@gitkraken/core-gitlens 0.68.0 → 0.69.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 (37) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +1 -1
  3. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -1
  4. package/dist/plus/integrations/index.d.ts +2 -1
  5. package/dist/plus/integrations/index.js +9 -0
  6. package/dist/plus/integrations/index.js.map +1 -1
  7. package/dist/plus/integrations/integrationService.d.ts +15 -0
  8. package/dist/plus/integrations/integrationService.js +35 -4
  9. package/dist/plus/integrations/integrationService.js.map +1 -1
  10. package/dist/plus/integrations/manager.d.ts +6 -0
  11. package/dist/plus/integrations/models/asanaTaskWrites.d.ts +155 -0
  12. package/dist/plus/integrations/models/asanaTaskWrites.js +0 -0
  13. package/dist/plus/integrations/models/issuesIntegration.d.ts +6 -1
  14. package/dist/plus/integrations/models/issuesIntegration.js +25 -0
  15. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  16. package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
  17. package/dist/plus/integrations/providers/asana.d.ts +3 -1
  18. package/dist/plus/integrations/providers/asana.js +10 -0
  19. package/dist/plus/integrations/providers/asana.js.map +1 -1
  20. package/dist/plus/integrations/providers/asanaTaskWriteTransport.d.ts +40 -0
  21. package/dist/plus/integrations/providers/asanaTaskWriteTransport.js +122 -0
  22. package/dist/plus/integrations/providers/asanaTaskWriteTransport.js.map +1 -0
  23. package/dist/plus/integrations/providers/asanaTaskWrites.d.ts +38 -0
  24. package/dist/plus/integrations/providers/asanaTaskWrites.js +521 -0
  25. package/dist/plus/integrations/providers/asanaTaskWrites.js.map +1 -0
  26. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  27. package/dist/plus/integrations/providers/trello.js +6 -23
  28. package/dist/plus/integrations/providers/trello.js.map +1 -1
  29. package/dist/plus/integrations/providers/trelloCardWriteTransport.d.ts +3 -4
  30. package/dist/plus/integrations/providers/trelloCardWriteTransport.js +19 -40
  31. package/dist/plus/integrations/providers/trelloCardWriteTransport.js.map +1 -1
  32. package/dist/plus/integrations/providers/utils/writeTransport.d.ts +28 -0
  33. package/dist/plus/integrations/providers/utils/writeTransport.js +60 -0
  34. package/dist/plus/integrations/providers/utils/writeTransport.js.map +1 -0
  35. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  36. package/docs/integrations.md +25 -0
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.69.0] - 2026-12-05
10
+
11
+ ### Added
12
+
13
+ - Adds Asana task write discovery, point reads by GID or URL, creation, editing, completion, same-project section moves, and confirmed deletion to `IntegrationManager`; task receipts include the assignee and a subtask's inherited projects ([#6275](https://github.com/gitkraken/vscode-gitlens/issues/6275)).
14
+
15
+ ### Changed
16
+
17
+ - Changes refreshed cloud integration sessions to report the scopes the GitKraken backend stores for the connection instead of the integration's default scopes ([#6275](https://github.com/gitkraken/vscode-gitlens/issues/6275)).
18
+
9
19
  ## [0.68.0] - 2026-12-05
10
20
 
11
21
  ### Added
