@stalfh233/omc-fake-platform 0.6.28 → 0.6.30

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/perm.js CHANGED
@@ -4,6 +4,36 @@ export const permRoute = (ctx, input) => {
4
4
  const q = input.query ?? {};
5
5
  const body = (input.body ?? {});
6
6
  const groups = [...ctx.state.permissionGroups.values()].filter((g) => !q.appCode || g.appCode === q.appCode);
7
+ if (input.path === "/api/api/system/permission/get_apppackage" && input.method === "GET")
8
+ return { appCode: q.appCode, permissionGroups: groups };
9
+ if (input.path === "/api/api/system/permission/get_group" && input.method === "GET") {
10
+ const g = ctx.state.permissionGroups.get(String(q.id));
11
+ if (!g)
12
+ return businessRefusal(404, "权限组不存在");
13
+ return { ...g, functionPermissions: g.scopes, dataPermissionGroups: g.scopes };
14
+ }
15
+ if (input.path === "/api/api/system/permission/getGroupBySchemaCode" && input.method === "GET") {
16
+ return groups.length ? { id: groups[0].id, appCode: groups[0].appCode, name: groups[0].name, dataPermissionGroups: groups.flatMap((g) => g.scopes) } : {};
17
+ }
18
+ if ((input.path === "/api/api/system/permission/update_group" || input.path === "/api/api/system/permission/updatePermissionGroupAndFunction") && (input.method === "POST" || input.method === "PUT")) {
19
+ const id = String(body.id || `perm-${ctx.state.permissionGroups.size + 1}`);
20
+ const prior = ctx.state.permissionGroups.get(id);
21
+ const g = { id, appCode: String(body.appCode), name: String(body.name || prior?.name || ""), code: String(body.code || prior?.code || id), internalUser: body.internalUser !== false, externalUser: body.externalUser === true, remarks: body.remarks ?? prior?.remarks ?? null, members: prior?.members ?? [], scopes: Array.isArray(body.functionPermissions) ? body.functionPermissions : (prior?.scopes ?? []) };
22
+ ctx.state.permissionGroups.set(id, g);
23
+ return g;
24
+ }
25
+ if (input.path === "/api/api/system/permission/updatePermissionGroupStatus" && input.method === "POST") {
26
+ for (const item of Array.isArray(input.body) ? input.body : []) {
27
+ const g = ctx.state.permissionGroups.get(String(item.id));
28
+ if (g)
29
+ g.enabled = item.enabled;
30
+ }
31
+ return null;
32
+ }
33
+ if (input.path === "/api/api/system/permission/delete_group" && (input.method === "DELETE" || input.method === "POST")) {
34
+ ctx.state.permissionGroups.delete(String(q.id));
35
+ return null;
36
+ }
7
37
  if (input.path === "/api/api/organization/authorization/listPermissionGroups" && input.method === "POST") {
8
38
  if (!body.unitId)
9
39
  return businessRefusal(10005, "部门/角色/用户Id不能为空");
package/dist/state.d.ts CHANGED
@@ -523,7 +523,7 @@ export interface FakeState {
523
523
  }
524
524
  export interface FakeRequestInput {
525
525
  path: string;
526
- method: "GET" | "POST";
526
+ method: "GET" | "POST" | "PUT" | "DELETE";
527
527
  query?: Record<string, string>;
528
528
  body?: unknown;
529
529
  headers?: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-fake-platform",
3
- "version": "0.6.28",
3
+ "version": "0.6.30",
4
4
  "description": "OMC 的内存假 CloudPivot 平台(wire 接缝的第二个适配器)+ HTTP 假服务器——@stalfh233/omc-cli 的测试与 bench 基准基座",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "build": "tsc --project tsconfig.build.json"
19
19
  },
20
20
  "dependencies": {
21
- "omc-core": "0.6.28"
21
+ "omc-core": "0.6.30"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=22.13"