freestyle-sandboxes 0.0.60 → 0.0.62
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/.env +1 -0
- package/dist/inde.d.cts +2 -1
- package/dist/inde.d.mts +2 -1
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +4 -2
- package/dist/react/dev-server/index..d.cts +2 -0
- package/dist/react/dev-server/index..d.mts +2 -0
- package/dist/react/dev-server/index.cjs +50 -9
- package/dist/react/dev-server/index.d.cts +2 -0
- package/dist/react/dev-server/index.d.mts +2 -0
- package/dist/react/dev-server/index.mjs +50 -9
- package/dist/{types.gen-DyY7Deri.d.ts → types.gen-BoJEFWW-.d.ts} +1 -55
- package/package.json +2 -2
- package/src/index.ts +4 -1
- package/src/react/dev-server/index.tsx +50 -7
- package/dist/index-BBXyg0JQ.cjs +0 -3253
- package/dist/index-BQHqnjZK.mjs +0 -3231
- package/dist/index-CEEa9WHp.cjs +0 -3238
- package/dist/index-D1ulQeJR.mjs +0 -3247
- package/dist/index-DCF70Xbq.mjs +0 -3246
- package/dist/index-H7UNEAjs.cjs +0 -3254
- package/dist/index.d-CXx1AdyW.d.ts +0 -4210
- package/dist/types.gen-1sd31qLV.d.ts +0 -172
- package/dist/types.gen-627pxroW.d.ts +0 -830
- package/dist/types.gen-BCdfx7yt.d.ts +0 -760
- package/dist/types.gen-BaMKzqxQ.d.ts +0 -233
- package/dist/types.gen-BtK6PMQy.d.ts +0 -195
- package/dist/types.gen-BuhQ5LpB.d.ts +0 -764
- package/dist/types.gen-BzRtj_TA.d.ts +0 -725
- package/dist/types.gen-C03gaIPq.d.ts +0 -297
- package/dist/types.gen-CMuCas4r.d.ts +0 -183
- package/dist/types.gen-CZUnqmzP.d.ts +0 -789
- package/dist/types.gen-CnEkmbco.d.ts +0 -314
- package/dist/types.gen-DDYpuDzZ.d.ts +0 -764
- package/dist/types.gen-DHmdEOOa.d.ts +0 -172
- package/dist/types.gen-DLYohMJT.d.ts +0 -382
- package/dist/types.gen-DbTb_SrD.d.ts +0 -156
- package/dist/types.gen-DkQ-Dbs1.d.ts +0 -764
- package/dist/types.gen-MBZCvIhE.d.ts +0 -311
- package/dist/types.gen-YhJAHBw8.d.ts +0 -233
- package/dist/types.gen-cCnnhnB6.d.ts +0 -182
- package/dist/types.gen-mg_JNXrq.d.ts +0 -830
- package/dist/types.gen-uDTr6v-7.d.ts +0 -731
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FREESTYLE_API_KEY=RoZ4n8eAY4ChcgdKV89LjY-Fhvp6Rzqx27bZ4BjHaVf7qpEw7vA7MekK84DdGgZYkR2
|
package/dist/inde.d.cts
CHANGED
|
@@ -180,13 +180,14 @@ 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({ repoUrl, repoId, }: {
|
|
183
|
+
requestDevServer({ repoUrl, repoId, baseId, }: {
|
|
184
184
|
/**
|
|
185
185
|
* @deprecated
|
|
186
186
|
*/
|
|
187
187
|
repoUrl?: string;
|
|
188
188
|
repoId?: string;
|
|
189
189
|
repo?: string;
|
|
190
|
+
baseId?: string;
|
|
190
191
|
}): Promise<{
|
|
191
192
|
mcpEphemeralUrl: any;
|
|
192
193
|
ephemeralUrl: string;
|
package/dist/inde.d.mts
CHANGED
|
@@ -180,13 +180,14 @@ 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({ repoUrl, repoId, }: {
|
|
183
|
+
requestDevServer({ repoUrl, repoId, baseId, }: {
|
|
184
184
|
/**
|
|
185
185
|
* @deprecated
|
|
186
186
|
*/
|
|
187
187
|
repoUrl?: string;
|
|
188
188
|
repoId?: string;
|
|
189
189
|
repo?: string;
|
|
190
|
+
baseId?: string;
|
|
190
191
|
}): Promise<{
|
|
191
192
|
mcpEphemeralUrl: any;
|
|
192
193
|
ephemeralUrl: string;
|
package/dist/index.cjs
CHANGED
|
@@ -779,7 +779,8 @@ ${response.error.message}`);
|
|
|
779
779
|
*/
|
|
780
780
|
async requestDevServer({
|
|
781
781
|
repoUrl,
|
|
782
|
-
repoId
|
|
782
|
+
repoId,
|
|
783
|
+
baseId
|
|
783
784
|
}) {
|
|
784
785
|
function formatHook(serverUrl, repoUrl2) {
|
|
785
786
|
const hook = serverUrl + "/__freestyle_dev_server/update/git?repo=" + encodeURIComponent(repoUrl2);
|
|
@@ -790,7 +791,8 @@ ${response.error.message}`);
|
|
|
790
791
|
body: {
|
|
791
792
|
// @ts-ignore
|
|
792
793
|
repo: repoUrl,
|
|
793
|
-
repoId
|
|
794
|
+
repoId,
|
|
795
|
+
baseId
|
|
794
796
|
}
|
|
795
797
|
});
|
|
796
798
|
if (response.data.isNew) {
|
package/dist/index.d.cts
CHANGED
|
@@ -180,13 +180,14 @@ 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({ repoUrl, repoId, }: {
|
|
183
|
+
requestDevServer({ repoUrl, repoId, baseId, }: {
|
|
184
184
|
/**
|
|
185
185
|
* @deprecated
|
|
186
186
|
*/
|
|
187
187
|
repoUrl?: string;
|
|
188
188
|
repoId?: string;
|
|
189
189
|
repo?: string;
|
|
190
|
+
baseId?: string;
|
|
190
191
|
}): Promise<{
|
|
191
192
|
mcpEphemeralUrl: any;
|
|
192
193
|
ephemeralUrl: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -180,13 +180,14 @@ 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({ repoUrl, repoId, }: {
|
|
183
|
+
requestDevServer({ repoUrl, repoId, baseId, }: {
|
|
184
184
|
/**
|
|
185
185
|
* @deprecated
|
|
186
186
|
*/
|
|
187
187
|
repoUrl?: string;
|
|
188
188
|
repoId?: string;
|
|
189
189
|
repo?: string;
|
|
190
|
+
baseId?: string;
|
|
190
191
|
}): Promise<{
|
|
191
192
|
mcpEphemeralUrl: any;
|
|
192
193
|
ephemeralUrl: string;
|
package/dist/index.mjs
CHANGED
|
@@ -777,7 +777,8 @@ ${response.error.message}`);
|
|
|
777
777
|
*/
|
|
778
778
|
async requestDevServer({
|
|
779
779
|
repoUrl,
|
|
780
|
-
repoId
|
|
780
|
+
repoId,
|
|
781
|
+
baseId
|
|
781
782
|
}) {
|
|
782
783
|
function formatHook(serverUrl, repoUrl2) {
|
|
783
784
|
const hook = serverUrl + "/__freestyle_dev_server/update/git?repo=" + encodeURIComponent(repoUrl2);
|
|
@@ -788,7 +789,8 @@ ${response.error.message}`);
|
|
|
788
789
|
body: {
|
|
789
790
|
// @ts-ignore
|
|
790
791
|
repo: repoUrl,
|
|
791
|
-
repoId
|
|
792
|
+
repoId,
|
|
793
|
+
baseId
|
|
792
794
|
}
|
|
793
795
|
});
|
|
794
796
|
if (response.data.isNew) {
|
|
@@ -14,6 +14,7 @@ declare function DefaultLoadingComponent({ installCommandRunning, }: {
|
|
|
14
14
|
devCommandRunning: boolean;
|
|
15
15
|
installCommandRunning: boolean;
|
|
16
16
|
serverStarting: boolean;
|
|
17
|
+
iframeLoading: boolean;
|
|
17
18
|
}): any;
|
|
18
19
|
declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
19
20
|
repoId: string;
|
|
@@ -21,6 +22,7 @@ declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
|
21
22
|
devCommandRunning: boolean;
|
|
22
23
|
installCommandRunning: boolean;
|
|
23
24
|
serverStarting: boolean;
|
|
25
|
+
iframeLoading: boolean;
|
|
24
26
|
}) => React.ReactNode;
|
|
25
27
|
actions: RequestDevServerActions;
|
|
26
28
|
}): any;
|
|
@@ -14,6 +14,7 @@ declare function DefaultLoadingComponent({ installCommandRunning, }: {
|
|
|
14
14
|
devCommandRunning: boolean;
|
|
15
15
|
installCommandRunning: boolean;
|
|
16
16
|
serverStarting: boolean;
|
|
17
|
+
iframeLoading: boolean;
|
|
17
18
|
}): any;
|
|
18
19
|
declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
19
20
|
repoId: string;
|
|
@@ -21,6 +22,7 @@ declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
|
21
22
|
devCommandRunning: boolean;
|
|
22
23
|
installCommandRunning: boolean;
|
|
23
24
|
serverStarting: boolean;
|
|
25
|
+
iframeLoading: boolean;
|
|
24
26
|
}) => React.ReactNode;
|
|
25
27
|
actions: RequestDevServerActions;
|
|
26
28
|
}): any;
|
|
@@ -62,37 +62,78 @@ function FreestyleDevServerInner({
|
|
|
62
62
|
return () => clearInterval(interval);
|
|
63
63
|
}, [data?.ephemeralUrl]);
|
|
64
64
|
const [wasLoaded, setWasLoaded] = React.useState(false);
|
|
65
|
+
const [iframeLoaded, setIframeLoaded] = React.useState(false);
|
|
65
66
|
React.useMemo(() => {
|
|
66
67
|
if (data?.devCommandRunning) {
|
|
67
68
|
setWasLoaded(true);
|
|
68
69
|
}
|
|
69
70
|
}, [isLoading, data?.devCommandRunning]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
ref.current?.addEventListener("load", () => {
|
|
73
|
+
setIframeLoaded(true);
|
|
74
|
+
});
|
|
75
|
+
}, [ref]);
|
|
70
76
|
if (isLoading) {
|
|
71
77
|
return loadingComponent({
|
|
72
78
|
devCommandRunning: false,
|
|
73
79
|
installCommandRunning: false,
|
|
74
|
-
serverStarting: true
|
|
80
|
+
serverStarting: true,
|
|
81
|
+
iframeLoading: false
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
if (!data?.devCommandRunning && !wasLoaded) {
|
|
78
85
|
return loadingComponent({
|
|
79
86
|
devCommandRunning: data?.devCommandRunning ?? false,
|
|
80
87
|
installCommandRunning: data?.installCommandRunning ?? false,
|
|
81
|
-
serverStarting: false
|
|
88
|
+
serverStarting: false,
|
|
89
|
+
iframeLoading: false
|
|
82
90
|
});
|
|
83
91
|
}
|
|
84
92
|
return /* @__PURE__ */ React.createElement(
|
|
85
|
-
"
|
|
93
|
+
"div",
|
|
86
94
|
{
|
|
87
|
-
ref,
|
|
88
|
-
sandbox: "allow-scripts allow-same-origin allow-forms",
|
|
89
|
-
src: data.ephemeralUrl,
|
|
90
95
|
style: {
|
|
96
|
+
display: "grid",
|
|
97
|
+
gridTemplateRows: "1fr",
|
|
98
|
+
gridTemplateColumns: "1fr",
|
|
91
99
|
width: "100%",
|
|
92
|
-
height: "100%"
|
|
93
|
-
border: "none"
|
|
100
|
+
height: "100%"
|
|
94
101
|
}
|
|
95
|
-
}
|
|
102
|
+
},
|
|
103
|
+
/* @__PURE__ */ React.createElement(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
style: {
|
|
107
|
+
width: "100%",
|
|
108
|
+
height: "100%",
|
|
109
|
+
border: "none",
|
|
110
|
+
gridColumn: "1 / -1",
|
|
111
|
+
gridRow: "1 / -1",
|
|
112
|
+
visibility: iframeLoaded ? "hidden" : "visible"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
loadingComponent({
|
|
116
|
+
devCommandRunning: data?.devCommandRunning ?? false,
|
|
117
|
+
installCommandRunning: data?.installCommandRunning ?? false,
|
|
118
|
+
serverStarting: false,
|
|
119
|
+
iframeLoading: true
|
|
120
|
+
})
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ React.createElement(
|
|
123
|
+
"iframe",
|
|
124
|
+
{
|
|
125
|
+
ref,
|
|
126
|
+
sandbox: "allow-scripts allow-same-origin allow-forms",
|
|
127
|
+
src: data.ephemeralUrl,
|
|
128
|
+
style: {
|
|
129
|
+
width: "100%",
|
|
130
|
+
height: "100%",
|
|
131
|
+
border: "none",
|
|
132
|
+
gridColumn: "1 / -1",
|
|
133
|
+
gridRow: "1 / -1"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
)
|
|
96
137
|
);
|
|
97
138
|
}
|
|
98
139
|
|
|
@@ -14,6 +14,7 @@ declare function DefaultLoadingComponent({ installCommandRunning, }: {
|
|
|
14
14
|
devCommandRunning: boolean;
|
|
15
15
|
installCommandRunning: boolean;
|
|
16
16
|
serverStarting: boolean;
|
|
17
|
+
iframeLoading: boolean;
|
|
17
18
|
}): any;
|
|
18
19
|
declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
19
20
|
repoId: string;
|
|
@@ -21,6 +22,7 @@ declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
|
21
22
|
devCommandRunning: boolean;
|
|
22
23
|
installCommandRunning: boolean;
|
|
23
24
|
serverStarting: boolean;
|
|
25
|
+
iframeLoading: boolean;
|
|
24
26
|
}) => React.ReactNode;
|
|
25
27
|
actions: RequestDevServerActions;
|
|
26
28
|
}): any;
|
|
@@ -14,6 +14,7 @@ declare function DefaultLoadingComponent({ installCommandRunning, }: {
|
|
|
14
14
|
devCommandRunning: boolean;
|
|
15
15
|
installCommandRunning: boolean;
|
|
16
16
|
serverStarting: boolean;
|
|
17
|
+
iframeLoading: boolean;
|
|
17
18
|
}): any;
|
|
18
19
|
declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
19
20
|
repoId: string;
|
|
@@ -21,6 +22,7 @@ declare function FreestyleDevServer({ loadingComponent, actions, repoId, }: {
|
|
|
21
22
|
devCommandRunning: boolean;
|
|
22
23
|
installCommandRunning: boolean;
|
|
23
24
|
serverStarting: boolean;
|
|
25
|
+
iframeLoading: boolean;
|
|
24
26
|
}) => React.ReactNode;
|
|
25
27
|
actions: RequestDevServerActions;
|
|
26
28
|
}): any;
|
|
@@ -60,37 +60,78 @@ function FreestyleDevServerInner({
|
|
|
60
60
|
return () => clearInterval(interval);
|
|
61
61
|
}, [data?.ephemeralUrl]);
|
|
62
62
|
const [wasLoaded, setWasLoaded] = React.useState(false);
|
|
63
|
+
const [iframeLoaded, setIframeLoaded] = React.useState(false);
|
|
63
64
|
React.useMemo(() => {
|
|
64
65
|
if (data?.devCommandRunning) {
|
|
65
66
|
setWasLoaded(true);
|
|
66
67
|
}
|
|
67
68
|
}, [isLoading, data?.devCommandRunning]);
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
ref.current?.addEventListener("load", () => {
|
|
71
|
+
setIframeLoaded(true);
|
|
72
|
+
});
|
|
73
|
+
}, [ref]);
|
|
68
74
|
if (isLoading) {
|
|
69
75
|
return loadingComponent({
|
|
70
76
|
devCommandRunning: false,
|
|
71
77
|
installCommandRunning: false,
|
|
72
|
-
serverStarting: true
|
|
78
|
+
serverStarting: true,
|
|
79
|
+
iframeLoading: false
|
|
73
80
|
});
|
|
74
81
|
}
|
|
75
82
|
if (!data?.devCommandRunning && !wasLoaded) {
|
|
76
83
|
return loadingComponent({
|
|
77
84
|
devCommandRunning: data?.devCommandRunning ?? false,
|
|
78
85
|
installCommandRunning: data?.installCommandRunning ?? false,
|
|
79
|
-
serverStarting: false
|
|
86
|
+
serverStarting: false,
|
|
87
|
+
iframeLoading: false
|
|
80
88
|
});
|
|
81
89
|
}
|
|
82
90
|
return /* @__PURE__ */ React.createElement(
|
|
83
|
-
"
|
|
91
|
+
"div",
|
|
84
92
|
{
|
|
85
|
-
ref,
|
|
86
|
-
sandbox: "allow-scripts allow-same-origin allow-forms",
|
|
87
|
-
src: data.ephemeralUrl,
|
|
88
93
|
style: {
|
|
94
|
+
display: "grid",
|
|
95
|
+
gridTemplateRows: "1fr",
|
|
96
|
+
gridTemplateColumns: "1fr",
|
|
89
97
|
width: "100%",
|
|
90
|
-
height: "100%"
|
|
91
|
-
border: "none"
|
|
98
|
+
height: "100%"
|
|
92
99
|
}
|
|
93
|
-
}
|
|
100
|
+
},
|
|
101
|
+
/* @__PURE__ */ React.createElement(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
style: {
|
|
105
|
+
width: "100%",
|
|
106
|
+
height: "100%",
|
|
107
|
+
border: "none",
|
|
108
|
+
gridColumn: "1 / -1",
|
|
109
|
+
gridRow: "1 / -1",
|
|
110
|
+
visibility: iframeLoaded ? "hidden" : "visible"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
loadingComponent({
|
|
114
|
+
devCommandRunning: data?.devCommandRunning ?? false,
|
|
115
|
+
installCommandRunning: data?.installCommandRunning ?? false,
|
|
116
|
+
serverStarting: false,
|
|
117
|
+
iframeLoading: true
|
|
118
|
+
})
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ React.createElement(
|
|
121
|
+
"iframe",
|
|
122
|
+
{
|
|
123
|
+
ref,
|
|
124
|
+
sandbox: "allow-scripts allow-same-origin allow-forms",
|
|
125
|
+
src: data.ephemeralUrl,
|
|
126
|
+
style: {
|
|
127
|
+
width: "100%",
|
|
128
|
+
height: "100%",
|
|
129
|
+
border: "none",
|
|
130
|
+
gridColumn: "1 / -1",
|
|
131
|
+
gridRow: "1 / -1"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
)
|
|
94
135
|
);
|
|
95
136
|
}
|
|
96
137
|
|
|
@@ -10,9 +10,6 @@ type FreestyleCloudstateDeployConfiguration = {
|
|
|
10
10
|
[key: string]: (string);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
type FreestyleCloudstateDeployErrorResponse = {
|
|
14
|
-
message: string;
|
|
15
|
-
};
|
|
16
13
|
type FreestyleCloudstateDeployRequest = {
|
|
17
14
|
classes: string;
|
|
18
15
|
config?: FreestyleCloudstateDeployConfiguration;
|
|
@@ -50,36 +47,12 @@ type FreestyleDeployWebConfiguration = {
|
|
|
50
47
|
[key: string]: (string);
|
|
51
48
|
} | null;
|
|
52
49
|
};
|
|
53
|
-
type FreestyleDeployWebErrorResponse = {
|
|
54
|
-
message: string;
|
|
55
|
-
};
|
|
56
|
-
type FreestyleDeployWebPayload = {
|
|
57
|
-
/**
|
|
58
|
-
* The files to deploy, a map of file paths to file contents, e.g. { \"index.js\": {\"content\": \"your main\", \"encoding\": \"utf-8\"}, \"file2.js\": {\"content\": \"your helper\" } }
|
|
59
|
-
*
|
|
60
|
-
* **Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.
|
|
61
|
-
*/
|
|
62
|
-
files: {
|
|
63
|
-
[key: string]: FreestyleFile;
|
|
64
|
-
};
|
|
65
|
-
config?: FreestyleDeployWebConfiguration;
|
|
66
|
-
};
|
|
67
50
|
type FreestyleDeployWebSuccessResponse = {
|
|
68
51
|
projectId: string;
|
|
69
52
|
};
|
|
70
|
-
type FreestyleExecureScriptResultError = {
|
|
71
|
-
error: string;
|
|
72
|
-
};
|
|
73
53
|
type FreestyleExecureScriptResultSuccess = {
|
|
74
54
|
result: unknown;
|
|
75
55
|
};
|
|
76
|
-
type FreestyleExecuteScriptParams = {
|
|
77
|
-
/**
|
|
78
|
-
* The JavaScript or TypeScript script to execute
|
|
79
|
-
*/
|
|
80
|
-
script: string;
|
|
81
|
-
config?: FreestyleExecuteScriptParamsConfiguration;
|
|
82
|
-
};
|
|
83
56
|
type FreestyleExecuteScriptParamsConfiguration = {
|
|
84
57
|
/**
|
|
85
58
|
* The environment variables to set for the script
|
|
@@ -102,37 +75,10 @@ type FreestyleExecuteScriptParamsConfiguration = {
|
|
|
102
75
|
*/
|
|
103
76
|
timeout?: (string) | null;
|
|
104
77
|
};
|
|
105
|
-
type FreestyleFile = {
|
|
106
|
-
/**
|
|
107
|
-
* The content of the file
|
|
108
|
-
*/
|
|
109
|
-
content: string;
|
|
110
|
-
/**
|
|
111
|
-
* The encoding of the file. Either **utf-8** or **base64**
|
|
112
|
-
*/
|
|
113
|
-
encoding?: string;
|
|
114
|
-
};
|
|
115
78
|
type FreestyleLogResponseObject = {
|
|
116
79
|
message: string;
|
|
117
80
|
};
|
|
118
|
-
type HandleDeployCloudstateData = {
|
|
119
|
-
body: FreestyleCloudstateDeployRequest;
|
|
120
|
-
};
|
|
121
|
-
type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
|
|
122
|
-
type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
|
|
123
81
|
type HandleBackupCloudstateResponse = (Array<(number)>);
|
|
124
|
-
type HandleBackupCloudstateError = (unknown);
|
|
125
|
-
type HandleExecuteScriptData = {
|
|
126
|
-
body: FreestyleExecuteScriptParams;
|
|
127
|
-
};
|
|
128
|
-
type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
|
|
129
|
-
type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
|
|
130
|
-
type HandleDeployWebData = {
|
|
131
|
-
body: FreestyleDeployWebPayload;
|
|
132
|
-
};
|
|
133
|
-
type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
|
|
134
|
-
type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
|
|
135
82
|
type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
|
|
136
|
-
type HandleGetLogsError = unknown;
|
|
137
83
|
|
|
138
|
-
export type { FreestyleExecuteScriptParamsConfiguration as F, HandleBackupCloudstateResponse as H, FreestyleExecureScriptResultSuccess as a, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f
|
|
84
|
+
export type { FreestyleExecuteScriptParamsConfiguration as F, HandleBackupCloudstateResponse as H, FreestyleExecureScriptResultSuccess as a, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "freestyle-sandboxes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -106,4 +106,4 @@
|
|
|
106
106
|
"zod": "^3.24.1"
|
|
107
107
|
},
|
|
108
108
|
"packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
|
|
109
|
-
}
|
|
109
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -800,12 +800,14 @@ export class FreestyleSandboxes {
|
|
|
800
800
|
async requestDevServer({
|
|
801
801
|
repoUrl,
|
|
802
802
|
repoId,
|
|
803
|
+
baseId,
|
|
803
804
|
}: {
|
|
804
805
|
/**
|
|
805
806
|
* @deprecated
|
|
806
807
|
*/
|
|
807
808
|
repoUrl?: string,
|
|
808
|
-
repoId?: string, repo?: string
|
|
809
|
+
repoId?: string, repo?: string,
|
|
810
|
+
baseId?: string,
|
|
809
811
|
}) {
|
|
810
812
|
function formatHook(serverUrl: string, repoUrl: string) {
|
|
811
813
|
const hook =
|
|
@@ -821,6 +823,7 @@ export class FreestyleSandboxes {
|
|
|
821
823
|
// @ts-ignore
|
|
822
824
|
repo: repoUrl,
|
|
823
825
|
repoId: repoId,
|
|
826
|
+
baseId: baseId
|
|
824
827
|
},
|
|
825
828
|
});
|
|
826
829
|
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
QueryClientProvider,
|
|
4
4
|
useQuery,
|
|
5
5
|
} from "@tanstack/react-query";
|
|
6
|
-
import { RequestDevServerActions } from "./types";
|
|
7
6
|
import React from "react";
|
|
7
|
+
import { RequestDevServerActions } from "./types";
|
|
8
8
|
|
|
9
9
|
const queryClient = new QueryClient();
|
|
10
10
|
|
|
@@ -14,6 +14,7 @@ export function DefaultLoadingComponent({
|
|
|
14
14
|
devCommandRunning: boolean;
|
|
15
15
|
installCommandRunning: boolean;
|
|
16
16
|
serverStarting: boolean;
|
|
17
|
+
iframeLoading: boolean;
|
|
17
18
|
}) {
|
|
18
19
|
let loadingText = "Starting container...";
|
|
19
20
|
|
|
@@ -48,6 +49,7 @@ export function FreestyleDevServer({
|
|
|
48
49
|
devCommandRunning: boolean;
|
|
49
50
|
installCommandRunning: boolean;
|
|
50
51
|
serverStarting: boolean;
|
|
52
|
+
iframeLoading: boolean;
|
|
51
53
|
}) => React.ReactNode;
|
|
52
54
|
actions: RequestDevServerActions;
|
|
53
55
|
}) {
|
|
@@ -72,6 +74,7 @@ function FreestyleDevServerInner({
|
|
|
72
74
|
devCommandRunning: boolean;
|
|
73
75
|
installCommandRunning: boolean;
|
|
74
76
|
serverStarting: boolean;
|
|
77
|
+
iframeLoading: boolean;
|
|
75
78
|
}) => React.ReactNode;
|
|
76
79
|
actions: RequestDevServerActions;
|
|
77
80
|
}) {
|
|
@@ -97,6 +100,7 @@ function FreestyleDevServerInner({
|
|
|
97
100
|
}, [data?.ephemeralUrl]);
|
|
98
101
|
|
|
99
102
|
const [wasLoaded, setWasLoaded] = React.useState(false);
|
|
103
|
+
const [iframeLoaded, setIframeLoaded] = React.useState(false);
|
|
100
104
|
|
|
101
105
|
React.useMemo(() => {
|
|
102
106
|
if (data?.devCommandRunning) {
|
|
@@ -104,11 +108,18 @@ function FreestyleDevServerInner({
|
|
|
104
108
|
}
|
|
105
109
|
}, [isLoading, data?.devCommandRunning]);
|
|
106
110
|
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
ref.current?.addEventListener("load", () => {
|
|
113
|
+
setIframeLoaded(true);
|
|
114
|
+
});
|
|
115
|
+
}, [ref]);
|
|
116
|
+
|
|
107
117
|
if (isLoading) {
|
|
108
118
|
return loadingComponent({
|
|
109
119
|
devCommandRunning: false,
|
|
110
120
|
installCommandRunning: false,
|
|
111
121
|
serverStarting: true,
|
|
122
|
+
iframeLoading: false,
|
|
112
123
|
});
|
|
113
124
|
}
|
|
114
125
|
|
|
@@ -117,19 +128,51 @@ function FreestyleDevServerInner({
|
|
|
117
128
|
devCommandRunning: data?.devCommandRunning ?? false,
|
|
118
129
|
installCommandRunning: data?.installCommandRunning ?? false,
|
|
119
130
|
serverStarting: false,
|
|
131
|
+
iframeLoading: false,
|
|
120
132
|
});
|
|
121
133
|
}
|
|
122
134
|
|
|
123
135
|
return (
|
|
124
|
-
<
|
|
125
|
-
ref={ref}
|
|
126
|
-
sandbox="allow-scripts allow-same-origin allow-forms"
|
|
127
|
-
src={data.ephemeralUrl}
|
|
136
|
+
<div
|
|
128
137
|
style={{
|
|
138
|
+
display: "grid",
|
|
139
|
+
gridTemplateRows: "1fr",
|
|
140
|
+
gridTemplateColumns: "1fr",
|
|
129
141
|
width: "100%",
|
|
130
142
|
height: "100%",
|
|
131
|
-
border: "none",
|
|
132
143
|
}}
|
|
133
|
-
|
|
144
|
+
>
|
|
145
|
+
{
|
|
146
|
+
<div
|
|
147
|
+
style={{
|
|
148
|
+
width: "100%",
|
|
149
|
+
height: "100%",
|
|
150
|
+
border: "none",
|
|
151
|
+
gridColumn: "1 / -1",
|
|
152
|
+
gridRow: "1 / -1",
|
|
153
|
+
visibility: iframeLoaded ? "hidden" : "visible",
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
{loadingComponent({
|
|
157
|
+
devCommandRunning: data?.devCommandRunning ?? false,
|
|
158
|
+
installCommandRunning: data?.installCommandRunning ?? false,
|
|
159
|
+
serverStarting: false,
|
|
160
|
+
iframeLoading: true,
|
|
161
|
+
})}
|
|
162
|
+
</div>
|
|
163
|
+
}
|
|
164
|
+
<iframe
|
|
165
|
+
ref={ref}
|
|
166
|
+
sandbox="allow-scripts allow-same-origin allow-forms"
|
|
167
|
+
src={data.ephemeralUrl}
|
|
168
|
+
style={{
|
|
169
|
+
width: "100%",
|
|
170
|
+
height: "100%",
|
|
171
|
+
border: "none",
|
|
172
|
+
gridColumn: "1 / -1",
|
|
173
|
+
gridRow: "1 / -1",
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
134
177
|
);
|
|
135
178
|
}
|