freestyle-sandboxes 0.0.5 → 0.0.7
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/ai/index.d.cts +1 -1
- package/dist/ai/index.d.mts +1 -1
- package/dist/index.cjs +51 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.mts +15 -3
- package/dist/index.mjs +51 -1
- package/dist/types.gen-DbTb_SrD.d.ts +156 -0
- package/openapi/sdk.gen.ts +18 -1
- package/openapi/types.gen.ts +24 -0
- package/openapi.json +1 -432
- package/package.json +3 -2
- package/src/index.ts +47 -1
package/dist/ai/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
|
-
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-
|
|
2
|
+
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-DbTb_SrD.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/ai/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
|
-
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-
|
|
2
|
+
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-DbTb_SrD.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -15,6 +15,12 @@ const handleBackupCloudstate = (options) => {
|
|
|
15
15
|
url: "/cloudstate/v1/projects/:id/backup"
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
+
const handleVerifyDomain = (options) => {
|
|
19
|
+
return (options?.client ?? client).put({
|
|
20
|
+
...options,
|
|
21
|
+
url: "/domains/v1/verifications"
|
|
22
|
+
});
|
|
23
|
+
};
|
|
18
24
|
const handleExecuteScript = (options) => {
|
|
19
25
|
return (options?.client ?? client).post({
|
|
20
26
|
...options,
|
|
@@ -86,7 +92,11 @@ ${JSON.stringify(
|
|
|
86
92
|
return response.data;
|
|
87
93
|
} else {
|
|
88
94
|
throw new Error(
|
|
89
|
-
`Failed to deploy web project
|
|
95
|
+
`Failed to deploy web project
|
|
96
|
+
|
|
97
|
+
Status: ${response.response.status}
|
|
98
|
+
|
|
99
|
+
Message: ${response.error?.message}`
|
|
90
100
|
);
|
|
91
101
|
}
|
|
92
102
|
}
|
|
@@ -142,6 +152,46 @@ ${JSON.stringify(
|
|
|
142
152
|
throw new Error("Failed to get logs for sandbox");
|
|
143
153
|
}
|
|
144
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a a domain verification request.
|
|
157
|
+
* @param domain The domain to verify.
|
|
158
|
+
* @returns The domain verification token.
|
|
159
|
+
*/
|
|
160
|
+
async createDomainVerificationRequest(domain) {
|
|
161
|
+
const response = await handleVerifyDomain({
|
|
162
|
+
client: this.client,
|
|
163
|
+
body: {
|
|
164
|
+
domain
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
if (response.data) {
|
|
168
|
+
return response.data;
|
|
169
|
+
} else {
|
|
170
|
+
throw new Error(
|
|
171
|
+
`Failed to create domain verification request for domain ${domain}: ${response.error.message}`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Verify a domain. Note, this requires the domain verification token to be already set up.
|
|
177
|
+
* @param domain The domain to verify.
|
|
178
|
+
* @returns The domain verification request.
|
|
179
|
+
*/
|
|
180
|
+
async verifyDomain(domain) {
|
|
181
|
+
const response = await handleVerifyDomain({
|
|
182
|
+
client: this.client,
|
|
183
|
+
body: {
|
|
184
|
+
domain
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
if (response.data) {
|
|
188
|
+
return response.data;
|
|
189
|
+
} else {
|
|
190
|
+
throw new Error(
|
|
191
|
+
`Failed to verify domain ${domain}: ${response.error.message}`
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
145
195
|
}
|
|
146
196
|
|
|
147
197
|
exports.FreestyleSandboxes = FreestyleSandboxes;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponse, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse } from './types.gen-
|
|
2
|
-
export {
|
|
1
|
+
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponse, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleVerifyDomainResponse } from './types.gen-DbTb_SrD.js';
|
|
2
|
+
export { h as FreestyleCloudstateDeployConfiguration, i as FreestyleCloudstateDeployErrorResponse, j as FreestyleDeployWebErrorResponse, k as FreestyleDeployWebPayload, l as FreestyleDomainVerificationRequest, m as FreestyleExecureScriptResultError, n as FreestyleExecuteScriptParams, o as FreestyleFile, p as FreestyleLogResponseObject, q as FreestyleVerifyDomainRequest, u as HandleBackupCloudstateError, x as HandleCreateDomainVerificationData, r as HandleDeployCloudstateData, t as HandleDeployCloudstateError, s as HandleDeployCloudstateResponse, B as HandleDeployWebData, D as HandleDeployWebError, C as HandleDeployWebResponse, y as HandleExecuteScriptData, A as HandleExecuteScriptError, z as HandleExecuteScriptResponse, E as HandleGetLogsError, v as HandleVerifyDomainData, w as HandleVerifyDomainError } from './types.gen-DbTb_SrD.js';
|
|
3
3
|
|
|
4
4
|
declare class FreestyleSandboxes {
|
|
5
5
|
private client;
|
|
@@ -42,6 +42,18 @@ declare class FreestyleSandboxes {
|
|
|
42
42
|
* @throws An error if the logs could not be retrieved.
|
|
43
43
|
*/
|
|
44
44
|
getWebLogs(id: string): Promise<HandleGetLogsResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a a domain verification request.
|
|
47
|
+
* @param domain The domain to verify.
|
|
48
|
+
* @returns The domain verification token.
|
|
49
|
+
*/
|
|
50
|
+
createDomainVerificationRequest(domain: string): Promise<HandleVerifyDomainResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Verify a domain. Note, this requires the domain verification token to be already set up.
|
|
53
|
+
* @param domain The domain to verify.
|
|
54
|
+
* @returns The domain verification request.
|
|
55
|
+
*/
|
|
56
|
+
verifyDomain(domain: string): Promise<HandleVerifyDomainResponse>;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
|
-
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleGetLogsResponse };
|
|
59
|
+
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleGetLogsResponse, HandleVerifyDomainResponse };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponse, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse } from './types.gen-
|
|
2
|
-
export {
|
|
1
|
+
import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponse, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleVerifyDomainResponse } from './types.gen-DbTb_SrD.js';
|
|
2
|
+
export { h as FreestyleCloudstateDeployConfiguration, i as FreestyleCloudstateDeployErrorResponse, j as FreestyleDeployWebErrorResponse, k as FreestyleDeployWebPayload, l as FreestyleDomainVerificationRequest, m as FreestyleExecureScriptResultError, n as FreestyleExecuteScriptParams, o as FreestyleFile, p as FreestyleLogResponseObject, q as FreestyleVerifyDomainRequest, u as HandleBackupCloudstateError, x as HandleCreateDomainVerificationData, r as HandleDeployCloudstateData, t as HandleDeployCloudstateError, s as HandleDeployCloudstateResponse, B as HandleDeployWebData, D as HandleDeployWebError, C as HandleDeployWebResponse, y as HandleExecuteScriptData, A as HandleExecuteScriptError, z as HandleExecuteScriptResponse, E as HandleGetLogsError, v as HandleVerifyDomainData, w as HandleVerifyDomainError } from './types.gen-DbTb_SrD.js';
|
|
3
3
|
|
|
4
4
|
declare class FreestyleSandboxes {
|
|
5
5
|
private client;
|
|
@@ -42,6 +42,18 @@ declare class FreestyleSandboxes {
|
|
|
42
42
|
* @throws An error if the logs could not be retrieved.
|
|
43
43
|
*/
|
|
44
44
|
getWebLogs(id: string): Promise<HandleGetLogsResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a a domain verification request.
|
|
47
|
+
* @param domain The domain to verify.
|
|
48
|
+
* @returns The domain verification token.
|
|
49
|
+
*/
|
|
50
|
+
createDomainVerificationRequest(domain: string): Promise<HandleVerifyDomainResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Verify a domain. Note, this requires the domain verification token to be already set up.
|
|
53
|
+
* @param domain The domain to verify.
|
|
54
|
+
* @returns The domain verification request.
|
|
55
|
+
*/
|
|
56
|
+
verifyDomain(domain: string): Promise<HandleVerifyDomainResponse>;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
|
-
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleGetLogsResponse };
|
|
59
|
+
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleGetLogsResponse, HandleVerifyDomainResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,12 @@ const handleBackupCloudstate = (options) => {
|
|
|
13
13
|
url: "/cloudstate/v1/projects/:id/backup"
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
+
const handleVerifyDomain = (options) => {
|
|
17
|
+
return (options?.client ?? client).put({
|
|
18
|
+
...options,
|
|
19
|
+
url: "/domains/v1/verifications"
|
|
20
|
+
});
|
|
21
|
+
};
|
|
16
22
|
const handleExecuteScript = (options) => {
|
|
17
23
|
return (options?.client ?? client).post({
|
|
18
24
|
...options,
|
|
@@ -84,7 +90,11 @@ ${JSON.stringify(
|
|
|
84
90
|
return response.data;
|
|
85
91
|
} else {
|
|
86
92
|
throw new Error(
|
|
87
|
-
`Failed to deploy web project
|
|
93
|
+
`Failed to deploy web project
|
|
94
|
+
|
|
95
|
+
Status: ${response.response.status}
|
|
96
|
+
|
|
97
|
+
Message: ${response.error?.message}`
|
|
88
98
|
);
|
|
89
99
|
}
|
|
90
100
|
}
|
|
@@ -140,6 +150,46 @@ ${JSON.stringify(
|
|
|
140
150
|
throw new Error("Failed to get logs for sandbox");
|
|
141
151
|
}
|
|
142
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Create a a domain verification request.
|
|
155
|
+
* @param domain The domain to verify.
|
|
156
|
+
* @returns The domain verification token.
|
|
157
|
+
*/
|
|
158
|
+
async createDomainVerificationRequest(domain) {
|
|
159
|
+
const response = await handleVerifyDomain({
|
|
160
|
+
client: this.client,
|
|
161
|
+
body: {
|
|
162
|
+
domain
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
if (response.data) {
|
|
166
|
+
return response.data;
|
|
167
|
+
} else {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`Failed to create domain verification request for domain ${domain}: ${response.error.message}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Verify a domain. Note, this requires the domain verification token to be already set up.
|
|
175
|
+
* @param domain The domain to verify.
|
|
176
|
+
* @returns The domain verification request.
|
|
177
|
+
*/
|
|
178
|
+
async verifyDomain(domain) {
|
|
179
|
+
const response = await handleVerifyDomain({
|
|
180
|
+
client: this.client,
|
|
181
|
+
body: {
|
|
182
|
+
domain
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
if (response.data) {
|
|
186
|
+
return response.data;
|
|
187
|
+
} else {
|
|
188
|
+
throw new Error(
|
|
189
|
+
`Failed to verify domain ${domain}: ${response.error.message}`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
143
193
|
}
|
|
144
194
|
|
|
145
195
|
export { FreestyleSandboxes };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
type FreestyleCloudstateDeployConfiguration = {
|
|
2
|
+
/**
|
|
3
|
+
* ID of the project to deploy, if not provided will create a new project
|
|
4
|
+
*/
|
|
5
|
+
projectId?: (string) | null;
|
|
6
|
+
/**
|
|
7
|
+
* The environment variables that the cloudstate deploy can access
|
|
8
|
+
*/
|
|
9
|
+
envVars?: {
|
|
10
|
+
[key: string]: (string);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
type FreestyleCloudstateDeployErrorResponse = {
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
type FreestyleCloudstateDeployRequest = {
|
|
17
|
+
classes: string;
|
|
18
|
+
config?: FreestyleCloudstateDeployConfiguration;
|
|
19
|
+
};
|
|
20
|
+
type FreestyleCloudstateDeploySuccessResponse = {
|
|
21
|
+
/**
|
|
22
|
+
* The id of the project deployed to
|
|
23
|
+
*/
|
|
24
|
+
projectId: string;
|
|
25
|
+
};
|
|
26
|
+
type FreestyleDeployWebConfiguration = {
|
|
27
|
+
/**
|
|
28
|
+
* The entrypoint file for the website
|
|
29
|
+
*/
|
|
30
|
+
entrypoint?: (string) | null;
|
|
31
|
+
/**
|
|
32
|
+
* The custom domains for the website, eg. [\"subdomain.yourwebsite.com\"]. You may not include *.style.dev domains here, those are reserved for projectIds
|
|
33
|
+
*/
|
|
34
|
+
domains?: Array<(string)> | null;
|
|
35
|
+
/**
|
|
36
|
+
* The project id to deploy to, if not provided will create a new project, may be used to provision a new project with a specific id if that id is available
|
|
37
|
+
*/
|
|
38
|
+
projectId?: (string) | null;
|
|
39
|
+
/**
|
|
40
|
+
* Node Modules to install for the website, a map of package names to versions, e.g. { \"express\": \"4.17.1\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.
|
|
41
|
+
*/
|
|
42
|
+
nodeModules?: {
|
|
43
|
+
[key: string]: (string);
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* The environment variables that the website can access
|
|
47
|
+
* e.g. { \"RESEND_API_KEY\": \"re_123456789\" }
|
|
48
|
+
*/
|
|
49
|
+
envVars?: {
|
|
50
|
+
[key: string]: (string);
|
|
51
|
+
} | null;
|
|
52
|
+
};
|
|
53
|
+
type FreestyleDeployWebErrorResponse = {
|
|
54
|
+
message: string;
|
|
55
|
+
};
|
|
56
|
+
type FreestyleDeployWebPayload = {
|
|
57
|
+
/**
|
|
58
|
+
* The files to deploy, a map of file paths to file contents, e.g. { \"index.js\": {\"content\": \"your main\", \"encoding\": \"utf-8\"}, \"file2.js\": {\"content\": \"your helper\" } }
|
|
59
|
+
*
|
|
60
|
+
* **Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.
|
|
61
|
+
*/
|
|
62
|
+
files: {
|
|
63
|
+
[key: string]: FreestyleFile;
|
|
64
|
+
};
|
|
65
|
+
config?: FreestyleDeployWebConfiguration;
|
|
66
|
+
};
|
|
67
|
+
type FreestyleDeployWebSuccessResponse = {
|
|
68
|
+
projectId: string;
|
|
69
|
+
};
|
|
70
|
+
type FreestyleDomainVerificationRequest = {
|
|
71
|
+
domain: string;
|
|
72
|
+
};
|
|
73
|
+
type FreestyleExecureScriptResultError = {
|
|
74
|
+
error: string;
|
|
75
|
+
};
|
|
76
|
+
type FreestyleExecureScriptResultSuccess = {
|
|
77
|
+
result: unknown;
|
|
78
|
+
};
|
|
79
|
+
type FreestyleExecuteScriptParams = {
|
|
80
|
+
/**
|
|
81
|
+
* The JavaScript or TypeScript script to execute
|
|
82
|
+
*/
|
|
83
|
+
script: string;
|
|
84
|
+
config?: FreestyleExecuteScriptParamsConfiguration;
|
|
85
|
+
};
|
|
86
|
+
type FreestyleExecuteScriptParamsConfiguration = {
|
|
87
|
+
/**
|
|
88
|
+
* The environment variables to set for the script
|
|
89
|
+
*/
|
|
90
|
+
envVars?: {
|
|
91
|
+
[key: string]: (string);
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The node modules to install for the script
|
|
95
|
+
*/
|
|
96
|
+
nodeModules?: {
|
|
97
|
+
[key: string]: (string);
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Tags for you to organize your scripts, useful for tracking what you're running
|
|
101
|
+
*/
|
|
102
|
+
tags?: Array<(string)>;
|
|
103
|
+
/**
|
|
104
|
+
* The script timeout
|
|
105
|
+
*/
|
|
106
|
+
timeout?: (string) | null;
|
|
107
|
+
};
|
|
108
|
+
type FreestyleFile = {
|
|
109
|
+
/**
|
|
110
|
+
* The content of the file
|
|
111
|
+
*/
|
|
112
|
+
content: string;
|
|
113
|
+
/**
|
|
114
|
+
* The encoding of the file. Either **utf-8** or **base64**
|
|
115
|
+
*/
|
|
116
|
+
encoding?: string;
|
|
117
|
+
};
|
|
118
|
+
type FreestyleLogResponseObject = {
|
|
119
|
+
message: string;
|
|
120
|
+
};
|
|
121
|
+
type FreestyleVerifyDomainRequest = {
|
|
122
|
+
domain: string;
|
|
123
|
+
};
|
|
124
|
+
type HandleDeployCloudstateData = {
|
|
125
|
+
body: FreestyleCloudstateDeployRequest;
|
|
126
|
+
};
|
|
127
|
+
type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
|
|
128
|
+
type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
|
|
129
|
+
type HandleBackupCloudstateResponse = (Array<(number)>);
|
|
130
|
+
type HandleBackupCloudstateError = (unknown);
|
|
131
|
+
type HandleVerifyDomainData = {
|
|
132
|
+
body: FreestyleVerifyDomainRequest;
|
|
133
|
+
};
|
|
134
|
+
type HandleVerifyDomainResponse = ({
|
|
135
|
+
domain: string;
|
|
136
|
+
});
|
|
137
|
+
type HandleVerifyDomainError = ({
|
|
138
|
+
message: string;
|
|
139
|
+
});
|
|
140
|
+
type HandleCreateDomainVerificationData = {
|
|
141
|
+
body: FreestyleDomainVerificationRequest;
|
|
142
|
+
};
|
|
143
|
+
type HandleExecuteScriptData = {
|
|
144
|
+
body: FreestyleExecuteScriptParams;
|
|
145
|
+
};
|
|
146
|
+
type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
|
|
147
|
+
type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
|
|
148
|
+
type HandleDeployWebData = {
|
|
149
|
+
body: FreestyleDeployWebPayload;
|
|
150
|
+
};
|
|
151
|
+
type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
|
|
152
|
+
type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
|
|
153
|
+
type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
|
|
154
|
+
type HandleGetLogsError = unknown;
|
|
155
|
+
|
|
156
|
+
export type { HandleExecuteScriptError as A, HandleDeployWebData as B, HandleDeployWebResponse as C, HandleDeployWebError as D, HandleGetLogsError as E, FreestyleExecuteScriptParamsConfiguration as F, HandleBackupCloudstateResponse as H, FreestyleExecureScriptResultSuccess as a, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f, HandleVerifyDomainResponse as g, FreestyleCloudstateDeployConfiguration as h, FreestyleCloudstateDeployErrorResponse as i, FreestyleDeployWebErrorResponse as j, FreestyleDeployWebPayload as k, FreestyleDomainVerificationRequest as l, FreestyleExecureScriptResultError as m, FreestyleExecuteScriptParams as n, FreestyleFile as o, FreestyleLogResponseObject as p, FreestyleVerifyDomainRequest as q, HandleDeployCloudstateData as r, HandleDeployCloudstateResponse as s, HandleDeployCloudstateError as t, HandleBackupCloudstateError as u, HandleVerifyDomainData as v, HandleVerifyDomainError as w, HandleCreateDomainVerificationData as x, HandleExecuteScriptData as y, HandleExecuteScriptResponse as z };
|
package/openapi/sdk.gen.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
3
|
import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch';
|
|
4
|
-
import type { HandleDeployCloudstateData, HandleDeployCloudstateError, HandleDeployCloudstateResponse, HandleBackupCloudstateError, HandleBackupCloudstateResponse, HandleExecuteScriptData, HandleExecuteScriptError, HandleExecuteScriptResponse, HandleDeployWebData, HandleDeployWebError, HandleDeployWebResponse, HandleGetLogsError, HandleGetLogsResponse } from './types.gen';
|
|
4
|
+
import type { HandleDeployCloudstateData, HandleDeployCloudstateError, HandleDeployCloudstateResponse, HandleBackupCloudstateError, HandleBackupCloudstateResponse, HandleVerifyDomainData, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleCreateDomainVerificationData, HandleExecuteScriptData, HandleExecuteScriptError, HandleExecuteScriptResponse, HandleDeployWebData, HandleDeployWebError, HandleDeployWebResponse, HandleGetLogsError, HandleGetLogsResponse } from './types.gen';
|
|
5
5
|
|
|
6
6
|
export const client = createClient(createConfig());
|
|
7
7
|
|
|
@@ -27,6 +27,23 @@ export const handleBackupCloudstate = <ThrowOnError extends boolean = false>(opt
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
export const handleVerifyDomain = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleVerifyDomainData, ThrowOnError>) => {
|
|
31
|
+
return (options?.client ?? client).put<HandleVerifyDomainResponse, HandleVerifyDomainError, ThrowOnError>({
|
|
32
|
+
...options,
|
|
33
|
+
url: '/domains/v1/verifications'
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a domain verification request
|
|
39
|
+
*/
|
|
40
|
+
export const handleCreateDomainVerification = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleCreateDomainVerificationData, ThrowOnError>) => {
|
|
41
|
+
return (options?.client ?? client).post<void, unknown, ThrowOnError>({
|
|
42
|
+
...options,
|
|
43
|
+
url: '/domains/v1/verifications'
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
30
47
|
/**
|
|
31
48
|
* Execute Code
|
|
32
49
|
* Send a TypeScript or JavaScript module, get the result
|
package/openapi/types.gen.ts
CHANGED
|
@@ -77,6 +77,10 @@ export type FreestyleDeployWebSuccessResponse = {
|
|
|
77
77
|
projectId: string;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
export type FreestyleDomainVerificationRequest = {
|
|
81
|
+
domain: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
80
84
|
export type FreestyleExecureScriptResultError = {
|
|
81
85
|
error: string;
|
|
82
86
|
};
|
|
@@ -131,6 +135,10 @@ export type FreestyleLogResponseObject = {
|
|
|
131
135
|
message: string;
|
|
132
136
|
};
|
|
133
137
|
|
|
138
|
+
export type FreestyleVerifyDomainRequest = {
|
|
139
|
+
domain: string;
|
|
140
|
+
};
|
|
141
|
+
|
|
134
142
|
export type HandleDeployCloudstateData = {
|
|
135
143
|
body: FreestyleCloudstateDeployRequest;
|
|
136
144
|
};
|
|
@@ -143,6 +151,22 @@ export type HandleBackupCloudstateResponse = (Array<(number)>);
|
|
|
143
151
|
|
|
144
152
|
export type HandleBackupCloudstateError = (unknown);
|
|
145
153
|
|
|
154
|
+
export type HandleVerifyDomainData = {
|
|
155
|
+
body: FreestyleVerifyDomainRequest;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type HandleVerifyDomainResponse = ({
|
|
159
|
+
domain: string;
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export type HandleVerifyDomainError = ({
|
|
163
|
+
message: string;
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export type HandleCreateDomainVerificationData = {
|
|
167
|
+
body: FreestyleDomainVerificationRequest;
|
|
168
|
+
};
|
|
169
|
+
|
|
146
170
|
export type HandleExecuteScriptData = {
|
|
147
171
|
body: FreestyleExecuteScriptParams;
|
|
148
172
|
};
|
package/openapi.json
CHANGED
|
@@ -1,432 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.1.0",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "Freestyle Sandboxes",
|
|
5
|
-
"description": "\nFreestyle Sandboxes lets you deploy your users or AIs code.\n \nThey are broken up into 3 categories: [Web](#tag/web), [Execute](#tag/execute) and [Cloudstate](#tag/cloudstate).\n\n[Web](#tag/web): Send us the code for the website, we'll provision the certificates and get it hosted\n\n[Execute](#tag/execute): Send us a function, we'll run it and send you the output\n\n[Cloudstate](#tag/cloudstate): Our Opensource JavaScript Runtime used for cloud functions with persistent state\n",
|
|
6
|
-
"contact": { "name": "Ben", "email": "ben@freestyle.sh" },
|
|
7
|
-
"license": { "name": "" },
|
|
8
|
-
"version": "0.1.0"
|
|
9
|
-
},
|
|
10
|
-
"servers": [
|
|
11
|
-
{ "url": "https://api.freestyle.sh", "description": "Production" }
|
|
12
|
-
],
|
|
13
|
-
"paths": {
|
|
14
|
-
"/cloudstate/v1/deploy": {
|
|
15
|
-
"post": {
|
|
16
|
-
"tags": ["Cloudstate"],
|
|
17
|
-
"summary": "Deploy Cloudstate Project",
|
|
18
|
-
"description": "Deploy a cloudstate project",
|
|
19
|
-
"operationId": "handle_deploy_cloudstate",
|
|
20
|
-
"requestBody": {
|
|
21
|
-
"content": {
|
|
22
|
-
"application/json": {
|
|
23
|
-
"schema": {
|
|
24
|
-
"$ref": "#/components/schemas/FreestyleCloudstateDeployRequest"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"required": true
|
|
29
|
-
},
|
|
30
|
-
"responses": {
|
|
31
|
-
"200": {
|
|
32
|
-
"description": "successfully deployed",
|
|
33
|
-
"content": {
|
|
34
|
-
"application/json": {
|
|
35
|
-
"schema": {
|
|
36
|
-
"$ref": "#/components/schemas/FreestyleCloudstateDeploySuccessResponse"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"500": {
|
|
42
|
-
"description": "failed to deploy",
|
|
43
|
-
"content": {
|
|
44
|
-
"application/json": {
|
|
45
|
-
"schema": {
|
|
46
|
-
"$ref": "#/components/schemas/FreestyleCloudstateDeployErrorResponse"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"/cloudstate/v1/projects/:id/backup": {
|
|
55
|
-
"get": {
|
|
56
|
-
"tags": ["Cloudstate"],
|
|
57
|
-
"summary": "Get Backup of Cloudstate Project",
|
|
58
|
-
"description": "Get a backup of a cloudstate project",
|
|
59
|
-
"operationId": "handle_backup_cloudstate",
|
|
60
|
-
"responses": {
|
|
61
|
-
"200": {
|
|
62
|
-
"description": "successfully backed up",
|
|
63
|
-
"content": {
|
|
64
|
-
"application/octet-stream": {
|
|
65
|
-
"schema": {
|
|
66
|
-
"type": "array",
|
|
67
|
-
"items": {
|
|
68
|
-
"type": "integer",
|
|
69
|
-
"format": "int32",
|
|
70
|
-
"minimum": 0
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"500": { "description": "failed to backup" }
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"/execute/v1/script": {
|
|
81
|
-
"post": {
|
|
82
|
-
"tags": ["Execute"],
|
|
83
|
-
"summary": "Execute Code",
|
|
84
|
-
"description": "Send a TypeScript or JavaScript module, get the result",
|
|
85
|
-
"operationId": "handle_execute_script",
|
|
86
|
-
"requestBody": {
|
|
87
|
-
"content": {
|
|
88
|
-
"application/json": {
|
|
89
|
-
"schema": {
|
|
90
|
-
"$ref": "#/components/schemas/FreestyleExecuteScriptParams"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"required": true
|
|
95
|
-
},
|
|
96
|
-
"responses": {
|
|
97
|
-
"200": {
|
|
98
|
-
"description": "Success",
|
|
99
|
-
"content": {
|
|
100
|
-
"application/json": {
|
|
101
|
-
"schema": {
|
|
102
|
-
"$ref": "#/components/schemas/FreestyleExecureScriptResultSuccess"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"400": {
|
|
108
|
-
"description": "Error in your Script",
|
|
109
|
-
"content": {
|
|
110
|
-
"application/json": {
|
|
111
|
-
"schema": {
|
|
112
|
-
"$ref": "#/components/schemas/FreestyleExecureScriptResultError"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
"500": {
|
|
118
|
-
"description": "Internal Error",
|
|
119
|
-
"content": {
|
|
120
|
-
"application/json": {
|
|
121
|
-
"schema": {
|
|
122
|
-
"$ref": "#/components/schemas/FreestyleExecureScriptResultError"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"x-codeSamples": [
|
|
129
|
-
{
|
|
130
|
-
"label": "Human SDK",
|
|
131
|
-
"lang": "JavaScript",
|
|
132
|
-
"source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.executeScript(\n `export default () => {\n let set1 = [1, 2, 3, 4, 5];\n let set2 = [4, 5, 6, 7, 8];\n\n // find the sum of every value of each set multiplied by every value of the other set\n\n let sum = 0;\n for (let i = 0; i < set1.length; i++) {\n for (let j = 0; j < set2.length; j++) {\n sum += set1[i] * set2[j];\n }\n }\n\n return sum;\n};`\n);"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"label": "AI SDK",
|
|
136
|
-
"lang": "JavaScript",
|
|
137
|
-
"source": "import { executeTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst codeExecutor = executeTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n codeExecutor,\n },\n maxSteps: 2,\n prompt:\n 'What is the sum of every number between 1 and 12 multiplied by itself?',\n});"
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
"/web/v1/deploy": {
|
|
143
|
-
"post": {
|
|
144
|
-
"tags": ["Web"],
|
|
145
|
-
"summary": "Deploy a Website",
|
|
146
|
-
"description": "Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.",
|
|
147
|
-
"operationId": "handle_deploy_web",
|
|
148
|
-
"requestBody": {
|
|
149
|
-
"content": {
|
|
150
|
-
"application/json": {
|
|
151
|
-
"schema": {
|
|
152
|
-
"$ref": "#/components/schemas/FreestyleDeployWebPayload"
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
"required": true
|
|
157
|
-
},
|
|
158
|
-
"responses": {
|
|
159
|
-
"200": {
|
|
160
|
-
"description": "successfully deployed",
|
|
161
|
-
"content": {
|
|
162
|
-
"application/json": {
|
|
163
|
-
"schema": {
|
|
164
|
-
"$ref": "#/components/schemas/FreestyleDeployWebSuccessResponse"
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
"400": {
|
|
170
|
-
"description": "failed to deploy",
|
|
171
|
-
"content": {
|
|
172
|
-
"application/json": {
|
|
173
|
-
"schema": {
|
|
174
|
-
"$ref": "#/components/schemas/FreestyleDeployWebErrorResponse"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"x-codeSamples": [
|
|
181
|
-
{
|
|
182
|
-
"label": "Human SDK",
|
|
183
|
-
"lang": "JavaScript",
|
|
184
|
-
"source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .deployWeb({\n 'index.js': `\n import http from 'node:http';\n console.log('starting server');\n\n const server = http.createServer(async(req, res) => {\n // wait 5 seconds before responding\n // await new Promise((resolve) => setTimeout(resolve, 5000));\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Welcome to New York its been waiting for you');\n });\n\n server.listen(3000, () => {\n console.log('Server is running at http://localhost:3000');\n });`,\n })\n .then((result) => {\n console.log('Deployed website @ ', result.projectId);\n });\n"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"label": "AI SDK",
|
|
188
|
-
"lang": "JavaScript",
|
|
189
|
-
"source": "import { deployWebTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst deployer = deployWebTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n deployer,\n },\n maxSteps: 2,\n prompt:\n 'Deploy a website to subdomain.yourdomain.com that has all the lyrics to Sandstorm by Darude on the homepage',\n});"
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
"/web/v1/projects/:id/logs": {
|
|
195
|
-
"get": {
|
|
196
|
-
"tags": ["Web"],
|
|
197
|
-
"summary": "Get Website Logs",
|
|
198
|
-
"description": "Get the logs for a project",
|
|
199
|
-
"operationId": "handle_get_logs",
|
|
200
|
-
"responses": {
|
|
201
|
-
"200": {
|
|
202
|
-
"description": "",
|
|
203
|
-
"content": {
|
|
204
|
-
"application/json": {
|
|
205
|
-
"schema": {
|
|
206
|
-
"type": "array",
|
|
207
|
-
"items": {
|
|
208
|
-
"$ref": "#/components/schemas/FreestyleLogResponseObject"
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
"x-codeSamples": [
|
|
216
|
-
{
|
|
217
|
-
"label": "Human SDK",
|
|
218
|
-
"lang": "JavaScript",
|
|
219
|
-
"source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.getWebLogs('1234abcd-5678-efgh-ijkl-9012mnop3456').then((logs) => {\n console.log('Logs for project 1234abcd-5678-efgh-ijkl-9012mnop3456: ', logs);\n});"
|
|
220
|
-
}
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
"components": {
|
|
226
|
-
"schemas": {
|
|
227
|
-
"FreestyleCloudstateDeployConfiguration": {
|
|
228
|
-
"type": "object",
|
|
229
|
-
"properties": {
|
|
230
|
-
"projectId": {
|
|
231
|
-
"type": ["string", "null"],
|
|
232
|
-
"description": "ID of the project to deploy, if not provided will create a new project",
|
|
233
|
-
"default": null
|
|
234
|
-
},
|
|
235
|
-
"envVars": {
|
|
236
|
-
"type": "object",
|
|
237
|
-
"description": "The environment variables that the cloudstate deploy can access",
|
|
238
|
-
"default": {},
|
|
239
|
-
"additionalProperties": { "type": "string" },
|
|
240
|
-
"propertyNames": { "type": "string" }
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
"FreestyleCloudstateDeployErrorResponse": {
|
|
245
|
-
"type": "object",
|
|
246
|
-
"required": ["message"],
|
|
247
|
-
"properties": { "message": { "type": "string" } }
|
|
248
|
-
},
|
|
249
|
-
"FreestyleCloudstateDeployRequest": {
|
|
250
|
-
"type": "object",
|
|
251
|
-
"required": ["classes"],
|
|
252
|
-
"properties": {
|
|
253
|
-
"classes": { "type": "string" },
|
|
254
|
-
"config": {
|
|
255
|
-
"$ref": "#/components/schemas/FreestyleCloudstateDeployConfiguration"
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
"FreestyleCloudstateDeploySuccessResponse": {
|
|
260
|
-
"type": "object",
|
|
261
|
-
"required": ["projectId"],
|
|
262
|
-
"properties": {
|
|
263
|
-
"projectId": {
|
|
264
|
-
"type": "string",
|
|
265
|
-
"description": "The id of the project deployed to"
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
"FreestyleDeployWebConfiguration": {
|
|
270
|
-
"type": "object",
|
|
271
|
-
"properties": {
|
|
272
|
-
"entrypoint": {
|
|
273
|
-
"type": ["string", "null"],
|
|
274
|
-
"description": "The entrypoint file for the website",
|
|
275
|
-
"default": "index.js"
|
|
276
|
-
},
|
|
277
|
-
"domains": {
|
|
278
|
-
"type": ["array", "null"],
|
|
279
|
-
"items": { "type": "string" },
|
|
280
|
-
"description": "The custom domains for the website, eg. [\\\"subdomain.yourwebsite.com\\\"]. You may not include *.style.dev domains here, those are reserved for projectIds",
|
|
281
|
-
"example": ["subdomain.yourdomain.com"],
|
|
282
|
-
"default": null
|
|
283
|
-
},
|
|
284
|
-
"projectId": {
|
|
285
|
-
"type": ["string", "null"],
|
|
286
|
-
"description": "The project id to deploy to, if not provided will create a new project, may be used to provision a new project with a specific id if that id is available",
|
|
287
|
-
"default": null
|
|
288
|
-
},
|
|
289
|
-
"nodeModules": {
|
|
290
|
-
"type": ["object", "null"],
|
|
291
|
-
"description": "Node Modules to install for the website, a map of package names to versions, e.g. { \\\"express\\\": \\\"4.17.1\\\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.",
|
|
292
|
-
"default": null,
|
|
293
|
-
"additionalProperties": { "type": "string" },
|
|
294
|
-
"propertyNames": { "type": "string" },
|
|
295
|
-
"example": { "resend": "4.0.1" }
|
|
296
|
-
},
|
|
297
|
-
"envVars": {
|
|
298
|
-
"type": ["object", "null"],
|
|
299
|
-
"description": "The environment variables that the website can access\ne.g. { \\\"RESEND_API_KEY\\\": \\\"re_123456789\\\" }",
|
|
300
|
-
"default": null,
|
|
301
|
-
"additionalProperties": { "type": "string" },
|
|
302
|
-
"propertyNames": { "type": "string" },
|
|
303
|
-
"example": { "RESEND_API_KEY": "re_123456789" }
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
"FreestyleDeployWebErrorResponse": {
|
|
308
|
-
"type": "object",
|
|
309
|
-
"required": ["message"],
|
|
310
|
-
"properties": { "message": { "type": "string" } }
|
|
311
|
-
},
|
|
312
|
-
"FreestyleDeployWebPayload": {
|
|
313
|
-
"type": "object",
|
|
314
|
-
"required": ["files"],
|
|
315
|
-
"properties": {
|
|
316
|
-
"files": {
|
|
317
|
-
"type": "object",
|
|
318
|
-
"description": "The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.",
|
|
319
|
-
"additionalProperties": {
|
|
320
|
-
"$ref": "#/components/schemas/FreestyleFile"
|
|
321
|
-
},
|
|
322
|
-
"propertyNames": { "type": "string" },
|
|
323
|
-
"example": {
|
|
324
|
-
"index.js": {
|
|
325
|
-
"content": "import http from 'node:http';\\n// import { resolver } from './file2.js';\\n\\nconsole.log('starting server');\\n\\nconst server = http.createServer(async(req, res) => {\\n // wait 5 seconds before responding\\n // await new Promise((resolve) => setTimeout(resolve, 5000));\\n res.writeHead(200, { 'Content-Type': 'text/plain' });\\n res.end('Welcome to New York its been waiting for you');\\n});\\n\\nserver.listen(3000, () => {\\n console.log('Server is running at http://localhost:3000');\\n});"
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
"config": {
|
|
330
|
-
"$ref": "#/components/schemas/FreestyleDeployWebConfiguration"
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
"FreestyleDeployWebSuccessResponse": {
|
|
335
|
-
"type": "object",
|
|
336
|
-
"required": ["projectId"],
|
|
337
|
-
"properties": { "projectId": { "type": "string" } }
|
|
338
|
-
},
|
|
339
|
-
"FreestyleExecureScriptResultError": {
|
|
340
|
-
"type": "object",
|
|
341
|
-
"required": ["error"],
|
|
342
|
-
"properties": { "error": { "type": "string" } }
|
|
343
|
-
},
|
|
344
|
-
"FreestyleExecureScriptResultSuccess": {
|
|
345
|
-
"type": "object",
|
|
346
|
-
"required": ["result"],
|
|
347
|
-
"properties": { "result": {} }
|
|
348
|
-
},
|
|
349
|
-
"FreestyleExecuteScriptParams": {
|
|
350
|
-
"type": "object",
|
|
351
|
-
"required": ["script"],
|
|
352
|
-
"properties": {
|
|
353
|
-
"script": {
|
|
354
|
-
"type": "string",
|
|
355
|
-
"description": "The JavaScript or TypeScript script to execute",
|
|
356
|
-
"example": "export default () => {\n // get the value of the factorials of the numbers from 1 to 10 combined\n const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\n function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n }\n\n const b = a.map(factorial);\n\n return b.reduce((a, b) => a + b);\n};\n"
|
|
357
|
-
},
|
|
358
|
-
"config": {
|
|
359
|
-
"$ref": "#/components/schemas/FreestyleExecuteScriptParamsConfiguration"
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
"FreestyleExecuteScriptParamsConfiguration": {
|
|
364
|
-
"type": "object",
|
|
365
|
-
"properties": {
|
|
366
|
-
"envVars": {
|
|
367
|
-
"type": "object",
|
|
368
|
-
"description": "The environment variables to set for the script",
|
|
369
|
-
"default": {},
|
|
370
|
-
"additionalProperties": { "type": "string" },
|
|
371
|
-
"propertyNames": { "type": "string" },
|
|
372
|
-
"example": { "RESEND_API_KEY": "re_123456789" }
|
|
373
|
-
},
|
|
374
|
-
"nodeModules": {
|
|
375
|
-
"type": "object",
|
|
376
|
-
"description": "The node modules to install for the script",
|
|
377
|
-
"default": {},
|
|
378
|
-
"additionalProperties": { "type": "string" },
|
|
379
|
-
"propertyNames": { "type": "string" },
|
|
380
|
-
"example": { "resend": "4.0.1" }
|
|
381
|
-
},
|
|
382
|
-
"tags": {
|
|
383
|
-
"type": "array",
|
|
384
|
-
"items": { "type": "string" },
|
|
385
|
-
"description": "Tags for you to organize your scripts, useful for tracking what you're running",
|
|
386
|
-
"example": ["email"],
|
|
387
|
-
"default": []
|
|
388
|
-
},
|
|
389
|
-
"timeout": {
|
|
390
|
-
"type": ["string", "null"],
|
|
391
|
-
"description": "The script timeout",
|
|
392
|
-
"default": null
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
"FreestyleFile": {
|
|
397
|
-
"type": "object",
|
|
398
|
-
"required": ["content"],
|
|
399
|
-
"properties": {
|
|
400
|
-
"content": {
|
|
401
|
-
"type": "string",
|
|
402
|
-
"description": "The content of the file"
|
|
403
|
-
},
|
|
404
|
-
"encoding": {
|
|
405
|
-
"type": "string",
|
|
406
|
-
"description": "The encoding of the file. Either **utf-8** or **base64**"
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
"FreestyleLogResponseObject": {
|
|
411
|
-
"type": "object",
|
|
412
|
-
"required": ["message"],
|
|
413
|
-
"properties": { "message": { "type": "string" } }
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
"securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } }
|
|
417
|
-
},
|
|
418
|
-
"tags": [
|
|
419
|
-
{
|
|
420
|
-
"name": "Web",
|
|
421
|
-
"description": "APIs for deploying websites. We handle node modules caching, scaling, certificates and the whole end to end process. Send the code using the [deploy](#tag/web/POST/web/v1/deploy) endpoint, and you'll get a full hosted website back. Works with any TypeScript or JavaScript codebase."
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"name": "Execute",
|
|
425
|
-
"description": "APIs for running code. Send the code using the [execute](#tag/execute/POST/execute/v1/execute) endpoint, and you'll get the output back. Works with any TypeScript or JavaScript code + handles any node modules and environment variables you want."
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
"name": "Cloudstate",
|
|
429
|
-
"description": "APIs for running cloud functions with persistent state. [Cloudstate](https://github.com/freestyle-sh/cloudstate/) is an opensource, durable JavaScript runtime maintained by the Freestyle Team."
|
|
430
|
-
}
|
|
431
|
-
]
|
|
432
|
-
}
|
|
1
|
+
{"openapi":"3.1.0","info":{"title":"Freestyle Sandboxes","description":"\nFreestyle Sandboxes lets you deploy your users or AIs code.\n \nThey are broken up into 3 categories: [Web](#tag/web), [Execute](#tag/execute) and [Cloudstate](#tag/cloudstate).\n\n[Web](#tag/web): Send us the code for the website, we'll provision the certificates and get it hosted\n\n[Execute](#tag/execute): Send us a function, we'll run it and send you the output\n\n[Cloudstate](#tag/cloudstate): Our Opensource JavaScript Runtime used for cloud functions with persistent state\n","contact":{"name":"Ben","email":"ben@freestyle.sh"},"license":{"name":""},"version":"0.1.0"},"servers":[{"url":"https://api.freestyle.sh","description":"Production"}],"paths":{"/cloudstate/v1/deploy":{"post":{"tags":["Cloudstate"],"summary":"Deploy Cloudstate Project","description":"Deploy a cloudstate project","operationId":"handle_deploy_cloudstate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployRequest"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeploySuccessResponse"}}}},"500":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployErrorResponse"}}}}}}},"/cloudstate/v1/projects/:id/backup":{"get":{"tags":["Cloudstate"],"summary":"Get Backup of Cloudstate Project","description":"Get a backup of a cloudstate project","operationId":"handle_backup_cloudstate","responses":{"200":{"description":"successfully backed up","content":{"application/octet-stream":{"schema":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}}},"500":{"description":"failed to backup"}}}},"/domains/v1/verifications":{"put":{"tags":["Domains"],"operationId":"handle_verify_domain","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleVerifyDomainRequest"}}},"required":true},"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string"}}}}}},"400":{"description":"Failed to verify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Domains"],"summary":"Create a domain verification request","operationId":"handle_create_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDomainVerificationRequest"}}},"required":true},"responses":{}}},"/execute/v1/script":{"post":{"tags":["Execute"],"summary":"Execute Code","description":"Send a TypeScript or JavaScript module, get the result","operationId":"handle_execute_script","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecuteScriptParams"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecureScriptResultSuccess"}}}},"400":{"description":"Error in your Script","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecureScriptResultError"}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecureScriptResultError"}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.executeScript(\n `export default () => {\n let set1 = [1, 2, 3, 4, 5];\n let set2 = [4, 5, 6, 7, 8];\n\n // find the sum of every value of each set multiplied by every value of the other set\n\n let sum = 0;\n for (let i = 0; i < set1.length; i++) {\n for (let j = 0; j < set2.length; j++) {\n sum += set1[i] * set2[j];\n }\n }\n\n return sum;\n};`\n);"},{"label":"AI SDK","lang":"JavaScript","source":"import { executeTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst codeExecutor = executeTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n codeExecutor,\n },\n maxSteps: 2,\n prompt:\n 'What is the sum of every number between 1 and 12 multiplied by itself?',\n});"}]}},"/web/v1/deploy":{"post":{"tags":["Web"],"summary":"Deploy a Website","description":"Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.","operationId":"handle_deploy_web","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebPayload"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebSuccessResponse"}}}},"400":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebErrorResponse"}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .deployWeb({\n 'index.js': {\n content:`\n import http from 'node:http';\n console.log('starting server');\n\n const server = http.createServer(async(req, res) => {\n // wait 5 seconds before responding\n // await new Promise((resolve) => setTimeout(resolve, 5000));\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Welcome to New York its been waiting for you');\n });\n\n server.listen(3000, () => {\n console.log('Server is running at http://localhost:3000');\n });`,\n })\n .then((result) => {\n console.log('Deployed website @ ', result.projectId);\n });\n"},{"label":"AI SDK","lang":"JavaScript","source":"import { deployWebTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst deployer = deployWebTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n deployer,\n },\n maxSteps: 2,\n prompt:\n 'Deploy a website to subdomain.yourdomain.com that has all the lyrics to Sandstorm by Darude on the homepage',\n});"}]}},"/web/v1/projects/:id/logs":{"get":{"tags":["Web"],"summary":"Get Website Logs","description":"Get the logs for a project","operationId":"handle_get_logs","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleLogResponseObject"}}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.getWebLogs('1234abcd-5678-efgh-ijkl-9012mnop3456').then((logs) => {\n console.log('Logs for project 1234abcd-5678-efgh-ijkl-9012mnop3456: ', logs);\n});"}]}}},"components":{"schemas":{"FreestyleCloudstateDeployConfiguration":{"type":"object","properties":{"projectId":{"type":["string","null"],"description":"ID of the project to deploy, if not provided will create a new project","default":null},"envVars":{"type":"object","description":"The environment variables that the cloudstate deploy can access","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"FreestyleCloudstateDeployErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleCloudstateDeployRequest":{"type":"object","required":["classes"],"properties":{"classes":{"type":"string"},"config":{"$ref":"#/components/schemas/FreestyleCloudstateDeployConfiguration"}}},"FreestyleCloudstateDeploySuccessResponse":{"type":"object","required":["projectId"],"properties":{"projectId":{"type":"string","description":"The id of the project deployed to"}}},"FreestyleDeployWebConfiguration":{"type":"object","properties":{"entrypoint":{"type":["string","null"],"description":"The entrypoint file for the website","default":"index.js"},"domains":{"type":["array","null"],"items":{"type":"string"},"description":"The custom domains for the website, eg. [\\\"subdomain.yourwebsite.com\\\"]. You may not include *.style.dev domains here, those are reserved for projectIds","example":["subdomain.yourdomain.com"],"default":null},"projectId":{"type":["string","null"],"description":"The project id to deploy to, if not provided will create a new project, may be used to provision a new project with a specific id if that id is available","default":null},"nodeModules":{"type":["object","null"],"description":"Node Modules to install for the website, a map of package names to versions, e.g. { \\\"express\\\": \\\"4.17.1\\\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"envVars":{"type":["object","null"],"description":"The environment variables that the website can access\ne.g. { \\\"RESEND_API_KEY\\\": \\\"re_123456789\\\" }","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}}}},"FreestyleDeployWebErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleDeployWebPayload":{"type":"object","required":["files"],"properties":{"files":{"type":"object","description":"The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.","additionalProperties":{"$ref":"#/components/schemas/FreestyleFile"},"propertyNames":{"type":"string"},"example":{"index.js":{"content":"import http from 'node:http';\\n// import { resolver } from './file2.js';\\n\\nconsole.log('starting server');\\n\\nconst server = http.createServer(async(req, res) => {\\n // wait 5 seconds before responding\\n // await new Promise((resolve) => setTimeout(resolve, 5000));\\n res.writeHead(200, { 'Content-Type': 'text/plain' });\\n res.end('Welcome to New York its been waiting for you');\\n});\\n\\nserver.listen(3000, () => {\\n console.log('Server is running at http://localhost:3000');\\n});"}}},"config":{"$ref":"#/components/schemas/FreestyleDeployWebConfiguration"}}},"FreestyleDeployWebSuccessResponse":{"type":"object","required":["projectId"],"properties":{"projectId":{"type":"string"}}},"FreestyleDomainVerificationRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string"}}},"FreestyleExecureScriptResultError":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"FreestyleExecureScriptResultSuccess":{"type":"object","required":["result"],"properties":{"result":{}}},"FreestyleExecuteScriptParams":{"type":"object","required":["script"],"properties":{"script":{"type":"string","description":"The JavaScript or TypeScript script to execute","example":"export default () => {\n // get the value of the factorials of the numbers from 1 to 10 combined\n const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\n function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n }\n\n const b = a.map(factorial);\n\n return b.reduce((a, b) => a + b);\n};\n"},"config":{"$ref":"#/components/schemas/FreestyleExecuteScriptParamsConfiguration"}}},"FreestyleExecuteScriptParamsConfiguration":{"type":"object","properties":{"envVars":{"type":"object","description":"The environment variables to set for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"nodeModules":{"type":"object","description":"The node modules to install for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"tags":{"type":"array","items":{"type":"string"},"description":"Tags for you to organize your scripts, useful for tracking what you're running","example":["email"],"default":[]},"timeout":{"type":["string","null"],"description":"The script timeout","default":null}}},"FreestyleFile":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"The content of the file"},"encoding":{"type":"string","description":"The encoding of the file. Either **utf-8** or **base64**"}}},"FreestyleLogResponseObject":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleVerifyDomainRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string"}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Web","description":"APIs for deploying websites. We handle node modules caching, scaling, certificates and the whole end to end process. Send the code using the [deploy](#tag/web/POST/web/v1/deploy) endpoint, and you'll get a full hosted website back. Works with any TypeScript or JavaScript codebase."},{"name":"Execute","description":"APIs for running code. Send the code using the [execute](#tag/execute/POST/execute/v1/execute) endpoint, and you'll get the output back. Works with any TypeScript or JavaScript code + handles any node modules and environment variables you want."},{"name":"Cloudstate","description":"APIs for running cloud functions with persistent state. [Cloudstate](https://github.com/freestyle-sh/cloudstate/) is an opensource, durable JavaScript runtime maintained by the Freestyle Team."}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "freestyle-sandboxes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
"openai": "^4.77.3",
|
|
47
47
|
"openapi": "^1.0.1",
|
|
48
48
|
"zod": "^3.24.1"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
|
|
50
51
|
}
|
package/src/index.ts
CHANGED
|
@@ -70,7 +70,7 @@ export class FreestyleSandboxes {
|
|
|
70
70
|
return response.data;
|
|
71
71
|
} else {
|
|
72
72
|
throw new Error(
|
|
73
|
-
`Failed to deploy web project: ${response.error?.message}`
|
|
73
|
+
`Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -133,6 +133,52 @@ export class FreestyleSandboxes {
|
|
|
133
133
|
throw new Error("Failed to get logs for sandbox");
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Create a a domain verification request.
|
|
139
|
+
* @param domain The domain to verify.
|
|
140
|
+
* @returns The domain verification token.
|
|
141
|
+
*/
|
|
142
|
+
async createDomainVerificationRequest(
|
|
143
|
+
domain: string
|
|
144
|
+
): Promise<sandbox_openapi.HandleVerifyDomainResponse> {
|
|
145
|
+
const response = await sandbox_openapi.handleVerifyDomain({
|
|
146
|
+
client: this.client,
|
|
147
|
+
body: {
|
|
148
|
+
domain: domain,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
if (response.data) {
|
|
152
|
+
return response.data;
|
|
153
|
+
} else {
|
|
154
|
+
throw new Error(
|
|
155
|
+
`Failed to create domain verification request for domain ${domain}: ${response.error.message}`
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Verify a domain. Note, this requires the domain verification token to be already set up.
|
|
162
|
+
* @param domain The domain to verify.
|
|
163
|
+
* @returns The domain verification request.
|
|
164
|
+
*/
|
|
165
|
+
async verifyDomain(
|
|
166
|
+
domain: string
|
|
167
|
+
): Promise<sandbox_openapi.HandleVerifyDomainResponse> {
|
|
168
|
+
const response = await sandbox_openapi.handleVerifyDomain({
|
|
169
|
+
client: this.client,
|
|
170
|
+
body: {
|
|
171
|
+
domain: domain,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
if (response.data) {
|
|
175
|
+
return response.data;
|
|
176
|
+
} else {
|
|
177
|
+
throw new Error(
|
|
178
|
+
`Failed to verify domain ${domain}: ${response.error.message}`
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
136
182
|
}
|
|
137
183
|
|
|
138
184
|
export * from "../openapi/types.gen.ts";
|