Skip to main content

Cloudflare/workers

@swamp/cloudflare/workersv2026.10.23.1· AGPL-3.0-or-later· 3d agoBEHAVIORS
01README

Cloudflare workers infrastructure models

02Release Notes
  • Updated: namespaces
  • Updated: automations
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
03Behaviors6
@swamp/cloudflare/workers/automationsv2026.10.23.1automations.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
afterInactivitySeconds?number
afterOccurrences?number
enabled?boolean
name?string
policyId?string
service?string
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Automations
fn get(id: string)
Get a Automations
ArgumentTypeDescription
idstringThe ID of the Automations
fn lookup(allowMissing?: boolean)
Look up an existing Automations by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Automations by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Automations to import
fn update(identifier?: string)
Update Automations attributes
ArgumentTypeDescription
identifier?stringTarget a specific Automations by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Automations
ArgumentTypeDescription
idstringThe ID of the Automations
fn sync(identifier?: string)
Sync Automations state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Automations by id (e.g. one discovered by list)

Resources

state(infinite)— Automations resource state
lookupResult(infinite)— Outcome of the most recent lookup
@swamp/cloudflare/workers/namespacesv2026.10.23.1namespaces.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
name?stringThe name of the dispatch namespace.
trusted_workers?booleanWhether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted".
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Namespaces
fn get(id: string)
Get a Namespaces
ArgumentTypeDescription
idstringThe ID of the Namespaces
fn lookup(allowMissing?: boolean)
Look up an existing Namespaces by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Namespaces by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Namespaces to import
fn update(identifier?: string)
Update Namespaces attributes
ArgumentTypeDescription
identifier?stringTarget a specific Namespaces by name (e.g. one discovered by list)
fn delete(id: string)
Delete the Namespaces
ArgumentTypeDescription
idstringThe ID of the Namespaces
fn sync(identifier?: string)
Sync Namespaces state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Namespaces by name (e.g. one discovered by list)

Resources

state(infinite)— Namespaces resource state
lookupResult(infinite)— Outcome of the most recent lookup
@swamp/cloudflare/workers/queriesv2026.10.23.1queries.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
description?string
name?stringQuery name
parameters?object
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Queries
fn get(id: string)
Get a Queries
ArgumentTypeDescription
idstringThe ID of the Queries
fn lookup(allowMissing?: boolean)
Look up an existing Queries by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Queries by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Queries to import
fn update(identifier?: string)
Update Queries attributes
ArgumentTypeDescription
identifier?stringTarget a specific Queries by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Queries
ArgumentTypeDescription
idstringThe ID of the Queries
fn sync(identifier?: string)
Sync Queries state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Queries by id (e.g. one discovered by list)

Resources

state(infinite)— Queries resource state
lookupResult(infinite)— Outcome of the most recent lookup
@swamp/cloudflare/workers/queryv2026.10.23.1query.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
namestringInstance name for this resource (used as the unique identifier in the factory pattern)
chart?booleanWhen true, includes time-series data in the response.
chartType?enumControls the SQL shape and response payload for the 'calculations' view. Omitted or 'timeseries_and_aggregate': current behaviour — both the time-series and aggregate queries. 'timeseries': time-series only. 'aggregate': aggregate only. 'distribution': a bucketed 2D histogram (time × value buckets) returned in 'distribution' instead of 'calculations'. 'distribution' is not compatible with 'compare' — combining them returns a 400.
compare?booleanWhen true, includes a comparison dataset from the previous time period of equal length.
distributionScale?enumValue-axis bucketing for chartType 'distribution'. Omitted or 'log': geometric buckets, best for heavy-tailed latency. 'linear': fixed-width buckets, clearer for narrow or additive ranges. Ignored for other chartTypes. The response echoes the scheme used in distribution.bucketMode.
dry?booleanWhen true, executes the query without persisting the results. Useful for validation or previewing.
granularity?numberNumber of time-series buckets. Only used when view is 'calculations'. Omit to let the system auto-detect an appropriate granularity.
ignoreSeries?booleanWhen true, omits time-series data from the response and returns only aggregated values. Reduces response size when series are not needed.
limit?numberMaximum number of events to return when view is 'events'. Also controls the number of group-by rows when view is 'calculations'.
offset?stringCursor for pagination in event, trace, invocation, and agent views. Pass the $metadata.id of the last event, the trace cursor, or AgentRun.id to fetch the next page.
offsetBy?numberNumeric offset for paginating grouped/pattern results (top-N lists). Use together with limit. Not used by cursor-based pagination.
offsetDirection?stringPagination direction: 'next' for forward, 'prev' for backward.
parameters?objectQuery parameters defining what data to retrieve — filters, calculations, group-bys, and ordering. In practice this should always be provided for ad-hoc queries. Only omit when executing a previously saved query by queryId. Use the keys and values endpoints to discover available fields before building filters.
queryId?stringIdentifier for the query. When parameters are omitted, this ID is used to load a previously saved query's parameters. When providing parameters inline, pass any identifier (e.g. an ad-hoc ID).
timeframe?objectTimeframe for the query using Unix timestamps in milliseconds. 'from' must be earlier than 'to'. Narrower timeframes produce faster responses and more specific results.
view?enumControls the shape of the response. 'events': individual log lines matching the query. 'calculations': aggregated metrics (count, avg, p99, etc.) with optional group-by breakdowns and time-series. 'invocations': events grouped by request ID. 'traces': distributed trace summaries. 'agents': agent-specific trace summaries.
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Query
fn get(id: string)
Get a Query
ArgumentTypeDescription
idstringThe ID of the Query
fn lookup(allowMissing?: boolean)
Look up an existing Query by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Query by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Query to import
fn sync(identifier?: string)
Sync Query state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Query by id (e.g. one discovered by list)

