@lunora/do 1.0.0-alpha.244 → 1.0.0-alpha.246

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
@@ -5405,10 +5405,16 @@ declare abstract class ShardDO {
5405
5405
  * registers AFTER the unregister, not before it.
5406
5406
  */
5407
5407
  private serializeRegistry;
5408
- /** The `SHARD_REGISTRY_DO_SECRET` the registry requires of its callers, when one is provisioned. */
5409
- private registrySecret;
5410
5408
  /** The registry stub, pinned to this DO's own jurisdiction — the subnamespace the worker pins the registry it reads. */
5411
5409
  private registryStub;
5410
+ /**
5411
+ * Where this shard's registry writes go. A Durable Object namespace is this app's own
5412
+ * registry: signed directly with this worker's secret. Anything else is the RPC surface of
5413
+ * the worker that hosts the registry, reached through its service binding, so the binding
5414
+ * itself is the capability and no secret is needed. `undefined` when a namespace is not in
5415
+ * this shard's jurisdiction.
5416
+ */
5417
+ private registryWriter;
5412
5418
  /**
5413
5419
  * Tell the shard registry this shard holds rows of each `.shardBy()` table
5414
5420
  * the flushed write touched, once per table per instance. The cross-shard
@@ -6774,9 +6780,10 @@ interface ShardRegistryDOState {
6774
6780
  }
6775
6781
  /**
6776
6782
  * Concrete (not abstract) DO class. Apps register this binding in their
6777
- * `wrangler.jsonc` as `SHARD_REGISTRY` (or any name) — no subclassing
6778
- * required. The runtime's `createDynamicShardRegistry` takes the namespace
6779
- * binding and the conventional instance name and produces a `ShardRegistry`.
6783
+ * `wrangler.jsonc` as `SHARD_REGISTRY` — the name the hosted entrypoint and
6784
+ * binding inference both read — with no subclassing required. The runtime's
6785
+ * `createDynamicShardRegistry` takes the namespace binding and the conventional
6786
+ * instance name and produces a `ShardRegistry`.
6780
6787
  */
6781
6788
  declare class ShardRegistryDO {
6782
6789
  protected env: unknown;
@@ -6798,6 +6805,15 @@ declare class ShardRegistryDO {
6798
6805
  private loaded;
6799
6806
  constructor(state: ShardRegistryDOState, env: unknown);
6800
6807
  fetch(request: Request): Promise<Response>;
6808
+ /**
6809
+ * Refuse a request that cannot be signed, before its body is read: a DO without
6810
+ * `LUNORA_RELAY_SECRET`, or a request without a signature header. `verifySiblingBody`
6811
+ * alone passes an unconfigured DO (the relay channel's legacy network-trust), which
6812
+ * is the hole this closes, so a missing secret is its own refusal.
6813
+ */
6814
+ private refuseUnsigned;
6815
+ /** Refuse a request whose signature does not cover its body, once the body has been read. */
6816
+ private refuseBadSignature;
6801
6817
  /**
6802
6818
  * Load the persisted entries exactly once. `blockConcurrencyWhile`
6803
6819
  * suspends concurrent fetch dispatches on this DO until the load
@@ -6816,6 +6832,24 @@ declare class ShardRegistryDO {
6816
6832
  /** The in-memory map as a JSON-safe `table → [keys]` object, for `/snapshot`. */
6817
6833
  private serializeTables;
6818
6834
  }
6835
+ /**
6836
+ * The registry's read and write surface, as a worker calls it. Each method is an
6837
+ * RPC on the worker that hosts the registry, so a caller that holds only that
6838
+ * worker's service binding needs no secret.
6839
+ */
6840
+ interface ShardRegistryRpc {
6841
+ listShardKeys: (table: string) => Promise<string[]>;
6842
+ register: (table: string, shardKey: string) => Promise<void>;
6843
+ snapshot: () => Promise<Record<string, string[]>>;
6844
+ unregister: (table: string, shardKey: string) => Promise<void>;
6845
+ }
6846
+ /**
6847
+ * The registry, as the host worker calls its own Durable Object namespace. The
6848
+ * generated `ShardRegistryEntrypoint` delegates to this: its methods are the RPC
6849
+ * surface a client worker reaches through a service binding. Signed with
6850
+ * `LUNORA_RELAY_SECRET`, which only the host holds.
6851
+ */
6852
+ declare const hostedShardRegistry: (env: unknown, jurisdiction?: string) => ShardRegistryRpc;
6819
6853
  /**
6820
6854
  * The `ctx.newId` for one handler run. Each call returns the next id in the run's
6821
6855
  * sequence, so the ORDER of `ctx.newId()` calls is part of the contract.
@@ -6839,4 +6873,4 @@ declare const createStableIdFactory: (mutationId: string | undefined, scope: str
6839
6873
  * @param scope the same scope string {@link createStableIdFactory} takes.
6840
6874
  */
6841
6875
  declare const createStableRandomFactory: (mutationId: string | undefined, scope: string) => (() => number);
6842
- export { type DeliveryAuthorization, type DeliveryAuthorizationRequest, type DeliveryPermit, type DispatchBookmark, type DurableObjectHandlers, type HibernatableWebSocket, MERGED_ROLES, type MergedDurableObject, type MergedRole, type MergedRoles, type QueryReadScope, ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, type RoleClass, type RoleNamespaceTarget, type RunShardApplyCdcArgs, type RunShardApplyCdcResult, type RunShardBulkRowArgs, type RunShardBulkRowResult, type RunShardExportArgs, type RunShardFindRelatedArgs, type RunShardImportArgs, type RunShardMigrationArgs, type RunShardRankBeforeArgs, type RunShardRankPageArgs, type RunShardWriteArgs, type RunShardWriteResult, SESSION_DO_TTL_DEFAULT, SHARD_REGISTRY_DO_NAME, type SensitiveScope, SessionDO, type SessionRecord, ShardDO, type ShardDOOptions, type ShardDOState, ShardRegistryDO, type SubscriptionOutcome, type TelemetrySink, type TraceRefLike, createStableIdFactory, createStableRandomFactory, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
6876
+ export { type DeliveryAuthorization, type DeliveryAuthorizationRequest, type DeliveryPermit, type DispatchBookmark, type DurableObjectHandlers, type HibernatableWebSocket, MERGED_ROLES, type MergedDurableObject, type MergedRole, type MergedRoles, type QueryReadScope, ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, type RoleClass, type RoleNamespaceTarget, type RunShardApplyCdcArgs, type RunShardApplyCdcResult, type RunShardBulkRowArgs, type RunShardBulkRowResult, type RunShardExportArgs, type RunShardFindRelatedArgs, type RunShardImportArgs, type RunShardMigrationArgs, type RunShardRankBeforeArgs, type RunShardRankPageArgs, type RunShardWriteArgs, type RunShardWriteResult, SESSION_DO_TTL_DEFAULT, SHARD_REGISTRY_DO_NAME, type SensitiveScope, SessionDO, type SessionRecord, ShardDO, type ShardDOOptions, type ShardDOState, ShardRegistryDO, type ShardRegistryRpc, type SubscriptionOutcome, type TelemetrySink, type TraceRefLike, createStableIdFactory, createStableRandomFactory, hostedShardRegistry, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
package/dist/index.d.ts CHANGED
@@ -5405,10 +5405,16 @@ declare abstract class ShardDO {
5405
5405
  * registers AFTER the unregister, not before it.
5406
5406
  */
5407
5407
  private serializeRegistry;
5408
- /** The `SHARD_REGISTRY_DO_SECRET` the registry requires of its callers, when one is provisioned. */
5409
- private registrySecret;
5410
5408
  /** The registry stub, pinned to this DO's own jurisdiction — the subnamespace the worker pins the registry it reads. */
5411
5409
  private registryStub;
5410
+ /**
5411
+ * Where this shard's registry writes go. A Durable Object namespace is this app's own
5412
+ * registry: signed directly with this worker's secret. Anything else is the RPC surface of
5413
+ * the worker that hosts the registry, reached through its service binding, so the binding
5414
+ * itself is the capability and no secret is needed. `undefined` when a namespace is not in
5415
+ * this shard's jurisdiction.
5416
+ */
5417
+ private registryWriter;
5412
5418
  /**
5413
5419
  * Tell the shard registry this shard holds rows of each `.shardBy()` table
5414
5420
  * the flushed write touched, once per table per instance. The cross-shard
@@ -6774,9 +6780,10 @@ interface ShardRegistryDOState {
6774
6780
  }
6775
6781
  /**
6776
6782
  * Concrete (not abstract) DO class. Apps register this binding in their
6777
- * `wrangler.jsonc` as `SHARD_REGISTRY` (or any name) — no subclassing
6778
- * required. The runtime's `createDynamicShardRegistry` takes the namespace
6779
- * binding and the conventional instance name and produces a `ShardRegistry`.
6783
+ * `wrangler.jsonc` as `SHARD_REGISTRY` — the name the hosted entrypoint and
6784
+ * binding inference both read — with no subclassing required. The runtime's
6785
+ * `createDynamicShardRegistry` takes the namespace binding and the conventional
6786
+ * instance name and produces a `ShardRegistry`.
6780
6787
  */
6781
6788
  declare class ShardRegistryDO {
6782
6789
  protected env: unknown;
@@ -6798,6 +6805,15 @@ declare class ShardRegistryDO {
6798
6805
  private loaded;
6799
6806
  constructor(state: ShardRegistryDOState, env: unknown);
6800
6807
  fetch(request: Request): Promise<Response>;
6808
+ /**
6809
+ * Refuse a request that cannot be signed, before its body is read: a DO without
6810
+ * `LUNORA_RELAY_SECRET`, or a request without a signature header. `verifySiblingBody`
6811
+ * alone passes an unconfigured DO (the relay channel's legacy network-trust), which
6812
+ * is the hole this closes, so a missing secret is its own refusal.
6813
+ */
6814
+ private refuseUnsigned;
6815
+ /** Refuse a request whose signature does not cover its body, once the body has been read. */
6816
+ private refuseBadSignature;
6801
6817
  /**
6802
6818
  * Load the persisted entries exactly once. `blockConcurrencyWhile`
6803
6819
  * suspends concurrent fetch dispatches on this DO until the load
@@ -6816,6 +6832,24 @@ declare class ShardRegistryDO {
6816
6832
  /** The in-memory map as a JSON-safe `table → [keys]` object, for `/snapshot`. */
6817
6833
  private serializeTables;
6818
6834
  }
6835
+ /**
6836
+ * The registry's read and write surface, as a worker calls it. Each method is an
6837
+ * RPC on the worker that hosts the registry, so a caller that holds only that
6838
+ * worker's service binding needs no secret.
6839
+ */
6840
+ interface ShardRegistryRpc {
6841
+ listShardKeys: (table: string) => Promise<string[]>;
6842
+ register: (table: string, shardKey: string) => Promise<void>;
6843
+ snapshot: () => Promise<Record<string, string[]>>;
6844
+ unregister: (table: string, shardKey: string) => Promise<void>;
6845
+ }
6846
+ /**
6847
+ * The registry, as the host worker calls its own Durable Object namespace. The
6848
+ * generated `ShardRegistryEntrypoint` delegates to this: its methods are the RPC
6849
+ * surface a client worker reaches through a service binding. Signed with
6850
+ * `LUNORA_RELAY_SECRET`, which only the host holds.
6851
+ */
6852
+ declare const hostedShardRegistry: (env: unknown, jurisdiction?: string) => ShardRegistryRpc;
6819
6853
  /**
6820
6854
  * The `ctx.newId` for one handler run. Each call returns the next id in the run's
6821
6855
  * sequence, so the ORDER of `ctx.newId()` calls is part of the contract.
@@ -6839,4 +6873,4 @@ declare const createStableIdFactory: (mutationId: string | undefined, scope: str
6839
6873
  * @param scope the same scope string {@link createStableIdFactory} takes.
6840
6874
  */
6841
6875
  declare const createStableRandomFactory: (mutationId: string | undefined, scope: string) => (() => number);
6842
- export { type DeliveryAuthorization, type DeliveryAuthorizationRequest, type DeliveryPermit, type DispatchBookmark, type DurableObjectHandlers, type HibernatableWebSocket, MERGED_ROLES, type MergedDurableObject, type MergedRole, type MergedRoles, type QueryReadScope, ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, type RoleClass, type RoleNamespaceTarget, type RunShardApplyCdcArgs, type RunShardApplyCdcResult, type RunShardBulkRowArgs, type RunShardBulkRowResult, type RunShardExportArgs, type RunShardFindRelatedArgs, type RunShardImportArgs, type RunShardMigrationArgs, type RunShardRankBeforeArgs, type RunShardRankPageArgs, type RunShardWriteArgs, type RunShardWriteResult, SESSION_DO_TTL_DEFAULT, SHARD_REGISTRY_DO_NAME, type SensitiveScope, SessionDO, type SessionRecord, ShardDO, type ShardDOOptions, type ShardDOState, ShardRegistryDO, type SubscriptionOutcome, type TelemetrySink, type TraceRefLike, createStableIdFactory, createStableRandomFactory, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
6876
+ export { type DeliveryAuthorization, type DeliveryAuthorizationRequest, type DeliveryPermit, type DispatchBookmark, type DurableObjectHandlers, type HibernatableWebSocket, MERGED_ROLES, type MergedDurableObject, type MergedRole, type MergedRoles, type QueryReadScope, ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, type RoleClass, type RoleNamespaceTarget, type RunShardApplyCdcArgs, type RunShardApplyCdcResult, type RunShardBulkRowArgs, type RunShardBulkRowResult, type RunShardExportArgs, type RunShardFindRelatedArgs, type RunShardImportArgs, type RunShardMigrationArgs, type RunShardRankBeforeArgs, type RunShardRankPageArgs, type RunShardWriteArgs, type RunShardWriteResult, SESSION_DO_TTL_DEFAULT, SHARD_REGISTRY_DO_NAME, type SensitiveScope, SessionDO, type SessionRecord, ShardDO, type ShardDOOptions, type ShardDOState, ShardRegistryDO, type ShardRegistryRpc, type SubscriptionOutcome, type TelemetrySink, type TraceRefLike, createStableIdFactory, createStableRandomFactory, hostedShardRegistry, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{installDeliveryFence as a}from"./packem_shared/installDeliveryFence-B6M9KOnb.mjs";import{MERGED_ROLES as t,mergeDurableObjects as c,roleNamespace as S}from"./packem_shared/MERGED_ROLES-C4RToZ16.mjs";import{serveRelationFanout as s}from"./packem_shared/serveRelationFanout-DcSjzAZv.mjs";import{SESSION_DO_TTL_DEFAULT as n,SessionDO as p}from"./packem_shared/SESSION_DO_TTL_DEFAULT-CyF6dsyR.mjs";import{ROOT_DO_SIZE_WARN_BYTES as d,ROOT_SHARD_NAME as m,ShardDO as D}from"./packem_shared/ROOT_DO_SIZE_WARN_BYTES-DLzMQc2f.mjs";import{S as O,a as h}from"./packem_shared/shard-registry-do-DVfOqeqi.mjs";import{createStableIdFactory as x,createStableRandomFactory as u}from"./packem_shared/createStableIdFactory-DPDT_chw.mjs";import{createShardAlarms as f,createShardDirectory as T,createShardHost as I,createShardKvStore as A,createShardPlatform as M,createSocketHost as g,createWorkerPlatform as y}from"@lunora/platform-cloudflare";import{REPROJECTION_MIGRATION_PREFIX as k,UNVOUCHABLE_DEP as F,applyCdcChanges as L,assertShapeShardable as C,backfillSearchIndexes as H,backfillVectorIndexes as P,buildReprojectionMigration as j,clearMemoryTables as v,countLegacyRows as U,createReadFootprint as w,createShardCtxDb as G,exportShardRows as B,importShardRows as V,isSourceDue as W,markUnvouchableReads as Y,pullExternalSourceIncrementalTick as J,pullExternalSourceTick as K,reprojectionMigrationId as X,reprojectionTables as Z,runDataMigration as q,runShardMigrations as z,subscriptionListDeltas as Q}from"@lunora/shard-engine";export{t as MERGED_ROLES,k as REPROJECTION_MIGRATION_PREFIX,d as ROOT_DO_SIZE_WARN_BYTES,m as ROOT_SHARD_NAME,n as SESSION_DO_TTL_DEFAULT,O as SHARD_REGISTRY_DO_NAME,p as SessionDO,D as ShardDO,h as ShardRegistryDO,F as UNVOUCHABLE_DEP,L as applyCdcChanges,C as assertShapeShardable,H as backfillSearchIndexes,P as backfillVectorIndexes,j as buildReprojectionMigration,v as clearMemoryTables,U as countLegacyRows,w as createReadFootprint,f as createShardAlarms,G as createShardCtxDb,T as createShardDirectory,I as createShardHost,A as createShardKvStore,M as createShardPlatform,g as createSocketHost,x as createStableIdFactory,u as createStableRandomFactory,y as createWorkerPlatform,B as exportShardRows,V as importShardRows,a as installDeliveryFence,W as isSourceDue,Y as markUnvouchableReads,c as mergeDurableObjects,J as pullExternalSourceIncrementalTick,K as pullExternalSourceTick,X as reprojectionMigrationId,Z as reprojectionTables,S as roleNamespace,q as runDataMigration,z as runShardMigrations,s as serveRelationFanout,Q as subscriptionListDeltas};
1
+ import{installDeliveryFence as a}from"./packem_shared/installDeliveryFence-B6M9KOnb.mjs";import{MERGED_ROLES as o,mergeDurableObjects as c,roleNamespace as S}from"./packem_shared/MERGED_ROLES-C4RToZ16.mjs";import{serveRelationFanout as i}from"./packem_shared/serveRelationFanout-DcSjzAZv.mjs";import{SESSION_DO_TTL_DEFAULT as n,SessionDO as d}from"./packem_shared/SESSION_DO_TTL_DEFAULT-DSvTwRjc.mjs";import{ROOT_DO_SIZE_WARN_BYTES as p,ROOT_SHARD_NAME as m,ShardDO as h}from"./packem_shared/ROOT_DO_SIZE_WARN_BYTES-B5QyYH7o.mjs";import{SHARD_REGISTRY_DO_NAME as E,ShardRegistryDO as O,hostedShardRegistry as _}from"./packem_shared/SHARD_REGISTRY_DO_NAME-YZZk79QR.mjs";import{createStableIdFactory as u,createStableRandomFactory as b}from"./packem_shared/createStableIdFactory-DPDT_chw.mjs";import{createShardAlarms as T,createShardDirectory as I,createShardHost as g,createShardKvStore as y,createShardPlatform as A,createSocketHost as M,createWorkerPlatform as N}from"@lunora/platform-cloudflare";import{REPROJECTION_MIGRATION_PREFIX as F,UNVOUCHABLE_DEP as L,applyCdcChanges as C,assertShapeShardable as H,backfillSearchIndexes as P,backfillVectorIndexes as j,buildReprojectionMigration as v,clearMemoryTables as U,countLegacyRows as w,createReadFootprint as G,createShardCtxDb as B,exportShardRows as V,importShardRows as W,isSourceDue as Y,markUnvouchableReads as J,pullExternalSourceIncrementalTick as K,pullExternalSourceTick as X,reprojectionMigrationId as Z,reprojectionTables as q,runDataMigration as z,runShardMigrations as Q,subscriptionListDeltas as $}from"@lunora/shard-engine";export{o as MERGED_ROLES,F as REPROJECTION_MIGRATION_PREFIX,p as ROOT_DO_SIZE_WARN_BYTES,m as ROOT_SHARD_NAME,n as SESSION_DO_TTL_DEFAULT,E as SHARD_REGISTRY_DO_NAME,d as SessionDO,h as ShardDO,O as ShardRegistryDO,L as UNVOUCHABLE_DEP,C as applyCdcChanges,H as assertShapeShardable,P as backfillSearchIndexes,j as backfillVectorIndexes,v as buildReprojectionMigration,U as clearMemoryTables,w as countLegacyRows,G as createReadFootprint,T as createShardAlarms,B as createShardCtxDb,I as createShardDirectory,g as createShardHost,y as createShardKvStore,A as createShardPlatform,M as createSocketHost,u as createStableIdFactory,b as createStableRandomFactory,N as createWorkerPlatform,V as exportShardRows,_ as hostedShardRegistry,W as importShardRows,a as installDeliveryFence,Y as isSourceDue,J as markUnvouchableReads,c as mergeDurableObjects,K as pullExternalSourceIncrementalTick,X as pullExternalSourceTick,Z as reprojectionMigrationId,q as reprojectionTables,S as roleNamespace,z as runDataMigration,Q as runShardMigrations,i as serveRelationFanout,$ as subscriptionListDeltas};