@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.
Files changed (80) hide show
  1. package/README.md +71 -19
  2. package/dist/module.d.mts +16 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +103 -11
  5. package/dist/runtime/api/.openapi-generator/FILES +24 -2
  6. package/dist/runtime/api/apis/CollectionApi.d.ts +137 -0
  7. package/dist/runtime/api/apis/CollectionApi.js +213 -0
  8. package/dist/runtime/api/apis/DocumentApi.d.ts +225 -8
  9. package/dist/runtime/api/apis/DocumentApi.js +364 -5
  10. package/dist/runtime/api/docs/AuditEntry.md +52 -0
  11. package/dist/runtime/api/docs/CollectionApi.md +272 -2
  12. package/dist/runtime/api/docs/CollectionDeclaration.md +52 -0
  13. package/dist/runtime/api/docs/CollectionDeclarationAudit.md +34 -0
  14. package/dist/runtime/api/docs/CollectionDeclarationOwner.md +36 -0
  15. package/dist/runtime/api/docs/CollectionDeclarationSoftDelete.md +36 -0
  16. package/dist/runtime/api/docs/CollectionDeclarationTimestamps.md +40 -0
  17. package/dist/runtime/api/docs/CollectionDeclarationVersioned.md +38 -0
  18. package/dist/runtime/api/docs/CountRequest.md +34 -0
  19. package/dist/runtime/api/docs/DocumentApi.md +467 -12
  20. package/dist/runtime/api/docs/ErrorDescription.md +4 -0
  21. package/dist/runtime/api/docs/ExportRequest.md +40 -0
  22. package/dist/runtime/api/docs/MongoAggregateRequest.md +2 -0
  23. package/dist/runtime/api/docs/SettingsResponse.md +0 -6
  24. package/dist/runtime/api/docs/SuggestedValidator.md +40 -0
  25. package/dist/runtime/api/docs/{UpdateRequest.md → UpdateManyRequest.md} +4 -4
  26. package/dist/runtime/api/docs/ValidationIssue.md +36 -0
  27. package/dist/runtime/api/models/AuditEntry.d.ts +88 -0
  28. package/dist/runtime/api/models/AuditEntry.js +56 -0
  29. package/dist/runtime/api/models/CollectionDeclaration.d.ts +80 -0
  30. package/dist/runtime/api/models/CollectionDeclaration.js +73 -0
  31. package/dist/runtime/api/models/CollectionDeclarationAudit.d.ts +30 -0
  32. package/dist/runtime/api/models/CollectionDeclarationAudit.js +26 -0
  33. package/dist/runtime/api/models/CollectionDeclarationOwner.d.ts +43 -0
  34. package/dist/runtime/api/models/CollectionDeclarationOwner.js +34 -0
  35. package/dist/runtime/api/models/CollectionDeclarationSoftDelete.d.ts +34 -0
  36. package/dist/runtime/api/models/CollectionDeclarationSoftDelete.js +28 -0
  37. package/dist/runtime/api/models/CollectionDeclarationTimestamps.d.ts +42 -0
  38. package/dist/runtime/api/models/CollectionDeclarationTimestamps.js +33 -0
  39. package/dist/runtime/api/models/CollectionDeclarationVersioned.d.ts +46 -0
  40. package/dist/runtime/api/models/CollectionDeclarationVersioned.js +36 -0
  41. package/dist/runtime/api/models/CountRequest.d.ts +30 -0
  42. package/dist/runtime/api/models/CountRequest.js +25 -0
  43. package/dist/runtime/api/models/ErrorDescription.d.ts +11 -0
  44. package/dist/runtime/api/models/ErrorDescription.js +10 -2
  45. package/dist/runtime/api/models/ExportRequest.d.ts +42 -0
  46. package/dist/runtime/api/models/ExportRequest.js +31 -0
  47. package/dist/runtime/api/models/Grant.d.ts +10 -1
  48. package/dist/runtime/api/models/Grant.js +5 -0
  49. package/dist/runtime/api/models/MongoAggregateRequest.d.ts +4 -0
  50. package/dist/runtime/api/models/MongoAggregateRequest.js +4 -2
  51. package/dist/runtime/api/models/SettingsResponse.d.ts +0 -14
  52. package/dist/runtime/api/models/SettingsResponse.js +0 -6
  53. package/dist/runtime/api/models/SuggestedValidator.d.ts +44 -0
  54. package/dist/runtime/api/models/SuggestedValidator.js +35 -0
  55. package/dist/runtime/api/models/UpdateManyRequest.d.ts +38 -0
  56. package/dist/runtime/api/models/{UpdateRequest.js → UpdateManyRequest.js} +7 -7
  57. package/dist/runtime/api/models/ValidationIssue.d.ts +34 -0
  58. package/dist/runtime/api/models/ValidationIssue.js +29 -0
  59. package/dist/runtime/api/models/index.d.ts +12 -1
  60. package/dist/runtime/api/models/index.js +12 -1
  61. package/dist/runtime/composables/mongocampApiCollection.d.ts +14 -15
  62. package/dist/runtime/composables/mongocampApiCollection.js +4 -1
  63. package/dist/runtime/composables/mongocampCollection.d.ts +106 -0
  64. package/dist/runtime/composables/mongocampCollection.js +200 -0
  65. package/dist/runtime/composables/mongocampLive.d.ts +33 -0
  66. package/dist/runtime/composables/mongocampLive.js +152 -0
  67. package/dist/runtime/composables/mongocampSearch.d.ts +12 -9
  68. package/dist/runtime/server/mongocamp/core.d.ts +2 -0
  69. package/dist/runtime/server/mongocamp/core.js +8 -1
  70. package/dist/runtime/server/mongocamp/plugin.d.ts +5 -1
  71. package/dist/runtime/server/mongocamp/plugin.js +21 -1
  72. package/dist/runtime/types/collections.d.ts +20 -0
  73. package/dist/runtime/types/collections.js +0 -0
  74. package/dist/runtime/utils/sse.d.ts +10 -0
  75. package/dist/runtime/utils/sse.js +33 -0
  76. package/dist/runtime/utils/toMongocampError.d.ts +7 -0
  77. package/dist/runtime/utils/toMongocampError.js +18 -1
  78. package/dist/types.d.mts +6 -0
  79. package/package.json +4 -3
  80. package/dist/runtime/api/models/UpdateRequest.d.ts +0 -38
