@gitkraken/core-gitlens 0.30.0 → 0.32.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/CHANGELOG.md +30 -1
- package/dist/git/models/issue.d.ts +3 -2
- package/dist/git/models/issue.js +3 -1
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/issueOrPullRequest.d.ts +21 -0
- package/dist/git/models/pullRequest.d.ts +7 -3
- package/dist/git/models/pullRequest.js +3 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/providers/config.d.ts +8 -0
- package/dist/git/service.d.ts +2 -1
- package/dist/git/service.js +2 -1
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/issue.utils.js +3 -1
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/utils/issueOrPullRequest.utils.d.ts +3 -1
- package/dist/git/utils/issueOrPullRequest.utils.js +12 -1
- package/dist/git/utils/issueOrPullRequest.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.js +2 -0
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +3 -2
- package/dist/git/watching/worktreeSummary.js +4 -3
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +1 -1
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +17 -1
- package/dist/git-cli/exec/git.js +48 -6
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/indexLock.d.ts +2 -0
- package/dist/git-cli/exec/indexLock.js +2 -2
- package/dist/git-cli/exec/indexLock.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +4 -1
- package/dist/git-cli/providers/config.js +30 -40
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +7 -3
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/plus/git-github/api/github.js +16 -0
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +12 -0
- package/dist/plus/git-github/models.js +14 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/fieldPresence.d.ts +6 -2
- package/dist/plus/integrations/fieldPresence.js +47 -16
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +7 -5
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
- package/dist/plus/integrations/providers/gitlab/models.js +8 -6
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/models.js +18 -3
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +1 -0
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/docs/integrations.md +25 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue.utils.js","names":[],"sources":["../../../../git/src/utils/issue.utils.ts"],"sourcesContent":["import type {\n\tIssue,\n\tIssueProviderState,\n\tIssueRepositoryIdentityDescriptor,\n\tIssueShape,\n\tIssueSortField,\n\tIssueSorting,\n} from '../models/issue.js';\nimport { defaultIssueSort } from '../models/issue.js';\n\n/**\n * How each sort field is read off an {@link IssueShape}, for the reads that MERGE several provider queries and so\n * have to order the union themselves instead of letting the provider do it.\n *\n * Only the fields the shape actually carries appear. `priority`, `dueDate` and `resolved` are absent because\n * `IssueOrPullRequest`/`IssueShape` doesn't model them: a provider may well order by them server-side on a\n * single-query read, but a merged one cannot — which is exactly what {@link getIssueComparator} returning\n * `undefined` lets its caller refuse, instead of concatenating unordered runs and calling them sorted.\n */\nconst issueSortValues: Partial<Record<IssueSortField, (issue: IssueShape) => number | Date | string | undefined>> = {\n\tcreated: i => i.createdDate,\n\tupdated: i => i.updatedDate,\n\tclosed: i => i.closedDate,\n\tcomments: i => i.commentsCount,\n\treactions: i => i.thumbsUpCount,\n\ttitle: i => i.title,\n};\n\n/**\n * The order a read that ALWAYS orders is being made under: the caller's key, or the facade's default.\n *\n * The one place `?? defaultIssueSort` may be written. Several things downstream must agree on the answer — the\n * emitted provider qualifier, the fingerprint sealed into a cursor, the comparator that re-sorts a merged page and\n * the ceiling warning that names the order — and re-deriving the fallback at each is how they come to disagree,\n * which is not cosmetic: a cursor sealed with a key its query wasn't built with makes the fingerprint check refuse\n * valid resumptions.\n *\n * Note this is for a surface that CAN always order. A read whose provider may not express even the default resolves\n * through `resolveIssueSort` instead, which can answer \"leave the provider's own order\".\n */\nexport function effectiveIssueSort(sort: IssueSorting | undefined): IssueSorting {\n\treturn sort ?? defaultIssueSort;\n}\n\n/**\n * A comparator for one sort key over normalized issues, or `undefined` when the field isn't derivable from an\n * {@link IssueShape} — the signal that the key is only honorable on a SINGLE-origin read, where the provider\n * already ordered the page.\n *\n * `@gitkraken/provider-apis` carries a twin of this over its own `Issue` shape (`src/issueSort.ts`), which it uses\n * for the merges it performs itself. It is not importable — the SDK does not export it, and it takes a different\n * shape — so the two are separate implementations of one rule, and the rule below is the part that must not drift.\n *\n * Missing values sort LAST in both directions. That is deliberately not the same as negating the descending\n * comparator (which would float them to the front when ascending), and it is why they're partitioned before any\n * arithmetic rather than mapped to an infinite sentinel: two missing values have to compare equal, and\n * `-Infinity - -Infinity` is `NaN`, which makes the comparator inconsistent and the resulting order\n * implementation-defined.\n *\n * Note it orders whatever it is handed. Sorting a page that was already capped does not make it the top N.\n *\n * KNOWN DIVERGENCE, `title` only: strings are compared by code unit, so `'B' < 'a'`. A single-scope read is\n * ordered by the provider's own database instead — case-insensitive and accent-aware — so the same `title:asc`\n * yields \"Banana, apple, ábaco\" from a merged page and \"ábaco, apple, Banana\" from one repository. Deliberately\n * NOT fixed with `localeCompare`: the SDK's twin comparator (which performs the merges core doesn't, notably\n * GitLab's repo-ids aggregate) compares by code unit, so switching here would make two paths of the SAME\n * multi-repo read disagree — a worse divergence than the one it closes, and it would break the parity test in\n * `issueSortCapabilities.test.ts`. Closing this properly means changing the rule on BOTH sides at once; until\n * then it is a cosmetic ordering difference on one key, not wrong data.\n */\nexport function getIssueComparator(sort: IssueSorting): ((a: IssueShape, b: IssueShape) => number) | undefined {\n\t// The union's shape guarantees both halves, so this needs no validation — only the cast tsc can't infer.\n\tconst [field, direction] = sort.split(':') as [IssueSortField, 'asc' | 'desc'];\n\tconst getValue = issueSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport function getRepositoryIdentityForIssue(issue: IssueShape | Issue): IssueRepositoryIdentityDescriptor {\n\tif (issue.repository == null) throw new Error('Missing repository');\n\n\treturn {\n\t\tremote: {\n\t\t\turl: issue.repository.url,\n\t\t\tdomain: issue.provider.domain,\n\t\t},\n\t\tname: `${issue.repository.owner}/${issue.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: issue.provider.id,\n\t\t\tdomain: issue.provider.domain,\n\t\t\trepoDomain: issue.repository.owner,\n\t\t\trepoName: issue.repository.repo,\n\t\t\trepoOwnerDomain: issue.repository.owner,\n\t\t},\n\t};\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `repository.accessLevel`, so a tag would have field presence\n * report the viewer's access as fetched when the copy no longer has it.\n */\nexport function serializeIssue(value: IssueShape): IssueShape {\n\tconst serialized: IssueShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tissueType: value.issueType,\n\t\ttitle: value.title,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tstate: value.state,\n\t\tproviderState:\n\t\t\tvalue.providerState == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: value.providerState.id,\n\t\t\t\t\t\tname: value.providerState.name,\n\t\t\t\t\t\tcolor: value.providerState.color,\n\t\t\t\t\t\tcategory: value.providerState.category,\n\t\t\t\t\t},\n\t\tauthor:\n\t\t\tvalue.author == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: value.author.id,\n\t\t\t\t\t\tname: value.author.name,\n\t\t\t\t\t\tusername: value.author.username,\n\t\t\t\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\t\t\t\turl: value.author.url,\n\t\t\t\t\t},\n\t\trepository:\n\t\t\tvalue.repository == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\towner: value.repository.owner,\n\t\t\t\t\t\trepo: value.repository.repo,\n\t\t\t\t\t\turl: value.repository.url,\n\t\t\t\t\t},\n\t\tproject:\n\t\t\tvalue.project == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: value.project.id,\n\t\t\t\t\t\tname: value.project.name,\n\t\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t\t},\n\t\tassignees: value.assignees.map(assignee => ({\n\t\t\tid: assignee.id,\n\t\t\tname: assignee.name,\n\t\t\tusername: assignee.username,\n\t\t\tavatarUrl: assignee.avatarUrl,\n\t\t\turl: assignee.url,\n\t\t})),\n\t\tlabels:\n\t\t\tvalue.labels == null\n\t\t\t\t? undefined\n\t\t\t\t: value.labels.map(label => ({\n\t\t\t\t\t\tcolor: label.color,\n\t\t\t\t\t\tname: label.name,\n\t\t\t\t\t})),\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\tbody: value.body,\n\t\tbodyFormat: value.bodyFormat,\n\t\tbodyField: value.bodyField == null ? undefined : { id: value.bodyField.id, name: value.bodyField.name },\n\t\titerations:\n\t\t\tvalue.iterations == null\n\t\t\t\t? undefined\n\t\t\t\t: value.iterations.map(iteration => ({\n\t\t\t\t\t\tid: iteration.id,\n\t\t\t\t\t\tname: iteration.name,\n\t\t\t\t\t\tisActive: iteration.isActive,\n\t\t\t\t\t\tstartDate: iteration.startDate,\n\t\t\t\t\t\tendDate: iteration.endDate,\n\t\t\t\t\t})),\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tsyncedWith: value.syncedWith?.map(synced => ({ ...synced })),\n\t};\n\treturn serialized;\n}\n\n/** Whether a provider's workflow category ends the issue: done or abandoned (see {@link IssueProviderState.category}). */\nexport function isTerminalIssueStateCategory(category: IssueProviderState['category']): boolean {\n\treturn category === 'DONE' || category === 'CANCELED';\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,kBAA8G;CACnH,UAAS,MAAK,EAAE;CAChB,UAAS,MAAK,EAAE;CAChB,SAAQ,MAAK,EAAE;CACf,WAAU,MAAK,EAAE;CACjB,YAAW,MAAK,EAAE;CAClB,QAAO,MAAK,EAAE;AACf;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,MAA8C;CAChF,OAAO,QAAA;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAmB,MAA4E;CAE9G,MAAM,CAAC,OAAO,aAAa,KAAK,MAAM,GAAG;CACzC,MAAM,WAAW,gBAAgB;CACjC,I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YAAW,EAAE,GAAG,OAAO,EAAE;CAE5C;AACjB;;AAGA,SAAgB,6BAA6B,UAAmD;CAC/F,OAAO,aAAa,UAAU,aAAa;AAC5C"}
|
|
1
|
+
{"version":3,"file":"issue.utils.js","names":[],"sources":["../../../../git/src/utils/issue.utils.ts"],"sourcesContent":["import type {\n\tIssue,\n\tIssueProviderState,\n\tIssueRepositoryIdentityDescriptor,\n\tIssueShape,\n\tIssueSortField,\n\tIssueSorting,\n} from '../models/issue.js';\nimport { defaultIssueSort } from '../models/issue.js';\nimport { serializeMilestone } from './issueOrPullRequest.utils.js';\n\n/**\n * How each sort field is read off an {@link IssueShape}, for the reads that MERGE several provider queries and so\n * have to order the union themselves instead of letting the provider do it.\n *\n * Only the fields the shape actually carries appear. `priority`, `dueDate` and `resolved` are absent because\n * `IssueOrPullRequest`/`IssueShape` doesn't model them: a provider may well order by them server-side on a\n * single-query read, but a merged one cannot — which is exactly what {@link getIssueComparator} returning\n * `undefined` lets its caller refuse, instead of concatenating unordered runs and calling them sorted.\n */\nconst issueSortValues: Partial<Record<IssueSortField, (issue: IssueShape) => number | Date | string | undefined>> = {\n\tcreated: i => i.createdDate,\n\tupdated: i => i.updatedDate,\n\tclosed: i => i.closedDate,\n\tcomments: i => i.commentsCount,\n\treactions: i => i.thumbsUpCount,\n\ttitle: i => i.title,\n};\n\n/**\n * The order a read that ALWAYS orders is being made under: the caller's key, or the facade's default.\n *\n * The one place `?? defaultIssueSort` may be written. Several things downstream must agree on the answer — the\n * emitted provider qualifier, the fingerprint sealed into a cursor, the comparator that re-sorts a merged page and\n * the ceiling warning that names the order — and re-deriving the fallback at each is how they come to disagree,\n * which is not cosmetic: a cursor sealed with a key its query wasn't built with makes the fingerprint check refuse\n * valid resumptions.\n *\n * Note this is for a surface that CAN always order. A read whose provider may not express even the default resolves\n * through `resolveIssueSort` instead, which can answer \"leave the provider's own order\".\n */\nexport function effectiveIssueSort(sort: IssueSorting | undefined): IssueSorting {\n\treturn sort ?? defaultIssueSort;\n}\n\n/**\n * A comparator for one sort key over normalized issues, or `undefined` when the field isn't derivable from an\n * {@link IssueShape} — the signal that the key is only honorable on a SINGLE-origin read, where the provider\n * already ordered the page.\n *\n * `@gitkraken/provider-apis` carries a twin of this over its own `Issue` shape (`src/issueSort.ts`), which it uses\n * for the merges it performs itself. It is not importable — the SDK does not export it, and it takes a different\n * shape — so the two are separate implementations of one rule, and the rule below is the part that must not drift.\n *\n * Missing values sort LAST in both directions. That is deliberately not the same as negating the descending\n * comparator (which would float them to the front when ascending), and it is why they're partitioned before any\n * arithmetic rather than mapped to an infinite sentinel: two missing values have to compare equal, and\n * `-Infinity - -Infinity` is `NaN`, which makes the comparator inconsistent and the resulting order\n * implementation-defined.\n *\n * Note it orders whatever it is handed. Sorting a page that was already capped does not make it the top N.\n *\n * KNOWN DIVERGENCE, `title` only: strings are compared by code unit, so `'B' < 'a'`. A single-scope read is\n * ordered by the provider's own database instead — case-insensitive and accent-aware — so the same `title:asc`\n * yields \"Banana, apple, ábaco\" from a merged page and \"ábaco, apple, Banana\" from one repository. Deliberately\n * NOT fixed with `localeCompare`: the SDK's twin comparator (which performs the merges core doesn't, notably\n * GitLab's repo-ids aggregate) compares by code unit, so switching here would make two paths of the SAME\n * multi-repo read disagree — a worse divergence than the one it closes, and it would break the parity test in\n * `issueSortCapabilities.test.ts`. Closing this properly means changing the rule on BOTH sides at once; until\n * then it is a cosmetic ordering difference on one key, not wrong data.\n */\nexport function getIssueComparator(sort: IssueSorting): ((a: IssueShape, b: IssueShape) => number) | undefined {\n\t// The union's shape guarantees both halves, so this needs no validation — only the cast tsc can't infer.\n\tconst [field, direction] = sort.split(':') as [IssueSortField, 'asc' | 'desc'];\n\tconst getValue = issueSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport function getRepositoryIdentityForIssue(issue: IssueShape | Issue): IssueRepositoryIdentityDescriptor {\n\tif (issue.repository == null) throw new Error('Missing repository');\n\n\treturn {\n\t\tremote: {\n\t\t\turl: issue.repository.url,\n\t\t\tdomain: issue.provider.domain,\n\t\t},\n\t\tname: `${issue.repository.owner}/${issue.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: issue.provider.id,\n\t\t\tdomain: issue.provider.domain,\n\t\t\trepoDomain: issue.repository.owner,\n\t\t\trepoName: issue.repository.repo,\n\t\t\trepoOwnerDomain: issue.repository.owner,\n\t\t},\n\t};\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `repository.accessLevel`, so a tag would have field presence\n * report the viewer's access as fetched when the copy no longer has it.\n */\nexport function serializeIssue(value: IssueShape): IssueShape {\n\tconst serialized: IssueShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tissueType: value.issueType,\n\t\ttitle: value.title,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tstate: value.state,\n\t\tproviderState:\n\t\t\tvalue.providerState == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: value.providerState.id,\n\t\t\t\t\t\tname: value.providerState.name,\n\t\t\t\t\t\tcolor: value.providerState.color,\n\t\t\t\t\t\tcategory: value.providerState.category,\n\t\t\t\t\t},\n\t\tauthor:\n\t\t\tvalue.author == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: value.author.id,\n\t\t\t\t\t\tname: value.author.name,\n\t\t\t\t\t\tusername: value.author.username,\n\t\t\t\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\t\t\t\turl: value.author.url,\n\t\t\t\t\t},\n\t\trepository:\n\t\t\tvalue.repository == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\towner: value.repository.owner,\n\t\t\t\t\t\trepo: value.repository.repo,\n\t\t\t\t\t\turl: value.repository.url,\n\t\t\t\t\t},\n\t\tproject:\n\t\t\tvalue.project == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: value.project.id,\n\t\t\t\t\t\tname: value.project.name,\n\t\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t\t},\n\t\tassignees: value.assignees.map(assignee => ({\n\t\t\tid: assignee.id,\n\t\t\tname: assignee.name,\n\t\t\tusername: assignee.username,\n\t\t\tavatarUrl: assignee.avatarUrl,\n\t\t\turl: assignee.url,\n\t\t})),\n\t\tlabels:\n\t\t\tvalue.labels == null\n\t\t\t\t? undefined\n\t\t\t\t: value.labels.map(label => ({\n\t\t\t\t\t\tcolor: label.color,\n\t\t\t\t\t\tname: label.name,\n\t\t\t\t\t})),\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\tbody: value.body,\n\t\tbodyFormat: value.bodyFormat,\n\t\tbodyField: value.bodyField == null ? undefined : { id: value.bodyField.id, name: value.bodyField.name },\n\t\titerations:\n\t\t\tvalue.iterations == null\n\t\t\t\t? undefined\n\t\t\t\t: value.iterations.map(iteration => ({\n\t\t\t\t\t\tid: iteration.id,\n\t\t\t\t\t\tname: iteration.name,\n\t\t\t\t\t\tisActive: iteration.isActive,\n\t\t\t\t\t\tstartDate: iteration.startDate,\n\t\t\t\t\t\tendDate: iteration.endDate,\n\t\t\t\t\t})),\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tsyncedWith: value.syncedWith?.map(synced => ({ ...synced })),\n\t\tmilestone: serializeMilestone(value.milestone),\n\t};\n\treturn serialized;\n}\n\n/** Whether a provider's workflow category ends the issue: done or abandoned (see {@link IssueProviderState.category}). */\nexport function isTerminalIssueStateCategory(category: IssueProviderState['category']): boolean {\n\treturn category === 'DONE' || category === 'CANCELED';\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,kBAA8G;CACnH,UAAS,MAAK,EAAE;CAChB,UAAS,MAAK,EAAE;CAChB,SAAQ,MAAK,EAAE;CACf,WAAU,MAAK,EAAE;CACjB,YAAW,MAAK,EAAE;CAClB,QAAO,MAAK,EAAE;AACf;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,MAA8C;CAChF,OAAO,QAAA;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAmB,MAA4E;CAE9G,MAAM,CAAC,OAAO,aAAa,KAAK,MAAM,GAAG;CACzC,MAAM,WAAW,gBAAgB;CACjC,IAAI,YAAY,MAAM,OAAO,KAAA;CAE7B,QAAQ,GAAG,MAAM;EAChB,MAAM,OAAO,aAAa,SAAS,CAAC,CAAC;EACrC,MAAM,QAAQ,aAAa,SAAS,CAAC,CAAC;EACtC,IAAI,QAAQ,QAAQ,SAAS,MAAM;GAClC,IAAI,QAAQ,QAAQ,SAAS,MAAM,OAAO;GAC1C,OAAO,QAAQ,OAAO,IAAI;EAC3B;EAEA,MAAM,UAAU,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;EACvD,OAAO,cAAc,QAAQ,UAAU,CAAC;CACzC;AACD;AAEA,SAAS,aAAa,OAAwE;CAC7F,OAAO,iBAAiB,OAAO,MAAM,QAAQ,IAAI;AAClD;AAEA,SAAgB,8BAA8B,OAA8D;CAC3G,IAAI,MAAM,cAAc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;EAC7B;EACH,WAAW,MAAM,UAAU,KAAI,cAAa;GAC3C,IAAI,SAAS;GACb,MAAM,SAAS;GACf,UAAU,SAAS;GACnB,WAAW,SAAS;GACpB,KAAK,SAAS;EACf,EAAE;EACF,QACC,MAAM,UAAU,OACb,KAAA,IACA,MAAM,OAAO,KAAI,WAAU;GAC3B,OAAO,MAAM;GACb,MAAM,MAAM;EACb,EAAE;EACL,eAAe,MAAM;EACrB,eAAe,MAAM;EACrB,MAAM,MAAM;EACZ,YAAY,MAAM;EAClB,WAAW,MAAM,aAAa,OAAO,KAAA,IAAY;GAAE,IAAI,MAAM,UAAU;GAAI,MAAM,MAAM,UAAU;EAAK;EACtG,YACC,MAAM,cAAc,OACjB,KAAA,IACA,MAAM,WAAW,KAAI,eAAc;GACnC,IAAI,UAAU;GACd,MAAM,UAAU;GAChB,UAAU,UAAU;GACpB,WAAW,UAAU;GACrB,SAAS,UAAU;EACpB,EAAE;EACL,QAAQ,MAAM,UAAU,OAAO;GAAE,IAAI,MAAM,OAAO;GAAI,UAAU,MAAM,OAAO;EAAS,IAAI,KAAA;EAC1F,kBAAkB,MAAM;EACxB,YAAY,MAAM,YAAY,KAAI,YAAW,EAAE,GAAG,OAAO,EAAE;EAC3D,WAAW,mBAAmB,MAAM,SAAS;CAE9B;AACjB;;AAGA,SAAgB,6BAA6B,UAAmD;CAC/F,OAAO,aAAa,UAAU,aAAa;AAC5C"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { IssueOrPullRequest } from "../models/issueOrPullRequest.js";
|
|
1
|
+
import { IssueMilestone, IssueOrPullRequest } from "../models/issueOrPullRequest.js";
|
|
2
2
|
//#region ../git/src/utils/issueOrPullRequest.utils.d.ts
|
|
3
3
|
export declare function serializeIssueOrPullRequest(value: IssueOrPullRequest): IssueOrPullRequest;
|
|
4
|
+
/** Keeps `null` (none) apart from `undefined` (not read). */
|
|
5
|
+
export declare function serializeMilestone(value: IssueMilestone | null | undefined): IssueMilestone | null | undefined;
|
|
4
6
|
//#endregion
|
|
5
7
|
//# sourceMappingURL=issueOrPullRequest.utils.d.ts.map
|
|
@@ -19,7 +19,18 @@ function serializeIssueOrPullRequest(value) {
|
|
|
19
19
|
state: value.state
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
/** Keeps `null` (none) apart from `undefined` (not read). */
|
|
23
|
+
function serializeMilestone(value) {
|
|
24
|
+
if (value == null) return value;
|
|
25
|
+
return {
|
|
26
|
+
id: value.id,
|
|
27
|
+
title: value.title,
|
|
28
|
+
state: value.state,
|
|
29
|
+
...value.dueDate != null ? { dueDate: value.dueDate } : {},
|
|
30
|
+
...value.url != null ? { url: value.url } : {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
22
33
|
//#endregion
|
|
23
|
-
export { serializeIssueOrPullRequest };
|
|
34
|
+
export { serializeIssueOrPullRequest, serializeMilestone };
|
|
24
35
|
|
|
25
36
|
//# sourceMappingURL=issueOrPullRequest.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issueOrPullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/issueOrPullRequest.utils.ts"],"sourcesContent":["import type { IssueOrPullRequest } from '../models/issueOrPullRequest.js';\n\nexport function serializeIssueOrPullRequest(value: IssueOrPullRequest): IssueOrPullRequest {\n\tconst serialized: IssueOrPullRequest = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\ttitle: value.title,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tstate: value.state,\n\t};\n\treturn serialized;\n}\n"],"mappings":";AAEA,SAAgB,4BAA4B,OAA+C;CAmB1F,OAAO;EAjBN,MAAM,MAAM;EACZ,UAAU;GACT,IAAI,MAAM,SAAS;GACnB,MAAM,MAAM,SAAS;GACrB,QAAQ,MAAM,SAAS;GACvB,MAAM,MAAM,SAAS;EACtB;EACA,IAAI,MAAM;EACV,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,KAAK,MAAM;EACX,aAAa,MAAM;EACnB,aAAa,MAAM;EACnB,YAAY,MAAM;EAClB,QAAQ,MAAM;EACd,OAAO,MAAM;CAEE;AACjB"}
|
|
1
|
+
{"version":3,"file":"issueOrPullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/issueOrPullRequest.utils.ts"],"sourcesContent":["import type { IssueMilestone, IssueOrPullRequest } from '../models/issueOrPullRequest.js';\n\nexport function serializeIssueOrPullRequest(value: IssueOrPullRequest): IssueOrPullRequest {\n\tconst serialized: IssueOrPullRequest = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\ttitle: value.title,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tstate: value.state,\n\t};\n\treturn serialized;\n}\n\n/** Keeps `null` (none) apart from `undefined` (not read). */\nexport function serializeMilestone(value: IssueMilestone | null | undefined): IssueMilestone | null | undefined {\n\tif (value == null) return value;\n\n\treturn {\n\t\tid: value.id,\n\t\ttitle: value.title,\n\t\tstate: value.state,\n\t\t...(value.dueDate != null ? { dueDate: value.dueDate } : {}),\n\t\t...(value.url != null ? { url: value.url } : {}),\n\t};\n}\n"],"mappings":";AAEA,SAAgB,4BAA4B,OAA+C;CAmB1F,OAAO;EAjBN,MAAM,MAAM;EACZ,UAAU;GACT,IAAI,MAAM,SAAS;GACnB,MAAM,MAAM,SAAS;GACrB,QAAQ,MAAM,SAAS;GACvB,MAAM,MAAM,SAAS;EACtB;EACA,IAAI,MAAM;EACV,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,KAAK,MAAM;EACX,aAAa,MAAM;EACnB,aAAa,MAAM;EACnB,YAAY,MAAM;EAClB,QAAQ,MAAM;EACd,OAAO,MAAM;CAEE;AACjB;;AAGA,SAAgB,mBAAmB,OAA6E;CAC/G,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,IAAI,MAAM;EACV,OAAO,MAAM;EACb,OAAO,MAAM;EACb,GAAI,MAAM,WAAW,OAAO,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;EAC1D,GAAI,MAAM,OAAO,OAAO,EAAE,KAAK,MAAM,IAAI,IAAI,CAAC;CAC/C;AACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { shortenRevision } from "./revision.utils.js";
|
|
2
|
+
import { serializeMilestone } from "./issueOrPullRequest.utils.js";
|
|
2
3
|
//#region ../git/src/utils/pullRequest.utils.ts
|
|
3
4
|
/** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either
|
|
4
5
|
* just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one
|
|
@@ -185,6 +186,7 @@ function serializePullRequest(value) {
|
|
|
185
186
|
username: value.viewer.username
|
|
186
187
|
} : void 0,
|
|
187
188
|
viewerUnresolved: value.viewerUnresolved,
|
|
189
|
+
milestone: serializeMilestone(value.milestone),
|
|
188
190
|
project: value.project ? {
|
|
189
191
|
id: value.project.id,
|
|
190
192
|
name: value.project.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/pullRequest.utils.ts"],"sourcesContent":["import type {\n\tPullRequest,\n\tPullRequestComparisonRefs,\n\tPullRequestRefs,\n\tPullRequestRepositoryIdentityDescriptor,\n\tPullRequestShape,\n\tPullRequestSortField,\n\tPullRequestSorting,\n\tPullRequestStackInfo,\n} from '../models/pullRequest.js';\nimport { shortenRevision } from './revision.utils.js';\n\n/** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either\n * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one\n * source every merge-confirmation and merge-action label counts from, so they can't drift apart.\n * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the\n * webview side carry narrower serialized stack shapes. */\nexport function getStackedMergeCount(\n\tstack: Pick<PullRequestStackInfo, 'position' | 'size'> | undefined,\n\toptions?: { wholeStack?: boolean },\n): number {\n\tif (stack == null) return 1;\n\treturn options?.wholeStack ? stack.size : stack.position;\n}\n\n/**\n * How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its\n * relationship × state facets in the facade and so has to order the union itself instead of trusting the\n * per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and\n * the reason {@link PullRequestSortField} is just these two.\n */\nconst pullRequestSortValues: Partial<\n\tRecord<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>\n> = {\n\tcreated: pr => pr.createdDate,\n\tupdated: pr => pr.updatedDate,\n};\n\n/**\n * A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable\n * from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the\n * provider already ordered the page. Missing values sort LAST in both directions (partitioned before any\n * arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).\n *\n * Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the\n * top N.\n */\nexport function getPullRequestComparator(\n\tsort: PullRequestSorting,\n): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {\n\tconst [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];\n\tconst getValue = pullRequestSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport interface PullRequestUrlIdentity<TProvider extends string = string> {\n\tprovider?: TProvider;\n\n\townerAndRepo?: string;\n\tprNumber: string;\n}\n\nexport function getComparisonRefsForPullRequest(repoPath: string, prRefs: PullRequestRefs): PullRequestComparisonRefs {\n\tconst refs: PullRequestComparisonRefs = {\n\t\trepoPath: repoPath,\n\t\tbase: { ref: prRefs.base.sha, label: `${prRefs.base.branch} (${shortenRevision(prRefs.base.sha)})` },\n\t\thead: { ref: prRefs.head.sha, label: prRefs.head.branch },\n\t};\n\treturn refs;\n}\n\nexport function getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\tlet prNumber: string | undefined = undefined;\n\n\tlet match = search.match(/(?:\\/)(\\d+)/); // any number starting with \"/\"\n\tif (match != null) {\n\t\tprNumber = match[1];\n\t}\n\n\tif (prNumber == null) {\n\t\tmatch = search.match(/^#?(\\d+)$/); // just a number or with a leading \"#\"\n\t\tif (match != null) {\n\t\t\tprNumber = match[1];\n\t\t}\n\t}\n\n\treturn prNumber == null ? undefined : { ownerAndRepo: undefined, prNumber: prNumber, provider: undefined };\n}\n\n/** A pull request's display number from its url, or `undefined` for a url naming no pull request. Anchors\n * on the provider's pull request path segment (GitHub `pull`, Bitbucket `pull-requests`, GitLab\n * `merge_requests`, Azure `pullrequest`) so a digit-leading owner (`github.com/1Password/x/pull/123`)\n * can't win. */\nexport function getPullRequestNumberFromUrl(url: string): string | undefined {\n\t// No loose fallback: `getPullRequestIdentityFromMaybeUrl` scans for any `/<digits>`, which reads a bare\n\t// repository url like `github.com/1Password/sdk` as pull request #1. Callers that hold a real pull\n\t// request fall back to its id instead, and the one that asks whether a pasted url names a pull request\n\t// needs \"no\" for an answer.\n\treturn url.match(/(?:pull|pull-requests|merge_requests|pullrequest)\\/(\\d+)(?:\\b|\\/|$)/)?.[1];\n}\n\nexport function getRepositoryIdentityForPullRequest(\n\tpr: PullRequest,\n\theadRepo: boolean = true,\n): PullRequestRepositoryIdentityDescriptor {\n\tif (headRepo) {\n\t\treturn {\n\t\t\tremote: {\n\t\t\t\turl: pr.refs?.head?.url,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t},\n\t\t\tname: `${pr.refs?.head?.owner ?? pr.repository.owner}/${pr.refs?.head?.repo ?? pr.repository.repo}`,\n\t\t\tprovider: {\n\t\t\t\tid: pr.provider.id,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t\trepoDomain: pr.refs?.head?.owner ?? pr.repository.owner,\n\t\t\t\trepoName: pr.refs?.head?.repo ?? pr.repository.repo,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tremote: {\n\t\t\turl: pr.refs?.base?.url ?? pr.url,\n\t\t\tdomain: pr.provider.domain,\n\t\t},\n\t\tname: `${pr.refs?.base?.owner ?? pr.repository.owner}/${pr.refs?.base?.repo ?? pr.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: pr.provider.id,\n\t\t\tdomain: pr.provider.domain,\n\t\t\trepoDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t\trepoName: pr.refs?.base?.repo ?? pr.repository.repo,\n\t\t\trepoOwnerDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t},\n\t};\n}\n\nexport function isMaybeNonSpecificPullRequestSearchUrl(search: string): boolean {\n\treturn getPullRequestIdentityFromMaybeUrl(search) != null;\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `filesChanged`, `repository` and the class-only check rollup,\n * commit count and `viewerCanUpdate`, so a tag would have field presence report as fetched what the copy no longer has.\n */\nexport function serializePullRequest(value: PullRequest): PullRequestShape {\n\tconst serialized: PullRequestShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tnumber: value.number,\n\t\ttitle: value.title,\n\t\tbody: value.body,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tauthor: {\n\t\t\tid: value.author.id,\n\t\t\tname: value.author.name,\n\t\t\tusername: value.author.username,\n\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\turl: value.author.url,\n\t\t},\n\t\tstate: value.state,\n\t\tmergedDate: value.mergedDate,\n\t\tmergeableState: value.mergeableState,\n\t\trefs: value.refs\n\t\t\t? {\n\t\t\t\t\thead: {\n\t\t\t\t\t\texists: value.refs.head.exists,\n\t\t\t\t\t\towner: value.refs.head.owner,\n\t\t\t\t\t\trepo: value.refs.head.repo,\n\t\t\t\t\t\tsha: value.refs.head.sha,\n\t\t\t\t\t\tbranch: value.refs.head.branch,\n\t\t\t\t\t\turl: value.refs.head.url,\n\t\t\t\t\t\tcloneHttps: value.refs.head.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.head.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.head.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tbase: {\n\t\t\t\t\t\texists: value.refs.base.exists,\n\t\t\t\t\t\towner: value.refs.base.owner,\n\t\t\t\t\t\trepo: value.refs.base.repo,\n\t\t\t\t\t\tsha: value.refs.base.sha,\n\t\t\t\t\t\tbranch: value.refs.base.branch,\n\t\t\t\t\t\turl: value.refs.base.url,\n\t\t\t\t\t\tcloneHttps: value.refs.base.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.base.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.base.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tisCrossRepository: value.refs.isCrossRepository,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisDraft: value.isDraft,\n\t\tadditions: value.additions,\n\t\tdeletions: value.deletions,\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\treviewDecision: value.reviewDecision,\n\t\treviewRequests: value.reviewRequests,\n\t\tlatestReviews: value.latestReviews,\n\t\tassignees: value.assignees,\n\t\tauthoredByMe: value.authoredByMe,\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tproject: value.project\n\t\t\t? {\n\t\t\t\t\tid: value.project.id,\n\t\t\t\t\tname: value.project.name,\n\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstack: value.stack\n\t\t\t? {\n\t\t\t\t\tid: value.stack.id,\n\t\t\t\t\tnumber: value.stack.number,\n\t\t\t\t\tsize: value.stack.size,\n\t\t\t\t\tposition: value.stack.position,\n\t\t\t\t\tbaseRef: value.stack.baseRef,\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n\treturn serialized;\n}\n"],"mappings":";;;;;;;AAiBA,SAAgB,qBACf,OACA,SACS;CACT,IAAI,SAAS,MAAM,OAAO;CAC1B,OAAO,SAAS,aAAa,MAAM,OAAO,MAAM;AACjD;;;;;;;AAQA,MAAM,wBAEF;CACH,UAAS,OAAM,GAAG;CAClB,UAAS,OAAM,GAAG;AACnB;;;;;;;;;;AAWA,SAAgB,yBACf,MACqE;CACrE,MAAM,CAAC,OAAO,aAAa,KAAK,MAAM,GAAG;CACzC,MAAM,WAAW,sBAAsB;CACvC,IAAI,YAAY,MAAM,OAAO,KAAA;CAE7B,QAAQ,GAAG,MAAM;EAChB,MAAM,OAAO,aAAa,SAAS,CAAC,CAAC;EACrC,MAAM,QAAQ,aAAa,SAAS,CAAC,CAAC;EACtC,IAAI,QAAQ,QAAQ,SAAS,MAAM;GAClC,IAAI,QAAQ,QAAQ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ourcesContent":["import type {\n\tPullRequest,\n\tPullRequestComparisonRefs,\n\tPullRequestRefs,\n\tPullRequestRepositoryIdentityDescriptor,\n\tPullRequestShape,\n\tPullRequestSortField,\n\tPullRequestSorting,\n\tPullRequestStackInfo,\n} from '../models/pullRequest.js';\nimport { serializeMilestone } from './issueOrPullRequest.utils.js';\nimport { shortenRevision } from './revision.utils.js';\n\n/** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either\n * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one\n * source every merge-confirmation and merge-action label counts from, so they can't drift apart.\n * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the\n * webview side carry narrower serialized stack shapes. */\nexport function getStackedMergeCount(\n\tstack: Pick<PullRequestStackInfo, 'position' | 'size'> | undefined,\n\toptions?: { wholeStack?: boolean },\n): number {\n\tif (stack == null) return 1;\n\treturn options?.wholeStack ? stack.size : stack.position;\n}\n\n/**\n * How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its\n * relationship × state facets in the facade and so has to order the union itself instead of trusting the\n * per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and\n * the reason {@link PullRequestSortField} is just these two.\n */\nconst pullRequestSortValues: Partial<\n\tRecord<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>\n> = {\n\tcreated: pr => pr.createdDate,\n\tupdated: pr => pr.updatedDate,\n};\n\n/**\n * A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable\n * from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the\n * provider already ordered the page. Missing values sort LAST in both directions (partitioned before any\n * arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).\n *\n * Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the\n * top N.\n */\nexport function getPullRequestComparator(\n\tsort: PullRequestSorting,\n): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {\n\tconst [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];\n\tconst getValue = pullRequestSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport interface PullRequestUrlIdentity<TProvider extends string = string> {\n\tprovider?: TProvider;\n\n\townerAndRepo?: string;\n\tprNumber: string;\n}\n\nexport function getComparisonRefsForPullRequest(repoPath: string, prRefs: PullRequestRefs): PullRequestComparisonRefs {\n\tconst refs: PullRequestComparisonRefs = {\n\t\trepoPath: repoPath,\n\t\tbase: { ref: prRefs.base.sha, label: `${prRefs.base.branch} (${shortenRevision(prRefs.base.sha)})` },\n\t\thead: { ref: prRefs.head.sha, label: prRefs.head.branch },\n\t};\n\treturn refs;\n}\n\nexport function getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\tlet prNumber: string | undefined = undefined;\n\n\tlet match = search.match(/(?:\\/)(\\d+)/); // any number starting with \"/\"\n\tif (match != null) {\n\t\tprNumber = match[1];\n\t}\n\n\tif (prNumber == null) {\n\t\tmatch = search.match(/^#?(\\d+)$/); // just a number or with a leading \"#\"\n\t\tif (match != null) {\n\t\t\tprNumber = match[1];\n\t\t}\n\t}\n\n\treturn prNumber == null ? undefined : { ownerAndRepo: undefined, prNumber: prNumber, provider: undefined };\n}\n\n/** A pull request's display number from its url, or `undefined` for a url naming no pull request. Anchors\n * on the provider's pull request path segment (GitHub `pull`, Bitbucket `pull-requests`, GitLab\n * `merge_requests`, Azure `pullrequest`) so a digit-leading owner (`github.com/1Password/x/pull/123`)\n * can't win. */\nexport function getPullRequestNumberFromUrl(url: string): string | undefined {\n\t// No loose fallback: `getPullRequestIdentityFromMaybeUrl` scans for any `/<digits>`, which reads a bare\n\t// repository url like `github.com/1Password/sdk` as pull request #1. Callers that hold a real pull\n\t// request fall back to its id instead, and the one that asks whether a pasted url names a pull request\n\t// needs \"no\" for an answer.\n\treturn url.match(/(?:pull|pull-requests|merge_requests|pullrequest)\\/(\\d+)(?:\\b|\\/|$)/)?.[1];\n}\n\nexport function getRepositoryIdentityForPullRequest(\n\tpr: PullRequest,\n\theadRepo: boolean = true,\n): PullRequestRepositoryIdentityDescriptor {\n\tif (headRepo) {\n\t\treturn {\n\t\t\tremote: {\n\t\t\t\turl: pr.refs?.head?.url,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t},\n\t\t\tname: `${pr.refs?.head?.owner ?? pr.repository.owner}/${pr.refs?.head?.repo ?? pr.repository.repo}`,\n\t\t\tprovider: {\n\t\t\t\tid: pr.provider.id,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t\trepoDomain: pr.refs?.head?.owner ?? pr.repository.owner,\n\t\t\t\trepoName: pr.refs?.head?.repo ?? pr.repository.repo,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tremote: {\n\t\t\turl: pr.refs?.base?.url ?? pr.url,\n\t\t\tdomain: pr.provider.domain,\n\t\t},\n\t\tname: `${pr.refs?.base?.owner ?? pr.repository.owner}/${pr.refs?.base?.repo ?? pr.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: pr.provider.id,\n\t\t\tdomain: pr.provider.domain,\n\t\t\trepoDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t\trepoName: pr.refs?.base?.repo ?? pr.repository.repo,\n\t\t\trepoOwnerDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t},\n\t};\n}\n\nexport function isMaybeNonSpecificPullRequestSearchUrl(search: string): boolean {\n\treturn getPullRequestIdentityFromMaybeUrl(search) != null;\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `filesChanged`, `repository` and the class-only check rollup,\n * commit count and `viewerCanUpdate`, so a tag would have field presence report as fetched what the copy no longer has.\n */\nexport function serializePullRequest(value: PullRequest): PullRequestShape {\n\tconst serialized: PullRequestShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tnumber: value.number,\n\t\ttitle: value.title,\n\t\tbody: value.body,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tauthor: {\n\t\t\tid: value.author.id,\n\t\t\tname: value.author.name,\n\t\t\tusername: value.author.username,\n\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\turl: value.author.url,\n\t\t},\n\t\tstate: value.state,\n\t\tmergedDate: value.mergedDate,\n\t\tmergeableState: value.mergeableState,\n\t\trefs: value.refs\n\t\t\t? {\n\t\t\t\t\thead: {\n\t\t\t\t\t\texists: value.refs.head.exists,\n\t\t\t\t\t\towner: value.refs.head.owner,\n\t\t\t\t\t\trepo: value.refs.head.repo,\n\t\t\t\t\t\tsha: value.refs.head.sha,\n\t\t\t\t\t\tbranch: value.refs.head.branch,\n\t\t\t\t\t\turl: value.refs.head.url,\n\t\t\t\t\t\tcloneHttps: value.refs.head.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.head.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.head.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tbase: {\n\t\t\t\t\t\texists: value.refs.base.exists,\n\t\t\t\t\t\towner: value.refs.base.owner,\n\t\t\t\t\t\trepo: value.refs.base.repo,\n\t\t\t\t\t\tsha: value.refs.base.sha,\n\t\t\t\t\t\tbranch: value.refs.base.branch,\n\t\t\t\t\t\turl: value.refs.base.url,\n\t\t\t\t\t\tcloneHttps: value.refs.base.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.base.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.base.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tisCrossRepository: value.refs.isCrossRepository,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisDraft: value.isDraft,\n\t\tadditions: value.additions,\n\t\tdeletions: value.deletions,\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\treviewDecision: value.reviewDecision,\n\t\treviewRequests: value.reviewRequests,\n\t\tlatestReviews: value.latestReviews,\n\t\tassignees: value.assignees,\n\t\tauthoredByMe: value.authoredByMe,\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tmilestone: serializeMilestone(value.milestone),\n\t\tproject: value.project\n\t\t\t? {\n\t\t\t\t\tid: value.project.id,\n\t\t\t\t\tname: value.project.name,\n\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstack: value.stack\n\t\t\t? {\n\t\t\t\t\tid: value.stack.id,\n\t\t\t\t\tnumber: value.stack.number,\n\t\t\t\t\tsize: value.stack.size,\n\t\t\t\t\tposition: value.stack.position,\n\t\t\t\t\tbaseRef: value.stack.baseRef,\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n\treturn serialized;\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgB,qBACf,OACA,SACS;CACT,IAAI,SAAS,MAAM,OAAO;CAC1B,OAAO,SAAS,aAAa,MAAM,OAAO,MAAM;AACjD;;;;;;;AAQA,MAAM,wBAEF;CACH,UAAS,OAAM,GAAG;CAClB,UAAS,OAAM,GAAG;AACnB;;;;;;;;;;AAWA,SAAgB,yBACf,MACqE;CACrE,MAAM,CAAC,OAAO,aAAa,KAAK,MAAM,GAA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;EAC7B,IACC,KAAA;EACH,OAAO,MAAM,QACV;GACA,IAAI,MAAM,MAAM;GAChB,QAAQ,MAAM,MAAM;GACpB,MAAM,MAAM,MAAM;GAClB,UAAU,MAAM,MAAM;GACtB,SAAS,MAAM,MAAM;EACtB,IACC,KAAA;CAEY;AACjB"}
|
|
@@ -224,7 +224,7 @@ export declare class WorktreeSummaryService implements UnifiedDisposable {
|
|
|
224
224
|
/**
|
|
225
225
|
* Returns a worktree's summary. For a subscribed worktree, the cached value — after waiting for any run in flight
|
|
226
226
|
* or pending; it rejects with the read's error when there is still no value, after one more read when git ran out
|
|
227
|
-
* of time. Otherwise the last read of it, re-reading what moved since (see {@link getSummarySnapshot}).
|
|
227
|
+
* of time or the start failed. Otherwise the last read of it, re-reading what moved since (see {@link getSummarySnapshot}).
|
|
228
228
|
*/
|
|
229
229
|
getSummary(repoPath: string, cancellation?: AbortSignal): Promise<WorktreeSummary>;
|
|
230
230
|
/**
|
|
@@ -246,7 +246,8 @@ export declare class WorktreeSummaryService implements UnifiedDisposable {
|
|
|
246
246
|
* A first read cut short (git ran past its time limit, or was killed) says nothing about the worktree, and no git
|
|
247
247
|
* event may come to read it again, so each reader reads once more, joining a read in flight, before getting its
|
|
248
248
|
* error, and so does each new subscriber. Only they cause this: reads of a worktree run one at a time, each bounded
|
|
249
|
-
* by the time limit and holding a read slot.
|
|
249
|
+
* by the time limit and holding a read slot. A start that failed has no watch for an event to come from, however it
|
|
250
|
+
* failed, so it gets the same.
|
|
250
251
|
*/
|
|
251
252
|
private getSubscribedSummary;
|
|
252
253
|
/** The value once any run in flight or pending is done, `undefined` when it has none */
|
|
@@ -247,7 +247,7 @@ var WorktreeSummaryService = class {
|
|
|
247
247
|
/**
|
|
248
248
|
* Returns a worktree's summary. For a subscribed worktree, the cached value — after waiting for any run in flight
|
|
249
249
|
* or pending; it rejects with the read's error when there is still no value, after one more read when git ran out
|
|
250
|
-
* of time. Otherwise the last read of it, re-reading what moved since (see {@link getSummarySnapshot}).
|
|
250
|
+
* of time or the start failed. Otherwise the last read of it, re-reading what moved since (see {@link getSummarySnapshot}).
|
|
251
251
|
*/
|
|
252
252
|
async getSummary(repoPath, cancellation) {
|
|
253
253
|
const key = getRepositoryKey(repoPath);
|
|
@@ -286,12 +286,13 @@ var WorktreeSummaryService = class {
|
|
|
286
286
|
* A first read cut short (git ran past its time limit, or was killed) says nothing about the worktree, and no git
|
|
287
287
|
* event may come to read it again, so each reader reads once more, joining a read in flight, before getting its
|
|
288
288
|
* error, and so does each new subscriber. Only they cause this: reads of a worktree run one at a time, each bounded
|
|
289
|
-
* by the time limit and holding a read slot.
|
|
289
|
+
* by the time limit and holding a read slot. A start that failed has no watch for an event to come from, however it
|
|
290
|
+
* failed, so it gets the same.
|
|
290
291
|
*/
|
|
291
292
|
async getSubscribedSummary(entry, cancellation) {
|
|
292
293
|
let summary = await this.waitForValue(entry, cancellation);
|
|
293
294
|
if (summary != null) return summary;
|
|
294
|
-
if (isCancellationError(entry.error)) {
|
|
295
|
+
if (isCancellationError(entry.error) || entry.handle == null) {
|
|
295
296
|
if (cancellation?.aborted) throw new CancellationError();
|
|
296
297
|
if (entry.running == null) {
|
|
297
298
|
if (entry.handle == null) entry.running = this.start(entry);
|