@jskit-ai/crud-server-generator 0.1.40 → 0.1.42
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/package.descriptor.mjs +42 -17
- package/package.json +6 -6
- package/src/server/buildTemplateContext.js +583 -46
- package/src/shared/crud/crudResource.js +7 -5
- package/templates/migrations/crud_initial.cjs +1 -0
- package/templates/src/local-package/server/CrudProvider.js +1 -2
- package/templates/src/local-package/server/actions.js +12 -50
- package/templates/src/local-package/server/registerRoutes.js +12 -21
- package/templates/src/local-package/server/repository.js +4 -0
- package/templates/src/local-package/shared/crudResource.js +2 -2
- package/test/addFieldSubcommand.test.js +12 -6
- package/test/buildTemplateContext.test.js +384 -39
- package/test/crudResource.test.js +1 -1
- package/test/crudServerGuards.test.js +21 -18
- package/test/packageDescriptor.test.js +52 -0
- package/test/routeInputContracts.test.js +63 -16
- package/test-support/templateServerFixture.js +134 -23
package/package.descriptor.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Object.freeze({
|
|
2
2
|
packageVersion: 1,
|
|
3
3
|
packageId: "@jskit-ai/crud-server-generator",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.42",
|
|
5
5
|
kind: "generator",
|
|
6
6
|
description: "CRUD server generator with routes, actions, and persistence scaffolding.",
|
|
7
7
|
options: {
|
|
@@ -13,16 +13,18 @@ export default Object.freeze({
|
|
|
13
13
|
promptHint: "Required slug (example: customers, appointments, vendors)."
|
|
14
14
|
},
|
|
15
15
|
surface: {
|
|
16
|
-
required:
|
|
16
|
+
required: false,
|
|
17
17
|
inputType: "text",
|
|
18
18
|
validationType: "enabled-surface-id",
|
|
19
19
|
promptLabel: "Target surface",
|
|
20
|
-
promptHint: "
|
|
20
|
+
promptHint: "Optional for non-workspace apps; otherwise must match an enabled surface id."
|
|
21
21
|
},
|
|
22
22
|
"ownership-filter": {
|
|
23
23
|
required: true,
|
|
24
24
|
inputType: "text",
|
|
25
25
|
defaultValue: "auto",
|
|
26
|
+
validationType: "enum",
|
|
27
|
+
allowedValues: ["auto", "public", "user", "workspace", "workspace_user"],
|
|
26
28
|
promptLabel: "Ownership filter",
|
|
27
29
|
promptHint: "auto | public | user | workspace | workspace_user"
|
|
28
30
|
},
|
|
@@ -34,11 +36,12 @@ export default Object.freeze({
|
|
|
34
36
|
promptHint: "Optional subpath prepended to the CRUD route path (example: crm or ops/team-a)."
|
|
35
37
|
},
|
|
36
38
|
"table-name": {
|
|
37
|
-
required:
|
|
39
|
+
required: false,
|
|
38
40
|
inputType: "text",
|
|
39
41
|
defaultValue: "",
|
|
42
|
+
defaultFromOptionTemplate: "${option:namespace}",
|
|
40
43
|
promptLabel: "Table name",
|
|
41
|
-
promptHint: "
|
|
44
|
+
promptHint: "Existing MySQL table to introspect for CRUD schema generation (defaults to namespace)."
|
|
42
45
|
},
|
|
43
46
|
"id-column": {
|
|
44
47
|
required: false,
|
|
@@ -148,13 +151,13 @@ export default Object.freeze({
|
|
|
148
151
|
mutations: {
|
|
149
152
|
dependencies: {
|
|
150
153
|
runtime: {
|
|
151
|
-
"@jskit-ai/auth-core": "0.1.
|
|
152
|
-
"@jskit-ai/crud-core": "0.1.
|
|
153
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
154
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
155
|
-
"@jskit-ai/kernel": "0.1.
|
|
156
|
-
"@jskit-ai/realtime": "0.1.
|
|
157
|
-
"@jskit-ai/users-core": "0.1.
|
|
154
|
+
"@jskit-ai/auth-core": "0.1.33",
|
|
155
|
+
"@jskit-ai/crud-core": "0.1.42",
|
|
156
|
+
"@jskit-ai/database-runtime": "0.1.34",
|
|
157
|
+
"@jskit-ai/http-runtime": "0.1.33",
|
|
158
|
+
"@jskit-ai/kernel": "0.1.34",
|
|
159
|
+
"@jskit-ai/realtime": "0.1.33",
|
|
160
|
+
"@jskit-ai/users-core": "0.1.44",
|
|
158
161
|
"@local/${option:namespace|kebab}": "file:packages/${option:namespace|kebab}",
|
|
159
162
|
"typebox": "^1.0.81"
|
|
160
163
|
},
|
|
@@ -208,7 +211,11 @@ export default Object.freeze({
|
|
|
208
211
|
to: "packages/${option:namespace|kebab}/src/server/actions.js",
|
|
209
212
|
reason: "Install app-local CRUD action definitions.",
|
|
210
213
|
category: "crud",
|
|
211
|
-
id: "crud-local-package-server-actions-${option:namespace|snake}"
|
|
214
|
+
id: "crud-local-package-server-actions-${option:namespace|snake}",
|
|
215
|
+
templateContext: {
|
|
216
|
+
entrypoint: "src/server/buildTemplateContext.js",
|
|
217
|
+
export: "buildTemplateContext"
|
|
218
|
+
}
|
|
212
219
|
},
|
|
213
220
|
{
|
|
214
221
|
from: "templates/src/local-package/server/actionIds.js",
|
|
@@ -217,12 +224,27 @@ export default Object.freeze({
|
|
|
217
224
|
category: "crud",
|
|
218
225
|
id: "crud-local-package-server-action-ids-${option:namespace|snake}"
|
|
219
226
|
},
|
|
227
|
+
{
|
|
228
|
+
from: "templates/src/local-package/server/listConfig.js",
|
|
229
|
+
to: "packages/${option:namespace|kebab}/src/server/listConfig.js",
|
|
230
|
+
reason: "Install app-local CRUD list configuration.",
|
|
231
|
+
category: "crud",
|
|
232
|
+
id: "crud-local-package-server-list-config-${option:namespace|snake}",
|
|
233
|
+
templateContext: {
|
|
234
|
+
entrypoint: "src/server/buildTemplateContext.js",
|
|
235
|
+
export: "buildTemplateContext"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
220
238
|
{
|
|
221
239
|
from: "templates/src/local-package/server/registerRoutes.js",
|
|
222
240
|
to: "packages/${option:namespace|kebab}/src/server/registerRoutes.js",
|
|
223
241
|
reason: "Install app-local CRUD route registration.",
|
|
224
242
|
category: "crud",
|
|
225
|
-
id: "crud-local-package-server-routes-${option:namespace|snake}"
|
|
243
|
+
id: "crud-local-package-server-routes-${option:namespace|snake}",
|
|
244
|
+
templateContext: {
|
|
245
|
+
entrypoint: "src/server/buildTemplateContext.js",
|
|
246
|
+
export: "buildTemplateContext"
|
|
247
|
+
}
|
|
226
248
|
},
|
|
227
249
|
{
|
|
228
250
|
from: "templates/src/local-package/server/repository.js",
|
|
@@ -267,11 +289,14 @@ export default Object.freeze({
|
|
|
267
289
|
file: "config/roles.js",
|
|
268
290
|
position: "bottom",
|
|
269
291
|
skipIfContains: "\"crud.${option:namespace|snake}.list\"",
|
|
270
|
-
value:
|
|
271
|
-
"\nroleCatalog.roles.member.permissions.push(\n \"crud.${option:namespace|snake}.list\",\n \"crud.${option:namespace|snake}.view\",\n \"crud.${option:namespace|snake}.create\",\n \"crud.${option:namespace|snake}.update\",\n \"crud.${option:namespace|snake}.delete\"\n);\n",
|
|
292
|
+
value: "__JSKIT_CRUD_ROLE_CATALOG_PERMISSION_GRANTS__",
|
|
272
293
|
reason: "Grant generated CRUD action permissions to the default member role in the app-owned role catalog.",
|
|
273
294
|
category: "crud",
|
|
274
|
-
id: "crud-role-catalog-permissions-${option:namespace|snake}"
|
|
295
|
+
id: "crud-role-catalog-permissions-${option:namespace|snake}",
|
|
296
|
+
templateContext: {
|
|
297
|
+
entrypoint: "src/server/buildTemplateContext.js",
|
|
298
|
+
export: "buildTemplateContext"
|
|
299
|
+
}
|
|
275
300
|
}
|
|
276
301
|
]
|
|
277
302
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/crud-server-generator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/parser": "^7.29.2",
|
|
16
|
-
"@jskit-ai/crud-core": "0.1.
|
|
17
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
18
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
19
|
-
"@jskit-ai/kernel": "0.1.
|
|
20
|
-
"@jskit-ai/users-core": "0.1.
|
|
16
|
+
"@jskit-ai/crud-core": "0.1.42",
|
|
17
|
+
"@jskit-ai/database-runtime": "0.1.34",
|
|
18
|
+
"@jskit-ai/http-runtime": "0.1.33",
|
|
19
|
+
"@jskit-ai/kernel": "0.1.34",
|
|
20
|
+
"@jskit-ai/users-core": "0.1.44",
|
|
21
21
|
"recast": "^0.23.11",
|
|
22
22
|
"typebox": "^1.0.81"
|
|
23
23
|
}
|