@@ -222,7 +222,7 @@ var CloudIntegrationAuthenticationProvider = class extends IntegrationAuthentica
222
222
  const resolved = {
223
223
  id: session.id ?? fallbackId,
224
224
  accessToken: session.accessToken,
225
- scopes: descriptor.scopes,
225
+ scopes: session.scopes ? session.scopes.split(",") : descriptor.scopes,
226
226
  account: {
227
227
  id: "",
228
228
  label: ""
@@ -1 +1 @@
1
- {"version":3,"file":"cloudIntegrationAuthenticationProvider.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/cloudIntegrationAuthenticationProvider.ts"],"sourcesContent":["import { CancellationError } from '@gitlens/utils/cancellation.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport { Emitter } from '@gitlens/utils/event.js';\nimport type { IntegrationIds } from '../constants.js';\nimport type { Sources } from '../telemetry.js';\nimport { areDomainsOnSameHost } from '../utils/domain.utils.js';\nimport { isNonExpiringZeroTokenIntegrationId, isSelfManagedHostIntegrationId } from '../utils/integration.utils.js';\nimport type { CloudIntegrationSync } from './cloudIntegrationObservations.js';\nimport type { ConfiguredIntegrationService } from './configuredIntegrationService.js';\nimport type {\n\tGetSessionOptions,\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n\tRejectedTokenRefreshOptions,\n} from './integrationAuthenticationProvider.js';\nimport type { IntegrationAuthenticationService } from './integrationAuthenticationService.js';\nimport type { ProviderAuthenticationSession } from './models.js';\nimport { isSupportedCloudIntegrationId } from './models.js';\n\n// The package's implementation of the public `IntegrationAuthenticationProvider` contract, kept out of that module so\n// the contract's declarations never reach the internal services these classes are built on.\n\nconst maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)\n\n/**\n * What {@link IntegrationAuthenticationProviderBase.getSession} passes down once it has decided the stored\n * session can't be served as-is. `refreshIfExpired` is its own conclusion, not a caller's option.\n */\ntype GetNewSessionOptions = GetSessionOptions & { refreshIfExpired?: boolean; skipConnect?: boolean };\n\nabstract class IntegrationAuthenticationProviderBase<\n\tID extends IntegrationIds = IntegrationIds,\n> implements IntegrationAuthenticationProvider {\n\tprotected readonly disposables: Disposable[] = [];\n\tprotected readonly primaryResponses = new WeakMap<ProviderAuthenticationSession, 'named' | 'legacy'>();\n\n\tconstructor(\n\t\tprotected readonly authenticationService: IntegrationAuthenticationService,\n\t\tprotected readonly configuredIntegrationService: ConfiguredIntegrationService,\n\t) {}\n\n\tdispose(): void {\n\t\tthis.disposables.forEach(d => d.dispose());\n\t}\n\n\tprivate readonly _onDidChange = new Emitter<void>();\n\tget onDidChange(): Event<void> {\n\t\treturn this._onDidChange.event;\n\t}\n\n\tprotected abstract get authProviderId(): ID;\n\n\t@trace()\n\tasync deleteSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: { preserveConfigured?: boolean; signOutMark?: number; sync?: CloudIntegrationSync },\n\t): Promise<void> {\n\t\tconst domain = isSelfManagedHostIntegrationId(this.authProviderId) ? descriptor?.domain : undefined;\n\t\tconst configured = this.configuredIntegrationService.getConfigured(this.authProviderId, {\n\t\t\tdomain: domain,\n\t\t});\n\n\t\t// Scope the descriptor to cloud so resolveConnectionId targets the cloud variant's id: this is a\n\t\t// cloud-only delete, and a mixed local+cloud connection whose local descriptor is primary would\n\t\t// otherwise resolve the local id and leave the cloud secret intact.\n\t\tconst deleted = await this.configuredIntegrationService.deleteStoredSessions(\n\t\t\tthis.authProviderId,\n\t\t\t{ ...descriptor, cloud: true },\n\t\t\ttrue,\n\t\t\t{\n\t\t\t\tpreserveConfigured: options?.preserveConfigured ?? true,\n\t\t\t\tsignOutMark: options?.signOutMark,\n\t\t\t\tsync: options?.sync,\n\t\t\t},\n\t\t);\n\n\t\tif (deleted && configured?.length) {\n\t\t\tthis.fireChange();\n\t\t}\n\t}\n\n\t@trace()\n\tasync deleteAllSessions(descriptor?: IntegrationAuthenticationSessionDescriptor): Promise<void> {\n\t\tawait this.clearSessions(descriptor);\n\t}\n\n\tasync clearSessions(\n\t\tdescriptor?: IntegrationAuthenticationSessionDescriptor,\n\t\tsync?: CloudIntegrationSync,\n\t): Promise<boolean> {\n\t\tconst domain = isSelfManagedHostIntegrationId(this.authProviderId) ? descriptor?.domain : undefined;\n\t\tconst configured = this.configuredIntegrationService.getConfigured(this.authProviderId, { domain: domain });\n\t\tconst cleared = await this.configuredIntegrationService.deleteAllStoredSessions(\n\t\t\tthis.authProviderId,\n\t\t\tundefined,\n\t\t\tdomain,\n\t\t\tsync,\n\t\t);\n\t\tif (cleared && configured.length) {\n\t\t\tthis.fireChange();\n\t\t}\n\t\treturn cleared;\n\t}\n\n\t@trace()\n\tasync getSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetSessionOptions,\n\t\tauthority?: CloudIntegrationSync,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\t// KEEP: taken before queueing, so a sign-out while this waits refuses its store.\n\t\tconst signOutMark = this.configuredIntegrationService.getSignOutMark();\n\t\tif (!this.configuredIntegrationService.serializesCredentialAcquisition(this.authProviderId)) {\n\t\t\treturn this.acquireSession(descriptor, options, signOutMark, signOutMark, authority);\n\t\t}\n\n\t\tconst connectionId = descriptor.connectionId || this.getImplicitCloudConnectionId(descriptor, options);\n\t\t// KEEP: connecting reaches this provider's own getSession again, so it runs after the queued acquisition.\n\t\tconst session = await this.configuredIntegrationService.withCredentialAcquisition(\n\t\t\tthis.authProviderId,\n\t\t\tconnectionId,\n\t\t\t() =>\n\t\t\t\tthis.acquireSession(\n\t\t\t\t\tconnectionId != null ? { ...descriptor, connectionId: connectionId } : descriptor,\n\t\t\t\t\t{ ...options, skipConnect: true },\n\t\t\t\t\tsignOutMark,\n\t\t\t\t\tthis.configuredIntegrationService.getStoredWriteMark(),\n\t\t\t\t\tauthority,\n\t\t\t\t),\n\t\t);\n\t\tif (session != null || !options?.createIfNeeded || options.forceNewSession) return session;\n\t\t// KEEP: a sign-out or replacement since the mark refused the fetched credential; it is not a missing one.\n\t\tif (\n\t\t\tthis.configuredIntegrationService.isSessionRetiredSince(\n\t\t\t\tthis.authProviderId,\n\t\t\t\t{ id: connectionId ?? '', domain: descriptor.domain, cloud: descriptor.cloud },\n\t\t\t\tsignOutMark,\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.connectNewSession(descriptor, options);\n\t}\n\n\tprivate getImplicitCloudConnectionId(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions: GetSessionOptions | undefined,\n\t): string | undefined {\n\t\tconst connectionId = this.configuredIntegrationService.getConfiguredConnectionId(\n\t\t\tthis.authProviderId,\n\t\t\tdescriptor.domain,\n\t\t\ttrue,\n\t\t);\n\t\tconst stored = this.configuredIntegrationService.resolveConnectionId(\n\t\t\tthis.authProviderId,\n\t\t\toptions?.sync ? { ...descriptor, cloud: true } : descriptor,\n\t\t);\n\t\treturn connectionId === stored ? connectionId : undefined;\n\t}\n\n\tprivate async acquireSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions: (GetSessionOptions & { skipConnect?: boolean }) | undefined,\n\t\tinitialSignOutMark: number,\n\t\tacquisitionMark: number,\n\t\tauthority?: CloudIntegrationSync,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tlet signOutMark = initialSignOutMark;\n\t\tlet session;\n\t\tlet previousToken;\n\t\tlet refetched: ProviderAuthenticationSession | undefined;\n\t\tif (options?.forceNewSession) {\n\t\t\tif (isSelfManagedHostIntegrationId(this.authProviderId)) {\n\t\t\t\tconst connectionId =\n\t\t\t\t\tdescriptor.connectionId ||\n\t\t\t\t\tthis.configuredIntegrationService.getConfiguredConnectionId(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\t!this.configuredIntegrationService.isConnectionConfiguredForHost(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tconnectionId,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tdescriptor = { ...descriptor, connectionId: connectionId };\n\t\t\t}\n\t\t\t// Cloud-only delete (see deleteSession): scope to cloud so the cloud variant's id is cleared even\n\t\t\t// when a mixed local+cloud connection's local descriptor is primary. A sign-out, so a token fetched before\n\t\t\t// it is not stored back; the mark is taken after it, so this session's own fetch is not refused.\n\t\t\tawait this.configuredIntegrationService.deleteStoredSessions(\n\t\t\t\tthis.authProviderId,\n\t\t\t\t{ ...descriptor, cloud: true },\n\t\t\t\ttrue,\n\t\t\t\t{ signOut: true, preserveConfigured: isSelfManagedHostIntegrationId(this.authProviderId) },\n\t\t\t);\n\t\t\tsignOutMark = this.configuredIntegrationService.getSignOutMark();\n\t\t\tacquisitionMark = signOutMark;\n\t\t} else {\n\t\t\tconst stored = await this.configuredIntegrationService.getStoredSession(\n\t\t\t\tthis.authProviderId,\n\t\t\t\toptions?.sync ? { ...descriptor, cloud: true } : descriptor,\n\t\t\t);\n\t\t\tpreviousToken = stored?.accessToken;\n\t\t\tif (options?.sync && options.refetch) {\n\t\t\t\trefetched = stored;\n\t\t\t} else {\n\t\t\t\tsession = stored;\n\t\t\t}\n\t\t}\n\n\t\tconst isExpiredSession = session?.expiresAt != null && new Date(session.expiresAt).getTime() < Date.now();\n\t\t// A rejected token has to re-resolve even when the stored session looks perfectly healthy: that is\n\t\t// the whole point — the provider refused it while its expiry still says valid. Without this the\n\t\t// stored session short-circuits here and the refresh below is never reached.\n\t\tconst scopedRecovery = options?.isRejectedToken?.(session?.accessToken) === true;\n\t\tconst refreshRejectedToken = scopedRecovery || (options?.refreshRejectedToken === true && session != null);\n\t\tif (session == null || isExpiredSession || refreshRejectedToken) {\n\t\t\tsession = await this.getNewSession(descriptor, {\n\t\t\t\t...options,\n\t\t\t\trefreshIfExpired: isExpiredSession,\n\t\t\t\trefreshRejectedToken: refreshRejectedToken,\n\t\t\t\tisRejectedToken: scopedRecovery ? options?.isRejectedToken : undefined,\n\t\t\t});\n\t\t\tif (\n\t\t\t\tsession == null &&\n\t\t\t\toptions?.refetch &&\n\t\t\t\trefetched != null &&\n\t\t\t\tthis.configuredIntegrationService.isSessionRetiredSince(\n\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\trefetched,\n\t\t\t\t\tsignOutMark,\n\t\t\t\t\tacquisitionMark,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\n\t\t\tif (session != null) {\n\t\t\t\tconst primaryResponse = this.primaryResponses.get(session);\n\t\t\t\tconst stored = await this.configuredIntegrationService.storeSession(this.authProviderId, session, {\n\t\t\t\t\tsignOutMark: signOutMark,\n\t\t\t\t\tacquisitionMark: acquisitionMark,\n\t\t\t\t\texpectedStoredAccessToken: scopedRecovery ? previousToken : undefined,\n\t\t\t\t\tprimaryResponse: primaryResponse,\n\t\t\t\t\tsync: authority,\n\t\t\t\t});\n\t\t\t\tif (authority?.isCurrent() === false) throw new CancellationError();\n\n\t\t\t\tconst primary =\n\t\t\t\t\tprimaryResponse === 'named'\n\t\t\t\t\t\t? this.configuredIntegrationService.supersedingPrimary(\n\t\t\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\tsignOutMark,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: undefined;\n\t\t\t\tif (primary != null) {\n\t\t\t\t\tconst current = await this.configuredIntegrationService.peekStoredSession(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tprimary,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\tcurrent == null ||\n\t\t\t\t\t\tthis.configuredIntegrationService.supersedingPrimary(\n\t\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\tsignOutMark,\n\t\t\t\t\t\t) !== primary\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new CancellationError();\n\t\t\t\t\t}\n\n\t\t\t\t\tsession = current;\n\t\t\t\t} else if (!stored) {\n\t\t\t\t\tsession = await this.configuredIntegrationService.peekStoredSession(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tsession.id,\n\t\t\t\t\t\tsession.cloud,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t);\n\t\t\t\t\toptions?.isRejectedToken?.(session?.accessToken);\n\t\t\t\t} else if (refetched?.id != null && refetched.id !== session.id) {\n\t\t\t\t\t// The replacement belongs to a different connection (the cloud's primary moved to another\n\t\t\t\t\t// account), so it was stored beside the one it replaces rather than over it. Drop the old token\n\t\t\t\t\t// as the up-front delete used to, or an unscoped read would keep resolving it until the next sync.\n\t\t\t\t\tawait this.configuredIntegrationService.deleteStoredSessions(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\t{ ...descriptor, connectionId: refetched.id, cloud: true },\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpreserveConfigured: true,\n\t\t\t\t\t\t\tsignOutMark: signOutMark,\n\t\t\t\t\t\t\tunobservedSince: signOutMark,\n\t\t\t\t\t\t\tsync: authority,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (session?.cloud && this.configuredIntegrationService.lastCloudLogout > signOutMark) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\tif (previousToken !== session?.accessToken) {\n\t\t\tthis.fireChange();\n\t\t}\n\n\t\treturn session;\n\t}\n\n\tprotected connectNewSession(\n\t\t_descriptor: IntegrationAuthenticationSessionDescriptor,\n\t\t_options: GetSessionOptions | undefined,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tprotected abstract getNewSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetNewSessionOptions,\n\t): Promise<ProviderAuthenticationSession | undefined>;\n\n\tprotected fireChange(): void {\n\t\tqueueMicrotask(() => this._onDidChange.fire());\n\t}\n}\n\nexport class CloudIntegrationAuthenticationProvider<\n\tID extends IntegrationIds = IntegrationIds,\n> extends IntegrationAuthenticationProviderBase<ID> {\n\tconstructor(\n\t\tauthenticationService: IntegrationAuthenticationService,\n\t\tconfiguredIntegrationService: ConfiguredIntegrationService,\n\t\tprivate readonly _authProviderId: ID,\n\t) {\n\t\tsuper(authenticationService, configuredIntegrationService);\n\t}\n\n\tprotected get authProviderId(): ID {\n\t\treturn this._authProviderId;\n\t}\n\n\tprotected override async getNewSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetNewSessionOptions,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tif (options?.forceNewSession) {\n\t\t\tif ((await this.disconnectCloudSession(descriptor)) === 'failure') {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tvoid this.connectCloudSession(false, options?.source);\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// TODO: This is a stopgap to make sure we're not hammering the api on automatic calls to get the session.\n\t\t// Ultimately we want to timestamp calls to syncCloudIntegrations and use that to determine whether we should\n\t\t// make the call or not.\n\t\t// `refreshRejectedToken` joins the list for the same reason `refreshIfExpired` is on it: both mean the\n\t\t// session in hand is known-unusable, so skipping the cloud round trip would just re-serve it.\n\t\tconst session =\n\t\t\toptions?.refreshIfExpired ||\n\t\t\toptions?.refreshRejectedToken ||\n\t\t\toptions?.createIfNeeded ||\n\t\t\toptions?.forceNewSession ||\n\t\t\toptions?.sync\n\t\t\t\t? await this.getCloudSession(descriptor, options)\n\t\t\t\t: undefined;\n\n\t\tif (options?.createIfNeeded && session == null && !options.skipConnect) {\n\t\t\treturn this.connectNewSession(descriptor, options);\n\t\t}\n\n\t\treturn session;\n\t}\n\n\tprotected override async connectNewSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions: GetSessionOptions | undefined,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tconst connected = await this.connectCloudSession(true, options?.source);\n\t\tif (!connected) return undefined;\n\n\t\treturn this.getSession(descriptor, { source: options?.source });\n\t}\n\n\tprivate connectCloudSession(skipIfConnected: boolean, source: Sources | undefined): Promise<boolean> {\n\t\t// Capture in a const so the type guard narrows it to `SupportedCloudIntegrationIds` (a getter\n\t\t// access wouldn't narrow), letting us call the service directly without a cast.\n\t\tconst id = this.authProviderId;\n\t\tif (isSupportedCloudIntegrationId(id)) {\n\t\t\treturn this.authenticationService.connectCloudIntegrations(\n\t\t\t\t{ integrationIds: [id], skipIfConnected: skipIfConnected, skipPreSync: true },\n\t\t\t\t{\n\t\t\t\t\tsource: source ?? 'integrations',\n\t\t\t\t\tdetail: {\n\t\t\t\t\t\taction: 'connect',\n\t\t\t\t\t\tintegration: id,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn Promise.resolve(false);\n\t}\n\n\tprivate async getCloudSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: RejectedTokenRefreshOptions,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tconst loggedIn = (await this.authenticationService.ctx.account.getAccount()) != null;\n\t\tif (!loggedIn) return undefined;\n\n\t\tconst cloudIntegrations = this.authenticationService.cloudIntegrations;\n\t\t// An unscoped descriptor (no explicit connectionId) would fetch the provider-global primary via\n\t\t// `v1/provider-tokens/<provider>`. For a self-managed provider spanning multiple hosts that primary\n\t\t// can belong to a different host, so a forced sync of host A would hydrate host B's token here (before\n\t\t// reconcile corrects storage). Scope to this host's own configured connection when we have one; fall\n\t\t// through to the provider-scoped path only when nothing is configured yet (legacy/first sync).\n\t\tconst connectionId =\n\t\t\tdescriptor.connectionId ??\n\t\t\t(isSelfManagedHostIntegrationId(this.authProviderId)\n\t\t\t\t? this.configuredIntegrationService.getConfiguredConnectionId(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t)\n\t\t\t\t: undefined);\n\t\t// Refuses a session issued for a DIFFERENT host than the one this connection is keyed by, which would\n\t\t// otherwise let host B's token serve host A.\n\t\t//\n\t\t// A session that names no host is accepted ONLY when it was fetched by a connection id WE have stored\n\t\t// for this host. That descriptor is what ties the token to the host, so an absent domain then means the\n\t\t// backend did not say rather than that the token belongs elsewhere, and refusing it would strand the\n\t\t// refresh.\n\t\t//\n\t\t// A non-null id is not enough on its own: `descriptor.connectionId` can come from the caller, and with\n\t\t// no id at all the fetch goes to the provider-GLOBAL primary endpoint whose token can belong to any\n\t\t// configured host. In both of those cases a domainless response must be refused, or a token would be\n\t\t// bound to — and sent to — a host it was never issued for.\n\t\tconst scopedToThisHost = this.configuredIntegrationService.isConnectionConfiguredForHost(\n\t\t\tthis.authProviderId,\n\t\t\tconnectionId,\n\t\t\tdescriptor.domain,\n\t\t);\n\t\tconst isForAnotherHost = (session: { domain: string } | undefined) =>\n\t\t\tsession != null &&\n\t\t\tisSelfManagedHostIntegrationId(this.authProviderId) &&\n\t\t\t(!scopedToThisHost || Boolean(session.domain?.trim())) &&\n\t\t\t!areDomainsOnSameHost(session.domain, descriptor.domain);\n\n\t\tconst fallbackId =\n\t\t\tconnectionId ?? this.configuredIntegrationService.resolveConnectionId(this.authProviderId, descriptor);\n\t\tlet session = await cloudIntegrations.getConnectionSession(this.authProviderId, undefined, connectionId);\n\t\tif (isForAnotherHost(session)) return undefined;\n\t\tif (options?.isRejectedToken != null && session?.id != null && session.id !== connectionId) return undefined;\n\n\t\t// GitHub, the cloud self-managed hosts, and Trello return `expiresIn: 0` for a token that never\n\t\t// expires; left as 0 the session would be built with `expiresAt = now` and rejected as expired on the\n\t\t// next resolution. Map it to the maximum expiry so it isn't refreshed frequently.\n\t\tif (session?.expiresIn === 0 && isNonExpiringZeroTokenIntegrationId(this.authProviderId)) {\n\t\t\tsession.expiresIn = maxSmallIntegerV8; // maximum expiration length\n\t\t}\n\n\t\t// `expiresIn < 60` is a PREDICTION that the token is about to lapse, and it is the only trigger the\n\t\t// refresh used to have. It cannot see a token the provider has already refused while the backend\n\t\t// still believes it is valid — a revoked grant, retired scopes, an app removed from the org — where\n\t\t// `expiresIn` stays high and the doomed token is re-sent on every read. `refreshRejectedToken` is\n\t\t// the observed counterpart: the caller saw the provider reject this exact token, so refresh it\n\t\t// regardless of what its expiry claims.\n\t\tif (\n\t\t\tsession != null &&\n\t\t\t(session.expiresIn < 60 ||\n\t\t\t\t(options?.refreshRejectedToken && (options.isRejectedToken?.(session.accessToken) ?? true)))\n\t\t) {\n\t\t\tsession = await cloudIntegrations.getConnectionSession(\n\t\t\t\tthis.authProviderId,\n\t\t\t\tsession.accessToken,\n\t\t\t\tconnectionId,\n\t\t\t);\n\t\t\tif (isForAnotherHost(session)) return undefined;\n\t\t\tif (options?.isRejectedToken != null && session?.id != null && session.id !== connectionId) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tif (!session) return undefined;\n\n\t\tlet sessionProtocol;\n\t\t// Only derive a protocol from a domain carrying an explicit scheme; a bare `host:port` (e.g. a\n\t\t// self-managed `ghe.example.com:8443`) parses the host as the protocol, corrupting the value.\n\t\tif (/^[a-z][a-z\\d+\\-.]*:\\/\\//i.test(session.domain)) {\n\t\t\ttry {\n\t\t\t\tsessionProtocol = new URL(session.domain).protocol;\n\t\t\t} catch {\n\t\t\t\tsessionProtocol = undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst resolved: ProviderAuthenticationSession = {\n\t\t\t// Prefer the backend's per-connection token id (multi-account); fall back to the resolved\n\t\t\t// primary/legacy connection id so existing single-connection storage keys are preserved.\n\t\t\tid: session.id ?? fallbackId,\n\t\t\taccessToken: session.accessToken,\n\t\t\tscopes: descriptor.scopes,\n\t\t\taccount: {\n\t\t\t\tid: '',\n\t\t\t\tlabel: '',\n\t\t\t},\n\t\t\tcloud: true,\n\t\t\ttype: session.type,\n\t\t\texpiresAt: new Date(session.expiresIn * 1000 + Date.now()),\n\t\t\t// Note: do not use the session's domain, because the format is different than in our model\n\t\t\tdomain: descriptor.domain,\n\t\t\t// That format difference is exactly what `baseUrl` is for: the descriptor's domain is the\n\t\t\t// normalized host this connection is keyed by, so a context path only survives on the wire value.\n\t\t\t// When the backend reports no domain at all, KEEP the address already configured rather than\n\t\t\t// writing `undefined` — `writeSecret` mirrors this onto the descriptor, so falling back to the\n\t\t\t// bare host here would drop a context path the user never changed on the next refresh.\n\t\t\tbaseUrl:\n\t\t\t\tsession.domain ||\n\t\t\t\tthis.configuredIntegrationService.getConfiguredBaseUrl(\n\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\tconnectionId,\n\t\t\t\t\tdescriptor.domain,\n\t\t\t\t),\n\t\t\tprotocol: sessionProtocol ?? undefined,\n\t\t\t// Carried for providers whose client needs an app key alongside the token (e.g. Trello).\n\t\t\tappKey: session.appKey,\n\t\t};\n\t\tif (connectionId == null) {\n\t\t\tthis.primaryResponses.set(resolved, session.id == null ? 'legacy' : 'named');\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tprivate async disconnectCloudSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t): Promise<'skip' | 'success' | 'failure'> {\n\t\tconst loggedIn = (await this.authenticationService.ctx.account.getAccount()) != null;\n\t\tif (!loggedIn) return 'skip';\n\n\t\tconst cloudIntegrations = this.authenticationService.cloudIntegrations;\n\t\tif (!(await cloudIntegrations.disconnect(this.authProviderId, descriptor.connectionId))) return 'failure';\n\n\t\tif (isSelfManagedHostIntegrationId(this.authProviderId)) {\n\t\t\tawait this.deleteSession(descriptor, { preserveConfigured: false });\n\t\t}\n\n\t\treturn 'success';\n\t}\n}\n"],"mappings":";;;;;;;;AAwBA,MAAM,oBAAoB,KAAK,KAAK;AAQpC,IAAe,wCAAf,MAE+C;CAK1B;CACA;CALpB,cAA+C,CAAC;CAChD,mCAAsC,IAAI,QAA2D;CAErG,YACC,uBACA,8BACC;EAFkB,KAAA,wBAAA;EACA,KAAA,+BAAA;CACjB;CAEH,UAAgB;EACf,KAAK,YAAY,SAAQ,MAAK,EAAE,QAAQ,CAAC;CAC1C;CAEA,eAAgC,IAAI,QAAc;CAClD,IAAI,cAA2B;EAC9B,OAAO,KAAK,aAAa;CAC1B;CAIA,MACM,cACL,YACA,SACgB;EAChB,MAAM,SAAS,+BAA+B,KAAK,cAAc,IAAI,YAAY,SAAS,KAAA;EAC1F,M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F;GACD,UAAU,MAAM,kBAAkB,qBACjC,KAAK,gBACL,QAAQ,aACR,YACD;GACA,IAAI,iBAAiB,OAAO,GAAG,OAAO,KAAA;GACtC,IAAI,SAAS,mBAAmB,QAAQ,SAAS,MAAM,QAAQ,QAAQ,OAAO,cAC7E;EAEF;EAEA,IAAI,CAAC,SAAS,OAAO,KAAA;EAErB,IAAI;EAGJ,IAAI,2BAA2B,KAAK,QAAQ,MAAM,GACjD,IAAI;GACH,kBAAkB,IAAI,IAAI,QAAQ,MAAM,CAAC,CAAC;EAC3C,QAAQ;GACP,kBAAkB,KAAA;EACnB;EAGD,MAAM,WAA0C;GAG/C,IAAI,QAAQ,MAAM;GAClB,aAAa,QAAQ;GACrB,QAAQ,WAAW;GACnB,SAAS;IACR,IAAI;IACJ,OAAO;GACR;GACA,OAAO;GACP,MAAM,QAAQ;GACd,WAAW,IAAI,KAAK,QAAQ,YAAY,MAAO,KAAK,IAAI,CAAC;GAEzD,QAAQ,WAAW;GAMnB,SACC,QAAQ,UACR,KAAK,6BAA6B,qBACjC,KAAK,gBACL,cACA,WAAW,MACZ;GACD,UAAU,mBAAmB,KAAA;GAE7B,QAAQ,QAAQ;EACjB;EACA,IAAI,gBAAgB,MACnB,KAAK,iBAAiB,IAAI,UAAU,QAAQ,MAAM,OAAO,WAAW,OAAO;EAE5E,OAAO;CACR;CAEA,MAAc,uBACb,YAC0C;EAE1C,IAAI,EADc,MAAM,KAAK,sBAAsB,IAAI,QAAQ,WAAW,KAAM,OACjE,OAAO;EAGtB,IAAI,CAAE,MADoB,KAAK,sBAAsB,kBACvB,WAAW,KAAK,gBAAgB,WAAW,YAAY,GAAI,OAAO;EAEhG,IAAI,+BAA+B,KAAK,cAAc,GACrD,MAAM,KAAK,cAAc,YAAY,EAAE,oBAAoB,MAAM,CAAC;EAGnE,OAAO;CACR;AACD"}
1
+ {"version":3,"file":"cloudIntegrationAuthenticationProvider.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/cloudIntegrationAuthenticationProvider.ts"],"sourcesContent":["import { CancellationError } from '@gitlens/utils/cancellation.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport { Emitter } from '@gitlens/utils/event.js';\nimport type { IntegrationIds } from '../constants.js';\nimport type { Sources } from '../telemetry.js';\nimport { areDomainsOnSameHost } from '../utils/domain.utils.js';\nimport { isNonExpiringZeroTokenIntegrationId, isSelfManagedHostIntegrationId } from '../utils/integration.utils.js';\nimport type { CloudIntegrationSync } from './cloudIntegrationObservations.js';\nimport type { ConfiguredIntegrationService } from './configuredIntegrationService.js';\nimport type {\n\tGetSessionOptions,\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n\tRejectedTokenRefreshOptions,\n} from './integrationAuthenticationProvider.js';\nimport type { IntegrationAuthenticationService } from './integrationAuthenticationService.js';\nimport type { ProviderAuthenticationSession } from './models.js';\nimport { isSupportedCloudIntegrationId } from './models.js';\n\n// The package's implementation of the public `IntegrationAuthenticationProvider` contract, kept out of that module so\n// the contract's declarations never reach the internal services these classes are built on.\n\nconst maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)\n\n/**\n * What {@link IntegrationAuthenticationProviderBase.getSession} passes down once it has decided the stored\n * session can't be served as-is. `refreshIfExpired` is its own conclusion, not a caller's option.\n */\ntype GetNewSessionOptions = GetSessionOptions & { refreshIfExpired?: boolean; skipConnect?: boolean };\n\nabstract class IntegrationAuthenticationProviderBase<\n\tID extends IntegrationIds = IntegrationIds,\n> implements IntegrationAuthenticationProvider {\n\tprotected readonly disposables: Disposable[] = [];\n\tprotected readonly primaryResponses = new WeakMap<ProviderAuthenticationSession, 'named' | 'legacy'>();\n\n\tconstructor(\n\t\tprotected readonly authenticationService: IntegrationAuthenticationService,\n\t\tprotected readonly configuredIntegrationService: ConfiguredIntegrationService,\n\t) {}\n\n\tdispose(): void {\n\t\tthis.disposables.forEach(d => d.dispose());\n\t}\n\n\tprivate readonly _onDidChange = new Emitter<void>();\n\tget onDidChange(): Event<void> {\n\t\treturn this._onDidChange.event;\n\t}\n\n\tprotected abstract get authProviderId(): ID;\n\n\t@trace()\n\tasync deleteSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: { preserveConfigured?: boolean; signOutMark?: number; sync?: CloudIntegrationSync },\n\t): Promise<void> {\n\t\tconst domain = isSelfManagedHostIntegrationId(this.authProviderId) ? descriptor?.domain : undefined;\n\t\tconst configured = this.configuredIntegrationService.getConfigured(this.authProviderId, {\n\t\t\tdomain: domain,\n\t\t});\n\n\t\t// Scope the descriptor to cloud so resolveConnectionId targets the cloud variant's id: this is a\n\t\t// cloud-only delete, and a mixed local+cloud connection whose local descriptor is primary would\n\t\t// otherwise resolve the local id and leave the cloud secret intact.\n\t\tconst deleted = await this.configuredIntegrationService.deleteStoredSessions(\n\t\t\tthis.authProviderId,\n\t\t\t{ ...descriptor, cloud: true },\n\t\t\ttrue,\n\t\t\t{\n\t\t\t\tpreserveConfigured: options?.preserveConfigured ?? true,\n\t\t\t\tsignOutMark: options?.signOutMark,\n\t\t\t\tsync: options?.sync,\n\t\t\t},\n\t\t);\n\n\t\tif (deleted && configured?.length) {\n\t\t\tthis.fireChange();\n\t\t}\n\t}\n\n\t@trace()\n\tasync deleteAllSessions(descriptor?: IntegrationAuthenticationSessionDescriptor): Promise<void> {\n\t\tawait this.clearSessions(descriptor);\n\t}\n\n\tasync clearSessions(\n\t\tdescriptor?: IntegrationAuthenticationSessionDescriptor,\n\t\tsync?: CloudIntegrationSync,\n\t): Promise<boolean> {\n\t\tconst domain = isSelfManagedHostIntegrationId(this.authProviderId) ? descriptor?.domain : undefined;\n\t\tconst configured = this.configuredIntegrationService.getConfigured(this.authProviderId, { domain: domain });\n\t\tconst cleared = await this.configuredIntegrationService.deleteAllStoredSessions(\n\t\t\tthis.authProviderId,\n\t\t\tundefined,\n\t\t\tdomain,\n\t\t\tsync,\n\t\t);\n\t\tif (cleared && configured.length) {\n\t\t\tthis.fireChange();\n\t\t}\n\t\treturn cleared;\n\t}\n\n\t@trace()\n\tasync getSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetSessionOptions,\n\t\tauthority?: CloudIntegrationSync,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\t// KEEP: taken before queueing, so a sign-out while this waits refuses its store.\n\t\tconst signOutMark = this.configuredIntegrationService.getSignOutMark();\n\t\tif (!this.configuredIntegrationService.serializesCredentialAcquisition(this.authProviderId)) {\n\t\t\treturn this.acquireSession(descriptor, options, signOutMark, signOutMark, authority);\n\t\t}\n\n\t\tconst connectionId = descriptor.connectionId || this.getImplicitCloudConnectionId(descriptor, options);\n\t\t// KEEP: connecting reaches this provider's own getSession again, so it runs after the queued acquisition.\n\t\tconst session = await this.configuredIntegrationService.withCredentialAcquisition(\n\t\t\tthis.authProviderId,\n\t\t\tconnectionId,\n\t\t\t() =>\n\t\t\t\tthis.acquireSession(\n\t\t\t\t\tconnectionId != null ? { ...descriptor, connectionId: connectionId } : descriptor,\n\t\t\t\t\t{ ...options, skipConnect: true },\n\t\t\t\t\tsignOutMark,\n\t\t\t\t\tthis.configuredIntegrationService.getStoredWriteMark(),\n\t\t\t\t\tauthority,\n\t\t\t\t),\n\t\t);\n\t\tif (session != null || !options?.createIfNeeded || options.forceNewSession) return session;\n\t\t// KEEP: a sign-out or replacement since the mark refused the fetched credential; it is not a missing one.\n\t\tif (\n\t\t\tthis.configuredIntegrationService.isSessionRetiredSince(\n\t\t\t\tthis.authProviderId,\n\t\t\t\t{ id: connectionId ?? '', domain: descriptor.domain, cloud: descriptor.cloud },\n\t\t\t\tsignOutMark,\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.connectNewSession(descriptor, options);\n\t}\n\n\tprivate getImplicitCloudConnectionId(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions: GetSessionOptions | undefined,\n\t): string | undefined {\n\t\tconst connectionId = this.configuredIntegrationService.getConfiguredConnectionId(\n\t\t\tthis.authProviderId,\n\t\t\tdescriptor.domain,\n\t\t\ttrue,\n\t\t);\n\t\tconst stored = this.configuredIntegrationService.resolveConnectionId(\n\t\t\tthis.authProviderId,\n\t\t\toptions?.sync ? { ...descriptor, cloud: true } : descriptor,\n\t\t);\n\t\treturn connectionId === stored ? connectionId : undefined;\n\t}\n\n\tprivate async acquireSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions: (GetSessionOptions & { skipConnect?: boolean }) | undefined,\n\t\tinitialSignOutMark: number,\n\t\tacquisitionMark: number,\n\t\tauthority?: CloudIntegrationSync,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tlet signOutMark = initialSignOutMark;\n\t\tlet session;\n\t\tlet previousToken;\n\t\tlet refetched: ProviderAuthenticationSession | undefined;\n\t\tif (options?.forceNewSession) {\n\t\t\tif (isSelfManagedHostIntegrationId(this.authProviderId)) {\n\t\t\t\tconst connectionId =\n\t\t\t\t\tdescriptor.connectionId ||\n\t\t\t\t\tthis.configuredIntegrationService.getConfiguredConnectionId(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\t!this.configuredIntegrationService.isConnectionConfiguredForHost(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tconnectionId,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tdescriptor = { ...descriptor, connectionId: connectionId };\n\t\t\t}\n\t\t\t// Cloud-only delete (see deleteSession): scope to cloud so the cloud variant's id is cleared even\n\t\t\t// when a mixed local+cloud connection's local descriptor is primary. A sign-out, so a token fetched before\n\t\t\t// it is not stored back; the mark is taken after it, so this session's own fetch is not refused.\n\t\t\tawait this.configuredIntegrationService.deleteStoredSessions(\n\t\t\t\tthis.authProviderId,\n\t\t\t\t{ ...descriptor, cloud: true },\n\t\t\t\ttrue,\n\t\t\t\t{ signOut: true, preserveConfigured: isSelfManagedHostIntegrationId(this.authProviderId) },\n\t\t\t);\n\t\t\tsignOutMark = this.configuredIntegrationService.getSignOutMark();\n\t\t\tacquisitionMark = signOutMark;\n\t\t} else {\n\t\t\tconst stored = await this.configuredIntegrationService.getStoredSession(\n\t\t\t\tthis.authProviderId,\n\t\t\t\toptions?.sync ? { ...descriptor, cloud: true } : descriptor,\n\t\t\t);\n\t\t\tpreviousToken = stored?.accessToken;\n\t\t\tif (options?.sync && options.refetch) {\n\t\t\t\trefetched = stored;\n\t\t\t} else {\n\t\t\t\tsession = stored;\n\t\t\t}\n\t\t}\n\n\t\tconst isExpiredSession = session?.expiresAt != null && new Date(session.expiresAt).getTime() < Date.now();\n\t\t// A rejected token has to re-resolve even when the stored session looks perfectly healthy: that is\n\t\t// the whole point — the provider refused it while its expiry still says valid. Without this the\n\t\t// stored session short-circuits here and the refresh below is never reached.\n\t\tconst scopedRecovery = options?.isRejectedToken?.(session?.accessToken) === true;\n\t\tconst refreshRejectedToken = scopedRecovery || (options?.refreshRejectedToken === true && session != null);\n\t\tif (session == null || isExpiredSession || refreshRejectedToken) {\n\t\t\tsession = await this.getNewSession(descriptor, {\n\t\t\t\t...options,\n\t\t\t\trefreshIfExpired: isExpiredSession,\n\t\t\t\trefreshRejectedToken: refreshRejectedToken,\n\t\t\t\tisRejectedToken: scopedRecovery ? options?.isRejectedToken : undefined,\n\t\t\t});\n\t\t\tif (\n\t\t\t\tsession == null &&\n\t\t\t\toptions?.refetch &&\n\t\t\t\trefetched != null &&\n\t\t\t\tthis.configuredIntegrationService.isSessionRetiredSince(\n\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\trefetched,\n\t\t\t\t\tsignOutMark,\n\t\t\t\t\tacquisitionMark,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\n\t\t\tif (session != null) {\n\t\t\t\tconst primaryResponse = this.primaryResponses.get(session);\n\t\t\t\tconst stored = await this.configuredIntegrationService.storeSession(this.authProviderId, session, {\n\t\t\t\t\tsignOutMark: signOutMark,\n\t\t\t\t\tacquisitionMark: acquisitionMark,\n\t\t\t\t\texpectedStoredAccessToken: scopedRecovery ? previousToken : undefined,\n\t\t\t\t\tprimaryResponse: primaryResponse,\n\t\t\t\t\tsync: authority,\n\t\t\t\t});\n\t\t\t\tif (authority?.isCurrent() === false) throw new CancellationError();\n\n\t\t\t\tconst primary =\n\t\t\t\t\tprimaryResponse === 'named'\n\t\t\t\t\t\t? this.configuredIntegrationService.supersedingPrimary(\n\t\t\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\tsignOutMark,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: undefined;\n\t\t\t\tif (primary != null) {\n\t\t\t\t\tconst current = await this.configuredIntegrationService.peekStoredSession(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tprimary,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\tcurrent == null ||\n\t\t\t\t\t\tthis.configuredIntegrationService.supersedingPrimary(\n\t\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\tsignOutMark,\n\t\t\t\t\t\t) !== primary\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new CancellationError();\n\t\t\t\t\t}\n\n\t\t\t\t\tsession = current;\n\t\t\t\t} else if (!stored) {\n\t\t\t\t\tsession = await this.configuredIntegrationService.peekStoredSession(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tsession.id,\n\t\t\t\t\t\tsession.cloud,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t);\n\t\t\t\t\toptions?.isRejectedToken?.(session?.accessToken);\n\t\t\t\t} else if (refetched?.id != null && refetched.id !== session.id) {\n\t\t\t\t\t// The replacement belongs to a different connection (the cloud's primary moved to another\n\t\t\t\t\t// account), so it was stored beside the one it replaces rather than over it. Drop the old token\n\t\t\t\t\t// as the up-front delete used to, or an unscoped read would keep resolving it until the next sync.\n\t\t\t\t\tawait this.configuredIntegrationService.deleteStoredSessions(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\t{ ...descriptor, connectionId: refetched.id, cloud: true },\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpreserveConfigured: true,\n\t\t\t\t\t\t\tsignOutMark: signOutMark,\n\t\t\t\t\t\t\tunobservedSince: signOutMark,\n\t\t\t\t\t\t\tsync: authority,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (session?.cloud && this.configuredIntegrationService.lastCloudLogout > signOutMark) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\tif (previousToken !== session?.accessToken) {\n\t\t\tthis.fireChange();\n\t\t}\n\n\t\treturn session;\n\t}\n\n\tprotected connectNewSession(\n\t\t_descriptor: IntegrationAuthenticationSessionDescriptor,\n\t\t_options: GetSessionOptions | undefined,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tprotected abstract getNewSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetNewSessionOptions,\n\t): Promise<ProviderAuthenticationSession | undefined>;\n\n\tprotected fireChange(): void {\n\t\tqueueMicrotask(() => this._onDidChange.fire());\n\t}\n}\n\nexport class CloudIntegrationAuthenticationProvider<\n\tID extends IntegrationIds = IntegrationIds,\n> extends IntegrationAuthenticationProviderBase<ID> {\n\tconstructor(\n\t\tauthenticationService: IntegrationAuthenticationService,\n\t\tconfiguredIntegrationService: ConfiguredIntegrationService,\n\t\tprivate readonly _authProviderId: ID,\n\t) {\n\t\tsuper(authenticationService, configuredIntegrationService);\n\t}\n\n\tprotected get authProviderId(): ID {\n\t\treturn this._authProviderId;\n\t}\n\n\tprotected override async getNewSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetNewSessionOptions,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tif (options?.forceNewSession) {\n\t\t\tif ((await this.disconnectCloudSession(descriptor)) === 'failure') {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tvoid this.connectCloudSession(false, options?.source);\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// TODO: This is a stopgap to make sure we're not hammering the api on automatic calls to get the session.\n\t\t// Ultimately we want to timestamp calls to syncCloudIntegrations and use that to determine whether we should\n\t\t// make the call or not.\n\t\t// `refreshRejectedToken` joins the list for the same reason `refreshIfExpired` is on it: both mean the\n\t\t// session in hand is known-unusable, so skipping the cloud round trip would just re-serve it.\n\t\tconst session =\n\t\t\toptions?.refreshIfExpired ||\n\t\t\toptions?.refreshRejectedToken ||\n\t\t\toptions?.createIfNeeded ||\n\t\t\toptions?.forceNewSession ||\n\t\t\toptions?.sync\n\t\t\t\t? await this.getCloudSession(descriptor, options)\n\t\t\t\t: undefined;\n\n\t\tif (options?.createIfNeeded && session == null && !options.skipConnect) {\n\t\t\treturn this.connectNewSession(descriptor, options);\n\t\t}\n\n\t\treturn session;\n\t}\n\n\tprotected override async connectNewSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions: GetSessionOptions | undefined,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tconst connected = await this.connectCloudSession(true, options?.source);\n\t\tif (!connected) return undefined;\n\n\t\treturn this.getSession(descriptor, { source: options?.source });\n\t}\n\n\tprivate connectCloudSession(skipIfConnected: boolean, source: Sources | undefined): Promise<boolean> {\n\t\t// Capture in a const so the type guard narrows it to `SupportedCloudIntegrationIds` (a getter\n\t\t// access wouldn't narrow), letting us call the service directly without a cast.\n\t\tconst id = this.authProviderId;\n\t\tif (isSupportedCloudIntegrationId(id)) {\n\t\t\treturn this.authenticationService.connectCloudIntegrations(\n\t\t\t\t{ integrationIds: [id], skipIfConnected: skipIfConnected, skipPreSync: true },\n\t\t\t\t{\n\t\t\t\t\tsource: source ?? 'integrations',\n\t\t\t\t\tdetail: {\n\t\t\t\t\t\taction: 'connect',\n\t\t\t\t\t\tintegration: id,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn Promise.resolve(false);\n\t}\n\n\tprivate async getCloudSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: RejectedTokenRefreshOptions,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tconst loggedIn = (await this.authenticationService.ctx.account.getAccount()) != null;\n\t\tif (!loggedIn) return undefined;\n\n\t\tconst cloudIntegrations = this.authenticationService.cloudIntegrations;\n\t\t// An unscoped descriptor (no explicit connectionId) would fetch the provider-global primary via\n\t\t// `v1/provider-tokens/<provider>`. For a self-managed provider spanning multiple hosts that primary\n\t\t// can belong to a different host, so a forced sync of host A would hydrate host B's token here (before\n\t\t// reconcile corrects storage). Scope to this host's own configured connection when we have one; fall\n\t\t// through to the provider-scoped path only when nothing is configured yet (legacy/first sync).\n\t\tconst connectionId =\n\t\t\tdescriptor.connectionId ??\n\t\t\t(isSelfManagedHostIntegrationId(this.authProviderId)\n\t\t\t\t? this.configuredIntegrationService.getConfiguredConnectionId(\n\t\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\t\tdescriptor.domain,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t)\n\t\t\t\t: undefined);\n\t\t// Refuses a session issued for a DIFFERENT host than the one this connection is keyed by, which would\n\t\t// otherwise let host B's token serve host A.\n\t\t//\n\t\t// A session that names no host is accepted ONLY when it was fetched by a connection id WE have stored\n\t\t// for this host. That descriptor is what ties the token to the host, so an absent domain then means the\n\t\t// backend did not say rather than that the token belongs elsewhere, and refusing it would strand the\n\t\t// refresh.\n\t\t//\n\t\t// A non-null id is not enough on its own: `descriptor.connectionId` can come from the caller, and with\n\t\t// no id at all the fetch goes to the provider-GLOBAL primary endpoint whose token can belong to any\n\t\t// configured host. In both of those cases a domainless response must be refused, or a token would be\n\t\t// bound to — and sent to — a host it was never issued for.\n\t\tconst scopedToThisHost = this.configuredIntegrationService.isConnectionConfiguredForHost(\n\t\t\tthis.authProviderId,\n\t\t\tconnectionId,\n\t\t\tdescriptor.domain,\n\t\t);\n\t\tconst isForAnotherHost = (session: { domain: string } | undefined) =>\n\t\t\tsession != null &&\n\t\t\tisSelfManagedHostIntegrationId(this.authProviderId) &&\n\t\t\t(!scopedToThisHost || Boolean(session.domain?.trim())) &&\n\t\t\t!areDomainsOnSameHost(session.domain, descriptor.domain);\n\n\t\tconst fallbackId =\n\t\t\tconnectionId ?? this.configuredIntegrationService.resolveConnectionId(this.authProviderId, descriptor);\n\t\tlet session = await cloudIntegrations.getConnectionSession(this.authProviderId, undefined, connectionId);\n\t\tif (isForAnotherHost(session)) return undefined;\n\t\tif (options?.isRejectedToken != null && session?.id != null && session.id !== connectionId) return undefined;\n\n\t\t// GitHub, the cloud self-managed hosts, and Trello return `expiresIn: 0` for a token that never\n\t\t// expires; left as 0 the session would be built with `expiresAt = now` and rejected as expired on the\n\t\t// next resolution. Map it to the maximum expiry so it isn't refreshed frequently.\n\t\tif (session?.expiresIn === 0 && isNonExpiringZeroTokenIntegrationId(this.authProviderId)) {\n\t\t\tsession.expiresIn = maxSmallIntegerV8; // maximum expiration length\n\t\t}\n\n\t\t// `expiresIn < 60` is a PREDICTION that the token is about to lapse, and it is the only trigger the\n\t\t// refresh used to have. It cannot see a token the provider has already refused while the backend\n\t\t// still believes it is valid — a revoked grant, retired scopes, an app removed from the org — where\n\t\t// `expiresIn` stays high and the doomed token is re-sent on every read. `refreshRejectedToken` is\n\t\t// the observed counterpart: the caller saw the provider reject this exact token, so refresh it\n\t\t// regardless of what its expiry claims.\n\t\tif (\n\t\t\tsession != null &&\n\t\t\t(session.expiresIn < 60 ||\n\t\t\t\t(options?.refreshRejectedToken && (options.isRejectedToken?.(session.accessToken) ?? true)))\n\t\t) {\n\t\t\tsession = await cloudIntegrations.getConnectionSession(\n\t\t\t\tthis.authProviderId,\n\t\t\t\tsession.accessToken,\n\t\t\t\tconnectionId,\n\t\t\t);\n\t\t\tif (isForAnotherHost(session)) return undefined;\n\t\t\tif (options?.isRejectedToken != null && session?.id != null && session.id !== connectionId) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tif (!session) return undefined;\n\n\t\tlet sessionProtocol;\n\t\t// Only derive a protocol from a domain carrying an explicit scheme; a bare `host:port` (e.g. a\n\t\t// self-managed `ghe.example.com:8443`) parses the host as the protocol, corrupting the value.\n\t\tif (/^[a-z][a-z\\d+\\-.]*:\\/\\//i.test(session.domain)) {\n\t\t\ttry {\n\t\t\t\tsessionProtocol = new URL(session.domain).protocol;\n\t\t\t} catch {\n\t\t\t\tsessionProtocol = undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst resolved: ProviderAuthenticationSession = {\n\t\t\t// Prefer the backend's per-connection token id (multi-account); fall back to the resolved\n\t\t\t// primary/legacy connection id so existing single-connection storage keys are preserved.\n\t\t\tid: session.id ?? fallbackId,\n\t\t\taccessToken: session.accessToken,\n\t\t\tscopes: session.scopes ? session.scopes.split(',') : descriptor.scopes,\n\t\t\taccount: {\n\t\t\t\tid: '',\n\t\t\t\tlabel: '',\n\t\t\t},\n\t\t\tcloud: true,\n\t\t\ttype: session.type,\n\t\t\texpiresAt: new Date(session.expiresIn * 1000 + Date.now()),\n\t\t\t// Note: do not use the session's domain, because the format is different than in our model\n\t\t\tdomain: descriptor.domain,\n\t\t\t// That format difference is exactly what `baseUrl` is for: the descriptor's domain is the\n\t\t\t// normalized host this connection is keyed by, so a context path only survives on the wire value.\n\t\t\t// When the backend reports no domain at all, KEEP the address already configured rather than\n\t\t\t// writing `undefined` — `writeSecret` mirrors this onto the descriptor, so falling back to the\n\t\t\t// bare host here would drop a context path the user never changed on the next refresh.\n\t\t\tbaseUrl:\n\t\t\t\tsession.domain ||\n\t\t\t\tthis.configuredIntegrationService.getConfiguredBaseUrl(\n\t\t\t\t\tthis.authProviderId,\n\t\t\t\t\tconnectionId,\n\t\t\t\t\tdescriptor.domain,\n\t\t\t\t),\n\t\t\tprotocol: sessionProtocol ?? undefined,\n\t\t\t// Carried for providers whose client needs an app key alongside the token (e.g. Trello).\n\t\t\tappKey: session.appKey,\n\t\t};\n\t\tif (connectionId == null) {\n\t\t\tthis.primaryResponses.set(resolved, session.id == null ? 'legacy' : 'named');\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tprivate async disconnectCloudSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t): Promise<'skip' | 'success' | 'failure'> {\n\t\tconst loggedIn = (await this.authenticationService.ctx.account.getAccount()) != null;\n\t\tif (!loggedIn) return 'skip';\n\n\t\tconst cloudIntegrations = this.authenticationService.cloudIntegrations;\n\t\tif (!(await cloudIntegrations.disconnect(this.authProviderId, descriptor.connectionId))) return 'failure';\n\n\t\tif (isSelfManagedHostIntegrationId(this.authProviderId)) {\n\t\t\tawait this.deleteSession(descriptor, { preserveConfigured: false });\n\t\t}\n\n\t\treturn 'success';\n\t}\n}\n"],"mappings":";;;;;;;;AAwBA,MAAM,oBAAoB,KAAK,KAAK;AAQpC,IAAe,wCAAf,MAE+C;CAK1B;CACA;CALpB,cAA+C,CAAC;CAChD,mCAAsC,IAAI,QAA2D;CAErG,YACC,uBACA,8BACC;EAFkB,KAAA,wBAAA;EACA,KAAA,+BAAA;CACjB;CAEH,UAAgB;EACf,KAAK,YAAY,SAAQ,MAAK,EAAE,QAAQ,CAAC;CAC1C;CAEA,eAAgC,IAAI,QAAc;CAClD,IAAI,cAA2B;EAC9B,OAAO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D,MAAM,KAAK,cAAc,YAAY,EAAE,oBAAoB,MAAM,CAAC;EAGnE,OAAO;CACR;AACD"}
@@ -11,6 +11,7 @@ import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, Integration
11
11
  import { Source, Sources } from "./telemetry.js";
