@gitkraken/core-gitlens 0.65.0 → 0.67.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/plus/integrations/extensionManager.js.map +1 -1
  3. package/dist/plus/integrations/index.d.ts +2 -1
  4. package/dist/plus/integrations/index.js +12 -2
  5. package/dist/plus/integrations/index.js.map +1 -1
  6. package/dist/plus/integrations/integrationService.d.ts +20 -6
  7. package/dist/plus/integrations/integrationService.js +62 -9
  8. package/dist/plus/integrations/integrationService.js.map +1 -1
  9. package/dist/plus/integrations/manager.d.ts +7 -4
  10. package/dist/plus/integrations/models/gitlabMergeRequestWrites.d.ts +3 -9
  11. package/dist/plus/integrations/models/linearIssueWrites.d.ts +101 -0
  12. package/dist/plus/integrations/models/linearIssueWrites.js +0 -0
  13. package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
  14. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  15. package/dist/plus/integrations/providers/gitlab/mergeRequestPermissions.d.ts +36 -0
  16. package/dist/plus/integrations/providers/gitlab/mergeRequestPermissions.js +36 -0
  17. package/dist/plus/integrations/providers/gitlab/mergeRequestPermissions.js.map +1 -0
  18. package/dist/plus/integrations/providers/gitlab/mergeRequestWrites.d.ts +1 -2
  19. package/dist/plus/integrations/providers/gitlab/mergeRequestWrites.js +93 -73
  20. package/dist/plus/integrations/providers/gitlab/mergeRequestWrites.js.map +1 -1
  21. package/dist/plus/integrations/providers/gitlab/writeTransport.d.ts +7 -1
  22. package/dist/plus/integrations/providers/gitlab/writeTransport.js +21 -2
  23. package/dist/plus/integrations/providers/gitlab/writeTransport.js.map +1 -1
  24. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  25. package/dist/plus/integrations/providers/linear.d.ts +6 -6
  26. package/dist/plus/integrations/providers/linear.js +36 -14
  27. package/dist/plus/integrations/providers/linear.js.map +1 -1
  28. package/dist/plus/integrations/providers/linearIssueWriteTransport.d.ts +27 -0
  29. package/dist/plus/integrations/providers/linearIssueWriteTransport.js +110 -0
  30. package/dist/plus/integrations/providers/linearIssueWriteTransport.js.map +1 -0
  31. package/dist/plus/integrations/providers/linearIssueWrites.d.ts +27 -0
  32. package/dist/plus/integrations/providers/linearIssueWrites.js +310 -0
  33. package/dist/plus/integrations/providers/linearIssueWrites.js.map +1 -0
  34. package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +2 -0
  35. package/dist/plus/integrations/providers/linearIssuesEtag.js +27 -1
  36. package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
  37. package/dist/plus/integrations/providers/providerApiClient.d.ts +2 -2
  38. package/dist/plus/integrations/providers/providerApiClient.js +5 -5
  39. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  40. package/dist/plus/integrations/providers/providerErrors.d.ts +9 -0
  41. package/dist/plus/integrations/providers/providerErrors.js +1 -1
  42. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  43. package/dist/plus/integrations/providers/providersApi.d.ts +1 -0
  44. package/dist/plus/integrations/providers/providersApi.js +8 -1
  45. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  46. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  47. package/docs/integrations.md +92 -14
  48. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
