@jskit-ai/crud-ui-generator 0.1.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.
@@ -0,0 +1,201 @@
1
+ export default Object.freeze({
2
+ packageVersion: 1,
3
+ packageId: "@jskit-ai/crud-ui-generator",
4
+ version: "0.1.1",
5
+ kind: "generator",
6
+ description: "Generate app-local CRUD UI scaffolds from resource validators.",
7
+ options: {
8
+ namespace: {
9
+ required: true,
10
+ inputType: "text",
11
+ defaultValue: "",
12
+ promptLabel: "UI namespace",
13
+ promptHint: "Required slug (example: contacts-alt, customers-ui, tickets-view)."
14
+ },
15
+ surface: {
16
+ required: true,
17
+ inputType: "text",
18
+ defaultFromConfig: "surfaceDefaultId",
19
+ promptLabel: "Target surface",
20
+ promptHint: "Defaults to config.public.surfaceDefaultId. Must match an enabled surface id."
21
+ },
22
+ "resource-file": {
23
+ required: true,
24
+ inputType: "text",
25
+ defaultValue: "",
26
+ promptLabel: "Resource file",
27
+ promptHint: "Relative path from app root to the resource module."
28
+ },
29
+ "resource-export": {
30
+ required: false,
31
+ inputType: "text",
32
+ defaultValue: "",
33
+ promptLabel: "Resource export",
34
+ promptHint: "Named export in the resource module (defaults to resource-file basename, example: contactResource)."
35
+ },
36
+ operations: {
37
+ required: true,
38
+ inputType: "text",
39
+ defaultValue: "",
40
+ promptLabel: "Operations",
41
+ promptHint: "Required comma-separated values from: list, view, new, edit."
42
+ },
43
+ "display-fields": {
44
+ required: false,
45
+ inputType: "text",
46
+ defaultValue: "",
47
+ promptLabel: "Display fields",
48
+ promptHint: "Optional comma-separated field keys to render (must exist in selected operation schemas)."
49
+ },
50
+ "api-path": {
51
+ required: true,
52
+ inputType: "text",
53
+ defaultValue: "",
54
+ promptLabel: "API path",
55
+ promptHint: "Base API path without trailing id (example: /crud/contacts)."
56
+ },
57
+ "route-path": {
58
+ required: true,
59
+ inputType: "text",
60
+ defaultValue: "",
61
+ promptLabel: "Route path",
62
+ promptHint: "List route path under the target surface (example: crm/contacts-alt)."
63
+ },
64
+ "id-param": {
65
+ required: false,
66
+ inputType: "text",
67
+ defaultValue: "recordId",
68
+ promptLabel: "Route id param",
69
+ promptHint: "Route param used by view and edit pages (default: recordId)."
70
+ },
71
+ "directory-prefix": {
72
+ required: false,
73
+ inputType: "text",
74
+ defaultValue: "",
75
+ promptLabel: "Page directory prefix",
76
+ promptHint: "Optional subpath under the selected surface pages root (example: crm or ops/team-a)."
77
+ }
78
+ },
79
+ dependsOn: [],
80
+ capabilities: {
81
+ provides: ["ui-generator"],
82
+ requires: []
83
+ },
84
+ runtime: {
85
+ server: {
86
+ providers: []
87
+ },
88
+ client: {
89
+ providers: []
90
+ }
91
+ },
92
+ metadata: {
93
+ apiSummary: {
94
+ surfaces: [
95
+ {
96
+ subpath: "./server/buildTemplateContext",
97
+ summary: "Builds deterministic template context values from selected resource operation validators."
98
+ }
99
+ ],
100
+ containerTokens: {
101
+ server: [],
102
+ client: []
103
+ }
104
+ }
105
+ },
106
+ mutations: {
107
+ dependencies: {
108
+ runtime: {
109
+ "@jskit-ai/users-web": "0.1.32"
110
+ },
111
+ dev: {}
112
+ },
113
+ packageJson: {
114
+ scripts: {}
115
+ },
116
+ procfile: {},
117
+ files: [
118
+ {
119
+ from: "templates/src/pages/admin/ui-generator/ListElement.vue",
120
+ toSurface: "${option:surface|lower}",
121
+ toSurfacePath: "${option:directory-prefix|pathprefix}${option:route-path|path}/index.vue",
122
+ reason: "Install generated list page.",
123
+ category: "ui-generator",
124
+ id: "ui-generator-page-list-${option:namespace|snake}",
125
+ templateContext: {
126
+ entrypoint: "src/server/buildTemplateContext.js",
127
+ export: "buildUiTemplateContext"
128
+ },
129
+ when: {
130
+ option: "operations",
131
+ in: ["list"]
132
+ }
133
+ },
134
+ {
135
+ from: "templates/src/pages/admin/ui-generator/ViewElement.vue",
136
+ toSurface: "${option:surface|lower}",
137
+ toSurfacePath: "${option:directory-prefix|pathprefix}${option:route-path|path}/[${option:id-param|trim}]/index.vue",
138
+ reason: "Install generated view page.",
139
+ category: "ui-generator",
140
+ id: "ui-generator-page-view-${option:namespace|snake}",
141
+ templateContext: {
142
+ entrypoint: "src/server/buildTemplateContext.js",
143
+ export: "buildUiTemplateContext"
144
+ },
145
+ when: {
146
+ option: "operations",
147
+ in: ["view"]
148
+ }
149
+ },
150
+ {
151
+ from: "templates/src/pages/admin/ui-generator/NewElement.vue",
152
+ toSurface: "${option:surface|lower}",
153
+ toSurfacePath: "${option:directory-prefix|pathprefix}${option:route-path|path}/new.vue",
154
+ reason: "Install generated new page.",
155
+ category: "ui-generator",
156
+ id: "ui-generator-page-new-${option:namespace|snake}",
157
+ templateContext: {
158
+ entrypoint: "src/server/buildTemplateContext.js",
159
+ export: "buildUiTemplateContext"
160
+ },
161
+ when: {
162
+ option: "operations",
163
+ in: ["new"]
164
+ }
165
+ },
166
+ {
167
+ from: "templates/src/pages/admin/ui-generator/EditElement.vue",
168
+ toSurface: "${option:surface|lower}",
169
+ toSurfacePath: "${option:directory-prefix|pathprefix}${option:route-path|path}/[${option:id-param|trim}]/edit.vue",
170
+ reason: "Install generated edit page.",
171
+ category: "ui-generator",
172
+ id: "ui-generator-page-edit-${option:namespace|snake}",
173
+ templateContext: {
174
+ entrypoint: "src/server/buildTemplateContext.js",
175
+ export: "buildUiTemplateContext"
176
+ },
177
+ when: {
178
+ option: "operations",
179
+ in: ["edit"]
180
+ }
181
+ }
182
+ ],
183
+ text: [
184
+ {
185
+ op: "append-text",
186
+ file: "src/placement.js",
187
+ position: "bottom",
188
+ skipIfContains: "jskit:ui-generator.menu:${option:namespace|kebab}:${option:directory-prefix|path}:${option:route-path|path}",
189
+ value:
190
+ "\n// jskit:ui-generator.menu:${option:namespace|kebab}:${option:directory-prefix|path}:${option:route-path|path}\n{\n addPlacement({\n id: \"ui-generator.${option:namespace|kebab}.menu\",\n host: \"shell-layout\",\n position: \"primary-menu\",\n surfaces: [\"${option:surface|lower}\"],\n order: 155,\n componentToken: \"users.web.shell.surface-aware-menu-link-item\",\n props: {\n label: \"${option:namespace|plural|pascal}\",\n surface: \"${option:surface|lower}\",\n workspaceSuffix: \"/${option:directory-prefix|pathprefix}${option:route-path|path}\",\n nonWorkspaceSuffix: \"/${option:directory-prefix|pathprefix}${option:route-path|path}\"\n },\n when: ({ auth }) => Boolean(auth?.authenticated)\n });\n}\n",
191
+ reason: "Append generated UI menu placement.",
192
+ category: "ui-generator",
193
+ id: "ui-generator-placement-menu",
194
+ when: {
195
+ option: "operations",
196
+ in: ["list"]
197
+ }
198
+ }
199
+ ]
200
+ }
201
+ });
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@jskit-ai/crud-ui-generator",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "scripts": {
6
+ "test": "node --test"
7
+ },
8
+ "exports": {
9
+ "./server/buildTemplateContext": "./src/server/buildTemplateContext.js"
10
+ }
11
+ }