@sfxcode/nuxt-mongocamp-server 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +24 -2
  2. package/dist/module.d.mts +10 -4
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +41 -21
  5. package/dist/runtime/api/.openapi-generator/FILES +4 -0
  6. package/dist/runtime/api/apis/CollectionApi.d.ts +6 -6
  7. package/dist/runtime/api/apis/CollectionApi.js +4 -4
  8. package/dist/runtime/api/apis/DocumentApi.d.ts +42 -14
  9. package/dist/runtime/api/apis/DocumentApi.js +27 -6
  10. package/dist/runtime/api/docs/CollectionApi.md +6 -6
  11. package/dist/runtime/api/docs/CollectionDeclaration.md +4 -0
  12. package/dist/runtime/api/docs/CollectionDeclarationIndexesInner.md +38 -0
  13. package/dist/runtime/api/docs/CollectionDeclarationRefsInner.md +38 -0
  14. package/dist/runtime/api/docs/DocumentApi.md +47 -26
  15. package/dist/runtime/api/docs/ExportRequest.md +2 -0
  16. package/dist/runtime/api/docs/MongoFindRequest.md +2 -0
  17. package/dist/runtime/api/docs/SearchRequest.md +2 -0
  18. package/dist/runtime/api/models/CollectionDeclaration.d.ts +10 -0
  19. package/dist/runtime/api/models/CollectionDeclaration.js +14 -0
  20. package/dist/runtime/api/models/CollectionDeclarationIndexesInner.d.ts +40 -0
  21. package/dist/runtime/api/models/CollectionDeclarationIndexesInner.js +32 -0
  22. package/dist/runtime/api/models/CollectionDeclarationRefsInner.d.ts +38 -0
  23. package/dist/runtime/api/models/CollectionDeclarationRefsInner.js +31 -0
  24. package/dist/runtime/api/models/ErrorDescription.d.ts +1 -1
  25. package/dist/runtime/api/models/ExportRequest.d.ts +4 -0
  26. package/dist/runtime/api/models/ExportRequest.js +4 -2
  27. package/dist/runtime/api/models/MongoFindRequest.d.ts +4 -0
  28. package/dist/runtime/api/models/MongoFindRequest.js +4 -2
  29. package/dist/runtime/api/models/SearchRequest.d.ts +4 -0
  30. package/dist/runtime/api/models/SearchRequest.js +4 -2
  31. package/dist/runtime/api/models/index.d.ts +2 -0
  32. package/dist/runtime/api/models/index.js +2 -0
  33. package/dist/runtime/composables/mongocampApi.d.ts +4 -0
  34. package/dist/runtime/composables/mongocampApi.js +10 -2
  35. package/dist/runtime/composables/mongocampAuth.js +29 -25
  36. package/dist/runtime/composables/mongocampCollection.d.ts +50 -11
  37. package/dist/runtime/composables/mongocampCollection.js +85 -21
  38. package/dist/runtime/composables/mongocampLive.d.ts +5 -2
  39. package/dist/runtime/composables/mongocampLive.js +30 -5
  40. package/dist/runtime/composables/mongocampSearch.js +12 -3
  41. package/dist/runtime/plugins/bson-payload.d.ts +8 -0
  42. package/dist/runtime/plugins/bson-payload.js +6 -0
  43. package/dist/runtime/server/composables/mongocampApi.d.ts +5 -1
  44. package/dist/runtime/server/composables/mongocampApi.js +1 -9
  45. package/dist/runtime/server/composables/mongocampServerApi.d.ts +4 -0
  46. package/dist/runtime/server/composables/mongocampServerApi.js +5 -0
  47. package/dist/runtime/server/composables/mongocampServerCollection.d.ts +20 -0
  48. package/dist/runtime/server/composables/mongocampServerCollection.js +12 -0
  49. package/dist/runtime/server/mongocamp/core.d.ts +1 -1
  50. package/dist/runtime/server/mongocamp/core.js +1 -1
  51. package/dist/runtime/server/mongocamp/embedded-api.d.ts +18 -0
  52. package/dist/runtime/server/mongocamp/embedded-api.js +10 -0
  53. package/dist/runtime/types/collections.d.ts +10 -0
  54. package/dist/runtime/utils/appState.d.ts +21 -0
  55. package/dist/runtime/utils/appState.js +11 -0
  56. package/dist/runtime/utils/bsonPayload.d.ts +8 -0
  57. package/dist/runtime/utils/bsonPayload.js +10 -0
  58. package/dist/runtime/utils/buildFieldFilterExpression.d.ts +4 -0
  59. package/dist/runtime/utils/buildFieldFilterExpression.js +5 -3
  60. package/dist/runtime/utils/sse.d.ts +1 -1
  61. package/dist/runtime/utils/sse.js +7 -1
  62. package/package.json +15 -7
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.4 a declaration also switches behaviours on, one flag each — what Mongoose users know from `{ timestamps: true }`, `__v` and
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.d.mts CHANGED
@@ -39,12 +39,17 @@ interface ResolvedServerOptions {
39
39
  }
