freestyle-sandboxes 0.0.83 → 0.0.85

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.
Files changed (53) hide show
  1. package/dist/ai/inde.d.cts +1 -1
  2. package/dist/ai/inde.d.mts +1 -1
  3. package/dist/ai/index.d.cts +1 -1
  4. package/dist/ai/index.d.mts +1 -1
  5. package/dist/inde.d.cts +45 -4
  6. package/dist/inde.d.mts +45 -4
  7. package/dist/{index-CGc0kRd_.cjs → index-BBXyg0JQ.cjs} +5 -9
  8. package/dist/index-BQHqnjZK.mjs +3231 -0
  9. package/dist/index-CEEa9WHp.cjs +3238 -0
  10. package/dist/{index-jh-93svX.mjs → index-DCF70Xbq.mjs} +5 -9
  11. package/dist/index.cjs +172 -9
  12. package/dist/index.d.cts +45 -4
  13. package/dist/index.d.mts +45 -4
  14. package/dist/index.mjs +172 -9
  15. package/dist/langgraph/inde.d.cts +1 -1
  16. package/dist/langgraph/inde.d.mts +1 -1
  17. package/dist/langgraph/index.d.cts +1 -1
  18. package/dist/langgraph/index.d.mts +1 -1
  19. package/dist/mastra/inde.d.cts +1 -1
  20. package/dist/mastra/inde.d.mts +1 -1
  21. package/dist/mastra/index.d.cts +1 -1
  22. package/dist/mastra/index.d.mts +1 -1
  23. package/dist/types.gen-1sd31qLV.d.ts +172 -0
  24. package/dist/types.gen-627pxroW.d.ts +830 -0
  25. package/dist/types.gen-BCdfx7yt.d.ts +760 -0
  26. package/dist/{types.gen-0bQ5Wn0o.d.ts → types.gen-BVXmFV7d.d.ts} +17 -18
  27. package/dist/types.gen-BWwhCgTX.d.ts +1462 -0
  28. package/dist/types.gen-BaMKzqxQ.d.ts +233 -0
  29. package/dist/types.gen-BbekD8Sd.d.ts +1119 -0
  30. package/dist/types.gen-BqN1t03N.d.ts +842 -0
  31. package/dist/types.gen-BtK6PMQy.d.ts +195 -0
  32. package/dist/types.gen-C03gaIPq.d.ts +297 -0
  33. package/dist/{types.gen-BJArgpto.d.ts → types.gen-CIf3ciN7.d.ts} +5 -2
  34. package/dist/types.gen-CMuCas4r.d.ts +183 -0
  35. package/dist/{types.gen-DxZanGNF.d.ts → types.gen-CZUnqmzP.d.ts} +6 -9
  36. package/dist/types.gen-CnEkmbco.d.ts +314 -0
  37. package/dist/types.gen-DDYpuDzZ.d.ts +764 -0
  38. package/dist/types.gen-DHmdEOOa.d.ts +172 -0
  39. package/dist/{types.gen-CfrGF-JI.d.ts → types.gen-DLYohMJT.d.ts} +1 -1
  40. package/dist/types.gen-DbTb_SrD.d.ts +156 -0
  41. package/dist/types.gen-DkQ-Dbs1.d.ts +764 -0
  42. package/dist/types.gen-DyY7Deri.d.ts +138 -0
  43. package/dist/types.gen-MBZCvIhE.d.ts +311 -0
  44. package/dist/types.gen-YhJAHBw8.d.ts +233 -0
  45. package/dist/types.gen-cCnnhnB6.d.ts +182 -0
  46. package/dist/types.gen-mg_JNXrq.d.ts +830 -0
  47. package/dist/types.gen-uDTr6v-7.d.ts +731 -0
  48. package/dist/utils/inde.d.cts +1 -1
  49. package/dist/utils/inde.d.mts +1 -1
  50. package/dist/utils/index.d.cts +1 -1
  51. package/dist/utils/index.d.mts +1 -1
  52. package/package.json +1 -1
  53. package/src/index.ts +44 -44
