@lunora/runtime 1.0.0-alpha.237 → 1.0.0-alpha.238

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 CHANGED
@@ -4903,28 +4903,49 @@ declare const SHARD_REGISTRY_DO_NAME: string;
4903
4903
  * take up to 30s to participate in fan-outs).
4904
4904
  */
4905
4905
  declare const DEFAULT_REGISTRY_CACHE_TTL_MS: number;
4906
+ /**
4907
+ * The registry as the worker that hosts it exposes it over RPC: the methods of the
4908
+ * host's `ShardRegistryEntrypoint`, reached through a service binding. The binding is
4909
+ * the capability, so a caller holding it needs no secret.
4910
+ */
4911
+ interface ShardRegistryRpc {
4912
+ listShardKeys: (table: string) => Promise<string[]>;
4913
+ register: (table: string, shardKey: string) => Promise<void>;
4914
+ snapshot: () => Promise<Record<string, string[]>>;
4915
+ unregister: (table: string, shardKey: string) => Promise<void>;
4916
+ }
4906
4917
  interface DynamicShardRegistryOptions {
4907
4918
  /**
4908
4919
  * Override the in-process per-table cache TTL. Set to `0` to disable
4909
- * caching (every `listShardKeys` call hits the DO — useful only for
4920
+ * caching (every `listShardKeys` call hits the registry — useful only for
4910
4921
  * tests).
4911
4922
  */
4912
4923
  cacheTtlMs?: number;
4924
+ /**
4925
+ * The worker's `env`, read for `LUNORA_RELAY_SECRET` when `namespace` is a Durable
4926
+ * Object namespace. Every request to the registry is signed with it and the registry
4927
+ * refuses any that is not. Not needed for a service binding, which needs no secret.
4928
+ */
4929
+ env?: unknown;
4913
4930
  /**
4914
4931
  * DO instance name. Defaults to {@link SHARD_REGISTRY_DO_NAME}. Override
4915
- * only if you run multiple isolated registries in one environment.
4932
+ * only if you run multiple isolated registries in one environment. Applies to a
4933
+ * Durable Object namespace only.
4916
4934
  */
4917
4935
  instanceName?: string;
4918
4936
  /**
4919
4937
  * Pin the registry DO to a Cloudflare data-residency jurisdiction. Pass the
4920
4938
  * same value as the worker's `jurisdiction` so the registry co-locates with
4921
- * the shards it tracks. Omit for the un-pinned global namespace.
4939
+ * the shards it tracks. Omit for the un-pinned global namespace. Applies to a
4940
+ * Durable Object namespace only.
4922
4941
  */
4923
4942
  jurisdiction?: DurableObjectJurisdiction;
4924
- /** DO namespace binding (`env.SHARD_REGISTRY`). */
4925
- namespace: ShardNamespaceLike;
4926
- /** The registry's `SHARD_REGISTRY_DO_SECRET`, sent on every request; omit when none is provisioned. */
4927
- secret?: string;
4943
+ /**
4944
+ * The registry: `env.SHARD_REGISTRY` as a Durable Object namespace when this worker
4945
+ * hosts the registry, or as a service binding to the host's `ShardRegistryEntrypoint`
4946
+ * when another worker hosts it.
4947
+ */
4948
+ namespace: ShardNamespaceLike | ShardRegistryRpc;
4928
4949
  }
4929
4950
  /**
4930
4951
  * Extension of {@link ShardRegistry} with the mutator surface a worker
@@ -5679,4 +5700,4 @@ export { type AccessContextLike, type AccessIdentityLike, type AdminTableResolve
5679
5700
  * surface — without a name for it, a caller cannot hoist a shared attribute bag
5680
5701
  * into a typed constant.
5681
5702
  */
