freestyle-sandboxes 0.0.80 → 0.0.81
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 +0 -1
- package/dist/inde.d.mts +0 -1
- package/dist/{index-BBXyg0JQ.cjs → index-CGc0kRd_.cjs} +9 -5
- package/dist/{index-DCF70Xbq.mjs → index-jh-93svX.mjs} +9 -5
- package/dist/index.cjs +5 -14
- package/dist/index.d.cts +0 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +5 -14
- package/dist/{types.gen-BVXmFV7d.d.ts → types.gen-0bQ5Wn0o.d.ts} +18 -17
- package/dist/{types.gen-CIf3ciN7.d.ts → types.gen-BJArgpto.d.ts} +2 -5
- package/dist/{types.gen-DLYohMJT.d.ts → types.gen-CfrGF-JI.d.ts} +1 -1
- package/dist/{types.gen-CZUnqmzP.d.ts → types.gen-DxZanGNF.d.ts} +9 -6
- package/openapi/sdk.gen.ts +57 -2
- package/openapi/types.gen.ts +133 -2
- package/openapi.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +143 -0
- package/dist/index-BQHqnjZK.mjs +0 -3231
- package/dist/index-CEEa9WHp.cjs +0 -3238
- 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-BbekD8Sd.d.ts +0 -1119
- package/dist/types.gen-BqN1t03N.d.ts +0 -842
- package/dist/types.gen-BtK6PMQy.d.ts +0 -195
- package/dist/types.gen-C03gaIPq.d.ts +0 -297
- package/dist/types.gen-CMuCas4r.d.ts +0 -183
- 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-DbTb_SrD.d.ts +0 -156
- package/dist/types.gen-DkQ-Dbs1.d.ts +0 -764
- package/dist/types.gen-DyY7Deri.d.ts +0 -138
- 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/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -854,6 +854,149 @@ export class FreestyleSandboxes {
|
|
|
854
854
|
);
|
|
855
855
|
}
|
|
856
856
|
|
|
857
|
+
/**
|
|
858
|
+
* Set the default branch for a git repository.
|
|
859
|
+
*/
|
|
860
|
+
async setGitRepoDefaultBranch({
|
|
861
|
+
repoId,
|
|
862
|
+
defaultBranch,
|
|
863
|
+
}: sandbox_openapi.SetDefaultBranchRequest & {
|
|
864
|
+
repoId: string;
|
|
865
|
+
}): Promise<void> {
|
|
866
|
+
const response = await sandbox_openapi.handleSetDefaultBranch({
|
|
867
|
+
client: this.client,
|
|
868
|
+
path: {
|
|
869
|
+
repo_id: repoId,
|
|
870
|
+
},
|
|
871
|
+
body: {
|
|
872
|
+
defaultBranch,
|
|
873
|
+
},
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
if (response.error) {
|
|
877
|
+
throw new Error(`Failed to set default branch: ${response.error}`);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Get the default branch for a git repository.
|
|
883
|
+
*/
|
|
884
|
+
async getGitRepoDefaultBranch({
|
|
885
|
+
repoId,
|
|
886
|
+
}: {
|
|
887
|
+
repoId: string;
|
|
888
|
+
}): Promise<string> {
|
|
889
|
+
const response = await sandbox_openapi.handleGetDefaultBranch({
|
|
890
|
+
client: this.client,
|
|
891
|
+
path: { repo_id: repoId },
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
if (response.data) {
|
|
895
|
+
return response.data.defaultBranch;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
throw new Error(
|
|
899
|
+
`Failed to get default branch for repository ${repoId}: ${response.error}`,
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Get the contents of a git repository at the given path.
|
|
905
|
+
*/
|
|
906
|
+
async getGitRepoContents({
|
|
907
|
+
repoId,
|
|
908
|
+
path,
|
|
909
|
+
ref,
|
|
910
|
+
}: {
|
|
911
|
+
repoId: string;
|
|
912
|
+
path?: string;
|
|
913
|
+
ref?: string;
|
|
914
|
+
}): Promise<sandbox_openapi.HandleGetContentsResponse> {
|
|
915
|
+
const response = await sandbox_openapi.handleGetContents({
|
|
916
|
+
client: this.client,
|
|
917
|
+
path: {
|
|
918
|
+
repo: repoId,
|
|
919
|
+
"*path": path ?? null,
|
|
920
|
+
},
|
|
921
|
+
query: {
|
|
922
|
+
ref: ref,
|
|
923
|
+
},
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
if (response.data) {
|
|
927
|
+
return response.data;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
throw new Error(
|
|
931
|
+
`Failed to get git repository contents: ${response.error.message}`,
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Configure a git repository to sync with GitHub.
|
|
937
|
+
*/
|
|
938
|
+
async configureGitRepoGitHubSync({
|
|
939
|
+
repoId,
|
|
940
|
+
githubRepoName,
|
|
941
|
+
}: {
|
|
942
|
+
repoId: string;
|
|
943
|
+
githubRepoName: string;
|
|
944
|
+
}): Promise<void> {
|
|
945
|
+
const response = await sandbox_openapi.configureGithubSync({
|
|
946
|
+
client: this.client,
|
|
947
|
+
path: {
|
|
948
|
+
repo_id: repoId,
|
|
949
|
+
},
|
|
950
|
+
body: {
|
|
951
|
+
githubRepoName,
|
|
952
|
+
},
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
if (response.error) {
|
|
956
|
+
throw new Error(`Failed to configure GitHub sync: ${response.error}`);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Remove the GitHub sync configuration for a git repository.
|
|
962
|
+
*/
|
|
963
|
+
async removeGitRepoGitHubSync({ repoId }: { repoId: string }): Promise<void> {
|
|
964
|
+
const response = await sandbox_openapi.removeGithubSync({
|
|
965
|
+
client: this.client,
|
|
966
|
+
path: {
|
|
967
|
+
repo_id: repoId,
|
|
968
|
+
},
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
if (response.error) {
|
|
972
|
+
throw new Error(`Failed to remove GitHub sync: ${response.error}`);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Get the GitHub sync configuration for a git repository.
|
|
978
|
+
*/
|
|
979
|
+
async getGitRepoGitHubSyncConfig({
|
|
980
|
+
repoId,
|
|
981
|
+
}): Promise<sandbox_openapi.GetGithubSyncResponse | null> {
|
|
982
|
+
const response = await sandbox_openapi.getGithubSync({
|
|
983
|
+
client: this.client,
|
|
984
|
+
path: {
|
|
985
|
+
repo_id: repoId,
|
|
986
|
+
},
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
if (response.response.status === 404) {
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
if (response.error) {
|
|
994
|
+
throw new Error(`Failed to get GitHub sync config: ${response.error}`);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
return response.data ?? null;
|
|
998
|
+
}
|
|
999
|
+
|
|
857
1000
|
/**
|
|
858
1001
|
* Request a dev server for a repository. If a dev server is already running
|
|
859
1002
|
* for that repository, it will return a url to that server. Dev servers are
|