monsqlize 3.3.4 → 3.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 +4 -3
- package/README.md +1 -1
- package/changelogs/v3.4.0.md +28 -0
- package/dist/cjs/cli/data-task.cjs +4 -2
- package/dist/cjs/index.cjs +559 -75
- package/dist/cjs/transaction/Transaction.cjs +7 -0
- package/dist/cjs/transaction/TransactionManager.cjs +7 -0
- package/dist/esm/index.mjs +559 -75
- package/dist/types/base.d.mts +6 -0
- package/dist/types/base.d.ts +6 -0
- package/dist/types/collection.d.mts +2 -2
- package/dist/types/collection.d.ts +2 -2
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model.d.mts +2 -2
- package/dist/types/model.d.ts +2 -2
- package/dist/types/runtime.d.mts +7 -0
- package/dist/types/runtime.d.ts +7 -0
- package/dist/types/search-index.d.mts +107 -0
- package/dist/types/search-index.d.ts +107 -0
- package/package.json +4 -2
package/dist/types/base.d.mts
CHANGED
|
@@ -37,6 +37,12 @@ export declare const enum ErrorCodes {
|
|
|
37
37
|
INVALID_PAGINATION = 'INVALID_PAGINATION',
|
|
38
38
|
INVALID_OPERATION = 'INVALID_OPERATION',
|
|
39
39
|
INVALID_VECTOR_SEARCH = 'INVALID_VECTOR_SEARCH',
|
|
40
|
+
INVALID_SEARCH_INDEX_DEFINITION = 'INVALID_SEARCH_INDEX_DEFINITION',
|
|
41
|
+
SEARCH_INDEX_EXISTS = 'SEARCH_INDEX_EXISTS',
|
|
42
|
+
SEARCH_INDEX_NOT_FOUND = 'SEARCH_INDEX_NOT_FOUND',
|
|
43
|
+
SEARCH_INDEX_UNSUPPORTED = 'SEARCH_INDEX_UNSUPPORTED',
|
|
44
|
+
SEARCH_INDEX_BUILD_FAILED = 'SEARCH_INDEX_BUILD_FAILED',
|
|
45
|
+
SEARCH_INDEX_WAIT_TIMEOUT = 'SEARCH_INDEX_WAIT_TIMEOUT',
|
|
40
46
|
INVALID_RELATION_SELECT = 'INVALID_RELATION_SELECT',
|
|
41
47
|
RELATION_IN_USE = 'RELATION_IN_USE',
|
|
42
48
|
RELATION_USAGE_UNAVAILABLE = 'RELATION_USAGE_UNAVAILABLE',
|
package/dist/types/base.d.ts
CHANGED
|
@@ -37,6 +37,12 @@ export declare const enum ErrorCodes {
|
|
|
37
37
|
INVALID_PAGINATION = 'INVALID_PAGINATION',
|
|
38
38
|
INVALID_OPERATION = 'INVALID_OPERATION',
|
|
39
39
|
INVALID_VECTOR_SEARCH = 'INVALID_VECTOR_SEARCH',
|
|
40
|
+
INVALID_SEARCH_INDEX_DEFINITION = 'INVALID_SEARCH_INDEX_DEFINITION',
|
|
41
|
+
SEARCH_INDEX_EXISTS = 'SEARCH_INDEX_EXISTS',
|
|
42
|
+
SEARCH_INDEX_NOT_FOUND = 'SEARCH_INDEX_NOT_FOUND',
|
|
43
|
+
SEARCH_INDEX_UNSUPPORTED = 'SEARCH_INDEX_UNSUPPORTED',
|
|
44
|
+
SEARCH_INDEX_BUILD_FAILED = 'SEARCH_INDEX_BUILD_FAILED',
|
|
45
|
+
SEARCH_INDEX_WAIT_TIMEOUT = 'SEARCH_INDEX_WAIT_TIMEOUT',
|
|
40
46
|
INVALID_RELATION_SELECT = 'INVALID_RELATION_SELECT',
|
|
41
47
|
RELATION_IN_USE = 'RELATION_IN_USE',
|
|
42
48
|
RELATION_USAGE_UNAVAILABLE = 'RELATION_USAGE_UNAVAILABLE',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChangeStream, Document, FindOptions as MongoFindOptions, Sort } from 'mongodb';
|
|
1
|
+
import type { ChangeStream, Document, FindOptions as MongoFindOptions, Sort } from 'mongodb'; import type { SearchIndexManagement } from './search-index.mjs';
|
|
2
2
|
import type {
|
|
3
3
|
MetaOptions,
|
|
4
4
|
VectorSearchHit,
|
|
@@ -685,7 +685,7 @@ export interface AdminAccessor {
|
|
|
685
685
|
stats(options?: { scale?: number; }): Promise<DbStatsView>;
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
export interface Collection<TSchema = any> {
|
|
688
|
+
export interface Collection<TSchema = any> extends SearchIndexManagement {
|
|
689
689
|
/** Returns the namespace descriptor (iid, db, collection) for this collection. */
|
|
690
690
|
getNamespace(): { iid: string; type: 'mongodb'; db: string; collection: string; pool?: string; };
|
|
691
691
|
/** Returns the underlying native MongoDB Collection object. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChangeStream, Document, FindOptions as MongoFindOptions, Sort } from 'mongodb';
|
|
1
|
+
import type { ChangeStream, Document, FindOptions as MongoFindOptions, Sort } from 'mongodb'; import type { SearchIndexManagement } from './search-index';
|
|
2
2
|
import type {
|
|
3
3
|
MetaOptions,
|
|
4
4
|
VectorSearchHit,
|
|
@@ -685,7 +685,7 @@ export interface AdminAccessor {
|
|
|
685
685
|
stats(options?: { scale?: number; }): Promise<DbStatsView>;
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
export interface Collection<TSchema = any> {
|
|
688
|
+
export interface Collection<TSchema = any> extends SearchIndexManagement {
|
|
689
689
|
/** Returns the namespace descriptor (iid, db, collection) for this collection. */
|
|
690
690
|
getNamespace(): { iid: string; type: 'mongodb'; db: string; collection: string; pool?: string; };
|
|
691
691
|
/** Returns the underlying native MongoDB Collection object. */
|
package/dist/types/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './mongodb.mjs';
|
|
|
8
8
|
export * from './pool.mjs';
|
|
9
9
|
export * from './runtime.mjs';
|
|
10
10
|
export * from './saga.mjs';
|
|
11
|
+
export * from './search-index.mjs';
|
|
11
12
|
export * from './slow-query-log.mjs';
|
|
12
13
|
export * from './sync.mjs';
|
|
13
14
|
export * from './transaction.mjs';
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/model.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BookmarkClearResult, BookmarkListResult, BookmarkPrewarmResult, DeleteBatchResult, DeleteResult, IncrementOneResult, IndexCreateResult, InsertBatchResult, InsertManyResult, InsertOneResult, UpdateBatchResult, UpdateResult, VectorSearchHit, VectorSearchOptions } from './collection.mjs';
|
|
2
|
-
import type { InferSchema } from 'schema-dsl';
|
|
2
|
+
import type { InferSchema } from 'schema-dsl'; import type { SearchIndexManagement } from './search-index.mjs';
|
|
3
3
|
import type { SchemaDslRuntime } from 'schema-dsl/runtime';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -428,7 +428,7 @@ export type ModelDocument<TDocument = any> = TDocument & Record<string, unknown>
|
|
|
428
428
|
toJSON(): TDocument & Record<string, unknown>;
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
-
export interface ModelInstance<TDocument = any> {
|
|
431
|
+
export interface ModelInstance<TDocument = any> extends SearchIndexManagement {
|
|
432
432
|
readonly collectionName: string;
|
|
433
433
|
readonly dbName: string;
|
|
434
434
|
readonly poolName?: string;
|
package/dist/types/model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BookmarkClearResult, BookmarkListResult, BookmarkPrewarmResult, DeleteBatchResult, DeleteResult, IncrementOneResult, IndexCreateResult, InsertBatchResult, InsertManyResult, InsertOneResult, UpdateBatchResult, UpdateResult, VectorSearchHit, VectorSearchOptions } from './collection';
|
|
2
|
-
import type { InferSchema } from 'schema-dsl';
|
|
2
|
+
import type { InferSchema } from 'schema-dsl'; import type { SearchIndexManagement } from './search-index';
|
|
3
3
|
import type { SchemaDslRuntime } from 'schema-dsl/runtime';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -428,7 +428,7 @@ export type ModelDocument<TDocument = any> = TDocument & Record<string, unknown>
|
|
|
428
428
|
toJSON(): TDocument & Record<string, unknown>;
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
-
export interface ModelInstance<TDocument = any> {
|
|
431
|
+
export interface ModelInstance<TDocument = any> extends SearchIndexManagement {
|
|
432
432
|
readonly collectionName: string;
|
|
433
433
|
readonly dbName: string;
|
|
434
434
|
readonly poolName?: string;
|
package/dist/types/runtime.d.mts
CHANGED
|
@@ -345,6 +345,13 @@ export declare class ModelInstance<TDocument = any> implements ModelInstanceCont
|
|
|
345
345
|
ensureIndexes(options?: ModelEnsureIndexesOptions): Promise<ModelIndexEnsureResult>;
|
|
346
346
|
dropIndex(name: string): Promise<unknown>;
|
|
347
347
|
dropIndexes(): Promise<unknown>;
|
|
348
|
+
createSearchIndex(spec: import('./search-index.mjs').SearchIndexSpec, options?: import('./search-index.mjs').CreateSearchIndexOptions): Promise<import('./search-index.mjs').CreateSearchIndexResult>;
|
|
349
|
+
createSearchIndexes(specs: import('./search-index.mjs').SearchIndexSpec[]): Promise<string[]>;
|
|
350
|
+
listSearchIndexes(options?: import('./search-index.mjs').ListSearchIndexesOptions): Promise<import('./search-index.mjs').SearchIndexInfo[]>;
|
|
351
|
+
getSearchIndex(name: string): Promise<import('./search-index.mjs').SearchIndexInfo>;
|
|
352
|
+
updateSearchIndex(name: string, definition: Record<string, unknown>): Promise<void>;
|
|
353
|
+
dropSearchIndex(name: string, options?: import('./search-index.mjs').DropSearchIndexOptions): Promise<void>;
|
|
354
|
+
waitForSearchIndex(name: string, options?: import('./search-index.mjs').WaitForSearchIndexOptions): Promise<import('./search-index.mjs').SearchIndexInfo>;
|
|
348
355
|
prewarmBookmarks(keyDims?: unknown, pages?: number[]): Promise<BookmarkPrewarmResult>;
|
|
349
356
|
listBookmarks(keyDims?: unknown): Promise<BookmarkListResult>;
|
|
350
357
|
clearBookmarks(keyDims?: unknown): Promise<BookmarkClearResult>;
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -345,6 +345,13 @@ export declare class ModelInstance<TDocument = any> implements ModelInstanceCont
|
|
|
345
345
|
ensureIndexes(options?: ModelEnsureIndexesOptions): Promise<ModelIndexEnsureResult>;
|
|
346
346
|
dropIndex(name: string): Promise<unknown>;
|
|
347
347
|
dropIndexes(): Promise<unknown>;
|
|
348
|
+
createSearchIndex(spec: import('./search-index').SearchIndexSpec, options?: import('./search-index').CreateSearchIndexOptions): Promise<import('./search-index').CreateSearchIndexResult>;
|
|
349
|
+
createSearchIndexes(specs: import('./search-index').SearchIndexSpec[]): Promise<string[]>;
|
|
350
|
+
listSearchIndexes(options?: import('./search-index').ListSearchIndexesOptions): Promise<import('./search-index').SearchIndexInfo[]>;
|
|
351
|
+
getSearchIndex(name: string): Promise<import('./search-index').SearchIndexInfo>;
|
|
352
|
+
updateSearchIndex(name: string, definition: Record<string, unknown>): Promise<void>;
|
|
353
|
+
dropSearchIndex(name: string, options?: import('./search-index').DropSearchIndexOptions): Promise<void>;
|
|
354
|
+
waitForSearchIndex(name: string, options?: import('./search-index').WaitForSearchIndexOptions): Promise<import('./search-index').SearchIndexInfo>;
|
|
348
355
|
prewarmBookmarks(keyDims?: unknown, pages?: number[]): Promise<BookmarkPrewarmResult>;
|
|
349
356
|
listBookmarks(keyDims?: unknown): Promise<BookmarkListResult>;
|
|
350
357
|
clearBookmarks(keyDims?: unknown): Promise<BookmarkClearResult>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search index lifecycle types (Atlas Search / Vector Search).
|
|
3
|
+
* @since v3.4.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Search index kind: full-text `search` or `vectorSearch`. */
|
|
7
|
+
export type SearchIndexType = 'search' | 'vectorSearch';
|
|
8
|
+
|
|
9
|
+
/** Origin of `SearchIndexInfo.type`. */
|
|
10
|
+
export type SearchIndexTypeSource = 'server' | 'inferred' | 'unknown';
|
|
11
|
+
|
|
12
|
+
/** Server-reported Search index status (passed through unchanged). */
|
|
13
|
+
export type SearchIndexStatus =
|
|
14
|
+
| 'PENDING'
|
|
15
|
+
| 'BUILDING'
|
|
16
|
+
| 'READY'
|
|
17
|
+
| 'FAILED'
|
|
18
|
+
| 'STALE'
|
|
19
|
+
| 'DELETING'
|
|
20
|
+
| 'DOES_NOT_EXIST';
|
|
21
|
+
|
|
22
|
+
/** Search index definition submitted to the server. */
|
|
23
|
+
export interface SearchIndexSpec {
|
|
24
|
+
/** Index name; non-empty, without leading/trailing whitespace. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Index kind; required. */
|
|
27
|
+
type: SearchIndexType;
|
|
28
|
+
/** Index definition object, passed to the server as-is after basic validation. */
|
|
29
|
+
definition: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Normalized Search index information. */
|
|
33
|
+
export interface SearchIndexInfo {
|
|
34
|
+
name: string;
|
|
35
|
+
status: SearchIndexStatus;
|
|
36
|
+
/** Whether the index can currently serve queries; `false` when absent. */
|
|
37
|
+
queryable: boolean;
|
|
38
|
+
id?: string;
|
|
39
|
+
/** Resolved index type; omitted only when `typeSource` is `'unknown'`. */
|
|
40
|
+
type?: SearchIndexType;
|
|
41
|
+
/**
|
|
42
|
+
* Where `type` came from: reported by the server, inferred from `latestDefinition`
|
|
43
|
+
* (self-managed mongot omits the top-level type field), or not determinable.
|
|
44
|
+
*/
|
|
45
|
+
typeSource: SearchIndexTypeSource;
|
|
46
|
+
latestDefinition?: Record<string, unknown>;
|
|
47
|
+
latestDefinitionVersion?: { version: number; createdAt: Date; };
|
|
48
|
+
statusDetail?: Array<Record<string, unknown>>;
|
|
49
|
+
/** Raw driver document; `{}` when status is `DOES_NOT_EXIST`. */
|
|
50
|
+
raw: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface CreateSearchIndexOptions {
|
|
54
|
+
/** Behavior when an index with the same name exists. Default `'error'`. */
|
|
55
|
+
ifExists?: 'error' | 'skip' | 'update';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface CreateSearchIndexResult {
|
|
59
|
+
name: string;
|
|
60
|
+
action: 'created' | 'skipped' | 'updated';
|
|
61
|
+
/** `true` only when `action === 'created'`. */
|
|
62
|
+
created: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ListSearchIndexesOptions {
|
|
66
|
+
/** Client-side filter on the resolved type; entries with `typeSource: 'unknown'` never match. */
|
|
67
|
+
type?: SearchIndexType;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface DropSearchIndexOptions {
|
|
71
|
+
/** Do not throw when the index does not exist. Default `false`. */
|
|
72
|
+
ignoreMissing?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface WaitForSearchIndexOptions {
|
|
76
|
+
/** Target condition. Default `'queryable'`. */
|
|
77
|
+
until?: 'queryable' | 'ready' | 'dropped';
|
|
78
|
+
/** Overall timeout in ms (positive integer). Default `300000`. */
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
/** Poll interval in ms (integer >= 100). Default `2000`. */
|
|
81
|
+
intervalMs?: number;
|
|
82
|
+
/** Abort signal; aborting rejects with `signal.reason`. */
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Search index lifecycle methods, available on collection accessors and Models.
|
|
88
|
+
* Write methods are governed by `writePathPolicy` under the `management` category.
|
|
89
|
+
* Requires MongoDB Atlas, Community/Enterprise 8.2+ with mongot, or `mongodb/mongodb-atlas-local`.
|
|
90
|
+
* @since v3.4.0
|
|
91
|
+
*/
|
|
92
|
+
export interface SearchIndexManagement {
|
|
93
|
+
/** Creates one Search index. Default `ifExists: 'error'` throws `SEARCH_INDEX_EXISTS`. */
|
|
94
|
+
createSearchIndex(spec: SearchIndexSpec, options?: CreateSearchIndexOptions): Promise<CreateSearchIndexResult>;
|
|
95
|
+
/** Creates several Search indexes in one command (no `ifExists`). */
|
|
96
|
+
createSearchIndexes(specs: SearchIndexSpec[]): Promise<string[]>;
|
|
97
|
+
/** Lists Search indexes on the collection. */
|
|
98
|
+
listSearchIndexes(options?: ListSearchIndexesOptions): Promise<SearchIndexInfo[]>;
|
|
99
|
+
/** Returns one Search index; a missing index yields `status: 'DOES_NOT_EXIST'` instead of throwing. */
|
|
100
|
+
getSearchIndex(name: string): Promise<SearchIndexInfo>;
|
|
101
|
+
/** Replaces the index definition; the server rebuilds asynchronously. */
|
|
102
|
+
updateSearchIndex(name: string, definition: Record<string, unknown>): Promise<void>;
|
|
103
|
+
/** Drops a Search index; throws `SEARCH_INDEX_NOT_FOUND` unless `ignoreMissing`. */
|
|
104
|
+
dropSearchIndex(name: string, options?: DropSearchIndexOptions): Promise<void>;
|
|
105
|
+
/** Polls until the index is queryable, READY, or dropped. */
|
|
106
|
+
waitForSearchIndex(name: string, options?: WaitForSearchIndexOptions): Promise<SearchIndexInfo>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search index lifecycle types (Atlas Search / Vector Search).
|
|
3
|
+
* @since v3.4.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Search index kind: full-text `search` or `vectorSearch`. */
|
|
7
|
+
export type SearchIndexType = 'search' | 'vectorSearch';
|
|
8
|
+
|
|
9
|
+
/** Origin of `SearchIndexInfo.type`. */
|
|
10
|
+
export type SearchIndexTypeSource = 'server' | 'inferred' | 'unknown';
|
|
11
|
+
|
|
12
|
+
/** Server-reported Search index status (passed through unchanged). */
|
|
13
|
+
export type SearchIndexStatus =
|
|
14
|
+
| 'PENDING'
|
|
15
|
+
| 'BUILDING'
|
|
16
|
+
| 'READY'
|
|
17
|
+
| 'FAILED'
|
|
18
|
+
| 'STALE'
|
|
19
|
+
| 'DELETING'
|
|
20
|
+
| 'DOES_NOT_EXIST';
|
|
21
|
+
|
|
22
|
+
/** Search index definition submitted to the server. */
|
|
23
|
+
export interface SearchIndexSpec {
|
|
24
|
+
/** Index name; non-empty, without leading/trailing whitespace. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Index kind; required. */
|
|
27
|
+
type: SearchIndexType;
|
|
28
|
+
/** Index definition object, passed to the server as-is after basic validation. */
|
|
29
|
+
definition: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Normalized Search index information. */
|
|
33
|
+
export interface SearchIndexInfo {
|
|
34
|
+
name: string;
|
|
35
|
+
status: SearchIndexStatus;
|
|
36
|
+
/** Whether the index can currently serve queries; `false` when absent. */
|
|
37
|
+
queryable: boolean;
|
|
38
|
+
id?: string;
|
|
39
|
+
/** Resolved index type; omitted only when `typeSource` is `'unknown'`. */
|
|
40
|
+
type?: SearchIndexType;
|
|
41
|
+
/**
|
|
42
|
+
* Where `type` came from: reported by the server, inferred from `latestDefinition`
|
|
43
|
+
* (self-managed mongot omits the top-level type field), or not determinable.
|
|
44
|
+
*/
|
|
45
|
+
typeSource: SearchIndexTypeSource;
|
|
46
|
+
latestDefinition?: Record<string, unknown>;
|
|
47
|
+
latestDefinitionVersion?: { version: number; createdAt: Date; };
|
|
48
|
+
statusDetail?: Array<Record<string, unknown>>;
|
|
49
|
+
/** Raw driver document; `{}` when status is `DOES_NOT_EXIST`. */
|
|
50
|
+
raw: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface CreateSearchIndexOptions {
|
|
54
|
+
/** Behavior when an index with the same name exists. Default `'error'`. */
|
|
55
|
+
ifExists?: 'error' | 'skip' | 'update';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface CreateSearchIndexResult {
|
|
59
|
+
name: string;
|
|
60
|
+
action: 'created' | 'skipped' | 'updated';
|
|
61
|
+
/** `true` only when `action === 'created'`. */
|
|
62
|
+
created: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ListSearchIndexesOptions {
|
|
66
|
+
/** Client-side filter on the resolved type; entries with `typeSource: 'unknown'` never match. */
|
|
67
|
+
type?: SearchIndexType;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface DropSearchIndexOptions {
|
|
71
|
+
/** Do not throw when the index does not exist. Default `false`. */
|
|
72
|
+
ignoreMissing?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface WaitForSearchIndexOptions {
|
|
76
|
+
/** Target condition. Default `'queryable'`. */
|
|
77
|
+
until?: 'queryable' | 'ready' | 'dropped';
|
|
78
|
+
/** Overall timeout in ms (positive integer). Default `300000`. */
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
/** Poll interval in ms (integer >= 100). Default `2000`. */
|
|
81
|
+
intervalMs?: number;
|
|
82
|
+
/** Abort signal; aborting rejects with `signal.reason`. */
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Search index lifecycle methods, available on collection accessors and Models.
|
|
88
|
+
* Write methods are governed by `writePathPolicy` under the `management` category.
|
|
89
|
+
* Requires MongoDB Atlas, Community/Enterprise 8.2+ with mongot, or `mongodb/mongodb-atlas-local`.
|
|
90
|
+
* @since v3.4.0
|
|
91
|
+
*/
|
|
92
|
+
export interface SearchIndexManagement {
|
|
93
|
+
/** Creates one Search index. Default `ifExists: 'error'` throws `SEARCH_INDEX_EXISTS`. */
|
|
94
|
+
createSearchIndex(spec: SearchIndexSpec, options?: CreateSearchIndexOptions): Promise<CreateSearchIndexResult>;
|
|
95
|
+
/** Creates several Search indexes in one command (no `ifExists`). */
|
|
96
|
+
createSearchIndexes(specs: SearchIndexSpec[]): Promise<string[]>;
|
|
97
|
+
/** Lists Search indexes on the collection. */
|
|
98
|
+
listSearchIndexes(options?: ListSearchIndexesOptions): Promise<SearchIndexInfo[]>;
|
|
99
|
+
/** Returns one Search index; a missing index yields `status: 'DOES_NOT_EXIST'` instead of throwing. */
|
|
100
|
+
getSearchIndex(name: string): Promise<SearchIndexInfo>;
|
|
101
|
+
/** Replaces the index definition; the server rebuilds asynchronously. */
|
|
102
|
+
updateSearchIndex(name: string, definition: Record<string, unknown>): Promise<void>;
|
|
103
|
+
/** Drops a Search index; throws `SEARCH_INDEX_NOT_FOUND` unless `ignoreMissing`. */
|
|
104
|
+
dropSearchIndex(name: string, options?: DropSearchIndexOptions): Promise<void>;
|
|
105
|
+
/** Polls until the index is queryable, READY, or dropped. */
|
|
106
|
+
waitForSearchIndex(name: string, options?: WaitForSearchIndexOptions): Promise<SearchIndexInfo>;
|
|
107
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monsqlize",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "TypeScript production data runtime layer for MongoDB today, with cache, transactions, pools, models, sync, and observability",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"./package.json": "./package.json"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
+
"changelogs/v3.4.0.md",
|
|
24
25
|
"changelogs/v3.3.3.md",
|
|
25
26
|
"changelogs/v3.3.4.md",
|
|
26
27
|
"changelogs/v3.3.2.md",
|
|
@@ -121,6 +122,7 @@
|
|
|
121
122
|
"test:compatibility": "npm run build && npm run build:tests && node --test .generated/test-dist/test/compatibility/exports/exports.test.js .generated/test-dist/test/compatibility/matrix.test.js",
|
|
122
123
|
"probe:server-matrix": "node scripts/validation/probe-memory-server-matrix.cjs",
|
|
123
124
|
"test:server-matrix": "node scripts/validation/run-memory-server-matrix.cjs",
|
|
125
|
+
"test:search-index:real": "npm run build && node scripts/validation/run-search-index-real-env.cjs",
|
|
124
126
|
"test:real-env:private": "node scripts/validation/run-private-real-env-checks.cjs",
|
|
125
127
|
"test:examples": "npm run build && tsc -p tsconfig.examples.json && node scripts/run-examples.cjs",
|
|
126
128
|
"test:performance": "npm run build && npm run build:tests && node .generated/test-dist/test/performance/baselines/function-cache.benchmark.js",
|
|
@@ -134,7 +136,7 @@
|
|
|
134
136
|
"test:coverage": "node scripts/run-coverage.cjs",
|
|
135
137
|
"test:audit": "npm audit --omit=dev --registry=https://registry.npmjs.org/",
|
|
136
138
|
"test": "npm run build && npm run build:tests && node test/run-tests.cjs",
|
|
137
|
-
"type-check": "npm run build && tsc -p tsconfig.json --noEmit && tsd --files test/types/root-import.test-d.ts --files test/types/cache-usage.test-d.ts --files test/types/model-usage.test-d.ts --files test/types/pool-usage.test-d.ts --files test/types/sync-usage.test-d.ts --files test/types/slow-query-log-usage.test-d.ts --files test/types/saga-usage.test-d.ts --files test/types/data-tasks-usage.test-d.ts",
|
|
139
|
+
"type-check": "npm run build && tsc -p tsconfig.json --noEmit && tsd --files test/types/root-import.test-d.ts --files test/types/cache-usage.test-d.ts --files test/types/model-usage.test-d.ts --files test/types/pool-usage.test-d.ts --files test/types/sync-usage.test-d.ts --files test/types/slow-query-log-usage.test-d.ts --files test/types/saga-usage.test-d.ts --files test/types/data-tasks-usage.test-d.ts --files test/types/search-index-usage.test-d.ts",
|
|
138
140
|
"check:test-language": "node scripts/check-test-language.cjs",
|
|
139
141
|
"check:docs-examples": "node scripts/validation/check-doc-example-matrix.cjs",
|
|
140
142
|
"check:release-candidate": "node scripts/check-release-candidate.cjs",
|