@mastra/deployer-cloudflare 0.0.1-alpha.34 → 0.0.1-alpha.5

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.
@@ -1,87 +0,0 @@
1
- // src/secrets-manager/index.ts
2
- var CloudflareSecretsManager = class {
3
- accountId;
4
- apiToken;
5
- baseUrl;
6
- constructor({ accountId, apiToken }) {
7
- this.accountId = accountId;
8
- this.apiToken = apiToken;
9
- this.baseUrl = "https://api.cloudflare.com/client/v4";
10
- }
11
- async createSecret({
12
- workerId,
13
- secretName,
14
- secretValue
15
- }) {
16
- const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets`;
17
- try {
18
- const response = await fetch(url, {
19
- method: "PUT",
20
- headers: {
21
- Authorization: `Bearer ${this.apiToken}`,
22
- "Content-Type": "application/json"
23
- },
24
- body: JSON.stringify({
25
- name: secretName,
26
- text: secretValue
27
- })
28
- });
29
- const data = await response.json();
30
- if (!data.success) {
31
- throw new Error(data.errors[0].message);
32
- }
33
- return data.result;
34
- } catch (error) {
35
- console.error("Failed to create secret:", error);
36
- throw error;
37
- }
38
- }
39
- async createProjectSecrets({
40
- workerId,
41
- customerId,
42
- envVars
43
- }) {
44
- const secretName = `PROJECT_${customerId.toUpperCase()}`;
45
- const secretValue = JSON.stringify(envVars);
46
- return this.createSecret({ workerId, secretName, secretValue });
47
- }
48
- async deleteSecret({ workerId, secretName }) {
49
- const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets/${secretName}`;
50
- try {
51
- const response = await fetch(url, {
52
- method: "DELETE",
53
- headers: {
54
- Authorization: `Bearer ${this.apiToken}`
55
- }
56
- });
57
- const data = await response.json();
58
- if (!data.success) {
59
- throw new Error(data.errors[0].message);
60
- }
61
- return data.result;
62
- } catch (error) {
63
- console.error("Failed to delete secret:", error);
64
- throw error;
65
- }
66
- }
67
- async listSecrets(workerId) {
68
- const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets`;
69
- try {
70
- const response = await fetch(url, {
71
- headers: {
72
- Authorization: `Bearer ${this.apiToken}`
73
- }
74
- });
75
- const data = await response.json();
76
- if (!data.success) {
77
- throw new Error(data.errors[0].message);
78
- }
79
- return data.result;
80
- } catch (error) {
81
- console.error("Failed to list secrets:", error);
82
- throw error;
83
- }
84
- }
85
- };
86
-
87
- export { CloudflareSecretsManager };
package/global.d.ts DELETED
@@ -1 +0,0 @@
1
- declare module 'rollup-plugin-shim';