@pithy-sh/cloudflare 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -109,8 +109,19 @@ export declare class CloudflareWorkersManager extends CloudflareManager {
|
|
|
109
109
|
getWorkerVars(scriptName: string): Promise<Record<string, string> | null>;
|
|
110
110
|
/** Edit a Worker's settings (observability, logpush, tags, …). */
|
|
111
111
|
updateSettings(scriptName: string, settings: WorkerSettings): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Delete a Worker script.
|
|
114
|
+
*
|
|
115
|
+
* **Cloudflare refuses the delete while another Worker still binds the script** — as a service, a Durable
|
|
116
|
+
* Object namespace, or a dispatch outbound — unless it is forced. `force` sends that flag. It is the
|
|
117
|
+
* caller's to decide, because only the caller knows whether what binds the script is going too: a set of
|
|
118
|
+
* Workers that call each other can only be deleted forced, and one Worker another project still calls
|
|
119
|
+
* should not be. Forcing also removes what Cloudflare associates with the script, its Durable Objects
|
|
120
|
+
* included. wrangler's own `delete` forces only after a person has read the list of what will break.
|
|
121
|
+
*/
|
|
122
|
+
deleteWorker(scriptName: string, options?: {
|
|
123
|
+
force?: boolean;
|
|
124
|
+
}): Promise<void>;
|
|
114
125
|
/** List every version of a Worker script. */
|
|
115
126
|
listVersions(scriptName: string): Promise<VersionListResponse[]>;
|
|
116
127
|
/** Get one version of a Worker script. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workersManager.d.ts","sourceRoot":"","sources":["../../src/workers/workersManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAClG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,E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,21 @@ var CloudflareWorkersManager = class extends CloudflareManager {
|
|
|
186
186
|
...settings
|
|
187
187
|
}));
|
|
188
188
|
}
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Delete a Worker script.
|
|
191
|
+
*
|
|
192
|
+
* **Cloudflare refuses the delete while another Worker still binds the script** — as a service, a Durable
|
|
193
|
+
* Object namespace, or a dispatch outbound — unless it is forced. `force` sends that flag. It is the
|
|
194
|
+
* caller's to decide, because only the caller knows whether what binds the script is going too: a set of
|
|
195
|
+
* Workers that call each other can only be deleted forced, and one Worker another project still calls
|
|
196
|
+
* should not be. Forcing also removes what Cloudflare associates with the script, its Durable Objects
|
|
197
|
+
* included. wrangler's own `delete` forces only after a person has read the list of what will break.
|
|
198
|
+
*/
|
|
199
|
+
async deleteWorker(scriptName, options = {}) {
|
|
200
|
+
await cloudflareRequest(`delete worker '${scriptName}'`, () => this.getClient().workers.scripts.delete(scriptName, {
|
|
201
|
+
account_id: this.accountId,
|
|
202
|
+
...options.force === true ? { force: true } : {}
|
|
203
|
+
}, requestOptions));
|
|
192
204
|
}
|
|
193
205
|
/** List every version of a Worker script. */
|
|
194
206
|
async listVersions(scriptName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"js-base64": "^3.9.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@pithy-sh/core": "^0.
|
|
43
|
+
"@pithy-sh/core": "^0.7.0",
|
|
44
44
|
"zod": "^4.4.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -259,10 +259,23 @@ export class CloudflareWorkersManager extends CloudflareManager {
|
|
|
259
259
|
);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
/**
|
|
263
|
-
|
|
262
|
+
/**
|
|
263
|
+
* Delete a Worker script.
|
|
264
|
+
*
|
|
265
|
+
* **Cloudflare refuses the delete while another Worker still binds the script** — as a service, a Durable
|
|
266
|
+
* Object namespace, or a dispatch outbound — unless it is forced. `force` sends that flag. It is the
|
|
267
|
+
* caller's to decide, because only the caller knows whether what binds the script is going too: a set of
|
|
268
|
+
* Workers that call each other can only be deleted forced, and one Worker another project still calls
|
|
269
|
+
* should not be. Forcing also removes what Cloudflare associates with the script, its Durable Objects
|
|
270
|
+
* included. wrangler's own `delete` forces only after a person has read the list of what will break.
|
|
271
|
+
*/
|
|
272
|
+
async deleteWorker(scriptName: string, options: { force?: boolean } = {}): Promise<void> {
|
|
264
273
|
await cloudflareRequest(`delete worker '${scriptName}'`, () =>
|
|
265
|
-
this.getClient().workers.scripts.delete(
|
|
274
|
+
this.getClient().workers.scripts.delete(
|
|
275
|
+
scriptName,
|
|
276
|
+
{ account_id: this.accountId, ...(options.force === true ? { force: true } : {}) },
|
|
277
|
+
requestOptions,
|
|
278
|
+
),
|
|
266
279
|
);
|
|
267
280
|
}
|
|
268
281
|
|