document-dataply 0.0.10-alpha.3 → 0.0.10-alpha.5

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.
@@ -0,0 +1,105 @@
1
+ import type { AnalysisHeader, DocumentJSON, FlattenedDocumentJSON } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import type { AnalysisProvider } from './AnalysisProvider';
4
+ import { Transaction } from 'dataply';
5
+ export declare class AnalysisManager<T extends DocumentJSON> {
6
+ private api;
7
+ private providers;
8
+ constructor(api: DocumentDataplyAPI<T>);
9
+ /**
10
+ * Register all built-in analysis providers.
11
+ * Each provider class is instantiated with the API reference and registered.
12
+ */
13
+ registerBuiltinProviders(): void;
14
+ /**
15
+ * Register an analysis provider.
16
+ * @param provider The provider instance to register
17
+ */
18
+ registerProvider(provider: AnalysisProvider<T>): void;
19
+ /**
20
+ * Get a registered analysis provider by name.
21
+ * @param name The provider name
22
+ * @returns The provider instance, or null if not found
23
+ */
24
+ getProvider<P extends AnalysisProvider<T> = AnalysisProvider<T>>(name: string): P | null;
25
+ /**
26
+ * Initialize all registered providers by loading existing data from disk.
27
+ * Should be called after database initialization.
28
+ * @param tx The transaction to use
29
+ */
30
+ initializeProviders(tx: Transaction): Promise<void>;
31
+ /**
32
+ * Notify all realtime providers that documents were inserted.
33
+ * Data is persisted immediately after each provider processes the mutation.
34
+ * @param documents The flattened documents that were inserted
35
+ * @param tx The transaction to use
36
+ */
37
+ notifyInsert(documents: FlattenedDocumentJSON[], tx: Transaction): Promise<void>;
38
+ /**
39
+ * Notify all realtime providers that documents were deleted.
40
+ * Data is persisted immediately after each provider processes the mutation.
41
+ * @param documents The flattened documents that were deleted
42
+ * @param tx The transaction to use
43
+ */
44
+ notifyDelete(documents: FlattenedDocumentJSON[], tx: Transaction): Promise<void>;
45
+ /**
46
+ * Notify all realtime providers that documents were updated.
47
+ * Data is persisted immediately after each provider processes the mutation.
48
+ * @param pairs Array of { oldDocument, newDocument } pairs
49
+ * @param tx The transaction to use
50
+ */
51
+ notifyUpdate(pairs: {
52
+ oldDocument: FlattenedDocumentJSON;
53
+ newDocument: FlattenedDocumentJSON;
54
+ }[], tx: Transaction): Promise<void>;
55
+ /**
56
+ * Flush all interval providers' data to disk.
57
+ * @param tx The transaction to use (must be a write transaction)
58
+ */
59
+ flush(tx: Transaction): Promise<void>;
60
+ /**
61
+ * Get the analysis header row.
62
+ * Returns null if no analysis header exists yet.
63
+ * @param tx The transaction to use
64
+ */
65
+ getAnalysisHeader(tx: Transaction): Promise<AnalysisHeader | null>;
66
+ /**
67
+ * Get the analysis header row, creating it if it doesn't exist.
68
+ * @param tx The transaction to use (must be a write transaction)
69
+ */
70
+ getOrCreateAnalysisHeader(tx: Transaction): Promise<AnalysisHeader>;
71
+ /**
72
+ * Get analysis data for a specific type as a raw string.
73
+ * Returns null if the type doesn't exist in the analysis header.
74
+ * @param type The analysis type name
75
+ * @param tx The transaction to use
76
+ */
77
+ getAnalysisData(type: string, tx: Transaction): Promise<string | null>;
78
+ /**
79
+ * Set analysis data for a specific type.
80
+ * Creates a new overflow row if the type doesn't exist yet,
81
+ * or updates the existing row if it does.
82
+ * @param type The analysis type name
83
+ * @param data The raw string data to store
84
+ * @param tx The transaction to use (must be a write transaction)
85
+ */
86
+ setAnalysisData(type: string, data: string, tx: Transaction): Promise<void>;
87
+ /**
88
+ * Delete analysis data for a specific type.
89
+ * Removes the type entry from the analysis header.
90
+ * @param type The analysis type name
91
+ * @param tx The transaction to use (must be a write transaction)
92
+ */
93
+ deleteAnalysisData(type: string, tx: Transaction): Promise<boolean>;
94
+ /**
95
+ * Check if analysis data exists for a specific type.
96
+ * @param type The analysis type name
97
+ * @param tx The transaction to use
98
+ */
99
+ hasAnalysisData(type: string, tx: Transaction): Promise<boolean>;
100
+ /**
101
+ * Get all registered analysis type names.
102
+ * @param tx The transaction to use
103
+ */
104
+ getAnalysisTypes(tx: Transaction): Promise<string[]>;
105
+ }
@@ -0,0 +1,30 @@
1
+ import type { DocumentJSON } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import type { Transaction } from 'dataply';
4
+ /**
5
+ * Abstract base class for analysis providers.
6
+ * Subclasses should extend either RealtimeAnalysisProvider or IntervalAnalysisProvider.
7
+ */
8
+ export declare abstract class AnalysisProvider<T extends DocumentJSON = DocumentJSON> {
9
+ protected api: DocumentDataplyAPI<T>;
10
+ /** Overflow row PK assigned by AnalysisManager during initialization. */
11
+ storageKey: number;
12
+ constructor(api: DocumentDataplyAPI<T>);
13
+ /**
14
+ * Unique name of this analysis type (e.g. 'ftsTermCount').
15
+ * Used as the key in the AnalysisHeader.
16
+ */
17
+ abstract readonly name: string;
18
+ /**
19
+ * Load existing statistics data from a raw string.
20
+ * Called during initialization to restore state from disk.
21
+ * @param raw The raw string from the overflow row, or null if no data exists yet
22
+ * @param tx Optional transaction
23
+ */
24
+ abstract load(raw: string | null, tx: Transaction): Promise<void>;
25
+ /**
26
+ * Serialize the current statistics data to a raw string for storage.
27
+ * @param tx Optional transaction
28
+ */
29
+ abstract serialize(tx: Transaction): Promise<string>;
30
+ }
@@ -0,0 +1,5 @@
1
+ import type { DocumentJSON, FlattenedDocumentJSON } from '../types';
2
+ export declare class DocumentFormatter<T extends DocumentJSON> {
3
+ private flattenInternal;
4
+ flattenDocument(document: T): FlattenedDocumentJSON;
5
+ }
@@ -0,0 +1,68 @@
1
+ import type { DataplyTreeValue, DocumentDataplyInnerMetadata, Primitive, CreateIndexOption, IndexMetaConfig, FTSConfig, DocumentJSON, FlattenedDocumentJSON } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import { BPTreeAsync, Transaction } from 'dataply';
4
+ export declare class IndexManager<T extends DocumentJSON> {
5
+ private api;
6
+ indices: DocumentDataplyInnerMetadata['indices'];
7
+ readonly trees: Map<string, BPTreeAsync<string | number, DataplyTreeValue<Primitive>>>;
8
+ readonly indexedFields: Set<string>;
9
+ /**
10
+ * Registered indices via createIndex() (before init)
11
+ * Key: index name, Value: index configuration
12
+ */
13
+ readonly pendingCreateIndices: Map<string, CreateIndexOption<T>>;
14
+ /**
15
+ * Resolved index configurations after init.
16
+ * Key: index name, Value: index config (from metadata)
17
+ */
18
+ registeredIndices: Map<string, IndexMetaConfig>;
19
+ /**
20
+ * Maps field name → index names that cover this field.
21
+ * Used for query resolution.
22
+ */
23
+ fieldToIndices: Map<string, string[]>;
24
+ pendingBackfillFields: string[];
25
+ constructor(api: DocumentDataplyAPI<T>);
26
+ /**
27
+ * Validate and apply indices from DB metadata and pending indices.
28
+ * Called during database initialization.
29
+ */
30
+ initializeIndices(metadata: DocumentDataplyInnerMetadata, isNewlyCreated: boolean, tx: Transaction): Promise<boolean>;
31
+ /**
32
+ * Register an index. If called before init(), queues it.
33
+ */
34
+ registerIndex(name: string, option: CreateIndexOption<T>, tx?: Transaction): Promise<void>;
35
+ /**
36
+ * Register an index at runtime (after init).
37
+ */
38
+ private registerIndexRuntime;
39
+ /**
40
+ * Drop (remove) a named index.
41
+ */
42
+ dropIndex(name: string, tx?: Transaction): Promise<void>;
43
+ /**
44
+ * Backfill indices for newly created indices after data was inserted.
45
+ */
46
+ backfillIndices(tx?: Transaction): Promise<number>;
47
+ /**
48
+ * Convert CreateIndexOption to IndexMetaConfig for metadata storage.
49
+ */
50
+ toIndexMetaConfig(option: CreateIndexOption<T>): IndexMetaConfig;
51
+ /**
52
+ * Get all field names from an IndexMetaConfig.
53
+ */
54
+ getFieldsFromConfig(config: IndexMetaConfig): string[];
55
+ /**
56
+ * Get the primary field of an index.
57
+ */
58
+ getPrimaryField(config: IndexMetaConfig): string;
59
+ /**
60
+ * Create B+Tree value string for indexing a document
61
+ */
62
+ getIndexValue(config: IndexMetaConfig, flatDoc: FlattenedDocumentJSON): Primitive | Primitive[] | undefined;
63
+ /**
64
+ * Get FTSConfig from IndexMetaConfig
65
+ */
66
+ getFtsConfig(config: IndexMetaConfig): FTSConfig | null;
67
+ getTokenKey(pk: number, token: string): string;
68
+ }
@@ -0,0 +1,31 @@
1
+ import type { DocumentJSON, DataplyDocument } from '../types';
2
+ import { AnalysisProvider } from './AnalysisProvider';
3
+ import type { Transaction } from 'dataply';
4
+ /**
5
+ * Sampling options for interval analysis providers.
6
+ * Specify either a ratio (0~1) or an exact count.
7
+ */
8
+ export type SampleOptions = {
9
+ /** Ratio of documents to sample (0 exclusive ~ 1 inclusive) */
10
+ rate: number;
11
+ count?: never;
12
+ } | {
13
+ rate?: never;
14
+ /** Exact number of documents to sample */
15
+ count: number;
16
+ };
17
+ /**
18
+ * Abstract base class for interval analysis providers.
19
+ * Data is accumulated in memory and persisted only when flush() is called.
20
+ * No mutation hooks — state is computed independently (e.g. on a schedule or at init).
21
+ */
22
+ export declare abstract class IntervalAnalysisProvider<T extends DocumentJSON = DocumentJSON> extends AnalysisProvider<T> {
23
+ /**
24
+ * Sample random documents from the entire dataset.
25
+ * Fetches only PK index, then reads only the selected documents from disk.
26
+ * @param sampleOptions Sampling strategy — either `{ rate }` or `{ count }`
27
+ * @param tx Optional transaction
28
+ * @returns Randomly selected documents
29
+ */
30
+ sample(sampleOptions: SampleOptions, tx?: Transaction): Promise<DataplyDocument<T>[]>;
31
+ }
@@ -0,0 +1,11 @@
1
+ import type { DocumentDataplyMetadata, DocumentDataplyInnerMetadata, DocumentJSON } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import { Transaction } from 'dataply';
4
+ export declare class MetadataManager<T extends DocumentJSON> {
5
+ private api;
6
+ constructor(api: DocumentDataplyAPI<T>);
7
+ getDocumentMetadata(tx: Transaction): Promise<DocumentDataplyMetadata>;
8
+ getDocumentInnerMetadata(tx: Transaction): Promise<DocumentDataplyInnerMetadata>;
9
+ updateDocumentInnerMetadata(metadata: DocumentDataplyInnerMetadata, tx: Transaction): Promise<void>;
10
+ migration(version: number, callback: (tx: Transaction) => Promise<void>, tx?: Transaction): Promise<void>;
11
+ }
@@ -0,0 +1,14 @@
1
+ import type { DocumentJSON, DataplyDocument, DocumentDataplyQuery } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import { Transaction } from 'dataply';
4
+ export declare class MutationManager<T extends DocumentJSON> {
5
+ private api;
6
+ constructor(api: DocumentDataplyAPI<T>);
7
+ private insertDocumentInternal;
8
+ insertSingleDocument(document: T, tx?: Transaction): Promise<number>;
9
+ insertBatchDocuments(documents: T[], tx?: Transaction): Promise<number[]>;
10
+ private updateInternal;
11
+ fullUpdate(query: Partial<DocumentDataplyQuery<T>>, newRecord: T | ((document: DataplyDocument<T>) => T), tx?: Transaction): Promise<number>;
12
+ partialUpdate(query: Partial<DocumentDataplyQuery<T>>, newRecord: Partial<DataplyDocument<T>> | ((document: DataplyDocument<T>) => Partial<DataplyDocument<T>>), tx?: Transaction): Promise<number>;
13
+ deleteDocuments(query: Partial<DocumentDataplyQuery<T>>, tx?: Transaction): Promise<number>;
14
+ }
@@ -0,0 +1,79 @@
1
+ import type { DataplyTreeValue, DocumentDataplyQuery, DocumentDataplyCondition } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import { BPTreeAsync } from 'dataply';
4
+ export declare class Optimizer<T extends Record<string, any>> {
5
+ private api;
6
+ constructor(api: DocumentDataplyAPI<T>);
7
+ /**
8
+ * B-Tree 타입 인덱스의 선택도를 평가하고 트리에 부여할 조건을 산출합니다.
9
+ */
10
+ evaluateBTreeCandidate<U extends Partial<DocumentDataplyQuery<T>>, V extends DataplyTreeValue<U>>(indexName: string, config: any, query: Partial<DocumentDataplyQuery<V>>, queryFields: Set<string>, treeTx: BPTreeAsync<string | number, V>, orderByField?: string): {
11
+ readonly tree: BPTreeAsync<string | number, V>;
12
+ readonly condition: any;
13
+ readonly field: any;
14
+ readonly indexName: string;
15
+ readonly isFtsMatch: false;
16
+ readonly score: number;
17
+ readonly compositeVerifyFields: string[];
18
+ readonly coveredFields: string[];
19
+ readonly isIndexOrderSupported: boolean;
20
+ } | null;
21
+ /**
22
+ * FTS 타입 인덱스의 선택도를 평가합니다.
23
+ * FTSTermCount 통계가 있으면 토큰 빈도 기반 동적 score를 산출합니다.
24
+ */
25
+ evaluateFTSCandidate<U extends Partial<DocumentDataplyQuery<T>>, V extends DataplyTreeValue<U>>(indexName: string, config: any, query: Partial<DocumentDataplyQuery<V>>, queryFields: Set<string>, treeTx: BPTreeAsync<string | number, V>): {
26
+ readonly tree: BPTreeAsync<string | number, V>;
27
+ readonly condition: any;
28
+ readonly field: any;
29
+ readonly indexName: string;
30
+ readonly isFtsMatch: true;
31
+ readonly matchTokens: string[];
32
+ readonly score: number;
33
+ readonly compositeVerifyFields: readonly [];
34
+ readonly coveredFields: readonly [any];
35
+ readonly isIndexOrderSupported: false;
36
+ } | null;
37
+ /**
38
+ * 실행할 최적의 인덱스를 선택합니다. (최적 드라이버 선택)
39
+ */
40
+ getSelectivityCandidate<U extends Partial<DocumentDataplyQuery<T>>, V extends DataplyTreeValue<U>>(query: Partial<DocumentDataplyQuery<V>>, orderByField?: string): Promise<{
41
+ driver: ({
42
+ tree: BPTreeAsync<number, V>;
43
+ condition: Partial<DocumentDataplyCondition<U>>;
44
+ field: string;
45
+ indexName: string;
46
+ isFtsMatch: false;
47
+ isIndexOrderSupported: boolean;
48
+ } | {
49
+ tree: BPTreeAsync<string, V>;
50
+ condition: Partial<DocumentDataplyCondition<U>>;
51
+ field: string;
52
+ indexName: string;
53
+ isFtsMatch: true;
54
+ matchTokens: string[];
55
+ isIndexOrderSupported: boolean;
56
+ });
57
+ others: ({
58
+ tree: BPTreeAsync<number, V>;
59
+ condition: Partial<DocumentDataplyCondition<U>>;
60
+ field: string;
61
+ indexName: string;
62
+ isFtsMatch: false;
63
+ isIndexOrderSupported: boolean;
64
+ } | {
65
+ tree: BPTreeAsync<string, V>;
66
+ condition: Partial<DocumentDataplyCondition<U>>;
67
+ field: string;
68
+ indexName: string;
69
+ isFtsMatch: true;
70
+ matchTokens: string[];
71
+ isIndexOrderSupported: boolean;
72
+ })[];
73
+ compositeVerifyConditions: {
74
+ field: string;
75
+ condition: any;
76
+ }[];
77
+ rollback: () => void;
78
+ } | null>;
79
+ }
@@ -0,0 +1,75 @@
1
+ import type { DataplyTreeValue, DocumentDataplyQuery, DocumentDataplyQueryOptions, DataplyDocument, Primitive, DocumentJSON } from '../types';
2
+ import type { DocumentDataplyAPI } from './documentAPI';
3
+ import type { Optimizer } from './Optimizer';
4
+ import { BPTreeAsync } from 'dataply';
5
+ export declare class QueryManager<T extends DocumentJSON> {
6
+ private api;
7
+ private optimizer;
8
+ private readonly operatorConverters;
9
+ constructor(api: DocumentDataplyAPI<T>, optimizer: Optimizer<T>);
10
+ /**
11
+ * Transforms a query object into a verbose query object
12
+ */
13
+ verboseQuery<U extends Partial<DocumentDataplyQuery<T>>, V extends DataplyTreeValue<U>>(query: Partial<DocumentDataplyQuery<U>>): Partial<DocumentDataplyQuery<V>>;
14
+ getFreeMemoryChunkSize(): {
15
+ verySmallChunkSize: number;
16
+ smallChunkSize: number;
17
+ };
18
+ private applyCandidateByFTSStream;
19
+ private applyCandidateStream;
20
+ getKeys(query: Partial<DocumentDataplyQuery<T>>, orderBy?: string, sortOrder?: 'asc' | 'desc'): Promise<Float64Array>;
21
+ getDriverKeys(query: Partial<DocumentDataplyQuery<T>>, orderBy?: string, sortOrder?: 'asc' | 'desc'): Promise<{
22
+ keysStream: AsyncIterableIterator<number>;
23
+ others: {
24
+ tree: BPTreeAsync<string | number, DataplyTreeValue<Primitive>>;
25
+ condition: any;
26
+ field: string;
27
+ indexName: string;
28
+ isFtsMatch: boolean;
29
+ matchTokens?: string[];
30
+ coveredFields?: string[];
31
+ }[];
32
+ compositeVerifyConditions: {
33
+ field: string;
34
+ condition: any;
35
+ }[];
36
+ isDriverOrderByField: boolean;
37
+ rollback: () => void;
38
+ } | null>;
39
+ verifyFts(doc: DataplyDocument<T>, ftsConditions: {
40
+ field: string;
41
+ matchTokens: string[];
42
+ }[]): boolean;
43
+ verifyCompositeConditions(doc: DataplyDocument<T>, conditions: {
44
+ field: string;
45
+ condition: any;
46
+ }[]): boolean;
47
+ verifyValue(value: Primitive, condition: any): boolean;
48
+ adjustChunkSize(currentChunkSize: number, chunkTotalSize: number): number;
49
+ processChunkedKeysWithVerify(keysStream: AsyncIterableIterator<number>, startIdx: number, initialChunkSize: number, limit: number, ftsConditions: {
50
+ field: string;
51
+ matchTokens: string[];
52
+ }[], compositeVerifyConditions: {
53
+ field: string;
54
+ condition: any;
55
+ }[], others: {
56
+ tree: BPTreeAsync<string | number, DataplyTreeValue<Primitive>>;
57
+ condition: any;
58
+ field: string;
59
+ indexName: string;
60
+ isFtsMatch: boolean;
61
+ matchTokens?: string[];
62
+ coveredFields?: string[];
63
+ }[], tx: any): AsyncGenerator<DataplyDocument<T>>;
64
+ /**
65
+ * Count documents from the database that match the query
66
+ * @param query The query to use
67
+ * @param tx The transaction to use
68
+ * @returns The number of documents that match the query
69
+ */
70
+ countDocuments(query: Partial<DocumentDataplyQuery<T>>, tx?: any): Promise<number>;
71
+ selectDocuments(query: Partial<DocumentDataplyQuery<T>>, options?: DocumentDataplyQueryOptions, tx?: any): {
72
+ stream: () => AsyncIterableIterator<DataplyDocument<T>>;
73
+ drain: () => Promise<DataplyDocument<T>[]>;
74
+ };
75
+ }
@@ -0,0 +1,27 @@
1
+ import type { FlattenedDocumentJSON, DocumentJSON } from '../types';
2
+ import { AnalysisProvider } from './AnalysisProvider';
3
+ /**
4
+ * Abstract base class for realtime analysis providers.
5
+ * Mutation hooks (onInsert, onDelete, onUpdate) are called on every mutation
6
+ * and the result is persisted immediately.
7
+ */
8
+ export declare abstract class RealtimeAnalysisProvider<T extends DocumentJSON = DocumentJSON> extends AnalysisProvider<T> {
9
+ /**
10
+ * Called when documents are inserted.
11
+ * @param documents The flattened documents that were inserted
12
+ */
13
+ abstract onInsert(documents: FlattenedDocumentJSON[]): Promise<void>;
14
+ /**
15
+ * Called when documents are deleted.
16
+ * @param documents The flattened documents that were deleted
17
+ */
18
+ abstract onDelete(documents: FlattenedDocumentJSON[]): Promise<void>;
19
+ /**
20
+ * Called when documents are updated.
21
+ * @param pairs Array of { oldDocument, newDocument } pairs
22
+ */
23
+ abstract onUpdate(pairs: {
24
+ oldDocument: FlattenedDocumentJSON;
25
+ newDocument: FlattenedDocumentJSON;
26
+ }[]): Promise<void>;
27
+ }
@@ -0,0 +1,28 @@
1
+ import type { DocumentJSON } from '../../types';
2
+ import { Transaction } from 'dataply';
3
+ import { IntervalAnalysisProvider } from '../IntervalAnalysisProvider';
4
+ export declare class FTSTermCount<T extends DocumentJSON = DocumentJSON> extends IntervalAnalysisProvider<T> {
5
+ readonly name = "fts_term_count";
6
+ private termCount;
7
+ private sampleSize;
8
+ serialize(tx: Transaction): Promise<string>;
9
+ load(data: string | null, tx: Transaction): Promise<void>;
10
+ /**
11
+ * 특정 field/strategy/token의 문서 빈도를 반환합니다.
12
+ * 통계에 없으면 0을 반환합니다.
13
+ */
14
+ getTermCount(field: string, strategy: string, token: string): number;
15
+ /**
16
+ * 쿼리 토큰 배열에서 최소 빈도(AND 시맨틱스 상한선)를 반환합니다.
17
+ * 통계가 없거나 sampleSize가 0이면 -1을 반환합니다.
18
+ */
19
+ getMinTokenCount(field: string, strategy: string, tokens: string[]): number;
20
+ /**
21
+ * 통계가 유효한지 여부를 반환합니다.
22
+ */
23
+ get hasSampleData(): boolean;
24
+ /**
25
+ * 통계 수집 시 사용된 샘플 크기를 반환합니다.
26
+ */
27
+ getSampleSize(): number;
28
+ }
@@ -0,0 +1,2 @@
1
+ import { FTSTermCount } from './FTSTermCount';
2
+ export declare const BuiltinAnalysisProviders: (typeof FTSTermCount)[];
@@ -52,6 +52,12 @@ export declare class DocumentDataply<T extends DocumentJSON> {
52
52
  * Initialize the document database
53
53
  */
54
54
  init(): Promise<void>;
55
+ /**
56
+ * Flush all interval analysis providers, forcing statistics to be recalculated.
57
+ * Call this after bulk inserts or periodically to keep FTS statistics fresh.
58
+ * @param tx Optional transaction
59
+ */
60
+ flushAnalysis(tx?: Transaction): Promise<void>;
55
61
  /**
56
62
  * Run a migration if the current schemeVersion is lower than the target version.
57
63
  * The callback is only executed when the database's schemeVersion is below the given version.