12
12
  import { IntegrationAuthenticationProvider, IntegrationAuthenticationProviderDescriptor, IntegrationAuthenticationSessionDescriptor } from "./authentication/integrationAuthenticationProvider.js";
13
13
  import { IssueTrackerCreateOptions, IssueTrackerCreateOptionsResult, IssueTrackerDeleteOptions, IssueTrackerField, IssueTrackerIssueReceipt, IssueTrackerIssueWriteOptions, IssueTrackerIssueWriteOptionsResult, IssueTrackerStatus, IssueTrackerTransition, IssueTrackerWriteConnection, IssueTrackerWriteFailure, IssueTrackerWriteOptions, IssueTrackerWriteResult, IssueTrackerWriteTargetOptions, IssueTrackerWriteTargetResult } from "./models/issueTrackerWrites.js";
14
+ import { AsanaTaskAssignee, AsanaTaskCreateOptions, AsanaTaskCreateOptionsResult, AsanaTaskDeleteOptions, AsanaTaskDeleteResult, AsanaTaskMembership, AsanaTaskMutationTarget, AsanaTaskReceipt, AsanaTaskWriteAccount, AsanaTaskWriteAccountResult, AsanaTaskWriteCapability, AsanaTaskWriteFailure, AsanaTaskWriteOptions, AsanaTaskWriteOptionsResult, AsanaTaskWriteProject, AsanaTaskWriteResult, AsanaTaskWriteScope, AsanaTaskWriteSection, AsanaTaskWriteTargetOptions, AsanaTaskWriteWorkspace } from "./models/asanaTaskWrites.js";
14
15
  import { AzureServerWorkItemWriteScope, AzureServicesWorkItemWriteScope, WorkItemAddress, WorkItemCreateOptions, WorkItemCreateOptionsResult, WorkItemDeleteCapability, WorkItemDeleteOptions, WorkItemDeleteResult, WorkItemDeleteTargetChanged, WorkItemDeletion, WorkItemReceipt, WorkItemState, WorkItemWriteContext, WorkItemWriteField, WorkItemWriteOptions, WorkItemWriteOptionsResult, WorkItemWriteResult, WorkItemWriteScope, WorkItemWriteTargetOptions, WorkItemWriteTargetResult } from "./models/workItemWrites.js";
15
16
  import { AzurePullRequestCreateCapabilityOptions, AzurePullRequestCreateCapabilityResult, AzurePullRequestMergeStrategy, AzurePullRequestRepository, AzurePullRequestWriteAction, AzurePullRequestWriteFailure, AzurePullRequestWriteOptions, AzurePullRequestWriteResult, AzurePullRequestWriteTargetOptions, AzurePullRequestWriteTargetResult, AzureServerPullRequestWriteOptions, AzureServerPullRequestWriteScope, AzureServerPullRequestWriteTargetOptions, AzureWrittenPullRequest } from "./models/azurePullRequestWrites.js";
16
17
  import { BitbucketPullRequestCreateCapabilityOptions, BitbucketPullRequestCreateCapabilityResult, BitbucketPullRequestMergeCapability, BitbucketPullRequestMergeStatusOptions, BitbucketPullRequestMergeStatusResult, BitbucketPullRequestMergeStrategy, BitbucketPullRequestRepository, BitbucketPullRequestWriteAction, BitbucketPullRequestWriteFailure, BitbucketPullRequestWriteOptions, BitbucketPullRequestWriteReleaseOptions, BitbucketPullRequestWriteReleaseResult, BitbucketPullRequestWriteResult, BitbucketPullRequestWriteTargetOptions, BitbucketPullRequestWriteTargetResult, BitbucketUnsettledPullRequestWrite, BitbucketWrittenPullRequest } from "./models/bitbucketPullRequestWrites.js";
@@ -55,5 +56,5 @@ import { getActionablePullRequests, toActionablePullRequestInput } from "./provi
55
56
  */
56
57
  export declare function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager;
57
58
  //#endregion
