freestyle-sandboxes 0.0.75-1 → 0.0.75

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 (56) 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 +4 -2
  6. package/dist/inde.d.mts +4 -2
  7. package/dist/{index-BBXyg0JQ.cjs → index-CGc0kRd_.cjs} +9 -5
  8. package/dist/{index-DCF70Xbq.mjs → index-jh-93svX.mjs} +9 -5
  9. package/dist/index.cjs +13 -6
  10. package/dist/index.d.cts +4 -2
  11. package/dist/index.d.mts +4 -2
  12. package/dist/index.mjs +13 -6
  13. package/dist/langgraph/inde.d.cts +1 -1
  14. package/dist/langgraph/inde.d.mts +1 -1
  15. package/dist/langgraph/index.d.cts +1 -1
  16. package/dist/langgraph/index.d.mts +1 -1
  17. package/dist/mastra/inde.d.cts +1 -1
  18. package/dist/mastra/inde.d.mts +1 -1
  19. package/dist/mastra/index.d.cts +1 -1
  20. package/dist/mastra/index.d.mts +1 -1
  21. package/dist/{types.gen-BVXmFV7d.d.ts → types.gen-0bQ5Wn0o.d.ts} +18 -17
  22. package/dist/{types.gen-CIf3ciN7.d.ts → types.gen-BJArgpto.d.ts} +2 -5
  23. package/dist/{types.gen-DLYohMJT.d.ts → types.gen-CfrGF-JI.d.ts} +1 -1
  24. package/dist/{types.gen-CZUnqmzP.d.ts → types.gen-DxZanGNF.d.ts} +9 -6
  25. package/dist/utils/inde.d.cts +1 -1
  26. package/dist/utils/inde.d.mts +1 -1
  27. package/dist/utils/index.d.cts +1 -1
  28. package/dist/utils/index.d.mts +1 -1
  29. package/openapi/sdk.gen.ts +12 -12
  30. package/openapi/types.gen.ts +20 -19
  31. package/openapi.json +1 -1
  32. package/package.json +1 -1
  33. package/src/dev-server.ts +3 -0
  34. package/src/index.ts +45 -58
  35. package/dist/index-BQHqnjZK.mjs +0 -3231
  36. package/dist/index-CEEa9WHp.cjs +0 -3238
  37. package/dist/types.gen-1sd31qLV.d.ts +0 -172
  38. package/dist/types.gen-627pxroW.d.ts +0 -830
  39. package/dist/types.gen-BCdfx7yt.d.ts +0 -760
  40. package/dist/types.gen-BaMKzqxQ.d.ts +0 -233
  41. package/dist/types.gen-BbekD8Sd.d.ts +0 -1119
  42. package/dist/types.gen-BqN1t03N.d.ts +0 -842
  43. package/dist/types.gen-BtK6PMQy.d.ts +0 -195
  44. package/dist/types.gen-C03gaIPq.d.ts +0 -297
  45. package/dist/types.gen-CMuCas4r.d.ts +0 -183
  46. package/dist/types.gen-CnEkmbco.d.ts +0 -314
  47. package/dist/types.gen-DDYpuDzZ.d.ts +0 -764
  48. package/dist/types.gen-DHmdEOOa.d.ts +0 -172
  49. package/dist/types.gen-DbTb_SrD.d.ts +0 -156
  50. package/dist/types.gen-DkQ-Dbs1.d.ts +0 -764
  51. package/dist/types.gen-DyY7Deri.d.ts +0 -138
  52. package/dist/types.gen-MBZCvIhE.d.ts +0 -311
  53. package/dist/types.gen-YhJAHBw8.d.ts +0 -233
  54. package/dist/types.gen-cCnnhnB6.d.ts +0 -182
  55. package/dist/types.gen-mg_JNXrq.d.ts +0 -830
  56. package/dist/types.gen-uDTr6v-7.d.ts +0 -731
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.75-1",
3
+ "version": "0.0.75",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/src/dev-server.ts CHANGED
@@ -23,6 +23,9 @@ export interface FreestyleDevServer {
23
23
 
24
24
  process: FreestyleDevServerProcess;
25
25
 
26
+ devCommandRunning: boolean;
27
+ installCommandRunning: boolean;
28
+
26
29
  /**
27
30
  * Get the status of the dev server
28
31
  */
package/src/index.ts CHANGED
@@ -97,7 +97,7 @@ export class FreestyleSandboxes {
97
97
  }
98
98
  if (!this.options.apiKey) {
99
99
  throw new Error(
100
- "No API key provided. Please set the FREESTYLE_API_KEY environment variable or configure apiKey when constructing FreestyleSandboxes."
100
+ "No API key provided. Please set the FREESTYLE_API_KEY environment variable or configure apiKey when constructing FreestyleSandboxes.",
101
101
  );
102
102
  }
103
103
 
@@ -129,7 +129,7 @@ export class FreestyleSandboxes {
129
129
  */
130
130
  async executeScript(
131
131
  script: string,
132
- config?: FreestyleExecuteScriptParamsConfiguration
132
+ config?: FreestyleExecuteScriptParamsConfiguration,
133
133
  ): Promise<FreestyleExecuteScriptResultSuccess> {
134
134
  const response = await sandbox_openapi.handleExecuteScript({
135
135
  client: this.client,
@@ -144,7 +144,7 @@ export class FreestyleSandboxes {
144
144
  }
145
145
  throw {
146
146
  message: `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
147
- response
147
+ response,
148
148
  )}`,
149
149
  error: response.error,
150
150
  };
@@ -158,7 +158,7 @@ export class FreestyleSandboxes {
158
158
  */
159
159
  async deployWeb(
160
160
  source: sandbox_openapi.DeploymentSource,
161
- config?: FreestyleDeployWebConfiguration
161
+ config?: FreestyleDeployWebConfiguration,
162
162
  ): Promise<FreestyleDeployWebSuccessResponseV2> {
163
163
  const response = await sandbox_openapi.handleDeployWebV2({
164
164
  client: this.client,
@@ -171,7 +171,7 @@ export class FreestyleSandboxes {
171
171
  return response.data;
172
172
  }
173
173
  throw new Error(
174
- `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`
174
+ `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`,
175
175
  );
176
176
  }
177
177
 
@@ -179,7 +179,7 @@ export class FreestyleSandboxes {
179
179
  * Deploy a Cloudstate project to a sandbox.
180
180
  */
181
181
  async deployCloudstate(
182
- body: FreestyleCloudstateDeployRequest
182
+ body: FreestyleCloudstateDeployRequest,
183
183
  ): Promise<FreestyleCloudstateDeploySuccessResponse> {
184
184
  const response = await sandbox_openapi.handleDeployCloudstate({
185
185
  client: this.client,
@@ -242,7 +242,7 @@ export class FreestyleSandboxes {
242
242
  * @returns The domain verification token.
243
243
  */
244
244
  async createDomainVerificationRequest(
245
- domain: string
245
+ domain: string,
246
246
  ): Promise<HandleCreateDomainVerificationResponse> {
247
247
  const response = await sandbox_openapi.handleCreateDomainVerification({
248
248
  client: this.client,
@@ -263,7 +263,7 @@ export class FreestyleSandboxes {
263
263
  * @returns The domain verification request.
264
264
  */
265
265
  async verifyDomain(
266
- domain: string
266
+ domain: string,
267
267
  ): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
268
268
  const response = await sandbox_openapi.handleVerifyDomain({
269
269
  client: this.client,
@@ -275,7 +275,7 @@ export class FreestyleSandboxes {
275
275
  return response.data;
276
276
  }
277
277
  throw new Error(
278
- `Failed to verify domain ${domain}: ${response.error.message}`
278
+ `Failed to verify domain ${domain}: ${response.error.message}`,
279
279
  );
280
280
  }
281
281
 
@@ -294,20 +294,20 @@ export class FreestyleSandboxes {
294
294
  const response = await sandbox_openapi.handleListDomainVerificationRequests(
295
295
  {
296
296
  client: this.client,
297
- }
297
+ },
298
298
  );
299
299
  if (response.data) {
300
300
  return response.data;
301
301
  }
302
302
 
303
303
  throw new Error(
304
- `Failed to list domain verification requests\n${response.error.message}`
304
+ `Failed to list domain verification requests\n${response.error.message}`,
305
305
  );
306
306
  }
307
307
 
308
308
  async deleteDomainVerificationRequest(
309
309
  domain: string,
310
- verificationCode: string
310
+ verificationCode: string,
311
311
  ): Promise<HandleDeleteDomainVerificationResponse> {
312
312
  const response = await sandbox_openapi.handleDeleteDomainVerification({
313
313
  client: this.client,
@@ -321,13 +321,13 @@ export class FreestyleSandboxes {
321
321
  }
322
322
 
323
323
  throw new Error(
324
- `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
324
+ `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
325
325
  );
326
326
  }
327
327
 
328
328
  async listWebDeployments(
329
329
  limit?: number,
330
- offset?: number
330
+ offset?: number,
331
331
  ): Promise<HandleListWebDeploysResponse> {
332
332
  const response = await sandbox_openapi.handleListWebDeploys({
333
333
  client: this.client,
@@ -342,13 +342,13 @@ export class FreestyleSandboxes {
342
342
  }
343
343
 
344
344
  throw new Error(
345
- `Failed to list web deployments\n${response.error.message}`
345
+ `Failed to list web deployments\n${response.error.message}`,
346
346
  );
347
347
  }
348
348
 
349
349
  async listExecuteRuns(
350
350
  limit?: number,
351
- offset?: number
351
+ offset?: number,
352
352
  ): Promise<HandleListExecuteRunsResponse> {
353
353
  const response = await sandbox_openapi.handleListExecuteRuns({
354
354
  client: this.client,
@@ -376,7 +376,7 @@ export class FreestyleSandboxes {
376
376
  }
377
377
 
378
378
  throw new Error(
379
- `Failed to get execute run with ID ${id}: ${response.error.message}`
379
+ `Failed to get execute run with ID ${id}: ${response.error.message}`,
380
380
  );
381
381
  }
382
382
 
@@ -394,7 +394,7 @@ export class FreestyleSandboxes {
394
394
  }
395
395
 
396
396
  throw new Error(
397
- `Failed to provision wildcard for domain ${domain}: ${response.error.message}`
397
+ `Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
398
398
  );
399
399
  }
400
400
 
@@ -429,7 +429,7 @@ export class FreestyleSandboxes {
429
429
  }
430
430
 
431
431
  throw new Error(
432
- `Failed to create git repository ${name}: ${response.error}`
432
+ `Failed to create git repository ${name}: ${response.error}`,
433
433
  );
434
434
  }
435
435
 
@@ -478,7 +478,7 @@ export class FreestyleSandboxes {
478
478
  }
479
479
 
480
480
  throw new Error(
481
- `Failed to delete git repository ${repoId}: ${response.error}`
481
+ `Failed to delete git repository ${repoId}: ${response.error}`,
482
482
  );
483
483
  }
484
484
 
@@ -547,7 +547,7 @@ export class FreestyleSandboxes {
547
547
  }
548
548
 
549
549
  throw new Error(
550
- `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`
550
+ `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
551
551
  );
552
552
  }
553
553
 
@@ -579,7 +579,7 @@ export class FreestyleSandboxes {
579
579
  }
580
580
 
581
581
  throw new Error(
582
- `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`
582
+ `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
583
583
  );
584
584
  }
585
585
 
@@ -606,7 +606,7 @@ export class FreestyleSandboxes {
606
606
  }
607
607
 
608
608
  throw new Error(
609
- `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`
609
+ `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
610
610
  );
611
611
  }
612
612
 
@@ -630,7 +630,7 @@ export class FreestyleSandboxes {
630
630
  }
631
631
 
632
632
  throw new Error(
633
- `Failed to list permissions for git identity ${identityId}: ${response.error}`
633
+ `Failed to list permissions for git identity ${identityId}: ${response.error}`,
634
634
  );
635
635
  }
636
636
 
@@ -657,7 +657,7 @@ export class FreestyleSandboxes {
657
657
  }
658
658
 
659
659
  throw new Error(
660
- `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`
660
+ `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
661
661
  );
662
662
  }
663
663
 
@@ -681,7 +681,7 @@ export class FreestyleSandboxes {
681
681
  }
682
682
 
683
683
  throw new Error(
684
- `Failed to create git access token: ${response.error.message}`
684
+ `Failed to create git access token: ${response.error.message}`,
685
685
  );
686
686
  }
687
687
 
@@ -710,7 +710,7 @@ export class FreestyleSandboxes {
710
710
  }
711
711
 
712
712
  throw new Error(
713
- `Failed to revoke git access token ${tokenId}: ${response.error.message}`
713
+ `Failed to revoke git access token ${tokenId}: ${response.error.message}`,
714
714
  );
715
715
  }
716
716
 
@@ -734,7 +734,7 @@ export class FreestyleSandboxes {
734
734
  }
735
735
 
736
736
  throw new Error(
737
- `Failed to list git access tokens: ${response.error.message}`
737
+ `Failed to list git access tokens: ${response.error.message}`,
738
738
  );
739
739
  }
740
740
 
@@ -758,7 +758,7 @@ export class FreestyleSandboxes {
758
758
  }
759
759
 
760
760
  throw new Error(
761
- `Failed to list git triggers for repository ${repoId}: ${response.error.message}`
761
+ `Failed to list git triggers for repository ${repoId}: ${response.error.message}`,
762
762
  );
763
763
  }
764
764
 
@@ -790,7 +790,7 @@ export class FreestyleSandboxes {
790
790
  }
791
791
 
792
792
  throw new Error(
793
- `Failed to create git trigger for repository ${repoId}: ${response.error.message}`
793
+ `Failed to create git trigger for repository ${repoId}: ${response.error.message}`,
794
794
  );
795
795
  }
796
796
 
@@ -810,7 +810,7 @@ export class FreestyleSandboxes {
810
810
  }
811
811
 
812
812
  throw new Error(
813
- `Failed to delete git trigger ${triggerId}: ${response.error.message}`
813
+ `Failed to delete git trigger ${triggerId}: ${response.error.message}`,
814
814
  );
815
815
  }
816
816
 
@@ -857,7 +857,7 @@ export class FreestyleSandboxes {
857
857
  if (response.error) {
858
858
  throw new Error(
859
859
  // @ts-ignore
860
- `Failed to request dev server: ${response.error.message}`
860
+ `Failed to request dev server: ${response.error.message}`,
861
861
  );
862
862
  }
863
863
 
@@ -869,7 +869,7 @@ export class FreestyleSandboxes {
869
869
  action: {
870
870
  endpoint: formatHook(
871
871
  response.data?.url!,
872
- options.repoUrl || `https://git.freestyle.sh/${rId}`
872
+ options.repoUrl || `https://git.freestyle.sh/${rId}`,
873
873
  ),
874
874
  action: "webhook",
875
875
  },
@@ -1001,12 +1001,12 @@ export class FreestyleSandboxes {
1001
1001
  kind: devServerInstance.kind,
1002
1002
  },
1003
1003
  }),
1004
- }
1004
+ },
1005
1005
  );
1006
1006
 
1007
1007
  if (!response.ok) {
1008
1008
  throw new Error(
1009
- `Failed to fetch stream: ${response.status} ${response.statusText}`
1009
+ `Failed to fetch stream: ${response.status} ${response.statusText}`,
1010
1010
  );
1011
1011
  }
1012
1012
 
@@ -1076,42 +1076,29 @@ export class FreestyleSandboxes {
1076
1076
  async writeFile(
1077
1077
  path: string,
1078
1078
  content: string | ArrayBuffer,
1079
- encoding: BufferEncoding = "utf-8"
1079
+ encoding: BufferEncoding = "utf-8",
1080
1080
  ) {
1081
1081
  const contentStr =
1082
1082
  typeof content === "string"
1083
1083
  ? content
1084
1084
  : Buffer.from(content).toString(encoding);
1085
1085
 
1086
- // const response =
1087
- // await sandbox_openapi.handleWriteFileFromEphemeralDevServer({
1088
- // client,
1089
-
1090
- // path: {
1091
- // filepath: path,
1092
- // },
1093
- // body: {
1094
- // devServer: devServerInstance,
1095
- // content: contentStr,
1096
- // encoding,
1097
- // },
1098
- // });
1099
- await client
1100
- .put({
1101
- url: `/ephemeral/v1/dev-servers/files/${path}`,
1086
+ const response =
1087
+ await sandbox_openapi.handleWriteFileFromEphemeralDevServer({
1088
+ client,
1089
+ path: {
1090
+ filepath: path,
1091
+ },
1102
1092
  body: {
1103
1093
  devServer: devServerInstance,
1104
1094
  content: contentStr,
1105
1095
  encoding,
1106
1096
  },
1107
- })
1108
- .then((response) => {
1109
- console.log("Request PATH: ", response.request.url);
1110
1097
  });
1111
1098
 
1112
1099
  if (response.error) {
1113
1100
  throw new Error(
1114
- `Failed to write file: ${JSON.stringify(response.error)}`
1101
+ `Failed to write file: ${JSON.stringify(response.error)}`,
1115
1102
  );
1116
1103
  }
1117
1104
  },
@@ -1127,7 +1114,7 @@ export class FreestyleSandboxes {
1127
1114
  command: cmd,
1128
1115
  background,
1129
1116
  },
1130
- }
1117
+ },
1131
1118
  );
1132
1119
 
1133
1120
  if (response.error) {
@@ -1164,7 +1151,7 @@ export class FreestyleSandboxes {
1164
1151
 
1165
1152
  const url = new URL(
1166
1153
  path,
1167
- this.options.baseUrl ?? "https://api.freestyle.sh"
1154
+ this.options.baseUrl ?? "https://api.freestyle.sh",
1168
1155
  );
1169
1156
 
1170
1157
  return fetch(url, {