@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.
Files changed (36) hide show
  1. package/README.md +20 -19
  2. package/dist/module.d.mts +6 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +15 -3
  5. package/dist/runtime/api/.openapi-generator/FILES +6 -2
  6. package/dist/runtime/api/apis/CollectionApi.d.ts +13 -0
  7. package/dist/runtime/api/apis/CollectionApi.js +8 -0
  8. package/dist/runtime/api/apis/DocumentApi.d.ts +91 -8
  9. package/dist/runtime/api/apis/DocumentApi.js +156 -5
  10. package/dist/runtime/api/docs/CollectionApi.md +4 -1
  11. package/dist/runtime/api/docs/CountRequest.md +34 -0
  12. package/dist/runtime/api/docs/DocumentApi.md +188 -7
  13. package/dist/runtime/api/docs/ExportRequest.md +40 -0
  14. package/dist/runtime/api/docs/MongoAggregateRequest.md +2 -0
  15. package/dist/runtime/api/docs/SettingsResponse.md +0 -6
  16. package/dist/runtime/api/docs/{UpdateRequest.md → UpdateManyRequest.md} +4 -4
  17. package/dist/runtime/api/models/CountRequest.d.ts +30 -0
  18. package/dist/runtime/api/models/CountRequest.js +25 -0
  19. package/dist/runtime/api/models/ExportRequest.d.ts +42 -0
  20. package/dist/runtime/api/models/ExportRequest.js +31 -0
  21. package/dist/runtime/api/models/Grant.d.ts +10 -1
  22. package/dist/runtime/api/models/Grant.js +5 -0
  23. package/dist/runtime/api/models/MongoAggregateRequest.d.ts +4 -0
  24. package/dist/runtime/api/models/MongoAggregateRequest.js +4 -2
  25. package/dist/runtime/api/models/SettingsResponse.d.ts +0 -14
  26. package/dist/runtime/api/models/SettingsResponse.js +0 -6
  27. package/dist/runtime/api/models/UpdateManyRequest.d.ts +38 -0
  28. package/dist/runtime/api/models/{UpdateRequest.js → UpdateManyRequest.js} +7 -7
  29. package/dist/runtime/api/models/index.d.ts +3 -1
  30. package/dist/runtime/api/models/index.js +3 -1
  31. package/dist/runtime/server/mongocamp/core.d.ts +2 -0
  32. package/dist/runtime/server/mongocamp/core.js +8 -1
  33. package/dist/runtime/server/mongocamp/plugin.d.ts +5 -1
  34. package/dist/runtime/server/mongocamp/plugin.js +12 -1
  35. package/package.json +2 -2
  36. package/dist/runtime/api/models/UpdateRequest.d.ts +0 -38
@@ -1,5 +1,5 @@
1
1
 
2
- # UpdateRequest
2
+ # UpdateManyRequest
3
3
 
4
4
 
5
5
  ## Properties
@@ -12,13 +12,13 @@ Name | Type
12
12
  ## Example
13
13
 
14
14
  ```typescript
15
- import type { UpdateRequest } from ''
15
+ import type { UpdateManyRequest } from ''
16
16
 
17
17
  // TODO: Update the object below with actual values
18
18
  const example = {
19
19
  "document": null,
20
20
  "filter": null,
21
- } satisfies UpdateRequest
21
+ } satisfies UpdateManyRequest
22
22
 
23
23
  console.log(example)
24
24
 
@@ -27,7 +27,7 @@ const exampleJSON: string = JSON.stringify(example)
27
27
  console.log(exampleJSON)
28
28
 
29
29
  // Parse the JSON string back to an object
30
- const exampleParsed = JSON.parse(exampleJSON) as UpdateRequest
30
+ const exampleParsed = JSON.parse(exampleJSON) as UpdateManyRequest
31
31
  console.log(exampleParsed)
32
32
  ```
33
33
 