58
- export { type Account, type AccountProvider, type ActionablePullRequest, type ActionablePullRequestAccount, ActionablePullRequestBuildStatusState, type ActionablePullRequestCategory, type ActionablePullRequestEnrichedItem, type ActionablePullRequestEnrichedItems, type ActionablePullRequestFields, type ActionablePullRequestInput, ActionablePullRequestReviewState, type AuthenticationSessionLike, type AuthenticationSessionsChangeEvent, type Autolink, type AutolinkReference, type AzurePullRequestCreateCapabilityOptions, type AzurePullRequestCreateCapabilityResult, type AzurePullRequestMergeStrategy, type AzurePullRequestRepository, type AzurePullRequestWriteAction, type AzurePullRequestWriteFailure, type AzurePullRequestWriteOptions, type AzurePullRequestWriteResult, type AzurePullRequestWriteTargetOptions, type AzurePullRequestWriteTargetResult, type AzureServerPullRequestWriteOptions, type AzureServerPullRequestWriteScope, type AzureServerPullRequestWriteTargetOptions, type AzureServerWorkItemWriteScope, type AzureServicesWorkItemWriteScope, type AzureWrittenPullRequest, type BitbucketPullRequestCreateCapabilityOptions, type BitbucketPullRequestCreateCapabilityResult, type BitbucketPullRequestMergeCapability, type BitbucketPullRequestMergeStatusOptions, type BitbucketPullRequestMergeStatusResult, type BitbucketPullRequestMergeStrategy, type BitbucketPullRequestRepository, type BitbucketPullRequestWriteAction, type BitbucketPullRequestWriteFailure, type BitbucketPullRequestWriteOptions, type BitbucketPullRequestWriteReleaseOptions, type BitbucketPullRequestWriteReleaseResult, type BitbucketPullRequestWriteResult, type BitbucketPullRequestWriteTargetOptions, type BitbucketPullRequestWriteTargetResult, type BitbucketServerPullRequestActionCapability, type BitbucketServerPullRequestCreateCapabilityResult, type BitbucketServerPullRequestMergeCapability, type BitbucketServerPullRequestRepository, type BitbucketServerPullRequestVeto, type BitbucketServerPullRequestWriteAction, type BitbucketServerPullRequestWriteFailure, type BitbucketServerPullRequestWriteOptions, type BitbucketServerPullRequestWriteResult, type BitbucketServerPullRequestWriteScope, type BitbucketServerPullRequestWriteTargetOptions, type BitbucketServerPullRequestWriteTargetResult, type BitbucketServerWrittenPullRequest, type BitbucketUnsettledPullRequestWrite, type BitbucketWrittenPullRequest, type CaptureRelationshipCurrency, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, type CurrentAccountResult, type DynamicAutolinkReference, type EntityIdentifier, type EntityIdentifierFields, type EntityIdentifierInput, EntityIdentifierProviderType, EntityType, EntityVersion, type FieldPresence, type GetAutolinkReferencesOptions, GitCloudHostIntegrationId, type GitConfigEntityIdentifier, type GitHostIntegration, type GitLabIssueCreateOptions, type GitLabIssueCreateOptionsResult, type GitLabIssueDeleteOptions, type GitLabIssueReceipt, type GitLabIssueWriteAddress, type GitLabIssueWriteCapability, type GitLabIssueWriteContext, type GitLabIssueWriteFailure, type GitLabIssueWriteField, type GitLabIssueWriteOptions, type GitLabIssueWriteOptionsResult, type GitLabIssueWriteResult, type GitLabIssueWriteScope, type GitLabIssueWriteTargetOptions, type GitLabIssueWriteTargetResult, type GitLabMergeBlocker, type GitLabMergeExecution, type GitLabMergeMethod, type GitLabMergeRequestCreateOptions, type GitLabMergeRequestCreateOptionsResult, type GitLabMergeRequestDeleteOptions, type GitLabMergeRequestMergeCapability, type GitLabMergeRequestProject, type GitLabMergeRequestReceipt, type GitLabMergeRequestWriteAddress, type GitLabMergeRequestWriteCapability, type GitLabMergeRequestWriteContext, type GitLabMergeRequestWriteFailure, type GitLabMergeRequestWriteField, type GitLabMergeRequestWriteOptions, type GitLabMergeRequestWriteOptionsResult, type GitLabMergeRequestWriteResult, type GitLabMergeRequestWriteScope, type GitLabMergeRequestWriteTargetOptions, type GitLabMergeRequestWriteTargetResult, type GitLabMergeSquash, GitSelfManagedHostIntegrationId, type HttpProvider, type Integration, type IntegrationAccountCacheDescriptor, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationById, type IntegrationCacheDescriptor, type IntegrationConnectedKey, type IntegrationCredential, type IntegrationIds, type IntegrationManager, type IntegrationManagerCacheLoader, type IntegrationManagerCacheOptions, type IntegrationManagerCacheProvider, type IntegrationManagerCacheResult, type IntegrationManagerContext, type IntegrationResult, type IntegrationServiceHooks, type IntegrationStorageProvider, type IntegrationType, type IntegrationsRemoteConfig, type IssueBatchResult, type IssueBatchTarget, type IssueCountResult, type IssueCountScope, type IssueDeleteOptions, type IssueEtagInclude, type IssueFieldGroup, IssueFilter, type IssueProjection, type IssueRelationshipFailure, type IssueRelationshipPin, type IssueRelationshipReceipt, type IssueRelationshipWriteOptions, type IssueRelationshipWriteResult, type IssueRelationshipsOptions, type IssueRelationshipsResult, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, type IssueTrackerCreateOptions, type IssueTrackerCreateOptionsResult, type IssueTrackerDeleteOptions, type IssueTrackerField, type IssueTrackerIssueReceipt, type IssueTrackerIssueWriteOptions, type IssueTrackerIssueWriteOptionsResult, type IssueTrackerStatus, type IssueTrackerTransition, type IssueTrackerWriteConnection, type IssueTrackerWriteFailure, type IssueTrackerWriteOptions, type IssueTrackerWriteResult, type IssueTrackerWriteTargetOptions, type IssueTrackerWriteTargetResult, type IssueWriteOptions, type IssueWriteResult, type IssueWriteTargetOptions, type IssueWriteTargetResult, IssuesCloudHostIntegrationId, type IssuesIntegration, IssuesSelfManagedHostIntegrationId, type LinearIssueCreateOptions, type LinearIssueCreateOptionsResult, type LinearIssueDeleteOptions, type LinearIssueDeleteResult, type LinearIssueMutationTarget, type LinearIssueReceipt, type LinearIssueWorkflowState, type LinearIssueWriteOptions, type LinearIssueWriteOptionsResult, type LinearIssueWriteResult, type LinearIssueWriteScope, type LinearIssueWriteTargetOptions, type ListLinearProjectsOptions, type ListOrgsOptions, type ListProjectsOptions, LookupBackedOffError, type ManualTokenAuthProviderOptions, type MyPullRequestsForReposOptions, type ProviderAuthenticationSession, type ProviderBroadenOrg, type ProviderBroadenResult, type ProviderLinearProjectShape, type ProviderMetadata, type ProviderOrganization, type ProviderPageInfo, type ProviderPagedResult, type ProviderPullRequestSearchResult, type ProviderReference, type ProviderRepositoriesInput, type ProviderRepositoryInput, type ProviderRepositoryShape, type ProviderResult, type ProviderSweepResult, type ProviderSweepTarget, type ProviderSweepTargetEvent, type ProviderSweepTargetRef, type ProviderWarning, type ProviderWarningCause, type ProviderWarningCauseReason, type ProviderWarningKind, type ProviderWarningOmission, type ProviderWarningOmissionKind, type ProviderWarningOmissionRecovery, type ProviderWarningOmissionScope, type ProviderWarningScope, type ProviderWarningSelector, type ProviderWarningUnreadableItems, type PullRequestActivityAuthor, type PullRequestActivityComment, type PullRequestActivityItem, type PullRequestActivityResult, type PullRequestActivityReview, type PullRequestActivityReviewComment, type PullRequestActivityTarget, type PullRequestBatchResult, type PullRequestBatchTarget, type PullRequestBranchResult, type PullRequestBranchTarget, type PullRequestCheckLogResult, type PullRequestCheckLogTarget, type PullRequestCountResult, type PullRequestCountScope, type PullRequestCreateCapabilityOptions, type PullRequestCreateCapabilityResult, type PullRequestEntityIdentifierInput, type PullRequestEtagInclude, type PullRequestFieldGroup, PullRequestFilter, type PullRequestForCommitResult, type PullRequestProjection, type PullRequestSearchCapabilities, type PullRequestSearchCriteria, type PullRequestStateFilter, type PullRequestSweepOptions, type PullRequestWriteFailure, type PullRequestWriteOptions, type PullRequestWriteResult, type PullRequestWriteSnapshot, type PullRequestWriteTargetOptions, type PullRequestWriteTargetResult, type RefSet, type RepositoriesProvider, type RepositoryIdentity, type RepositoryResolution, type RepositoryResolutionStatus, type ResolveRepositoryResult, type SearchMyPullRequestsOptions, type SearchPullRequestsOptions, type Source, type Sources, type SupportedCloudIntegrationIds, type TokenInfo, type TrelloCardCreateOptions, type TrelloCardCreateOptionsResult, type TrelloCardDeleteOptions, type TrelloCardDeleteResult, type TrelloCardMutationTarget, type TrelloCardReceipt, type TrelloCardWriteAccount, type TrelloCardWriteBoard, type TrelloCardWriteCapability, type TrelloCardWriteFailure, type TrelloCardWriteList, type TrelloCardWriteOptions, type TrelloCardWriteOptionsResult, type TrelloCardWriteResult, type TrelloCardWriteScope, type TrelloCardWriteTargetOptions, type WorkItemAddress, type WorkItemCreateOptions, type WorkItemCreateOptionsResult, type WorkItemDeleteCapability, type WorkItemDeleteOptions, type WorkItemDeleteResult, type WorkItemDeleteTargetChanged, type WorkItemDeletion, type WorkItemReceipt, type WorkItemState, type WorkItemWriteContext, type WorkItemWriteField, type WorkItemWriteOptions, type WorkItemWriteOptionsResult, type WorkItemWriteResult, type WorkItemWriteScope, type WorkItemWriteTargetOptions, type WorkItemWriteTargetResult, areDomainsOnSameHost, convertRemoteProviderIdToIntegrationId, createManualTokenAuthProvider, decodeEntityIdentifier, decodeEntityIdentifiersFromGitConfig, encodeEntityIdentifier, encodeIssueOrPullRequestForGitConfig, getActionablePullRequests, getAzureRepositoryIdentity, getEntityIdentifierInput, getIntegrationConnectedKey, getIntegrationIdForRemote, getIssueFieldPresence, getIssueFromGitConfigEntityIdentifier, getIssueOwner, getProviderIdFromEntityIdentifier, getPullRequestFieldPresence, getSingleConfiguredDomain, hostFromDomain, isAzureProviderId, isCloudGitSelfManagedHostIntegrationId, isGitCloudHostIntegrationId, isGitHostIntegration, isGitSelfManagedHostIntegrationId, isIntegration, isIntegrationId, isIssuesHostIntegrationId, isIssuesIntegration, isMaybeGitLabPullRequestUrl, isSelfManagedHostIntegrationId, isSupportedCloudIntegrationId, providersMetadata, splitOwnerAndRepo, supportsCodeSuggest, toActionablePullRequestInput, toCloudIntegrationType, toIntegrationId, toTokenInfo, toTokenWithInfo };
59
+ export { type Account, type AccountProvider, type ActionablePullRequest, type ActionablePullRequestAccount, ActionablePullRequestBuildStatusState, type ActionablePullRequestCategory, type ActionablePullRequestEnrichedItem, type ActionablePullRequestEnrichedItems, type ActionablePullRequestFields, type ActionablePullRequestInput, ActionablePullRequestReviewState, type AsanaTaskAssignee, type AsanaTaskCreateOptions, type AsanaTaskCreateOptionsResult, type AsanaTaskDeleteOptions, type AsanaTaskDeleteResult, type AsanaTaskMembership, type AsanaTaskMutationTarget, type AsanaTaskReceipt, type AsanaTaskWriteAccount, type AsanaTaskWriteAccountResult, type AsanaTaskWriteCapability, type AsanaTaskWriteFailure, type AsanaTaskWriteOptions, type AsanaTaskWriteOptionsResult, type AsanaTaskWriteProject, type AsanaTaskWriteResult, type AsanaTaskWriteScope, type AsanaTaskWriteSection, type AsanaTaskWriteTargetOptions, type AsanaTaskWriteWorkspace, type AuthenticationSessionLike, type AuthenticationSessionsChangeEvent, type Autolink, type AutolinkReference, type AzurePullRequestCreateCapabilityOptions, type AzurePullRequestCreateCapabilityResult, type AzurePullRequestMergeStrategy, type AzurePullRequestRepository, type AzurePullRequestWriteAction, type AzurePullRequestWriteFailure, type AzurePullRequestWriteOptions, type AzurePullRequestWriteResult, type AzurePullRequestWriteTargetOptions, type AzurePullRequestWriteTargetResult, type AzureServerPullRequestWriteOptions, type AzureServerPullRequestWriteScope, type AzureServerPullRequestWriteTargetOptions, type AzureServerWorkItemWriteScope, type AzureServicesWorkItemWriteScope, type AzureWrittenPullRequest, type BitbucketPullRequestCreateCapabilityOptions, type BitbucketPullRequestCreateCapabilityResult, type BitbucketPullRequestMergeCapability, type BitbucketPullRequestMergeStatusOptions, type BitbucketPullRequestMergeStatusResult, type BitbucketPullRequestMergeStrategy, type BitbucketPullRequestRepository, type BitbucketPullRequestWriteAction, type BitbucketPullRequestWriteFailure, type BitbucketPullRequestWriteOptions, type BitbucketPullRequestWriteReleaseOptions, type BitbucketPullRequestWriteReleaseResult, type BitbucketPullRequestWriteResult, type BitbucketPullRequestWriteTargetOptions, type BitbucketPullRequestWriteTargetResult, type BitbucketServerPullRequestActionCapability, type BitbucketServerPullRequestCreateCapabilityResult, type BitbucketServerPullRequestMergeCapability, type BitbucketServerPullRequestRepository, type BitbucketServerPullRequestVeto, type BitbucketServerPullRequestWriteAction, type BitbucketServerPullRequestWriteFailure, type BitbucketServerPullRequestWriteOptions, type BitbucketServerPullRequestWriteResult, type BitbucketServerPullRequestWriteScope, type BitbucketServerPullRequestWriteTargetOptions, type BitbucketServerPullRequestWriteTargetResult, type BitbucketServerWrittenPullRequest, type BitbucketUnsettledPullRequestWrite, type BitbucketWrittenPullRequest, type CaptureRelationshipCurrency, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, type CurrentAccountResult, type DynamicAutolinkReference, type EntityIdentifier, type EntityIdentifierFields, type EntityIdentifierInput, EntityIdentifierProviderType, EntityType, EntityVersion, type FieldPresence, type GetAutolinkReferencesOptions, GitCloudHostIntegrationId, type GitConfigEntityIdentifier, type GitHostIntegration, type GitLabIssueCreateOptions, type GitLabIssueCreateOptionsResult, type GitLabIssueDeleteOptions, type GitLabIssueReceipt, type GitLabIssueWriteAddress, type GitLabIssueWriteCapability, type GitLabIssueWriteContext, type GitLabIssueWriteFailure, type GitLabIssueWriteField, type GitLabIssueWriteOptions, type GitLabIssueWriteOptionsResult, type GitLabIssueWriteResult, type GitLabIssueWriteScope, type GitLabIssueWriteTargetOptions, type GitLabIssueWriteTargetResult, type GitLabMergeBlocker, type GitLabMergeExecution, type GitLabMergeMethod, type GitLabMergeRequestCreateOptions, type GitLabMergeRequestCreateOptionsResult, type GitLabMergeRequestDeleteOptions, type GitLabMergeRequestMergeCapability, type GitLabMergeRequestProject, type GitLabMergeRequestReceipt, type GitLabMergeRequestWriteAddress, type GitLabMergeRequestWriteCapability, type GitLabMergeRequestWriteContext, type GitLabMergeRequestWriteFailure, type GitLabMergeRequestWriteField, type GitLabMergeRequestWriteOptions, type GitLabMergeRequestWriteOptionsResult, type GitLabMergeRequestWriteResult, type GitLabMergeRequestWriteScope, type GitLabMergeRequestWriteTargetOptions, type GitLabMergeRequestWriteTargetResult, type GitLabMergeSquash, GitSelfManagedHostIntegrationId, type HttpProvider, type Integration, type IntegrationAccountCacheDescriptor, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationById, type IntegrationCacheDescriptor, type IntegrationConnectedKey, type IntegrationCredential, type IntegrationIds, type IntegrationManager, type IntegrationManagerCacheLoader, type IntegrationManagerCacheOptions, type IntegrationManagerCacheProvider, type IntegrationManagerCacheResult, type IntegrationManagerContext, type IntegrationResult, type IntegrationServiceHooks, type IntegrationStorageProvider, type IntegrationType, type IntegrationsRemoteConfig, type IssueBatchResult, type IssueBatchTarget, type IssueCountResult, type IssueCountScope, type IssueDeleteOptions, type IssueEtagInclude, type IssueFieldGroup, IssueFilter, type IssueProjection, type IssueRelationshipFailure, type IssueRelationshipPin, type IssueRelationshipReceipt, type IssueRelationshipWriteOptions, type IssueRelationshipWriteResult, type IssueRelationshipsOptions, type IssueRelationshipsResult, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, type IssueTrackerCreateOptions, type IssueTrackerCreateOptionsResult, type IssueTrackerDeleteOptions, type IssueTrackerField, type IssueTrackerIssueReceipt, type IssueTrackerIssueWriteOptions, type IssueTrackerIssueWriteOptionsResult, type IssueTrackerStatus, type IssueTrackerTransition, type IssueTrackerWriteConnection, type IssueTrackerWriteFailure, type IssueTrackerWriteOptions, type IssueTrackerWriteResult, type IssueTrackerWriteTargetOptions, type IssueTrackerWriteTargetResult, type IssueWriteOptions, type IssueWriteResult, type IssueWriteTargetOptions, type IssueWriteTargetResult, IssuesCloudHostIntegrationId, type IssuesIntegration, IssuesSelfManagedHostIntegrationId, type LinearIssueCreateOptions, type LinearIssueCreateOptionsResult, type LinearIssueDeleteOptions, type LinearIssueDeleteResult, type LinearIssueMutationTarget, type LinearIssueReceipt, type LinearIssueWorkflowState, type LinearIssueWriteOptions, type LinearIssueWriteOptionsResult, type LinearIssueWriteResult, type LinearIssueWriteScope, type LinearIssueWriteTargetOptions, type ListLinearProjectsOptions, type ListOrgsOptions, type ListProjectsOptions, LookupBackedOffError, type ManualTokenAuthProviderOptions, type MyPullRequestsForReposOptions, type ProviderAuthenticationSession, type ProviderBroadenOrg, type ProviderBroadenResult, type ProviderLinearProjectShape, type ProviderMetadata, type ProviderOrganization, type ProviderPageInfo, type ProviderPagedResult, type ProviderPullRequestSearchResult, type ProviderReference, type ProviderRepositoriesInput, type ProviderRepositoryInput, type ProviderRepositoryShape, type ProviderResult, type ProviderSweepResult, type ProviderSweepTarget, type ProviderSweepTargetEvent, type ProviderSweepTargetRef, type ProviderWarning, type ProviderWarningCause, type ProviderWarningCauseReason, type ProviderWarningKind, type ProviderWarningOmission, type ProviderWarningOmissionKind, type ProviderWarningOmissionRecovery, type ProviderWarningOmissionScope, type ProviderWarningScope, type ProviderWarningSelector, type ProviderWarningUnreadableItems, type PullRequestActivityAuthor, type PullRequestActivityComment, type PullRequestActivityItem, type PullRequestActivityResult, type PullRequestActivityReview, type PullRequestActivityReviewComment, type PullRequestActivityTarget, type PullRequestBatchResult, type PullRequestBatchTarget, type PullRequestBranchResult, type PullRequestBranchTarget, type PullRequestCheckLogResult, type PullRequestCheckLogTarget, type PullRequestCountResult, type PullRequestCountScope, type PullRequestCreateCapabilityOptions, type PullRequestCreateCapabilityResult, type PullRequestEntityIdentifierInput, type PullRequestEtagInclude, type PullRequestFieldGroup, PullRequestFilter, type PullRequestForCommitResult, type PullRequestProjection, type PullRequestSearchCapabilities, type PullRequestSearchCriteria, type PullRequestStateFilter, type PullRequestSweepOptions, type PullRequestWriteFailure, type PullRequestWriteOptions, type PullRequestWriteResult, type PullRequestWriteSnapshot, type PullRequestWriteTargetOptions, type PullRequestWriteTargetResult, type RefSet, type RepositoriesProvider, type RepositoryIdentity, type RepositoryResolution, type RepositoryResolutionStatus, type ResolveRepositoryResult, type SearchMyPullRequestsOptions, type SearchPullRequestsOptions, type Source, type Sources, type SupportedCloudIntegrationIds, type TokenInfo, type TrelloCardCreateOptions, type TrelloCardCreateOptionsResult, type TrelloCardDeleteOptions, type TrelloCardDeleteResult, type TrelloCardMutationTarget, type TrelloCardReceipt, type TrelloCardWriteAccount, type TrelloCardWriteBoard, type TrelloCardWriteCapability, type TrelloCardWriteFailure, type TrelloCardWriteList, type TrelloCardWriteOptions, type TrelloCardWriteOptionsResult, type TrelloCardWriteResult, type TrelloCardWriteScope, type TrelloCardWriteTargetOptions, type WorkItemAddress, type WorkItemCreateOptions, type WorkItemCreateOptionsResult, type WorkItemDeleteCapability, type WorkItemDeleteOptions, type WorkItemDeleteResult, type WorkItemDeleteTargetChanged, type WorkItemDeletion, type WorkItemReceipt, type WorkItemState, type WorkItemWriteContext, type WorkItemWriteField, type WorkItemWriteOptions, type WorkItemWriteOptionsResult, type WorkItemWriteResult, type WorkItemWriteScope, type WorkItemWriteTargetOptions, type WorkItemWriteTargetResult, areDomainsOnSameHost, convertRemoteProviderIdToIntegrationId, createManualTokenAuthProvider, decodeEntityIdentifier, decodeEntityIdentifiersFromGitConfig, encodeEntityIdentifier, encodeIssueOrPullRequestForGitConfig, getActionablePullRequests, getAzureRepositoryIdentity, getEntityIdentifierInput, getIntegrationConnectedKey, getIntegrationIdForRemote, getIssueFieldPresence, getIssueFromGitConfigEntityIdentifier, getIssueOwner, getProviderIdFromEntityIdentifier, getPullRequestFieldPresence, getSingleConfiguredDomain, hostFromDomain, isAzureProviderId, isCloudGitSelfManagedHostIntegrationId, isGitCloudHostIntegrationId, isGitHostIntegration, isGitSelfManagedHostIntegrationId, isIntegration, isIntegrationId, isIssuesHostIntegrationId, isIssuesIntegration, isMaybeGitLabPullRequestUrl, isSelfManagedHostIntegrationId, isSupportedCloudIntegrationId, providersMetadata, splitOwnerAndRepo, supportsCodeSuggest, toActionablePullRequestInput, toCloudIntegrationType, toIntegrationId, toTokenInfo, toTokenWithInfo };
59
60
  //# sourceMappingURL=index.d.ts.map
@@ -13,6 +13,8 @@ import { getAzureRepositoryIdentity } from "./providers/azure/azure.utils.js";
13
13
  import { isGitHostIntegration, isIntegration, isIssuesIntegration } from "./models/publicIntegration.js";
14
14
  import { createIntegrationService } from "./integrationService.js";
15
15
  import { toIntegrationServiceContext } from "./managerContext.js";
16
+ import { AsanaTaskWriteTransport, toAsanaTaskWriteFailure } from "./providers/asanaTaskWriteTransport.js";
17
+ import { AsanaTaskWriter, isAsanaTaskWriteScope } from "./providers/asanaTaskWrites.js";
16
18
  import { GitLabIssueWriter } from "./providers/gitlab/issueWrites.js";
17
19
  import { GitLabMergeRequestWriter } from "./providers/gitlab/mergeRequestWrites.js";
18
20
  import { LinearIssueWriteTransport, toLinearIssueWriteFailure } from "./providers/linearIssueWriteTransport.js";
@@ -41,8 +43,15 @@ function createIntegrationManager(ctx) {
41
43
  const http = ctx.http;
42
44
  const linearRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent, true);
43
45
  const trelloRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent);
46
+ const asanaRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent);
44
47
  const activeTrelloWrites = /* @__PURE__ */ new Set();
