freestyle-sandboxes 0.0.45 → 0.0.46

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 (38) hide show
  1. package/dist/ai/index.d.cts +1 -1
  2. package/dist/ai/index.d.mts +1 -1
  3. package/dist/{index-BBXyg0JQ.cjs → index-CGc0kRd_.cjs} +9 -5
  4. package/dist/{index-DCF70Xbq.mjs → index-jh-93svX.mjs} +9 -5
  5. package/dist/index.cjs +132 -49
  6. package/dist/index.d.cts +74 -47
  7. package/dist/index.d.mts +74 -47
  8. package/dist/index.mjs +132 -49
  9. package/dist/langgraph/index.d.cts +1 -1
  10. package/dist/langgraph/index.d.mts +1 -1
  11. package/dist/mastra/index.d.cts +1 -1
  12. package/dist/mastra/index.d.mts +1 -1
  13. package/dist/{types.gen-DDYpuDzZ.d.ts → types.gen-BJArgpto.d.ts} +50 -10
  14. package/dist/{types.gen-DLYohMJT.d.ts → types.gen-CfrGF-JI.d.ts} +1 -1
  15. package/dist/{types.gen-CZUnqmzP.d.ts → types.gen-DxZanGNF.d.ts} +9 -6
  16. package/dist/utils/index.d.cts +1 -1
  17. package/dist/utils/index.d.mts +1 -1
  18. package/openapi/types.gen.ts +23 -5
  19. package/openapi.json +1 -1
  20. package/package.json +1 -1
  21. package/src/index.ts +193 -101
  22. package/dist/index-BQHqnjZK.mjs +0 -3231
  23. package/dist/index-CEEa9WHp.cjs +0 -3238
  24. package/dist/types.gen-1sd31qLV.d.ts +0 -172
  25. package/dist/types.gen-BCdfx7yt.d.ts +0 -760
  26. package/dist/types.gen-BaMKzqxQ.d.ts +0 -233
  27. package/dist/types.gen-BtK6PMQy.d.ts +0 -195
  28. package/dist/types.gen-C03gaIPq.d.ts +0 -297
  29. package/dist/types.gen-CMuCas4r.d.ts +0 -183
  30. package/dist/types.gen-CnEkmbco.d.ts +0 -314
  31. package/dist/types.gen-DHmdEOOa.d.ts +0 -172
  32. package/dist/types.gen-DbTb_SrD.d.ts +0 -156
  33. package/dist/types.gen-DkQ-Dbs1.d.ts +0 -764
  34. package/dist/types.gen-DyY7Deri.d.ts +0 -138
  35. package/dist/types.gen-MBZCvIhE.d.ts +0 -311
  36. package/dist/types.gen-YhJAHBw8.d.ts +0 -233
  37. package/dist/types.gen-cCnnhnB6.d.ts +0 -182
  38. package/dist/types.gen-uDTr6v-7.d.ts +0 -731
