@jskit-ai/crud-server-generator 0.1.46 → 0.1.48
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
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.48",
|
|
5
5
|
kind: "generator",
|
|
6
6
|
description: "CRUD server generator with routes, actions, and persistence scaffolding.",
|
|
7
7
|
options: {
|
|
@@ -151,13 +151,13 @@ export default Object.freeze({
|
|
|
151
151
|
mutations: {
|
|
152
152
|
dependencies: {
|
|
153
153
|
runtime: {
|
|
154
|
-
"@jskit-ai/auth-core": "0.1.
|
|
155
|
-
"@jskit-ai/crud-core": "0.1.
|
|
156
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
157
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
158
|
-
"@jskit-ai/kernel": "0.1.
|
|
159
|
-
"@jskit-ai/realtime": "0.1.
|
|
160
|
-
"@jskit-ai/users-core": "0.1.
|
|
154
|
+
"@jskit-ai/auth-core": "0.1.39",
|
|
155
|
+
"@jskit-ai/crud-core": "0.1.48",
|
|
156
|
+
"@jskit-ai/database-runtime": "0.1.40",
|
|
157
|
+
"@jskit-ai/http-runtime": "0.1.39",
|
|
158
|
+
"@jskit-ai/kernel": "0.1.40",
|
|
159
|
+
"@jskit-ai/realtime": "0.1.39",
|
|
160
|
+
"@jskit-ai/users-core": "0.1.50",
|
|
161
161
|
"@local/${option:namespace|kebab}": "file:packages/${option:namespace|kebab}",
|
|
162
162
|
"typebox": "^1.0.81"
|
|
163
163
|
},
|
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.48",
|
|
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.48",
|
|
17
|
+
"@jskit-ai/database-runtime": "0.1.40",
|
|
18
|
+
"@jskit-ai/http-runtime": "0.1.39",
|
|
19
|
+
"@jskit-ai/kernel": "0.1.40",
|
|
20
|
+
"@jskit-ai/users-core": "0.1.50",
|
|
21
21
|
"recast": "^0.23.11",
|
|
22
22
|
"typebox": "^1.0.81"
|
|
23
23
|
}
|
|
@@ -1434,8 +1434,8 @@ function renderRouteWorkspaceSupportImports({ surfaceRequiresWorkspace = true }
|
|
|
1434
1434
|
}
|
|
1435
1435
|
|
|
1436
1436
|
return [
|
|
1437
|
-
'import { routeParamsValidator } from "@jskit-ai/
|
|
1438
|
-
'import { buildWorkspaceInputFromRouteParams } from "@jskit-ai/
|
|
1437
|
+
'import { routeParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";',
|
|
1438
|
+
'import { buildWorkspaceInputFromRouteParams } from "@jskit-ai/workspaces-core/server/support/workspaceRouteInput";'
|
|
1439
1439
|
].join("\n");
|
|
1440
1440
|
}
|
|
1441
1441
|
|
|
@@ -1444,7 +1444,7 @@ function renderActionWorkspaceValidatorImport({ surfaceRequiresWorkspace = true
|
|
|
1444
1444
|
return "";
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
|
-
return 'import { workspaceSlugParamsValidator } from "@jskit-ai/
|
|
1447
|
+
return 'import { workspaceSlugParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";';
|
|
1448
1448
|
}
|
|
1449
1449
|
|
|
1450
1450
|
function renderRouteParamsValidatorLine(operation = "", { surfaceRequiresWorkspace = true } = {}) {
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
recordIdParamsValidator
|
|
11
11
|
} from "@jskit-ai/kernel/shared/validators";
|
|
12
|
-
import { checkRouteVisibility } from "@jskit-ai/
|
|
13
|
-
import {
|
|
12
|
+
import { checkRouteVisibility } from "@jskit-ai/kernel/shared/support/visibility";
|
|
13
|
+
import { resolveScopedApiBasePath } from "@jskit-ai/kernel/shared/surface";
|
|
14
14
|
import { actionIds } from "./actionIds.js";
|
|
15
15
|
import { resource } from "../shared/${option:namespace|singular|camel}Resource.js";
|
|
16
16
|
import { LIST_CONFIG } from "./listConfig.js";
|
|
@@ -29,9 +29,10 @@ function registerRoutes(
|
|
|
29
29
|
) {
|
|
30
30
|
const router = app.make("jskit.http.router");
|
|
31
31
|
const normalizedRouteSurface = normalizeSurfaceId(routeSurface);
|
|
32
|
-
const routeBase =
|
|
33
|
-
|
|
34
|
-
relativePath: routeRelativePath
|
|
32
|
+
const routeBase = resolveScopedApiBasePath({
|
|
33
|
+
routeBase: __JSKIT_CRUD_ROUTE_SURFACE_REQUIRES_WORKSPACE__ ? "/w/:workspaceSlug" : "/",
|
|
34
|
+
relativePath: routeRelativePath,
|
|
35
|
+
strictParams: false
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
router.register(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test, { after } from "node:test";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveScopedApiBasePath } from "@jskit-ai/kernel/shared/surface";
|
|
4
4
|
import { recordIdParamsValidator } from "@jskit-ai/kernel/shared/validators";
|
|
5
5
|
import { createTemplateServerFixture } from "../test-support/templateServerFixture.js";
|
|
6
6
|
|
|
@@ -61,9 +61,10 @@ test("crud routes build create/update action input with explicit payload and pat
|
|
|
61
61
|
routeRelativePath: "/customers"
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
const workspaceRouteBase =
|
|
65
|
-
|
|
66
|
-
relativePath: "/customers"
|
|
64
|
+
const workspaceRouteBase = resolveScopedApiBasePath({
|
|
65
|
+
routeBase: "/w/:workspaceSlug",
|
|
66
|
+
relativePath: "/customers",
|
|
67
|
+
strictParams: false
|
|
67
68
|
});
|
|
68
69
|
const createRoute = findRoute(registeredRoutes, "POST", workspaceRouteBase);
|
|
69
70
|
const updateRoute = findRoute(registeredRoutes, "PATCH", `${workspaceRouteBase}/:recordId`);
|
|
@@ -233,9 +234,10 @@ test("crud routes validate route ownership filter values before registering visi
|
|
|
233
234
|
/must be one of/
|
|
234
235
|
);
|
|
235
236
|
|
|
236
|
-
const workspaceRouteBase =
|
|
237
|
-
|
|
238
|
-
relativePath: "/customers"
|
|
237
|
+
const workspaceRouteBase = resolveScopedApiBasePath({
|
|
238
|
+
routeBase: "/w/:workspaceSlug",
|
|
239
|
+
relativePath: "/customers",
|
|
240
|
+
strictParams: false
|
|
239
241
|
});
|
|
240
242
|
const workspaceUserRoute = findRoute(registeredRoutes, "GET", workspaceRouteBase);
|
|
241
243
|
|
|
@@ -268,9 +270,10 @@ test("crud list route forwards normalized query input from list query validators
|
|
|
268
270
|
routeRelativePath: "/customers"
|
|
269
271
|
});
|
|
270
272
|
|
|
271
|
-
const workspaceRouteBase =
|
|
272
|
-
|
|
273
|
-
relativePath: "/customers"
|
|
273
|
+
const workspaceRouteBase = resolveScopedApiBasePath({
|
|
274
|
+
routeBase: "/w/:workspaceSlug",
|
|
275
|
+
relativePath: "/customers",
|
|
276
|
+
strictParams: false
|
|
274
277
|
});
|
|
275
278
|
const listRoute = findRoute(registeredRoutes, "GET", workspaceRouteBase);
|
|
276
279
|
assert.ok(listRoute);
|
|
@@ -333,9 +336,10 @@ test("crud view route forwards include query input", async () => {
|
|
|
333
336
|
routeRelativePath: "/customers"
|
|
334
337
|
});
|
|
335
338
|
|
|
336
|
-
const workspaceRouteBase =
|
|
337
|
-
|
|
338
|
-
relativePath: "/customers"
|
|
339
|
+
const workspaceRouteBase = resolveScopedApiBasePath({
|
|
340
|
+
routeBase: "/w/:workspaceSlug",
|
|
341
|
+
relativePath: "/customers",
|
|
342
|
+
strictParams: false
|
|
339
343
|
});
|
|
340
344
|
const viewRoute = findRoute(registeredRoutes, "GET", `${workspaceRouteBase}/:recordId`);
|
|
341
345
|
assert.ok(viewRoute);
|
|
@@ -21,12 +21,12 @@ function buildTemplateReplacements({
|
|
|
21
21
|
} = {}) {
|
|
22
22
|
const routeWorkspaceSupportImports = surfaceRequiresWorkspace
|
|
23
23
|
? [
|
|
24
|
-
'import { routeParamsValidator } from "@jskit-ai/
|
|
25
|
-
'import { buildWorkspaceInputFromRouteParams } from "@jskit-ai/
|
|
24
|
+
'import { routeParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";',
|
|
25
|
+
'import { buildWorkspaceInputFromRouteParams } from "@jskit-ai/workspaces-core/server/support/workspaceRouteInput";'
|
|
26
26
|
].join("\n")
|
|
27
27
|
: "";
|
|
28
28
|
const actionWorkspaceValidatorImport = surfaceRequiresWorkspace
|
|
29
|
-
? 'import { workspaceSlugParamsValidator } from "@jskit-ai/
|
|
29
|
+
? 'import { workspaceSlugParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";'
|
|
30
30
|
: "";
|
|
31
31
|
const actionPermissionSupport = requiresNamedPermissions
|
|
32
32
|
? [
|