@sfxcode/nuxt-mongocamp-server 1.4.4 → 1.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 (34) hide show
  1. package/README.md +63 -0
  2. package/dist/module.d.mts +16 -3
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +20 -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 +4 -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 +9 -3
@@ -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.0",
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",
@@ -28,7 +32,7 @@
28
32
  "dev": "nuxi dev playground",
29
33
  "dev:build": "nuxi build playground",
30
34
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
31
- "release": "npm run lint && npm run test && npm run prepack && changelogen --patch --release && npm publish --access public && git push --follow-tags",
35
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --minor --release && npm publish --access public && git push --follow-tags",
32
36
  "lint": "eslint .",
33
37
  "lint:fix": "eslint --fix .",
34
38
  "test": "vitest run",
@@ -40,7 +44,9 @@
40
44
  },
41
45
  "dependencies": {
42
46
  "@nuxt/kit": "^4.4.8",
43
- "@vueuse/nuxt": "^14.3.0"
47
+ "@vueuse/nuxt": "^14.3.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",