freestyle-sandboxes 0.0.76 → 0.0.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/src/dev-server.ts CHANGED
@@ -23,6 +23,9 @@ export interface FreestyleDevServer {
23
23
 
24
24
  process: FreestyleDevServerProcess;
25
25
 
26
+ devCommandRunning: boolean;
27
+ installCommandRunning: boolean;
28
+
26
29
  /**
27
30
  * Get the status of the dev server
28
31
  */
package/src/index.ts CHANGED
@@ -70,6 +70,34 @@ export type {
70
70
  DeploymentBuildOptions,
71
71
  } from "../openapi/index.ts";
72
72
 
73
+ /**
74
+ * Create a new git repository with a single commit from a static import.
75
+ */
76
+ type CreateGitRepositoryImport = {
77
+ /**
78
+ * Create a new git repository with a single commit from a static import.
79
+ */
80
+ import: sandbox_openapi.CreateRepoImport;
81
+ /**
82
+ * Create a git repository from another git reopsitory
83
+ */
84
+ source?: never;
85
+ };
86
+
87
+ /**
88
+ * Create a git repository from another git reopsitory
89
+ */
90
+ type CreateGitRepositorySource = {
91
+ /**
92
+ * Create a git repository from another git reopsitory
93
+ */
94
+ source: sandbox_openapi.CreateRepoSource;
95
+ /**
96
+ * Create a new git repository with a single commit from a static import.
97
+ */
98
+ import?: never;
99
+ };
100
+
73
101
  type Options = {
74
102
  /**
75
103
  * The base URL for the API.
@@ -257,6 +285,24 @@ export class FreestyleSandboxes {
257
285
  throw new Error(response.error.message);
258
286
  }
259
287
 
288
+ async verifyDomainVerificationRequest(
289
+ id: string
290
+ ): Promise<HandleVerifyDomainResponse> {
291
+ const response = await sandbox_openapi.handleVerifyDomain({
292
+ client: this.client,
293
+ body: {
294
+ id,
295
+ },
296
+ });
297
+
298
+ if (response.data) {
299
+ return response.data;
300
+ }
301
+ throw new Error(
302
+ `Failed to verify domain verification request with ID ${id}: ${response.error.message}`
303
+ );
304
+ }
305
+
260
306
  /**
261
307
  * Verify a domain. Note, this requires the domain verification token to be already set up.
262
308
  * @param domain The domain to verify.
@@ -405,22 +451,21 @@ export class FreestyleSandboxes {
405
451
  name,
406
452
  public: pub = false,
407
453
  source,
454
+ import: _import,
408
455
  }: {
409
- name: string;
456
+ name?: string;
410
457
  public?: boolean;
411
- source?: {
412
- type: "git";
413
- url: string;
414
- branch?: string;
415
- depth?: number;
416
- };
417
- }): Promise<CreateRepositoryResponseSuccess> {
458
+ } & (
459
+ | CreateGitRepositorySource
460
+ | CreateGitRepositoryImport
461
+ )): Promise<CreateRepositoryResponseSuccess> {
418
462
  const response = await sandbox_openapi.handleCreateRepo({
419
463
  client: this.client,
420
464
  body: {
421
465
  name,
422
466
  public: pub,
423
467
  source,
468
+ import: _import,
424
469
  },
425
470
  });
426
471
 
@@ -1083,14 +1128,18 @@ export class FreestyleSandboxes {
1083
1128
  ? content
1084
1129
  : Buffer.from(content).toString(encoding);
1085
1130
 
1086
- await client.put({
1087
- url: `/ephemeral/v1/dev-servers/files/${path}`,
1088
- body: {
1089
- devServer: devServerInstance,
1090
- content: contentStr,
1091
- encoding,
1092
- },
1093
- });
1131
+ const response =
1132
+ await sandbox_openapi.handleWriteFileFromEphemeralDevServer({
1133
+ client,
1134
+ path: {
1135
+ filepath: path,
1136
+ },
1137
+ body: {
1138
+ devServer: devServerInstance,
1139
+ content: contentStr,
1140
+ encoding,
1141
+ },
1142
+ });
1094
1143
 
1095
1144
  if (response.error) {
1096
1145
  throw new Error(
package/src/temp.ts DELETED
@@ -1,10 +0,0 @@
1
- import { FreestyleSandboxes } from "./index";
2
- import "dotenv/config"
3
-
4
- const api = new FreestyleSandboxes({
5
- apiKey: process.env.FREESTYLE_API_KEY,
6
- });
7
-
8
- api.requestDevServer({
9
- repoUrl: "https://c6709211-2d68-478e-80b3-7ebe7313f3ac:QqasQD331e3woNyK.Q9dnXy3MR9Aeo759@git.freestyle.sh/15b7ed11-0e7c-452b-b044-70f0dcab9161"
10
- }).then(console.log)