@lunora/do 1.0.0-alpha.233 → 1.0.0-alpha.235
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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SubscriptionIdentity, SchemaLike, DatabaseWriterLike, CrossShardReadArgs, CdcChange, FilterClause, ExportRow, MigrationDirection, ReadFootprint, DependencyTracker, ReactiveCache, ShapeProbeCounters, GlobalPollCounters, ReactiveCacheOptions, TransactionHeadroomTracker, LifecycleDispatchInfo, MigrationRunResult, SearchBackfillProgress, VectorBackfillProgress, TableIndexInfo, ColumnMeta, AdvisoryFinding, AdvisorProcedure, RlsPoliciesResult, MaskPoliciesResult, StorageRulesResult, StudioFeaturesResult, FlagsResult, QueuesResult, WorkflowsResult, ImportShardResult, RelatedPage, ShardRankPageResult, ShardSocketLike, SubscriptionQuery, ShapeSubscriptionQuery, MutationDelta, KeyRange, ResolvedShape, ShapeRow, TtlSweepSpec, ScheduleOutbox, SchedulerLike, TransactionLimits, IndexKeyEntry, SqlExec, CdcChangeKey } from '@lunora/shard-engine';
|
|
2
2
|
export { type AdvisorProcedure, type AdvisoryFinding, type AggregateIndexDefinitionLike, type DataMigrationLike, type DatabaseWriterLike, type ExportRow, type ExternalSourceLike, type FlagsResult, type ImportShardResult, type KeyRange, type MaskPoliciesResult, type MigrationRunResult, type MutationDelta, type QueuesResult, REPROJECTION_MIGRATION_PREFIX, type RankIndexDefinitionLike, type RelatedPage, type RlsPoliciesResult, type SchedulerLike, type SchemaLike, type SearchBackfillProgress, type ShardRankPageResult, type SourceClientLike, type SqlExec, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionIdentity, type SystemReaderStorageLike, type TransactionHeadroomTracker, UNVOUCHABLE_DEP, type ValidatorLike, type VectorBackfillProgress, type WhereInput, type WorkflowsResult, type WriteHook, applyCdcChanges, assertShapeShardable, backfillSearchIndexes, backfillVectorIndexes, buildReprojectionMigration, clearMemoryTables, countLegacyRows, createReadFootprint, createShardCtxDb, exportShardRows, importShardRows, isSourceDue, markUnvouchableReads, pullExternalSourceIncrementalTick, pullExternalSourceTick, reprojectionMigrationId, reprojectionTables, runDataMigration, runShardMigrations, subscriptionListDeltas } from '@lunora/shard-engine';
|
|
3
3
|
import { DatabaseInstrumentation, MetricHistoryOptions, LogEventInput, TraceAnchor, ContextLogLevel, ContextTracer, SqlClientLike, ContextFetch, ContextMetrics } from '@lunora/observability';
|
|
4
|
+
import { SecretValueHost } from '@lunora/platform';
|
|
4
5
|
import { DrizzleSqliteDODatabase } from 'drizzle-orm/durable-sqlite';
|
|
5
6
|
export { type ShardPlatform, type WorkerPlatform, type WorkerPlatformOptions, createShardAlarms, createShardDirectory, createShardHost, createShardKvStore, createShardPlatform, createSocketHost, createWorkerPlatform } from '@lunora/platform-cloudflare';
|
|
6
7
|
/** Opaque authority scope and its monotonic revision. No access policy is stored on the shard. */
|
|
@@ -712,6 +713,30 @@ interface RunShardApplyCdcArgs {
|
|
|
712
713
|
interface RunShardApplyCdcResult {
|
|
713
714
|
applied: number;
|
|
714
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* The scrub scope of one invocation: the structural projection of
|
|
718
|
+
* `@lunora/observability`'s `SensitiveScope`, declared here so generated code can
|
|
719
|
+
* name it without depending on observability (see {@link ShardDO.openSensitiveScope}).
|
|
720
|
+
*/
|
|
721
|
+
interface SensitiveScope {
|
|
722
|
+
/** Admit more values and marked property names into the invocation (a composed call's marked arguments). */
|
|
723
|
+
add: (values: ReadonlyArray<string>, names?: ReadonlyArray<string>) => void;
|
|
724
|
+
/** Mark the dispatch settled; the values outlive it only while a record opened under the scope is still held. */
|
|
725
|
+
clear: () => void;
|
|
726
|
+
/** Scrub a field bag; `undefined` passes through. */
|
|
727
|
+
fields: <T extends Record<string, unknown> | undefined>(bag: T) => T;
|
|
728
|
+
/** Keep the values for a record opened under the scope and not yet written. Returns the release. */
|
|
729
|
+
hold: () => () => void;
|
|
730
|
+
/**
|
|
731
|
+
* Scrub a telemetry name (an event, span or metric name, or a plain log message). A name that is exactly a
|
|
732
|
+
* marked property name masks whole; any other name is scrubbed as free text.
|
|
733
|
+
*/
|
|
734
|
+
name: (name: string) => string;
|
|
735
|
+
/** Scrub a free-text string. */
|
|
736
|
+
text: (text: string) => string;
|
|
737
|
+
/** Scrub one structured value. */
|
|
738
|
+
value: <T>(value: T) => T;
|
|
739
|
+
}
|
|
715
740
|
/**
|
|
716
741
|
* The sink surface the DO hands its three signals to: `ctx.log` lines, `ctx.trace`
|
|
717
742
|
* spans, and `ctx.metrics` measurements. Structurally compatible with
|
|
@@ -1485,6 +1510,12 @@ declare abstract class ShardDO {
|
|
|
1485
1510
|
* changelog proved their table had not moved.
|
|
1486
1511
|
*/
|
|
1487
1512
|
protected globalPoll: GlobalPollCounters;
|
|
1513
|
+
/**
|
|
1514
|
+
* Human-supplied secret values for durable steps, over the same
|
|
1515
|
+
* `state.storage` as {@link ShardDO.shardHost}. Protected so an agent-layer
|
|
1516
|
+
* subclass can reach it; nothing in this class calls it.
|
|
1517
|
+
*/
|
|
1518
|
+
protected readonly secretValues: SecretValueHost;
|
|
1488
1519
|
private readonly deliveryAuthorization;
|
|
1489
1520
|
private readonly deliveryFence;
|
|
1490
1521
|
private readonly deliveryResponsePermits;
|
|
@@ -2376,7 +2407,7 @@ declare abstract class ShardDO {
|
|
|
2376
2407
|
* THIS dispatch's response rather than a shared field a concurrent action can
|
|
2377
2408
|
* clear.
|
|
2378
2409
|
*/
|
|
2379
|
-
abstract handleRpc(functionPath: string, args: Record<string, unknown>, headroom?: TransactionHeadroomTracker, scope?: QueryReadScope, bookmarks?: DispatchBookmark): Promise<unknown>;
|
|
2410
|
+
abstract handleRpc(functionPath: string, args: Record<string, unknown>, headroom?: TransactionHeadroomTracker, scope?: QueryReadScope, bookmarks?: DispatchBookmark, sensitive?: SensitiveScope): Promise<unknown>;
|
|
2380
2411
|
/**
|
|
2381
2412
|
* The registered function paths to dispatch on a lifecycle moment —
|
|
2382
2413
|
* `connect`/`disconnect` per socket, `init` once per Durable Object instance,
|
|
@@ -3440,6 +3471,50 @@ declare abstract class ShardDO {
|
|
|
3440
3471
|
* nothing — and this is the only place left that still knows the call is paid.
|
|
3441
3472
|
*/
|
|
3442
3473
|
protected isPaidFunction(_functionPath: string): boolean;
|
|
3474
|
+
/**
|
|
3475
|
+
* The argument names of `functionPath` whose validators carry a `v.sensitive`
|
|
3476
|
+
* marker. The request log replaces them before anything is persisted, logged or
|
|
3477
|
+
* shipped, so a marked value survives neither the durable row nor a dev
|
|
3478
|
+
* `captureRaw` capture. The base class has no function registry and marks
|
|
3479
|
+
* nothing; the codegen-generated subclass answers from `LUNORA_FUNCTIONS`.
|
|
3480
|
+
*/
|
|
3481
|
+
protected sensitiveArgNames(_functionPath: string): ReadonlySet<string>;
|
|
3482
|
+
/**
|
|
3483
|
+
* The scrub scope for ONE invocation: every free-text and structured record it
|
|
3484
|
+
* writes (logs, spans, the wide event, metrics, the root span's error) has the
|
|
3485
|
+
* values of its marked arguments replaced. The single place those values are
|
|
3486
|
+
* read. Built from the DECODED args, because a wire-encoded bigint or byte
|
|
3487
|
+
* string would not match the text the handler actually sees. The caller owns
|
|
3488
|
+
* the scope and clears it once the dispatch's records are written.
|
|
3489
|
+
*/
|
|
3490
|
+
protected openSensitiveScope(functionPath: string, args: Record<string, unknown>): SensitiveScope;
|
|
3491
|
+
/**
|
|
3492
|
+
* Run a dispatch outside `/rpc` under the sensitive scope its arguments open, so a
|
|
3493
|
+
* `v.sensitive` argument is masked in the records it writes, as it is on `/rpc`. The
|
|
3494
|
+
* scope is released once the dispatch and its records are done.
|
|
3495
|
+
*/
|
|
3496
|
+
protected withSensitiveScope<T>(functionPath: string, args: Record<string, unknown>, run: (sensitive: SensitiveScope) => Promise<T>): Promise<T>;
|
|
3497
|
+
/**
|
|
3498
|
+
* The error a shape resolve throws, with its message and stack scrubbed through the scope the
|
|
3499
|
+
* resolve ran under. The scope has admitted the validator's output, which a re-open from the raw
|
|
3500
|
+
* args would miss, so the scrub must happen before the scope is cleared, at the throw site.
|
|
3501
|
+
*/
|
|
3502
|
+
protected maskSensitiveError(error: unknown, scope: SensitiveScope): unknown;
|
|
3503
|
+
/**
|
|
3504
|
+
* Admit a composed call's marked arguments into the invocation that makes the
|
|
3505
|
+
* call. The callee runs inside that invocation, so its own `v.sensitive` values
|
|
3506
|
+
* are scrubbed from its records too, not only the caller's.
|
|
3507
|
+
*/
|
|
3508
|
+
protected admitSensitiveArgs(scope: SensitiveScope | undefined, functionPath: string, args: Record<string, unknown>): void;
|
|
3509
|
+
/**
|
|
3510
|
+
* Admit the marked values of one function's arguments into a dispatch's scope,
|
|
3511
|
+
* with the names its validators declared. The validator may transform a marked
|
|
3512
|
+
* value (trim, decode, parse), so the value the handler logs is not the one the
|
|
3513
|
+
* scope opened from the raw args holds; the generated ctx calls this with the
|
|
3514
|
+
* parsed args. Names are taken as given, not looked up by path: a composed
|
|
3515
|
+
* call's ctx carries the caller's path, which would name the wrong arguments.
|
|
3516
|
+
*/
|
|
3517
|
+
protected admitSensitiveValues(scope: SensitiveScope | undefined, args: Record<string, unknown>, names: ReadonlySet<string>): void;
|
|
3443
3518
|
/**
|
|
3444
3519
|
* Register a subscription on the given socket. Stored via
|
|
3445
3520
|
* `ws.serializeAttachment` so it survives hibernation.
|
|
@@ -4096,7 +4171,7 @@ declare abstract class ShardDO {
|
|
|
4096
4171
|
* stamps `fields` onto every line. The generated `buildCtx` calls this once
|
|
4097
4172
|
* per dispatch and assigns the result to `ctx.log`.
|
|
4098
4173
|
*/
|
|
4099
|
-
protected makeLogger(functionPath: string, sink?: TelemetrySink, boundFields?: Record<string, unknown
|
|
4174
|
+
protected makeLogger(functionPath: string, sink?: TelemetrySink, boundFields?: Record<string, unknown>, scope?: SensitiveScope): ContextLogger;
|
|
4100
4175
|
/**
|
|
4101
4176
|
* Build the `ctx.trace` span factory for one dispatched function. The
|
|
4102
4177
|
* generated `buildCtx` calls this once per dispatch and assigns the result to
|
|
@@ -4113,7 +4188,7 @@ declare abstract class ShardDO {
|
|
|
4113
4188
|
* The Cloudflare custom-spans bridge is threaded here but stays off unless the
|
|
4114
4189
|
* resolved sink sets `fuseCloudflareTraces` (see {@link resolveHostTracing}).
|
|
4115
4190
|
*/
|
|
4116
|
-
protected makeTracer(functionPath: string, sink?: TelemetrySink, anchor?: TraceAnchor): ContextTracer;
|
|
4191
|
+
protected makeTracer(functionPath: string, sink?: TelemetrySink, anchor?: TraceAnchor, scope?: SensitiveScope): ContextTracer;
|
|
4117
4192
|
/**
|
|
4118
4193
|
* The trace anchor a ctx's `trace` and `span` both hang off.
|
|
4119
4194
|
*
|
|
@@ -4136,7 +4211,7 @@ declare abstract class ShardDO {
|
|
|
4136
4211
|
* `instrumentDatabase: "off"`, so a deployment that collects nothing pays
|
|
4137
4212
|
* nothing.
|
|
4138
4213
|
*/
|
|
4139
|
-
protected instrumentDb<T extends object>(database: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink): T;
|
|
4214
|
+
protected instrumentDb<T extends object>(database: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): T;
|
|
4140
4215
|
/**
|
|
4141
4216
|
* Wrap the action-only `ctx.sql` (Hyperdrive) client in the same automatic
|
|
4142
4217
|
* instrumentation as `ctx.db` — see {@link instrumentSqlClient}. Same knob
|
|
@@ -4149,7 +4224,7 @@ declare abstract class ShardDO {
|
|
|
4149
4224
|
* spans go to the sink, and the folded counters reach the host invocation
|
|
4150
4225
|
* span through the root-span mirroring in `recordDispatchRootSpan`.
|
|
4151
4226
|
*/
|
|
4152
|
-
protected instrumentSql<T extends SqlClientLike>(client: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink): T;
|
|
4227
|
+
protected instrumentSql<T extends SqlClientLike>(client: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): T;
|
|
4153
4228
|
/**
|
|
4154
4229
|
* Build `ctx.fetch` — the platform `fetch`, instrumented.
|
|
4155
4230
|
*
|
|
@@ -4163,13 +4238,13 @@ declare abstract class ShardDO {
|
|
|
4163
4238
|
* nobody collects, and an app calling a third party it would rather not send
|
|
4164
4239
|
* trace ids to needs a way to say so.
|
|
4165
4240
|
*/
|
|
4166
|
-
protected makeFetch(functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink): ContextFetch;
|
|
4167
|
-
protected makeDispatchSpan(anchor: TraceAnchor, sink?: TelemetrySink): SpanHandle;
|
|
4241
|
+
protected makeFetch(functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): ContextFetch;
|
|
4242
|
+
protected makeDispatchSpan(anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): SpanHandle;
|
|
4168
4243
|
/**
|
|
4169
4244
|
* Build the `ctx.metrics` recorder for one dispatched function. Thin wiring
|
|
4170
4245
|
* over {@link createMetrics}, which owns the instrument semantics.
|
|
4171
4246
|
*/
|
|
4172
|
-
protected makeMetrics(functionPath: string, sink?: TelemetrySink): ContextMetrics;
|
|
4247
|
+
protected makeMetrics(functionPath: string, sink?: TelemetrySink, scope?: SensitiveScope): ContextMetrics;
|
|
4173
4248
|
/**
|
|
4174
4249
|
* Fold one measurement into the in-memory {@link metricSeries} readout and
|
|
4175
4250
|
* hand it to the optional `sink.onMetric`. Best-effort like
|
|
@@ -6457,6 +6532,8 @@ declare abstract class ShardDO {
|
|
|
6457
6532
|
/**
|
|
6458
6533
|
* Refuse a room event that failed or could not run: log it, and if it was a join,
|
|
6459
6534
|
* undo the membership it created and remember the refusal for the leave queued behind it.
|
|
6535
|
+
* `sensitive` is the event's dispatch scope, still open where the handler failed; a refusal
|
|
6536
|
+
* raised before any dispatch has none.
|
|
6460
6537
|
*/
|
|
6461
6538
|
private refuseRoomEvent;
|
|
6462
6539
|
/**
|
|
@@ -6676,4 +6753,4 @@ declare class ShardRegistryDO {
|
|
|
6676
6753
|
* never share an id sequence for the same key.
|
|
6677
6754
|
*/
|
|
6678
6755
|
declare const createStableIdFactory: (mutationId: string | undefined, scope: string) => (() => string);
|
|
6679
|
-
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, SessionDO, type SessionRecord, ShardDO, type ShardDOOptions, type ShardDOState, ShardRegistryDO, type SubscriptionOutcome, type TelemetrySink, type TraceRefLike, createStableIdFactory, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
|
|
6756
|
+
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, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SubscriptionIdentity, SchemaLike, DatabaseWriterLike, CrossShardReadArgs, CdcChange, FilterClause, ExportRow, MigrationDirection, ReadFootprint, DependencyTracker, ReactiveCache, ShapeProbeCounters, GlobalPollCounters, ReactiveCacheOptions, TransactionHeadroomTracker, LifecycleDispatchInfo, MigrationRunResult, SearchBackfillProgress, VectorBackfillProgress, TableIndexInfo, ColumnMeta, AdvisoryFinding, AdvisorProcedure, RlsPoliciesResult, MaskPoliciesResult, StorageRulesResult, StudioFeaturesResult, FlagsResult, QueuesResult, WorkflowsResult, ImportShardResult, RelatedPage, ShardRankPageResult, ShardSocketLike, SubscriptionQuery, ShapeSubscriptionQuery, MutationDelta, KeyRange, ResolvedShape, ShapeRow, TtlSweepSpec, ScheduleOutbox, SchedulerLike, TransactionLimits, IndexKeyEntry, SqlExec, CdcChangeKey } from '@lunora/shard-engine';
|
|
2
2
|
export { type AdvisorProcedure, type AdvisoryFinding, type AggregateIndexDefinitionLike, type DataMigrationLike, type DatabaseWriterLike, type ExportRow, type ExternalSourceLike, type FlagsResult, type ImportShardResult, type KeyRange, type MaskPoliciesResult, type MigrationRunResult, type MutationDelta, type QueuesResult, REPROJECTION_MIGRATION_PREFIX, type RankIndexDefinitionLike, type RelatedPage, type RlsPoliciesResult, type SchedulerLike, type SchemaLike, type SearchBackfillProgress, type ShardRankPageResult, type SourceClientLike, type SqlExec, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionIdentity, type SystemReaderStorageLike, type TransactionHeadroomTracker, UNVOUCHABLE_DEP, type ValidatorLike, type VectorBackfillProgress, type WhereInput, type WorkflowsResult, type WriteHook, applyCdcChanges, assertShapeShardable, backfillSearchIndexes, backfillVectorIndexes, buildReprojectionMigration, clearMemoryTables, countLegacyRows, createReadFootprint, createShardCtxDb, exportShardRows, importShardRows, isSourceDue, markUnvouchableReads, pullExternalSourceIncrementalTick, pullExternalSourceTick, reprojectionMigrationId, reprojectionTables, runDataMigration, runShardMigrations, subscriptionListDeltas } from '@lunora/shard-engine';
|
|
3
3
|
import { DatabaseInstrumentation, MetricHistoryOptions, LogEventInput, TraceAnchor, ContextLogLevel, ContextTracer, SqlClientLike, ContextFetch, ContextMetrics } from '@lunora/observability';
|
|
4
|
+
import { SecretValueHost } from '@lunora/platform';
|
|
4
5
|
import { DrizzleSqliteDODatabase } from 'drizzle-orm/durable-sqlite';
|
|
5
6
|
export { type ShardPlatform, type WorkerPlatform, type WorkerPlatformOptions, createShardAlarms, createShardDirectory, createShardHost, createShardKvStore, createShardPlatform, createSocketHost, createWorkerPlatform } from '@lunora/platform-cloudflare';
|
|
6
7
|
/** Opaque authority scope and its monotonic revision. No access policy is stored on the shard. */
|
|
@@ -712,6 +713,30 @@ interface RunShardApplyCdcArgs {
|
|
|
712
713
|
interface RunShardApplyCdcResult {
|
|
713
714
|
applied: number;
|
|
714
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* The scrub scope of one invocation: the structural projection of
|
|
718
|
+
* `@lunora/observability`'s `SensitiveScope`, declared here so generated code can
|
|
719
|
+
* name it without depending on observability (see {@link ShardDO.openSensitiveScope}).
|
|
720
|
+
*/
|
|
721
|
+
interface SensitiveScope {
|
|
722
|
+
/** Admit more values and marked property names into the invocation (a composed call's marked arguments). */
|
|
723
|
+
add: (values: ReadonlyArray<string>, names?: ReadonlyArray<string>) => void;
|
|
724
|
+
/** Mark the dispatch settled; the values outlive it only while a record opened under the scope is still held. */
|
|
725
|
+
clear: () => void;
|
|
726
|
+
/** Scrub a field bag; `undefined` passes through. */
|
|
727
|
+
fields: <T extends Record<string, unknown> | undefined>(bag: T) => T;
|
|
728
|
+
/** Keep the values for a record opened under the scope and not yet written. Returns the release. */
|
|
729
|
+
hold: () => () => void;
|
|
730
|
+
/**
|
|
731
|
+
* Scrub a telemetry name (an event, span or metric name, or a plain log message). A name that is exactly a
|
|
732
|
+
* marked property name masks whole; any other name is scrubbed as free text.
|
|
733
|
+
*/
|
|
734
|
+
name: (name: string) => string;
|
|
735
|
+
/** Scrub a free-text string. */
|
|
736
|
+
text: (text: string) => string;
|
|
737
|
+
/** Scrub one structured value. */
|
|
738
|
+
value: <T>(value: T) => T;
|
|
739
|
+
}
|
|
715
740
|
/**
|
|
716
741
|
* The sink surface the DO hands its three signals to: `ctx.log` lines, `ctx.trace`
|
|
717
742
|
* spans, and `ctx.metrics` measurements. Structurally compatible with
|
|
@@ -1485,6 +1510,12 @@ declare abstract class ShardDO {
|
|
|
1485
1510
|
* changelog proved their table had not moved.
|
|
1486
1511
|
*/
|
|
1487
1512
|
protected globalPoll: GlobalPollCounters;
|
|
1513
|
+
/**
|
|
1514
|
+
* Human-supplied secret values for durable steps, over the same
|
|
1515
|
+
* `state.storage` as {@link ShardDO.shardHost}. Protected so an agent-layer
|
|
1516
|
+
* subclass can reach it; nothing in this class calls it.
|
|
1517
|
+
*/
|
|
1518
|
+
protected readonly secretValues: SecretValueHost;
|
|
1488
1519
|
private readonly deliveryAuthorization;
|
|
1489
1520
|
private readonly deliveryFence;
|
|
1490
1521
|
private readonly deliveryResponsePermits;
|
|
@@ -2376,7 +2407,7 @@ declare abstract class ShardDO {
|
|
|
2376
2407
|
* THIS dispatch's response rather than a shared field a concurrent action can
|
|
2377
2408
|
* clear.
|
|
2378
2409
|
*/
|
|
2379
|
-
abstract handleRpc(functionPath: string, args: Record<string, unknown>, headroom?: TransactionHeadroomTracker, scope?: QueryReadScope, bookmarks?: DispatchBookmark): Promise<unknown>;
|
|
2410
|
+
abstract handleRpc(functionPath: string, args: Record<string, unknown>, headroom?: TransactionHeadroomTracker, scope?: QueryReadScope, bookmarks?: DispatchBookmark, sensitive?: SensitiveScope): Promise<unknown>;
|
|
2380
2411
|
/**
|
|
2381
2412
|
* The registered function paths to dispatch on a lifecycle moment —
|
|
2382
2413
|
* `connect`/`disconnect` per socket, `init` once per Durable Object instance,
|
|
@@ -3440,6 +3471,50 @@ declare abstract class ShardDO {
|
|
|
3440
3471
|
* nothing — and this is the only place left that still knows the call is paid.
|
|
3441
3472
|
*/
|
|
3442
3473
|
protected isPaidFunction(_functionPath: string): boolean;
|
|
3474
|
+
/**
|
|
3475
|
+
* The argument names of `functionPath` whose validators carry a `v.sensitive`
|
|
3476
|
+
* marker. The request log replaces them before anything is persisted, logged or
|
|
3477
|
+
* shipped, so a marked value survives neither the durable row nor a dev
|
|
3478
|
+
* `captureRaw` capture. The base class has no function registry and marks
|
|
3479
|
+
* nothing; the codegen-generated subclass answers from `LUNORA_FUNCTIONS`.
|
|
3480
|
+
*/
|
|
3481
|
+
protected sensitiveArgNames(_functionPath: string): ReadonlySet<string>;
|
|
3482
|
+
/**
|
|
3483
|
+
* The scrub scope for ONE invocation: every free-text and structured record it
|
|
3484
|
+
* writes (logs, spans, the wide event, metrics, the root span's error) has the
|
|
3485
|
+
* values of its marked arguments replaced. The single place those values are
|
|
3486
|
+
* read. Built from the DECODED args, because a wire-encoded bigint or byte
|
|
3487
|
+
* string would not match the text the handler actually sees. The caller owns
|
|
3488
|
+
* the scope and clears it once the dispatch's records are written.
|
|
3489
|
+
*/
|
|
3490
|
+
protected openSensitiveScope(functionPath: string, args: Record<string, unknown>): SensitiveScope;
|
|
3491
|
+
/**
|
|
3492
|
+
* Run a dispatch outside `/rpc` under the sensitive scope its arguments open, so a
|
|
3493
|
+
* `v.sensitive` argument is masked in the records it writes, as it is on `/rpc`. The
|
|
3494
|
+
* scope is released once the dispatch and its records are done.
|
|
3495
|
+
*/
|
|
3496
|
+
protected withSensitiveScope<T>(functionPath: string, args: Record<string, unknown>, run: (sensitive: SensitiveScope) => Promise<T>): Promise<T>;
|
|
3497
|
+
/**
|
|
3498
|
+
* The error a shape resolve throws, with its message and stack scrubbed through the scope the
|
|
3499
|
+
* resolve ran under. The scope has admitted the validator's output, which a re-open from the raw
|
|
3500
|
+
* args would miss, so the scrub must happen before the scope is cleared, at the throw site.
|
|
3501
|
+
*/
|
|
3502
|
+
protected maskSensitiveError(error: unknown, scope: SensitiveScope): unknown;
|
|
3503
|
+
/**
|
|
3504
|
+
* Admit a composed call's marked arguments into the invocation that makes the
|
|
3505
|
+
* call. The callee runs inside that invocation, so its own `v.sensitive` values
|
|
3506
|
+
* are scrubbed from its records too, not only the caller's.
|
|
3507
|
+
*/
|
|
3508
|
+
protected admitSensitiveArgs(scope: SensitiveScope | undefined, functionPath: string, args: Record<string, unknown>): void;
|
|
3509
|
+
/**
|
|
3510
|
+
* Admit the marked values of one function's arguments into a dispatch's scope,
|
|
3511
|
+
* with the names its validators declared. The validator may transform a marked
|
|
3512
|
+
* value (trim, decode, parse), so the value the handler logs is not the one the
|
|
3513
|
+
* scope opened from the raw args holds; the generated ctx calls this with the
|
|
3514
|
+
* parsed args. Names are taken as given, not looked up by path: a composed
|
|
3515
|
+
* call's ctx carries the caller's path, which would name the wrong arguments.
|
|
3516
|
+
*/
|
|
3517
|
+
protected admitSensitiveValues(scope: SensitiveScope | undefined, args: Record<string, unknown>, names: ReadonlySet<string>): void;
|
|
3443
3518
|
/**
|
|
3444
3519
|
* Register a subscription on the given socket. Stored via
|
|
3445
3520
|
* `ws.serializeAttachment` so it survives hibernation.
|
|
@@ -4096,7 +4171,7 @@ declare abstract class ShardDO {
|
|
|
4096
4171
|
* stamps `fields` onto every line. The generated `buildCtx` calls this once
|
|
4097
4172
|
* per dispatch and assigns the result to `ctx.log`.
|
|
4098
4173
|
*/
|
|
4099
|
-
protected makeLogger(functionPath: string, sink?: TelemetrySink, boundFields?: Record<string, unknown
|
|
4174
|
+
protected makeLogger(functionPath: string, sink?: TelemetrySink, boundFields?: Record<string, unknown>, scope?: SensitiveScope): ContextLogger;
|
|
4100
4175
|
/**
|
|
4101
4176
|
* Build the `ctx.trace` span factory for one dispatched function. The
|
|
4102
4177
|
* generated `buildCtx` calls this once per dispatch and assigns the result to
|
|
@@ -4113,7 +4188,7 @@ declare abstract class ShardDO {
|
|
|
4113
4188
|
* The Cloudflare custom-spans bridge is threaded here but stays off unless the
|
|
4114
4189
|
* resolved sink sets `fuseCloudflareTraces` (see {@link resolveHostTracing}).
|
|
4115
4190
|
*/
|
|
4116
|
-
protected makeTracer(functionPath: string, sink?: TelemetrySink, anchor?: TraceAnchor): ContextTracer;
|
|
4191
|
+
protected makeTracer(functionPath: string, sink?: TelemetrySink, anchor?: TraceAnchor, scope?: SensitiveScope): ContextTracer;
|
|
4117
4192
|
/**
|
|
4118
4193
|
* The trace anchor a ctx's `trace` and `span` both hang off.
|
|
4119
4194
|
*
|
|
@@ -4136,7 +4211,7 @@ declare abstract class ShardDO {
|
|
|
4136
4211
|
* `instrumentDatabase: "off"`, so a deployment that collects nothing pays
|
|
4137
4212
|
* nothing.
|
|
4138
4213
|
*/
|
|
4139
|
-
protected instrumentDb<T extends object>(database: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink): T;
|
|
4214
|
+
protected instrumentDb<T extends object>(database: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): T;
|
|
4140
4215
|
/**
|
|
4141
4216
|
* Wrap the action-only `ctx.sql` (Hyperdrive) client in the same automatic
|
|
4142
4217
|
* instrumentation as `ctx.db` — see {@link instrumentSqlClient}. Same knob
|
|
@@ -4149,7 +4224,7 @@ declare abstract class ShardDO {
|
|
|
4149
4224
|
* spans go to the sink, and the folded counters reach the host invocation
|
|
4150
4225
|
* span through the root-span mirroring in `recordDispatchRootSpan`.
|
|
4151
4226
|
*/
|
|
4152
|
-
protected instrumentSql<T extends SqlClientLike>(client: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink): T;
|
|
4227
|
+
protected instrumentSql<T extends SqlClientLike>(client: T, functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): T;
|
|
4153
4228
|
/**
|
|
4154
4229
|
* Build `ctx.fetch` — the platform `fetch`, instrumented.
|
|
4155
4230
|
*
|
|
@@ -4163,13 +4238,13 @@ declare abstract class ShardDO {
|
|
|
4163
4238
|
* nobody collects, and an app calling a third party it would rather not send
|
|
4164
4239
|
* trace ids to needs a way to say so.
|
|
4165
4240
|
*/
|
|
4166
|
-
protected makeFetch(functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink): ContextFetch;
|
|
4167
|
-
protected makeDispatchSpan(anchor: TraceAnchor, sink?: TelemetrySink): SpanHandle;
|
|
4241
|
+
protected makeFetch(functionPath: string, anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): ContextFetch;
|
|
4242
|
+
protected makeDispatchSpan(anchor: TraceAnchor, sink?: TelemetrySink, scope?: SensitiveScope): SpanHandle;
|
|
4168
4243
|
/**
|
|
4169
4244
|
* Build the `ctx.metrics` recorder for one dispatched function. Thin wiring
|
|
4170
4245
|
* over {@link createMetrics}, which owns the instrument semantics.
|
|
4171
4246
|
*/
|
|
4172
|
-
protected makeMetrics(functionPath: string, sink?: TelemetrySink): ContextMetrics;
|
|
4247
|
+
protected makeMetrics(functionPath: string, sink?: TelemetrySink, scope?: SensitiveScope): ContextMetrics;
|
|
4173
4248
|
/**
|
|
4174
4249
|
* Fold one measurement into the in-memory {@link metricSeries} readout and
|
|
4175
4250
|
* hand it to the optional `sink.onMetric`. Best-effort like
|
|
@@ -6457,6 +6532,8 @@ declare abstract class ShardDO {
|
|
|
6457
6532
|
/**
|
|
6458
6533
|
* Refuse a room event that failed or could not run: log it, and if it was a join,
|
|
6459
6534
|
* undo the membership it created and remember the refusal for the leave queued behind it.
|
|
6535
|
+
* `sensitive` is the event's dispatch scope, still open where the handler failed; a refusal
|
|
6536
|
+
* raised before any dispatch has none.
|
|
6460
6537
|
*/
|
|
6461
6538
|
private refuseRoomEvent;
|
|
6462
6539
|
/**
|
|
@@ -6676,4 +6753,4 @@ declare class ShardRegistryDO {
|
|
|
6676
6753
|
* never share an id sequence for the same key.
|
|
6677
6754
|
*/
|
|
6678
6755
|
declare const createStableIdFactory: (mutationId: string | undefined, scope: string) => (() => string);
|
|
6679
|
-
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, SessionDO, type SessionRecord, ShardDO, type ShardDOOptions, type ShardDOState, ShardRegistryDO, type SubscriptionOutcome, type TelemetrySink, type TraceRefLike, createStableIdFactory, installDeliveryFence, mergeDurableObjects, roleNamespace, serveRelationFanout };
|
|
6756
|
+
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, 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 i}from"./packem_shared/serveRelationFanout-DcSjzAZv.mjs";import{SESSION_DO_TTL_DEFAULT as n,SessionDO as p}from"./packem_shared/SESSION_DO_TTL_DEFAULT-DSvTwRjc.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-
|
|
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 i}from"./packem_shared/serveRelationFanout-DcSjzAZv.mjs";import{SESSION_DO_TTL_DEFAULT as n,SessionDO as p}from"./packem_shared/SESSION_DO_TTL_DEFAULT-DSvTwRjc.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-Ddq11_jA.mjs";import{SHARD_REGISTRY_DO_NAME as O,ShardRegistryDO as h}from"./packem_shared/SHARD_REGISTRY_DO_NAME-DRIFt2FK.mjs";import{createStableIdFactory as x}from"./packem_shared/createStableIdFactory-CAEDEee5.mjs";import{createShardAlarms as f,createShardDirectory as T,createShardHost as b,createShardKvStore as I,createShardPlatform as A,createSocketHost as M,createWorkerPlatform as g}from"@lunora/platform-cloudflare";import{REPROJECTION_MIGRATION_PREFIX as k,UNVOUCHABLE_DEP as y,applyCdcChanges as F,assertShapeShardable as L,backfillSearchIndexes as C,backfillVectorIndexes as H,buildReprojectionMigration as P,clearMemoryTables as j,countLegacyRows as v,createReadFootprint as U,createShardCtxDb as w,exportShardRows as G,importShardRows as B,isSourceDue as V,markUnvouchableReads as W,pullExternalSourceIncrementalTick as Y,pullExternalSourceTick as J,reprojectionMigrationId as K,reprojectionTables as X,runDataMigration as Z,runShardMigrations as q,subscriptionListDeltas as z}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,y as UNVOUCHABLE_DEP,F as applyCdcChanges,L as assertShapeShardable,C as backfillSearchIndexes,H as backfillVectorIndexes,P as buildReprojectionMigration,j as clearMemoryTables,v as countLegacyRows,U as createReadFootprint,f as createShardAlarms,w as createShardCtxDb,T as createShardDirectory,b as createShardHost,I as createShardKvStore,A as createShardPlatform,M as createSocketHost,x as createStableIdFactory,g as createWorkerPlatform,G as exportShardRows,B as importShardRows,a as installDeliveryFence,V as isSourceDue,W as markUnvouchableReads,c as mergeDurableObjects,Y as pullExternalSourceIncrementalTick,J as pullExternalSourceTick,K as reprojectionMigrationId,X as reprojectionTables,S as roleNamespace,Z as runDataMigration,q as runShardMigrations,i as serveRelationFanout,z as subscriptionListDeltas};
|