freestyle-sandboxes 0.0.14 → 0.0.16
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 +43 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.mts +6 -4
- package/dist/index.mjs +43 -1
- package/dist/mastra/index.d.cts +1 -1
- package/dist/mastra/index.d.mts +1 -1
- package/dist/types.gen-BaMKzqxQ.d.ts +233 -0
- package/dist/types.gen-YhJAHBw8.d.ts +233 -0
- package/openapi/sdk.gen.ts +23 -1
- package/openapi/types.gen.ts +44 -0
- package/openapi.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +41 -2
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-YhJAHBw8.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const executeCodeSchema: z.ZodObject<{
|
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-YhJAHBw8.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const executeCodeSchema: z.ZodObject<{
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,12 @@ const handleListDomains = (options) => {
|
|
|
21
21
|
url: "/domains/v1/domains"
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
|
+
const handleListDomainVerificationRequests = (options) => {
|
|
25
|
+
return (options?.client ?? client).get({
|
|
26
|
+
...options,
|
|
27
|
+
url: "/domains/v1/verifications"
|
|
28
|
+
});
|
|
29
|
+
};
|
|
24
30
|
const handleVerifyDomain = (options) => {
|
|
25
31
|
return (options?.client ?? client).put({
|
|
26
32
|
...options,
|
|
@@ -33,6 +39,12 @@ const handleCreateDomainVerification = (options) => {
|
|
|
33
39
|
url: "/domains/v1/verifications"
|
|
34
40
|
});
|
|
35
41
|
};
|
|
42
|
+
const handleDeleteDomainVerification = (options) => {
|
|
43
|
+
return (options?.client ?? client).delete({
|
|
44
|
+
...options,
|
|
45
|
+
url: "/domains/v1/verifications"
|
|
46
|
+
});
|
|
47
|
+
};
|
|
36
48
|
const handleExecuteScript = (options) => {
|
|
37
49
|
return (options?.client ?? client).post({
|
|
38
50
|
...options,
|
|
@@ -212,7 +224,37 @@ Message: ${response.error?.message}`
|
|
|
212
224
|
if (response.data) {
|
|
213
225
|
return response.data;
|
|
214
226
|
} else {
|
|
215
|
-
throw new Error("Failed to list domains");
|
|
227
|
+
throw new Error("Failed to list domains\n" + response.error.message);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async listDomainVerificationRequests() {
|
|
231
|
+
const response = await handleListDomainVerificationRequests(
|
|
232
|
+
{
|
|
233
|
+
client: this.client
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
if (response.data) {
|
|
237
|
+
return response.data;
|
|
238
|
+
} else {
|
|
239
|
+
throw new Error(
|
|
240
|
+
"Failed to list domain verification requests\n" + response.error.message
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async deleteDomainVerificationRequest(domain, verificationCode) {
|
|
245
|
+
const response = await handleDeleteDomainVerification({
|
|
246
|
+
client: this.client,
|
|
247
|
+
body: {
|
|
248
|
+
domain,
|
|
249
|
+
verificationCode
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
if (response.data) {
|
|
253
|
+
return response.data;
|
|
254
|
+
} else {
|
|
255
|
+
throw new Error(
|
|
256
|
+
`Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
|
|
257
|
+
);
|
|
216
258
|
}
|
|
217
259
|
}
|
|
218
260
|
}
|
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, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleListDomainsResponse } 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 HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse } from './types.gen-YhJAHBw8.js';
|
|
2
|
+
export { m as FreestyleCloudstateDeployConfiguration, n as FreestyleCloudstateDeployErrorResponse, o as FreestyleDeleteDomainVerificationRequest, p as FreestyleDeployWebErrorResponse, q as FreestyleDeployWebPayload, r as FreestyleDomainVerificationRequest, s as FreestyleExecureScriptResultError, t as FreestyleExecuteScriptParams, u as FreestyleFile, v as FreestyleLogResponseObject, w as FreestyleVerifyDomainRequest, A as HandleBackupCloudstateData, B as HandleBackupCloudstateError, G as HandleCreateDomainVerificationData, I as HandleCreateDomainVerificationError, K as HandleDeleteDomainVerificationData, L as HandleDeleteDomainVerificationError, x as HandleDeployCloudstateData, z as HandleDeployCloudstateError, y as HandleDeployCloudstateResponse, P as HandleDeployWebData, R as HandleDeployWebError, Q as HandleDeployWebResponse, M as HandleExecuteScriptData, O as HandleExecuteScriptError, N as HandleExecuteScriptResponse, S as HandleGetLogsData, T as HandleGetLogsError, D as HandleListDomainVerificationRequestsError, C as HandleListDomainsError, E as HandleVerifyDomainData, J as JavaScriptLog } from './types.gen-YhJAHBw8.js';
|
|
3
3
|
|
|
4
4
|
declare class FreestyleSandboxes {
|
|
5
5
|
private client;
|
|
@@ -57,8 +57,10 @@ declare class FreestyleSandboxes {
|
|
|
57
57
|
* @param domain The domain to verify.
|
|
58
58
|
* @returns The domain verification request.
|
|
59
59
|
*/
|
|
60
|
-
verifyDomain(domain: string): Promise<HandleVerifyDomainResponse>;
|
|
60
|
+
verifyDomain(domain: string): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError>;
|
|
61
61
|
listDomains(): Promise<HandleListDomainsResponse>;
|
|
62
|
+
listDomainVerificationRequests(): Promise<HandleListDomainVerificationRequestsResponse>;
|
|
63
|
+
deleteDomainVerificationRequest(domain: string, verificationCode: string): Promise<HandleDeleteDomainVerificationResponse>;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleGetLogsResponse, HandleListDomainsResponse, HandleVerifyDomainResponse };
|
|
66
|
+
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleDeleteDomainVerificationResponse, HandleGetLogsResponse, HandleListDomainVerificationRequestsResponse, HandleListDomainsResponse, HandleVerifyDomainError, 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, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleListDomainsResponse } 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 HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse } from './types.gen-YhJAHBw8.js';
|
|
2
|
+
export { m as FreestyleCloudstateDeployConfiguration, n as FreestyleCloudstateDeployErrorResponse, o as FreestyleDeleteDomainVerificationRequest, p as FreestyleDeployWebErrorResponse, q as FreestyleDeployWebPayload, r as FreestyleDomainVerificationRequest, s as FreestyleExecureScriptResultError, t as FreestyleExecuteScriptParams, u as FreestyleFile, v as FreestyleLogResponseObject, w as FreestyleVerifyDomainRequest, A as HandleBackupCloudstateData, B as HandleBackupCloudstateError, G as HandleCreateDomainVerificationData, I as HandleCreateDomainVerificationError, K as HandleDeleteDomainVerificationData, L as HandleDeleteDomainVerificationError, x as HandleDeployCloudstateData, z as HandleDeployCloudstateError, y as HandleDeployCloudstateResponse, P as HandleDeployWebData, R as HandleDeployWebError, Q as HandleDeployWebResponse, M as HandleExecuteScriptData, O as HandleExecuteScriptError, N as HandleExecuteScriptResponse, S as HandleGetLogsData, T as HandleGetLogsError, D as HandleListDomainVerificationRequestsError, C as HandleListDomainsError, E as HandleVerifyDomainData, J as JavaScriptLog } from './types.gen-YhJAHBw8.js';
|
|
3
3
|
|
|
4
4
|
declare class FreestyleSandboxes {
|
|
5
5
|
private client;
|
|
@@ -57,8 +57,10 @@ declare class FreestyleSandboxes {
|
|
|
57
57
|
* @param domain The domain to verify.
|
|
58
58
|
* @returns The domain verification request.
|
|
59
59
|
*/
|
|
60
|
-
verifyDomain(domain: string): Promise<HandleVerifyDomainResponse>;
|
|
60
|
+
verifyDomain(domain: string): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError>;
|
|
61
61
|
listDomains(): Promise<HandleListDomainsResponse>;
|
|
62
|
+
listDomainVerificationRequests(): Promise<HandleListDomainVerificationRequestsResponse>;
|
|
63
|
+
deleteDomainVerificationRequest(domain: string, verificationCode: string): Promise<HandleDeleteDomainVerificationResponse>;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleGetLogsResponse, HandleListDomainsResponse, HandleVerifyDomainResponse };
|
|
66
|
+
export { FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponse, FreestyleExecureScriptResultSuccess, FreestyleExecuteScriptParamsConfiguration, FreestyleSandboxes, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleDeleteDomainVerificationResponse, HandleGetLogsResponse, HandleListDomainVerificationRequestsResponse, HandleListDomainsResponse, HandleVerifyDomainError, HandleVerifyDomainResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -19,6 +19,12 @@ const handleListDomains = (options) => {
|
|
|
19
19
|
url: "/domains/v1/domains"
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
+
const handleListDomainVerificationRequests = (options) => {
|
|
23
|
+
return (options?.client ?? client).get({
|
|
24
|
+
...options,
|
|
25
|
+
url: "/domains/v1/verifications"
|
|
26
|
+
});
|
|
27
|
+
};
|
|
22
28
|
const handleVerifyDomain = (options) => {
|
|
23
29
|
return (options?.client ?? client).put({
|
|
24
30
|
...options,
|
|
@@ -31,6 +37,12 @@ const handleCreateDomainVerification = (options) => {
|
|
|
31
37
|
url: "/domains/v1/verifications"
|
|
32
38
|
});
|
|
33
39
|
};
|
|
40
|
+
const handleDeleteDomainVerification = (options) => {
|
|
41
|
+
return (options?.client ?? client).delete({
|
|
42
|
+
...options,
|
|
43
|
+
url: "/domains/v1/verifications"
|
|
44
|
+
});
|
|
45
|
+
};
|
|
34
46
|
const handleExecuteScript = (options) => {
|
|
35
47
|
return (options?.client ?? client).post({
|
|
36
48
|
...options,
|
|
@@ -210,7 +222,37 @@ Message: ${response.error?.message}`
|
|
|
210
222
|
if (response.data) {
|
|
211
223
|
return response.data;
|
|
212
224
|
} else {
|
|
213
|
-
throw new Error("Failed to list domains");
|
|
225
|
+
throw new Error("Failed to list domains\n" + response.error.message);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async listDomainVerificationRequests() {
|
|
229
|
+
const response = await handleListDomainVerificationRequests(
|
|
230
|
+
{
|
|
231
|
+
client: this.client
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
if (response.data) {
|
|
235
|
+
return response.data;
|
|
236
|
+
} else {
|
|
237
|
+
throw new Error(
|
|
238
|
+
"Failed to list domain verification requests\n" + response.error.message
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async deleteDomainVerificationRequest(domain, verificationCode) {
|
|
243
|
+
const response = await handleDeleteDomainVerification({
|
|
244
|
+
client: this.client,
|
|
245
|
+
body: {
|
|
246
|
+
domain,
|
|
247
|
+
verificationCode
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
if (response.data) {
|
|
251
|
+
return response.data;
|
|
252
|
+
} else {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
|
|
255
|
+
);
|
|
214
256
|
}
|
|
215
257
|
}
|
|
216
258
|
}
|
package/dist/mastra/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _mastra_core from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-
|
|
3
|
+
import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-YhJAHBw8.js';
|
|
4
4
|
|
|
5
5
|
declare const executeTool: (config: FreestyleExecuteScriptParamsConfiguration & {
|
|
6
6
|
apiKey: string;
|
package/dist/mastra/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _mastra_core from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-
|
|
3
|
+
import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-YhJAHBw8.js';
|
|
4
4
|
|
|
5
5
|
declare const executeTool: (config: FreestyleExecuteScriptParamsConfiguration & {
|
|
6
6
|
apiKey: string;
|
|
@@ -0,0 +1,233 @@
|
|
|
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 FreestyleDeleteDomainVerificationRequest = {
|
|
27
|
+
/**
|
|
28
|
+
* The domain to create a verification code for
|
|
29
|
+
*/
|
|
30
|
+
domain: string;
|
|
31
|
+
/**
|
|
32
|
+
* The verification code
|
|
33
|
+
*/
|
|
34
|
+
verificationCode: string;
|
|
35
|
+
};
|
|
36
|
+
type FreestyleDeployWebConfiguration = {
|
|
37
|
+
/**
|
|
38
|
+
* The entrypoint file for the website
|
|
39
|
+
*/
|
|
40
|
+
entrypoint?: (string) | null;
|
|
41
|
+
/**
|
|
42
|
+
* The custom domains for the website, eg. [\"subdomain.yourwebsite.com\"]. You may include a single *.style.dev domain here.
|
|
43
|
+
*/
|
|
44
|
+
domains?: Array<(string)> | null;
|
|
45
|
+
/**
|
|
46
|
+
* Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.
|
|
47
|
+
* @deprecated
|
|
48
|
+
*/
|
|
49
|
+
projectId?: (string) | null;
|
|
50
|
+
/**
|
|
51
|
+
* 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.
|
|
52
|
+
*/
|
|
53
|
+
nodeModules?: {
|
|
54
|
+
[key: string]: (string);
|
|
55
|
+
} | null;
|
|
56
|
+
/**
|
|
57
|
+
* The environment variables that the website can access
|
|
58
|
+
* e.g. { \"RESEND_API_KEY\": \"re_123456789\" }
|
|
59
|
+
*/
|
|
60
|
+
envVars?: {
|
|
61
|
+
[key: string]: (string);
|
|
62
|
+
} | null;
|
|
63
|
+
serverStartCheck?: boolean;
|
|
64
|
+
};
|
|
65
|
+
type FreestyleDeployWebErrorResponse = {
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
type FreestyleDeployWebPayload = {
|
|
69
|
+
/**
|
|
70
|
+
* 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\" } }
|
|
71
|
+
*
|
|
72
|
+
* **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.
|
|
73
|
+
*/
|
|
74
|
+
files: {
|
|
75
|
+
[key: string]: FreestyleFile;
|
|
76
|
+
};
|
|
77
|
+
config?: FreestyleDeployWebConfiguration;
|
|
78
|
+
};
|
|
79
|
+
type FreestyleDeployWebSuccessResponse = {
|
|
80
|
+
deploymentId: string;
|
|
81
|
+
domains?: Array<(string)> | null;
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated
|
|
84
|
+
*/
|
|
85
|
+
projectId?: (string) | null;
|
|
86
|
+
};
|
|
87
|
+
type FreestyleDomainVerificationRequest = {
|
|
88
|
+
/**
|
|
89
|
+
* The domain to create a verification code for
|
|
90
|
+
*/
|
|
91
|
+
domain: string;
|
|
92
|
+
};
|
|
93
|
+
type FreestyleExecureScriptResultError = {
|
|
94
|
+
error: string;
|
|
95
|
+
};
|
|
96
|
+
type FreestyleExecureScriptResultSuccess = {
|
|
97
|
+
result: unknown;
|
|
98
|
+
logs: Array<JavaScriptLog>;
|
|
99
|
+
};
|
|
100
|
+
type FreestyleExecuteScriptParams = {
|
|
101
|
+
/**
|
|
102
|
+
* The JavaScript or TypeScript script to execute
|
|
103
|
+
*/
|
|
104
|
+
script: string;
|
|
105
|
+
config?: FreestyleExecuteScriptParamsConfiguration;
|
|
106
|
+
};
|
|
107
|
+
type FreestyleExecuteScriptParamsConfiguration = {
|
|
108
|
+
/**
|
|
109
|
+
* The environment variables to set for the script
|
|
110
|
+
*/
|
|
111
|
+
envVars?: {
|
|
112
|
+
[key: string]: (string);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The node modules to install for the script
|
|
116
|
+
*/
|
|
117
|
+
nodeModules?: {
|
|
118
|
+
[key: string]: (string);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Tags for you to organize your scripts, useful for tracking what you're running
|
|
122
|
+
*/
|
|
123
|
+
tags?: Array<(string)>;
|
|
124
|
+
/**
|
|
125
|
+
* The script timeout
|
|
126
|
+
*/
|
|
127
|
+
timeout?: (string) | null;
|
|
128
|
+
/**
|
|
129
|
+
* If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.
|
|
130
|
+
*/
|
|
131
|
+
peerDependencyResolution?: boolean;
|
|
132
|
+
};
|
|
133
|
+
type FreestyleFile = {
|
|
134
|
+
/**
|
|
135
|
+
* The content of the file
|
|
136
|
+
*/
|
|
137
|
+
content: string;
|
|
138
|
+
/**
|
|
139
|
+
* The encoding of the file. Either **utf-8** or **base64**
|
|
140
|
+
*/
|
|
141
|
+
encoding?: string;
|
|
142
|
+
};
|
|
143
|
+
type FreestyleLogResponseObject = {
|
|
144
|
+
message: string;
|
|
145
|
+
};
|
|
146
|
+
type FreestyleVerifyDomainRequest = {
|
|
147
|
+
domain: string;
|
|
148
|
+
};
|
|
149
|
+
type JavaScriptLog = {
|
|
150
|
+
/**
|
|
151
|
+
* The log message
|
|
152
|
+
*/
|
|
153
|
+
message: string;
|
|
154
|
+
/**
|
|
155
|
+
* The log level
|
|
156
|
+
*/
|
|
157
|
+
type: string;
|
|
158
|
+
};
|
|
159
|
+
type HandleDeployCloudstateData = {
|
|
160
|
+
body: FreestyleCloudstateDeployRequest;
|
|
161
|
+
};
|
|
162
|
+
type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
|
|
163
|
+
type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
|
|
164
|
+
type HandleBackupCloudstateData = {
|
|
165
|
+
path: {
|
|
166
|
+
id: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
type HandleBackupCloudstateResponse = (Array<(number)>);
|
|
170
|
+
type HandleBackupCloudstateError = (unknown);
|
|
171
|
+
type HandleListDomainsResponse = (Array<{
|
|
172
|
+
domain: string;
|
|
173
|
+
createdAt: number;
|
|
174
|
+
}>);
|
|
175
|
+
type HandleListDomainsError = ({
|
|
176
|
+
message: string;
|
|
177
|
+
});
|
|
178
|
+
type HandleListDomainVerificationRequestsResponse = (Array<{
|
|
179
|
+
verificationCode: string;
|
|
180
|
+
domain: string;
|
|
181
|
+
createdAt: number;
|
|
182
|
+
}>);
|
|
183
|
+
type HandleListDomainVerificationRequestsError = ({
|
|
184
|
+
message: string;
|
|
185
|
+
});
|
|
186
|
+
type HandleVerifyDomainData = {
|
|
187
|
+
body: FreestyleVerifyDomainRequest;
|
|
188
|
+
};
|
|
189
|
+
type HandleVerifyDomainResponse = ({
|
|
190
|
+
domain: string;
|
|
191
|
+
});
|
|
192
|
+
type HandleVerifyDomainError = ({
|
|
193
|
+
message: string;
|
|
194
|
+
});
|
|
195
|
+
type HandleCreateDomainVerificationData = {
|
|
196
|
+
body: FreestyleDomainVerificationRequest;
|
|
197
|
+
};
|
|
198
|
+
type HandleCreateDomainVerificationResponse = ({
|
|
199
|
+
verificationCode: string;
|
|
200
|
+
domain: string;
|
|
201
|
+
});
|
|
202
|
+
type HandleCreateDomainVerificationError = ({
|
|
203
|
+
message: string;
|
|
204
|
+
});
|
|
205
|
+
type HandleDeleteDomainVerificationData = {
|
|
206
|
+
body: FreestyleDeleteDomainVerificationRequest;
|
|
207
|
+
};
|
|
208
|
+
type HandleDeleteDomainVerificationResponse = ({
|
|
209
|
+
verificationCode: string;
|
|
210
|
+
domain: string;
|
|
211
|
+
});
|
|
212
|
+
type HandleDeleteDomainVerificationError = ({
|
|
213
|
+
message: string;
|
|
214
|
+
});
|
|
215
|
+
type HandleExecuteScriptData = {
|
|
216
|
+
body: FreestyleExecuteScriptParams;
|
|
217
|
+
};
|
|
218
|
+
type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
|
|
219
|
+
type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
|
|
220
|
+
type HandleDeployWebData = {
|
|
221
|
+
body: FreestyleDeployWebPayload;
|
|
222
|
+
};
|
|
223
|
+
type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
|
|
224
|
+
type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
|
|
225
|
+
type HandleGetLogsData = {
|
|
226
|
+
path: {
|
|
227
|
+
id: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
|
|
231
|
+
type HandleGetLogsError = unknown;
|
|
232
|
+
|
|
233
|
+
export type { HandleBackupCloudstateError as A, HandleListDomainsError as B, HandleListDomainVerificationRequestsError as C, HandleVerifyDomainData as D, HandleVerifyDomainError as E, FreestyleExecuteScriptParamsConfiguration as F, HandleCreateDomainVerificationData as G, HandleBackupCloudstateResponse as H, HandleCreateDomainVerificationError as I, JavaScriptLog as J, HandleDeleteDomainVerificationData as K, HandleDeleteDomainVerificationError as L, HandleExecuteScriptData as M, HandleExecuteScriptResponse as N, HandleExecuteScriptError as O, HandleDeployWebData as P, HandleDeployWebResponse as Q, HandleDeployWebError as R, HandleGetLogsData as S, HandleGetLogsError as T, FreestyleExecureScriptResultSuccess as a, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f, HandleCreateDomainVerificationResponse as g, HandleVerifyDomainResponse as h, HandleListDomainsResponse as i, HandleListDomainVerificationRequestsResponse as j, HandleDeleteDomainVerificationResponse as k, FreestyleCloudstateDeployConfiguration as l, FreestyleCloudstateDeployErrorResponse as m, FreestyleDeleteDomainVerificationRequest as n, FreestyleDeployWebErrorResponse as o, FreestyleDeployWebPayload as p, FreestyleDomainVerificationRequest as q, FreestyleExecureScriptResultError as r, FreestyleExecuteScriptParams as s, FreestyleFile as t, FreestyleLogResponseObject as u, FreestyleVerifyDomainRequest as v, HandleDeployCloudstateData as w, HandleDeployCloudstateResponse as x, HandleDeployCloudstateError as y, HandleBackupCloudstateData as z };
|
|
@@ -0,0 +1,233 @@
|
|
|
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 FreestyleDeleteDomainVerificationRequest = {
|
|
27
|
+
/**
|
|
28
|
+
* The domain to create a verification code for
|
|
29
|
+
*/
|
|
30
|
+
domain: string;
|
|
31
|
+
/**
|
|
32
|
+
* The verification code
|
|
33
|
+
*/
|
|
34
|
+
verificationCode: string;
|
|
35
|
+
};
|
|
36
|
+
type FreestyleDeployWebConfiguration = {
|
|
37
|
+
/**
|
|
38
|
+
* The entrypoint file for the website
|
|
39
|
+
*/
|
|
40
|
+
entrypoint?: (string) | null;
|
|
41
|
+
/**
|
|
42
|
+
* The custom domains for the website, eg. [\"subdomain.yourwebsite.com\"]. You may include a single *.style.dev domain here.
|
|
43
|
+
*/
|
|
44
|
+
domains?: Array<(string)> | null;
|
|
45
|
+
/**
|
|
46
|
+
* Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.
|
|
47
|
+
* @deprecated
|
|
48
|
+
*/
|
|
49
|
+
projectId?: (string) | null;
|
|
50
|
+
/**
|
|
51
|
+
* 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.
|
|
52
|
+
*/
|
|
53
|
+
nodeModules?: {
|
|
54
|
+
[key: string]: (string);
|
|
55
|
+
} | null;
|
|
56
|
+
/**
|
|
57
|
+
* The environment variables that the website can access
|
|
58
|
+
* e.g. { \"RESEND_API_KEY\": \"re_123456789\" }
|
|
59
|
+
*/
|
|
60
|
+
envVars?: {
|
|
61
|
+
[key: string]: (string);
|
|
62
|
+
} | null;
|
|
63
|
+
serverStartCheck?: boolean;
|
|
64
|
+
};
|
|
65
|
+
type FreestyleDeployWebErrorResponse = {
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
type FreestyleDeployWebPayload = {
|
|
69
|
+
/**
|
|
70
|
+
* 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\" } }
|
|
71
|
+
*
|
|
72
|
+
* **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.
|
|
73
|
+
*/
|
|
74
|
+
files: {
|
|
75
|
+
[key: string]: FreestyleFile;
|
|
76
|
+
};
|
|
77
|
+
config?: FreestyleDeployWebConfiguration;
|
|
78
|
+
};
|
|
79
|
+
type FreestyleDeployWebSuccessResponse = {
|
|
80
|
+
deploymentId: string;
|
|
81
|
+
domains?: Array<(string)> | null;
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated
|
|
84
|
+
*/
|
|
85
|
+
projectId?: (string) | null;
|
|
86
|
+
};
|
|
87
|
+
type FreestyleDomainVerificationRequest = {
|
|
88
|
+
/**
|
|
89
|
+
* The domain to create a verification code for
|
|
90
|
+
*/
|
|
91
|
+
domain: string;
|
|
92
|
+
};
|
|
93
|
+
type FreestyleExecureScriptResultError = {
|
|
94
|
+
error: string;
|
|
95
|
+
};
|
|
96
|
+
type FreestyleExecureScriptResultSuccess = {
|
|
97
|
+
result: unknown;
|
|
98
|
+
logs: Array<JavaScriptLog>;
|
|
99
|
+
};
|
|
100
|
+
type FreestyleExecuteScriptParams = {
|
|
101
|
+
/**
|
|
102
|
+
* The JavaScript or TypeScript script to execute
|
|
103
|
+
*/
|
|
104
|
+
script: string;
|
|
105
|
+
config?: FreestyleExecuteScriptParamsConfiguration;
|
|
106
|
+
};
|
|
107
|
+
type FreestyleExecuteScriptParamsConfiguration = {
|
|
108
|
+
/**
|
|
109
|
+
* The environment variables to set for the script
|
|
110
|
+
*/
|
|
111
|
+
envVars?: {
|
|
112
|
+
[key: string]: (string);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The node modules to install for the script
|
|
116
|
+
*/
|
|
117
|
+
nodeModules?: {
|
|
118
|
+
[key: string]: (string);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Tags for you to organize your scripts, useful for tracking what you're running
|
|
122
|
+
*/
|
|
123
|
+
tags?: Array<(string)>;
|
|
124
|
+
/**
|
|
125
|
+
* The script timeout
|
|
126
|
+
*/
|
|
127
|
+
timeout?: (string) | null;
|
|
128
|
+
/**
|
|
129
|
+
* If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.
|
|
130
|
+
*/
|
|
131
|
+
peerDependencyResolution?: boolean;
|
|
132
|
+
};
|
|
133
|
+
type FreestyleFile = {
|
|
134
|
+
/**
|
|
135
|
+
* The content of the file
|
|
136
|
+
*/
|
|
137
|
+
content: string;
|
|
138
|
+
/**
|
|
139
|
+
* The encoding of the file. Either **utf-8** or **base64**
|
|
140
|
+
*/
|
|
141
|
+
encoding?: string;
|
|
142
|
+
};
|
|
143
|
+
type FreestyleLogResponseObject = {
|
|
144
|
+
message: string;
|
|
145
|
+
};
|
|
146
|
+
type FreestyleVerifyDomainRequest = {
|
|
147
|
+
domain: string;
|
|
148
|
+
};
|
|
149
|
+
type JavaScriptLog = {
|
|
150
|
+
/**
|
|
151
|
+
* The log message
|
|
152
|
+
*/
|
|
153
|
+
message: string;
|
|
154
|
+
/**
|
|
155
|
+
* The log level
|
|
156
|
+
*/
|
|
157
|
+
type: string;
|
|
158
|
+
};
|
|
159
|
+
type HandleDeployCloudstateData = {
|
|
160
|
+
body: FreestyleCloudstateDeployRequest;
|
|
161
|
+
};
|
|
162
|
+
type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
|
|
163
|
+
type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
|
|
164
|
+
type HandleBackupCloudstateData = {
|
|
165
|
+
path: {
|
|
166
|
+
id: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
type HandleBackupCloudstateResponse = (Array<(number)>);
|
|
170
|
+
type HandleBackupCloudstateError = (unknown);
|
|
171
|
+
type HandleListDomainsResponse = (Array<{
|
|
172
|
+
domain: string;
|
|
173
|
+
createdAt: number;
|
|
174
|
+
}>);
|
|
175
|
+
type HandleListDomainsError = ({
|
|
176
|
+
message: string;
|
|
177
|
+
});
|
|
178
|
+
type HandleListDomainVerificationRequestsResponse = (Array<{
|
|
179
|
+
verificationCode: string;
|
|
180
|
+
domain: string;
|
|
181
|
+
createdAt: number;
|
|
182
|
+
}>);
|
|
183
|
+
type HandleListDomainVerificationRequestsError = ({
|
|
184
|
+
message: string;
|
|
185
|
+
});
|
|
186
|
+
type HandleVerifyDomainData = {
|
|
187
|
+
body: FreestyleVerifyDomainRequest;
|
|
188
|
+
};
|
|
189
|
+
type HandleVerifyDomainResponse = ({
|
|
190
|
+
domain: string;
|
|
191
|
+
});
|
|
192
|
+
type HandleVerifyDomainError = ({
|
|
193
|
+
message: string;
|
|
194
|
+
});
|
|
195
|
+
type HandleCreateDomainVerificationData = {
|
|
196
|
+
body: FreestyleDomainVerificationRequest;
|
|
197
|
+
};
|
|
198
|
+
type HandleCreateDomainVerificationResponse = ({
|
|
199
|
+
verificationCode: string;
|
|
200
|
+
domain: string;
|
|
201
|
+
});
|
|
202
|
+
type HandleCreateDomainVerificationError = ({
|
|
203
|
+
message: string;
|
|
204
|
+
});
|
|
205
|
+
type HandleDeleteDomainVerificationData = {
|
|
206
|
+
body: FreestyleDeleteDomainVerificationRequest;
|
|
207
|
+
};
|
|
208
|
+
type HandleDeleteDomainVerificationResponse = ({
|
|
209
|
+
verificationCode: string;
|
|
210
|
+
domain: string;
|
|
211
|
+
});
|
|
212
|
+
type HandleDeleteDomainVerificationError = ({
|
|
213
|
+
message: string;
|
|
214
|
+
});
|
|
215
|
+
type HandleExecuteScriptData = {
|
|
216
|
+
body: FreestyleExecuteScriptParams;
|
|
217
|
+
};
|
|
218
|
+
type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
|
|
219
|
+
type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
|
|
220
|
+
type HandleDeployWebData = {
|
|
221
|
+
body: FreestyleDeployWebPayload;
|
|
222
|
+
};
|
|
223
|
+
type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
|
|
224
|
+
type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
|
|
225
|
+
type HandleGetLogsData = {
|
|
226
|
+
path: {
|
|
227
|
+
id: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
|
|
231
|
+
type HandleGetLogsError = unknown;
|
|
232
|
+
|
|
233
|
+
export type { HandleBackupCloudstateData as A, HandleBackupCloudstateError as B, HandleListDomainsError as C, HandleListDomainVerificationRequestsError as D, HandleVerifyDomainData as E, FreestyleExecuteScriptParamsConfiguration as F, HandleCreateDomainVerificationData as G, HandleBackupCloudstateResponse as H, HandleCreateDomainVerificationError as I, JavaScriptLog as J, HandleDeleteDomainVerificationData as K, HandleDeleteDomainVerificationError as L, HandleExecuteScriptData as M, HandleExecuteScriptResponse as N, HandleExecuteScriptError as O, HandleDeployWebData as P, HandleDeployWebResponse as Q, HandleDeployWebError as R, HandleGetLogsData as S, HandleGetLogsError as T, FreestyleExecureScriptResultSuccess as a, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f, HandleCreateDomainVerificationResponse as g, HandleVerifyDomainResponse as h, HandleVerifyDomainError as i, HandleListDomainsResponse as j, HandleListDomainVerificationRequestsResponse as k, HandleDeleteDomainVerificationResponse as l, FreestyleCloudstateDeployConfiguration as m, FreestyleCloudstateDeployErrorResponse as n, FreestyleDeleteDomainVerificationRequest as o, FreestyleDeployWebErrorResponse as p, FreestyleDeployWebPayload as q, FreestyleDomainVerificationRequest as r, FreestyleExecureScriptResultError as s, FreestyleExecuteScriptParams as t, FreestyleFile as u, FreestyleLogResponseObject as v, FreestyleVerifyDomainRequest as w, HandleDeployCloudstateData as x, HandleDeployCloudstateResponse as y, HandleDeployCloudstateError 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, HandleBackupCloudstateData, HandleBackupCloudstateError, HandleBackupCloudstateResponse, HandleListDomainsError, HandleListDomainsResponse, HandleVerifyDomainData, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleCreateDomainVerificationData, HandleCreateDomainVerificationError, HandleCreateDomainVerificationResponse, HandleExecuteScriptData, HandleExecuteScriptError, HandleExecuteScriptResponse, HandleDeployWebData, HandleDeployWebError, HandleDeployWebResponse, HandleGetLogsData, HandleGetLogsError, HandleGetLogsResponse } from './types.gen';
|
|
4
|
+
import type { HandleDeployCloudstateData, HandleDeployCloudstateError, HandleDeployCloudstateResponse, HandleBackupCloudstateData, HandleBackupCloudstateError, HandleBackupCloudstateResponse, HandleListDomainsError, HandleListDomainsResponse, HandleListDomainVerificationRequestsError, HandleListDomainVerificationRequestsResponse, HandleVerifyDomainData, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleCreateDomainVerificationData, HandleCreateDomainVerificationError, HandleCreateDomainVerificationResponse, HandleDeleteDomainVerificationData, HandleDeleteDomainVerificationError, HandleDeleteDomainVerificationResponse, HandleExecuteScriptData, HandleExecuteScriptError, HandleExecuteScriptResponse, HandleDeployWebData, HandleDeployWebError, HandleDeployWebResponse, HandleGetLogsData, HandleGetLogsError, HandleGetLogsResponse } from './types.gen';
|
|
5
5
|
|
|
6
6
|
export const client = createClient(createConfig());
|
|
7
7
|
|
|
@@ -38,6 +38,17 @@ export const handleListDomains = <ThrowOnError extends boolean = false>(options?
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* List domain verification requests for an account
|
|
43
|
+
* Lists domain verification requests for the current account.
|
|
44
|
+
*/
|
|
45
|
+
export const handleListDomainVerificationRequests = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
|
|
46
|
+
return (options?.client ?? client).get<HandleListDomainVerificationRequestsResponse, HandleListDomainVerificationRequestsError, ThrowOnError>({
|
|
47
|
+
...options,
|
|
48
|
+
url: '/domains/v1/verifications'
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
41
52
|
/**
|
|
42
53
|
* Verify a domain
|
|
43
54
|
* This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.
|
|
@@ -60,6 +71,17 @@ export const handleCreateDomainVerification = <ThrowOnError extends boolean = fa
|
|
|
60
71
|
});
|
|
61
72
|
};
|
|
62
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Delete a domain verification request
|
|
76
|
+
* This deletes a Freestyle Domain Verification Request. This does not remove the domain from the account if it has already been verified, however the verification code will no longer be valid.
|
|
77
|
+
*/
|
|
78
|
+
export const handleDeleteDomainVerification = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleDeleteDomainVerificationData, ThrowOnError>) => {
|
|
79
|
+
return (options?.client ?? client).delete<HandleDeleteDomainVerificationResponse, HandleDeleteDomainVerificationError, ThrowOnError>({
|
|
80
|
+
...options,
|
|
81
|
+
url: '/domains/v1/verifications'
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
63
85
|
/**
|
|
64
86
|
* Execute Code
|
|
65
87
|
* Send a TypeScript or JavaScript module, get the result
|
package/openapi/types.gen.ts
CHANGED
|
@@ -29,6 +29,17 @@ export type FreestyleCloudstateDeploySuccessResponse = {
|
|
|
29
29
|
projectId: string;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
export type FreestyleDeleteDomainVerificationRequest = {
|
|
33
|
+
/**
|
|
34
|
+
* The domain to create a verification code for
|
|
35
|
+
*/
|
|
36
|
+
domain: string;
|
|
37
|
+
/**
|
|
38
|
+
* The verification code
|
|
39
|
+
*/
|
|
40
|
+
verificationCode: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
32
43
|
export type FreestyleDeployWebConfiguration = {
|
|
33
44
|
/**
|
|
34
45
|
* The entrypoint file for the website
|
|
@@ -56,6 +67,7 @@ export type FreestyleDeployWebConfiguration = {
|
|
|
56
67
|
envVars?: {
|
|
57
68
|
[key: string]: (string);
|
|
58
69
|
} | null;
|
|
70
|
+
serverStartCheck?: boolean;
|
|
59
71
|
};
|
|
60
72
|
|
|
61
73
|
export type FreestyleDeployWebErrorResponse = {
|
|
@@ -76,6 +88,11 @@ export type FreestyleDeployWebPayload = {
|
|
|
76
88
|
|
|
77
89
|
export type FreestyleDeployWebSuccessResponse = {
|
|
78
90
|
deploymentId: string;
|
|
91
|
+
domains?: Array<(string)> | null;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated
|
|
94
|
+
*/
|
|
95
|
+
projectId?: (string) | null;
|
|
79
96
|
};
|
|
80
97
|
|
|
81
98
|
export type FreestyleDomainVerificationRequest = {
|
|
@@ -123,6 +140,10 @@ export type FreestyleExecuteScriptParamsConfiguration = {
|
|
|
123
140
|
* The script timeout
|
|
124
141
|
*/
|
|
125
142
|
timeout?: (string) | null;
|
|
143
|
+
/**
|
|
144
|
+
* If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.
|
|
145
|
+
*/
|
|
146
|
+
peerDependencyResolution?: boolean;
|
|
126
147
|
};
|
|
127
148
|
|
|
128
149
|
export type FreestyleFile = {
|
|
@@ -182,6 +203,16 @@ export type HandleListDomainsError = ({
|
|
|
182
203
|
message: string;
|
|
183
204
|
});
|
|
184
205
|
|
|
206
|
+
export type HandleListDomainVerificationRequestsResponse = (Array<{
|
|
207
|
+
verificationCode: string;
|
|
208
|
+
domain: string;
|
|
209
|
+
createdAt: number;
|
|
210
|
+
}>);
|
|
211
|
+
|
|
212
|
+
export type HandleListDomainVerificationRequestsError = ({
|
|
213
|
+
message: string;
|
|
214
|
+
});
|
|
215
|
+
|
|
185
216
|
export type HandleVerifyDomainData = {
|
|
186
217
|
body: FreestyleVerifyDomainRequest;
|
|
187
218
|
};
|
|
@@ -207,6 +238,19 @@ export type HandleCreateDomainVerificationError = ({
|
|
|
207
238
|
message: string;
|
|
208
239
|
});
|
|
209
240
|
|
|
241
|
+
export type HandleDeleteDomainVerificationData = {
|
|
242
|
+
body: FreestyleDeleteDomainVerificationRequest;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export type HandleDeleteDomainVerificationResponse = ({
|
|
246
|
+
verificationCode: string;
|
|
247
|
+
domain: string;
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
export type HandleDeleteDomainVerificationError = ({
|
|
251
|
+
message: string;
|
|
252
|
+
});
|
|
253
|
+
|
|
210
254
|
export type HandleExecuteScriptData = {
|
|
211
255
|
body: FreestyleExecuteScriptParams;
|
|
212
256
|
};
|
package/openapi.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"openapi":"3.1.0","info":{"title":"Freestyle Sandboxes","description":"\nFreestyle Sandboxes lets you deploy your users or AIs code. **Get your API Key at [admin.freestyle.sh](https://admin.freestyle.sh)**\n\nThey are broken up into 4 categories: [Web](#tag/web), [Execute](#tag/execute) [Cloudstate](#tag/cloudstate), and [Domains](#tag/domains).\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\n[Domains](#tag/domains): Manage your domains, including verification and listing\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","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"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/domains":{"get":{"tags":["Domains"],"summary":"List domains for an account","description":"This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.","operationId":"handle_list_domains","responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["domain","createdAt"],"properties":{"domain":{"type":"string","example":"example.yourdomain.com"},"createdAt":{"type":"integer","format":"int64"}}}}}}},"400":{"description":"Failed to get domains","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"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.listDomains().then((response) => {\n console.log(response);\n});"}]}},"/domains/v1/verifications":{"put":{"tags":["Domains"],"summary":"Verify a domain","description":"This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.","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","example":"example.com"}}}}}},"400":{"description":"Failed to verify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .verifyDomain('example.com')\n .then((result) => {\n console.log('Successfully Verified Domain!');\n })\n .catch((error) => {\n console.error('Failed to verify domain: ', error);\n });"}]},"post":{"tags":["Domains"],"summary":"Create a domain verification request","description":"This creates a Freestyle Domain Verification Request. It returns a `verificationCode` for your domain. You need to place this code in a TXT record at `_freestyle_custom_hostname.thedomain.com`, then call the [verify domain](/#tag/domains/PUT/domains/v1/verifications) endpoint with the domain to verify it.","operationId":"handle_create_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verificationCode","domain"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.createDomainVerificationRequest('example.com').then((result) => {\n const verificationCode = result.verificationCode;\n // put this at a TXT record at _freestyle_custom_hostname.example.com\n});"}]}},"/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","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"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 include a single *.style.dev domain here.","example":["subdomain.yourdomain.com"],"default":null},"projectId":{"type":["string","null"],"description":"Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.","default":null,"deprecated":true},"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":["deploymentId"],"properties":{"deploymentId":{"type":"string"}}},"FreestyleDomainVerificationRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"}}},"FreestyleExecureScriptResultError":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"FreestyleExecureScriptResultSuccess":{"type":"object","required":["result","logs"],"properties":{"result":{},"logs":{"type":"array","items":{"$ref":"#/components/schemas/JavaScriptLog"}}}},"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","example":"example.com"}}},"JavaScriptLog":{"type":"object","required":["message","type"],"properties":{"message":{"type":"string","description":"The log message"},"type":{"type":"string","description":"The log level"}}}},"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."},{"name":"Domains","description":"APIs for managing domains. This is only relevant when you want to start to deploy to custom domains."}]}
|
|
1
|
+
{"openapi":"3.1.0","info":{"title":"Freestyle Sandboxes","description":"\nFreestyle Sandboxes lets you deploy your users or AIs code. **Get your API Key at [admin.freestyle.sh](https://admin.freestyle.sh)**\n\nThey are broken up into 4 categories: [Web](#tag/web), [Execute](#tag/execute), [Cloudstate](#tag/cloudstate), and [Domains](#tag/domains).\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\n[Domains](#tag/domains): Manage your domains, including verification and listing\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","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"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/domains":{"get":{"tags":["Domains"],"summary":"List domains for an account","description":"This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.","operationId":"handle_list_domains","responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["domain","createdAt"],"properties":{"domain":{"type":"string","example":"example.yourdomain.com"},"createdAt":{"type":"integer","format":"int64"}}}}}}},"400":{"description":"Failed to get domains","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"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.listDomains().then((response) => {\n console.log(response);\n});"}]}},"/domains/v1/verifications":{"get":{"tags":["Domains"],"summary":"List domain verification requests for an account","description":"Lists domain verification requests for the current account.","operationId":"handle_list_domain_verification_requests","responses":{"200":{"description":"List of verification codes","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["verificationCode","domain","createdAt"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string"},"createdAt":{"type":"integer","format":"int64"}}}}}}},"400":{"description":"Failed to get verification codes","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"put":{"tags":["Domains"],"summary":"Verify a domain","description":"This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.","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","example":"example.com"}}}}}},"400":{"description":"Failed to verify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .verifyDomain('example.com')\n .then((result) => {\n console.log('Successfully Verified Domain!');\n })\n .catch((error) => {\n console.error('Failed to verify domain: ', error);\n });"}]},"post":{"tags":["Domains"],"summary":"Create a domain verification request","description":"This creates a Freestyle Domain Verification Request. It returns a `verificationCode` for your domain. You need to place this code in a TXT record at `_freestyle_custom_hostname.thedomain.com`, then call the [verify domain](/#tag/domains/PUT/domains/v1/verifications) endpoint with the domain to verify it.","operationId":"handle_create_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verificationCode","domain"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"Human SDK","lang":"JavaScript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.createDomainVerificationRequest('example.com').then((result) => {\n const verificationCode = result.verificationCode;\n // put this at a TXT record at _freestyle_custom_hostname.example.com\n});"}]},"delete":{"tags":["Domains"],"summary":"Delete a domain verification request","description":"This deletes a Freestyle Domain Verification Request. This does not remove the domain from the account if it has already been verified, however the verification code will no longer be valid.","operationId":"handle_delete_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeleteDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verificationCode","domain"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/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":"Vercel 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});"},{"label":"Mastra AI SDK","lang":"JavaScript","source":"import { executeTool } from 'freestyle-sandboxes/mastra';\n\nconst mastra = new Mastra();\n\nconst modelConfig: ModelConfig = {\n provider: 'OPEN_AI',\n name: 'gpt-4',\n};\n\nconst llm = mastra.LLM(modelConfig);\n\nconst response = await llm.generate(\n 'Calculate the sum of every number between 13 and 19 divided by the sum of every number between 8 and 13',\n {\n tools: {\n executor: executeTool({\n apiKey: process.env.FREESTYLE_API_KEY!,\n }),\n },\n }\n);\n\nconsole.log('Response Steps:', response.steps);\nconsole.log('Response:', response.text);"}]}},"/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.deploymentId);\n });\n"},{"label":"Vercel 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","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"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"}}},"FreestyleDeleteDomainVerificationRequest":{"type":"object","required":["domain","verificationCode"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"},"verificationCode":{"type":"string","description":"The verification code"}}},"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 include a single *.style.dev domain here.","example":["subdomain.yourdomain.com"],"default":null},"projectId":{"type":["string","null"],"description":"Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.","default":null,"deprecated":true},"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"}},"serverStartCheck":{"type":"boolean","default":false}}},"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":["deploymentId"],"properties":{"deploymentId":{"type":"string"},"domains":{"type":["array","null"],"items":{"type":"string"}},"projectId":{"type":["string","null"],"deprecated":true}}},"FreestyleDomainVerificationRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"}}},"FreestyleExecureScriptResultError":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"FreestyleExecureScriptResultSuccess":{"type":"object","required":["result","logs"],"properties":{"result":{},"logs":{"type":"array","items":{"$ref":"#/components/schemas/JavaScriptLog"}}}},"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},"peerDependencyResolution":{"type":"boolean","description":"If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.","default":"true"}}},"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","example":"example.com"}}},"JavaScriptLog":{"type":"object","required":["message","type"],"properties":{"message":{"type":"string","description":"The log message"},"type":{"type":"string","description":"The log level"}}}},"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."},{"name":"Domains","description":"APIs for managing domains. This is only relevant when you want to start to deploy to custom domains."}]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Client, createClient } from "@hey-api/client-fetch";
|
|
2
2
|
import * as sandbox_openapi from "../openapi/index.ts";
|
|
3
|
+
|
|
3
4
|
export class FreestyleSandboxes {
|
|
4
5
|
private client: Client;
|
|
5
6
|
constructor(options: {
|
|
@@ -169,7 +170,10 @@ export class FreestyleSandboxes {
|
|
|
169
170
|
*/
|
|
170
171
|
async verifyDomain(
|
|
171
172
|
domain: string
|
|
172
|
-
): Promise<
|
|
173
|
+
): Promise<
|
|
174
|
+
| sandbox_openapi.HandleVerifyDomainResponse
|
|
175
|
+
| sandbox_openapi.HandleVerifyDomainError
|
|
176
|
+
> {
|
|
173
177
|
const response = await sandbox_openapi.handleVerifyDomain({
|
|
174
178
|
client: this.client,
|
|
175
179
|
body: {
|
|
@@ -192,7 +196,42 @@ export class FreestyleSandboxes {
|
|
|
192
196
|
if (response.data) {
|
|
193
197
|
return response.data;
|
|
194
198
|
} else {
|
|
195
|
-
throw new Error("Failed to list domains");
|
|
199
|
+
throw new Error("Failed to list domains\n" + response.error.message);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async listDomainVerificationRequests(): Promise<sandbox_openapi.HandleListDomainVerificationRequestsResponse> {
|
|
204
|
+
const response = await sandbox_openapi.handleListDomainVerificationRequests(
|
|
205
|
+
{
|
|
206
|
+
client: this.client,
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
if (response.data) {
|
|
210
|
+
return response.data;
|
|
211
|
+
} else {
|
|
212
|
+
throw new Error(
|
|
213
|
+
"Failed to list domain verification requests\n" + response.error.message
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async deleteDomainVerificationRequest(
|
|
219
|
+
domain: string,
|
|
220
|
+
verificationCode: string
|
|
221
|
+
): Promise<sandbox_openapi.HandleDeleteDomainVerificationResponse> {
|
|
222
|
+
const response = await sandbox_openapi.handleDeleteDomainVerification({
|
|
223
|
+
client: this.client,
|
|
224
|
+
body: {
|
|
225
|
+
domain: domain,
|
|
226
|
+
verificationCode: verificationCode,
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
if (response.data) {
|
|
230
|
+
return response.data;
|
|
231
|
+
} else {
|
|
232
|
+
throw new Error(
|
|
233
|
+
`Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
|
|
234
|
+
);
|
|
196
235
|
}
|
|
197
236
|
}
|
|
198
237
|
}
|