freestyle-sandboxes 0.0.64 → 0.0.66

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