@underpeaks/generator-core 1.0.20
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/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest/manifest.d.ts +23 -0
- package/dist/manifest/manifest.d.ts.map +1 -0
- package/dist/manifest/manifest.js +66 -0
- package/dist/manifest/manifest.js.map +1 -0
- package/dist/routes/parser.d.ts +1 -0
- package/dist/routes/parser.d.ts.map +1 -0
- package/dist/routes/parser.js +2 -0
- package/dist/routes/parser.js.map +1 -0
- package/dist/schema/parser.d.ts +14 -0
- package/dist/schema/parser.d.ts.map +1 -0
- package/dist/schema/parser.js +121 -0
- package/dist/schema/parser.js.map +1 -0
- package/dist/schema/types.d.ts +91 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +4 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/theme/mapper.d.ts +1 -0
- package/dist/theme/mapper.d.ts.map +1 -0
- package/dist/theme/mapper.js +2 -0
- package/dist/theme/mapper.js.map +1 -0
- package/package.json +21 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File: underpeaks_codegen/packages/generator-core/src/index.ts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./schema/types"), exports);
|
|
19
|
+
__exportStar(require("./schema/parser"), exports);
|
|
20
|
+
__exportStar(require("./manifest/manifest"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,gEAAgE;;;;;;;;;;;;;;;;AAEhE,iDAA8B;AAC9B,kDAA+B;AAC/B,sDAAmC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GeneratedFile } from '../schema/types';
|
|
2
|
+
export interface ManifestEntry {
|
|
3
|
+
source_type: 'model' | 'page' | 'route' | 'theme' | 'root';
|
|
4
|
+
source_id: string;
|
|
5
|
+
checksum: string;
|
|
6
|
+
generated: boolean;
|
|
7
|
+
customized: boolean;
|
|
8
|
+
generated_at: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Manifest {
|
|
11
|
+
version: string;
|
|
12
|
+
generated_at: string;
|
|
13
|
+
project_id: string;
|
|
14
|
+
files: Record<string, ManifestEntry>;
|
|
15
|
+
}
|
|
16
|
+
export declare function computeChecksum(content: string): string;
|
|
17
|
+
export declare function createManifest(projectId: string, files: GeneratedFile[], sourceMap: Record<string, {
|
|
18
|
+
type: ManifestEntry['source_type'];
|
|
19
|
+
id: string;
|
|
20
|
+
}>): Manifest;
|
|
21
|
+
export declare function mergeManifest(existing: Manifest, incoming: Manifest, existingFileContents: Record<string, string>): Manifest;
|
|
22
|
+
export declare function getFilesToSkip(manifest: Manifest): string[];
|
|
23
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/manifest/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;IAC1D,SAAS,EAAI,MAAM,CAAA;IACnB,QAAQ,EAAK,MAAM,CAAA;IACnB,SAAS,EAAI,OAAO,CAAA;IACpB,UAAU,EAAG,OAAO,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAO,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAI,MAAM,CAAA;IACpB,KAAK,EAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC5C;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,aAAa,EAAE,EACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC5E,QAAQ,CAsBV;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3C,QAAQ,CA2BV;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,CAI3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File: underpeaks_codegen/packages/generator-core/src/manifest/manifest.ts
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.computeChecksum = computeChecksum;
|
|
8
|
+
exports.createManifest = createManifest;
|
|
9
|
+
exports.mergeManifest = mergeManifest;
|
|
10
|
+
exports.getFilesToSkip = getFilesToSkip;
|
|
11
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
12
|
+
function computeChecksum(content) {
|
|
13
|
+
return 'sha256:' + crypto_1.default.createHash('sha256').update(content).digest('hex');
|
|
14
|
+
}
|
|
15
|
+
function createManifest(projectId, files, sourceMap) {
|
|
16
|
+
const now = new Date().toISOString();
|
|
17
|
+
const entries = {};
|
|
18
|
+
for (const file of files) {
|
|
19
|
+
const source = sourceMap[file.path] ?? { type: 'root', id: 'root' };
|
|
20
|
+
entries[file.path] = {
|
|
21
|
+
source_type: source.type,
|
|
22
|
+
source_id: source.id,
|
|
23
|
+
checksum: computeChecksum(file.content),
|
|
24
|
+
generated: true,
|
|
25
|
+
customized: false,
|
|
26
|
+
generated_at: now,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
version: '1.0.0',
|
|
31
|
+
generated_at: now,
|
|
32
|
+
project_id: projectId,
|
|
33
|
+
files: entries,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function mergeManifest(existing, incoming, existingFileContents) {
|
|
37
|
+
// FIX: was a shallow spread ({ ...incoming }), so merged.files was the
|
|
38
|
+
// SAME object reference as incoming.files — every write below silently
|
|
39
|
+
// mutated the caller's original incoming manifest as a side effect.
|
|
40
|
+
// Now deep-copies the files map so incoming stays untouched.
|
|
41
|
+
const merged = {
|
|
42
|
+
...incoming,
|
|
43
|
+
files: { ...incoming.files },
|
|
44
|
+
};
|
|
45
|
+
for (const [filePath, existingEntry] of Object.entries(existing.files)) {
|
|
46
|
+
const incomingEntry = incoming.files[filePath];
|
|
47
|
+
if (!incomingEntry)
|
|
48
|
+
continue;
|
|
49
|
+
// Check if file was customized — if on-disk checksum differs from last generated checksum
|
|
50
|
+
const onDiskContent = existingFileContents[filePath];
|
|
51
|
+
const onDiskChecksum = onDiskContent ? computeChecksum(onDiskContent) : null;
|
|
52
|
+
if (onDiskChecksum && onDiskChecksum !== existingEntry.checksum) {
|
|
53
|
+
merged.files[filePath] = {
|
|
54
|
+
...incomingEntry,
|
|
55
|
+
customized: true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return merged;
|
|
60
|
+
}
|
|
61
|
+
function getFilesToSkip(manifest) {
|
|
62
|
+
return Object.entries(manifest.files)
|
|
63
|
+
.filter(([, entry]) => entry.customized)
|
|
64
|
+
.map(([filePath]) => filePath);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/manifest/manifest.ts"],"names":[],"mappings":";AAAA,4EAA4E;;;;;AAqB5E,0CAEC;AAED,wCA0BC;AAED,sCA+BC;AAED,wCAIC;AAxFD,oDAA2B;AAmB3B,SAAgB,eAAe,CAAC,OAAe;IAC7C,OAAO,SAAS,GAAG,gBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC9E,CAAC;AAED,SAAgB,cAAc,CAC5B,SAAiB,EACjB,KAAsB,EACtB,SAA6E;IAE7E,MAAM,GAAG,GAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACxC,MAAM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A;QAE5E,IAAI,cAAc,IAAI,cAAc,KAAK,aAAa,CAAC,QAAQ,EAAE,CAAC;YAChE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG;gBACvB,GAAG,aAAa;gBAChB,UAAU,EAAE,IAAI;aACjB,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAgB,cAAc,CAAC,QAAkB;IAC/C,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;SACvC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/routes/parser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/routes/parser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Model, ColumnDef, ProjectData } from './types';
|
|
2
|
+
export declare function parseColumnType(col: ColumnDef): {
|
|
3
|
+
dartType: string;
|
|
4
|
+
tsType: string;
|
|
5
|
+
nullable: boolean;
|
|
6
|
+
fromJson: string;
|
|
7
|
+
toJson: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getVisibleColumns(model: Model): ColumnDef[];
|
|
10
|
+
export declare function getPrimaryKey(model: Model): ColumnDef | undefined;
|
|
11
|
+
export declare function modelToClassName(modelName: string): string;
|
|
12
|
+
export declare function modelToFileName(modelName: string): string;
|
|
13
|
+
export declare function filterProjectData(data: ProjectData): ProjectData;
|
|
14
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/schema/parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE5D,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG;IAC/C,QAAQ,EAAI,MAAM,CAAA;IAClB,MAAM,EAAM,MAAM,CAAA;IAClB,QAAQ,EAAI,OAAO,CAAA;IACnB,QAAQ,EAAI,MAAM,CAAA;IAClB,MAAM,EAAM,MAAM,CAAA;CACnB,CAwEA;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAE3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAEjE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOzD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAkBhE"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File: underpeaks_codegen/packages/generator-core/src/schema/parser.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.parseColumnType = parseColumnType;
|
|
5
|
+
exports.getVisibleColumns = getVisibleColumns;
|
|
6
|
+
exports.getPrimaryKey = getPrimaryKey;
|
|
7
|
+
exports.modelToClassName = modelToClassName;
|
|
8
|
+
exports.modelToFileName = modelToFileName;
|
|
9
|
+
exports.filterProjectData = filterProjectData;
|
|
10
|
+
function parseColumnType(col) {
|
|
11
|
+
const nullable = col.nullable !== false;
|
|
12
|
+
switch (col.type.toLowerCase()) {
|
|
13
|
+
case 'uuid':
|
|
14
|
+
case 'string':
|
|
15
|
+
case 'text':
|
|
16
|
+
return {
|
|
17
|
+
dartType: nullable ? 'String?' : 'String',
|
|
18
|
+
tsType: 'string',
|
|
19
|
+
nullable,
|
|
20
|
+
fromJson: `json['${col.name}'] as String?`,
|
|
21
|
+
toJson: `'${col.name}': ${col.name}`,
|
|
22
|
+
};
|
|
23
|
+
case 'integer':
|
|
24
|
+
case 'int':
|
|
25
|
+
case 'bigint':
|
|
26
|
+
return {
|
|
27
|
+
dartType: nullable ? 'int?' : 'int',
|
|
28
|
+
tsType: 'number',
|
|
29
|
+
nullable,
|
|
30
|
+
fromJson: `json['${col.name}'] as int?`,
|
|
31
|
+
toJson: `'${col.name}': ${col.name}`,
|
|
32
|
+
};
|
|
33
|
+
case 'float':
|
|
34
|
+
case 'double':
|
|
35
|
+
case 'decimal':
|
|
36
|
+
case 'number':
|
|
37
|
+
return {
|
|
38
|
+
dartType: nullable ? 'double?' : 'double',
|
|
39
|
+
tsType: 'number',
|
|
40
|
+
nullable,
|
|
41
|
+
fromJson: `(json['${col.name}'] as num?)?.toDouble()`,
|
|
42
|
+
toJson: `'${col.name}': ${col.name}`,
|
|
43
|
+
};
|
|
44
|
+
case 'boolean':
|
|
45
|
+
return {
|
|
46
|
+
dartType: nullable ? 'bool?' : 'bool',
|
|
47
|
+
tsType: 'boolean',
|
|
48
|
+
nullable,
|
|
49
|
+
fromJson: `json['${col.name}'] as bool?`,
|
|
50
|
+
toJson: `'${col.name}': ${col.name}`,
|
|
51
|
+
};
|
|
52
|
+
case 'datetime':
|
|
53
|
+
case 'timestamp':
|
|
54
|
+
case 'date':
|
|
55
|
+
return {
|
|
56
|
+
dartType: nullable ? 'DateTime?' : 'DateTime',
|
|
57
|
+
tsType: 'string',
|
|
58
|
+
nullable,
|
|
59
|
+
fromJson: `json['${col.name}'] != null ? DateTime.parse(json['${col.name}']) : null`,
|
|
60
|
+
toJson: `'${col.name}': ${col.name}?.toIso8601String()`,
|
|
61
|
+
};
|
|
62
|
+
case 'json':
|
|
63
|
+
case 'jsonb':
|
|
64
|
+
case 'array':
|
|
65
|
+
return {
|
|
66
|
+
dartType: nullable ? 'Map<String, dynamic>?' : 'Map<String, dynamic>',
|
|
67
|
+
tsType: 'Record<string, any>',
|
|
68
|
+
nullable,
|
|
69
|
+
fromJson: `json['${col.name}'] as Map<String, dynamic>?`,
|
|
70
|
+
toJson: `'${col.name}': ${col.name}`,
|
|
71
|
+
};
|
|
72
|
+
default:
|
|
73
|
+
return {
|
|
74
|
+
dartType: nullable ? 'dynamic' : 'dynamic',
|
|
75
|
+
tsType: 'any',
|
|
76
|
+
nullable,
|
|
77
|
+
fromJson: `json['${col.name}']`,
|
|
78
|
+
toJson: `'${col.name}': ${col.name}`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function getVisibleColumns(model) {
|
|
83
|
+
return model.schema.columns.filter((c) => !c.hidden && !c.is_primary);
|
|
84
|
+
}
|
|
85
|
+
function getPrimaryKey(model) {
|
|
86
|
+
return model.schema.columns.find((c) => c.is_primary);
|
|
87
|
+
}
|
|
88
|
+
function modelToClassName(modelName) {
|
|
89
|
+
// nxf_products → Product
|
|
90
|
+
// NOTE: singularisation is naive (strips a trailing 's' only) — a model
|
|
91
|
+
// literally named "nxf_status" would become "Statu", and "nxf_categories"
|
|
92
|
+
// would become "Categorie" instead of "Category". Left as-is pending a
|
|
93
|
+
// product decision on whether this needs a real pluralisation library —
|
|
94
|
+
// flagged, not fixed, since it's a correctness trade-off, not a clear bug.
|
|
95
|
+
return modelName
|
|
96
|
+
.replace(/^nxf_/, '')
|
|
97
|
+
.replace(/_([a-z])/g, (_, c) => c.toUpperCase())
|
|
98
|
+
.replace(/^([a-z])/, (_, c) => c.toUpperCase())
|
|
99
|
+
.replace(/s$/, '');
|
|
100
|
+
}
|
|
101
|
+
function modelToFileName(modelName) {
|
|
102
|
+
// nxf_products → products
|
|
103
|
+
// FIX: was .replace(/_/g, '_') — replacing every underscore with itself,
|
|
104
|
+
// a complete no-op. Underscores are now correctly preserved as-is (this
|
|
105
|
+
// function only needs to strip the nxf_ prefix); removed the dead
|
|
106
|
+
// replace call rather than guessing what it was originally meant to do.
|
|
107
|
+
return modelName.replace(/^nxf_/, '');
|
|
108
|
+
}
|
|
109
|
+
function filterProjectData(data) {
|
|
110
|
+
let { models, pages } = data;
|
|
111
|
+
if (data.filter_models?.length) {
|
|
112
|
+
const names = data.filter_models.map((m) => m.toLowerCase());
|
|
113
|
+
models = models.filter((m) => names.some((n) => m.name.toLowerCase().includes(n)));
|
|
114
|
+
}
|
|
115
|
+
if (data.filter_pages?.length) {
|
|
116
|
+
const names = data.filter_pages.map((p) => p.toLowerCase());
|
|
117
|
+
pages = pages.filter((p) => names.some((n) => p.name.toLowerCase().includes(n) || p.slug.toLowerCase().includes(n)));
|
|
118
|
+
}
|
|
119
|
+
return { ...data, models, pages };
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/schema/parser.ts"],"names":[],"mappings":";AAAA,wEAAwE;;AAIxE,0CA8EC;AAED,8CAEC;AAED,sCAEC;AAED,4CAYC;AAED,0CAOC;AAED,8CAkBC;AAjID,SAAgB,eAAe,CAAC,GAAc;IAO5C,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,KAAK,KAAK,CAAA;IAEvC,QAAQ,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,MAAM;YACT,OAAO;gBACL,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;gBACzC,MAAM,EAAI,QAAQ;gBAClB,QAAQ;gBACR,QAAQ,EAAE,SAAS,GAAG,CAAC,IAAI,eAAe;gBAC1C,MAAM,EAAI,IAAI,GAAG,C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C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACzB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACxF,CAAA;IACH,CAAC;IAED,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AACnC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export interface ColumnDef {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
ui_type?: string;
|
|
5
|
+
is_primary?: boolean;
|
|
6
|
+
nullable?: boolean;
|
|
7
|
+
unique?: boolean;
|
|
8
|
+
default?: any;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
options?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface ModelSchema {
|
|
14
|
+
version: string;
|
|
15
|
+
columns: ColumnDef[];
|
|
16
|
+
hooks?: any[];
|
|
17
|
+
integrations?: any[];
|
|
18
|
+
}
|
|
19
|
+
export interface Model {
|
|
20
|
+
sm_id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
slug?: string;
|
|
23
|
+
schema: ModelSchema;
|
|
24
|
+
project_id: string;
|
|
25
|
+
tenant_id: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PageDef {
|
|
28
|
+
page_id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
slug: string;
|
|
31
|
+
template_type: string;
|
|
32
|
+
nav_type?: string;
|
|
33
|
+
model_id?: string | null;
|
|
34
|
+
visibility?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PageRoute {
|
|
37
|
+
route_id: string;
|
|
38
|
+
from_page_id: string;
|
|
39
|
+
to_page_id: string;
|
|
40
|
+
trigger: string;
|
|
41
|
+
label?: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface ThemeData {
|
|
44
|
+
colours: Record<string, string>;
|
|
45
|
+
typography: {
|
|
46
|
+
headingFont: string;
|
|
47
|
+
bodyFont: string;
|
|
48
|
+
monoFont: string;
|
|
49
|
+
headingWeight: string;
|
|
50
|
+
bodyWeight: string;
|
|
51
|
+
scale: string;
|
|
52
|
+
};
|
|
53
|
+
spacing: {
|
|
54
|
+
radius: string;
|
|
55
|
+
density: string;
|
|
56
|
+
shadow: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface EndpointDef {
|
|
60
|
+
endpoint_id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
method: string;
|
|
63
|
+
path: string;
|
|
64
|
+
model_name: string;
|
|
65
|
+
operation: string;
|
|
66
|
+
}
|
|
67
|
+
export interface IntegrationDef {
|
|
68
|
+
provider_slug: string;
|
|
69
|
+
config: Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
export interface ProjectData {
|
|
72
|
+
project_id: string;
|
|
73
|
+
project_name: string;
|
|
74
|
+
project_type: string;
|
|
75
|
+
models: Model[];
|
|
76
|
+
pages: PageDef[];
|
|
77
|
+
routes: PageRoute[];
|
|
78
|
+
theme: ThemeData;
|
|
79
|
+
state_manager: 'riverpod' | 'bloc' | 'provider';
|
|
80
|
+
source: 'hosted' | 'core';
|
|
81
|
+
filter_models?: string[] | null;
|
|
82
|
+
filter_pages?: string[] | null;
|
|
83
|
+
endpoints?: EndpointDef[];
|
|
84
|
+
integrations?: IntegrationDef[];
|
|
85
|
+
}
|
|
86
|
+
export interface GeneratedFile {
|
|
87
|
+
path: string;
|
|
88
|
+
content: string;
|
|
89
|
+
category: 'generated' | 'customizable' | 'root';
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAEA,MA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AC/B,SAAS,CAAC,EAAK,WAAW,EAAE,CAAA;IAC5B,YAAY,CAAC,EAAE,cAAc,EAAE,CAAA;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAM,MAAM,CAAA;IAChB,OAAO,EAAG,MAAM,CAAA;IAChB,QAAQ,EAAE,WAAW,GAAG,cAAc,GAAG,MAAM,CAAA;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":";AAAA,uEAAuE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../src/theme/mapper.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapper.js","sourceRoot":"","sources":["../../src/theme/mapper.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@underpeaks/generator-core",
|
|
3
|
+
"version": "1.0.20",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsc --watch",
|
|
12
|
+
"clean": "rm -rf dist"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.0.0",
|
|
16
|
+
"@types/node": "^20.0.0"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
}
|
|
21
|
+
}
|