ABC audit MFE drop — app/index.json + abc-audit iife/staging (C14 deploy)
This commit is contained in:
parent
e71b8909bd
commit
9e66f7b3e4
4 changed files with 171 additions and 1 deletions
63
README.md
63
README.md
|
|
@ -1,2 +1,63 @@
|
||||||
# mfe-index
|
# ABC Audit — app-shell MFE Plugin drop
|
||||||
|
|
||||||
|
This folder makes the **ABC Audit** service appear in the app-shell **Plugin
|
||||||
|
Library** (`/library`) and open **in-shell**, authed by the user's app-shell
|
||||||
|
session — the Class-2 MFE-plugin path (the app-shell has no Class-3 "Services"
|
||||||
|
registry; it embeds MFE bundles).
|
||||||
|
|
||||||
|
## What the app-shell expects (contract)
|
||||||
|
|
||||||
|
The app-shell `/library` page reads a multi-MFE **`index.json`** manifest
|
||||||
|
(schema `doxa-1040-maps-mfe-index@1`) via `GET /api/_library`, which scans the
|
||||||
|
source configured by the server env var:
|
||||||
|
|
||||||
|
```
|
||||||
|
NUXT_MFE_INDEX_SOURCE=<path-or-url> # a local path to this folder / its index.json, OR an http(s) URL
|
||||||
|
NUXT_PUBLIC_MFE_LIBRARY_ENABLED=true # already set on the DT app-shell (turns /library on)
|
||||||
|
```
|
||||||
|
|
||||||
|
Each **bundle** in the manifest is an **IIFE** that registers a **custom
|
||||||
|
element**; the shell embeds it as `<abc-audit-tree profile-config='{…}'>`. The
|
||||||
|
`/library` "View" action opens the profile's `embed` staging page.
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
mfe-index/
|
||||||
|
index.json manifest (static, checked in)
|
||||||
|
build.sh assembles the drop (builds the IIFE, copies it in)
|
||||||
|
abc-audit/
|
||||||
|
abc-audit.iife.js BUILT — self-mounting <abc-audit-tree> (see build.sh)
|
||||||
|
audit-tree/index.html staging "View" page — loader-injects-token
|
||||||
|
```
|
||||||
|
|
||||||
|
`abc-audit.iife.js` is **built, not committed** (the builder sandbox has no npm).
|
||||||
|
Run `./build.sh` on any host with npm (the deploy host / BUILD-GATE) to produce it.
|
||||||
|
|
||||||
|
## The auth wire (C1 — no second login)
|
||||||
|
|
||||||
|
The token is **never baked** into the bundle. The staging page injects it at
|
||||||
|
runtime (priority: `?tk=` → `window.__MFE_TOKEN__` → baked `profile-config.tk`)
|
||||||
|
and the API base the same way (`?api=` → `window.__ABC_API_URL__` → `apiUrl`).
|
||||||
|
The custom element writes the token to `localStorage['abc_dev_token']` and sets
|
||||||
|
the API host before the Vue app's first `getTree()` — so the tree loads live
|
||||||
|
under the user's tenant with no re-login. The token is the **app-shell-signed
|
||||||
|
HS256 JWT**; the running ABC API verifies it with the same
|
||||||
|
`APP_SHELL_JWT_SECRET` (C1 wire, already live).
|
||||||
|
|
||||||
|
The app-shell's library "View" href must therefore be given `?tk=<session JWT>`
|
||||||
|
and `?api=<abc api base>` for a specific deployment — or a host wrapper sets
|
||||||
|
`window.__MFE_TOKEN__` / `window.__ABC_API_URL__` before loading the bundle.
|
||||||
|
|
||||||
|
## Deploy steps (coordinator / deploy-side)
|
||||||
|
|
||||||
|
1. `cd abc-audit-service/mfe-index && ./build.sh` → produces `abc-audit/abc-audit.iife.js`
|
||||||
|
2. Serve this `mfe-index/` folder (static) OR push it to Forgejo raw.
|
||||||
|
3. Set on the app-shell container:
|
||||||
|
`NUXT_MFE_INDEX_SOURCE=<served-url-or-path>/index.json` and recreate the app-shell.
|
||||||
|
4. Log into `:3000` → `/library` shows **ABC Audit** → View → the audit tree opens
|
||||||
|
in-shell (44 audits render), no second login.
|
||||||
|
|
||||||
|
No app-shell **code** change is needed — `NUXT_MFE_INDEX_SOURCE` is deploy
|
||||||
|
config. (If in-shell mounting ever needs shell code, STOP and coordinate the
|
||||||
|
authoritative app-shell tree with qa-coord/pm-1040-maps.)
|
||||||
|
|
|
||||||
28
app/abc-audit/abc-audit.iife.js
Normal file
28
app/abc-audit/abc-audit.iife.js
Normal file
File diff suppressed because one or more lines are too long
47
app/abc-audit/audit-tree/index.html
Normal file
47
app/abc-audit/audit-tree/index.html
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>abc-audit · audit-tree</title>
|
||||||
|
<link rel="icon" href="data:," />
|
||||||
|
<style>
|
||||||
|
html, body { margin: 0; height: 100%; background: #0b0f14; }
|
||||||
|
abc-audit-tree { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!--
|
||||||
|
Staging / in-shell "View" page for the ABC Audit MFE.
|
||||||
|
|
||||||
|
The app-shell library "View" action opens this page (the profile's `embed`).
|
||||||
|
It mounts <abc-audit-tree> and hands it the runtime embed config:
|
||||||
|
|
||||||
|
apiUrl — base of the sovereign ABC API for THIS deployment
|
||||||
|
tk — the app-shell-signed JWT (C1 wire: same HS256 secret abc-api verifies)
|
||||||
|
|
||||||
|
loader-injects-token — keep the token OUT of the built bundle. Priority:
|
||||||
|
?tk=<token> → window.__MFE_TOKEN__ → the baked profile-config.tk
|
||||||
|
The API base is set the same way via ?api= → window.__ABC_API_URL__ → cfg.apiUrl,
|
||||||
|
so ONE built bundle serves every deployment (dev sandbox, staging, prod) — the
|
||||||
|
host wires the URL + token, never a rebuild.
|
||||||
|
-->
|
||||||
|
<abc-audit-tree id="abc-mfe" profile-config='{"profile":"audit-tree","useFixtures":"0"}'></abc-audit-tree>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var el = document.getElementById('abc-mfe');
|
||||||
|
var cfg = {};
|
||||||
|
try { cfg = JSON.parse(el.getAttribute('profile-config')) || {}; } catch (e) { cfg = {}; }
|
||||||
|
var q = new URLSearchParams(location.search);
|
||||||
|
// Token: ?tk → window.__MFE_TOKEN__ → baked cfg.tk
|
||||||
|
var tk = q.get('tk') || window.__MFE_TOKEN__ || cfg.tk || '';
|
||||||
|
if (tk) cfg.tk = tk;
|
||||||
|
// API base: ?api → window.__ABC_API_URL__ → baked cfg.apiUrl
|
||||||
|
var api = q.get('api') || window.__ABC_API_URL__ || cfg.apiUrl || '';
|
||||||
|
if (api) cfg.apiUrl = api;
|
||||||
|
el.setAttribute('profile-config', JSON.stringify(cfg));
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<script src="../abc-audit.iife.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
34
app/index.json
Normal file
34
app/index.json
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"schema": "doxa-1040-maps-mfe-index@1",
|
||||||
|
"kit": "abc-audit",
|
||||||
|
"generatedFrom": "abc-audit-service/web (Vite IIFE embeddable)",
|
||||||
|
"bundleCount": 1,
|
||||||
|
"profileCount": 1,
|
||||||
|
"instanceCount": 1,
|
||||||
|
"bundles": [
|
||||||
|
{
|
||||||
|
"bundle": "abc-audit",
|
||||||
|
"category": "Security",
|
||||||
|
"icon": "🛡️",
|
||||||
|
"description": "ABC Audit — the sovereign Architecture / Build / Cybersecurity audit tree. A 4-level semantic drill-down (plugin → audit → branch → findings) over the RLS-isolated ABC EDGE database, authed by your app-shell session.",
|
||||||
|
"output": "abc-audit/abc-audit.iife.js",
|
||||||
|
"staging": "abc-audit/audit-tree/index.html",
|
||||||
|
"elements": [
|
||||||
|
"abc-audit-tree"
|
||||||
|
],
|
||||||
|
"element": "abc-audit-tree",
|
||||||
|
"profileCount": 1,
|
||||||
|
"profiles": [
|
||||||
|
{
|
||||||
|
"profile": "audit-tree",
|
||||||
|
"file": "mfe.js",
|
||||||
|
"element": "abc-audit-tree",
|
||||||
|
"description": "The full ABC audit tree: every plugin's Architecture / Build / Cybersecurity findings, drill-down + row detail, live from the sovereign ABC API under your tenant.",
|
||||||
|
"parameterized": false,
|
||||||
|
"embed": "abc-audit/audit-tree/index.html",
|
||||||
|
"embedScript": "<script src=\"/abc-audit/abc-audit.iife.js\"></script>\n<abc-audit-tree profile-config='{\"profile\":\"audit-tree\"}'></abc-audit-tree>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue