freestyle-sandboxes 0.0.77 → 0.0.78

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 (37) hide show
  1. package/dist/inde.d.cts +1 -0
  2. package/dist/inde.d.mts +1 -0
  3. package/dist/{index-CGc0kRd_.cjs → index-BBXyg0JQ.cjs} +5 -9
  4. package/dist/index-BQHqnjZK.mjs +3231 -0
  5. package/dist/index-CEEa9WHp.cjs +3238 -0
  6. package/dist/{index-jh-93svX.mjs → index-DCF70Xbq.mjs} +5 -9
  7. package/dist/index.cjs +14 -0
  8. package/dist/index.d.cts +1 -0
  9. package/dist/index.d.mts +1 -0
  10. package/dist/index.mjs +14 -0
  11. package/dist/types.gen-1sd31qLV.d.ts +172 -0
  12. package/dist/types.gen-627pxroW.d.ts +830 -0
  13. package/dist/types.gen-BCdfx7yt.d.ts +760 -0
  14. package/dist/{types.gen-0bQ5Wn0o.d.ts → types.gen-BVXmFV7d.d.ts} +17 -18
  15. package/dist/types.gen-BaMKzqxQ.d.ts +233 -0
  16. package/dist/types.gen-BbekD8Sd.d.ts +1119 -0
  17. package/dist/types.gen-BqN1t03N.d.ts +842 -0
  18. package/dist/types.gen-BtK6PMQy.d.ts +195 -0
  19. package/dist/types.gen-C03gaIPq.d.ts +297 -0
  20. package/dist/{types.gen-BJArgpto.d.ts → types.gen-CIf3ciN7.d.ts} +5 -2
  21. package/dist/types.gen-CMuCas4r.d.ts +183 -0
  22. package/dist/{types.gen-DxZanGNF.d.ts → types.gen-CZUnqmzP.d.ts} +6 -9
  23. package/dist/types.gen-CnEkmbco.d.ts +314 -0
  24. package/dist/types.gen-DDYpuDzZ.d.ts +764 -0
  25. package/dist/types.gen-DHmdEOOa.d.ts +172 -0
  26. package/dist/{types.gen-CfrGF-JI.d.ts → types.gen-DLYohMJT.d.ts} +1 -1
  27. package/dist/types.gen-DbTb_SrD.d.ts +156 -0
  28. package/dist/types.gen-DkQ-Dbs1.d.ts +764 -0
  29. package/dist/types.gen-DyY7Deri.d.ts +138 -0
  30. package/dist/types.gen-MBZCvIhE.d.ts +311 -0
  31. package/dist/types.gen-YhJAHBw8.d.ts +233 -0
  32. package/dist/types.gen-cCnnhnB6.d.ts +182 -0
  33. package/dist/types.gen-mg_JNXrq.d.ts +830 -0
  34. package/dist/types.gen-uDTr6v-7.d.ts +731 -0
  35. package/package.json +1 -1
  36. package/src/index.ts +57 -39
  37. package/src/temp.ts +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -125,7 +125,7 @@ export class FreestyleSandboxes {
125
125
  }
126
126
  if (!this.options.apiKey) {
127
127
  throw new Error(
128
- "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."
129
129
  );
130
130
  }
131
131
 
