freestyle-sandboxes 0.0.64 → 0.0.65

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.
package/dist/index.cjs CHANGED
@@ -790,12 +790,18 @@ ${response.error.message}`);
790
790
  repo: options.repoUrl
791
791
  }
792
792
  });
793
+ if (response.error) {
794
+ throw new Error(`Failed to request dev server: ${response.error}`);
795
+ }
793
796
  if (response.data.isNew) {
794
797
  const rId = options.repoId || options.repoUrl.split("/").at(-1);
795
798
  await this.createGitTrigger({
796
799
  repoId: rId,
797
800
  action: {
798
- endpoint: formatHook(response.data?.url, options.repoUrl || `https://git.freestyle.sh/${rId}`),
801
+ endpoint: formatHook(
802
+ response.data?.url,
803
+ options.repoUrl || `https://git.freestyle.sh/${rId}`
804
+ ),
799
805
  action: "webhook"
800
806
  },
801
807
  trigger: {
@@ -811,8 +817,10 @@ ${response.error.message}`);
811
817
  // @ts-ignore
812
818
  mcpEphemeralUrl: response.data.mcpEphemeralUrl || response.data.url + "/mcp",
813
819
  ephemeralUrl: response.data.ephemeralUrl ?? response.data.url,
814
- // @ts-ignore
815
- codeServerUrl: response.data.codeServerUrl ?? response.data.ephemeralUrl + "/__freestyle_code_server/?folder=/template"
820
+ codeServerUrl: (
821
+ // @ts-ignore
822
+ response.data.codeServerUrl ?? response.data.ephemeralUrl + "/__freestyle_code_server/?folder=/template"
823
+ )
816
824
  };
817
825
  }
818
826
  }
package/dist/index.mjs CHANGED
@@ -788,12 +788,18 @@ ${response.error.message}`);
788
788
  repo: options.repoUrl
789
789
  }
790
790
  });
791
+ if (response.error) {
792
+ throw new Error(`Failed to request dev server: ${response.error}`);
793
+ }
791
794
  if (response.data.isNew) {
792
795
  const rId = options.repoId || options.repoUrl.split("/").at(-1);
793
796
  await this.createGitTrigger({
794
797
  repoId: rId,
795
798
  action: {
796
- endpoint: formatHook(response.data?.url, options.repoUrl || `https://git.freestyle.sh/${rId}`),
799
+ endpoint: formatHook(
800
+ response.data?.url,
801
+ options.repoUrl || `https://git.freestyle.sh/${rId}`
802
+ ),
797
803
  action: "webhook"
798
804
  },
799
805
  trigger: {
@@ -809,8 +815,10 @@ ${response.error.message}`);
809
815
  // @ts-ignore
810
816
  mcpEphemeralUrl: response.data.mcpEphemeralUrl || response.data.url + "/mcp",
811
817
  ephemeralUrl: response.data.ephemeralUrl ?? response.data.url,
812
- // @ts-ignore
813
- codeServerUrl: response.data.codeServerUrl ?? response.data.ephemeralUrl + "/__freestyle_code_server/?folder=/template"
818
+ codeServerUrl: (
819
+ // @ts-ignore
820
+ response.data.codeServerUrl ?? response.data.ephemeralUrl + "/__freestyle_code_server/?folder=/template"
821
+ )
814
822
  };
815
823
  }
816
824
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -801,10 +801,11 @@ export class FreestyleSandboxes {
801
801
  /**
802
802
  * @deprecated
803
803
  */
804
- repoUrl?: string,
805
- repoId?: string, repo?: string,
806
- baseId?: string,
807
- devCommand?: string,
804
+ repoUrl?: string;
805
+ repoId?: string;
806
+ repo?: string;
807
+ baseId?: string;
808
+ devCommand?: string;
808
809
  }) {
809
810
  function formatHook(serverUrl: string, repoUrl: string) {
810
811
  const hook =
@@ -823,14 +824,21 @@ export class FreestyleSandboxes {
823
824
  },
824
825
  });
825
826
 
827
+ if (response.error) {
828
+ throw new Error(`Failed to request dev server: ${response.error}`);
829
+ }
830
+
826
831
  if (response.data.isNew) {
827
832
  const rId = options.repoId || options.repoUrl.split("/").at(-1)!;
828
833
 
829
834
  await this.createGitTrigger({
830
835
  repoId: rId,
831
836
  action: {
832
- endpoint: formatHook(response.data?.url!, options.repoUrl || `https://git.freestyle.sh/${rId}`),
833
- action: "webhook"
837
+ endpoint: formatHook(
838
+ response.data?.url!,
839
+ options.repoUrl || `https://git.freestyle.sh/${rId}`
840
+ ),
841
+ action: "webhook",
834
842
  },
835
843
  trigger: {
836
844
  event: "push",
@@ -847,8 +855,11 @@ export class FreestyleSandboxes {
847
855
  mcpEphemeralUrl:
848
856
  (response.data as any).mcpEphemeralUrl || response.data.url + "/mcp",
849
857
  ephemeralUrl: response.data.ephemeralUrl ?? response.data.url,
850
- // @ts-ignore
851
- codeServerUrl: response.data.codeServerUrl ?? response.data.ephemeralUrl + "/__freestyle_code_server/?folder=/template",
858
+ codeServerUrl:
859
+ // @ts-ignore
860
+ response.data.codeServerUrl ??
861
+ response.data.ephemeralUrl +
862
+ "/__freestyle_code_server/?folder=/template",
852
863
  };
853
864
  }
854
865
  }