freestyle-sandboxes 0.0.76 → 0.0.77

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 +34 -12
  6. package/dist/inde.d.mts +34 -12
  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 +17 -6
  10. package/dist/index.d.cts +34 -12
  11. package/dist/index.d.mts +34 -12
  12. package/dist/index.mjs +17 -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-BbekD8Sd.d.ts → types.gen-DkFlXKTr.d.ts} +266 -31
  25. package/dist/{types.gen-CZUnqmzP.d.ts → types.gen-DxZanGNF.d.ts} +9 -6
  26. package/dist/utils/inde.d.cts +1 -1
  27. package/dist/utils/inde.d.mts +1 -1
  28. package/dist/utils/index.d.cts +1 -1
  29. package/dist/utils/index.d.mts +1 -1
  30. package/openapi/sdk.gen.ts +22 -11
  31. package/openapi/types.gen.ts +80 -20
  32. package/openapi.json +1 -1
  33. package/package.json +1 -1
  34. package/src/dev-server.ts +3 -0
  35. package/src/index.ts +86 -55
  36. package/dist/index-BQHqnjZK.mjs +0 -3231
  37. package/dist/index-CEEa9WHp.cjs +0 -3238
  38. package/dist/types.gen-1sd31qLV.d.ts +0 -172
  39. package/dist/types.gen-627pxroW.d.ts +0 -830
  40. package/dist/types.gen-BCdfx7yt.d.ts +0 -760
  41. package/dist/types.gen-BaMKzqxQ.d.ts +0 -233
  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.76",
3
+ "version": "0.0.77",
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
@@ -70,6 +70,34 @@ export type {
70
70
  DeploymentBuildOptions,
71
71
  } from "../openapi/index.ts";
72
72
 
