@cloudflare/workers-auth 0.15.6 → 0.17.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.
@@ -1,7 +1,7 @@
1
1
  import { b as ConfigStorage, A as AuthConfigStorage, U as UserAuthConfig, g as OAuthFlowContext, h as ProfileStore } from '../authentication-error-DcqALFv6.mjs';
2
2
  export { a as AuthenticationError } from '../authentication-error-DcqALFv6.mjs';
3
- import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-DGkctqNO.mjs';
4
- export { b as CloudflareLoginProps } from '../keyring-preference-DGkctqNO.mjs';
3
+ import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-BUyxOJDK.mjs';
4
+ export { b as CloudflareLoginProps } from '../keyring-preference-BUyxOJDK.mjs';
5
5
  import '@cloudflare/workers-utils';
6
6
 
7
7
  /**
@@ -15,12 +15,12 @@ declare const defaultAuthConfigStorage: (profile?: string) => AuthConfigStorage;
15
15
  declare const readAuthConfigFile: (profile?: string) => UserAuthConfig | undefined;
16
16
  declare const writeAuthConfigFile: (config: UserAuthConfig, profile?: string) => void;
17
17
 
18
- declare const CF_CLIENT_REGISTERED_SCOPES: readonly ["access:read", "access:write", "account:read", "account_api_tokens:create", "agw:read", "agw:run", "agw:write", "ai:read", "ai:write", "ai-search:read", "ai-search:run", "ai-search:write", "aiaudit:read", "aiaudit:write", "aig:read", "aig:write", "auditlogs:read", "billing:read", "billing:write", "browser:read", "browser:write", "cfone:read", "cfone:write", "cloudchamber:write", "connectivity:admin", "connectivity:bind", "connectivity:read", "constellation:write", "containers:write", "d1:write", "dex:read", "dex:write", "dns_analytics:read", "dns_records:edit", "dns_records:read", "dns_settings:read", "email_routing:read", "email_routing:write", "email_sending:read", "email_sending:write", "firstpartytags:write", "hyperdrive-planetscale:setup", "images:read", "images:write", "lb:edit", "lb:read", "logpush:read", "logpush:write", "mcp_portals:read", "mcp_portals:write", "notebook-examples:read", "notebook-managed:read", "notification:read", "notification:write", "oauth_account_ssl_and_certificates_write", "offline", "openid", "pages:read", "pages:write", "pipelines:read", "pipelines:setup", "pipelines:write", "query_cache:write", "queues:write", "r2_catalog:write", "radar:read", "rag:read", "rag:write", "registrar:read", "registrar:write", "secrets_store:read", "secrets_store:write", "sso-connector:read", "sso-connector:write", "ssl_certs:write", "teams:pii", "teams:read", "teams:secure_location", "teams:write", "url_scanner:read", "url_scanner:write", "user:read", "vectorize:write", "workers:read", "workers:write", "workers_builds:read", "workers_builds:write", "workers_deployments:read", "workers_kv:write", "workers_observability:read", "workers_observability:write", "workers_observability_telemetry:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "zone:read", "account-analytics.read", "account-ssl-and-certificates.write", "ssl-and-certificates.read", "ssl-and-certificates.write", "registrar-domains.read", "registrar-domains.admin", "logs.read", "logs.write", "websearch.run", "snippets.read", "snippets.write", "access-acct.read", "access-acct.revoke", "access-acct.write", "access-app.read", "access-app.revoke", "access-app.write", "access-audit-log.read", "access-certificate.read", "access-certificate.write", "access-custom-page.read", "access-custom-page.write", "access-device-posture.read", "access-device-posture.write", "access-group.read", "access-group.write", "access-idp.read", "access-idp.write", "access-key.read", "access-key.write", "access-org.read", "access-org.revoke", "access-org.write", "access-policy-test.read", "access-policy-test.write", "access-policy.read", "access-policy.write", "access-population.read", "access-population.write", "access-saml-certificate.read", "access-saml-certificate.write", "access-scim-log.read", "access-seats.write", "access-service-token.read", "access-service-token.write", "access-ssh-auditing.read", "access-ssh-auditing.write", "access-tag.read", "access-tag.write", "access-users.read", "access-users.write", "access.read", "access.revoke", "access.write", "account-api-gateway.read", "account-api-gateway.write", "account-custom-asset.read", "account-custom-asset.write", "account-custom-error-rules.read", "account-custom-error-rules.write", "account-custom-pages.read", "account-custom-pages.write", "account-disable-esc.read", "account-disable-esc.write", "account-dns-settings.read", "account-dns-settings.write", "account-firewall-access-rules.read", "account-firewall-access-rules.write", "account-logs.read", "account-logs.write", "account-rule-lists.read", "account-rule-lists.write", "account-rulesets.read", "account-rulesets.write", "account-security-center-insights.read", "account-security-center-insights.write", "account-settings.read", "account-settings.write", "account-ssl-and-certificates.read", "account-waf.read", "account-waf.write", "account-waiting-rooms.read", "address-maps.read", "address-maps.write", "agent-memory.write", "agw.read", "agw.run", "agw.write", "ai-search.index", "ai-search.metadata_read", "ai-search.read", "ai-search.run", "ai-search.write", "ai.read", "ai.write", "aiaudit.read", "aiaudit.write", "aig.metadata_read", "aig.read", "aig.run", "aig.write", "analytics.read", "api-gateway.read", "api-gateway.write", "apps.write", "argotunnel.read", "argotunnel.write", "artifacts.read", "artifacts.write", "bot-management-feedback.read", "bot-management-feedback.write", "bot-management.read", "bot-management.write", "browser-rendering.read", "browser-rendering.write", "cache-settings.read", "cache-settings.write", "cache.purge", "calls.read", "calls.write", "casb.read", "casb.write", "cf-agents.read", "cf-agents.write", "challenge-widgets.read", "challenge-widgets.write", "chinanetwork-steering.read", "chinanetwork-steering.write", "cloud-connector.read", "cloud-connector.write", "cloud-email-security.read", "cloud-email-security.write", "cloudchamber.read", "cloudchamber.write", "cloudforce-one.read", "cloudforce-one.write", "config-settings.read", "config-settings.write", "connectivity-directory.admin", "connectivity-directory.bind", "connectivity-directory.read", "constellation.read", "constellation.write", "containers.read", "containers.write", "custom-errors.read", "custom-errors.write", "custom-pages.read", "custom-pages.write", "d1.metadata_read", "d1.read", "d1.write", "ddos-botnet-feed.read", "ddos-botnet-feed.write", "ddos-protection.read", "ddos-protection.write", "dls.read", "dls.write", "dns-firewall.read", "dns-firewall.write", "dns-view.read", "dns-view.write", "dns.read", "dns.write", "domain-page-shield.read", "domain-page.shield", "dynamic-redirect.read", "dynamic-redirect.write", "email-routing-account-rule.read", "email-routing-address.read", "email-routing-address.write", "email-routing-rule.read", "email-routing-rule.write", "email-routing-suppression.read", "email-routing-suppression.write", "email-security-dmarcreports.read", "email-security-dmarcreports.write", "email-sending.read", "email-sending.write", "fbm.admin", "fbm.read", "fbm.write", "field-extractor.read", "field-extractor.write", "firewall-for-ai.read", "firewall-for-ai.write", "firewall-services.read", "firewall-services.write", "flagship.evaluate", "flagship.read", "flagship.write", "fraud-detection-pii.read", "fraud-detection.read", "fraud-detection.write", "fraud-events.write", "fraud-feedback.read", "fraud-feedback.write", "healthcheck.read", "healthcheck.write", "http-applications.read", "http-applications.write", "http-ddos-managed-ruleset.read", "http-ddos-managed-ruleset.write", "images.metadata_read", "images.read", "images.write", "integration.write", "intel.read", "intel.write", "iot.read", "iot.write", "ip-prefix-bgp-on-demand.read", "ip-prefix-bgp-on-demand.write", "ip-prefix.read", "ip-prefix.write", "k2.consume", "k2.produce", "k2.read", "k2.write", "l4-ddos-managed-ruleset.read", "l4-ddos-managed-ruleset.write", "load-balancers-account.read", "load-balancers-account.write", "load-balancers.read", "load-balancers.write", "load-balancing-monitors-and-pools.read", "load-balancing-monitors-and-pools.write", "magic-firewall.read", "magic-firewall.write", "magic-transit.read", "magic-transit.write", "magic-wan.read", "magic-wan.write", "managed-headers.read", "managed-headers.write", "mass-url-redirects.read", "mass-url-redirects.write", "mcp-portals.read", "mcp-portals.write", "memberships.read", "memberships.write", "messaging.edit", "messaging.metadata_read", "messaging.read", "moq.read", "moq.write", "notifications.read", "notifications.write", "origin.read", "origin.write", "page-rules.read", "page-rules.write", "page-shield.read", "page.read", "page.shield", "page.write", "pages.metadata_read", "payments-gateway.read", "payments-gateway.write", "pcaps-api.read", "pcaps-api.write", "pipelines.read", "pipelines.send", "pipelines.write", "precursor.read", "precursor.write", "pubsub.read", "pubsub.write", "query-cache.read", "query-cache.write", "queues.metadata_read", "queues.read", "queues.write", "r2-catalog-sql.read", "r2-catalog.read", "r2-catalog.write", "radar.read", "rag.read", "rag.run", "rag.write", "realtime.admin", "realtime.read", "realtime.write", "registrar-sandbox-domains.admin", "registrar-sandbox-domains.read", "reports-application-security-report.read", "request-tracer.read", "resource-library.read", "resource-library.write", "resource-sharing.read", "response-compression.read", "response-compression.write", "sanitize.read", "sanitize.write", "secrets-store.read", "secrets-store.write", "select-configuration.read", "select-configuration.write", "stream.metadata_read", "stream.read", "stream.write", "tag.read", "tag.write", "teams-cds-compute-account.read", "teams-cds-compute-account.write", "teams-connector-cloudflared.monitoring", "teams-connector-cloudflared.read", "teams-connector-cloudflared.write", "teams-connector-warp.read", "teams-connector-warp.write", "teams-connectors.read", "teams-connectors.write", "teams-dex.read", "teams-dex.write", "teams-networks.read", "teams-networks.write", "teams-pii.read", "teams-resilience.read", "teams-resilience.write", "teams-secure.location", "teams.read", "teams.report", "teams.write", "transform-rules.read", "transform-rules.write", "trust-and-safety.read", "trust-and-safety.write", "url-scanner.read", "url-scanner.write", "user-api-tokens.write", "user-details.read", "user-details.write", "vectorize.read", "vectorize.write", "waiting-rooms.read", "waiting-rooms.write", "web3-hostnames.read", "web3-hostnames.write", "websearch.metadata_read", "websearch.read", "websearch.write", "workers-ci.read", "workers-ci.write", "workers-kv-storage.metadata_read", "workers-kv-storage.read", "workers-kv-storage.write", "workers-observability-telemetry.write", "workers-observability.read", "workers-observability.write", "workers-r2-bucket-item.read", "workers-r2-bucket-item.write", "workers-r2.metadata_read", "workers-r2.read", "workers-r2.write", "workers-routes.read", "workers-routes.write", "workers-scripts.bind", "workers-scripts.read", "workers-scripts.write", "workers-tail.read", "workers_ai.metadata_read", "zaraz.edit", "zaraz.read", "zaraz.write", "zone-access.read", "zone-access.revoke", "zone-access.write", "zone-custom-asset.read", "zone-custom-asset.write", "zone-disable-esc.read", "zone-disable-esc.write", "zone-dns-settings.read", "zone-dns-settings.write", "zone-observability.read", "zone-observability.write", "zone-security-center-insights.read", "zone-security-center-insights.write", "zone-settings.read", "zone-settings.write", "zone-transform-rules.read", "zone-transform-rules.write", "zone-versioning.read", "zone-versioning.write", "zone-waf.read", "zone-waf.write", "zone.read", "zone.write"];
18
+ declare const CF_CLIENT_REGISTERED_SCOPES: readonly ["access:read", "access:write", "account:read", "account_api_tokens:create", "agw:read", "agw:run", "agw:write", "ai:read", "ai:write", "ai-search:read", "ai-search:run", "ai-search:write", "aiaudit:read", "aiaudit:write", "aig:read", "aig:write", "auditlogs:read", "billing:read", "billing:write", "browser:read", "browser:write", "cfone:read", "cfone:write", "cloudchamber:write", "connectivity:admin", "connectivity:bind", "connectivity:read", "constellation:write", "containers:write", "d1:write", "dex:read", "dex:write", "dns_analytics:read", "dns_records:edit", "dns_records:read", "dns_settings:read", "email_routing:read", "email_routing:write", "email_sending:read", "email_sending:write", "firstpartytags:write", "images:read", "images:write", "lb:edit", "lb:read", "logpush:read", "logpush:write", "mcp_portals:read", "mcp_portals:write", "notebook-examples:read", "notebook-managed:read", "notification:read", "notification:write", "oauth_account_ssl_and_certificates_write", "offline", "openid", "pages:read", "pages:write", "pipelines:read", "pipelines:setup", "pipelines:write", "query_cache:write", "queues:write", "r2_catalog:write", "radar:read", "rag:read", "rag:write", "registrar:read", "registrar:write", "secrets_store:read", "secrets_store:write", "sso-connector:read", "sso-connector:write", "ssl_certs:write", "teams:pii", "teams:read", "teams:secure_location", "teams:write", "url_scanner:read", "url_scanner:write", "user:read", "vectorize:write", "workers:read", "workers:write", "workers_builds:read", "workers_builds:write", "workers_deployments:read", "workers_kv:write", "workers_observability:read", "workers_observability:write", "workers_observability_telemetry:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "zone:read", "account-analytics.read", "account-ssl-and-certificates.write", "ssl-and-certificates.read", "ssl-and-certificates.write", "registrar-domains.read", "registrar-domains.admin", "logs.read", "logs.write", "websearch.run", "snippets.read", "snippets.write", "access-acct.read", "access-acct.revoke", "access-acct.write", "access-app.read", "access-app.revoke", "access-app.write", "access-audit-log.read", "access-certificate.read", "access-certificate.write", "access-custom-page.read", "access-custom-page.write", "access-device-posture.read", "access-device-posture.write", "access-group.read", "access-group.write", "access-idp.read", "access-idp.write", "access-key.read", "access-key.write", "access-org.read", "access-org.revoke", "access-org.write", "access-policy-test.read", "access-policy-test.write", "access-policy.read", "access-policy.write", "access-population.read", "access-population.write", "access-saml-certificate.read", "access-saml-certificate.write", "access-scim-log.read", "access-seats.write", "access-service-token.read", "access-service-token.write", "access-ssh-auditing.read", "access-ssh-auditing.write", "access-tag.read", "access-tag.write", "access-users.read", "access-users.write", "access.read", "access.revoke", "access.write", "account-api-gateway.read", "account-api-gateway.write", "account-custom-asset.read", "account-custom-asset.write", "account-custom-error-rules.read", "account-custom-error-rules.write", "account-custom-pages.read", "account-custom-pages.write", "account-disable-esc.read", "account-disable-esc.write", "account-dns-settings.read", "account-dns-settings.write", "account-firewall-access-rules.read", "account-firewall-access-rules.write", "account-logs.read", "account-logs.write", "account-rule-lists.read", "account-rule-lists.write", "account-rulesets.read", "account-rulesets.write", "account-security-center-insights.read", "account-security-center-insights.write", "account-settings.read", "account-settings.write", "account-ssl-and-certificates.read", "account-waf.read", "account-waf.write", "account-waiting-rooms.read", "address-maps.read", "address-maps.write", "agent-memory.write", "agw.read", "agw.run", "agw.write", "ai-search.index", "ai-search.metadata_read", "ai-search.read", "ai-search.run", "ai-search.write", "ai.read", "ai.write", "aiaudit.read", "aiaudit.write", "aig.metadata_read", "aig.read", "aig.run", "aig.write", "analytics.read", "api-gateway.read", "api-gateway.write", "apps.write", "argotunnel.read", "argotunnel.write", "artifacts.read", "artifacts.write", "bot-management-feedback.read", "bot-management-feedback.write", "bot-management.read", "bot-management.write", "browser-rendering.read", "browser-rendering.write", "cache-settings.read", "cache-settings.write", "cache.purge", "calls.read", "calls.write", "casb.read", "casb.write", "cf-agents.read", "cf-agents.write", "challenge-widgets.read", "challenge-widgets.write", "chinanetwork-steering.read", "chinanetwork-steering.write", "cloud-connector.read", "cloud-connector.write", "cloud-email-security.read", "cloud-email-security.write", "cloudchamber.read", "cloudchamber.write", "cloudforce-one.read", "cloudforce-one.write", "config-settings.read", "config-settings.write", "connectivity-directory.admin", "connectivity-directory.bind", "connectivity-directory.read", "constellation.read", "constellation.write", "containers.read", "containers.write", "custom-errors.read", "custom-errors.write", "custom-pages.read", "custom-pages.write", "d1.metadata_read", "d1.read", "d1.write", "ddos-botnet-feed.read", "ddos-botnet-feed.write", "ddos-protection.read", "ddos-protection.write", "dls.read", "dls.write", "dns-firewall.read", "dns-firewall.write", "dns-view.read", "dns-view.write", "dns.read", "dns.write", "domain-page-shield.read", "domain-page.shield", "dynamic-redirect.read", "dynamic-redirect.write", "email-routing-account-rule.read", "email-routing-address.read", "email-routing-address.write", "email-routing-rule.read", "email-routing-rule.write", "email-routing-suppression.read", "email-routing-suppression.write", "email-security-dmarcreports.read", "email-security-dmarcreports.write", "email-sending.read", "email-sending.write", "fbm.admin", "fbm.read", "fbm.write", "field-extractor.read", "field-extractor.write", "firewall-for-ai.read", "firewall-for-ai.write", "firewall-services.read", "firewall-services.write", "flagship.evaluate", "flagship.read", "flagship.write", "fraud-detection-pii.read", "fraud-detection.read", "fraud-detection.write", "fraud-events.write", "fraud-feedback.read", "fraud-feedback.write", "healthcheck.read", "healthcheck.write", "hyperdrive-planetscale.setup", "http-applications.read", "http-applications.write", "http-ddos-managed-ruleset.read", "http-ddos-managed-ruleset.write", "images.metadata_read", "images.read", "images.write", "integration.write", "intel.read", "intel.write", "iot.read", "iot.write", "ip-prefix-bgp-on-demand.read", "ip-prefix-bgp-on-demand.write", "ip-prefix.read", "ip-prefix.write", "k2.consume", "k2.produce", "k2.read", "k2.write", "l4-ddos-managed-ruleset.read", "l4-ddos-managed-ruleset.write", "load-balancers-account.read", "load-balancers-account.write", "load-balancers.read", "load-balancers.write", "load-balancing-monitors-and-pools.read", "load-balancing-monitors-and-pools.write", "magic-firewall.read", "magic-firewall.write", "magic-transit.read", "magic-transit.write", "magic-wan.read", "magic-wan.write", "managed-headers.read", "managed-headers.write", "mass-url-redirects.read", "mass-url-redirects.write", "mcp-portals.read", "mcp-portals.write", "memberships.read", "memberships.write", "messaging.edit", "messaging.metadata_read", "messaging.read", "moq.read", "moq.write", "notifications.read", "notifications.write", "origin.read", "origin.write", "page-rules.read", "page-rules.write", "page-shield.read", "page.read", "page.shield", "page.write", "pages.metadata_read", "payments-gateway.read", "payments-gateway.write", "pcaps-api.read", "pcaps-api.write", "pipelines.read", "pipelines.send", "pipelines.write", "precursor.read", "precursor.write", "pubsub.read", "pubsub.write", "query-cache.read", "query-cache.write", "queues.metadata_read", "queues.read", "queues.write", "r2-catalog-sql.read", "r2-catalog.read", "r2-catalog.write", "radar.read", "rag.read", "rag.run", "rag.write", "realtime.admin", "realtime.read", "realtime.write", "registrar-sandbox-domains.admin", "registrar-sandbox-domains.read", "reports-application-security-report.read", "request-tracer.read", "resource-library.read", "resource-library.write", "resource-sharing.read", "response-compression.read", "response-compression.write", "sanitize.read", "sanitize.write", "secrets-store.read", "secrets-store.write", "select-configuration.read", "select-configuration.write", "stream.metadata_read", "stream.read", "stream.write", "tag.read", "tag.write", "teams-cds-compute-account.read", "teams-cds-compute-account.write", "teams-connector-cloudflared.monitoring", "teams-connector-cloudflared.read", "teams-connector-cloudflared.write", "teams-connector-warp.read", "teams-connector-warp.write", "teams-connectors.read", "teams-connectors.write", "teams-dex.read", "teams-dex.write", "teams-networks.read", "teams-networks.write", "teams-pii.read", "teams-resilience.read", "teams-resilience.write", "teams-secure.location", "teams.read", "teams.report", "teams.write", "transform-rules.read", "transform-rules.write", "trust-and-safety.read", "trust-and-safety.write", "url-scanner.read", "url-scanner.write", "user-api-tokens.write", "user-details.read", "user-details.write", "vectorize.read", "vectorize.write", "waiting-rooms.read", "waiting-rooms.write", "web3-hostnames.read", "web3-hostnames.write", "websearch.metadata_read", "websearch.read", "websearch.write", "workers-ci.read", "workers-ci.write", "workers-kv-storage.metadata_read", "workers-kv-storage.read", "workers-kv-storage.write", "workers-observability-telemetry.write", "workers-observability.read", "workers-observability.write", "workers-r2-bucket-item.read", "workers-r2-bucket-item.write", "workers-r2.metadata_read", "workers-r2.read", "workers-r2.write", "workers-routes.read", "workers-routes.write", "workers-scripts.bind", "workers-scripts.read", "workers-scripts.write", "workers-tail.read", "workers_ai.metadata_read", "zaraz.edit", "zaraz.read", "zaraz.write", "zone-access.read", "zone-access.revoke", "zone-access.write", "zone-custom-asset.read", "zone-custom-asset.write", "zone-disable-esc.read", "zone-disable-esc.write", "zone-dns-settings.read", "zone-dns-settings.write", "zone-observability.read", "zone-observability.write", "zone-security-center-insights.read", "zone-security-center-insights.write", "zone-settings.read", "zone-settings.write", "zone-transform-rules.read", "zone-transform-rules.write", "zone-versioning.read", "zone-versioning.write", "zone-waf.read", "zone-waf.write", "zone.read", "zone.write"];
19
19
  type ClientRegisteredScope = (typeof CF_CLIENT_REGISTERED_SCOPES)[number];
20
20
  declare const CF_REGISTERED_BUT_UNGRANTABLE_SCOPES: readonly ["billing:read", "billing:write", "email_routing:read", "email_sending:read", "notebook-managed:read", "oauth_account_ssl_and_certificates_write"];
21
21
  type UngrantableScope = (typeof CF_REGISTERED_BUT_UNGRANTABLE_SCOPES)[number];
22
22
  /**
23
- * The possible explicitly requestable keys for a cf Scope.
23
+ * The possible requestable keys for a cf Scope.
24
24
  *
25
25
  * "offline_access" is automatically included.
26
26
  */
