@sfxcode/nuxt-mongocamp-server 2.0.0 → 2.1.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.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Nuxt module wrapping a generated OpenAPI client for [MongoCamp](https://mongocamp.io), with composables for browser-session auth and server-side API-key/bearer auth.
4
4
 
5
+ 📖 **Documentation: [mongocamp.github.io/nuxt-mongocamp-server](https://mongocamp.github.io/nuxt-mongocamp-server/)**
6
+
5
7
  ## MongoCamp Server
6
8
 
7
9
  The module works in two modes:
@@ -51,9 +53,10 @@ The connection and every other setting use the env variables of the Scala server
51
53
  | `AUTH_SECRET` | random, stored | secret of the tokens (stored in `mc_configuration`, shared by all instances) |
52
54
  | `AUTH_EXPIRING_DURATION` | `6h` | lifetime of a token |
53
55
  | `REQUESTLOGGING_ENABLED`, `METRICS_ENABLED` | `false` | request log and metrics (the former plugins) |
56
+ | `JOBS_ENABLED` | `true` | `false`: this instance does not run the jobs on their schedule (several instances) |
54
57
 
55
58
  At the first start the user `admin` is created with a random password that is printed to the log (like the Scala server). Further settings
56
- and the extension points (events, job handlers) are described in [`packages/server-core/README.md`](packages/server-core/README.md). In
59
+ and the extension points (events, job handlers registered with `core.registerJobHandler(...)`) are described in [`packages/server-core/README.md`](packages/server-core/README.md). In
57
60
  server code `useMongocampCore()` gives the embedded server, e.g. to listen to its events:
58
61
 
59
62
  ```ts
@@ -66,9 +69,9 @@ export default definePlugin(async () => {
66
69
  })
67
70
  ```
68
71
 
69
- **Migration to 2.0** (from 1.x or from the Scala server): every change and the checklist are in [`docs/migration-2.0.md`](docs/migration-2.0.md) — documents as Extended JSON, Lucene rules, 404 for missing resources, salted passwords, one start with `MIGRATION_DROP_SCALA_LEFTOVERS=true` on a database of the Scala server.
72
+ **Migration to 2.0** (from 1.x or from the Scala server): every change and the checklist are in [`docs/migration/to-2.0.md`](docs/migration/to-2.0.md) — documents as Extended JSON, Lucene rules, 404 for missing resources, salted passwords, one start with `MIGRATION_DROP_SCALA_LEFTOVERS=true` on a database of the Scala server.
70
73
 
71
- **Migration from the Scala server** (details and all differences: [`docs/migration-from-scala.md`](docs/migration-from-scala.md)): point the embedded server at the same database (the same `CONNECTION_*` and `AUTH_PREFIX`); users,
74
+ **Migration from the Scala server** (details and all differences: [`docs/migration/from-scala.md`](docs/migration/from-scala.md)): point the embedded server at the same database (the same `CONNECTION_*` and `AUTH_PREFIX`); users,
72
75
  roles, tokens, the token secret and the stored configurations keep working. Jobs are read from `mc_jobs` with cron expressions in the
73
76
  syntax of [croner](https://croner.56k.guru) (`*/5` instead of `0/5`); the Quartz tables `mc_jobs_*` are not read.
74
77
 
@@ -82,7 +85,9 @@ docker build -f apps/server/Dockerfile -t mongocamp-nitro-server .
82
85
  docker run -p 8080:8080 -e CONNECTION_HOST=host.docker.internal mongocamp-nitro-server
83
86
  ```
84
87
 
85
- The image (distroless Node 24, about 214 MB, the server itself 2.8 MB) stops cleanly on `docker stop` (SIGTERM) and on `DELETE /system`.
88
+ Every request is one JSON line on stdout ([evlog](https://www.evlog.dev) wide events with the fields of the server under `mongocamp`); a Nuxt application that uses `evlog/nuxt` gets the same fields for the embedded API.
89
+
90
+ The image (distroless Node 24, about 214 MB, the server itself 3 MB) stops cleanly on `docker stop` (SIGTERM) and on `DELETE /system`.
86
91
 
87
92
  The spec is served at `/docs/docs.yaml` (`DOCS_OPENAPI`, default on) and an API reference UI at `/docs` (`DOCS_SWAGGER`).
88
93
 
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "configKey": "mongocamp",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.7.0"
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import { consola } from 'consola';
4
4
  export * from '../dist/runtime/api/index.js';
5
5
 
6
6
  const name = "@sfxcode/nuxt-mongocamp-server";
7
- const version = "2.0.0";
7
+ const version = "2.1.0";
8
8
 
9
9
  const DefaultServerPrefix = "/api/mongocamp-server";
10
10
  function normalizePrefix(prefix) {
@@ -1,8 +1,16 @@
1
1
  import { defineHandler } from "nitro";
2
2
  import { useRuntimeConfig } from "nitro/runtime-config";
3
3
  import { toCoreRequest, useMongocampCore } from "./core.js";
4
+ function fetchOptionsOf(request) {
5
+ const log = request.context?.log;
6
+ if (!log || typeof log.set !== "function") {
7
+ return void 0;
8
+ }
9
+ const requestId = log.getContext?.().requestId;
10
+ return { log, requestId: typeof requestId === "string" ? requestId : void 0 };
11
+ }
4
12
  export default defineHandler(async (event) => {
5
13
  const settings = useRuntimeConfig().mongocampServer;
6
14
  const core = await useMongocampCore(settings);
7
- return core.fetch(toCoreRequest(event.req, settings.prefix));
15
+ return core.fetch(toCoreRequest(event.req, settings.prefix), fetchOptionsOf(event.req));
8
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "2.0.0",
3
+ "version": "2.1.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.0.0",
32
+ "@sfxcode/mongocamp-server-core": "2.1.0",
33
33
  "@vueuse/nuxt": "^15.1.0",
34
34
  "bson": "^7.3.4",
35
35
  "consola": "^3.4.2",
@@ -46,6 +46,7 @@
46
46
  "@unocss/nuxt": "^66.13.0",
47
47
  "changelogen": "^0.6.2",
48
48
  "eslint": "^10.16.0",
49
+ "evlog": "2.37.1",
49
50
  "h3": "2.0.8",
50
51
  "mongodb": "7.9.1",
51
52
  "nitro": "3.0.261103-rc",
@@ -74,6 +75,9 @@
74
75
  "api-codegen": "openapi-generator-cli generate -i ./openapi/docs.yaml -g typescript-fetch -o src/runtime/api --additional-properties=typescriptThreePlus=true,supportsES6=true",
75
76
  "test:contract": "vitest run --config vitest.contract.config.ts",
76
77
  "typecheck:server": "pnpm --filter @sfxcode/mongocamp-server-core typecheck",
77
- "sync-versions": "node scripts/sync-versions.mjs"
78
+ "sync-versions": "node scripts/sync-versions.mjs",
79
+ "docs:dev": "pnpm --filter mongocamp-docs dev",
80
+ "docs:build": "pnpm --filter mongocamp-docs build",
81
+ "docs:preview": "pnpm --filter mongocamp-docs preview"
78
82
  }
79
83
  }