@structured-world/gitlab-mcp 10.0.1 → 11.0.0
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/README.md +6 -6
- package/README.md.in +1 -1
- package/dist/src/channel-gateway/format.js +7 -1
- package/dist/src/channel-gateway/format.js.map +1 -1
- package/dist/src/channel-gateway/forwarding.d.ts +3 -0
- package/dist/src/channel-gateway/forwarding.js +8 -1
- package/dist/src/channel-gateway/forwarding.js.map +1 -1
- package/dist/src/channel-gateway/gateway.d.ts +7 -0
- package/dist/src/channel-gateway/gateway.js +80 -16
- package/dist/src/channel-gateway/gateway.js.map +1 -1
- package/dist/src/cli/docker/container-runtime.d.ts +1 -0
- package/dist/src/cli/docker/container-runtime.js +37 -5
- package/dist/src/cli/docker/container-runtime.js.map +1 -1
- package/dist/src/cli/docker/docker-command.js +11 -2
- package/dist/src/cli/docker/docker-command.js.map +1 -1
- package/dist/src/cli/docker/docker-utils.d.ts +1 -0
- package/dist/src/cli/docker/docker-utils.js +137 -27
- package/dist/src/cli/docker/docker-utils.js.map +1 -1
- package/dist/src/cli/docker/oauth-issuer-prompt.d.ts +2 -0
- package/dist/src/cli/docker/oauth-issuer-prompt.js +47 -0
- package/dist/src/cli/docker/oauth-issuer-prompt.js.map +1 -0
- package/dist/src/cli/docker/types.d.ts +18 -4
- package/dist/src/cli/docker/types.js.map +1 -1
- package/dist/src/cli/list-tools.js +14 -35
- package/dist/src/cli/list-tools.js.map +1 -1
- package/dist/src/cli/setup/flows/server-setup.js +15 -0
- package/dist/src/cli/setup/flows/server-setup.js.map +1 -1
- package/dist/src/config/instances-loader.js +17 -3
- package/dist/src/config/instances-loader.js.map +1 -1
- package/dist/src/config/instances-schema.d.ts +6 -3
- package/dist/src/config/instances-schema.js +7 -6
- package/dist/src/config/instances-schema.js.map +1 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/configuration/caller.d.ts +10 -0
- package/dist/src/configuration/caller.js +39 -0
- package/dist/src/configuration/caller.js.map +1 -0
- package/dist/src/configuration/composed-feeds.d.ts +31 -0
- package/dist/src/configuration/composed-feeds.js +698 -0
- package/dist/src/configuration/composed-feeds.js.map +1 -0
- package/dist/src/configuration/composed-listings.d.ts +14 -0
- package/dist/src/configuration/composed-listings.js +157 -0
- package/dist/src/configuration/composed-listings.js.map +1 -0
- package/dist/src/configuration/groups.d.ts +8 -0
- package/dist/src/configuration/groups.js +39 -0
- package/dist/src/configuration/groups.js.map +1 -0
- package/dist/src/configuration/index.d.ts +6 -0
- package/dist/src/configuration/index.js +87 -0
- package/dist/src/configuration/index.js.map +1 -0
- package/dist/src/configuration/policy.d.ts +34 -0
- package/dist/src/configuration/policy.js +122 -0
- package/dist/src/configuration/policy.js.map +1 -0
- package/dist/src/configuration/scope-ids.d.ts +7 -0
- package/dist/src/configuration/scope-ids.js +78 -0
- package/dist/src/configuration/scope-ids.js.map +1 -0
- package/dist/src/configuration/scope-projects.d.ts +5 -0
- package/dist/src/configuration/scope-projects.js +76 -0
- package/dist/src/configuration/scope-projects.js.map +1 -0
- package/dist/src/configuration/scope-targets.d.ts +26 -0
- package/dist/src/configuration/scope-targets.js +307 -0
- package/dist/src/configuration/scope-targets.js.map +1 -0
- package/dist/src/configuration/scoped-execution.d.ts +6 -0
- package/dist/src/configuration/scoped-execution.js +577 -0
- package/dist/src/configuration/scoped-execution.js.map +1 -0
- package/dist/src/configuration/scoped-feeds.d.ts +22 -0
- package/dist/src/configuration/scoped-feeds.js +136 -0
- package/dist/src/configuration/scoped-feeds.js.map +1 -0
- package/dist/src/configuration/service.d.ts +53 -0
- package/dist/src/configuration/service.js +186 -0
- package/dist/src/configuration/service.js.map +1 -0
- package/dist/src/configuration/settings-store.d.ts +20 -0
- package/dist/src/configuration/settings-store.js +228 -0
- package/dist/src/configuration/settings-store.js.map +1 -0
- package/dist/src/configuration/types.d.ts +30 -0
- package/dist/src/configuration/types.js +20 -0
- package/dist/src/configuration/types.js.map +1 -0
- package/dist/src/contracts/storage.d.ts +2 -1
- package/dist/src/dashboard/html-template.js +8 -15
- package/dist/src/dashboard/html-template.js.map +1 -1
- package/dist/src/dashboard/metrics.d.ts +1 -1
- package/dist/src/entities/context/connection-check.d.ts +64 -0
- package/dist/src/entities/context/connection-check.js +117 -0
- package/dist/src/entities/context/connection-check.js.map +1 -0
- package/dist/src/entities/context/context-manager.d.ts +10 -22
- package/dist/src/entities/context/context-manager.js +108 -207
- package/dist/src/entities/context/context-manager.js.map +1 -1
- package/dist/src/entities/context/handlers.d.ts +3 -5
- package/dist/src/entities/context/handlers.js +2 -14
- package/dist/src/entities/context/handlers.js.map +1 -1
- package/dist/src/entities/context/output-schema.d.ts +272 -0
- package/dist/src/entities/context/output-schema.js +182 -0
- package/dist/src/entities/context/output-schema.js.map +1 -0
- package/dist/src/entities/context/profile.d.ts +29 -0
- package/dist/src/entities/context/profile.js +72 -0
- package/dist/src/entities/context/profile.js.map +1 -0
- package/dist/src/entities/context/registry.js +140 -3
- package/dist/src/entities/context/registry.js.map +1 -1
- package/dist/src/entities/context/schema.d.ts +6 -14
- package/dist/src/entities/context/schema.js +6 -13
- package/dist/src/entities/context/schema.js.map +1 -1
- package/dist/src/entities/context/scope-search.d.ts +49 -0
- package/dist/src/entities/context/scope-search.js +71 -0
- package/dist/src/entities/context/scope-search.js.map +1 -0
- package/dist/src/entities/context/settings-panel.d.ts +13 -0
- package/dist/src/entities/context/settings-panel.js +508 -0
- package/dist/src/entities/context/settings-panel.js.map +1 -0
- package/dist/src/entities/context/settings.d.ts +78 -0
- package/dist/src/entities/context/settings.js +239 -0
- package/dist/src/entities/context/settings.js.map +1 -0
- package/dist/src/entities/context/types.d.ts +3 -4
- package/dist/src/entities/context/whoami.js +39 -31
- package/dist/src/entities/context/whoami.js.map +1 -1
- package/dist/src/entities/core/registry.js +34 -33
- package/dist/src/entities/core/registry.js.map +1 -1
- package/dist/src/entities/environments/schema-readonly.d.ts +3 -3
- package/dist/src/entities/files/registry.js +3 -2
- package/dist/src/entities/files/registry.js.map +1 -1
- package/dist/src/entities/iterations/registry.js +3 -2
- package/dist/src/entities/iterations/registry.js.map +1 -1
- package/dist/src/entities/mrs/registry.js +11 -5
- package/dist/src/entities/mrs/registry.js.map +1 -1
- package/dist/src/entities/mrs/schema-readonly.d.ts +8 -2
- package/dist/src/entities/mrs/schema-readonly.js +31 -3
- package/dist/src/entities/mrs/schema-readonly.js.map +1 -1
- package/dist/src/entities/pipelines/registry.js +3 -2
- package/dist/src/entities/pipelines/registry.js.map +1 -1
- package/dist/src/entities/pipelines/schema-readonly.d.ts +3 -3
- package/dist/src/entities/runners/project-access.d.ts +14 -0
- package/dist/src/entities/runners/project-access.js +64 -0
- package/dist/src/entities/runners/project-access.js.map +1 -0
- package/dist/src/entities/runners/registry.js +54 -26
- package/dist/src/entities/runners/registry.js.map +1 -1
- package/dist/src/entities/search/schema-readonly.d.ts +28 -28
- package/dist/src/graphql/runners.d.ts +26 -1
- package/dist/src/graphql/runners.js +43 -6
- package/dist/src/graphql/runners.js.map +1 -1
- package/dist/src/graphql/vulnerabilities.d.ts +3 -0
- package/dist/src/graphql/vulnerabilities.js +1 -0
- package/dist/src/graphql/vulnerabilities.js.map +1 -1
- package/dist/src/handlers.js +218 -142
- package/dist/src/handlers.js.map +1 -1
- package/dist/src/logger.d.ts +3 -2
- package/dist/src/mcp-apps.d.ts +6 -0
- package/dist/src/mcp-apps.js +8 -0
- package/dist/src/mcp-apps.js.map +1 -0
- package/dist/src/middleware/mcp-auth-routes.d.ts +3 -0
- package/dist/src/middleware/mcp-auth-routes.js +9 -0
- package/dist/src/middleware/mcp-auth-routes.js.map +1 -0
- package/dist/src/middleware/oauth-auth.js +83 -23
- package/dist/src/middleware/oauth-auth.js.map +1 -1
- package/dist/src/middleware/rate-limiter.js +11 -10
- package/dist/src/middleware/rate-limiter.js.map +1 -1
- package/dist/src/oauth/authorization-response.d.ts +1 -0
- package/dist/src/oauth/authorization-response.js +14 -0
- package/dist/src/oauth/authorization-response.js.map +1 -0
- package/dist/src/oauth/client-auth.d.ts +16 -0
- package/dist/src/oauth/client-auth.js +73 -0
- package/dist/src/oauth/client-auth.js.map +1 -0
- package/dist/src/oauth/config.d.ts +2 -0
- package/dist/src/oauth/config.js +37 -0
- package/dist/src/oauth/config.js.map +1 -1
- package/dist/src/oauth/endpoints/authorize.d.ts +1 -0
- package/dist/src/oauth/endpoints/authorize.js +361 -102
- package/dist/src/oauth/endpoints/authorize.js.map +1 -1
- package/dist/src/oauth/endpoints/callback.js +78 -41
- package/dist/src/oauth/endpoints/callback.js.map +1 -1
- package/dist/src/oauth/endpoints/index.d.ts +1 -0
- package/dist/src/oauth/endpoints/index.js +3 -1
- package/dist/src/oauth/endpoints/index.js.map +1 -1
- package/dist/src/oauth/endpoints/metadata.d.ts +1 -1
- package/dist/src/oauth/endpoints/metadata.js +23 -8
- package/dist/src/oauth/endpoints/metadata.js.map +1 -1
- package/dist/src/oauth/endpoints/register.d.ts +3 -2
- package/dist/src/oauth/endpoints/register.js +70 -19
- package/dist/src/oauth/endpoints/register.js.map +1 -1
- package/dist/src/oauth/endpoints/revoke.d.ts +2 -0
- package/dist/src/oauth/endpoints/revoke.js +97 -0
- package/dist/src/oauth/endpoints/revoke.js.map +1 -0
- package/dist/src/oauth/endpoints/token.js +136 -62
- package/dist/src/oauth/endpoints/token.js.map +1 -1
- package/dist/src/oauth/gitlab-device-flow.d.ts +27 -8
- package/dist/src/oauth/gitlab-device-flow.js +119 -57
- package/dist/src/oauth/gitlab-device-flow.js.map +1 -1
- package/dist/src/oauth/gitlab-request-bound.d.ts +1 -0
- package/dist/src/oauth/gitlab-request-bound.js +6 -0
- package/dist/src/oauth/gitlab-request-bound.js.map +1 -0
- package/dist/src/oauth/gitlab-token-refresh.d.ts +6 -0
- package/dist/src/oauth/gitlab-token-refresh.js +130 -0
- package/dist/src/oauth/gitlab-token-refresh.js.map +1 -0
- package/dist/src/oauth/granted-scopes.d.ts +1 -0
- package/dist/src/oauth/granted-scopes.js +7 -0
- package/dist/src/oauth/granted-scopes.js.map +1 -0
- package/dist/src/oauth/index.d.ts +2 -2
- package/dist/src/oauth/index.js +4 -2
- package/dist/src/oauth/index.js.map +1 -1
- package/dist/src/oauth/instance-app.d.ts +4 -0
- package/dist/src/oauth/instance-app.js +45 -0
- package/dist/src/oauth/instance-app.js.map +1 -0
- package/dist/src/oauth/issued-tokens.d.ts +1 -0
- package/dist/src/oauth/issued-tokens.js +24 -0
- package/dist/src/oauth/issued-tokens.js.map +1 -0
- package/dist/src/oauth/oauth-app.d.ts +9 -0
- package/dist/src/oauth/oauth-app.js +14 -0
- package/dist/src/oauth/oauth-app.js.map +1 -0
- package/dist/src/oauth/request-params.d.ts +1 -0
- package/dist/src/oauth/request-params.js +17 -0
- package/dist/src/oauth/request-params.js.map +1 -0
- package/dist/src/oauth/resource.d.ts +12 -0
- package/dist/src/oauth/resource.js +66 -0
- package/dist/src/oauth/resource.js.map +1 -0
- package/dist/src/oauth/routes.d.ts +2 -0
- package/dist/src/oauth/routes.js +31 -0
- package/dist/src/oauth/routes.js.map +1 -0
- package/dist/src/oauth/session-store.d.ts +44 -36
- package/dist/src/oauth/session-store.js +125 -253
- package/dist/src/oauth/session-store.js.map +1 -1
- package/dist/src/oauth/storage/factory.js +1 -1
- package/dist/src/oauth/storage/factory.js.map +1 -1
- package/dist/src/oauth/storage/file.d.ts +23 -1
- package/dist/src/oauth/storage/file.js +168 -36
- package/dist/src/oauth/storage/file.js.map +1 -1
- package/dist/src/oauth/storage/memory.d.ts +23 -1
- package/dist/src/oauth/storage/memory.js +120 -22
- package/dist/src/oauth/storage/memory.js.map +1 -1
- package/dist/src/oauth/storage/types.d.ts +17 -1
- package/dist/src/oauth/storage/types.js.map +1 -1
- package/dist/src/oauth/tool-auth.d.ts +12 -0
- package/dist/src/oauth/tool-auth.js +108 -0
- package/dist/src/oauth/tool-auth.js.map +1 -0
- package/dist/src/oauth/types.d.ts +30 -0
- package/dist/src/profiles/scope-enforcer.d.ts +8 -0
- package/dist/src/profiles/scope-enforcer.js +86 -24
- package/dist/src/profiles/scope-enforcer.js.map +1 -1
- package/dist/src/profiles/types.js +4 -1
- package/dist/src/profiles/types.js.map +1 -1
- package/dist/src/registry-manager.d.ts +16 -4
- package/dist/src/registry-manager.js +115 -33
- package/dist/src/registry-manager.js.map +1 -1
- package/dist/src/server.js +66 -39
- package/dist/src/server.js.map +1 -1
- package/dist/src/services/ConnectionManager.d.ts +2 -1
- package/dist/src/services/ConnectionManager.js +26 -19
- package/dist/src/services/ConnectionManager.js.map +1 -1
- package/dist/src/services/TokenScopeDetector.d.ts +5 -1
- package/dist/src/services/TokenScopeDetector.js +19 -0
- package/dist/src/services/TokenScopeDetector.js.map +1 -1
- package/dist/src/session-manager.d.ts +3 -1
- package/dist/src/session-manager.js +35 -10
- package/dist/src/session-manager.js.map +1 -1
- package/dist/src/types.d.ts +3 -2
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/bounded-map.d.ts +1 -0
- package/dist/src/utils/bounded-map.js +23 -0
- package/dist/src/utils/bounded-map.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +0 -1
- package/dist/src/utils/fetch.js +2 -12
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/gitlab-api.js +2 -1
- package/dist/src/utils/gitlab-api.js.map +1 -1
- package/dist/src/utils/gitlab-base-url.d.ts +2 -0
- package/dist/src/utils/gitlab-base-url.js +30 -0
- package/dist/src/utils/gitlab-base-url.js.map +1 -0
- package/dist/src/utils/html.d.ts +1 -0
- package/dist/src/utils/html.js +12 -0
- package/dist/src/utils/html.js.map +1 -0
- package/dist/src/utils/namespace.d.ts +1 -0
- package/dist/src/utils/namespace.js +72 -24
- package/dist/src/utils/namespace.js.map +1 -1
- package/dist/src/utils/schema-utils.d.ts +5 -3
- package/dist/src/utils/schema-utils.js +50 -22
- package/dist/src/utils/schema-utils.js.map +1 -1
- package/dist/src/utils/smart-user-search.js +2 -1
- package/dist/src/utils/smart-user-search.js.map +1 -1
- package/dist/src/utils/sync-directory.d.ts +1 -0
- package/dist/src/utils/sync-directory.js +49 -0
- package/dist/src/utils/sync-directory.js.map +1 -0
- package/dist/src/utils/tool-result.d.ts +4 -0
- package/dist/src/utils/tool-result.js +41 -0
- package/dist/src/utils/tool-result.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +65 -18
- package/skills/gitlab-ci/SKILL.md +16 -0
- package/skills/gitlab-discovery/SKILL.md +15 -0
- package/skills/gitlab-review/SKILL.md +16 -0
- package/skills/gitlab-setup/SKILL.md +16 -0
- package/skills/gitlab-work-items/SKILL.md +16 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const ContextOutputSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
action: z.ZodLiteral<"show">;
|
|
4
|
+
data: z.ZodObject<{
|
|
5
|
+
host: z.ZodString;
|
|
6
|
+
apiUrl: z.ZodString;
|
|
7
|
+
presetName: z.ZodOptional<z.ZodString>;
|
|
8
|
+
readOnly: z.ZodBoolean;
|
|
9
|
+
disabledToolGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
type: z.ZodEnum<{
|
|
12
|
+
project: "project";
|
|
13
|
+
group: "group";
|
|
14
|
+
}>;
|
|
15
|
+
path: z.ZodString;
|
|
16
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
|
+
includeSubgroups: z.ZodBoolean;
|
|
18
|
+
detected: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
oauthMode: z.ZodBoolean;
|
|
21
|
+
initialContext: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
host: z.ZodString;
|
|
23
|
+
apiUrl: z.ZodString;
|
|
24
|
+
presetName: z.ZodOptional<z.ZodString>;
|
|
25
|
+
readOnly: z.ZodBoolean;
|
|
26
|
+
disabledToolGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
type: z.ZodEnum<{
|
|
29
|
+
project: "project";
|
|
30
|
+
group: "group";
|
|
31
|
+
}>;
|
|
32
|
+
path: z.ZodString;
|
|
33
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
includeSubgroups: z.ZodBoolean;
|
|
35
|
+
detected: z.ZodBoolean;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
oauthMode: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
action: z.ZodLiteral<"list_presets">;
|
|
42
|
+
data: z.ZodArray<z.ZodObject<{
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
description: z.ZodOptional<z.ZodString>;
|
|
45
|
+
readOnly: z.ZodBoolean;
|
|
46
|
+
isBuiltIn: z.ZodBoolean;
|
|
47
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
project: z.ZodOptional<z.ZodString>;
|
|
49
|
+
group: z.ZodOptional<z.ZodString>;
|
|
50
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
51
|
+
projects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
includeSubgroups: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
action: z.ZodLiteral<"whoami">;
|
|
59
|
+
data: z.ZodObject<{
|
|
60
|
+
user: z.ZodNullable<z.ZodObject<{
|
|
61
|
+
id: z.ZodNumber;
|
|
62
|
+
username: z.ZodString;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
email: z.ZodOptional<z.ZodString>;
|
|
65
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
66
|
+
isAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
adminModeActive: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
state: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
userLookup: z.ZodEnum<{
|
|
71
|
+
failed: "failed";
|
|
72
|
+
rejected: "rejected";
|
|
73
|
+
ok: "ok";
|
|
74
|
+
}>;
|
|
75
|
+
token: z.ZodNullable<z.ZodObject<{
|
|
76
|
+
type: z.ZodEnum<{
|
|
77
|
+
oauth: "oauth";
|
|
78
|
+
unknown: "unknown";
|
|
79
|
+
personal_access_token: "personal_access_token";
|
|
80
|
+
project_access_token: "project_access_token";
|
|
81
|
+
group_access_token: "group_access_token";
|
|
82
|
+
}>;
|
|
83
|
+
name: z.ZodNullable<z.ZodString>;
|
|
84
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
85
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
86
|
+
daysUntilExpiry: z.ZodNullable<z.ZodNumber>;
|
|
87
|
+
isValid: z.ZodBoolean;
|
|
88
|
+
hasGraphQLAccess: z.ZodBoolean;
|
|
89
|
+
hasWriteAccess: z.ZodBoolean;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
server: z.ZodObject<{
|
|
92
|
+
host: z.ZodString;
|
|
93
|
+
apiUrl: z.ZodString;
|
|
94
|
+
version: z.ZodString;
|
|
95
|
+
tier: z.ZodEnum<{
|
|
96
|
+
unknown: "unknown";
|
|
97
|
+
free: "free";
|
|
98
|
+
premium: "premium";
|
|
99
|
+
ultimate: "ultimate";
|
|
100
|
+
}>;
|
|
101
|
+
edition: z.ZodEnum<{
|
|
102
|
+
unknown: "unknown";
|
|
103
|
+
EE: "EE";
|
|
104
|
+
CE: "CE";
|
|
105
|
+
}>;
|
|
106
|
+
readOnlyMode: z.ZodBoolean;
|
|
107
|
+
oauthEnabled: z.ZodBoolean;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
capabilities: z.ZodObject<{
|
|
110
|
+
canBrowse: z.ZodBoolean;
|
|
111
|
+
canManage: z.ZodBoolean;
|
|
112
|
+
canAccessGraphQL: z.ZodBoolean;
|
|
113
|
+
availableToolCount: z.ZodNumber;
|
|
114
|
+
totalToolCount: z.ZodNumber;
|
|
115
|
+
filteredByScopes: z.ZodNumber;
|
|
116
|
+
filteredByReadOnly: z.ZodNumber;
|
|
117
|
+
filteredByTier: z.ZodNumber;
|
|
118
|
+
filteredByDeniedRegex: z.ZodNumber;
|
|
119
|
+
filteredByActionDenial: z.ZodNumber;
|
|
120
|
+
filteredByAdmin: z.ZodNumber;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
context: z.ZodObject<{
|
|
123
|
+
activePreset: z.ZodNullable<z.ZodString>;
|
|
124
|
+
scope: z.ZodNullable<z.ZodObject<{
|
|
125
|
+
type: z.ZodEnum<{
|
|
126
|
+
project: "project";
|
|
127
|
+
group: "group";
|
|
128
|
+
}>;
|
|
129
|
+
path: z.ZodString;
|
|
130
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
|
+
includeSubgroups: z.ZodBoolean;
|
|
132
|
+
detected: z.ZodBoolean;
|
|
133
|
+
}, z.core.$strip>>;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
warnings: z.ZodArray<z.ZodString>;
|
|
136
|
+
recommendations: z.ZodArray<z.ZodObject<{
|
|
137
|
+
action: z.ZodEnum<{
|
|
138
|
+
create_new_token: "create_new_token";
|
|
139
|
+
add_scope: "add_scope";
|
|
140
|
+
enable_oauth: "enable_oauth";
|
|
141
|
+
contact_admin: "contact_admin";
|
|
142
|
+
enable_admin_mode: "enable_admin_mode";
|
|
143
|
+
renew_token: "renew_token";
|
|
144
|
+
}>;
|
|
145
|
+
message: z.ZodString;
|
|
146
|
+
url: z.ZodOptional<z.ZodString>;
|
|
147
|
+
priority: z.ZodEnum<{
|
|
148
|
+
high: "high";
|
|
149
|
+
low: "low";
|
|
150
|
+
medium: "medium";
|
|
151
|
+
}>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
scopesRefreshed: z.ZodBoolean;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
action: z.ZodLiteral<"switch_preset">;
|
|
157
|
+
data: z.ZodObject<{
|
|
158
|
+
success: z.ZodBoolean;
|
|
159
|
+
previous: z.ZodOptional<z.ZodString>;
|
|
160
|
+
current: z.ZodString;
|
|
161
|
+
message: z.ZodString;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
action: z.ZodLiteral<"set_scope">;
|
|
165
|
+
data: z.ZodObject<{
|
|
166
|
+
success: z.ZodBoolean;
|
|
167
|
+
scope: z.ZodObject<{
|
|
168
|
+
type: z.ZodEnum<{
|
|
169
|
+
project: "project";
|
|
170
|
+
group: "group";
|
|
171
|
+
}>;
|
|
172
|
+
path: z.ZodString;
|
|
173
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
|
+
includeSubgroups: z.ZodBoolean;
|
|
175
|
+
detected: z.ZodBoolean;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
message: z.ZodString;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
+
action: z.ZodLiteral<"clear_scope">;
|
|
181
|
+
data: z.ZodObject<{
|
|
182
|
+
success: z.ZodBoolean;
|
|
183
|
+
message: z.ZodString;
|
|
184
|
+
context: z.ZodObject<{
|
|
185
|
+
host: z.ZodString;
|
|
186
|
+
apiUrl: z.ZodString;
|
|
187
|
+
presetName: z.ZodOptional<z.ZodString>;
|
|
188
|
+
readOnly: z.ZodBoolean;
|
|
189
|
+
disabledToolGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
190
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
191
|
+
type: z.ZodEnum<{
|
|
192
|
+
project: "project";
|
|
193
|
+
group: "group";
|
|
194
|
+
}>;
|
|
195
|
+
path: z.ZodString;
|
|
196
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
197
|
+
includeSubgroups: z.ZodBoolean;
|
|
198
|
+
detected: z.ZodBoolean;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
oauthMode: z.ZodBoolean;
|
|
201
|
+
initialContext: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
host: z.ZodString;
|
|
203
|
+
apiUrl: z.ZodString;
|
|
204
|
+
presetName: z.ZodOptional<z.ZodString>;
|
|
205
|
+
readOnly: z.ZodBoolean;
|
|
206
|
+
disabledToolGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
207
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
type: z.ZodEnum<{
|
|
209
|
+
project: "project";
|
|
210
|
+
group: "group";
|
|
211
|
+
}>;
|
|
212
|
+
path: z.ZodString;
|
|
213
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
214
|
+
includeSubgroups: z.ZodBoolean;
|
|
215
|
+
detected: z.ZodBoolean;
|
|
216
|
+
}, z.core.$strip>>;
|
|
217
|
+
oauthMode: z.ZodBoolean;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
action: z.ZodLiteral<"reset">;
|
|
223
|
+
data: z.ZodObject<{
|
|
224
|
+
success: z.ZodBoolean;
|
|
225
|
+
message: z.ZodString;
|
|
226
|
+
context: z.ZodObject<{
|
|
227
|
+
host: z.ZodString;
|
|
228
|
+
apiUrl: z.ZodString;
|
|
229
|
+
presetName: z.ZodOptional<z.ZodString>;
|
|
230
|
+
readOnly: z.ZodBoolean;
|
|
231
|
+
disabledToolGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
232
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
233
|
+
type: z.ZodEnum<{
|
|
234
|
+
project: "project";
|
|
235
|
+
group: "group";
|
|
236
|
+
}>;
|
|
237
|
+
path: z.ZodString;
|
|
238
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
239
|
+
includeSubgroups: z.ZodBoolean;
|
|
240
|
+
detected: z.ZodBoolean;
|
|
241
|
+
}, z.core.$strip>>;
|
|
242
|
+
oauthMode: z.ZodBoolean;
|
|
243
|
+
initialContext: z.ZodOptional<z.ZodObject<{
|
|
244
|
+
host: z.ZodString;
|
|
245
|
+
apiUrl: z.ZodString;
|
|
246
|
+
presetName: z.ZodOptional<z.ZodString>;
|
|
247
|
+
readOnly: z.ZodBoolean;
|
|
248
|
+
disabledToolGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
249
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
250
|
+
type: z.ZodEnum<{
|
|
251
|
+
project: "project";
|
|
252
|
+
group: "group";
|
|
253
|
+
}>;
|
|
254
|
+
path: z.ZodString;
|
|
255
|
+
additionalPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
256
|
+
includeSubgroups: z.ZodBoolean;
|
|
257
|
+
detected: z.ZodBoolean;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
oauthMode: z.ZodBoolean;
|
|
260
|
+
}, z.core.$strip>>;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
}, z.core.$strip>], "action">, z.ZodObject<{
|
|
264
|
+
error: z.ZodUnion<readonly [z.ZodObject<{
|
|
265
|
+
error: z.ZodString;
|
|
266
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
267
|
+
error_code: z.ZodString;
|
|
268
|
+
tool: z.ZodString;
|
|
269
|
+
action: z.ZodString;
|
|
270
|
+
message: z.ZodString;
|
|
271
|
+
}, z.core.$loose>]>;
|
|
272
|
+
}, z.core.$strip>]>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ContextOutputSchema = void 0;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const scope = z.object({
|
|
39
|
+
type: z.enum(['project', 'group']),
|
|
40
|
+
path: z.string(),
|
|
41
|
+
additionalPaths: z.array(z.string()).optional(),
|
|
42
|
+
includeSubgroups: z.boolean(),
|
|
43
|
+
detected: z.boolean(),
|
|
44
|
+
});
|
|
45
|
+
const baseContext = z.object({
|
|
46
|
+
host: z.string(),
|
|
47
|
+
apiUrl: z.string(),
|
|
48
|
+
presetName: z.string().optional(),
|
|
49
|
+
readOnly: z.boolean(),
|
|
50
|
+
disabledToolGroups: z.array(z.string()).optional(),
|
|
51
|
+
scope: scope.optional(),
|
|
52
|
+
oauthMode: z.boolean(),
|
|
53
|
+
});
|
|
54
|
+
const context = baseContext.extend({ initialContext: baseContext.optional() });
|
|
55
|
+
const preset = z.object({
|
|
56
|
+
name: z.string(),
|
|
57
|
+
description: z.string().optional(),
|
|
58
|
+
readOnly: z.boolean(),
|
|
59
|
+
isBuiltIn: z.boolean(),
|
|
60
|
+
scope: z
|
|
61
|
+
.object({
|
|
62
|
+
project: z.string().optional(),
|
|
63
|
+
group: z.string().optional(),
|
|
64
|
+
namespace: z.string().optional(),
|
|
65
|
+
projects: z.array(z.string()).optional(),
|
|
66
|
+
groups: z.array(z.string()).optional(),
|
|
67
|
+
includeSubgroups: z.boolean().optional(),
|
|
68
|
+
})
|
|
69
|
+
.optional(),
|
|
70
|
+
features: z.record(z.string(), z.boolean()).optional(),
|
|
71
|
+
});
|
|
72
|
+
const switched = z.object({
|
|
73
|
+
success: z.boolean(),
|
|
74
|
+
previous: z.string().optional(),
|
|
75
|
+
current: z.string(),
|
|
76
|
+
message: z.string(),
|
|
77
|
+
});
|
|
78
|
+
const whoami = z.object({
|
|
79
|
+
user: z
|
|
80
|
+
.object({
|
|
81
|
+
id: z.number(),
|
|
82
|
+
username: z.string(),
|
|
83
|
+
name: z.string(),
|
|
84
|
+
email: z.string().optional(),
|
|
85
|
+
avatarUrl: z.string().optional(),
|
|
86
|
+
isAdmin: z.boolean().optional(),
|
|
87
|
+
adminModeActive: z.boolean().optional(),
|
|
88
|
+
state: z.string(),
|
|
89
|
+
})
|
|
90
|
+
.nullable(),
|
|
91
|
+
userLookup: z.enum(['ok', 'rejected', 'failed']),
|
|
92
|
+
token: z
|
|
93
|
+
.object({
|
|
94
|
+
type: z.enum([
|
|
95
|
+
'personal_access_token',
|
|
96
|
+
'project_access_token',
|
|
97
|
+
'group_access_token',
|
|
98
|
+
'oauth',
|
|
99
|
+
'unknown',
|
|
100
|
+
]),
|
|
101
|
+
name: z.string().nullable(),
|
|
102
|
+
scopes: z.array(z.string()),
|
|
103
|
+
expiresAt: z.string().nullable(),
|
|
104
|
+
daysUntilExpiry: z.number().nullable(),
|
|
105
|
+
isValid: z.boolean(),
|
|
106
|
+
hasGraphQLAccess: z.boolean(),
|
|
107
|
+
hasWriteAccess: z.boolean(),
|
|
108
|
+
})
|
|
109
|
+
.nullable(),
|
|
110
|
+
server: z.object({
|
|
111
|
+
host: z.string(),
|
|
112
|
+
apiUrl: z.string(),
|
|
113
|
+
version: z.string(),
|
|
114
|
+
tier: z.enum(['free', 'premium', 'ultimate', 'unknown']),
|
|
115
|
+
edition: z.enum(['EE', 'CE', 'unknown']),
|
|
116
|
+
readOnlyMode: z.boolean(),
|
|
117
|
+
oauthEnabled: z.boolean(),
|
|
118
|
+
}),
|
|
119
|
+
capabilities: z.object({
|
|
120
|
+
canBrowse: z.boolean(),
|
|
121
|
+
canManage: z.boolean(),
|
|
122
|
+
canAccessGraphQL: z.boolean(),
|
|
123
|
+
availableToolCount: z.number(),
|
|
124
|
+
totalToolCount: z.number(),
|
|
125
|
+
filteredByScopes: z.number(),
|
|
126
|
+
filteredByReadOnly: z.number(),
|
|
127
|
+
filteredByTier: z.number(),
|
|
128
|
+
filteredByDeniedRegex: z.number(),
|
|
129
|
+
filteredByActionDenial: z.number(),
|
|
130
|
+
filteredByAdmin: z.number(),
|
|
131
|
+
}),
|
|
132
|
+
context: z.object({
|
|
133
|
+
activePreset: z.string().nullable(),
|
|
134
|
+
scope: scope.nullable(),
|
|
135
|
+
}),
|
|
136
|
+
warnings: z.array(z.string()),
|
|
137
|
+
recommendations: z.array(z.object({
|
|
138
|
+
action: z.enum([
|
|
139
|
+
'create_new_token',
|
|
140
|
+
'add_scope',
|
|
141
|
+
'enable_oauth',
|
|
142
|
+
'contact_admin',
|
|
143
|
+
'enable_admin_mode',
|
|
144
|
+
'renew_token',
|
|
145
|
+
]),
|
|
146
|
+
message: z.string(),
|
|
147
|
+
url: z.string().optional(),
|
|
148
|
+
priority: z.enum(['high', 'medium', 'low']),
|
|
149
|
+
})),
|
|
150
|
+
scopesRefreshed: z.boolean(),
|
|
151
|
+
});
|
|
152
|
+
const success = z.discriminatedUnion('action', [
|
|
153
|
+
z.object({ action: z.literal('show'), data: context }),
|
|
154
|
+
z.object({ action: z.literal('list_presets'), data: z.array(preset) }),
|
|
155
|
+
z.object({ action: z.literal('whoami'), data: whoami }),
|
|
156
|
+
z.object({ action: z.literal('switch_preset'), data: switched }),
|
|
157
|
+
z.object({
|
|
158
|
+
action: z.literal('set_scope'),
|
|
159
|
+
data: z.object({ success: z.boolean(), scope, message: z.string() }),
|
|
160
|
+
}),
|
|
161
|
+
z.object({
|
|
162
|
+
action: z.literal('clear_scope'),
|
|
163
|
+
data: z.object({ success: z.boolean(), message: z.string(), context }),
|
|
164
|
+
}),
|
|
165
|
+
z.object({
|
|
166
|
+
action: z.literal('reset'),
|
|
167
|
+
data: z.object({ success: z.boolean(), message: z.string(), context }),
|
|
168
|
+
}),
|
|
169
|
+
]);
|
|
170
|
+
const error = z.object({
|
|
171
|
+
error: z.union([
|
|
172
|
+
z.object({ error: z.string() }),
|
|
173
|
+
z.looseObject({
|
|
174
|
+
error_code: z.string(),
|
|
175
|
+
tool: z.string(),
|
|
176
|
+
action: z.string(),
|
|
177
|
+
message: z.string(),
|
|
178
|
+
}),
|
|
179
|
+
]),
|
|
180
|
+
});
|
|
181
|
+
exports.ContextOutputSchema = z.union([success, error]);
|
|
182
|
+
//# sourceMappingURL=output-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-schema.js","sourceRoot":"","sources":["../../../../src/entities/context/output-schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC,CAAC;AACH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClD,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;IACvB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC;AACH,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,cAAc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CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAChC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;KACvE,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;KACvE,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;QACb,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QAC/B,CAAC,CAAC,WAAW,CAAC;YACZ,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;YACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;YAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;SACpB,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AACU,QAAA,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface AccountProfile {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
nickname?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ACCOUNT_PROFILE_OUTPUT_SCHEMA: {
|
|
8
|
+
type: "object";
|
|
9
|
+
properties: {
|
|
10
|
+
id: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
pattern: string;
|
|
14
|
+
};
|
|
15
|
+
name: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
email: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
nickname: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
required: string[];
|
|
26
|
+
additionalProperties: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function accountProfileId(instanceUrl: string, gitlabUserId: number): string;
|
|
29
|
+
export declare function getAccountProfile(): Promise<AccountProfile>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACCOUNT_PROFILE_OUTPUT_SCHEMA = void 0;
|
|
4
|
+
exports.accountProfileId = accountProfileId;
|
|
5
|
+
exports.getAccountProfile = getAccountProfile;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const logger_1 = require("../../logger");
|
|
8
|
+
const token_context_1 = require("../../oauth/token-context");
|
|
9
|
+
const fetch_1 = require("../../utils/fetch");
|
|
10
|
+
const gitlab_base_url_1 = require("../../utils/gitlab-base-url");
|
|
11
|
+
const url_1 = require("../../utils/url");
|
|
12
|
+
exports.ACCOUNT_PROFILE_OUTPUT_SCHEMA = {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
id: { type: 'string', minLength: 1, pattern: String.raw `\S` },
|
|
16
|
+
name: { type: 'string' },
|
|
17
|
+
email: { type: 'string' },
|
|
18
|
+
nickname: { type: 'string' },
|
|
19
|
+
},
|
|
20
|
+
required: ['id'],
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
};
|
|
23
|
+
function accountProfileId(instanceUrl, gitlabUserId) {
|
|
24
|
+
const digest = (0, node_crypto_1.createHash)('sha256')
|
|
25
|
+
.update(`${(0, url_1.normalizeInstanceUrl)(instanceUrl)}\n${gitlabUserId}`)
|
|
26
|
+
.digest('base64url');
|
|
27
|
+
return `gitlab:${digest}`;
|
|
28
|
+
}
|
|
29
|
+
async function fetchCurrentUser(instanceUrl) {
|
|
30
|
+
try {
|
|
31
|
+
const response = await (0, fetch_1.enhancedFetch)(`${instanceUrl}/api/v4/user`, { retry: false });
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
(0, logger_1.logDebug)('Profile: GitLab did not return the current user', { status: response.status });
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (await response.json());
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
(0, logger_1.logDebug)('Profile: failed to fetch the current user', {
|
|
40
|
+
error: error instanceof Error ? error.message : String(error),
|
|
41
|
+
});
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function instanceName(instanceUrl, label) {
|
|
46
|
+
if (label)
|
|
47
|
+
return label;
|
|
48
|
+
try {
|
|
49
|
+
return new URL(instanceUrl).host;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return instanceUrl;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function getAccountProfile() {
|
|
56
|
+
const context = (0, token_context_1.getTokenContext)();
|
|
57
|
+
const instanceUrl = (0, url_1.normalizeInstanceUrl)((0, token_context_1.getGitLabApiUrlFromContext)() ?? (0, gitlab_base_url_1.getGitLabBaseUrl)());
|
|
58
|
+
const user = await fetchCurrentUser(instanceUrl);
|
|
59
|
+
const userId = context?.gitlabUserId ?? user?.id;
|
|
60
|
+
const username = context?.gitlabUsername ?? user?.username;
|
|
61
|
+
if (userId === undefined || username === undefined) {
|
|
62
|
+
throw new Error('GitLab did not identify the account for this connection');
|
|
63
|
+
}
|
|
64
|
+
const email = user?.email ?? user?.public_email;
|
|
65
|
+
return {
|
|
66
|
+
id: accountProfileId(instanceUrl, userId),
|
|
67
|
+
...(user?.name ? { name: user.name } : {}),
|
|
68
|
+
...(email ? { email } : {}),
|
|
69
|
+
nickname: `${username} @ ${instanceName(instanceUrl, context?.instanceLabel)}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../../src/entities/context/profile.ts"],"names":[],"mappings":";;;AA8CA,4CAKC;AAiCD,8CAoBC;AA/FD,6CAAyC;AACzC,yCAAwC;AACxC,6DAAwF;AACxF,6CAAkD;AAClD,iEAA+D;AAC/D,yCAAuD;AAW1C,QAAA,6BAA6B,GAAG;IAC3C,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,IAAI,EAAE;QAC7D,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC7B;IACD,QAAQ,EAAE,CAAC,IAAI,CAAC;IAChB,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAWF,SAAgB,gBAAgB,CAAC,WAAmB,EAAE,YAAoB;IACxE,MAAM,MAAM,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SAChC,MAAM,CAAC,GAAG,IAAA,0BAAoB,EAAC,WAAW,CAAC,KAAK,YAAY,EAAE,CAAC;SAC/D,MAAM,CAAC,WAAW,CAAC,CAAC;IACvB,OAAO,UAAU,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,WAAmB;IACjD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAa,EAAC,GAAG,WAAW,cAAc,EAAE,EAAE,KAAK,EAAE,KAA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