scripts_versions
Creates, updates, deletes, gets or lists a scripts_versions resource.
Overview
| Name | scripts_versions |
| Type | Resource |
| Id | cloudflare.workers.scripts_versions |
Fields
The following fields are returned by SELECT queries:
- get_by_account
- list_by_account
Get Version Detail response.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the version. (example: 18f97339-c287-4872-9bdd-e2135c07ec12) |
metadata | object | |
number | number | Sequential version number. |
resources | object |
List Versions response.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the version. (example: 18f97339-c287-4872-9bdd-e2135c07ec12) |
metadata | object | |
number | number | Sequential version number. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_account | select | account_id, script_name, version_id | Retrieves detailed information about a specific version of a Workers script. | |
list_by_account | select | account_id, script_name | deployable, page, per_page | List of Worker Versions. The first version in the list is the latest version. |
create_by_account | insert | account_id, script_name, metadata | bindings_inherit | Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
script_name | string | The Worker script name. |
version_id | string | |
bindings_inherit | string | When set to "strict", the upload will fail if any inherit type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped. |
deployable | boolean | Only return versions that can be used in a deployment. Ignores pagination. |
page | integer | Current page. |
per_page | integer | Items per-page. |
SELECT examples
- get_by_account
- list_by_account
Retrieves detailed information about a specific version of a Workers script.
SELECT
id,
metadata,
number,
resources
FROM cloudflare.workers.scripts_versions
WHERE account_id = '{{ account_id }}' -- required
AND script_name = '{{ script_name }}' -- required
AND version_id = '{{ version_id }}' -- required
;
List of Worker Versions. The first version in the list is the latest version.
SELECT
id,
metadata,
number
FROM cloudflare.workers.scripts_versions
WHERE account_id = '{{ account_id }}' -- required
AND script_name = '{{ script_name }}' -- required
AND deployable = '{{ deployable }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- create_by_account
- Manifest
Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.
INSERT INTO cloudflare.workers.scripts_versions (
files,
metadata,
account_id,
script_name,
bindings_inherit
)
SELECT
'{{ files }}',
'{{ metadata }}' /* required */,
'{{ account_id }}',
'{{ script_name }}',
'{{ bindings_inherit }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: scripts_versions
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the scripts_versions resource.
- name: script_name
value: "{{ script_name }}"
description: Required parameter for the scripts_versions resource.
- name: files
value:
- "{{ files }}"
description: |
An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
- name: metadata
description: |
JSON-encoded metadata about the uploaded parts and Worker configuration.
value:
annotations:
workers/alias: "{{ workers/alias }}"
workers/message: "{{ workers/message }}"
workers/tag: "{{ workers/tag }}"
bindings:
- name: "{{ name }}"
type: "{{ type }}"
instance_name: "{{ instance_name }}"
namespace: "{{ namespace }}"
dataset: "{{ dataset }}"
database_id: "{{ database_id }}"
id: "{{ id }}"
part: "{{ part }}"
outbound:
params:
- name: "{{ name }}"
worker:
entrypoint: "{{ entrypoint }}"
environment: "{{ environment }}"
service: "{{ service }}"
class_name: "{{ class_name }}"
dispatch_namespace: "{{ dispatch_namespace }}"
environment: "{{ environment }}"
namespace_id: "{{ namespace_id }}"
script_name: "{{ script_name }}"
old_name: "{{ old_name }}"
version_id: "{{ version_id }}"
json: "{{ json }}"
certificate_id: "{{ certificate_id }}"
text: "{{ text }}"
pipeline: "{{ pipeline }}"
queue_name: "{{ queue_name }}"
simple:
limit: {{ limit }}
mitigation_timeout: {{ mitigation_timeout }}
period: {{ period }}
bucket_name: "{{ bucket_name }}"
jurisdiction: "{{ jurisdiction }}"
allowed_destination_addresses: "{{ allowed_destination_addresses }}"
allowed_sender_addresses: "{{ allowed_sender_addresses }}"
destination_address: "{{ destination_address }}"
entrypoint: "{{ entrypoint }}"
service: "{{ service }}"
index_name: "{{ index_name }}"
secret_name: "{{ secret_name }}"
store_id: "{{ store_id }}"
app_id: "{{ app_id }}"
algorithm: "{{ algorithm }}"
format: "{{ format }}"
key_base64: "{{ key_base64 }}"
key_jwk: "{{ key_jwk }}"
usages: "{{ usages }}"
workflow_name: "{{ workflow_name }}"
service_id: "{{ service_id }}"
network_id: "{{ network_id }}"
tunnel_id: "{{ tunnel_id }}"
compatibility_date: "{{ compatibility_date }}"
compatibility_flags:
- "{{ compatibility_flags }}"
keep_bindings:
- "{{ keep_bindings }}"
main_module: "{{ main_module }}"
usage_model: "{{ usage_model }}"
- name: bindings_inherit
value: "{{ bindings_inherit }}"
description: When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.
description: When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.