40
40
 
41
41
  interface ModuleOptions {
42
- /** The url of the MongoCamp API; with `server.enabled` it defaults to the prefix of the embedded server. */
43
- url: string;
42
+ /** The url of the MongoCamp API; with `server.enabled` it defaults to the prefix of the embedded server (2.5.0: optional then). */
43
+ url?: string;
44
+ /** An api key for the server code (`useMongocampApi(event)`); private, never sent to the browser. Better set by env. */
44
45
  apiKey?: string;
46
+ /** Rows per page of the client composables (default 500, at least 10). */
45
47
  paginationSize?: number;
48
+ /** Refreshes the token of the session while the user is active (default false). */
46
49
  refreshToken?: boolean;
47
- tokenRefreshInterval: number;
50
+ /** Milliseconds between two token refreshes (default 5000, at least 5000). */
51
+ tokenRefreshInterval?: number;
52
+ /** Seconds the session cookie lives (default 30 days). */
48
53
  sessionMaxAge?: number;
49
54
  /** The MongoCamp server embedded in the Nitro of this application. */
50
55
  server?: ServerOptions;
@@ -61,7 +66,8 @@ declare module '@nuxt/schema' {
61
66
  }
62
67
  interface RuntimeConfig {
63
68
  mongocampApiKey: string;
64
- mongocampServer: ResolvedServerOptions & {
69
+ /** Only when the embedded server is enabled (2.5.0). */
70
+ mongocampServer?: ResolvedServerOptions & {
65
71
  version: {
66
72
  name: string;
67
73
  version: string;
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "configKey": "mongocamp",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.7.0"
package/dist/module.mjs CHANGED
@@ -1,11 +1,10 @@
1
1
  import { join, relative, basename, extname, isAbsolute, resolve } from 'node:path';
2
- import { defineNuxtModule, createResolver, addImportsDir, addImports, addServerImportsDir, addServerHandler, addServerPlugin, addServerImports, addTypeTemplate, addServerTemplate, updateTemplates, resolveFiles } from '@nuxt/kit';
2
+ import { defineNuxtModule, useLogger, createResolver, addImportsDir, addPlugin, addImports, addServerImports, addServerHandler, addServerPlugin, addTypeTemplate, addServerTemplate, updateTemplates, resolveFiles } from '@nuxt/kit';
3
3
  import { defu } from 'defu';
4
- import { consola } from 'consola';
5
4
  export * from '../dist/runtime/api/index.js';
6
5
 
7
6
  const name = "@sfxcode/nuxt-mongocamp-server";
8
- const version = "2.3.0";
7
+ const version = "2.5.0";
9
8
 
10
9
  const DefaultServerPrefix = "/api/mongocamp-server";
11
10
  const DefaultCollectionsDir = "mongocamp";
@@ -69,7 +68,7 @@ function collectionsServerTemplate(files, rootDir) {
69
68
  function collectionsTypeTemplate(files, typesDir) {
70
69
  const entries = (type) => files.map((file) => ` ${JSON.stringify(file.key)}: ${type}<typeof import(${JSON.stringify(importPath(typesDir, file.path))}).default>`);
71
70
  return [
72
- "import type { InferDocument, InferDocumentInput } from '@sfxcode/mongocamp-server-core'",
71
+ "import type { InferDocument, InferDocumentInput, InferRefs } from '@sfxcode/mongocamp-server-core'",
73
72
  "",
74
73
  "declare global {",
75
74
  " /** The documents of the declared collections (`server/mongocamp/<name>.ts`) as they are stored, by file name. */",
@@ -80,6 +79,10 @@ function collectionsTypeTemplate(files, typesDir) {
80
79
  " interface MongocampCollectionInputs {",
81
80
  ...entries("InferDocumentInput"),
82
81
  " }",
82
+ " /** The references of the declared collections (2.4.0): field \u2192 target collection, for `expand`. */",
83
+ " interface MongocampCollectionRefs {",
84
+ ...entries("InferRefs"),
85
+ " }",
83
86
  "}",
84
87
  "",
85
88
  "export {}",
@@ -103,7 +106,15 @@ const module$1 = defineNuxtModule({
103
106
  nuxt: ">=4.7.0"
104
107
  }
105
108
  },
109
+ defaults: {
110
+ paginationSize: 500,
111
+ refreshToken: false,
112
+ tokenRefreshInterval: 5e3,
113
+ sessionMaxAge: 60 * 60 * 24 * 30
114
+ // 30 days
115
+ },
106
116
  setup(options, nuxt) {
117
+ const logger = useLogger("mongocamp");
107
118
  if (nuxt.options._nitroMajor !== 3) {
108
119
  throw new Error('[mongocamp] the module needs Nitro 3: add "nitro" to the dependencies of the application (Nuxt then builds with @nuxt/nitro-v3-server)');
109
120
  }
@@ -115,24 +126,21 @@ const module$1 = defineNuxtModule({
115
126
  if (!options.url || options.url.length === 0)
116
127
  throw new Error('[mongocamp] Missing required "url" module option (or enable the embedded server with "server.enabled").');
117
128
  });
118
- if (options.paginationSize !== void 0 && options.paginationSize < 10)
119
- consola.warn(`[mongocamp] paginationSize of ${options.paginationSize} is below the minimum of 10, falling back to 500`);
120
- if (!options.paginationSize || options.paginationSize < 10)
129
+ if (!options.paginationSize || options.paginationSize < 10) {
130
+ logger.warn(`paginationSize of ${options.paginationSize} is below the minimum of 10, falling back to 500`);
121
131
  options.paginationSize = 500;
122
- if (options.tokenRefreshInterval !== void 0 && options.tokenRefreshInterval < 5e3)
123
- consola.warn(`[mongocamp] tokenRefreshInterval of ${options.tokenRefreshInterval} is below the minimum of 5000, falling back to 5000`);
124
- if (!options.tokenRefreshInterval || options.tokenRefreshInterval < 5e3)
132
+ }
133
+ if (!options.tokenRefreshInterval || options.tokenRefreshInterval < 5e3) {
134
+ logger.warn(`tokenRefreshInterval of ${options.tokenRefreshInterval} is below the minimum of 5000, falling back to 5000`);
125
135
  options.tokenRefreshInterval = 5e3;
126
- if (options.refreshToken === void 0) {
127
- consola.warn('[mongocamp] "refreshToken" module option is not set, falling back to false (no auto token refresh)');
128
- options.refreshToken = false;
129
136
  }
130
- if (!options.sessionMaxAge || options.sessionMaxAge <= 0)
137
+ if (!options.sessionMaxAge || options.sessionMaxAge <= 0) {
131
138
  options.sessionMaxAge = 60 * 60 * 24 * 30;
139
+ }
132
140
  nuxt.options.runtimeConfig.public.mongocamp = defu(
133
141
  nuxt.options.runtimeConfig.public.mongocamp,
134
142
  {
135
- url: options.url,
143
+ url: options.url ?? "",
136
144
  paginationSize: options.paginationSize,
137
145
  refreshToken: options.refreshToken,
138
146
  tokenRefreshInterval: options.tokenRefreshInterval,
@@ -143,13 +151,21 @@ const module$1 = defineNuxtModule({
143
151
  const { resolve: resolve$1 } = createResolver(import.meta.url);
144
152
  const runtimeDir = resolve$1("./runtime");
145
153
  addImportsDir(resolve$1(runtimeDir, "composables"));
154
+ addPlugin(resolve$1(runtimeDir, "plugins/bson-payload"));
146
155
  addImports(["fromExtendedJson", "toExtendedJson", "documentId"].map((name2) => ({ name: name2, from: resolve$1(runtimeDir, "utils/extendedJson") })));
147
- addServerImportsDir(resolve$1(runtimeDir, "server/composables"));
148
- nuxt.options.runtimeConfig.mongocampServer = defu(nuxt.options.runtimeConfig.mongocampServer, { ...server, version: { name: "mongocamp-nitro-server", version } });
156
+ addServerImports([
157
+ { name: "useMongocampServerApi", from: resolve$1(runtimeDir, "server/composables/mongocampServerApi") },
158
+ { name: "useMongocampApi", from: resolve$1(runtimeDir, server.enabled ? "server/mongocamp/embedded-api" : "server/composables/mongocampApi") }
159
+ ]);
149
160
  if (server.enabled) {
161
+ nuxt.options.runtimeConfig.mongocampServer = defu(nuxt.options.runtimeConfig.mongocampServer, { ...server, version: { name: "mongocamp-nitro-server", version } });
150
162
  addServerHandler({ route: `${server.prefix}/**`, handler: resolve$1(runtimeDir, "server/mongocamp/handler") });
151
163
  addServerPlugin(resolve$1(runtimeDir, "server/mongocamp/plugin"));
152
- addServerImports([{ name: "useMongocampCore", from: resolve$1(runtimeDir, "server/mongocamp/core") }]);
164
+ addServerImports([
165
+ { name: "useMongocampCore", from: resolve$1(runtimeDir, "server/mongocamp/core") },
166
+ // the documents of a collection with the rules of the API, in-process (2.4.0)
167
+ { name: "useMongocampServerCollection", from: resolve$1(runtimeDir, "server/composables/mongocampServerCollection") }
168
+ ]);
153
169
  addTypeTemplate({
154
170
  filename: "types/mongocamp-hooks.d.ts",
155
171
  getContents: () => [
@@ -160,7 +176,7 @@ const module$1 = defineNuxtModule({
160
176
  "export {}"
161
177
  ].join("\n")
162
178
  }, { nitro: true, nuxt: true });
163
- consola.info(`[mongocamp] embedded server at ${server.prefix}`);
179
+ logger.info(`embedded server at ${server.prefix}`);
164
180
  }
165
181
  if (server.enabled || options.server?.collectionsDir !== void 0) {
166
182
  const dirs = collectionDirs(nuxt.options._layers, server.collectionsDir);
@@ -176,12 +192,16 @@ const module$1 = defineNuxtModule({
176
192
  }, { nitro: true, nuxt: true });
177
193
  nuxt.hook("builder:watch", async (event, path) => {
178
194
  const candidates = isAbsolute(path) ? [path] : [resolve(nuxt.options.srcDir, path), resolve(nuxt.options.rootDir, path)];
179
- if ((event === "add" || event === "unlink") && candidates.some((candidate) => dirs.some((dir) => candidate.startsWith(`${dir}/`)))) {
195
+ const inDir = (candidate) => dirs.some((dir) => {
196
+ const rest = relative(dir, candidate);
197
+ return rest !== "" && !rest.startsWith("..") && !isAbsolute(rest);
198
+ });
199
+ if ((event === "add" || event === "unlink") && candidates.some(inDir)) {
180
200
  await updateTemplates({ filter: (template) => template.filename === "types/mongocamp-collections.d.ts" });
181
201
  }
182
202
  });
183
203
  }
184
- consola.success("mongocamp-nuxt available");
204
+ logger.debug("mongocamp-nuxt available");
185
205
  }
186
206
  });
187
207
 
@@ -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.4.0); needs the administrate grant of the collection, 403 otherwise.
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.4.0); needs the administrate grant of the collection, 403 otherwise.
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.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
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.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
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.4.0); for the administrators of the collection. 404 for a collection without audit.
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.4.0); for the administrators of the collection. 404 for a collection without audit.
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.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
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.4.0): fields it must not send, version and owner fields, behaviours. 404 for a collection that is not declared.
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.4.0); for the administrators of the collection. 404 for a collection without audit.
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.4.0); for the administrators of the collection. 404 for a collection without audit.
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.4.0); needs the administrate grant of the collection, 403 otherwise.
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.4.0); needs the administrate grant of the collection, 403 otherwise.
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
- * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
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
- * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
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
- * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
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
- * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
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
- * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
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
- * Soft-deleted documents too (collections declared with softDelete, 2.4.0); needs the administrate grant of the collection, 403 otherwise.
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.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
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.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
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.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
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.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
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.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
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.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
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.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
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.4.0). For users who can read the document; administrators of the collection also get the history of deleted documents. 404 for a collection without audit.
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.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
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.4.0). 404 for a collection without soft delete and for a document that is missing or not deleted.
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.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
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.4.0), scoped like every read and by `filter`. Events: `upsert` (data `{ id, document }`, a document that is in the scope), `remove` (data `{ id }`, deleted or left the scope), `reset` (the client loads again). The `id` of an event is the resume token: send it as `Last-Event-ID` to resume. A comment every 25 seconds. Needs a replica set or a sharded cluster: 501 (code 5011) otherwise; at most `WATCH_MAX_STREAMS` streams per instance (503).
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) {