UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

201 lines 8.79 kB
import * as Core from 'cloudflare/core'; import { APIResource } from 'cloudflare/resource'; import * as ScriptsScriptsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts'; import * as WorkersAPI from 'cloudflare/resources/workers/workers'; import * as ScriptsAPI from 'cloudflare/resources/workers/scripts/scripts'; import * as TailAPI from 'cloudflare/resources/workers/scripts/tail'; import * as BindingsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings'; import * as ContentAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/content'; import * as SecretsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets'; import * as SettingsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/settings'; import * as TagsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/tags'; import { type Uploadable } from 'cloudflare/core'; export declare class Scripts extends APIResource { content: ContentAPI.Content; settings: SettingsAPI.Settings; bindings: BindingsAPI.Bindings; secrets: SecretsAPI.Secrets; tags: TagsAPI.Tags; /** * Upload a worker module to a Workers for Platforms namespace. You can find an * example of the metadata on our docs: * https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/ */ update(dispatchNamespace: string, scriptName: string, params: ScriptUpdateParams, options?: Core.RequestOptions): Core.APIPromise<ScriptsAPI.Script>; /** * Delete a worker from a Workers for Platforms namespace. This call has no * response body on a successful delete. */ delete(dispatchNamespace: string, scriptName: string, params: ScriptDeleteParams, options?: Core.RequestOptions): Core.APIPromise<void>; /** * Fetch information about a script uploaded to a Workers for Platforms namespace. */ get(dispatchNamespace: string, scriptName: string, params: ScriptGetParams, options?: Core.RequestOptions): Core.APIPromise<Script>; } /** * Details about a worker uploaded to a Workers for Platforms namespace. */ export interface Script { /** * When the script was created. */ created_on?: string; /** * Name of the Workers for Platforms dispatch namespace. */ dispatch_namespace?: string; /** * When the script was last modified. */ modified_on?: string; script?: ScriptsAPI.Script; } export type ScriptUpdateParams = ScriptUpdateParams.Variant0 | ScriptUpdateParams.Variant1; export declare namespace ScriptUpdateParams { interface Variant0 { /** * Path param: Identifier */ account_id: string; /** * Body param: A module comprising a Worker script, often a javascript file. * Multiple modules may be provided as separate named parts, but at least one * module must be present and referenced in the metadata as `main_module` or * `body_part` by part name. Source maps may also be included using the * `application/source-map` content type. */ '<any part name>'?: Array<Uploadable>; /** * Body param: JSON encoded metadata about the uploaded parts and Worker * configuration. */ metadata?: ScriptUpdateParams.Variant0.Metadata; } namespace Variant0 { /** * JSON encoded metadata about the uploaded parts and Worker configuration. */ interface Metadata { /** * List of bindings available to the worker. */ bindings?: Array<unknown>; /** * Name of the part in the multipart request that contains the script (e.g. the * file adding a listener to the `fetch` event). Indicates a * `service worker syntax` Worker. */ body_part?: string; /** * Date indicating targeted support in the Workers runtime. Backwards incompatible * fixes to the runtime following this date will not affect this Worker. */ compatibility_date?: string; /** * Flags that enable or disable certain features in the Workers runtime. Used to * enable upcoming features or opt in or out of specific changes not included in a * `compatibility_date`. */ compatibility_flags?: Array<string>; /** * List of binding types to keep from previous_upload. */ keep_bindings?: Array<string>; /** * Whether Logpush is turned on for the Worker. */ logpush?: boolean; /** * Name of the part in the multipart request that contains the main module (e.g. * the file exporting a `fetch` handler). Indicates a `module syntax` Worker. */ main_module?: string; /** * Migrations to apply for Durable Objects associated with this Worker. */ migrations?: WorkersAPI.SingleStepMigration | WorkersAPI.SteppedMigration; placement?: WorkersAPI.PlacementConfiguration; /** * List of strings to use as tags for this Worker */ tags?: Array<string>; /** * List of Workers that will consume logs from the attached Worker. */ tail_consumers?: Array<TailAPI.ConsumerScript>; /** * Usage model to apply to invocations. */ usage_model?: 'bundled' | 'unbound'; /** * Key-value pairs to use as tags for this version of this Worker */ version_tags?: unknown; } } interface Variant1 { /** * Path param: Identifier */ account_id: string; /** * Body param: Rollback message to be associated with this deployment. Only parsed * when query param `"rollback_to"` is present. */ message?: string; } } export interface ScriptDeleteParams { /** * Path param: Identifier */ account_id: string; /** * Body param: */ body: unknown; /** * Query param: If set to true, delete will not be stopped by associated service * binding, durable object, or other binding. Any of these associated * bindings/durable objects will be deleted along with the script. */ force?: boolean; } export interface ScriptGetParams { /** * Identifier */ account_id: string; } export declare namespace Scripts { export import Script = ScriptsScriptsAPI.Script; export import ScriptUpdateParams = ScriptsScriptsAPI.ScriptUpdateParams; export import ScriptDeleteParams = ScriptsScriptsAPI.ScriptDeleteParams; export import ScriptGetParams = ScriptsScriptsAPI.ScriptGetParams; export import Content = ContentAPI.Content; export import ContentUpdateParams = ContentAPI.ContentUpdateParams; export import ContentGetParams = ContentAPI.ContentGetParams; export import Settings = SettingsAPI.Settings; export import SettingEditResponse = SettingsAPI.SettingEditResponse; export import SettingGetResponse = SettingsAPI.SettingGetResponse; export import SettingEditParams = SettingsAPI.SettingEditParams; export import SettingGetParams = SettingsAPI.SettingGetParams; export import Bindings = BindingsAPI.Bindings; export import BindingGetResponse = BindingsAPI.BindingGetResponse; export import BindingGetParams = BindingsAPI.BindingGetParams; export import Secrets = SecretsAPI.Secrets; export import SecretUpdateResponse = SecretsAPI.SecretUpdateResponse; export import SecretListResponse = SecretsAPI.SecretListResponse; export import SecretListResponsesSinglePage = SecretsAPI.SecretListResponsesSinglePage; export import SecretUpdateParams = SecretsAPI.SecretUpdateParams; export import SecretListParams = SecretsAPI.SecretListParams; export import Tags = TagsAPI.Tags; export import TagUpdateResponse = TagsAPI.TagUpdateResponse; export import TagListResponse = TagsAPI.TagListResponse; export import TagDeleteResponse = TagsAPI.TagDeleteResponse; export import TagListResponsesSinglePage = TagsAPI.TagListResponsesSinglePage; export import TagUpdateParams = TagsAPI.TagUpdateParams; export import TagListParams = TagsAPI.TagListParams; export import TagDeleteParams = TagsAPI.TagDeleteParams; } //# sourceMappingURL=scripts.d.ts.map