@sfxcode/nuxt-mongocamp-server 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -2
- package/dist/runtime/api/.openapi-generator/FILES +4 -0
- package/dist/runtime/api/apis/CollectionApi.d.ts +6 -6
- package/dist/runtime/api/apis/CollectionApi.js +4 -4
- package/dist/runtime/api/apis/DocumentApi.d.ts +42 -14
- package/dist/runtime/api/apis/DocumentApi.js +27 -6
- package/dist/runtime/api/docs/CollectionApi.md +6 -6
- package/dist/runtime/api/docs/CollectionDeclaration.md +4 -0
- package/dist/runtime/api/docs/CollectionDeclarationIndexesInner.md +38 -0
- package/dist/runtime/api/docs/CollectionDeclarationRefsInner.md +38 -0
- package/dist/runtime/api/docs/DocumentApi.md +47 -26
- package/dist/runtime/api/docs/ExportRequest.md +2 -0
- package/dist/runtime/api/docs/MongoFindRequest.md +2 -0
- package/dist/runtime/api/docs/SearchRequest.md +2 -0
- package/dist/runtime/api/models/CollectionDeclaration.d.ts +10 -0
- package/dist/runtime/api/models/CollectionDeclaration.js +14 -0
- package/dist/runtime/api/models/CollectionDeclarationIndexesInner.d.ts +40 -0
- package/dist/runtime/api/models/CollectionDeclarationIndexesInner.js +32 -0
- package/dist/runtime/api/models/CollectionDeclarationRefsInner.d.ts +38 -0
- package/dist/runtime/api/models/CollectionDeclarationRefsInner.js +31 -0
- package/dist/runtime/api/models/ErrorDescription.d.ts +1 -1
- package/dist/runtime/api/models/ExportRequest.d.ts +4 -0
- package/dist/runtime/api/models/ExportRequest.js +4 -2
- package/dist/runtime/api/models/MongoFindRequest.d.ts +4 -0
- package/dist/runtime/api/models/MongoFindRequest.js +4 -2
- package/dist/runtime/api/models/SearchRequest.d.ts +4 -0
- package/dist/runtime/api/models/SearchRequest.js +4 -2
- package/dist/runtime/api/models/index.d.ts +2 -0
- package/dist/runtime/api/models/index.js +2 -0
- package/dist/runtime/composables/mongocampCollection.d.ts +48 -10
- package/dist/runtime/composables/mongocampCollection.js +50 -9
- package/dist/runtime/composables/mongocampLive.d.ts +5 -2
- package/dist/runtime/composables/mongocampLive.js +5 -2
- package/dist/runtime/server/composables/mongocampServerCollection.d.ts +20 -0
- package/dist/runtime/server/composables/mongocampServerCollection.js +12 -0
- package/dist/runtime/types/collections.d.ts +10 -0
- package/dist/runtime/utils/sse.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ const open = await orders.find({ filter: 'qty:[2 TO *]' }) // { customer: string
|
|
|
97
97
|
await orders.insert({ customer: 'Ada', createdAt: new Date() })
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
Since 2.
|
|
100
|
+
Since 2.3 a declaration also switches behaviours on, one flag each — what Mongoose users know from `{ timestamps: true }`, `__v` and
|
|
101
101
|
plugins, plus per-document ownership and live data in the browser ([behaviours](https://mongocamp.github.io/nuxt-mongocamp-server/server/declared-collections#behaviours),
|
|
102
102
|
[coming from Mongoose](https://mongocamp.github.io/nuxt-mongocamp-server/guide/coming-from-mongoose)):
|
|
103
103
|
|
|
@@ -118,6 +118,27 @@ export default defineMongocampCollection({
|
|
|
118
118
|
const { documents, status } = useMongocampLive('orders', { filter: 'status:open' })
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
Since 2.4 the declaration also holds the indexes and the references to other collections — Mongoose's `index` and `populate`
|
|
122
|
+
([indexes](https://mongocamp.github.io/nuxt-mongocamp-server/server/declared-collections#indexes),
|
|
123
|
+
[relations](https://mongocamp.github.io/nuxt-mongocamp-server/server/declared-collections#relations)):
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
export default defineMongocampCollection({
|
|
127
|
+
name: 'orders',
|
|
128
|
+
schema,
|
|
129
|
+
indexes: ['status', ['customerId', '-createdAt'], { fields: { number: 1 }, unique: true }], // created at the start
|
|
130
|
+
refs: { customerId: 'customers' },
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const list = await useMongocampCollection('orders').find({ expand: ['customerId'] }) // customerId: Customer | null, read with your rights
|
|
136
|
+
|
|
137
|
+
// server/api/orders.post.ts: the same rules as the API, for the caller of the request
|
|
138
|
+
const orders = useMongocampServerCollection('orders', { user: event })
|
|
139
|
+
await orders.insert({ customerId, total: 12.5 })
|
|
140
|
+
```
|
|
141
|
+
|
|
121
142
|
**Upgrading** from an older MongoCamp server or a 1.x version of this module: see the migration guides ([`docs/migration/to-2.0.md`](docs/migration/to-2.0.md), [`docs/migration/from-scala.md`](docs/migration/from-scala.md)).
|
|
122
143
|
|
|
123
144
|
### Standalone server
|
|
@@ -185,7 +206,7 @@ A missing `url` throws during `nuxi dev`/`nuxi build`/`nuxi generate` (not durin
|
|
|
185
206
|
| `useMongocampUrl()` | The configured base URL. |
|
|
186
207
|
| `useMongocampSearch()` | `find`/`findAll`/`findByField` document search helpers. `find(..., filterCaseInsensitive)` makes wildcards of the filter ignore the case (case-sensitive by default). |
|
|
187
208
|
| `usePaginatedFind(collection, opts)`| Reactive pagination wrapper (`page`, `documents`, `pending`, `error`, `nextPage`/`previousPage`/`goToPage`); `opts.filterCaseInsensitive` as for `find`. |
|
|
188
|
-
| `useMongocampCollection(name)` | Typed and decoded documents of a declared collection (or `<T>(name)` for any other): `find`, `findPage`, `findById`, `insert`, `replace`, `update`, `remove`, `restore`, `history`, `isMine`, `paginated()`; versions sent automatically, errors with `status`, `issues`, `isConflict`, `current`. |
|
|
209
|
+
| `useMongocampCollection(name)` | Typed and decoded documents of a declared collection (or `<T>(name)` for any other): `find`, `findPage`, `findById`, `insert`, `replace`, `update`, `remove`, `restore`, `history`, `isMine`, `paginated()`; `expand` of references (typed); versions sent automatically, errors with `status`, `issues`, `isConflict`, `current`. |
|
|
189
210
|
| `useMongocampLive(name, opts)` | A live list kept in sync with the server (Server-Sent Events on change streams, polling without a replica set). |
|
|
190
211
|
| `useMongocampApiCollection(name)` | Per-collection insert/update/delete/aggregate/schema helpers, `suggestValidator()`. |
|
|
191
212
|
| `useMongocampApiCollections()` | List collections/databases, database info. |
|
|
@@ -210,6 +231,7 @@ The server returns documents as relaxed MongoDB Extended JSON: `{"_id": {"$oid":
|
|
|
210
231
|
| `useMongocampApi(event, token?)` | Builds authenticated API clients using the module's `apiKey`, or the given `token` as a fallback. With the embedded server the calls are answered in-process. |
|
|
211
232
|
| `useMongocampCore()` | The embedded server (`server.enabled` only) in server routes; plugins get it on the hook `mongocamp:ready`. |
|
|
212
233
|
| `useMongocampServerApi(url, key?, token?)` | Lower-level factory when you need to authenticate against a different URL/credential explicitly. |
|
|
234
|
+
| `useMongocampServerCollection(name, { user })` | Typed documents of a collection in server code with the rules of the API (grants, scope, validation, behaviours, events) for the event's caller, a user id or `'system'` (2.4, embedded server). |
|
|
213
235
|
|
|
214
236
|
```ts
|
|
215
237
|
// server/api/mongocamp/users.ts
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { consola } from 'consola';
|
|
|
5
5
|
export * from '../dist/runtime/api/index.js';
|
|
6
6
|
|
|
7
7
|
const name = "@sfxcode/nuxt-mongocamp-server";
|
|
8
|
-
const version = "2.
|
|
8
|
+
const version = "2.4.0";
|
|
9
9
|
|
|
10
10
|
const DefaultServerPrefix = "/api/mongocamp-server";
|
|
11
11
|
const DefaultCollectionsDir = "mongocamp";
|
|
@@ -69,7 +69,7 @@ function collectionsServerTemplate(files, rootDir) {
|
|
|
69
69
|
function collectionsTypeTemplate(files, typesDir) {
|
|
70
70
|
const entries = (type) => files.map((file) => ` ${JSON.stringify(file.key)}: ${type}<typeof import(${JSON.stringify(importPath(typesDir, file.path))}).default>`);
|
|
71
71
|
return [
|
|
72
|
-
"import type { InferDocument, InferDocumentInput } from '@sfxcode/mongocamp-server-core'",
|
|
72
|
+
"import type { InferDocument, InferDocumentInput, InferRefs } from '@sfxcode/mongocamp-server-core'",
|
|
73
73
|
"",
|
|
74
74
|
"declare global {",
|
|
75
75
|
" /** The documents of the declared collections (`server/mongocamp/<name>.ts`) as they are stored, by file name. */",
|
|
@@ -80,6 +80,10 @@ function collectionsTypeTemplate(files, typesDir) {
|
|
|
80
80
|
" interface MongocampCollectionInputs {",
|
|
81
81
|
...entries("InferDocumentInput"),
|
|
82
82
|
" }",
|
|
83
|
+
" /** The references of the declared collections (2.4.0): field \u2192 target collection, for `expand`. */",
|
|
84
|
+
" interface MongocampCollectionRefs {",
|
|
85
|
+
...entries("InferRefs"),
|
|
86
|
+
" }",
|
|
83
87
|
"}",
|
|
84
88
|
"",
|
|
85
89
|
"export {}",
|
|
@@ -24,7 +24,9 @@ docs/CollectionApi.md
|
|
|
24
24
|
docs/CollectionCollation.md
|
|
25
25
|
docs/CollectionDeclaration.md
|
|
26
26
|
docs/CollectionDeclarationAudit.md
|
|
27
|
+
docs/CollectionDeclarationIndexesInner.md
|
|
27
28
|
docs/CollectionDeclarationOwner.md
|
|
29
|
+
docs/CollectionDeclarationRefsInner.md
|
|
28
30
|
docs/CollectionDeclarationSoftDelete.md
|
|
29
31
|
docs/CollectionDeclarationTimestamps.md
|
|
30
32
|
docs/CollectionDeclarationVersioned.md
|
|
@@ -108,7 +110,9 @@ models/ClusterMemberInformation.ts
|
|
|
108
110
|
models/CollectionCollation.ts
|
|
109
111
|
models/CollectionDeclaration.ts
|
|
110
112
|
models/CollectionDeclarationAudit.ts
|
|
113
|
+
models/CollectionDeclarationIndexesInner.ts
|
|
111
114
|
models/CollectionDeclarationOwner.ts
|
|
115
|
+
models/CollectionDeclarationRefsInner.ts
|
|
112
116
|
models/CollectionDeclarationSoftDelete.ts
|
|
113
117
|
models/CollectionDeclarationTimestamps.ts
|
|
114
118
|
models/CollectionDeclarationVersioned.ts
|
|
@@ -36,7 +36,7 @@ export interface AggregateRequest {
|
|
|
36
36
|
*/
|
|
37
37
|
mongoAggregateRequest: MongoAggregateRequest;
|
|
38
38
|
/**
|
|
39
|
-
* Soft-deleted documents too (collections declared with softDelete, 2.
|
|
39
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
40
40
|
*/
|
|
41
41
|
withDeleted?: boolean;
|
|
42
42
|
/**
|
|
@@ -110,7 +110,7 @@ export interface DistinctRequest {
|
|
|
110
110
|
*/
|
|
111
111
|
field: string;
|
|
112
112
|
/**
|
|
113
|
-
* Soft-deleted documents too (collections declared with softDelete, 2.
|
|
113
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
114
114
|
*/
|
|
115
115
|
withDeleted?: boolean;
|
|
116
116
|
/**
|
|
@@ -381,12 +381,12 @@ export declare class CollectionApi extends runtime.BaseAPI {
|
|
|
381
381
|
*/
|
|
382
382
|
getCollectionDeclarationRequestOpts(requestParameters: GetCollectionDeclarationRequest): Promise<runtime.RequestOpts>;
|
|
383
383
|
/**
|
|
384
|
-
* What a client needs to know of a declared collection (2.
|
|
384
|
+
* What a client needs to know of a declared collection (2.3.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
|
|
385
385
|
* Declaration of a Collection
|
|
386
386
|
*/
|
|
387
387
|
getCollectionDeclarationRaw(requestParameters: GetCollectionDeclarationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CollectionDeclaration>>;
|
|
388
388
|
/**
|
|
389
|
-
* What a client needs to know of a declared collection (2.
|
|
389
|
+
* What a client needs to know of a declared collection (2.3.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
|
|
390
390
|
* Declaration of a Collection
|
|
391
391
|
*/
|
|
392
392
|
getCollectionDeclaration(requestParameters: GetCollectionDeclarationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CollectionDeclaration>;
|
|
@@ -409,12 +409,12 @@ export declare class CollectionApi extends runtime.BaseAPI {
|
|
|
409
409
|
*/
|
|
410
410
|
getCollectionHistoryRequestOpts(requestParameters: GetCollectionHistoryRequest): Promise<runtime.RequestOpts>;
|
|
411
411
|
/**
|
|
412
|
-
* The audit records of a collection declared with audit, newest first (2.
|
|
412
|
+
* The audit records of a collection declared with audit, newest first (2.3.0); for the administrators of the collection. 404 for a collection without audit.
|
|
413
413
|
* History of a Collection
|
|
414
414
|
*/
|
|
415
415
|
getCollectionHistoryRaw(requestParameters: GetCollectionHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<AuditEntry>>>;
|
|
416
416
|
/**
|
|
417
|
-
* The audit records of a collection declared with audit, newest first (2.
|
|
417
|
+
* The audit records of a collection declared with audit, newest first (2.3.0); for the administrators of the collection. 404 for a collection without audit.
|
|
418
418
|
* History of a Collection
|
|
419
419
|
*/
|
|
420
420
|
getCollectionHistory(requestParameters: GetCollectionHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<AuditEntry>>;
|
|
@@ -454,7 +454,7 @@ export class CollectionApi extends runtime.BaseAPI {
|
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
/**
|
|
457
|
-
* What a client needs to know of a declared collection (2.
|
|
457
|
+
* What a client needs to know of a declared collection (2.3.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
|
|
458
458
|
* Declaration of a Collection
|
|
459
459
|
*/
|
|
460
460
|
async getCollectionDeclarationRaw(requestParameters, initOverrides) {
|
|
@@ -463,7 +463,7 @@ export class CollectionApi extends runtime.BaseAPI {
|
|
|
463
463
|
return new runtime.JSONApiResponse(response, (jsonValue) => CollectionDeclarationFromJSON(jsonValue));
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
466
|
-
* What a client needs to know of a declared collection (2.
|
|
466
|
+
* What a client needs to know of a declared collection (2.3.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
|
|
467
467
|
* Declaration of a Collection
|
|
468
468
|
*/
|
|
469
469
|
async getCollectionDeclaration(requestParameters, initOverrides) {
|
|
@@ -574,7 +574,7 @@ export class CollectionApi extends runtime.BaseAPI {
|
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
/**
|
|
577
|
-
* The audit records of a collection declared with audit, newest first (2.
|
|
577
|
+
* The audit records of a collection declared with audit, newest first (2.3.0); for the administrators of the collection. 404 for a collection without audit.
|
|
578
578
|
* History of a Collection
|
|
579
579
|
*/
|
|
580
580
|
async getCollectionHistoryRaw(requestParameters, initOverrides) {
|
|
@@ -583,7 +583,7 @@ export class CollectionApi extends runtime.BaseAPI {
|
|
|
583
583
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AuditEntryFromJSON));
|
|
584
584
|
}
|
|
585
585
|
/**
|
|
586
|
-
* The audit records of a collection declared with audit, newest first (2.
|
|
586
|
+
* The audit records of a collection declared with audit, newest first (2.3.0); for the administrators of the collection. 404 for a collection without audit.
|
|
587
587
|
* History of a Collection
|
|
588
588
|
*/
|
|
589
589
|
async getCollectionHistory(requestParameters, initOverrides) {
|
|
@@ -37,7 +37,7 @@ export interface CountDocumentsRequest {
|
|
|
37
37
|
*/
|
|
38
38
|
collectionName: string;
|
|
39
39
|
/**
|
|
40
|
-
* Soft-deleted documents too (collections declared with softDelete, 2.
|
|
40
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
41
41
|
*/
|
|
42
42
|
withDeleted?: boolean;
|
|
43
43
|
/**
|
|
@@ -59,7 +59,7 @@ export interface CountDocumentsByBodyRequest {
|
|
|
59
59
|
*/
|
|
60
60
|
countRequest: CountRequest;
|
|
61
61
|
/**
|
|
62
|
-
* Soft-deleted documents too (collections declared with softDelete, 2.
|
|
62
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
63
63
|
*/
|
|
64
64
|
withDeleted?: boolean;
|
|
65
65
|
/**
|
|
@@ -97,7 +97,11 @@ export interface ExportDocumentsRequest {
|
|
|
97
97
|
*/
|
|
98
98
|
collectionName: string;
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
100
|
+
* References to expand (2.4.0): declared ref fields of the collection, repeated or comma separated, at most 5. Each becomes the referenced document, read with the grant and the read scope of its collection (null, or left out of an array, when the caller cannot read it). 400 for a field that is no reference.
|
|
101
|
+
*/
|
|
102
|
+
expand?: Array<string>;
|
|
103
|
+
/**
|
|
104
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
101
105
|
*/
|
|
102
106
|
withDeleted?: boolean;
|
|
103
107
|
/**
|
|
@@ -143,7 +147,11 @@ export interface ExportDocumentsByBodyRequest {
|
|
|
143
147
|
*/
|
|
144
148
|
exportRequest: ExportRequest;
|
|
145
149
|
/**
|
|
146
|
-
*
|
|
150
|
+
* References to expand (2.4.0): declared ref fields of the collection, repeated or comma separated, at most 5. Each becomes the referenced document, read with the grant and the read scope of its collection (null, or left out of an array, when the caller cannot read it). 400 for a field that is no reference.
|
|
151
|
+
*/
|
|
152
|
+
expand?: Array<string>;
|
|
153
|
+
/**
|
|
154
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
147
155
|
*/
|
|
148
156
|
withDeleted?: boolean;
|
|
149
157
|
/**
|
|
@@ -173,7 +181,11 @@ export interface FindRequest {
|
|
|
173
181
|
*/
|
|
174
182
|
mongoFindRequest: MongoFindRequest;
|
|
175
183
|
/**
|
|
176
|
-
*
|
|
184
|
+
* References to expand (2.4.0): declared ref fields of the collection, repeated or comma separated, at most 5. Each becomes the referenced document, read with the grant and the read scope of its collection (null, or left out of an array, when the caller cannot read it). 400 for a field that is no reference.
|
|
185
|
+
*/
|
|
186
|
+
expand?: Array<string>;
|
|
187
|
+
/**
|
|
188
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
177
189
|
*/
|
|
178
190
|
withDeleted?: boolean;
|
|
179
191
|
/**
|
|
@@ -207,7 +219,11 @@ export interface GetDocumentRequest {
|
|
|
207
219
|
*/
|
|
208
220
|
documentId: string;
|
|
209
221
|
/**
|
|
210
|
-
*
|
|
222
|
+
* References to expand (2.4.0): declared ref fields of the collection, repeated or comma separated, at most 5. Each becomes the referenced document, read with the grant and the read scope of its collection (null, or left out of an array, when the caller cannot read it). 400 for a field that is no reference.
|
|
223
|
+
*/
|
|
224
|
+
expand?: Array<string>;
|
|
225
|
+
/**
|
|
226
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
211
227
|
*/
|
|
212
228
|
withDeleted?: boolean;
|
|
213
229
|
/**
|
|
@@ -281,7 +297,11 @@ export interface ListDocumentsRequest {
|
|
|
281
297
|
*/
|
|
282
298
|
collectionName: string;
|
|
283
299
|
/**
|
|
284
|
-
*
|
|
300
|
+
* References to expand (2.4.0): declared ref fields of the collection, repeated or comma separated, at most 5. Each becomes the referenced document, read with the grant and the read scope of its collection (null, or left out of an array, when the caller cannot read it). 400 for a field that is no reference.
|
|
301
|
+
*/
|
|
302
|
+
expand?: Array<string>;
|
|
303
|
+
/**
|
|
304
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
285
305
|
*/
|
|
286
306
|
withDeleted?: boolean;
|
|
287
307
|
/**
|
|
@@ -341,7 +361,11 @@ export interface SearchDocumentsRequest {
|
|
|
341
361
|
*/
|
|
342
362
|
searchRequest: SearchRequest;
|
|
343
363
|
/**
|
|
344
|
-
*
|
|
364
|
+
* References to expand (2.4.0): declared ref fields of the collection, repeated or comma separated, at most 5. Each becomes the referenced document, read with the grant and the read scope of its collection (null, or left out of an array, when the caller cannot read it). 400 for a field that is no reference.
|
|
365
|
+
*/
|
|
366
|
+
expand?: Array<string>;
|
|
367
|
+
/**
|
|
368
|
+
* Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.
|
|
345
369
|
*/
|
|
346
370
|
withDeleted?: boolean;
|
|
347
371
|
/**
|
|
@@ -428,6 +452,10 @@ export interface WatchDocumentsRequest {
|
|
|
428
452
|
* The name of your MongoDb Collection
|
|
429
453
|
*/
|
|
430
454
|
collectionName: string;
|
|
455
|
+
/**
|
|
456
|
+
* References to expand in each upsert (2.4.0), like on the list of documents. A change of a referenced document sends no event.
|
|
457
|
+
*/
|
|
458
|
+
expand?: Array<string>;
|
|
431
459
|
/**
|
|
432
460
|
* Lucene filter of the documents to watch.
|
|
433
461
|
*/
|
|
@@ -570,12 +598,12 @@ export declare class DocumentApi extends runtime.BaseAPI {
|
|
|
570
598
|
*/
|
|
571
599
|
getDocumentHistoryRequestOpts(requestParameters: GetDocumentHistoryRequest): Promise<runtime.RequestOpts>;
|
|
572
600
|
/**
|
|
573
|
-
* The audit records of a document of a collection declared with audit, newest first (2.
|
|
601
|
+
* The audit records of a document of a collection declared with audit, newest first (2.3.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.
|
|
574
602
|
* History of a Document
|
|
575
603
|
*/
|
|
576
604
|
getDocumentHistoryRaw(requestParameters: GetDocumentHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<AuditEntry>>>;
|
|
577
605
|
/**
|
|
578
|
-
* The audit records of a document of a collection declared with audit, newest first (2.
|
|
606
|
+
* The audit records of a document of a collection declared with audit, newest first (2.3.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.
|
|
579
607
|
* History of a Document
|
|
580
608
|
*/
|
|
581
609
|
getDocumentHistory(requestParameters: GetDocumentHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<AuditEntry>>;
|
|
@@ -644,12 +672,12 @@ export declare class DocumentApi extends runtime.BaseAPI {
|
|
|
644
672
|
*/
|
|
645
673
|
restoreDocumentRequestOpts(requestParameters: RestoreDocumentRequest): Promise<runtime.RequestOpts>;
|
|
646
674
|
/**
|
|
647
|
-
* Removes the deleted mark of a document of a collection declared with softDelete (2.
|
|
675
|
+
* Removes the deleted mark of a document of a collection declared with softDelete (2.3.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
648
676
|
* Restore a soft-deleted Document
|
|
649
677
|
*/
|
|
650
678
|
restoreDocumentRaw(requestParameters: RestoreDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UpdateResponse>>;
|
|
651
679
|
/**
|
|
652
|
-
* Removes the deleted mark of a document of a collection declared with softDelete (2.
|
|
680
|
+
* Removes the deleted mark of a document of a collection declared with softDelete (2.3.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
653
681
|
* Restore a soft-deleted Document
|
|
654
682
|
*/
|
|
655
683
|
restoreDocument(requestParameters: RestoreDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UpdateResponse>;
|
|
@@ -718,12 +746,12 @@ export declare class DocumentApi extends runtime.BaseAPI {
|
|
|
718
746
|
*/
|
|
719
747
|
watchDocumentsRequestOpts(requestParameters: WatchDocumentsRequest): Promise<runtime.RequestOpts>;
|
|
720
748
|
/**
|
|
721
|
-
* The changes of the documents as Server-Sent Events (2.
|
|
749
|
+
* The changes of the documents as Server-Sent Events (2.3.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).
|
|
722
750
|
* Live Updates of a Collection
|
|
723
751
|
*/
|
|
724
752
|
watchDocumentsRaw(requestParameters: WatchDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
|
|
725
753
|
/**
|
|
726
|
-
* The changes of the documents as Server-Sent Events (2.
|
|
754
|
+
* The changes of the documents as Server-Sent Events (2.3.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).
|
|
727
755
|
* Live Updates of a Collection
|
|
728
756
|
*/
|
|
729
757
|
watchDocuments(requestParameters: WatchDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
|
|
@@ -295,6 +295,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
297
|
const queryParameters = {};
|
|
298
|
+
if (requestParameters["expand"] != null) {
|
|
299
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
300
|
+
}
|
|
298
301
|
if (requestParameters["withDeleted"] != null) {
|
|
299
302
|
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
300
303
|
}
|
|
@@ -383,6 +386,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
383
386
|
);
|
|
384
387
|
}
|
|
385
388
|
const queryParameters = {};
|
|
389
|
+
if (requestParameters["expand"] != null) {
|
|
390
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
391
|
+
}
|
|
386
392
|
if (requestParameters["withDeleted"] != null) {
|
|
387
393
|
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
388
394
|
}
|
|
@@ -461,6 +467,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
461
467
|
);
|
|
462
468
|
}
|
|
463
469
|
const queryParameters = {};
|
|
470
|
+
if (requestParameters["expand"] != null) {
|
|
471
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
472
|
+
}
|
|
464
473
|
if (requestParameters["withDeleted"] != null) {
|
|
465
474
|
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
466
475
|
}
|
|
@@ -538,6 +547,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
538
547
|
);
|
|
539
548
|
}
|
|
540
549
|
const queryParameters = {};
|
|
550
|
+
if (requestParameters["expand"] != null) {
|
|
551
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
552
|
+
}
|
|
541
553
|
if (requestParameters["withDeleted"] != null) {
|
|
542
554
|
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
543
555
|
}
|
|
@@ -636,7 +648,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
636
648
|
};
|
|
637
649
|
}
|
|
638
650
|
/**
|
|
639
|
-
* The audit records of a document of a collection declared with audit, newest first (2.
|
|
651
|
+
* The audit records of a document of a collection declared with audit, newest first (2.3.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
652
|
* History of a Document
|
|
641
653
|
*/
|
|
642
654
|
async getDocumentHistoryRaw(requestParameters, initOverrides) {
|
|
@@ -645,7 +657,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
645
657
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AuditEntryFromJSON));
|
|
646
658
|
}
|
|
647
659
|
/**
|
|
648
|
-
* The audit records of a document of a collection declared with audit, newest first (2.
|
|
660
|
+
* The audit records of a document of a collection declared with audit, newest first (2.3.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
661
|
* History of a Document
|
|
650
662
|
*/
|
|
651
663
|
async getDocumentHistory(requestParameters, initOverrides) {
|
|
@@ -837,6 +849,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
837
849
|
);
|
|
838
850
|
}
|
|
839
851
|
const queryParameters = {};
|
|
852
|
+
if (requestParameters["expand"] != null) {
|
|
853
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
854
|
+
}
|
|
840
855
|
if (requestParameters["withDeleted"] != null) {
|
|
841
856
|
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
842
857
|
}
|
|
@@ -949,7 +964,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
949
964
|
};
|
|
950
965
|
}
|
|
951
966
|
/**
|
|
952
|
-
* Removes the deleted mark of a document of a collection declared with softDelete (2.
|
|
967
|
+
* Removes the deleted mark of a document of a collection declared with softDelete (2.3.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
953
968
|
* Restore a soft-deleted Document
|
|
954
969
|
*/
|
|
955
970
|
async restoreDocumentRaw(requestParameters, initOverrides) {
|
|
@@ -958,7 +973,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
958
973
|
return new runtime.JSONApiResponse(response, (jsonValue) => UpdateResponseFromJSON(jsonValue));
|
|
959
974
|
}
|
|
960
975
|
/**
|
|
961
|
-
* Removes the deleted mark of a document of a collection declared with softDelete (2.
|
|
976
|
+
* Removes the deleted mark of a document of a collection declared with softDelete (2.3.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
|
|
962
977
|
* Restore a soft-deleted Document
|
|
963
978
|
*/
|
|
964
979
|
async restoreDocument(requestParameters, initOverrides) {
|
|
@@ -982,6 +997,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
982
997
|
);
|
|
983
998
|
}
|
|
984
999
|
const queryParameters = {};
|
|
1000
|
+
if (requestParameters["expand"] != null) {
|
|
1001
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
1002
|
+
}
|
|
985
1003
|
if (requestParameters["withDeleted"] != null) {
|
|
986
1004
|
queryParameters["withDeleted"] = requestParameters["withDeleted"];
|
|
987
1005
|
}
|
|
@@ -1256,6 +1274,9 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
1256
1274
|
);
|
|
1257
1275
|
}
|
|
1258
1276
|
const queryParameters = {};
|
|
1277
|
+
if (requestParameters["expand"] != null) {
|
|
1278
|
+
queryParameters["expand"] = requestParameters["expand"];
|
|
1279
|
+
}
|
|
1259
1280
|
if (requestParameters["filter"] != null) {
|
|
1260
1281
|
queryParameters["filter"] = requestParameters["filter"];
|
|
1261
1282
|
}
|
|
@@ -1276,7 +1297,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
1276
1297
|
};
|
|
1277
1298
|
}
|
|
1278
1299
|
/**
|
|
1279
|
-
* The changes of the documents as Server-Sent Events (2.
|
|
1300
|
+
* The changes of the documents as Server-Sent Events (2.3.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
1301
|
* Live Updates of a Collection
|
|
1281
1302
|
*/
|
|
1282
1303
|
async watchDocumentsRaw(requestParameters, initOverrides) {
|
|
@@ -1289,7 +1310,7 @@ export class DocumentApi extends runtime.BaseAPI {
|
|
|
1289
1310
|
}
|
|
1290
1311
|
}
|
|
1291
1312
|
/**
|
|
1292
|
-
* The changes of the documents as Server-Sent Events (2.
|
|
1313
|
+
* The changes of the documents as Server-Sent Events (2.3.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
1314
|
* Live Updates of a Collection
|
|
1294
1315
|
*/
|
|
1295
1316
|
async watchDocuments(requestParameters, initOverrides) {
|
|
@@ -62,7 +62,7 @@ async function example() {
|
|
|
62
62
|
collectionName: collectionName_example,
|
|
63
63
|
// MongoAggregateRequest
|
|
64
64
|
mongoAggregateRequest: ...,
|
|
65
|
-
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.
|
|
65
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
66
66
|
withDeleted: true,
|
|
67
67
|
// number | Count elements per page (optional)
|
|
68
68
|
rowsPerPage: 100,
|
|
@@ -97,7 +97,7 @@ example().catch(console.error);
|
|
|
97
97
|
|------------- | ------------- | ------------- | -------------|
|
|
98
98
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
99
99
|
| **mongoAggregateRequest** | [MongoAggregateRequest](MongoAggregateRequest.md) | | |
|
|
100
|
-
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.
|
|
100
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
101
101
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
102
102
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
103
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] |
|
|
@@ -483,7 +483,7 @@ async function example() {
|
|
|
483
483
|
collectionName: collectionName_example,
|
|
484
484
|
// string | The field for your distinct Request.
|
|
485
485
|
field: field_example,
|
|
486
|
-
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.
|
|
486
|
+
// boolean | Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise. (optional)
|
|
487
487
|
withDeleted: true,
|
|
488
488
|
// number | Count elements per page (optional)
|
|
489
489
|
rowsPerPage: 100,
|
|
@@ -514,7 +514,7 @@ example().catch(console.error);
|
|
|
514
514
|
|------------- | ------------- | ------------- | -------------|
|
|
515
515
|
| **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
|
|
516
516
|
| **field** | `string` | The field for your distinct Request. | [Defaults to `undefined`] |
|
|
517
|
-
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.
|
|
517
|
+
| **withDeleted** | `boolean` | Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise. | [Optional] [Defaults to `false`] |
|
|
518
518
|
| **rowsPerPage** | `number` | Count elements per page | [Optional] [Defaults to `undefined`] |
|
|
519
519
|
| **page** | `number` | Requested page of the ResultSets | [Optional] [Defaults to `undefined`] |
|
|
520
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] |
|
|
@@ -550,7 +550,7 @@ example().catch(console.error);
|
|
|
550
550
|
|
|
551
551
|
Declaration of a Collection
|
|
552
552
|
|
|
553
|
-
What a client needs to know of a declared collection (2.
|
|
553
|
+
What a client needs to know of a declared collection (2.3.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
|
|
554
554
|
|
|
555
555
|
### Example
|
|
556
556
|
|
|
@@ -709,7 +709,7 @@ example().catch(console.error);
|
|
|
709
709
|
|
|
710
710
|
History of a Collection
|
|
711
711
|
|
|
712
|
-
The audit records of a collection declared with audit, newest first (2.
|
|
712
|
+
The audit records of a collection declared with audit, newest first (2.3.0); for the administrators of the collection. 404 for a collection without audit.
|
|
713
713
|
|
|
714
714
|
### Example
|
|
715
715
|
|
|
@@ -11,6 +11,8 @@ Name | Type
|
|
|
11
11
|
`validation` | string
|
|
12
12
|
`systemFields` | Array<string>
|
|
13
13
|
`protectedFields` | Array<string>
|
|
14
|
+
`indexes` | [Array<CollectionDeclarationIndexesInner>](CollectionDeclarationIndexesInner.md)
|
|
15
|
+
`refs` | [Array<CollectionDeclarationRefsInner>](CollectionDeclarationRefsInner.md)
|
|
14
16
|
`timestamps` | [CollectionDeclarationTimestamps](CollectionDeclarationTimestamps.md)
|
|
15
17
|
`owner` | [CollectionDeclarationOwner](CollectionDeclarationOwner.md)
|
|
16
18
|
`softDelete` | [CollectionDeclarationSoftDelete](CollectionDeclarationSoftDelete.md)
|
|
@@ -29,6 +31,8 @@ const example = {
|
|
|
29
31
|
"validation": null,
|
|
30
32
|
"systemFields": null,
|
|
31
33
|
"protectedFields": null,
|
|
34
|
+
"indexes": null,
|
|
35
|
+
"refs": null,
|
|
32
36
|
"timestamps": null,
|
|
33
37
|
"owner": null,
|
|
34
38
|
"softDelete": null,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationIndexesInner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`name` | string
|
|
10
|
+
`key` | { [key: string]: any; }
|
|
11
|
+
`unique` | boolean
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { CollectionDeclarationIndexesInner } from ''
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"name": null,
|
|
21
|
+
"key": null,
|
|
22
|
+
"unique": null,
|
|
23
|
+
} satisfies CollectionDeclarationIndexesInner
|
|
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 CollectionDeclarationIndexesInner
|
|
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,38 @@
|
|
|
1
|
+
|
|
2
|
+
# CollectionDeclarationRefsInner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`field` | string
|
|
10
|
+
`collection` | string
|
|
11
|
+
`many` | boolean
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { CollectionDeclarationRefsInner } from ''
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"field": null,
|
|
21
|
+
"collection": null,
|
|
22
|
+
"many": null,
|
|
23
|
+
} satisfies CollectionDeclarationRefsInner
|
|
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 CollectionDeclarationRefsInner
|
|
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
|
+
|