plugin-git-manager 1.2.23 → 1.2.26
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/client/900.acf7d1fa22f95e71.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/900.f32b9dc85249fc0a.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -8
- package/dist/locale/en-US.json +4 -3
- package/dist/locale/vi-VN.json +4 -3
- package/dist/locale/zh-CN.json +4 -3
- package/dist/server/actions/git-actions.js +21 -8
- package/dist/server/actions/gitlab-api.js +5 -8
- package/dist/server/actions/poller.js +2 -1
- package/dist/server/actions/review.js +50 -13
- package/dist/server/actions/role-permissions.js +109 -16
- package/dist/server/actions/subtree.js +4 -8
- package/dist/server/migrations/20260730000000-migrate-legacy-repository-permissions.js +23 -7
- package/dist/server/plugin.js +42 -19
- package/dist/server/repository-access.js +505 -27
- package/dist/server/services/registry-content-service.js +149 -32
- package/dist/server/utils/get-repo-account.js +5 -2
- package/dist/server/utils/gitlab-url.js +2 -0
- package/dist/server/utils/redact.js +51 -5
- package/dist/server/utils/url-security.js +109 -0
- package/package.json +4 -2
- package/src/client/components/RunReviewButton.tsx +437 -436
- package/src/client/index.tsx +2 -1
- package/src/locale/en-US.json +4 -3
- package/src/locale/vi-VN.json +4 -3
- package/src/locale/zh-CN.json +4 -3
- package/src/server/__tests__/git-actions.test.ts +24 -0
- package/src/server/__tests__/plugin-url-security.test.ts +17 -0
- package/src/server/__tests__/poller.test.ts +37 -0
- package/src/server/__tests__/repository-access.test.ts +695 -1
- package/src/server/__tests__/review.test.ts +137 -0
- package/src/server/__tests__/role-permissions.test.ts +123 -2
- package/src/server/actions/git-actions.ts +33 -10
- package/src/server/actions/gitlab-api.ts +5 -8
- package/src/server/actions/poller.ts +2 -1
- package/src/server/actions/review.ts +74 -15
- package/src/server/actions/role-permissions.ts +136 -14
- package/src/server/actions/subtree.ts +4 -8
- package/src/server/migrations/20260730000000-migrate-legacy-repository-permissions.ts +23 -8
- package/src/server/plugin.ts +46 -25
- package/src/server/repository-access.ts +737 -28
- package/src/server/services/__tests__/registry-content-service.test.ts +209 -13
- package/src/server/services/registry-content-service.ts +473 -315
- package/src/server/utils/__tests__/redact.test.ts +56 -0
- package/src/server/utils/__tests__/url-security.test.ts +85 -0
- package/src/server/utils/get-repo-account.ts +22 -4
- package/src/server/utils/gitlab-url.ts +3 -0
- package/src/server/utils/redact.ts +68 -5
- package/src/server/utils/url-security.ts +95 -0
- package/dist/client/900.ee2fa037aff389e2.js +0 -10
- package/dist/client-v2/900.bef1c41d267e50c5.js +0 -10
package/src/client/index.tsx
CHANGED
|
@@ -18,7 +18,7 @@ const GitAccounts = React.lazy(() =>
|
|
|
18
18
|
// Reuse the v2 subtree UI here so the feature is available in both runtimes.
|
|
19
19
|
const SubtreeSplits = React.lazy(() => import('../client-v2/components/SubtreeSplits'));
|
|
20
20
|
|
|
21
|
-
import PluginACLClient from
|
|
21
|
+
import PluginACLClient from "@nocobase/plugin-acl";
|
|
22
22
|
import { RepositoryPermissions } from './components/RepositoryPermissions';
|
|
23
23
|
|
|
24
24
|
export class PluginGitManagerClient extends Plugin {
|
|
@@ -80,3 +80,4 @@ export class PluginGitManagerClient extends Plugin {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export default PluginGitManagerClient;
|
|
83
|
+
|
package/src/locale/en-US.json
CHANGED
|
@@ -290,7 +290,8 @@
|
|
|
290
290
|
"Policy": "Policy",
|
|
291
291
|
"Split SHA": "Split SHA",
|
|
292
292
|
"Target before": "Target before",
|
|
293
|
-
"Target after": "Target after"
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
"Target after": "Target after",
|
|
294
|
+
"Execution mode": "Execution mode",
|
|
295
|
+
"App process": "App process",
|
|
296
|
+
"Credential-bearing URLs are not allowed": "Credential-bearing URLs are not allowed"
|
|
296
297
|
}
|
package/src/locale/vi-VN.json
CHANGED
|
@@ -285,7 +285,8 @@
|
|
|
285
285
|
"Policy": "Chính sách",
|
|
286
286
|
"Split SHA": "SHA subtree",
|
|
287
287
|
"Target before": "Nhánh đích trước đó",
|
|
288
|
-
"Target after": "Nhánh đích sau đó"
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
"Target after": "Nhánh đích sau đó",
|
|
289
|
+
"Execution mode": "Chế độ thực thi",
|
|
290
|
+
"App process": "App process",
|
|
291
|
+
"Credential-bearing URLs are not allowed": "URL không được chứa tên người dùng hoặc thông tin xác thực"
|
|
291
292
|
}
|
package/src/locale/zh-CN.json
CHANGED
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"Split SHA": "拆分 SHA",
|
|
45
45
|
"Target before": "更新前目标",
|
|
46
46
|
"Target after": "更新后目标",
|
|
47
|
-
"Error": "错误"
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
"Error": "错误",
|
|
48
|
+
"Execution mode": "执行模式",
|
|
49
|
+
"App process": "应用进程",
|
|
50
|
+
"Credential-bearing URLs are not allowed": "URL 中不允许包含用户名或凭据"
|
|
50
51
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Context } from '@nocobase/actions';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { getRepo } from '../actions/git-actions';
|
|
5
|
+
|
|
6
|
+
describe('Git Manager git actions', () => {
|
|
7
|
+
it('uses the repository ID from the request body over the URL parameter', async () => {
|
|
8
|
+
const repository = { id: 20 };
|
|
9
|
+
const findOne = vi.fn().mockResolvedValue(repository);
|
|
10
|
+
const context = {
|
|
11
|
+
action: { params: { repositoryId: 10 } },
|
|
12
|
+
request: { body: { repositoryId: 20 } },
|
|
13
|
+
db: {
|
|
14
|
+
getRepository: vi.fn().mockReturnValue({ findOne }),
|
|
15
|
+
},
|
|
16
|
+
throw: vi.fn(),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const result = await getRepo(context as unknown as Context);
|
|
20
|
+
|
|
21
|
+
expect(findOne).toHaveBeenCalledWith({ filterByTk: 20 });
|
|
22
|
+
expect(result).toBe(repository);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { isGitConfigurationUrlMutation } from '../plugin';
|
|
4
|
+
|
|
5
|
+
describe('Git Manager generic URL mutation policy', () => {
|
|
6
|
+
it('covers direct and association collection create/update routes', () => {
|
|
7
|
+
expect(isGitConfigurationUrlMutation('gitRepositories', 'create')).toBe(true);
|
|
8
|
+
expect(isGitConfigurationUrlMutation('gitAccounts', 'update')).toBe(true);
|
|
9
|
+
expect(isGitConfigurationUrlMutation('gitAccounts.repositories', 'update')).toBe(true);
|
|
10
|
+
expect(isGitConfigurationUrlMutation('gitRepositories.10.gitAccount', 'create')).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('does not treat a read or a custom Git Manager action as a generic URL mutation', () => {
|
|
14
|
+
expect(isGitConfigurationUrlMutation('gitAccounts.repositories', 'list')).toBe(false);
|
|
15
|
+
expect(isGitConfigurationUrlMutation('gitManager', 'clone')).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Context } from '@nocobase/actions';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
vi.mock('../poller', () => ({
|
|
5
|
+
pollAllRepos: vi.fn(),
|
|
6
|
+
pollOneRepo: vi.fn(),
|
|
7
|
+
getPollerStatus: vi.fn(),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
import { pollNow } from '../actions/poller';
|
|
11
|
+
import { pollAllRepos, pollOneRepo } from '../poller';
|
|
12
|
+
|
|
13
|
+
describe('Git Manager poll action', () => {
|
|
14
|
+
it('uses a repository ID sent in the request body instead of polling every repository', async () => {
|
|
15
|
+
const repository = { id: 10 };
|
|
16
|
+
vi.mocked(pollOneRepo).mockResolvedValue({ scanned: 1, triggered: 0 });
|
|
17
|
+
const context = {
|
|
18
|
+
action: { params: {} },
|
|
19
|
+
request: { body: { repositoryId: 10 } },
|
|
20
|
+
app: {},
|
|
21
|
+
db: {
|
|
22
|
+
getRepository: vi.fn().mockReturnValue({
|
|
23
|
+
findOne: vi.fn().mockResolvedValue(repository),
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
throw: vi.fn(),
|
|
27
|
+
body: undefined as unknown,
|
|
28
|
+
};
|
|
29
|
+
const next = vi.fn().mockResolvedValue(undefined);
|
|
30
|
+
|
|
31
|
+
await pollNow(context as unknown as Context, next);
|
|
32
|
+
|
|
33
|
+
expect(pollOneRepo).toHaveBeenCalledWith(context.app, repository);
|
|
34
|
+
expect(pollAllRepos).not.toHaveBeenCalled();
|
|
35
|
+
expect(context.body).toEqual({ success: true, data: { scanned: 1, triggered: 0 } });
|
|
36
|
+
});
|
|
37
|
+
});
|