package/dist/index.mjs CHANGED
@@ -181,12 +181,48 @@ const handleCreateRepo = (options) => {
181
181
  url: "/git/v1/repo"
182
182
  });
183
183
  };
184
+ const handleGetDefaultBranch = (options) => {
185
+ return (options?.client ?? client).get({
186
+ ...options,
187
+ url: "/git/v1/repo/{repo_id}/default-branch"
188
+ });
189
+ };
190
+ const handleSetDefaultBranch = (options) => {
191
+ return (options?.client ?? client).put({
192
+ ...options,
193
+ url: "/git/v1/repo/{repo_id}/default-branch"
194
+ });
195
+ };
196
+ const getGithubSync = (options) => {
197
+ return (options?.client ?? client).get({
198
+ ...options,
199
+ url: "/git/v1/repo/{repo_id}/github-sync"
200
+ });
201
+ };
202
+ const configureGithubSync = (options) => {
203
+ return (options?.client ?? client).post({
204
+ ...options,
205
+ url: "/git/v1/repo/{repo_id}/github-sync"
206
+ });
207
+ };
208
+ const removeGithubSync = (options) => {
209
+ return (options?.client ?? client).delete({
210
+ ...options,
211
+ url: "/git/v1/repo/{repo_id}/github-sync"
212
+ });
213
+ };
184
214
  const handleDeleteRepo = (options) => {
185
215
  return (options?.client ?? client).delete({
186
216
  ...options,
187
217
  url: "/git/v1/repo/{repo}"
188
218
  });
189
219
  };