5682
- 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 PrunedBackups, type QueryCoordinator, type QueryCoordinatorOptions, type QueueForwardBatch, type QueueForwardHandler, type QueueForwardMessage, type QueueForwardResult, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ReportedError, 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, STORAGE_UPLOAD_MAX_BODY_BYTES, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type ShardCallArgs, type ShardCallOptions, type ShardCallReturn, type ShardCaller, type ShardCallerIdentity, type ShardClient, type ShardClientOptions, type ShardError, type ShardExportOutcome, type ShardFunctionReference, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceInput, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SinkEnricher, type SinkEvent, type SinkRouteOptions, type SinkSignalKind, type SpanEvent, type StackFrame, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, type TraceTrustSignal, type TriggerTrace, type TrustInboundTraceContext, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, applyRestCache, argsFromQuery, backupManifestKey, backupObjectKey, backupObjectKeyOfManifest, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createShardClient, createStaticShardRegistry, createWorker, d1Probe, declareAppJurisdiction, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, enrichSink, filterSink, handleCorsPreflight, isBackupManifestEntry, isBackupManifestKey, memoizeIdentity, memoizeIdentityPerRequest, normalizeBackupPrefix, otlpSink, parseStackFrames, pipelineLogSink, presenceProbe, r2Sink, requestCarriesCredentials, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restCacheHeaders, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, toAirbyteMessages, toError, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
5703
+ 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 PrunedBackups, type QueryCoordinator, type QueryCoordinatorOptions, type QueueForwardBatch, type QueueForwardHandler, type QueueForwardMessage, type QueueForwardResult, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ReportedError, 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, STORAGE_UPLOAD_MAX_BODY_BYTES, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type ShardCallArgs, type ShardCallOptions, type ShardCallReturn, type ShardCaller, type ShardCallerIdentity, type ShardClient, type ShardClientOptions, type ShardError, type ShardExportOutcome, type ShardFunctionReference, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceInput, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardRegistryRpc, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SinkEnricher, type SinkEvent, type SinkRouteOptions, type SinkSignalKind, type SpanEvent, type StackFrame, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, type TraceTrustSignal, type TriggerTrace, type TrustInboundTraceContext, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, applyRestCache, argsFromQuery, backupManifestKey, backupObjectKey, backupObjectKeyOfManifest, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createShardClient, createStaticShardRegistry, createWorker, d1Probe, declareAppJurisdiction, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, enrichSink, filterSink, handleCorsPreflight, isBackupManifestEntry, isBackupManifestKey, memoizeIdentity, memoizeIdentityPerRequest, normalizeBackupPrefix, otlpSink, parseStackFrames, pipelineLogSink, presenceProbe, r2Sink, requestCarriesCredentials, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restCacheHeaders, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, toAirbyteMessages, toError, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
package/dist/index.d.ts CHANGED
@@ -4903,28 +4903,49 @@ declare const SHARD_REGISTRY_DO_NAME: string;
4903
4903
  * take up to 30s to participate in fan-outs).
4904
4904
  */
4905
4905
  declare const DEFAULT_REGISTRY_CACHE_TTL_MS: number;
