blob: 9b4aa0f442c6b259a608f117dbe802a72b2844e0 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2019 The Chromium Authors
Copybara854996b2021-09-07 19:36:02 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5/**
6 * @fileoverview Shared file for specifying common types used in type
7 * annotations across Monorail.
8 */
9
10// TODO(zhangtiff): Find out if there's a way we can generate typedef's for
11// API object from .proto files.
12
13
14/**
15 * Types used in the app that don't come from any Proto files.
16 */
17
18/**
19 * A HotlistItem with the Issue flattened into the top-level,
20 * containing the intersection of the fields of HotlistItem and Issue.
21 *
22 * @typedef {Issue & HotlistItem} HotlistIssue
23 * @property {User=} adder
24 */
25
26/**
27 * A String containing the data necessary to identify an IssueRef. An IssueRef
28 * can reference either an issue in Monorail or an external issue in another
29 * tracker.
30 *
31 * Examples of valid IssueRefStrings:
32 * - monorail:1234
33 * - chromium:1
34 * - 1234
35 * - b/123456
36 *
37 * @typedef {string} IssueRefString
38 */
39
40/**
41 * An Object for specifying what to display in a single entry in the
42 * dropdown list.
43 *
44 * @typedef {Object} MenuItem
45 * @property {string=} text The text to display in the menu.
46 * @property {string=} icon A Material Design icon shown left of the text.
47 * @property {Array<MenuItem>=} items A specification for a nested submenu.
48 * @property {function=} handler An optional click handler for an item.
49 * @property {string=} url A link for the menu item to navigate to.
50 */
51
52/**
53 * An Object containing the metadata associated with tracking async requests
54 * through Redux.
55 *
56 * @typedef {Object} ReduxRequestState
57 * @property {boolean=} requesting Whether a request is in flight.
58 * @property {Error=} error An Error Object returned by the request.
59 */
60
61
62/**
63 * Resource names used in our resource-oriented API.
64 * @see https://aip.dev/122
65 */
66
67
68/**
69 * Resource name of an IssueStar.
70 *
71 * Examples of valid IssueStar resource names:
72 * - users/1234/issueStars/monorail.5556
73 * - users/1234/issueStars/test-project.4321
74 *
75 * @typedef {string} IssueStarName
76 */
77
78
79/**
80 * Resource name of a ProjectStar.
81 *
82 * Examples of valid ProjectStar resource names:
83 * - users/1234/projectStars/monorail
84 * - users/1234/projectStars/test-project
85 *
86 * @typedef {string} ProjectStarName
87 */
88
89
90/**
91 * Resource name of a Star.
92 *
93 * @typedef {ProjectStarName|IssueStarName} StarName
94 */
95
96
97/**
98 * Resource name of a Project.
99 *
100 * Examples of valid Project resource names:
101 * - projects/monorail
102 * - projects/test-project-1
103 *
104 * @typedef {string} ProjectName
105 */
106
107
108/**
109 * Resource name of a User.
110 *
111 * Examples of valid User resource names:
112 * - users/test@example.com
113 * - users/1234
114 *
115 * @typedef {string} UserName
116 */
117
118/**
119 * Resource name of a ProjectMember.
120 *
121 * Examples of valid ProjectMember resource names:
122 * - projects/monorail/members/1234
123 * - projects/test-xyz/members/5678
124 *
125 * @typedef {string} ProjectMemberName
126 */
127
128
129/**
130 * Types defined in common.proto.
131 */
132
133
134/**
135 * A ComponentRef Object returned by the pRPC API common.proto.
136 *
137 * @typedef {Object} ComponentRef
138 * @property {string} path
139 * @property {boolean=} isDerived
140 */
141
142/**
143 * An Enum representing the type that a custom field uses.
144 *
145 * @typedef {string} FieldType
146 */
147
148/**
149 * A FieldRef Object returned by the pRPC API common.proto.
150 *
151 * @typedef {Object} FieldRef
152 * @property {number} fieldId
153 * @property {string} fieldName
154 * @property {FieldType} type
155 * @property {string=} approvalName
156 */
157
158/**
159 * A LabelRef Object returned by the pRPC API common.proto.
160 *
161 * @typedef {Object} LabelRef
162 * @property {string} label
163 * @property {boolean=} isDerived
164 */
165
166/**
167 * A StatusRef Object returned by the pRPC API common.proto.
168 *
169 * @typedef {Object} StatusRef
170 * @property {string} status
171 * @property {boolean=} meansOpen
172 * @property {boolean=} isDerived
173 */
174
175/**
176 * An IssueRef Object returned by the pRPC API common.proto.
177 *
178 * @typedef {Object} IssueRef
179 * @property {string=} projectName
180 * @property {number=} localId
181 * @property {string=} extIdentifier
182 */
183
184/**
185 * A UserRef Object returned by the pRPC API common.proto.
186 *
187 * @typedef {Object} UserRef
188 * @property {string=} displayName
189 * @property {number=} userId
190 */
191
192/**
193 * A HotlistRef Object returned by the pRPC API common.proto.
194 *
195 * @typedef {Object} HotlistRef
196 * @property {string=} name
197 * @property {UserRef=} owner
198 */
199
200/**
201 * A SavedQuery Object returned by the pRPC API common.proto.
202 *
203 * @typedef {Object} SavedQuery
204 * @property {number} queryId
205 * @property {string} name
206 * @property {string} query
207 * @property {Array<string>} projectNames
208 */
209
210
211/**
212 * Types defined in issue_objects.proto.
213 */
214
215/**
216 * An Approval Object returned by the pRPC API issue_objects.proto.
217 *
218 * @typedef {Object} Approval
219 * @property {FieldRef} fieldRef
220 * @property {Array<UserRef>} approverRefs
221 * @property {ApprovalStatus} status
222 * @property {number} setOn
223 * @property {UserRef} setterRef
224 * @property {PhaseRef} phaseRef
225 */
226
227/**
228 * An Enum representing the status of an Approval.
229 *
230 * @typedef {string} ApprovalStatus
231 */
232
233/**
234 * An Amendment Object returned by the pRPC API issue_objects.proto.
235 *
236 * @typedef {Object} Amendment
237 * @property {string} fieldName
238 * @property {string} newOrDeltaValue
239 * @property {string} oldValue
240 */
241
242/**
243 * An Attachment Object returned by the pRPC API issue_objects.proto.
244 *
245 * @typedef {Object} Attachment
246* @property {number} attachmentId
247* @property {string} filename
248* @property {number} size
249* @property {string} contentType
250* @property {boolean} isDeleted
251* @property {string} thumbnailUrl
252* @property {string} viewUrl
253* @property {string} downloadUrl
254*/
255
256/**
257 * A Comment Object returned by the pRPC API issue_objects.proto.
258 *
259 * Note: This Object is called "Comment" in the backend but is named
260 * "IssueComment" here to avoid a collision with an internal JSDoc Intellisense
261 * type.
262 *
263 * @typedef {Object} IssueComment
264 * @property {string} projectName
265 * @property {number} localId
266 * @property {number=} sequenceNum
267 * @property {boolean=} isDeleted
268 * @property {UserRef=} commenter
269 * @property {number=} timestamp
270 * @property {string=} content
271 * @property {string=} inboundMessage
272 * @property {Array<Amendment>=} amendments
273 * @property {Array<Attachment>=} attachments
274 * @property {FieldRef=} approvalRef
275 * @property {number=} descriptionNum
276 * @property {boolean=} isSpam
277 * @property {boolean=} canDelete
278 * @property {boolean=} canFlag
279 */
280
281/**
282 * A FieldValue Object returned by the pRPC API issue_objects.proto.
283 *
284 * @typedef {Object} FieldValue
285 * @property {FieldRef} fieldRef
286 * @property {string} value
287 * @property {boolean=} isDerived
288 * @property {PhaseRef=} phaseRef
289 */
290
291/**
292 * An Issue Object returned by the pRPC API issue_objects.proto.
293 *
294 * @typedef {Object} Issue
295 * @property {string} projectName
296 * @property {number} localId
297 * @property {string=} summary
298 * @property {StatusRef=} statusRef
299 * @property {UserRef=} ownerRef
300 * @property {Array<UserRef>=} ccRefs
301 * @property {Array<LabelRef>=} labelRefs
302 * @property {Array<ComponentRef>=} componentRefs
303 * @property {Array<IssueRef>=} blockedOnIssueRefs
304 * @property {Array<IssueRef>=} blockingIssueRefs
305 * @property {Array<IssueRef>=} danglingBlockedOnRefs
306 * @property {Array<IssueRef>=} danglingBlockingRefs
307 * @property {IssueRef=} mergedIntoIssueRef
308 * @property {Array<FieldValue>=} fieldValues
309 * @property {boolean=} isDeleted
310 * @property {UserRef=} reporterRef
311 * @property {number=} openedTimestamp
312 * @property {number=} closedTimestamp
313 * @property {number=} modifiedTimestamp
314 * @property {number=} componentModifiedTimestamp
315 * @property {number=} statusModifiedTimestamp
316 * @property {number=} ownerModifiedTimestamp
317 * @property {number=} starCount
318 * @property {boolean=} isSpam
319 * @property {number=} attachmentCount
320 * @property {Array<Approval>=} approvalValues
321 * @property {Array<PhaseDef>=} phases
322 */
323
324/**
325 * A IssueDelta Object returned by the pRPC API issue_objects.proto.
326 *
327 * @typedef {Object} IssueDelta
328 * @property {string=} status
329 * @property {UserRef=} ownerRef
330 * @property {Array<UserRef>=} ccRefsAdd
331 * @property {Array<UserRef>=} ccRefsRemove
332 * @property {Array<ComponentRef>=} compRefsAdd
333 * @property {Array<ComponentRef>=} compRefsRemove
334 * @property {Array<LabelRef>=} labelRefsAdd
335 * @property {Array<LabelRef>=} labelRefsRemove
336 * @property {Array<FieldValue>=} fieldValsAdd
337 * @property {Array<FieldValue>=} fieldValsRemove
338 * @property {Array<FieldRef>=} fieldsClear
339 * @property {Array<IssueRef>=} blockedOnRefsAdd
340 * @property {Array<IssueRef>=} blockedOnRefsRemove
341 * @property {Array<IssueRef>=} blockingRefsAdd
342 * @property {Array<IssueRef>=} blockingRefsRemove
343 * @property {IssueRef=} mergedIntoRef
344 * @property {string=} summary
345 */
346
347/**
348 * An PhaseDef Object returned by the pRPC API issue_objects.proto.
349 *
350 * @typedef {Object} PhaseDef
351 * @property {PhaseRef} phaseRef
352 * @property {number} rank
353 */
354
355/**
356 * An PhaseRef Object returned by the pRPC API issue_objects.proto.
357 *
358 * @typedef {Object} PhaseRef
359 * @property {string} phaseName
360 */
361
362/**
363 * An Object returned by the pRPC v3 API from feature_objects.proto.
364 *
365 * @typedef {Object} IssuesListColumn
366 * @property {string} column
367 */
368
369
370/**
371 * Types defined in permission_objects.proto.
372 */
373
374/**
375 * A Permission string returned by the pRPC API permission_objects.proto.
376 *
377 * @typedef {string} Permission
378 */
379
380/**
381 * A PermissionSet Object returned by the pRPC API permission_objects.proto.
382 *
383 * @typedef {Object} PermissionSet
384 * @property {string} resource
385 * @property {Array<Permission>} permissions
386 */
387
388
389/**
390 * Types defined in project_objects.proto.
391 */
392
393/**
394 * An Enum representing the role a ProjectMember has.
395 *
396 * @typedef {string} ProjectRole
397 */
398
399/**
400 * An Enum representing how a ProjectMember shows up in autocomplete.
401 *
402 * @typedef {string} AutocompleteVisibility
403 */
404
405/**
406 * A ProjectMember Object returned by the pRPC API project_objects.proto.
407 *
408 * @typedef {Object} ProjectMember
409 * @property {ProjectMemberName} name
410 * @property {ProjectRole} role
411 * @property {Array<Permission>=} standardPerms
412 * @property {Array<string>=} customPerms
413 * @property {string=} notes
414 * @property {AutocompleteVisibility=} includeInAutocomplete
415 */
416
417/**
418 * A Project Object returned by the pRPC API project_objects.proto.
419 *
420 * @typedef {Object} Project
421 * @property {string} name
422 * @property {string} summary
423 * @property {string=} description
424 */
425
426/**
427 * A Project Object returned by the v0 pRPC API project_objects.proto.
428 *
429 * @typedef {Object} ProjectV0
430 * @property {string} name
431 * @property {string} summary
432 * @property {string=} description
433 */
434
435/**
436 * A StatusDef Object returned by the pRPC API project_objects.proto.
437 *
438 * @typedef {Object} StatusDef
439 * @property {string} status
440 * @property {boolean} meansOpen
441 * @property {number} rank
442 * @property {string} docstring
443 * @property {boolean} deprecated
444 */
445
446/**
447 * A LabelDef Object returned by the pRPC API project_objects.proto.
448 *
449 * @typedef {Object} LabelDef
450 * @property {string} label
451 * @property {string=} docstring
452 * @property {boolean=} deprecated
453 */
454
455/**
456 * A ComponentDef Object returned by the pRPC API project_objects.proto.
457 *
458 * @typedef {Object} ComponentDef
459 * @property {string} path
460 * @property {string} docstring
461 * @property {Array<UserRef>} adminRefs
462 * @property {Array<UserRef>} ccRefs
463 * @property {boolean} deprecated
464 * @property {number} created
465 * @property {UserRef} creatorRef
466 * @property {number} modified
467 * @property {UserRef} modifierRef
468 * @property {Array<LabelRef>} labelRefs
469 */
470
471/**
472 * A FieldDef Object returned by the pRPC API project_objects.proto.
473 *
474 * @typedef {Object} FieldDef
475 * @property {FieldRef} fieldRef
476 * @property {string=} applicableType
477 * @property {boolean=} isRequired
478 * @property {boolean=} isNiche
479 * @property {boolean=} isMultivalued
480 * @property {string=} docstring
481 * @property {Array<UserRef>=} adminRefs
482 * @property {boolean=} isPhaseField
483 * @property {Array<UserRef>=} userChoices
484 * @property {Array<LabelDef>=} enumChoices
485 */
486
487/**
488 * A ApprovalDef Object returned by the pRPC API project_objects.proto.
489 *
490 * @typedef {Object} ApprovalDef
491 * @property {FieldRef} fieldRef
492 * @property {Array<UserRef>} approverRefs
493 * @property {string} survey
494 */
495
496/**
497 * A Config Object returned by the pRPC API project_objects.proto.
498 *
499 * @typedef {Object} Config
500 * @property {string} projectName
501 * @property {Array<StatusDef>=} statusDefs
502 * @property {Array<StatusRef>=} statusesOfferMerge
503 * @property {Array<LabelDef>=} labelDefs
504 * @property {Array<string>=} exclusiveLabelPrefixes
505 * @property {Array<ComponentDef>=} componentDefs
506 * @property {Array<FieldDef>=} fieldDefs
507 * @property {Array<ApprovalDef>=} approvalDefs
508 * @property {boolean=} restrictToKnown
509 */
510
511
512/**
513 * A PresentationConfig Object returned by the pRPC API project_objects.proto.
514 *
515 * @typedef {Object} PresentationConfig
516 * @property {string=} projectThumbnailUrl
517 * @property {string=} projectSummary
518 * @property {string=} customIssueEntryUrl
519 * @property {string=} defaultQuery
520 * @property {Array<SavedQuery>=} savedQueries
521 * @property {string=} revisionUrlFormat
522 * @property {string=} defaultColSpec
523 * @property {string=} defaultSortSpec
524 * @property {string=} defaultXAttr
525 * @property {string=} defaultYAttr
526 */
527
528/**
529 * A TemplateDef Object returned by the pRPC API project_objects.proto.
530 *
531 * @typedef {Object} TemplateDef
532 * @property {string} templateName
533 * @property {string=} content
534 * @property {string=} summary
535 * @property {boolean=} summaryMustBeEdited
536 * @property {UserRef=} ownerRef
537 * @property {StatusRef=} statusRef
538 * @property {Array<LabelRef>=} labelRefs
539 * @property {boolean=} membersOnly
540 * @property {boolean=} ownerDefaultsToMember
541 * @property {Array<UserRef>=} adminRefs
542 * @property {Array<FieldValue>=} fieldValues
543 * @property {Array<ComponentRef>=} componentRefs
544 * @property {boolean=} componentRequired
545 * @property {Array<Approval>=} approvalValues
546 * @property {Array<PhaseDef>=} phases
547 */
548
549
550/**
551 * Types defined in features_objects.proto.
552 */
553
554/**
555 * A Hotlist Object returned by the pRPC API features_objects.proto.
556 *
557 * @typedef {Object} HotlistV0
558 * @property {UserRef=} ownerRef
559 * @property {string=} name
560 * @property {string=} summary
561 * @property {string=} description
562 * @property {string=} defaultColSpec
563 * @property {boolean=} isPrivate
564 */
565
566/**
567 * A Hotlist Object returned by the pRPC v3 API from feature_objects.proto.
568 *
569 * @typedef {Object} Hotlist
570 * @property {string} name
571 * @property {string=} displayName
572 * @property {string=} owner
573 * @property {Array<string>=} editors
574 * @property {string=} summary
575 * @property {string=} description
576 * @property {Array<IssuesListColumn>=} defaultColumns
577 * @property {string=} hotlistPrivacy
578 */
579
580/**
581 * A HotlistItem Object returned by the pRPC API features_objects.proto.
582 *
583 * @typedef {Object} HotlistItemV0
584 * @property {Issue=} issue
585 * @property {number=} rank
586 * @property {UserRef=} adderRef
587 * @property {number=} addedTimestamp
588 * @property {string=} note
589 */
590
591/**
592 * A HotlistItem Object returned by the pRPC v3 API from feature_objects.proto.
593 *
594 * @typedef {Object} HotlistItem
595 * @property {string=} name
596 * @property {string=} issue
597 * @property {number=} rank
598 * @property {string=} adder
599 * @property {string=} createTime
600 * @property {string=} note
601 */
602
603/**
604 * Types defined in user_objects.proto.
605 */
606
607/**
608 * A User Object returned by the pRPC API user_objects.proto.
609 *
610 * @typedef {Object} UserV0
611 * @property {string=} displayName
612 * @property {number=} userId
613 * @property {boolean=} isSiteAdmin
614 * @property {string=} availability
615 * @property {UserRef=} linkedParentRef
616 * @property {Array<UserRef>=} linkedChildRefs
617 */
618
619/**
620 * A User Object returned by the pRPC v3 API from user_objects.proto.
621 *
622 * @typedef {Object} User
623 * @property {string=} name
624 * @property {string=} displayName
625 * @property {string=} availabilityMessage
626 */
627
628/**
629 * A ProjectStar Object returned by the pRPC v3 API from user_objects.proto.
630 *
631 * @typedef {Object} ProjectStar
632 * @property {string=} name
633 */
634
635/**
636 * A IssueStar Object returned by the pRPC v3 API from user_objects.proto.
637 *
638 * @typedef {Object} IssueStar
639 * @property {string=} name
640 */
641
642/**
643 * Type alias for any Star object.
644 *
645 * @typedef {ProjectStar|IssueStar} Star
646 */