@@ -157,7 +157,7 @@ export class FreestyleSandboxes {
157
157
  */
158
158
  async executeScript(
159
159
  script: string,
160
- config?: FreestyleExecuteScriptParamsConfiguration,
160
+ config?: FreestyleExecuteScriptParamsConfiguration
161
161
  ): Promise<FreestyleExecuteScriptResultSuccess> {
162
162
  const response = await sandbox_openapi.handleExecuteScript({
163
163
  client: this.client,
@@ -172,7 +172,7 @@ export class FreestyleSandboxes {
172
172
  }
173
173
  throw {
174
174
  message: `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
175
- response,
175
+ response
176
176
  )}`,
177
177
  error: response.error,
178
178
  };
@@ -186,7 +186,7 @@ export class FreestyleSandboxes {
186
186
  */
187
187
  async deployWeb(
188
188
  source: sandbox_openapi.DeploymentSource,
189
- config?: FreestyleDeployWebConfiguration,
189
+ config?: FreestyleDeployWebConfiguration
190
190
  ): Promise<FreestyleDeployWebSuccessResponseV2> {
191
191
  const response = await sandbox_openapi.handleDeployWebV2({
192
192
  client: this.client,
@@ -199,7 +199,7 @@ export class FreestyleSandboxes {
199
199
  return response.data;
200
200
  }
201
201
  throw new Error(
202
- `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}`
203
203
  );
204
204
  }
205
205
 
@@ -207,7 +207,7 @@ export class FreestyleSandboxes {
207
207
  * Deploy a Cloudstate project to a sandbox.
208
208
  */
209
209
  async deployCloudstate(
210
- body: FreestyleCloudstateDeployRequest,
210
+ body: FreestyleCloudstateDeployRequest
211
211
  ): Promise<FreestyleCloudstateDeploySuccessResponse> {
212
212
  const response = await sandbox_openapi.handleDeployCloudstate({
213
213
  client: this.client,
@@ -270,7 +270,7 @@ export class FreestyleSandboxes {
270
270
  * @returns The domain verification token.
271
271
  */
272
272
  async createDomainVerificationRequest(
273
- domain: string,
273
+ domain: string
274
274
  ): Promise<HandleCreateDomainVerificationResponse> {
275
275
  const response = await sandbox_openapi.handleCreateDomainVerification({
276
276
  client: this.client,
@@ -285,13 +285,31 @@ export class FreestyleSandboxes {
285
285
  throw new Error(response.error.message);
286
286
  }
287
287
 
288
+ async verifyDomainVerificationRequest(
289
+ id: string
290
+ ): Promise<HandleVerifyDomainResponse> {
291
+ const response = await sandbox_openapi.handleVerifyDomain({
292
+ client: this.client,
293
+ body: {
294
+ id,
295
+ },
296
+ });
297
+
298
+ if (response.data) {
299
+ return response.data;
300
+ }
301
+ throw new Error(
302
+ `Failed to verify domain verification request with ID ${id}: ${response.error.message}`
303
+ );
304
+ }
305
+
288
306
  /**
289
307
  * Verify a domain. Note, this requires the domain verification token to be already set up.
290
308
  * @param domain The domain to verify.
291
309
  * @returns The domain verification request.
292
310
  */
293
311
  async verifyDomain(
294
- domain: string,
312
+ domain: string
295
313
  ): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
296
314
  const response = await sandbox_openapi.handleVerifyDomain({
297
315
  client: this.client,
@@ -303,7 +321,7 @@ export class FreestyleSandboxes {
303
321
  return response.data;
304
322
  }
305
323
  throw new Error(
306
- `Failed to verify domain ${domain}: ${response.error.message}`,
324
+ `Failed to verify domain ${domain}: ${response.error.message}`
307
325
  );
308
326
  }
309
327
 
@@ -322,20 +340,20 @@ export class FreestyleSandboxes {
322
340
  const response = await sandbox_openapi.handleListDomainVerificationRequests(
323
341
  {
324
342
  client: this.client,
325
- },
343
+ }
326
344
  );
327
345
  if (response.data) {
328
346
  return response.data;
329
347
  }
330
348
 
331
349
  throw new Error(
332
- `Failed to list domain verification requests\n${response.error.message}`,
350
+ `Failed to list domain verification requests\n${response.error.message}`
333
351
  );
334
352
  }
335
353
 
336
354
  async deleteDomainVerificationRequest(
337
355
  domain: string,
338
- verificationCode: string,
356
+ verificationCode: string
339
357
  ): Promise<HandleDeleteDomainVerificationResponse> {
340
358
  const response = await sandbox_openapi.handleDeleteDomainVerification({
341
359
  client: this.client,
@@ -349,13 +367,13 @@ export class FreestyleSandboxes {
349
367
  }
350
368
 
351
369
  throw new Error(
352
- `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
370
+ `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
353
371
  );
354
372
  }
355
373
 
356
374
  async listWebDeployments(
357
375
  limit?: number,
358
- offset?: number,
376
+ offset?: number
359
377
  ): Promise<HandleListWebDeploysResponse> {
360
378
  const response = await sandbox_openapi.handleListWebDeploys({
361
379
  client: this.client,
@@ -370,13 +388,13 @@ export class FreestyleSandboxes {
370
388
  }
371
389
 
372
390
  throw new Error(
373
- `Failed to list web deployments\n${response.error.message}`,
391
+ `Failed to list web deployments\n${response.error.message}`
374
392
  );
375
393
  }
376
394
 
377
395
  async listExecuteRuns(
378
396
  limit?: number,
379
- offset?: number,
397
+ offset?: number
380
398
  ): Promise<HandleListExecuteRunsResponse> {
381
399
  const response = await sandbox_openapi.handleListExecuteRuns({
382
400
  client: this.client,
@@ -404,7 +422,7 @@ export class FreestyleSandboxes {
404
422
  }
405
423
 
406
424
  throw new Error(
407
- `Failed to get execute run with ID ${id}: ${response.error.message}`,
425
+ `Failed to get execute run with ID ${id}: ${response.error.message}`
408
426
  );
409
427
  }
410
428
 
@@ -422,7 +440,7 @@ export class FreestyleSandboxes {
422
440
  }
423
441
 
424
442
  throw new Error(
425
- `Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
443
+ `Failed to provision wildcard for domain ${domain}: ${response.error.message}`
426
444
  );
427
445
  }
428
446
 
@@ -456,7 +474,7 @@ export class FreestyleSandboxes {
456
474
  }
457
475
 
458
476
  throw new Error(
459
- `Failed to create git repository ${name}: ${response.error}`,
477
+ `Failed to create git repository ${name}: ${response.error}`
460
478
  );
461
479
  }
462
480
 
@@ -505,7 +523,7 @@ export class FreestyleSandboxes {
505
523
  }
506
524
 
507
525
  throw new Error(
508
- `Failed to delete git repository ${repoId}: ${response.error}`,
526
+ `Failed to delete git repository ${repoId}: ${response.error}`
509
527
  );
510
528
  }
511
529
 
@@ -574,7 +592,7 @@ export class FreestyleSandboxes {
574
592
  }
575
593
 
576
594
  throw new Error(
577
- `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
595
+ `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`
578
596
  );
579
597
  }
580
598
 
@@ -606,7 +624,7 @@ export class FreestyleSandboxes {
606
624
  }
607
625
 
608
626
  throw new Error(
609
- `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
627
+ `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`
610
628
  );
611
629
  }
612
630
 
@@ -633,7 +651,7 @@ export class FreestyleSandboxes {
633
651
  }
634
652
 
635
653
  throw new Error(
636
- `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
654
+ `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`
637
655
  );
638
656
  }
639
657
 
@@ -657,7 +675,7 @@ export class FreestyleSandboxes {
657
675
  }
658
676
 
659
677
  throw new Error(
660
- `Failed to list permissions for git identity ${identityId}: ${response.error}`,
678
+ `Failed to list permissions for git identity ${identityId}: ${response.error}`
661
679
  );
662
680
  }
663
681
 
@@ -684,7 +702,7 @@ export class FreestyleSandboxes {
684
702
  }
685
703
 
686
704
  throw new Error(
687
- `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
705
+ `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`
688
706
  );
689
707
  }
690
708
 
@@ -708,7 +726,7 @@ export class FreestyleSandboxes {
708
726
  }
709
727
 
710
728
  throw new Error(
711
- `Failed to create git access token: ${response.error.message}`,
729
+ `Failed to create git access token: ${response.error.message}`
712
730
  );
713
731
  }
714
732
 
@@ -737,7 +755,7 @@ export class FreestyleSandboxes {
737
755
  }
738
756
 
739
757
  throw new Error(
740
- `Failed to revoke git access token ${tokenId}: ${response.error.message}`,
758
+ `Failed to revoke git access token ${tokenId}: ${response.error.message}`
741
759
  );
742
760
  }
743
761
 
@@ -761,7 +779,7 @@ export class FreestyleSandboxes {
761
779
  }
762
780
 
763
781
  throw new Error(
764
- `Failed to list git access tokens: ${response.error.message}`,
782
+ `Failed to list git access tokens: ${response.error.message}`
765
783
  );
766
784
  }
767
785
 
@@ -785,7 +803,7 @@ export class FreestyleSandboxes {
785
803
  }
786
804
 
787
805
  throw new Error(
788
- `Failed to list git triggers for repository ${repoId}: ${response.error.message}`,
806
+ `Failed to list git triggers for repository ${repoId}: ${response.error.message}`
789
807
  );
790
808
  }
791
809
 
@@ -817,7 +835,7 @@ export class FreestyleSandboxes {
817
835
  }
818
836
 
819
837
  throw new Error(
820
- `Failed to create git trigger for repository ${repoId}: ${response.error.message}`,
838
+ `Failed to create git trigger for repository ${repoId}: ${response.error.message}`
821
839
  );
822
840
  }
823
841
 
@@ -837,7 +855,7 @@ export class FreestyleSandboxes {
837
855
  }
838
856
 
839
857
  throw new Error(
840
- `Failed to delete git trigger ${triggerId}: ${response.error.message}`,
858
+ `Failed to delete git trigger ${triggerId}: ${response.error.message}`
841
859
  );
842
860
  }
843
861
 
@@ -884,7 +902,7 @@ export class FreestyleSandboxes {
884
902
  if (response.error) {
885
903
  throw new Error(
886
904
  // @ts-ignore
887
- `Failed to request dev server: ${response.error.message}`,
905
+ `Failed to request dev server: ${response.error.message}`
888
906
  );
889
907
  }
890
908
 
@@ -896,7 +914,7 @@ export class FreestyleSandboxes {
896
914
  action: {
897
915
  endpoint: formatHook(
898
916
  response.data?.url!,
899
- options.repoUrl || `https://git.freestyle.sh/${rId}`,
917
+ options.repoUrl || `https://git.freestyle.sh/${rId}`
900
918
  ),
901
919
  action: "webhook",
902
920
  },
@@ -1028,12 +1046,12 @@ export class FreestyleSandboxes {
1028
1046
  kind: devServerInstance.kind,
1029
1047
  },
1030
1048
  }),
1031
- },
1049
+ }
1032
1050
  );
1033
1051
 
1034
1052
  if (!response.ok) {
1035
1053
  throw new Error(
1036
- `Failed to fetch stream: ${response.status} ${response.statusText}`,
1054
+ `Failed to fetch stream: ${response.status} ${response.statusText}`
1037
1055
  );
1038
1056
  }
1039
1057
 
@@ -1103,7 +1121,7 @@ export class FreestyleSandboxes {
1103
1121
  async writeFile(
1104
1122
  path: string,
1105
1123
  content: string | ArrayBuffer,
1106
- encoding: BufferEncoding = "utf-8",
1124
+ encoding: BufferEncoding = "utf-8"
1107
1125
  ) {
1108
1126
  const contentStr =
1109
1127
  typeof content === "string"
@@ -1125,7 +1143,7 @@ export class FreestyleSandboxes {
1125
1143
 
1126
1144
  if (response.error) {
1127
1145
  throw new Error(
1128
- `Failed to write file: ${JSON.stringify(response.error)}`,
1146
+ `Failed to write file: ${JSON.stringify(response.error)}`
1129
1147
  );
1130
1148
  }
1131
1149
  },
@@ -1141,7 +1159,7 @@ export class FreestyleSandboxes {
1141
1159
  command: cmd,
1142
1160
  background,
1143
1161
  },
1144
- },
1162
+ }
1145
1163
  );
1146
1164
 
1147
1165
  if (response.error) {
@@ -1178,7 +1196,7 @@ export class FreestyleSandboxes {
1178
1196
 
1179
1197
  const url = new URL(
1180
1198
  path,
1181
- this.options.baseUrl ?? "https://api.freestyle.sh",
1199
+ this.options.baseUrl ?? "https://api.freestyle.sh"
1182
1200
  );
1183
1201
 
1184
1202
  return fetch(url, {
package/src/temp.ts DELETED
@@ -1,10 +0,0 @@
1
- import { FreestyleSandboxes } from "./index";
2
- import "dotenv/config"
3
-
4
- const api = new FreestyleSandboxes({
5
- apiKey: process.env.FREESTYLE_API_KEY,
6
- });
7
-
8
- api.requestDevServer({
9
- repoUrl: "https://c6709211-2d68-478e-80b3-7ebe7313f3ac:QqasQD331e3woNyK.Q9dnXy3MR9Aeo759@git.freestyle.sh/15b7ed11-0e7c-452b-b044-70f0dcab9161"
10
- }).then(console.log)