create-windy 0.2.28 → 0.2.29
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/cli.js
CHANGED
|
@@ -4337,7 +4337,8 @@ var recipes = [
|
|
|
4337
4337
|
{ id: "starter-0.2.24-to-0.2.25", from: "0.2.24", to: "0.2.25" },
|
|
4338
4338
|
{ id: "starter-0.2.25-to-0.2.26", from: "0.2.25", to: "0.2.26" },
|
|
4339
4339
|
{ id: "starter-0.2.26-to-0.2.27", from: "0.2.26", to: "0.2.27" },
|
|
4340
|
-
{ id: "starter-0.2.27-to-0.2.28", from: "0.2.27", to: "0.2.28" }
|
|
4340
|
+
{ id: "starter-0.2.27-to-0.2.28", from: "0.2.27", to: "0.2.28" },
|
|
4341
|
+
{ id: "starter-0.2.28-to-0.2.29", from: "0.2.28", to: "0.2.29" }
|
|
4341
4342
|
];
|
|
4342
4343
|
function resolveRecipeChain(sourceVersion, targetVersion) {
|
|
4343
4344
|
if (sourceVersion === targetVersion)
|
|
@@ -4436,8 +4437,13 @@ var known026DownstreamHashes = new Map([
|
|
|
4436
4437
|
[
|
|
4437
4438
|
"apps/server/src/module-bootstrap.ts",
|
|
4438
4439
|
"4b79ab5d0271b3111c7cb546e0b581d483da8c5de263f8d2f9671d53f60c5099"
|
|
4440
|
+
],
|
|
4441
|
+
[
|
|
4442
|
+
"apps/web/src/router/router-test-fixtures.ts",
|
|
4443
|
+
"e498fa34cf6ab6dbabf014ec11233772f30995dceab250ff4f993323834ebc82"
|
|
4439
4444
|
]
|
|
4440
4445
|
]);
|
|
4446
|
+
var known026RouterHash = "55a60a28d7a8e88386a38cab763b1eac43d66a11e60b84a21acefacc29c6f44d";
|
|
4441
4447
|
var known023DownstreamHashes = new Map([
|
|
4442
4448
|
[
|
|
4443
4449
|
"apps/server/src/http-app.ts",
|
|
@@ -4494,23 +4500,9 @@ function repairKnown026Downstream(input) {
|
|
|
4494
4500
|
if (known026DownstreamHashes.get(input.path) === contentHash(input.content)) {
|
|
4495
4501
|
return input.targetContent;
|
|
4496
4502
|
}
|
|
4497
|
-
if (input.path === "apps/web/src/router/index.ts" && input.targetContent.includes("@/pages/auth/LoginPage.vue")) {
|
|
4498
|
-
return replaceKnown(input.content,
|
|
4499
|
-
}
|
|
4500
|
-
if (input.path !== "apps/web/src/router/router-test-fixtures.ts" || input.targetContent.includes("lijian.")) {
|
|
4501
|
-
return;
|
|
4502
|
-
}
|
|
4503
|
-
const replacements2 = [
|
|
4504
|
-
["lijian.case.read", "case.read"],
|
|
4505
|
-
["lijian.evidence.read", "evidence.read"],
|
|
4506
|
-
["lijian.case", "case"],
|
|
4507
|
-
["lijian.evidence.import", "evidence.import"],
|
|
4508
|
-
["lijian.evidence", "evidence"]
|
|
4509
|
-
];
|
|
4510
|
-
if (!replacements2.every(([source]) => input.content.includes(source))) {
|
|
4511
|
-
return;
|
|
4503
|
+
if (input.path === "apps/web/src/router/index.ts" && contentHash(input.content) === known026RouterHash && input.targetContent.includes("@/pages/auth/LoginPage.vue")) {
|
|
4504
|
+
return replaceKnown(input.content, /import LoginPage from "@\/app\/auth\/[^"\n]+LoginPage\.vue";/, 'import LoginPage from "@/pages/auth/LoginPage.vue";');
|
|
4512
4505
|
}
|
|
4513
|
-
return replacements2.reduce((content, [source, target]) => content.replaceAll(source, target), input.content);
|
|
4514
4506
|
}
|
|
4515
4507
|
function repairKnown023Downstream(input) {
|
|
4516
4508
|
if (input.sourceVersion !== "0.2.23" || known023DownstreamHashes.get(input.path) !== contentHash(input.content)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { WebAccessSnapshot } from "@/layout/navigation";
|
|
2
|
+
import type { RouteRecordRaw } from "vue-router";
|
|
2
3
|
// @windy-module system.license begin
|
|
3
4
|
import type { PlatformLicenseSnapshot } from "@/services/license-api";
|
|
4
5
|
// @windy-module system.license end
|
|
6
|
+
import { routes } from "./index";
|
|
5
7
|
|
|
6
8
|
export function provider(snapshot: WebAccessSnapshot) {
|
|
7
9
|
return { refresh: async () => snapshot };
|
|
@@ -41,6 +43,7 @@ export function authProvider(
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export function accessSnapshot(): WebAccessSnapshot {
|
|
46
|
+
const routeAccess = collectRouteAccess(routes);
|
|
44
47
|
return {
|
|
45
48
|
actor: {
|
|
46
49
|
id: "user_1",
|
|
@@ -51,6 +54,7 @@ export function accessSnapshot(): WebAccessSnapshot {
|
|
|
51
54
|
"system.admin.access",
|
|
52
55
|
"system.audit.read",
|
|
53
56
|
"system.feature.read",
|
|
57
|
+
...routeAccess.permissionKeys,
|
|
54
58
|
],
|
|
55
59
|
},
|
|
56
60
|
menus: [],
|
|
@@ -70,6 +74,34 @@ export function accessSnapshot(): WebAccessSnapshot {
|
|
|
70
74
|
allowed: true,
|
|
71
75
|
reason: "allowed",
|
|
72
76
|
},
|
|
77
|
+
...routeAccess.featureKeys.map((key) => ({
|
|
78
|
+
key,
|
|
79
|
+
enabled: true,
|
|
80
|
+
visible: "visible" as const,
|
|
81
|
+
allowed: true,
|
|
82
|
+
reason: "allowed" as const,
|
|
83
|
+
})),
|
|
73
84
|
],
|
|
74
85
|
};
|
|
75
86
|
}
|
|
87
|
+
|
|
88
|
+
export function collectRouteAccess(routeRecords: RouteRecordRaw[]) {
|
|
89
|
+
const permissionKeys = new Set<string>();
|
|
90
|
+
const featureKeys = new Set<string>();
|
|
91
|
+
const visit = (records: RouteRecordRaw[]) => {
|
|
92
|
+
for (const route of records) {
|
|
93
|
+
if (typeof route.meta?.permissionKey === "string") {
|
|
94
|
+
permissionKeys.add(route.meta.permissionKey);
|
|
95
|
+
}
|
|
96
|
+
if (typeof route.meta?.featureKey === "string") {
|
|
97
|
+
featureKeys.add(route.meta.featureKey);
|
|
98
|
+
}
|
|
99
|
+
if (route.children) visit(route.children);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
visit(routeRecords);
|
|
103
|
+
return {
|
|
104
|
+
permissionKeys: [...permissionKeys],
|
|
105
|
+
featureKeys: [...featureKeys],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
|
+
import type { RouteRecordRaw } from "vue-router";
|
|
2
3
|
import routerSource from "./index.ts?raw";
|
|
3
4
|
import fixtureSource from "./router-test-fixtures.ts?raw";
|
|
5
|
+
import { collectRouteAccess } from "./router-test-fixtures";
|
|
4
6
|
|
|
5
7
|
describe("Router shared-scaffold 中性契约", () => {
|
|
6
8
|
test("平台登录页与测试快照不固化下游产品命名", () => {
|
|
@@ -11,4 +13,32 @@ describe("Router shared-scaffold 中性契约", () => {
|
|
|
11
13
|
/LijianLoginPage|lijian\./,
|
|
12
14
|
);
|
|
13
15
|
});
|
|
16
|
+
|
|
17
|
+
test("测试快照从项目路由递归派生真实访问键", () => {
|
|
18
|
+
const projectRoutes: RouteRecordRaw[] = [
|
|
19
|
+
{
|
|
20
|
+
path: "/records",
|
|
21
|
+
component: {},
|
|
22
|
+
meta: {
|
|
23
|
+
permissionKey: "records.read",
|
|
24
|
+
featureKey: "records",
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
path: "import",
|
|
29
|
+
component: {},
|
|
30
|
+
meta: {
|
|
31
|
+
permissionKey: "records.import",
|
|
32
|
+
featureKey: "records.import",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
expect(collectRouteAccess(projectRoutes)).toEqual({
|
|
40
|
+
permissionKeys: ["records.read", "records.import"],
|
|
41
|
+
featureKeys: ["records", "records.import"],
|
|
42
|
+
});
|
|
43
|
+
});
|
|
14
44
|
});
|