73
+ /**
74
+ * Create a new git repository with a single commit from a static import.
75
+ */
76
+ type CreateGitRepositoryImport = {
77
+ /**
78
+ * Create a new git repository with a single commit from a static import.
79
+ */
80
+ import: sandbox_openapi.CreateRepoImport;
81
+ /**
82
+ * Create a git repository from another git reopsitory
83
+ */
84
+ source?: never;
85
+ };
86
+
87
+ /**
88
+ * Create a git repository from another git reopsitory
89
+ */
90
+ type CreateGitRepositorySource = {
91
+ /**
92
+ * Create a git repository from another git reopsitory
93
+ */
94
+ source: sandbox_openapi.CreateRepoSource;
95
+ /**
96
+ * Create a new git repository with a single commit from a static import.
97
+ */
98
+ import?: never;
99
+ };
100
+
73
101
  type Options = {
74
102
  /**
75
103
  * The base URL for the API.
@@ -97,7 +125,7 @@ export class FreestyleSandboxes {
97
125
  }
98
126
  if (!this.options.apiKey) {
99
127
  throw new Error(
100
- "No API key provided. Please set the FREESTYLE_API_KEY environment variable or configure apiKey when constructing FreestyleSandboxes."
128
+ "No API key provided. Please set the FREESTYLE_API_KEY environment variable or configure apiKey when constructing FreestyleSandboxes.",
101
129
  );
102
130
  }
103
131
 
@@ -129,7 +157,7 @@ export class FreestyleSandboxes {
129
157
  */
130
158
  async executeScript(
131
159
  script: string,
132
- config?: FreestyleExecuteScriptParamsConfiguration
160
+ config?: FreestyleExecuteScriptParamsConfiguration,
133
161
  ): Promise<FreestyleExecuteScriptResultSuccess> {
134
162
  const response = await sandbox_openapi.handleExecuteScript({
135
163
  client: this.client,
@@ -144,7 +172,7 @@ export class FreestyleSandboxes {
144
172
  }
145
173
  throw {
146
174
  message: `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
147
- response
175
+ response,
148
176
  )}`,
149
177
  error: response.error,
150
178
  };
@@ -158,7 +186,7 @@ export class FreestyleSandboxes {
158
186
  */
159
187
  async deployWeb(
160
188
  source: sandbox_openapi.DeploymentSource,
161
- config?: FreestyleDeployWebConfiguration
189
+ config?: FreestyleDeployWebConfiguration,
162
190
  ): Promise<FreestyleDeployWebSuccessResponseV2> {
163
191
  const response = await sandbox_openapi.handleDeployWebV2({
164
192
  client: this.client,
@@ -171,7 +199,7 @@ export class FreestyleSandboxes {
171
199
  return response.data;
172
200
  }
173
201
  throw new Error(
174
- `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`
202
+ `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`,
175
203
  );
176
204
  }
177
205
 
@@ -179,7 +207,7 @@ export class FreestyleSandboxes {
179
207
  * Deploy a Cloudstate project to a sandbox.
180
208
  */
181
209
  async deployCloudstate(
182
- body: FreestyleCloudstateDeployRequest
210
+ body: FreestyleCloudstateDeployRequest,
183
211
  ): Promise<FreestyleCloudstateDeploySuccessResponse> {
184
212
  const response = await sandbox_openapi.handleDeployCloudstate({
185
213
  client: this.client,
@@ -242,7 +270,7 @@ export class FreestyleSandboxes {
242
270
  * @returns The domain verification token.
243
271
  */
244
272
  async createDomainVerificationRequest(
245
- domain: string
273
+ domain: string,
246
274
  ): Promise<HandleCreateDomainVerificationResponse> {
247
275
  const response = await sandbox_openapi.handleCreateDomainVerification({
248
276
  client: this.client,
@@ -263,7 +291,7 @@ export class FreestyleSandboxes {
263
291
  * @returns The domain verification request.
264
292
  */
265
293
  async verifyDomain(
266
- domain: string
294
+ domain: string,
267
295
  ): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
268
296
  const response = await sandbox_openapi.handleVerifyDomain({
269
297
  client: this.client,
@@ -275,7 +303,7 @@ export class FreestyleSandboxes {
275
303
  return response.data;
276
304
  }
277
305
  throw new Error(
278
- `Failed to verify domain ${domain}: ${response.error.message}`
306
+ `Failed to verify domain ${domain}: ${response.error.message}`,
279
307
  );
280
308
  }
281
309
 
@@ -294,20 +322,20 @@ export class FreestyleSandboxes {
294
322
  const response = await sandbox_openapi.handleListDomainVerificationRequests(
295
323
  {
296
324
  client: this.client,
297
- }
325
+ },
298
326
  );
299
327
  if (response.data) {
300
328
  return response.data;
301
329
  }
302
330
 
303
331
  throw new Error(
304
- `Failed to list domain verification requests\n${response.error.message}`
332
+ `Failed to list domain verification requests\n${response.error.message}`,
305
333
  );
306
334
  }
307
335
 
308
336
  async deleteDomainVerificationRequest(
309
337
  domain: string,
310
- verificationCode: string
338
+ verificationCode: string,
311
339
  ): Promise<HandleDeleteDomainVerificationResponse> {
312
340
  const response = await sandbox_openapi.handleDeleteDomainVerification({
313
341
  client: this.client,
@@ -321,13 +349,13 @@ export class FreestyleSandboxes {
321
349
  }
322
350
 
323
351
  throw new Error(
324
- `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
352
+ `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
325
353
  );
326
354
  }
327
355
 
328
356
  async listWebDeployments(
329
357
  limit?: number,
330
- offset?: number
358
+ offset?: number,
331
359
  ): Promise<HandleListWebDeploysResponse> {
332
360
  const response = await sandbox_openapi.handleListWebDeploys({
333
361
  client: this.client,
@@ -342,13 +370,13 @@ export class FreestyleSandboxes {
342
370
  }
343
371
 
344
372
  throw new Error(
345
- `Failed to list web deployments\n${response.error.message}`
373
+ `Failed to list web deployments\n${response.error.message}`,
346
374
  );
347
375
  }
348
376
 
349
377
  async listExecuteRuns(
350
378
  limit?: number,
351
- offset?: number
379
+ offset?: number,
352
380
  ): Promise<HandleListExecuteRunsResponse> {
353
381
  const response = await sandbox_openapi.handleListExecuteRuns({
354
382
  client: this.client,
@@ -376,7 +404,7 @@ export class FreestyleSandboxes {
376
404
  }
377
405
 
378
406
  throw new Error(
379
- `Failed to get execute run with ID ${id}: ${response.error.message}`
407
+ `Failed to get execute run with ID ${id}: ${response.error.message}`,
380
408
  );
381
409
  }
382
410
 
@@ -394,7 +422,7 @@ export class FreestyleSandboxes {
394
422
  }
395
423
 
396
424
  throw new Error(
397
- `Failed to provision wildcard for domain ${domain}: ${response.error.message}`
425
+ `Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
398
426
  );
399
427
  }
400
428
 
@@ -405,22 +433,21 @@ export class FreestyleSandboxes {
405
433
  name,
406
434
  public: pub = false,
407
435
  source,
436
+ import: _import,
408
437
  }: {
409
- name: string;
438
+ name?: string;
410
439
  public?: boolean;
411
- source?: {
412
- type: "git";
413
- url: string;
414
- branch?: string;
415
- depth?: number;
416
- };
417
- }): Promise<CreateRepositoryResponseSuccess> {
440
+ } & (
441
+ | CreateGitRepositorySource
442
+ | CreateGitRepositoryImport
443
+ )): Promise<CreateRepositoryResponseSuccess> {
418
444
  const response = await sandbox_openapi.handleCreateRepo({
419
445
  client: this.client,
420
446
  body: {
421
447
  name,
422
448
  public: pub,
423
449
  source,
450
+ import: _import,
424
451
  },
425
452
  });
426
453
 
@@ -429,7 +456,7 @@ export class FreestyleSandboxes {
429
456
  }
430
457
 
431
458
  throw new Error(
432
- `Failed to create git repository ${name}: ${response.error}`
459
+ `Failed to create git repository ${name}: ${response.error}`,
433
460
  );
434
461
  }
435
462
 
@@ -478,7 +505,7 @@ export class FreestyleSandboxes {
478
505
  }
479
506
 
480
507
  throw new Error(
481
- `Failed to delete git repository ${repoId}: ${response.error}`
508
+ `Failed to delete git repository ${repoId}: ${response.error}`,
482
509
  );
483
510
  }
484
511
 
@@ -547,7 +574,7 @@ export class FreestyleSandboxes {
547
574
  }
548
575
 
549
576
  throw new Error(
550
- `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`
577
+ `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
551
578
  );
552
579
  }
553
580
 
@@ -579,7 +606,7 @@ export class FreestyleSandboxes {
579
606
  }
580
607
 
581
608
  throw new Error(
582
- `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`
609
+ `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
583
610
  );
584
611
  }
585
612
 
@@ -606,7 +633,7 @@ export class FreestyleSandboxes {
606
633
  }
607
634
 
608
635
  throw new Error(
609
- `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`
636
+ `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
610
637
  );
611
638
  }
612
639
 
@@ -630,7 +657,7 @@ export class FreestyleSandboxes {
630
657
  }
631
658
 
632
659
  throw new Error(
633
- `Failed to list permissions for git identity ${identityId}: ${response.error}`
660
+ `Failed to list permissions for git identity ${identityId}: ${response.error}`,
634
661
  );
635
662
  }
636
663
 
@@ -657,7 +684,7 @@ export class FreestyleSandboxes {
657
684
  }
658
685
 
659
686
  throw new Error(
660
- `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`
687
+ `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
661
688
  );
662
689
  }
663
690
 
@@ -681,7 +708,7 @@ export class FreestyleSandboxes {
681
708
  }
682
709
 
683
710
  throw new Error(
684
- `Failed to create git access token: ${response.error.message}`
711
+ `Failed to create git access token: ${response.error.message}`,
685
712
  );
686
713
  }
687
714
 
@@ -710,7 +737,7 @@ export class FreestyleSandboxes {
710
737
  }
711
738
 
712
739
  throw new Error(
713
- `Failed to revoke git access token ${tokenId}: ${response.error.message}`
740
+ `Failed to revoke git access token ${tokenId}: ${response.error.message}`,
714
741
  );
715
742
  }
716
743
 
@@ -734,7 +761,7 @@ export class FreestyleSandboxes {
734
761
  }
735
762
 
736
763
  throw new Error(
737
- `Failed to list git access tokens: ${response.error.message}`
764
+ `Failed to list git access tokens: ${response.error.message}`,
738
765
  );
739
766
  }
740
767
 
@@ -758,7 +785,7 @@ export class FreestyleSandboxes {
758
785
  }
759
786
 
760
787
  throw new Error(
761
- `Failed to list git triggers for repository ${repoId}: ${response.error.message}`
788
+ `Failed to list git triggers for repository ${repoId}: ${response.error.message}`,
762
789
  );
763
790
  }
764
791
 
@@ -790,7 +817,7 @@ export class FreestyleSandboxes {
790
817
  }
791
818
 
792
819
  throw new Error(
793
- `Failed to create git trigger for repository ${repoId}: ${response.error.message}`
820
+ `Failed to create git trigger for repository ${repoId}: ${response.error.message}`,
794
821
  );
795
822
  }
796
823
 
@@ -810,7 +837,7 @@ export class FreestyleSandboxes {
810
837
  }
811
838
 
812
839
  throw new Error(
813
- `Failed to delete git trigger ${triggerId}: ${response.error.message}`
840
+ `Failed to delete git trigger ${triggerId}: ${response.error.message}`,
814
841
  );
815
842
  }
816
843
 
@@ -857,7 +884,7 @@ export class FreestyleSandboxes {
857
884
  if (response.error) {
858
885
  throw new Error(
859
886
  // @ts-ignore
860
- `Failed to request dev server: ${response.error.message}`
887
+ `Failed to request dev server: ${response.error.message}`,
861
888
  );
862
889
  }
863
890
 
@@ -869,7 +896,7 @@ export class FreestyleSandboxes {
869
896
  action: {
870
897
  endpoint: formatHook(
871
898
  response.data?.url!,
872
- options.repoUrl || `https://git.freestyle.sh/${rId}`
899
+ options.repoUrl || `https://git.freestyle.sh/${rId}`,
873
900
  ),
874
901
  action: "webhook",
875
902
  },
@@ -1001,12 +1028,12 @@ export class FreestyleSandboxes {
1001
1028
  kind: devServerInstance.kind,
1002
1029
  },
1003
1030
  }),
1004
- }
1031
+ },
1005
1032
  );
1006
1033
 
1007
1034
  if (!response.ok) {
1008
1035
  throw new Error(
1009
- `Failed to fetch stream: ${response.status} ${response.statusText}`
1036
+ `Failed to fetch stream: ${response.status} ${response.statusText}`,
1010
1037
  );
1011
1038
  }
1012
1039
 
@@ -1076,25 +1103,29 @@ export class FreestyleSandboxes {
1076
1103
  async writeFile(
1077
1104
  path: string,
1078
1105
  content: string | ArrayBuffer,
1079
- encoding: BufferEncoding = "utf-8"
1106
+ encoding: BufferEncoding = "utf-8",
1080
1107
  ) {
1081
1108
  const contentStr =
1082
1109
  typeof content === "string"
1083
1110
  ? content
1084
1111
  : Buffer.from(content).toString(encoding);
1085
1112
 
1086
- await client.put({
1087
- url: `/ephemeral/v1/dev-servers/files/${path}`,
1088
- body: {
1089
- devServer: devServerInstance,
1090
- content: contentStr,
1091
- encoding,
1092
- },
1093
- });
1113
+ const response =
1114
+ await sandbox_openapi.handleWriteFileFromEphemeralDevServer({
1115
+ client,
1116
+ path: {
1117
+ filepath: path,
1118
+ },
1119
+ body: {
1120
+ devServer: devServerInstance,
1121
+ content: contentStr,
1122
+ encoding,
1123
+ },
1124
+ });
1094
1125
 
1095
1126
  if (response.error) {
1096
1127
  throw new Error(
1097
- `Failed to write file: ${JSON.stringify(response.error)}`
1128
+ `Failed to write file: ${JSON.stringify(response.error)}`,
1098
1129
  );
1099
1130
  }
1100
1131
  },
@@ -1110,7 +1141,7 @@ export class FreestyleSandboxes {
1110
1141
  command: cmd,
1111
1142
  background,
1112
1143
  },
1113
- }
1144
+ },
1114
1145
  );
1115
1146
 
1116
1147
  if (response.error) {
@@ -1147,7 +1178,7 @@ export class FreestyleSandboxes {
1147
1178
 
1148
1179
  const url = new URL(
1149
1180
  path,
1150
- this.options.baseUrl ?? "https://api.freestyle.sh"
1181
+ this.options.baseUrl ?? "https://api.freestyle.sh",
1151
1182
  );
1152
1183
 
1153
1184
  return fetch(url, {