@zhanglc77/bitbucket-mcp-server 1.0.6 → 1.0.7

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.
@@ -0,0 +1,1099 @@
1
+ /**
2
+ * Static field schemas and metadata for Bitbucket Cloud REST API resources
3
+ * Based on official Bitbucket Cloud REST API documentation
4
+ */
5
+ /**
6
+ * Repository resource field schema
7
+ */
8
+ export const repositorySchema = {
9
+ type: 'repository',
10
+ description: 'Bitbucket repository object with complete metadata',
11
+ fields: [
12
+ {
13
+ name: 'type',
14
+ type: 'string',
15
+ description: 'Object type identifier, always "repository"',
16
+ required: true,
17
+ readonly: true,
18
+ example: 'repository'
19
+ },
20
+ {
21
+ name: 'uuid',
22
+ type: 'string',
23
+ description: 'Unique repository identifier in UUID format with braces',
24
+ required: true,
25
+ readonly: true,
26
+ example: '{b4434b4d-6a0e-4f57-8d75-e02a824abeb0}'
27
+ },
28
+ {
29
+ name: 'name',
30
+ type: 'string',
31
+ description: 'Repository display name',
32
+ required: true,
33
+ example: 'My Repository'
34
+ },
35
+ {
36
+ name: 'slug',
37
+ type: 'string',
38
+ description: 'URL-safe repository identifier',
39
+ required: true,
40
+ example: 'my-repository'
41
+ },
42
+ {
43
+ name: 'full_name',
44
+ type: 'string',
45
+ description: 'Full repository name in format "workspace/repo_slug"',
46
+ required: true,
47
+ readonly: true,
48
+ example: 'teamsinspace/documentation-tests'
49
+ },
50
+ {
51
+ name: 'description',
52
+ type: 'string',
53
+ description: 'Repository description text',
54
+ example: 'This is a sample repository'
55
+ },
56
+ {
57
+ name: 'scm',
58
+ type: 'string',
59
+ description: 'Source control management type (git, hg)',
60
+ required: true,
61
+ readonly: true,
62
+ example: 'git'
63
+ },
64
+ {
65
+ name: 'is_private',
66
+ type: 'boolean',
67
+ description: 'Whether the repository is private',
68
+ required: true,
69
+ example: false
70
+ },
71
+ {
72
+ name: 'size',
73
+ type: 'number',
74
+ description: 'Repository size in bytes',
75
+ readonly: true,
76
+ example: 1172663
77
+ },
78
+ {
79
+ name: 'language',
80
+ type: 'string',
81
+ description: 'Primary programming language detected',
82
+ readonly: true,
83
+ example: 'JavaScript'
84
+ },
85
+ {
86
+ name: 'has_issues',
87
+ type: 'boolean',
88
+ description: 'Whether issue tracker is enabled',
89
+ example: true
90
+ },
91
+ {
92
+ name: 'has_wiki',
93
+ type: 'boolean',
94
+ description: 'Whether wiki is enabled',
95
+ example: true
96
+ },
97
+ {
98
+ name: 'fork_policy',
99
+ type: 'string',
100
+ description: 'Fork permission policy (allow_forks, no_public_forks, no_forks)',
101
+ example: 'allow_forks'
102
+ },
103
+ {
104
+ name: 'website',
105
+ type: 'string',
106
+ description: 'Repository website URL',
107
+ example: 'https://example.com'
108
+ },
109
+ {
110
+ name: 'created_on',
111
+ type: 'string',
112
+ description: 'Repository creation timestamp in ISO 8601 format',
113
+ readonly: true,
114
+ example: '2014-07-24T21:48:26.648365+00:00'
115
+ },
116
+ {
117
+ name: 'updated_on',
118
+ type: 'string',
119
+ description: 'Last update timestamp in ISO 8601 format',
120
+ readonly: true,
121
+ example: '2016-07-29T18:45:36.317590+00:00'
122
+ },
123
+ {
124
+ name: 'mainbranch',
125
+ type: 'object',
126
+ description: 'Main branch information object',
127
+ nested: true,
128
+ example: { name: 'main' }
129
+ },
130
+ {
131
+ name: 'owner',
132
+ type: 'object',
133
+ description: 'Repository owner (user or team) object',
134
+ required: true,
135
+ nested: true,
136
+ example: { username: 'teamsinspace', type: 'team' }
137
+ },
138
+ {
139
+ name: 'project',
140
+ type: 'object',
141
+ description: 'Associated project object',
142
+ nested: true,
143
+ example: { name: 'Master station', key: 'PROJ' }
144
+ },
145
+ {
146
+ name: 'links',
147
+ type: 'object',
148
+ description: 'Related links for repository resources',
149
+ readonly: true,
150
+ nested: true,
151
+ example: { self: { href: 'https://api.bitbucket.org/2.0/repositories/...' } }
152
+ },
153
+ {
154
+ name: 'properties',
155
+ type: 'object',
156
+ description: 'Application-specific properties stored for this repository',
157
+ nested: true
158
+ }
159
+ ]
160
+ };
161
+ /**
162
+ * Pull Request resource field schema
163
+ */
164
+ export const pullRequestSchema = {
165
+ type: 'pullrequest',
166
+ description: 'Bitbucket pull request object with complete metadata',
167
+ fields: [
168
+ {
169
+ name: 'type',
170
+ type: 'string',
171
+ description: 'Object type identifier, always "pullrequest"',
172
+ required: true,
173
+ readonly: true,
174
+ example: 'pullrequest'
175
+ },
176
+ {
177
+ name: 'id',
178
+ type: 'number',
179
+ description: 'Unique pull request identifier',
180
+ required: true,
181
+ readonly: true,
182
+ example: 1234
183
+ },
184
+ {
185
+ name: 'title',
186
+ type: 'string',
187
+ description: 'Pull request title',
188
+ required: true,
189
+ example: 'Add new feature'
190
+ },
191
+ {
192
+ name: 'description',
193
+ type: 'string',
194
+ description: 'Pull request description in Markdown format',
195
+ example: 'This PR adds a new feature...'
196
+ },
197
+ {
198
+ name: 'state',
199
+ type: 'string',
200
+ description: 'Pull request state (OPEN, MERGED, DECLINED, SUPERSEDED)',
201
+ required: true,
202
+ example: 'OPEN'
203
+ },
204
+ {
205
+ name: 'draft',
206
+ type: 'boolean',
207
+ description: 'Whether the pull request is in draft status',
208
+ example: false
209
+ },
210
+ {
211
+ name: 'author',
212
+ type: 'object',
213
+ description: 'Pull request author (user) object',
214
+ required: true,
215
+ nested: true,
216
+ example: { username: 'developer', display_name: 'Developer Name' }
217
+ },
218
+ {
219
+ name: 'source',
220
+ type: 'object',
221
+ description: 'Source branch information',
222
+ required: true,
223
+ nested: true,
224
+ example: { branch: { name: 'feature-branch' } }
225
+ },
226
+ {
227
+ name: 'destination',
228
+ type: 'object',
229
+ description: 'Destination branch information',
230
+ required: true,
231
+ nested: true,
232
+ example: { branch: { name: 'main' }, repository: { full_name: 'team/repo' } }
233
+ },
234
+ {
235
+ name: 'merge_commit',
236
+ type: 'object',
237
+ description: 'Merge commit information (available after merge)',
238
+ nested: true,
239
+ readonly: true
240
+ },
241
+ {
242
+ name: 'close_source_branch',
243
+ type: 'boolean',
244
+ description: 'Whether to close source branch after merge',
245
+ example: true
246
+ },
247
+ {
248
+ name: 'closed_by',
249
+ type: 'object',
250
+ description: 'User who closed the pull request',
251
+ nested: true,
252
+ readonly: true
253
+ },
254
+ {
255
+ name: 'reason',
256
+ type: 'string',
257
+ description: 'Reason for closing (if declined)',
258
+ readonly: true
259
+ },
260
+ {
261
+ name: 'created_on',
262
+ type: 'string',
263
+ description: 'Creation timestamp in ISO 8601 format',
264
+ readonly: true,
265
+ example: '2023-01-15T10:30:00.000Z'
266
+ },
267
+ {
268
+ name: 'updated_on',
269
+ type: 'string',
270
+ description: 'Last update timestamp in ISO 8601 format',
271
+ readonly: true,
272
+ example: '2023-01-16T14:20:00.000Z'
273
+ },
274
+ {
275
+ name: 'comment_count',
276
+ type: 'number',
277
+ description: 'Total number of comments',
278
+ readonly: true,
279
+ example: 5
280
+ },
281
+ {
282
+ name: 'task_count',
283
+ type: 'number',
284
+ description: 'Total number of tasks',
285
+ readonly: true,
286
+ example: 2
287
+ },
288
+ {
289
+ name: 'reviewers',
290
+ type: 'array',
291
+ description: 'List of pull request reviewers',
292
+ nested: true,
293
+ example: [{ user: { username: 'reviewer1' }, approved: true }]
294
+ },
295
+ {
296
+ name: 'participants',
297
+ type: 'array',
298
+ description: 'List of pull request participants',
299
+ nested: true,
300
+ readonly: true
301
+ },
302
+ {
303
+ name: 'links',
304
+ type: 'object',
305
+ description: 'Related links for pull request resources',
306
+ readonly: true,
307
+ nested: true
308
+ }
309
+ ]
310
+ };
311
+ /**
312
+ * Commit resource field schema
313
+ */
314
+ export const commitSchema = {
315
+ type: 'commit',
316
+ description: 'Bitbucket commit object with complete metadata',
317
+ fields: [
318
+ {
319
+ name: 'type',
320
+ type: 'string',
321
+ description: 'Object type identifier, always "commit"',
322
+ required: true,
323
+ readonly: true,
324
+ example: 'commit'
325
+ },
326
+ {
327
+ name: 'hash',
328
+ type: 'string',
329
+ description: 'Commit SHA hash',
330
+ required: true,
331
+ readonly: true,
332
+ example: 'abc123def456'
333
+ },
334
+ {
335
+ name: 'message',
336
+ type: 'string',
337
+ description: 'Commit message',
338
+ required: true,
339
+ readonly: true,
340
+ example: 'Fix bug in user authentication'
341
+ },
342
+ {
343
+ name: 'summary',
344
+ type: 'object',
345
+ description: 'Commit message summary with raw and markup',
346
+ readonly: true,
347
+ nested: true
348
+ },
349
+ {
350
+ name: 'author',
351
+ type: 'object',
352
+ description: 'Commit author information',
353
+ required: true,
354
+ readonly: true,
355
+ nested: true,
356
+ example: { user: { username: 'developer' }, raw: 'Developer <dev@example.com>' }
357
+ },
358
+ {
359
+ name: 'date',
360
+ type: 'string',
361
+ description: 'Commit date in ISO 8601 format',
362
+ required: true,
363
+ readonly: true,
364
+ example: '2023-01-15T10:30:00+00:00'
365
+ },
366
+ {
367
+ name: 'parents',
368
+ type: 'array',
369
+ description: 'Parent commit objects',
370
+ readonly: true,
371
+ nested: true,
372
+ example: [{ hash: 'parent123abc' }]
373
+ },
374
+ {
375
+ name: 'repository',
376
+ type: 'object',
377
+ description: 'Repository object this commit belongs to',
378
+ required: true,
379
+ readonly: true,
380
+ nested: true
381
+ },
382
+ {
383
+ name: 'links',
384
+ type: 'object',
385
+ description: 'Related links for commit resources',
386
+ readonly: true,
387
+ nested: true
388
+ }
389
+ ]
390
+ };
391
+ /**
392
+ * Branch resource field schema
393
+ */
394
+ export const branchSchema = {
395
+ type: 'branch',
396
+ description: 'Bitbucket branch reference object',
397
+ fields: [
398
+ {
399
+ name: 'type',
400
+ type: 'string',
401
+ description: 'Object type identifier, always "branch"',
402
+ required: true,
403
+ readonly: true,
404
+ example: 'branch'
405
+ },
406
+ {
407
+ name: 'name',
408
+ type: 'string',
409
+ description: 'Branch name',
410
+ required: true,
411
+ example: 'main'
412
+ },
413
+ {
414
+ name: 'target',
415
+ type: 'object',
416
+ description: 'Target commit object',
417
+ required: true,
418
+ readonly: true,
419
+ nested: true,
420
+ example: { hash: 'abc123def456' }
421
+ },
422
+ {
423
+ name: 'heads',
424
+ type: 'array',
425
+ description: 'Branch head commits',
426
+ readonly: true,
427
+ nested: true
428
+ },
429
+ {
430
+ name: 'links',
431
+ type: 'object',
432
+ description: 'Related links for branch resources',
433
+ readonly: true,
434
+ nested: true
435
+ },
436
+ {
437
+ name: 'default_merge_strategy',
438
+ type: 'string',
439
+ description: 'Default merge strategy for this branch',
440
+ example: 'merge_commit'
441
+ },
442
+ {
443
+ name: 'merge_strategies',
444
+ type: 'array',
445
+ description: 'Available merge strategies',
446
+ readonly: true,
447
+ example: ['merge_commit', 'squash', 'fast_forward']
448
+ }
449
+ ]
450
+ };
451
+ /**
452
+ * File/Directory resource field schema
453
+ */
454
+ export const fileSchema = {
455
+ type: 'commit_file',
456
+ description: 'File or directory in a repository at a specific commit',
457
+ fields: [
458
+ {
459
+ name: 'type',
460
+ type: 'string',
461
+ description: 'Object type (commit_file or commit_directory)',
462
+ required: true,
463
+ readonly: true,
464
+ example: 'commit_file'
465
+ },
466
+ {
467
+ name: 'path',
468
+ type: 'string',
469
+ description: 'File or directory path relative to repository root',
470
+ required: true,
471
+ readonly: true,
472
+ example: 'src/main.js'
473
+ },
474
+ {
475
+ name: 'commit',
476
+ type: 'object',
477
+ description: 'Commit object this file belongs to',
478
+ required: true,
479
+ readonly: true,
480
+ nested: true
481
+ },
482
+ {
483
+ name: 'size',
484
+ type: 'number',
485
+ description: 'File size in bytes (files only)',
486
+ readonly: true,
487
+ example: 1024
488
+ },
489
+ {
490
+ name: 'mimetype',
491
+ type: 'string',
492
+ description: 'MIME type of the file content',
493
+ readonly: true,
494
+ example: 'text/javascript'
495
+ },
496
+ {
497
+ name: 'links',
498
+ type: 'object',
499
+ description: 'Related links for file resources',
500
+ readonly: true,
501
+ nested: true
502
+ },
503
+ {
504
+ name: 'escaped_path',
505
+ type: 'string',
506
+ description: 'URL-escaped file path',
507
+ readonly: true
508
+ },
509
+ {
510
+ name: 'attributes',
511
+ type: 'array',
512
+ description: 'File attributes (executable, symlink, etc.)',
513
+ readonly: true,
514
+ example: ['executable']
515
+ }
516
+ ]
517
+ };
518
+ /**
519
+ * Issue resource field schema
520
+ */
521
+ export const issueSchema = {
522
+ type: 'issue',
523
+ description: 'Bitbucket issue object',
524
+ fields: [
525
+ {
526
+ name: 'type',
527
+ type: 'string',
528
+ description: 'Object type identifier, always "issue"',
529
+ required: true,
530
+ readonly: true,
531
+ example: 'issue'
532
+ },
533
+ {
534
+ name: 'id',
535
+ type: 'number',
536
+ description: 'Unique issue identifier',
537
+ required: true,
538
+ readonly: true,
539
+ example: 42
540
+ },
541
+ {
542
+ name: 'title',
543
+ type: 'string',
544
+ description: 'Issue title',
545
+ required: true,
546
+ example: 'Bug in login system'
547
+ },
548
+ {
549
+ name: 'content',
550
+ type: 'object',
551
+ description: 'Issue content with raw and markup',
552
+ nested: true
553
+ },
554
+ {
555
+ name: 'reporter',
556
+ type: 'object',
557
+ description: 'User who reported the issue',
558
+ required: true,
559
+ readonly: true,
560
+ nested: true
561
+ },
562
+ {
563
+ name: 'assignee',
564
+ type: 'object',
565
+ description: 'User assigned to the issue',
566
+ nested: true
567
+ },
568
+ {
569
+ name: 'state',
570
+ type: 'string',
571
+ description: 'Issue state (new, open, resolved, closed, etc.)',
572
+ required: true,
573
+ example: 'open'
574
+ },
575
+ {
576
+ name: 'kind',
577
+ type: 'string',
578
+ description: 'Issue kind (bug, enhancement, proposal, task)',
579
+ required: true,
580
+ example: 'bug'
581
+ },
582
+ {
583
+ name: 'priority',
584
+ type: 'string',
585
+ description: 'Issue priority (trivial, minor, major, critical, blocker)',
586
+ required: true,
587
+ example: 'major'
588
+ },
589
+ {
590
+ name: 'component',
591
+ type: 'object',
592
+ description: 'Component this issue belongs to',
593
+ nested: true
594
+ },
595
+ {
596
+ name: 'milestone',
597
+ type: 'object',
598
+ description: 'Milestone this issue is assigned to',
599
+ nested: true
600
+ },
601
+ {
602
+ name: 'version',
603
+ type: 'object',
604
+ description: 'Version this issue affects',
605
+ nested: true
606
+ },
607
+ {
608
+ name: 'votes',
609
+ type: 'number',
610
+ description: 'Number of votes for this issue',
611
+ readonly: true,
612
+ example: 5
613
+ },
614
+ {
615
+ name: 'watches',
616
+ type: 'number',
617
+ description: 'Number of watchers for this issue',
618
+ readonly: true,
619
+ example: 3
620
+ },
621
+ {
622
+ name: 'created_on',
623
+ type: 'string',
624
+ description: 'Creation timestamp in ISO 8601 format',
625
+ readonly: true,
626
+ example: '2023-01-15T10:30:00.000Z'
627
+ },
628
+ {
629
+ name: 'updated_on',
630
+ type: 'string',
631
+ description: 'Last update timestamp in ISO 8601 format',
632
+ readonly: true,
633
+ example: '2023-01-16T14:20:00.000Z'
634
+ },
635
+ {
636
+ name: 'repository',
637
+ type: 'object',
638
+ description: 'Repository this issue belongs to',
639
+ required: true,
640
+ readonly: true,
641
+ nested: true
642
+ },
643
+ {
644
+ name: 'links',
645
+ type: 'object',
646
+ description: 'Related links for issue resources',
647
+ readonly: true,
648
+ nested: true
649
+ }
650
+ ]
651
+ };
652
+ /**
653
+ * User/Account resource field schema
654
+ */
655
+ export const userSchema = {
656
+ type: 'user',
657
+ description: 'Bitbucket user or team account object',
658
+ fields: [
659
+ {
660
+ name: 'type',
661
+ type: 'string',
662
+ description: 'Object type (user or team)',
663
+ required: true,
664
+ readonly: true,
665
+ example: 'user'
666
+ },
667
+ {
668
+ name: 'uuid',
669
+ type: 'string',
670
+ description: 'Unique user identifier in UUID format with braces',
671
+ required: true,
672
+ readonly: true,
673
+ example: '{61fc5cf6-d054-47d2-b4a9-061ccf858379}'
674
+ },
675
+ {
676
+ name: 'account_id',
677
+ type: 'string',
678
+ description: 'Account identifier string',
679
+ readonly: true,
680
+ example: '5d5355e8c6b9320d9ea5b28d'
681
+ },
682
+ {
683
+ name: 'username',
684
+ type: 'string',
685
+ description: 'Username (deprecated for users, still valid for teams)',
686
+ readonly: true,
687
+ example: 'teamsinspace'
688
+ },
689
+ {
690
+ name: 'nickname',
691
+ type: 'string',
692
+ description: 'User nickname',
693
+ readonly: true,
694
+ example: 'dev123'
695
+ },
696
+ {
697
+ name: 'display_name',
698
+ type: 'string',
699
+ description: 'User display name',
700
+ required: true,
701
+ example: 'John Developer'
702
+ },
703
+ {
704
+ name: 'website',
705
+ type: 'string',
706
+ description: 'User website URL',
707
+ example: 'https://johndeveloper.com'
708
+ },
709
+ {
710
+ name: 'location',
711
+ type: 'string',
712
+ description: 'User location',
713
+ example: 'San Francisco, CA'
714
+ },
715
+ {
716
+ name: 'created_on',
717
+ type: 'string',
718
+ description: 'Account creation timestamp in ISO 8601 format',
719
+ readonly: true,
720
+ example: '2019-01-01T00:00:00.000Z'
721
+ },
722
+ {
723
+ name: 'account_status',
724
+ type: 'string',
725
+ description: 'Account status (active, inactive)',
726
+ readonly: true,
727
+ example: 'active'
728
+ },
729
+ {
730
+ name: 'has_2fa_enabled',
731
+ type: 'boolean',
732
+ description: 'Whether two-factor authentication is enabled',
733
+ readonly: true,
734
+ example: true
735
+ },
736
+ {
737
+ name: 'links',
738
+ type: 'object',
739
+ description: 'Related links for user resources',
740
+ readonly: true,
741
+ nested: true
742
+ }
743
+ ]
744
+ };
745
+ /**
746
+ * Project resource field schema
747
+ */
748
+ export const projectSchema = {
749
+ type: 'project',
750
+ description: 'Bitbucket project object for organizing repositories',
751
+ fields: [
752
+ {
753
+ name: 'type',
754
+ type: 'string',
755
+ description: 'Object type identifier, always "project"',
756
+ required: true,
757
+ readonly: true,
758
+ example: 'project'
759
+ },
760
+ {
761
+ name: 'uuid',
762
+ type: 'string',
763
+ description: 'Unique project identifier in UUID format with braces',
764
+ required: true,
765
+ readonly: true,
766
+ example: '{a18967d5-acba-4f73-bf9c-36d9fa6ea143}'
767
+ },
768
+ {
769
+ name: 'key',
770
+ type: 'string',
771
+ description: 'Project key (unique within workspace)',
772
+ required: true,
773
+ example: 'PROJ'
774
+ },
775
+ {
776
+ name: 'name',
777
+ type: 'string',
778
+ description: 'Project display name',
779
+ required: true,
780
+ example: 'My Project'
781
+ },
782
+ {
783
+ name: 'description',
784
+ type: 'string',
785
+ description: 'Project description',
786
+ example: 'This is a sample project'
787
+ },
788
+ {
789
+ name: 'is_private',
790
+ type: 'boolean',
791
+ description: 'Whether the project is private',
792
+ required: true,
793
+ example: false
794
+ },
795
+ {
796
+ name: 'owner',
797
+ type: 'object',
798
+ description: 'Project owner (team or user) object',
799
+ required: true,
800
+ nested: true
801
+ },
802
+ {
803
+ name: 'created_on',
804
+ type: 'string',
805
+ description: 'Project creation timestamp in ISO 8601 format',
806
+ readonly: true,
807
+ example: '2023-01-01T00:00:00.000Z'
808
+ },
809
+ {
810
+ name: 'updated_on',
811
+ type: 'string',
812
+ description: 'Last update timestamp in ISO 8601 format',
813
+ readonly: true,
814
+ example: '2023-01-15T12:00:00.000Z'
815
+ },
816
+ {
817
+ name: 'links',
818
+ type: 'object',
819
+ description: 'Related links for project resources',
820
+ readonly: true,
821
+ nested: true
822
+ }
823
+ ]
824
+ };
825
+ /**
826
+ * Comment resource field schema (for pull requests, commits, issues)
827
+ */
828
+ export const commentSchema = {
829
+ type: 'comment',
830
+ description: 'Comment object for pull requests, commits, or issues',
831
+ fields: [
832
+ {
833
+ name: 'type',
834
+ type: 'string',
835
+ description: 'Comment type (pullrequest_comment, commit_comment, issue_comment)',
836
+ required: true,
837
+ readonly: true,
838
+ example: 'pullrequest_comment'
839
+ },
840
+ {
841
+ name: 'id',
842
+ type: 'number',
843
+ description: 'Unique comment identifier',
844
+ required: true,
845
+ readonly: true,
846
+ example: 12345
847
+ },
848
+ {
849
+ name: 'content',
850
+ type: 'object',
851
+ description: 'Comment content with raw and markup',
852
+ required: true,
853
+ nested: true
854
+ },
855
+ {
856
+ name: 'user',
857
+ type: 'object',
858
+ description: 'User who created the comment',
859
+ required: true,
860
+ readonly: true,
861
+ nested: true
862
+ },
863
+ {
864
+ name: 'created_on',
865
+ type: 'string',
866
+ description: 'Creation timestamp in ISO 8601 format',
867
+ readonly: true,
868
+ example: '2023-01-15T10:30:00.000Z'
869
+ },
870
+ {
871
+ name: 'updated_on',
872
+ type: 'string',
873
+ description: 'Last update timestamp in ISO 8601 format',
874
+ readonly: true,
875
+ example: '2023-01-16T14:20:00.000Z'
876
+ },
877
+ {
878
+ name: 'inline',
879
+ type: 'object',
880
+ description: 'Inline comment positioning (for code comments)',
881
+ nested: true
882
+ },
883
+ {
884
+ name: 'parent',
885
+ type: 'object',
886
+ description: 'Parent comment (for threaded comments)',
887
+ nested: true,
888
+ readonly: true
889
+ },
890
+ {
891
+ name: 'pullrequest',
892
+ type: 'object',
893
+ description: 'Associated pull request (for PR comments)',
894
+ readonly: true,
895
+ nested: true
896
+ },
897
+ {
898
+ name: 'commit',
899
+ type: 'object',
900
+ description: 'Associated commit (for commit comments)',
901
+ readonly: true,
902
+ nested: true
903
+ },
904
+ {
905
+ name: 'issue',
906
+ type: 'object',
907
+ description: 'Associated issue (for issue comments)',
908
+ readonly: true,
909
+ nested: true
910
+ },
911
+ {
912
+ name: 'links',
913
+ type: 'object',
914
+ description: 'Related links for comment resources',
915
+ readonly: true,
916
+ nested: true
917
+ }
918
+ ]
919
+ };
920
+ /**
921
+ * All available resource schemas indexed by type
922
+ */
923
+ export const resourceSchemas = {
924
+ repository: repositorySchema,
925
+ pullrequest: pullRequestSchema,
926
+ commit: commitSchema,
927
+ branch: branchSchema,
928
+ commit_file: fileSchema,
929
+ commit_directory: fileSchema,
930
+ issue: issueSchema,
931
+ user: userSchema,
932
+ team: userSchema,
933
+ project: projectSchema,
934
+ pullrequest_comment: commentSchema,
935
+ commit_comment: commentSchema,
936
+ issue_comment: commentSchema
937
+ };
938
+ /**
939
+ * Get field schema for a specific resource type
940
+ */
941
+ export function getResourceSchema(resourceType) {
942
+ return resourceSchemas[resourceType];
943
+ }
944
+ /**
945
+ * Get all field names for a resource type
946
+ */
947
+ export function getResourceFields(resourceType) {
948
+ const schema = getResourceSchema(resourceType);
949
+ return schema?.fields.map(f => f.name) || [];
950
+ }
951
+ /**
952
+ * Get field metadata for a specific field
953
+ */
954
+ export function getFieldMetadata(resourceType, fieldName) {
955
+ const schema = getResourceSchema(resourceType);
956
+ return schema?.fields.find(f => f.name === fieldName);
957
+ }
958
+ /**
959
+ * Get commonly requested fields for different access patterns
960
+ */
961
+ export const commonFieldSets = {
962
+ minimal: ['type', 'id', 'uuid', 'name', 'full_name'],
963
+ summary: ['type', 'id', 'uuid', 'name', 'full_name', 'title', 'description', 'state', 'created_on', 'updated_on'],
964
+ metadata: ['type', 'id', 'uuid', 'name', 'full_name', 'title', 'description', 'state', 'created_on', 'updated_on', 'author', 'owner'],
965
+ detailed: [] // Empty means all fields
966
+ };
967
+ /**
968
+ * Get predefined field set
969
+ */
970
+ export function getCommonFields(pattern) {
971
+ return commonFieldSets[pattern];
972
+ }
973
+ /**
974
+ * Resource type categories for organization and discovery
975
+ */
976
+ export const resourceCategories = {
977
+ core: {
978
+ description: 'Core Bitbucket resources essential for most operations',
979
+ types: ['repository', 'pullrequest', 'commit', 'branch', 'user']
980
+ },
981
+ extended: {
982
+ description: 'Extended resources for advanced functionality',
983
+ types: ['issue', 'project', 'pullrequest_comment', 'commit_comment', 'issue_comment', 'commit_file', 'commit_directory']
984
+ }
985
+ };
986
+ /**
987
+ * Get all available resource types
988
+ */
989
+ export function getAllResourceTypes() {
990
+ return Object.keys(resourceSchemas);
991
+ }
992
+ /**
993
+ * Get resource types by category
994
+ */
995
+ export function getResourceTypesByCategory(category = 'all') {
996
+ if (category === 'all') {
997
+ return getAllResourceTypes();
998
+ }
999
+ return resourceCategories[category]?.types || [];
1000
+ }
1001
+ /**
1002
+ * Get resource type index with metadata
1003
+ * Returns a static list of all available resource types
1004
+ */
1005
+ export function getResourceTypeIndex() {
1006
+ const types = getResourceTypesByCategory('all');
1007
+ return types.map(type => {
1008
+ const schema = getResourceSchema(type);
1009
+ if (!schema)
1010
+ return null;
1011
+ return {
1012
+ type: schema.type,
1013
+ description: schema.description,
1014
+ category: resourceCategories.core.types.includes(type) ? 'core' : 'extended'
1015
+ };
1016
+ }).filter(Boolean);
1017
+ }
1018
+ /**
1019
+ * Get filtered fields based on criteria
1020
+ */
1021
+ export function getFilteredFields(resourceType, filterBy) {
1022
+ const schema = getResourceSchema(resourceType);
1023
+ if (!schema)
1024
+ return [];
1025
+ if (!filterBy)
1026
+ return schema.fields;
1027
+ return schema.fields.filter(field => {
1028
+ switch (filterBy) {
1029
+ case 'required':
1030
+ return field.required === true;
1031
+ case 'optional':
1032
+ return !field.required;
1033
+ case 'readonly':
1034
+ return field.readonly === true;
1035
+ case 'nested':
1036
+ return field.nested === true;
1037
+ default:
1038
+ return true;
1039
+ }
1040
+ });
1041
+ }
1042
+ /**
1043
+ * Get validation rules for a resource type
1044
+ */
1045
+ export function getValidationRules(resourceType, operation = 'read') {
1046
+ const schema = getResourceSchema(resourceType);
1047
+ if (!schema)
1048
+ return null;
1049
+ const rules = {
1050
+ resourceType: schema.type,
1051
+ operation,
1052
+ requiredFields: schema.fields.filter(f => f.required && !f.readonly).map(f => f.name),
1053
+ readonlyFields: schema.fields.filter(f => f.readonly).map(f => f.name),
1054
+ optionalFields: schema.fields.filter(f => !f.required && !f.readonly).map(f => f.name),
1055
+ nestedFields: schema.fields.filter(f => f.nested).map(f => f.name),
1056
+ fieldTypes: schema.fields.reduce((acc, field) => {
1057
+ acc[field.name] = field.type;
1058
+ return acc;
1059
+ }, {})
1060
+ };
1061
+ // Adjust rules based on operation
1062
+ if (operation === 'create') {
1063
+ // For create operations, some readonly fields might be auto-generated
1064
+ rules.readonlyFields = schema.fields.filter(f => f.readonly && !['type', 'created_on'].includes(f.name)).map(f => f.name);
1065
+ }
1066
+ else if (operation === 'update') {
1067
+ // For update operations, some required fields might become optional
1068
+ rules.requiredFields = schema.fields.filter(f => f.required && !f.readonly && !['type', 'id', 'uuid'].includes(f.name)).map(f => f.name);
1069
+ }
1070
+ return rules;
1071
+ }
1072
+ /**
1073
+ * Get field schema with detailed information
1074
+ */
1075
+ export function getDetailedFieldSchema(resourceType, fieldName, includeNested = false) {
1076
+ const fieldMetadata = getFieldMetadata(resourceType, fieldName);
1077
+ if (!fieldMetadata)
1078
+ return null;
1079
+ const result = {
1080
+ ...fieldMetadata,
1081
+ resourceType,
1082
+ validationRules: {
1083
+ required: fieldMetadata.required || false,
1084
+ readonly: fieldMetadata.readonly || false,
1085
+ type: fieldMetadata.type
1086
+ }
1087
+ };
1088
+ // Add nested schema information if requested and applicable
1089
+ if (includeNested && fieldMetadata.nested && fieldMetadata.type === 'object') {
1090
+ // For now, we'll indicate that nested schemas are available
1091
+ // In the future, this could include detailed nested field definitions
1092
+ result.nestedSchema = {
1093
+ available: true,
1094
+ note: `Nested schema for ${fieldName} in ${resourceType} - use specific resource type for detailed schema`
1095
+ };
1096
+ }
1097
+ return result;
1098
+ }
1099
+ //# sourceMappingURL=field-schemas.js.map