freestyle-sandboxes 0.0.51 → 0.0.53
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/inde.d.cts +5 -5
- package/dist/inde.d.mts +5 -5
- package/dist/index.cjs +14 -13
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +14 -13
- package/package.json +1 -1
- package/src/index.ts +20 -19
package/dist/inde.d.cts
CHANGED
|
@@ -180,12 +180,12 @@ declare class FreestyleSandboxes {
|
|
|
180
180
|
* ephemeral so you should call this function every time you need a url. Do
|
|
181
181
|
* not store the url in your database!
|
|
182
182
|
*/
|
|
183
|
-
requestDevServer(repo: {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
requestDevServer({ repo, repoUrl, repoId, }: {
|
|
184
|
+
repoUrl?: string;
|
|
185
|
+
repoId?: string;
|
|
186
|
+
repo?: string;
|
|
187
187
|
}): Promise<{
|
|
188
|
-
mcpEphemeralUrl:
|
|
188
|
+
mcpEphemeralUrl: any;
|
|
189
189
|
ephemeralUrl: any;
|
|
190
190
|
url: string;
|
|
191
191
|
isNew: boolean;
|
package/dist/inde.d.mts
CHANGED
|
@@ -180,12 +180,12 @@ declare class FreestyleSandboxes {
|
|
|
180
180
|
* ephemeral so you should call this function every time you need a url. Do
|
|
181
181
|
* not store the url in your database!
|
|
182
182
|
*/
|
|
183
|
-
requestDevServer(repo: {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
requestDevServer({ repo, repoUrl, repoId, }: {
|
|
184
|
+
repoUrl?: string;
|
|
185
|
+
repoId?: string;
|
|
186
|
+
repo?: string;
|
|
187
187
|
}): Promise<{
|
|
188
|
-
mcpEphemeralUrl:
|
|
188
|
+
mcpEphemeralUrl: any;
|
|
189
189
|
ephemeralUrl: any;
|
|
190
190
|
url: string;
|
|
191
191
|
isNew: boolean;
|
package/dist/index.cjs
CHANGED
|
@@ -777,37 +777,38 @@ ${response.error.message}`);
|
|
|
777
777
|
* ephemeral so you should call this function every time you need a url. Do
|
|
778
778
|
* not store the url in your database!
|
|
779
779
|
*/
|
|
780
|
-
async requestDevServer(
|
|
780
|
+
async requestDevServer({
|
|
781
|
+
repo,
|
|
782
|
+
repoUrl,
|
|
783
|
+
repoId
|
|
784
|
+
}) {
|
|
781
785
|
function formatHook(serverUrl, repoUrl2) {
|
|
782
786
|
const hook = serverUrl + "/__freestyle_dev_server/update/git?repo=" + encodeURIComponent(repoUrl2);
|
|
783
|
-
console.log(hook);
|
|
784
787
|
return hook;
|
|
785
788
|
}
|
|
786
|
-
let repoId;
|
|
787
|
-
if ("repoId" in repo) {
|
|
788
|
-
repoId = repo.repoId;
|
|
789
|
-
} else if ("repoUrl" in repo) {
|
|
790
|
-
const parts = repo.repoUrl.split("/");
|
|
791
|
-
repoId = parts[parts.length - 1];
|
|
792
|
-
}
|
|
793
|
-
const repoUrl = process.env.GIT_URL ?? "https://git.freestyle.sh/" + repoId;
|
|
794
789
|
const response = await handleEphemeralDevServer({
|
|
795
790
|
client: this.client,
|
|
796
791
|
body: {
|
|
792
|
+
// @ts-ignore
|
|
793
|
+
repo: repo || repoUrl,
|
|
797
794
|
repoId
|
|
798
795
|
}
|
|
799
796
|
});
|
|
800
797
|
if (response.data.isNew) {
|
|
798
|
+
const rId = repoId || repoUrl.split("/").at(-1);
|
|
801
799
|
await this.createGitTrigger({
|
|
802
|
-
repoId,
|
|
800
|
+
repoId: rId,
|
|
803
801
|
action: {
|
|
804
|
-
endpoint: formatHook(
|
|
802
|
+
endpoint: formatHook(
|
|
803
|
+
response.data?.url,
|
|
804
|
+
repoUrl || repo || `https://git.freestyle.sh/${rId}`
|
|
805
|
+
),
|
|
805
806
|
action: "webhook"
|
|
806
807
|
},
|
|
807
808
|
trigger: {
|
|
808
809
|
event: "push"
|
|
809
810
|
}
|
|
810
|
-
})
|
|
811
|
+
});
|
|
811
812
|
}
|
|
812
813
|
if (!response.data) {
|
|
813
814
|
throw new Error(`Failed to request dev server: ${response.error}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -180,12 +180,12 @@ declare class FreestyleSandboxes {
|
|
|
180
180
|
* ephemeral so you should call this function every time you need a url. Do
|
|
181
181
|
* not store the url in your database!
|
|
182
182
|
*/
|
|
183
|
-
requestDevServer(repo: {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
requestDevServer({ repo, repoUrl, repoId, }: {
|
|
184
|
+
repoUrl?: string;
|
|
185
|
+
repoId?: string;
|
|
186
|
+
repo?: string;
|
|
187
187
|
}): Promise<{
|
|
188
|
-
mcpEphemeralUrl:
|
|
188
|
+
mcpEphemeralUrl: any;
|
|
189
189
|
ephemeralUrl: any;
|
|
190
190
|
url: string;
|
|
191
191
|
isNew: boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -180,12 +180,12 @@ declare class FreestyleSandboxes {
|
|
|
180
180
|
* ephemeral so you should call this function every time you need a url. Do
|
|
181
181
|
* not store the url in your database!
|
|
182
182
|
*/
|
|
183
|
-
requestDevServer(repo: {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
requestDevServer({ repo, repoUrl, repoId, }: {
|
|
184
|
+
repoUrl?: string;
|
|
185
|
+
repoId?: string;
|
|
186
|
+
repo?: string;
|
|
187
187
|
}): Promise<{
|
|
188
|
-
mcpEphemeralUrl:
|
|
188
|
+
mcpEphemeralUrl: any;
|
|
189
189
|
ephemeralUrl: any;
|
|
190
190
|
url: string;
|
|
191
191
|
isNew: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -775,37 +775,38 @@ ${response.error.message}`);
|
|
|
775
775
|
* ephemeral so you should call this function every time you need a url. Do
|
|
776
776
|
* not store the url in your database!
|
|
777
777
|
*/
|
|
778
|
-
async requestDevServer(
|
|
778
|
+
async requestDevServer({
|
|
779
|
+
repo,
|
|
780
|
+
repoUrl,
|
|
781
|
+
repoId
|
|
782
|
+
}) {
|
|
779
783
|
function formatHook(serverUrl, repoUrl2) {
|
|
780
784
|
const hook = serverUrl + "/__freestyle_dev_server/update/git?repo=" + encodeURIComponent(repoUrl2);
|
|
781
|
-
console.log(hook);
|
|
782
785
|
return hook;
|
|
783
786
|
}
|
|
784
|
-
let repoId;
|
|
785
|
-
if ("repoId" in repo) {
|
|
786
|
-
repoId = repo.repoId;
|
|
787
|
-
} else if ("repoUrl" in repo) {
|
|
788
|
-
const parts = repo.repoUrl.split("/");
|
|
789
|
-
repoId = parts[parts.length - 1];
|
|
790
|
-
}
|
|
791
|
-
const repoUrl = process.env.GIT_URL ?? "https://git.freestyle.sh/" + repoId;
|
|
792
787
|
const response = await handleEphemeralDevServer({
|
|
793
788
|
client: this.client,
|
|
794
789
|
body: {
|
|
790
|
+
// @ts-ignore
|
|
791
|
+
repo: repo || repoUrl,
|
|
795
792
|
repoId
|
|
796
793
|
}
|
|
797
794
|
});
|
|
798
795
|
if (response.data.isNew) {
|
|
796
|
+
const rId = repoId || repoUrl.split("/").at(-1);
|
|
799
797
|
await this.createGitTrigger({
|
|
800
|
-
repoId,
|
|
798
|
+
repoId: rId,
|
|
801
799
|
action: {
|
|
802
|
-
endpoint: formatHook(
|
|
800
|
+
endpoint: formatHook(
|
|
801
|
+
response.data?.url,
|
|
802
|
+
repoUrl || repo || `https://git.freestyle.sh/${rId}`
|
|
803
|
+
),
|
|
803
804
|
action: "webhook"
|
|
804
805
|
},
|
|
805
806
|
trigger: {
|
|
806
807
|
event: "push"
|
|
807
808
|
}
|
|
808
|
-
})
|
|
809
|
+
});
|
|
809
810
|
}
|
|
810
811
|
if (!response.data) {
|
|
811
812
|
throw new Error(`Failed to request dev server: ${response.error}`);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -797,57 +797,58 @@ export class FreestyleSandboxes {
|
|
|
797
797
|
* ephemeral so you should call this function every time you need a url. Do
|
|
798
798
|
* not store the url in your database!
|
|
799
799
|
*/
|
|
800
|
-
async requestDevServer(
|
|
800
|
+
async requestDevServer({
|
|
801
|
+
repo,
|
|
802
|
+
repoUrl,
|
|
803
|
+
repoId,
|
|
804
|
+
}: {
|
|
805
|
+
repoUrl?: string;
|
|
806
|
+
repoId?: string;
|
|
807
|
+
repo?: string;
|
|
808
|
+
}) {
|
|
801
809
|
function formatHook(serverUrl: string, repoUrl: string) {
|
|
802
810
|
const hook =
|
|
803
811
|
serverUrl +
|
|
804
812
|
"/__freestyle_dev_server/update/git?repo=" +
|
|
805
813
|
encodeURIComponent(repoUrl);
|
|
806
|
-
|
|
807
|
-
console.log(hook);
|
|
808
814
|
return hook;
|
|
809
815
|
}
|
|
810
816
|
|
|
811
|
-
let repoId: string;
|
|
812
|
-
if ("repoId" in repo) {
|
|
813
|
-
repoId = repo.repoId;
|
|
814
|
-
} else if ("repoUrl" in repo) {
|
|
815
|
-
const parts = repo.repoUrl.split("/");
|
|
816
|
-
repoId = parts[parts.length - 1]; // Get the last part of the URL path
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
const repoUrl = process.env.GIT_URL ?? "https://git.freestyle.sh/" + repoId;
|
|
820
|
-
|
|
821
817
|
const response = await sandbox_openapi.handleEphemeralDevServer({
|
|
822
818
|
client: this.client,
|
|
823
819
|
body: {
|
|
820
|
+
// @ts-ignore
|
|
821
|
+
repo: repo || repoUrl,
|
|
824
822
|
repoId: repoId,
|
|
825
823
|
},
|
|
826
824
|
});
|
|
827
825
|
|
|
828
826
|
if (response.data.isNew) {
|
|
827
|
+
const rId = repoId || repoUrl.split("/").at(-1)!;
|
|
828
|
+
|
|
829
829
|
await this.createGitTrigger({
|
|
830
|
-
repoId:
|
|
830
|
+
repoId: rId,
|
|
831
831
|
action: {
|
|
832
|
-
endpoint: formatHook(
|
|
832
|
+
endpoint: formatHook(
|
|
833
|
+
response.data?.url!,
|
|
834
|
+
repoUrl || repo || `https://git.freestyle.sh/${rId}`
|
|
835
|
+
),
|
|
833
836
|
action: "webhook",
|
|
834
837
|
},
|
|
835
838
|
trigger: {
|
|
836
839
|
event: "push",
|
|
837
840
|
},
|
|
838
|
-
})
|
|
841
|
+
});
|
|
839
842
|
}
|
|
840
843
|
|
|
841
844
|
if (!response.data) {
|
|
842
845
|
throw new Error(`Failed to request dev server: ${response.error}`);
|
|
843
846
|
}
|
|
844
|
-
|
|
845
847
|
return {
|
|
846
848
|
...response.data,
|
|
847
849
|
// @ts-ignore
|
|
848
850
|
mcpEphemeralUrl:
|
|
849
|
-
(response.data as
|
|
850
|
-
response.data.url + "/mcp",
|
|
851
|
+
(response.data as any).mcpEphemeralUrl || response.data.url + "/mcp",
|
|
851
852
|
// @ts-ignore
|
|
852
853
|
ephemeralUrl: response.data.ephemeralUrl ?? response.data.url,
|
|
853
854
|
};
|