@gitkraken/core-gitlens 0.51.1 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/_types/provider-apis/types/exportedTypes/github.d.ts +75 -0
  3. package/dist/_types/provider-apis/types/exportedTypes/types.d.ts +7 -0
  4. package/dist/git-cli/providers/config.js +2 -2
  5. package/dist/git-cli/providers/pausedOperations.js +2 -2
  6. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  7. package/dist/git-cli/providers/staging.js +1 -1
  8. package/dist/ipc/discovery.js +1 -1
  9. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  10. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  11. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  12. package/dist/plus/git-github/api/issueWrites.js +1 -1
  13. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  14. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +10 -1
  15. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +75 -23
  16. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -1
  17. package/dist/plus/integrations/authentication/cloudIntegrationObservations.d.ts +49 -0
  18. package/dist/plus/integrations/authentication/cloudIntegrationObservations.js +118 -0
  19. package/dist/plus/integrations/authentication/cloudIntegrationObservations.js.map +1 -0
  20. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +45 -25
  21. package/dist/plus/integrations/authentication/configuredIntegrationService.js +409 -141
  22. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  23. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +12 -3
  24. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +39 -7
  25. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  26. package/dist/plus/integrations/authentication/models.d.ts +6 -0
  27. package/dist/plus/integrations/authentication/models.js +9 -1
  28. package/dist/plus/integrations/authentication/models.js.map +1 -1
  29. package/dist/plus/integrations/authentication/observedAuthenticationProvider.d.ts +17 -2
  30. package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +84 -16
  31. package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
  32. package/dist/plus/integrations/index.d.ts +3 -2
  33. package/dist/plus/integrations/index.js.map +1 -1
  34. package/dist/plus/integrations/integrationService.d.ts +9 -0
  35. package/dist/plus/integrations/integrationService.js +182 -39
  36. package/dist/plus/integrations/integrationService.js.map +1 -1
  37. package/dist/plus/integrations/manager.d.ts +3 -0
  38. package/dist/plus/integrations/models/integration.d.ts +4 -0
  39. package/dist/plus/integrations/models/integration.js +61 -16
  40. package/dist/plus/integrations/models/integration.js.map +1 -1
  41. package/dist/plus/integrations/models/issueRelationships.d.ts +31 -0
  42. package/dist/plus/integrations/models/issueRelationships.js +0 -0
  43. package/dist/plus/integrations/models/workItemWrites.d.ts +34 -2
  44. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  45. package/dist/plus/integrations/providers/azureDevOps.d.ts +4 -3
  46. package/dist/plus/integrations/providers/azureDevOps.js +6 -6
  47. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  48. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +3 -0
  49. package/dist/plus/integrations/providers/azureDevOpsServer.js +14 -0
  50. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  51. package/dist/plus/integrations/providers/azureWorkItemWriteErrors.d.ts +4 -0
  52. package/dist/plus/integrations/providers/azureWorkItemWriteErrors.js +34 -2
  53. package/dist/plus/integrations/providers/azureWorkItemWriteErrors.js.map +1 -1
  54. package/dist/plus/integrations/providers/azureWorkItemWrites.d.ts +5 -2
  55. package/dist/plus/integrations/providers/azureWorkItemWrites.js +57 -14
  56. package/dist/plus/integrations/providers/azureWorkItemWrites.js.map +1 -1
  57. package/dist/plus/integrations/providers/github.d.ts +8 -0
  58. package/dist/plus/integrations/providers/github.js +162 -2
  59. package/dist/plus/integrations/providers/github.js.map +1 -1
  60. package/dist/plus/integrations/providers/providerApiClient.d.ts +1 -1
  61. package/dist/plus/integrations/providers/providerApiClient.js +33 -14
  62. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  63. package/dist/plus/integrations/providers/providerErrors.d.ts +1 -0
  64. package/dist/plus/integrations/providers/providerErrors.js +1 -2
  65. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  66. package/dist/plus/integrations/providers/providersApi.d.ts +10 -4
  67. package/dist/plus/integrations/providers/providersApi.js +21 -0
  68. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  69. package/dist/utils/env/node/exec.js +2 -2
  70. package/docs/integrations.md +61 -0
  71. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/models.ts"],"sourcesContent":["import { microhash } from '@gitlens/utils/hash.js';\nimport type { IntegrationIds, SupportedCloudIntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tsupportedOrderedCloudIntegrationIds,\n} from '../constants.js';\n\n/**\n * Mirrors the shape of `vscode.AuthenticationSession` so the integrations\n * package can stay vscode-free. Host adapters bridge VS Code sessions to\n * this shape via {@link AuthenticationProvider}.\n */\nexport interface AuthenticationSessionLike {\n\treadonly id: string;\n\treadonly accessToken: string;\n\treadonly account: { readonly id: string; readonly label: string };\n\treadonly scopes: readonly string[];\n}\n\nexport interface ProviderAuthenticationSession extends AuthenticationSessionLike {\n\treadonly cloud: boolean;\n\treadonly type: CloudIntegrationAuthType | undefined;\n\treadonly expiresAt?: Date;\n\treadonly domain: string;\n\t/**\n\t * The connection's address exactly as it was configured, path and all, when that differs from\n\t * {@link domain}.\n\t *\n\t * `domain` is the IDENTITY a self-managed connection is keyed by, so it is normalized to a bare host\n\t * (`hostFromDomain`) and one host cannot key two connections. An instance mounted below a context path —\n\t * Jira Data Center's `/jira`, a reverse-proxied GitLab or Bitbucket — still has to be ADDRESSED at that\n\t * path, and normalizing it away is what made every request go to the root. Absent when the backend\n\t * reported nothing beyond the host, which is the common case.\n\t */\n\treadonly baseUrl?: string;\n\treadonly protocol?: string;\n\t/** The provider app key paired with the token for providers whose client needs one (e.g. Trello). */\n\treadonly appKey?: string;\n}\n\nexport type SessionPublication = {\n\treadonly session?: ProviderAuthenticationSession;\n\treadonly previousSessionId?: string;\n\treadonly connectionId?: string;\n\t/** A removal has no session from which to recover the affected storage variant. */\n\treadonly cloud?: boolean;\n\treadonly replacePrimary?: boolean;\n\treadonly retireAll?: boolean;\n};\n\nexport function getSessionIdentity(\n\tsession:\n\t\t| Partial<\n\t\t\t\tPick<\n\t\t\t\t\tProviderAuthenticationSession,\n\t\t\t\t\t'id' | 'accessToken' | 'domain' | 'baseUrl' | 'protocol' | 'appKey' | 'type' | 'cloud'\n\t\t\t\t>\n\t\t >\n\t\t| null\n\t\t| undefined,\n): string | undefined {\n\treturn session == null\n\t\t? undefined\n\t\t: JSON.stringify([\n\t\t\t\tsession.id,\n\t\t\t\tsession.accessToken,\n\t\t\t\tsession.domain,\n\t\t\t\tsession.baseUrl,\n\t\t\t\tsession.protocol,\n\t\t\t\tsession.appKey,\n\t\t\t\tsession.type,\n\t\t\t\tsession.cloud,\n\t\t\t]);\n}\n\nexport interface TokenInfo<T extends IntegrationIds | 'gitkraken' = IntegrationIds | 'gitkraken'> {\n\treadonly providerId: T;\n\t/**\n\t * The first 3 characters of the md5 hash of the token.\n\t * It's a very obfuscated representation of the token that we can use in logs\n\t * to see whether the token survives refreshing or gets updated.\n\t */\n\treadonly microHash: string | undefined;\n\treadonly cloud: boolean;\n\treadonly type: CloudIntegrationAuthType | undefined;\n\treadonly scopes: readonly string[] | undefined;\n\treadonly expiresAt?: Date;\n}\n\nexport interface TokenWithInfo<T extends IntegrationIds = IntegrationIds> extends TokenInfo<T> {\n\treadonly accessToken: string;\n\t/** The token's connection (its session's id), which a failed request's strike counts against. */\n\treadonly connectionId?: string;\n}\n\nexport function toTokenInfo<T extends IntegrationIds | 'gitkraken'>(\n\tproviderId: T,\n\taccessToken: string | undefined,\n\tinfo: { cloud: boolean; type: CloudIntegrationAuthType | undefined; scopes?: readonly string[]; expiresAt?: Date },\n): TokenInfo<T> {\n\treturn {\n\t\tproviderId: providerId,\n\t\tmicroHash: microhash(accessToken, 3),\n\t\tcloud: info.cloud,\n\t\ttype: info.type,\n\t\tscopes: info.scopes,\n\t\texpiresAt: info.expiresAt,\n\t};\n}\n\nexport function toTokenWithInfo<T extends IntegrationIds>(\n\tproviderId: T,\n\tsession: ProviderAuthenticationSession,\n\taltToken?: string,\n): TokenWithInfo<T> {\n\tconst { accessToken: sessionToken, ...sessionInfo } = session;\n\tconst accessToken = altToken ?? session.accessToken;\n\treturn {\n\t\t// pass original token info to form the correlated microhash\n\t\t...toTokenInfo(providerId, sessionToken, sessionInfo),\n\t\t// use the actual token used for the request\n\t\taccessToken: accessToken,\n\t\tconnectionId: session.id,\n\t};\n}\n\nexport type TokenOptInfo<T extends IntegrationIds = IntegrationIds> =\n\t| TokenWithInfo<T>\n\t// `connectionId` targets a specific connection (multi-account) when the token still has to be resolved.\n\t// Omitted resolves the provider's primary connection, preserving the pre-multi-account behavior.\n\t| { providerId: T; accessToken?: undefined; connectionId?: string };\n\nexport interface ConfiguredIntegrationDescriptor {\n\t/**\n\t * Stable per-connection identifier, distinct from the domain, so multiple accounts can be\n\t * connected to the same provider+domain simultaneously. For legacy/migrated single connections\n\t * this is the domain (self-managed) or the provider's canonical domain (cloud), which keeps the\n\t * existing secret key (`integration.auth[.cloud]:{id}|{domain}`) valid with zero migration.\n\t */\n\treadonly id: string;\n\t/**\n\t * Whether this is the connection used by default for the provider. Optional: when no descriptor\n\t * for a provider+domain carries an explicit flag, the first one is treated as primary. Only\n\t * {@link ConfiguredIntegrationService.setPrimaryConnection} sets the flag (and clears it on siblings).\n\t */\n\treadonly primary?: boolean;\n\t/** The connection's auth type (`oauth`/`pat`), when known. */\n\treadonly type?: CloudIntegrationAuthType;\n\t/**\n\t * Human-readable account handle for this connection (e.g. the GitHub login). Resolved from the\n\t * provider API (the token backend doesn't expose it); absent until resolved or if the lookup fails.\n\t */\n\treadonly accountName?: string;\n\t/**\n\t * Workspace the connection's token was granted for (Linear), separate from the person. Resolved with the\n\t * connection's own token and kept by connection id; both are set together, or neither is.\n\t */\n\treadonly resourceName?: string;\n\treadonly resourceId?: string;\n\treadonly cloud: boolean;\n\treadonly integrationId: IntegrationIds;\n\treadonly scopes: string;\n\treadonly domain?: string;\n\t/**\n\t * The address this connection was configured with, path included — see\n\t * {@link ProviderAuthenticationSession.baseUrl}.\n\t *\n\t * Mirrored onto the descriptor so reconciliation can tell a re-pointed connection from an unchanged one\n\t * without reading its secret: {@link domain} is normalized to a bare host, so a backend connection moved\n\t * from one context path to another on the SAME host looks identical by domain alone.\n\t */\n\treadonly baseUrl?: string;\n\treadonly expiresAt?: string | Date;\n}\n\nexport interface CloudIntegrationAuthenticationSession {\n\ttype: CloudIntegrationAuthType;\n\taccessToken: string;\n\tdomain: string;\n\texpiresIn: number;\n\tscopes: string;\n\t/** Backend per-connection token identifier, when the provider-tokens backend supports multi-account. */\n\tid?: string;\n\t/** Provider app key paired with the token (e.g. Trello app key), when the backend supplies one. */\n\tappKey?: string;\n}\n\nexport interface CloudIntegrationAuthorization {\n\turl: string;\n}\n\n/** Workspace a connection's token was granted for; only ever a complete pair. */\nexport interface ConnectionResource {\n\treadonly id: string;\n\treadonly name: string;\n}\n\nexport interface CloudIntegrationConnection {\n\ttype: CloudIntegrationAuthType;\n\tprovider: CloudIntegrationType;\n\tdomain: string;\n\t/** Backend per-connection token identifier, when the provider-tokens backend supports multi-account. */\n\tid?: string;\n\t/** Whether the backend marks this connection as the primary/default for the provider. */\n\tprimary?: boolean;\n\t/** Human-readable account handle, when the backend provides it on the connection (may be absent). */\n\taccountName?: string;\n}\n\nexport type CloudIntegrationType =\n\t| 'jira'\n\t| 'jiraServer'\n\t| 'linear'\n\t| 'trello'\n\t| 'asana'\n\t| 'gitlab'\n\t| 'github'\n\t| 'bitbucket'\n\t| 'bitbucketServer'\n\t| 'azure'\n\t| 'azureDevopsServer'\n\t| 'githubEnterprise'\n\t| 'gitlabSelfHosted';\n\nexport type CloudIntegrationAuthType = 'oauth' | 'pat';\n\n/** Returns all supported cloud integration ids. */\nexport function getSupportedCloudIntegrationIds(): readonly SupportedCloudIntegrationIds[] {\n\t// Return the shared const directly (readonly so callers can't mutate it) — this runs on hot,\n\t// per-integration membership paths, so avoid allocating a fresh array per call.\n\treturn supportedOrderedCloudIntegrationIds;\n}\n\n/** Whether `id` is a supported cloud integration id. */\nexport function isSupportedCloudIntegrationId(id: string): id is SupportedCloudIntegrationIds {\n\treturn getSupportedCloudIntegrationIds().includes(id as SupportedCloudIntegrationIds);\n}\n\nexport function isIssueCloudIntegrationId(id: string): id is IssuesCloudHostIntegrationId {\n\tconst issueIds: string[] = Object.values(IssuesCloudHostIntegrationId);\n\treturn issueIds.includes(id);\n}\n\nexport const toIntegrationId: { [key in CloudIntegrationType]: IntegrationIds } = {\n\tjira: IssuesCloudHostIntegrationId.Jira,\n\tjiraServer: IssuesSelfManagedHostIntegrationId.JiraServer,\n\tlinear: IssuesCloudHostIntegrationId.Linear,\n\ttrello: IssuesCloudHostIntegrationId.Trello,\n\tasana: IssuesCloudHostIntegrationId.Asana,\n\tgitlab: GitCloudHostIntegrationId.GitLab,\n\tgithub: GitCloudHostIntegrationId.GitHub,\n\tgithubEnterprise: GitSelfManagedHostIntegrationId.CloudGitHubEnterprise,\n\tgitlabSelfHosted: GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted,\n\tbitbucket: GitCloudHostIntegrationId.Bitbucket,\n\tbitbucketServer: GitSelfManagedHostIntegrationId.BitbucketServer,\n\tazure: GitCloudHostIntegrationId.AzureDevOps,\n\tazureDevopsServer: GitSelfManagedHostIntegrationId.AzureDevOpsServer,\n};\n\nexport const toCloudIntegrationType: { [key in IntegrationIds]: CloudIntegrationType | undefined } = {\n\t[IssuesCloudHostIntegrationId.Jira]: 'jira',\n\t[IssuesSelfManagedHostIntegrationId.JiraServer]: 'jiraServer',\n\t[IssuesCloudHostIntegrationId.Linear]: 'linear',\n\t[IssuesCloudHostIntegrationId.Trello]: 'trello',\n\t[IssuesCloudHostIntegrationId.Asana]: 'asana',\n\t[GitCloudHostIntegrationId.GitLab]: 'gitlab',\n\t[GitCloudHostIntegrationId.GitHub]: 'github',\n\t[GitCloudHostIntegrationId.Bitbucket]: 'bitbucket',\n\t[GitCloudHostIntegrationId.AzureDevOps]: 'azure',\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: 'azureDevopsServer',\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: 'githubEnterprise',\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: 'gitlabSelfHosted',\n\t[GitSelfManagedHostIntegrationId.BitbucketServer]: 'bitbucketServer',\n};\n"],"mappings":";;;AAqDA,SAAgB,mBACf,SASqB;CACrB,OAAO,WAAW,OACf,KAAA,IACA,KAAK,UAAU;EACf,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;CACT,CAAC;AACJ;AAsBA,SAAgB,YACf,YACA,aACA,MACe;CACf,OAAO;EACM;EACZ,WAAW,UAAU,aAAa,CAAC;EACnC,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,QAAQ,KAAK;EACb,WAAW,KAAK;CACjB;AACD;AAEA,SAAgB,gBACf,YACA,SACA,UACmB;CACnB,MAAM,EAAE,aAAa,cAAc,GAAG,gBAAgB;CACtD,MAAM,cAAc,YAAY,QAAQ;CACxC,OAAO;EAEN,GAAG,YAAY,YAAY,cAAc,WAAW;EAEvC;EACb,cAAc,QAAQ;CACvB;AACD;;AAuGA,SAAgB,kCAA2E;CAG1F,OAAO;AACR;;AAGA,SAAgB,8BAA8B,IAAgD;CAC7F,OAAO,gCAAgC,CAAC,CAAC,SAAS,EAAkC;AACrF;AAEA,SAAgB,0BAA0B,IAAgD;CAEzF,OAD2B,OAAO,OAAO,4BAC3B,CAAC,CAAC,SAAS,EAAE;AAC5B;AAEA,MAAa,kBAAqE;CACjF,MAAA;CACA,YAAA;CACA,QAAA;CACA,QAAA;CACA,OAAA;CACA,QAAA;CACA,QAAA;CACA,kBAAA;CACA,kBAAA;CACA,WAAA;CACA,iBAAA;CACA,OAAA;CACA,mBAAA;AACD;AAEA,MAAa,yBAAwF;EAC/D,SAAA;EACY,gBAAA;EACV,WAAA;EACA,WAAA;EACD,UAAA;EACF,WAAA;EACA,WAAA;EACG,cAAA;EACE,gBAAA;EACY,wBAAA;EACI,4BAAA;EACA,6BAAA;EACN,qBAAA;AACpD"}
1
+ {"version":3,"file":"models.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/models.ts"],"sourcesContent":["import { microhash } from '@gitlens/utils/hash.js';\nimport type { IntegrationIds, SupportedCloudIntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tsupportedOrderedCloudIntegrationIds,\n} from '../constants.js';\n\n/**\n * Mirrors the shape of `vscode.AuthenticationSession` so the integrations\n * package can stay vscode-free. Host adapters bridge VS Code sessions to\n * this shape via {@link AuthenticationProvider}.\n */\nexport interface AuthenticationSessionLike {\n\treadonly id: string;\n\treadonly accessToken: string;\n\treadonly account: { readonly id: string; readonly label: string };\n\treadonly scopes: readonly string[];\n}\n\nexport interface ProviderAuthenticationSession extends AuthenticationSessionLike {\n\treadonly cloud: boolean;\n\treadonly type: CloudIntegrationAuthType | undefined;\n\treadonly expiresAt?: Date;\n\treadonly domain: string;\n\t/**\n\t * The connection's address exactly as it was configured, path and all, when that differs from\n\t * {@link domain}.\n\t *\n\t * `domain` is the IDENTITY a self-managed connection is keyed by, so it is normalized to a bare host\n\t * (`hostFromDomain`) and one host cannot key two connections. An instance mounted below a context path —\n\t * Jira Data Center's `/jira`, a reverse-proxied GitLab or Bitbucket — still has to be ADDRESSED at that\n\t * path, and normalizing it away is what made every request go to the root. Absent when the backend\n\t * reported nothing beyond the host, which is the common case.\n\t */\n\treadonly baseUrl?: string;\n\treadonly protocol?: string;\n\t/** The provider app key paired with the token for providers whose client needs one (e.g. Trello). */\n\treadonly appKey?: string;\n}\n\nexport type SessionPublication = {\n\treadonly session?: ProviderAuthenticationSession;\n\treadonly previousSessionId?: string;\n\treadonly connectionId?: string;\n\t/** A removal has no session from which to recover the affected storage variant. */\n\treadonly cloud?: boolean;\n\treadonly replacePrimary?: boolean;\n\treadonly retireAll?: boolean;\n};\n\nexport type RelationshipSessionGuard = {\n\tisCurrent: () => boolean;\n\tverify: () => Promise<boolean>;\n};\n\nexport function sessionExpiry(value: Date | string | undefined): number {\n\tif (value == null) return Infinity;\n\n\tconst time = new Date(value).getTime();\n\treturn Number.isNaN(time) ? 0 : time;\n}\n\nexport function isSameAuthenticationSession(\n\tfirst: ProviderAuthenticationSession,\n\tsecond: ProviderAuthenticationSession,\n): boolean {\n\treturn getSessionIdentity(first) === getSessionIdentity(second) && first.account?.id === second.account?.id;\n}\n\nexport function getSessionIdentity(\n\tsession:\n\t\t| Partial<\n\t\t\t\tPick<\n\t\t\t\t\tProviderAuthenticationSession,\n\t\t\t\t\t'id' | 'accessToken' | 'domain' | 'baseUrl' | 'protocol' | 'appKey' | 'type' | 'cloud'\n\t\t\t\t>\n\t\t >\n\t\t| null\n\t\t| undefined,\n): string | undefined {\n\treturn session == null\n\t\t? undefined\n\t\t: JSON.stringify([\n\t\t\t\tsession.id,\n\t\t\t\tsession.accessToken,\n\t\t\t\tsession.domain,\n\t\t\t\tsession.baseUrl,\n\t\t\t\tsession.protocol,\n\t\t\t\tsession.appKey,\n\t\t\t\tsession.type,\n\t\t\t\tsession.cloud,\n\t\t\t]);\n}\n\nexport interface TokenInfo<T extends IntegrationIds | 'gitkraken' = IntegrationIds | 'gitkraken'> {\n\treadonly providerId: T;\n\t/**\n\t * The first 3 characters of the md5 hash of the token.\n\t * It's a very obfuscated representation of the token that we can use in logs\n\t * to see whether the token survives refreshing or gets updated.\n\t */\n\treadonly microHash: string | undefined;\n\treadonly cloud: boolean;\n\treadonly type: CloudIntegrationAuthType | undefined;\n\treadonly scopes: readonly string[] | undefined;\n\treadonly expiresAt?: Date;\n}\n\nexport interface TokenWithInfo<T extends IntegrationIds = IntegrationIds> extends TokenInfo<T> {\n\treadonly accessToken: string;\n\t/** The token's connection (its session's id), which a failed request's strike counts against. */\n\treadonly connectionId?: string;\n}\n\nexport function toTokenInfo<T extends IntegrationIds | 'gitkraken'>(\n\tproviderId: T,\n\taccessToken: string | undefined,\n\tinfo: { cloud: boolean; type: CloudIntegrationAuthType | undefined; scopes?: readonly string[]; expiresAt?: Date },\n): TokenInfo<T> {\n\treturn {\n\t\tproviderId: providerId,\n\t\tmicroHash: microhash(accessToken, 3),\n\t\tcloud: info.cloud,\n\t\ttype: info.type,\n\t\tscopes: info.scopes,\n\t\texpiresAt: info.expiresAt,\n\t};\n}\n\nexport function toTokenWithInfo<T extends IntegrationIds>(\n\tproviderId: T,\n\tsession: ProviderAuthenticationSession,\n\taltToken?: string,\n): TokenWithInfo<T> {\n\tconst { accessToken: sessionToken, ...sessionInfo } = session;\n\tconst accessToken = altToken ?? session.accessToken;\n\treturn {\n\t\t// pass original token info to form the correlated microhash\n\t\t...toTokenInfo(providerId, sessionToken, sessionInfo),\n\t\t// use the actual token used for the request\n\t\taccessToken: accessToken,\n\t\tconnectionId: session.id,\n\t};\n}\n\nexport type TokenOptInfo<T extends IntegrationIds = IntegrationIds> =\n\t| TokenWithInfo<T>\n\t// `connectionId` targets a specific connection (multi-account) when the token still has to be resolved.\n\t// Omitted resolves the provider's primary connection, preserving the pre-multi-account behavior.\n\t| { providerId: T; accessToken?: undefined; connectionId?: string };\n\nexport interface ConfiguredIntegrationDescriptor {\n\t/**\n\t * Stable per-connection identifier, distinct from the domain, so multiple accounts can be\n\t * connected to the same provider+domain simultaneously. For legacy/migrated single connections\n\t * this is the domain (self-managed) or the provider's canonical domain (cloud), which keeps the\n\t * existing secret key (`integration.auth[.cloud]:{id}|{domain}`) valid with zero migration.\n\t */\n\treadonly id: string;\n\t/**\n\t * Whether this is the connection used by default for the provider. Optional: when no descriptor\n\t * for a provider+domain carries an explicit flag, the first one is treated as primary. Only\n\t * {@link ConfiguredIntegrationService.setPrimaryConnection} sets the flag (and clears it on siblings).\n\t */\n\treadonly primary?: boolean;\n\t/** The connection's auth type (`oauth`/`pat`), when known. */\n\treadonly type?: CloudIntegrationAuthType;\n\t/**\n\t * Human-readable account handle for this connection (e.g. the GitHub login). Resolved from the\n\t * provider API (the token backend doesn't expose it); absent until resolved or if the lookup fails.\n\t */\n\treadonly accountName?: string;\n\t/**\n\t * Workspace the connection's token was granted for (Linear), separate from the person. Resolved with the\n\t * connection's own token and kept by connection id; both are set together, or neither is.\n\t */\n\treadonly resourceName?: string;\n\treadonly resourceId?: string;\n\treadonly cloud: boolean;\n\treadonly integrationId: IntegrationIds;\n\treadonly scopes: string;\n\treadonly domain?: string;\n\t/**\n\t * The address this connection was configured with, path included — see\n\t * {@link ProviderAuthenticationSession.baseUrl}.\n\t *\n\t * Mirrored onto the descriptor so reconciliation can tell a re-pointed connection from an unchanged one\n\t * without reading its secret: {@link domain} is normalized to a bare host, so a backend connection moved\n\t * from one context path to another on the SAME host looks identical by domain alone.\n\t */\n\treadonly baseUrl?: string;\n\treadonly expiresAt?: string | Date;\n}\n\nexport interface CloudIntegrationAuthenticationSession {\n\ttype: CloudIntegrationAuthType;\n\taccessToken: string;\n\tdomain: string;\n\texpiresIn: number;\n\tscopes: string;\n\t/** Backend per-connection token identifier, when the provider-tokens backend supports multi-account. */\n\tid?: string;\n\t/** Provider app key paired with the token (e.g. Trello app key), when the backend supplies one. */\n\tappKey?: string;\n}\n\nexport interface CloudIntegrationAuthorization {\n\turl: string;\n}\n\n/** Workspace a connection's token was granted for; only ever a complete pair. */\nexport interface ConnectionResource {\n\treadonly id: string;\n\treadonly name: string;\n}\n\nexport interface CloudIntegrationConnection {\n\ttype: CloudIntegrationAuthType;\n\tprovider: CloudIntegrationType;\n\tdomain: string;\n\t/** Backend per-connection token identifier, when the provider-tokens backend supports multi-account. */\n\tid?: string;\n\t/** Whether the backend marks this connection as the primary/default for the provider. */\n\tprimary?: boolean;\n\t/** Human-readable account handle, when the backend provides it on the connection (may be absent). */\n\taccountName?: string;\n}\n\nexport type CloudIntegrationType =\n\t| 'jira'\n\t| 'jiraServer'\n\t| 'linear'\n\t| 'trello'\n\t| 'asana'\n\t| 'gitlab'\n\t| 'github'\n\t| 'bitbucket'\n\t| 'bitbucketServer'\n\t| 'azure'\n\t| 'azureDevopsServer'\n\t| 'githubEnterprise'\n\t| 'gitlabSelfHosted';\n\nexport type CloudIntegrationAuthType = 'oauth' | 'pat';\n\n/** Returns all supported cloud integration ids. */\nexport function getSupportedCloudIntegrationIds(): readonly SupportedCloudIntegrationIds[] {\n\t// Return the shared const directly (readonly so callers can't mutate it) — this runs on hot,\n\t// per-integration membership paths, so avoid allocating a fresh array per call.\n\treturn supportedOrderedCloudIntegrationIds;\n}\n\n/** Whether `id` is a supported cloud integration id. */\nexport function isSupportedCloudIntegrationId(id: string): id is SupportedCloudIntegrationIds {\n\treturn getSupportedCloudIntegrationIds().includes(id as SupportedCloudIntegrationIds);\n}\n\nexport function isIssueCloudIntegrationId(id: string): id is IssuesCloudHostIntegrationId {\n\tconst issueIds: string[] = Object.values(IssuesCloudHostIntegrationId);\n\treturn issueIds.includes(id);\n}\n\nexport const toIntegrationId: { [key in CloudIntegrationType]: IntegrationIds } = {\n\tjira: IssuesCloudHostIntegrationId.Jira,\n\tjiraServer: IssuesSelfManagedHostIntegrationId.JiraServer,\n\tlinear: IssuesCloudHostIntegrationId.Linear,\n\ttrello: IssuesCloudHostIntegrationId.Trello,\n\tasana: IssuesCloudHostIntegrationId.Asana,\n\tgitlab: GitCloudHostIntegrationId.GitLab,\n\tgithub: GitCloudHostIntegrationId.GitHub,\n\tgithubEnterprise: GitSelfManagedHostIntegrationId.CloudGitHubEnterprise,\n\tgitlabSelfHosted: GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted,\n\tbitbucket: GitCloudHostIntegrationId.Bitbucket,\n\tbitbucketServer: GitSelfManagedHostIntegrationId.BitbucketServer,\n\tazure: GitCloudHostIntegrationId.AzureDevOps,\n\tazureDevopsServer: GitSelfManagedHostIntegrationId.AzureDevOpsServer,\n};\n\nexport const toCloudIntegrationType: { [key in IntegrationIds]: CloudIntegrationType | undefined } = {\n\t[IssuesCloudHostIntegrationId.Jira]: 'jira',\n\t[IssuesSelfManagedHostIntegrationId.JiraServer]: 'jiraServer',\n\t[IssuesCloudHostIntegrationId.Linear]: 'linear',\n\t[IssuesCloudHostIntegrationId.Trello]: 'trello',\n\t[IssuesCloudHostIntegrationId.Asana]: 'asana',\n\t[GitCloudHostIntegrationId.GitLab]: 'gitlab',\n\t[GitCloudHostIntegrationId.GitHub]: 'github',\n\t[GitCloudHostIntegrationId.Bitbucket]: 'bitbucket',\n\t[GitCloudHostIntegrationId.AzureDevOps]: 'azure',\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: 'azureDevopsServer',\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: 'githubEnterprise',\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: 'gitlabSelfHosted',\n\t[GitSelfManagedHostIntegrationId.BitbucketServer]: 'bitbucketServer',\n};\n"],"mappings":";;;AA0DA,SAAgB,cAAc,OAA0C;CACvE,IAAI,SAAS,MAAM,OAAO;CAE1B,MAAM,OAAO,IAAI,KAAK,KAAK,CAAC,CAAC,QAAQ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A;EACI,4BAAA;EACA,6BAAA;EACN,qBAAA;AACpD"}
@@ -1,23 +1,38 @@
1
1
  import { Event } from "../../../utils/event.js";
2
- import { ProviderAuthenticationSession, SessionPublication } from "./models.js";
2
+ import { ProviderAuthenticationSession, RelationshipSessionGuard, SessionPublication } from "./models.js";
3
+ import { IntegrationIds } from "../constants.js";
3
4
  import { GetSessionOptions, IntegrationAuthenticationProvider, IntegrationAuthenticationSessionDescriptor } from "./integrationAuthenticationProvider.js";
5
+ import { ConfiguredIntegrationService } from "./configuredIntegrationService.js";
4
6
  //#region ../plus/integrations/src/authentication/observedAuthenticationProvider.d.ts
5
7
  export declare class ObservedAuthenticationProvider implements IntegrationAuthenticationProvider {
6
8
  private readonly host;
7
9
  private readonly selfManaged;
8
10
  private readonly publish;
11
+ private readonly configured?;
9
12
  private readonly observations;
10
13
  private readonly credentials;
11
14
  private readonly descriptorRetirements;
12
15
  private readonly actualRetirements;
13
16
  private readonly hostRetirements;
14
17
  private readonly activeRetirements;
18
+ private readonly claimWitnesses;
19
+ private readonly issuances;
15
20
  private sequence;
16
21
  private globalRetirement;
17
22
  private disposed;
18
- constructor(host: IntegrationAuthenticationProvider, selfManaged: boolean, publish: (publication: SessionPublication, domains: (string | undefined)[]) => void);
23
+ private hostChanges;
24
+ private hostObserver?;
25
+ constructor(host: IntegrationAuthenticationProvider, selfManaged: boolean, publish: (publication: SessionPublication, domains: (string | undefined)[]) => void, configured?: {
26
+ id: IntegrationIds;
27
+ store: ConfiguredIntegrationService;
28
+ } | undefined);
19
29
  get onDidChange(): Event<void>;
30
+ captureRelationshipSession(descriptor: IntegrationAuthenticationSessionDescriptor): (session: ProviderAuthenticationSession) => RelationshipSessionGuard & {
31
+ isRetired: () => boolean;
32
+ };
20
33
  getSession(descriptor: IntegrationAuthenticationSessionDescriptor, options?: GetSessionOptions): Promise<ProviderAuthenticationSession | undefined>;
34
+ /** KEEP: fails closed for a session this provider did not issue, since its changes cannot be proven absent. */
35
+ trackSession(session: ProviderAuthenticationSession): () => boolean;
21
36
  deleteSession(descriptor: IntegrationAuthenticationSessionDescriptor, options?: {
22
37
  preserveConfigured?: boolean;
23
38
  signOutMark?: number;
@@ -1,6 +1,6 @@
1
1
  import { CancellationError } from "../../../utils/cancellation.js";
2
2
  import { areDomainsOnSameHost, hostFromDomain } from "../utils/domain.utils.js";
3
- import { getSessionIdentity } from "./models.js";
3
+ import { getSessionIdentity, isSameAuthenticationSession, sessionExpiry } from "./models.js";
4
4
  //#region ../plus/integrations/src/authentication/observedAuthenticationProvider.ts
5
5
  function domainKey(domain) {
6
6
  return hostFromDomain(domain) ?? domain;
@@ -23,26 +23,67 @@ var ObservedAuthenticationProvider = class {
23
23
  host;
24
24
  selfManaged;
25
25
  publish;
26
+ configured;
26
27
  observations = /* @__PURE__ */ new Map();
27
28
  credentials = /* @__PURE__ */ new Map();
28
29
  descriptorRetirements = /* @__PURE__ */ new Map();
29
30
  actualRetirements = /* @__PURE__ */ new Map();
30
31
  hostRetirements = /* @__PURE__ */ new Map();
31
32
  activeRetirements = /* @__PURE__ */ new Set();
33
+ claimWitnesses = /* @__PURE__ */ new Map();
34
+ issuances = /* @__PURE__ */ new WeakMap();
32
35
  sequence = 0;
33
36
  globalRetirement = 0;
34
37
  disposed = false;
35
- constructor(host, selfManaged, publish) {
38
+ hostChanges = 0;
39
+ hostObserver;
40
+ constructor(host, selfManaged, publish, configured) {
36
41
  this.host = host;
37
42
  this.selfManaged = selfManaged;
38
43
  this.publish = publish;
44
+ this.configured = configured;
39
45
  }
40
46
  get onDidChange() {
41
47
  return this.host.onDidChange;
42
48
  }
49
+ captureRelationshipSession(descriptor) {
50
+ if (this.disposed) throw new CancellationError();
51
+ if (this.hostObserver == null) {
52
+ const observer = this.host.onDidChange(() => this.hostChanges++);
53
+ if (this.disposed) {
54
+ observer.dispose();
55
+ throw new CancellationError();
56
+ }
57
+ this.hostObserver = observer;
58
+ }
59
+ const generation = this.hostChanges;
60
+ const request = this.sequence;
61
+ return (session) => {
62
+ const key = actualKey(session.domain || descriptor.domain, session.id, session.cloud);
63
+ const identity = getSessionIdentity(session);
64
+ const accountId = session.account?.id;
65
+ const tenure = this.credentials.get(key)?.tenure;
66
+ const isRetired = () => generation !== this.hostChanges || this.isRetired(request, descriptor, session);
67
+ const isCurrent = () => {
68
+ const latest = this.credentials.get(key);
69
+ return !isRetired() && latest != null && latest.tenure === tenure && latest.identity === identity && latest.accountId === accountId && latest.expiry > Date.now();
70
+ };
71
+ return {
72
+ isCurrent,
73
+ isRetired,
74
+ verify: async () => {
75
+ if (!isCurrent()) return false;
76
+ const latest = await this.getSession(descriptor);
77
+ if (latest == null || !isSameAuthenticationSession(latest, session)) return false;
78
+ return isCurrent();
79
+ }
80
+ };
81
+ };
82
+ }
43
83
  async getSession(descriptor, options) {
44
84
  if (this.disposed) return void 0;
45
85
  const request = ++this.sequence;
86
+ const logout = this.configured?.store.lastCloudLogout ?? 0;
46
87
  const scope = JSON.stringify([
47
88
  descriptor.connectionId,
48
89
  domainKey(descriptor.domain),
@@ -51,7 +92,7 @@ var ObservedAuthenticationProvider = class {
51
92
  ]);
52
93
  const { isRejectedToken, ...hostOptions } = options ?? {};
53
94
  const source = await this.host.getSession(descriptor, isRejectedToken == null ? options : hostOptions);
54
- if (source != null && this.selfManaged && !areDomainsOnSameHost(descriptor.domain, source.domain) || this.isRetired(request, descriptor, source)) {
95
+ if (source?.cloud && this.configured?.store.hasCloudLogout && !await this.configured.store.confirmHostCloudSession(this.configured.id, source, logout) || source != null && this.selfManaged && !areDomainsOnSameHost(descriptor.domain, source.domain) || this.isRetired(request, descriptor, source)) {
55
96
  isRejectedToken?.(void 0);
56
97
  throw new CancellationError();
57
98
  }
@@ -60,7 +101,7 @@ var ObservedAuthenticationProvider = class {
60
101
  const sessionKey = source == null ? previous?.sessionKey ?? (descriptor.connectionId ? actualKey(descriptor.domain, descriptor.connectionId, descriptor.cloud ?? true) : void 0) : actualKey(source.domain || descriptor.domain, source.id, source.cloud);
61
102
  const credential = sessionKey == null ? void 0 : this.credentials.get(sessionKey);
62
103
  const latest = credential != null && (previous == null || credential.request > previous.request) ? credential : previous;
63
- if (latest != null && latest.request > request && latest.identity !== identity) {
104
+ if (latest != null && latest.request > request && (latest.identity !== identity || isRejectedToken != null && latest.accountId !== source?.account?.id)) {
64
105
  isRejectedToken?.(void 0);
65
106
  throw new CancellationError();
66
107
  }
@@ -81,21 +122,30 @@ var ObservedAuthenticationProvider = class {
81
122
  protocol: source.protocol,
82
123
  appKey: source.appKey
83
124
  };
84
- if (latest == null || latest.request <= request) {
85
- if (previous == null || previous.identity !== identity || credential?.identity !== identity) this.publish({
86
- session,
87
- previousSessionId: latest?.sessionId ?? descriptor.connectionId,
88
- connectionId: descriptor.connectionId,
89
- cloud: session != null ? session.cloud : latest?.cloud ?? descriptor.cloud,
90
- replacePrimary: !descriptor.connectionId
91
- }, [
92
- descriptor.domain,
93
- session?.domain,
94
- previous?.actualDomain
95
- ]);
125
+ const claims = [`descriptor:${descriptorKey(descriptor.domain, descriptor.connectionId, descriptor.cloud)}`, ...sessionKey != null ? [`actual:${sessionKey}`] : []];
126
+ const witness = source == null ? void 0 : JSON.stringify([identity, source.account?.id]);
127
+ const accepted = latest == null || latest.request <= request;
128
+ if (accepted && claims.every((claim) => (this.claimWitnesses.get(claim)?.request ?? 0) <= request)) for (const claim of claims) {
129
+ const current = this.claimWitnesses.get(claim);
130
+ this.claimWitnesses.set(claim, {
131
+ mark: current != null && current.witness === witness ? current.mark : ++this.sequence,
132
+ request,
133
+ witness
134
+ });
135
+ }
136
+ if (session != null && claims.every((claim) => this.claimWitnesses.get(claim)?.witness === witness)) this.issuances.set(session, {
137
+ mark: this.sequence,
138
+ logout,
139
+ claims,
140
+ descriptor
141
+ });
142
+ if (accepted) {
96
143
  const observation = {
97
144
  request,
98
145
  identity,
146
+ accountId: source?.account?.id,
147
+ expiry: sessionExpiry(source?.expiresAt),
148
+ tenure: credential != null && credential.identity === identity && credential.accountId === source?.account?.id ? credential.tenure : request,
99
149
  descriptorDomain: descriptor.domain,
100
150
  actualDomain: session?.domain || descriptor.domain,
101
151
  cloud: session?.cloud ?? descriptor.cloud,
@@ -105,9 +155,26 @@ var ObservedAuthenticationProvider = class {
105
155
  };
106
156
  this.observations.set(scope, observation);
107
157
  if (sessionKey != null) this.credentials.set(sessionKey, observation);
158
+ if (previous == null || previous.identity !== identity || credential?.identity !== identity) this.publish({
159
+ session,
160
+ previousSessionId: latest?.sessionId ?? descriptor.connectionId,
161
+ connectionId: descriptor.connectionId,
162
+ cloud: session != null ? session.cloud : latest?.cloud ?? descriptor.cloud,
163
+ replacePrimary: !descriptor.connectionId
164
+ }, [
165
+ descriptor.domain,
166
+ session?.domain,
167
+ previous?.actualDomain
168
+ ]);
108
169
  }
109
170
  return session;
110
171
  }
172
+ /** KEEP: fails closed for a session this provider did not issue, since its changes cannot be proven absent. */
173
+ trackSession(session) {
174
+ const issuance = this.issuances.get(session);
175
+ if (issuance == null) return () => true;
176
+ return () => this.configured != null && (this.configured.store.getCloudDeparture(this.configured.id, session) ?? 0) > issuance.logout || issuance.claims.some((claim) => (this.claimWitnesses.get(claim)?.mark ?? 0) > issuance.mark) || this.isRetired(issuance.mark, issuance.descriptor, session);
177
+ }
111
178
  async deleteSession(descriptor, options) {
112
179
  const retirement = this.retireConnection(descriptor);
113
180
  this.activeRetirements.add(retirement);
@@ -131,6 +198,7 @@ var ObservedAuthenticationProvider = class {
131
198
  dispose() {
132
199
  if (this.disposed) return;
133
200
  this.disposed = true;
201
+ this.hostObserver?.dispose();
134
202
  this.retireAll();
135
203
  this.host.dispose();
136
204
  }
@@ -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,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K,eAAe,UAAU;EAC9B,OAAO;CACR;CAEA,UAAkB,YAAwB,aAAgC;EACzE,WAAW,YAAY,IACtB,cAAc,YAAY,kBAAkB,YAAY,cAAc,YAAY,KAAK,CACxF;EACA,IAAI,YAAY,aAAa,MAC5B,WAAW,QAAQ,IAAI,UAAU,YAAY,cAAc,YAAY,WAAW,YAAY,KAAK,CAAC;CAEtG;CAEA,cAAsB,SAA8B;EACnD,MAAM,UAAU,IAAI,IAAI,OAAO;EAC/B,KAAK,MAAM,CAAC,KAAK,gBAAgB,KAAK,cACrC,IAAI,QAAQ,IAAI,WAAW,GAC1B,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 { Disposable } from '@gitlens/utils/disposable.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { areDomainsOnSameHost, hostFromDomain } from '../utils/domain.utils.js';\nimport type { ConfiguredIntegrationService } from './configuredIntegrationService.js';\nimport type {\n\tGetSessionOptions,\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession, RelationshipSessionGuard, SessionPublication } from './models.js';\nimport { getSessionIdentity, isSameAuthenticationSession, sessionExpiry } from './models.js';\n\ntype Observation = {\n\trequest: number;\n\tidentity: string | undefined;\n\taccountId?: string;\n\texpiry: number;\n\ttenure: number;\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\tlogout: 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\tprivate hostChanges = 0;\n\tprivate hostObserver?: Disposable;\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\tprivate readonly configured?: { id: IntegrationIds; store: ConfiguredIntegrationService },\n\t) {}\n\n\tget onDidChange(): Event<void> {\n\t\treturn this.host.onDidChange;\n\t}\n\n\tcaptureRelationshipSession(\n\t\tdescriptor: IntegrationAuthenticationSessionDescriptor,\n\t): (session: ProviderAuthenticationSession) => RelationshipSessionGuard & { isRetired: () => boolean } {\n\t\tif (this.disposed) throw new CancellationError();\n\n\t\tif (this.hostObserver == null) {\n\t\t\tconst observer = this.host.onDidChange(() => this.hostChanges++);\n\t\t\tif (this.disposed) {\n\t\t\t\tobserver.dispose();\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\n\t\t\tthis.hostObserver = observer;\n\t\t}\n\t\tconst generation = this.hostChanges;\n\t\tconst request = this.sequence;\n\t\treturn session => {\n\t\t\tconst key = actualKey(session.domain || descriptor.domain, session.id, session.cloud);\n\t\t\tconst identity = getSessionIdentity(session);\n\t\t\tconst accountId = session.account?.id;\n\t\t\tconst tenure = this.credentials.get(key)?.tenure;\n\t\t\tconst isRetired = () => generation !== this.hostChanges || this.isRetired(request, descriptor, session);\n\t\t\tconst isCurrent = () => {\n\t\t\t\tconst latest = this.credentials.get(key);\n\t\t\t\treturn (\n\t\t\t\t\t!isRetired() &&\n\t\t\t\t\tlatest != null &&\n\t\t\t\t\tlatest.tenure === tenure &&\n\t\t\t\t\tlatest.identity === identity &&\n\t\t\t\t\tlatest.accountId === accountId &&\n\t\t\t\t\tlatest.expiry > Date.now()\n\t\t\t\t);\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tisCurrent: isCurrent,\n\t\t\t\tisRetired: isRetired,\n\t\t\t\tverify: async () => {\n\t\t\t\t\tif (!isCurrent()) return false;\n\n\t\t\t\t\tconst latest = await this.getSession(descriptor);\n\t\t\t\t\tif (latest == null || !isSameAuthenticationSession(latest, session)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn isCurrent();\n\t\t\t\t},\n\t\t\t};\n\t\t};\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 logout = this.configured?.store.lastCloudLogout ?? 0;\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?.cloud &&\n\t\t\t\tthis.configured?.store.hasCloudLogout &&\n\t\t\t\t!(await this.configured.store.confirmHostCloudSession(this.configured.id, source, logout))) ||\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 (\n\t\t\tlatest != null &&\n\t\t\tlatest.request > request &&\n\t\t\t(latest.identity !== identity || (isRejectedToken != null && latest.accountId !== source?.account?.id))\n\t\t) {\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}\n\t\tif (session != null && claims.every(claim => this.claimWitnesses.get(claim)?.witness === witness)) {\n\t\t\tthis.issuances.set(session, {\n\t\t\t\tmark: this.sequence,\n\t\t\t\tlogout: logout,\n\t\t\t\tclaims: claims,\n\t\t\t\tdescriptor: descriptor,\n\t\t\t});\n\t\t}\n\n\t\tif (accepted) {\n\t\t\tconst observation: Observation = {\n\t\t\t\trequest: request,\n\t\t\t\tidentity: identity,\n\t\t\t\taccountId: source?.account?.id,\n\t\t\t\texpiry: sessionExpiry(source?.expiresAt),\n\t\t\t\ttenure:\n\t\t\t\t\tcredential != null &&\n\t\t\t\t\tcredential.identity === identity &&\n\t\t\t\t\tcredential.accountId === source?.account?.id\n\t\t\t\t\t\t? credential.tenure\n\t\t\t\t\t\t: request,\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\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\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\t(this.configured != null &&\n\t\t\t\t(this.configured.store.getCloudDeparture(this.configured.id, session) ?? 0) > issuance.logout) ||\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.hostObserver?.dispose();\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":";;;;AA0CA,SAAS,UAAU,QAAwB;CAC1C,OAAO,eAAe,MAAM,KAAK;AAClC;AAEA,SAAS,cAAc,QAAgB,cAAkC,OAAoC;CAC5G,O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,KAAK,kBAAkB,IAAI,KAAK,IAAI;CAEtC;AACD"}
@@ -16,8 +16,9 @@ import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, Integration
16
16
  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
+ import { CaptureRelationshipCurrency, IssueRelationshipFailure, IssueRelationshipPin, IssueRelationshipReceipt, IssueRelationshipWriteOptions, IssueRelationshipWriteResult, IssueRelationshipsOptions, IssueRelationshipsResult } from "./models/issueRelationships.js";
19
20
  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";
21
+ 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
22
  import { IssueFilter } from "./providerFilters.js";
22
23
  import { IssueEtagInclude, PullRequestEtagInclude } from "./reads/etag.js";
23
24
  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 +108,5 @@ export interface IntegrationManagerContext {
107
108
  */
108
109
  export declare function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager;
109
110
  //#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 };
111
+ 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 CaptureRelationshipCurrency, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, type CurrentAccountResult, type DynamicAutolinkReference, type EntityIdentifier, type EntityIdentifierFields, type EntityIdentifierInput, EntityIdentifierProviderType, EntityType, EntityVersion, type FieldPresence, type GetAutolinkReferencesOptions, GitCloudHostIntegrationId, type GitConfigEntityIdentifier, type GitHostIntegration, 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 IssueRelationshipFailure, type IssueRelationshipPin, type IssueRelationshipReceipt, type IssueRelationshipWriteOptions, type IssueRelationshipWriteResult, type IssueRelationshipsOptions, type IssueRelationshipsResult, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, type IssueTrackerCreateOptions, type IssueTrackerCreateOptionsResult, type IssueTrackerDeleteOptions, type IssueTrackerField, type IssueTrackerIssueReceipt, type IssueTrackerIssueWriteOptions, type IssueTrackerIssueWriteOptionsResult, type IssueTrackerStatus, type IssueTrackerTransition, type IssueTrackerWriteConnection, type IssueTrackerWriteFailure, type IssueTrackerWriteOptions, type IssueTrackerWriteResult, type IssueTrackerWriteTargetOptions, type IssueTrackerWriteTargetResult, type IssueWriteOptions, type IssueWriteResult, type IssueWriteTargetOptions, type IssueWriteTargetResult, IssuesCloudHostIntegrationId, type IssuesIntegration, IssuesSelfManagedHostIntegrationId, type 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
112
  //# 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,0BAA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,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;;;;;;;;;;;;;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 {\n\tCaptureRelationshipCurrency,\n\tIssueRelationshipsOptions,\n\tIssueRelationshipsResult,\n\tIssueRelationshipWriteOptions,\n\tIssueRelationshipWriteResult,\n\tIssueRelationshipPin,\n\tIssueRelationshipReceipt,\n\tIssueRelationshipFailure,\n} from './models/issueRelationships.js';\nexport type { IssueWriteResult } from '@gitlens/git-github/api/issueWrites.js';\nexport type {\n\tPullRequestCreateCapabilityResult,\n\tPullRequestWriteFailure,\n\tPullRequestWriteResult,\n\tPullRequestWriteSnapshot,\n\tPullRequestWriteTargetResult,\n} from '@gitlens/git-github/api/pullRequestWrites.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\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,WAAW,aAAa,MAAM;CAEhE,0BAA0B,CAAC;AAC5B;;;;;;AAOA,SAAS,2BAA2B,OAA8E;CACjH,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,wBAAwB,MAAM,aAAa,QAAQ,YAClD,MAAM,yBAAyB,OAC5B,MAAM,sBAAsB,MAAM,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IACjF,aAAa,MAAM;EACvB,6BAA6B,MAAM,aAAa,QAAQ,YACvD,MAAM,8BAA8B,OACjC,MAAM,2BAA2B,MAAM,kBAAkB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