Resources

state(infinite)— Query resource state
lookupResult(infinite)— Outcome of the most recent lookup
@swamp/cloudflare/workers/routesv2026.10.23.1routes.ts

Global Arguments

ArgumentTypeDescription
zone_idstringCloudflare zone ID
namestringInstance name for this resource (used as the unique identifier in the factory pattern)
id?stringIdentifier.
pattern?stringPattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
script?stringName of the script to run if the route matches.
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Routes
fn get(id: string)
Get a Routes
ArgumentTypeDescription
idstringThe ID of the Routes
fn lookup(allowMissing?: boolean)
Look up an existing Routes by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Routes by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Routes to import
fn update(identifier?: string)
Update Routes attributes
ArgumentTypeDescription
identifier?stringTarget a specific Routes by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Routes
ArgumentTypeDescription
idstringThe ID of the Routes
fn sync(identifier?: string)
Sync Routes state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Routes by id (e.g. one discovered by list)

Resources

state(infinite)— Routes resource state
lookupResult(infinite)— Outcome of the most recent lookup
@swamp/cloudflare/workers/workersv2026.10.23.1workers.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
created_on?stringWhen the Worker was created.
deployed_on?stringWhen the Worker's most recent deployment was created. `null` if the Worker has never been deployed.
id?stringImmutable ID of the Worker.
logpush?booleanWhether logpush is enabled for the Worker.
name?stringName of the Worker.
observability?objectObservability settings for the Worker.
previews_base_config?object
references?objectOther resources that reference the Worker and depend on it existing.
subdomain?objectSubdomain settings for the Worker.
tags?arrayTags associated with the Worker.
tail_consumers?arrayOther Workers that should consume logs from the Worker.
updated_on?stringWhen the Worker was most recently updated.
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Workers
fn get(id: string)
Get a Workers
ArgumentTypeDescription
idstringThe ID of the Workers
fn lookup(allowMissing?: boolean)
Look up an existing Workers by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Workers by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Workers to import
fn update(identifier?: string)
Update Workers attributes
ArgumentTypeDescription
identifier?stringTarget a specific Workers by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Workers
ArgumentTypeDescription
idstringThe ID of the Workers
fn sync(identifier?: string)
Sync Workers state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Workers by id (e.g. one discovered by list)

Resources

state(infinite)— Workers resource state
lookupResult(infinite)— Outcome of the most recent lookup
04Previous Versions19
2026.10.20.1AGPL-3.0-or-later
  • Updated: namespaces
  • Updated: automations
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers

Modified 6 behaviors

2026.10.16.1AGPL-3.0-or-later(was none)
2026.10.13.1
  • Updated: namespaces
  • Updated: automations
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
2026.10.08.1
  • Updated: query
2026.10.02.1
  • Updated: query
2026.09.29.2
  • Updated: automations
  • Updated: routes
2026.09.29.1
  • Updated: automations
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
2026.09.22.1
  • Updated: workers
2026.09.19.1
  • Added: automations

Added 1 behaviors

2026.09.16.1
  • Updated: workers
2026.08.26.1
  • Updated: query
  • Updated: workers
2026.08.25.2
  • Updated: queries
  • Updated: query
  • Updated: workers
2026.08.25.1
  • Updated: queries
  • Updated: query
  • Updated: workers
2026.08.15.1
  • Updated: workers
2026.08.11.2
  • Updated: queries
  • Updated: query
2026.07.25.1
  • Updated: query
2026.07.21.1
  • Updated: namespaces
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
2026.07.18.2

Modified 5 behaviors

2026.06.08.2
  • Updated: namespaces
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
05Stats
A
100 / 100
Downloads
86
Archive size
36.0 KB
Verified by Swamp
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
06Platforms
07Labels