@nsxbet/admin-sdk 0.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 +680 -0
- package/dist/auth/client/in-memory.d.ts +27 -0
- package/dist/auth/client/in-memory.d.ts.map +1 -0
- package/dist/auth/client/in-memory.js +242 -0
- package/dist/auth/client/index.d.ts +7 -0
- package/dist/auth/client/index.d.ts.map +1 -0
- package/dist/auth/client/index.js +7 -0
- package/dist/auth/client/interface.d.ts +115 -0
- package/dist/auth/client/interface.d.ts.map +1 -0
- package/dist/auth/client/interface.js +7 -0
- package/dist/auth/client/keycloak.d.ts +19 -0
- package/dist/auth/client/keycloak.d.ts.map +1 -0
- package/dist/auth/client/keycloak.js +126 -0
- package/dist/auth/components/UserSelector.d.ts +19 -0
- package/dist/auth/components/UserSelector.d.ts.map +1 -0
- package/dist/auth/components/UserSelector.js +100 -0
- package/dist/auth/components/index.d.ts +5 -0
- package/dist/auth/components/index.d.ts.map +1 -0
- package/dist/auth/components/index.js +4 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/components/AuthProvider.d.ts +48 -0
- package/dist/components/AuthProvider.d.ts.map +1 -0
- package/dist/components/AuthProvider.js +117 -0
- package/dist/hooks/useAuth.d.ts +21 -0
- package/dist/hooks/useAuth.d.ts.map +1 -0
- package/dist/hooks/useAuth.js +34 -0
- package/dist/hooks/useFetch.d.ts +8 -0
- package/dist/hooks/useFetch.d.ts.map +1 -0
- package/dist/hooks/useFetch.js +31 -0
- package/dist/hooks/useI18n.d.ts +46 -0
- package/dist/hooks/useI18n.d.ts.map +1 -0
- package/dist/hooks/useI18n.js +95 -0
- package/dist/hooks/usePlatformAPI.d.ts +12 -0
- package/dist/hooks/usePlatformAPI.d.ts.map +1 -0
- package/dist/hooks/usePlatformAPI.js +10 -0
- package/dist/hooks/useTelemetry.d.ts +17 -0
- package/dist/hooks/useTelemetry.d.ts.map +1 -0
- package/dist/hooks/useTelemetry.js +36 -0
- package/dist/i18n/config.d.ts +26 -0
- package/dist/i18n/config.d.ts.map +1 -0
- package/dist/i18n/config.js +92 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +4 -0
- package/dist/i18n/locales/en-US.json +144 -0
- package/dist/i18n/locales/es.json +144 -0
- package/dist/i18n/locales/pt-BR.json +144 -0
- package/dist/i18n/locales/ro.json +144 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/registry/AdminShellRegistry.d.ts +140 -0
- package/dist/registry/AdminShellRegistry.d.ts.map +1 -0
- package/dist/registry/AdminShellRegistry.js +237 -0
- package/dist/registry/client/http.d.ts +21 -0
- package/dist/registry/client/http.d.ts.map +1 -0
- package/dist/registry/client/http.js +107 -0
- package/dist/registry/client/in-memory.d.ts +36 -0
- package/dist/registry/client/in-memory.d.ts.map +1 -0
- package/dist/registry/client/in-memory.js +242 -0
- package/dist/registry/client/index.d.ts +7 -0
- package/dist/registry/client/index.d.ts.map +1 -0
- package/dist/registry/client/index.js +5 -0
- package/dist/registry/client/interface.d.ts +96 -0
- package/dist/registry/client/interface.d.ts.map +1 -0
- package/dist/registry/client/interface.js +7 -0
- package/dist/registry/index.d.ts +12 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +8 -0
- package/dist/registry/types/index.d.ts +9 -0
- package/dist/registry/types/index.d.ts.map +1 -0
- package/dist/registry/types/index.js +6 -0
- package/dist/registry/types/manifest.d.ts +98 -0
- package/dist/registry/types/manifest.d.ts.map +1 -0
- package/dist/registry/types/manifest.js +81 -0
- package/dist/registry/types/module.d.ts +115 -0
- package/dist/registry/types/module.d.ts.map +1 -0
- package/dist/registry/types/module.js +6 -0
- package/dist/router/DynamicModule.d.ts +50 -0
- package/dist/router/DynamicModule.d.ts.map +1 -0
- package/dist/router/DynamicModule.js +141 -0
- package/dist/router/index.d.ts +2 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +1 -0
- package/dist/shell/AdminShell.d.ts +38 -0
- package/dist/shell/AdminShell.d.ts.map +1 -0
- package/dist/shell/AdminShell.js +299 -0
- package/dist/shell/BackofficeShell.d.ts +38 -0
- package/dist/shell/BackofficeShell.d.ts.map +1 -0
- package/dist/shell/BackofficeShell.js +299 -0
- package/dist/shell/components/CommandPalette.d.ts +8 -0
- package/dist/shell/components/CommandPalette.d.ts.map +1 -0
- package/dist/shell/components/CommandPalette.js +197 -0
- package/dist/shell/components/HomePage.d.ts +2 -0
- package/dist/shell/components/HomePage.d.ts.map +1 -0
- package/dist/shell/components/HomePage.js +32 -0
- package/dist/shell/components/LeftNav.d.ts +7 -0
- package/dist/shell/components/LeftNav.d.ts.map +1 -0
- package/dist/shell/components/LeftNav.js +247 -0
- package/dist/shell/components/MainContent.d.ts +9 -0
- package/dist/shell/components/MainContent.d.ts.map +1 -0
- package/dist/shell/components/MainContent.js +88 -0
- package/dist/shell/components/ModuleOverview.d.ts +7 -0
- package/dist/shell/components/ModuleOverview.d.ts.map +1 -0
- package/dist/shell/components/ModuleOverview.js +40 -0
- package/dist/shell/components/ProfilePage.d.ts +2 -0
- package/dist/shell/components/ProfilePage.d.ts.map +1 -0
- package/dist/shell/components/ProfilePage.js +30 -0
- package/dist/shell/components/RegistryPage.d.ts +8 -0
- package/dist/shell/components/RegistryPage.d.ts.map +1 -0
- package/dist/shell/components/RegistryPage.js +129 -0
- package/dist/shell/components/SettingsPage.d.ts +2 -0
- package/dist/shell/components/SettingsPage.d.ts.map +1 -0
- package/dist/shell/components/SettingsPage.js +60 -0
- package/dist/shell/components/TopBar.d.ts +8 -0
- package/dist/shell/components/TopBar.d.ts.map +1 -0
- package/dist/shell/components/TopBar.js +61 -0
- package/dist/shell/components/index.d.ts +10 -0
- package/dist/shell/components/index.d.ts.map +1 -0
- package/dist/shell/components/index.js +7 -0
- package/dist/shell/components/theme-provider.d.ts +15 -0
- package/dist/shell/components/theme-provider.d.ts.map +1 -0
- package/dist/shell/components/theme-provider.js +39 -0
- package/dist/shell/index.d.ts +9 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +8 -0
- package/dist/shell/search/fuzzy.d.ts +18 -0
- package/dist/shell/search/fuzzy.d.ts.map +1 -0
- package/dist/shell/search/fuzzy.js +121 -0
- package/dist/shell/search/index.d.ts +3 -0
- package/dist/shell/search/index.d.ts.map +1 -0
- package/dist/shell/search/index.js +1 -0
- package/dist/shell/telemetry.d.ts +7 -0
- package/dist/shell/telemetry.d.ts.map +1 -0
- package/dist/shell/telemetry.js +25 -0
- package/dist/shell/types.d.ts +110 -0
- package/dist/shell/types.d.ts.map +1 -0
- package/dist/shell/types.js +4 -0
- package/dist/tailwind/index.d.ts +20 -0
- package/dist/tailwind/index.d.ts.map +1 -0
- package/dist/tailwind/index.js +42 -0
- package/dist/types/keycloak.d.ts +26 -0
- package/dist/types/keycloak.d.ts.map +1 -0
- package/dist/types/keycloak.js +1 -0
- package/dist/types/platform.d.ts +83 -0
- package/dist/types/platform.d.ts.map +1 -0
- package/dist/types/platform.js +5 -0
- package/dist/vite/config.d.ts +71 -0
- package/dist/vite/config.d.ts.map +1 -0
- package/dist/vite/config.js +87 -0
- package/dist/vite/index.d.ts +18 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +17 -0
- package/dist/vite/plugins.d.ts +44 -0
- package/dist/vite/plugins.d.ts.map +1 -0
- package/dist/vite/plugins.js +74 -0
- package/package.json +86 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite utilities for building admin modules.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // vite.config.ts
|
|
7
|
+
* import { defineModuleConfig } from "@nsxbet/admin-sdk/vite";
|
|
8
|
+
*
|
|
9
|
+
* export default defineModuleConfig({
|
|
10
|
+
* port: 3003,
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
export { generateModuleManifestPlugin, serveDistPlugin, } from "./plugins.js";
|
|
17
|
+
export { defineModuleConfig, SHARED_EXTERNALS, } from "./config.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
export interface GenerateModuleManifestPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Path to the admin.module.json file
|
|
5
|
+
* @default resolve(process.cwd(), "admin.module.json")
|
|
6
|
+
*/
|
|
7
|
+
manifestPath?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Vite plugin to generate module.manifest.json after build.
|
|
11
|
+
* Merges admin.module.json metadata with the build entry path.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { generateModuleManifestPlugin } from "@nsxbet/admin-sdk/vite";
|
|
16
|
+
*
|
|
17
|
+
* export default defineConfig({
|
|
18
|
+
* plugins: [generateModuleManifestPlugin()],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateModuleManifestPlugin(options?: GenerateModuleManifestPluginOptions): Plugin;
|
|
23
|
+
export interface ServeDistPluginOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Directory where built files are located
|
|
26
|
+
* @default "dist"
|
|
27
|
+
*/
|
|
28
|
+
distDir?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Vite plugin to serve dist files during development.
|
|
32
|
+
* Enables the shell to load the module's built assets while developing.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { serveDistPlugin } from "@nsxbet/admin-sdk/vite";
|
|
37
|
+
*
|
|
38
|
+
* export default defineConfig({
|
|
39
|
+
* plugins: [serveDistPlugin()],
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function serveDistPlugin(options?: ServeDistPluginOptions): Plugin;
|
|
44
|
+
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/vite/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,mCAAwC,GAChD,MAAM,CAsBR;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CA+B5E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
2
|
+
import { resolve, join } from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin to generate module.manifest.json after build.
|
|
5
|
+
* Merges admin.module.json metadata with the build entry path.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { generateModuleManifestPlugin } from "@nsxbet/admin-sdk/vite";
|
|
10
|
+
*
|
|
11
|
+
* export default defineConfig({
|
|
12
|
+
* plugins: [generateModuleManifestPlugin()],
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function generateModuleManifestPlugin(options = {}) {
|
|
17
|
+
const manifestPath = options.manifestPath || resolve(process.cwd(), "admin.module.json");
|
|
18
|
+
return {
|
|
19
|
+
name: "generate-module-manifest",
|
|
20
|
+
writeBundle(outputOptions, bundle) {
|
|
21
|
+
const spaEntry = Object.keys(bundle).find((name) => name.includes("spa-") && name.endsWith(".js"));
|
|
22
|
+
if (!spaEntry)
|
|
23
|
+
return;
|
|
24
|
+
const metadata = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
25
|
+
const manifest = { entry: spaEntry, ...metadata };
|
|
26
|
+
const outDir = outputOptions.dir || "dist";
|
|
27
|
+
const outputPath = join(outDir, "module.manifest.json");
|
|
28
|
+
writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
|
|
29
|
+
console.log(`[generate-module-manifest] Generated ${outputPath} with entry: ${spaEntry}`);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Vite plugin to serve dist files during development.
|
|
35
|
+
* Enables the shell to load the module's built assets while developing.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { serveDistPlugin } from "@nsxbet/admin-sdk/vite";
|
|
40
|
+
*
|
|
41
|
+
* export default defineConfig({
|
|
42
|
+
* plugins: [serveDistPlugin()],
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function serveDistPlugin(options = {}) {
|
|
47
|
+
const distDir = options.distDir || "dist";
|
|
48
|
+
return {
|
|
49
|
+
name: "serve-dist",
|
|
50
|
+
configureServer(server) {
|
|
51
|
+
server.middlewares.use((req, res, next) => {
|
|
52
|
+
if (req.url === "/module.manifest.json") {
|
|
53
|
+
const manifestPath = resolve(process.cwd(), distDir, "module.manifest.json");
|
|
54
|
+
if (existsSync(manifestPath)) {
|
|
55
|
+
res.setHeader("Content-Type", "application/json");
|
|
56
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
57
|
+
res.end(readFileSync(manifestPath, "utf-8"));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (req.url?.startsWith("/assets/spa-") && req.url?.endsWith(".js")) {
|
|
62
|
+
const filePath = resolve(process.cwd(), distDir, req.url.slice(1));
|
|
63
|
+
if (existsSync(filePath)) {
|
|
64
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
65
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
66
|
+
res.end(readFileSync(filePath, "utf-8"));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
next();
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nsxbet/admin-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SDK for building NSX Admin modules with integrated shell",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./vite": {
|
|
16
|
+
"types": "./dist/vite/index.d.ts",
|
|
17
|
+
"import": "./dist/vite/index.js",
|
|
18
|
+
"default": "./dist/vite/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./tailwind": {
|
|
21
|
+
"types": "./dist/tailwind/index.d.ts",
|
|
22
|
+
"import": "./dist/tailwind/index.js",
|
|
23
|
+
"default": "./dist/tailwind/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"dev": "tsc --watch --preserveWatchOutput",
|
|
33
|
+
"type-check": "tsc --noEmit",
|
|
34
|
+
"test": "vitest run --passWithNoTests"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@nsxbet/admin-ui": ">=0.1.0",
|
|
38
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
39
|
+
"i18next": "^23.0.0 || ^24.0.0 || ^25.0.0",
|
|
40
|
+
"react": "^18.2.0",
|
|
41
|
+
"react-dom": "^18.2.0",
|
|
42
|
+
"react-i18next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
43
|
+
"react-router-dom": "^6.0.0",
|
|
44
|
+
"vite": "^5.0.0 || ^6.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"@vitejs/plugin-react": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"vite": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"keycloak-js": "^23.0.0",
|
|
56
|
+
"lucide-react": "^0.460.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@nsxbet/admin-ui": "workspace:*",
|
|
60
|
+
"@types/react": "^18.2.0",
|
|
61
|
+
"@types/react-dom": "^18.2.0",
|
|
62
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
63
|
+
"i18next": "^25.7.4",
|
|
64
|
+
"react-i18next": "^16.5.3",
|
|
65
|
+
"react-router-dom": "^6.20.1",
|
|
66
|
+
"typescript": "^5.7.0",
|
|
67
|
+
"vite": "^6.0.0",
|
|
68
|
+
"vitest": "^1.0.0"
|
|
69
|
+
},
|
|
70
|
+
"keywords": [
|
|
71
|
+
"nsxbet",
|
|
72
|
+
"admin",
|
|
73
|
+
"microfrontend",
|
|
74
|
+
"shell"
|
|
75
|
+
],
|
|
76
|
+
"author": "NSX Platform Team",
|
|
77
|
+
"license": "UNLICENSED",
|
|
78
|
+
"publishConfig": {
|
|
79
|
+
"access": "public"
|
|
80
|
+
},
|
|
81
|
+
"repository": {
|
|
82
|
+
"type": "git",
|
|
83
|
+
"url": "git+https://github.com/NSXBet/admin.git",
|
|
84
|
+
"directory": "packages/admin-sdk"
|
|
85
|
+
}
|
|
86
|
+
}
|