@sfxcode/nuxt-mongocamp-server 2.1.0 → 2.2.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 +20 -19
- package/dist/module.d.mts +6 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +15 -3
- package/dist/runtime/api/.openapi-generator/FILES +6 -2
- package/dist/runtime/api/apis/CollectionApi.d.ts +13 -0
- package/dist/runtime/api/apis/CollectionApi.js +8 -0
- package/dist/runtime/api/apis/DocumentApi.d.ts +91 -8
- package/dist/runtime/api/apis/DocumentApi.js +156 -5
- package/dist/runtime/api/docs/CollectionApi.md +4 -1
- package/dist/runtime/api/docs/CountRequest.md +34 -0
- package/dist/runtime/api/docs/DocumentApi.md +188 -7
- 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/{UpdateRequest.md → UpdateManyRequest.md} +4 -4
- package/dist/runtime/api/models/CountRequest.d.ts +30 -0
- package/dist/runtime/api/models/CountRequest.js +25 -0
- 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/UpdateManyRequest.d.ts +38 -0
- package/dist/runtime/api/models/{UpdateRequest.js → UpdateManyRequest.js} +7 -7
- package/dist/runtime/api/models/index.d.ts +3 -1
- package/dist/runtime/api/models/index.js +3 -1
- 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 +12 -1
- package/package.json +2 -2
- package/dist/runtime/api/models/UpdateRequest.d.ts +0 -38
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Nuxt module wrapping a generated OpenAPI client for [MongoCamp](https://mongocam
|
|
|
8
8
|
|
|
9
9
|
The module works in two modes:
|
|
10
10
|
|
|
11
|
-
- **Embedded server** (`server.enabled`): the MongoCamp API runs inside the Nitro of your application (`@sfxcode/mongocamp-server-core
|
|
11
|
+
- **Embedded server** (`server.enabled`): the MongoCamp API runs inside the Nitro of your application (`@sfxcode/mongocamp-server-core`). No second application is needed.
|
|
12
12
|
- **External server**: the module is a client for a running server at `url`.
|
|
13
13
|
|
|
14
14
|
The module runs on **Nitro 3 / h3 2**. Nuxt 4.7 builds with Nitro 3 (`@nuxt/nitro-v3-server`) when the application declares `nitro`:
|
|
@@ -17,7 +17,7 @@ The module runs on **Nitro 3 / h3 2**. Nuxt 4.7 builds with Nitro 3 (`@nuxt/nitr
|
|
|
17
17
|
pnpm add @sfxcode/nuxt-mongocamp-server nitro
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
In external mode, this module is a client for
|
|
20
|
+
In external mode, this module is a client for a MongoCamp server: the [standalone server](#standalone-server) of this repository or another application that embeds it. It provides authentication, user/role management, and collection, document, index and file APIs. The OpenAPI client in this module is generated from the server's OpenAPI spec (`openapi/docs.yaml`), so module and server should have the same version.
|
|
21
21
|
|
|
22
22
|
## Nuxt UI MongoCamp
|
|
23
23
|
|
|
@@ -36,13 +36,14 @@ export default defineNuxtConfig({
|
|
|
36
36
|
enabled: true,
|
|
37
37
|
// prefix: '/api/mongocamp-server', the url of the clients defaults to it
|
|
38
38
|
config: { CONNECTION_DATABASE: 'mongocamp' },
|
|
39
|
+
// requestLogging: true, metrics: true,
|
|
39
40
|
},
|
|
40
41
|
refreshToken: true,
|
|
41
42
|
},
|
|
42
43
|
})
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
The connection and every other setting
|
|
46
|
+
The connection and every other setting are environment variables (all of them in the [configuration reference](https://mongocamp.github.io/nuxt-mongocamp-server/server/configuration)):
|
|
46
47
|
|
|
47
48
|
| Env | Default | Description |
|
|
48
49
|
| --- | --- | --- |
|
|
@@ -52,33 +53,29 @@ The connection and every other setting use the env variables of the Scala server
|
|
|
52
53
|
| `AUTH_HANDLER` | `mongo` | users and roles in `mc_users` / `mc_roles` (`static`: `AUTH_USERS`, `AUTH_ROLES`) |
|
|
53
54
|
| `AUTH_SECRET` | random, stored | secret of the tokens (stored in `mc_configuration`, shared by all instances) |
|
|
54
55
|
| `AUTH_EXPIRING_DURATION` | `6h` | lifetime of a token |
|
|
55
|
-
| `REQUESTLOGGING_ENABLED`, `METRICS_ENABLED` | `false` | request log and metrics (the former plugins) |
|
|
56
56
|
| `JOBS_ENABLED` | `true` | `false`: this instance does not run the jobs on their schedule (several instances) |
|
|
57
57
|
|
|
58
|
-
At the first start the user `admin` is created with a random password that is printed to the log
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
At the first start the user `admin` is created with a random password that is printed to the log.
|
|
59
|
+
|
|
60
|
+
Extensions are Nitro 3 plugins: every event of the server is a Nitro hook `mongocamp:<event>`, and `mongocamp:ready` hands over the
|
|
61
|
+
started server (features, job handlers, direct access). In server routes `useMongocampCore()` gives the same server.
|
|
61
62
|
|
|
62
63
|
```ts
|
|
63
64
|
// server/plugins/audit.ts
|
|
64
65
|
import { definePlugin } from 'nitro'
|
|
65
66
|
|
|
66
|
-
export default definePlugin(
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
export default definePlugin((nitroApp) => {
|
|
68
|
+
nitroApp.hooks.hook('mongocamp:ready', server => server.registerJobHandler('my.app.ReportJob', sendReport))
|
|
69
|
+
nitroApp.hooks.hook('mongocamp:document:delete', event => console.info(event.user.userId, event.collectionName, event.oldValues))
|
|
69
70
|
})
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
**
|
|
73
|
-
|
|
74
|
-
**Migration from the Scala server** (details and all differences: [`docs/migration/from-scala.md`](docs/migration/from-scala.md)): point the embedded server at the same database (the same `CONNECTION_*` and `AUTH_PREFIX`); users,
|
|
75
|
-
roles, tokens, the token secret and the stored configurations keep working. Jobs are read from `mc_jobs` with cron expressions in the
|
|
76
|
-
syntax of [croner](https://croner.56k.guru) (`*/5` instead of `0/5`); the Quartz tables `mc_jobs_*` are not read.
|
|
73
|
+
**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)).
|
|
77
74
|
|
|
78
75
|
### Standalone server
|
|
79
76
|
|
|
80
77
|
`apps/server` is the same server without Nuxt (Nitro 3), configured only by env and listening on `SERVER_INTERFACE:SERVER_PORT`
|
|
81
|
-
(default `0.0.0.0:8080`)
|
|
78
|
+
(default `0.0.0.0:8080`):
|
|
82
79
|
|
|
83
80
|
```bash
|
|
84
81
|
docker build -f apps/server/Dockerfile -t mongocamp-nitro-server .
|
|
@@ -87,6 +84,8 @@ docker run -p 8080:8080 -e CONNECTION_HOST=host.docker.internal mongocamp-nitro-
|
|
|
87
84
|
|
|
88
85
|
Every request is one JSON line on stdout ([evlog](https://www.evlog.dev) wide events with the fields of the server under `mongocamp`); a Nuxt application that uses `evlog/nuxt` gets the same fields for the embedded API.
|
|
89
86
|
|
|
87
|
+
`REQUESTLOGGING_ENABLED` and `METRICS_ENABLED` switch request logging and metrics on (a Nitro plugin of the app, `apps/server/plugins/features.ts`).
|
|
88
|
+
|
|
90
89
|
The image (distroless Node 24, about 214 MB, the server itself 3 MB) stops cleanly on `docker stop` (SIGTERM) and on `DELETE /system`.
|
|
91
90
|
|
|
92
91
|
The spec is served at `/docs/docs.yaml` (`DOCS_OPENAPI`, default on) and an API reference UI at `/docs` (`DOCS_SWAGGER`).
|
|
@@ -116,6 +115,8 @@ export default defineNuxtConfig({
|
|
|
116
115
|
| `server.connectionUri` | `string` | — | MongoDB connection string; better by env `NUXT_MONGOCAMP_SERVER_CONNECTION_URI`. |
|
|
117
116
|
| `server.config` | `object` | `{}` | Settings by key (`CONNECTION_DATABASE`, ...); the env variables win. |
|
|
118
117
|
| `server.jobs` | `boolean` | `true` | Runs the jobs (token cleanup, ...) on their schedule in this instance. |
|
|
118
|
+
| `server.requestLogging` | `boolean` | `false` | Writes every request as a document of `mc_request_logging`. |
|
|
119
|
+
| `server.metrics` | `boolean` | `false` | Serves `/system/monitoring/*` (also Prometheus text) and writes the metric snapshots. |
|
|
119
120
|
| `apiKey` | `string` | — | Optional. Stored server-side only; picked up automatically by `useMongocampApi(event)`. |
|
|
120
121
|
| `paginationSize` | `number` | `500` | Default rows per page for search/list composables. Values below 10 fall back to the default. |
|
|
121
122
|
| `refreshToken` | `boolean` | `false` | Whether the client auto-refreshes the session token on an interval after login. |
|
|
@@ -133,7 +134,7 @@ A missing `url` throws during `nuxi dev`/`nuxi build`/`nuxi generate` (not durin
|
|
|
133
134
|
| `useMongocampStorage()` | The session cookie (`{ token, profile }`) backing auth state; SSR-safe. |
|
|
134
135
|
| `useMongocampUser()` | Reactive current user profile, derived from `useMongocampStorage()` (read-only). |
|
|
135
136
|
| `useMongocampUrl()` | The configured base URL. |
|
|
136
|
-
| `useMongocampSearch()` | `find`/`findAll`/`findByField` document search helpers. `find(..., filterCaseInsensitive)` makes wildcards of the filter ignore the case (case-sensitive by default
|
|
137
|
+
| `useMongocampSearch()` | `find`/`findAll`/`findByField` document search helpers. `find(..., filterCaseInsensitive)` makes wildcards of the filter ignore the case (case-sensitive by default). |
|
|
137
138
|
| `usePaginatedFind(collection, opts)`| Reactive pagination wrapper (`page`, `documents`, `pending`, `error`, `nextPage`/`previousPage`/`goToPage`); `opts.filterCaseInsensitive` as for `find`. |
|
|
138
139
|
| `useMongocampApiCollection(name)` | Per-collection insert/update/delete/aggregate/schema helpers. |
|
|
139
140
|
| `useMongocampApiCollections()` | List collections/databases, database info. |
|
|
@@ -143,7 +144,7 @@ A missing `url` throws during `nuxi dev`/`nuxi build`/`nuxi generate` (not durin
|
|
|
143
144
|
|
|
144
145
|
### Documents as Extended JSON
|
|
145
146
|
|
|
146
|
-
|
|
147
|
+
The server returns documents as relaxed MongoDB Extended JSON: `{"_id": {"$oid": "…"}, "when": {"$date": "…"}}`. Send `extendedJson: 'plain'` for plain JSON (ids and dates as strings). Auto-imported helpers:
|
|
147
148
|
|
|
148
149
|
| Helper | Purpose |
|
|
149
150
|
| ---------------------------| --------------------------------------------------------------------------------------------------------|
|
|
@@ -156,7 +157,7 @@ Since 2.0.0 the server returns documents as relaxed MongoDB Extended JSON: `{"_i
|
|
|
156
157
|
| Composable | Purpose |
|
|
157
158
|
| -----------------------------------------------| -----------------------------------------------------------------------------------|
|
|
158
159
|
| `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. |
|
|
159
|
-
| `useMongocampCore()` | The embedded server (`server.enabled` only)
|
|
160
|
+
| `useMongocampCore()` | The embedded server (`server.enabled` only) in server routes; plugins get it on the hook `mongocamp:ready`. |
|
|
160
161
|
| `useMongocampServerApi(url, key?, token?)` | Lower-level factory when you need to authenticate against a different URL/credential explicitly. |
|
|
161
162
|
|
|
162
163
|
```ts
|
package/dist/module.d.mts
CHANGED
|
@@ -13,6 +13,10 @@ interface ServerOptions {
|
|
|
13
13
|
config?: Record<string, unknown>;
|
|
14
14
|
/** Runs the jobs (token cleanup, ...) on their schedule in this instance (default true). */
|
|
15
15
|
jobs?: boolean;
|
|
16
|
+
/** Writes every request as a document of `<AUTH_PREFIX>request_logging` (default false). */
|
|
17
|
+
requestLogging?: boolean;
|
|
18
|
+
/** Serves `/system/monitoring/*` and writes the metric snapshots of `LOGGING_METRICS_MONGODB_*` (default false). */
|
|
19
|
+
metrics?: boolean;
|
|
16
20
|
}
|
|
17
21
|
interface ResolvedServerOptions {
|
|
18
22
|
enabled: boolean;
|
|
@@ -20,6 +24,8 @@ interface ResolvedServerOptions {
|
|
|
20
24
|
connectionUri: string;
|
|
21
25
|
config: Record<string, unknown>;
|
|
22
26
|
jobs: boolean;
|
|
27
|
+
requestLogging: boolean;
|
|
28
|
+
metrics: boolean;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
interface ModuleOptions {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addImportsDir, addImports, addServerImportsDir, addServerHandler, addServerPlugin, addServerImports } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addImportsDir, addImports, addServerImportsDir, addServerHandler, addServerPlugin, addServerImports, addTypeTemplate } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { consola } from 'consola';
|
|
4
4
|
export * from '../dist/runtime/api/index.js';
|
|
5
5
|
|
|
6
6
|
const name = "@sfxcode/nuxt-mongocamp-server";
|
|
7
|
-
const version = "2.
|
|
7
|
+
const version = "2.2.0";
|
|
8
8
|
|
|
9
9
|
const DefaultServerPrefix = "/api/mongocamp-server";
|
|
10
10
|
function normalizePrefix(prefix) {
|
|
@@ -21,7 +21,9 @@ function resolveServerOptions(options) {
|
|
|
21
21
|
prefix: normalizePrefix(options?.prefix),
|
|
22
22
|
connectionUri: options?.connectionUri ?? "",
|
|
23
23
|
config: options?.config ?? {},
|
|
24
|
-
jobs: options?.jobs ?? true
|
|
24
|
+
jobs: options?.jobs ?? true,
|
|
25
|
+
requestLogging: options?.requestLogging ?? false,
|
|
26
|
+
metrics: options?.metrics ?? false
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
function resolveClientUrl(url, server) {
|
|
@@ -87,6 +89,16 @@ const module$1 = defineNuxtModule({
|
|
|
87
89
|
addServerHandler({ route: `${server.prefix}/**`, handler: resolve(runtimeDir, "server/mongocamp/handler") });
|
|
88
90
|
addServerPlugin(resolve(runtimeDir, "server/mongocamp/plugin"));
|
|
89
91
|
addServerImports([{ name: "useMongocampCore", from: resolve(runtimeDir, "server/mongocamp/core") }]);
|
|
92
|
+
addTypeTemplate({
|
|
93
|
+
filename: "types/mongocamp-hooks.d.ts",
|
|
94
|
+
getContents: () => [
|
|
95
|
+
"import type { MongocampHooks } from '@sfxcode/mongocamp-server-core'",
|
|
96
|
+
"declare module 'nitro/types' {",
|
|
97
|
+
" interface NitroRuntimeHooks extends MongocampHooks {}",
|
|
98
|
+
"}",
|
|
99
|
+
"export {}"
|
|
100
|
+
].join("\n")
|
|
101
|
+
}, { nitro: true, nuxt: true });
|
|
90
102
|
consola.info(`[mongocamp] embedded server at ${server.prefix}`);
|
|
91
103
|
}
|
|
92
104
|
consola.success("mongocamp-nuxt available");
|
|
@@ -28,6 +28,7 @@ docs/CollectionSummary.md
|
|
|
28
28
|
docs/ConnectionStats.md
|
|
29
29
|
docs/CopyRequest.md
|
|
30
30
|
docs/CopyResponse.md
|
|
31
|
+
docs/CountRequest.md
|
|
31
32
|
docs/CountResponse.md
|
|
32
33
|
docs/CreateCollectionResponse.md
|
|
33
34
|
docs/DatabaseApi.md
|
|
@@ -35,6 +36,7 @@ docs/DatabaseInfo.md
|
|
|
35
36
|
docs/DeleteResponse.md
|
|
36
37
|
docs/DocumentApi.md
|
|
37
38
|
docs/ErrorDescription.md
|
|
39
|
+
docs/ExportRequest.md
|
|
38
40
|
docs/FieldInfo.md
|
|
39
41
|
docs/FieldTypeCount.md
|
|
40
42
|
docs/FileApi.md
|
|
@@ -81,7 +83,7 @@ docs/SystemApi.md
|
|
|
81
83
|
docs/SystemInfo.md
|
|
82
84
|
docs/SystemStats.md
|
|
83
85
|
docs/UpdateFileInformationRequest.md
|
|
84
|
-
docs/
|
|
86
|
+
docs/UpdateManyRequest.md
|
|
85
87
|
docs/UpdateResponse.md
|
|
86
88
|
docs/UpdateRoleRequest.md
|
|
87
89
|
docs/UserInformation.md
|
|
@@ -101,11 +103,13 @@ models/CollectionSummary.ts
|
|
|
101
103
|
models/ConnectionStats.ts
|
|
102
104
|
models/CopyRequest.ts
|
|
103
105
|
models/CopyResponse.ts
|
|
106
|
+
models/CountRequest.ts
|
|
104
107
|
models/CountResponse.ts
|
|
105
108
|
models/CreateCollectionResponse.ts
|
|
106
109
|
models/DatabaseInfo.ts
|
|
107
110
|
models/DeleteResponse.ts
|
|
108
111
|
models/ErrorDescription.ts
|
|
112
|
+
models/ExportRequest.ts
|
|
109
113
|
models/FieldInfo.ts
|
|
110
114
|
models/FieldTypeCount.ts
|
|
111
115
|
models/FileInformation.ts
|
|
@@ -148,7 +152,7 @@ models/SettingsResponse.ts
|
|
|
148
152
|
models/SystemInfo.ts
|
|
149
153
|
models/SystemStats.ts
|
|
150
154
|
models/UpdateFileInformationRequest.ts
|
|
151
|
-
models/
|
|
155
|
+
models/UpdateManyRequest.ts
|
|
152
156
|
models/UpdateResponse.ts
|
|
153
157
|
models/UpdateRoleRequest.ts
|
|
154
158
|
models/UserInformation.ts
|
|
@@ -114,6 +114,10 @@ export interface DistinctRequest {
|
|
|
114
114
|
* How the result is counted: exact (default) or none (no count headers, no count query)
|
|
115
115
|
*/
|
|
116
116
|
count?: DistinctCountEnum;
|
|
117
|
+
/**
|
|
118
|
+
* 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)
|
|
119
|
+
*/
|
|
120
|
+
extendedJson?: DistinctExtendedJsonEnum;
|
|
117
121
|
}
|
|
118
122
|
export interface GetCollectionFieldsRequest {
|
|
119
123
|
/**
|
|
@@ -491,3 +495,12 @@ export declare const DistinctCountEnum: {
|
|
|
491
495
|
readonly None: "none";
|
|
492
496
|
};
|
|
493
497
|
export type DistinctCountEnum = typeof DistinctCountEnum[keyof typeof DistinctCountEnum];
|
|
498
|
+
/**
|
|
499
|
+
* @export
|
|
500
|
+
*/
|
|
501
|
+
export declare const DistinctExtendedJsonEnum: {
|
|
502
|
+
readonly Relaxed: "relaxed";
|
|
503
|
+
readonly Canonical: "canonical";
|
|
504
|
+
readonly Plain: "plain";
|
|
505
|
+
};
|
|
506
|
+
export type DistinctExtendedJsonEnum = typeof DistinctExtendedJsonEnum[keyof typeof DistinctExtendedJsonEnum];
|
|
@@ -360,6 +360,9 @@ export class CollectionApi extends runtime.BaseAPI {
|
|
|
360
360
|
if (requestParameters["count"] != null) {
|
|
361
361
|
queryParameters["count"] = requestParameters["count"];
|
|
362
362
|
}
|
|
363
|
+
if (requestParameters["extendedJson"] != null) {
|
|
364
|
+
queryParameters["extendedJson"] = requestParameters["extendedJson"];
|
|
365
|
+
}
|
|
363
366
|
const headerParameters = {};
|
|
364
367
|
if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
|
|
365
368
|
headerParameters["Authorization"] = "Basic " + btoa((this.configuration.username || "") + ":" + (this.configuration.password || ""));
|
|
@@ -1008,3 +1011,8 @@ export const DistinctCountEnum = {
|
|
|
1008
1011
|
Exact: "exact",
|
|
1009
1012
|
None: "none"
|
|
1010
1013
|
};
|
|
1014
|
+
export const DistinctExtendedJsonEnum = {
|
|
1015
|
+
Relaxed: "relaxed",
|
|
1016
|
+
Canonical: "canonical",
|
|
1017
|
+
Plain: "plain"
|
|
1018
|
+
};
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime.js';
|
|
13
|
+
import { type CountRequest } from '../models/CountRequest.js';
|
|
13
14
|
import { type CountResponse } from '../models/CountResponse.js';
|
|
14
15
|
import { type DeleteResponse } from '../models/DeleteResponse.js';
|
|
16
|
+
import { type ExportRequest } from '../models/ExportRequest.js';
|
|
15
17
|
import { type ImportResponse } from '../models/ImportResponse.js';
|
|
16
18
|
import { type InsertResponse } from '../models/InsertResponse.js';
|
|
17
19
|
import { type MongoFindRequest } from '../models/MongoFindRequest.js';
|
|
18
20
|
import { type SearchRequest } from '../models/SearchRequest.js';
|
|
19
|
-
import { type
|
|
21
|
+
import { type UpdateManyRequest } from '../models/UpdateManyRequest.js';
|
|
20
22
|
import { type UpdateResponse } from '../models/UpdateResponse.js';
|
|
21
23
|
export interface DeleteRequest {
|
|
22
24
|
/**
|
|
@@ -42,6 +44,20 @@ export interface CountDocumentsRequest {
|
|
|
42
44
|
*/
|
|
43
45
|
filterCaseInsensitive?: boolean;
|
|
44
46
|
}
|
|
47
|
+
export interface CountDocumentsByBodyRequest {
|
|
48
|
+
/**
|
|
49
|
+
* The name of your MongoDb Collection
|
|
50
|
+
*/
|
|
51
|
+
collectionName: string;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
countRequest: CountRequest;
|
|
56
|
+
/**
|
|
57
|
+
* true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc*
|
|
58
|
+
*/
|
|
59
|
+
filterCaseInsensitive?: boolean;
|
|
60
|
+
}
|
|
45
61
|
export interface DeleteManyRequest {
|
|
46
62
|
/**
|
|
47
63
|
* The name of your MongoDb Collection
|
|
@@ -99,6 +115,36 @@ export interface ExportDocumentsRequest {
|
|
|
99
115
|
* true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc*
|
|
100
116
|
*/
|
|
101
117
|
filterCaseInsensitive?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* true (2.1.0): the export ends with a marker, so a cut-off stream can be told from a complete one. ndjson: a last line {"$end":true,"count":n}, or {"$error":"..."} when the stream fails; json: the array is followed by nothing on success and the stream ends without "]" on failure (the marker is the closing bracket); csv: a last line "# end n" or "# error ...". Default false
|
|
120
|
+
*/
|
|
121
|
+
trailer?: boolean;
|
|
122
|
+
}
|
|
123
|
+
export interface ExportDocumentsByBodyRequest {
|
|
124
|
+
/**
|
|
125
|
+
* The name of your MongoDb Collection
|
|
126
|
+
*/
|
|
127
|
+
collectionName: string;
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
*/
|
|
131
|
+
exportRequest: ExportRequest;
|
|
132
|
+
/**
|
|
133
|
+
* ndjson (one JSON document per line), json (one array) or csv
|
|
134
|
+
*/
|
|
135
|
+
format?: string;
|
|
136
|
+
/**
|
|
137
|
+
* relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({"$oid": ...}, {"$date": ...}, {"$numberDecimal": ...}; canonical also {"$numberInt": ...}, {"$numberLong": ...} and {"$numberDouble": ...}); a text that looks like a date is {"$string": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types). The default of a csv export is plain.
|
|
138
|
+
*/
|
|
139
|
+
extendedJson?: ExportDocumentsByBodyExtendedJsonEnum;
|
|
140
|
+
/**
|
|
141
|
+
* true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc*
|
|
142
|
+
*/
|
|
143
|
+
filterCaseInsensitive?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* true (2.1.0): the export ends with a marker, so a cut-off stream can be told from a complete one. ndjson: a last line {"$end":true,"count":n}, or {"$error":"..."} when the stream fails; json: the array is followed by nothing on success and the stream ends without "]" on failure (the marker is the closing bracket); csv: a last line "# end n" or "# error ...". Default false
|
|
146
|
+
*/
|
|
147
|
+
trailer?: boolean;
|
|
102
148
|
}
|
|
103
149
|
export interface FindRequest {
|
|
104
150
|
/**
|
|
@@ -290,7 +336,7 @@ export interface UpdateDocumentPartialRequest {
|
|
|
290
336
|
[key: string]: any | null;
|
|
291
337
|
};
|
|
292
338
|
}
|
|
293
|
-
export interface
|
|
339
|
+
export interface UpdateManyOperationRequest {
|
|
294
340
|
/**
|
|
295
341
|
* The name of your MongoDb Collection
|
|
296
342
|
*/
|
|
@@ -298,7 +344,7 @@ export interface UpdateManyRequest {
|
|
|
298
344
|
/**
|
|
299
345
|
*
|
|
300
346
|
*/
|
|
301
|
-
updateRequest:
|
|
347
|
+
updateRequest: UpdateManyRequest;
|
|
302
348
|
/**
|
|
303
349
|
* Allow an empty filter, that matches all documents of the collection
|
|
304
350
|
*/
|
|
@@ -344,6 +390,20 @@ export declare class DocumentApi extends runtime.BaseAPI {
|
|
|
344
390
|
* Count Documents in Collection
|
|
345
391
|
*/
|
|
346
392
|
countDocuments(requestParameters: CountDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CountResponse>;
|
|
393
|
+
/**
|
|
394
|
+
* Creates request options for countDocumentsByBody without sending the request
|
|
395
|
+
*/
|
|
396
|
+
countDocumentsByBodyRequestOpts(requestParameters: CountDocumentsByBodyRequest): Promise<runtime.RequestOpts>;
|
|
397
|
+
/**
|
|
398
|
+
* Count the Documents of the given Collection that match the filter without loading them
|
|
399
|
+
* Count Documents in Collection (filter in the body)
|
|
400
|
+
*/
|
|
401
|
+
countDocumentsByBodyRaw(requestParameters: CountDocumentsByBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CountResponse>>;
|
|
402
|
+
/**
|
|
403
|
+
* Count the Documents of the given Collection that match the filter without loading them
|
|
404
|
+
* Count Documents in Collection (filter in the body)
|
|
405
|
+
*/
|
|
406
|
+
countDocumentsByBody(requestParameters: CountDocumentsByBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CountResponse>;
|
|
347
407
|
/**
|
|
348
408
|
* Creates request options for deleteMany without sending the request
|
|
349
409
|
*/
|
|
@@ -363,15 +423,29 @@ export declare class DocumentApi extends runtime.BaseAPI {
|
|
|
363
423
|
*/
|
|
364
424
|
exportDocumentsRequestOpts(requestParameters: ExportDocumentsRequest): Promise<runtime.RequestOpts>;
|
|
365
425
|
/**
|
|
366
|
-
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then.
|
|
426
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
367
427
|
* Export Documents of a Collection
|
|
368
428
|
*/
|
|
369
429
|
exportDocumentsRaw(requestParameters: ExportDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
|
|
370
430
|
/**
|
|
371
|
-
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then.
|
|
431
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
372
432
|
* Export Documents of a Collection
|
|
373
433
|
*/
|
|
374
434
|
exportDocuments(requestParameters: ExportDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
|
|
435
|
+
/**
|
|
436
|
+
* Creates request options for exportDocumentsByBody without sending the request
|
|
437
|
+
*/
|
|
438
|
+
exportDocumentsByBodyRequestOpts(requestParameters: ExportDocumentsByBodyRequest): Promise<runtime.RequestOpts>;
|
|
439
|
+
/**
|
|
440
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
441
|
+
* Export Documents of a Collection (filter in the body)
|
|
442
|
+
*/
|
|
443
|
+
exportDocumentsByBodyRaw(requestParameters: ExportDocumentsByBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
|
|
444
|
+
/**
|
|
445
|
+
* Download the documents of a Collection as a stream: ndjson (one JSON document per line), json (one array) or csv (a header line, nested values as JSON, a text with a comma, a quote or a line break in quotes). The documents are written while the database delivers them, the memory of the server does not depend on the size of the Collection. The columns of a csv export are the fields of `projection`, by default the fields of the first 1000 documents. With extendedJson the types of the values are explicit. A failure while the stream is running ends the stream, the status is 200 by then; send trailer=true for an end marker. POST takes the filter in the body (no URL limit).
|
|
446
|
+
* Export Documents of a Collection (filter in the body)
|
|
447
|
+
*/
|
|
448
|
+
exportDocumentsByBody(requestParameters: ExportDocumentsByBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
|
|
375
449
|
/**
|
|
376
450
|
* Creates request options for find without sending the request
|
|
377
451
|
*/
|
|
@@ -517,17 +591,17 @@ export declare class DocumentApi extends runtime.BaseAPI {
|
|
|
517
591
|
/**
|
|
518
592
|
* Creates request options for updateMany without sending the request
|
|
519
593
|
*/
|
|
520
|
-
updateManyRequestOpts(requestParameters:
|
|
594
|
+
updateManyRequestOpts(requestParameters: UpdateManyOperationRequest): Promise<runtime.RequestOpts>;
|
|
521
595
|
/**
|
|
522
596
|
* Update many Documents in given Collection
|
|
523
597
|
* Update many in Collection
|
|
524
598
|
*/
|
|
525
|
-
updateManyRaw(requestParameters:
|
|
599
|
+
updateManyRaw(requestParameters: UpdateManyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UpdateResponse>>;
|
|
526
600
|
/**
|
|
527
601
|
* Update many Documents in given Collection
|
|
528
602
|
* Update many in Collection
|
|
529
603
|
*/
|
|
530
|
-
updateMany(requestParameters:
|
|
604
|
+
updateMany(requestParameters: UpdateManyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UpdateResponse>;
|
|
531
605
|
}
|
|
532
606
|
/**
|
|
533
607
|
* @export
|
|
@@ -538,6 +612,15 @@ export declare const ExportDocumentsExtendedJsonEnum: {
|
|
|
538
612
|
readonly Plain: "plain";
|
|
539
613
|
};
|
|
540
614
|
export type ExportDocumentsExtendedJsonEnum = typeof ExportDocumentsExtendedJsonEnum[keyof typeof ExportDocumentsExtendedJsonEnum];
|
|
615
|
+
/**
|
|
616
|
+
* @export
|
|
617
|
+
*/
|
|
618
|
+
export declare const ExportDocumentsByBodyExtendedJsonEnum: {
|
|
619
|
+
readonly Relaxed: "relaxed";
|
|
620
|
+
readonly Canonical: "canonical";
|
|
621
|
+
readonly Plain: "plain";
|
|
622
|
+
};
|
|
623
|
+
export type ExportDocumentsByBodyExtendedJsonEnum = typeof ExportDocumentsByBodyExtendedJsonEnum[keyof typeof ExportDocumentsByBodyExtendedJsonEnum];
|
|
541
624
|
/**
|
|
542
625
|
* @export
|
|
543
626
|
*/
|