package/dist/cf/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'node:module';
2
- import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-YWQXTXOY.mjs';
3
- export { AuthenticationError } from '../chunk-SOBRPAPT.mjs';
2
+ import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-MP32ZADQ.mjs';
3
+ export { AuthenticationError } from '../chunk-H5PZ3FJ2.mjs';
4
4
  import { __name } from '../chunk-VAZEJK55.mjs';
5
5
  import { getEnvironmentVariableFactory, getGlobalConfigPath, getCloudflareApiEnvironmentFromEnv } from '@cloudflare/workers-utils';
6
6
  import path from 'node:path';
@@ -77,7 +77,6 @@ var CF_CLIENT_REGISTERED_SCOPES = [
77
77
  "email_sending:read",
78
78
  "email_sending:write",
79
79
  "firstpartytags:write",
80
- "hyperdrive-planetscale:setup",
81
80
  "images:read",
82
81
  "images:write",
83
82
  "lb:edit",
@@ -331,6 +330,7 @@ var CF_CLIENT_REGISTERED_SCOPES = [
331
330
  "fraud-feedback.write",
332
331
  "healthcheck.read",
333
332
  "healthcheck.write",
333
+ "hyperdrive-planetscale.setup",
334
334
  "http-applications.read",
335
335
  "http-applications.write",
336
336
  "http-ddos-managed-ruleset.read",
@@ -528,21 +528,13 @@ var CF_REGISTERED_BUT_UNGRANTABLE_SCOPES = [
528
528
  "notebook-managed:read",
529
529
  "oauth_account_ssl_and_certificates_write"
530
530
  ];
531
- var CF_EXPLICIT_ONLY_SCOPES = [
532
- "hyperdrive-planetscale:setup"
533
- ];
534
531
  var CF_UNGRANTABLE_SCOPE_SET = new Set(
535
532
  CF_REGISTERED_BUT_UNGRANTABLE_SCOPES
536
533
  );
537
534
  var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter(
538
535
  (scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope)
539
536
  );
540
- var CF_EXPLICIT_ONLY_SCOPE_SET = new Set(
541
- CF_EXPLICIT_ONLY_SCOPES
542
- );
543
- var DefaultScopeKeys = CF_REQUESTABLE_SCOPES.filter(
544
- (scope) => !CF_EXPLICIT_ONLY_SCOPE_SET.has(scope)
545
- );
537
+ var DefaultScopeKeys = [...CF_REQUESTABLE_SCOPES];
546
538
  function setLoginScopeKeys(scopes) {
547
539
  DefaultScopeKeys = scopes;
548
540
  }
@@ -605,9 +597,8 @@ var CF_CLI = {
605
597
  // cf gets its own cache dir (`.cache/cloudflare` / `.cloudflare/cache`) so
606
598
  // `cf auth login`/`logout` never purges wrangler's shared cache.
607
599
  cacheNamespace: "cloudflare",
608
- // cf persists its default account in `config.json` (`defaults.accountId`);
609
- // this label is surfaced in the "set account_id in your <file>" hint.
610
- getConfigFileLabel: /* @__PURE__ */ __name(() => "cf config", "getConfigFileLabel"),
600
+ // This label is surfaced in shared account configuration hints.
601
+ getConfigFileLabel: /* @__PURE__ */ __name(() => "cloudflare.config.ts", "getConfigFileLabel"),
611
602
  getDefaultScopeKeys: /* @__PURE__ */ __name(() => DefaultScopeKeys, "getDefaultScopeKeys")
612
603
  };
613
604
  var cfPreferences = createPreferences(getCfConfigPath);
@@ -114,6 +114,9 @@ function validateAccountId(accountId, source) {
114
114
  __name(validateAccountId, "validateAccountId");
115
115
 
116
116
  // src/env-vars.ts
117
+ var getCloudflareAuthProfileFromEnv = getEnvironmentVariableFactory({
118
+ variableName: "CLOUDFLARE_AUTH_PROFILE"
119
+ });
117
120
  var getAuthDomainFromEnv = getEnvironmentVariableFactory({
118
121
  variableName: "WRANGLER_AUTH_DOMAIN",
119
122
  defaultValue: /* @__PURE__ */ __name(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "dash.staging.cloudflare.com" : "dash.cloudflare.com", "defaultValue")
@@ -2140,12 +2143,13 @@ function createProfileStore(args) {
2140
2143
  configs: args.configs,
2141
2144
  bindings,
2142
2145
  resolve(resolveArgs) {
2143
- if (resolveArgs.profile) {
2144
- if (resolveArgs.profile === "default") {
2146
+ const profile = resolveArgs.profile || getCloudflareAuthProfileFromEnv();
2147
+ if (profile) {
2148
+ if (profile === "default") {
2145
2149
  return "default";
2146
2150
  }
2147
- validateProfileName(resolveArgs.profile);
2148
- return resolveArgs.profile;
2151
+ validateProfileName(profile);
2152
+ return profile;
2149
2153
  }
2150
2154
  const dirProfile = bindings.getProfileForDirectory(resolveArgs.cwd);
2151
2155
  if (dirProfile) {
@@ -3670,4 +3674,4 @@ smol-toml/dist/index.js:
3670
3674
  *)
3671
3675
  */
3672
3676
 
3673
- export { AuthenticationError, DEFAULT_TEMPORARY_ACCOUNT_FLAG, EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, dedent, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, parseFile, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, stringifyFile, validateAccountId, validateProfileName };
3677
+ export { AuthenticationError, DEFAULT_TEMPORARY_ACCOUNT_FLAG, EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, dedent, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthProfileFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, parseFile, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, stringifyFile, validateAccountId, validateProfileName };
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'node:module';
2
- import { stringifyFile, parseFile, dedent, DEFAULT_TEMPORARY_ACCOUNT_FLAG, createCredentialStorageContext, createOAuthFlow, getAuthFromEnv, createProfileStore, AuthenticationError, validateAccountId, getCloudflareAccountIdFromEnv, getAuthConfigFilePath, getEncryptedAuthConfigFilePath, scrubEncryptedCredentials, validateProfileName, getCloudflareAuthUseKeyringFromEnv } from './chunk-SOBRPAPT.mjs';
2
+ import { stringifyFile, parseFile, dedent, DEFAULT_TEMPORARY_ACCOUNT_FLAG, createCredentialStorageContext, createOAuthFlow, getAuthFromEnv, createProfileStore, AuthenticationError, validateAccountId, getCloudflareAccountIdFromEnv, getAuthConfigFilePath, getEncryptedAuthConfigFilePath, scrubEncryptedCredentials, validateProfileName, getCloudflareAuthUseKeyringFromEnv } from './chunk-H5PZ3FJ2.mjs';
3
3
  import { __name } from './chunk-VAZEJK55.mjs';
4
4
  import { existsSync, rmSync, mkdirSync, writeFileSync, chmodSync, readFileSync as readFileSync$1, readdirSync } from 'node:fs';
5
5
  import path3 from 'node:path';
@@ -793,10 +793,22 @@ function createCloudflareAuth(descriptor, ctx) {
793
793
  const NOT_LOGGED_IN_WHOAMI_TIP = `
794
794
  Run \`${descriptor.commands.whoami}\` to check your current authentication status.`;
795
795
  const preferences = createPreferences(descriptor.getConfigPath);
796
+ const persistAccountSelection = descriptor.persistAccountSelection ?? false;
796
797
  const configCache = createConfigCache(
797
798
  logger,
798
799
  descriptor.cacheNamespace ? { namespace: descriptor.cacheNamespace } : void 0
799
800
  );
801
+ let accountSelection;
802
+ let accountSelectionPromise;
803
+ function clearAccountSelection() {
804
+ accountSelection = void 0;
805
+ }
806
+ __name(clearAccountSelection, "clearAccountSelection");
807
+ function purgeAccountCaches() {
808
+ clearAccountSelection();
809
+ configCache.purgeConfigCaches();
810
+ }
811
+ __name(purgeAccountCaches, "purgeAccountCaches");
800
812
  const credentialStorage = createCredentialStorageContext({
801
813
  serviceName: descriptor.keyringServiceName,
802
814
  getConfigPath: descriptor.getConfigPath,
@@ -812,7 +824,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
812
824
  isNonInteractiveOrCI: isNonInteractiveOrCI,
813
825
  openInBrowser: /* @__PURE__ */ __name((url) => openInBrowser(url, logger), "openInBrowser"),
814
826
  hasEnvCredentials: /* @__PURE__ */ __name(() => getAuthFromEnv({ allowGlobalAuthKey }) !== void 0, "hasEnvCredentials"),
815
- purgeOnLoginOrLogout: configCache.purgeConfigCaches,
827
+ purgeOnLoginOrLogout: purgeAccountCaches,
816
828
  clientId: descriptor.clientId,
817
829
  consent: descriptor.consent,
818
830
  cliDisplayName: descriptor.displayName,
@@ -904,6 +916,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
904
916
  }
905
917
  __name(readAuthCredentials, "readAuthCredentials");
906
918
  function writeAuthCredentials(config) {
919
+ clearAccountSelection();
907
920
  credentialStorage.storageFactory(getActiveProfile()).write(config);
908
921
  }
909
922
  __name(writeAuthCredentials, "writeAuthCredentials");
@@ -915,14 +928,34 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
915
928
  return `${descriptor.accountCachePrefix}-${profile}.json`;
916
929
  }
917
930
  __name(getAccountCacheFileName, "getAccountCacheFileName");
918
- function saveAccountToCache(account) {
919
- configCache.saveToConfigCache(
920
- getAccountCacheFileName(),
921
- { account }
922
- );
931
+ function retainAccountSelection(account) {
932
+ accountSelection = {
933
+ account,
934
+ profile: getActiveProfile()
935
+ };
936
+ if (persistAccountSelection) {
937
+ configCache.saveToConfigCache(
938
+ getAccountCacheFileName(),
939
+ { account }
940
+ );
941
+ }
923
942
  }
924
- __name(saveAccountToCache, "saveAccountToCache");
943
+ __name(retainAccountSelection, "retainAccountSelection");
944
+ function resolveAccountSelection() {
945
+ const profile = getActiveProfile();
946
+ if (persistAccountSelection) {
947
+ const account = getAccountFromCache();
948
+ accountSelection = account ? { account, profile } : void 0;
949
+ } else if (accountSelection?.profile !== profile) {
950
+ clearAccountSelection();
951
+ }
952
+ return accountSelection?.account;
953
+ }
954
+ __name(resolveAccountSelection, "resolveAccountSelection");
925
955
  function getAccountFromCache() {
956
+ if (!persistAccountSelection) {
957
+ return void 0;
958
+ }
926
959
  return configCache.getConfigCache(
927
960
  getAccountCacheFileName()
928
961
  ).account;
@@ -993,13 +1026,13 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
993
1026
  `Failed to automatically retrieve account IDs for the logged in user.
994
1027
  You may have incorrect permissions on your API token, or an environment variable such as CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, or CLOUDFLARE_EMAIL may be set to an invalid value.
995
1028
  Check your environment and unset or correct any Cloudflare credential variables, or run \`${descriptor.commands.login}\` to re-authenticate.
996
- You can also skip this account check by adding an \`account_id\` in your ${descriptor.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,
1029
+ You can also skip this account check by adding an account ID to your ${descriptor.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,
997
1030
  { telemetryMessage: "user account fetch permission denied" }
998
1031
  );
999
1032
  }
1000
1033
  throw new UserError(
1001
1034
  `Failed to automatically retrieve account IDs for the logged in user.
1002
- You may have incorrect permissions on your API token, or your authentication may have expired. Try running \`${descriptor.commands.login}\` to re-authenticate. You can also skip this account check by adding an \`account_id\` in your ${descriptor.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,
1035
+ You may have incorrect permissions on your API token, or your authentication may have expired. Try running \`${descriptor.commands.login}\` to re-authenticate. You can also skip this account check by adding an account ID to your ${descriptor.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,
1003
1036
  { telemetryMessage: "user account fetch permission denied" }
1004
1037
  );
1005
1038
  } else {
@@ -1015,7 +1048,7 @@ You may have incorrect permissions on your API token, or your authentication may
1015
1048
  if (usableAccounts.length === 0 && throwOnEmpty) {
1016
1049
  throw new UserError(
1017
1050
  `Failed to automatically retrieve account IDs for the logged in user.
1018
- In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your ${descriptor.getConfigFileLabel()} file.
1051
+ In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or in your ${descriptor.getConfigFileLabel()} file.
1019
1052
  Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`,
1020
1053
  { telemetryMessage: "user account fetch empty" }
1021
1054
  );
@@ -1031,24 +1064,20 @@ Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`
1031
1064
  if (config.account_id) {
1032
1065
  return validateAccountId(
1033
1066
  config.account_id,
1034
- `set as \`account_id\` in your ${descriptor.getConfigFileLabel()} file`
1067
+ `set in your ${descriptor.getConfigFileLabel()} file`
1035
1068
  );
1036
1069
  }
1037
1070
  const envAccountId = getCloudflareAccountIdFromEnv();
1038
1071
  if (envAccountId) {
1039
1072
  return envAccountId;
1040
1073
  }
1041
- return getAccountFromCache()?.id;
1074
+ return resolveAccountSelection()?.id;
1042
1075
  }
1043
1076
  __name(getActiveAccountId, "getActiveAccountId");
1044
- async function getOrSelectAccountId(config) {
1045
- const activeAccountId = getActiveAccountId(config);
1046
- if (activeAccountId) {
1047
- return activeAccountId;
1048
- }
1077
+ async function selectAccountId(config) {
1049
1078
  const accounts = await fetchAllAccounts(config);
1050
1079
  if (accounts.length === 1) {
1051
- saveAccountToCache({ id: accounts[0].id, name: accounts[0].name });
1080
+ retainAccountSelection({ id: accounts[0].id, name: accounts[0].name });
1052
1081
  return accounts[0].id;
1053
1082
  }
1054
1083
  try {
@@ -1062,14 +1091,14 @@ Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`
1062
1091
  if (!account) {
1063
1092
  throw new Error("Selected account not found in accounts list");
1064
1093
  }
1065
- saveAccountToCache({ id: account.id, name: account.name });
1094
+ retainAccountSelection({ id: account.id, name: account.name });
1066
1095
  return accountID;
1067
1096
  } catch (e) {
1068
1097
  if (ctx.isNoDefaultValueProvidedError(e)) {
1069
1098
  const redactAccountName = isCI();
1070
1099
  throw new UserError(
1071
1100
  `More than one account available but unable to select one in non-interactive mode.
1072
- Please set the appropriate \`account_id\` in your ${descriptor.getConfigFileLabel()} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
1101
+ Please set the appropriate account ID in your ${descriptor.getConfigFileLabel()} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
1073
1102
  Available accounts are (\`<name>\`: \`<account_id>\`):
1074
1103
  ${accounts.map(
1075
1104
  (account) => ` \`${redactAccountName ? "(redacted)" : account.name}\`: \`${account.id}\``
@@ -1080,6 +1109,17 @@ ${accounts.map(
1080
1109
  throw e;
1081
1110
  }
1082
1111
  }
1112
+ __name(selectAccountId, "selectAccountId");
1113
+ async function getOrSelectAccountId(config) {
1114
+ const activeAccountId = getActiveAccountId(config);
1115
+ if (activeAccountId) {
1116
+ return activeAccountId;
1117
+ }
1118
+ accountSelectionPromise ??= selectAccountId(config).finally(() => {
1119
+ accountSelectionPromise = void 0;
1120
+ });
1121
+ return accountSelectionPromise;
1122
+ }
1083
1123
  __name(getOrSelectAccountId, "getOrSelectAccountId");
1084
1124
  async function requireAuth(config) {
1085
1125
  if (oauthFlow.isTemporaryAllowed()) {
package/dist/index.d.mts CHANGED
@@ -80,6 +80,11 @@ declare function getAccessHeaders(domain: string, options: {
80
80
  previewToken?: string;
81
81
  }): Promise<Record<string, string>>;
82
82
 
83
+ /**
84
+ * Select a named auth profile for this process and its children.
85
+ * Explicit profile arguments take precedence; directory bindings are the fallback.
86
+ */
87
+ declare const getCloudflareAuthProfileFromEnv: () => string | undefined;
83
88
  /**
84
89
  * `WRANGLER_AUTH_URL` is the path that is used to access OAuth
85
90
  * for the Cloudflare APIs.
@@ -833,4 +838,4 @@ declare function decryptString(envelope: EncryptedEnvelope, key: Uint8Array): st
833
838
  */
834
839
  declare function parseEncryptedEnvelope(raw: unknown): EncryptedEnvelope | undefined;
835
840
 
836
- export { AuthConfigStorage, type CredentialStorageBundle, type CredentialStorageContext, CredentialStore, type EncryptedEnvelope, EncryptedFileCredentialStore, FileCredentialStore, type KeyProvider, type KeyProviderResolution, type KeyringEntry, type KeyringEntryFactory, LinuxSecretToolKeyProvider, type LinuxSecretToolRunner, type MacSecurityCommandRunner, MacSecurityKeyProvider, NapiKeyringKeyProvider, type NpmRunner, OAuthFlowLogger, PINNED_KEYRING_VERSION, PKCE_CHARSET, type ScrubEncryptedCredentialsResult, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, UserAuthConfig, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateKey, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner };
841
+ export { AuthConfigStorage, type CredentialStorageBundle, type CredentialStorageContext, CredentialStore, type EncryptedEnvelope, EncryptedFileCredentialStore, FileCredentialStore, type KeyProvider, type KeyProviderResolution, type KeyringEntry, type KeyringEntryFactory, LinuxSecretToolKeyProvider, type LinuxSecretToolRunner, type MacSecurityCommandRunner, MacSecurityKeyProvider, NapiKeyringKeyProvider, type NpmRunner, OAuthFlowLogger, PINNED_KEYRING_VERSION, PKCE_CHARSET, type ScrubEncryptedCredentialsResult, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, UserAuthConfig, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateKey, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthProfileFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'node:module';
2
- export { AuthenticationError, EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, validateProfileName } from './chunk-SOBRPAPT.mjs';
2
+ export { AuthenticationError, EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthProfileFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, validateProfileName } from './chunk-H5PZ3FJ2.mjs';
3
3
  import './chunk-VAZEJK55.mjs';
4
4
 
5
5
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
@@ -105,6 +105,12 @@ interface CliDescriptor {
105
105
  getTemporaryAccountConfigPath: () => string;
106
106
  /** On-disk file format for credentials / temporary-account / profile files. */
107
107
  fileFormat: FileFormat;
108
+ /**
109
+ * Whether an account selected from the current credentials is persisted in
110
+ * the config cache for later invocations. When disabled, the selection is
111
+ * retained only for the lifetime of the auth instance. Defaults to `false`.
112
+ */
113
+ persistAccountSelection?: boolean;
108
114
  /**
109
115
  * Filename prefix for the cached account selection in the config cache
110
116
  * (e.g. `"wrangler-account"` → `wrangler-account.json`). Always JSON.
@@ -117,9 +123,9 @@ interface CliDescriptor {
117
123
  */
118
124
  cacheNamespace?: string;
119
125
  /**
120
- * Label for the CLI's config file, used in "set `account_id` in your <file>"
121
- * hints. A getter so it can reflect runtime config state (wrangler resolves
122
- * this from `configFileName(undefined)`).
126
+ * Label for the CLI's account config file, used in account ID guidance. A
127
+ * getter so it can reflect runtime config state (wrangler resolves this from
128
+ * `configFileName(undefined)`).
123
129
  */
124
130
  getConfigFileLabel: () => string;
125
131
  /** The live default OAuth scope keys (a getter so any reassignment of the mutable `DefaultScopeKeys` binding is observed). */
@@ -127,14 +133,14 @@ interface CliDescriptor {
127
133
  }
128
134
 
129
135
  /** Details for one of the user's accounts. */
130
- type Account = {
136
+ interface Account {
131
137
  id: string;
132
138
  name: string;
133
- };
139
+ }
134
140
  /** The config surface {@link CloudflareAuth.requireAuth} needs: compliance settings plus an optional `account_id`. */
135
- type RequireAuthConfig = ComplianceConfig & {
141
+ interface RequireAuthConfig extends ComplianceConfig {
136
142
  account_id?: string;
137
- };
143
+ }
138
144
  /** Overrides accepted by {@link CloudflareAuth.login} / {@link CloudflareAuth.loginOrRefreshIfRequired}. */
139
145
  interface CloudflareLoginProps {
140
146
  scopes?: string[];
@@ -178,7 +184,7 @@ interface CloudflareAuth {
178
184
  readAuthCredentials: () => UserAuthConfig | undefined;
179
185
  /** Persist OAuth credentials via the active credential store. */
180
186
  writeAuthCredentials: (config: UserAuthConfig) => void;
181
- /** Returns the active account ID without side effects (config → env → cache). */
187
+ /** Returns the active account ID without fetching accounts or prompting. */
182
188
  getActiveAccountId: (config: {
183
189
  account_id?: string;
184
190
  }) => string | undefined;