@@ -0,0 +1,30 @@
1
+ /**
2
+ * mongocamp-library
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface CountRequest
16
+ */
17
+ export interface CountRequest {
18
+ /**
19
+ * Lucene filter like on the list of documents, by default all documents
20
+ */
21
+ filter?: string;
22
+ }
23
+ /**
24
+ * Check if a given object implements the CountRequest interface.
25
+ */
26
+ export declare function instanceOfCountRequest(value: object): value is CountRequest;
27
+ export declare function CountRequestFromJSON(json: any): CountRequest;
28
+ export declare function CountRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CountRequest;
29
+ export declare function CountRequestToJSON(json: any): CountRequest;
30
+ export declare function CountRequestToJSONTyped(value?: CountRequest | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,25 @@
1
+ export function instanceOfCountRequest(value) {
2
+ return true;
3
+ }
4
+ export function CountRequestFromJSON(json) {
5
+ return CountRequestFromJSONTyped(json, false);
6
+ }
7
+ export function CountRequestFromJSONTyped(json, ignoreDiscriminator) {
8
+ if (json == null) {
9
+ return json;
10
+ }
11
+ return {
12
+ "filter": json["filter"] == null ? void 0 : json["filter"]
13
+ };
14
+ }
15
+ export function CountRequestToJSON(json) {
16
+ return CountRequestToJSONTyped(json, false);
17
+ }
18
+ export function CountRequestToJSONTyped(value, ignoreDiscriminator = false) {
19
+ if (value == null) {
20
+ return value;
21
+ }
22
+ return {
23
+ "filter": value["filter"]
24
+ };
25
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * mongocamp-library
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface ExportRequest
16
+ */
17
+ export interface ExportRequest {
18
+ /**
19
+ * Lucene filter like on the list of documents, by default all documents
20
+ */
21
+ filter?: string;
22
+ /**
23
+ *
24
+ */
25
+ sort?: Array<string>;
26
+ /**
27
+ *
28
+ */
29
+ projection?: Array<string>;
30
+ /**
31
+ *
32
+ */
33
+ limit?: number;
34
+ }
35
+ /**
36
+ * Check if a given object implements the ExportRequest interface.
37
+ */
38
+ export declare function instanceOfExportRequest(value: object): value is ExportRequest;
39
+ export declare function ExportRequestFromJSON(json: any): ExportRequest;
40
+ export declare function ExportRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExportRequest;
41
+ export declare function ExportRequestToJSON(json: any): ExportRequest;
42
+ export declare function ExportRequestToJSONTyped(value?: ExportRequest | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,31 @@
1
+ export function instanceOfExportRequest(value) {
2
+ return true;
3
+ }
4
+ export function ExportRequestFromJSON(json) {
5
+ return ExportRequestFromJSONTyped(json, false);
6
+ }
7
+ export function ExportRequestFromJSONTyped(json, ignoreDiscriminator) {
8
+ if (json == null) {
9
+ return json;
10
+ }
11
+ return {
12
+ "filter": json["filter"] == null ? void 0 : json["filter"],
13
+ "sort": json["sort"] == null ? void 0 : json["sort"],
14
+ "projection": json["projection"] == null ? void 0 : json["projection"],
15
+ "limit": json["limit"] == null ? void 0 : json["limit"]
16
+ };
17
+ }
18
+ export function ExportRequestToJSON(json) {
19
+ return ExportRequestToJSONTyped(json, false);
20
+ }
21
+ export function ExportRequestToJSONTyped(value, ignoreDiscriminator = false) {
22
+ if (value == null) {
23
+ return value;
24
+ }
25
+ return {
26
+ "filter": value["filter"],
27
+ "sort": value["sort"],
28
+ "projection": value["projection"],
29
+ "limit": value["limit"]
30
+ };
31
+ }
@@ -34,8 +34,17 @@ export interface Grant {
34
34
  /**
35
35
  *
36
36
  */
37
- grantType: string;
37
+ grantType: GrantGrantTypeEnum;
38
38
  }
39
+ /**
40
+ * @export
41
+ */
42
+ export declare const GrantGrantTypeEnum: {
43
+ readonly Collection: "COLLECTION";
44
+ readonly Bucket: "BUCKET";
45
+ readonly BucketMeta: "BUCKET_META";
46
+ };
47
+ export type GrantGrantTypeEnum = typeof GrantGrantTypeEnum[keyof typeof GrantGrantTypeEnum];
39
48
  /**
40
49
  * Check if a given object implements the Grant interface.
41
50
  */
@@ -1,3 +1,8 @@
1
+ export const GrantGrantTypeEnum = {
2
+ Collection: "COLLECTION",
3
+ Bucket: "BUCKET",
4
+ BucketMeta: "BUCKET_META"
5
+ };
1
6
  export function instanceOfGrant(value) {
2
7
  if (!("name" in value) || value["name"] === void 0) return false;
3
8
  if (!("read" in value) || value["read"] === void 0) return false;
@@ -24,6 +24,10 @@ export interface MongoAggregateRequest {
24
24
  *
25
25
  */
26
26
  allowDiskUse: boolean;
27
+ /**
28
+ * 2.1.0: the Lucene filter of the list as first stage, like the query parameter filter (send one of both; no URL limit in the body)
29
+ */
30
+ filter?: string;
27
31
  }
28
32
  /**
29
33
  * Check if a given object implements the MongoAggregateRequest interface.
@@ -15,7 +15,8 @@ export function MongoAggregateRequestFromJSONTyped(json, ignoreDiscriminator) {
15
15
  }
16
16
  return {
17
17
  "pipeline": json["pipeline"] == null ? void 0 : json["pipeline"].map(PipelineStageFromJSON),
18
- "allowDiskUse": json["allowDiskUse"]
18
+ "allowDiskUse": json["allowDiskUse"],
19
+ "filter": json["filter"] == null ? void 0 : json["filter"]
19
20
  };
20
21
  }
21
22
  export function MongoAggregateRequestToJSON(json) {
@@ -27,6 +28,7 @@ export function MongoAggregateRequestToJSONTyped(value, ignoreDiscriminator = fa
27
28
  }
28
29
  return {
29
30
  "pipeline": value["pipeline"] == null ? void 0 : value["pipeline"].map(PipelineStageToJSON),
30
- "allowDiskUse": value["allowDiskUse"]
31
+ "allowDiskUse": value["allowDiskUse"],
32
+ "filter": value["filter"]
31
33
  };
32
34
  }
@@ -15,20 +15,6 @@
15
15
  * @interface SettingsResponse
16
16
  */
17
17
  export interface SettingsResponse {
18
- /**
19
- *
20
- */
21
- routesPlugins?: Array<string>;
22
- /**
23
- * Deprecated: plugin system of the Scala server, always [GridFsFileAdapter]
24
- * @deprecated
25
- */
26
- filePlugins?: Array<string>;
27
- /**
28
- * Deprecated: plugin system of the Scala server, the value of PLUGINS_IGNORED
29
- * @deprecated
30
- */
31
- ignoredPlugins?: Array<string>;
32
18
  /**
33
19
  *
34
20
  */
@@ -10,9 +10,6 @@ export function SettingsResponseFromJSONTyped(json, ignoreDiscriminator) {
10
10
  return json;
11
11
  }
12
12
  return {
13
- "routesPlugins": json["routesPlugins"] == null ? void 0 : json["routesPlugins"],
14
- "filePlugins": json["filePlugins"] == null ? void 0 : json["filePlugins"],
15
- "ignoredPlugins": json["ignoredPlugins"] == null ? void 0 : json["ignoredPlugins"],
16
13
  "configurations": json["configurations"]
17
14
  };
18
15
  }
@@ -24,9 +21,6 @@ export function SettingsResponseToJSONTyped(value, ignoreDiscriminator = false)
24
21
  return value;
25
22
  }
26
23
  return {
27
- "routesPlugins": value["routesPlugins"],
28
- "filePlugins": value["filePlugins"],
29
- "ignoredPlugins": value["ignoredPlugins"],
30
24
  "configurations": value["configurations"]
31
25
  };
32
26
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * mongocamp-library
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface UpdateManyRequest
16
+ */
17
+ export interface UpdateManyRequest {
18
+ /**
19
+ *
20
+ */
21
+ document: {
22
+ [key: string]: any | null;
23
+ };
24
+ /**
25
+ *
26
+ */
27
+ filter: {
28
+ [key: string]: any | null;
29
+ };
30
+ }
31
+ /**
32
+ * Check if a given object implements the UpdateManyRequest interface.
33
+ */
34
+ export declare function instanceOfUpdateManyRequest(value: object): value is UpdateManyRequest;
35
+ export declare function UpdateManyRequestFromJSON(json: any): UpdateManyRequest;
36
+ export declare function UpdateManyRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateManyRequest;
37
+ export declare function UpdateManyRequestToJSON(json: any): UpdateManyRequest;
38
+ export declare function UpdateManyRequestToJSONTyped(value?: UpdateManyRequest | null, ignoreDiscriminator?: boolean): any;
@@ -1,12 +1,12 @@
1
- export function instanceOfUpdateRequest(value) {
1
+ export function instanceOfUpdateManyRequest(value) {
2
2
  if (!("document" in value) || value["document"] === void 0) return false;
3
3
  if (!("filter" in value) || value["filter"] === void 0) return false;
4
4
  return true;
5
5
  }
6
- export function UpdateRequestFromJSON(json) {
7
- return UpdateRequestFromJSONTyped(json, false);
6
+ export function UpdateManyRequestFromJSON(json) {
7
+ return UpdateManyRequestFromJSONTyped(json, false);
8
8
  }
9
- export function UpdateRequestFromJSONTyped(json, ignoreDiscriminator) {
9
+ export function UpdateManyRequestFromJSONTyped(json, ignoreDiscriminator) {
10
10
  if (json == null) {
11
11
  return json;
12
12
  }
@@ -15,10 +15,10 @@ export function UpdateRequestFromJSONTyped(json, ignoreDiscriminator) {
15
15
  "filter": json["filter"]
16
16
  };
17
17
  }
18
- export function UpdateRequestToJSON(json) {
19
- return UpdateRequestToJSONTyped(json, false);
18
+ export function UpdateManyRequestToJSON(json) {
19
+ return UpdateManyRequestToJSONTyped(json, false);
20
20
  }
21
- export function UpdateRequestToJSONTyped(value, ignoreDiscriminator = false) {
21
+ export function UpdateManyRequestToJSONTyped(value, ignoreDiscriminator = false) {
22
22
  if (value == null) {
23
23
  return value;
24
24
  }
@@ -11,11 +11,13 @@ export * from './CollectionSummary.js';
11
11
  export * from './ConnectionStats.js';
12
12
  export * from './CopyRequest.js';
13
13
  export * from './CopyResponse.js';
14
+ export * from './CountRequest.js';
14
15
  export * from './CountResponse.js';
15
16
  export * from './CreateCollectionResponse.js';
16
17
  export * from './DatabaseInfo.js';
17
18
  export * from './DeleteResponse.js';
18
19
  export * from './ErrorDescription.js';
20
+ export * from './ExportRequest.js';
19
21
  export * from './FieldInfo.js';
20
22
  export * from './FieldTypeCount.js';
21
23
  export * from './FileInformation.js';
@@ -58,7 +60,7 @@ export * from './SettingsResponse.js';
58
60
  export * from './SystemInfo.js';
59
61
  export * from './SystemStats.js';
60
62
  export * from './UpdateFileInformationRequest.js';
61
- export * from './UpdateRequest.js';
63
+ export * from './UpdateManyRequest.js';
62
64
  export * from './UpdateResponse.js';
63
65
  export * from './UpdateRoleRequest.js';
64
66
  export * from './UserInformation.js';
@@ -11,11 +11,13 @@ export * from "./CollectionSummary.js";
11
11
  export * from "./ConnectionStats.js";
12
12
  export * from "./CopyRequest.js";
13
13
  export * from "./CopyResponse.js";
14
+ export * from "./CountRequest.js";
14
15
  export * from "./CountResponse.js";
15
16
  export * from "./CreateCollectionResponse.js";
16
17
  export * from "./DatabaseInfo.js";
17
18
  export * from "./DeleteResponse.js";
18
19
  export * from "./ErrorDescription.js";
20
+ export * from "./ExportRequest.js";
19
21
  export * from "./FieldInfo.js";
20
22
  export * from "./FieldTypeCount.js";
21
23
  export * from "./FileInformation.js";
@@ -58,7 +60,7 @@ export * from "./SettingsResponse.js";
58
60
  export * from "./SystemInfo.js";
59
61
  export * from "./SystemStats.js";
60
62
  export * from "./UpdateFileInformationRequest.js";
61
- export * from "./UpdateRequest.js";
63
+ export * from "./UpdateManyRequest.js";
62
64
  export * from "./UpdateResponse.js";
63
65
  export * from "./UpdateRoleRequest.js";
64
66
  export * from "./UserInformation.js";
@@ -6,6 +6,8 @@ export interface EmbeddedServerConfig {
6
6
  connectionUri: string;
7
7
  config: Record<string, unknown>;
8
8
  jobs: boolean;
9
+ requestLogging?: boolean;
10
+ metrics?: boolean;
9
11
  version: {
10
12
  name: string;
11
13
  version: string;
@@ -1,4 +1,5 @@
1
- import { createMongocampServer } from "@sfxcode/mongocamp-server-core";
1
+ import { connectHooks, createMongocampServer } from "@sfxcode/mongocamp-server-core";
2
+ import { useNitroApp } from "nitro/app";
2
3
  import { useRuntimeConfig } from "nitro/runtime-config";
3
4
  let server;
4
5
  export function useMongocampCore(settings = useRuntimeConfig().mongocampServer) {
@@ -10,6 +11,12 @@ export function useMongocampCore(settings = useRuntimeConfig().mongocampServer)
10
11
  config: settings.config,
11
12
  jobs: settings.jobs,
12
13
  version: settings.version
14
+ }).then(async (created) => {
15
+ const hooks = useNitroApp().hooks;
16
+ if (hooks) {
17
+ await connectHooks(created, hooks);
18
+ }
19
+ return created;
13
20
  }).catch((error) => {
14
21
  server = void 0;
15
22
  throw error;
@@ -1,3 +1,7 @@
1
- /** Closes the embedded server with Nitro. */
1
+ /**
2
+ * The Nitro plugin of the embedded server: switches on the features of the module options (`server.requestLogging`, `server.metrics`)
3
+ * when the server is ready, and closes it with Nitro. An application adds its own features and listeners the same way, in its own Nitro
4
+ * plugin on the hooks `mongocamp:ready` and `mongocamp:<event>`.
5
+ */
2
6
  declare const _default: import("nitro/types").NitroAppPlugin;
3
7
  export default _default;
@@ -1,7 +1,18 @@
1
+ import { metrics, requestLogging } from "@sfxcode/mongocamp-server-core";
1
2
  import { definePlugin } from "nitro";
3
+ import { useRuntimeConfig } from "nitro/runtime-config";
2
4
  import { closeMongocampCore } from "./core.js";
3
5
  export default definePlugin((nitroApp) => {
4
- nitroApp.hooks.hook("close", async () => {
6
+ const settings = useRuntimeConfig().mongocampServer;
7
+ nitroApp.hooks?.hook("mongocamp:ready", async (server) => {
8
+ if (settings.requestLogging) {
9
+ await server.use(requestLogging());
10
+ }
11
+ if (settings.metrics) {
12
+ await server.use(metrics());
13
+ }
14
+ });
15
+ nitroApp.hooks?.hook("close", async () => {
5
16
  await closeMongocampCore();
6
17
  });
7
18
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@nuxt/kit": "^4.7.0",
32
- "@sfxcode/mongocamp-server-core": "2.1.0",
32
+ "@sfxcode/mongocamp-server-core": "2.2.0",
33
33
  "@vueuse/nuxt": "^15.1.0",
34
34
  "bson": "^7.3.4",
35
35
  "consola": "^3.4.2",
@@ -1,38 +0,0 @@
1
- /**
2
- * mongocamp-library
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 2.0.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- *
14
- * @export
15
- * @interface UpdateRequest
16
- */
17
- export interface UpdateRequest {
18
- /**
19
- *
20
- */
21
- document: {
22
- [key: string]: any | null;
23
- };
24
- /**
25
- *
26
- */
27
- filter: {
28
- [key: string]: any | null;
29
- };
30
- }
31
- /**
32
- * Check if a given object implements the UpdateRequest interface.
33
- */
34
- export declare function instanceOfUpdateRequest(value: object): value is UpdateRequest;
35
- export declare function UpdateRequestFromJSON(json: any): UpdateRequest;
36
- export declare function UpdateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateRequest;
37
- export declare function UpdateRequestToJSON(json: any): UpdateRequest;
38
- export declare function UpdateRequestToJSONTyped(value?: UpdateRequest | null, ignoreDiscriminator?: boolean): any;