@duraxis/core 0.2.2 → 0.4.0
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/CHANGELOG.md +21 -0
- package/README.md +28 -1
- package/dist/commit/commit-coordinator.d.ts +3 -1
- package/dist/database/duraxis-database.d.ts +39 -5
- package/dist/gc/garbage-collector.d.ts +5 -1
- package/dist/gc/reachability-scanner.d.ts +7 -2
- package/dist/gc/storage-coordination.d.ts +10 -0
- package/dist/index.cjs +1817 -576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1812 -578
- package/dist/index.js.map +1 -1
- package/dist/indexes/bptree/bptree-node-cache.d.ts +7 -2
- package/dist/indexes/secondary/secondary-index-manager.d.ts +2 -4
- package/dist/query/context/query-context.d.ts +26 -9
- package/dist/query/executor/query-executor.d.ts +3 -0
- package/dist/query/model/cursor.d.ts +9 -2
- package/dist/query/planner/rule-based-planner.d.ts +4 -1
- package/dist/query/validation/query-validator.d.ts +5 -1
- package/dist/relations/foreign-key-manager.d.ts +1 -1
- package/dist/resources/operation-owner.d.ts +25 -0
- package/dist/resources/prepared-writes.d.ts +11 -0
- package/dist/resources/resource-manager.d.ts +64 -0
- package/dist/security/storage-key-manager.d.ts +1 -0
- package/dist/transactions/transaction.d.ts +43 -4
- package/package.json +4 -4
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
import { ResourceScope } from "../../resources/resource-manager.js";
|
|
1
2
|
import type { BPlusTreeNode, BPlusTreeNodeIO, NodeId } from "./bptree-node.js";
|
|
2
|
-
/** Query-scoped LRU for already integrity-checked immutable nodes. */
|
|
3
3
|
export declare class BPlusTreeNodeCache implements BPlusTreeNodeIO {
|
|
4
4
|
private readonly source;
|
|
5
5
|
private readonly capacity;
|
|
6
|
+
private readonly maxBytes;
|
|
6
7
|
private readonly entries;
|
|
8
|
+
private readonly sizes;
|
|
9
|
+
private bytes;
|
|
10
|
+
private readonly reservation;
|
|
7
11
|
private hits;
|
|
8
12
|
private misses;
|
|
9
|
-
constructor(source: BPlusTreeNodeIO, capacity?: number);
|
|
13
|
+
constructor(source: BPlusTreeNodeIO, capacity?: number, maxBytes?: number, resources?: ResourceScope);
|
|
10
14
|
read(ref: NodeId): Promise<BPlusTreeNode>;
|
|
11
15
|
write(node: BPlusTreeNode): Promise<NodeId>;
|
|
12
16
|
clear(): void;
|
|
13
17
|
getMetrics(): {
|
|
14
18
|
readonly hits: number;
|
|
15
19
|
readonly misses: number;
|
|
20
|
+
readonly bytes: number;
|
|
16
21
|
};
|
|
17
22
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ResourceScope } from "../../resources/resource-manager.js";
|
|
1
2
|
import type { StorageDriver } from "@duraxis/storage";
|
|
2
3
|
import type { Manifest } from "../../commit/manifest.js";
|
|
3
4
|
import type { PendingWrite } from "../../transactions/transaction.js";
|
|
@@ -8,9 +9,7 @@ import type { BPlusTreeNodeIO, ScanMetrics } from "../bptree/bptree-node.js";
|
|
|
8
9
|
export interface SecondaryIndexScanOptions {
|
|
9
10
|
readonly eq?: IndexScalar | readonly IndexScalar[];
|
|
10
11
|
readonly prefix?: readonly IndexScalar[];
|
|
11
|
-
/** Logical range on the component immediately following prefix. */
|
|
12
12
|
readonly range?: SecondaryIndexLogicalRange;
|
|
13
|
-
/** Legacy shorthand: preceding tuple values are treated as an equality prefix. */
|
|
14
13
|
readonly gt?: readonly IndexScalar[];
|
|
15
14
|
readonly gte?: readonly IndexScalar[];
|
|
16
15
|
readonly lt?: readonly IndexScalar[];
|
|
@@ -40,11 +39,10 @@ export declare class SecondaryIndexManager {
|
|
|
40
39
|
private readonly nodes;
|
|
41
40
|
private readonly primary;
|
|
42
41
|
constructor(storage: StorageDriver, keys: StorageKeyManager, nodes?: BPlusTreeNodeIO);
|
|
43
|
-
prepare(previousManifest: Manifest, nextPrimaryRoot: string | null, writes: ReadonlyMap<string, PendingWrite>, catalog: ReadonlyMap<string, CollectionDefinition
|
|
42
|
+
prepare(previousManifest: Manifest, nextPrimaryRoot: string | null, writes: ReadonlyMap<string, PendingWrite>, catalog: ReadonlyMap<string, CollectionDefinition>, resources?: ResourceScope): Promise<Map<string, string | null>>;
|
|
44
43
|
private collectChanges;
|
|
45
44
|
private rebuild;
|
|
46
45
|
private resolve;
|
|
47
|
-
/** Ordered, incremental access that never materializes the ID set. */
|
|
48
46
|
scanIds(manifest: Manifest, collection: string, indexName: string, options?: SecondaryIndexScanOptions): AsyncIterable<SecondaryIndexEntry>;
|
|
49
47
|
lookupIds(manifest: Manifest, collection: string, indexName: string, value: IndexScalar | readonly IndexScalar[], limit?: number): Promise<string[]>;
|
|
50
48
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResourceScope, type ResourceLimits } from "../../resources/resource-manager.js";
|
|
1
2
|
import type { StorageDriver } from "@duraxis/storage";
|
|
2
3
|
import type { Snapshot } from "../../commit/manifest.js";
|
|
3
4
|
import { type CollectionDefinition, type DocumentRecord } from "../../catalog/collection-schema.js";
|
|
@@ -17,15 +18,22 @@ export interface QueryMetrics {
|
|
|
17
18
|
durationMs: number;
|
|
18
19
|
}
|
|
19
20
|
export interface QueryContextOptions {
|
|
21
|
+
readonly assertAccess?: () => void;
|
|
22
|
+
readonly resources?: ResourceScope;
|
|
23
|
+
readonly limits?: ResourceLimits;
|
|
20
24
|
readonly writes?: ReadonlyMap<string, PendingWrite>;
|
|
21
25
|
readonly catalog?: ReadonlyMap<string, CollectionDefinition>;
|
|
22
26
|
readonly onIteratorStart?: () => void;
|
|
23
27
|
readonly onIteratorEnd?: () => void;
|
|
24
28
|
readonly onClose?: () => void;
|
|
29
|
+
readonly onPendingCleanup?: (promise: Promise<unknown>) => void;
|
|
30
|
+
readonly onCleanupFailure?: (error: unknown) => void;
|
|
25
31
|
}
|
|
26
32
|
export declare class QueryContext {
|
|
27
|
-
readonly snapshot: Snapshot;
|
|
28
33
|
private readonly options;
|
|
34
|
+
readonly resources: ResourceScope;
|
|
35
|
+
readonly limits: Readonly<ResourceLimits>;
|
|
36
|
+
private readonly iteratorReservations;
|
|
29
37
|
private readonly primary;
|
|
30
38
|
private readonly secondary;
|
|
31
39
|
private readonly nodeCache;
|
|
@@ -34,13 +42,26 @@ export declare class QueryContext {
|
|
|
34
42
|
private readonly startedAt;
|
|
35
43
|
private active;
|
|
36
44
|
private iterators;
|
|
45
|
+
private readonly timer;
|
|
46
|
+
private readonly cancellationReturns;
|
|
37
47
|
readonly metrics: QueryMetrics;
|
|
38
|
-
|
|
48
|
+
private snapshotValue?;
|
|
49
|
+
get snapshot(): Snapshot;
|
|
50
|
+
private readonly catalogValue;
|
|
51
|
+
get catalog(): ReadonlyMap<string, CollectionDefinition>;
|
|
39
52
|
constructor(storage: StorageDriver, snapshot: Snapshot, keys: StorageKeyManager, options?: QueryContextOptions);
|
|
40
53
|
get generation(): string;
|
|
41
54
|
get signal(): AbortSignal;
|
|
42
55
|
get isActive(): boolean;
|
|
43
|
-
close(
|
|
56
|
+
bindCancellation(close: () => Promise<unknown>): () => void;
|
|
57
|
+
private managed;
|
|
58
|
+
scanCollection(collection: string, options?: {
|
|
59
|
+
readonly direction?: "ASC" | "DESC";
|
|
60
|
+
readonly limit?: number;
|
|
61
|
+
readonly signal?: AbortSignal;
|
|
62
|
+
}): AsyncIterable<QueryRow>;
|
|
63
|
+
scanIndex(collection: string, index: string, options?: SecondaryIndexScanOptions): AsyncIterable<QueryRow>;
|
|
64
|
+
close(reason?: unknown, cleanup?: () => Promise<unknown>): void;
|
|
44
65
|
cancel(reason?: unknown): void;
|
|
45
66
|
assertActive(): void;
|
|
46
67
|
private begin;
|
|
@@ -48,11 +69,7 @@ export declare class QueryContext {
|
|
|
48
69
|
private schema;
|
|
49
70
|
getDocument(collection: string, id: string): Promise<DocumentRecord | null>;
|
|
50
71
|
private pendingFor;
|
|
51
|
-
|
|
52
|
-
readonly direction?: "ASC" | "DESC";
|
|
53
|
-
readonly limit?: number;
|
|
54
|
-
readonly signal?: AbortSignal;
|
|
55
|
-
}): AsyncIterable<QueryRow>;
|
|
72
|
+
private scanCollectionRows;
|
|
56
73
|
private pendingIndexEntries;
|
|
57
|
-
|
|
74
|
+
private scanIndexRows;
|
|
58
75
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AccessPath, LogicalQuery } from "../model/query.js";
|
|
2
|
+
import { type CursorKeyring } from "../model/cursor.js";
|
|
2
3
|
import type { QueryContext } from "../context/query-context.js";
|
|
3
4
|
import type { QueryRow } from "./predicate.js";
|
|
4
5
|
import { type QueryOperator, type SortSpillStore } from "./operators/operators.js";
|
|
@@ -10,6 +11,8 @@ export interface QueryExecutorOptions {
|
|
|
10
11
|
readonly maxSortRowsInMemory?: number;
|
|
11
12
|
readonly sortSpill?: SortSpillStore;
|
|
12
13
|
readonly cursorSigningKey?: Uint8Array;
|
|
14
|
+
readonly cursorEncryption?: CursorKeyring;
|
|
15
|
+
readonly cursorNamespace?: string;
|
|
13
16
|
readonly signal?: AbortSignal;
|
|
14
17
|
}
|
|
15
18
|
export declare class QueryExecutor {
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { type CollectionDefinition, type IndexScalar } from "../../catalog/collection-schema.js";
|
|
2
2
|
import type { LogicalQuery } from "./query.js";
|
|
3
3
|
import type { QueryRow } from "../executor/predicate.js";
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export interface CursorKeyring {
|
|
5
|
+
readonly activeKeyId: string;
|
|
6
|
+
readonly keys: Readonly<Record<string, Uint8Array>>;
|
|
7
|
+
readonly ttlMs?: number;
|
|
8
|
+
readonly allowLegacySigned?: boolean;
|
|
9
|
+
readonly legacySigningKey?: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export declare function encodeQueryCursor(generation: string, schema: CollectionDefinition, query: LogicalQuery, row: QueryRow, keys: Uint8Array | CursorKeyring, namespace?: string): string;
|
|
12
|
+
export declare function decodeQueryCursor(cursor: string, generation: string, schema: CollectionDefinition, query: LogicalQuery, keys: Uint8Array | CursorKeyring, namespace?: string): {
|
|
6
13
|
readonly values: readonly (IndexScalar | undefined)[];
|
|
7
14
|
readonly id: string;
|
|
8
15
|
};
|
|
@@ -5,6 +5,9 @@ import type { PhysicalPlan } from "./physical-plan.js";
|
|
|
5
5
|
export declare class RuleBasedPlanner {
|
|
6
6
|
private readonly enumerator;
|
|
7
7
|
constructor(enumerator?: AccessPathEnumerator);
|
|
8
|
-
plan(query: LogicalQuery, catalog: ReadonlyMap<string, CollectionDefinition
|
|
8
|
+
plan(query: LogicalQuery, catalog: ReadonlyMap<string, CollectionDefinition>, limits?: {
|
|
9
|
+
readonly maxPredicateDepth: number;
|
|
10
|
+
readonly maxPredicateNodes: number;
|
|
11
|
+
}): PhysicalPlan;
|
|
9
12
|
private choose;
|
|
10
13
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type CollectionDefinition } from "../../catalog/collection-schema.js";
|
|
2
2
|
import type { LogicalQuery } from "../model/query.js";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function validatePredicateComplexity(query: LogicalQuery, maxDepth?: number, maxNodes?: number): void;
|
|
4
|
+
export declare function validateQuery(query: LogicalQuery, catalog: ReadonlyMap<string, CollectionDefinition>, limits?: {
|
|
5
|
+
readonly maxPredicateDepth: number;
|
|
6
|
+
readonly maxPredicateNodes: number;
|
|
7
|
+
}): CollectionDefinition;
|
|
@@ -6,7 +6,7 @@ import type { PendingWrite } from "../transactions/transaction.js";
|
|
|
6
6
|
export declare class ForeignKeyManager {
|
|
7
7
|
#private;
|
|
8
8
|
constructor(storage: StorageDriver, keys?: StorageKeyManager);
|
|
9
|
-
prepare(snapshot: Snapshot, sourceWrites: ReadonlyMap<string, PendingWrite>, sourceCatalog: ReadonlyMap<string, CollectionDefinition>): Promise<Map<string, PendingWrite>>;
|
|
9
|
+
prepare(snapshot: Snapshot, sourceWrites: ReadonlyMap<string, PendingWrite>, sourceCatalog: ReadonlyMap<string, CollectionDefinition>, targetWrites?: Map<string, PendingWrite>): Promise<Map<string, PendingWrite>>;
|
|
10
10
|
private validateCatalog;
|
|
11
11
|
private incoming;
|
|
12
12
|
private childIds;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StorageDriver } from "@duraxis/storage";
|
|
2
|
+
import { ResourceScope } from "./resource-manager.js";
|
|
3
|
+
export declare class OperationOwner {
|
|
4
|
+
readonly scope: ResourceScope;
|
|
5
|
+
private readonly onDispose;
|
|
6
|
+
readonly controller: AbortController;
|
|
7
|
+
readonly storage: StorageDriver;
|
|
8
|
+
private pending;
|
|
9
|
+
private ended;
|
|
10
|
+
private disposed;
|
|
11
|
+
private publishing;
|
|
12
|
+
private readonly timer;
|
|
13
|
+
constructor(scope: ResourceScope, storage: StorageDriver, durationMs: number, onDispose: () => void, maxReadBytes?: number);
|
|
14
|
+
get signal(): AbortSignal;
|
|
15
|
+
get isDisposed(): boolean;
|
|
16
|
+
get pendingOperations(): number;
|
|
17
|
+
assertActive(): void;
|
|
18
|
+
private track;
|
|
19
|
+
protectPublication(): void;
|
|
20
|
+
cancel(reason?: unknown): void;
|
|
21
|
+
finish(): void;
|
|
22
|
+
private disposeIfReady;
|
|
23
|
+
holdCleanup(promise: Promise<unknown>): void;
|
|
24
|
+
wait<T>(promise: Promise<T>): Promise<T>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ResourceLimits, type ResourceScope } from "./resource-manager.js";
|
|
2
|
+
import type { PendingWrite } from "../transactions/transaction.js";
|
|
3
|
+
export declare class PreparedWrites extends Map<string, PendingWrite> {
|
|
4
|
+
private readonly limits;
|
|
5
|
+
private bytes;
|
|
6
|
+
private encodedBytes;
|
|
7
|
+
private readonly reservation;
|
|
8
|
+
constructor(scope: ResourceScope, limits: ResourceLimits, source: ReadonlyMap<string, PendingWrite>);
|
|
9
|
+
private sizeOf;
|
|
10
|
+
set(key: string, value: PendingWrite): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type Resource = "workingBytes" | "writeBytes" | "writes" | "resultRows" | "resultBytes" | "transactions" | "queries" | "snapshots" | "iterators" | "pendingOperations" | "queuedOperations" | "spillBytes";
|
|
2
|
+
export type ResourceAmounts = Partial<Record<Resource, number>>;
|
|
3
|
+
export interface ResourceLimits {
|
|
4
|
+
readonly maxConcurrentTransactions: number;
|
|
5
|
+
readonly maxConcurrentQueries: number;
|
|
6
|
+
readonly maxOpenSnapshots: number;
|
|
7
|
+
readonly maxOpenIterators: number;
|
|
8
|
+
readonly maxPendingOperations: number;
|
|
9
|
+
readonly maxQueuedOperations: number;
|
|
10
|
+
readonly maxPendingWrites: number;
|
|
11
|
+
readonly maxPendingWriteBytes: number;
|
|
12
|
+
readonly maxResultRows: number;
|
|
13
|
+
readonly maxResultBytes: number;
|
|
14
|
+
readonly maxQueryWorkingBytes: number;
|
|
15
|
+
readonly maxTransactionWorkingBytes: number;
|
|
16
|
+
readonly maxDatabaseWorkingBytes: number;
|
|
17
|
+
readonly maxStorageReadBytes: number;
|
|
18
|
+
readonly maxDocumentBytes: number;
|
|
19
|
+
readonly maxDocumentDepth: number;
|
|
20
|
+
readonly maxPredicateDepth: number;
|
|
21
|
+
readonly maxPredicateNodes: number;
|
|
22
|
+
readonly maxTransactionDurationMs: number;
|
|
23
|
+
readonly maxQueryDurationMs: number;
|
|
24
|
+
readonly maxSnapshotLifetimeMs: number;
|
|
25
|
+
readonly maxSpillBytes: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_RESOURCE_LIMITS: Readonly<ResourceLimits>;
|
|
28
|
+
export declare class ResourceExhaustedError extends Error {
|
|
29
|
+
readonly resource: string;
|
|
30
|
+
readonly limit: number;
|
|
31
|
+
constructor(resource: string, limit: number);
|
|
32
|
+
}
|
|
33
|
+
export declare class OperationCancelledError extends Error {
|
|
34
|
+
constructor(message?: string);
|
|
35
|
+
}
|
|
36
|
+
export declare function resourceLimits(options?: Partial<ResourceLimits>): Readonly<ResourceLimits>;
|
|
37
|
+
export interface ResourceReservation {
|
|
38
|
+
resize(amounts: ResourceAmounts): void;
|
|
39
|
+
release(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare class ResourceScope {
|
|
42
|
+
private readonly limits;
|
|
43
|
+
private readonly parent?;
|
|
44
|
+
private readonly usage;
|
|
45
|
+
private readonly high;
|
|
46
|
+
private readonly children;
|
|
47
|
+
private closed;
|
|
48
|
+
constructor(limits: ResourceAmounts, parent?: ResourceScope | undefined);
|
|
49
|
+
child(limits: ResourceAmounts): ResourceScope;
|
|
50
|
+
private assertOpen;
|
|
51
|
+
private change;
|
|
52
|
+
reserve(initial: ResourceAmounts): ResourceReservation;
|
|
53
|
+
metrics(): {
|
|
54
|
+
current: ResourceAmounts;
|
|
55
|
+
highWater: ResourceAmounts;
|
|
56
|
+
};
|
|
57
|
+
close(): void;
|
|
58
|
+
}
|
|
59
|
+
export declare function databaseScope(limits: ResourceLimits): ResourceScope;
|
|
60
|
+
export declare function estimateBytes(value: unknown, maximum?: number, maxDepth?: number): number;
|
|
61
|
+
export declare function materialize<T>(scope: ResourceScope, limits: ResourceLimits): {
|
|
62
|
+
add(value: T): void;
|
|
63
|
+
close(): void;
|
|
64
|
+
};
|
|
@@ -9,6 +9,7 @@ export declare class StorageKeyManager {
|
|
|
9
9
|
private readonly commitPattern;
|
|
10
10
|
constructor(namespace?: string);
|
|
11
11
|
validateLogicalKey(key: string): void;
|
|
12
|
+
validatePrimaryKey(key: string): void;
|
|
12
13
|
objectKey(data: Uint8Array): string;
|
|
13
14
|
commitKey(id: string, data: Uint8Array): string;
|
|
14
15
|
validateObjectKey(key: string): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CursorKeyring } from "../query/model/cursor.js";
|
|
2
|
+
import { ResourceScope, type ResourceLimits } from "../resources/resource-manager.js";
|
|
1
3
|
import type { StorageDriver } from "@duraxis/storage";
|
|
2
4
|
import type { Snapshot } from "../commit/manifest.js";
|
|
3
5
|
import { StorageKeyManager } from "../security/storage-key-manager.js";
|
|
@@ -17,23 +19,45 @@ export type PendingWrite = {
|
|
|
17
19
|
export interface PreparedTransaction {
|
|
18
20
|
readonly snapshot: Snapshot;
|
|
19
21
|
readonly writes: ReadonlyMap<string, PendingWrite>;
|
|
20
|
-
readonly schemaChanges: ReadonlyMap<string, CollectionDefinition>;
|
|
22
|
+
readonly schemaChanges: ReadonlyMap<string, CollectionDefinition | null>;
|
|
21
23
|
}
|
|
22
24
|
export declare class Transaction {
|
|
23
25
|
private readonly storage;
|
|
24
26
|
private readonly keys;
|
|
25
27
|
private readonly cursorSigningKey?;
|
|
28
|
+
private readonly operationSignal?;
|
|
29
|
+
private readonly onPublication?;
|
|
30
|
+
private readonly assertAccessScope?;
|
|
31
|
+
private readonly runtimeHooks;
|
|
32
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
33
|
+
private readonly pendingCleanup;
|
|
34
|
+
private readonly localCancellation;
|
|
35
|
+
readonly signal: AbortSignal;
|
|
36
|
+
readonly resources: ResourceScope;
|
|
37
|
+
readonly limits: Readonly<ResourceLimits>;
|
|
38
|
+
private readonly writeReservations;
|
|
39
|
+
private readonly schemaReservations;
|
|
26
40
|
private readonly writes;
|
|
27
41
|
private readonly schemas;
|
|
28
|
-
private
|
|
29
|
-
private
|
|
42
|
+
private snapshotValue?;
|
|
43
|
+
private get capturedSnapshot();
|
|
44
|
+
private set capturedSnapshot(value);
|
|
45
|
+
private readerValue?;
|
|
46
|
+
private get reader();
|
|
47
|
+
private set reader(value);
|
|
30
48
|
private stateValue;
|
|
31
49
|
private pendingReads;
|
|
32
50
|
private readonly readWaiters;
|
|
33
51
|
private readonly queryContexts;
|
|
34
52
|
private readonly planner;
|
|
35
53
|
private readonly planCompiler;
|
|
36
|
-
constructor(storage: StorageDriver, snapshot: Snapshot, keys?: StorageKeyManager, cursorSigningKey?: Uint8Array | undefined)
|
|
54
|
+
constructor(storage: StorageDriver, snapshot: Snapshot, keys?: StorageKeyManager, cursorSigningKey?: Uint8Array | undefined, parentResources?: ResourceScope, limits?: ResourceLimits, operationSignal?: AbortSignal | undefined, onPublication?: (() => void) | undefined, assertAccessScope?: (() => void) | undefined, runtimeHooks?: {
|
|
55
|
+
readonly cursorEncryption?: CursorKeyring;
|
|
56
|
+
readonly onPendingCleanup?: (promise: Promise<unknown>) => void;
|
|
57
|
+
readonly onCleanupFailure?: (error: unknown) => void;
|
|
58
|
+
});
|
|
59
|
+
get expectedStorageVersion(): string | null;
|
|
60
|
+
get hasChanges(): boolean;
|
|
37
61
|
get state(): TransactionState;
|
|
38
62
|
get hasPendingReads(): boolean;
|
|
39
63
|
get(key: string): Promise<Uint8Array | null>;
|
|
@@ -41,6 +65,13 @@ export declare class Transaction {
|
|
|
41
65
|
delete(key: string): void;
|
|
42
66
|
defineCollection(definition: CollectionDefinition): void;
|
|
43
67
|
defineCollections(definitions: readonly CollectionDefinition[]): void;
|
|
68
|
+
getCollectionDefinitions(): readonly CollectionDefinition[];
|
|
69
|
+
alterCollection(name: string, definition: CollectionDefinition): void;
|
|
70
|
+
dropCollection(name: string): void;
|
|
71
|
+
getMetadata(namespace: string): Promise<Uint8Array | null>;
|
|
72
|
+
putMetadata(namespace: string, data: Uint8Array): void;
|
|
73
|
+
private metadataKey;
|
|
74
|
+
scanCollection(collection: string): AsyncIterable<QueryRow>;
|
|
44
75
|
addIndex(collection: string, index: SecondaryIndexDefinition): void;
|
|
45
76
|
removeIndex(collection: string, indexName: string): void;
|
|
46
77
|
getDocument(collection: string, id: string): Promise<DocumentRecord | null>;
|
|
@@ -57,7 +88,15 @@ export declare class Transaction {
|
|
|
57
88
|
markCommitted(): void;
|
|
58
89
|
markUnknown(): void;
|
|
59
90
|
abort(): void;
|
|
91
|
+
rejectPublication(): void;
|
|
60
92
|
close(): void;
|
|
93
|
+
createMaterializationBudget<T>(): {
|
|
94
|
+
add(value: T): void;
|
|
95
|
+
close(): void;
|
|
96
|
+
};
|
|
97
|
+
private reserveWrite;
|
|
98
|
+
private stageDelete;
|
|
99
|
+
private stageSchema;
|
|
61
100
|
private stagePut;
|
|
62
101
|
private releaseRead;
|
|
63
102
|
private queryOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duraxis/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Transactional embedded database engine and query primitives for Duraxis.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "João Paulo Dias <joaopdias.dev@gmail.com>",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://github.com/Joaopdiasventura/Duraxis/issues"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
24
|
+
"node": ">=24.15.0"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
],
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@duraxis/storage": "0.
|
|
49
|
+
"@duraxis/storage": "0.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@duraxis/storage-memory": "0.
|
|
52
|
+
"@duraxis/storage-memory": "0.2.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "vite build && tsc -p tsconfig.build.json",
|