4906
+ /**
4907
+ * The registry as the worker that hosts it exposes it over RPC: the methods of the
4908
+ * host's `ShardRegistryEntrypoint`, reached through a service binding. The binding is
4909
+ * the capability, so a caller holding it needs no secret.
4910
+ */
4911
+ interface ShardRegistryRpc {
4912
+ listShardKeys: (table: string) => Promise<string[]>;
4913
+ register: (table: string, shardKey: string) => Promise<void>;
4914
+ snapshot: () => Promise<Record<string, string[]>>;
4915
+ unregister: (table: string, shardKey: string) => Promise<void>;
4916
+ }
4906
4917
  interface DynamicShardRegistryOptions {
4907
4918
  /**
4908
4919
  * Override the in-process per-table cache TTL. Set to `0` to disable
4909
- * caching (every `listShardKeys` call hits the DO — useful only for
4920
+ * caching (every `listShardKeys` call hits the registry — useful only for
4910
4921
  * tests).
4911
4922
  */
4912
4923
  cacheTtlMs?: number;
4924
+ /**
4925
+ * The worker's `env`, read for `LUNORA_RELAY_SECRET` when `namespace` is a Durable
4926
+ * Object namespace. Every request to the registry is signed with it and the registry
4927
+ * refuses any that is not. Not needed for a service binding, which needs no secret.
4928
+ */
4929
+ env?: unknown;
4913
4930
  /**
4914
4931
  * DO instance name. Defaults to {@link SHARD_REGISTRY_DO_NAME}. Override
4915
- * only if you run multiple isolated registries in one environment.
4932
+ * only if you run multiple isolated registries in one environment. Applies to a
4933
+ * Durable Object namespace only.
4916
4934
  */
4917
4935
  instanceName?: string;
4918
4936
  /**
4919
4937
  * Pin the registry DO to a Cloudflare data-residency jurisdiction. Pass the
4920
4938
  * same value as the worker's `jurisdiction` so the registry co-locates with
4921
- * the shards it tracks. Omit for the un-pinned global namespace.
4939
+ * the shards it tracks. Omit for the un-pinned global namespace. Applies to a
4940
+ * Durable Object namespace only.
4922
4941
  */
4923
4942
  jurisdiction?: DurableObjectJurisdiction;
4924
- /** DO namespace binding (`env.SHARD_REGISTRY`). */
4925
- namespace: ShardNamespaceLike;
4926
- /** The registry's `SHARD_REGISTRY_DO_SECRET`, sent on every request; omit when none is provisioned. */
4927
- secret?: string;
4943
+ /**
4944
+ * The registry: `env.SHARD_REGISTRY` as a Durable Object namespace when this worker
4945
+ * hosts the registry, or as a service binding to the host's `ShardRegistryEntrypoint`
4946
+ * when another worker hosts it.
4947
+ */
4948
+ namespace: ShardNamespaceLike | ShardRegistryRpc;
4928
4949
  }
4929
4950
  /**
4930
4951
  * Extension of {@link ShardRegistry} with the mutator surface a worker
@@ -5679,4 +5700,4 @@ export { type AccessContextLike, type AccessIdentityLike, type AdminTableResolve
5679
5700
  * surface — without a name for it, a caller cannot hoist a shared attribute bag
5680
5701
  * into a typed constant.
5681
5702
  */
