@sfxcode/nuxt-mongocamp-server 2.1.0 → 2.3.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/README.md +71 -19
- package/dist/module.d.mts +16 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +103 -11
- package/dist/runtime/api/.openapi-generator/FILES +24 -2
- package/dist/runtime/api/apis/CollectionApi.d.ts +137 -0
- package/dist/runtime/api/apis/CollectionApi.js +213 -0
- package/dist/runtime/api/apis/DocumentApi.d.ts +225 -8
- package/dist/runtime/api/apis/DocumentApi.js +364 -5
- package/dist/runtime/api/docs/AuditEntry.md +52 -0
- package/dist/runtime/api/docs/CollectionApi.md +272 -2
- package/dist/runtime/api/docs/CollectionDeclaration.md +52 -0
- package/dist/runtime/api/docs/CollectionDeclarationAudit.md +34 -0
- package/dist/runtime/api/docs/CollectionDeclarationOwner.md +36 -0
- package/dist/runtime/api/docs/CollectionDeclarationSoftDelete.md +36 -0
- package/dist/runtime/api/docs/CollectionDeclarationTimestamps.md +40 -0
- package/dist/runtime/api/docs/CollectionDeclarationVersioned.md +38 -0
- package/dist/runtime/api/docs/CountRequest.md +34 -0
- package/dist/runtime/api/docs/DocumentApi.md +467 -12
- package/dist/runtime/api/docs/ErrorDescription.md +4 -0
- package/dist/runtime/api/docs/ExportRequest.md +40 -0
- package/dist/runtime/api/docs/MongoAggregateRequest.md +2 -0
- package/dist/runtime/api/docs/SettingsResponse.md +0 -6
- package/dist/runtime/api/docs/SuggestedValidator.md +40 -0
- package/dist/runtime/api/docs/{UpdateRequest.md → UpdateManyRequest.md} +4 -4
- package/dist/runtime/api/docs/ValidationIssue.md +36 -0
- package/dist/runtime/api/models/AuditEntry.d.ts +88 -0
- package/dist/runtime/api/models/AuditEntry.js +56 -0
- package/dist/runtime/api/models/CollectionDeclaration.d.ts +80 -0
- package/dist/runtime/api/models/CollectionDeclaration.js +73 -0
- package/dist/runtime/api/models/CollectionDeclarationAudit.d.ts +30 -0
- package/dist/runtime/api/models/CollectionDeclarationAudit.js +26 -0
- package/dist/runtime/api/models/CollectionDeclarationOwner.d.ts +43 -0
- package/dist/runtime/api/models/CollectionDeclarationOwner.js +34 -0
- package/dist/runtime/api/models/CollectionDeclarationSoftDelete.d.ts +34 -0
- package/dist/runtime/api/models/CollectionDeclarationSoftDelete.js +28 -0
- package/dist/runtime/api/models/CollectionDeclarationTimestamps.d.ts +42 -0
- package/dist/runtime/api/models/CollectionDeclarationTimestamps.js +33 -0
- package/dist/runtime/api/models/CollectionDeclarationVersioned.d.ts +46 -0
- package/dist/runtime/api/models/CollectionDeclarationVersioned.js +36 -0
- package/dist/runtime/api/models/CountRequest.d.ts +30 -0
- package/dist/runtime/api/models/CountRequest.js +25 -0
- package/dist/runtime/api/models/ErrorDescription.d.ts +11 -0
- package/dist/runtime/api/models/ErrorDescription.js +10 -2
- package/dist/runtime/api/models/ExportRequest.d.ts +42 -0
- package/dist/runtime/api/models/ExportRequest.js +31 -0
- package/dist/runtime/api/models/Grant.d.ts +10 -1
- package/dist/runtime/api/models/Grant.js +5 -0
- package/dist/runtime/api/models/MongoAggregateRequest.d.ts +4 -0
- package/dist/runtime/api/models/MongoAggregateRequest.js +4 -2
- package/dist/runtime/api/models/SettingsResponse.d.ts +0 -14
- package/dist/runtime/api/models/SettingsResponse.js +0 -6
- package/dist/runtime/api/models/SuggestedValidator.d.ts +44 -0
- package/dist/runtime/api/models/SuggestedValidator.js +35 -0
- package/dist/runtime/api/models/UpdateManyRequest.d.ts +38 -0
- package/dist/runtime/api/models/{UpdateRequest.js → UpdateManyRequest.js} +7 -7
- package/dist/runtime/api/models/ValidationIssue.d.ts +34 -0
- package/dist/runtime/api/models/ValidationIssue.js +29 -0
- package/dist/runtime/api/models/index.d.ts +12 -1
- package/dist/runtime/api/models/index.js +12 -1
- package/dist/runtime/composables/mongocampApiCollection.d.ts +14 -15
- package/dist/runtime/composables/mongocampApiCollection.js +4 -1
- package/dist/runtime/composables/mongocampCollection.d.ts +106 -0
- package/dist/runtime/composables/mongocampCollection.js +200 -0
- package/dist/runtime/composables/mongocampLive.d.ts +33 -0
- package/dist/runtime/composables/mongocampLive.js +152 -0
- package/dist/runtime/composables/mongocampSearch.d.ts +12 -9
- package/dist/runtime/server/mongocamp/core.d.ts +2 -0
- package/dist/runtime/server/mongocamp/core.js +8 -1
- package/dist/runtime/server/mongocamp/plugin.d.ts +5 -1
- package/dist/runtime/server/mongocamp/plugin.js +21 -1
- package/dist/runtime/types/collections.d.ts +20 -0
- package/dist/runtime/types/collections.js +0 -0
- package/dist/runtime/utils/sse.d.ts +10 -0
- package/dist/runtime/utils/sse.js +33 -0
- package/dist/runtime/utils/toMongocampError.d.ts +7 -0
- package/dist/runtime/utils/toMongocampError.js +18 -1
- package/dist/types.d.mts +6 -0
- package/package.json +4 -3
- package/dist/runtime/api/models/UpdateRequest.d.ts +0 -38
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import * as runtime from "../runtime.js";
|
|
2
|
+
import {
|
|
3
|
+
AuditEntryFromJSON
|
|
4
|
+
} from "../models/AuditEntry.js";
|
|
5
|
+
import {
|
|
6
|
+
CountRequestToJSON
|
|
7
|
+
} from "../models/CountRequest.js";
|
|
2
8
|
import {
|
|
3
9
|
CountResponseFromJSON
|
|
4
10
|
} from "../models/CountResponse.js";
|
|
5
11
|
import {
|
|
6
12
|
DeleteResponseFromJSON
|
|
7
13
|
} from "../models/DeleteResponse.js";
|
|
14
|
+
import {
|
|
15
|
+
ExportRequestToJSON
|
|
16
|
+
} from "../models/ExportRequest.js";
|
|
8
17
|
import {
|
|
9
18
|
ImportResponseFromJSON
|
|
10
19
|
} from "../models/ImportResponse.js";
|
|
@@ -18,8 +27,8 @@ import {
|
|
|
18
27
|
SearchRequestToJSON
|
|
19
28
|
} from "../models/SearchRequest.js";
|
|
20
29
|
import {
|
|
21
|
-
|
|
22
|
-
} from "../models/
|
|
30
|
+
UpdateManyRequestToJSON
|
|
31
|
+
} from "../models/UpdateManyRequest.js";
|
|
23
32
|
import {
|
|
24
33
|
UpdateResponseFromJSON
|
|
25
34
|
} from "../models/UpdateResponse.js";
|
|
@@ -93,6 +102,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
93
102
|
);
|
|
94
103
|
}
|
|
95
104
|
const queryParameters = {};
|
|
105
|
+
if (requestParameters["withDeleted"] != null) {
|
|
106
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
107
|
+
}
|
|
96
108
|
if (requestParameters["filter"] != null) {
|
|
97
109
|
queryParameters["filter"] = requestParameters["filter"];
|
|
98
110
|
}
|
|
@@ -139,6 +151,71 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
139
151
|
const response = await this.countDocumentsRaw(requestParameters, initOverrides);
|
|
140
152
|
return await response.value();
|
|
141
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Creates request options for countDocumentsByBody without sending the request
|
|
156
|
+
*/
|
|
157
|
+
async countDocumentsByBodyRequestOpts(requestParameters) {
|
|
158
|
+
if (requestParameters["collectionName"] == null) {
|
|
159
|
+
throw new runtime.RequiredError(
|
|
160
|
+
"collectionName",
|
|
161
|
+
'Required parameter "collectionName" was null or undefined when calling countDocumentsByBody().'
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (requestParameters["countRequest"] == null) {
|
|
165
|
+
throw new runtime.RequiredError(
|
|
166
|
+
"countRequest",
|
|
167
|
+
'Required parameter "countRequest" was null or undefined when calling countDocumentsByBody().'
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
const queryParameters = {};
|
|
171
|
+
if (requestParameters["withDeleted"] != null) {
|
|
172
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
173
|
+
}
|
|
174
|
+
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
175
|
+
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
176
|
+
}
|
|
177
|
+
const headerParameters = {};
|
|
178
|
+
headerParameters["Content-Type"] = "application/json";
|
|
179
|
+
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
180
|
+
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
181
|
+
}
|
|
182
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
183
|
+
const token = this.configuration.accessToken;
|
|
184
|
+
const tokenString = await token("httpAuth", []);
|
|
185
|
+
if (tokenString) {
|
|
186
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
190
|
+
headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
|
|
191
|
+
}
|
|
192
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/count`;
|
|
193
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
194
|
+
return {
|
|
195
|
+
path: urlPath,
|
|
196
|
+
method: "POST",
|
|
197
|
+
headers: headerParameters,
|
|
198
|
+
query: queryParameters,
|
|
199
|
+
body: CountRequestToJSON(requestParameters["countRequest"])
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Count the Documents of the given Collection that match the filter without loading them
|
|
204
|
+
* Count Documents in Collection (filter in the body)
|
|
205
|
+
*/
|
|
206
|
+
async countDocumentsByBodyRaw(requestParameters, initOverrides) {
|
|
207
|
+
const requestOptions = await this.countDocumentsByBodyRequestOpts(requestParameters);
|
|
208
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
209
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CountResponseFromJSON(jsonValue));
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Count the Documents of the given Collection that match the filter without loading them
|
|
213
|
+
* Count Documents in Collection (filter in the body)
|
|
214
|
+
*/
|
|
215
|
+
async countDocumentsByBody(requestParameters, initOverrides) {
|
|
216
|
+
const response = await this.countDocumentsByBodyRaw(requestParameters, initOverrides);
|
|
217
|
+
return await response.value();
|
|
218
|
+
}
|
|
142
219
|
/**
|
|
143
220
|
* Creates request options for deleteMany without sending the request
|
|
144
221
|
*/
|
|
@@ -218,6 +295,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
218
295
|
);
|
|
219
296
|
}
|
|
220
297
|
const queryParameters = {};
|
|
298
|
+
if (requestParameters["withDeleted"] != null) {
|
|
299
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
300
|
+
}
|
|
221
301
|
if (requestParameters["format"] != null) {
|
|
222
302
|
queryParameters["format"] = requestParameters["format"];
|
|
223
303
|
}
|
|
@@ -239,6 +319,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
239
319
|
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
240
320
|
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
241
321
|
}
|
|
322
|
+
if (requestParameters["trailer"] != null) {
|
|
323
|
+
queryParameters["trailer"] = requestParameters["trailer"];
|
|
324
|
+
}
|
|
242
325
|
const headerParameters = {};
|
|
243
326
|
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
244
327
|
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
@@ -263,7 +346,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
263
346
|
};
|
|
264
347
|
}
|
|
265
348
|
/**
|
|
266
|
-
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then.
|
|
349
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
267
350
|
* Export Documents of a Collection
|
|
268
351
|
*/
|
|
269
352
|
async exportDocumentsRaw(requestParameters, initOverrides) {
|
|
@@ -276,13 +359,91 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
276
359
|
}
|
|
277
360
|
}
|
|
278
361
|
/**
|
|
279
|
-
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then.
|
|
362
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
280
363
|
* Export Documents of a Collection
|
|
281
364
|
*/
|
|
282
365
|
async exportDocuments(requestParameters, initOverrides) {
|
|
283
366
|
const response = await this.exportDocumentsRaw(requestParameters, initOverrides);
|
|
284
367
|
return await response.value();
|
|
285
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Creates request options for exportDocumentsByBody without sending the request
|
|
371
|
+
*/
|
|
372
|
+
async exportDocumentsByBodyRequestOpts(requestParameters) {
|
|
373
|
+
if (requestParameters["collectionName"] == null) {
|
|
374
|
+
throw new runtime.RequiredError(
|
|
375
|
+
"collectionName",
|
|
376
|
+
'Required parameter "collectionName" was null or undefined when calling exportDocumentsByBody().'
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
if (requestParameters["exportRequest"] == null) {
|
|
380
|
+
throw new runtime.RequiredError(
|
|
381
|
+
"exportRequest",
|
|
382
|
+
'Required parameter "exportRequest" was null or undefined when calling exportDocumentsByBody().'
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
const queryParameters = {};
|
|
386
|
+
if (requestParameters["withDeleted"] != null) {
|
|
387
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
388
|
+
}
|
|
389
|
+
if (requestParameters["format"] != null) {
|
|
390
|
+
queryParameters["format"] = requestParameters["format"];
|
|
391
|
+
}
|
|
392
|
+
if (requestParameters["extendedJson"] != null) {
|
|
393
|
+
queryParameters["extendedJson"] = requestParameters["extendedJson"];
|
|
394
|
+
}
|
|
395
|
+
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
396
|
+
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
397
|
+
}
|
|
398
|
+
if (requestParameters["trailer"] != null) {
|
|
399
|
+
queryParameters["trailer"] = requestParameters["trailer"];
|
|
400
|
+
}
|
|
401
|
+
const headerParameters = {};
|
|
402
|
+
headerParameters["Content-Type"] = "application/json";
|
|
403
|
+
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
404
|
+
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
405
|
+
}
|
|
406
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
407
|
+
const token = this.configuration.accessToken;
|
|
408
|
+
const tokenString = await token("httpAuth", []);
|
|
409
|
+
if (tokenString) {
|
|
410
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
414
|
+
headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
|
|
415
|
+
}
|
|
416
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/export`;
|
|
417
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
418
|
+
return {
|
|
419
|
+
path: urlPath,
|
|
420
|
+
method: "POST",
|
|
421
|
+
headers: headerParameters,
|
|
422
|
+
query: queryParameters,
|
|
423
|
+
body: ExportRequestToJSON(requestParameters["exportRequest"])
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
428
|
+
* Export Documents of a Collection (filter in the body)
|
|
429
|
+
*/
|
|
430
|
+
async exportDocumentsByBodyRaw(requestParameters, initOverrides) {
|
|
431
|
+
const requestOptions = await this.exportDocumentsByBodyRequestOpts(requestParameters);
|
|
432
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
433
|
+
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
434
|
+
return new runtime.JSONApiResponse(response);
|
|
435
|
+
} else {
|
|
436
|
+
return new runtime.TextApiResponse(response);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
441
|
+
* Export Documents of a Collection (filter in the body)
|
|
442
|
+
*/
|
|
443
|
+
async exportDocumentsByBody(requestParameters, initOverrides) {
|
|
444
|
+
const response = await this.exportDocumentsByBodyRaw(requestParameters, initOverrides);
|
|
445
|
+
return await response.value();
|
|
446
|
+
}
|
|
286
447
|
/**
|
|
287
448
|
* Creates request options for find without sending the request
|
|
288
449
|
*/
|
|
@@ -300,6 +461,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
300
461
|
);
|
|
301
462
|
}
|
|
302
463
|
const queryParameters = {};
|
|
464
|
+
if (requestParameters["withDeleted"] != null) {
|
|
465
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
466
|
+
}
|
|
303
467
|
if (requestParameters["rowsPerPage"] != null) {
|
|
304
468
|
queryParameters["rowsPerPage"] = requestParameters["rowsPerPage"];
|
|
305
469
|
}
|
|
@@ -374,6 +538,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
374
538
|
);
|
|
375
539
|
}
|
|
376
540
|
const queryParameters = {};
|
|
541
|
+
if (requestParameters["withDeleted"] != null) {
|
|
542
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
543
|
+
}
|
|
377
544
|
if (requestParameters["extendedJson"] != null) {
|
|
378
545
|
queryParameters["extendedJson"] = requestParameters["extendedJson"];
|
|
379
546
|
}
|
|
@@ -418,6 +585,73 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
418
585
|
const response = await this.getDocumentRaw(requestParameters, initOverrides);
|
|
419
586
|
return await response.value();
|
|
420
587
|
}
|
|
588
|
+
/**
|
|
589
|
+
* Creates request options for getDocumentHistory without sending the request
|
|
590
|
+
*/
|
|
591
|
+
async getDocumentHistoryRequestOpts(requestParameters) {
|
|
592
|
+
if (requestParameters["collectionName"] == null) {
|
|
593
|
+
throw new runtime.RequiredError(
|
|
594
|
+
"collectionName",
|
|
595
|
+
'Required parameter "collectionName" was null or undefined when calling getDocumentHistory().'
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
if (requestParameters["documentId"] == null) {
|
|
599
|
+
throw new runtime.RequiredError(
|
|
600
|
+
"documentId",
|
|
601
|
+
'Required parameter "documentId" was null or undefined when calling getDocumentHistory().'
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
const queryParameters = {};
|
|
605
|
+
if (requestParameters["rowsPerPage"] != null) {
|
|
606
|
+
queryParameters["rowsPerPage"] = requestParameters["rowsPerPage"];
|
|
607
|
+
}
|
|
608
|
+
if (requestParameters["page"] != null) {
|
|
609
|
+
queryParameters["page"] = requestParameters["page"];
|
|
610
|
+
}
|
|
611
|
+
if (requestParameters["extendedJson"] != null) {
|
|
612
|
+
queryParameters["extendedJson"] = requestParameters["extendedJson"];
|
|
613
|
+
}
|
|
614
|
+
const headerParameters = {};
|
|
615
|
+
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
616
|
+
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
617
|
+
}
|
|
618
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
619
|
+
const token = this.configuration.accessToken;
|
|
620
|
+
const tokenString = await token("httpAuth", []);
|
|
621
|
+
if (tokenString) {
|
|
622
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
626
|
+
headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
|
|
627
|
+
}
|
|
628
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/{documentId}/history`;
|
|
629
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
630
|
+
urlPath = urlPath.replace("{documentId}", encodeURIComponent(String(requestParameters["documentId"])));
|
|
631
|
+
return {
|
|
632
|
+
path: urlPath,
|
|
633
|
+
method: "GET",
|
|
634
|
+
headers: headerParameters,
|
|
635
|
+
query: queryParameters
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* The audit records of a document of a collection declared with audit, newest first (2.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
|
|
640
|
+
* History of a Document
|
|
641
|
+
*/
|
|
642
|
+
async getDocumentHistoryRaw(requestParameters, initOverrides) {
|
|
643
|
+
const requestOptions = await this.getDocumentHistoryRequestOpts(requestParameters);
|
|
644
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
645
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AuditEntryFromJSON));
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* The audit records of a document of a collection declared with audit, newest first (2.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
|
|
649
|
+
* History of a Document
|
|
650
|
+
*/
|
|
651
|
+
async getDocumentHistory(requestParameters, initOverrides) {
|
|
652
|
+
const response = await this.getDocumentHistoryRaw(requestParameters, initOverrides);
|
|
653
|
+
return await response.value();
|
|
654
|
+
}
|
|
421
655
|
/**
|
|
422
656
|
* Creates request options for importDocuments without sending the request
|
|
423
657
|
*/
|
|
@@ -603,6 +837,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
603
837
|
);
|
|
604
838
|
}
|
|
605
839
|
const queryParameters = {};
|
|
840
|
+
if (requestParameters["withDeleted"] != null) {
|
|
841
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
842
|
+
}
|
|
606
843
|
if (requestParameters["filter"] != null) {
|
|
607
844
|
queryParameters["filter"] = requestParameters["filter"];
|
|
608
845
|
}
|
|
@@ -670,6 +907,64 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
670
907
|
const response = await this.listDocumentsRaw(requestParameters, initOverrides);
|
|
671
908
|
return await response.value();
|
|
672
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Creates request options for restoreDocument without sending the request
|
|
912
|
+
*/
|
|
913
|
+
async restoreDocumentRequestOpts(requestParameters) {
|
|
914
|
+
if (requestParameters["collectionName"] == null) {
|
|
915
|
+
throw new runtime.RequiredError(
|
|
916
|
+
"collectionName",
|
|
917
|
+
'Required parameter "collectionName" was null or undefined when calling restoreDocument().'
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
if (requestParameters["documentId"] == null) {
|
|
921
|
+
throw new runtime.RequiredError(
|
|
922
|
+
"documentId",
|
|
923
|
+
'Required parameter "documentId" was null or undefined when calling restoreDocument().'
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
const queryParameters = {};
|
|
927
|
+
const headerParameters = {};
|
|
928
|
+
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
929
|
+
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
930
|
+
}
|
|
931
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
932
|
+
const token = this.configuration.accessToken;
|
|
933
|
+
const tokenString = await token("httpAuth", []);
|
|
934
|
+
if (tokenString) {
|
|
935
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
939
|
+
headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
|
|
940
|
+
}
|
|
941
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/{documentId}/restore`;
|
|
942
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
943
|
+
urlPath = urlPath.replace("{documentId}", encodeURIComponent(String(requestParameters["documentId"])));
|
|
944
|
+
return {
|
|
945
|
+
path: urlPath,
|
|
946
|
+
method: "POST",
|
|
947
|
+
headers: headerParameters,
|
|
948
|
+
query: queryParameters
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Removes the deleted mark of a document of a collection declared with softDelete (2.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
953
|
+
* Restore a soft-deleted Document
|
|
954
|
+
*/
|
|
955
|
+
async restoreDocumentRaw(requestParameters, initOverrides) {
|
|
956
|
+
const requestOptions = await this.restoreDocumentRequestOpts(requestParameters);
|
|
957
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
958
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => UpdateResponseFromJSON(jsonValue));
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Removes the deleted mark of a document of a collection declared with softDelete (2.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
962
|
+
* Restore a soft-deleted Document
|
|
963
|
+
*/
|
|
964
|
+
async restoreDocument(requestParameters, initOverrides) {
|
|
965
|
+
const response = await this.restoreDocumentRaw(requestParameters, initOverrides);
|
|
966
|
+
return await response.value();
|
|
967
|
+
}
|
|
673
968
|
/**
|
|
674
969
|
* Creates request options for searchDocuments without sending the request
|
|
675
970
|
*/
|
|
@@ -687,6 +982,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
687
982
|
);
|
|
688
983
|
}
|
|
689
984
|
const queryParameters = {};
|
|
985
|
+
if (requestParameters["withDeleted"] != null) {
|
|
986
|
+
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
987
|
+
}
|
|
690
988
|
if (requestParameters["rowsPerPage"] != null) {
|
|
691
989
|
queryParameters["rowsPerPage"] = requestParameters["rowsPerPage"];
|
|
692
990
|
}
|
|
@@ -927,7 +1225,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
927
1225
|
method: "PATCH",
|
|
928
1226
|
headers: headerParameters,
|
|
929
1227
|
query: queryParameters,
|
|
930
|
-
body:
|
|
1228
|
+
body: UpdateManyRequestToJSON(requestParameters["updateRequest"])
|
|
931
1229
|
};
|
|
932
1230
|
}
|
|
933
1231
|
/**
|
|
@@ -947,12 +1245,68 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
947
1245
|
const response = await this.updateManyRaw(requestParameters, initOverrides);
|
|
948
1246
|
return await response.value();
|
|
949
1247
|
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Creates request options for watchDocuments without sending the request
|
|
1250
|
+
*/
|
|
1251
|
+
async watchDocumentsRequestOpts(requestParameters) {
|
|
1252
|
+
if (requestParameters["collectionName"] == null) {
|
|
1253
|
+
throw new runtime.RequiredError(
|
|
1254
|
+
"collectionName",
|
|
1255
|
+
'Required parameter "collectionName" was null or undefined when calling watchDocuments().'
|
|
1256
|
+
);
|
|
1257
|
+
}
|
|
1258
|
+
const queryParameters = {};
|
|
1259
|
+
if (requestParameters["filter"] != null) {
|
|
1260
|
+
queryParameters["filter"] = requestParameters["filter"];
|
|
1261
|
+
}
|
|
1262
|
+
if (requestParameters["filterCaseInsensitive"] != null) {
|
|
1263
|
+
queryParameters["filterCaseInsensitive"] = requestParameters["filterCaseInsensitive"];
|
|
1264
|
+
}
|
|
1265
|
+
const headerParameters = {};
|
|
1266
|
+
if (requestParameters["lastEventID"] != null) {
|
|
1267
|
+
headerParameters["Last-Event-ID"] = String(requestParameters["lastEventID"]);
|
|
1268
|
+
}
|
|
1269
|
+
let urlPath = `/mongodb/collections/{collectionName}/documents/watch`;
|
|
1270
|
+
urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
|
|
1271
|
+
return {
|
|
1272
|
+
path: urlPath,
|
|
1273
|
+
method: "GET",
|
|
1274
|
+
headers: headerParameters,
|
|
1275
|
+
query: queryParameters
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* The changes of the documents as Server-Sent Events (2.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
|
|
1280
|
+
* Live Updates of a Collection
|
|
1281
|
+
*/
|
|
1282
|
+
async watchDocumentsRaw(requestParameters, initOverrides) {
|
|
1283
|
+
const requestOptions = await this.watchDocumentsRequestOpts(requestParameters);
|
|
1284
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1285
|
+
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
1286
|
+
return new runtime.JSONApiResponse(response);
|
|
1287
|
+
} else {
|
|
1288
|
+
return new runtime.TextApiResponse(response);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* The changes of the documents as Server-Sent Events (2.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
|
|
1293
|
+
* Live Updates of a Collection
|
|
1294
|
+
*/
|
|
1295
|
+
async watchDocuments(requestParameters, initOverrides) {
|
|
1296
|
+
const response = await this.watchDocumentsRaw(requestParameters, initOverrides);
|
|
1297
|
+
return await response.value();
|
|
1298
|
+
}
|
|
950
1299
|
}
|
|
951
1300
|
export const ExportDocumentsExtendedJsonEnum = {
|
|
952
1301
|
Relaxed: "relaxed",
|
|
953
1302
|
Canonical: "canonical",
|
|
954
1303
|
Plain: "plain"
|
|
955
1304
|
};
|
|
1305
|
+
export const ExportDocumentsByBodyExtendedJsonEnum = {
|
|
1306
|
+
Relaxed: "relaxed",
|
|
1307
|
+
Canonical: "canonical",
|
|
1308
|
+
Plain: "plain"
|
|
1309
|
+
};
|
|
956
1310
|
export const FindCountEnum = {
|
|
957
1311
|
Exact: "exact",
|
|
958
1312
|
None: "none"
|
|
@@ -967,6 +1321,11 @@ export const GetDocumentExtendedJsonEnum = {
|
|
|
967
1321
|
Canonical: "canonical",
|
|
968
1322
|
Plain: "plain"
|
|
969
1323
|
};
|
|
1324
|
+
export const GetDocumentHistoryExtendedJsonEnum = {
|
|
1325
|
+
Relaxed: "relaxed",
|
|
1326
|
+
Canonical: "canonical",
|
|
1327
|
+
Plain: "plain"
|
|
1328
|
+
};
|
|
970
1329
|
export const ListDocumentsCountEnum = {
|
|
971
1330
|
Exact: "exact",
|
|
972
1331
|
None: "none"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
# AuditEntry
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`collection` | string
|
|
10
|
+
`database` | string
|
|
11
|
+
`documentId` | any
|
|
12
|
+
`operation` | string
|
|
13
|
+
`user` | string
|
|
14
|
+
`at` | { [key: string]: any; }
|
|
15
|
+
`before` | { [key: string]: any; }
|
|
16
|
+
`after` | { [key: string]: any; }
|
|
17
|
+
`summary` | { [key: string]: any; }
|
|
18
|
+
`expiresAt` | { [key: string]: any; }
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import type { AuditEntry } from ''
|
|
24
|
+
|
|
25
|
+
// TODO: Update the object below with actual values
|
|
26
|
+
const example = {
|
|
27
|
+
"collection": null,
|
|
28
|
+
"database": null,
|
|
29
|
+
"documentId": null,
|
|
30
|
+
"operation": null,
|
|
31
|
+
"user": null,
|
|
32
|
+
"at": null,
|
|
33
|
+
"before": null,
|
|
34
|
+
"after": null,
|
|
35
|
+
"summary": null,
|
|
36
|
+
"expiresAt": null,
|
|
37
|
+
} satisfies AuditEntry
|
|
38
|
+
|
|
39
|
+
console.log(example)
|
|
40
|
+
|
|
41
|
+
// Convert the instance to a JSON string
|
|
42
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
43
|
+
console.log(exampleJSON)
|
|
44
|
+
|
|
45
|
+
// Parse the JSON string back to an object
|
|
46
|
+
const exampleParsed = JSON.parse(exampleJSON) as AuditEntry
|
|
47
|
+
console.log(exampleParsed)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
51
|
+
|
|
52
|
+
|