mapomodule 2.0.0-beta.9 → 2.0.0-experimental.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.
package/README.md CHANGED
@@ -1,59 +1,66 @@
1
1
  # mapomodule
2
2
 
3
- The Mapo meta-module: a single Nuxt module that registers the entire Mapo stack with one entry in `nuxt.config.ts`.
3
+ The Mapo meta-module: one Nuxt module that installs the whole Mapo v2 stack and reads its configuration from the `mapo` key. Mapo is a Nuxt 4 admin framework that turns a REST backend following Django REST Framework conventions into a backoffice, declaratively.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- pnpm add mapomodule @nuxt/ui
8
+ pnpm add mapomodule@next @nuxt/ui
9
9
  ```
10
10
 
11
+ Mapo v2 is in beta and published on the `next` dist-tag; `latest` still points to Mapo v1 (Nuxt 2).
12
+
11
13
  ```ts
12
- // nuxt.config.ts — @nuxt/ui MUST come before mapomodule
14
+ // nuxt.config.ts — register @nuxt/ui before mapomodule
13
15
  export default defineNuxtConfig({
14
16
  modules: ["@nuxt/ui", "mapomodule"],
15
17
 
16
18
  mapo: {
19
+ // @mapomodule/core options (these are the defaults)
17
20
  authLoginUrl: "/api/auth/login",
18
21
  userInfoApi: "/api/profiles/me/",
19
22
  logoutUrl: "/api/auth/logout",
20
23
  loginUrl: "/login",
21
24
 
22
- uikit: {
23
- css: "~/assets/css/theme.css", // optional CSS token override
24
- ui: { button: { defaultVariants: { color: "primary" } } }, // optional Nuxt UI defaults
25
- },
26
-
27
- form: {
28
- // optional — global field registry defaults and debounce config
29
- },
25
+ uikit: { css: "~/assets/css/theme.css" }, // theme tokens, Nuxt UI defaults, media endpoints
26
+ form: { debounce: 300 }, // field registry defaults
27
+ i18n: { defaultLocale: "en" }, // locales
28
+ // mcp: false, // skip the development-only MCP server
29
+ // ai: {}, // opt in to AI-assisted data entry (experimental)
30
30
  },
31
31
  });
32
32
  ```
33
33
 
34
- All options are optional and fall back to `MAPO_DEFAULTS`.
34
+ Every key is optional. The app also needs an `app.vue` that wraps the page in `<UApp>` and `<NuxtLayout>`: see [Getting Started](https://lotrekagency.github.io/mapo-new/guide/getting-started).
35
35
 
36
36
  ## What it installs
37
37
 
38
- | Package | Status |
39
- | ------------------- | ------------------------------------------------------------------------ |
40
- | `@mapomodule/store` | ✅ Pinia stores |
41
- | `@mapomodule/core` | ✅ Service layer (forwards `mapo` config) |
42
- | `@mapomodule/uikit` | ✅ UI shell + theming + MapoOverride system + List engine + Detail shell |
43
- | `@mapomodule/form` | ✅ Form engine (`MapoForm`, `MapoDetail`, `useMapoForm`, field types) |
44
- | `@mapomodule/i18n` | 🔲 Planned |
38
+ | Module | Configured under | Provides |
39
+ | ------------------- | ----------------------- | ---------------------------------------------------------------------------------------- |
40
+ | `@mapomodule/store` | — | Pinia stores (auth, snack, confirm, sidebar) and `usePermissions` |
41
+ | `@mapomodule/i18n` | `mapo.i18n` | `@nuxtjs/i18n` with Mapo's English and Italian catalogs |
42
+ | `@mapomodule/core` | `mapo` (top-level keys) | `$mapoFetch`, `useCrud`, `useMapoAuth`, the `auth`, `permissions` and `roles` middleware |
43
+ | `@mapomodule/uikit` | `mapo.uikit` | Layouts, sidebar, login, `MapoList`, `MapoDetail`, media and menu managers, theming |
44
+ | `@mapomodule/form` | `mapo.form` | The form engine and its field registry |
45
+ | `@mapomodule/mcp` | `mapo.mcp` | An MCP server for AI assistants, in development only |
46
+ | `@mapomodule/ai` | `mapo.ai` | AI-assisted data entry (experimental), installed only when `mapo.ai` is set |
45
47
 
46
- ## Dev workflow
48
+ `@mapomodule/utils`, `@nuxt/ui` and `@iconify-json/lucide` come along as dependencies. A module you register yourself in `modules` is not installed a second time, and it then reads its own config key (`mapoForm`, `mapoUikit`, …) instead of the `mapo` block.
47
49
 
48
- ```bash
49
- # watch mode — rebuilds dist/ on src/ changes
50
- pnpm dev:mapomodule # from monorepo root
50
+ ## Types
51
+
52
+ Composables, stores and components are auto-imported. Types come from one aggregator:
53
+
54
+ ```ts
55
+ import type { FieldDescriptor, ListColumn } from "mapomodule/types";
51
56
  ```
52
57
 