5682
- 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 PrunedBackups, type QueryCoordinator, type QueryCoordinatorOptions, type QueueForwardBatch, type QueueForwardHandler, type QueueForwardMessage, type QueueForwardResult, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ReportedError, 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, STORAGE_UPLOAD_MAX_BODY_BYTES, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type ShardCallArgs, type ShardCallOptions, type ShardCallReturn, type ShardCaller, type ShardCallerIdentity, type ShardClient, type ShardClientOptions, type ShardError, type ShardExportOutcome, type ShardFunctionReference, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceInput, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SinkEnricher, type SinkEvent, type SinkRouteOptions, type SinkSignalKind, type SpanEvent, type StackFrame, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, type TraceTrustSignal, type TriggerTrace, type TrustInboundTraceContext, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, applyRestCache, argsFromQuery, backupManifestKey, backupObjectKey, backupObjectKeyOfManifest, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createShardClient, createStaticShardRegistry, createWorker, d1Probe, declareAppJurisdiction, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, enrichSink, filterSink, handleCorsPreflight, isBackupManifestEntry, isBackupManifestKey, memoizeIdentity, memoizeIdentityPerRequest, normalizeBackupPrefix, otlpSink, parseStackFrames, pipelineLogSink, presenceProbe, r2Sink, requestCarriesCredentials, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restCacheHeaders, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, toAirbyteMessages, toError, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
5703
+ 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 PrunedBackups, type QueryCoordinator, type QueryCoordinatorOptions, type QueueForwardBatch, type QueueForwardHandler, type QueueForwardMessage, type QueueForwardResult, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ReportedError, 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, STORAGE_UPLOAD_MAX_BODY_BYTES, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type ShardCallArgs, type ShardCallOptions, type ShardCallReturn, type ShardCaller, type ShardCallerIdentity, type ShardClient, type ShardClientOptions, type ShardError, type ShardExportOutcome, type ShardFunctionReference, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceInput, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardRegistryRpc, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SinkEnricher, type SinkEvent, type SinkRouteOptions, type SinkSignalKind, type SpanEvent, type StackFrame, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, type TraceTrustSignal, type TriggerTrace, type TrustInboundTraceContext, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, applyRestCache, argsFromQuery, backupManifestKey, backupObjectKey, backupObjectKeyOfManifest, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createShardClient, createStaticShardRegistry, createWorker, d1Probe, declareAppJurisdiction, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, enrichSink, filterSink, handleCorsPreflight, isBackupManifestEntry, isBackupManifestKey, memoizeIdentity, memoizeIdentityPerRequest, normalizeBackupPrefix, otlpSink, parseStackFrames, pipelineLogSink, presenceProbe, r2Sink, requestCarriesCredentials, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restCacheHeaders, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, toAirbyteMessages, toError, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{declareAppJurisdiction as t}from"./packem_shared/declareAppJurisdiction-DEba2p42.mjs";import{BACKUP_KEY_PREFIX as s,backupManifestKey as i,backupObjectKey as p,backupObjectKeyOfManifest as n,isBackupManifestEntry as c,isBackupManifestKey as m,normalizeBackupPrefix as f}from"./packem_shared/BACKUP_KEY_PREFIX-BOtSu-_3.mjs";import{toAirbyteMessages as x,toFivetranResponse as R}from"./packem_shared/toAirbyteMessages-DY0vsuEn.mjs";import{composeWorker as l,createLunoraHandler as d,createWorker as u,defineRpcEnvelope as _,resolveLunoraOptions as k,withFrameworkWorker as b}from"./packem_shared/composeWorker-Dycssvhe.mjs";import{createCrossShardRelationCapabilities as C}from"./packem_shared/createCrossShardRelationCapabilities-C8lpyW1a.mjs";import{DEFAULT_REGISTRY_CACHE_TTL_MS as A,SHARD_REGISTRY_DO_NAME as L,createDynamicShardRegistry as T}from"./packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-CLskZt-Q.mjs";import{parseStackFrames as H,toError as P}from"./packem_shared/parseStackFrames-CZddjveh.mjs";import{LunoraError as v,toErrorResponse as I}from"./packem_shared/LunoraError-PkZWF-_g.mjs";import{c as F,a as M,d as N,r as G,b as K,s as U,w}from"./packem_shared/export-tap-C2B_SATf.mjs";import{HEALTH_PATH as Y,HEALTH_READY_PATH as z,buildHealthRoutes as X,d1Probe as j,durableObjectProbe as V,presenceProbe as W}from"./packem_shared/HEALTH_PATH-B8ndDG3s.mjs";import{LOG_ARCHIVE_PATH as J,resolveLogArchiveFromEnv as Q}from"./packem_shared/LOG_ARCHIVE_PATH-dTuCzfyj.mjs";import{memoizeIdentity as $,memoizeIdentityPerRequest as ee}from"./packem_shared/memoizeIdentity-BNnHkqeF.mjs";import{e as oe,a as te}from"./packem_shared/observability-9slk__Gi.mjs";import{enrichSink as se,filterSink as ie}from"./packem_shared/enrichSink-44NOapaE.mjs";import{a as ne,c as ce,b as me,o as fe,p as Ee,w as xe}from"./packem_shared/observability-sinks-lLKqc_rV.mjs";import{D as Se,c as le}from"./packem_shared/pipeline-log-reader-C-nuWG_e.mjs";import{createQueryCoordinator as ue,createStaticShardRegistry as _e}from"./packem_shared/createQueryCoordinator-Bt6xVTQn.mjs";import{applyJurisdiction as be,resolveShard as ye}from"./packem_shared/applyJurisdiction-DKQE8kOA.mjs";import{a as Oe,r as Ae,b as Le}from"./packem_shared/rest-cache-CmHN871W.mjs";import{a as he,b as He,c as Pe,r as ge}from"./packem_shared/rest-routes-CDQ1F7kI.mjs";import{decorateResponse as Ie,enforceOrigin as De,handleCorsPreflight as Fe,resolveSecurity as Me}from"./packem_shared/decorateResponse-CdelJSUs.mjs";import{createShardClient as Ge}from"./packem_shared/createShardClient-BlcK9Nok.mjs";import{STORAGE_UPLOAD_MAX_BODY_BYTES as Ue}from"./packem_shared/STORAGE_UPLOAD_MAX_BODY_BYTES-DiZho96u.mjs";import{LOG_ARCHIVE_NOT_CONFIGURED as Be}from"./packem_shared/LOG_ARCHIVE_NOT_CONFIGURED-CDpi4yFD.mjs";import{NOOP_EXECUTION_CONTEXT as ze}from"./packem_shared/NOOP_EXECUTION_CONTEXT-YmXqH-jH.mjs";import{composeIdentityResolvers as je,routeIdentityResolvers as Ve}from"./packem_shared/composeIdentityResolvers-CpdHuDyk.mjs";const e="0.0.0";export{s as BACKUP_KEY_PREFIX,Se as DEFAULT_LOG_COLUMNS,A as DEFAULT_REGISTRY_CACHE_TTL_MS,Y as HEALTH_PATH,z as HEALTH_READY_PATH,Be as LOG_ARCHIVE_NOT_CONFIGURED,J as LOG_ARCHIVE_PATH,v as LunoraError,ze as NOOP_EXECUTION_CONTEXT,L as SHARD_REGISTRY_DO_NAME,Ue as STORAGE_UPLOAD_MAX_BODY_BYTES,e as VERSION,ne as analyticsEngineSink,be as applyJurisdiction,Oe as applyRestCache,he as argsFromQuery,i as backupManifestKey,p as backupObjectKey,n as backupObjectKeyOfManifest,X as buildHealthRoutes,He as buildRestRoutes,ce as combineSinks,je as composeIdentityResolvers,l as composeWorker,me as consoleSink,C as createCrossShardRelationCapabilities,T as createDynamicShardRegistry,F as createKvCursorStore,d as createLunoraHandler,M as createMemoryCursorStore,le as createPipelineLogReader,ue as createQueryCoordinator,Pe as createRestRateLimit,Ge as createShardClient,_e as createStaticShardRegistry,u as createWorker,j as d1Probe,t as declareAppJurisdiction,Ie as decorateResponse,N as defineExportSink,_ as defineRpcEnvelope,V as durableObjectProbe,oe as emitLogEvent,te as emitRpcEvent,De as enforceOrigin,se as enrichSink,ie as filterSink,Fe as handleCorsPreflight,c as isBackupManifestEntry,m as isBackupManifestKey,$ as memoizeIdentity,ee as memoizeIdentityPerRequest,f as normalizeBackupPrefix,fe as otlpSink,H as parseStackFrames,Ee as pipelineLogSink,W as presenceProbe,G as r2Sink,Ae as requestCarriesCredentials,Q as resolveLogArchiveFromEnv,k as resolveLunoraOptions,Me as resolveSecurity,ye as resolveShard,Le as restCacheHeaders,ge as restSurfaceFromRegistry,Ve as routeIdentityResolvers,K as runExportTap,U as sanitizeChange,x as toAirbyteMessages,P as toError,I as toErrorResponse,R as toFivetranResponse,w as webhookExportSink,xe as webhookSink,b as withFrameworkWorker};
1
+ import{declareAppJurisdiction as t}from"./packem_shared/declareAppJurisdiction-DEba2p42.mjs";import{BACKUP_KEY_PREFIX as s,backupManifestKey as i,backupObjectKey as p,backupObjectKeyOfManifest as n,isBackupManifestEntry as c,isBackupManifestKey as m,normalizeBackupPrefix as f}from"./packem_shared/BACKUP_KEY_PREFIX-BOtSu-_3.mjs";import{toAirbyteMessages as x,toFivetranResponse as R}from"./packem_shared/toAirbyteMessages-DY0vsuEn.mjs";import{composeWorker as l,createLunoraHandler as d,createWorker as u,defineRpcEnvelope as _,resolveLunoraOptions as k,withFrameworkWorker as b}from"./packem_shared/composeWorker-Dycssvhe.mjs";import{createCrossShardRelationCapabilities as C}from"./packem_shared/createCrossShardRelationCapabilities-C8lpyW1a.mjs";import{DEFAULT_REGISTRY_CACHE_TTL_MS as A,SHARD_REGISTRY_DO_NAME as L,createDynamicShardRegistry as T}from"./packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-w_RLPiwj.mjs";import{parseStackFrames as H,toError as P}from"./packem_shared/parseStackFrames-CZddjveh.mjs";import{LunoraError as v,toErrorResponse as I}from"./packem_shared/LunoraError-PkZWF-_g.mjs";import{c as F,a as M,d as N,r as G,b as K,s as U,w}from"./packem_shared/export-tap-C2B_SATf.mjs";import{HEALTH_PATH as Y,HEALTH_READY_PATH as z,buildHealthRoutes as X,d1Probe as j,durableObjectProbe as V,presenceProbe as W}from"./packem_shared/HEALTH_PATH-B8ndDG3s.mjs";import{LOG_ARCHIVE_PATH as J,resolveLogArchiveFromEnv as Q}from"./packem_shared/LOG_ARCHIVE_PATH-dTuCzfyj.mjs";import{memoizeIdentity as $,memoizeIdentityPerRequest as ee}from"./packem_shared/memoizeIdentity-BNnHkqeF.mjs";import{e as oe,a as te}from"./packem_shared/observability-9slk__Gi.mjs";import{enrichSink as se,filterSink as ie}from"./packem_shared/enrichSink-44NOapaE.mjs";import{a as ne,c as ce,b as me,o as fe,p as Ee,w as xe}from"./packem_shared/observability-sinks-lLKqc_rV.mjs";import{D as Se,c as le}from"./packem_shared/pipeline-log-reader-C-nuWG_e.mjs";import{createQueryCoordinator as ue,createStaticShardRegistry as _e}from"./packem_shared/createQueryCoordinator-Bt6xVTQn.mjs";import{applyJurisdiction as be,resolveShard as ye}from"./packem_shared/applyJurisdiction-DKQE8kOA.mjs";import{a as Oe,r as Ae,b as Le}from"./packem_shared/rest-cache-CmHN871W.mjs";import{a as he,b as He,c as Pe,r as ge}from"./packem_shared/rest-routes-CDQ1F7kI.mjs";import{decorateResponse as Ie,enforceOrigin as De,handleCorsPreflight as Fe,resolveSecurity as Me}from"./packem_shared/decorateResponse-CdelJSUs.mjs";import{createShardClient as Ge}from"./packem_shared/createShardClient-BlcK9Nok.mjs";import{STORAGE_UPLOAD_MAX_BODY_BYTES as Ue}from"./packem_shared/STORAGE_UPLOAD_MAX_BODY_BYTES-DiZho96u.mjs";import{LOG_ARCHIVE_NOT_CONFIGURED as Be}from"./packem_shared/LOG_ARCHIVE_NOT_CONFIGURED-CDpi4yFD.mjs";import{NOOP_EXECUTION_CONTEXT as ze}from"./packem_shared/NOOP_EXECUTION_CONTEXT-YmXqH-jH.mjs";import{composeIdentityResolvers as je,routeIdentityResolvers as Ve}from"./packem_shared/composeIdentityResolvers-CpdHuDyk.mjs";const e="0.0.0";export{s as BACKUP_KEY_PREFIX,Se as DEFAULT_LOG_COLUMNS,A as DEFAULT_REGISTRY_CACHE_TTL_MS,Y as HEALTH_PATH,z as HEALTH_READY_PATH,Be as LOG_ARCHIVE_NOT_CONFIGURED,J as LOG_ARCHIVE_PATH,v as LunoraError,ze as NOOP_EXECUTION_CONTEXT,L as SHARD_REGISTRY_DO_NAME,Ue as STORAGE_UPLOAD_MAX_BODY_BYTES,e as VERSION,ne as analyticsEngineSink,be as applyJurisdiction,Oe as applyRestCache,he as argsFromQuery,i as backupManifestKey,p as backupObjectKey,n as backupObjectKeyOfManifest,X as buildHealthRoutes,He as buildRestRoutes,ce as combineSinks,je as composeIdentityResolvers,l as composeWorker,me as consoleSink,C as createCrossShardRelationCapabilities,T as createDynamicShardRegistry,F as createKvCursorStore,d as createLunoraHandler,M as createMemoryCursorStore,le as createPipelineLogReader,ue as createQueryCoordinator,Pe as createRestRateLimit,Ge as createShardClient,_e as createStaticShardRegistry,u as createWorker,j as d1Probe,t as declareAppJurisdiction,Ie as decorateResponse,N as defineExportSink,_ as defineRpcEnvelope,V as durableObjectProbe,oe as emitLogEvent,te as emitRpcEvent,De as enforceOrigin,se as enrichSink,ie as filterSink,Fe as handleCorsPreflight,c as isBackupManifestEntry,m as isBackupManifestKey,$ as memoizeIdentity,ee as memoizeIdentityPerRequest,f as normalizeBackupPrefix,fe as otlpSink,H as parseStackFrames,Ee as pipelineLogSink,W as presenceProbe,G as r2Sink,Ae as requestCarriesCredentials,Q as resolveLogArchiveFromEnv,k as resolveLunoraOptions,Me as resolveSecurity,ye as resolveShard,Le as restCacheHeaders,ge as restSurfaceFromRegistry,Ve as routeIdentityResolvers,K as runExportTap,U as sanitizeChange,x as toAirbyteMessages,P as toError,I as toErrorResponse,R as toFivetranResponse,w as webhookExportSink,xe as webhookSink,b as withFrameworkWorker};
@@ -0,0 +1,2 @@
1
+ import{siblingSecretOf as f,RELAY_SIGNATURE_HEADER as l,signSiblingBody as R}from"@lunora/shard-engine";import{LunoraError as g}from"./LunoraError-PkZWF-_g.mjs";import{applyJurisdiction as m,resolveShard as S}from"./applyJurisdiction-DKQE8kOA.mjs";const _=(e,i,a)=>{const{pathname:c,search:o}=new URL(i);return`${e.toUpperCase()} ${c}${o}
2
+ ${a}`},E="__lunora_shard_registry__",A=3e4,T="https://shard-registry.internal",$=e=>typeof e.register!="function"&&"idFromName"in e&&typeof e.idFromName=="function",w=async e=>await e.json(),N=e=>{const i=e.instanceName??E,a=m(e.namespace,e.jurisdiction),c=()=>S(a,i),o=async(t,r,n)=>{const y=f(e.env);if(y===void 0)throw new g("the shard registry requires LUNORA_RELAY_SECRET; set it on the worker and every Durable Object",{code:"RELAY_MISCONFIGURED"});const h=`${T}${r}`,u=n===void 0?void 0:JSON.stringify(n),p={[l]:await R(y,_(t,h,u??""))};return u!==void 0&&(p["content-type"]="application/json"),c().fetch(new Request(h,{body:u,headers:p,method:t}))},s=async(t,r)=>o("POST",t,r),d=async t=>o("GET",t);return{async list(t){const r=await d(`/list?table=${encodeURIComponent(t)}`);if(!r.ok)throw new g(`shard registry /list returned ${String(r.status)}`);const{shardKeys:n}=await w(r);return n},async register(t,r){const n=await s("/register",{shardKey:r,table:t});if(!n.ok)throw new g(`shard registry /register returned ${String(n.status)}`)},async snapshot(){const t=await d("/snapshot");if(!t.ok)throw new g(`shard registry /snapshot returned ${String(t.status)}`);const{tables:r}=await w(t);return r},async unregister(t,r){const n=await s("/unregister",{shardKey:r,table:t});if(!n.ok)throw new g(`shard registry /unregister returned ${String(n.status)}`)}}},v=e=>({list:async i=>e.listShardKeys(i),register:async(i,a)=>e.register(i,a),snapshot:async()=>e.snapshot(),unregister:async(i,a)=>e.unregister(i,a)}),U=e=>{const i=e.cacheTtlMs??A,a=new Map,c=new Map,o=$(e.namespace)?N({...e,namespace:e.namespace}):v(e.namespace);return{invalidate(s){s===void 0?(a.clear(),c.clear()):(a.delete(s),c.delete(s))},async listShardKeys(s){const d=Date.now(),t=a.get(s);if(t&&t.expiresAt>d)return t.shardKeys;const r=c.get(s);if(r)return r;const n=o.list(s);i>0&&c.set(s,n);try{const y=await n;return i>0&&c.get(s)===n&&a.set(s,{expiresAt:d+i,shardKeys:y}),y}finally{c.get(s)===n&&c.delete(s)}},async register(s,d){await o.register(s,d),a.delete(s),c.delete(s)},async snapshot(){return o.snapshot()},async unregister(s,d){await o.unregister(s,d),a.delete(s),c.delete(s)}}};export{A as DEFAULT_REGISTRY_CACHE_TTL_MS,E as SHARD_REGISTRY_DO_NAME,U as createDynamicShardRegistry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/runtime",
3
- "version": "1.0.0-alpha.237",
3
+ "version": "1.0.0-alpha.238",
4
4
  "description": "Lunora Worker runtime: the RPC router, shard resolver, and query coordinator",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,14 +46,14 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/bindings": "1.0.0-alpha.133",
49
+ "@lunora/bindings": "1.0.0-alpha.134",
50
50
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
51
- "@lunora/observability": "1.0.0-alpha.169",
52
- "@lunora/platform": "1.0.0-alpha.74",
51
+ "@lunora/observability": "1.0.0-alpha.170",
52
+ "@lunora/platform": "1.0.0-alpha.75",
53
53
  "@lunora/wire": "1.0.0-alpha.2"
54
54
  },
