adminforgex 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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial public release.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aftab Ahmad Khan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # adminforgex
2
+
3
+ **Topics:** `admin` · `adminforgex` · `crud` · `dashboard` · `mern-packages` · `merndev` · `nodejs` · `npm-pm` · `observability` · `schema` · `typescript`
4
+
5
+ **Auto admin panel generator (core)** — describe models once (`path`, `fields`, optional relations) and emit a versioned **JSON manifest** your React/Next admin shell can render as CRUD tables + forms.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install adminforgex
11
+ ```
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import { adminModel, buildAdminManifest } from "adminforgex";
17
+
18
+ const manifest = buildAdminManifest([
19
+ adminModel({
20
+ name: "Order",
21
+ path: "/api/orders",
22
+ fields: [
23
+ { key: "_id", type: "id", readonly: true },
24
+ { key: "total", type: "number" },
25
+ { key: "userId", type: "id", relation: { resource: "User", labelField: "email" } },
26
+ ],
27
+ }),
28
+ ]);
29
+
30
+ // expose manifest.json from your API or bundle it in the admin app
31
+ ```
32
+
33
+ ## License
34
+
35
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ adminModel: () => adminModel,
24
+ adminforgex: () => adminforgex,
25
+ buildAdminManifest: () => buildAdminManifest
26
+ });
27
+ module.exports = __toCommonJS(src_exports);
28
+ function adminModel(def) {
29
+ return def;
30
+ }
31
+ function buildAdminManifest(models, generatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
32
+ return { version: 1, generatedAt, models };
33
+ }
34
+ var adminforgex = { adminModel, buildAdminManifest };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ adminModel,
38
+ adminforgex,
39
+ buildAdminManifest
40
+ });
41
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type AdminFieldType = \"string\" | \"number\" | \"boolean\" | \"date\" | \"id\" | \"json\";\n\nexport interface AdminFieldDef {\n key: string;\n label?: string;\n type: AdminFieldType;\n readonly?: boolean;\n relation?: { resource: string; labelField?: string };\n}\n\nexport interface AdminModelDef {\n /** Singular resource name */\n name: string;\n /** API base path, e.g. `/api/users` */\n path: string;\n fields: AdminFieldDef[];\n}\n\nexport interface AdminManifest {\n version: 1;\n generatedAt: string;\n models: AdminModelDef[];\n}\n\nexport function adminModel(def: AdminModelDef): AdminModelDef {\n return def;\n}\n\n/** Produce a portable admin manifest for UI generators. */\nexport function buildAdminManifest(models: AdminModelDef[], generatedAt = new Date().toISOString()): AdminManifest {\n return { version: 1, generatedAt, models };\n}\n\nexport const adminforgex = { adminModel, buildAdminManifest };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBO,SAAS,WAAW,KAAmC;AAC5D,SAAO;AACT;AAGO,SAAS,mBAAmB,QAAyB,eAAc,oBAAI,KAAK,GAAE,YAAY,GAAkB;AACjH,SAAO,EAAE,SAAS,GAAG,aAAa,OAAO;AAC3C;AAEO,IAAM,cAAc,EAAE,YAAY,mBAAmB;","names":[]}
@@ -0,0 +1,32 @@
1
+ type AdminFieldType = "string" | "number" | "boolean" | "date" | "id" | "json";
2
+ interface AdminFieldDef {
3
+ key: string;
4
+ label?: string;
5
+ type: AdminFieldType;
6
+ readonly?: boolean;
7
+ relation?: {
8
+ resource: string;
9
+ labelField?: string;
10
+ };
11
+ }
12
+ interface AdminModelDef {
13
+ /** Singular resource name */
14
+ name: string;
15
+ /** API base path, e.g. `/api/users` */
16
+ path: string;
17
+ fields: AdminFieldDef[];
18
+ }
19
+ interface AdminManifest {
20
+ version: 1;
21
+ generatedAt: string;
22
+ models: AdminModelDef[];
23
+ }
24
+ declare function adminModel(def: AdminModelDef): AdminModelDef;
25
+ /** Produce a portable admin manifest for UI generators. */
26
+ declare function buildAdminManifest(models: AdminModelDef[], generatedAt?: string): AdminManifest;
27
+ declare const adminforgex: {
28
+ adminModel: typeof adminModel;
29
+ buildAdminManifest: typeof buildAdminManifest;
30
+ };
31
+
32
+ export { type AdminFieldDef, type AdminFieldType, type AdminManifest, type AdminModelDef, adminModel, adminforgex, buildAdminManifest };
@@ -0,0 +1,32 @@
1
+ type AdminFieldType = "string" | "number" | "boolean" | "date" | "id" | "json";
2
+ interface AdminFieldDef {
3
+ key: string;
4
+ label?: string;
5
+ type: AdminFieldType;
6
+ readonly?: boolean;
7
+ relation?: {
8
+ resource: string;
9
+ labelField?: string;
10
+ };
11
+ }
12
+ interface AdminModelDef {
13
+ /** Singular resource name */
14
+ name: string;
15
+ /** API base path, e.g. `/api/users` */
16
+ path: string;
17
+ fields: AdminFieldDef[];
18
+ }
19
+ interface AdminManifest {
20
+ version: 1;
21
+ generatedAt: string;
22
+ models: AdminModelDef[];
23
+ }
24
+ declare function adminModel(def: AdminModelDef): AdminModelDef;
25
+ /** Produce a portable admin manifest for UI generators. */
26
+ declare function buildAdminManifest(models: AdminModelDef[], generatedAt?: string): AdminManifest;
27
+ declare const adminforgex: {
28
+ adminModel: typeof adminModel;
29
+ buildAdminManifest: typeof buildAdminManifest;
30
+ };
31
+
32
+ export { type AdminFieldDef, type AdminFieldType, type AdminManifest, type AdminModelDef, adminModel, adminforgex, buildAdminManifest };
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ // src/index.ts
2
+ function adminModel(def) {
3
+ return def;
4
+ }
5
+ function buildAdminManifest(models, generatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
6
+ return { version: 1, generatedAt, models };
7
+ }
8
+ var adminforgex = { adminModel, buildAdminManifest };
9
+ export {
10
+ adminModel,
11
+ adminforgex,
12
+ buildAdminManifest
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type AdminFieldType = \"string\" | \"number\" | \"boolean\" | \"date\" | \"id\" | \"json\";\n\nexport interface AdminFieldDef {\n key: string;\n label?: string;\n type: AdminFieldType;\n readonly?: boolean;\n relation?: { resource: string; labelField?: string };\n}\n\nexport interface AdminModelDef {\n /** Singular resource name */\n name: string;\n /** API base path, e.g. `/api/users` */\n path: string;\n fields: AdminFieldDef[];\n}\n\nexport interface AdminManifest {\n version: 1;\n generatedAt: string;\n models: AdminModelDef[];\n}\n\nexport function adminModel(def: AdminModelDef): AdminModelDef {\n return def;\n}\n\n/** Produce a portable admin manifest for UI generators. */\nexport function buildAdminManifest(models: AdminModelDef[], generatedAt = new Date().toISOString()): AdminManifest {\n return { version: 1, generatedAt, models };\n}\n\nexport const adminforgex = { adminModel, buildAdminManifest };\n"],"mappings":";AAwBO,SAAS,WAAW,KAAmC;AAC5D,SAAO;AACT;AAGO,SAAS,mBAAmB,QAAyB,eAAc,oBAAI,KAAK,GAAE,YAAY,GAAkB;AACjH,SAAO,EAAE,SAAS,GAAG,aAAa,OAAO;AAC3C;AAEO,IAAM,cAAc,EAAE,YAAY,mBAAmB;","names":[]}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "adminforgex",
3
+ "version": "0.1.0",
4
+ "description": "adminforgex — Admin panel generator core: JSON manifest of models, fields, and routes for CRUD UIs (React/Next adapters plug in separately).",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "test": "vitest run",
26
+ "typecheck": "tsc --noEmit",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "keywords": [
30
+ "admin",
31
+ "adminforgex",
32
+ "crud",
33
+ "dashboard",
34
+ "mern-packages",
35
+ "merndev",
36
+ "nodejs",
37
+ "npm-pm",
38
+ "observability",
39
+ "schema",
40
+ "typescript"
41
+ ],
42
+ "devDependencies": {
43
+ "@types/node": "^20.11.0",
44
+ "tsup": "^8.0.0",
45
+ "typescript": "^5.4.0",
46
+ "vitest": "^1.4.0"
47
+ },
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "author": "Aftab Ahmad Khan (https://github.com/aftab-ahmad-khan-dev)",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/NPM-Packages-Modules/mern.git",
55
+ "directory": "adminforgex"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/NPM-Packages-Modules/mern/issues"
59
+ },
60
+ "homepage": "https://github.com/NPM-Packages-Modules/mern/tree/main/adminforgex",
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
64
+ }