@sfxcode/nuxt-mongocamp-server 1.4.4 → 1.5.1

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 (34) hide show
  1. package/README.md +64 -0
  2. package/dist/module.d.mts +18 -3
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +23 -642
  5. package/dist/runtime/composables/mongocampApi.d.ts +11 -22
  6. package/dist/runtime/composables/mongocampApi.js +4 -37
  7. package/dist/runtime/composables/mongocampApiAdmin.d.ts +15 -0
  8. package/dist/runtime/composables/mongocampApiAdmin.js +41 -0
  9. package/dist/runtime/composables/mongocampApiCollection.d.ts +26 -0
  10. package/dist/runtime/composables/mongocampApiCollection.js +40 -0
  11. package/dist/runtime/composables/mongocampApiCollections.d.ts +8 -0
  12. package/dist/runtime/composables/mongocampApiCollections.js +23 -0
  13. package/dist/runtime/composables/mongocampApiFiles.d.ts +14 -0
  14. package/dist/runtime/composables/mongocampApiFiles.js +38 -0
  15. package/dist/runtime/composables/mongocampApiJobs.d.ts +9 -0
  16. package/dist/runtime/composables/mongocampApiJobs.js +23 -0
  17. package/dist/runtime/composables/mongocampAuth.js +30 -22
  18. package/dist/runtime/composables/mongocampSearch.d.ts +23 -1
  19. package/dist/runtime/composables/mongocampSearch.js +34 -1
  20. package/dist/runtime/composables/mongocampStorage.d.ts +3 -2
  21. package/dist/runtime/composables/mongocampStorage.js +6 -3
  22. package/dist/runtime/composables/mongocampUser.js +1 -1
  23. package/dist/runtime/server/composables/mongocampApi.d.ts +14 -0
  24. package/dist/runtime/server/composables/mongocampApi.js +8 -0
  25. package/dist/runtime/server/composables/mongocampServerApi.d.ts +11 -12
  26. package/dist/runtime/server/composables/mongocampServerApi.js +4 -39
  27. package/dist/runtime/utils/buildFieldFilterExpression.d.ts +2 -0
  28. package/dist/runtime/utils/buildFieldFilterExpression.js +7 -0
  29. package/dist/runtime/utils/createMongocampApis.d.ts +15 -0
  30. package/dist/runtime/utils/createMongocampApis.js +28 -0
  31. package/dist/runtime/utils/toMongocampError.d.ts +7 -0
  32. package/dist/runtime/utils/toMongocampError.js +19 -0
  33. package/dist/types.d.mts +1 -1
  34. package/package.json +17 -11