package/src/index.ts CHANGED
@@ -107,7 +107,7 @@ export class FreestyleSandboxes {
107
107
  */
108
108
  async executeScript(
109
109
  script: string,
110
- config?: FreestyleExecuteScriptParamsConfiguration
110
+ config?: FreestyleExecuteScriptParamsConfiguration,
111
111
  ): Promise<FreestyleExecuteScriptResultSuccess> {
112
112
  const response = await sandbox_openapi.handleExecuteScript({
113
113
  client: this.client,
@@ -122,7 +122,7 @@ export class FreestyleSandboxes {
122
122
  }
123
123
  throw {
124
124
  message: `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
125
- response
125
+ response,
126
126
  )}`,
127
127
  error: response.error,
128
128
  };
@@ -142,7 +142,7 @@ export class FreestyleSandboxes {
142
142
  | (Omit<BuildOptions, "command"> & {
143
143
  command: string | string[];
144
144
  });
145
- }
145
+ },
146
146
  ): Promise<FreestyleDeployWebSuccessResponseV2> {
147
147
  if (Array.isArray(config.build?.command)) {
148
148
  config.build.command = config.build.command.join(" && ") as string;
@@ -159,7 +159,7 @@ export class FreestyleSandboxes {
159
159
  return response.data;
160
160
  }
161
161
  throw new Error(
162
- `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`
162
+ `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`,
163
163
  );
164
164
  }
165
165
 
@@ -167,7 +167,7 @@ export class FreestyleSandboxes {
167
167
  * Deploy a Cloudstate project to a sandbox.
168
168
  */
169
169
  async deployCloudstate(
170
- body: FreestyleCloudstateDeployRequest
170
+ body: FreestyleCloudstateDeployRequest,
171
171
  ): Promise<FreestyleCloudstateDeploySuccessResponse> {
172
172
  const response = await sandbox_openapi.handleDeployCloudstate({
173
173
  client: this.client,
@@ -230,7 +230,7 @@ export class FreestyleSandboxes {
230
230
  * @returns The domain verification token.
231
231
  */
232
232
  async createDomainVerificationRequest(
233
- domain: string
233
+ domain: string,
234
234
  ): Promise<HandleCreateDomainVerificationResponse> {
235
235
  const response = await sandbox_openapi.handleCreateDomainVerification({
236
236
  client: this.client,
@@ -251,7 +251,7 @@ export class FreestyleSandboxes {
251
251
  * @returns The domain verification request.
252
252
  */
253
253
  async verifyDomain(
254
- domain: string
254
+ domain: string,
255
255
  ): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
256
256
  const response = await sandbox_openapi.handleVerifyDomain({
257
257
  client: this.client,
@@ -263,7 +263,7 @@ export class FreestyleSandboxes {
263
263
  return response.data;
264
264
  }
265
265
  throw new Error(
266
- `Failed to verify domain ${domain}: ${response.error.message}`
266
+ `Failed to verify domain ${domain}: ${response.error.message}`,
267
267
  );
268
268
  }
269
269
 
@@ -282,20 +282,20 @@ export class FreestyleSandboxes {
282
282
  const response = await sandbox_openapi.handleListDomainVerificationRequests(
283
283
  {
284
284
  client: this.client,
285
- }
285
+ },
286
286
  );
287
287
  if (response.data) {
288
288
  return response.data;
289
289
  }
290
290
 
291
291
  throw new Error(
292
- `Failed to list domain verification requests\n${response.error.message}`
292
+ `Failed to list domain verification requests\n${response.error.message}`,
293
293
  );
294
294
  }
295
295
 
296
296
  async deleteDomainVerificationRequest(
297
297
  domain: string,
298
- verificationCode: string
298
+ verificationCode: string,
299
299
  ): Promise<HandleDeleteDomainVerificationResponse> {
300
300
  const response = await sandbox_openapi.handleDeleteDomainVerification({
301
301
  client: this.client,
@@ -309,13 +309,13 @@ export class FreestyleSandboxes {
309
309
  }
310
310
 
311
311
  throw new Error(
312
- `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
312
+ `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
313
313
  );
314
314
  }
315
315
 
316
316
  async listWebDeployments(
317
317
  limit?: number,
318
- offset?: number
318
+ offset?: number,
319
319
  ): Promise<HandleListWebDeploysResponse> {
320
320
  const response = await sandbox_openapi.handleListWebDeploys({
321
321
  client: this.client,
@@ -330,13 +330,13 @@ export class FreestyleSandboxes {
330
330
  }
331
331
 
332
332
  throw new Error(
333
- `Failed to list web deployments\n${response.error.message}`
333
+ `Failed to list web deployments\n${response.error.message}`,
334
334
  );
335
335
  }
336
336
 
337
337
  async listExecuteRuns(
338
338
  limit?: number,
339
- offset?: number
339
+ offset?: number,
340
340
  ): Promise<HandleListExecuteRunsResponse> {
341
341
  const response = await sandbox_openapi.handleListExecuteRuns({
342
342
  client: this.client,
@@ -364,7 +364,7 @@ export class FreestyleSandboxes {
364
364
  }
365
365
 
366
366
  throw new Error(
367
- `Failed to get execute run with ID ${id}: ${response.error.message}`
367
+ `Failed to get execute run with ID ${id}: ${response.error.message}`,
368
368
  );
369
369
  }
370
370
 
@@ -382,22 +382,33 @@ export class FreestyleSandboxes {
382
382
  }
383
383
 
384
384
  throw new Error(
385
- `Failed to provision wildcard for domain ${domain}: ${response.error.message}`
385
+ `Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
386
386
  );
387
387
  }
388
388
 
389
389
  /**
390
390
  * Create a new git repository.
391
- *
392
- * @param name The name of the repository.
393
391
  */
394
- async createGitRepository(
395
- name: string
396
- ): Promise<CreateRepositoryResponseSuccess> {
392
+ async createGitRepository({
393
+ name,
394
+ public: pub = false,
395
+ source,
396
+ }: {
397
+ name: string;
398
+ public?: boolean;
399
+ source?: {
400
+ type: "git";
401
+ url: string;
402
+ branch?: string;
403
+ depth?: number;
404
+ };
405
+ }): Promise<CreateRepositoryResponseSuccess> {
397
406
  const response = await sandbox_openapi.handleCreateRepo({
398
407
  client: this.client,
399
408
  body: {
400
409
  name,
410
+ public: pub,
411
+ source,
401
412
  },
402
413
  });
403
414
 
@@ -406,25 +417,25 @@ export class FreestyleSandboxes {
406
417
  }
407
418
 
408
419
  throw new Error(
409
- `Failed to create git repository ${name}: ${response.error}`
420
+ `Failed to create git repository ${name}: ${response.error}`,
410
421
  );
411
422
  }
412
423
 
413
424
  /**
414
425
  * List git repositories.
415
- *
416
- * @param limit The maximum number of repositories to return. Defaults to 10.
417
- * @param offset The offset to start at. Defaults to 0.
418
426
  */
419
- async listGitRepositories(
420
- limit?: number,
421
- offset?: number
422
- ): Promise<HandleListRepositoriesResponse> {
427
+ async listGitRepositories({
428
+ limit = 10,
429
+ offset = 0,
430
+ }: {
431
+ limit?: number;
432
+ offset?: number;
433
+ } = {}): Promise<HandleListRepositoriesResponse> {
423
434
  const response = await sandbox_openapi.handleListRepositories({
424
435
  client: this.client,
425
436
  query: {
426
- limit: limit ?? 10,
427
- offset: offset ?? 0,
437
+ limit,
438
+ offset,
428
439
  },
429
440
  });
430
441
 
@@ -437,16 +448,16 @@ export class FreestyleSandboxes {
437
448
 
438
449
  /**
439
450
  * Delete a git repository.
440
- *
441
- * @param repositoryId The ID of the repository to delete.
442
451
  */
443
- async deleteGitRepository(
444
- repositoryId: string
445
- ): Promise<HandleDeleteRepoResponse> {
452
+ async deleteGitRepository({
453
+ repoId,
454
+ }: {
455
+ repoId: string;
456
+ }): Promise<HandleDeleteRepoResponse> {
446
457
  const response = await sandbox_openapi.handleDeleteRepo({
447
458
  client: this.client,
448
459
  path: {
449
- repo: repositoryId,
460
+ repo: repoId,
450
461
  },
451
462
  });
452
463
 
@@ -455,7 +466,7 @@ export class FreestyleSandboxes {
455
466
  }
456
467
 
457
468
  throw new Error(
458
- `Failed to delete git repository ${repositoryId}: ${response.error}`
469
+ `Failed to delete git repository ${repoId}: ${response.error}`,
459
470
  );
460
471
  }
461
472
 
@@ -476,12 +487,12 @@ export class FreestyleSandboxes {
476
487
 
477
488
  /**
478
489
  * Delete a git identity.
479
- *
480
- * @param identityId The ID of the identity to delete.
481
490
  */
482
- async deleteGitIdentity(
483
- identityId: string
484
- ): Promise<HandleDeleteIdentityResponse> {
491
+ async deleteGitIdentity({
492
+ identityId,
493
+ }: {
494
+ identityId: string;
495
+ }): Promise<HandleDeleteIdentityResponse> {
485
496
  const response = await sandbox_openapi.handleDeleteIdentity({
486
497
  client: this.client,
487
498
  path: {
@@ -498,16 +509,16 @@ export class FreestyleSandboxes {
498
509
 
499
510
  /**
500
511
  * Grant a git identity access to a repository.
501
- *
502
- * @param repoId The ID of the repository to grant access to.
503
- * @param identityId The ID of the identity grant access to `repoId`.
504
- * @param permission The permission to grant.
505
512
  */
506
- async grantGitPermission(
507
- repoId: string,
508
- identityId: string,
509
- permission: AccessLevel
510
- ) {
513
+ async grantGitPermission({
514
+ repoId,
515
+ identityId,
516
+ permission,
517
+ }: {
518
+ repoId: string;
519
+ identityId: string;
520
+ permission: AccessLevel;
521
+ }) {
511
522
  const response = await sandbox_openapi.handleGrantPermission({
512
523
  client: this.client,
513
524
  path: {
@@ -524,22 +535,22 @@ export class FreestyleSandboxes {
524
535
  }
525
536
 
526
537
  throw new Error(
527
- `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`
538
+ `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
528
539
  );
529
540
  }
530
541
 
531
542
  /**
532
543
  * Update a git identity's permissions on a repository.
533
- *
534
- * @param repoId The ID of the repository to update permissions for.
535
- * @param identityId The ID of the identity to whose access to update.
536
- * @param permission The permission to grant.
537
544
  */
538
- async updateGitPermission(
539
- repoId: string,
540
- identityId: string,
541
- permission: AccessLevel
542
- ): Promise<void> {
545
+ async updateGitPermission({
546
+ repoId,
547
+ identityId,
548
+ permission,
549
+ }: {
550
+ repoId: string;
551
+ identityId: string;
552
+ permission: AccessLevel;
553
+ }): Promise<void> {
543
554
  const response = await sandbox_openapi.handleUpdatePermission({
544
555
  client: this.client,
545
556
  path: {
@@ -556,17 +567,20 @@ export class FreestyleSandboxes {
556
567
  }
557
568
 
558
569
  throw new Error(
559
- `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`
570
+ `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
560
571
  );
561
572
  }
562
573
 
563
574
  /**
564
575
  * Revoke a git identity's access to a repository.
565
- *
566
- * @param repoId The ID of the repository revoke access to.
567
- * @param identityId The ID of the identity to revoke access from.
568
576
  */
569
- async revokeGitPermission(repoId: string, identityId: string): Promise<void> {
577
+ async revokeGitPermission({
578
+ repoId,
579
+ identityId,
580
+ }: {
581
+ repoId: string;
582
+ identityId: string;
583
+ }): Promise<void> {
570
584
  const response = await sandbox_openapi.handleRevokePermission({
571
585
  client: this.client,
572
586
  path: {
@@ -580,18 +594,18 @@ export class FreestyleSandboxes {
580
594
  }
581
595
 
582
596
  throw new Error(
583
- `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`
597
+ `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
584
598
  );
585
599
  }
586
600
 
587
601
  /**
588
602
  * List access permissions for a git identity.
589
- *
590
- * @param identityId The ID of the identity to list permissions for.
591
603
  */
592
- async listGitPermissions(
593
- identityId: string
594
- ): Promise<ListPermissionResponseSuccess> {
604
+ async listGitPermissions({
605
+ identityId,
606
+ }: {
607
+ identityId: string;
608
+ }): Promise<ListPermissionResponseSuccess> {
595
609
  const response = await sandbox_openapi.handleListPermissions({
596
610
  client: this.client,
597
611
  path: {
@@ -604,20 +618,20 @@ export class FreestyleSandboxes {
604
618
  }
605
619
 
606
620
  throw new Error(
607
- `Failed to list permissions for git identity ${identityId}: ${response.error}`
621
+ `Failed to list permissions for git identity ${identityId}: ${response.error}`,
608
622
  );
609
623
  }
610
624
 
611
625
  /**
612
626
  * Get the permission of a git identity on a repository.
613
- *
614
- * @param repoId The ID of the repository to check permissions for.
615
- * @param identityId The ID of the identity to check permissions for.
616
627
  */
617
- async getGitPermission(
618
- repoId: string,
619
- identityId: string
620
- ): Promise<DescribePermissionResponseSuccess> {
628
+ async getGitPermission({
629
+ repoId,
630
+ identityId,
631
+ }: {
632
+ repoId: string;
633
+ identityId: string;
634
+ }): Promise<DescribePermissionResponseSuccess> {
621
635
  const response = await sandbox_openapi.handleDescribePermission({
622
636
  client: this.client,
623
637
  path: {
@@ -631,16 +645,18 @@ export class FreestyleSandboxes {
631
645
  }
632
646
 
633
647
  throw new Error(
634
- `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`
648
+ `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
635
649
  );
636
650
  }
637
651
 
638
652
  /**
639
653
  * Create a new git access token for an identity.
640
- *
641
- * @param identityId The ID of the identity to create the token for.
642
654
  */
643
- async createGitAccessToken(identityId: string): Promise<CreatedToken> {
655
+ async createGitAccessToken({
656
+ identityId,
657
+ }: {
658
+ identityId: string;
659
+ }): Promise<CreatedToken> {
644
660
  const response = await sandbox_openapi.handleCreateGitToken({
645
661
  client: this.client,
646
662
  path: {
@@ -653,20 +669,20 @@ export class FreestyleSandboxes {
653
669
  }
654
670
 
655
671
  throw new Error(
656
- `Failed to create git access token: ${response.error.message}`
672
+ `Failed to create git access token: ${response.error.message}`,
657
673
  );
658
674
  }
659
675
 
660
676
  /**
661
677
  * Revoke a git access token.
662
- *
663
- * @param identityId The ID of the identity the token belongs to.
664
- * @param tokenId The ID of the token to revoke.
665
678
  */
666
- async revokeGitAccessToken(
667
- identityId: string,
668
- tokenId: string
669
- ): Promise<void> {
679
+ async revokeGitAccessToken({
680
+ identityId,
681
+ tokenId,
682
+ }: {
683
+ identityId: string;
684
+ tokenId: string;
685
+ }): Promise<void> {
670
686
  const response = await sandbox_openapi.handleRevokeGitToken({
671
687
  client: this.client,
672
688
  body: {
@@ -682,18 +698,18 @@ export class FreestyleSandboxes {
682
698
  }
683
699
 
684
700
  throw new Error(
685
- `Failed to revoke git access token ${tokenId}: ${response.error.message}`
701
+ `Failed to revoke git access token ${tokenId}: ${response.error.message}`,
686
702
  );
687
703
  }
688
704
 
689
705
  /**
690
706
  * List git access tokens for an identity.
691
- *
692
- * @param identityId The ID of the identity to list tokens for.
693
707
  */
694
- async listGitAccessTokens(
695
- identityId: string
696
- ): Promise<ListGitTokensResponseSuccess> {
708
+ async listGitAccessTokens({
709
+ identityId,
710
+ }: {
711
+ identityId: string;
712
+ }): Promise<ListGitTokensResponseSuccess> {
697
713
  const response = await sandbox_openapi.handleListGitTokens({
698
714
  client: this.client,
699
715
  path: {
@@ -706,7 +722,83 @@ export class FreestyleSandboxes {
706
722
  }
707
723
 
708
724
  throw new Error(
709
- `Failed to list git access tokens: ${response.error.message}`
725
+ `Failed to list git access tokens: ${response.error.message}`,
726
+ );
727
+ }
728
+
729
+ /**
730
+ * List git triggers for a repository.
731
+ */
732
+ async listGitTriggers({
733
+ repoId,
734
+ }: {
735
+ repoId: string;
736
+ }): Promise<sandbox_openapi.HandleListGitTriggersResponse> {
737
+ const response = await sandbox_openapi.handleListGitTriggers({
738
+ client: this.client,
739
+ path: {
740
+ repo: repoId,
741
+ },
742
+ });
743
+
744
+ if (response.data) {
745
+ return response.data;
746
+ }
747
+
748
+ throw new Error(
749
+ `Failed to list git triggers for repository ${repoId}: ${response.error.message}`,
750
+ );
751
+ }
752
+
753
+ /**
754
+ * Create a git trigger for a repository.
755
+ */
756
+ async createGitTrigger({
757
+ repoId,
758
+ trigger,
759
+ action,
760
+ }: {
761
+ repoId: string;
762
+ trigger: sandbox_openapi.GitTrigger;
763
+ action: sandbox_openapi.GitTriggerAction;
764
+ }): Promise<sandbox_openapi.HandleCreateGitTriggerResponse> {
765
+ const response = await sandbox_openapi.handleCreateGitTrigger({
766
+ client: this.client,
767
+ path: {
768
+ repo: repoId,
769
+ },
770
+ body: {
771
+ trigger,
772
+ action,
773
+ },
774
+ });
775
+
776
+ if (response.data) {
777
+ return response.data;
778
+ }
779
+
780
+ throw new Error(
781
+ `Failed to create git trigger for repository ${repoId}: ${response.error.message}`,
782
+ );
783
+ }
784
+
785
+ /**
786
+ * Delete a git trigger.
787
+ */
788
+ async deleteGitTrigger({ triggerId }: { triggerId: string }): Promise<void> {
789
+ const response = await sandbox_openapi.handleDeleteGitTrigger({
790
+ client: this.client,
791
+ path: {
792
+ trigger: triggerId,
793
+ },
794
+ });
795
+
796
+ if (response.data) {
797
+ return;
798
+ }
799
+
800
+ throw new Error(
801
+ `Failed to delete git trigger ${triggerId}: ${response.error.message}`,
710
802
  );
711
803
  }
712
804
  }