@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
|
@@ -10,12 +10,15 @@ All URIs are relative to *http://localhost*
|
|
|
10
10
|
| [**createCollection**](CollectionApi.md#createcollection) | **PUT** /mongodb/collections/{collectionName} | Create Collection |
|
|
11
11
|
| [**deleteCollection**](CollectionApi.md#deletecollection) | **DELETE** /mongodb/collections/{collectionName} | Delete Collection |
|
|
12
12
|
| [**distinct**](CollectionApi.md#distinct) | **POST** /mongodb/collections/{collectionName}/distinct/{field} | Distinct in Collection |
|
|
13
|
+
| [**getCollectionDeclaration**](CollectionApi.md#getcollectiondeclaration) | **GET** /mongodb/collections/{collectionName}/declaration | Declaration of a Collection |
|
|
13
14
|
| [**getCollectionFields**](CollectionApi.md#getcollectionfields) | **GET** /mongodb/collections/{collectionName}/fields | Collection Fields |
|
|
15
|
+
| [**getCollectionHistory**](CollectionApi.md#getcollectionhistory) | **GET** /mongodb/collections/{collectionName}/history | History of a Collection |
|
|
14
16
|
| [**getCollectionInformation**](CollectionApi.md#getcollectioninformation) | **GET** /mongodb/collections/{collectionName} | Collection Information |
|
|
15
17
|
| [**getCollectionOptions**](CollectionApi.md#getcollectionoptions) | **GET** /mongodb/collections/{collectionName}/options | Collection Options |
|
|
16
18
|
| [**getFieldDetails**](CollectionApi.md#getfielddetails) | **GET** /mongodb/collections/{collectionName}/fields/detail | Fields of a Collection with types |
|
|
17
19
|
| [**getJsonSchema**](CollectionApi.md#getjsonschema) | **GET** /mongodb/collections/{collectionName}/schema | Collection Fields |
|
|
18
20
|
| [**getSchemaAnalysis**](CollectionApi.md#getschemaanalysis) | **GET** /mongodb/collections/{collectionName}/schema/analysis | Collection Fields |
|
|
21
|
+
| [**getSuggestedValidator**](CollectionApi.md#getsuggestedvalidator) | **GET** /mongodb/collections/{collectionName}/schema/validator | Suggested Validator |
|
|
19
22
|
| [**listCollectionInformation**](CollectionApi.md#listcollectioninformation) | **GET** /mongodb/collections/info | Information of all Collections |
|
|
20
23
|
| [**listCollections**](CollectionApi.md#listcollections) | **GET** /mongodb/collections | List of Collections |
|
|
21
24
|
| [**listCollectionsByDatabase**](CollectionApi.md#listcollectionsbydatabase) | **GET** /mongodb/databases/{databaseName}/collections | List of Collections |
|
|
@@ -26,7 +29,7 @@ All URIs are relative to *http://localhost*
|
|
|
26
29
|
|
|
27
30
|
## aggregate
|
|
28
31
|
|
|
29
|
-
> Array<{ [key: string]: any | null; }> aggregate(collectionName, mongoAggregateRequest, rowsPerPage, page, count, filter, extendedJson, filterCaseInsensitive)
|
|
32
|
+
> Array<{ [key: string]: any | null; }> aggregate(collectionName, mongoAggregateRequest, withDeleted, rowsPerPage, page, count, filter, extendedJson, filterCaseInsensitive)
|
|
30
33
|
|
|
31
34
|
Aggregate in Collection
|
|
32
35
|
|
|
@@ -59,6 +62,8 @@ async function example() {
|
|
|
59
62
|
collectionName: collectionName_example,
|
|
60
63
|
// MongoAggregateRequest
|
|
61
64
|
mongoAggregateRequest: ...,
|
|
65
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
66
|
+
withDeleted: true,
|
|
62
67
|
// number | Count elements per page (optional)
|
|
63
68
|
rowsPerPage: 100,
|
|
64
69
|
// number | Requested page of the ResultSets (optional)
|
|
@@ -92,6 +97,7 @@ example().catch(console.error);
|
|
|
92
97
|
|------------- | ------------- | ------------- | -------------|
|
|
93
98
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
94
99
|
| **mongoAggregateRequest** | [MongoAggregateRequest](MongoAggregateRequest.md) | | |
|
|
100
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
95
101
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
96
102
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
97
103
|
| **count** | `exact`, `none` | How the result is counted: exact (default) or none (no count headers, no count query) | [Optional] [Defaults to `'exact'`] [Enum: exact, none] |
|
|
@@ -444,7 +450,7 @@ example().catch(console.error);
|
|
|
444
450
|
|
|
445
451
|
## distinct
|
|
446
452
|
|
|
447
|
-
> Array<any> distinct(collectionName, field, rowsPerPage, page, count)
|
|
453
|
+
> Array<any> distinct(collectionName, field, withDeleted, rowsPerPage, page, count, extendedJson)
|
|
448
454
|
|
|
449
455
|
Distinct in Collection
|
|
450
456
|
|
|
@@ -477,12 +483,16 @@ async function example() {
|
|
|
477
483
|
collectionName: collectionName_example,
|
|
478
484
|
// string | The field for your distinct Request.
|
|
479
485
|
field: field_example,
|
|
486
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
487
|
+
withDeleted: true,
|
|
480
488
|
// number | Count elements per page (optional)
|
|
481
489
|
rowsPerPage: 100,
|
|
482
490
|
// number | Requested page of the ResultSets (optional)
|
|
483
491
|
page: 1,
|
|
484
492
|
// 'exact' | 'none' | How the result is counted: exact (default) or none (no count headers, no count query) (optional)
|
|
485
493
|
count: exact,
|
|
494
|
+
// 'relaxed' | 'canonical' | 'plain' | 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) (optional)
|
|
495
|
+
extendedJson: extendedJson_example,
|
|
486
496
|
} satisfies DistinctRequest;
|
|
487
497
|
|
|
488
498
|
try {
|
|
@@ -504,9 +514,11 @@ example().catch(console.error);
|
|
|
504
514
|
|------------- | ------------- | ------------- | -------------|
|
|
505
515
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
506
516
|
| **field** | `string` | The field for your distinct Request. | [Defaults to `undefined`] |
|
|
517
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
507
518
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
508
519
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
509
520
|
| **count** | `exact`, `none` | How the result is counted: exact (default) or none (no count headers, no count query) | [Optional] [Defaults to `'exact'`] [Enum: exact, none] |
|
|
521
|
+
| **extendedJson** | `relaxed`, `canonical`, `plain` | 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) | [Optional] [Defaults to `'plain'`] [Enum: relaxed, canonical, plain] |
|
|
510
522
|
|
|
511
523
|
### Return type
|
|
512
524
|
|
|
@@ -532,6 +544,84 @@ example().catch(console.error);
|
|
|
532
544
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
533
545
|
|
|
534
546
|
|
|
547
|
+
## getCollectionDeclaration
|
|
548
|
+
|
|
549
|
+
> CollectionDeclaration getCollectionDeclaration(collectionName)
|
|
550
|
+
|
|
551
|
+
Declaration of a Collection
|
|
552
|
+
|
|
553
|
+
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.
|
|
554
|
+
|
|
555
|
+
### Example
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
import {
|
|
559
|
+
Configuration,
|
|
560
|
+
CollectionApi,
|
|
561
|
+
} from '';
|
|
562
|
+
import type { GetCollectionDeclarationRequest } from '';
|
|
563
|
+
|
|
564
|
+
async function example() {
|
|
565
|
+
console.log("🚀 Testing SDK...");
|
|
566
|
+
const config = new Configuration({
|
|
567
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
568
|
+
username: "YOUR USERNAME",
|
|
569
|
+
password: "YOUR PASSWORD",
|
|
570
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
571
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
572
|
+
// To configure API key authorization: apiKeyAuth
|
|
573
|
+
apiKey: "YOUR API KEY",
|
|
574
|
+
});
|
|
575
|
+
const api = new CollectionApi(config);
|
|
576
|
+
|
|
577
|
+
const body = {
|
|
578
|
+
// string | The name of your MongoDb Collection
|
|
579
|
+
collectionName: collectionName_example,
|
|
580
|
+
} satisfies GetCollectionDeclarationRequest;
|
|
581
|
+
|
|
582
|
+
try {
|
|
583
|
+
const data = await api.getCollectionDeclaration(body);
|
|
584
|
+
console.log(data);
|
|
585
|
+
} catch (error) {
|
|
586
|
+
console.error(error);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// Run the test
|
|
591
|
+
example().catch(console.error);
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Parameters
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
| Name | Type | Description | Notes |
|
|
598
|
+
|------------- | ------------- | ------------- | -------------|
|
|
599
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
600
|
+
|
|
601
|
+
### Return type
|
|
602
|
+
|
|
603
|
+
[**CollectionDeclaration**](CollectionDeclaration.md)
|
|
604
|
+
|
|
605
|
+
### Authorization
|
|
606
|
+
|
|
607
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
608
|
+
|
|
609
|
+
### HTTP request headers
|
|
610
|
+
|
|
611
|
+
- **Content-Type**: Not defined
|
|
612
|
+
- **Accept**: `application/json`, `text/plain`
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
### HTTP response details
|
|
616
|
+
| Status code | Description | Response headers |
|
|
617
|
+
|-------------|-------------|------------------|
|
|
618
|
+
| **200** | | - |
|
|
619
|
+
| **400** | Invalid value for: body | - |
|
|
620
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
621
|
+
|
|
622
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
623
|
+
|
|
624
|
+
|
|
535
625
|
## getCollectionFields
|
|
536
626
|
|
|
537
627
|
> Array<string> getCollectionFields(collectionName, sampleSize)
|
|
@@ -613,6 +703,99 @@ example().catch(console.error);
|
|
|
613
703
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
614
704
|
|
|
615
705
|
|
|
706
|
+
## getCollectionHistory
|
|
707
|
+
|
|
708
|
+
> Array<AuditEntry> getCollectionHistory(collectionName, since, operation, rowsPerPage, page, extendedJson)
|
|
709
|
+
|
|
710
|
+
History of a Collection
|
|
711
|
+
|
|
712
|
+
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.
|
|
713
|
+
|
|
714
|
+
### Example
|
|
715
|
+
|
|
716
|
+
```ts
|
|
717
|
+
import {
|
|
718
|
+
Configuration,
|
|
719
|
+
CollectionApi,
|
|
720
|
+
} from '';
|
|
721
|
+
import type { GetCollectionHistoryRequest } from '';
|
|
722
|
+
|
|
723
|
+
async function example() {
|
|
724
|
+
console.log("🚀 Testing SDK...");
|
|
725
|
+
const config = new Configuration({
|
|
726
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
727
|
+
username: "YOUR USERNAME",
|
|
728
|
+
password: "YOUR PASSWORD",
|
|
729
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
730
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
731
|
+
// To configure API key authorization: apiKeyAuth
|
|
732
|
+
apiKey: "YOUR API KEY",
|
|
733
|
+
});
|
|
734
|
+
const api = new CollectionApi(config);
|
|
735
|
+
|
|
736
|
+
const body = {
|
|
737
|
+
// string | The name of your MongoDb Collection
|
|
738
|
+
collectionName: collectionName_example,
|
|
739
|
+
// string | Only records from this time on (ISO date or time). (optional)
|
|
740
|
+
since: since_example,
|
|
741
|
+
// 'insert' | 'replace' | 'update' | 'delete' | 'softDelete' | 'restore' | Only records of this operation. (optional)
|
|
742
|
+
operation: operation_example,
|
|
743
|
+
// number (optional)
|
|
744
|
+
rowsPerPage: 789,
|
|
745
|
+
// number (optional)
|
|
746
|
+
page: 789,
|
|
747
|
+
// 'relaxed' | 'canonical' | 'plain' | relaxed (default), canonical or plain, as for the documents. (optional)
|
|
748
|
+
extendedJson: extendedJson_example,
|
|
749
|
+
} satisfies GetCollectionHistoryRequest;
|
|
750
|
+
|
|
751
|
+
try {
|
|
752
|
+
const data = await api.getCollectionHistory(body);
|
|
753
|
+
console.log(data);
|
|
754
|
+
} catch (error) {
|
|
755
|
+
console.error(error);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// Run the test
|
|
760
|
+
example().catch(console.error);
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
### Parameters
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
| Name | Type | Description | Notes |
|
|
767
|
+
|------------- | ------------- | ------------- | -------------|
|
|
768
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
769
|
+
| **since** | `string` | Only records from this time on (ISO date or time). | [Optional] [Defaults to `undefined`] |
|
|
770
|
+
| **operation** | `insert`, `replace`, `update`, `delete`, `softDelete`, `restore` | Only records of this operation. | [Optional] [Defaults to `undefined`] [Enum: insert, replace, update, delete, softDelete, restore] |
|
|
771
|
+
| **rowsPerPage** | `number` | | [Optional] [Defaults to `undefined`] |
|
|
772
|
+
| **page** | `number` | | [Optional] [Defaults to `undefined`] |
|
|
773
|
+
| **extendedJson** | `relaxed`, `canonical`, `plain` | relaxed (default), canonical or plain, as for the documents. | [Optional] [Defaults to `undefined`] [Enum: relaxed, canonical, plain] |
|
|
774
|
+
|
|
775
|
+
### Return type
|
|
776
|
+
|
|
777
|
+
[**Array<AuditEntry>**](AuditEntry.md)
|
|
778
|
+
|
|
779
|
+
### Authorization
|
|
780
|
+
|
|
781
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
782
|
+
|
|
783
|
+
### HTTP request headers
|
|
784
|
+
|
|
785
|
+
- **Content-Type**: Not defined
|
|
786
|
+
- **Accept**: `application/json`, `text/plain`
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
### HTTP response details
|
|
790
|
+
| Status code | Description | Response headers |
|
|
791
|
+
|-------------|-------------|------------------|
|
|
792
|
+
| **200** | | - |
|
|
793
|
+
| **400** | Invalid value for: body | - |
|
|
794
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
795
|
+
|
|
796
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
797
|
+
|
|
798
|
+
|
|
616
799
|
## getCollectionInformation
|
|
617
800
|
|
|
618
801
|
> CollectionStatus getCollectionInformation(collectionName, includeDetails)
|
|
@@ -1023,6 +1206,93 @@ example().catch(console.error);
|
|
|
1023
1206
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
1024
1207
|
|
|
1025
1208
|
|
|
1209
|
+
## getSuggestedValidator
|
|
1210
|
+
|
|
1211
|
+
> SuggestedValidator getSuggestedValidator(collectionName, sampleSize, depth, requiredThreshold)
|
|
1212
|
+
|
|
1213
|
+
Suggested Validator
|
|
1214
|
+
|
|
1215
|
+
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.
|
|
1216
|
+
|
|
1217
|
+
### Example
|
|
1218
|
+
|
|
1219
|
+
```ts
|
|
1220
|
+
import {
|
|
1221
|
+
Configuration,
|
|
1222
|
+
CollectionApi,
|
|
1223
|
+
} from '';
|
|
1224
|
+
import type { GetSuggestedValidatorRequest } from '';
|
|
1225
|
+
|
|
1226
|
+
async function example() {
|
|
1227
|
+
console.log("🚀 Testing SDK...");
|
|
1228
|
+
const config = new Configuration({
|
|
1229
|
+
// To configure HTTP basic authorization: httpAuth1
|
|
1230
|
+
username: "YOUR USERNAME",
|
|
1231
|
+
password: "YOUR PASSWORD",
|
|
1232
|
+
// Configure HTTP bearer authorization: httpAuth
|
|
1233
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
1234
|
+
// To configure API key authorization: apiKeyAuth
|
|
1235
|
+
apiKey: "YOUR API KEY",
|
|
1236
|
+
});
|
|
1237
|
+
const api = new CollectionApi(config);
|
|
1238
|
+
|
|
1239
|
+
const body = {
|
|
1240
|
+
// string | The name of your MongoDb Collection
|
|
1241
|
+
collectionName: collectionName_example,
|
|
1242
|
+
// number | 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. (optional)
|
|
1243
|
+
sampleSize: 1000,
|
|
1244
|
+
// number | How deep nested objects are analysed (optional)
|
|
1245
|
+
depth: 56,
|
|
1246
|
+
// number | 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). (optional)
|
|
1247
|
+
requiredThreshold: 1.2,
|
|
1248
|
+
} satisfies GetSuggestedValidatorRequest;
|
|
1249
|
+
|
|
1250
|
+
try {
|
|
1251
|
+
const data = await api.getSuggestedValidator(body);
|
|
1252
|
+
console.log(data);
|
|
1253
|
+
} catch (error) {
|
|
1254
|
+
console.error(error);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
// Run the test
|
|
1259
|
+
example().catch(console.error);
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
### Parameters
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
| Name | Type | Description | Notes |
|
|
1266
|
+
|------------- | ------------- | ------------- | -------------|
|
|
1267
|
+
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
1268
|
+
| **sampleSize** | `number` | 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. | [Optional] [Defaults to `1000`] |
|
|
1269
|
+
| **depth** | `number` | How deep nested objects are analysed | [Optional] [Defaults to `3`] |
|
|
1270
|
+
| **requiredThreshold** | `number` | 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). | [Optional] [Defaults to `1`] |
|
|
1271
|
+
|
|
1272
|
+
### Return type
|
|
1273
|
+
|
|
1274
|
+
[**SuggestedValidator**](SuggestedValidator.md)
|
|
1275
|
+
|
|
1276
|
+
### Authorization
|
|
1277
|
+
|
|
1278
|
+
[httpAuth1](../README.md#httpAuth1), [httpAuth](../README.md#httpAuth), [apiKeyAuth](../README.md#apiKeyAuth)
|
|
1279
|
+
|
|
1280
|
+
### HTTP request headers
|
|
1281
|
+
|
|
1282
|
+
- **Content-Type**: Not defined
|
|
1283
|
+
- **Accept**: `application/json`, `text/plain`
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
### HTTP response details
|
|
1287
|
+
| Status code | Description | Response headers |
|
|
1288
|
+
|-------------|-------------|------------------|
|
|
1289
|
+
| **200** | | - |
|
|
1290
|
+
| **400** | Invalid value for: query parameter sampleSize, Invalid value for: query parameter depth, Invalid value for: query parameter requiredThreshold | - |
|
|
1291
|
+
| **0** | | * x-error-code - Error Code <br> * x-error-message - Message of the MongoCampException <br> * x-error-additional-info - Additional information for the MongoCampException <br> |
|
|
1292
|
+
|
|
1293
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
1294
|
+
|
|
1295
|
+
|
|
1026
1296
|
## listCollectionInformation
|
|
1027
1297
|
|
|
1028
1298
|
> Array<CollectionSummary> listCollectionInformation(name, database)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclaration
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`name` | string
|
|
10
|
+
`database` | string
|
|
11
|
+
`validation` | string
|
|
12
|
+
`systemFields` | Array<string>
|
|
13
|
+
`protectedFields` | Array<string>
|
|
14
|
+
`timestamps` | [CollectionDeclarationTimestamps](CollectionDeclarationTimestamps.md)
|
|
15
|
+
`owner` | [CollectionDeclarationOwner](CollectionDeclarationOwner.md)
|
|
16
|
+
`softDelete` | [CollectionDeclarationSoftDelete](CollectionDeclarationSoftDelete.md)
|
|
17
|
+
`versioned` | [CollectionDeclarationVersioned](CollectionDeclarationVersioned.md)
|
|
18
|
+
`audit` | [CollectionDeclarationAudit](CollectionDeclarationAudit.md)
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import type { CollectionDeclaration } from ''
|
|
24
|
+
|
|
25
|
+
// TODO: Update the object below with actual values
|
|
26
|
+
const example = {
|
|
27
|
+
"name": null,
|
|
28
|
+
"database": null,
|
|
29
|
+
"validation": null,
|
|
30
|
+
"systemFields": null,
|
|
31
|
+
"protectedFields": null,
|
|
32
|
+
"timestamps": null,
|
|
33
|
+
"owner": null,
|
|
34
|
+
"softDelete": null,
|
|
35
|
+
"versioned": null,
|
|
36
|
+
"audit": null,
|
|
37
|
+
} satisfies CollectionDeclaration
|
|
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 CollectionDeclaration
|
|
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
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationAudit
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`retentionDays` | number
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { CollectionDeclarationAudit } from ''
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"retentionDays": null,
|
|
19
|
+
} satisfies CollectionDeclarationAudit
|
|
20
|
+
|
|
21
|
+
console.log(example)
|
|
22
|
+
|
|
23
|
+
// Convert the instance to a JSON string
|
|
24
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
25
|
+
console.log(exampleJSON)
|
|
26
|
+
|
|
27
|
+
// Parse the JSON string back to an object
|
|
28
|
+
const exampleParsed = JSON.parse(exampleJSON) as CollectionDeclarationAudit
|
|
29
|
+
console.log(exampleParsed)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationOwner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`field` | string
|
|
10
|
+
`read` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { CollectionDeclarationOwner } from ''
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"field": null,
|
|
20
|
+
"read": null,
|
|
21
|
+
} satisfies CollectionDeclarationOwner
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as CollectionDeclarationOwner
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationSoftDelete
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`field` | string
|
|
10
|
+
`purgeAfterDays` | number
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { CollectionDeclarationSoftDelete } from ''
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"field": null,
|
|
20
|
+
"purgeAfterDays": null,
|
|
21
|
+
} satisfies CollectionDeclarationSoftDelete
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as CollectionDeclarationSoftDelete
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationTimestamps
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`createdAt` | string
|
|
10
|
+
`updatedAt` | string
|
|
11
|
+
`createdBy` | string
|
|
12
|
+
`updatedBy` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { CollectionDeclarationTimestamps } from ''
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"createdAt": null,
|
|
22
|
+
"updatedAt": null,
|
|
23
|
+
"createdBy": null,
|
|
24
|
+
"updatedBy": null,
|
|
25
|
+
} satisfies CollectionDeclarationTimestamps
|
|
26
|
+
|
|
27
|
+
console.log(example)
|
|
28
|
+
|
|
29
|
+
// Convert the instance to a JSON string
|
|
30
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
31
|
+
console.log(exampleJSON)
|
|
32
|
+
|
|
33
|
+
// Parse the JSON string back to an object
|
|
34
|
+
const exampleParsed = JSON.parse(exampleJSON) as CollectionDeclarationTimestamps
|
|
35
|
+
console.log(exampleParsed)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationVersioned
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`mode` | string
|
|
10
|
+
`field` | string
|
|
11
|
+
`required` | boolean
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { CollectionDeclarationVersioned } from ''
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"mode": null,
|
|
21
|
+
"field": null,
|
|
22
|
+
"required": null,
|
|
23
|
+
} satisfies CollectionDeclarationVersioned
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as CollectionDeclarationVersioned
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# CountRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`filter` | string
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { CountRequest } from ''
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"filter": null,
|
|
19
|
+
} satisfies CountRequest
|
|
20
|
+
|
|
21
|
+
console.log(example)
|
|
22
|
+
|
|
23
|
+
// Convert the instance to a JSON string
|
|
24
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
25
|
+
console.log(exampleJSON)
|
|
26
|
+
|
|
27
|
+
// Parse the JSON string back to an object
|
|
28
|
+
const exampleParsed = JSON.parse(exampleJSON) as CountRequest
|
|
29
|
+
console.log(exampleParsed)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
33
|
+
|
|
34
|
+
|