document-dataply 0.0.13 → 0.0.14-alpha.1

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.
@@ -5,10 +5,11 @@ import { Transaction } from 'dataply';
5
5
  export declare class AnalysisManager<T extends DocumentJSON> {
6
6
  private api;
7
7
  readonly sampleSize: number;
8
+ private logger;
8
9
  private providers;
9
10
  private cron;
10
11
  private flushing;
11
- constructor(api: DocumentDataplyAPI<T>, schedule: string, sampleSize: number);
12
+ constructor(api: DocumentDataplyAPI<T>, schedule: string, sampleSize: number, logger: any);
12
13
  /**
13
14
  * Stop the background analysis cron job.
14
15
  */
@@ -3,6 +3,7 @@ import type { DocumentDataplyAPI } from './documentAPI';
3
3
  import { BPTreeAsync, Transaction } from 'dataply';
4
4
  export declare class IndexManager<T extends DocumentJSON> {
5
5
  private api;
6
+ private logger;
6
7
  indices: DocumentDataplyInnerMetadata['indices'];
7
8
  readonly trees: Map<string, BPTreeAsync<string | number, DataplyTreeValue<Primitive>>>;
8
9
  readonly indexedFields: Set<string>;
@@ -22,7 +23,7 @@ export declare class IndexManager<T extends DocumentJSON> {
22
23
  */
23
24
  fieldToIndices: Map<string, string[]>;
24
25
  pendingBackfillFields: string[];
25
- constructor(api: DocumentDataplyAPI<T>);
26
+ constructor(api: DocumentDataplyAPI<T>, logger: any);
26
27
  /**
27
28
  * Validate and apply indices from DB metadata and pending indices.
28
29
  * Called during database initialization.
@@ -44,6 +45,11 @@ export declare class IndexManager<T extends DocumentJSON> {
44
45
  * Backfill indices for newly created indices after data was inserted.
45
46
  */
46
47
  backfillIndices(tx?: Transaction): Promise<number>;
48
+ /**
49
+ * Rebuild specified indices by clearing existing tree data and rebuilding via bulkLoad.
50
+ * If no index names are provided, all indices (except _id) are rebuilt.
51
+ */
52
+ rebuildIndices(indexNames?: string[], tx?: Transaction): Promise<number>;
47
53
  /**
48
54
  * Convert CreateIndexOption to IndexMetaConfig for metadata storage.
49
55
  */
@@ -3,7 +3,8 @@ import type { DocumentDataplyAPI } from './documentAPI';
3
3
  import { Transaction } from 'dataply';
4
4
  export declare class MetadataManager<T extends DocumentJSON> {
5
5
  private api;
6
- constructor(api: DocumentDataplyAPI<T>);
6
+ private logger;
7
+ constructor(api: DocumentDataplyAPI<T>, logger: any);
7
8
  getDocumentMetadata(tx: Transaction): Promise<DocumentDataplyMetadata>;
8
9
  getDocumentInnerMetadata(tx: Transaction): Promise<DocumentDataplyInnerMetadata>;
9
10
  updateDocumentInnerMetadata(metadata: DocumentDataplyInnerMetadata, tx: Transaction): Promise<void>;
@@ -3,7 +3,9 @@ import type { DocumentDataplyAPI } from './documentAPI';
3
3
  import { Transaction } from 'dataply';
4
4
  export declare class MutationManager<T extends DocumentJSON> {
5
5
  private api;
6
- constructor(api: DocumentDataplyAPI<T>);
6
+ private logger;
7
+ constructor(api: DocumentDataplyAPI<T>, logger: any);
8
+ private isTreeEmpty;
7
9
  private insertDocumentInternal;
8
10
  insertSingleDocument(document: T, tx?: Transaction): Promise<number>;
9
11
  insertBatchDocuments(documents: T[], tx?: Transaction): Promise<number[]>;
@@ -5,8 +5,9 @@ import { BPTreeAsync } from 'dataply';
5
5
  export declare class QueryManager<T extends DocumentJSON> {
6
6
  private api;
7
7
  private optimizer;
8
+ private logger;
8
9
  private readonly operatorConverters;
9
- constructor(api: DocumentDataplyAPI<T>, optimizer: Optimizer<T>);
10
+ constructor(api: DocumentDataplyAPI<T>, optimizer: Optimizer<T>, logger: any);
10
11
  /**
11
12
  * Transforms a query object into a verbose query object
12
13
  */
@@ -48,6 +48,14 @@ export declare class DocumentDataply<T extends DocumentJSON> {
48
48
  * @returns Promise<this> for chaining
49
49
  */
50
50
  dropIndex(name: string, tx?: Transaction): Promise<this>;
51
+ /**
52
+ * Rebuild specified indices by clearing existing data and reconstructing via bulkLoad.
53
+ * If no index names are provided, rebuilds all indices except '_id'.
54
+ * @param indexNames Optional array of index names to rebuild
55
+ * @param tx Optional transaction
56
+ * @returns The number of documents processed
57
+ */
58
+ rebuildIndices(indexNames?: string[], tx?: Transaction): Promise<number>;
51
59
  /**
52
60
  * Initialize the document database
53
61
  */
@@ -56,6 +56,14 @@ export declare class DocumentDataplyAPI<T extends DocumentJSON> extends DataplyA
56
56
  * Delegated to IndexManager.
57
57
  */
58
58
  backfillIndices(tx?: Transaction): Promise<number>;
59
+ /**
60
+ * Rebuild specified indices by clearing existing tree data and rebuilding via bulkLoad.
61
+ * If no index names are provided, all indices (except _id) are rebuilt.
62
+ * @param indexNames Optional array of index names to rebuild
63
+ * @param tx Optional transaction
64
+ * @returns The number of documents processed
65
+ */
66
+ rebuildIndices(indexNames?: string[], tx?: Transaction): Promise<number>;
59
67
  /**
60
68
  * Flush all interval analysis providers, forcing statistics to be recalculated.
61
69
  * Call this after bulk inserts or periodically to keep statistics fresh.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-dataply",
3
- "version": "0.0.13",
3
+ "version": "0.0.14-alpha.1",
4
4
  "description": "Simple and powerful JSON document database supporting complex queries and flexible indexing policies.",
5
5
  "license": "MIT",
6
6
  "author": "izure <admin@izure.org>",
@@ -43,7 +43,7 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "croner": "^10.0.1",
46
- "dataply": "^0.0.25"
46
+ "dataply": "^0.0.26-alpha.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/jest": "^30.0.0",
@@ -52,4 +52,4 @@
52
52
  "ts-jest": "^29.4.6",
53
53
  "typescript": "^5.9.3"
54
54
  }
55
- }
55
+ }