@gitkraken/core-gitlens 0.51.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +5 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +35 -7
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +33 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +5 -2
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +6 -4
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.d.ts +4 -0
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +31 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +1 -0
- package/dist/plus/integrations/integrationService.js +34 -3
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
- package/dist/plus/integrations/models/workItemWrites.d.ts +34 -2
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +4 -3
- package/dist/plus/integrations/providers/azureDevOps.js +6 -6
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +3 -0
- package/dist/plus/integrations/providers/azureDevOpsServer.js +14 -0
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/azureWorkItemWriteErrors.d.ts +4 -0
- package/dist/plus/integrations/providers/azureWorkItemWriteErrors.js +34 -2
- package/dist/plus/integrations/providers/azureWorkItemWriteErrors.js.map +1 -1
- package/dist/plus/integrations/providers/azureWorkItemWrites.d.ts +5 -2
- package/dist/plus/integrations/providers/azureWorkItemWrites.js +57 -14
- package/dist/plus/integrations/providers/azureWorkItemWrites.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/providersApi.d.ts +8 -14
- package/dist/plus/integrations/providers/providersApi.js +21 -12
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +1 -0
- package/dist/utils/env/node/exec.js +2 -2
- package/docs/integrations.md +25 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationAuthenticationService.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/integrationAuthenticationService.ts"],"sourcesContent":["import type { GitRemote } from '@gitlens/git/models/remote.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport type { IntegrationIds, SupportedCloudIntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from '../constants.js';\nimport type { IntegrationServiceContext } from '../context.js';\nimport type { IntegrationService } from '../integrationService.js';\nimport type { GitHostIntegration } from '../models/gitHostIntegration.js';\nimport type { ApiClients } from '../providers/apiClients.js';\nimport type { Source } from '../telemetry.js';\nimport { isSelfManagedHostIntegrationId, supportedIntegrationIds } from '../utils/integration.utils.js';\nimport { CloudIntegrationAuthenticationProvider } from './cloudIntegrationAuthenticationProvider.js';\nimport type { CloudIntegrationService } from './cloudIntegrationService.js';\nimport type { ConfiguredIntegrationService } from './configuredIntegrationService.js';\nimport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession } from './models.js';\nimport { getSessionIdentity } from './models.js';\nimport { ObservedAuthenticationProvider } from './observedAuthenticationProvider.js';\n\nexport class IntegrationAuthenticationService implements Disposable {\n\tprivate readonly providers = new Map<IntegrationIds, IntegrationAuthenticationProvider>();\n\n\tconstructor(\n\t\tprivate readonly configuredIntegrationService: ConfiguredIntegrationService,\n\t\treadonly ctx: IntegrationServiceContext,\n\t\t/**\n\t\t * Lazy accessor for the owning {@link IntegrationService}. Injected by the composition root\n\t\t * ({@link createIntegrationManager}) to break the auth↔service construction cycle without a\n\t\t * mutable setter or a host round-trip; only resolved at runtime (long after construction).\n\t\t */\n\t\tprivate readonly getIntegrationService: () => IntegrationService,\n\t\t/** The package's cloud token-exchange client, constructed by the composition root. */\n\t\treadonly cloudIntegrations: CloudIntegrationService,\n\t) {}\n\n\tdispose(): void {\n\t\tthis.providers.forEach(p => p.dispose());\n\t\tthis.providers.clear();\n\t}\n\n\t/**\n\t * Initiates the cloud-integration connect flow on the owning service. Cloud auth providers call\n\t * this when they need a session that doesn't exist yet (see\n\t * {@link CloudIntegrationAuthenticationProvider}).\n\t */\n\tconnectCloudIntegrations(\n\t\tconnect: { integrationIds: SupportedCloudIntegrationIds[]; skipIfConnected?: boolean; skipPreSync?: boolean },\n\t\tsource?: Source,\n\t): Promise<boolean> {\n\t\treturn this.getIntegrationService().connectCloudIntegrations(connect, source);\n\t}\n\n\t/**\n\t * Resolves the connected git-host integration for a `GitRemote`, via the owning service. Lets\n\t * package-internal callers (e.g. the Bitbucket provider) resolve a remote's integration without a\n\t * host round-trip.\n\t */\n\tgetByRemote(remote: GitRemote): Promise<GitHostIntegration | undefined> {\n\t\treturn this.getIntegrationService().getByRemote(remote);\n\t}\n\n\t/** Resolves the per-integration `ignoreSSLErrors` flag via the owning service (host-config-backed). */\n\tignoreSSLErrors(integration: GitHostIntegration | { id: IntegrationIds; domain?: string }): boolean | 'force' {\n\t\treturn this.getIntegrationService().ignoreSSLErrors(integration);\n\t}\n\n\t/** The package-built per-provider API clients, via the owning service (built once + memoized there). */\n\tget apis(): ApiClients {\n\t\treturn this.getIntegrationService().apis;\n\t}\n\n\tasync get(providerId: IntegrationIds): Promise<IntegrationAuthenticationProvider> {\n\t\treturn this.ensureProvider(providerId);\n\t}\n\n\tgetSignOutMark(): number {\n\t\treturn this.configuredIntegrationService.getSignOutMark();\n\t}\n\n\tusesHostAuthenticationProvider(id: IntegrationIds): boolean {\n\t\treturn this.providers.get(id) instanceof ObservedAuthenticationProvider;\n\t}\n\n\ttrackStoredSession(id: IntegrationIds, session: ProviderAuthenticationSession): () => Promise<boolean> {\n\t\tconst store = this.configuredIntegrationService;\n\t\tconst mark = store.getStoredWriteMark();\n\t\tconst identity = getSessionIdentity(session);\n\t\treturn async () => {\n\t\t\tif (store.isStoredWriteRetiredSince(id, session, mark)) return false;\n\n\t\t\tconst current = await store\n\t\t\t\t.peekStoredSession(id, session.id, session.cloud ?? false, session.domain)\n\t\t\t\t.catch(() => undefined);\n\t\t\treturn (\n\t\t\t\tcurrent != null &&\n\t\t\t\t!store.isStoredWriteRetiredSince(id, session, mark) &&\n\t\t\t\tgetSessionIdentity(current) === identity &&\n\t\t\t\tcurrent.account?.id === session.account?.id\n\t\t\t);\n\t\t};\n\t}\n\n\t/** The id of the connection a descriptor naming none reads: the primary configured for its host. */\n\tgetPrimaryConnectionId(providerId: IntegrationIds, descriptor: IntegrationAuthenticationSessionDescriptor): string {\n\t\treturn this.configuredIntegrationService.resolveConnectionId(providerId, descriptor);\n\t}\n\n\t@debug()\n\tasync reset(): Promise<void> {\n\t\t// TODO: This really isn't ideal, since it will only work for \"cloud\" providers as we won't have any more specific descriptors\n\t\tawait Promise.allSettled(\n\t\t\tsupportedIntegrationIds.map(async providerId =>\n\t\t\t\t(await this.ensureProvider(providerId)).deleteAllSessions(),\n\t\t\t),\n\t\t);\n\t}\n\n\tsupports(providerId: string): boolean {\n\t\t// Linear, Trello and Asana are cloud-backed issue integrations (same as Jira): `ensureProvider` registers a\n\t\t// cloud auth provider for them, so a disconnect must offer to sign out of the cloud token too —\n\t\t// otherwise the backend token and configured connection survive the disable.\n\t\tswitch (providerId) {\n\t\t\tcase GitCloudHostIntegrationId.AzureDevOps:\n\t\t\tcase GitSelfManagedHostIntegrationId.AzureDevOpsServer:\n\t\t\tcase GitCloudHostIntegrationId.Bitbucket:\n\t\t\tcase GitCloudHostIntegrationId.GitLab:\n\t\t\tcase IssuesCloudHostIntegrationId.Jira:\n\t\t\tcase IssuesSelfManagedHostIntegrationId.JiraServer:\n\t\t\tcase IssuesCloudHostIntegrationId.Linear:\n\t\t\tcase IssuesCloudHostIntegrationId.Trello:\n\t\t\tcase IssuesCloudHostIntegrationId.Asana:\n\t\t\tcase GitCloudHostIntegrationId.GitHub:\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\t@gate()\n\tprivate async ensureProvider(providerId: IntegrationIds): Promise<IntegrationAuthenticationProvider> {\n\t\tlet provider = this.providers.get(providerId);\n\t\tif (provider != null) return provider;\n\n\t\t// Optional consumer override for custom auth (e.g. a manual-token provider). GitLens omits it —\n\t\t// the package constructs its own cloud providers below (so GitLens's cloud auth needs no host hook).\n\t\tconst hostProvider = await this.ctx.hooks?.createAuthenticationProvider?.({\n\t\t\tid: providerId,\n\t\t});\n\t\tif (hostProvider != null) {\n\t\t\tprovider = new ObservedAuthenticationProvider(\n\t\t\t\thostProvider,\n\t\t\t\tisSelfManagedHostIntegrationId(providerId),\n\t\t\t\t(publication, domains) =>\n\t\t\t\t\tthis.getIntegrationService().onSessionPublishing(providerId, publication, domains),\n\t\t\t);\n\t\t\tthis.providers.set(providerId, provider);\n\t\t\treturn provider;\n\t\t}\n\n\t\t// Every cloud integration shares one provider, parameterized by id (cloud-only).\n\t\tswitch (providerId) {\n\t\t\tcase GitCloudHostIntegrationId.GitHub:\n\t\t\tcase GitSelfManagedHostIntegrationId.CloudGitHubEnterprise:\n\t\t\tcase GitCloudHostIntegrationId.GitLab:\n\t\t\tcase GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted:\n\t\t\tcase GitCloudHostIntegrationId.AzureDevOps:\n\t\t\tcase GitSelfManagedHostIntegrationId.AzureDevOpsServer:\n\t\t\tcase GitCloudHostIntegrationId.Bitbucket:\n\t\t\tcase GitSelfManagedHostIntegrationId.BitbucketServer:\n\t\t\tcase IssuesCloudHostIntegrationId.Jira:\n\t\t\tcase IssuesSelfManagedHostIntegrationId.JiraServer:\n\t\t\tcase IssuesCloudHostIntegrationId.Linear:\n\t\t\tcase IssuesCloudHostIntegrationId.Trello:\n\t\t\tcase IssuesCloudHostIntegrationId.Asana:\n\t\t\t\tprovider = new CloudIntegrationAuthenticationProvider(\n\t\t\t\t\tthis,\n\t\t\t\t\tthis.configuredIntegrationService,\n\t\t\t\t\tproviderId,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`No authentication provider registered for integration '${String(providerId)}'`);\n\t\t}\n\n\t\tthis.providers.set(providerId, provider);\n\t\treturn provider;\n\t}\n}\n"],"mappings":";;;;;;;;;AA4BA,IAAa,mCAAb,MAAoE;CAIjD;CACR;CAMQ;CAER;CAZV,4BAA6B,IAAI,IAAuD;CAExF,YACC,8BACA,KAMA,uBAEA,mBACC;EAVgB,KAAA,+BAAA;EACR,KAAA,MAAA;EAMQ,KAAA,wBAAA;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C,MAAM,KAAK,eAAe,UAAU,EAAA,CAAG,kBAAkB,CAC3D,CACD;CACD;CAEA,SAAS,YAA6B;EAIrC,QAAQ,YAAR;GACC,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA,UACC,OAAO;GACR,SACC,OAAO;EACT;CACD;CAEA,MACc,eAAe,YAAwE;EACpG,IAAI,WAAW,KAAK,UAAU,IAAI,UAAU;EAC5C,IAAI,YAAY,MAAM,OAAO;EAI7B,MAAM,eAAe,MAAM,KAAK,IAAI,OAAO,+BAA+B,EACzE,IAAI,WACL,CAAC;EACD,IAAI,gBAAgB,MAAM;GACzB,WAAW,IAAI,+BACd,cACA,+BAA+B,UAAU,IACxC,aAAa,YACb,KAAK,sBAAsB,CAAC,CAAC,oBAAoB,YAAY,aAAa,OAAO,CACnF;GACA,KAAK,UAAU,IAAI,YAAY,QAAQ;GACvC,OAAO;EACR;EAGA,QAAQ,YAAR;GACC,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;IACC,WAAW,IAAI,uCACd,MACA,KAAK,8BACL,UACD;IACA;GACD,SACC,MAAM,IAAI,MAAM,0DAA0D,OAAO,UAAU,EAAE,EAAE;EACjG;EAEA,KAAK,UAAU,IAAI,YAAY,QAAQ;EACvC,OAAO;CACR;AACD;AAhFE,WAAA,CAAA,MAAM,CAAA,GAAA,iCAAA,WAAA,SAAA,IAAA;AA+BN,WAAA,CAAA,KAAK,CAAA,GAAA,iCAAA,WAAA,kBAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"integrationAuthenticationService.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/integrationAuthenticationService.ts"],"sourcesContent":["import type { GitRemote } from '@gitlens/git/models/remote.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport type { IntegrationIds, SupportedCloudIntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from '../constants.js';\nimport type { IntegrationServiceContext } from '../context.js';\nimport type { IntegrationService } from '../integrationService.js';\nimport type { GitHostIntegration } from '../models/gitHostIntegration.js';\nimport type { ApiClients } from '../providers/apiClients.js';\nimport type { Source } from '../telemetry.js';\nimport { isSelfManagedHostIntegrationId, supportedIntegrationIds } from '../utils/integration.utils.js';\nimport { CloudIntegrationAuthenticationProvider } from './cloudIntegrationAuthenticationProvider.js';\nimport type { CloudIntegrationService } from './cloudIntegrationService.js';\nimport type { ConfiguredIntegrationService } from './configuredIntegrationService.js';\nimport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession } from './models.js';\nimport { getSessionIdentity } from './models.js';\nimport { ObservedAuthenticationProvider } from './observedAuthenticationProvider.js';\n\nexport type TrackedSession = (() => Promise<boolean>) & { readonly isRetired: () => boolean };\n\nexport class IntegrationAuthenticationService implements Disposable {\n\tprivate readonly providers = new Map<IntegrationIds, IntegrationAuthenticationProvider>();\n\n\tconstructor(\n\t\tprivate readonly configuredIntegrationService: ConfiguredIntegrationService,\n\t\treadonly ctx: IntegrationServiceContext,\n\t\t/**\n\t\t * Lazy accessor for the owning {@link IntegrationService}. Injected by the composition root\n\t\t * ({@link createIntegrationManager}) to break the auth↔service construction cycle without a\n\t\t * mutable setter or a host round-trip; only resolved at runtime (long after construction).\n\t\t */\n\t\tprivate readonly getIntegrationService: () => IntegrationService,\n\t\t/** The package's cloud token-exchange client, constructed by the composition root. */\n\t\treadonly cloudIntegrations: CloudIntegrationService,\n\t) {}\n\n\tdispose(): void {\n\t\tthis.providers.forEach(p => p.dispose());\n\t\tthis.providers.clear();\n\t}\n\n\t/**\n\t * Initiates the cloud-integration connect flow on the owning service. Cloud auth providers call\n\t * this when they need a session that doesn't exist yet (see\n\t * {@link CloudIntegrationAuthenticationProvider}).\n\t */\n\tconnectCloudIntegrations(\n\t\tconnect: { integrationIds: SupportedCloudIntegrationIds[]; skipIfConnected?: boolean; skipPreSync?: boolean },\n\t\tsource?: Source,\n\t): Promise<boolean> {\n\t\treturn this.getIntegrationService().connectCloudIntegrations(connect, source);\n\t}\n\n\t/**\n\t * Resolves the connected git-host integration for a `GitRemote`, via the owning service. Lets\n\t * package-internal callers (e.g. the Bitbucket provider) resolve a remote's integration without a\n\t * host round-trip.\n\t */\n\tgetByRemote(remote: GitRemote): Promise<GitHostIntegration | undefined> {\n\t\treturn this.getIntegrationService().getByRemote(remote);\n\t}\n\n\t/** Resolves the per-integration `ignoreSSLErrors` flag via the owning service (host-config-backed). */\n\tignoreSSLErrors(integration: GitHostIntegration | { id: IntegrationIds; domain?: string }): boolean | 'force' {\n\t\treturn this.getIntegrationService().ignoreSSLErrors(integration);\n\t}\n\n\t/** The package-built per-provider API clients, via the owning service (built once + memoized there). */\n\tget apis(): ApiClients {\n\t\treturn this.getIntegrationService().apis;\n\t}\n\n\tasync get(providerId: IntegrationIds): Promise<IntegrationAuthenticationProvider> {\n\t\treturn this.ensureProvider(providerId);\n\t}\n\n\tgetSignOutMark(): number {\n\t\treturn this.configuredIntegrationService.getSignOutMark();\n\t}\n\n\ttrackStoredSession(id: IntegrationIds, session: ProviderAuthenticationSession): TrackedSession {\n\t\tconst store = this.configuredIntegrationService;\n\t\tconst mark = store.getStoredWriteMark();\n\t\tconst identity = getSessionIdentity(session);\n\t\tconst isCurrent = async () => {\n\t\t\tif (store.isStoredWriteRetiredSince(id, session, mark)) return false;\n\n\t\t\tconst current = await store\n\t\t\t\t.peekStoredSession(id, session.id, session.cloud ?? false, session.domain)\n\t\t\t\t.catch(() => undefined);\n\t\t\treturn (\n\t\t\t\tcurrent != null &&\n\t\t\t\t!store.isStoredWriteRetiredSince(id, session, mark) &&\n\t\t\t\tgetSessionIdentity(current) === identity &&\n\t\t\t\tcurrent.account?.id === session.account?.id\n\t\t\t);\n\t\t};\n\t\treturn Object.assign(isCurrent, { isRetired: () => store.isStoredWriteRetiredSince(id, session, mark) });\n\t}\n\n\ttrackIssuedSession(\n\t\tid: IntegrationIds,\n\t\tsession: ProviderAuthenticationSession,\n\t\tisHostSessionCurrent: () => Promise<boolean>,\n\t): TrackedSession {\n\t\tconst provider = this.providers.get(id);\n\t\treturn provider instanceof ObservedAuthenticationProvider\n\t\t\t? Object.assign(isHostSessionCurrent, { isRetired: provider.trackSession(session) })\n\t\t\t: this.trackStoredSession(id, session);\n\t}\n\n\t/** The id of the connection a descriptor naming none reads: the primary configured for its host. */\n\tgetPrimaryConnectionId(providerId: IntegrationIds, descriptor: IntegrationAuthenticationSessionDescriptor): string {\n\t\treturn this.configuredIntegrationService.resolveConnectionId(providerId, descriptor);\n\t}\n\n\t@debug()\n\tasync reset(): Promise<void> {\n\t\t// TODO: This really isn't ideal, since it will only work for \"cloud\" providers as we won't have any more specific descriptors\n\t\tawait Promise.allSettled(\n\t\t\tsupportedIntegrationIds.map(async providerId =>\n\t\t\t\t(await this.ensureProvider(providerId)).deleteAllSessions(),\n\t\t\t),\n\t\t);\n\t}\n\n\tsupports(providerId: string): boolean {\n\t\t// Linear, Trello and Asana are cloud-backed issue integrations (same as Jira): `ensureProvider` registers a\n\t\t// cloud auth provider for them, so a disconnect must offer to sign out of the cloud token too —\n\t\t// otherwise the backend token and configured connection survive the disable.\n\t\tswitch (providerId) {\n\t\t\tcase GitCloudHostIntegrationId.AzureDevOps:\n\t\t\tcase GitSelfManagedHostIntegrationId.AzureDevOpsServer:\n\t\t\tcase GitCloudHostIntegrationId.Bitbucket:\n\t\t\tcase GitCloudHostIntegrationId.GitLab:\n\t\t\tcase IssuesCloudHostIntegrationId.Jira:\n\t\t\tcase IssuesSelfManagedHostIntegrationId.JiraServer:\n\t\t\tcase IssuesCloudHostIntegrationId.Linear:\n\t\t\tcase IssuesCloudHostIntegrationId.Trello:\n\t\t\tcase IssuesCloudHostIntegrationId.Asana:\n\t\t\tcase GitCloudHostIntegrationId.GitHub:\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\t@gate()\n\tprivate async ensureProvider(providerId: IntegrationIds): Promise<IntegrationAuthenticationProvider> {\n\t\tlet provider = this.providers.get(providerId);\n\t\tif (provider != null) return provider;\n\n\t\t// Optional consumer override for custom auth (e.g. a manual-token provider). GitLens omits it —\n\t\t// the package constructs its own cloud providers below (so GitLens's cloud auth needs no host hook).\n\t\tconst hostProvider = await this.ctx.hooks?.createAuthenticationProvider?.({\n\t\t\tid: providerId,\n\t\t});\n\t\tif (hostProvider != null) {\n\t\t\tprovider = new ObservedAuthenticationProvider(\n\t\t\t\thostProvider,\n\t\t\t\tisSelfManagedHostIntegrationId(providerId),\n\t\t\t\t(publication, domains) =>\n\t\t\t\t\tthis.getIntegrationService().onSessionPublishing(providerId, publication, domains),\n\t\t\t);\n\t\t\tthis.providers.set(providerId, provider);\n\t\t\treturn provider;\n\t\t}\n\n\t\t// Every cloud integration shares one provider, parameterized by id (cloud-only).\n\t\tswitch (providerId) {\n\t\t\tcase GitCloudHostIntegrationId.GitHub:\n\t\t\tcase GitSelfManagedHostIntegrationId.CloudGitHubEnterprise:\n\t\t\tcase GitCloudHostIntegrationId.GitLab:\n\t\t\tcase GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted:\n\t\t\tcase GitCloudHostIntegrationId.AzureDevOps:\n\t\t\tcase GitSelfManagedHostIntegrationId.AzureDevOpsServer:\n\t\t\tcase GitCloudHostIntegrationId.Bitbucket:\n\t\t\tcase GitSelfManagedHostIntegrationId.BitbucketServer:\n\t\t\tcase IssuesCloudHostIntegrationId.Jira:\n\t\t\tcase IssuesSelfManagedHostIntegrationId.JiraServer:\n\t\t\tcase IssuesCloudHostIntegrationId.Linear:\n\t\t\tcase IssuesCloudHostIntegrationId.Trello:\n\t\t\tcase IssuesCloudHostIntegrationId.Asana:\n\t\t\t\tprovider = new CloudIntegrationAuthenticationProvider(\n\t\t\t\t\tthis,\n\t\t\t\t\tthis.configuredIntegrationService,\n\t\t\t\t\tproviderId,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`No authentication provider registered for integration '${String(providerId)}'`);\n\t\t}\n\n\t\tthis.providers.set(providerId, provider);\n\t\treturn provider;\n\t}\n}\n"],"mappings":";;;;;;;;;AA8BA,IAAa,mCAAb,MAAoE;CAIjD;CACR;CAMQ;CAER;CAZV,4BAA6B,IAAI,IAAuD;CAExF,YACC,8BACA,KAMA,uBAEA,mBACC;EAVgB,KAAA,+BAAA;EACR,KAAA,MAAA;EAMQ,KAAA,wBAAA;EAER,KAAA,oBAAA;CACP;CAEH,UAAgB;EACf,KAAK,UAAU,SAAQ,MAAK,EAAE,QAAQ,CAAC;EACvC,KAAK,UAAU,MAAM;CACtB;;;;;;CAOA,yBACC,SACA,QACmB;EACnB,OAAO,KAAK,sBAAsB,CAAC,CAAC,yBAAyB,SAAS,MAAM;CAC7E;;;;;;CAOA,YAAY,QAA4D;EACvE,OAAO,KAAK,sBAAsB,CAAC,CAAC,YAAY,MAAM;CACvD;;CAGA,gBAAgB,aAA8F;EAC7G,OAAO,KAAK,sBAAsB,CAAC,CAAC,gBAAgB,WAAW;CAChE;;CAGA,IAAI,OAAmB;EACtB,OAAO,KAAK,sBAAsB,CAAC,CAAC;CACrC;CAEA,MAAM,IAAI,YAAwE;EACjF,OAAO,KAAK,eAAe,UAAU;CACtC;CAEA,iBAAyB;EACxB,OAAO,KAAK,6BAA6B,eAAe;CACzD;CAEA,mBAAmB,IAAoB,SAAwD;EAC9F,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,MAAM,mBAAmB;E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;EACD,IAAI,gBAAgB,MAAM;GACzB,WAAW,IAAI,+BACd,cACA,+BAA+B,UAAU,IACxC,aAAa,YACb,KAAK,sBAAsB,CAAC,CAAC,oBAAoB,YAAY,aAAa,OAAO,CACnF;GACA,KAAK,UAAU,IAAI,YAAY,QAAQ;GACvC,OAAO;EACR;EAGA,QAAQ,YAAR;GACC,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;GACA,KAAA;IACC,WAAW,IAAI,uCACd,MACA,KAAK,8BACL,UACD;IACA;GACD,SACC,MAAM,IAAI,MAAM,0DAA0D,OAAO,UAAU,EAAE,EAAE;EACjG;EAEA,KAAK,UAAU,IAAI,YAAY,QAAQ;EACvC,OAAO;CACR;AACD;AAhFE,WAAA,CAAA,MAAM,CAAA,GAAA,iCAAA,WAAA,SAAA,IAAA;AA+BN,WAAA,CAAA,KAAK,CAAA,GAAA,iCAAA,WAAA,kBAAA,IAAA"}
|
|
@@ -12,12 +12,16 @@ export declare class ObservedAuthenticationProvider implements IntegrationAuthen
|
|
|
12
12
|
private readonly actualRetirements;
|
|
13
13
|
private readonly hostRetirements;
|
|
14
14
|
private readonly activeRetirements;
|
|
15
|
+
private readonly claimWitnesses;
|
|
16
|
+
private readonly issuances;
|
|
15
17
|
private sequence;
|
|
16
18
|
private globalRetirement;
|
|
17
19
|
private disposed;
|
|
18
20
|
constructor(host: IntegrationAuthenticationProvider, selfManaged: boolean, publish: (publication: SessionPublication, domains: (string | undefined)[]) => void);
|
|
19
21
|
get onDidChange(): Event<void>;
|
|
20
22
|
getSession(descriptor: IntegrationAuthenticationSessionDescriptor, options?: GetSessionOptions): Promise<ProviderAuthenticationSession | undefined>;
|
|
23
|
+
/** KEEP: fails closed for a session this provider did not issue, since its changes cannot be proven absent. */
|
|
24
|
+
trackSession(session: ProviderAuthenticationSession): () => boolean;
|
|
21
25
|
deleteSession(descriptor: IntegrationAuthenticationSessionDescriptor, options?: {
|
|
22
26
|
preserveConfigured?: boolean;
|
|
23
27
|
signOutMark?: number;
|
|
@@ -29,6 +29,8 @@ var ObservedAuthenticationProvider = class {
|
|
|
29
29
|
actualRetirements = /* @__PURE__ */ new Map();
|
|
30
30
|
hostRetirements = /* @__PURE__ */ new Map();
|
|
31
31
|
activeRetirements = /* @__PURE__ */ new Set();
|
|
32
|
+
claimWitnesses = /* @__PURE__ */ new Map();
|
|
33
|
+
issuances = /* @__PURE__ */ new WeakMap();
|
|
32
34
|
sequence = 0;
|
|
33
35
|
globalRetirement = 0;
|
|
34
36
|
disposed = false;
|
|
@@ -81,7 +83,29 @@ var ObservedAuthenticationProvider = class {
|
|
|
81
83
|
protocol: source.protocol,
|
|
82
84
|
appKey: source.appKey
|
|
83
85
|
};
|
|
84
|
-
|
|
86
|
+
const claims = [`descriptor:${descriptorKey(descriptor.domain, descriptor.connectionId, descriptor.cloud)}`, ...sessionKey != null ? [`actual:${sessionKey}`] : []];
|
|
87
|
+
const witness = source == null ? void 0 : JSON.stringify([identity, source.account?.id]);
|
|
88
|
+
const accepted = latest == null || latest.request <= request;
|
|
89
|
+
if (accepted && claims.every((claim) => (this.claimWitnesses.get(claim)?.request ?? 0) <= request)) {
|
|
90
|
+
for (const claim of claims) {
|
|
91
|
+
const current = this.claimWitnesses.get(claim);
|
|
92
|
+
this.claimWitnesses.set(claim, {
|
|
93
|
+
mark: current != null && current.witness === witness ? current.mark : ++this.sequence,
|
|
94
|
+
request,
|
|
95
|
+
witness
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (session != null) this.issuances.set(session, {
|
|
99
|
+
mark: this.sequence,
|
|
100
|
+
claims,
|
|
101
|
+
descriptor
|
|
102
|
+
});
|
|
103
|
+
} else if (session != null && claims.every((claim) => this.claimWitnesses.get(claim)?.witness === witness)) this.issuances.set(session, {
|
|
104
|
+
mark: this.sequence,
|
|
105
|
+
claims,
|
|
106
|
+
descriptor
|
|
107
|
+
});
|
|
108
|
+
if (accepted) {
|
|
85
109
|
if (previous == null || previous.identity !== identity || credential?.identity !== identity) this.publish({
|
|
86
110
|
session,
|
|
87
111
|
previousSessionId: latest?.sessionId ?? descriptor.connectionId,
|
|
@@ -108,6 +132,12 @@ var ObservedAuthenticationProvider = class {
|
|
|
108
132
|
}
|
|
109
133
|
return session;
|
|
110
134
|
}
|
|
135
|
+
/** KEEP: fails closed for a session this provider did not issue, since its changes cannot be proven absent. */
|
|
136
|
+
trackSession(session) {
|
|
137
|
+
const issuance = this.issuances.get(session);
|
|
138
|
+
if (issuance == null) return () => true;
|
|
139
|
+
return () => issuance.claims.some((claim) => (this.claimWitnesses.get(claim)?.mark ?? 0) > issuance.mark) || this.isRetired(issuance.mark, issuance.descriptor, session);
|
|
140
|
+
}
|
|
111
141
|
async deleteSession(descriptor, options) {
|
|
112
142
|
const retirement = this.retireConnection(descriptor);
|
|
113
143
|
this.activeRetirements.add(retirement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observedAuthenticationProvider.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/observedAuthenticationProvider.ts"],"sourcesContent":["import { CancellationError } from '@gitlens/utils/cancellation.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport { areDomainsOnSameHost, hostFromDomain } from '../utils/domain.utils.js';\nimport type {\n\tGetSessionOptions,\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession, SessionPublication } from './models.js';\nimport { getSessionIdentity } from './models.js';\n\ntype Observation = {\n\trequest: number;\n\tidentity: string | undefined;\n\tdescriptorDomain: string;\n\tactualDomain: string;\n\tcloud: boolean | undefined;\n\tsessionKey?: string;\n\tsessionId?: string;\n\tconnectionId?: string;\n};\n\ntype Retirement = {\n\tdescriptors: Set<string>;\n\tactuals: Set<string>;\n\thost?: string;\n\tall?: boolean;\n};\n\nfunction domainKey(domain: string): string {\n\treturn hostFromDomain(domain) ?? domain;\n}\n\nfunction descriptorKey(domain: string, connectionId: string | undefined, cloud: boolean | undefined): string {\n\treturn JSON.stringify([domainKey(domain), connectionId, cloud]);\n}\n\nfunction actualKey(domain: string, id: string, cloud: boolean | undefined): string {\n\treturn JSON.stringify([domainKey(domain), id, cloud]);\n}\n\nexport class ObservedAuthenticationProvider implements IntegrationAuthenticationProvider {\n\tprivate readonly observations = new Map<string, Observation>();\n\tprivate readonly credentials = new Map<string, Observation>();\n\tprivate readonly descriptorRetirements = new Map<string, number>();\n\tprivate readonly actualRetirements = new Map<string, number>();\n\tprivate readonly hostRetirements = new Map<string, number>();\n\tprivate readonly activeRetirements = new Set<Retirement>();\n\tprivate sequence = 0;\n\tprivate globalRetirement = 0;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tprivate readonly host: IntegrationAuthenticationProvider,\n\t\tprivate readonly selfManaged: boolean,\n\t\tprivate readonly publish: (publication: SessionPublication, domains: (string | undefined)[]) => void,\n\t) {}\n\n\tget onDidChange(): Event<void> {\n\t\treturn this.host.onDidChange;\n\t}\n\n\tasync getSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetSessionOptions,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tif (this.disposed) return undefined;\n\n\t\tconst request = ++this.sequence;\n\t\tconst scope = JSON.stringify([\n\t\t\tdescriptor.connectionId,\n\t\t\tdomainKey(descriptor.domain),\n\t\t\tdescriptor.cloud,\n\t\t\tdescriptor.scopes,\n\t\t]);\n\t\tconst { isRejectedToken, ...hostOptions } = options ?? {};\n\t\tconst source = await this.host.getSession(descriptor, isRejectedToken == null ? options : hostOptions);\n\t\tif (\n\t\t\t(source != null && this.selfManaged && !areDomainsOnSameHost(descriptor.domain, source.domain)) ||\n\t\t\tthis.isRetired(request, descriptor, source)\n\t\t) {\n\t\t\tisRejectedToken?.(undefined);\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\tconst identity = getSessionIdentity(source);\n\t\tconst previous = this.observations.get(scope);\n\t\tconst sessionKey =\n\t\t\tsource == null\n\t\t\t\t? (previous?.sessionKey ??\n\t\t\t\t\t(descriptor.connectionId\n\t\t\t\t\t\t? actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud ?? true)\n\t\t\t\t\t\t: undefined))\n\t\t\t\t: actualKey(source.domain || descriptor.domain, source.id, source.cloud);\n\t\tconst credential = sessionKey == null ? undefined : this.credentials.get(sessionKey);\n\t\tconst latest =\n\t\t\tcredential != null && (previous == null || credential.request > previous.request) ? credential : previous;\n\t\tif (latest != null && latest.request > request && latest.identity !== identity) {\n\t\t\tisRejectedToken?.(undefined);\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\tif (isRejectedToken?.(source?.id === descriptor.connectionId ? source?.accessToken : undefined)) {\n\t\t\treturn this.getSession(descriptor, { ...hostOptions, refreshRejectedToken: true });\n\t\t}\n\n\t\tconst session: ProviderAuthenticationSession | undefined =\n\t\t\tsource == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: source.id,\n\t\t\t\t\t\taccessToken: source.accessToken,\n\t\t\t\t\t\taccount: source.account,\n\t\t\t\t\t\tscopes: source.scopes,\n\t\t\t\t\t\tcloud: source.cloud,\n\t\t\t\t\t\ttype: source.type,\n\t\t\t\t\t\texpiresAt: source.expiresAt,\n\t\t\t\t\t\tdomain: source.domain,\n\t\t\t\t\t\tbaseUrl: source.baseUrl,\n\t\t\t\t\t\tprotocol: source.protocol,\n\t\t\t\t\t\tappKey: source.appKey,\n\t\t\t\t\t};\n\t\tif (latest == null || latest.request <= request) {\n\t\t\tif (previous == null || previous.identity !== identity || credential?.identity !== identity) {\n\t\t\t\tthis.publish(\n\t\t\t\t\t{\n\t\t\t\t\t\tsession: session,\n\t\t\t\t\t\tpreviousSessionId: latest?.sessionId ?? descriptor.connectionId,\n\t\t\t\t\t\tconnectionId: descriptor.connectionId,\n\t\t\t\t\t\tcloud: session != null ? session.cloud : (latest?.cloud ?? descriptor.cloud),\n\t\t\t\t\t\treplacePrimary: !descriptor.connectionId,\n\t\t\t\t\t},\n\t\t\t\t\t[descriptor.domain, session?.domain, previous?.actualDomain],\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst observation: Observation = {\n\t\t\t\trequest: request,\n\t\t\t\tidentity: identity,\n\t\t\t\tdescriptorDomain: descriptor.domain,\n\t\t\t\tactualDomain: session?.domain || descriptor.domain,\n\t\t\t\tcloud: session?.cloud ?? descriptor.cloud,\n\t\t\t\tsessionKey: sessionKey,\n\t\t\t\tsessionId: source?.id ?? latest?.sessionId ?? descriptor.connectionId,\n\t\t\t\tconnectionId: descriptor.connectionId,\n\t\t\t};\n\t\t\tthis.observations.set(scope, observation);\n\t\t\tif (sessionKey != null) {\n\t\t\t\tthis.credentials.set(sessionKey, observation);\n\t\t\t}\n\t\t}\n\n\t\treturn session;\n\t}\n\n\tasync deleteSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: { preserveConfigured?: boolean; signOutMark?: number },\n\t): Promise<void> {\n\t\tconst retirement = this.retireConnection(descriptor);\n\t\tthis.activeRetirements.add(retirement);\n\t\ttry {\n\t\t\tawait this.host.deleteSession(descriptor, options);\n\t\t} finally {\n\t\t\tthis.markRetirement(retirement);\n\t\t\tthis.activeRetirements.delete(retirement);\n\t\t}\n\t}\n\n\tasync deleteAllSessions(descriptor?: IntegrationAuthenticationSessionDescriptor): Promise<void> {\n\t\tconst retirement = this.retireAll(this.selfManaged ? descriptor?.domain : undefined);\n\t\tthis.activeRetirements.add(retirement);\n\t\ttry {\n\t\t\tawait this.host.deleteAllSessions(descriptor);\n\t\t} finally {\n\t\t\tthis.markRetirement(retirement);\n\t\t\tthis.activeRetirements.delete(retirement);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\n\t\tthis.disposed = true;\n\t\tthis.retireAll();\n\t\tthis.host.dispose();\n\t}\n\n\tprivate isRetired(\n\t\trequest: number,\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\tsession: ProviderAuthenticationSession | undefined,\n\t): boolean {\n\t\tif (this.disposed || request < this.globalRetirement) return true;\n\n\t\tconst host = domainKey(descriptor.domain);\n\t\tconst variants = new Set([undefined, descriptor.cloud, session?.cloud]);\n\t\tif (descriptor.cloud == null && session?.cloud == null) {\n\t\t\tvariants.add(true);\n\t\t\tvariants.add(false);\n\t\t}\n\t\tconst descriptorIdentities = Array.from(variants, cloud =>\n\t\t\tdescriptorKey(descriptor.domain, descriptor.connectionId, cloud),\n\t\t);\n\t\tconst actual =\n\t\t\tsession == null ? undefined : actualKey(session.domain || descriptor.domain, session.id, session.cloud);\n\t\tconst actualAnyVariant =\n\t\t\tsession == null ? undefined : actualKey(session.domain || descriptor.domain, session.id, undefined);\n\t\tif (\n\t\t\trequest < (this.hostRetirements.get(host) ?? 0) ||\n\t\t\tdescriptorIdentities.some(key => request < (this.descriptorRetirements.get(key) ?? 0)) ||\n\t\t\t(actual != null && request < (this.actualRetirements.get(actual) ?? 0)) ||\n\t\t\t(actualAnyVariant != null && request < (this.actualRetirements.get(actualAnyVariant) ?? 0))\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\tfor (const retirement of this.activeRetirements) {\n\t\t\tif (\n\t\t\t\tretirement.all ||\n\t\t\t\tretirement.host === host ||\n\t\t\t\tdescriptorIdentities.some(key => retirement.descriptors.has(key)) ||\n\t\t\t\t(actual != null && retirement.actuals.has(actual)) ||\n\t\t\t\t(actualAnyVariant != null && retirement.actuals.has(actualAnyVariant))\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate retireConnection(descriptor: IntegrationAuthenticationSessionDescriptor): Retirement {\n\t\tconst host = domainKey(descriptor.domain);\n\t\tconst matching = [...this.observations.values()].filter(o => {\n\t\t\tif (domainKey(o.descriptorDomain) !== host && domainKey(o.actualDomain) !== host) return false;\n\t\t\tif (descriptor.cloud != null && o.cloud !== descriptor.cloud) return false;\n\t\t\treturn descriptor.connectionId == null\n\t\t\t\t? o.connectionId == null\n\t\t\t\t: o.connectionId === descriptor.connectionId || o.sessionId === descriptor.connectionId;\n\t\t});\n\t\tconst actuals = new Set(\n\t\t\tmatching\n\t\t\t\t.filter((o): o is Observation & { sessionId: string } => o.sessionId != null)\n\t\t\t\t.map(o => actualKey(o.actualDomain, o.sessionId, o.cloud)),\n\t\t);\n\t\tif (descriptor.connectionId != null) {\n\t\t\tactuals.add(actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud));\n\t\t}\n\n\t\tconst targets = [...this.observations.values()].filter(o => {\n\t\t\tif (descriptor.cloud != null && o.cloud !== descriptor.cloud) return false;\n\t\t\treturn (\n\t\t\t\tmatching.includes(o) ||\n\t\t\t\t(o.sessionId != null && actuals.has(actualKey(o.actualDomain, o.sessionId, o.cloud)))\n\t\t\t);\n\t\t});\n\t\tconst retirement: Retirement = { descriptors: new Set(), actuals: new Set() };\n\t\tretirement.descriptors.add(descriptorKey(descriptor.domain, descriptor.connectionId, descriptor.cloud));\n\t\tif (descriptor.connectionId != null) {\n\t\t\tretirement.actuals.add(actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud));\n\t\t}\n\n\t\tfor (const target of targets) {\n\t\t\tthis.addTarget(retirement, target);\n\t\t\tthis.publish(\n\t\t\t\t{\n\t\t\t\t\tpreviousSessionId: target.sessionId,\n\t\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\t\tcloud: target.cloud,\n\t\t\t\t\treplacePrimary: target.connectionId == null,\n\t\t\t\t},\n\t\t\t\t[target.descriptorDomain, target.actualDomain],\n\t\t\t);\n\t\t}\n\n\t\tif (targets.every(target => target.connectionId !== descriptor.connectionId)) {\n\t\t\tthis.publish(\n\t\t\t\t{\n\t\t\t\t\tpreviousSessionId: descriptor.connectionId,\n\t\t\t\t\tconnectionId: descriptor.connectionId,\n\t\t\t\t\tcloud: descriptor.cloud,\n\t\t\t\t\treplacePrimary: descriptor.connectionId == null,\n\t\t\t\t},\n\t\t\t\t[descriptor.domain],\n\t\t\t);\n\t\t}\n\n\t\tthis.removeTargets(targets);\n\t\tthis.markRetirement(retirement);\n\t\treturn retirement;\n\t}\n\n\tprivate retireAll(domain?: string): Retirement {\n\t\tconst host = domain == null ? undefined : domainKey(domain);\n\t\tconst retirement: Retirement = { descriptors: new Set(), actuals: new Set(), host: host, all: host == null };\n\t\tconst targets = [...this.observations.values()].filter(\n\t\t\to => host == null || domainKey(o.descriptorDomain) === host || domainKey(o.actualDomain) === host,\n\t\t);\n\t\tfor (const target of targets) {\n\t\t\tthis.addTarget(retirement, target);\n\t\t\tthis.publish(\n\t\t\t\t{\n\t\t\t\t\tpreviousSessionId: target.sessionId,\n\t\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\t\tcloud: target.cloud,\n\t\t\t\t\treplacePrimary: target.connectionId == null,\n\t\t\t\t},\n\t\t\t\t[target.descriptorDomain, target.actualDomain],\n\t\t\t);\n\t\t}\n\n\t\tthis.publish({ replacePrimary: true, retireAll: true }, [domain]);\n\n\t\tthis.removeTargets(targets);\n\t\tthis.markRetirement(retirement);\n\t\treturn retirement;\n\t}\n\n\tprivate addTarget(retirement: Retirement, observation: Observation): void {\n\t\tretirement.descriptors.add(\n\t\t\tdescriptorKey(observation.descriptorDomain, observation.connectionId, observation.cloud),\n\t\t);\n\t\tif (observation.sessionId != null) {\n\t\t\tretirement.actuals.add(actualKey(observation.actualDomain, observation.sessionId, observation.cloud));\n\t\t}\n\t}\n\n\tprivate removeTargets(targets: Observation[]): void {\n\t\tconst removed = new Set(targets);\n\t\tfor (const [key, observation] of this.observations) {\n\t\t\tif (removed.has(observation)) {\n\t\t\t\tthis.observations.delete(key);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, observation] of this.credentials) {\n\t\t\tif (removed.has(observation)) {\n\t\t\t\tthis.credentials.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate markRetirement(retirement: Retirement): void {\n\t\tconst mark = ++this.sequence;\n\t\tif (retirement.all) {\n\t\t\tthis.globalRetirement = mark;\n\t\t}\n\t\tif (retirement.host != null) {\n\t\t\tthis.hostRetirements.set(retirement.host, mark);\n\t\t}\n\t\tfor (const key of retirement.descriptors) {\n\t\t\tthis.descriptorRetirements.set(key, mark);\n\t\t}\n\n\t\tfor (const key of retirement.actuals) {\n\t\t\tthis.actualRetirements.set(key, mark);\n\t\t}\n\t}\n}\n"],"mappings":";;;;AA6BA,SAAS,UAAU,QAAwB;CAC1C,OAAO,eAAe,MAAM,KAAK;AAClC;AAEA,SAAS,cAAc,QAAgB,cAAkC,OAAoC;CAC5G,OAAO,KAAK,UAAU;EAAC,UAAU,MAAM;EAAG;EAAc;CAAK,CAAC;AAC/D;AAEA,SAAS,UAAU,QAAgB,IAAY,OAAoC;CAClF,OAAO,KAAK,UAAU;EAAC,UAAU,MAAM;EAAG;EAAI;CAAK,CAAC;AACrD;AAEA,IAAa,iCAAb,MAAyF;CAYtE;CACA;CACA;CAblB,+BAAgC,IAAI,IAAyB;CAC7D,8BAA+B,IAAI,IAAyB;CAC5D,wCAAyC,IAAI,IAAoB;CACjE,oCAAqC,IAAI,IAAoB;CAC7D,kCAAmC,IAAI,IAAoB;CAC3D,oCAAqC,IAAI,IAAgB;CACzD,WAAmB;CACnB,mBAA2B;CAC3B,WAAmB;CAEnB,YACC,MACA,aACA,SACC;EAHgB,KAAA,OAAA;EACA,KAAA,cAAA;EACA,KAAA,UAAA;CACf;CAEH,IAAI,cAA2B;EAC9B,OAAO,KAAK,KAAK;CAClB;CAEA,MAAM,WACL,YACA,SACqD;EACrD,IAAI,KAAK,UAAU,OAAO,KAAA;EAE1B,MAAM,UAAU,EAAE,KAAK;EACvB,MAAM,QAAQ,KAAK,UAAU;GAC5B,WAAW;GACX,UAAU,WAAW,MAAM;GAC3B,WAAW;GACX,WAAW;EACZ,CAAC;EACD,MAAM,EAAE,iBA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1B,KAAK,aAAa,OAAO,GAAG;EAI9B,KAAK,MAAM,CAAC,KAAK,gBAAgB,KAAK,aACrC,IAAI,QAAQ,IAAI,WAAW,GAC1B,KAAK,YAAY,OAAO,GAAG;CAG9B;CAEA,eAAuB,YAA8B;EACpD,MAAM,OAAO,EAAE,KAAK;EACpB,IAAI,WAAW,KACd,KAAK,mBAAmB;EAEzB,IAAI,WAAW,QAAQ,MACtB,KAAK,gBAAgB,IAAI,WAAW,MAAM,IAAI;EAE/C,KAAK,MAAM,OAAO,WAAW,aAC5B,KAAK,sBAAsB,IAAI,KAAK,IAAI;EAGzC,KAAK,MAAM,OAAO,WAAW,SAC5B,KAAK,kBAAkB,IAAI,KAAK,IAAI;CAEtC;AACD"}
|
|
1
|
+
{"version":3,"file":"observedAuthenticationProvider.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/observedAuthenticationProvider.ts"],"sourcesContent":["import { CancellationError } from '@gitlens/utils/cancellation.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport { areDomainsOnSameHost, hostFromDomain } from '../utils/domain.utils.js';\nimport type {\n\tGetSessionOptions,\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession, SessionPublication } from './models.js';\nimport { getSessionIdentity } from './models.js';\n\ntype Observation = {\n\trequest: number;\n\tidentity: string | undefined;\n\tdescriptorDomain: string;\n\tactualDomain: string;\n\tcloud: boolean | undefined;\n\tsessionKey?: string;\n\tsessionId?: string;\n\tconnectionId?: string;\n};\n\ntype Issuance = {\n\tmark: number;\n\tclaims: string[];\n\tdescriptor: IntegrationAuthenticationSessionDescriptor;\n};\n\ntype Retirement = {\n\tdescriptors: Set<string>;\n\tactuals: Set<string>;\n\thost?: string;\n\tall?: boolean;\n};\n\nfunction domainKey(domain: string): string {\n\treturn hostFromDomain(domain) ?? domain;\n}\n\nfunction descriptorKey(domain: string, connectionId: string | undefined, cloud: boolean | undefined): string {\n\treturn JSON.stringify([domainKey(domain), connectionId, cloud]);\n}\n\nfunction actualKey(domain: string, id: string, cloud: boolean | undefined): string {\n\treturn JSON.stringify([domainKey(domain), id, cloud]);\n}\n\nexport class ObservedAuthenticationProvider implements IntegrationAuthenticationProvider {\n\tprivate readonly observations = new Map<string, Observation>();\n\tprivate readonly credentials = new Map<string, Observation>();\n\tprivate readonly descriptorRetirements = new Map<string, number>();\n\tprivate readonly actualRetirements = new Map<string, number>();\n\tprivate readonly hostRetirements = new Map<string, number>();\n\tprivate readonly activeRetirements = new Set<Retirement>();\n\tprivate readonly claimWitnesses = new Map<string, { mark: number; request: number; witness: string | undefined }>();\n\tprivate readonly issuances = new WeakMap<ProviderAuthenticationSession, Issuance>();\n\tprivate sequence = 0;\n\tprivate globalRetirement = 0;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tprivate readonly host: IntegrationAuthenticationProvider,\n\t\tprivate readonly selfManaged: boolean,\n\t\tprivate readonly publish: (publication: SessionPublication, domains: (string | undefined)[]) => void,\n\t) {}\n\n\tget onDidChange(): Event<void> {\n\t\treturn this.host.onDidChange;\n\t}\n\n\tasync getSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: GetSessionOptions,\n\t): Promise<ProviderAuthenticationSession | undefined> {\n\t\tif (this.disposed) return undefined;\n\n\t\tconst request = ++this.sequence;\n\t\tconst scope = JSON.stringify([\n\t\t\tdescriptor.connectionId,\n\t\t\tdomainKey(descriptor.domain),\n\t\t\tdescriptor.cloud,\n\t\t\tdescriptor.scopes,\n\t\t]);\n\t\tconst { isRejectedToken, ...hostOptions } = options ?? {};\n\t\tconst source = await this.host.getSession(descriptor, isRejectedToken == null ? options : hostOptions);\n\t\tif (\n\t\t\t(source != null && this.selfManaged && !areDomainsOnSameHost(descriptor.domain, source.domain)) ||\n\t\t\tthis.isRetired(request, descriptor, source)\n\t\t) {\n\t\t\tisRejectedToken?.(undefined);\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\tconst identity = getSessionIdentity(source);\n\t\tconst previous = this.observations.get(scope);\n\t\tconst sessionKey =\n\t\t\tsource == null\n\t\t\t\t? (previous?.sessionKey ??\n\t\t\t\t\t(descriptor.connectionId\n\t\t\t\t\t\t? actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud ?? true)\n\t\t\t\t\t\t: undefined))\n\t\t\t\t: actualKey(source.domain || descriptor.domain, source.id, source.cloud);\n\t\tconst credential = sessionKey == null ? undefined : this.credentials.get(sessionKey);\n\t\tconst latest =\n\t\t\tcredential != null && (previous == null || credential.request > previous.request) ? credential : previous;\n\t\tif (latest != null && latest.request > request && latest.identity !== identity) {\n\t\t\tisRejectedToken?.(undefined);\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\tif (isRejectedToken?.(source?.id === descriptor.connectionId ? source?.accessToken : undefined)) {\n\t\t\treturn this.getSession(descriptor, { ...hostOptions, refreshRejectedToken: true });\n\t\t}\n\n\t\tconst session: ProviderAuthenticationSession | undefined =\n\t\t\tsource == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tid: source.id,\n\t\t\t\t\t\taccessToken: source.accessToken,\n\t\t\t\t\t\taccount: source.account,\n\t\t\t\t\t\tscopes: source.scopes,\n\t\t\t\t\t\tcloud: source.cloud,\n\t\t\t\t\t\ttype: source.type,\n\t\t\t\t\t\texpiresAt: source.expiresAt,\n\t\t\t\t\t\tdomain: source.domain,\n\t\t\t\t\t\tbaseUrl: source.baseUrl,\n\t\t\t\t\t\tprotocol: source.protocol,\n\t\t\t\t\t\tappKey: source.appKey,\n\t\t\t\t\t};\n\t\tconst claims = [\n\t\t\t`descriptor:${descriptorKey(descriptor.domain, descriptor.connectionId, descriptor.cloud)}`,\n\t\t\t...(sessionKey != null ? [`actual:${sessionKey}`] : []),\n\t\t];\n\t\tconst witness = source == null ? undefined : JSON.stringify([identity, source.account?.id]);\n\t\tconst accepted = latest == null || latest.request <= request;\n\t\tif (accepted && claims.every(claim => (this.claimWitnesses.get(claim)?.request ?? 0) <= request)) {\n\t\t\tfor (const claim of claims) {\n\t\t\t\tconst current = this.claimWitnesses.get(claim);\n\t\t\t\tthis.claimWitnesses.set(claim, {\n\t\t\t\t\tmark: current != null && current.witness === witness ? current.mark : ++this.sequence,\n\t\t\t\t\trequest: request,\n\t\t\t\t\twitness: witness,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (session != null) {\n\t\t\t\tthis.issuances.set(session, { mark: this.sequence, claims: claims, descriptor: descriptor });\n\t\t\t}\n\t\t} else if (session != null && claims.every(claim => this.claimWitnesses.get(claim)?.witness === witness)) {\n\t\t\tthis.issuances.set(session, { mark: this.sequence, claims: claims, descriptor: descriptor });\n\t\t}\n\n\t\tif (accepted) {\n\t\t\tif (previous == null || previous.identity !== identity || credential?.identity !== identity) {\n\t\t\t\tthis.publish(\n\t\t\t\t\t{\n\t\t\t\t\t\tsession: session,\n\t\t\t\t\t\tpreviousSessionId: latest?.sessionId ?? descriptor.connectionId,\n\t\t\t\t\t\tconnectionId: descriptor.connectionId,\n\t\t\t\t\t\tcloud: session != null ? session.cloud : (latest?.cloud ?? descriptor.cloud),\n\t\t\t\t\t\treplacePrimary: !descriptor.connectionId,\n\t\t\t\t\t},\n\t\t\t\t\t[descriptor.domain, session?.domain, previous?.actualDomain],\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst observation: Observation = {\n\t\t\t\trequest: request,\n\t\t\t\tidentity: identity,\n\t\t\t\tdescriptorDomain: descriptor.domain,\n\t\t\t\tactualDomain: session?.domain || descriptor.domain,\n\t\t\t\tcloud: session?.cloud ?? descriptor.cloud,\n\t\t\t\tsessionKey: sessionKey,\n\t\t\t\tsessionId: source?.id ?? latest?.sessionId ?? descriptor.connectionId,\n\t\t\t\tconnectionId: descriptor.connectionId,\n\t\t\t};\n\t\t\tthis.observations.set(scope, observation);\n\t\t\tif (sessionKey != null) {\n\t\t\t\tthis.credentials.set(sessionKey, observation);\n\t\t\t}\n\t\t}\n\n\t\treturn session;\n\t}\n\n\t/** KEEP: fails closed for a session this provider did not issue, since its changes cannot be proven absent. */\n\ttrackSession(session: ProviderAuthenticationSession): () => boolean {\n\t\tconst issuance = this.issuances.get(session);\n\t\tif (issuance == null) return () => true;\n\n\t\treturn () =>\n\t\t\tissuance.claims.some(claim => (this.claimWitnesses.get(claim)?.mark ?? 0) > issuance.mark) ||\n\t\t\tthis.isRetired(issuance.mark, issuance.descriptor, session);\n\t}\n\n\tasync deleteSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\toptions?: { preserveConfigured?: boolean; signOutMark?: number },\n\t): Promise<void> {\n\t\tconst retirement = this.retireConnection(descriptor);\n\t\tthis.activeRetirements.add(retirement);\n\t\ttry {\n\t\t\tawait this.host.deleteSession(descriptor, options);\n\t\t} finally {\n\t\t\tthis.markRetirement(retirement);\n\t\t\tthis.activeRetirements.delete(retirement);\n\t\t}\n\t}\n\n\tasync deleteAllSessions(descriptor?: IntegrationAuthenticationSessionDescriptor): Promise<void> {\n\t\tconst retirement = this.retireAll(this.selfManaged ? descriptor?.domain : undefined);\n\t\tthis.activeRetirements.add(retirement);\n\t\ttry {\n\t\t\tawait this.host.deleteAllSessions(descriptor);\n\t\t} finally {\n\t\t\tthis.markRetirement(retirement);\n\t\t\tthis.activeRetirements.delete(retirement);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\n\t\tthis.disposed = true;\n\t\tthis.retireAll();\n\t\tthis.host.dispose();\n\t}\n\n\tprivate isRetired(\n\t\trequest: number,\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t\tsession: ProviderAuthenticationSession | undefined,\n\t): boolean {\n\t\tif (this.disposed || request < this.globalRetirement) return true;\n\n\t\tconst host = domainKey(descriptor.domain);\n\t\tconst variants = new Set([undefined, descriptor.cloud, session?.cloud]);\n\t\tif (descriptor.cloud == null && session?.cloud == null) {\n\t\t\tvariants.add(true);\n\t\t\tvariants.add(false);\n\t\t}\n\t\tconst descriptorIdentities = Array.from(variants, cloud =>\n\t\t\tdescriptorKey(descriptor.domain, descriptor.connectionId, cloud),\n\t\t);\n\t\tconst actual =\n\t\t\tsession == null ? undefined : actualKey(session.domain || descriptor.domain, session.id, session.cloud);\n\t\tconst actualAnyVariant =\n\t\t\tsession == null ? undefined : actualKey(session.domain || descriptor.domain, session.id, undefined);\n\t\tif (\n\t\t\trequest < (this.hostRetirements.get(host) ?? 0) ||\n\t\t\tdescriptorIdentities.some(key => request < (this.descriptorRetirements.get(key) ?? 0)) ||\n\t\t\t(actual != null && request < (this.actualRetirements.get(actual) ?? 0)) ||\n\t\t\t(actualAnyVariant != null && request < (this.actualRetirements.get(actualAnyVariant) ?? 0))\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\tfor (const retirement of this.activeRetirements) {\n\t\t\tif (\n\t\t\t\tretirement.all ||\n\t\t\t\tretirement.host === host ||\n\t\t\t\tdescriptorIdentities.some(key => retirement.descriptors.has(key)) ||\n\t\t\t\t(actual != null && retirement.actuals.has(actual)) ||\n\t\t\t\t(actualAnyVariant != null && retirement.actuals.has(actualAnyVariant))\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate retireConnection(descriptor: IntegrationAuthenticationSessionDescriptor): Retirement {\n\t\tconst host = domainKey(descriptor.domain);\n\t\tconst matching = [...this.observations.values()].filter(o => {\n\t\t\tif (domainKey(o.descriptorDomain) !== host && domainKey(o.actualDomain) !== host) return false;\n\t\t\tif (descriptor.cloud != null && o.cloud !== descriptor.cloud) return false;\n\t\t\treturn descriptor.connectionId == null\n\t\t\t\t? o.connectionId == null\n\t\t\t\t: o.connectionId === descriptor.connectionId || o.sessionId === descriptor.connectionId;\n\t\t});\n\t\tconst actuals = new Set(\n\t\t\tmatching\n\t\t\t\t.filter((o): o is Observation & { sessionId: string } => o.sessionId != null)\n\t\t\t\t.map(o => actualKey(o.actualDomain, o.sessionId, o.cloud)),\n\t\t);\n\t\tif (descriptor.connectionId != null) {\n\t\t\tactuals.add(actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud));\n\t\t}\n\n\t\tconst targets = [...this.observations.values()].filter(o => {\n\t\t\tif (descriptor.cloud != null && o.cloud !== descriptor.cloud) return false;\n\t\t\treturn (\n\t\t\t\tmatching.includes(o) ||\n\t\t\t\t(o.sessionId != null && actuals.has(actualKey(o.actualDomain, o.sessionId, o.cloud)))\n\t\t\t);\n\t\t});\n\t\tconst retirement: Retirement = { descriptors: new Set(), actuals: new Set() };\n\t\tretirement.descriptors.add(descriptorKey(descriptor.domain, descriptor.connectionId, descriptor.cloud));\n\t\tif (descriptor.connectionId != null) {\n\t\t\tretirement.actuals.add(actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud));\n\t\t}\n\n\t\tfor (const target of targets) {\n\t\t\tthis.addTarget(retirement, target);\n\t\t\tthis.publish(\n\t\t\t\t{\n\t\t\t\t\tpreviousSessionId: target.sessionId,\n\t\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\t\tcloud: target.cloud,\n\t\t\t\t\treplacePrimary: target.connectionId == null,\n\t\t\t\t},\n\t\t\t\t[target.descriptorDomain, target.actualDomain],\n\t\t\t);\n\t\t}\n\n\t\tif (targets.every(target => target.connectionId !== descriptor.connectionId)) {\n\t\t\tthis.publish(\n\t\t\t\t{\n\t\t\t\t\tpreviousSessionId: descriptor.connectionId,\n\t\t\t\t\tconnectionId: descriptor.connectionId,\n\t\t\t\t\tcloud: descriptor.cloud,\n\t\t\t\t\treplacePrimary: descriptor.connectionId == null,\n\t\t\t\t},\n\t\t\t\t[descriptor.domain],\n\t\t\t);\n\t\t}\n\n\t\tthis.removeTargets(targets);\n\t\tthis.markRetirement(retirement);\n\t\treturn retirement;\n\t}\n\n\tprivate retireAll(domain?: string): Retirement {\n\t\tconst host = domain == null ? undefined : domainKey(domain);\n\t\tconst retirement: Retirement = { descriptors: new Set(), actuals: new Set(), host: host, all: host == null };\n\t\tconst targets = [...this.observations.values()].filter(\n\t\t\to => host == null || domainKey(o.descriptorDomain) === host || domainKey(o.actualDomain) === host,\n\t\t);\n\t\tfor (const target of targets) {\n\t\t\tthis.addTarget(retirement, target);\n\t\t\tthis.publish(\n\t\t\t\t{\n\t\t\t\t\tpreviousSessionId: target.sessionId,\n\t\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\t\tcloud: target.cloud,\n\t\t\t\t\treplacePrimary: target.connectionId == null,\n\t\t\t\t},\n\t\t\t\t[target.descriptorDomain, target.actualDomain],\n\t\t\t);\n\t\t}\n\n\t\tthis.publish({ replacePrimary: true, retireAll: true }, [domain]);\n\n\t\tthis.removeTargets(targets);\n\t\tthis.markRetirement(retirement);\n\t\treturn retirement;\n\t}\n\n\tprivate addTarget(retirement: Retirement, observation: Observation): void {\n\t\tretirement.descriptors.add(\n\t\t\tdescriptorKey(observation.descriptorDomain, observation.connectionId, observation.cloud),\n\t\t);\n\t\tif (observation.sessionId != null) {\n\t\t\tretirement.actuals.add(actualKey(observation.actualDomain, observation.sessionId, observation.cloud));\n\t\t}\n\t}\n\n\tprivate removeTargets(targets: Observation[]): void {\n\t\tconst removed = new Set(targets);\n\t\tfor (const [key, observation] of this.observations) {\n\t\t\tif (removed.has(observation)) {\n\t\t\t\tthis.observations.delete(key);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, observation] of this.credentials) {\n\t\t\tif (removed.has(observation)) {\n\t\t\t\tthis.credentials.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate markRetirement(retirement: Retirement): void {\n\t\tconst mark = ++this.sequence;\n\t\tif (retirement.all) {\n\t\t\tthis.globalRetirement = mark;\n\t\t}\n\t\tif (retirement.host != null) {\n\t\t\tthis.hostRetirements.set(retirement.host, mark);\n\t\t}\n\t\tfor (const key of retirement.descriptors) {\n\t\t\tthis.descriptorRetirements.set(key, mark);\n\t\t}\n\n\t\tfor (const key of retirement.actuals) {\n\t\t\tthis.actualRetirements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BAAkB,IAAI,KAAK,IAAI;CAEtC;AACD"}
|
|
@@ -17,7 +17,7 @@ import { Source, Sources } from "./telemetry.js";
|
|
|
17
17
|
import { IntegrationAuthenticationProvider, IntegrationAuthenticationProviderDescriptor, IntegrationAuthenticationSessionDescriptor } from "./authentication/integrationAuthenticationProvider.js";
|
|
18
18
|
import { AzurePullRequestCreateCapabilityOptions, AzurePullRequestCreateCapabilityResult, AzurePullRequestMergeStrategy, AzurePullRequestRepository, AzurePullRequestWriteFailure, AzurePullRequestWriteOptions, AzurePullRequestWriteResult, AzurePullRequestWriteTargetOptions, AzurePullRequestWriteTargetResult, AzureWrittenPullRequest } from "./models/azurePullRequestWrites.js";
|
|
19
19
|
import { IssueTrackerCreateOptions, IssueTrackerCreateOptionsResult, IssueTrackerDeleteOptions, IssueTrackerField, IssueTrackerIssueReceipt, IssueTrackerIssueWriteOptions, IssueTrackerIssueWriteOptionsResult, IssueTrackerStatus, IssueTrackerTransition, IssueTrackerWriteConnection, IssueTrackerWriteFailure, IssueTrackerWriteOptions, IssueTrackerWriteResult, IssueTrackerWriteTargetOptions, IssueTrackerWriteTargetResult } from "./models/issueTrackerWrites.js";
|
|
20
|
-
import { WorkItemAddress, WorkItemCreateOptions, WorkItemCreateOptionsResult, WorkItemDeleteCapability, WorkItemDeleteOptions, WorkItemDeleteResult, WorkItemDeleteTargetChanged, WorkItemDeletion, WorkItemReceipt, WorkItemState, WorkItemWriteContext, WorkItemWriteField, WorkItemWriteOptions, WorkItemWriteOptionsResult, WorkItemWriteResult, WorkItemWriteScope, WorkItemWriteTargetOptions, WorkItemWriteTargetResult } from "./models/workItemWrites.js";
|
|
20
|
+
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";
|
|
21
21
|
import { IssueFilter } from "./providerFilters.js";
|
|
22
22
|
import { IssueEtagInclude, PullRequestEtagInclude } from "./reads/etag.js";
|
|
23
23
|
import { ConnectionStateChangeEvent, CurrentAccountResult, IssueBatchResult, IssueBatchTarget, IssueCountResult, IssueCountScope, ProviderBroadenResult, ProviderLinearProjectShape, ProviderOrganization, ProviderPageInfo, ProviderPagedResult, ProviderRepositoryShape, ProviderResult, ProviderSweepResult, ProviderSweepTargetRef, ProviderWarning, ProviderWarningCause, ProviderWarningCauseReason, ProviderWarningKind, ProviderWarningOmission, ProviderWarningOmissionKind, ProviderWarningOmissionRecovery, ProviderWarningOmissionScope, ProviderWarningScope, ProviderWarningSelector, ProviderWarningUnreadableItems, PullRequestActivityResult, PullRequestActivityTarget, PullRequestBatchResult, PullRequestBatchTarget, PullRequestBranchResult, PullRequestBranchTarget, PullRequestCheckLogResult, PullRequestCheckLogTarget, PullRequestCountResult, PullRequestCountScope, PullRequestForCommitResult, RepositoryIdentity, RepositoryResolution, RepositoryResolutionStatus, ResolveRepositoryResult } from "./results.js";
|
|
@@ -107,5 +107,5 @@ export interface IntegrationManagerContext {
|
|
|
107
107
|
*/
|
|
108
108
|
export declare function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager;
|
|
109
109
|
//#endregion
|
|
110
|
-
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 AzurePullRequestWriteFailure, type AzurePullRequestWriteOptions, type AzurePullRequestWriteResult, type AzurePullRequestWriteTargetOptions, type AzurePullRequestWriteTargetResult, type AzureWrittenPullRequest, 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, GitSelfManagedHostIntegrationId, type HttpProvider, type Integration, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationById, type IntegrationCacheDescriptor, type IntegrationConnectedKey, type IntegrationCredential, type IntegrationIds, type IntegrationManager, 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 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 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 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 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 };
|
|
110
|
+
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 AzurePullRequestWriteFailure, type AzurePullRequestWriteOptions, type AzurePullRequestWriteResult, type AzurePullRequestWriteTargetOptions, type AzurePullRequestWriteTargetResult, type AzureServerWorkItemWriteScope, type AzureServicesWorkItemWriteScope, type AzureWrittenPullRequest, 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, GitSelfManagedHostIntegrationId, type HttpProvider, type Integration, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationById, type IntegrationCacheDescriptor, type IntegrationConnectedKey, type IntegrationCredential, type IntegrationIds, type IntegrationManager, 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 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 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 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 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 };
|
|
111
111
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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 type { Account } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequest } from '@gitlens/git/models/pullRequest.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\nimport type { IntegrationCacheDescriptor } from './models/publicIntegration.js';\n\nexport type { Autolink, AutolinkReference, DynamicAutolinkReference, RefSet } from '@gitlens/git/models/autolink.js';\nexport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** The integration identity supplied to the consumer-owned account cache. */\nexport type IntegrationAccountCacheDescriptor = IntegrationCacheDescriptor;\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * Only `getCurrentAccount` is required. Each other lookup is optional: one the cache omits runs its loader on every\n * call, uncached. A cache that keys entries by integration should key them by the descriptor's `id` and `domain`,\n * and treat `maybeConnected` and `sessionFingerprint` as the entry's etag, so a reconnect or a token change misses.\n *\n * The manager calls each method on the cache object itself, so a class instance (methods on its prototype) works.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n\tgetRepositoryMetadata?(\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<RepositoryMetadata>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<RepositoryMetadata>;\n\tgetRepositoryDefaultBranch?(\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<DefaultBranch>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<DefaultBranch>;\n\tgetPullRequestForSha?(\n\t\tsha: string,\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetPullRequestForBranch?(\n\t\tbranch: string,\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetPullRequest?(\n\t\tid: string,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetIssueOrPullRequest?(\n\t\tid: string,\n\t\ttype: IssueOrPullRequestType | undefined,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<IssueOrPullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<IssueOrPullRequest>;\n\tgetIssue?(\n\t\tid: string,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<Issue>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Issue>;\n\t/** Evicts cached pull requests for the given installation origin, or all pull requests when omitted. */\n\tdeletePullRequests?(scope?: { id: IntegrationCacheDescriptor['id']; domain: string }): void;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\n/**\n * What a consumer cache is handed in place of the integration itself. The getters read through to the integration\n * when the cache reads them, as reading the integration did, without handing a consumer the class.\n */\nfunction toCacheDescriptor(integration: IntegrationCacheDescriptor): IntegrationCacheDescriptor;\nfunction toCacheDescriptor(integration: IntegrationCacheDescriptor | undefined): IntegrationCacheDescriptor | undefined;\nfunction toCacheDescriptor(\n\tintegration: IntegrationCacheDescriptor | undefined,\n): IntegrationCacheDescriptor | undefined {\n\tif (integration == null) return undefined;\n\n\treturn {\n\t\tid: integration.id,\n\t\tdomain: integration.domain,\n\t\t...(integration.installationOrigin != null && { installationOrigin: integration.installationOrigin }),\n\t\tget maybeConnected() {\n\t\t\treturn integration.maybeConnected;\n\t\t},\n\t\tget sessionFingerprint() {\n\t\t\treturn integration.sessionFingerprint;\n\t\t},\n\t};\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\t// Nothing is cached, so there is nothing to evict.\n\tdeletePullRequests: () => {},\n};\n\n/**\n * Adapts the consumer's cache to the internal one: each lookup the consumer supplies is called on `cache` itself (never\n * spread or detached, which would lose a class instance's prototype methods and `this`), and every other lookup runs\n * uncached.\n */\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\tgetRepositoryMetadata: (repo, integration, loader, options) =>\n\t\t\tcache.getRepositoryMetadata != null\n\t\t\t\t? cache.getRepositoryMetadata(repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetRepositoryDefaultBranch: (repo, integration, loader, options) =>\n\t\t\tcache.getRepositoryDefaultBranch != null\n\t\t\t\t? cache.getRepositoryDefaultBranch(repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequestForSha: (sha, repo, integration, loader, options) =>\n\t\t\tcache.getPullRequestForSha != null\n\t\t\t\t? cache.getPullRequestForSha(sha, repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequestForBranch: (branch, repo, integration, loader, options) =>\n\t\t\tcache.getPullRequestForBranch != null\n\t\t\t\t? cache.getPullRequestForBranch(branch, repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequest: (id, resource, integration, loader, options) =>\n\t\t\tcache.getPullRequest != null\n\t\t\t\t? cache.getPullRequest(id, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetIssueOrPullRequest: (id, type, resource, integration, loader, options) =>\n\t\t\tcache.getIssueOrPullRequest != null\n\t\t\t\t? cache.getIssueOrPullRequest(id, type, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetIssue: (id, resource, integration, loader, options) =>\n\t\t\tcache.getIssue != null\n\t\t\t\t? cache.getIssue(id, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount(toCacheDescriptor(integration), loader, options),\n\t\tdeletePullRequests: scope => cache.deletePullRequests?.(scope),\n\t};\n}\n\n/**\n * Consumer-facing runtime for {@link createIntegrationManager}.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\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\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\tAzurePullRequestCreateCapabilityOptions,\n\tAzurePullRequestCreateCapabilityResult,\n\tAzurePullRequestMergeStrategy,\n\tAzurePullRequestRepository,\n\tAzurePullRequestWriteFailure,\n\tAzurePullRequestWriteOptions,\n\tAzurePullRequestWriteResult,\n\tAzurePullRequestWriteTargetOptions,\n\tAzurePullRequestWriteTargetResult,\n\tAzureWrittenPullRequest,\n} from './models/azurePullRequestWrites.js';\nexport type {\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 { 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\treturn createIntegrationService({\n\t\t...ctx,\n\t\tcache: toIntegrationCacheProvider(ctx.cache),\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\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":";;;;;;;;;;;;;;;;;;;;AAyHA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAQA,SAAS,kBACR,aACyC;CACzC,IAAI,eAAe,MAAM,OAAO,KAAA;CAEhC,OAAO;EACN,IAAI,YAAY;EAChB,QAAQ,YAAY;EACpB,GAAI,YAAY,sBAAsB,QAAQ,EAAE,oBAAoB,YAAY,mBAAmB;EACnG,IAAI,iBAAiB;GACpB,OAAO,YAAY;EACpB;EACA,IAAI,qBAAqB;GACxB,OAAO,YAAY;EACpB;CACD;AACD;AAEA,MAAM,mCAA6D;CAClE,wBAAwB,OAAO,cAAc,WAAW,aAAa,MAAM;CAC3E,6BAA6B,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,uBAAuB,MAAM,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,0BAA0B,SAAS,OAAO,cAAc,WAAW,aAAa,MAAM;CACtF,iBAAiB,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CAC7E,wBAAwB,KAAK,OAAO,WAAW,cAAc,WAAW,aAAa,MAAM;CAC3F,WAAW,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CACvE,oBAAoB,cAAc,WAA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AqB,KAAK;CAC9D;AACD;;;;;;;;;;;;;AAgHA,SAAgB,yBAAyB,KAAoD;CAC5F,OAAO,yBAAyB;EAC/B,GAAG;EACH,OAAO,2BAA2B,IAAI,KAAK;CAC5C,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 type { Account } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequest } from '@gitlens/git/models/pullRequest.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\nimport type { IntegrationCacheDescriptor } from './models/publicIntegration.js';\n\nexport type { Autolink, AutolinkReference, DynamicAutolinkReference, RefSet } from '@gitlens/git/models/autolink.js';\nexport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** The integration identity supplied to the consumer-owned account cache. */\nexport type IntegrationAccountCacheDescriptor = IntegrationCacheDescriptor;\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * Only `getCurrentAccount` is required. Each other lookup is optional: one the cache omits runs its loader on every\n * call, uncached. A cache that keys entries by integration should key them by the descriptor's `id` and `domain`,\n * and treat `maybeConnected` and `sessionFingerprint` as the entry's etag, so a reconnect or a token change misses.\n *\n * The manager calls each method on the cache object itself, so a class instance (methods on its prototype) works.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n\tgetRepositoryMetadata?(\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<RepositoryMetadata>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<RepositoryMetadata>;\n\tgetRepositoryDefaultBranch?(\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<DefaultBranch>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<DefaultBranch>;\n\tgetPullRequestForSha?(\n\t\tsha: string,\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetPullRequestForBranch?(\n\t\tbranch: string,\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetPullRequest?(\n\t\tid: string,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetIssueOrPullRequest?(\n\t\tid: string,\n\t\ttype: IssueOrPullRequestType | undefined,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<IssueOrPullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<IssueOrPullRequest>;\n\tgetIssue?(\n\t\tid: string,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<Issue>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Issue>;\n\t/** Evicts cached pull requests for the given installation origin, or all pull requests when omitted. */\n\tdeletePullRequests?(scope?: { id: IntegrationCacheDescriptor['id']; domain: string }): void;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\n/**\n * What a consumer cache is handed in place of the integration itself. The getters read through to the integration\n * when the cache reads them, as reading the integration did, without handing a consumer the class.\n */\nfunction toCacheDescriptor(integration: IntegrationCacheDescriptor): IntegrationCacheDescriptor;\nfunction toCacheDescriptor(integration: IntegrationCacheDescriptor | undefined): IntegrationCacheDescriptor | undefined;\nfunction toCacheDescriptor(\n\tintegration: IntegrationCacheDescriptor | undefined,\n): IntegrationCacheDescriptor | undefined {\n\tif (integration == null) return undefined;\n\n\treturn {\n\t\tid: integration.id,\n\t\tdomain: integration.domain,\n\t\t...(integration.installationOrigin != null && { installationOrigin: integration.installationOrigin }),\n\t\tget maybeConnected() {\n\t\t\treturn integration.maybeConnected;\n\t\t},\n\t\tget sessionFingerprint() {\n\t\t\treturn integration.sessionFingerprint;\n\t\t},\n\t};\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\t// Nothing is cached, so there is nothing to evict.\n\tdeletePullRequests: () => {},\n};\n\n/**\n * Adapts the consumer's cache to the internal one: each lookup the consumer supplies is called on `cache` itself (never\n * spread or detached, which would lose a class instance's prototype methods and `this`), and every other lookup runs\n * uncached.\n */\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\tgetRepositoryMetadata: (repo, integration, loader, options) =>\n\t\t\tcache.getRepositoryMetadata != null\n\t\t\t\t? cache.getRepositoryMetadata(repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetRepositoryDefaultBranch: (repo, integration, loader, options) =>\n\t\t\tcache.getRepositoryDefaultBranch != null\n\t\t\t\t? cache.getRepositoryDefaultBranch(repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequestForSha: (sha, repo, integration, loader, options) =>\n\t\t\tcache.getPullRequestForSha != null\n\t\t\t\t? cache.getPullRequestForSha(sha, repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequestForBranch: (branch, repo, integration, loader, options) =>\n\t\t\tcache.getPullRequestForBranch != null\n\t\t\t\t? cache.getPullRequestForBranch(branch, repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequest: (id, resource, integration, loader, options) =>\n\t\t\tcache.getPullRequest != null\n\t\t\t\t? cache.getPullRequest(id, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetIssueOrPullRequest: (id, type, resource, integration, loader, options) =>\n\t\t\tcache.getIssueOrPullRequest != null\n\t\t\t\t? cache.getIssueOrPullRequest(id, type, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetIssue: (id, resource, integration, loader, options) =>\n\t\t\tcache.getIssue != null\n\t\t\t\t? cache.getIssue(id, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount(toCacheDescriptor(integration), loader, options),\n\t\tdeletePullRequests: scope => cache.deletePullRequests?.(scope),\n\t};\n}\n\n/**\n * Consumer-facing runtime for {@link createIntegrationManager}.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\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\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\tAzurePullRequestCreateCapabilityOptions,\n\tAzurePullRequestCreateCapabilityResult,\n\tAzurePullRequestMergeStrategy,\n\tAzurePullRequestRepository,\n\tAzurePullRequestWriteFailure,\n\tAzurePullRequestWriteOptions,\n\tAzurePullRequestWriteResult,\n\tAzurePullRequestWriteTargetOptions,\n\tAzurePullRequestWriteTargetResult,\n\tAzureWrittenPullRequest,\n} from './models/azurePullRequestWrites.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 { 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\treturn createIntegrationService({\n\t\t...ctx,\n\t\tcache: toIntegrationCacheProvider(ctx.cache),\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\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":";;;;;;;;;;;;;;;;;;;;AAyHA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAQA,SAAS,kBACR,aACyC;CACzC,IAAI,eAAe,MAAM,OAAO,KAAA;CAEhC,OAAO;EACN,IAAI,YAAY;EAChB,QAAQ,YAAY;EACpB,GAAI,YAAY,sBAAsB,QAAQ,EAAE,oBAAoB,YAAY,mBAAmB;EACn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B,MAAM,eAAe,IAAI,UAAU,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAClF,aAAa,MAAM;EACvB,wBAAwB,IAAI,MAAM,UAAU,aAAa,QAAQ,YAChE,MAAM,yBAAyB,OAC5B,MAAM,sBAAsB,IAAI,MAAM,UAAU,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAC/F,aAAa,MAAM;EACvB,WAAW,IAAI,UAAU,aAAa,QAAQ,YAC7C,MAAM,YAAY,OACf,MAAM,SAAS,IAAI,UAAU,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAC5E,aAAa,MAAM;EACvB,oBAAoB,aAAa,QAAQ,YACxC,MAAM,kBAAkB,kBAAkB,WAAW,GAAG,QAAQ,OAAO;EACxE,qBAAoB,UAAS,MAAM,qBAAqB,KAAK;CAC9D;AACD;;;;;;;;;;;;;AAkHA,SAAgB,yBAAyB,KAAoD;CAC5F,OAAO,yBAAyB;EAC/B,GAAG;EACH,OAAO,2BAA2B,IAAI,KAAK;CAC5C,CAAC;AACF"}
|
|
@@ -602,6 +602,7 @@ export declare class IntegrationService implements Disposable, IntegrationManage
|
|
|
602
602
|
private findCachedById;
|
|
603
603
|
private getCachedForDomain;
|
|
604
604
|
onSessionPublishing(id: IntegrationIds, publication: SessionPublication, domains: readonly (string | undefined)[]): void;
|
|
605
|
+
private isUnprovenRepoint;
|
|
605
606
|
private getConfiguredCloudConnection;
|
|
606
607
|
private getConfiguredConnectionDomain;
|
|
607
608
|
private getCloudPrimaryConnectionIdsByDomain;
|
|
@@ -820,7 +820,7 @@ var IntegrationService = class {
|
|
|
820
820
|
return this.withWorkItemWriter(input, (writer) => writer.delete(input));
|
|
821
821
|
}
|
|
822
822
|
async withWorkItemWriter(input, run) {
|
|
823
|
-
if (input.providerId !== "azureDevOps") return {
|
|
823
|
+
if (input.providerId !== "azureDevOps" && input.providerId !== "azure-devops-server") return {
|
|
824
824
|
ok: false,
|
|
825
825
|
reason: "unsupported",
|
|
826
826
|
mutationDispatched: false
|
|
@@ -831,7 +831,12 @@ var IntegrationService = class {
|
|
|
831
831
|
mutationDispatched: false
|
|
832
832
|
};
|
|
833
833
|
try {
|
|
834
|
-
|
|
834
|
+
let writer;
|
|
835
|
+
if (input.providerId === "azureDevOps") writer = await (await this.get(input.providerId)).getWorkItemWriter(input);
|
|
836
|
+
else {
|
|
837
|
+
const integration = await this.getIntegrationForRead(input.providerId, input.connectionId, input.domain);
|
|
838
|
+
writer = integration?.id === "azure-devops-server" ? await integration.getWorkItemWriter(input) : void 0;
|
|
839
|
+
}
|
|
835
840
|
return writer == null ? {
|
|
836
841
|
ok: false,
|
|
837
842
|
reason: "no-connection",
|
|
@@ -1200,6 +1205,10 @@ var IntegrationService = class {
|
|
|
1200
1205
|
integration.onSessionPublishing(publication);
|
|
1201
1206
|
}
|
|
1202
1207
|
}
|
|
1208
|
+
isUnprovenRepoint(id, connection) {
|
|
1209
|
+
const current = this.configuredIntegrationService.getConfigured(id, { cloud: true }).find((c) => c.id === connection.id)?.baseUrl;
|
|
1210
|
+
return current != null && Boolean(connection.domain?.trim()) && !sameConfiguredBaseUrl(current, connection.domain);
|
|
1211
|
+
}
|
|
1203
1212
|
getConfiguredCloudConnection(id, connectionId) {
|
|
1204
1213
|
const connection = this.configuredIntegrationService.getConfigured(id, { cloud: true }).find((c) => c.id === connectionId);
|
|
1205
1214
|
if (connection == null) throw new Error(`Connection '${connectionId}' is not configured for '${id}'`);
|
|
@@ -1298,9 +1307,17 @@ var IntegrationService = class {
|
|
|
1298
1307
|
host
|
|
1299
1308
|
};
|
|
1300
1309
|
if (baseUrlChanged && cached != null) repointedDomains.add(host);
|
|
1301
|
-
|
|
1310
|
+
const fetchConnection = async () => {
|
|
1302
1311
|
const session = await cloudIntegrations.getConnectionSession(id, void 0, connection.id);
|
|
1303
1312
|
if (session == null) return void 0;
|
|
1313
|
+
if (this.configuredIntegrationService.serializesCredentialAcquisition(id) && (session.id != null && session.id !== connection.id || Boolean(session.domain?.trim()) && !sameConfiguredBaseUrl(session.domain, connection.domain))) {
|
|
1314
|
+
scope?.warn(`Skipping connection '${connection.id}' for ${id}: token issued for another connection`);
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
if (this.configuredIntegrationService.serializesCredentialAcquisition(id) && !session.domain?.trim() && this.isUnprovenRepoint(id, connection)) {
|
|
1318
|
+
scope?.warn(`Skipping connection '${connection.id}' for ${id}: token does not confirm its moved address`);
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1304
1321
|
let providerSession = toProviderSession(id, connection, session, host, cached?.baseUrl);
|
|
1305
1322
|
const existing = existingById.get(connection.id);
|
|
1306
1323
|
const accountName = normalizeAccountName(connection.accountName) ?? normalizeAccountName(existing?.accountName) ?? await this.resolveAccountName(id, host, providerSession);
|
|
@@ -1319,6 +1336,20 @@ var IntegrationService = class {
|
|
|
1319
1336
|
providerSession,
|
|
1320
1337
|
resource
|
|
1321
1338
|
};
|
|
1339
|
+
};
|
|
1340
|
+
try {
|
|
1341
|
+
if (!this.configuredIntegrationService.serializesCredentialAcquisition(id)) return await fetchConnection();
|
|
1342
|
+
return await this.configuredIntegrationService.withCredentialAcquisition(id, connection.id, async () => {
|
|
1343
|
+
const prepared = await fetchConnection();
|
|
1344
|
+
if (prepared == null) return void 0;
|
|
1345
|
+
return await this.configuredIntegrationService.storeSession(id, prepared.providerSession, {
|
|
1346
|
+
signOutMark,
|
|
1347
|
+
resource: prepared.resource
|
|
1348
|
+
}) ? {
|
|
1349
|
+
...prepared,
|
|
1350
|
+
kind: "published"
|
|
1351
|
+
} : void 0;
|
|
1352
|
+
});
|
|
1322
1353
|
} catch (ex) {
|
|
1323
1354
|
scope?.warn(`Failed to sync connection '${connection.id}' for ${id}: ${ex instanceof Error ? ex.message : String(ex)}`);
|
|
1324
1355
|
return;
|