53
- ## Reference
58
+ `mapomodule/types` re-exports the public types of `core`, `store`, `form`, `uikit`, `ai` and `utils`.
59
+
60
+ ## Documentation
54
61
 
55
- - [`@mapomodule/core`](../@mapomodule/core/) — CRUD, auth, middleware
56
- - [`@mapomodule/store`](../@mapomodule/store/) — Pinia stores
57
- - [`@mapomodule/uikit`](../@mapomodule/uikit/) — UI shell, theming, MapoOverride, List engine, MapoDetail
58
- - [`@mapomodule/form`](../@mapomodule/form/) — form engine, field types, `useMapoForm`
59
- - [docs/modules/core](../../docs/modules/core.md) — full config reference
62
+ - [Getting Started](https://lotrekagency.github.io/mapo-new/guide/getting-started)
63
+ - [Concepts](https://lotrekagency.github.io/mapo-new/guide/concepts): the packages, the backend contract, the form engine, the customization layers
64
+ - [How-to recipes](https://lotrekagency.github.io/mapo-new/howto/)
65
+ - [Core options](https://lotrekagency.github.io/mapo-new/modules/core#options)
66
+ - [Migration v1 → v2](https://lotrekagency.github.io/mapo-new/migration/v1-to-v2)
package/dist/index.d.mts CHANGED
@@ -2,4 +2,6 @@ export * from '@mapomodule/core/types';
2
2
  export * from '@mapomodule/store/types';
3
3
  export * from '@mapomodule/form/types';
4
4
  export * from '@mapomodule/uikit/types';
5
+ export * from '@mapomodule/ai/types';
5
6
  export * from '@mapomodule/utils';
7
+ export { ModelPermissions } from '@mapomodule/utils';
package/dist/index.d.ts CHANGED
@@ -2,4 +2,6 @@ export * from '@mapomodule/core/types';
2
2
  export * from '@mapomodule/store/types';
3
3
  export * from '@mapomodule/form/types';
4
4
  export * from '@mapomodule/uikit/types';
5
+ export * from '@mapomodule/ai/types';
5
6
  export * from '@mapomodule/utils';
7
+ export { ModelPermissions } from '@mapomodule/utils';
package/dist/index.mjs CHANGED
@@ -2,4 +2,5 @@ export * from '@mapomodule/core/types';
2
2
  export * from '@mapomodule/store/types';
3
3
  export * from '@mapomodule/form/types';
4
4
  export * from '@mapomodule/uikit/types';
5
+ export * from '@mapomodule/ai/types';
5
6
  export * from '@mapomodule/utils';
package/dist/module.d.mts CHANGED
@@ -3,6 +3,8 @@ import { MapoOptions } from '@mapomodule/core';
3
3
  import { MapoUikitOptions } from '@mapomodule/uikit';
4
4
  import { MapoFormOptions } from '@mapomodule/form';
5
5
  import { MapoI18nOptions } from '@mapomodule/i18n';
6
+ import { MapoMcpOptions } from '@mapomodule/mcp/types';
7
+ import { MapoAiOptions } from '@mapomodule/ai/types';
6
8
 
7
9
  interface MapoModuleOptions extends MapoOptions {
8
10
  /** Options forwarded to @mapomodule/uikit (CSS override, Nuxt UI defaults). */
@@ -11,6 +13,17 @@ interface MapoModuleOptions extends MapoOptions {
11
13
  form?: MapoFormOptions;
12
14
  /** Options forwarded to @mapomodule/i18n (default locale, extra locales). */
13
15
  i18n?: MapoI18nOptions;
16
+ /**
17
+ * Options forwarded to @mapomodule/mcp (MCP server for AI assistants).
18
+ * Installed in development only; pass `false` to skip it entirely.
19
+ */
20
+ mcp?: MapoMcpOptions | false;
21
+ /**
22
+ * Options forwarded to @mapomodule/ai (AI-assisted data entry, experimental).
23
+ * Opt-in: the module is installed only when this key is set, `{}` included;
24
+ * without it, or with `false`, nothing of the module is loaded.
25
+ */
26
+ ai?: MapoAiOptions | false;
14
27
  }
15
28
  declare const _default: NuxtModule<MapoModuleOptions, MapoModuleOptions, false>;
16
29
 
package/dist/module.d.ts CHANGED
@@ -3,6 +3,8 @@ import { MapoOptions } from '@mapomodule/core';
3
3
  import { MapoUikitOptions } from '@mapomodule/uikit';
4
4
  import { MapoFormOptions } from '@mapomodule/form';
5
5
  import { MapoI18nOptions } from '@mapomodule/i18n';
6
+ import { MapoMcpOptions } from '@mapomodule/mcp/types';
7
+ import { MapoAiOptions } from '@mapomodule/ai/types';
6
8
 
7
9
  interface MapoModuleOptions extends MapoOptions {
8
10
  /** Options forwarded to @mapomodule/uikit (CSS override, Nuxt UI defaults). */
@@ -11,6 +13,17 @@ interface MapoModuleOptions extends MapoOptions {
11
13
  form?: MapoFormOptions;
12
14
  /** Options forwarded to @mapomodule/i18n (default locale, extra locales). */
13
15
  i18n?: MapoI18nOptions;
16
+ /**
17
+ * Options forwarded to @mapomodule/mcp (MCP server for AI assistants).
18
+ * Installed in development only; pass `false` to skip it entirely.
19
+ */
20
+ mcp?: MapoMcpOptions | false;
21
+ /**
22
+ * Options forwarded to @mapomodule/ai (AI-assisted data entry, experimental).
23
+ * Opt-in: the module is installed only when this key is set, `{}` included;
24
+ * without it, or with `false`, nothing of the module is loaded.
25
+ */
26
+ ai?: MapoAiOptions | false;
14
27
  }
15
28
  declare const _default: NuxtModule<MapoModuleOptions, MapoModuleOptions, false>;
16
29
 
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mapomodule",
3
3
  "configKey": "mapo",
4
- "version": "2.0.0-beta.9",
4
+ "version": "2.0.0-experimental.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { defineNuxtModule, createResolver, hasNuxtModule, installModule } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, hasNuxtModule, installModule, useLogger } from '@nuxt/kit';
2
2
 
3
3
  const module$1 = defineNuxtModule({
4
4
  meta: {
5
5
  name: "mapomodule",
6
6
  configKey: "mapo"
7
7
  },
8
- async setup(options, _nuxt) {
8
+ async setup(options, nuxt) {
9
9
  const resolver = createResolver(import.meta.url);
10
10
  if (!hasNuxtModule("@mapomodule/store")) {
11
11
  await installModule(await resolver.resolvePath("@mapomodule/store"));
12
12
  }
13
- const { uikit, form, i18n, ...coreOptions } = options;
13
+ const { uikit, form, i18n, mcp, ai, ...coreOptions } = options;
14
14
  if (!hasNuxtModule("@mapomodule/i18n")) {
15
15
  await installModule(
16
16
  await resolver.resolvePath("@mapomodule/i18n"),
@@ -35,6 +35,25 @@ const module$1 = defineNuxtModule({
35
35
  form ?? {}
36
36
  );
37
37
  }
38
+ const mcpEnabled = mcp !== false && (mcp?.enabled ?? nuxt.options.dev);
39
+ if (mcpEnabled && !hasNuxtModule("@mapomodule/mcp")) {
40
+ await installModule(
41
+ await resolver.resolvePath("@mapomodule/mcp"),
42
+ mcp || {}
43
+ );
44
+ }
45
+ const aiOptedOut = ai === false;
46
+ const aiConfigured = ai !== void 0;
47
+ const isAiListed = hasNuxtModule("@mapomodule/ai");
48
+ if (aiConfigured && !aiOptedOut && !isAiListed) {
49
+ await installModule(await resolver.resolvePath("@mapomodule/ai"), ai);
50
+ }
51
+ const hasAiOptions = typeof ai === "object" && ai !== null && Object.keys(ai).length > 0;
52
+ if (isAiListed && hasAiOptions) {
53
+ useLogger("mapomodule").warn(
54
+ "mapo.ai has options, but @mapomodule/ai is also listed in `modules`, so it reads `mapoAi` and the options in `mapo.ai` are not applied. Move them to `mapoAi`, or take @mapomodule/ai out of `modules`."
55
+ );
56
+ }
38
57
  }
39
58
  });
40
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapomodule",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0-experimental.1",
4
4
  "description": "Mapo meta-package: registers and re-exports all @mapomodule/* modules",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,6 @@
34
34
  "scripts": {
35
35
  "dev": "nuxt-module-build build --stub --watch",
36
36
  "build": "nuxt-module-build build",
37
- "prepack": "pnpm build",
38
37
  "dev:prepare": "nuxt-module-build build --stub",
39
38
  "typecheck": "tsc --noEmit",
40
39
  "lint": "eslint src"
@@ -44,12 +43,14 @@
44
43
  },
45
44
  "dependencies": {
46
45
  "@iconify-json/lucide": "^1.2.0",
47
- "@mapomodule/core": "2.0.0-beta.6",
48
- "@mapomodule/form": "2.0.0-beta.6",
49
- "@mapomodule/i18n": "workspace:*",
50
- "@mapomodule/store": "2.0.0-beta.4",
51
- "@mapomodule/uikit": "2.0.0-beta.8",
52
- "@mapomodule/utils": "2.0.0-beta.3",
46
+ "@mapomodule/ai": "1.0.0-experimental.1",
47
+ "@mapomodule/core": "2.0.0-experimental.1",
48
+ "@mapomodule/form": "2.0.0-experimental.1",
49
+ "@mapomodule/i18n": "2.0.0-experimental.1",
50
+ "@mapomodule/mcp": "1.0.0-experimental.1",
51
+ "@mapomodule/store": "2.0.0-experimental.1",
52
+ "@mapomodule/uikit": "2.0.0-experimental.1",
53
+ "@mapomodule/utils": "2.0.0-experimental.1",
53
54
  "@nuxt/ui": "^4.7.0"
54
55
  },
55
56
  "devDependencies": {