monsqlize 3.3.4 → 3.5.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 +5 -3
- package/README.md +1 -1
- package/changelogs/v3.4.0.md +28 -0
- package/changelogs/v3.5.0.md +23 -0
- package/dist/cjs/cli/data-task.cjs +5 -2
- package/dist/cjs/index.cjs +8983 -7429
- package/dist/cjs/transaction/Transaction.cjs +14 -0
- package/dist/cjs/transaction/TransactionManager.cjs +14 -0
- package/dist/esm/index.mjs +8995 -7441
- package/dist/types/base.d.mts +12 -0
- package/dist/types/base.d.ts +12 -0
- package/dist/types/collection.d.mts +2 -2
- package/dist/types/collection.d.ts +2 -2
- package/dist/types/gridfs.d.mts +146 -0
- package/dist/types/gridfs.d.ts +146 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/model.d.mts +4 -2
- package/dist/types/model.d.ts +4 -2
- package/dist/types/monsqlize.d.mts +20 -0
- package/dist/types/monsqlize.d.ts +20 -0
- package/dist/types/runtime.d.mts +9 -0
- package/dist/types/runtime.d.ts +9 -0
- package/dist/types/search-index.d.mts +107 -0
- package/dist/types/search-index.d.ts +107 -0
- package/package.json +5 -2
|
@@ -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.5.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,8 @@
|
|
|
21
21
|
"./package.json": "./package.json"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
+
"changelogs/v3.5.0.md",
|
|
25
|
+
"changelogs/v3.4.0.md",
|
|
24
26
|
"changelogs/v3.3.3.md",
|
|
25
27
|
"changelogs/v3.3.4.md",
|
|
26
28
|
"changelogs/v3.3.2.md",
|
|
@@ -121,6 +123,7 @@
|
|
|
121
123
|
"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
124
|
"probe:server-matrix": "node scripts/validation/probe-memory-server-matrix.cjs",
|
|
123
125
|
"test:server-matrix": "node scripts/validation/run-memory-server-matrix.cjs",
|
|
126
|
+
"test:search-index:real": "npm run build && node scripts/validation/run-search-index-real-env.cjs",
|
|
124
127
|
"test:real-env:private": "node scripts/validation/run-private-real-env-checks.cjs",
|
|
125
128
|
"test:examples": "npm run build && tsc -p tsconfig.examples.json && node scripts/run-examples.cjs",
|
|
126
129
|
"test:performance": "npm run build && npm run build:tests && node .generated/test-dist/test/performance/baselines/function-cache.benchmark.js",
|
|
@@ -134,7 +137,7 @@
|
|
|
134
137
|
"test:coverage": "node scripts/run-coverage.cjs",
|
|
135
138
|
"test:audit": "npm audit --omit=dev --registry=https://registry.npmjs.org/",
|
|
136
139
|
"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",
|
|
140
|
+
"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 --files test/types/gridfs-usage.test-d.ts",
|
|
138
141
|
"check:test-language": "node scripts/check-test-language.cjs",
|
|
139
142
|
"check:docs-examples": "node scripts/validation/check-doc-example-matrix.cjs",
|
|
140
143
|
"check:release-candidate": "node scripts/check-release-candidate.cjs",
|