Skip to content

Commit

Permalink
feat(api): api update (#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and meorphis committed Jan 13, 2025
1 parent 5bef56e commit 67cd748
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1397
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cedc346a76dfdf50768c01a48e573dfaeddfe35be8910188d42fe3c5afaaa5bb.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1504fe697d2d7335627a605468544df46a79e9a8b355f91527556e6d25cf0f7a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ export interface ScriptUpdateResponse {
*/
etag?: string;

/**
* Whether a Worker contains assets.
*/
has_assets?: boolean;

/**
* Whether a Worker contains modules.
*/
has_modules?: boolean;

/**
* Whether Logpush is turned on for the Worker.
*/
Expand Down Expand Up @@ -203,6 +213,11 @@ export namespace ScriptUpdateParams {
* JSON encoded metadata about the uploaded parts and Worker configuration.
*/
export interface Metadata {
/**
* Configuration for assets within a Worker
*/
assets?: Metadata.Assets;

/**
* List of bindings available to the worker.
*/
Expand All @@ -228,6 +243,12 @@ export namespace ScriptUpdateParams {
*/
compatibility_flags?: Array<string>;

/**
* Retain assets which exist for a previously uploaded Worker version; used in lieu
* of providing a completion token.
*/
keep_assets?: boolean;

/**
* List of binding types to keep from previous_upload.
*/
Expand All @@ -250,14 +271,14 @@ export namespace ScriptUpdateParams {
migrations?: WorkersAPI.SingleStepMigrationParam | WorkersAPI.SteppedMigrationParam;

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
observability?: Metadata.Observability;

placement?: WorkersAPI.PlacementConfigurationParam;

/**
* List of strings to use as tags for this Worker
* List of strings to use as tags for this Worker.
*/
tags?: Array<string>;

Expand All @@ -272,12 +293,45 @@ export namespace ScriptUpdateParams {
usage_model?: 'bundled' | 'unbound';

/**
* Key-value pairs to use as tags for this version of this Worker
* Key-value pairs to use as tags for this version of this Worker.
*/
version_tags?: Record<string, string>;
}

export namespace Metadata {
/**
* Configuration for assets within a Worker
*/
export interface Assets {
/**
* Configuration for assets within a Worker.
*/
config?: Assets.Config;

/**
* Token provided upon successful upload of all files from a registered manifest.
*/
jwt?: string;
}

export namespace Assets {
/**
* Configuration for assets within a Worker.
*/
export interface Config {
/**
* Determines the redirects and rewrites of requests for HTML content.
*/
html_handling?: 'auto-trailing-slash' | 'force-trailing-slash' | 'drop-trailing-slash' | 'none';

/**
* Determines the response when a request does not match a static asset, and there
* is no Worker script.
*/
not_found_handling?: 'none' | '404-page' | 'single-page-application';
}
}

export interface Binding {
/**
* Name of the binding variable.
Expand All @@ -293,11 +347,11 @@ export namespace ScriptUpdateParams {
}

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface SettingEditResponse {
migrations?: WorkersAPI.SingleStepMigration | WorkersAPI.SteppedMigration;

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
observability?: SettingEditResponse.Observability;

Expand Down Expand Up @@ -109,11 +109,11 @@ export namespace SettingEditResponse {
}

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down Expand Up @@ -157,7 +157,7 @@ export interface SettingGetResponse {
migrations?: WorkersAPI.SingleStepMigration | WorkersAPI.SteppedMigration;

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
observability?: SettingGetResponse.Observability;

Expand Down Expand Up @@ -191,11 +191,11 @@ export namespace SettingGetResponse {
}

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down Expand Up @@ -252,7 +252,7 @@ export namespace SettingEditParams {
migrations?: WorkersAPI.SingleStepMigrationParam | WorkersAPI.SteppedMigrationParam;

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
observability?: Settings.Observability;

Expand Down Expand Up @@ -286,11 +286,11 @@ export namespace SettingEditParams {
}

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down
80 changes: 72 additions & 8 deletions src/resources/workers/scripts/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ export interface Script {
*/
etag?: string;

/**
* Whether a Worker contains assets.
*/
has_assets?: boolean;

/**
* Whether a Worker contains modules.
*/
has_modules?: boolean;

/**
* Whether Logpush is turned on for the Worker.
*/
Expand Down Expand Up @@ -179,7 +189,7 @@ export interface ScriptSetting {
logpush?: boolean;

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
observability?: ScriptSetting.Observability;

Expand All @@ -191,11 +201,11 @@ export interface ScriptSetting {

export namespace ScriptSetting {
/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down Expand Up @@ -223,6 +233,16 @@ export interface ScriptUpdateResponse {
*/
etag?: string;

/**
* Whether a Worker contains assets.
*/
has_assets?: boolean;

/**
* Whether a Worker contains modules.
*/
has_modules?: boolean;

/**
* Whether Logpush is turned on for the Worker.
*/
Expand Down Expand Up @@ -288,6 +308,11 @@ export namespace ScriptUpdateParams {
* JSON encoded metadata about the uploaded parts and Worker configuration.
*/
export interface Metadata {
/**
* Configuration for assets within a Worker
*/
assets?: Metadata.Assets;

/**
* List of bindings available to the worker.
*/
Expand All @@ -313,6 +338,12 @@ export namespace ScriptUpdateParams {
*/
compatibility_flags?: Array<string>;

/**
* Retain assets which exist for a previously uploaded Worker version; used in lieu
* of providing a completion token.
*/
keep_assets?: boolean;

/**
* List of binding types to keep from previous_upload.
*/
Expand All @@ -335,14 +366,14 @@ export namespace ScriptUpdateParams {
migrations?: WorkersAPI.SingleStepMigrationParam | WorkersAPI.SteppedMigrationParam;

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
observability?: Metadata.Observability;

placement?: WorkersAPI.PlacementConfigurationParam;

/**
* List of strings to use as tags for this Worker
* List of strings to use as tags for this Worker.
*/
tags?: Array<string>;

Expand All @@ -357,12 +388,45 @@ export namespace ScriptUpdateParams {
usage_model?: 'bundled' | 'unbound';

/**
* Key-value pairs to use as tags for this version of this Worker
* Key-value pairs to use as tags for this version of this Worker.
*/
version_tags?: Record<string, string>;
}

export namespace Metadata {
/**
* Configuration for assets within a Worker
*/
export interface Assets {
/**
* Configuration for assets within a Worker.
*/
config?: Assets.Config;

/**
* Token provided upon successful upload of all files from a registered manifest.
*/
jwt?: string;
}

export namespace Assets {
/**
* Configuration for assets within a Worker.
*/
export interface Config {
/**
* Determines the redirects and rewrites of requests for HTML content.
*/
html_handling?: 'auto-trailing-slash' | 'force-trailing-slash' | 'drop-trailing-slash' | 'none';

/**
* Determines the response when a request does not match a static asset, and there
* is no Worker script.
*/
not_found_handling?: 'none' | '404-page' | 'single-page-application';
}
}

export interface Binding {
/**
* Name of the binding variable.
Expand All @@ -378,11 +442,11 @@ export namespace ScriptUpdateParams {
}

/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down
6 changes: 3 additions & 3 deletions src/resources/workers/scripts/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface SettingEditParams {
logpush?: boolean;

/**
* Body param: Observability settings for the Worker
* Body param: Observability settings for the Worker.
*/
observability?: SettingEditParams.Observability;

Expand All @@ -69,11 +69,11 @@ export interface SettingEditParams {

export namespace SettingEditParams {
/**
* Observability settings for the Worker
* Observability settings for the Worker.
*/
export interface Observability {
/**
* Whether observability is enabled for the Worker
* Whether observability is enabled for the Worker.
*/
enabled: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ describe('resource scripts', () => {
await toFile(Buffer.from('# my file contents'), 'README.md'),
],
metadata: {
assets: {
config: { html_handling: 'auto-trailing-slash', not_found_handling: 'none' },
jwt: 'jwt',
},
bindings: [{ name: 'MY_ENV_VAR', type: 'plain_text' }],
body_part: 'worker.js',
compatibility_date: '2023-07-25',
compatibility_flags: ['string', 'string', 'string'],
keep_assets: false,
keep_bindings: ['string', 'string', 'string'],
logpush: false,
main_module: 'worker.js',
Expand Down
Loading

0 comments on commit 67cd748

Please sign in to comment.