Cloudflare/workers
@swamp/cloudflare/workersv2026.07.25.1
01README
Cloudflare workers infrastructure models
02Release Notes
- Updated: query
03Models
@swamp/cloudflare/workers/namespacesv2026.07.21.1namespaces.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| account_id | string | Cloudflare account ID |
| name? | string | The name of the dispatch namespace. |
| trusted_workers? | boolean | Whether 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? | string | Cloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault. |
| apiKey? | string | Cloudflare 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? | string | Cloudflare 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
| Argument | Type | Description |
|---|---|---|
| id | string | The 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
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Namespaces to import |
fn update(identifier?: string)
Update Namespaces attributes
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target a specific Namespaces by name (e.g. one discovered by list) |
fn delete(id: string)
Delete the Namespaces
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Namespaces |
fn sync(identifier?: string)
Sync Namespaces state from Cloudflare
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target 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
| Argument | Type | Description |
|---|---|---|
| account_id | string | Cloudflare account ID |
| description | string | |
| name | string | Query name |
| parameters | object | |
| apiToken? | string | Cloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault. |
| apiKey? | string | Cloudflare 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? | string | Cloudflare 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
| Argument | Type | Description |
|---|---|---|
| id | string | The 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
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Queries to import |
fn update(identifier?: string)
Update Queries attributes
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target a specific Queries by id (e.g. one discovered by list) |
fn delete(id: string)
Delete the Queries
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Queries |
fn sync(identifier?: string)
Sync Queries state from Cloudflare
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target 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
| Argument | Type | Description |
|---|---|---|
| account_id | string | Cloudflare account ID |
| name | string | Instance name for this resource (used as the unique identifier in the factory pattern) |
| chart? | boolean | When true, includes time-series data in the response. |
| chartType? | enum | Controls 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? | boolean | When true, includes a comparison dataset from the previous time period of equal length. |
| dry? | boolean | When true, executes the query without persisting the results. Useful for validation or previewing. |
| granularity? | number | Number of time-series buckets. Only used when view is 'calculations'. Omit to let the system auto-detect an appropriate granularity. |
| ignoreSeries? | boolean | When true, omits time-series data from the response and returns only aggregated values. Reduces response size when series are not needed. |
| limit? | number | Maximum number of events to return when view is 'events'. Also controls the number of group-by rows when view is 'calculations'. |
| offset? | string | Cursor 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? | number | Numeric offset for paginating grouped/pattern results (top-N lists). Use together with limit. Not used by cursor-based pagination. |
| offsetDirection? | string | Pagination direction: 'next' for forward, 'prev' for backward. |
| parameters? | object | Query 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 | string | Identifier 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 | object | Timeframe for the query using Unix timestamps in milliseconds. Narrower timeframes produce faster responses and more specific results. |
| view? | enum | Controls 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? | string | Cloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault. |
| apiKey? | string | Cloudflare 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? | string | Cloudflare 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
| Argument | Type | Description |
|---|---|---|
| id | string | The 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
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Query to import |
fn sync(identifier?: string)
Sync Query state from Cloudflare
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target 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
| Argument | Type | Description |
|---|---|---|
| zone_id | string | Cloudflare zone ID |
| name | string | Instance name for this resource (used as the unique identifier in the factory pattern) |
| id | string | Identifier. |
| pattern | string | Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). |
| script? | string | Name of the script to run if the route matches. |
| apiToken? | string | Cloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault. |
| apiKey? | string | Cloudflare 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? | string | Cloudflare 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
| Argument | Type | Description |
|---|---|---|
| id | string | The 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
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Routes to import |
fn update(identifier?: string)
Update Routes attributes
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target a specific Routes by id (e.g. one discovered by list) |
fn delete(id: string)
Delete the Routes
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Routes |
fn sync(identifier?: string)
Sync Routes state from Cloudflare
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target 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
| Argument | Type | Description |
|---|---|---|
| account_id | string | Cloudflare account ID |
| created_on | string | When the Worker was created. |
| deployed_on? | string | When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. |
| id | string | Immutable ID of the Worker. |
| logpush | boolean | Whether logpush is enabled for the Worker. |
| name | string | Name of the Worker. |
| observability | object | Observability settings for the Worker. |
| references | object | Other resources that reference the Worker and depend on it existing. |
| subdomain | object | Subdomain settings for the Worker. |
| tags | array | Tags associated with the Worker. |
| tail_consumers | array | Other Workers that should consume logs from the Worker. |
| updated_on | string | When the Worker was most recently updated. |
| apiToken? | string | Cloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault. |
| apiKey? | string | Cloudflare 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? | string | Cloudflare 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
| Argument | Type | Description |
|---|---|---|
| id | string | The 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
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Workers to import |
fn update(identifier?: string)
Update Workers attributes
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target a specific Workers by id (e.g. one discovered by list) |
fn delete(id: string)
Delete the Workers
| Argument | Type | Description |
|---|---|---|
| id | string | The ID of the Workers |
fn sync(identifier?: string)
Sync Workers state from Cloudflare
| Argument | Type | Description |
|---|---|---|
| identifier? | string | Target a specific Workers by id (e.g. one discovered by list) |
Resources
state(infinite)— Workers resource state
04Previous Versions
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