@@ -10,6 +10,8 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime.js';
13
+ import { type AuditEntry } from '../models/AuditEntry.js';
14
+ import { type CollectionDeclaration } from '../models/CollectionDeclaration.js';
13
15
  import { type CollectionOptions } from '../models/CollectionOptions.js';
14
16
  import { type CollectionStatus } from '../models/CollectionStatus.js';
15
17
  import { type CollectionSummary } from '../models/CollectionSummary.js';
@@ -23,6 +25,7 @@ import { type MongoAggregateRequest } from '../models/MongoAggregateRequest.js';
23
25
  import { type RenameRequest } from '../models/RenameRequest.js';
24
26
  import { type RenameResponse } from '../models/RenameResponse.js';
25
27
  import { type SchemaAnalysis } from '../models/SchemaAnalysis.js';
28
+ import { type SuggestedValidator } from '../models/SuggestedValidator.js';
26
29
  export interface AggregateRequest {
27
30
  /**
28
31
  * The name of your MongoDb Collection
@@ -32,6 +35,10 @@ export interface AggregateRequest {
32
35
  *
33
36
  */
34
37
  mongoAggregateRequest: MongoAggregateRequest;
38
+ /**
39
+ * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
40
+ */
41
+ withDeleted?: boolean;
35
42
  /**
36
43
  * Count elements per page
37
44
  */
@@ -102,6 +109,10 @@ export interface DistinctRequest {
102
109
  * The field for your distinct Request.
103
110
  */
104
111
  field: string;
112
+ /**
113
+ * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
114
+ */
115
+ withDeleted?: boolean;
105
116
  /**
106
117
  * Count elements per page
107
118
  */
@@ -114,6 +125,16 @@ export interface DistinctRequest {
114
125
  * How the result is counted: exact (default) or none (no count headers, no count query)
115
126
  */
116
127
  count?: DistinctCountEnum;
128
+ /**
129
+ * plain (default) or relaxed / canonical (2.1.0): the values as MongoDB Extended JSON, so ObjectIds, dates, decimals and integers beyond 2^53 keep their types ({"$numberLong": ...} instead of a bare number that JavaScript rounds)
130
+ */
131
+ extendedJson?: DistinctExtendedJsonEnum;
132
+ }
133
+ export interface GetCollectionDeclarationRequest {
134
+ /**
135
+ * The name of your MongoDb Collection
136
+ */
137
+ collectionName: string;
117
138
  }
118
139
  export interface GetCollectionFieldsRequest {
119
140
  /**
@@ -125,6 +146,32 @@ export interface GetCollectionFieldsRequest {
125
146
  */
126
147
  sampleSize?: number;
127
148
  }
149
+ export interface GetCollectionHistoryRequest {
150
+ /**
151
+ * The name of your MongoDb Collection
152
+ */
153
+ collectionName: string;
154
+ /**
155
+ * Only records from this time on (ISO date or time).
156
+ */
157
+ since?: string;
158
+ /**
159
+ * Only records of this operation.
160
+ */
161
+ operation?: GetCollectionHistoryOperationEnum;
162
+ /**
163
+ *
164
+ */
165
+ rowsPerPage?: number;
166
+ /**
167
+ *
168
+ */
169
+ page?: number;
170
+ /**
171
+ * relaxed (default), canonical or plain, as for the documents.
172
+ */
173
+ extendedJson?: GetCollectionHistoryExtendedJsonEnum;
174
+ }
128
175
  export interface GetCollectionInformationRequest {
129
176
  /**
130
177
  * The name of your MongoDb Collection
@@ -183,6 +230,24 @@ export interface GetSchemaAnalysisRequest {
183
230
  */
184
231
  depth?: number;
185
232
  }
233
+ export interface GetSuggestedValidatorRequest {
234
+ /**
235
+ * The name of your MongoDb Collection
236
+ */
237
+ collectionName: string;
238
+ /**
239
+ * Number of documents that are analysed, 1000 by default (2.0.0; 1.x read every document); 0 reads every document. With a sample the counts and shares are estimates.
240
+ */
241
+ sampleSize?: number;
242
+ /**
243
+ * How deep nested objects are analysed
244
+ */
245
+ depth?: number;
246
+ /**
247
+ * The share of the objects (0 to 1) a field has to be in to be required; 1 by default (in every object of the sample).
248
+ */
249
+ requiredThreshold?: number;
250
+ }
186
251
  export interface ListCollectionInformationRequest {
187
252
  /**
188
253
  * Only the Collections with these names, by default all Collections that the user may read. With `database` the names are the names inside that database (`locations`), the full name (`geodata:locations`) of that database is accepted too.
@@ -311,6 +376,20 @@ export declare class CollectionApi extends runtime.BaseAPI {
311
376
  * Distinct in Collection
312
377
  */
313
378
  distinct(requestParameters: DistinctRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<any>>;
379
+ /**
380
+ * Creates request options for getCollectionDeclaration without sending the request
381
+ */
382
+ getCollectionDeclarationRequestOpts(requestParameters: GetCollectionDeclarationRequest): Promise<runtime.RequestOpts>;
383
+ /**
384
+ * What a client needs to know of a declared collection (2.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
385
+ * Declaration of a Collection
386
+ */
387
+ getCollectionDeclarationRaw(requestParameters: GetCollectionDeclarationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CollectionDeclaration>>;
388
+ /**
389
+ * What a client needs to know of a declared collection (2.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
390
+ * Declaration of a Collection
391
+ */
392
+ getCollectionDeclaration(requestParameters: GetCollectionDeclarationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CollectionDeclaration>;
314
393
  /**
315
394
  * Creates request options for getCollectionFields without sending the request
316
395
  */
@@ -325,6 +404,20 @@ export declare class CollectionApi extends runtime.BaseAPI {
325
404
  * Collection Fields
326
405
  */
327
406
  getCollectionFields(requestParameters: GetCollectionFieldsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
407
+ /**
408
+ * Creates request options for getCollectionHistory without sending the request
409
+ */
410
+ getCollectionHistoryRequestOpts(requestParameters: GetCollectionHistoryRequest): Promise<runtime.RequestOpts>;
411
+ /**
412
+ * The audit records of a collection declared with audit, newest first (2.4.0); for the administrators of the collection. 404 for a collection without audit.
413
+ * History of a Collection
414
+ */
415
+ getCollectionHistoryRaw(requestParameters: GetCollectionHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<AuditEntry>>>;
416
+ /**
417
+ * The audit records of a collection declared with audit, newest first (2.4.0); for the administrators of the collection. 404 for a collection without audit.
418
+ * History of a Collection
419
+ */
420
+ getCollectionHistory(requestParameters: GetCollectionHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<AuditEntry>>;
328
421
  /**
329
422
  * Creates request options for getCollectionInformation without sending the request
330
423
  */
@@ -395,6 +488,20 @@ export declare class CollectionApi extends runtime.BaseAPI {
395
488
  * Collection Fields
396
489
  */
397
490
  getSchemaAnalysis(requestParameters: GetSchemaAnalysisRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SchemaAnalysis>;
491
+ /**
492
+ * Creates request options for getSuggestedValidator without sending the request
493
+ */
494
+ getSuggestedValidatorRequestOpts(requestParameters: GetSuggestedValidatorRequest): Promise<runtime.RequestOpts>;
495
+ /**
496
+ * A $jsonSchema validator made of a sample of the documents (2.3.0): the BSON types per field, nested objects, array items and the required fields. Usable as validator of the collection options or of a declaration. 404 for a collection that does not exist.
497
+ * Suggested Validator
498
+ */
499
+ getSuggestedValidatorRaw(requestParameters: GetSuggestedValidatorRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuggestedValidator>>;
500
+ /**
501
+ * A $jsonSchema validator made of a sample of the documents (2.3.0): the BSON types per field, nested objects, array items and the required fields. Usable as validator of the collection options or of a declaration. 404 for a collection that does not exist.
502
+ * Suggested Validator
503
+ */
504
+ getSuggestedValidator(requestParameters: GetSuggestedValidatorRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuggestedValidator>;
398
505
  /**
399
506
  * Creates request options for listCollectionInformation without sending the request
400
507
  */
@@ -491,3 +598,33 @@ export declare const DistinctCountEnum: {
491
598
  readonly None: "none";
492
599
  };
493
600
  export type DistinctCountEnum = typeof DistinctCountEnum[keyof typeof DistinctCountEnum];
601
+ /**
602
+ * @export
603
+ */
604
+ export declare const DistinctExtendedJsonEnum: {
605
+ readonly Relaxed: "relaxed";
606
+ readonly Canonical: "canonical";
607
+ readonly Plain: "plain";
608
+ };
609
+ export type DistinctExtendedJsonEnum = typeof DistinctExtendedJsonEnum[keyof typeof DistinctExtendedJsonEnum];
610
+ /**
611
+ * @export
612
+ */
613
+ export declare const GetCollectionHistoryOperationEnum: {
614
+ readonly Insert: "insert";
615
+ readonly Replace: "replace";
616
+ readonly Update: "update";
617
+ readonly Delete: "delete";
618
+ readonly SoftDelete: "softDelete";
619
+ readonly Restore: "restore";
620
+ };
621
+ export type GetCollectionHistoryOperationEnum = typeof GetCollectionHistoryOperationEnum[keyof typeof GetCollectionHistoryOperationEnum];
622
+ /**
623
+ * @export
624
+ */
625
+ export declare const GetCollectionHistoryExtendedJsonEnum: {
626
+ readonly Relaxed: "relaxed";
627
+ readonly Canonical: "canonical";
628
+ readonly Plain: "plain";
629
+ };
630
+ export type GetCollectionHistoryExtendedJsonEnum = typeof GetCollectionHistoryExtendedJsonEnum[keyof typeof GetCollectionHistoryExtendedJsonEnum];
@@ -1,4 +1,10 @@
1
1
  import * as runtime from "../runtime.js";
2
+ import {
3
+ AuditEntryFromJSON
4
+ } from "../models/AuditEntry.js";
5
+ import {
6
+ CollectionDeclarationFromJSON
7
+ } from "../models/CollectionDeclaration.js";
2
8
  import {
3
9
  CollectionOptionsFromJSON,
4
10
  CollectionOptionsToJSON
@@ -39,6 +45,9 @@ import {
39
45
  import {
40
46
  SchemaAnalysisFromJSON
41
47
  } from "../models/SchemaAnalysis.js";
48
+ import {
49
+ SuggestedValidatorFromJSON
50
+ } from "../models/SuggestedValidator.js";
42
51
  export class CollectionApi extends runtime.BaseAPI {
43
52
  /**
44
53
  * Creates request options for aggregate without sending the request
@@ -57,6 +66,9 @@ export class CollectionApi extends runtime.BaseAPI {
57
66
  );
58
67
  }
59
68
  const queryParameters = {};
69
+ if (requestParameters["withDeleted"] != null) {
70
+ queryParameters["withDeleted"] = requestParameters["withDeleted"];
71
+ }
60
72
  if (requestParameters["rowsPerPage"] != null) {
61
73
  queryParameters["rowsPerPage"] = requestParameters["rowsPerPage"];
62
74
  }
@@ -351,6 +363,9 @@ export class CollectionApi extends runtime.BaseAPI {
351
363
  );
352
364
  }
353
365
  const queryParameters = {};
366
+ if (requestParameters["withDeleted"] != null) {
367
+ queryParameters["withDeleted"] = requestParameters["withDeleted"];
368
+ }
354
369
  if (requestParameters["rowsPerPage"] != null) {
355
370
  queryParameters["rowsPerPage"] = requestParameters["rowsPerPage"];
356
371
  }
@@ -360,6 +375,9 @@ export class CollectionApi extends runtime.BaseAPI {
360
375
  if (requestParameters["count"] != null) {
361
376
  queryParameters["count"] = requestParameters["count"];
362
377
  }
378
+ if (requestParameters["extendedJson"] != null) {
379
+ queryParameters["extendedJson"] = requestParameters["extendedJson"];
380
+ }
363
381
  const headerParameters = {};
364
382
  if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
365
383
  headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
@@ -401,6 +419,57 @@ export class CollectionApi extends runtime.BaseAPI {
401
419
  const response = await this.distinctRaw(requestParameters, initOverrides);
402
420
  return await response.value();
403
421
  }
422
+ /**
423
+ * Creates request options for getCollectionDeclaration without sending the request
424
+ */
425
+ async getCollectionDeclarationRequestOpts(requestParameters) {
426
+ if (requestParameters["collectionName"] == null) {
427
+ throw new runtime.RequiredError(
428
+ "collectionName",
429
+ 'Required parameter "collectionName" was null or undefined when calling getCollectionDeclaration().'
430
+ );
431
+ }
432
+ const queryParameters = {};
433
+ const headerParameters = {};
434
+ if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
435
+ headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
436
+ }
437
+ if (this.configuration && this.configuration.accessToken) {
438
+ const token = this.configuration.accessToken;
439
+ const tokenString = await token("httpAuth", []);
440
+ if (tokenString) {
441
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
442
+ }
443
+ }
444
+ if (this.configuration && this.configuration.apiKey) {
445
+ headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
446
+ }
447
+ let urlPath = `/mongodb/collections/{collectionName}/declaration`;
448
+ urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
449
+ return {
450
+ path: urlPath,
451
+ method: "GET",
452
+ headers: headerParameters,
453
+ query: queryParameters
454
+ };
455
+ }
456
+ /**
457
+ * What a client needs to know of a declared collection (2.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
458
+ * Declaration of a Collection
459
+ */
460
+ async getCollectionDeclarationRaw(requestParameters, initOverrides) {
461
+ const requestOptions = await this.getCollectionDeclarationRequestOpts(requestParameters);
462
+ const response = await this.request(requestOptions, initOverrides);
463
+ return new runtime.JSONApiResponse(response, (jsonValue) => CollectionDeclarationFromJSON(jsonValue));
464
+ }
465
+ /**
466
+ * What a client needs to know of a declared collection (2.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
467
+ * Declaration of a Collection
468
+ */
469
+ async getCollectionDeclaration(requestParameters, initOverrides) {
470
+ const response = await this.getCollectionDeclarationRaw(requestParameters, initOverrides);
471
+ return await response.value();
472
+ }
404
473
  /**
405
474
  * Creates request options for getCollectionFields without sending the request
406
475
  */
@@ -455,6 +524,72 @@ export class CollectionApi extends runtime.BaseAPI {
455
524
  const response = await this.getCollectionFieldsRaw(requestParameters, initOverrides);
456
525
  return await response.value();
457
526
  }
527
+ /**
528
+ * Creates request options for getCollectionHistory without sending the request
529
+ */
530
+ async getCollectionHistoryRequestOpts(requestParameters) {
531
+ if (requestParameters["collectionName"] == null) {
532
+ throw new runtime.RequiredError(
533
+ "collectionName",
534
+ 'Required parameter "collectionName" was null or undefined when calling getCollectionHistory().'
535
+ );
536
+ }
537
+ const queryParameters = {};
538
+ if (requestParameters["since"] != null) {
539
+ queryParameters["since"] = requestParameters["since"];
540
+ }
541
+ if (requestParameters["operation"] != null) {
542
+ queryParameters["operation"] = requestParameters["operation"];
543
+ }
544
+ if (requestParameters["rowsPerPage"] != null) {
545
+ queryParameters["rowsPerPage"] = requestParameters["rowsPerPage"];
546
+ }
547
+ if (requestParameters["page"] != null) {
548
+ queryParameters["page"] = requestParameters["page"];
549
+ }
550
+ if (requestParameters["extendedJson"] != null) {
551
+ queryParameters["extendedJson"] = requestParameters["extendedJson"];
552
+ }
553
+ const headerParameters = {};
554
+ if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
555
+ headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
556
+ }
557
+ if (this.configuration && this.configuration.accessToken) {
558
+ const token = this.configuration.accessToken;
559
+ const tokenString = await token("httpAuth", []);
560
+ if (tokenString) {
561
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
562
+ }
563
+ }
564
+ if (this.configuration && this.configuration.apiKey) {
565
+ headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
566
+ }
567
+ let urlPath = `/mongodb/collections/{collectionName}/history`;
568
+ urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
569
+ return {
570
+ path: urlPath,
571
+ method: "GET",
572
+ headers: headerParameters,
573
+ query: queryParameters
574
+ };
575
+ }
576
+ /**
577
+ * The audit records of a collection declared with audit, newest first (2.4.0); for the administrators of the collection. 404 for a collection without audit.
578
+ * History of a Collection
579
+ */
580
+ async getCollectionHistoryRaw(requestParameters, initOverrides) {
581
+ const requestOptions = await this.getCollectionHistoryRequestOpts(requestParameters);
582
+ const response = await this.request(requestOptions, initOverrides);
583
+ return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AuditEntryFromJSON));
584
+ }
585
+ /**
586
+ * The audit records of a collection declared with audit, newest first (2.4.0); for the administrators of the collection. 404 for a collection without audit.
587
+ * History of a Collection
588
+ */
589
+ async getCollectionHistory(requestParameters, initOverrides) {
590
+ const response = await this.getCollectionHistoryRaw(requestParameters, initOverrides);
591
+ return await response.value();
592
+ }
458
593
  /**
459
594
  * Creates request options for getCollectionInformation without sending the request
460
595
  */
@@ -731,6 +866,66 @@ export class CollectionApi extends runtime.BaseAPI {
731
866
  const response = await this.getSchemaAnalysisRaw(requestParameters, initOverrides);
732
867
  return await response.value();
733
868
  }
869
+ /**
870
+ * Creates request options for getSuggestedValidator without sending the request
871
+ */
872
+ async getSuggestedValidatorRequestOpts(requestParameters) {
873
+ if (requestParameters["collectionName"] == null) {
874
+ throw new runtime.RequiredError(
875
+ "collectionName",
876
+ 'Required parameter "collectionName" was null or undefined when calling getSuggestedValidator().'
877
+ );
878
+ }
879
+ const queryParameters = {};
880
+ if (requestParameters["sampleSize"] != null) {
881
+ queryParameters["sampleSize"] = requestParameters["sampleSize"];
882
+ }
883
+ if (requestParameters["depth"] != null) {
884
+ queryParameters["depth"] = requestParameters["depth"];
885
+ }
886
+ if (requestParameters["requiredThreshold"] != null) {
887
+ queryParameters["requiredThreshold"] = requestParameters["requiredThreshold"];
888
+ }
889
+ const headerParameters = {};
890
+ if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
891
+ headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
892
+ }
893
+ if (this.configuration && this.configuration.accessToken) {
894
+ const token = this.configuration.accessToken;
895
+ const tokenString = await token("httpAuth", []);
896
+ if (tokenString) {
897
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
898
+ }
899
+ }
900
+ if (this.configuration && this.configuration.apiKey) {
901
+ headerParameters["X-AUTH-APIKEY"] = await this.configuration.apiKey("X-AUTH-APIKEY");
902
+ }
903
+ let urlPath = `/mongodb/collections/{collectionName}/schema/validator`;
904
+ urlPath = urlPath.replace("{collectionName}", encodeURIComponent(String(requestParameters["collectionName"])));
905
+ return {
906
+ path: urlPath,
907
+ method: "GET",
908
+ headers: headerParameters,
909
+ query: queryParameters
910
+ };
911
+ }
912
+ /**
913
+ * A $jsonSchema validator made of a sample of the documents (2.3.0): the BSON types per field, nested objects, array items and the required fields. Usable as validator of the collection options or of a declaration. 404 for a collection that does not exist.
914
+ * Suggested Validator
915
+ */
916
+ async getSuggestedValidatorRaw(requestParameters, initOverrides) {
917
+ const requestOptions = await this.getSuggestedValidatorRequestOpts(requestParameters);
918
+ const response = await this.request(requestOptions, initOverrides);
919
+ return new runtime.JSONApiResponse(response, (jsonValue) => SuggestedValidatorFromJSON(jsonValue));
920
+ }
921
+ /**
922
+ * A $jsonSchema validator made of a sample of the documents (2.3.0): the BSON types per field, nested objects, array items and the required fields. Usable as validator of the collection options or of a declaration. 404 for a collection that does not exist.
923
+ * Suggested Validator
924
+ */
925
+ async getSuggestedValidator(requestParameters, initOverrides) {
926
+ const response = await this.getSuggestedValidatorRaw(requestParameters, initOverrides);
927
+ return await response.value();
928
+ }
734
929
  /**
735
930
  * Creates request options for listCollectionInformation without sending the request
736
931
  */
@@ -1008,3 +1203,21 @@ export const DistinctCountEnum = {
1008
1203
  Exact: "exact",
1009
1204
  None: "none"
1010
1205
  };
1206
+ export const DistinctExtendedJsonEnum = {
1207
+ Relaxed: "relaxed",
1208
+ Canonical: "canonical",
1209
+ Plain: "plain"
1210
+ };
1211
+ export const GetCollectionHistoryOperationEnum = {
1212
+ Insert: "insert",
1213
+ Replace: "replace",
1214
+ Update: "update",
1215
+ Delete: "delete",
1216
+ SoftDelete: "softDelete",
1217
+ Restore: "restore"
1218
+ };
1219
+ export const GetCollectionHistoryExtendedJsonEnum = {
1220
+ Relaxed: "relaxed",
1221
+ Canonical: "canonical",
1222
+ Plain: "plain"
1223
+ };