2
2
  import { PullRequest, PullRequestFilter, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
3
3
  import { IntegrationIds } from "../constants.js";
4
+ import "../providerFilters.js";
4
5
  import { ProviderWarning } from "../results.js";
5
6
  import { ProviderSweepTarget, PullRequestSweepOptions } from "../manager.js";
6
7
  import { IntegrationResult } from "../models/publicIntegration.js";
@@ -325,7 +325,8 @@ The hosts with a cheap check select only the change state:
325
325
  leaves out a key it can't answer (deleted, not visible, malformed or moved), so such a key falls through to its own
326
326
  full read, whose 404 is what proves an absence.
327
327
  - **Linear** (the tracker form of `getIssuesBatch`): one query per team per 50 issues, archived ones included, where
328
- the full read sends one request per issue. The query matches the team's current key, while the full read may also
328
+ the full read checks each issue by ID. An archived issue gets one additional check for its trash status.
329
+ Trash is a proven absence in either read. The query matches the team's current key, while the full read may also
329
330
  resolve an identifier the issue no longer carries (its team was renamed, or it moved), so an issue the query leaves
330
331
  out, or an identifier that isn't a team key and a number, falls through to its own full read, which decides whether
331
332
  it is absent. The check also reads each issue's GitHub sync links (`syncedWith`) with their coordinates, so a link
@@ -1019,9 +1020,12 @@ as other operations. Failures with `mutationDispatched: false` stopped before se
1019
1020
  the write. An `applied: 'maybe'` failure requires reconciliation before another attempt.
1020
1021
  A `not-found` response can also mean GitLab hid a resource from the selected account.
1021
1022
 
1022
- ### GitLab.com merge request writes
1023
+ ### GitLab merge request writes
1023
1024
 
1024
- Use the same scope as GitLab.com issue writes. `project` and `projectId` always name the
1025
+ Use the same scope as GitLab issue writes. Self-Managed calls require
1026
+ `GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted` and the selected connection's canonical
1027
+ `baseUrl`, including its installation path. The result identifies the provider, base URL,
1028
+ connection, authenticated account and canonical target project. `project` and `projectId` always name the
1025
1029
  target project. A merge request is addressed by the target project, its project-local `iid`
1026
1030
  and its global `id`, all decimal strings. Writes may also pass `expectedProjectPath`, and
1027
1031
  a moved or renamed project then reports `conflict`.
@@ -1049,14 +1053,13 @@ reports `conflict`, and Core does not send it again. A response without `lock_ve
1049
1053
  edited without that fence.
1050
1054
 
1051
1055
  A delete may pass `expectedState`, and a merge request in another state reports `conflict`.
1052
- Core deletes conditionally on the `updated_at` it read. Anything GitLab records on the
1053
- merge request after that read, such as a reopen, an edit or a comment, reports `conflict`
1054
- and deletes nothing. GitLab reports `updated_at` to the millisecond, so the fence cannot
1055
- tell apart an update recorded in the same millisecond as the one Core read; past that,
1056
- GitLab's own check at delete time is the last one. Core does not delete a merge request
1057
- whose `updated_at` it could not read as a timestamp with at least millisecond precision.
1058
-
1059
- A merge pins everything the caller approved: `expectedExecution`, `expectedMergeMethod`,
1056
+ Core sends a conditional delete based on the `updated_at` it read. GitLab responds with
1057
+ `conflict` when its conditional check sees a newer update, such as a reopen, edit or comment.
1058
+ The fence cannot distinguish updates within the millisecond GitLab reported, and GitLab's
1059
+ check is separate from the deletion. Core requires an `updated_at` timestamp with at
1060
+ least millisecond precision.
1061
+
1062
+ A merge revalidates the caller's `expectedExecution`, `expectedMergeMethod`,
1060
1063
  `expectedRemovesSourceBranch`, `expectedSourceProjectId`, both branch names,
1061
1064
  `expectedSourceSha`, `expectedTargetSha` and `squash`. The project owns the merge method,
1062
1065
  and Core never chooses another. GitLab compares the source commit atomically. Core reads
@@ -1064,15 +1067,32 @@ the target branch and its tip immediately before dispatch, and GitLab offers no
1064
1067
  guard for them. The capability's `squash` says what the merge may pass: `required` takes
1065
1068
  `squash: true`, `unavailable` takes `false`, and `optional` takes either. A merge request
1066
1069
  already set to squash is `required`, because GitLab's merge endpoints cannot turn squashing
1067
- off. A drifted source or target reports `source-changed` or `target-changed`, and any other
1068
- drift reports `conflict`. `removesSourceBranch` is what the merge asks for: GitLab may keep
1070
+ off. A source or target change detected before dispatch reports `source-changed` or
1071
+ `target-changed`. A changed merge method or option reports `conflict`.
1072
+ `removesSourceBranch` is what the merge asks for: GitLab may keep
1069
1073
  a protected source branch, or one the merging user cannot delete.
1070
1074
 
1071
1075
  Core reports `merged` only when GitLab's receipt still names the approved source project,
1072
1076
  both branches and the source commit. A merge it cannot tie to them, including one it
1073
1077
  observes after GitLab answered `422`, is `applied: 'maybe'`.
1074
1078
 
1075
- `execution: 'merge'` merges directly and returns `status: 'merged'`. On a project with
1079
+ `execution: 'merge'` merges directly and returns `status: 'merged'`. Self-Managed direct
1080
+ merges check the live branch tips, then reread the canonical merge request and project
1081
+ policy before dispatch. The final permission read must still agree with the merge
1082
+ request's source project, branches and head. Core passes the approved source-branch
1083
+ removal setting explicitly.
1084
+ GitLab checks the source SHA atomically. The target branch, target SHA and project
1085
+ policy can still change after these reads because GitLab's merge API does not accept
1086
+ them as preconditions. A receipt with an inconsistent squash result, or a `422` with
1087
+ an open MR when GitLab could already have persisted the requested squash setting,
1088
+ is reported as `applied: 'maybe'`.
1089
+ On installations whose schema lacks `squashReadOnly`, the target's REST squash setting
1090
+ and the merge request's effective squash state determine the capability. If GitLab omits
1091
+ the squash policy, merge is unavailable while other operations remain available according
1092
+ to their permissions. Self-Managed deletion requires the project owner access level and
1093
+ a timestamp usable by the conditional REST delete endpoint.
1094
+
1095
+ On a GitLab.com project with
1076
1096
  merge trains, `execution` is `'train'`: Core adds the merge request to the train without
1077
1097
  auto-merge and returns `status: 'queued'` while the merge request stays open. Core never
1078
1098
  merges around a train, never schedules auto-merge, and never falls back from one execution
@@ -1082,6 +1102,8 @@ that moved and for auto-merge enabled meanwhile, so a refused enqueue reports `c
1082
1102
  Core reports `queued` only when the train entry GitLab answers with, or the merge request's
1083
1103
  own train status when that page does not hold it, names this open merge request on the
1084
1104
  approved target branch. Anything else is `applied: 'maybe'`, and Core does not enqueue again.
1105
+ On Self-Managed, a project that requires a train reports `unsupported` with the
1106
+ `merge-train` blocker.
1085
1107
 
1086
1108
  An unavailable or refused merge reports `policy-blocked` with a `blocker` (`conflicts`,
1087
1109
  `pipeline`, `approvals`, `discussions`, `draft`, `rebase`, `status-checks`, `checking`,
@@ -1169,6 +1191,62 @@ credential. `mutationDispatched: false` means Core stopped before sending the wr
1169
1191
  `applied: 'maybe'` as uncertain and reconcile the issue state before retrying. A successful delete
1170
1192
  requires Jira's `204` acknowledgement. Jira can also return `404` when visibility changes. [Jira Cloud REST v2 issue operations](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/)
1171
1193
 
1194
+ ### Linear issue writes
1195
+
1196
+ Import the Linear methods and types from `@gitkraken/core-gitlens/plus/integrations/index.js`. Every
1197
+ request identifies the `connectionId` and the expected Linear `organizationId`. Use the live workspace
1198
+ ID from Linear discovery. Success results include the viewer's `accountId` and the workspace's
1199
+ `id`, `urlKey`, `url` and `name`. Pass `expectedAccountId` to verify a previously observed viewer
1200
+ and `expectedOrganizationUrlKey` to verify the workspace slug case-insensitively.
1201
+
1202
+ | Method | Input beyond the workspace and connection | Success |
1203
+ | ---------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
1204
+ | `getLinearIssueCreateOptions` | Team UUID (`teamId`) or exact canonical `teamKey` | Team ID, key and name, plus its live workflow states. |
1205
+ | `getLinearIssueWriteOptions` | Issue identifier or UUID (`issue`), optional `teamId` and `expectedIssueId` | Canonical issue, valid workflow states and explicit unknown edit/delete permissions. |
1206
+ | `resolveLinearIssueWriteTarget` | Same as `getLinearIssueWriteOptions` | Fresh canonical issue and account identity for confirmation or revalidation. |
1207
+ | `writeLinearIssue` with `action: 'create'` | `teamId`, nonblank `title`, optional Markdown `description` and `stateId` | Created issue receipt. |
1208
+ | `writeLinearIssue` with `action: 'edit'` | `teamId`, `issue`, `expectedIssueId`, at least one of `title` or `description` | Updated issue receipt. |
1209
+ | `writeLinearIssue` with `action: 'transition'` | `teamId`, `issue`, `expectedIssueId`, `stateId` | Updated issue receipt. |
1210
+ | `deleteLinearIssue` | `teamId`, `issue`, `expectedIssueId`, `expectedAccountId`, `expectedOrganizationUrlKey` | Pre-delete issue receipt and `deletion.trashed: true`, with `deletion.archivedAt` when Linear returns a timestamp. |
1211
+
1212
+ The team lookup works independently of the first page of the general team listing. Workflow
1213
+ discovery fails if the state list cannot be read in full. State entries contain `id`, `name`, Linear's
1214
+ `type` and the normalized `category`. Creation and transitions accept live state UUIDs belonging to
1215
+ the selected team. Reserved duplicate states require an issue relation and are excluded from these
1216
+ options. An omitted initial state lets Linear choose its default. On edit, an omitted description
1217
+ retains the current value and an empty string clears it.
1218
+
1219
+ An issue receipt contains the canonical UUID, identifier, URL, title, update timestamp, team and
1220
+ current state. Issue discovery and target resolution return the issue's live team. Supply `teamId`
1221
+ to require a matching team on these reads. Edit, transition and delete require both the team and the
1222
+ expected issue UUID and dispatch by canonical UUID. Issue identifiers must match the issue's current
1223
+ identifier case-insensitively. A moved or renamed identifier returns `conflict`; use the UUID in
1224
+ `issue` to address the issue by its stable ID. A supplied workspace slug or team mismatch also returns
1225
+ `conflict`. A viewer mismatch returns `forbidden`. Linear evaluates access on each
1226
+ mutation. GitKraken's OAuth configuration requests `read`, `write`, `issues:create` and
1227
+ `comments:create`; issue creation, including an initial state, and issue updates use the write grant.
1228
+ An explicit OAuth scope refusal returns `insufficient-scope`; account or policy denials return
1229
+ `forbidden`.
1230
+
1231
+ Deletion moves the issue and accessible unarchived sub-issues to the trash. Linear retains them for
1232
+ 30 days. Archiving retains issues outside the active list, and immediate permanent deletion requires
1233
+ workspace entity-management permission. An issue in the trash returns `not-found` during write
1234
+ option discovery, target resolution and mutation preflight, even if Linear still returns it by ID.
1235
+ Point and batch issue reads also treat trashed issues as absent. Archived issues outside the trash
1236
+ read as closed. If their trash status cannot be verified, the read fails.
1237
+ Receipts include `archivedAt` when available. Archive-only issues remain addressable and Linear
1238
+ evaluates mutation permissions. A successful create or update response can carry `trashed: true`
1239
+ if Linear reports the issue in the trash in that receipt. Resolve the issue again before asking for
1240
+ confirmation and carry the confirmed issue, team, viewer and workspace slug into
1241
+ `deleteLinearIssue`. Linear has no atomic team precondition for these mutations.
1242
+
1243
+ Failures share `IssueTrackerWriteFailure`. `mutationDispatched: false` identifies a refusal before
1244
+ sending the mutation. If `applied: 'maybe'` is present, reconcile the outcome before another write.
1245
+ Core sends each mutation once. See [Linear's GraphQL API](https://linear.app/developers/graphql),
1246
+ [OAuth scopes](https://linear.app/developers/oauth-2-0-authentication),
1247
+ [GraphQL schema](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/objects/Mutation)
1248
+ and [delete and archive guidance](https://linear.app/docs/delete-archive-issues).
1249
+
1172
1250
  ### Azure DevOps Services work item writes
1173
1251
 
1174
1252
  Use the work item methods on `IntegrationManager` from `@gitkraken/core-gitlens/plus/integrations/index.js`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gitkraken/core-gitlens",
3
3
  "description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
4
- "version": "0.65.0",
4
+ "version": "0.67.0",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
7
7
  "name": "GitKraken",