cloudflare
Version:
The official TypeScript library for the Cloudflare API
1,148 lines • 63.2 kB
JavaScript
var _BaseCloudflare_instances, _BaseCloudflare_encoder, _BaseCloudflare_baseURLOverridden, _a;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "./internal/tslib.mjs";
import { uuid4 } from "./internal/utils/uuid.mjs";
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from "./internal/utils/values.mjs";
import { sleep } from "./internal/utils/sleep.mjs";
import { castToError, isAbortError } from "./internal/errors.mjs";
import { getPlatformHeaders } from "./internal/detect-platform.mjs";
import * as Shims from "./internal/shims.mjs";
import * as Opts from "./internal/request-options.mjs";
import { stringifyQuery } from "./internal/utils/query.mjs";
import { VERSION } from "./version.mjs";
import * as Errors from "./core/error.mjs";
import * as Pagination from "./core/pagination.mjs";
import * as Uploads from "./core/uploads.mjs";
import * as API from "./resources/index.mjs";
import { APIPromise } from "./core/api-promise.mjs";
import { AbuseReports } from "./resources/abuse-reports/abuse-reports.mjs";
import { Accounts } from "./resources/accounts/accounts.mjs";
import { ACM } from "./resources/acm/acm.mjs";
import { Addressing } from "./resources/addressing/addressing.mjs";
import { AIAudit } from "./resources/ai-audit/ai-audit.mjs";
import { AIGateway } from "./resources/ai-gateway/ai-gateway.mjs";
import { AISecurity } from "./resources/ai-security/ai-security.mjs";
import { AI } from "./resources/ai/ai.mjs";
import { AISearch } from "./resources/aisearch/aisearch.mjs";
import { Alerting } from "./resources/alerting/alerting.mjs";
import { AnalyticsQuery, } from "./resources/analytics-query/analytics-query.mjs";
import { APIGateway } from "./resources/api-gateway/api-gateway.mjs";
import { Argo } from "./resources/argo/argo.mjs";
import { AuditLogs } from "./resources/audit-logs/audit-logs.mjs";
import { BasinCatalog } from "./resources/basin-catalog/basin-catalog.mjs";
import { Billing } from "./resources/billing/billing.mjs";
import { BotManagement } from "./resources/bot-management/bot-management.mjs";
import { BotnetFeed } from "./resources/botnet-feed/botnet-feed.mjs";
import { BrandProtection } from "./resources/brand-protection/brand-protection.mjs";
import { BrowserRendering } from "./resources/browser-rendering/browser-rendering.mjs";
import { Cache } from "./resources/cache/cache.mjs";
import { Calls } from "./resources/calls/calls.mjs";
import { CertificateAuthorities } from "./resources/certificate-authorities/certificate-authorities.mjs";
import { ClientCertificates } from "./resources/client-certificates/client-certificates.mjs";
import { CloudConnector } from "./resources/cloud-connector/cloud-connector.mjs";
import { CloudforceOne } from "./resources/cloudforce-one/cloudforce-one.mjs";
import { Connectivity } from "./resources/connectivity/connectivity.mjs";
import { Containers } from "./resources/containers/containers.mjs";
import { ContentScanning } from "./resources/content-scanning/content-scanning.mjs";
import { CsamScanner } from "./resources/csam-scanner/csam-scanner.mjs";
import { CustomCertificates } from "./resources/custom-certificates/custom-certificates.mjs";
import { CustomCsrs } from "./resources/custom-csrs/custom-csrs.mjs";
import { CustomHostnames } from "./resources/custom-hostnames/custom-hostnames.mjs";
import { CustomNameservers } from "./resources/custom-nameservers/custom-nameservers.mjs";
import { CustomPages } from "./resources/custom-pages/custom-pages.mjs";
import { D1Resource } from "./resources/d1/d1.mjs";
import { DCVDelegation } from "./resources/dcv-delegation/dcv-delegation.mjs";
import { DDoSProtection } from "./resources/ddos-protection/ddos-protection.mjs";
import { Diagnostics } from "./resources/diagnostics/diagnostics.mjs";
import { DLS } from "./resources/dls/dls.mjs";
import { DNSFirewall } from "./resources/dns-firewall/dns-firewall.mjs";
import { DNS } from "./resources/dns/dns.mjs";
import { DurableObjects } from "./resources/durable-objects/durable-objects.mjs";
import { EmailAuth } from "./resources/email-auth/email-auth.mjs";
import { EmailRouting } from "./resources/email-routing/email-routing.mjs";
import { EmailSecurity } from "./resources/email-security/email-security.mjs";
import { EmailSending } from "./resources/email-sending/email-sending.mjs";
import { FieldExtractors } from "./resources/field-extractors/field-extractors.mjs";
import { Filters } from "./resources/filters/filters.mjs";
import { Firewall } from "./resources/firewall/firewall.mjs";
import { Flagship } from "./resources/flagship/flagship.mjs";
import { Fraud } from "./resources/fraud/fraud.mjs";
import { GoogleTagGateway } from "./resources/google-tag-gateway/google-tag-gateway.mjs";
import { Healthchecks } from "./resources/healthchecks/healthchecks.mjs";
import { Hostnames } from "./resources/hostnames/hostnames.mjs";
import { HyperdriveResource } from "./resources/hyperdrive/hyperdrive.mjs";
import { IAM } from "./resources/iam/iam.mjs";
import { Images } from "./resources/images/images.mjs";
import { Intel } from "./resources/intel/intel.mjs";
import { IPs } from "./resources/ips/ips.mjs";
import { KeylessCertificates } from "./resources/keyless-certificates/keyless-certificates.mjs";
import { KV } from "./resources/kv/kv.mjs";
import { LeakedCredentialChecks } from "./resources/leaked-credential-checks/leaked-credential-checks.mjs";
import { LoadBalancers } from "./resources/load-balancers/load-balancers.mjs";
import { Logpush } from "./resources/logpush/logpush.mjs";
import { Logs } from "./resources/logs/logs.mjs";
import { MagicCloudNetworking } from "./resources/magic-cloud-networking/magic-cloud-networking.mjs";
import { MagicNetworkMonitoring } from "./resources/magic-network-monitoring/magic-network-monitoring.mjs";
import { MagicTransit } from "./resources/magic-transit/magic-transit.mjs";
import { ManagedDefense } from "./resources/managed-defense/managed-defense.mjs";
import { ManagedTransforms } from "./resources/managed-transforms/managed-transforms.mjs";
import { Memberships } from "./resources/memberships/memberships.mjs";
import { MoQ } from "./resources/moq/moq.mjs";
import { MTLSCertificates } from "./resources/mtls-certificates/mtls-certificates.mjs";
import { NetworkInterconnects } from "./resources/network-interconnects/network-interconnects.mjs";
import { Organizations } from "./resources/organizations/organizations.mjs";
import { OriginCACertificates } from "./resources/origin-ca-certificates/origin-ca-certificates.mjs";
import { OriginPostQuantumEncryption } from "./resources/origin-post-quantum-encryption/origin-post-quantum-encryption.mjs";
import { OriginTLSClientAuth } from "./resources/origin-tls-client-auth/origin-tls-client-auth.mjs";
import { OriginTLSComplianceModes } from "./resources/origin-tls-compliance-modes/origin-tls-compliance-modes.mjs";
import { PageRules } from "./resources/page-rules/page-rules.mjs";
import { PageShield } from "./resources/page-shield/page-shield.mjs";
import { Pages } from "./resources/pages/pages.mjs";
import { Pipelines } from "./resources/pipelines/pipelines.mjs";
import { Precursor } from "./resources/precursor/precursor.mjs";
import { Queues } from "./resources/queues/queues.mjs";
import { R2DataCatalog } from "./resources/r2-data-catalog/r2-data-catalog.mjs";
import { R2 } from "./resources/r2/r2.mjs";
import { Radar } from "./resources/radar/radar.mjs";
import { RateLimits } from "./resources/rate-limits/rate-limits.mjs";
import { RealtimeKit } from "./resources/realtime-kit/realtime-kit.mjs";
import { RegistrarSandbox } from "./resources/registrar-sandbox/registrar-sandbox.mjs";
import { Registrar } from "./resources/registrar/registrar.mjs";
import { RequestTracers } from "./resources/request-tracers/request-tracers.mjs";
import { ResourceSharing } from "./resources/resource-sharing/resource-sharing.mjs";
import { ResourceTagging } from "./resources/resource-tagging/resource-tagging.mjs";
import { Rules } from "./resources/rules/rules.mjs";
import { Rulesets } from "./resources/rulesets/rulesets.mjs";
import { RUM } from "./resources/rum/rum.mjs";
import { SchemaValidation } from "./resources/schema-validation/schema-validation.mjs";
import { SecretsStore } from "./resources/secrets-store/secrets-store.mjs";
import { SecurityCenter } from "./resources/security-center/security-center.mjs";
import { SecurityTXT } from "./resources/security-txt/security-txt.mjs";
import { Snippets } from "./resources/snippets/snippets.mjs";
import { Spectrum } from "./resources/spectrum/spectrum.mjs";
import { Speed } from "./resources/speed/speed.mjs";
import { SSL } from "./resources/ssl/ssl.mjs";
import { Stream } from "./resources/stream/stream.mjs";
import { TenantCustomNameservers } from "./resources/tenant-custom-nameservers/tenant-custom-nameservers.mjs";
import { Tenants } from "./resources/tenants/tenants.mjs";
import { TokenValidation } from "./resources/token-validation/token-validation.mjs";
import { Turnstile } from "./resources/turnstile/turnstile.mjs";
import { URLNormalization } from "./resources/url-normalization/url-normalization.mjs";
import { URLScanner } from "./resources/url-scanner/url-scanner.mjs";
import { User } from "./resources/user/user.mjs";
import { Vectorize } from "./resources/vectorize/vectorize.mjs";
import { VulnerabilityScanner } from "./resources/vulnerability-scanner/vulnerability-scanner.mjs";
import { WaitingRooms } from "./resources/waiting-rooms/waiting-rooms.mjs";
import { Web3 } from "./resources/web3/web3.mjs";
import { WorkersForPlatforms } from "./resources/workers-for-platforms/workers-for-platforms.mjs";
import { Workers } from "./resources/workers/workers.mjs";
import { Workflows } from "./resources/workflows/workflows.mjs";
import { Zaraz } from "./resources/zaraz/zaraz.mjs";
import { ZeroTrust } from "./resources/zero-trust/zero-trust.mjs";
import { Zones } from "./resources/zones/zones.mjs";
import { buildHeaders } from "./internal/headers.mjs";
import { readEnv } from "./internal/utils/env.mjs";
import { formatRequestDetails, loggerFor, parseLogLevel, } from "./internal/utils/log.mjs";
import { isEmptyObj } from "./internal/utils/values.mjs";
/**
* Base class for Cloudflare API clients.
*/
export var BaseCloudflare = /* @__PURE__ */ (() => {
/**
* Base class for Cloudflare API clients.
*/
class BaseCloudflare {
/**
* API Client for interfacing with the Cloudflare API.
*
* @param {string | null | undefined} [opts.apiToken=process.env['CLOUDFLARE_API_TOKEN'] ?? null]
* @param {string | null | undefined} [opts.apiKey=process.env['CLOUDFLARE_API_KEY'] ?? null]
* @param {string | null | undefined} [opts.apiEmail=process.env['CLOUDFLARE_EMAIL'] ?? null]
* @param {string | null | undefined} [opts.userServiceKey=process.env['CLOUDFLARE_API_USER_SERVICE_KEY'] ?? null]
* @param {string} [opts.baseURL=process.env['CLOUDFLARE_BASE_URL'] ?? https://api.cloudflare.com/client/v4] - Override the default base URL for the API.
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
* @param {string | null} [opts.apiVersion] - Define the version to target for the API.
*/
constructor({ baseURL = readEnv('CLOUDFLARE_BASE_URL'), apiVersion = null, apiToken = readEnv('CLOUDFLARE_API_TOKEN') ?? null, apiKey = readEnv('CLOUDFLARE_API_KEY') ?? null, apiEmail = readEnv('CLOUDFLARE_EMAIL') ?? null, userServiceKey = readEnv('CLOUDFLARE_API_USER_SERVICE_KEY') ?? null, ...opts } = {}) {
_BaseCloudflare_instances.add(this);
_BaseCloudflare_encoder.set(this, void 0);
const options = {
apiToken,
apiKey,
apiEmail,
userServiceKey,
...opts,
baseURL: baseURL || `https://api.cloudflare.com/client/v4`,
apiVersion: apiVersion || new Date().toISOString().slice(0, 10),
};
this.baseURL = options.baseURL;
this.timeout = options.timeout ?? BaseCloudflare.DEFAULT_TIMEOUT /* 1 minute */;
this.logger = options.logger ?? console;
const defaultLogLevel = 'warn';
// Set default logLevel early so that we can log a warning in parseLogLevel.
this.logLevel = defaultLogLevel;
this.logLevel =
parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
parseLogLevel(readEnv('CLOUDFLARE_LOG'), "process.env['CLOUDFLARE_LOG']", this) ??
defaultLogLevel;
this.fetchOptions = options.fetchOptions;
this.maxRetries = options.maxRetries ?? 2;
this.fetch = options.fetch ?? Shims.getDefaultFetch();
__classPrivateFieldSet(this, _BaseCloudflare_encoder, Opts.FallbackEncoder, "f");
const customHeadersEnv = readEnv('CLOUDFLARE_CUSTOM_HEADERS');
if (customHeadersEnv) {
const parsed = {};
for (const line of customHeadersEnv.split('\n')) {
const colon = line.indexOf(':');
if (colon >= 0) {
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
}
}
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
}
this._options = options;
this.apiToken = apiToken;
this.apiKey = apiKey;
this.apiEmail = apiEmail;
this.userServiceKey = userServiceKey;
this.apiVersion = options.apiVersion;
}
/**
* Create a new client instance re-using the same options given to the current client with optional overriding.
*/
withOptions(options) {
const client = new this.constructor({
...this._options,
baseURL: this.baseURL,
maxRetries: this.maxRetries,
timeout: this.timeout,
logger: this.logger,
logLevel: this.logLevel,
fetch: this.fetch,
fetchOptions: this.fetchOptions,
apiToken: this.apiToken,
apiKey: this.apiKey,
apiEmail: this.apiEmail,
userServiceKey: this.userServiceKey,
apiVersion: this.apiVersion,
...options,
});
return client;
}
defaultQuery() {
return this._options.defaultQuery;
}
validateHeaders({ values, nulls }) {
if (this.apiEmail && values.get('x-auth-email')) {
return;
}
if (nulls.has('x-auth-email')) {
return;
}
if (this.apiKey && values.get('x-auth-key')) {
return;
}
if (nulls.has('x-auth-key')) {
return;
}
if (this.apiToken && values.get('authorization')) {
return;
}
if (nulls.has('authorization')) {
return;
}
if (this.userServiceKey && values.get('x-auth-user-service-key')) {
return;
}
if (nulls.has('x-auth-user-service-key')) {
return;
}
throw new Error('Could not resolve authentication method. Expected one of apiEmail, apiKey, apiToken or userServiceKey to be set. Or for one of the "X-Auth-Email", "X-Auth-Key", "Authorization" or "X-Auth-User-Service-Key" headers to be explicitly omitted');
}
async authHeaders(opts) {
return buildHeaders([
await this.apiEmailAuth(opts),
await this.apiKeyAuth(opts),
await this.apiTokenAuth(opts),
await this.userServiceKeyAuth(opts),
]);
}
async apiEmailAuth(opts) {
if (this.apiEmail == null) {
return undefined;
}
return buildHeaders([{ 'X-Auth-Email': this.apiEmail }]);
}
async apiKeyAuth(opts) {
if (this.apiKey == null) {
return undefined;
}
return buildHeaders([{ 'X-Auth-Key': this.apiKey }]);
}
async apiTokenAuth(opts) {
if (this.apiToken == null) {
return undefined;
}
return buildHeaders([{ Authorization: `Bearer ${this.apiToken}` }]);
}
async userServiceKeyAuth(opts) {
if (this.userServiceKey == null) {
return undefined;
}
return buildHeaders([{ 'X-Auth-User-Service-Key': this.userServiceKey }]);
}
stringifyQuery(query) {
return stringifyQuery(query);
}
getUserAgent() {
return `${this.constructor.name}/JS ${VERSION}`;
}
defaultIdempotencyKey() {
return `stainless-node-retry-${uuid4()}`;
}
makeStatusError(status, error, message, headers) {
return Errors.APIError.generate(status, error, message, headers);
}
buildURL(path, query, defaultBaseURL) {
const baseURL = (!__classPrivateFieldGet(this, _BaseCloudflare_instances, "m", _BaseCloudflare_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
const url = isAbsoluteURL(path) ?
new URL(path)
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
const defaultQuery = this.defaultQuery();
const pathQuery = Object.fromEntries(url.searchParams);
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
query = { ...pathQuery, ...defaultQuery, ...query };
}
if (typeof query === 'object' && query && !Array.isArray(query)) {
url.search = this.stringifyQuery(query);
}
return url.toString();
}
/**
* Used as a callback for mutating the given `FinalRequestOptions` object.
*/
async prepareOptions(options) { }
/**
* Used as a callback for mutating the given `RequestInit` object.
*
* This is useful for cases where you want to add certain headers based off of
* the request properties, e.g. `method` or `url`.
*/
async prepareRequest(request, { url, options }) { }
get(path, opts) {
return this.methodRequest('get', path, opts);
}
post(path, opts) {
return this.methodRequest('post', path, opts);
}
patch(path, opts) {
return this.methodRequest('patch', path, opts);
}
put(path, opts) {
return this.methodRequest('put', path, opts);
}
delete(path, opts) {
return this.methodRequest('delete', path, opts);
}
methodRequest(method, path, opts) {
return this.request(Promise.resolve(opts).then((opts) => {
return { method, path, ...opts };
}));
}
request(options, remainingRetries = null) {
return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
}
async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
const options = await optionsInput;
const maxRetries = options.maxRetries ?? this.maxRetries;
if (retriesRemaining == null) {
retriesRemaining = maxRetries;
}
await this.prepareOptions(options);
const { req, url, timeout } = await this.buildRequest(options, {
retryCount: maxRetries - retriesRemaining,
});
await this.prepareRequest(req, { url, options });
/** Not an API request ID, just for correlating local log entries. */
const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
const startTime = Date.now();
loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({
retryOfRequestLogID,
method: options.method,
url,
options,
headers: req.headers,
}));
if (options.signal?.aborted) {
throw new Errors.APIUserAbortError();
}
const controller = new AbortController();
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
const headersTime = Date.now();
if (response instanceof globalThis.Error) {
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
if (options.signal?.aborted) {
throw new Errors.APIUserAbortError();
}
// detect native connection timeout errors
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
// undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
// others do not provide enough information to distinguish timeouts from other connection errors
const isTimeout = isAbortError(response) ||
/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
if (retriesRemaining) {
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({
retryOfRequestLogID,
url,
durationMs: headersTime - startTime,
message: response.message,
}));
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
}
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({
retryOfRequestLogID,
url,
durationMs: headersTime - startTime,
message: response.message,
}));
if (isTimeout) {
throw new Errors.APIConnectionTimeoutError();
}
throw new Errors.APIConnectionError({ cause: response });
}
const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
if (!response.ok) {
const shouldRetry = await this.shouldRetry(response);
if (retriesRemaining && shouldRetry) {
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
// We don't need the body of this response.
await Shims.CancelReadableStream(response.body);
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
retryOfRequestLogID,
url: response.url,
status: response.status,
headers: response.headers,
durationMs: headersTime - startTime,
}));
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
}
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
const errText = await response.text().catch((err) => castToError(err).message);
const errJSON = safeJSON(errText);
const errMessage = errJSON ? undefined : errText;
loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
retryOfRequestLogID,
url: response.url,
status: response.status,
headers: response.headers,
message: errMessage,
durationMs: Date.now() - startTime,
}));
const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
throw err;
}
loggerFor(this).info(responseInfo);
loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({
retryOfRequestLogID,
url: response.url,
status: response.status,
headers: response.headers,
durationMs: headersTime - startTime,
}));
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
}
getAPIList(path, Page, opts) {
return this.requestAPIList(Page, opts && 'then' in opts ?
opts.then((opts) => ({ method: 'get', path, ...opts }))
: { method: 'get', path, ...opts });
}
requestAPIList(Page, options) {
const request = this.makeRequest(options, null, undefined);
return new Pagination.PagePromise(this, request, Page);
}
async fetchWithTimeout(url, init, ms, controller) {
const { signal, method, ...options } = init || {};
const abort = this._makeAbort(controller);
if (signal)
signal.addEventListener('abort', abort, { once: true });
const timeout = setTimeout(abort, ms);
const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
const fetchOptions = {
signal: controller.signal,
...(isReadableBody ? { duplex: 'half' } : {}),
method: 'GET',
...options,
};
if (method) {
// Custom methods like 'patch' need to be uppercased
// See https://github.com/nodejs/undici/issues/2294
fetchOptions.method = method.toUpperCase();
}
try {
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
return await this.fetch.call(undefined, url, fetchOptions);
}
finally {
clearTimeout(timeout);
}
}
async shouldRetry(response) {
// Note this is not a standard header.
const shouldRetryHeader = response.headers.get('x-should-retry');
// If the server explicitly says whether or not to retry, obey.
if (shouldRetryHeader === 'true')
return true;
if (shouldRetryHeader === 'false')
return false;
// Retry on request timeouts.
if (response.status === 408)
return true;
// Retry on lock timeouts.
if (response.status === 409)
return true;
// Retry on rate limits.
if (response.status === 429)
return true;
// Retry internal errors.
if (response.status >= 500)
return true;
return false;
}
async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
let timeoutMillis;
// Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
if (retryAfterMillisHeader) {
const timeoutMs = parseFloat(retryAfterMillisHeader);
if (!Number.isNaN(timeoutMs)) {
timeoutMillis = timeoutMs;
}
}
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
const retryAfterHeader = responseHeaders?.get('retry-after');
if (retryAfterHeader && !timeoutMillis) {
const timeoutSeconds = parseFloat(retryAfterHeader);
if (!Number.isNaN(timeoutSeconds)) {
timeoutMillis = timeoutSeconds * 1000;
}
else {
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
}
}
// If the API asks us to wait a certain amount of time, just do what it
// says, but otherwise calculate a default
if (timeoutMillis === undefined) {
const maxRetries = options.maxRetries ?? this.maxRetries;
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
}
await sleep(timeoutMillis);
return this.makeRequest(options, retriesRemaining - 1, requestLogID);
}
calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
const initialRetryDelay = 0.5;
const maxRetryDelay = 8.0;
const numRetries = maxRetries - retriesRemaining;
// Apply exponential backoff, but not more than the max.
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
// Apply some jitter, take up to at most 25 percent of the retry time.
const jitter = 1 - Math.random() * 0.25;
return sleepSeconds * jitter * 1000;
}
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
const options = { ...inputOptions };
const { method, path, query, defaultBaseURL } = options;
const url = this.buildURL(path, query, defaultBaseURL);
if ('timeout' in options)
validatePositiveInteger('timeout', options.timeout);
options.timeout = options.timeout ?? this.timeout;
const { bodyHeaders, body } = this.buildBody({ options });
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
const req = {
method,
headers: reqHeaders,
...(options.signal && { signal: options.signal }),
...(globalThis.ReadableStream &&
body instanceof globalThis.ReadableStream && { duplex: 'half' }),
...(body && { body }),
...(this.fetchOptions ?? {}),
...(options.fetchOptions ?? {}),
};
return { req, url, timeout: options.timeout };
}
async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
let idempotencyHeaders = {};
if (this.idempotencyHeader && method !== 'get') {
if (!options.idempotencyKey)
options.idempotencyKey = this.defaultIdempotencyKey();
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
}
const headers = buildHeaders([
idempotencyHeaders,
{
Accept: 'application/json',
'User-Agent': this.getUserAgent(),
'api-version': this.apiVersion,
'X-Stainless-Retry-Count': String(retryCount),
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
...getPlatformHeaders(),
'X-Auth-Key': this.apiKey,
'X-Auth-Email': this.apiEmail,
},
await this.authHeaders(options),
this._options.defaultHeaders,
bodyHeaders,
options.headers,
]);
this.validateHeaders(headers);
return headers.values;
}
_makeAbort(controller) {
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
// would capture all request options, and cause a memory leak.
return () => controller.abort();
}
buildBody({ options }) {
const { body, headers: rawHeaders } = options;
if (!body) {
// A resource method always passes a `body` key when its operation defines a
// request body, even if the caller omitted an optional body param. Keep the
// content-type for those, and only elide it for operations with no body at
// all (e.g. GET/DELETE).
if (body == null && 'body' in options) {
return __classPrivateFieldGet(this, _BaseCloudflare_encoder, "f").call(this, { body, headers: buildHeaders([rawHeaders]) });
}
return { bodyHeaders: undefined, body: undefined };
}
const headers = buildHeaders([rawHeaders]);
if (
// Pass raw type verbatim
ArrayBuffer.isView(body) ||
body instanceof ArrayBuffer ||
body instanceof DataView ||
(typeof body === 'string' &&
// Preserve legacy string encoding behavior for now
headers.values.has('content-type')) ||
// `Blob` is superset of `File`
(globalThis.Blob && body instanceof globalThis.Blob) ||
// `FormData` -> `multipart/form-data`
body instanceof FormData ||
// `URLSearchParams` -> `application/x-www-form-urlencoded`
body instanceof URLSearchParams ||
// Send chunked stream (each chunk has own `length`)
(globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
return { bodyHeaders: undefined, body: body };
}
else if (typeof body === 'object' &&
(Symbol.asyncIterator in body ||
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body) };
}
else if (typeof body === 'object' &&
headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
return {
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
body: this.stringifyQuery(body),
};
}
else {
return __classPrivateFieldGet(this, _BaseCloudflare_encoder, "f").call(this, { body, headers });
}
}
}
_BaseCloudflare_encoder = new WeakMap(), _BaseCloudflare_instances = new WeakSet(), _BaseCloudflare_baseURLOverridden = function _BaseCloudflare_baseURLOverridden() {
return this.baseURL !== 'https://api.cloudflare.com/client/v4';
};
BaseCloudflare.DEFAULT_TIMEOUT = 60000; // 1 minute
return BaseCloudflare;
})();
/**
* API Client for interfacing with the Cloudflare API.
*/
export var Cloudflare = /* @__PURE__ */ (() => {
/**
* API Client for interfacing with the Cloudflare API.
*/
class Cloudflare extends BaseCloudflare {
constructor() {
super(...arguments);
this.accounts = new API.Accounts(this);
this.organizations = new API.Organizations(this);
this.tenants = new API.Tenants(this);
this.originCACertificates = new API.OriginCACertificates(this);
this.ips = new API.IPs(this);
this.memberships = new API.Memberships(this);
this.user = new API.User(this);
this.zones = new API.Zones(this);
this.loadBalancers = new API.LoadBalancers(this);
this.cache = new API.Cache(this);
this.ssl = new API.SSL(this);
this.acm = new API.ACM(this);
this.analyticsQuery = new API.AnalyticsQuery(this);
this.argo = new API.Argo(this);
this.certificateAuthorities = new API.CertificateAuthorities(this);
this.clientCertificates = new API.ClientCertificates(this);
this.customCertificates = new API.CustomCertificates(this);
this.customCsrs = new API.CustomCsrs(this);
this.customHostnames = new API.CustomHostnames(this);
this.customNameservers = new API.CustomNameservers(this);
this.tenantCustomNameservers = new API.TenantCustomNameservers(this);
this.dnsFirewall = new API.DNSFirewall(this);
this.dns = new API.DNS(this);
this.emailSecurity = new API.EmailSecurity(this);
this.emailAuth = new API.EmailAuth(this);
this.emailRouting = new API.EmailRouting(this);
this.emailSending = new API.EmailSending(this);
this.filters = new API.Filters(this);
this.firewall = new API.Firewall(this);
this.healthchecks = new API.Healthchecks(this);
this.keylessCertificates = new API.KeylessCertificates(this);
this.logpush = new API.Logpush(this);
this.logs = new API.Logs(this);
this.originTLSClientAuth = new API.OriginTLSClientAuth(this);
this.pageRules = new API.PageRules(this);
this.rateLimits = new API.RateLimits(this);
this.waitingRooms = new API.WaitingRooms(this);
this.web3 = new API.Web3(this);
this.workers = new API.Workers(this);
this.kv = new API.KV(this);
this.durableObjects = new API.DurableObjects(this);
this.containers = new API.Containers(this);
this.queues = new API.Queues(this);
this.apiGateway = new API.APIGateway(this);
this.managedTransforms = new API.ManagedTransforms(this);
this.pageShield = new API.PageShield(this);
this.rulesets = new API.Rulesets(this);
this.urlNormalization = new API.URLNormalization(this);
this.spectrum = new API.Spectrum(this);
this.addressing = new API.Addressing(this);
this.dls = new API.DLS(this);
this.auditLogs = new API.AuditLogs(this);
this.billing = new API.Billing(this);
this.brandProtection = new API.BrandProtection(this);
this.diagnostics = new API.Diagnostics(this);
this.images = new API.Images(this);
this.intel = new API.Intel(this);
this.magicTransit = new API.MagicTransit(this);
this.DDoSProtection = new API.DDoSProtection(this);
this.magicNetworkMonitoring = new API.MagicNetworkMonitoring(this);
this.magicCloudNetworking = new API.MagicCloudNetworking(this);
this.networkInterconnects = new API.NetworkInterconnects(this);
this.mtlsCertificates = new API.MTLSCertificates(this);
this.pages = new API.Pages(this);
/**
* Registrar API for searching, checking, registering, and managing domains through Cloudflare Registrar.
*
* ## Prerequisites
*
* Before using this API, ensure:
*
* 1. **Cloudflare account** — the caller must have a valid Cloudflare account.
* 2. **Billing profile** — the account must have a billing profile with a valid,
* current default payment method (credit card or other accepted method).
* This cannot be set up via API — the account owner must configure billing
* at `https://dash.cloudflare.com/{account_id}/billing/payment-info` before
* calling `POST /registrations`.
* 3. **API authentication** — use an API token or API key with the appropriate
* Registrar permissions for the operations you are calling.
*
* ## Terminology: domain extension
*
* Throughout this API, "extension" refers to the domain extension part of a fully
* qualified domain name — the portion after the registrable label. For example,
* in `example.co.uk`, the extension is `co.uk` (not just `uk`). This covers both
* top-level domains like `com` and multi-level extensions like `co.uk`. This is
* distinct from other uses of the word "extension" (e.g., EPP extensions).
*
* ## Supported extensions
*
* This API supports programmatic registration for all extensions supported by
* the dashboard experience, with the following exceptions:
*
* `giving`, `mom`, `inc`, `lol`, `sh`, `link`, `cc`, `new`
*
* Cloudflare Registrar supports 400+ extensions in the dashboard. Extensions
* listed above can be registered at `https://dash.cloudflare.com/{account_id}/domains/registrations`.
*
* ## Typical workflow
*
* 1. **Search** — call `GET /domain-search?q={keyword}` to discover available domains.
* 2. **Check** — call `POST /domain-check` with candidate domains to verify real-time
* availability and pricing.
* 3. **Review the response** — if `registrable: false`, inspect `reason` to
* understand whether the domain is unavailable, the extension is not supported
* by this API, the extension is not supported by Cloudflare Registrar at all,
* or the extension's registry has frozen new registrations.
* 4. **Handle premium domains** — if `tier: premium`, premium registration is
* not currently supported by this API. Surface the premium pricing to the user,
* but do not proceed to `POST /registrations` for that domain.
* 5. **Observe the registration schema** — call `GET /extensions/:extension_name`
* to discover the required values for registering this extension.
* 6. **Register** — call `POST /registrations` with the chosen domain name for
* supported non-premium registrations.
* 7. **Confirm completion** — if the response is `201 Created`, registration
* completed within the default timeout and no polling is needed.
* 8. **Poll when needed** — if the response is `202 Accepted`, poll
* `links.self` from the workflow response.
* 9. **Stop for user action** — if `state: action_required`, stop polling and
* surface `context.action` to the user.
* The workflow will not resolve on its own.
* 10. **Continue when blocked** — if `state: blocked`, continue polling and
* inform the user that a third party, such as the extension registry or losing
* registrar, is delaying progress.
* 11. **Review failures before retrying** — if `state: failed`, review
* `error.code` and `error.message`, then decide whether user action or a new
* Check call is needed.
*
* **All successful domain registrations are non-refundable.** Once the registration
* workflow completes with `state: succeeded`, the charge cannot be reversed.
* Confirm pricing and domain choice with the user before calling `POST /registrations`.
*
* ## Default behavior for mutating operations
*
* By default, mutating operations such as create and update hold the connection
* for a bounded, server-defined amount of time while the operation completes.
* In most cases, the response contains a completed workflow status and no
* polling is required.
*
* - **Completed within the synchronous wait window:** Returns `201` (create)
* or `200` (update) with a `workflow_status` where `state: succeeded` and
* `completed: true`.
* - **Still processing after the synchronous wait window:** Returns
* `202 Accepted` with a `workflow_status` where `completed: false`. Use
* the `links.self` URL to poll for completion.
*
* ## Non-blocking mode
*
* To receive an immediate `202 Accepted` response without waiting, send the
* `Prefer: respond-async` request header (RFC 7240). The server will acknowledge
* it with a `Preference-Applied: respond-async` response header.
*
* ## Polling
*
* When the response is `202`, poll the workflow status endpoint indicated by
* `links.self` in the response body until the workflow reaches a terminal
* state or requires user action.
*/
this.registrar = new API.Registrar(this);
/**
* Use the Registrar Sandbox API to test domain search, availability checks,
* registration, and domain management flows without buying real domains.
*
* **This API is a test environment for the production Registrar API.**
*
* ## Prerequisites
*
* Before using this API, make sure you have:
*
* 1. **Cloudflare account** — the caller must have a valid Cloudflare account.
* 2. **API authentication** — create an API token with Registrar Sandbox permissions.
*
* ## How the Sandbox API differs from the production Registrar API
*
* Because the Sandbox API is intended for testing, it behaves differently from
* the production Registrar API in a few important ways:
*
* 1. **No billing** — you will not be charged real money for purchasing a domain.
* 2. **No real domains** — purchased domains are test records and will not be
* reachable on the Internet.
* 3. **No DNS zones** — purchasing a domain does not create a zone resource.
* 4. **No Registration Express Mode** — you must provide full contact data.
*
* Sandbox purchases are still persisted. If you purchase a domain in the sandbox,
* that domain will not be available for others to purchase in the sandbox.
*
* ## Terminology: domain extension
*
* Throughout this API, "extension" refers to the domain extension part of a fully
* qualified domain name — the portion after the registrable label. For example,
* in `example.co.uk`, the extension is `co.uk` (not just `uk`). This covers both
* top-level domains like `com` and multi-level extensions like `co.uk`. This is
* distinct from other uses of the word "extension" (e.g., EPP extensions).
*
* ## Supported extensions
*
* The Sandbox API currently supports programmatic registration for these
* extensions:
*
* `com`, `net`
*
* The production Registrar API supports 40+ extensions.
*
* Cloudflare Registrar supports 400+ extensions in the dashboard. Extensions
* not listed above can be registered at `https://dash.cloudflare.com/{account_id}/domains/registrations`.
*
* ## Typical workflow
*
* 1. **Search** — call `GET /domain-search?q={keyword}` to discover available domains.
* 2. **Check** — call `POST /domain-check` with candidate domains to verify real-time
* availability and pricing.
* 3. **Review the response** — if `registrable: false`, inspect `reason` to
* understand whether the domain is unavailable, the extension is not supported
* by this API, the extension is not supported by Cloudflare Registrar at all,
* or the extension's registry has frozen new registrations.
* 4. **Handle premium domains** — if `tier: premium`, premium registration is
* not currently supported by this API. The Sandbox API currently supports
* only `com` and `net`, which do not have premium registrations, but clients
* should still handle this response for consistency with the production
* Registrar API. Surface the premium pricing to the user, but do not proceed
* to `POST /registrations` for that domain.
* 5. **Observe the registration schema** — call `GET /extensions/:extension_name`
* to discover the required values for registering this extension.
* 6. **Register** — call `POST /registrations` with the chosen domain name for
* supported non-premium registrations.
* 7. **Confirm completion** — if the response is `201 Created`, registration
* completed within the default timeout and no polling is needed.
* 8. **Poll when needed** — if the response is `202 Accepted`, poll
* `links.self` from the workflow response.
* 9. **Stop for user action** — if `state: action_required`, stop polling and
* surface `context.action` to the user.
* The workflow will not resolve on its own.
* 10. **Continue when blocked** — if `state: blocked`, continue polling and
* inform the user that a third party, such as the extension registry or losing
* registrar, is delaying progress.
* 11. **Review failures before retrying** — if `state: failed`, review
* `error.code` and `error.message`, then decide whether user action or a new
* Check call is needed.
*
* ## Default behavior for mutating operations
*
* By default, mutating operations such as create and update hold the connection
* for a bounded, server-defined amount of time while the operation completes.
* In most cases, the response contains a completed workflow status and no
* polling is required.
*
* - **Completed within the synchronous wait window:** Returns `201` (create)
* or `200` (update) with a `workflow_status` where `state: succeeded` and
* `completed: true`.
* - **Still processing after the synchronous wait window:** Returns
* `202 Accepted` with a `workflow_status` where `completed: false`. Use
* the `links.self` URL to poll for completion.
*
* ## Non-blocking mode
*
* To receive an immediate `202 Accepted` response without waiting, send the
* `Prefer: respond-async` request header (RFC 7240). The server will acknowledge
* it with a `Preference-Applied: respond-async` response header.
*
* ## Polling
*
* When the response is `202`, poll the workflow status endpoint indicated by
* `links.self` in the response body until the workflow reaches a terminal
* state or requires user action.
*/
this.registrarSandbox = new API.RegistrarSandbox(this);
this.requestTracers = new API.RequestTracers(this);
this.rules = new API.Rules(this);
this.stream = new API.Stream(this);
this.alerting = new API.Alerting(this);
this.d1 = new API.D1Resource(this);
this.r2 = new API.R2(this);
this.r2DataCatalog = new API.R2DataCatalog(this);
this.basinCatalog = new API.BasinCatalog(this);
this.workersForPlatforms = new API.WorkersForPlatforms(this);
this.zeroTrust = new API.ZeroTrust(this);
this.turnstile = new API.Turnstile(this);
this.connectivity = new API.Connectivity(this);
this.hyperdrive = new API.HyperdriveResource(this);
this.rum = new API.RUM(this);
this.vectorize = new API.Vectorize(this);
this.urlScanner = new API.URLScanner(this);
this.vulnerabilityScanner = new API.VulnerabilityScanner(this);
this.radar = new API.Radar(this);
this.botManagement = new API.BotManagement(this);
this.fraud = new API.Fraud(this);
this.precursor = new API.Precursor(this);
this.originPostQuantumEncryption = new API.OriginPostQuantumEncryption(this);
this.originTLSComplianceModes = new API.OriginTLSComplianceModes(this);
this.googleTagGateway = new API.GoogleTagGateway(this);
this.zaraz = new API.Zaraz(this);
this.speed = new API.Speed(this);
this.dcvDelegation = new API.DCVDelegation(this);
this.hostnames = new API.Hostnames(this);
this.snippets = new API.Snippets(this);
this.realtimeKit = new API.RealtimeKit(this);
this.calls = new API.Calls(this);
this.moq = new API.MoQ(this);
this.managedDefense = new API.ManagedDefense(this);
this.cloudforceOne = new API.CloudforceOne(this);
this.aiGateway = new API.AIGateway(this);
this.flagship = new API.Flagship(this);
this.iam = new API.IAM(this);
this.cloudConnector = new API.CloudConnector(this);
this.botnetFeed = new API.BotnetFeed(this);
this.securityTXT = new API.SecurityTXT(this);
this.workflows = new API.Workflows(this);
this.resourceSharing = new API.ResourceSharing(this);
this.resourceTagging = new API.ResourceTagging(this);
this.leakedCredentialChecks = new API.LeakedCredentialChecks(this);
this.contentScanning = new API.ContentScanning(this);
this.aiSecurity = new API.AISecurity(this);
this.csamScanner = new API.CsamScanner(this);
this.abuseReports = new API.AbuseReports(this);
this.ai = new API.AI(this);
this.aiAudit = new API.AIAudit(this);
this.aiSearch = new API.AISearch(this);
this.securityCenter = new API.SecurityCenter(this);
this.browserRendering = new API.BrowserRendering(this);
this.customPages = new API.CustomPages(this);
this.secretsStore = new API.SecretsStore(this);
this.pipelines = new API.Pipelines(this);
this.schemaValidation = new API.SchemaValidation(this);
this.tokenValidation = new API.TokenValidation(this);
this.fieldExtractors = new API.FieldExtractors(this);
}
}
_a = Cloudflare;
Cloudflare.Cloudflare = _a;
Cloudflare.CloudflareError = Errors.CloudflareError;
Cloudflare.APIError = Errors.APIError;
Cloudflare.APIConnectionError = Errors.APIConnectionError;
Cloudflare.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
Cloudflare.APIUserAbortError = Errors.APIUserAbortError;
Cloudflare.NotFoundError = Errors.NotFoundError;
Cloudflare.ConflictError = Errors.ConflictError;
Cloudflare.RateLimitError = Errors.RateLimitError;
Cloudflare.BadRequestError = Errors.BadRequestError;
Cloudflare.AuthenticationError = Errors.AuthenticationError;
Cloudflare.InternalServerError = Errors.InternalServerError;
Cloudflare.PermissionDeniedError = Errors.PermissionDeniedError;
Cloudflare.UnprocessableEntityError = Errors.UnprocessableEntityError;
Cloudflare.toFile = Uploads.toFile;
Cloudflare.Accounts = Accounts;
Cloudflare.Organizations = Organizations;
Cloudflare.Tenants = Tenants;
Cloudflare.OriginCACertificates = OriginCACertificates;
Cloudflare.IPs = IPs;
Cloudflare.Memberships = Memberships;
Cloudflare.User = User;
Cloudflare.Zones = Zones;
Cloudflare.LoadBalancers = LoadBalancers;
Cloudflare.Cache = Cache;
Cloudflare.SSL = SSL;
Cloudflare.ACM = ACM;
Cloudflare.AnalyticsQuery = AnalyticsQuery;
Cloudflare.Argo = Argo;
Cloudflare.CertificateAuthorities = CertificateAuthorities;
Cloudflare.ClientCertificates = ClientCertificates;
Cloudflare.CustomCertificates = CustomCertificates;
Cloudflare.CustomCsrs = CustomCsrs;
Cloudflare.CustomHostnames = CustomHostnames;
Cloudflare.CustomNameservers = CustomNameservers;
Cloudflare.TenantCustomNameservers = TenantCustomNameservers;
Cloudflare.DNSFirewall = DNSFirewall;
Cloudflare.DNS = DNS;
Cloudflare.EmailSecurity = EmailSecurity;
Cloudflare.EmailAuth = EmailAuth;
Cloudflare.EmailRouting = EmailRouting;
Cloudflare.EmailSending = EmailSending;
Cloudflare.Filters = Filters;
Cloudflare.Firewall = Firewall;
Cloudflare.Healthchecks = Healthchecks;
Cloudflare.KeylessCertificates = KeylessCertificates;
Cloudflare.Logpush = Logpush;
Cloudflare.Logs = Logs;
Cloudflare.OriginTLSClientAuth = OriginTLSClientAuth;
Cloudflare.PageRules = PageRules;
Cloudflare.RateLimits = RateLimits;
Cloudflare.WaitingRooms = WaitingRooms;
Cloudflare.Web3 = Web3;
Cloudflare.Workers = Workers;
Cloudflare.KV = KV;
Cloudflare.DurableObjects = DurableObjects;
Cloudflare.Containers = Containers;
Cloudflare.Queues = Queues;
Cloudflare.APIGateway = APIGateway;
Cloudflare.ManagedTransforms = ManagedTransforms;
Cloudflare.PageShield = PageShield;
Cloudflare.Rulesets = Rulesets;
Cloudflare.URLNormalization = URLNormalization;
Cloudflare.Spectrum = Spectrum;
Cloudflare.Addressing = Addressing;
Cloudflare.DLS = DLS;
Cloudflare.AuditLogs = AuditLogs;
Cloudflare.Billing = Billing;
Cloudflare.BrandProtection = BrandProtection;
Cloudflare.Diagnostics = Diagnostics;
Cloudflare.Images = Images;
Cloudflare.Intel = Intel;
Cloudflare.MagicTransit = MagicTransit;
Cloudflare.DDoSProtection = DDoSProtection;
Cloudflare.MagicNetworkMonitoring = MagicNetworkMonitoring;
Cloudflare.MagicCloudNetworking = MagicCloudNetworking;
Cloudflare.NetworkInterconnects = NetworkInterconnects;
Cloudflare.MTLSCertificates = MTLSCertificates;
Cloudflare.Pages = Pages;
Cloudflare.Registrar = Registrar;
Cloudflare.RegistrarSandbox = RegistrarSandbox;
Cloudflare.RequestTracers = RequestTracers;
Cloudflare.Rules = Rules;
Cloudflare.Stream = Stream;
Cloudflare.Alerting = Alerting;
Cloudflare.D1Resource = D1Resource;
Cloudflare.R2 = R2;
Cloudflare.R2DataCatalog = R2DataCatalog;
Cloudflare.BasinCatalog = BasinCatalog;
Cloudflare.WorkersForPlatforms = WorkersForPlatforms;
Cloudflare.ZeroTrust = ZeroTrust;
Cloudflare.Turnstile = Turnstile;
Cloudflare.Connectivity = Connectivity;
Cloudflare.HyperdriveResource = HyperdriveResource;
Cloudflare.RUM = RUM;
Cloudflare.Vectorize = Vectorize;
Cloudflare.URLScanner = URLScanner;
Cloudflare.VulnerabilityScanner = VulnerabilityScanner;
Cloudflare.Radar = Radar;
Cloudflare.BotManagement = BotManagement;
Cloudflare.Fraud = Fraud;
Cloudflare.Precursor = Precursor;
Cloudflare.OriginPostQuantumEncryption = OriginPostQuantumEncryption;
Cloudflare.OriginTLSComplianceModes = OriginTLSComplianceModes;
Cloudflare.GoogleTagGateway = GoogleTagGateway;
Cloudflare.Zaraz = Zaraz;
Cloudflare.Speed = Speed;
Cloudflare.DCVDelegation = DCVDelegation;
Cloudflare.Hostnames = Hostnames;
Cloudflare.Snippets = Snippets;
Cloudflare.RealtimeKit = RealtimeKit;
Cloudflare.Calls = Calls;
Cloudflare.MoQ = MoQ;
Cloudflare.ManagedDefense = ManagedDefense;
Cloudflare.CloudforceOne = CloudforceOne;
Cloudflare.AIGateway = AIGateway;
Cloudflare.Flagship = Flagship;
Cloudflare.IAM = IAM;
Cloudflare.CloudConnector = CloudConnector;
Cloudflare.BotnetFeed = BotnetFeed;
Cloudflare.SecurityTXT = SecurityTXT;
Cloudflare.Workflows = Workflows;
Cloudflare.ResourceSharing = ResourceSharing;
Cloudflare.ResourceTagging = ResourceTagging;
Cloudflare.LeakedCredentialChecks = LeakedCredentialChecks;
Cloudflare.ContentScanning = ContentScanning;
Cloudflare.AISecurity = AISecurity;
Cloudflare.CsamScanner = CsamScanner;
Cloudflare.AbuseReports = AbuseReports;
Cloudflare.AI = AI;
Cloudflare.AIAudit = AIAudit;
Cloudflare.AISearch = AISearch;
Cloudflare.SecurityCenter = SecurityCenter;
Cloudflare.BrowserRendering = BrowserRendering;
Cloudflare.CustomPages = CustomPages;
Cloudflare.SecretsStore = SecretsStore;
Cloudflare.Pipelines = Pipelines;
Cloudflare.SchemaValidation = SchemaValidation;
Cloudflare.TokenValidation = TokenValidation;
Cloudflare.FieldExtractors = FieldExtractors;
return Cloudflare;
})();
//# sourceMappingURL=client.mjs.map