@@ -0,0 +1,7 @@
1
+ export function buildFieldFilterExpression(field, value) {
2
+ if (typeof value === "number" || typeof value === "boolean")
3
+ return `${field}: ${value}`;
4
+ const stringValue = value instanceof Date ? value.toISOString() : value;
5
+ const escapedValue = stringValue.replace(/"/g, '\\"');
6
+ return `${field}: "${escapedValue}"`;
7
+ }
@@ -0,0 +1,15 @@
1
+ import type { Configuration } from '../api/index.js';
2
+ import { AdminApi, ApplicationApi, AuthApi, BucketApi, CollectionApi, DatabaseApi, DocumentApi, FileApi, IndexApi, InformationApi, JobsApi } from '../api/index.js';
3
+ export declare function createMongocampApis(configuration: Configuration): {
4
+ adminApi: AdminApi;
5
+ applicationApi: ApplicationApi;
6
+ authApi: AuthApi;
7
+ bucketApi: BucketApi;
8
+ collectionApi: CollectionApi;
9
+ databaseApi: DatabaseApi;
10
+ documentApi: DocumentApi;
11
+ fileApi: FileApi;
12
+ indexApi: IndexApi;
13
+ informationApi: InformationApi;
14
+ jobApi: JobsApi;
15
+ };
@@ -0,0 +1,28 @@
1
+ import {
2
+ AdminApi,
3
+ ApplicationApi,
4
+ AuthApi,
5
+ BucketApi,
6
+ CollectionApi,
7
+ DatabaseApi,
8
+ DocumentApi,
9
+ FileApi,
10
+ IndexApi,
11
+ InformationApi,
12
+ JobsApi
13
+ } from "../api/index.js";
14
+ export function createMongocampApis(configuration) {
15
+ return {
16
+ adminApi: new AdminApi(configuration),
17
+ applicationApi: new ApplicationApi(configuration),
18
+ authApi: new AuthApi(configuration),
19
+ bucketApi: new BucketApi(configuration),
20
+ collectionApi: new CollectionApi(configuration),
21
+ databaseApi: new DatabaseApi(configuration),
22
+ documentApi: new DocumentApi(configuration),
23
+ fileApi: new FileApi(configuration),
24
+ indexApi: new IndexApi(configuration),
25
+ informationApi: new InformationApi(configuration),
26
+ jobApi: new JobsApi(configuration)
27
+ };
28
+ }
@@ -0,0 +1,7 @@
1
+ export interface MongocampError {
2
+ status?: number;
3
+ message: string;
4
+ additionalInfo?: string;
5
+ cause: unknown;
6
+ }
7
+ export declare function toMongocampError(error: unknown): Promise<MongocampError>;
@@ -0,0 +1,19 @@
1
+ import { ResponseError } from "../api/index.js";
2
+ export async function toMongocampError(error) {
3
+ if (error instanceof ResponseError) {
4
+ const status = error.response.status;
5
+ let message = `Request failed with status ${status}`;
6
+ let additionalInfo;
7
+ try {
8
+ const body = await error.response.clone().json();
9
+ if (body?.msg)
10
+ message = body.msg;
11
+ additionalInfo = body?.additionalInfo;
12
+ } catch {
13
+ }
14
+ return { status, message, additionalInfo, cause: error };
15
+ }
16
+ if (error instanceof Error)
17
+ return { message: error.message, cause: error };
18
+ return { message: String(error), cause: error };
19
+ }
package/dist/types.d.mts CHANGED
@@ -2,4 +2,4 @@ export { default } from './module.mjs'
2
2
 
3
3
  export { type ModuleOptions } from './module.mjs'
4
4
 
5
- export * from '../dist/runtime/api/models/index.js'
5
+ export * from '../dist/runtime/api/index.js'
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "1.4.4",
3
+ "version": "1.5.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./dist/types.d.mts",
9
9
  "import": "./dist/module.mjs"
10
+ },
11
+ "./api": {
12
+ "types": "./dist/runtime/api/index.d.ts",
13
+ "import": "./dist/runtime/api/index.js"
10
14
  }
11
15
  },
12
16
  "main": "./dist/module.mjs",
@@ -39,22 +43,24 @@
39
43
  "api-codegen": "openapi-generator-cli generate -i ./openapi/docs.yaml -g typescript-fetch -o src/runtime/api --additional-properties=typescriptThreePlus=true,supportsES6=true"
40
44
  },
41
45
  "dependencies": {
42
- "@nuxt/kit": "^4.4.8",
43
- "@vueuse/nuxt": "^14.3.0"
46
+ "@nuxt/kit": "^4.5.1",
47
+ "@vueuse/nuxt": "^14.4.0",
48
+ "consola": "^3.4.2",
49
+ "defu": "^6.1.7"
44
50
  },
45
51
  "devDependencies": {
46
52
  "@nuxt/devtools": "4.0.0-alpha.7",
47
53
  "@nuxt/eslint-config": "^1.16.0",
48
- "@nuxt/module-builder": "^1.0.2",
49
- "@nuxt/schema": "^4.4.8",
50
- "@nuxt/test-utils": "^4.0.3",
51
- "@openapitools/openapi-generator-cli": "^2.39.0",
52
- "@types/node": "^26.0.0",
54
+ "@nuxt/module-builder": "^1.0.3",
55
+ "@nuxt/schema": "^4.5.1",
56
+ "@nuxt/test-utils": "^4.1.0",
57
+ "@openapitools/openapi-generator-cli": "^2.40.1",
58
+ "@types/node": "^26.1.2",
53
59
  "@unocss/nuxt": "66.7.2",
54
60
  "changelogen": "^0.6.2",
55
- "eslint": "^10.5.0",
56
- "nuxt": "^4.4.8",
57
- "vitest": "^4.1.9"
61
+ "eslint": "^10.8.0",
62
+ "nuxt": "^4.5.1",
63
+ "vitest": "^4.1.10"
58
64
  },
59
65
  "packageManager": "pnpm@10.30.0+sha512.2b5753de015d480eeb88f5b5b61e0051f05b4301808a82ec8b840c9d2adf7748eb352c83f5c1593ca703ff1017295bc3fdd3119abb9686efc96b9fcb18200937"
60
66
  }