@zereight/mcp-gitlab 2.1.16 โ 2.1.18
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 +14 -0
- package/build/index.js +348 -21
- package/build/schemas.js +178 -16
- package/build/test/schema-tests.js +105 -3
- package/build/test/test-ci-variables.js +306 -0
- package/build/test/test-dependency-proxy.js +191 -0
- package/build/test/test-geteffectiveprojectid.js +102 -0
- package/build/test/test-toolset-filtering.js +6 -0
- package/build/tools/registry.js +108 -2
- package/package.json +2 -2
package/build/schemas.js
CHANGED
|
@@ -3057,14 +3057,15 @@ export const GitLabTagSignatureSchema = z.object({
|
|
|
3057
3057
|
// --- Work item schemas (GraphQL-based) ---
|
|
3058
3058
|
// Case-insensitive work item type enum (accepts "ISSUE", "Issue", "issue")
|
|
3059
3059
|
const workItemTypeEnum = z.string().transform(v => v.toLowerCase()).pipe(z.enum(["issue", "task", "incident", "test_case", "epic", "key_result", "objective", "requirement", "ticket"]));
|
|
3060
|
+
const ProjectIdOrPathSchema = z.coerce.string().describe("Project ID, URL-encoded project path, or group path (e.g. 'group/subgroup' for group-level work items)");
|
|
3060
3061
|
// Common params for work item tools
|
|
3061
3062
|
const WorkItemParamsSchema = z.object({
|
|
3062
|
-
project_id:
|
|
3063
|
+
project_id: ProjectIdOrPathSchema,
|
|
3063
3064
|
iid: z.coerce.number().describe("The internal ID (IID) of the work item"),
|
|
3064
3065
|
});
|
|
3065
3066
|
export const GetWorkItemSchema = WorkItemParamsSchema;
|
|
3066
3067
|
export const ListWorkItemsSchema = z.object({
|
|
3067
|
-
project_id:
|
|
3068
|
+
project_id: ProjectIdOrPathSchema,
|
|
3068
3069
|
types: z
|
|
3069
3070
|
.array(workItemTypeEnum)
|
|
3070
3071
|
.optional()
|
|
@@ -3096,7 +3097,7 @@ export const ListWorkItemsSchema = z.object({
|
|
|
3096
3097
|
.describe("Cursor for pagination (from previous response's endCursor)"),
|
|
3097
3098
|
});
|
|
3098
3099
|
export const CreateWorkItemSchema = z.object({
|
|
3099
|
-
project_id:
|
|
3100
|
+
project_id: ProjectIdOrPathSchema,
|
|
3100
3101
|
title: z.string().describe("Title of the work item"),
|
|
3101
3102
|
type: workItemTypeEnum
|
|
3102
3103
|
.optional()
|
|
@@ -3166,38 +3167,38 @@ export const UpdateWorkItemSchema = WorkItemParamsSchema.extend({
|
|
|
3166
3167
|
.describe("Incident only: set escalation status"),
|
|
3167
3168
|
});
|
|
3168
3169
|
export const ConvertWorkItemTypeSchema = z.object({
|
|
3169
|
-
project_id:
|
|
3170
|
+
project_id: ProjectIdOrPathSchema,
|
|
3170
3171
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3171
3172
|
new_type: workItemTypeEnum.describe("The target work item type to convert to"),
|
|
3172
3173
|
});
|
|
3173
3174
|
export const ListWorkItemStatusesSchema = z.object({
|
|
3174
|
-
project_id:
|
|
3175
|
+
project_id: ProjectIdOrPathSchema,
|
|
3175
3176
|
work_item_type: workItemTypeEnum
|
|
3176
3177
|
.optional()
|
|
3177
3178
|
.default("issue")
|
|
3178
3179
|
.describe("The work item type to list available statuses for. Defaults to 'issue'."),
|
|
3179
3180
|
});
|
|
3180
3181
|
export const ListWorkItemNotesSchema = z.object({
|
|
3181
|
-
project_id:
|
|
3182
|
+
project_id: ProjectIdOrPathSchema,
|
|
3182
3183
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3183
3184
|
page_size: z.coerce.number().optional().default(20).describe("Number of discussions to return (default 20)"),
|
|
3184
3185
|
after: z.string().optional().describe("Cursor for pagination"),
|
|
3185
3186
|
sort: z.enum(["CREATED_ASC", "CREATED_DESC"]).optional().default("CREATED_ASC").describe("Sort order for discussions"),
|
|
3186
3187
|
});
|
|
3187
3188
|
export const CreateWorkItemNoteSchema = z.object({
|
|
3188
|
-
project_id:
|
|
3189
|
+
project_id: ProjectIdOrPathSchema,
|
|
3189
3190
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3190
3191
|
body: z.string().describe("Note body (Markdown supported)"),
|
|
3191
3192
|
internal: z.coerce.boolean().optional().default(false).describe("Create as internal/confidential note (only visible to project members)"),
|
|
3192
3193
|
discussion_id: z.string().optional().describe("Discussion ID to reply to (for threaded replies). If omitted, creates a new top-level note."),
|
|
3193
3194
|
});
|
|
3194
3195
|
export const MoveWorkItemSchema = z.object({
|
|
3195
|
-
project_id: z.coerce.string().describe("Project ID
|
|
3196
|
+
project_id: z.coerce.string().describe("Project ID, URL-encoded project path, or group path of the source namespace"),
|
|
3196
3197
|
iid: z.coerce.number().describe("The internal ID of the work item to move"),
|
|
3197
|
-
target_project_id: z.coerce.string().describe("Project ID
|
|
3198
|
+
target_project_id: z.coerce.string().describe("Project ID, URL-encoded project path, or group path of the target namespace"),
|
|
3198
3199
|
});
|
|
3199
3200
|
export const ListCustomFieldDefinitionsSchema = z.object({
|
|
3200
|
-
project_id:
|
|
3201
|
+
project_id: ProjectIdOrPathSchema,
|
|
3201
3202
|
work_item_type: workItemTypeEnum
|
|
3202
3203
|
.optional()
|
|
3203
3204
|
.default("issue")
|
|
@@ -3249,23 +3250,23 @@ export const DeleteIssueNoteEmojiReactionSchema = ProjectParamsSchema.extend({
|
|
|
3249
3250
|
});
|
|
3250
3251
|
// --- Emoji Reaction schemas (GraphQL: Work Items) ---
|
|
3251
3252
|
export const CreateWorkItemEmojiReactionSchema = z.object({
|
|
3252
|
-
project_id:
|
|
3253
|
+
project_id: ProjectIdOrPathSchema,
|
|
3253
3254
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3254
3255
|
name: emojiNameField,
|
|
3255
3256
|
});
|
|
3256
3257
|
export const DeleteWorkItemEmojiReactionSchema = z.object({
|
|
3257
|
-
project_id:
|
|
3258
|
+
project_id: ProjectIdOrPathSchema,
|
|
3258
3259
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3259
3260
|
name: emojiNameField,
|
|
3260
3261
|
});
|
|
3261
3262
|
export const CreateWorkItemNoteEmojiReactionSchema = z.object({
|
|
3262
|
-
project_id:
|
|
3263
|
+
project_id: ProjectIdOrPathSchema,
|
|
3263
3264
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3264
3265
|
note_id: z.string().describe("The GraphQL GID of the note (e.g. 'gid://gitlab/Note/123' from list_work_item_notes)"),
|
|
3265
3266
|
name: emojiNameField,
|
|
3266
3267
|
});
|
|
3267
3268
|
export const DeleteWorkItemNoteEmojiReactionSchema = z.object({
|
|
3268
|
-
project_id:
|
|
3269
|
+
project_id: ProjectIdOrPathSchema,
|
|
3269
3270
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3270
3271
|
note_id: z.string().describe("The GraphQL GID of the note (e.g. 'gid://gitlab/Note/123' from list_work_item_notes)"),
|
|
3271
3272
|
name: emojiNameField,
|
|
@@ -3287,11 +3288,11 @@ export const ListIssueNoteEmojiReactionsSchema = ProjectParamsSchema.extend({
|
|
|
3287
3288
|
discussion_id: noteEmojiDiscussionField,
|
|
3288
3289
|
});
|
|
3289
3290
|
export const ListWorkItemEmojiReactionsSchema = z.object({
|
|
3290
|
-
project_id:
|
|
3291
|
+
project_id: ProjectIdOrPathSchema,
|
|
3291
3292
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3292
3293
|
});
|
|
3293
3294
|
export const ListWorkItemNoteEmojiReactionsSchema = z.object({
|
|
3294
|
-
project_id:
|
|
3295
|
+
project_id: ProjectIdOrPathSchema,
|
|
3295
3296
|
iid: z.coerce.number().describe("The internal ID of the work item"),
|
|
3296
3297
|
note_id: z.string().describe("The GraphQL GID of the note (e.g. 'gid://gitlab/Note/123' from list_work_item_notes)"),
|
|
3297
3298
|
});
|
|
@@ -3377,3 +3378,164 @@ export const GetWebhookEventSchema = z
|
|
|
3377
3378
|
message: "Provide exactly one of project_id or group_id",
|
|
3378
3379
|
});
|
|
3379
3380
|
export const HealthCheckSchema = z.object({});
|
|
3381
|
+
// --- CI/CD Variable types ---
|
|
3382
|
+
export const GitLabCiVariableSchema = z.object({
|
|
3383
|
+
variable_type: z.enum(["env_var", "file"]).optional(),
|
|
3384
|
+
key: z.string(),
|
|
3385
|
+
value: z.string().nullable(),
|
|
3386
|
+
protected: z.boolean().optional(),
|
|
3387
|
+
masked: z.boolean().optional(),
|
|
3388
|
+
hidden: z.boolean().optional(),
|
|
3389
|
+
raw: z.boolean().optional(),
|
|
3390
|
+
environment_scope: z.string().optional(),
|
|
3391
|
+
description: z.string().nullable().optional(),
|
|
3392
|
+
});
|
|
3393
|
+
const ciVariableFields = {
|
|
3394
|
+
key: z.string().describe("The key of the variable (must match /[a-zA-Z0-9_]+/)"),
|
|
3395
|
+
value: z.string().describe("The value of the variable"),
|
|
3396
|
+
variable_type: z
|
|
3397
|
+
.enum(["env_var", "file"])
|
|
3398
|
+
.optional()
|
|
3399
|
+
.describe("The type of variable: 'env_var' (default) or 'file'"),
|
|
3400
|
+
protected: z
|
|
3401
|
+
.boolean()
|
|
3402
|
+
.optional()
|
|
3403
|
+
.describe("Whether the variable is only available on protected branches/tags"),
|
|
3404
|
+
masked: z.boolean().optional().describe("Whether the variable value is masked in job logs"),
|
|
3405
|
+
raw: z.boolean().optional().describe("Whether the variable is not expanded (treated as raw string)"),
|
|
3406
|
+
environment_scope: z
|
|
3407
|
+
.string()
|
|
3408
|
+
.optional()
|
|
3409
|
+
.describe("Environment scope (e.g. '*', 'production'). Default: '*'"),
|
|
3410
|
+
description: z.string().optional().describe("Description of the variable"),
|
|
3411
|
+
};
|
|
3412
|
+
export const ListProjectVariablesSchema = z
|
|
3413
|
+
.object({
|
|
3414
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
3415
|
+
filter: z
|
|
3416
|
+
.object({ environment_scope: z.string() })
|
|
3417
|
+
.optional()
|
|
3418
|
+
.describe("Filter by environment scope (e.g. '*', 'production')"),
|
|
3419
|
+
})
|
|
3420
|
+
.merge(PaginationOptionsSchema);
|
|
3421
|
+
export const GetProjectVariableSchema = z.object({
|
|
3422
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
3423
|
+
key: z.string().describe("The key of the variable"),
|
|
3424
|
+
filter: z
|
|
3425
|
+
.object({ environment_scope: z.string() })
|
|
3426
|
+
.optional()
|
|
3427
|
+
.describe("Filter by environment scope"),
|
|
3428
|
+
});
|
|
3429
|
+
export const CreateProjectVariableSchema = z.object({
|
|
3430
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
3431
|
+
...ciVariableFields,
|
|
3432
|
+
});
|
|
3433
|
+
export const UpdateProjectVariableSchema = z.object({
|
|
3434
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
3435
|
+
key: z.string().describe("The key of the variable to update"),
|
|
3436
|
+
value: z.string().describe("The new value of the variable"),
|
|
3437
|
+
variable_type: z.enum(["env_var", "file"]).optional().describe("The type of variable"),
|
|
3438
|
+
protected: z.boolean().optional().describe("Whether the variable is protected"),
|
|
3439
|
+
masked: z.boolean().optional().describe("Whether the variable value is masked in job logs"),
|
|
3440
|
+
raw: z.boolean().optional().describe("Whether the variable is not expanded"),
|
|
3441
|
+
environment_scope: z
|
|
3442
|
+
.string()
|
|
3443
|
+
.optional()
|
|
3444
|
+
.describe("New environment scope to assign to the variable (renames the scope, e.g. '*', 'production'). Use filter.environment_scope to identify which variable to update when multiple share the same key."),
|
|
3445
|
+
description: z.string().optional().describe("Description of the variable"),
|
|
3446
|
+
filter: z
|
|
3447
|
+
.object({ environment_scope: z.string() })
|
|
3448
|
+
.optional()
|
|
3449
|
+
.describe("Identifies which variable to update when multiple variables share the same key across different environment scopes"),
|
|
3450
|
+
});
|
|
3451
|
+
export const DeleteProjectVariableSchema = z.object({
|
|
3452
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
3453
|
+
key: z.string().describe("The key of the variable to delete"),
|
|
3454
|
+
filter: z
|
|
3455
|
+
.object({ environment_scope: z.string() })
|
|
3456
|
+
.optional()
|
|
3457
|
+
.describe("Filter by environment scope to disambiguate when multiple variables share the same key"),
|
|
3458
|
+
});
|
|
3459
|
+
export const ListGroupVariablesSchema = z
|
|
3460
|
+
.object({
|
|
3461
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3462
|
+
filter: z
|
|
3463
|
+
.object({ environment_scope: z.string() })
|
|
3464
|
+
.optional()
|
|
3465
|
+
.describe("Filter by environment scope (e.g. '*', 'production')"),
|
|
3466
|
+
})
|
|
3467
|
+
.merge(PaginationOptionsSchema);
|
|
3468
|
+
export const GetGroupVariableSchema = z.object({
|
|
3469
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3470
|
+
key: z.string().describe("The key of the variable"),
|
|
3471
|
+
filter: z
|
|
3472
|
+
.object({ environment_scope: z.string() })
|
|
3473
|
+
.optional()
|
|
3474
|
+
.describe("Filter by environment scope"),
|
|
3475
|
+
});
|
|
3476
|
+
export const CreateGroupVariableSchema = z.object({
|
|
3477
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3478
|
+
...ciVariableFields,
|
|
3479
|
+
});
|
|
3480
|
+
export const UpdateGroupVariableSchema = z.object({
|
|
3481
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3482
|
+
key: z.string().describe("The key of the variable to update"),
|
|
3483
|
+
value: z.string().describe("The new value of the variable"),
|
|
3484
|
+
variable_type: z.enum(["env_var", "file"]).optional().describe("The type of variable"),
|
|
3485
|
+
protected: z.boolean().optional().describe("Whether the variable is protected"),
|
|
3486
|
+
masked: z.boolean().optional().describe("Whether the variable value is masked in job logs"),
|
|
3487
|
+
raw: z.boolean().optional().describe("Whether the variable is not expanded"),
|
|
3488
|
+
environment_scope: z
|
|
3489
|
+
.string()
|
|
3490
|
+
.optional()
|
|
3491
|
+
.describe("New environment scope to assign to the variable (renames the scope, e.g. '*', 'production'). Use filter.environment_scope to identify which variable to update when multiple share the same key."),
|
|
3492
|
+
description: z.string().optional().describe("Description of the variable"),
|
|
3493
|
+
filter: z
|
|
3494
|
+
.object({ environment_scope: z.string() })
|
|
3495
|
+
.optional()
|
|
3496
|
+
.describe("Identifies which variable to update when multiple variables share the same key across different environment scopes"),
|
|
3497
|
+
});
|
|
3498
|
+
export const DeleteGroupVariableSchema = z.object({
|
|
3499
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3500
|
+
key: z.string().describe("The key of the variable to delete"),
|
|
3501
|
+
filter: z
|
|
3502
|
+
.object({ environment_scope: z.string() })
|
|
3503
|
+
.optional()
|
|
3504
|
+
.describe("Filter by environment scope to disambiguate when multiple variables share the same key"),
|
|
3505
|
+
});
|
|
3506
|
+
// --- Dependency Proxy types ---
|
|
3507
|
+
export const GitLabDependencyProxySchema = z.object({
|
|
3508
|
+
enabled: z.boolean(),
|
|
3509
|
+
blob_count: z.number().nullable().optional(),
|
|
3510
|
+
total_size: z.string().nullable().optional(),
|
|
3511
|
+
image_prefix: z.string().nullable().optional(),
|
|
3512
|
+
ttl_policy: z
|
|
3513
|
+
.object({
|
|
3514
|
+
enabled: z.boolean(),
|
|
3515
|
+
ttl: z.number().nullable().optional(),
|
|
3516
|
+
})
|
|
3517
|
+
.nullable()
|
|
3518
|
+
.optional(),
|
|
3519
|
+
});
|
|
3520
|
+
export const GitLabDependencyProxyBlobSchema = z.object({
|
|
3521
|
+
file_name: z.string(),
|
|
3522
|
+
size: z.string(),
|
|
3523
|
+
created_at: z.string().nullable().optional(),
|
|
3524
|
+
});
|
|
3525
|
+
export const GetDependencyProxySettingsSchema = z.object({
|
|
3526
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3527
|
+
});
|
|
3528
|
+
export const UpdateDependencyProxySettingsSchema = z.object({
|
|
3529
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3530
|
+
enabled: z.boolean().optional().describe("Enable or disable the dependency proxy"),
|
|
3531
|
+
identity: z.string().optional().describe("Proxy username for authenticated Docker Hub pulls (Premium/Ultimate)"),
|
|
3532
|
+
secret: z.string().optional().describe("Proxy password / access token for authenticated pulls"),
|
|
3533
|
+
});
|
|
3534
|
+
export const ListDependencyProxyBlobsSchema = z.object({
|
|
3535
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3536
|
+
first: z.number().int().optional().describe("Number of blobs to return (default: 20)"),
|
|
3537
|
+
after: z.string().optional().describe("Cursor for pagination (from previous response pageInfo.endCursor)"),
|
|
3538
|
+
});
|
|
3539
|
+
export const PurgeDependencyProxyCacheSchema = z.object({
|
|
3540
|
+
group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
|
|
3541
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
|
-
import { GetFileContentsSchema, GitLabFileContentSchema, GitLabRepositorySchema, CreatePipelineSchema, CreateCommitStatusSchema, ListCommitStatusesSchema, CreateIssueNoteSchema, CreateMergeRequestEmojiReactionSchema, CreateIssueEmojiReactionSchema, DeleteMergeRequestEmojiReactionSchema, DeleteIssueEmojiReactionSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, CreateIssueSchema, ListIssuesSchema, ListMergeRequestsSchema, ListLabelsSchema, GitLabMergeRequestSchema, GitLabTreeItemSchema, GetMergeRequestSchema, ListMergeRequestPipelinesSchema, GetRepositoryTreeSchema, GitLabUserFullSchema, GitLabMarkdownUploadSchema, } from '../schemas.js';
|
|
2
|
+
import { GetFileContentsSchema, GitLabFileContentSchema, GitLabRepositorySchema, CreatePipelineSchema, CreateCommitStatusSchema, ListCommitStatusesSchema, CreateIssueNoteSchema, CreateMergeRequestEmojiReactionSchema, CreateIssueEmojiReactionSchema, DeleteMergeRequestEmojiReactionSchema, DeleteIssueEmojiReactionSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, CreateIssueSchema, ListIssuesSchema, ListMergeRequestsSchema, ListLabelsSchema, GitLabMergeRequestSchema, GitLabTreeItemSchema, GetMergeRequestSchema, ListMergeRequestPipelinesSchema, GetRepositoryTreeSchema, GitLabUserFullSchema, GitLabMarkdownUploadSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, } from '../schemas.js';
|
|
3
3
|
function runGetFileContentsSchemaTests() {
|
|
4
4
|
console.log('๐งช Testing GetFileContentsSchema...');
|
|
5
5
|
const cases = [
|
|
@@ -1385,6 +1385,106 @@ function runGitLabUserFullSchemaTests() {
|
|
|
1385
1385
|
console.log(`\nResults: ${passed} passed, ${failed} failed`);
|
|
1386
1386
|
return { passed, failed };
|
|
1387
1387
|
}
|
|
1388
|
+
function runGitLabDependencyProxySchemaTests() {
|
|
1389
|
+
console.log('๐งช Testing GitLabDependencyProxySchema...');
|
|
1390
|
+
const cases = [
|
|
1391
|
+
{
|
|
1392
|
+
name: 'schema:dependency_proxy:minimal',
|
|
1393
|
+
input: { enabled: true, blob_count: 0, total_size: '0' },
|
|
1394
|
+
shouldFail: false,
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
name: 'schema:dependency_proxy:full',
|
|
1398
|
+
input: {
|
|
1399
|
+
enabled: true,
|
|
1400
|
+
blob_count: 42,
|
|
1401
|
+
total_size: '1234567890',
|
|
1402
|
+
image_prefix: 'gitlab.example.com:5050/my-group/dependency_proxy/containers',
|
|
1403
|
+
ttl_policy: { enabled: true, ttl: 90 },
|
|
1404
|
+
},
|
|
1405
|
+
shouldFail: false,
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
name: 'schema:dependency_proxy:nulls-allowed',
|
|
1409
|
+
input: { enabled: false, blob_count: null, total_size: null, image_prefix: null, ttl_policy: null },
|
|
1410
|
+
shouldFail: false,
|
|
1411
|
+
},
|
|
1412
|
+
];
|
|
1413
|
+
let passed = 0;
|
|
1414
|
+
let failed = 0;
|
|
1415
|
+
cases.forEach(testCase => {
|
|
1416
|
+
const result = { name: testCase.name, status: 'failed' };
|
|
1417
|
+
const parsed = GitLabDependencyProxySchema.safeParse(testCase.input);
|
|
1418
|
+
if (testCase.shouldFail) {
|
|
1419
|
+
result.status = parsed.success ? 'failed' : 'passed';
|
|
1420
|
+
if (parsed.success)
|
|
1421
|
+
result.error = 'Expected schema validation to fail';
|
|
1422
|
+
}
|
|
1423
|
+
else if (parsed.success) {
|
|
1424
|
+
result.status = 'passed';
|
|
1425
|
+
}
|
|
1426
|
+
else {
|
|
1427
|
+
result.error = parsed.error?.message || 'Schema validation failed';
|
|
1428
|
+
}
|
|
1429
|
+
if (result.status === 'passed') {
|
|
1430
|
+
passed++;
|
|
1431
|
+
console.log(`โ
${result.name}`);
|
|
1432
|
+
}
|
|
1433
|
+
else {
|
|
1434
|
+
failed++;
|
|
1435
|
+
console.log(`โ ${result.name}: ${result.error}`);
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
console.log(`\nResults: ${passed} passed, ${failed} failed`);
|
|
1439
|
+
return { passed, failed };
|
|
1440
|
+
}
|
|
1441
|
+
function runGitLabDependencyProxyBlobSchemaTests() {
|
|
1442
|
+
console.log('๐งช Testing GitLabDependencyProxyBlobSchema...');
|
|
1443
|
+
const cases = [
|
|
1444
|
+
{
|
|
1445
|
+
name: 'schema:dependency_proxy_blob:basic',
|
|
1446
|
+
input: { file_name: 'sha256:abc123', size: '2.5 MiB', created_at: '2026-01-01T00:00:00Z' },
|
|
1447
|
+
shouldFail: false,
|
|
1448
|
+
},
|
|
1449
|
+
{
|
|
1450
|
+
name: 'schema:dependency_proxy_blob:no-created-at',
|
|
1451
|
+
input: { file_name: 'sha256:def456', size: '512 KiB' },
|
|
1452
|
+
shouldFail: false,
|
|
1453
|
+
},
|
|
1454
|
+
{
|
|
1455
|
+
name: 'schema:dependency_proxy_blob:size-must-be-string',
|
|
1456
|
+
input: { file_name: 'sha256:ghi789', size: 12345 },
|
|
1457
|
+
shouldFail: true,
|
|
1458
|
+
},
|
|
1459
|
+
];
|
|
1460
|
+
let passed = 0;
|
|
1461
|
+
let failed = 0;
|
|
1462
|
+
cases.forEach(testCase => {
|
|
1463
|
+
const result = { name: testCase.name, status: 'failed' };
|
|
1464
|
+
const parsed = GitLabDependencyProxyBlobSchema.safeParse(testCase.input);
|
|
1465
|
+
if (testCase.shouldFail) {
|
|
1466
|
+
result.status = parsed.success ? 'failed' : 'passed';
|
|
1467
|
+
if (parsed.success)
|
|
1468
|
+
result.error = 'Expected schema validation to fail';
|
|
1469
|
+
}
|
|
1470
|
+
else if (parsed.success) {
|
|
1471
|
+
result.status = 'passed';
|
|
1472
|
+
}
|
|
1473
|
+
else {
|
|
1474
|
+
result.error = parsed.error?.message || 'Schema validation failed';
|
|
1475
|
+
}
|
|
1476
|
+
if (result.status === 'passed') {
|
|
1477
|
+
passed++;
|
|
1478
|
+
console.log(`โ
${result.name}`);
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
failed++;
|
|
1482
|
+
console.log(`โ ${result.name}: ${result.error}`);
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
console.log(`\nResults: ${passed} passed, ${failed} failed`);
|
|
1486
|
+
return { passed, failed };
|
|
1487
|
+
}
|
|
1388
1488
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
1389
1489
|
const getFileContentsResult = runGetFileContentsSchemaTests();
|
|
1390
1490
|
const fileContentResult = runGitLabFileContentSchemaTests();
|
|
@@ -1403,8 +1503,10 @@ if (import.meta.url === `file://${process.argv[1]}`) {
|
|
|
1403
1503
|
const repositoryTreeResult = runGetRepositoryTreeSchemaTests();
|
|
1404
1504
|
const gitLabUserFullResult = runGitLabUserFullSchemaTests();
|
|
1405
1505
|
const gitLabMarkdownUploadResult = runGitLabMarkdownUploadSchemaTests();
|
|
1406
|
-
const
|
|
1407
|
-
const
|
|
1506
|
+
const dependencyProxyResult = runGitLabDependencyProxySchemaTests();
|
|
1507
|
+
const dependencyProxyBlobResult = runGitLabDependencyProxyBlobSchemaTests();
|
|
1508
|
+
const totalPassed = getFileContentsResult.passed + fileContentResult.passed + createPipelineResult.passed + commitStatusResult.passed + createIssueNoteResult.passed + getMergeRequestResult.passed + listMergeRequestPipelinesResult.passed + gitLabMergeRequestResult.passed + emojiReactionResult.passed + repositorySchemaResult.passed + labelsCoercionResult.passed + approvedByUsernamesResult.passed + listLabelsResult.passed + treeItemResult.passed + repositoryTreeResult.passed + gitLabUserFullResult.passed + gitLabMarkdownUploadResult.passed + dependencyProxyResult.passed + dependencyProxyBlobResult.passed;
|
|
1509
|
+
const totalFailed = getFileContentsResult.failed + fileContentResult.failed + createPipelineResult.failed + commitStatusResult.failed + createIssueNoteResult.failed + getMergeRequestResult.failed + listMergeRequestPipelinesResult.failed + gitLabMergeRequestResult.failed + emojiReactionResult.failed + repositorySchemaResult.failed + labelsCoercionResult.failed + approvedByUsernamesResult.failed + listLabelsResult.failed + treeItemResult.failed + repositoryTreeResult.failed + gitLabUserFullResult.failed + gitLabMarkdownUploadResult.failed + dependencyProxyResult.failed + dependencyProxyBlobResult.failed;
|
|
1408
1510
|
console.log(`\nTotal Results: ${totalPassed} passed, ${totalFailed} failed`);
|
|
1409
1511
|
if (totalFailed > 0) {
|
|
1410
1512
|
process.exit(1);
|