55
55
  "peerDependencies": {
56
- "@lunora/shard-engine": ">=1.0.0-alpha.24 <2.0.0-0",
56
+ "@lunora/shard-engine": ">=1.0.0-alpha.135 <2.0.0-0",
57
57
  "@lunora/workflow": ">=1.0.0-alpha.24 <2.0.0-0"
58
58
  },
59
59
  "engines": {
@@ -1 +0,0 @@
1
- import{LunoraError as i}from"./LunoraError-PkZWF-_g.mjs";import{applyJurisdiction as l,resolveShard as E}from"./applyJurisdiction-DKQE8kOA.mjs";const m="x-lunora-shard-registry-do-secret",T="__lunora_shard_registry__",A=3e4,p="https://shard-registry.internal",S=async n=>await n.json(),M=n=>{const _=n.instanceName??T,d=n.cacheTtlMs??A,a=new Map,s=new Map,R=l(n.namespace,n.jurisdiction),h=n.secret?{[m]:n.secret}:{},y=()=>E(R,_),g=async(e,t)=>y().fetch(new Request(`${p}${e}`,{body:JSON.stringify(t),headers:{"content-type":"application/json",...h},method:"POST"})),u=async e=>y().fetch(new Request(`${p}${e}`,{headers:h,method:"GET"}));return{invalidate(e){e===void 0?(a.clear(),s.clear()):(a.delete(e),s.delete(e))},async listShardKeys(e){const t=Date.now(),r=a.get(e);if(r&&r.expiresAt>t)return r.shardKeys;const w=s.get(e);if(w)return w;const o=(async()=>{const c=await u(`/list?table=${encodeURIComponent(e)}`);if(!c.ok)throw new i(`shard registry /list returned ${String(c.status)}`);const{shardKeys:f}=await S(c);return f})();d>0&&s.set(e,o);try{const c=await o;return d>0&&s.get(e)===o&&a.set(e,{expiresAt:t+d,shardKeys:c}),c}finally{s.get(e)===o&&s.delete(e)}},async register(e,t){const r=await g("/register",{shardKey:t,table:e});if(!r.ok)throw new i(`shard registry /register returned ${String(r.status)}`);a.delete(e),s.delete(e)},async snapshot(){const e=await u("/snapshot");if(!e.ok)throw new i(`shard registry /snapshot returned ${String(e.status)}`);const{tables:t}=await S(e);return t},async unregister(e,t){const r=await g("/unregister",{shardKey:t,table:e});if(!r.ok)throw new i(`shard registry /unregister returned ${String(r.status)}`);a.delete(e),s.delete(e)}}};export{A as DEFAULT_REGISTRY_CACHE_TTL_MS,T as SHARD_REGISTRY_DO_NAME,M as createDynamicShardRegistry};