@sfxcode/nuxt-mongocamp-server 2.7.1 → 2.8.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 (28) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +3 -2
  3. package/dist/runtime/api/.openapi-generator/FILES +2 -0
  4. package/dist/runtime/api/apis/DocumentApi.d.ts +26 -0
  5. package/dist/runtime/api/apis/DocumentApi.js +16 -0
  6. package/dist/runtime/api/docs/CopyResponse.md +2 -0
  7. package/dist/runtime/api/docs/CoreVersion.md +36 -0
  8. package/dist/runtime/api/docs/DocumentApi.md +8 -2
  9. package/dist/runtime/api/docs/MongoCampConfiguration.md +6 -0
  10. package/dist/runtime/api/docs/Version.md +2 -0
  11. package/dist/runtime/api/models/CopyResponse.d.ts +4 -0
  12. package/dist/runtime/api/models/CopyResponse.js +4 -2
  13. package/dist/runtime/api/models/CoreVersion.d.ts +34 -0
  14. package/dist/runtime/api/models/CoreVersion.js +29 -0
  15. package/dist/runtime/api/models/MongoCampConfiguration.d.ts +23 -0
  16. package/dist/runtime/api/models/MongoCampConfiguration.js +15 -2
  17. package/dist/runtime/api/models/Version.d.ts +5 -0
  18. package/dist/runtime/api/models/Version.js +8 -2
  19. package/dist/runtime/api/models/index.d.ts +1 -0
  20. package/dist/runtime/api/models/index.js +1 -0
  21. package/dist/runtime/server/composables/mongocampApi.d.ts +9 -4
  22. package/dist/runtime/server/composables/mongocampApi.js +2 -1
  23. package/dist/runtime/server/composables/mongocampServerApi.js +1 -1
  24. package/dist/runtime/server/composables/mongocampServerCollection.d.ts +2 -0
  25. package/dist/runtime/server/composables/mongocampServerCollection.js +1 -1
  26. package/dist/runtime/server/mongocamp/embedded-api.d.ts +8 -3
  27. package/dist/runtime/server/mongocamp/embedded-api.js +2 -1
  28. package/package.json +7 -7
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "configKey": "mongocamp",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.7.0"
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import { defu } from 'defu';
4
4
  export * from '../dist/runtime/api/index.js';
5
5
 
6
6
  const name = "@sfxcode/nuxt-mongocamp-server";
7
- const version = "2.7.1";
7
+ const version = "2.8.0";
8
8
 
9
9
  const DefaultServerPrefix = "/api/mongocamp-server";
10
10
  const DefaultCollectionsDir = "mongocamp";