48
+ const activeAsanaWrites = /* @__PURE__ */ new Set();
45
49
  return createIntegrationService(toIntegrationServiceContext(ctx), {
50
+ asanaTask: {
51
+ create: (connection) => new AsanaTaskWriter(new AsanaTaskWriteTransport(asanaRequest, connection), activeAsanaWrites),
52
+ validateScope: isAsanaTaskWriteScope,
53
+ toFailure: toAsanaTaskWriteFailure
54
+ },
46
55
  gitLabIssue: (transport) => new GitLabIssueWriter(transport),
47
56
  gitLabMergeRequest: (transport) => new GitLabMergeRequestWriter(transport),
48
57
  linearIssue: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../plus/integrations/src/index.ts"],"sourcesContent":["// Public facade for `@gitlens/integrations`.\n//\n// External consumers should import from this entry point only, not from the\n// package's internal subpaths, with one exception: the lightweight, token-scoped\n// read API is a supported public subpath (`./lite.js`). It's kept out of this\n// facade on purpose so importing the session-managed manager doesn't eagerly pull\n// in every provider API client. The internal classes (IntegrationService,\n// IntegrationAuthenticationService, etc.) are not part of the public API and\n// may be refactored without semver bumps.\n\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\nimport type { IntegrationManagerContext } from './managerContext.js';\nimport { toIntegrationServiceContext } from './managerContext.js';\nimport { GitLabIssueWriter } from './providers/gitlab/issueWrites.js';\nimport { GitLabMergeRequestWriter } from './providers/gitlab/mergeRequestWrites.js';\nimport { isLinearIssueWriteScope, LinearIssueWriter } from './providers/linearIssueWrites.js';\nimport { LinearIssueWriteTransport, toLinearIssueWriteFailure } from './providers/linearIssueWriteTransport.js';\nimport { createProviderApiRequest } from './providers/providerApiClient.js';\nimport { isTrelloCardWriteScope, TrelloCardWriter } from './providers/trelloCardWrites.js';\nimport { toTrelloCardWriteFailure, TrelloCardWriteTransport } from './providers/trelloCardWriteTransport.js';\n\nexport type { Autolink, AutolinkReference, DynamicAutolinkReference, RefSet } from '@gitlens/git/models/autolink.js';\nexport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\n\nexport type {\n\tIntegrationAccountCacheDescriptor,\n\tIntegrationManagerCacheLoader,\n\tIntegrationManagerCacheOptions,\n\tIntegrationManagerCacheProvider,\n\tIntegrationManagerCacheResult,\n\tIntegrationManagerContext,\n} from './managerContext.js';\n\nexport type {\n\tClosedPullRequestSweepOptions,\n\tGetAutolinkReferencesOptions,\n\tIntegrationManager,\n\tIssueDeleteOptions,\n\tIssueWriteOptions,\n\tIssueWriteTargetOptions,\n\tIssueWriteTargetResult,\n\tListLinearProjectsOptions,\n\tListOrgsOptions,\n\tListProjectsOptions,\n\t// Every option shape a caller has to BUILD is exported, not just the ones the manager returns:\n\t// `manager.js` is not a public subpath, so a type omitted here can't be named by a consumer at all\n\t// (`broadenIssues`' `orgs` needed `ProviderBroadenOrg` and had to be re-declared downstream).\n\tProviderBroadenOrg,\n\tProviderRepositoriesInput,\n\tProviderRepositoryInput,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestCreateCapabilityOptions,\n\tPullRequestSweepOptions,\n\tPullRequestWriteOptions,\n\tPullRequestWriteTargetOptions,\n} from './manager.js';\nexport type {\n\tGitLabIssueCreateOptions,\n\tGitLabIssueCreateOptionsResult,\n\tGitLabIssueDeleteOptions,\n\tGitLabIssueReceipt,\n\tGitLabIssueWriteAddress,\n\tGitLabIssueWriteCapability,\n\tGitLabIssueWriteContext,\n\tGitLabIssueWriteFailure,\n\tGitLabIssueWriteField,\n\tGitLabIssueWriteOptions,\n\tGitLabIssueWriteOptionsResult,\n\tGitLabIssueWriteResult,\n\tGitLabIssueWriteScope,\n\tGitLabIssueWriteTargetOptions,\n\tGitLabIssueWriteTargetResult,\n} from './models/gitlabIssueWrites.js';\nexport type {\n\tGitLabMergeBlocker,\n\tGitLabMergeExecution,\n\tGitLabMergeMethod,\n\tGitLabMergeRequestCreateOptions,\n\tGitLabMergeRequestCreateOptionsResult,\n\tGitLabMergeRequestDeleteOptions,\n\tGitLabMergeRequestMergeCapability,\n\tGitLabMergeRequestProject,\n\tGitLabMergeRequestReceipt,\n\tGitLabMergeRequestWriteAddress,\n\tGitLabMergeRequestWriteCapability,\n\tGitLabMergeRequestWriteContext,\n\tGitLabMergeRequestWriteFailure,\n\tGitLabMergeRequestWriteField,\n\tGitLabMergeRequestWriteOptions,\n\tGitLabMergeRequestWriteOptionsResult,\n\tGitLabMergeRequestWriteResult,\n\tGitLabMergeRequestWriteScope,\n\tGitLabMergeRequestWriteTargetOptions,\n\tGitLabMergeRequestWriteTargetResult,\n\tGitLabMergeSquash,\n} from './models/gitlabMergeRequestWrites.js';\nexport type {\n\tIssueTrackerCreateOptions,\n\tIssueTrackerCreateOptionsResult,\n\tIssueTrackerDeleteOptions,\n\tIssueTrackerField,\n\tIssueTrackerIssueReceipt,\n\tIssueTrackerIssueWriteOptions,\n\tIssueTrackerIssueWriteOptionsResult,\n\tIssueTrackerStatus,\n\tIssueTrackerTransition,\n\tIssueTrackerWriteConnection,\n\tIssueTrackerWriteFailure,\n\tIssueTrackerWriteOptions,\n\tIssueTrackerWriteResult,\n\tIssueTrackerWriteTargetOptions,\n\tIssueTrackerWriteTargetResult,\n} from './models/issueTrackerWrites.js';\nexport type {\n\tLinearIssueCreateOptions,\n\tLinearIssueCreateOptionsResult,\n\tLinearIssueDeleteOptions,\n\tLinearIssueDeleteResult,\n\tLinearIssueMutationTarget,\n\tLinearIssueReceipt,\n\tLinearIssueWorkflowState,\n\tLinearIssueWriteOptions,\n\tLinearIssueWriteOptionsResult,\n\tLinearIssueWriteResult,\n\tLinearIssueWriteScope,\n\tLinearIssueWriteTargetOptions,\n} from './models/linearIssueWrites.js';\nexport type {\n\tTrelloCardCreateOptions,\n\tTrelloCardCreateOptionsResult,\n\tTrelloCardDeleteOptions,\n\tTrelloCardDeleteResult,\n\tTrelloCardMutationTarget,\n\tTrelloCardReceipt,\n\tTrelloCardWriteAccount,\n\tTrelloCardWriteBoard,\n\tTrelloCardWriteCapability,\n\tTrelloCardWriteFailure,\n\tTrelloCardWriteList,\n\tTrelloCardWriteOptions,\n\tTrelloCardWriteOptionsResult,\n\tTrelloCardWriteResult,\n\tTrelloCardWriteScope,\n\tTrelloCardWriteTargetOptions,\n} from './models/trelloCardWrites.js';\nexport type {\n\tAzurePullRequestCreateCapabilityOptions,\n\tAzurePullRequestCreateCapabilityResult,\n\tAzurePullRequestMergeStrategy,\n\tAzurePullRequestRepository,\n\tAzurePullRequestWriteAction,\n\tAzurePullRequestWriteFailure,\n\tAzurePullRequestWriteOptions,\n\tAzurePullRequestWriteResult,\n\tAzurePullRequestWriteTargetOptions,\n\tAzurePullRequestWriteTargetResult,\n\tAzureServerPullRequestWriteOptions,\n\tAzureServerPullRequestWriteScope,\n\tAzureServerPullRequestWriteTargetOptions,\n\tAzureWrittenPullRequest,\n} from './models/azurePullRequestWrites.js';\nexport type {\n\tBitbucketPullRequestCreateCapabilityOptions,\n\tBitbucketPullRequestCreateCapabilityResult,\n\tBitbucketPullRequestMergeCapability,\n\tBitbucketPullRequestMergeStatusOptions,\n\tBitbucketPullRequestMergeStatusResult,\n\tBitbucketPullRequestMergeStrategy,\n\tBitbucketPullRequestRepository,\n\tBitbucketPullRequestWriteAction,\n\tBitbucketPullRequestWriteFailure,\n\tBitbucketPullRequestWriteOptions,\n\tBitbucketPullRequestWriteReleaseOptions,\n\tBitbucketPullRequestWriteReleaseResult,\n\tBitbucketPullRequestWriteResult,\n\tBitbucketPullRequestWriteTargetOptions,\n\tBitbucketPullRequestWriteTargetResult,\n\tBitbucketUnsettledPullRequestWrite,\n\tBitbucketWrittenPullRequest,\n} from './models/bitbucketPullRequestWrites.js';\nexport type {\n\tBitbucketServerPullRequestActionCapability,\n\tBitbucketServerPullRequestCreateCapabilityResult,\n\tBitbucketServerPullRequestMergeCapability,\n\tBitbucketServerPullRequestRepository,\n\tBitbucketServerPullRequestVeto,\n\tBitbucketServerPullRequestWriteAction,\n\tBitbucketServerPullRequestWriteFailure,\n\tBitbucketServerPullRequestWriteOptions,\n\tBitbucketServerPullRequestWriteResult,\n\tBitbucketServerPullRequestWriteScope,\n\tBitbucketServerPullRequestWriteTargetOptions,\n\tBitbucketServerPullRequestWriteTargetResult,\n\tBitbucketServerWrittenPullRequest,\n} from './models/bitbucketServerPullRequestWrites.js';\nexport type {\n\tAzureServerWorkItemWriteScope,\n\tAzureServicesWorkItemWriteScope,\n\tWorkItemAddress,\n\tWorkItemCreateOptions,\n\tWorkItemCreateOptionsResult,\n\tWorkItemDeleteCapability,\n\tWorkItemDeleteOptions,\n\tWorkItemDeleteResult,\n\tWorkItemDeleteTargetChanged,\n\tWorkItemDeletion,\n\tWorkItemReceipt,\n\tWorkItemState,\n\tWorkItemWriteContext,\n\tWorkItemWriteField,\n\tWorkItemWriteOptions,\n\tWorkItemWriteOptionsResult,\n\tWorkItemWriteResult,\n\tWorkItemWriteScope,\n\tWorkItemWriteTargetOptions,\n\tWorkItemWriteTargetResult,\n} from './models/workItemWrites.js';\nexport type {\n\tCaptureRelationshipCurrency,\n\tIssueRelationshipsOptions,\n\tIssueRelationshipsResult,\n\tIssueRelationshipWriteOptions,\n\tIssueRelationshipWriteResult,\n\tIssueRelationshipPin,\n\tIssueRelationshipReceipt,\n\tIssueRelationshipFailure,\n} from './models/issueRelationships.js';\nexport type { IssueWriteResult } from '@gitlens/git-github/api/issueWrites.js';\nexport type {\n\tPullRequestCreateCapabilityResult,\n\tPullRequestWriteFailure,\n\tPullRequestWriteResult,\n\tPullRequestWriteSnapshot,\n\tPullRequestWriteTargetResult,\n} from '@gitlens/git-github/api/pullRequestWrites.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\tconst http = ctx.http;\n\tconst linearRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent, true);\n\tconst trelloRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent);\n\tconst activeTrelloWrites = new Set<string>();\n\treturn createIntegrationService(toIntegrationServiceContext(ctx), {\n\t\tgitLabIssue: transport => new GitLabIssueWriter(transport),\n\t\tgitLabMergeRequest: transport => new GitLabMergeRequestWriter(transport),\n\t\tlinearIssue: {\n\t\t\tcreate: connection => new LinearIssueWriter(new LinearIssueWriteTransport(linearRequest, connection)),\n\t\t\tvalidateScope: isLinearIssueWriteScope,\n\t\t\ttoFailure: toLinearIssueWriteFailure,\n\t\t},\n\t\ttrelloCard: {\n\t\t\tcreate: connection =>\n\t\t\t\tnew TrelloCardWriter(new TrelloCardWriteTransport(trelloRequest, connection), activeTrelloWrites),\n\t\t\tvalidateScope: isTrelloCardWriteScope,\n\t\t\ttoFailure: toTrelloCardWriteFailure,\n\t\t},\n\t});\n}\n\n// Re-exports for the public API surface.\nexport type {\n\tAccountProvider,\n\tAuthenticationSessionsChangeEvent,\n\tConfigChangeEvent,\n\tConfigProvider,\n\tRepositoriesProvider,\n\tHttpProvider,\n\tIntegrationsRemoteConfig,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n} from './context.js';\nexport type { Source, Sources } from './telemetry.js';\nexport type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.js';\nexport type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';\n\n// Authentication contract — what `IntegrationServiceHooks.createAuthenticationProvider`\n// implementers return. Consumers can plug in any auth strategy (manual token,\n// OAuth, host-managed) by returning an object implementing this interface from\n// the hook.\nexport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationProviderDescriptor,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './authentication/integrationAuthenticationProvider.js';\nexport type {\n\tAuthenticationSessionLike,\n\tCloudIntegrationAuthType,\n\tCloudIntegrationConnection,\n\tCloudIntegrationType,\n\tConfiguredIntegrationDescriptor,\n\tProviderAuthenticationSession,\n} from './authentication/models.js';\n// Provider-id mapping helpers for consumers bridging their own provider ids to `IntegrationIds`\n// (e.g. mapping multi-account connections from `getConfigured` back to a provider) and vice versa.\nexport { toCloudIntegrationType, toIntegrationId } from './authentication/models.js';\n// Domain normalization is part of connection selection and repository resolution; consumers should use the\n// same implementation rather than importing an internal utility subpath or maintaining a divergent copy.\nexport { areDomainsOnSameHost, hostFromDomain } from './utils/domain.utils.js';\n\n// Convenience: wrap a static access token (env var, CLI flag, secret manager)\n// as an `IntegrationAuthenticationProvider`. For OAuth/refresh flows, implement\n// the interface directly — this helper is for non-interactive consumers only.\nexport {\n\tcreateManualTokenAuthProvider,\n\ttype ManualTokenAuthProviderOptions,\n} from './authentication/manualTokenProvider.js';\n\nexport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tisIntegrationId,\n\tisSupportedCloudIntegrationId,\n} from './constants.js';\n\n// Neutral pagination + warning result types the Kepler ProviderBackend adapter maps to its own DTOs.\n// These carry no `@gitkraken/provider-apis` types, so consumers depend only on `@gitkraken/core-gitlens`.\nexport type {\n\tConnectionStateChangeEvent,\n\tProviderBroadenResult,\n\tProviderPagedResult,\n\tProviderPageInfo,\n\tProviderPullRequestSearchResult,\n\tProviderResult,\n\tProviderSweepResult,\n\tProviderSweepTargetRef,\n\tProviderWarning,\n\tProviderWarningCause,\n\tProviderWarningCauseReason,\n\tProviderWarningKind,\n\tProviderWarningOmission,\n\tProviderWarningOmissionKind,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningScope,\n\tProviderWarningSelector,\n\tProviderWarningUnreadableItems,\n\tProviderLinearProjectShape,\n\tProviderOrganization,\n\tProviderRepositoryShape,\n\tRepositoryIdentity,\n\tRepositoryResolution,\n\tRepositoryResolutionStatus,\n\tResolveRepositoryResult,\n} from './results.js';\n// Runtime enums — re-exported as values (not `export type`) so consumers can read their members.\nexport { IssueFilter, PullRequestFilter } from './providerFilters.js';\n// The filtered issue search's criteria model and the capability table that says which of it a provider honors.\n// String unions and plain interfaces, so a consumer builds criteria without importing an internal subpath.\nexport type { IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship } from './providerFilters.js';\n// Account-wide pull-request search criteria and the per-provider capability table.\nexport type { PullRequestSearchCapabilities, PullRequestSearchCriteria } from './providerFilters.js';\n// The count-only issue and pull-request probes' input and result shapes.\nexport type { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from './results.js';\nexport type { IssueBatchResult, IssueBatchTarget } from './results.js';\nexport type { PullRequestBatchResult, PullRequestBatchTarget } from './results.js';\nexport type { IssueEtagInclude, PullRequestEtagInclude } from './reads/etag.js';\nexport type { PullRequestBranchResult, PullRequestBranchTarget } from './results.js';\nexport type { PullRequestCheckLogResult, PullRequestCheckLogTarget } from './results.js';\nexport type { PullRequestActivityResult, PullRequestActivityTarget } from './results.js';\nexport type {\n\tPullRequestActivityAuthor,\n\tPullRequestActivityComment,\n\tPullRequestActivityItem,\n\tPullRequestActivityReview,\n\tPullRequestActivityReviewComment,\n} from '@gitlens/git/models/pullRequestActivity.js';\nexport type { PullRequestForCommitResult } from './results.js';\n// The current-account read's result, and the account shape every identity-bearing read already returns.\nexport type { CurrentAccountResult } from './results.js';\nexport type { Account } from '@gitlens/git/models/author.js';\n// Cross-provider PR/issue state filters (string unions in the git models).\nexport type { PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueStateFilter } from '@gitlens/git/models/issue.js';\n// Which read produced a row, and which of its fields that read fetched.\nexport type { PullRequestProjection } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueProjection } from '@gitlens/git/models/issue.js';\nexport type { FieldPresence, IssueFieldGroup, PullRequestFieldGroup } from './fieldPresence.js';\nexport { getIssueFieldPresence, getPullRequestFieldPresence } from './fieldPresence.js';\n\n// Interface-only views of the integrations the manager hands out (`get`, `getIntegrationsForAccountWideRead`), named\n// after the internal classes they view, and the types their members take and return. The classes stay internal; see\n// `models/publicIntegration.ts`.\nexport type {\n\tGitHostIntegration,\n\tIntegration,\n\tIntegrationById,\n\tIntegrationCacheDescriptor,\n\tIntegrationConnectedKey,\n\tIntegrationCredential,\n\tIntegrationResult,\n\tIntegrationType,\n\tIssuesIntegration,\n\tMyPullRequestsForReposOptions,\n\tSearchMyPullRequestsOptions,\n\tSearchPullRequestsOptions,\n} from './models/publicIntegration.js';\n// Guards over the views. `isIntegration` replaces an `instanceof` check against the internal base class.\nexport { isGitHostIntegration, isIntegration, isIssuesIntegration } from './models/publicIntegration.js';\nexport {\n\tconvertRemoteProviderIdToIntegrationId,\n\tgetIntegrationConnectedKey,\n\tgetIntegrationIdForRemote,\n\tisCloudGitSelfManagedHostIntegrationId,\n\tisGitCloudHostIntegrationId,\n\tisGitSelfManagedHostIntegrationId,\n\tisIssuesHostIntegrationId,\n\tisSelfManagedHostIntegrationId,\n} from './utils/integration.utils.js';\nexport { getSingleConfiguredDomain } from './utils/domain.utils.js';\nexport { getAzureRepositoryIdentity } from './providers/azure/azure.utils.js';\nexport { isAzureProviderId } from './providers/providerErrors.js';\nexport { LookupBackedOffError } from './errors.js';\n\n// Provider metadata (names, domains, icons, capabilities) and the per-provider feature checks built on it.\nexport type { ProviderMetadata } from './providers/metadata.js';\nexport { providersMetadata, supportsCodeSuggest } from './providers/metadata.js';\n\n// Token fingerprints, for logging and error reporting without the token itself.\nexport type { TokenInfo } from './authentication/models.js';\nexport { toTokenInfo, toTokenWithInfo } from './authentication/models.js';\n\n// Entity identifiers: the neutral codec Launchpad (pins/snoozes), drafts and branch-issue associations key by.\nexport type {\n\tEntityIdentifier,\n\tEntityIdentifierFields,\n\tEntityIdentifierInput,\n\tGitConfigEntityIdentifier,\n\tPullRequestEntityIdentifierInput,\n} from './providers/utils.js';\n// Runtime consts (and their same-named value unions) for building identifiers without string literals.\nexport {\n\tEntityIdentifierProviderType,\n\tEntityType,\n\tEntityVersion,\n\tdecodeEntityIdentifier,\n\tdecodeEntityIdentifiersFromGitConfig,\n\tencodeEntityIdentifier,\n\tencodeIssueOrPullRequestForGitConfig,\n\tgetEntityIdentifierInput,\n\tgetIssueFromGitConfigEntityIdentifier,\n\tgetIssueOwner,\n\tgetProviderIdFromEntityIdentifier,\n} from './providers/utils.js';\n\nexport { isMaybeGitLabPullRequestUrl, splitOwnerAndRepo } from './providers/gitlab/gitlab.utils.js';\n\n// Actionable pull requests: Launchpad's categorization, over neutral copies of the provider-apis shapes it reads.\nexport type {\n\tActionablePullRequest,\n\tActionablePullRequestAccount,\n\tActionablePullRequestCategory,\n\tActionablePullRequestEnrichedItem,\n\tActionablePullRequestEnrichedItems,\n\tActionablePullRequestFields,\n\tActionablePullRequestInput,\n} from './models/actionablePullRequest.js';\nexport {\n\tActionablePullRequestBuildStatusState,\n\tActionablePullRequestReviewState,\n} from './models/actionablePullRequest.js';\nexport { getActionablePullRequests, toActionablePullRequestInput } from './providers/actionablePullRequests.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0PA,SAAgB,yBAAyB,KAAoD;CAC5F,MAAM,OAAO,IAAI;CACjB,MAAM,gBAAgB,0BAA0B,OAAO,SAAS,KAAK,MAAM,OAAO,IAAI,GAAG,KAAK,WAAW,IAAI;CAC7G,MAAM,gBAAgB,0BAA0B,OAAO,SAAS,KAAK,MAAM,OAAO,IAAI,GAAG,KAAK,SAAS;CACvG,MAAM,qCAAqB,IAAI,IAAY;CAC3C,OAAO,yBAAyB,4BAA4B,GAAG,GAAG;EACjE,cAAa,cAAa,IAAI,kBAAkB,SAAS;EACzD,qBAAoB,cAAa,IAAI,yBAAyB,SAAS;EACvE,aAAa;GACZ,SAAQ,eAAc,IAAI,kBAAkB,IAAI,0BAA0B,eAAe,UAAU,CAAC;GACpG,eAAe;GACf,WAAW;EACZ;EACA,YAAY;GACX,SAAQ,eACP,IAAI,iBAAiB,IAAI,yBAAyB,eAAe,UAAU,GAAG,kBAAkB;GACjG,eAAe;GACf,WAAW;EACZ;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../plus/integrations/src/index.ts"],"sourcesContent":["// Public facade for `@gitlens/integrations`.\n//\n// External consumers should import from this entry point only, not from the\n// package's internal subpaths, with one exception: the lightweight, token-scoped\n// read API is a supported public subpath (`./lite.js`). It's kept out of this\n// facade on purpose so importing the session-managed manager doesn't eagerly pull\n// in every provider API client. The internal classes (IntegrationService,\n// IntegrationAuthenticationService, etc.) are not part of the public API and\n// may be refactored without semver bumps.\n\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\nimport type { IntegrationManagerContext } from './managerContext.js';\nimport { toIntegrationServiceContext } from './managerContext.js';\nimport { AsanaTaskWriter, isAsanaTaskWriteScope } from './providers/asanaTaskWrites.js';\nimport { AsanaTaskWriteTransport, toAsanaTaskWriteFailure } from './providers/asanaTaskWriteTransport.js';\nimport { GitLabIssueWriter } from './providers/gitlab/issueWrites.js';\nimport { GitLabMergeRequestWriter } from './providers/gitlab/mergeRequestWrites.js';\nimport { isLinearIssueWriteScope, LinearIssueWriter } from './providers/linearIssueWrites.js';\nimport { LinearIssueWriteTransport, toLinearIssueWriteFailure } from './providers/linearIssueWriteTransport.js';\nimport { createProviderApiRequest } from './providers/providerApiClient.js';\nimport { isTrelloCardWriteScope, TrelloCardWriter } from './providers/trelloCardWrites.js';\nimport { toTrelloCardWriteFailure, TrelloCardWriteTransport } from './providers/trelloCardWriteTransport.js';\n\nexport type { Autolink, AutolinkReference, DynamicAutolinkReference, RefSet } from '@gitlens/git/models/autolink.js';\nexport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\n\nexport type {\n\tIntegrationAccountCacheDescriptor,\n\tIntegrationManagerCacheLoader,\n\tIntegrationManagerCacheOptions,\n\tIntegrationManagerCacheProvider,\n\tIntegrationManagerCacheResult,\n\tIntegrationManagerContext,\n} from './managerContext.js';\n\nexport type {\n\tClosedPullRequestSweepOptions,\n\tGetAutolinkReferencesOptions,\n\tIntegrationManager,\n\tIssueDeleteOptions,\n\tIssueWriteOptions,\n\tIssueWriteTargetOptions,\n\tIssueWriteTargetResult,\n\tListLinearProjectsOptions,\n\tListOrgsOptions,\n\tListProjectsOptions,\n\t// Every option shape a caller has to BUILD is exported, not just the ones the manager returns:\n\t// `manager.js` is not a public subpath, so a type omitted here can't be named by a consumer at all\n\t// (`broadenIssues`' `orgs` needed `ProviderBroadenOrg` and had to be re-declared downstream).\n\tProviderBroadenOrg,\n\tProviderRepositoriesInput,\n\tProviderRepositoryInput,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestCreateCapabilityOptions,\n\tPullRequestSweepOptions,\n\tPullRequestWriteOptions,\n\tPullRequestWriteTargetOptions,\n} from './manager.js';\nexport type {\n\tGitLabIssueCreateOptions,\n\tGitLabIssueCreateOptionsResult,\n\tGitLabIssueDeleteOptions,\n\tGitLabIssueReceipt,\n\tGitLabIssueWriteAddress,\n\tGitLabIssueWriteCapability,\n\tGitLabIssueWriteContext,\n\tGitLabIssueWriteFailure,\n\tGitLabIssueWriteField,\n\tGitLabIssueWriteOptions,\n\tGitLabIssueWriteOptionsResult,\n\tGitLabIssueWriteResult,\n\tGitLabIssueWriteScope,\n\tGitLabIssueWriteTargetOptions,\n\tGitLabIssueWriteTargetResult,\n} from './models/gitlabIssueWrites.js';\nexport type {\n\tGitLabMergeBlocker,\n\tGitLabMergeExecution,\n\tGitLabMergeMethod,\n\tGitLabMergeRequestCreateOptions,\n\tGitLabMergeRequestCreateOptionsResult,\n\tGitLabMergeRequestDeleteOptions,\n\tGitLabMergeRequestMergeCapability,\n\tGitLabMergeRequestProject,\n\tGitLabMergeRequestReceipt,\n\tGitLabMergeRequestWriteAddress,\n\tGitLabMergeRequestWriteCapability,\n\tGitLabMergeRequestWriteContext,\n\tGitLabMergeRequestWriteFailure,\n\tGitLabMergeRequestWriteField,\n\tGitLabMergeRequestWriteOptions,\n\tGitLabMergeRequestWriteOptionsResult,\n\tGitLabMergeRequestWriteResult,\n\tGitLabMergeRequestWriteScope,\n\tGitLabMergeRequestWriteTargetOptions,\n\tGitLabMergeRequestWriteTargetResult,\n\tGitLabMergeSquash,\n} from './models/gitlabMergeRequestWrites.js';\nexport type {\n\tIssueTrackerCreateOptions,\n\tIssueTrackerCreateOptionsResult,\n\tIssueTrackerDeleteOptions,\n\tIssueTrackerField,\n\tIssueTrackerIssueReceipt,\n\tIssueTrackerIssueWriteOptions,\n\tIssueTrackerIssueWriteOptionsResult,\n\tIssueTrackerStatus,\n\tIssueTrackerTransition,\n\tIssueTrackerWriteConnection,\n\tIssueTrackerWriteFailure,\n\tIssueTrackerWriteOptions,\n\tIssueTrackerWriteResult,\n\tIssueTrackerWriteTargetOptions,\n\tIssueTrackerWriteTargetResult,\n} from './models/issueTrackerWrites.js';\nexport type {\n\tLinearIssueCreateOptions,\n\tLinearIssueCreateOptionsResult,\n\tLinearIssueDeleteOptions,\n\tLinearIssueDeleteResult,\n\tLinearIssueMutationTarget,\n\tLinearIssueReceipt,\n\tLinearIssueWorkflowState,\n\tLinearIssueWriteOptions,\n\tLinearIssueWriteOptionsResult,\n\tLinearIssueWriteResult,\n\tLinearIssueWriteScope,\n\tLinearIssueWriteTargetOptions,\n} from './models/linearIssueWrites.js';\nexport type {\n\tAsanaTaskAssignee,\n\tAsanaTaskCreateOptions,\n\tAsanaTaskCreateOptionsResult,\n\tAsanaTaskDeleteOptions,\n\tAsanaTaskDeleteResult,\n\tAsanaTaskMembership,\n\tAsanaTaskMutationTarget,\n\tAsanaTaskReceipt,\n\tAsanaTaskWriteAccount,\n\tAsanaTaskWriteAccountResult,\n\tAsanaTaskWriteCapability,\n\tAsanaTaskWriteFailure,\n\tAsanaTaskWriteOptions,\n\tAsanaTaskWriteOptionsResult,\n\tAsanaTaskWriteProject,\n\tAsanaTaskWriteResult,\n\tAsanaTaskWriteScope,\n\tAsanaTaskWriteSection,\n\tAsanaTaskWriteTargetOptions,\n\tAsanaTaskWriteWorkspace,\n} from './models/asanaTaskWrites.js';\nexport type {\n\tTrelloCardCreateOptions,\n\tTrelloCardCreateOptionsResult,\n\tTrelloCardDeleteOptions,\n\tTrelloCardDeleteResult,\n\tTrelloCardMutationTarget,\n\tTrelloCardReceipt,\n\tTrelloCardWriteAccount,\n\tTrelloCardWriteBoard,\n\tTrelloCardWriteCapability,\n\tTrelloCardWriteFailure,\n\tTrelloCardWriteList,\n\tTrelloCardWriteOptions,\n\tTrelloCardWriteOptionsResult,\n\tTrelloCardWriteResult,\n\tTrelloCardWriteScope,\n\tTrelloCardWriteTargetOptions,\n} from './models/trelloCardWrites.js';\nexport type {\n\tAzurePullRequestCreateCapabilityOptions,\n\tAzurePullRequestCreateCapabilityResult,\n\tAzurePullRequestMergeStrategy,\n\tAzurePullRequestRepository,\n\tAzurePullRequestWriteAction,\n\tAzurePullRequestWriteFailure,\n\tAzurePullRequestWriteOptions,\n\tAzurePullRequestWriteResult,\n\tAzurePullRequestWriteTargetOptions,\n\tAzurePullRequestWriteTargetResult,\n\tAzureServerPullRequestWriteOptions,\n\tAzureServerPullRequestWriteScope,\n\tAzureServerPullRequestWriteTargetOptions,\n\tAzureWrittenPullRequest,\n} from './models/azurePullRequestWrites.js';\nexport type {\n\tBitbucketPullRequestCreateCapabilityOptions,\n\tBitbucketPullRequestCreateCapabilityResult,\n\tBitbucketPullRequestMergeCapability,\n\tBitbucketPullRequestMergeStatusOptions,\n\tBitbucketPullRequestMergeStatusResult,\n\tBitbucketPullRequestMergeStrategy,\n\tBitbucketPullRequestRepository,\n\tBitbucketPullRequestWriteAction,\n\tBitbucketPullRequestWriteFailure,\n\tBitbucketPullRequestWriteOptions,\n\tBitbucketPullRequestWriteReleaseOptions,\n\tBitbucketPullRequestWriteReleaseResult,\n\tBitbucketPullRequestWriteResult,\n\tBitbucketPullRequestWriteTargetOptions,\n\tBitbucketPullRequestWriteTargetResult,\n\tBitbucketUnsettledPullRequestWrite,\n\tBitbucketWrittenPullRequest,\n} from './models/bitbucketPullRequestWrites.js';\nexport type {\n\tBitbucketServerPullRequestActionCapability,\n\tBitbucketServerPullRequestCreateCapabilityResult,\n\tBitbucketServerPullRequestMergeCapability,\n\tBitbucketServerPullRequestRepository,\n\tBitbucketServerPullRequestVeto,\n\tBitbucketServerPullRequestWriteAction,\n\tBitbucketServerPullRequestWriteFailure,\n\tBitbucketServerPullRequestWriteOptions,\n\tBitbucketServerPullRequestWriteResult,\n\tBitbucketServerPullRequestWriteScope,\n\tBitbucketServerPullRequestWriteTargetOptions,\n\tBitbucketServerPullRequestWriteTargetResult,\n\tBitbucketServerWrittenPullRequest,\n} from './models/bitbucketServerPullRequestWrites.js';\nexport type {\n\tAzureServerWorkItemWriteScope,\n\tAzureServicesWorkItemWriteScope,\n\tWorkItemAddress,\n\tWorkItemCreateOptions,\n\tWorkItemCreateOptionsResult,\n\tWorkItemDeleteCapability,\n\tWorkItemDeleteOptions,\n\tWorkItemDeleteResult,\n\tWorkItemDeleteTargetChanged,\n\tWorkItemDeletion,\n\tWorkItemReceipt,\n\tWorkItemState,\n\tWorkItemWriteContext,\n\tWorkItemWriteField,\n\tWorkItemWriteOptions,\n\tWorkItemWriteOptionsResult,\n\tWorkItemWriteResult,\n\tWorkItemWriteScope,\n\tWorkItemWriteTargetOptions,\n\tWorkItemWriteTargetResult,\n} from './models/workItemWrites.js';\nexport type {\n\tCaptureRelationshipCurrency,\n\tIssueRelationshipsOptions,\n\tIssueRelationshipsResult,\n\tIssueRelationshipWriteOptions,\n\tIssueRelationshipWriteResult,\n\tIssueRelationshipPin,\n\tIssueRelationshipReceipt,\n\tIssueRelationshipFailure,\n} from './models/issueRelationships.js';\nexport type { IssueWriteResult } from '@gitlens/git-github/api/issueWrites.js';\nexport type {\n\tPullRequestCreateCapabilityResult,\n\tPullRequestWriteFailure,\n\tPullRequestWriteResult,\n\tPullRequestWriteSnapshot,\n\tPullRequestWriteTargetResult,\n} from '@gitlens/git-github/api/pullRequestWrites.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\tconst http = ctx.http;\n\tconst linearRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent, true);\n\tconst trelloRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent);\n\tconst asanaRequest = createProviderApiRequest((input, init) => http.fetch(input, init), http.userAgent);\n\tconst activeTrelloWrites = new Set<string>();\n\tconst activeAsanaWrites = new Set<string>();\n\treturn createIntegrationService(toIntegrationServiceContext(ctx), {\n\t\tasanaTask: {\n\t\t\tcreate: connection =>\n\t\t\t\tnew AsanaTaskWriter(new AsanaTaskWriteTransport(asanaRequest, connection), activeAsanaWrites),\n\t\t\tvalidateScope: isAsanaTaskWriteScope,\n\t\t\ttoFailure: toAsanaTaskWriteFailure,\n\t\t},\n\t\tgitLabIssue: transport => new GitLabIssueWriter(transport),\n\t\tgitLabMergeRequest: transport => new GitLabMergeRequestWriter(transport),\n\t\tlinearIssue: {\n\t\t\tcreate: connection => new LinearIssueWriter(new LinearIssueWriteTransport(linearRequest, connection)),\n\t\t\tvalidateScope: isLinearIssueWriteScope,\n\t\t\ttoFailure: toLinearIssueWriteFailure,\n\t\t},\n\t\ttrelloCard: {\n\t\t\tcreate: connection =>\n\t\t\t\tnew TrelloCardWriter(new TrelloCardWriteTransport(trelloRequest, connection), activeTrelloWrites),\n\t\t\tvalidateScope: isTrelloCardWriteScope,\n\t\t\ttoFailure: toTrelloCardWriteFailure,\n\t\t},\n\t});\n}\n\n// Re-exports for the public API surface.\nexport type {\n\tAccountProvider,\n\tAuthenticationSessionsChangeEvent,\n\tConfigChangeEvent,\n\tConfigProvider,\n\tRepositoriesProvider,\n\tHttpProvider,\n\tIntegrationsRemoteConfig,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n} from './context.js';\nexport type { Source, Sources } from './telemetry.js';\nexport type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.js';\nexport type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';\n\n// Authentication contract — what `IntegrationServiceHooks.createAuthenticationProvider`\n// implementers return. Consumers can plug in any auth strategy (manual token,\n// OAuth, host-managed) by returning an object implementing this interface from\n// the hook.\nexport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationProviderDescriptor,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './authentication/integrationAuthenticationProvider.js';\nexport type {\n\tAuthenticationSessionLike,\n\tCloudIntegrationAuthType,\n\tCloudIntegrationConnection,\n\tCloudIntegrationType,\n\tConfiguredIntegrationDescriptor,\n\tProviderAuthenticationSession,\n} from './authentication/models.js';\n// Provider-id mapping helpers for consumers bridging their own provider ids to `IntegrationIds`\n// (e.g. mapping multi-account connections from `getConfigured` back to a provider) and vice versa.\nexport { toCloudIntegrationType, toIntegrationId } from './authentication/models.js';\n// Domain normalization is part of connection selection and repository resolution; consumers should use the\n// same implementation rather than importing an internal utility subpath or maintaining a divergent copy.\nexport { areDomainsOnSameHost, hostFromDomain } from './utils/domain.utils.js';\n\n// Convenience: wrap a static access token (env var, CLI flag, secret manager)\n// as an `IntegrationAuthenticationProvider`. For OAuth/refresh flows, implement\n// the interface directly — this helper is for non-interactive consumers only.\nexport {\n\tcreateManualTokenAuthProvider,\n\ttype ManualTokenAuthProviderOptions,\n} from './authentication/manualTokenProvider.js';\n\nexport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tisIntegrationId,\n\tisSupportedCloudIntegrationId,\n} from './constants.js';\n\n// Neutral pagination + warning result types the Kepler ProviderBackend adapter maps to its own DTOs.\n// These carry no `@gitkraken/provider-apis` types, so consumers depend only on `@gitkraken/core-gitlens`.\nexport type {\n\tConnectionStateChangeEvent,\n\tProviderBroadenResult,\n\tProviderPagedResult,\n\tProviderPageInfo,\n\tProviderPullRequestSearchResult,\n\tProviderResult,\n\tProviderSweepResult,\n\tProviderSweepTargetRef,\n\tProviderWarning,\n\tProviderWarningCause,\n\tProviderWarningCauseReason,\n\tProviderWarningKind,\n\tProviderWarningOmission,\n\tProviderWarningOmissionKind,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningScope,\n\tProviderWarningSelector,\n\tProviderWarningUnreadableItems,\n\tProviderLinearProjectShape,\n\tProviderOrganization,\n\tProviderRepositoryShape,\n\tRepositoryIdentity,\n\tRepositoryResolution,\n\tRepositoryResolutionStatus,\n\tResolveRepositoryResult,\n} from './results.js';\n// Runtime enums — re-exported as values (not `export type`) so consumers can read their members.\nexport { IssueFilter, PullRequestFilter } from './providerFilters.js';\n// The filtered issue search's criteria model and the capability table that says which of it a provider honors.\n// String unions and plain interfaces, so a consumer builds criteria without importing an internal subpath.\nexport type { IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship } from './providerFilters.js';\n// Account-wide pull-request search criteria and the per-provider capability table.\nexport type { PullRequestSearchCapabilities, PullRequestSearchCriteria } from './providerFilters.js';\n// The count-only issue and pull-request probes' input and result shapes.\nexport type { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from './results.js';\nexport type { IssueBatchResult, IssueBatchTarget } from './results.js';\nexport type { PullRequestBatchResult, PullRequestBatchTarget } from './results.js';\nexport type { IssueEtagInclude, PullRequestEtagInclude } from './reads/etag.js';\nexport type { PullRequestBranchResult, PullRequestBranchTarget } from './results.js';\nexport type { PullRequestCheckLogResult, PullRequestCheckLogTarget } from './results.js';\nexport type { PullRequestActivityResult, PullRequestActivityTarget } from './results.js';\nexport type {\n\tPullRequestActivityAuthor,\n\tPullRequestActivityComment,\n\tPullRequestActivityItem,\n\tPullRequestActivityReview,\n\tPullRequestActivityReviewComment,\n} from '@gitlens/git/models/pullRequestActivity.js';\nexport type { PullRequestForCommitResult } from './results.js';\n// The current-account read's result, and the account shape every identity-bearing read already returns.\nexport type { CurrentAccountResult } from './results.js';\nexport type { Account } from '@gitlens/git/models/author.js';\n// Cross-provider PR/issue state filters (string unions in the git models).\nexport type { PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueStateFilter } from '@gitlens/git/models/issue.js';\n// Which read produced a row, and which of its fields that read fetched.\nexport type { PullRequestProjection } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueProjection } from '@gitlens/git/models/issue.js';\nexport type { FieldPresence, IssueFieldGroup, PullRequestFieldGroup } from './fieldPresence.js';\nexport { getIssueFieldPresence, getPullRequestFieldPresence } from './fieldPresence.js';\n\n// Interface-only views of the integrations the manager hands out (`get`, `getIntegrationsForAccountWideRead`), named\n// after the internal classes they view, and the types their members take and return. The classes stay internal; see\n// `models/publicIntegration.ts`.\nexport type {\n\tGitHostIntegration,\n\tIntegration,\n\tIntegrationById,\n\tIntegrationCacheDescriptor,\n\tIntegrationConnectedKey,\n\tIntegrationCredential,\n\tIntegrationResult,\n\tIntegrationType,\n\tIssuesIntegration,\n\tMyPullRequestsForReposOptions,\n\tSearchMyPullRequestsOptions,\n\tSearchPullRequestsOptions,\n} from './models/publicIntegration.js';\n// Guards over the views. `isIntegration` replaces an `instanceof` check against the internal base class.\nexport { isGitHostIntegration, isIntegration, isIssuesIntegration } from './models/publicIntegration.js';\nexport {\n\tconvertRemoteProviderIdToIntegrationId,\n\tgetIntegrationConnectedKey,\n\tgetIntegrationIdForRemote,\n\tisCloudGitSelfManagedHostIntegrationId,\n\tisGitCloudHostIntegrationId,\n\tisGitSelfManagedHostIntegrationId,\n\tisIssuesHostIntegrationId,\n\tisSelfManagedHostIntegrationId,\n} from './utils/integration.utils.js';\nexport { getSingleConfiguredDomain } from './utils/domain.utils.js';\nexport { getAzureRepositoryIdentity } from './providers/azure/azure.utils.js';\nexport { isAzureProviderId } from './providers/providerErrors.js';\nexport { LookupBackedOffError } from './errors.js';\n\n// Provider metadata (names, domains, icons, capabilities) and the per-provider feature checks built on it.\nexport type { ProviderMetadata } from './providers/metadata.js';\nexport { providersMetadata, supportsCodeSuggest } from './providers/metadata.js';\n\n// Token fingerprints, for logging and error reporting without the token itself.\nexport type { TokenInfo } from './authentication/models.js';\nexport { toTokenInfo, toTokenWithInfo } from './authentication/models.js';\n\n// Entity identifiers: the neutral codec Launchpad (pins/snoozes), drafts and branch-issue associations key by.\nexport type {\n\tEntityIdentifier,\n\tEntityIdentifierFields,\n\tEntityIdentifierInput,\n\tGitConfigEntityIdentifier,\n\tPullRequestEntityIdentifierInput,\n} from './providers/utils.js';\n// Runtime consts (and their same-named value unions) for building identifiers without string literals.\nexport {\n\tEntityIdentifierProviderType,\n\tEntityType,\n\tEntityVersion,\n\tdecodeEntityIdentifier,\n\tdecodeEntityIdentifiersFromGitConfig,\n\tencodeEntityIdentifier,\n\tencodeIssueOrPullRequestForGitConfig,\n\tgetEntityIdentifierInput,\n\tgetIssueFromGitConfigEntityIdentifier,\n\tgetIssueOwner,\n\tgetProviderIdFromEntityIdentifier,\n} from './providers/utils.js';\n\nexport { isMaybeGitLabPullRequestUrl, splitOwnerAndRepo } from './providers/gitlab/gitlab.utils.js';\n\n// Actionable pull requests: Launchpad's categorization, over neutral copies of the provider-apis shapes it reads.\nexport type {\n\tActionablePullRequest,\n\tActionablePullRequestAccount,\n\tActionablePullRequestCategory,\n\tActionablePullRequestEnrichedItem,\n\tActionablePullRequestEnrichedItems,\n\tActionablePullRequestFields,\n\tActionablePullRequestInput,\n} from './models/actionablePullRequest.js';\nexport {\n\tActionablePullRequestBuildStatusState,\n\tActionablePullRequestReviewState,\n} from './models/actionablePullRequest.js';\nexport { getActionablePullRequests, toActionablePullRequestInput } from './providers/actionablePullRequests.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkRA,SAAgB,yBAAyB,KAAoD;CAC5F,MAAM,OAAO,IAAI;CACjB,MAAM,gBAAgB,0BAA0B,OAAO,SAAS,KAAK,MAAM,OAAO,IAAI,GAAG,KAAK,WAAW,IAAI;CAC7G,MAAM,gBAAgB,0BAA0B,OAAO,SAAS,KAAK,MAAM,OAAO,IAAI,GAAG,KAAK,SAAS;CACvG,MAAM,eAAe,0BAA0B,OAAO,SAAS,KAAK,MAAM,OAAO,IAAI,GAAG,KAAK,SAAS;CACtG,MAAM,qCAAqB,IAAI,IAAY;CAC3C,MAAM,oCAAoB,IAAI,IAAY;CAC1C,OAAO,yBAAyB,4BAA4B,GAAG,GAAG;EACjE,WAAW;GACV,SAAQ,eACP,IAAI,gBAAgB,IAAI,wBAAwB,cAAc,UAAU,GAAG,iBAAiB;GAC7F,eAAe;GACf,WAAW;EACZ;EACA,cAAa,cAAa,IAAI,kBAAkB,SAAS;EACzD,qBAAoB,cAAa,IAAI,yBAAyB,SAAS;EACvE,aAAa;GACZ,SAAQ,eAAc,IAAI,kBAAkB,IAAI,0BAA0B,eAAe,UAAU,CAAC;GACpG,eAAe;GACf,WAAW;EACZ;EACA,YAAY;GACX,SAAQ,eACP,IAAI,iBAAiB,IAAI,yBAAyB,eAAe,UAAU,GAAG,kBAAkB;GACjG,eAAe;GACf,WAAW;EACZ;CACD,CAAC;AACF"}
@@ -13,6 +13,7 @@ import { ConfiguredIntegrationDescriptor, SessionPublication } from "./authentic
13
13
  import { CloudGitSelfManagedHostIntegrationIds, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, SupportedCloudIntegrationIds } from "./constants.js";
14
14
  import { Source } from "./telemetry.js";
15
15
  import { IssueTrackerCreateOptions, IssueTrackerCreateOptionsResult, IssueTrackerDeleteOptions, IssueTrackerIssueWriteOptions, IssueTrackerIssueWriteOptionsResult, IssueTrackerWriteOptions, IssueTrackerWriteResult, IssueTrackerWriteTargetOptions, IssueTrackerWriteTargetResult } from "./models/issueTrackerWrites.js";
16
+ import { AsanaTaskCreateOptions, AsanaTaskCreateOptionsResult, AsanaTaskDeleteOptions, AsanaTaskDeleteResult, AsanaTaskWriteAccountResult, AsanaTaskWriteOptions, AsanaTaskWriteOptionsResult, AsanaTaskWriteResult, AsanaTaskWriteScope, AsanaTaskWriteTargetOptions } from "./models/asanaTaskWrites.js";
16
17
  import { WorkItemAddress, WorkItemCreateOptions, WorkItemCreateOptionsResult, WorkItemDeleteOptions, WorkItemDeleteResult, WorkItemWriteOptions, WorkItemWriteOptionsResult, WorkItemWriteResult, WorkItemWriteTargetOptions, WorkItemWriteTargetResult } from "./models/workItemWrites.js";
17
18
  import { AzurePullRequestCreateCapabilityOptions, AzurePullRequestCreateCapabilityResult, AzurePullRequestWriteOptions, AzurePullRequestWriteResult, AzurePullRequestWriteTargetOptions, AzurePullRequestWriteTargetResult, AzureServerPullRequestWriteOptions, AzureServerPullRequestWriteScope, AzureServerPullRequestWriteTargetOptions } from "./models/azurePullRequestWrites.js";
18
19
  import { BitbucketPullRequestCreateCapabilityOptions, BitbucketPullRequestCreateCapabilityResult, BitbucketPullRequestMergeStatusOptions, BitbucketPullRequestMergeStatusResult, BitbucketPullRequestWriteOptions, BitbucketPullRequestWriteReleaseOptions, BitbucketPullRequestWriteReleaseResult, BitbucketPullRequestWriteResult, BitbucketPullRequestWriteTargetOptions, BitbucketPullRequestWriteTargetResult } from "./models/bitbucketPullRequestWrites.js";
@@ -36,6 +37,8 @@ import { ProviderReposInput } from "./providers/models.js";
36
37
  import { GitHostIntegration } from "./models/gitHostIntegration.js";
37
38
  import { GitLabWriteTransport } from "./providers/gitlab/writeTransport.js";
38
39
  import { ApiClients } from "./providers/apiClients.js";
40
+ import { AsanaTaskWriteConnection, toAsanaTaskWriteFailure } from "./providers/asanaTaskWriteTransport.js";
41
+ import { AsanaTaskWriter, isAsanaTaskWriteScope } from "./providers/asanaTaskWrites.js";
39
42
  import { AzureDevOpsIntegration } from "./providers/azureDevOps.js";
40
43
  import { BitbucketIntegration } from "./providers/bitbucket.js";
41
44
  import { GitHubEnterpriseIntegration, GitHubIntegration } from "./providers/github.js";
@@ -52,6 +55,11 @@ export interface IntegrationConnectionChangeEvent extends ConnectionStateChangeE
52
55
  integration: IntegrationBase;
53
56
  }
54
57
  type IntegrationWriterFactories = {
58
+ asanaTask: {
59
+ create: (connection: AsanaTaskWriteConnection) => AsanaTaskWriter;
60
+ validateScope: typeof isAsanaTaskWriteScope;
61
+ toFailure: typeof toAsanaTaskWriteFailure;
62
+ };
55
63
  gitLabIssue: (transport: GitLabWriteTransport) => GitLabIssueWriter;
56
64
  gitLabMergeRequest: (transport: GitLabWriteTransport) => GitLabMergeRequestWriter;
57
65
  linearIssue: {
@@ -592,12 +600,19 @@ export declare class IntegrationService implements Disposable, IntegrationManage
592
600
  writeLinearIssue(options: LinearIssueWriteOptions): Promise<LinearIssueWriteResult>;
593
601
  deleteLinearIssue(options: LinearIssueDeleteOptions): Promise<LinearIssueDeleteResult>;
594
602
  private withLinearIssueWriter;
603
+ getAsanaTaskWriteAccount(options: AsanaTaskWriteScope): Promise<AsanaTaskWriteAccountResult>;
604
+ getAsanaTaskCreateOptions(options: AsanaTaskCreateOptions): Promise<AsanaTaskCreateOptionsResult>;
605
+ resolveAsanaTaskWriteTarget(options: AsanaTaskWriteTargetOptions): Promise<AsanaTaskWriteOptionsResult>;
606
+ writeAsanaTask(options: AsanaTaskWriteOptions): Promise<AsanaTaskWriteResult>;
607
+ deleteAsanaTask(options: AsanaTaskDeleteOptions): Promise<AsanaTaskDeleteResult>;
608
+ private withAsanaTaskWriter;
595
609
  getTrelloCardCreateOptions(options: TrelloCardCreateOptions): Promise<TrelloCardCreateOptionsResult>;
596
610
  getTrelloCardWriteOptions(options: TrelloCardWriteTargetOptions): Promise<TrelloCardWriteOptionsResult>;
597
611
  resolveTrelloCardWriteTarget(options: TrelloCardWriteTargetOptions): Promise<TrelloCardWriteOptionsResult>;
598
612
  writeTrelloCard(options: TrelloCardWriteOptions): Promise<TrelloCardWriteResult>;
599
613
  deleteTrelloCard(options: TrelloCardDeleteOptions): Promise<TrelloCardDeleteResult>;
600
614
  private withTrelloCardWriter;
615
+ private withPinnedWriter;
601
616
  getIssueTrackerCreateOptions(options: IssueTrackerCreateOptions): Promise<IssueTrackerCreateOptionsResult>;
602
617
  getIssueTrackerIssueWriteOptions(options: IssueTrackerIssueWriteOptions): Promise<IssueTrackerIssueWriteOptionsResult>;
603
618
  writeIssueTrackerIssue(options: IssueTrackerWriteOptions): Promise<IssueTrackerWriteResult>;
@@ -1109,6 +1109,35 @@ var IntegrationService = class {
1109
1109
  return factory.toFailure(ex);
1110
1110
  }
1111
1111
  }
1112
+ getAsanaTaskWriteAccount(options) {
1113
+ const input = { ...options };
1114
+ return this.withAsanaTaskWriter(input, "read", (writer) => writer.getAccount(input));
1115
+ }
1116
+ getAsanaTaskCreateOptions(options) {
1117
+ const input = {
1118
+ ...options,
1119
+ ...Array.isArray(options.projectIds) && { projectIds: [...options.projectIds] }
1120
+ };
1121
+ return this.withAsanaTaskWriter(input, "read", (writer) => writer.getCreateOptions(input));
1122
+ }
1123
+ resolveAsanaTaskWriteTarget(options) {
1124
+ const input = { ...options };
1125
+ return this.withAsanaTaskWriter(input, "read", (writer) => writer.resolveTarget(input));
1126
+ }
1127
+ writeAsanaTask(options) {
1128
+ const input = { ...options };
1129
+ return this.withAsanaTaskWriter(input, "write", (writer) => writer.write(input));
1130
+ }
1131
+ deleteAsanaTask(options) {
1132
+ const input = {
1133
+ ...options,
1134
+ ...Array.isArray(options.membershipProjectIds) && { membershipProjectIds: [...options.membershipProjectIds] }
1135
+ };
1136
+ return this.withAsanaTaskWriter(input, "write", (writer) => writer.delete(input));
1137
+ }
1138
+ withAsanaTaskWriter(options, access, run) {
1139
+ return this.withPinnedWriter("asana", this.writers?.asanaTask, (integration, connection, isCurrent) => integration.getTaskWriteConnection(connection, isCurrent), options, access, run);
1140
+ }
1112
1141
  getTrelloCardCreateOptions(options) {
1113
1142
  const input = { ...options };
1114
1143
  return this.withTrelloCardWriter(input, "read", (writer) => writer.getCreateOptions(input));
@@ -1128,8 +1157,10 @@ var IntegrationService = class {
1128
1157
  const input = { ...options };
1129
1158
  return this.withTrelloCardWriter(input, "write", (writer) => writer.delete(input));
1130
1159
  }
1131
- async withTrelloCardWriter(options, access, run) {
1132
- const factory = this.writers?.trelloCard;
1160
+ withTrelloCardWriter(options, access, run) {
1161
+ return this.withPinnedWriter("trello", this.writers?.trelloCard, (integration, connection, isCurrent) => integration.getCardWriteConnection(connection, isCurrent), options, access, run);
1162
+ }
1163
+ async withPinnedWriter(providerId, factory, getConnection, options, access, run) {
1133
1164
  if (factory == null) return {
1134
1165
  ok: false,
1135
1166
  reason: "unsupported",
@@ -1141,14 +1172,14 @@ var IntegrationService = class {
1141
1172
  mutationDispatched: false
1142
1173
  };
1143
1174
  try {
1144
- const providerId = "trello";
1145
1175
  const selection = await this.configuredIntegrationService.captureConnectionSelection(providerId, options.connectionId);
1146
1176
  if (!selection?.isCurrent()) return {
1147
1177
  ok: false,
1148
1178
  reason: "no-connection",
1149
1179
  mutationDispatched: false
1150
1180
  };
1151
- const connection = await (await this.get(providerId))?.getCardWriteConnection(selection.connection, selection.isCurrent);
1181
+ const integration = await this.get(providerId);
1182
+ const connection = integration != null ? await getConnection(integration, selection.connection, selection.isCurrent) : void 0;
1152
1183
  if (connection == null) return {
1153
1184
  ok: false,
1154
1185
  reason: "no-connection",