220
+ const handleGetContents = (options) => {
221
+ return (options?.client ?? client).get({
222
+ ...options,
223
+ url: "/git/v1/repo/{repo}/contents/{*path}"
224
+ });
225
+ };
190
226
  const handleListGitTriggers = (options) => {
191
227
  return (options?.client ?? client).get({
192
228
  ...options,
@@ -232,11 +268,6 @@ class FreestyleSandboxes {
232
268
  if (!options?.apiKey) {
233
269
  this.options.apiKey = process.env.FREESTYLE_API_KEY;
234
270
  }
235
- if (!this.options.apiKey) {
236
- throw new Error(
237
- "No API key provided. Please set the FREESTYLE_API_KEY environment variable or configure apiKey when constructing FreestyleSandboxes."
238
- );
239
- }
240
271
  if (typeof Deno !== "undefined") {
241
272
  class FreestyleRequest extends Request {
242
273
  constructor(input, init) {
@@ -375,6 +406,20 @@ Message: ${response.error?.message}`
375
406
  }
376
407
  throw new Error(response.error.message);
377
408
  }
409
+ async verifyDomainVerificationRequest(id) {
410
+ const response = await handleVerifyDomain({
411
+ client: this.client,
412
+ body: {
413
+ id
414
+ }
415
+ });
416
+ if (response.data) {
417
+ return response.data;
418
+ }
419
+ throw new Error(
420
+ `Failed to verify domain verification request with ID ${id}: ${response.error.message}`
421
+ );
422
+ }
378
423
  /**
379
424
  * Verify a domain. Note, this requires the domain verification token to be already set up.
380
425
  * @param domain The domain to verify.
@@ -499,7 +544,8 @@ ${response.error.message}`);
499
544
  name,
500
545
  public: pub = false,
501
546
  source,
502
- import: _import
547
+ import: _import,
548
+ defaultBranch
503
549
  }) {
504
550
  const response = await handleCreateRepo({
505
551
  client: this.client,
@@ -507,7 +553,8 @@ ${response.error.message}`);
507
553
  name,
508
554
  public: pub,
509
555
  source,
510
- import: _import
556
+ import: _import,
557
+ defaultBranch
511
558
  }
512
559
  });
513
560
  if (response.data) {
@@ -817,6 +864,122 @@ ${response.error.message}`);
817
864
  `Failed to delete git trigger ${triggerId}: ${response.error.message}`
818
865
  );
819
866
  }
867
+ /**
868
+ * Set the default branch for a git repository.
869
+ */
870
+ async setGitRepoDefaultBranch({
871
+ repoId,
872
+ defaultBranch
873
+ }) {
874
+ const response = await handleSetDefaultBranch({
875
+ client: this.client,
876
+ path: {
877
+ repo_id: repoId
878
+ },
879
+ body: {
880
+ defaultBranch
881
+ }
882
+ });
883
+ if (response.error) {
884
+ throw new Error(`Failed to set default branch: ${response.error}`);
885
+ }
886
+ }
887
+ /**
888
+ * Get the default branch for a git repository.
889
+ */
890
+ async getGitRepoDefaultBranch({
891
+ repoId
892
+ }) {
893
+ const response = await handleGetDefaultBranch({
894
+ client: this.client,
895
+ path: { repo_id: repoId }
896
+ });
897
+ if (response.data) {
898
+ return response.data.defaultBranch;
899
+ }
900
+ throw new Error(
901
+ `Failed to get default branch for repository ${repoId}: ${response.error}`
902
+ );
903
+ }
904
+ /**
905
+ * Get the contents of a git repository at the given path.
906
+ */
907
+ async getGitRepoContents({
908
+ repoId,
909
+ path,
910
+ ref
911
+ }) {
912
+ const response = await handleGetContents({
913
+ client: this.client,
914
+ path: {
915
+ repo: repoId,
916
+ "*path": path ?? null
917
+ },
918
+ query: {
919
+ ref
920
+ }
921
+ });
922
+ if (response.data) {
923
+ return response.data;
924
+ }
925
+ throw new Error(
926
+ `Failed to get git repository contents: ${response.error.message}`
927
+ );
928
+ }
929
+ /**
930
+ * Configure a git repository to sync with GitHub.
931
+ */
932
+ async configureGitRepoGitHubSync({
933
+ repoId,
934
+ githubRepoName
935
+ }) {
936
+ const response = await configureGithubSync({
937
+ client: this.client,
938
+ path: {
939
+ repo_id: repoId
940
+ },
941
+ body: {
942
+ githubRepoName
943
+ }
944
+ });
945
+ if (response.error) {
946
+ throw new Error(`Failed to configure GitHub sync: ${response.error}`);
947
+ }
948
+ }
949
+ /**
950
+ * Remove the GitHub sync configuration for a git repository.
951
+ */
952
+ async removeGitRepoGitHubSync({ repoId }) {
953
+ const response = await removeGithubSync({
954
+ client: this.client,
955
+ path: {
956
+ repo_id: repoId
957
+ }
958
+ });
959
+ if (response.error) {
960
+ throw new Error(`Failed to remove GitHub sync: ${response.error}`);
961
+ }
962
+ }
963
+ /**
964
+ * Get the GitHub sync configuration for a git repository.
965
+ */
966
+ async getGitRepoGitHubSyncConfig({
967
+ repoId
968
+ }) {
969
+ const response = await getGithubSync({
970
+ client: this.client,
971
+ path: {
972
+ repo_id: repoId
973
+ }
974
+ });
975
+ if (response.response.status === 404) {
976
+ return null;
977
+ }
978
+ if (response.error) {
979
+ throw new Error(`Failed to get GitHub sync config: ${response.error}`);
980
+ }
981
+ return response.data ?? null;
982
+ }
820
983
  /**
821
984
  * Request a dev server for a repository. If a dev server is already running
822
985
  * for that repository, it will return a url to that server. Dev servers are
@@ -921,7 +1084,7 @@ ${response.error.message}`);
921
1084
  const response2 = await handleReadFileFromEphemeralDevServer({
922
1085
  client,
923
1086
  path: {
924
- filepath: path
1087
+ "*filepath": path
925
1088
  },
926
1089
  body: {
927
1090
  devServer: devServerInstance,
@@ -1004,7 +1167,7 @@ ${response.error.message}`);
1004
1167
  const response2 = await handleWriteFileFromEphemeralDevServer({
1005
1168
  client,
1006
1169
  path: {
1007
- filepath: path
1170
+ "*filepath": path
1008
1171
  },
1009
1172
  body: {
1010
1173
  devServer: devServerInstance,
@@ -1,4 +1,4 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type AgentAction = {
@@ -1,4 +1,4 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type AgentAction = {
@@ -1,4 +1,4 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type AgentAction = {
@@ -1,4 +1,4 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type AgentAction = {
@@ -5,7 +5,7 @@ import { Transform } from 'stream';
5
5
  import { EventEmitter } from 'events';
6
6
  import { ServerResponse, IncomingMessage } from 'http';
7
7
  import { WorkerOptions } from 'worker_threads';
8
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
8
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
9
9
  import 'node:http';
10
10
 
11
11
  // Type definitions for pino-std-serializers 2.4
@@ -5,7 +5,7 @@ import { Transform } from 'stream';
5
5
  import { EventEmitter } from 'events';
6
6
  import { ServerResponse, IncomingMessage } from 'http';
7
7
  import { WorkerOptions } from 'worker_threads';
8
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
8
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
9
9
  import 'node:http';
10
10
 
11
11
  // Type definitions for pino-std-serializers 2.4
@@ -5,7 +5,7 @@ import { Transform } from 'stream';
5
5
  import { EventEmitter } from 'events';
6
6
  import { ServerResponse, IncomingMessage } from 'http';
7
7
  import { WorkerOptions } from 'worker_threads';
8
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
8
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
9
9
  import 'node:http';
10
10
 
11
11
  // Type definitions for pino-std-serializers 2.4
@@ -5,7 +5,7 @@ import { Transform } from 'stream';
5
5
  import { EventEmitter } from 'events';
6
6
  import { ServerResponse, IncomingMessage } from 'http';
7
7
  import { WorkerOptions } from 'worker_threads';
8
- import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-DkFlXKTr.js';
8
+ import { F as FreestyleExecuteScriptParamsConfiguration } from '../types.gen-BWwhCgTX.js';
9
9
  import 'node:http';
10
10
 
11
11
  // Type definitions for pino-std-serializers 2.4
@@ -0,0 +1,172 @@
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 HandleBackupCloudstateResponse = (Array<(number)>);
133
+ type HandleBackupCloudstateError = (unknown);
134
+ type HandleListDomainsResponse = ({
135
+ domains: Array<(string)>;
136
+ });
137
+ type HandleListDomainsError = ({
138
+ message: string;
139
+ });
140
+ type HandleVerifyDomainData = {
141
+ body: FreestyleVerifyDomainRequest;
142
+ };
143
+ type HandleVerifyDomainResponse = ({
144
+ domain: string;
145
+ });
146
+ type HandleVerifyDomainError = ({
147
+ message: string;
148
+ });
149
+ type HandleCreateDomainVerificationData = {
150
+ body: FreestyleDomainVerificationRequest;
151
+ };
152
+ type HandleCreateDomainVerificationResponse = ({
153
+ verification_code: string;
154
+ domain: string;
155
+ });
156
+ type HandleCreateDomainVerificationError = ({
157
+ message: string;
158
+ });
159
+ type HandleExecuteScriptData = {
160
+ body: FreestyleExecuteScriptParams;
161
+ };
162
+ type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
163
+ type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
164
+ type HandleDeployWebData = {
165
+ body: FreestyleDeployWebPayload;
166
+ };
167
+ type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
168
+ type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
169
+ type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
170
+ type HandleGetLogsError = unknown;
171
+
172
+ export type { HandleCreateDomainVerificationData as A, HandleCreateDomainVerificationError as B, HandleExecuteScriptData as C, HandleExecuteScriptResponse as D, HandleExecuteScriptError as E, FreestyleExecuteScriptParamsConfiguration as F, HandleDeployWebData as G, HandleBackupCloudstateResponse as H, HandleDeployWebResponse as I, HandleDeployWebError as J, HandleGetLogsError as K, 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, HandleBackupCloudstateError as w, HandleListDomainsError as x, HandleVerifyDomainData as y, HandleVerifyDomainError as z };