@@ -155,7 +155,8 @@ const module$1 = defineNuxtModule({
155
155
  addImports(["fromExtendedJson", "toExtendedJson", "documentId"].map((name2) => ({ name: name2, from: resolve$1(runtimeDir, "utils/extendedJson") })));
156
156
  addServerImports([
157
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") }
158
+ // 2.8.0: useMongocampEventApi; the old name stays (deprecated) — in server code it also matched the browser useMongocampApi()
159
+ ...["useMongocampEventApi", "useMongocampApi"].map((name2) => ({ name: name2, from: resolve$1(runtimeDir, server.enabled ? "server/mongocamp/embedded-api" : "server/composables/mongocampApi") }))
159
160
  ]);
160
161
  if (server.enabled) {
161
162
  nuxt.options.runtimeConfig.mongocampServer = defu(nuxt.options.runtimeConfig.mongocampServer, { ...server, version: { name: "mongocamp-nitro-server", version } });
@@ -38,6 +38,7 @@ docs/CollectionSummary.md
38
38
  docs/ConnectionStats.md
39
39
  docs/CopyRequest.md
40
40
  docs/CopyResponse.md
41
+ docs/CoreVersion.md
41
42
  docs/CountRequest.md
42
43
  docs/CountResponse.md
43
44
  docs/CreateCollectionResponse.md
@@ -125,6 +126,7 @@ models/CollectionSummary.ts
125
126
  models/ConnectionStats.ts
126
127
  models/CopyRequest.ts
127
128
  models/CopyResponse.ts
129
+ models/CoreVersion.ts
128
130
  models/CountRequest.ts
129
131
  models/CountResponse.ts
130
132
  models/CreateCollectionResponse.ts
@@ -408,6 +408,10 @@ export interface UpdateRequest {
408
408
  requestBody: {
409
409
  [key: string]: any | null;
410
410
  };
411
+ /**
412
+ * 2.8.0 in the spec (read since 2.6.0): the mode of the document current of a version conflict (409, code 4092): relaxed (default) or canonical Extended JSON, or plain.
413
+ */
414
+ extendedJson?: UpdateExtendedJsonEnum;
411
415
  }
412
416
  export interface UpdateDocumentPartialRequest {
413
417
  /**
@@ -424,6 +428,10 @@ export interface UpdateDocumentPartialRequest {
424
428
  requestBody: {
425
429
  [key: string]: any | null;
426
430
  };
431
+ /**
432
+ * 2.8.0 in the spec (read since 2.6.0): the mode of the document current of a version conflict (409, code 4092): relaxed (default) or canonical Extended JSON, or plain.
433
+ */
434
+ extendedJson?: UpdateDocumentPartialExtendedJsonEnum;
427
435
  }
428
436
  export interface UpdateManyOperationRequest {
429
437
  /**
@@ -843,3 +851,21 @@ export declare const SearchDocumentsExtendedJsonEnum: {
843
851
  readonly Plain: "plain";
844
852
  };
845
853
  export type SearchDocumentsExtendedJsonEnum = typeof SearchDocumentsExtendedJsonEnum[keyof typeof SearchDocumentsExtendedJsonEnum];
854
+ /**
855
+ * @export
856
+ */
857
+ export declare const UpdateExtendedJsonEnum: {
858
+ readonly Relaxed: "relaxed";
859
+ readonly Canonical: "canonical";
860
+ readonly Plain: "plain";
861
+ };
862
+ export type UpdateExtendedJsonEnum = typeof UpdateExtendedJsonEnum[keyof typeof UpdateExtendedJsonEnum];
863
+ /**
864
+ * @export
865
+ */
866
+ export declare const UpdateDocumentPartialExtendedJsonEnum: {
867
+ readonly Relaxed: "relaxed";
868
+ readonly Canonical: "canonical";
869
+ readonly Plain: "plain";
870
+ };
871
+ export type UpdateDocumentPartialExtendedJsonEnum = typeof UpdateDocumentPartialExtendedJsonEnum[keyof typeof UpdateDocumentPartialExtendedJsonEnum];
@@ -1086,6 +1086,9 @@ export class DocumentApi extends runtime.BaseAPI {
1086
1086
  );
1087
1087
  }
1088
1088
  const queryParameters = {};
1089
+ if (requestParameters["extendedJson"] != null) {
1090
+ queryParameters["extendedJson"] = requestParameters["extendedJson"];
1091
+ }
1089
1092
  const headerParameters = {};
1090
1093
  headerParameters["Content-Type"] = "application/json";
1091
1094
  if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
@@ -1152,6 +1155,9 @@ export class DocumentApi extends runtime.BaseAPI {
1152
1155
  );
1153
1156
  }
1154
1157
  const queryParameters = {};
1158
+ if (requestParameters["extendedJson"] != null) {
1159
+ queryParameters["extendedJson"] = requestParameters["extendedJson"];
1160
+ }
1155
1161
  const headerParameters = {};
1156
1162
  headerParameters["Content-Type"] = "application/json";
1157
1163
  if (this.configuration && (this.configuration.username !== void 0 || this.configuration.password !== void 0)) {
@@ -1365,3 +1371,13 @@ export const SearchDocumentsExtendedJsonEnum = {
1365
1371
  Canonical: "canonical",
1366
1372
  Plain: "plain"
1367
1373
  };
1374
+ export const UpdateExtendedJsonEnum = {
1375
+ Relaxed: "relaxed",
1376
+ Canonical: "canonical",
1377
+ Plain: "plain"
1378
+ };
1379
+ export const UpdateDocumentPartialExtendedJsonEnum = {
1380
+ Relaxed: "relaxed",
1381
+ Canonical: "canonical",
1382
+ Plain: "plain"
1383
+ };
@@ -9,6 +9,7 @@ Name | Type
9
9
  `name` | string
10
10
  `count` | number
11
11
  `indexes` | number
12
+ `skippedIndexes` | number
12
13
 
13
14
  ## Example
14
15
 
@@ -20,6 +21,7 @@ const example = {
20
21
  "name": null,
21
22
  "count": null,
22
23
  "indexes": null,
24
+ "skippedIndexes": null,
23
25
  } satisfies CopyResponse
24
26
 
25
27
  console.log(example)
@@ -0,0 +1,36 @@
1
+
2
+ # CoreVersion
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `name` | string
10
+ `version` | string
11
+
12
+ ## Example
13
+
14
+ ```typescript
15
+ import type { CoreVersion } from ''
16
+
17
+ // TODO: Update the object below with actual values
18
+ const example = {
19
+ "name": null,
20
+ "version": null,
21
+ } satisfies CoreVersion
22
+
23
+ console.log(example)
24
+
25
+ // Convert the instance to a JSON string
26
+ const exampleJSON: string = JSON.stringify(example)
27
+ console.log(exampleJSON)
28
+
29
+ // Parse the JSON string back to an object
30
+ const exampleParsed = JSON.parse(exampleJSON) as CoreVersion
31
+ console.log(exampleParsed)
32
+ ```
33
+
34
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
35
+
36
+
@@ -1401,7 +1401,7 @@ example().catch(console.error);
1401
1401
 
1402
1402
  ## update
1403
1403
 
1404
- > UpdateResponse update(collectionName, documentId, requestBody)
1404
+ > UpdateResponse update(collectionName, documentId, requestBody, extendedJson)
1405
1405
 
1406
1406
  Update Document in Collection
1407
1407
 
@@ -1436,6 +1436,8 @@ async function example() {
1436
1436
  documentId: documentId_example,
1437
1437
  // { [key: string]: any | null; }
1438
1438
  requestBody: Object,
1439
+ // 'relaxed' | 'canonical' | 'plain' | 2.8.0 in the spec (read since 2.6.0): the mode of the document current of a version conflict (409, code 4092): relaxed (default) or canonical Extended JSON, or plain. (optional)
1440
+ extendedJson: extendedJson_example,
1439
1441
  } satisfies UpdateRequest;
1440
1442
 
1441
1443
  try {
@@ -1458,6 +1460,7 @@ example().catch(console.error);
1458
1460
  | **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
1459
1461
  | **documentId** | `string` | DocumentId to update | [Defaults to `undefined`] |
1460
1462
  | **requestBody** | `{ [key: string]: any | null; }` | | |
1463
+ | **extendedJson** | `relaxed`, `canonical`, `plain` | 2.8.0 in the spec (read since 2.6.0): the mode of the document current of a version conflict (409, code 4092): relaxed (default) or canonical Extended JSON, or plain. | [Optional] [Defaults to `undefined`] [Enum: relaxed, canonical, plain] |
1461
1464
 
1462
1465
  ### Return type
1463
1466
 
@@ -1485,7 +1488,7 @@ example().catch(console.error);
1485
1488
 
1486
1489
  ## updateDocumentPartial
1487
1490
 
1488
- > UpdateResponse updateDocumentPartial(collectionName, documentId, requestBody)
1491
+ > UpdateResponse updateDocumentPartial(collectionName, documentId, requestBody, extendedJson)
1489
1492
 
1490
1493
  Update Document Parts in Collection
1491
1494
 
@@ -1520,6 +1523,8 @@ async function example() {
1520
1523
  documentId: documentId_example,
1521
1524
  // { [key: string]: any | null; }
1522
1525
  requestBody: Object,
1526
+ // 'relaxed' | 'canonical' | 'plain' | 2.8.0 in the spec (read since 2.6.0): the mode of the document current of a version conflict (409, code 4092): relaxed (default) or canonical Extended JSON, or plain. (optional)
1527
+ extendedJson: extendedJson_example,
1523
1528
  } satisfies UpdateDocumentPartialRequest;
1524
1529
 
1525
1530
  try {
@@ -1542,6 +1547,7 @@ example().catch(console.error);
1542
1547
  | **collectionName** | `string` | The name of your MongoDb Collection | [Defaults to `undefined`] |
1543
1548
  | **documentId** | `string` | DocumentId to update | [Defaults to `undefined`] |
1544
1549
  | **requestBody** | `{ [key: string]: any | null; }` | | |
1550
+ | **extendedJson** | `relaxed`, `canonical`, `plain` | 2.8.0 in the spec (read since 2.6.0): the mode of the document current of a version conflict (409, code 4092): relaxed (default) or canonical Extended JSON, or plain. | [Optional] [Defaults to `undefined`] [Enum: relaxed, canonical, plain] |
1545
1551
 
1546
1552
  ### Return type
1547
1553
 
@@ -11,6 +11,9 @@ Name | Type
11
11
  `configType` | string
12
12
  `comment` | string
13
13
  `needsRestartForActivation` | boolean
14
+ `source` | string
15
+ `defaultValue` | any
16
+ `isDefault` | boolean
14
17
 
15
18
  ## Example
16
19
 
@@ -24,6 +27,9 @@ const example = {
24
27
  "configType": null,
25
28
  "comment": null,
26
29
  "needsRestartForActivation": null,
30
+ "source": null,
31
+ "defaultValue": null,
32
+ "isDefault": null,
27
33
  } satisfies MongoCampConfiguration
28
34
 
29
35
  console.log(example)
@@ -9,6 +9,7 @@ Name | Type
9
9
  `name` | string
10
10
  `version` | string
11
11
  `builtAt` | Date
12
+ `core` | [CoreVersion](CoreVersion.md)
12
13
 
13
14
  ## Example
14
15
 
@@ -20,6 +21,7 @@ const example = {
20
21
  "name": null,
21
22
  "version": null,
22
23
  "builtAt": null,
24
+ "core": null,
23
25
  } satisfies Version
24
26
 
25
27
  console.log(example)
@@ -27,6 +27,10 @@ export interface CopyResponse {
27
27
  *
28
28
  */
29
29
  indexes: number;
30
+ /**
31
+ * 2.8.0: own indexes of a declaration (mongocamp_idx_*) that were not copied, because the target is not declared (no index sync would manage them there)
32
+ */
33
+ skippedIndexes?: number;
30
34
  }
31
35
  /**
32
36
  * Check if a given object implements the CopyResponse interface.
@@ -14,7 +14,8 @@ export function CopyResponseFromJSONTyped(json, ignoreDiscriminator) {
14
14
  return {
15
15
  "name": json["name"],
16
16
  "count": json["count"],
17
- "indexes": json["indexes"]
17
+ "indexes": json["indexes"],
18
+ "skippedIndexes": json["skippedIndexes"] == null ? void 0 : json["skippedIndexes"]
18
19
  };
19
20
  }
20
21
  export function CopyResponseToJSON(json) {
@@ -27,6 +28,7 @@ export function CopyResponseToJSONTyped(value, ignoreDiscriminator = false) {
27
28
  return {
28
29
  "name": value["name"],
29
30
  "count": value["count"],
30
- "indexes": value["indexes"]
31
+ "indexes": value["indexes"],
32
+ "skippedIndexes": value["skippedIndexes"]
31
33
  };
32
34
  }
@@ -0,0 +1,34 @@
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 CoreVersion
16
+ */
17
+ export interface CoreVersion {
18
+ /**
19
+ *
20
+ */
21
+ name: string;
22
+ /**
23
+ *
24
+ */
25
+ version: string;
26
+ }
27
+ /**
28
+ * Check if a given object implements the CoreVersion interface.
29
+ */
30
+ export declare function instanceOfCoreVersion(value: object): value is CoreVersion;
31
+ export declare function CoreVersionFromJSON(json: any): CoreVersion;
32
+ export declare function CoreVersionFromJSONTyped(json: any, ignoreDiscriminator: boolean): CoreVersion;
33
+ export declare function CoreVersionToJSON(json: any): CoreVersion;
34
+ export declare function CoreVersionToJSONTyped(value?: CoreVersion | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,29 @@
1
+ export function instanceOfCoreVersion(value) {
2
+ if (!("name" in value) || value["name"] === void 0) return false;
3
+ if (!("version" in value) || value["version"] === void 0) return false;
4
+ return true;
5
+ }
6
+ export function CoreVersionFromJSON(json) {
7
+ return CoreVersionFromJSONTyped(json, false);
8
+ }
9
+ export function CoreVersionFromJSONTyped(json, ignoreDiscriminator) {
10
+ if (json == null) {
11
+ return json;
12
+ }
13
+ return {
14
+ "name": json["name"],
15
+ "version": json["version"]
16
+ };
17
+ }
18
+ export function CoreVersionToJSON(json) {
19
+ return CoreVersionToJSONTyped(json, false);
20
+ }
21
+ export function CoreVersionToJSONTyped(value, ignoreDiscriminator = false) {
22
+ if (value == null) {
23
+ return value;
24
+ }
25
+ return {
26
+ "name": value["name"],
27
+ "version": value["version"]
28
+ };
29
+ }
@@ -35,7 +35,30 @@ export interface MongoCampConfiguration {
35
35
  *
36
36
  */
37
37
  needsRestartForActivation: boolean;
38
+ /**
39
+ * 2.8.0: where the active value comes from — env, an option of the server, an administrator's update (patched), a value stored without update (stored, e.g. the default an older server wrote at the first start), or the default
40
+ */
41
+ source?: MongoCampConfigurationSourceEnum;
42
+ /**
43
+ * 2.8.0: the current default in the form of value; left out for a generated default (AUTH_SECRET)
44
+ */
45
+ defaultValue?: any | null;
46
+ /**
47
+ * 2.8.0: value is the current default
48
+ */
49
+ isDefault?: boolean;
38
50
  }
51
+ /**
52
+ * @export
53
+ */
54
+ export declare const MongoCampConfigurationSourceEnum: {
55
+ readonly Env: "env";
56
+ readonly Option: "option";
57
+ readonly Patched: "patched";
58
+ readonly Stored: "stored";
59
+ readonly Default: "default";
60
+ };
61
+ export type MongoCampConfigurationSourceEnum = typeof MongoCampConfigurationSourceEnum[keyof typeof MongoCampConfigurationSourceEnum];
39
62
  /**
40
63
  * Check if a given object implements the MongoCampConfiguration interface.
41
64
  */
@@ -1,3 +1,10 @@
1
+ export const MongoCampConfigurationSourceEnum = {
2
+ Env: "env",
3
+ Option: "option",
4
+ Patched: "patched",
5
+ Stored: "stored",
6
+ Default: "default"
7
+ };
1
8
  export function instanceOfMongoCampConfiguration(value) {
2
9
  if (!("key" in value) || value["key"] === void 0) return false;
3
10
  if (!("value" in value) || value["value"] === void 0) return false;
@@ -18,7 +25,10 @@ export function MongoCampConfigurationFromJSONTyped(json, ignoreDiscriminator) {
18
25
  "value": json["value"],
19
26
  "configType": json["configType"],
20
27
  "comment": json["comment"],
21
- "needsRestartForActivation": json["needsRestartForActivation"]
28
+ "needsRestartForActivation": json["needsRestartForActivation"],
29
+ "source": json["source"] == null ? void 0 : json["source"],
30
+ "defaultValue": json["defaultValue"] === void 0 ? void 0 : json["defaultValue"] === null ? null : json["defaultValue"],
31
+ "isDefault": json["isDefault"] == null ? void 0 : json["isDefault"]
22
32
  };
23
33
  }
24
34
  export function MongoCampConfigurationToJSON(json) {
@@ -33,6 +43,9 @@ export function MongoCampConfigurationToJSONTyped(value, ignoreDiscriminator = f
33
43
  "value": value["value"],
34
44
  "configType": value["configType"],
35
45
  "comment": value["comment"],
36
- "needsRestartForActivation": value["needsRestartForActivation"]
46
+ "needsRestartForActivation": value["needsRestartForActivation"],
47
+ "source": value["source"],
48
+ "defaultValue": value["defaultValue"],
49
+ "isDefault": value["isDefault"]
37
50
  };
38
51
  }
@@ -9,6 +9,7 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
+ import type { CoreVersion } from './CoreVersion.js';
12
13
  /**
13
14
  *
14
15
  * @export
@@ -27,6 +28,10 @@ export interface Version {
27
28
  *
28
29
  */
29
30
  builtAt: Date;
31
+ /**
32
+ * 2.8.0: the package of the server core that runs (name and version of the application above may differ)
33
+ */
34
+ core?: CoreVersion;
30
35
  }
31
36
  /**
32
37
  * Check if a given object implements the Version interface.
@@ -1,4 +1,8 @@
1
1
  import { parseDateTime, serializeDateTime } from "../runtime.js";
2
+ import {
3
+ CoreVersionFromJSON,
4
+ CoreVersionToJSON
5
+ } from "./CoreVersion.js";
2
6
  export function instanceOfVersion(value) {
3
7
  if (!("name" in value) || value["name"] === void 0) return false;
4
8
  if (!("version" in value) || value["version"] === void 0) return false;
@@ -15,7 +19,8 @@ export function VersionFromJSONTyped(json, ignoreDiscriminator) {
15
19
  return {
16
20
  "name": json["name"],
17
21
  "version": json["version"],
18
- "builtAt": json["builtAt"] == null ? json["builtAt"] : parseDateTime(json["builtAt"])
22
+ "builtAt": json["builtAt"] == null ? json["builtAt"] : parseDateTime(json["builtAt"]),
23
+ "core": json["core"] == null ? void 0 : CoreVersionFromJSON(json["core"])
19
24
  };
20
25
  }
21
26
  export function VersionToJSON(json) {
@@ -28,6 +33,7 @@ export function VersionToJSONTyped(value, ignoreDiscriminator = false) {
28
33
  return {
29
34
  "name": value["name"],
30
35
  "version": value["version"],
31
- "builtAt": value["builtAt"] == null ? value["builtAt"] : serializeDateTime(value["builtAt"])
36
+ "builtAt": value["builtAt"] == null ? value["builtAt"] : serializeDateTime(value["builtAt"]),
37
+ "core": CoreVersionToJSON(value["core"])
32
38
  };
33
39
  }
@@ -21,6 +21,7 @@ export * from './CollectionSummary.js';
21
21
  export * from './ConnectionStats.js';
22
22
  export * from './CopyRequest.js';
23
23
  export * from './CopyResponse.js';
24
+ export * from './CoreVersion.js';
24
25
  export * from './CountRequest.js';
25
26
  export * from './CountResponse.js';
26
27
  export * from './CreateCollectionResponse.js';
@@ -21,6 +21,7 @@ export * from "./CollectionSummary.js";
21
21
  export * from "./ConnectionStats.js";
22
22
  export * from "./CopyRequest.js";
23
23
  export * from "./CopyResponse.js";
24
+ export * from "./CoreVersion.js";
24
25
  export * from "./CountRequest.js";
25
26
  export * from "./CountResponse.js";
26
27
  export * from "./CreateCollectionResponse.js";
@@ -1,10 +1,10 @@
1
1
  import type { H3Event } from 'h3';
2
2
  /**
3
- * The generated client for the server code, against the external server at the module option `url`; `event` is kept for the signature of
4
- * the earlier versions. With the embedded server the module registers `server/mongocamp/embedded-api.ts` under this name instead (2.5.0),
5
- * so an application with an external server does not bundle the core and the MongoDB driver.
3
+ * The generated client for the server code (2.8.0 `useMongocampEventApi`), against the external server at the module option `url`; `event`
4
+ * is kept for the signature of the earlier versions. With the embedded server the module registers `server/mongocamp/embedded-api.ts` under
5
+ * this name instead (2.5.0), so an application with an external server does not bundle the core and the MongoDB driver.
6
6
  */
7
- export declare function useMongocampApi(_event: H3Event, token?: string): {
7
+ export declare function useMongocampEventApi(_event: H3Event, token?: string): {
8
8
  adminApi: import("../../api/index.js").AdminApi;
9
9
  applicationApi: import("../../api/index.js").ApplicationApi;
10
10
  authApi: import("../../api/index.js").AuthApi;
@@ -17,3 +17,8 @@ export declare function useMongocampApi(_event: H3Event, token?: string): {
17
17
  systemApi: import("../../api/index.js").SystemApi;
18
18
  jobApi: import("../../api/index.js").JobsApi;
19
19
  };
20
+ /**
21
+ * @deprecated since 2.8.0, use `useMongocampEventApi` — in server code the name also matched the browser composable `useMongocampApi()`,
22
+ * so editors and a type check over the whole project picked the wrong one. Removed in 3.0.
23
+ */
24
+ export declare const useMongocampApi: typeof useMongocampEventApi;
@@ -1,6 +1,7 @@
1
1
  import { useRuntimeConfig } from "nitro/runtime-config";
2
2
  import { useMongocampServerApi } from "./mongocampServerApi.js";
3
- export function useMongocampApi(_event, token) {
3
+ export function useMongocampEventApi(_event, token) {
4
4
  const config = useRuntimeConfig();
5
5
  return useMongocampServerApi(config.public.mongocamp?.url, config.mongocampApiKey, token);
6
6
  }
7
+ export const useMongocampApi = useMongocampEventApi;
@@ -4,7 +4,7 @@ let precedenceExplained = false;
4
4
  export function useMongocampServerApi(url, key, token, fetchApi) {
5
5
  if (import.meta.dev && key && token && !precedenceExplained) {
6
6
  precedenceExplained = true;
7
- console.warn("[mongocamp] useMongocampApi: the api key of the module options wins over the token of the user; the calls run with the rights of the key's user");
7
+ console.warn("[mongocamp] useMongocampEventApi: the api key of the module options wins over the token of the user; the calls run with the rights of the key's user");
8
8
  }
9
9
  const credentials = key && key.length > 0 ? { apiKey: key } : token && token.length > 0 ? { accessToken: token } : {};
10
10
  return createMongocampApis(new Configuration({ basePath: url, ...credentials, ...fetchApi ? { fetchApi } : {} }));
@@ -15,6 +15,8 @@ import type { MongocampCollectionName, MongocampDocument, MongocampDocumentInput
15
15
  */
16
16
  export interface ServerCollectionUserOptions {
17
17
  user: H3Event | string | AuthorizedUser | 'system';
18
+ /** 2.8.0: updates and replaces keep the `updatedAt` / `updatedBy` they send where `timestamps.preserveOnUpdate` allows it (administrators). */
19
+ keepTimestamps?: boolean;
18
20
  }
19
21
  export declare function useMongocampServerCollection<N extends MongocampCollectionName>(name: N, options: ServerCollectionUserOptions): ServerCollection<MongocampDocument<N>, MongocampDocumentInput<N>>;
20
22
  export declare function useMongocampServerCollection<T = Record<string, unknown>, I = T>(name: string, options: ServerCollectionUserOptions): ServerCollection<T, I>;
@@ -6,7 +6,7 @@ function isEvent(user) {
6
6
  export function useMongocampServerCollection(name, options) {
7
7
  const user = isEvent(options.user) ? options.user.req : options.user;
8
8
  let collection;
9
- const get = () => collection ??= useMongocampCore().then((core) => core.collection(name, { user }));
9
+ const get = () => collection ??= useMongocampCore().then((core) => core.collection(name, { user, ...options.keepTimestamps === true ? { keepTimestamps: true } : {} }));
10
10
  const lazy = Object.fromEntries(methods.map((method) => [method, (...args) => get().then((target) => target[method](...args))]));
11
11
  return { name, ...lazy };
12
12
  }
@@ -1,9 +1,9 @@
1
1
  import type { H3Event } from 'h3';
2
2
  /**
3
- * `useMongocampApi(event, token?)` of an application with the embedded server: the generated client, answered in-process by the core (no
4
- * network hop to the own Nitro). Registered by the module instead of `server/composables/mongocampApi.ts` when `server.enabled`.
3
+ * `useMongocampEventApi(event, token?)` of an application with the embedded server: the generated client, answered in-process by the core
4
+ * (no network hop to the own Nitro). Registered by the module instead of `server/composables/mongocampApi.ts` when `server.enabled`.
5
5
  */
6
- export declare function useMongocampApi(_event: H3Event, token?: string): {
6
+ export declare function useMongocampEventApi(_event: H3Event, token?: string): {
7
7
  adminApi: import("../../api/index.js").AdminApi;
8
8
  applicationApi: import("../../api/index.js").ApplicationApi;
9
9
  authApi: import("../../api/index.js").AuthApi;
@@ -16,3 +16,8 @@ export declare function useMongocampApi(_event: H3Event, token?: string): {
16
16
  systemApi: import("../../api/index.js").SystemApi;
17
17
  jobApi: import("../../api/index.js").JobsApi;
18
18
  };
19
+ /**
20
+ * @deprecated since 2.8.0, use `useMongocampEventApi` — in server code the name also matched the browser composable `useMongocampApi()`,
21
+ * so editors and a type check over the whole project picked the wrong one. Removed in 3.0.
22
+ */
23
+ export declare const useMongocampApi: typeof useMongocampEventApi;
@@ -2,9 +2,10 @@ import { useRuntimeConfig } from "nitro/runtime-config";
2
2
  import { useMongocampServerApi } from "../composables/mongocampServerApi.js";
3
3
  import { useMongocampCore } from "./core.js";
4
4
  const EmbeddedBase = "http://mongocamp.embedded";
5
- export function useMongocampApi(_event, token) {
5
+ export function useMongocampEventApi(_event, token) {
6
6
  const config = useRuntimeConfig();
7
7
  const embedded = config.mongocampServer;
8
8
  const fetchApi = async (input, init) => (await useMongocampCore(embedded)).fetch(new Request(input, init));
9
9
  return useMongocampServerApi(EmbeddedBase, config.mongocampApiKey, token, fetchApi);
10
10
  }
11
+ export const useMongocampApi = useMongocampEventApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,17 +35,17 @@
35
35
  "failOnWarn": false
36
36
  },
37
37
  "dependencies": {
38
- "@nuxt/kit": "^4.7.0",
39
- "@sfxcode/mongocamp-server-core": "2.7.1",
38
+ "@nuxt/kit": "^4.7.1",
39
+ "@sfxcode/mongocamp-server-core": "2.8.0",
40
40
  "bson": "^7.3.4",
41
41
  "consola": "^3.4.2",
42
42
  "defu": "^6.1.7"
43
43
  },
44
44
  "devDependencies": {
45
- "@nuxt/devtools": "^4.2.2",
45
+ "@nuxt/devtools": "^4.3.0",
46
46
  "@nuxt/eslint-config": "^1.17.0",
47
47
  "@nuxt/module-builder": "^1.0.4",
48
- "@nuxt/schema": "^4.7.0",
48
+ "@nuxt/schema": "^4.7.1",
49
49
  "@nuxt/test-utils": "^4.4.0",
50
50
  "@openapitools/openapi-generator-cli": "^2.44.0",
51
51
  "@types/node": "^26.6.11",
@@ -53,11 +53,11 @@
53
53
  "@vitest/coverage-v8": "5.1.2",
54
54
  "changelogen": "^0.6.2",
55
55
  "eslint": "^10.16.0",
56
- "evlog": "2.37.1",
56
+ "evlog": "^2.39.0",
57
57
  "h3": "2.0.8",
58
58
  "mongodb": "7.9.1",
59
59
  "nitro": "3.0.261103-rc",
60
- "nuxt": "^4.7.0",
60
+ "nuxt": "^4.7.1",
61
61
  "srvx": "1.0.8",
62
62
  "typescript": "6.0.3",
63
63
  "vitest": "^5.1.2",