freestyle-sandboxes 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as ai from 'ai';
2
- import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-1sd31qLV.js';
2
+ import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-CMuCas4r.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -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-1sd31qLV.js';
2
+ import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecureScriptResultSuccess, c as FreestyleDeployWebSuccessResponse } from '../types.gen-CMuCas4r.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
package/dist/index.cjs CHANGED
@@ -12,7 +12,7 @@ const handleDeployCloudstate = (options) => {
12
12
  const handleBackupCloudstate = (options) => {
13
13
  return (options?.client ?? client).get({
14
14
  ...options,
15
- url: "/cloudstate/v1/projects/:id/backup"
15
+ url: "/cloudstate/v1/projects/{id}/backup"
16
16
  });
17
17
  };
18
18
  const handleListDomains = (options) => {
@@ -48,7 +48,7 @@ const handleDeployWeb = (options) => {
48
48
  const handleGetLogs = (options) => {
49
49
  return (options?.client ?? client).get({
50
50
  ...options,
51
- url: "/web/v1/projects/:id/logs"
51
+ url: "/web/v1/projects/{id}/logs"
52
52
  });
53
53
  };
54
54
 
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-1sd31qLV.js';
2
- export { j as FreestyleCloudstateDeployConfiguration, k as FreestyleCloudstateDeployErrorResponse, l as FreestyleDeployWebErrorResponse, m as FreestyleDeployWebPayload, n as FreestyleDomainVerificationRequest, o as FreestyleExecureScriptResultError, p as FreestyleExecuteScriptParams, q as FreestyleFile, r as FreestyleLogResponseObject, s as FreestyleVerifyDomainRequest, w as HandleBackupCloudstateError, A as HandleCreateDomainVerificationData, B as HandleCreateDomainVerificationError, t as HandleDeployCloudstateData, v as HandleDeployCloudstateError, u as HandleDeployCloudstateResponse, G as HandleDeployWebData, J as HandleDeployWebError, I as HandleDeployWebResponse, C as HandleExecuteScriptData, E as HandleExecuteScriptError, D as HandleExecuteScriptResponse, K as HandleGetLogsError, x as HandleListDomainsError, y as HandleVerifyDomainData, z as HandleVerifyDomainError } from './types.gen-1sd31qLV.js';
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-CMuCas4r.js';
2
+ export { j as FreestyleCloudstateDeployConfiguration, k as FreestyleCloudstateDeployErrorResponse, l as FreestyleDeployWebErrorResponse, m as FreestyleDeployWebPayload, n as FreestyleDomainVerificationRequest, o as FreestyleExecureScriptResultError, p as FreestyleExecuteScriptParams, q as FreestyleFile, r as FreestyleLogResponseObject, s as FreestyleVerifyDomainRequest, w as HandleBackupCloudstateData, x as HandleBackupCloudstateError, B as HandleCreateDomainVerificationData, C as HandleCreateDomainVerificationError, t as HandleDeployCloudstateData, v as HandleDeployCloudstateError, u as HandleDeployCloudstateResponse, I as HandleDeployWebData, K as HandleDeployWebError, J as HandleDeployWebResponse, D as HandleExecuteScriptData, G as HandleExecuteScriptError, E as HandleExecuteScriptResponse, L as HandleGetLogsData, M as HandleGetLogsError, y as HandleListDomainsError, z as HandleVerifyDomainData, A as HandleVerifyDomainError } from './types.gen-CMuCas4r.js';
3
3
 
4
4
  declare class FreestyleSandboxes {
5
5
  private client;
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-1sd31qLV.js';
2
- export { j as FreestyleCloudstateDeployConfiguration, k as FreestyleCloudstateDeployErrorResponse, l as FreestyleDeployWebErrorResponse, m as FreestyleDeployWebPayload, n as FreestyleDomainVerificationRequest, o as FreestyleExecureScriptResultError, p as FreestyleExecuteScriptParams, q as FreestyleFile, r as FreestyleLogResponseObject, s as FreestyleVerifyDomainRequest, w as HandleBackupCloudstateError, A as HandleCreateDomainVerificationData, B as HandleCreateDomainVerificationError, t as HandleDeployCloudstateData, v as HandleDeployCloudstateError, u as HandleDeployCloudstateResponse, G as HandleDeployWebData, J as HandleDeployWebError, I as HandleDeployWebResponse, C as HandleExecuteScriptData, E as HandleExecuteScriptError, D as HandleExecuteScriptResponse, K as HandleGetLogsError, x as HandleListDomainsError, y as HandleVerifyDomainData, z as HandleVerifyDomainError } from './types.gen-1sd31qLV.js';
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-CMuCas4r.js';
2
+ export { j as FreestyleCloudstateDeployConfiguration, k as FreestyleCloudstateDeployErrorResponse, l as FreestyleDeployWebErrorResponse, m as FreestyleDeployWebPayload, n as FreestyleDomainVerificationRequest, o as FreestyleExecureScriptResultError, p as FreestyleExecuteScriptParams, q as FreestyleFile, r as FreestyleLogResponseObject, s as FreestyleVerifyDomainRequest, w as HandleBackupCloudstateData, x as HandleBackupCloudstateError, B as HandleCreateDomainVerificationData, C as HandleCreateDomainVerificationError, t as HandleDeployCloudstateData, v as HandleDeployCloudstateError, u as HandleDeployCloudstateResponse, I as HandleDeployWebData, K as HandleDeployWebError, J as HandleDeployWebResponse, D as HandleExecuteScriptData, G as HandleExecuteScriptError, E as HandleExecuteScriptResponse, L as HandleGetLogsData, M as HandleGetLogsError, y as HandleListDomainsError, z as HandleVerifyDomainData, A as HandleVerifyDomainError } from './types.gen-CMuCas4r.js';
3
3
 
4
4
  declare class FreestyleSandboxes {
5
5
  private client;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ const handleDeployCloudstate = (options) => {
10
10
  const handleBackupCloudstate = (options) => {
11
11
  return (options?.client ?? client).get({
12
12
  ...options,
13
- url: "/cloudstate/v1/projects/:id/backup"
13
+ url: "/cloudstate/v1/projects/{id}/backup"
14
14
  });
15
15
  };
16
16
  const handleListDomains = (options) => {
@@ -46,7 +46,7 @@ const handleDeployWeb = (options) => {
46
46
  const handleGetLogs = (options) => {
47
47
  return (options?.client ?? client).get({
48
48
  ...options,
49
- url: "/web/v1/projects/:id/logs"
49
+ url: "/web/v1/projects/{id}/logs"
50
50
  });
51
51
  };
52
52
 
@@ -0,0 +1,183 @@
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
+ /**
72
+ * The domain to create a verification code for
73
+ */
74
+ domain: string;
75
+ };
76
+ type FreestyleExecureScriptResultError = {
77
+ error: string;
78
+ };
79
+ type FreestyleExecureScriptResultSuccess = {
80
+ result: unknown;
81
+ };
82
+ type FreestyleExecuteScriptParams = {
83
+ /**
84
+ * The JavaScript or TypeScript script to execute
85
+ */
86
+ script: string;
87
+ config?: FreestyleExecuteScriptParamsConfiguration;
88
+ };
89
+ type FreestyleExecuteScriptParamsConfiguration = {
90
+ /**
91
+ * The environment variables to set for the script
92
+ */
93
+ envVars?: {
94
+ [key: string]: (string);
95
+ };
96
+ /**
97
+ * The node modules to install for the script
98
+ */
99
+ nodeModules?: {
100
+ [key: string]: (string);
101
+ };
102
+ /**
103
+ * Tags for you to organize your scripts, useful for tracking what you're running
104
+ */
105
+ tags?: Array<(string)>;
106
+ /**
107
+ * The script timeout
108
+ */
109
+ timeout?: (string) | null;
110
+ };
111
+ type FreestyleFile = {
112
+ /**
113
+ * The content of the file
114
+ */
115
+ content: string;
116
+ /**
117
+ * The encoding of the file. Either **utf-8** or **base64**
118
+ */
119
+ encoding?: string;
120
+ };
121
+ type FreestyleLogResponseObject = {
122
+ message: string;
123
+ };
124
+ type FreestyleVerifyDomainRequest = {
125
+ domain: string;
126
+ };
127
+ type HandleDeployCloudstateData = {
128
+ body: FreestyleCloudstateDeployRequest;
129
+ };
130
+ type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
131
+ type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
132
+ type HandleBackupCloudstateData = {
133
+ path: {
134
+ id: string;
135
+ };
136
+ };
137
+ type HandleBackupCloudstateResponse = (Array<(number)>);
138
+ type HandleBackupCloudstateError = (unknown);
139
+ type HandleListDomainsResponse = (Array<{
140
+ domain: string;
141
+ createdAt: number;
142
+ }>);
143
+ type HandleListDomainsError = ({
144
+ message: string;
145
+ });
146
+ type HandleVerifyDomainData = {
147
+ body: FreestyleVerifyDomainRequest;
148
+ };
149
+ type HandleVerifyDomainResponse = ({
150
+ domain: string;
151
+ });
152
+ type HandleVerifyDomainError = ({
153
+ message: string;
154
+ });
155
+ type HandleCreateDomainVerificationData = {
156
+ body: FreestyleDomainVerificationRequest;
157
+ };
158
+ type HandleCreateDomainVerificationResponse = ({
159
+ verificationCode: string;
160
+ domain: string;
161
+ });
162
+ type HandleCreateDomainVerificationError = ({
163
+ message: string;
164
+ });
165
+ type HandleExecuteScriptData = {
166
+ body: FreestyleExecuteScriptParams;
167
+ };
168
+ type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
169
+ type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
170
+ type HandleDeployWebData = {
171
+ body: FreestyleDeployWebPayload;
172
+ };
173
+ type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
174
+ type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
175
+ type HandleGetLogsData = {
176
+ path: {
177
+ id: string;
178
+ };
179
+ };
180
+ type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
181
+ type HandleGetLogsError = unknown;
182
+
183
+ export type { HandleVerifyDomainError as A, HandleCreateDomainVerificationData as B, HandleCreateDomainVerificationError as C, HandleExecuteScriptData as D, HandleExecuteScriptResponse as E, FreestyleExecuteScriptParamsConfiguration as F, HandleExecuteScriptError as G, HandleBackupCloudstateResponse as H, HandleDeployWebData as I, HandleDeployWebResponse as J, HandleDeployWebError as K, HandleGetLogsData as L, HandleGetLogsError as M, 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, FreestyleCloudstateDeployConfiguration as j, FreestyleCloudstateDeployErrorResponse as k, FreestyleDeployWebErrorResponse as l, FreestyleDeployWebPayload as m, FreestyleDomainVerificationRequest as n, FreestyleExecureScriptResultError as o, FreestyleExecuteScriptParams as p, FreestyleFile as q, FreestyleLogResponseObject as r, FreestyleVerifyDomainRequest as s, HandleDeployCloudstateData as t, HandleDeployCloudstateResponse as u, HandleDeployCloudstateError as v, HandleBackupCloudstateData as w, HandleBackupCloudstateError as x, HandleListDomainsError as y, HandleVerifyDomainData as z };
@@ -0,0 +1,182 @@
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
+ /**
72
+ * The domain to create a verification code for
73
+ */
74
+ domain: string;
75
+ };
76
+ type FreestyleExecureScriptResultError = {
77
+ error: string;
78
+ };
79
+ type FreestyleExecureScriptResultSuccess = {
80
+ result: unknown;
81
+ };
82
+ type FreestyleExecuteScriptParams = {
83
+ /**
84
+ * The JavaScript or TypeScript script to execute
85
+ */
86
+ script: string;
87
+ config?: FreestyleExecuteScriptParamsConfiguration;
88
+ };
89
+ type FreestyleExecuteScriptParamsConfiguration = {
90
+ /**
91
+ * The environment variables to set for the script
92
+ */
93
+ envVars?: {
94
+ [key: string]: (string);
95
+ };
96
+ /**
97
+ * The node modules to install for the script
98
+ */
99
+ nodeModules?: {
100
+ [key: string]: (string);
101
+ };
102
+ /**
103
+ * Tags for you to organize your scripts, useful for tracking what you're running
104
+ */
105
+ tags?: Array<(string)>;
106
+ /**
107
+ * The script timeout
108
+ */
109
+ timeout?: (string) | null;
110
+ };
111
+ type FreestyleFile = {
112
+ /**
113
+ * The content of the file
114
+ */
115
+ content: string;
116
+ /**
117
+ * The encoding of the file. Either **utf-8** or **base64**
118
+ */
119
+ encoding?: string;
120
+ };
121
+ type FreestyleLogResponseObject = {
122
+ message: string;
123
+ };
124
+ type FreestyleVerifyDomainRequest = {
125
+ domain: string;
126
+ };
127
+ type HandleDeployCloudstateData = {
128
+ body: FreestyleCloudstateDeployRequest;
129
+ };
130
+ type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
131
+ type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
132
+ type HandleBackupCloudstateData = {
133
+ path: {
134
+ id: string;
135
+ };
136
+ };
137
+ type HandleBackupCloudstateResponse = (Array<(number)>);
138
+ type HandleBackupCloudstateError = (unknown);
139
+ type HandleListDomainsResponse = ({
140
+ domains: Array<(string)>;
141
+ });
142
+ type HandleListDomainsError = ({
143
+ message: string;
144
+ });
145
+ type HandleVerifyDomainData = {
146
+ body: FreestyleVerifyDomainRequest;
147
+ };
148
+ type HandleVerifyDomainResponse = ({
149
+ domain: string;
150
+ });
151
+ type HandleVerifyDomainError = ({
152
+ message: string;
153
+ });
154
+ type HandleCreateDomainVerificationData = {
155
+ body: FreestyleDomainVerificationRequest;
156
+ };
157
+ type HandleCreateDomainVerificationResponse = ({
158
+ verificationCode: string;
159
+ domain: string;
160
+ });
161
+ type HandleCreateDomainVerificationError = ({
162
+ message: string;
163
+ });
164
+ type HandleExecuteScriptData = {
165
+ body: FreestyleExecuteScriptParams;
166
+ };
167
+ type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
168
+ type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
169
+ type HandleDeployWebData = {
170
+ body: FreestyleDeployWebPayload;
171
+ };
172
+ type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
173
+ type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
174
+ type HandleGetLogsData = {
175
+ path: {
176
+ id: string;
177
+ };
178
+ };
179
+ type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
180
+ type HandleGetLogsError = unknown;
181
+
182
+ export type { HandleVerifyDomainError as A, HandleCreateDomainVerificationData as B, HandleCreateDomainVerificationError as C, HandleExecuteScriptData as D, HandleExecuteScriptResponse as E, FreestyleExecuteScriptParamsConfiguration as F, HandleExecuteScriptError as G, HandleBackupCloudstateResponse as H, HandleDeployWebData as I, HandleDeployWebResponse as J, HandleDeployWebError as K, HandleGetLogsData as L, HandleGetLogsError as M, 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, FreestyleCloudstateDeployConfiguration as j, FreestyleCloudstateDeployErrorResponse as k, FreestyleDeployWebErrorResponse as l, FreestyleDeployWebPayload as m, FreestyleDomainVerificationRequest as n, FreestyleExecureScriptResultError as o, FreestyleExecuteScriptParams as p, FreestyleFile as q, FreestyleLogResponseObject as r, FreestyleVerifyDomainRequest as s, HandleDeployCloudstateData as t, HandleDeployCloudstateResponse as u, HandleDeployCloudstateError as v, HandleBackupCloudstateData as w, HandleBackupCloudstateError as x, HandleListDomainsError as y, HandleVerifyDomainData as z };
@@ -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, HandleListDomainsError, HandleListDomainsResponse, HandleVerifyDomainData, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleCreateDomainVerificationData, HandleCreateDomainVerificationError, HandleCreateDomainVerificationResponse, HandleExecuteScriptData, HandleExecuteScriptError, HandleExecuteScriptResponse, HandleDeployWebData, HandleDeployWebError, HandleDeployWebResponse, HandleGetLogsError, HandleGetLogsResponse } from './types.gen';
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';
5
5
 
6
6
  export const client = createClient(createConfig());
7
7
 
@@ -20,15 +20,16 @@ export const handleDeployCloudstate = <ThrowOnError extends boolean = false>(opt
20
20
  * Get Backup of Cloudstate Project
21
21
  * Get a backup of a cloudstate project
22
22
  */
23
- export const handleBackupCloudstate = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
23
+ export const handleBackupCloudstate = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleBackupCloudstateData, ThrowOnError>) => {
24
24
  return (options?.client ?? client).get<HandleBackupCloudstateResponse, HandleBackupCloudstateError, ThrowOnError>({
25
25
  ...options,
26
- url: '/cloudstate/v1/projects/:id/backup'
26
+ url: '/cloudstate/v1/projects/{id}/backup'
27
27
  });
28
28
  };
29
29
 
30
30
  /**
31
31
  * List domains for an account
32
+ * This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.
32
33
  */
33
34
  export const handleListDomains = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
34
35
  return (options?.client ?? client).get<HandleListDomainsResponse, HandleListDomainsError, ThrowOnError>({
@@ -39,6 +40,7 @@ export const handleListDomains = <ThrowOnError extends boolean = false>(options?
39
40
 
40
41
  /**
41
42
  * Verify a domain
43
+ * 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.
42
44
  */
43
45
  export const handleVerifyDomain = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleVerifyDomainData, ThrowOnError>) => {
44
46
  return (options?.client ?? client).put<HandleVerifyDomainResponse, HandleVerifyDomainError, ThrowOnError>({
@@ -49,6 +51,7 @@ export const handleVerifyDomain = <ThrowOnError extends boolean = false>(options
49
51
 
50
52
  /**
51
53
  * Create a domain verification request
54
+ * 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.
52
55
  */
53
56
  export const handleCreateDomainVerification = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleCreateDomainVerificationData, ThrowOnError>) => {
54
57
  return (options?.client ?? client).post<HandleCreateDomainVerificationResponse, HandleCreateDomainVerificationError, ThrowOnError>({
@@ -83,9 +86,9 @@ export const handleDeployWeb = <ThrowOnError extends boolean = false>(options: O
83
86
  * Get Website Logs
84
87
  * Get the logs for a project
85
88
  */
86
- export const handleGetLogs = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
89
+ export const handleGetLogs = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<HandleGetLogsData, ThrowOnError>) => {
87
90
  return (options?.client ?? client).get<HandleGetLogsResponse, HandleGetLogsError, ThrowOnError>({
88
91
  ...options,
89
- url: '/web/v1/projects/:id/logs'
92
+ url: '/web/v1/projects/{id}/logs'
90
93
  });
91
94
  };
@@ -150,13 +150,20 @@ export type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessRe
150
150
 
151
151
  export type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
152
152
 
153
+ export type HandleBackupCloudstateData = {
154
+ path: {
155
+ id: string;
156
+ };
157
+ };
158
+
153
159
  export type HandleBackupCloudstateResponse = (Array<(number)>);
154
160
 
155
161
  export type HandleBackupCloudstateError = (unknown);
156
162
 
157
- export type HandleListDomainsResponse = ({
158
- domains: Array<(string)>;
159
- });
163
+ export type HandleListDomainsResponse = (Array<{
164
+ domain: string;
165
+ createdAt: number;
166
+ }>);
160
167
 
161
168
  export type HandleListDomainsError = ({
162
169
  message: string;
@@ -179,7 +186,7 @@ export type HandleCreateDomainVerificationData = {
179
186
  };
180
187
 
181
188
  export type HandleCreateDomainVerificationResponse = ({
182
- verification_code: string;
189
+ verificationCode: string;
183
190
  domain: string;
184
191
  });
185
192
 
@@ -203,6 +210,12 @@ export type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
203
210
 
204
211
  export type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
205
212
 
213
+ export type HandleGetLogsData = {
214
+ path: {
215
+ id: string;
216
+ };
217
+ };
218
+
206
219
  export type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
207
220
 
208
221
  export type HandleGetLogsError = unknown;
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.\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/domains":{"get":{"tags":["Domains"],"summary":"List domains for an account","operationId":"handle_list_domains","responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"object","required":["domains"],"properties":{"domains":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Failed to get domains","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/verifications":{"put":{"tags":["Domains"],"summary":"Verify a domain","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"}}}}}}}},"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":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verification_code","domain"],"properties":{"verification_code":{"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":"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","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"],"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","example":"example.com"}}}},"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."}]}
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 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","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"],"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","example":"example.com"}}}},"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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/tsconfig.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "allowImportingTsExtensions": true,
4
+
4
5
  "lib": ["ESNext", "DOM"]
5
6
  }
6
7
  }