@lunora/server 1.0.0-alpha.82 → 1.0.0-alpha.84
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 +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/flushDeferredDeletes-DEJXlhop.mjs +1 -0
- package/dist/types.d.mts +28 -3
- package/dist/types.d.ts +28 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Validator, Infer, ValidatorMap, InferValidatorMap, ColumnValidator, v } from '@lunora/values';
|
|
2
2
|
export { type ColumnValidator, type GeoPoint, type Id, type Infer, ValidationError, type Validator, type ValidatorKind, v } from '@lunora/values';
|
|
3
3
|
import { ArgsValidator, InferArgs, RegisteredAction, ExposeConfig, X402ProcedureConfig, ActionCtx, MutationCtx, RegisteredMutation, QueryCtx, RegisteredQuery, DurableStreamOptions, RegisteredStream, FunctionKind, Secrets, LifecycleEvent, ShardInitEvent, RegisteredLifecycleHook, TableDefinition, RegisteredFunction, VectorIndexDefinition, Schema, AggregateOp, DurableObjectJurisdiction, RelationDefinition, GlobalBackend, OnDeleteAction, SearchLanguage, SearchStrategy, ExternalSourceDefinition, TriggerBuilder, TriggerDefinition, VectorEmbedder, VectorMetric, AggregateIndexDefinition, RankIndexDefinition } from "./types.mjs";
|
|
4
|
-
export { type AnyApi, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type IndexDefinition, type IndexRangeBuilder, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type PaginationOptions, type PaginationResult, type RankSortKey, type ReadOnlyStorage, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type SearchFilterBuilder, type SearchIndexDefinition, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerCtx, type TriggerDatabase, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorMatch, type VectorMatches, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, anyApi } from "./types.mjs";
|
|
4
|
+
export { type AnyApi, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type IndexDefinition, type IndexRangeBuilder, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type MutationStorage, type PaginationOptions, type PaginationResult, type RankSortKey, type ReadOnlyStorage, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type SearchFilterBuilder, type SearchIndexDefinition, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerCtx, type TriggerDatabase, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorMatch, type VectorMatches, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, anyApi } from "./types.mjs";
|
|
5
5
|
import { LunoraError as LunoraError$1, LunoraErrorCode } from '@lunora/errors';
|
|
6
6
|
export type { LunoraErrorCode } from '@lunora/errors';
|
|
7
7
|
import { Context, Hono } from 'hono';
|
|
@@ -318,6 +318,38 @@ declare const initLunora: {
|
|
|
318
318
|
* wrangler config; the lookup is lazy, so an unused secret never resolves.
|
|
319
319
|
*/
|
|
320
320
|
declare const createSecrets: (env: Record<string, unknown>) => Secrets;
|
|
321
|
+
/**
|
|
322
|
+
* Wrap a storage facade so it also accepts `deleteAfterCommit(key)`.
|
|
323
|
+
*
|
|
324
|
+
* Call once per dispatch, outside any read-stamping wrapper: `bucket()` delegates
|
|
325
|
+
* to the wrapped facade, so a sub-facade is still stamped by whatever wrapped it.
|
|
326
|
+
* @param storage the bucket-aware facade from `asBucketStorage`
|
|
327
|
+
*/
|
|
328
|
+
declare const withDeferredDeletes: (storage: unknown) => unknown;
|
|
329
|
+
/** How a flush ended, so a caller can assert on it without this module owning a logger. */
|
|
330
|
+
interface DeferredDeleteFlushResult {
|
|
331
|
+
/** How many keys were attempted. */
|
|
332
|
+
attempted: number;
|
|
333
|
+
/** Keys whose delete did not happen, with the reason. Empty when everything succeeded. */
|
|
334
|
+
failures: {
|
|
335
|
+
error: unknown;
|
|
336
|
+
key: string;
|
|
337
|
+
}[];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Delete everything queued on `context.storage`, draining the queue as it goes,
|
|
341
|
+
* and report each failure through `context.log`.
|
|
342
|
+
*
|
|
343
|
+
* Draining first means a second flush of the same dispatch is a no-op rather than
|
|
344
|
+
* a second round of deletes.
|
|
345
|
+
*
|
|
346
|
+
* Never throws. A flush runs after the write committed, so there is no longer
|
|
347
|
+
* anything to fail into: rejecting here could only turn a leaked object into a
|
|
348
|
+
* failed response for a write that already succeeded. Failures are logged and
|
|
349
|
+
* also returned, so a dispatch can call this and ignore the result.
|
|
350
|
+
* @param context the dispatch context; a context with no queued deletes is a no-op
|
|
351
|
+
*/
|
|
352
|
+
declare const flushDeferredDeletes: (context: unknown) => Promise<DeferredDeleteFlushResult>;
|
|
321
353
|
/**
|
|
322
354
|
* Redact secrets from a free-form message. Masks, in order: any quoted value
|
|
323
355
|
* whose contents look like a credential (so a value surfaced as `received string
|
|
@@ -1757,7 +1789,8 @@ interface TableBuilder<Shape extends Record<string, Validator> = Record<string,
|
|
|
1757
1789
|
* `filterFields` (at most 16) lists the columns `.eq()` may narrow by inside
|
|
1758
1790
|
* the search. `language` selects the text analysis (accent folding always,
|
|
1759
1791
|
* plus that language's stopwords). `staged: true` skips the migration-time
|
|
1760
|
-
* backfill on a large existing table
|
|
1792
|
+
* backfill on a large existing table — pre-existing rows stay unsearchable
|
|
1793
|
+
* until `__lunora_admin__:backfillSearch` is run against the deployment. `strategy: "native"` uses the engine's
|
|
1761
1794
|
* own full-text index where it has one (Postgres) — faster on large corpora,
|
|
1762
1795
|
* at the cost of the engine ranking rather than the shared scorer.
|
|
1763
1796
|
*/
|
|
@@ -2825,4 +2858,4 @@ interface StorageContextIn {
|
|
|
2825
2858
|
}
|
|
2826
2859
|
declare const storageRules: <Context extends StorageContextIn = StorageContextIn>(rules: ReadonlyArray<StorageRule<Context>>, options?: StorageRulesOptions) => Middleware<Context, Context>;
|
|
2827
2860
|
declare const VERSION = "0.0.0";
|
|
2828
|
-
export { type ActionBuilder, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, type DataModelInit, type DefineComponentOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, LunoraError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RelationBuilder, type RelationDefinition, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ShapeDefinition, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, allowAll, asBucketStorage, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, defineAggregateIndex, defineComponent, defineEnv, defineIdentity, defineListArgs, defineMigration, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, httpAction, httpRoute, httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isSafeHeaderValue, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject, storageRules, toWhereInput };
|
|
2861
|
+
export { type ActionBuilder, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, type DataModelInit, type DeferredDeleteFlushResult, type DefineComponentOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, LunoraError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RelationBuilder, type RelationDefinition, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ShapeDefinition, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, allowAll, asBucketStorage, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, defineAggregateIndex, defineComponent, defineEnv, defineIdentity, defineListArgs, defineMigration, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, flushDeferredDeletes, httpAction, httpRoute, httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isSafeHeaderValue, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject, storageRules, toWhereInput, withDeferredDeletes };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Validator, Infer, ValidatorMap, InferValidatorMap, ColumnValidator, v } from '@lunora/values';
|
|
2
2
|
export { type ColumnValidator, type GeoPoint, type Id, type Infer, ValidationError, type Validator, type ValidatorKind, v } from '@lunora/values';
|
|
3
3
|
import { ArgsValidator, InferArgs, RegisteredAction, ExposeConfig, X402ProcedureConfig, ActionCtx, MutationCtx, RegisteredMutation, QueryCtx, RegisteredQuery, DurableStreamOptions, RegisteredStream, FunctionKind, Secrets, LifecycleEvent, ShardInitEvent, RegisteredLifecycleHook, TableDefinition, RegisteredFunction, VectorIndexDefinition, Schema, AggregateOp, DurableObjectJurisdiction, RelationDefinition, GlobalBackend, OnDeleteAction, SearchLanguage, SearchStrategy, ExternalSourceDefinition, TriggerBuilder, TriggerDefinition, VectorEmbedder, VectorMetric, AggregateIndexDefinition, RankIndexDefinition } from "./types.js";
|
|
4
|
-
export { type AnyApi, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type IndexDefinition, type IndexRangeBuilder, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type PaginationOptions, type PaginationResult, type RankSortKey, type ReadOnlyStorage, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type SearchFilterBuilder, type SearchIndexDefinition, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerCtx, type TriggerDatabase, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorMatch, type VectorMatches, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, anyApi } from "./types.js";
|
|
4
|
+
export { type AnyApi, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type IndexDefinition, type IndexRangeBuilder, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type MutationStorage, type PaginationOptions, type PaginationResult, type RankSortKey, type ReadOnlyStorage, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type SearchFilterBuilder, type SearchIndexDefinition, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerCtx, type TriggerDatabase, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorMatch, type VectorMatches, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, anyApi } from "./types.js";
|
|
5
5
|
import { LunoraError as LunoraError$1, LunoraErrorCode } from '@lunora/errors';
|
|
6
6
|
export type { LunoraErrorCode } from '@lunora/errors';
|
|
7
7
|
import { Context, Hono } from 'hono';
|
|
@@ -318,6 +318,38 @@ declare const initLunora: {
|
|
|
318
318
|
* wrangler config; the lookup is lazy, so an unused secret never resolves.
|
|
319
319
|
*/
|
|
320
320
|
declare const createSecrets: (env: Record<string, unknown>) => Secrets;
|
|
321
|
+
/**
|
|
322
|
+
* Wrap a storage facade so it also accepts `deleteAfterCommit(key)`.
|
|
323
|
+
*
|
|
324
|
+
* Call once per dispatch, outside any read-stamping wrapper: `bucket()` delegates
|
|
325
|
+
* to the wrapped facade, so a sub-facade is still stamped by whatever wrapped it.
|
|
326
|
+
* @param storage the bucket-aware facade from `asBucketStorage`
|
|
327
|
+
*/
|
|
328
|
+
declare const withDeferredDeletes: (storage: unknown) => unknown;
|
|
329
|
+
/** How a flush ended, so a caller can assert on it without this module owning a logger. */
|
|
330
|
+
interface DeferredDeleteFlushResult {
|
|
331
|
+
/** How many keys were attempted. */
|
|
332
|
+
attempted: number;
|
|
333
|
+
/** Keys whose delete did not happen, with the reason. Empty when everything succeeded. */
|
|
334
|
+
failures: {
|
|
335
|
+
error: unknown;
|
|
336
|
+
key: string;
|
|
337
|
+
}[];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Delete everything queued on `context.storage`, draining the queue as it goes,
|
|
341
|
+
* and report each failure through `context.log`.
|
|
342
|
+
*
|
|
343
|
+
* Draining first means a second flush of the same dispatch is a no-op rather than
|
|
344
|
+
* a second round of deletes.
|
|
345
|
+
*
|
|
346
|
+
* Never throws. A flush runs after the write committed, so there is no longer
|
|
347
|
+
* anything to fail into: rejecting here could only turn a leaked object into a
|
|
348
|
+
* failed response for a write that already succeeded. Failures are logged and
|
|
349
|
+
* also returned, so a dispatch can call this and ignore the result.
|
|
350
|
+
* @param context the dispatch context; a context with no queued deletes is a no-op
|
|
351
|
+
*/
|
|
352
|
+
declare const flushDeferredDeletes: (context: unknown) => Promise<DeferredDeleteFlushResult>;
|
|
321
353
|
/**
|
|
322
354
|
* Redact secrets from a free-form message. Masks, in order: any quoted value
|
|
323
355
|
* whose contents look like a credential (so a value surfaced as `received string
|
|
@@ -1757,7 +1789,8 @@ interface TableBuilder<Shape extends Record<string, Validator> = Record<string,
|
|
|
1757
1789
|
* `filterFields` (at most 16) lists the columns `.eq()` may narrow by inside
|
|
1758
1790
|
* the search. `language` selects the text analysis (accent folding always,
|
|
1759
1791
|
* plus that language's stopwords). `staged: true` skips the migration-time
|
|
1760
|
-
* backfill on a large existing table
|
|
1792
|
+
* backfill on a large existing table — pre-existing rows stay unsearchable
|
|
1793
|
+
* until `__lunora_admin__:backfillSearch` is run against the deployment. `strategy: "native"` uses the engine's
|
|
1761
1794
|
* own full-text index where it has one (Postgres) — faster on large corpora,
|
|
1762
1795
|
* at the cost of the engine ranking rather than the shared scorer.
|
|
1763
1796
|
*/
|
|
@@ -2825,4 +2858,4 @@ interface StorageContextIn {
|
|
|
2825
2858
|
}
|
|
2826
2859
|
declare const storageRules: <Context extends StorageContextIn = StorageContextIn>(rules: ReadonlyArray<StorageRule<Context>>, options?: StorageRulesOptions) => Middleware<Context, Context>;
|
|
2827
2860
|
declare const VERSION = "0.0.0";
|
|
2828
|
-
export { type ActionBuilder, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, type DataModelInit, type DefineComponentOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, LunoraError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RelationBuilder, type RelationDefinition, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ShapeDefinition, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, allowAll, asBucketStorage, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, defineAggregateIndex, defineComponent, defineEnv, defineIdentity, defineListArgs, defineMigration, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, httpAction, httpRoute, httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isSafeHeaderValue, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject, storageRules, toWhereInput };
|
|
2861
|
+
export { type ActionBuilder, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, type DataModelInit, type DeferredDeleteFlushResult, type DefineComponentOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, LunoraError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RelationBuilder, type RelationDefinition, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ShapeDefinition, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, allowAll, asBucketStorage, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, defineAggregateIndex, defineComponent, defineEnv, defineIdentity, defineListArgs, defineMigration, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, flushDeferredDeletes, httpAction, httpRoute, httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isSafeHeaderValue, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject, storageRules, toWhereInput, withDeferredDeletes };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initLunora as t}from"./packem_shared/initLunora-B2sfmFJ6.mjs";import{createSecrets as i}from"./packem_shared/createSecrets-CyrEddTF.mjs";import{
|
|
1
|
+
import{initLunora as t}from"./packem_shared/initLunora-B2sfmFJ6.mjs";import{createSecrets as i}from"./packem_shared/createSecrets-CyrEddTF.mjs";import{flushDeferredDeletes as f,withDeferredDeletes as s}from"./packem_shared/flushDeferredDeletes-DEJXlhop.mjs";import{LunoraEnvError as m,defineEnv as p,redactSecrets as x}from"./packem_shared/LunoraEnvError-ByvihJFy.mjs";import{LunoraError as c}from"./packem_shared/LunoraError-DcKdk9Ti.mjs";import{bindOrm as E,bindTableFacade as g}from"./packem_shared/bindOrm-lWdeDi9P.mjs";import{httpAction as h,httpRoute as R,httpRouter as L,isSafeHeaderValue as I,serveStorageObject as P}from"./packem_shared/httpAction-D3b9-YiY.mjs";import{defineIdentity as A}from"./packem_shared/defineIdentity-DwkNKwYa.mjs";import{onConnect as T,onDisconnect as y,onShardInit as M}from"./packem_shared/onConnect-BLRoOpv2.mjs";import{DEFAULT_LIMIT as F,DEFAULT_MAX_LIMIT as k,clampLimit as C,defineListArgs as v}from"./packem_shared/DEFAULT_LIMIT-DC-M6faS.mjs";import{defineMigration as w}from"./packem_shared/defineMigration-7GI9Qbtd.mjs";import{defineMutator as O}from"./packem_shared/defineMutator-DKy8UtbB.mjs";import{c as j,d as B,a as W,b as H,e as J,f as Q,g as X,h as q,i as z,j as G,k as K,m as Y}from"./packem_shared/plugin-DQcLxTx1.mjs";import{PRESENCE_DEFAULT_TTL_MS as $,PRESENCE_TABLE as ee,definePresence as re,presenceExtension as oe}from"./packem_shared/PRESENCE_DEFAULT_TTL_MS-BpSPSCwL.mjs";import{protectPublic as ne}from"./packem_shared/protectPublic-Bo4G9xaV.mjs";import{onQueryChange as ae}from"./packem_shared/onQueryChange-DDxYz2CF.mjs";import{defineShape as se}from"./packem_shared/defineShape-DYxbNl5W.mjs";import{anyApi as me}from"./types.mjs";import{cronJobs as xe}from"@lunora/scheduler";import{ValidationError as ce,v as ue}from"@lunora/values";import{allowAll as ge,deny as Se,isDeny as he,toWhereInput as Re}from"./packem_shared/allowAll-DkRAgItV.mjs";import{asBucketStorage as Ie}from"./packem_shared/asBucketStorage-BthCnWop.mjs";import{buildMaskRegistry as be}from"./packem_shared/buildMaskRegistry-72SL8fJn.mjs";import{buildRlsReadRegistry as De,composeShapeReadWhere as Te}from"./packem_shared/buildRlsReadRegistry-Deq8inqS.mjs";import{createPolicyDsl as Me,definePermission as _e,definePolicies as Fe,definePolicy as ke,defineRole as Ce}from"./packem_shared/createPolicyDsl-DNfByAUX.mjs";import{defineStorageRule as Ve,defineStorageRules as we}from"./packem_shared/defineStorageRule-BvxHVq3b.mjs";import{mask as Oe}from"./packem_shared/mask-Da7q82ZC.mjs";import{r as je}from"./packem_shared/middleware-DEW0yLvU.mjs";import{storageRules as We}from"./packem_shared/storageRules-CyaiZ0av.mjs";const e="0.0.0";export{F as DEFAULT_LIMIT,k as DEFAULT_MAX_LIMIT,m as LunoraEnvError,c as LunoraError,$ as PRESENCE_DEFAULT_TTL_MS,ee as PRESENCE_TABLE,e as VERSION,ce as ValidationError,ge as allowAll,me as anyApi,Ie as asBucketStorage,E as bindOrm,g as bindTableFacade,be as buildMaskRegistry,De as buildRlsReadRegistry,C as clampLimit,j as composePluginMiddleware,Te as composeShapeReadWhere,Me as createPolicyDsl,i as createSecrets,xe as cronJobs,B as defineAggregateIndex,W as defineComponent,p as defineEnv,A as defineIdentity,v as defineListArgs,w as defineMigration,O as defineMutator,_e as definePermission,H as definePlugin,Fe as definePolicies,ke as definePolicy,re as definePresence,J as defineRankIndex,Ce as defineRole,Q as defineSchema,X as defineSchemaExtension,se as defineShape,Ve as defineStorageRule,we as defineStorageRules,q as defineTable,z as defineVectorIndex,Se as deny,f as flushDeferredDeletes,h as httpAction,R as httpRoute,L as httpRouter,G as indexFieldsFromSchema,t as initLunora,K as installPlugins,he as isDeny,I as isSafeHeaderValue,Oe as mask,Y as mergeSchemaExtension,T as onConnect,y as onDisconnect,ae as onQueryChange,M as onShardInit,oe as presenceExtension,ne as protectPublic,x as redactSecrets,je as rls,P as serveStorageObject,We as storageRules,Re as toWhereInput,ue as v,s as withDeferredDeletes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l=new WeakMap,i=f=>{const a=[],o=n=>{const e=n??{},s={...e,deleteAfterCommit:r=>{a.push({key:r,storage:e})}};return Object.setPrototypeOf(s,Object.getPrototypeOf(e)),typeof e.bucket=="function"&&(s.bucket=r=>o(e.bucket?.(r))),l.set(s,a),s};return o(f)},u=async f=>{const{log:a,storage:o}=f??{},n=typeof o=="object"&&o!==null?l.get(o):void 0;if(!n||n.length===0)return{attempted:0,failures:[]};const e=n.splice(0),r=(await Promise.allSettled(e.map(async({key:t,storage:c})=>{if(typeof c.delete!="function")throw new TypeError("ctx.storage: no storage configured, so the object was not deleted");await c.delete(t)}))).flatMap((t,c)=>t.status==="rejected"?[{error:t.reason,key:e[c]?.key??""}]:[]);for(const t of r)a?.warn("ctx.storage.deleteAfterCommit: delete failed, object leaked",{error:String(t.error),key:t.key});return{attempted:e.length,failures:r}};export{u as flushDeferredDeletes,i as withDeferredDeletes};
|
package/dist/types.d.mts
CHANGED
|
@@ -199,7 +199,13 @@ interface SearchIndexDefinition {
|
|
|
199
199
|
* added to a populated table works immediately. On a very large table that
|
|
200
200
|
* scan is expensive to run inside a deploy: `staged: true` maintains the
|
|
201
201
|
* index on write only and leaves the initial population to an out-of-band
|
|
202
|
-
*
|
|
202
|
+
* run.
|
|
203
|
+
*
|
|
204
|
+
* That run is mandatory, not optional — until it happens, every row written
|
|
205
|
+
* BEFORE the deploy is unsearchable. Drive it against a deployment with
|
|
206
|
+
* `lunora run '__lunora_admin__:backfillSearch' --args '{"maxPages":20}'`,
|
|
207
|
+
* repeating until the response reports `done: true`; progress is durable, so
|
|
208
|
+
* each call resumes where the last stopped.
|
|
203
209
|
*/
|
|
204
210
|
staged?: boolean;
|
|
205
211
|
/**
|
|
@@ -1659,6 +1665,25 @@ interface ReadOnlyStorage<Buckets extends string = string> {
|
|
|
1659
1665
|
*/
|
|
1660
1666
|
head: (key: string) => Promise<StorageObjectHead | null>;
|
|
1661
1667
|
}
|
|
1668
|
+
/**
|
|
1669
|
+
* `ctx.storage` inside a **mutation**: the read surface, plus the one write a
|
|
1670
|
+
* transactional context can safely express. See `@lunora/server`'s
|
|
1671
|
+
* `deferred-deletes.ts` for why `delete` itself stays action-only.
|
|
1672
|
+
*/
|
|
1673
|
+
interface MutationStorage<Buckets extends string = string> extends ReadOnlyStorage<Buckets> {
|
|
1674
|
+
/** Select a named bucket; deletes queued on it are flushed against that bucket. */
|
|
1675
|
+
bucket: (name: Buckets) => MutationStorage<Buckets>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Queue `key` for deletion once this mutation commits.
|
|
1678
|
+
*
|
|
1679
|
+
* Returns `void`, not a promise: nothing has been attempted yet, so the object
|
|
1680
|
+
* is still there on the next line. A rolled-back mutation never flushes, so
|
|
1681
|
+
* the row deletion and the object cleanup cannot disagree. A failed delete
|
|
1682
|
+
* leaks the object rather than failing a mutation that already succeeded, and
|
|
1683
|
+
* is logged with its key.
|
|
1684
|
+
*/
|
|
1685
|
+
deleteAfterCommit: (key: string) => void;
|
|
1686
|
+
}
|
|
1662
1687
|
interface Storage<Buckets extends string = string> extends ReadOnlyStorage<Buckets> {
|
|
1663
1688
|
/** Select a named bucket; the returned accessor exposes the full read/write surface. */
|
|
1664
1689
|
bucket: (name: Buckets) => Storage<Buckets>;
|
|
@@ -2171,7 +2196,7 @@ interface MutationCtx {
|
|
|
2171
2196
|
readonly secrets: Secrets;
|
|
2172
2197
|
/** Attach facts to THIS request's span — the wide event; see {@link LunoraWideEvent}. */
|
|
2173
2198
|
readonly span: LunoraWideEvent;
|
|
2174
|
-
readonly storage:
|
|
2199
|
+
readonly storage: MutationStorage;
|
|
2175
2200
|
/** Wrap a sub-operation in its own nested span; see {@link LunoraTracer}. */
|
|
2176
2201
|
readonly trace: LunoraTracer;
|
|
2177
2202
|
readonly vectors: VectorSearch;
|
|
@@ -2242,4 +2267,4 @@ interface ActionCtx {
|
|
|
2242
2267
|
*/
|
|
2243
2268
|
type AnyApi = Record<string, Record<string, RegisteredFunction<ArgsValidator, unknown, FunctionKind>>>;
|
|
2244
2269
|
declare const anyApi: AnyApi;
|
|
2245
|
-
export { type ActionCtx, type AggregateIndexDefinition, type AggregateOp, type AnyApi, type ArgsValidator, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type DurableObjectJurisdiction, type DurableStreamOptions, type ExposeConfig, type ExternalSourceCursor, type ExternalSourceDefinition, type ExternalSourceMode, type ExternalSourceRefresh, type FunctionKind, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type GlobalBackend, type IndexDefinition, type IndexRangeBuilder, type InferArgs, type LifecycleEvent, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type MutationCtx, type OnDeleteAction, type PaginationOptions, type PaginationResult, type QueryCtx, type RankIndexDefinition, type RankSortKey, type ReadOnlyStorage, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMutation, type RegisteredQuery, type RegisteredStream, type RelationDefinition, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type Schema, type SearchFilterBuilder, type SearchIndexDefinition, type SearchLanguage, type SearchStrategy, type Secrets, type SecretsStoreSecretLike, type ShardInitEvent, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableDefinition, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerBuilder, type TriggerCtx, type TriggerDatabase, type TriggerDefinition, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorEmbedder, type VectorIndexDefinition, type VectorMatch, type VectorMatches, type VectorMetric, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, type X402ProcedureConfig, anyApi };
|
|
2270
|
+
export { type ActionCtx, type AggregateIndexDefinition, type AggregateOp, type AnyApi, type ArgsValidator, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type DurableObjectJurisdiction, type DurableStreamOptions, type ExposeConfig, type ExternalSourceCursor, type ExternalSourceDefinition, type ExternalSourceMode, type ExternalSourceRefresh, type FunctionKind, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type GlobalBackend, type IndexDefinition, type IndexRangeBuilder, type InferArgs, type LifecycleEvent, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type MutationCtx, type MutationStorage, type OnDeleteAction, type PaginationOptions, type PaginationResult, type QueryCtx, type RankIndexDefinition, type RankSortKey, type ReadOnlyStorage, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMutation, type RegisteredQuery, type RegisteredStream, type RelationDefinition, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type Schema, type SearchFilterBuilder, type SearchIndexDefinition, type SearchLanguage, type SearchStrategy, type Secrets, type SecretsStoreSecretLike, type ShardInitEvent, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableDefinition, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerBuilder, type TriggerCtx, type TriggerDatabase, type TriggerDefinition, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorEmbedder, type VectorIndexDefinition, type VectorMatch, type VectorMatches, type VectorMetric, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, type X402ProcedureConfig, anyApi };
|
package/dist/types.d.ts
CHANGED
|
@@ -199,7 +199,13 @@ interface SearchIndexDefinition {
|
|
|
199
199
|
* added to a populated table works immediately. On a very large table that
|
|
200
200
|
* scan is expensive to run inside a deploy: `staged: true` maintains the
|
|
201
201
|
* index on write only and leaves the initial population to an out-of-band
|
|
202
|
-
*
|
|
202
|
+
* run.
|
|
203
|
+
*
|
|
204
|
+
* That run is mandatory, not optional — until it happens, every row written
|
|
205
|
+
* BEFORE the deploy is unsearchable. Drive it against a deployment with
|
|
206
|
+
* `lunora run '__lunora_admin__:backfillSearch' --args '{"maxPages":20}'`,
|
|
207
|
+
* repeating until the response reports `done: true`; progress is durable, so
|
|
208
|
+
* each call resumes where the last stopped.
|
|
203
209
|
*/
|
|
204
210
|
staged?: boolean;
|
|
205
211
|
/**
|
|
@@ -1659,6 +1665,25 @@ interface ReadOnlyStorage<Buckets extends string = string> {
|
|
|
1659
1665
|
*/
|
|
1660
1666
|
head: (key: string) => Promise<StorageObjectHead | null>;
|
|
1661
1667
|
}
|
|
1668
|
+
/**
|
|
1669
|
+
* `ctx.storage` inside a **mutation**: the read surface, plus the one write a
|
|
1670
|
+
* transactional context can safely express. See `@lunora/server`'s
|
|
1671
|
+
* `deferred-deletes.ts` for why `delete` itself stays action-only.
|
|
1672
|
+
*/
|
|
1673
|
+
interface MutationStorage<Buckets extends string = string> extends ReadOnlyStorage<Buckets> {
|
|
1674
|
+
/** Select a named bucket; deletes queued on it are flushed against that bucket. */
|
|
1675
|
+
bucket: (name: Buckets) => MutationStorage<Buckets>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Queue `key` for deletion once this mutation commits.
|
|
1678
|
+
*
|
|
1679
|
+
* Returns `void`, not a promise: nothing has been attempted yet, so the object
|
|
1680
|
+
* is still there on the next line. A rolled-back mutation never flushes, so
|
|
1681
|
+
* the row deletion and the object cleanup cannot disagree. A failed delete
|
|
1682
|
+
* leaks the object rather than failing a mutation that already succeeded, and
|
|
1683
|
+
* is logged with its key.
|
|
1684
|
+
*/
|
|
1685
|
+
deleteAfterCommit: (key: string) => void;
|
|
1686
|
+
}
|
|
1662
1687
|
interface Storage<Buckets extends string = string> extends ReadOnlyStorage<Buckets> {
|
|
1663
1688
|
/** Select a named bucket; the returned accessor exposes the full read/write surface. */
|
|
1664
1689
|
bucket: (name: Buckets) => Storage<Buckets>;
|
|
@@ -2171,7 +2196,7 @@ interface MutationCtx {
|
|
|
2171
2196
|
readonly secrets: Secrets;
|
|
2172
2197
|
/** Attach facts to THIS request's span — the wide event; see {@link LunoraWideEvent}. */
|
|
2173
2198
|
readonly span: LunoraWideEvent;
|
|
2174
|
-
readonly storage:
|
|
2199
|
+
readonly storage: MutationStorage;
|
|
2175
2200
|
/** Wrap a sub-operation in its own nested span; see {@link LunoraTracer}. */
|
|
2176
2201
|
readonly trace: LunoraTracer;
|
|
2177
2202
|
readonly vectors: VectorSearch;
|
|
@@ -2242,4 +2267,4 @@ interface ActionCtx {
|
|
|
2242
2267
|
*/
|
|
2243
2268
|
type AnyApi = Record<string, Record<string, RegisteredFunction<ArgsValidator, unknown, FunctionKind>>>;
|
|
2244
2269
|
declare const anyApi: AnyApi;
|
|
2245
|
-
export { type ActionCtx, type AggregateIndexDefinition, type AggregateOp, type AnyApi, type ArgsValidator, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type DurableObjectJurisdiction, type DurableStreamOptions, type ExposeConfig, type ExternalSourceCursor, type ExternalSourceDefinition, type ExternalSourceMode, type ExternalSourceRefresh, type FunctionKind, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type GlobalBackend, type IndexDefinition, type IndexRangeBuilder, type InferArgs, type LifecycleEvent, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type MutationCtx, type OnDeleteAction, type PaginationOptions, type PaginationResult, type QueryCtx, type RankIndexDefinition, type RankSortKey, type ReadOnlyStorage, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMutation, type RegisteredQuery, type RegisteredStream, type RelationDefinition, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type Schema, type SearchFilterBuilder, type SearchIndexDefinition, type SearchLanguage, type SearchStrategy, type Secrets, type SecretsStoreSecretLike, type ShardInitEvent, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableDefinition, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerBuilder, type TriggerCtx, type TriggerDatabase, type TriggerDefinition, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorEmbedder, type VectorIndexDefinition, type VectorMatch, type VectorMatches, type VectorMetric, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, type X402ProcedureConfig, anyApi };
|
|
2270
|
+
export { type ActionCtx, type AggregateIndexDefinition, type AggregateOp, type AnyApi, type ArgsValidator, type AuthState, type CachePurge, type DatabaseReader, type DatabaseWriter, type DurableObjectJurisdiction, type DurableStreamOptions, type ExposeConfig, type ExternalSourceCursor, type ExternalSourceDefinition, type ExternalSourceMode, type ExternalSourceRefresh, type FunctionKind, type FunctionVisibility, type GeoBoundingBox, type GeoFilterBuilder, type GeoIndexDefinition, type GeoPointInput, type GlobalBackend, type IndexDefinition, type IndexRangeBuilder, type InferArgs, type LifecycleEvent, type LifecycleEventKind, type LogFields, type LunoraLogMethod, type LunoraLogger, type LunoraMetrics, type LunoraTracer, type LunoraWideEvent, type MutationCtx, type MutationStorage, type OnDeleteAction, type PaginationOptions, type PaginationResult, type QueryCtx, type RankIndexDefinition, type RankSortKey, type ReadOnlyStorage, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMutation, type RegisteredQuery, type RegisteredStream, type RelationDefinition, type RestCacheConfig, type RunQueryOptions, type ScheduledFunctionDoc, type ScheduledJob, type Scheduler, type Schema, type SearchFilterBuilder, type SearchIndexDefinition, type SearchLanguage, type SearchStrategy, type Secrets, type SecretsStoreSecretLike, type ShardInitEvent, type ShardMode, type SpanEvaluation, type SpanHandle, type SpanKind, type SpanLink, type SpanOptions, type Storage, type StorageMetadata, type StorageObjectHead, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemTableName, type TableDefinition, type TableReader, type TableVectorIndex, type TriggerAggregateOptions, type TriggerBuilder, type TriggerCtx, type TriggerDatabase, type TriggerDefinition, type TriggerDeleteEvent, type TriggerEvent, type TriggerGroupByEntry, type TriggerGroupByOptions, type TriggerHandler, type TriggerInsertEvent, type TriggerOp, type TriggerQueryArgs, type TriggerQueryPage, type TriggerRankOptions, type TriggerRankPageOptions, type TriggerRankResult, type TriggerRow, type TriggerTiming, type TriggerUpdateEvent, type TtlDefinition, type VectorEmbedder, type VectorIndexDefinition, type VectorMatch, type VectorMatches, type VectorMetric, type VectorQueryInput, type VectorRecord, type VectorSearch, type VectorSearchReader, type VectorUpsertInput, type WorkflowCreateOptions, type WorkflowEventDefinition, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceStatus, type WorkflowStatusResult, type Workflows, type X402ProcedureConfig, anyApi };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/server",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.84",
|
|
4
4
|
"description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backend",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
70
|
-
"@lunora/scheduler": "1.0.0-alpha.
|
|
71
|
-
"@lunora/values": "1.0.0-alpha.
|
|
69
|
+
"@lunora/errors": "1.0.0-alpha.24",
|
|
70
|
+
"@lunora/scheduler": "1.0.0-alpha.39",
|
|
71
|
+
"@lunora/values": "1.0.0-alpha.29",
|
|
72
72
|
"drizzle-orm": "^0.45.2",
|
|
73
73
|
"hono": "^4.13.1"
|
|
74
74
|
},
|