@theholocron/cloudflare-client 1.52.0 → 1.53.1
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.
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +7 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -177,7 +177,9 @@ declare function createCloudflareClient(opts: CloudflareClientOptions): {
|
|
|
177
177
|
};
|
|
178
178
|
workers: {
|
|
179
179
|
listScripts: (accountId: string) => Promise<CfWorkerScript[]>;
|
|
180
|
-
putScript: (accountId: string, scriptName: string, script: string
|
|
180
|
+
putScript: (accountId: string, scriptName: string, script: string, options?: {
|
|
181
|
+
keepSecrets?: boolean;
|
|
182
|
+
}) => Promise<void>;
|
|
181
183
|
listRoutes: (zoneId: string) => Promise<CfWorkerRoute[]>;
|
|
182
184
|
createRoute: (zoneId: string, pattern: string, script: string) => Promise<CfWorkerRoute>;
|
|
183
185
|
updateRoute: (zoneId: string, routeId: string, pattern: string, script: string) => Promise<CfWorkerRoute>;
|
package/dist/index.mjs
CHANGED
|
@@ -88,11 +88,16 @@ function workers(rest, opts) {
|
|
|
88
88
|
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
89
89
|
return {
|
|
90
90
|
listScripts: (accountId) => cfRequest(rest, "GET", `/accounts/${accountId}/workers/scripts`),
|
|
91
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Upload a script. Its secrets are kept by default, so a redeploy does not drop what was set earlier;
|
|
93
|
+
* pass `keepSecrets: false` to replace the script with no secrets bound.
|
|
94
|
+
*/
|
|
95
|
+
putScript: async (accountId, scriptName, script, options = {}) => {
|
|
92
96
|
const form = new FormData();
|
|
93
97
|
form.append("metadata", new Blob([JSON.stringify({
|
|
94
98
|
main_module: "index.js",
|
|
95
|
-
compatibility_date: "2025-08-31"
|
|
99
|
+
compatibility_date: "2025-08-31",
|
|
100
|
+
...options.keepSecrets === false ? {} : { keep_bindings: ["secret_text"] }
|
|
96
101
|
})], { type: "application/json" }));
|
|
97
102
|
form.append("index.js", new Blob([script], { type: "application/javascript+module" }), "index.js");
|
|
98
103
|
const path = `/accounts/${accountId}/workers/scripts/${encodeURIComponent(scriptName)}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/cloudflare-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.1",
|
|
4
4
|
"description": "A TypeScript client for the Cloudflare API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@theholocron/observability": "^0.3.0",
|
|
36
|
-
"@theholocron/http-client": "^1.
|
|
36
|
+
"@theholocron/http-client": "^1.53.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@theholocron/cli": "5.0.0-alpha.79",
|