Skip to main content

Cloudflare/workers

@swamp/cloudflare/workersv2026.07.25.1· 1d agoMODELS
01README

Cloudflare workers infrastructure models

02Release Notes
  • Updated: query
03Models5
@swamp/cloudflare/workers/namespacesv2026.07.21.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()
Look up an existing Namespaces by matching global argument values and import it into state
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
@swamp/cloudflare/workers/queriesv2026.07.21.1queries.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
descriptionstring
namestringQuery name
parametersobject
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()
Look up an existing Queries by matching global argument values and import it into state
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
@swamp/cloudflare/workers/queryv2026.07.25.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.
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.
queryIdstringIdentifier 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).
timeframeobjectTimeframe for the query using Unix timestamps in milliseconds. 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()
Look up an existing Query by matching global argument values and import it into state
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
@swamp/cloudflare/workers/routesv2026.07.21.1routes.ts

Global Arguments

ArgumentTypeDescription
zone_idstringCloudflare zone ID
namestringInstance name for this resource (used as the unique identifier in the factory pattern)
idstringIdentifier.
patternstringPattern 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()
Look up an existing Routes by matching global argument values and import it into state
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
@swamp/cloudflare/workers/workersv2026.07.21.1workers.ts

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
created_onstringWhen the Worker was created.
deployed_on?stringWhen the Worker's most recent deployment was created. `null` if the Worker has never been deployed.
idstringImmutable ID of the Worker.
logpushbooleanWhether logpush is enabled for the Worker.
namestringName of the Worker.
observabilityobjectObservability settings for the Worker.
referencesobjectOther resources that reference the Worker and depend on it existing.
subdomainobjectSubdomain settings for the Worker.
tagsarrayTags associated with the Worker.
tail_consumersarrayOther Workers that should consume logs from the Worker.
updated_onstringWhen 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()
Look up an existing Workers by matching global argument values and import it into state
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
04Previous Versions5
2026.07.21.1
  • Updated: namespaces
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
2026.07.18.2

Modified 5 models

2026.06.08.2
  • Updated: namespaces
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
2026.05.29.1
  • Updated: namespaces
  • Updated: queries
  • Updated: query
  • Updated: routes
  • Updated: workers
2026.05.22.1
  • Added: namespaces
  • Added: queries
  • Added: query
  • Added: routes
  • Added: workers
05Stats
A
100 / 100
Downloads
3
Archive size
34.5 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
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms
07Labels