@blaxel/core 0.2.86-dev.162 → 0.2.86-preview.163

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.
Files changed (66) hide show
  1. package/README.md +2 -37
  2. package/dist/cjs/.tsbuildinfo +1 -1
  3. package/dist/cjs/client/sdk.gen.js +12 -63
  4. package/dist/cjs/common/settings.js +3 -3
  5. package/dist/cjs/common/settings.test.js +3 -3
  6. package/dist/cjs/drive/index.js +3 -39
  7. package/dist/cjs/index.js +0 -1
  8. package/dist/cjs/jobs/jobs.js +9 -42
  9. package/dist/cjs/sandbox/sandbox.js +15 -41
  10. package/dist/cjs/types/client/sdk.gen.d.ts +19 -34
  11. package/dist/cjs/types/client/types.gen.d.ts +21 -614
  12. package/dist/cjs/types/drive/index.d.ts +4 -34
  13. package/dist/cjs/types/index.d.ts +0 -1
  14. package/dist/cjs/types/jobs/jobs.d.ts +3 -33
  15. package/dist/cjs/types/sandbox/sandbox.d.ts +4 -36
  16. package/dist/cjs/types/sandbox/types.d.ts +3 -0
  17. package/dist/cjs/types/volume/index.d.ts +4 -36
  18. package/dist/cjs/volume/index.js +3 -41
  19. package/dist/cjs-browser/.tsbuildinfo +1 -1
  20. package/dist/cjs-browser/client/sdk.gen.js +12 -63
  21. package/dist/cjs-browser/common/settings.js +3 -3
  22. package/dist/cjs-browser/common/settings.test.js +3 -3
  23. package/dist/cjs-browser/drive/index.js +3 -39
  24. package/dist/cjs-browser/index.js +0 -1
  25. package/dist/cjs-browser/jobs/jobs.js +9 -42
  26. package/dist/cjs-browser/sandbox/sandbox.js +15 -41
  27. package/dist/cjs-browser/types/client/sdk.gen.d.ts +19 -34
  28. package/dist/cjs-browser/types/client/types.gen.d.ts +21 -614
  29. package/dist/cjs-browser/types/drive/index.d.ts +4 -34
  30. package/dist/cjs-browser/types/index.d.ts +0 -1
  31. package/dist/cjs-browser/types/jobs/jobs.d.ts +3 -33
  32. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +4 -36
  33. package/dist/cjs-browser/types/sandbox/types.d.ts +3 -0
  34. package/dist/cjs-browser/types/volume/index.d.ts +4 -36
  35. package/dist/cjs-browser/volume/index.js +3 -41
  36. package/dist/esm/.tsbuildinfo +1 -1
  37. package/dist/esm/client/sdk.gen.js +9 -57
  38. package/dist/esm/common/settings.js +3 -3
  39. package/dist/esm/common/settings.test.js +3 -3
  40. package/dist/esm/drive/index.js +3 -39
  41. package/dist/esm/index.js +0 -1
  42. package/dist/esm/jobs/jobs.js +9 -42
  43. package/dist/esm/sandbox/sandbox.js +15 -41
  44. package/dist/esm/volume/index.js +3 -41
  45. package/dist/esm-browser/.tsbuildinfo +1 -1
  46. package/dist/esm-browser/client/sdk.gen.js +9 -57
  47. package/dist/esm-browser/common/settings.js +3 -3
  48. package/dist/esm-browser/common/settings.test.js +3 -3
  49. package/dist/esm-browser/drive/index.js +3 -39
  50. package/dist/esm-browser/index.js +0 -1
  51. package/dist/esm-browser/jobs/jobs.js +9 -42
  52. package/dist/esm-browser/sandbox/sandbox.js +15 -41
  53. package/dist/esm-browser/volume/index.js +3 -41
  54. package/package.json +1 -1
  55. package/dist/cjs/common/pagination.js +0 -87
  56. package/dist/cjs/common/pagination.test.js +0 -62
  57. package/dist/cjs/types/common/pagination.d.ts +0 -35
  58. package/dist/cjs/types/common/pagination.test.d.ts +0 -1
  59. package/dist/cjs-browser/common/pagination.js +0 -87
  60. package/dist/cjs-browser/common/pagination.test.js +0 -62
  61. package/dist/cjs-browser/types/common/pagination.d.ts +0 -35
  62. package/dist/cjs-browser/types/common/pagination.test.d.ts +0 -1
  63. package/dist/esm/common/pagination.js +0 -83
  64. package/dist/esm/common/pagination.test.js +0 -60
  65. package/dist/esm-browser/common/pagination.js +0 -83
  66. package/dist/esm-browser/common/pagination.test.js +0 -60
@@ -1,12 +1,11 @@
1
- import { type Drive, type ListDrivesData } from "../client/index.js";
2
- export type DriveListQuery = NonNullable<ListDrivesData["query"]>;
3
- export type DriveCreateConfiguration = {
1
+ import { Drive } from "../client/index.js";
2
+ export interface DriveCreateConfiguration {
4
3
  name?: string;
5
4
  displayName?: string;
6
5
  labels?: Record<string, string>;
7
6
  size?: number;
8
7
  region?: string;
9
- };
8
+ }
10
9
  export declare class DriveInstance {
11
10
  private drive;
12
11
  constructor(drive: Drive);
@@ -20,36 +19,7 @@ export declare class DriveInstance {
20
19
  get region(): string | undefined;
21
20
  static create(config: DriveCreateConfiguration | Drive): Promise<DriveInstance>;
22
21
  static get(driveName: string): Promise<DriveInstance>;
23
- /**
24
- * List one page of drives.
25
- *
26
- * The returned page exposes `data` for the current page, `meta` for cursor
27
- * metadata, and helpers to fetch more pages only when you need them.
28
- *
29
- * @example
30
- * ```ts
31
- * const page = await DriveInstance.list({ limit: 50 });
32
- *
33
- * for (const drive of page.data) {
34
- * console.log(drive.name);
35
- * }
36
- *
37
- * const nextPage = await page.nextPage();
38
- * ```
39
- *
40
- * @example
41
- * ```ts
42
- * const allDrives = await (await DriveInstance.list()).autoPagingToArray({
43
- * limit: 1000,
44
- * });
45
- * ```
46
- */
47
- static list(query?: DriveListQuery): Promise<import("../common/pagination.js").PaginatedList<DriveInstance, {
48
- cursor?: string;
49
- limit?: number;
50
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
51
- q?: string;
52
- }>>;
22
+ static list(): Promise<DriveInstance[]>;
53
23
  static delete(driveName: string): Promise<{
54
24
  message?: string;
55
25
  name?: string;
@@ -7,7 +7,6 @@ export * from "./common/node.js";
7
7
  export * from "./common/errors.js";
8
8
  export * from "./common/internal.js";
9
9
  export * from "./common/logger.js";
10
- export * from "./common/pagination.js";
11
10
  export * from "./common/settings.js";
12
11
  export * from "./common/webhook.js";
13
12
  export * from "./drive/index.js";
@@ -1,5 +1,4 @@
1
- import { type CreateJobExecutionRequest, type JobExecution, type ListJobExecutionsData } from "../client/index.js";
2
- export type JobExecutionListQuery = NonNullable<ListJobExecutionsData["query"]>;
1
+ import { CreateJobExecutionRequest, JobExecution } from "../client/index.js";
3
2
  declare class BlJob {
4
3
  jobName: string;
5
4
  constructor(jobName: string);
@@ -17,38 +16,9 @@ declare class BlJob {
17
16
  */
18
17
  getExecution(executionId: string): Promise<JobExecution>;
19
18
  /**
20
- * List one page of executions for this job.
21
- *
22
- * The returned page exposes `data` for the current page, `meta` for cursor
23
- * metadata, and helpers to fetch more pages only when you need them.
24
- *
25
- * @example
26
- * ```ts
27
- * const job = blJob("daily-import");
28
- * const page = await job.listExecutions({ limit: 50 });
29
- *
30
- * for (const execution of page.data) {
31
- * console.log(execution.status);
32
- * }
33
- *
34
- * const nextPage = await page.nextPage();
35
- * ```
36
- *
37
- * @example
38
- * ```ts
39
- * const job = blJob("daily-import");
40
- * const executions = await (await job.listExecutions()).autoPagingToArray({
41
- * limit: 1000,
42
- * });
43
- * ```
19
+ * List all executions for this job
44
20
  */
45
- listExecutions(query?: JobExecutionListQuery): Promise<import("../common/pagination.js").PaginatedList<JobExecution, {
46
- limit?: number;
47
- offset?: number;
48
- cursor?: string;
49
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
50
- q?: string;
51
- }>>;
21
+ listExecutions(): Promise<JobExecution[]>;
52
22
  /**
53
23
  * Get the status of a specific execution
54
24
  */
@@ -1,5 +1,5 @@
1
1
  import type http2 from "http2";
2
- import { type ListSandboxesData, type SandboxLifecycle, type Sandbox as SandboxModel } from "../client/index.js";
2
+ import { SandboxLifecycle, Sandbox as SandboxModel } from "../client/index.js";
3
3
  import { SandboxCodegen } from "./codegen/index.js";
4
4
  import { SandboxDrive } from "./drive/index.js";
5
5
  import { SandboxFileSystem } from "./filesystem/index.js";
@@ -8,8 +8,7 @@ import { SandboxPreviews } from "./preview.js";
8
8
  import { SandboxProcess } from "./process/index.js";
9
9
  import { SandboxSessions } from "./session.js";
10
10
  import { SandboxSystem } from "./system.js";
11
- import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SessionWithToken } from "./types.js";
12
- export type SandboxListQuery = NonNullable<ListSandboxesData["query"]>;
11
+ import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SandboxUpdateNetwork, SessionWithToken } from "./types.js";
13
12
  export declare class SandboxInstance {
14
13
  private sandbox;
15
14
  fs: SandboxFileSystem;
@@ -52,44 +51,13 @@ export declare class SandboxInstance {
52
51
  createIfNotExist?: boolean;
53
52
  }): Promise<SandboxInstance>;
54
53
  static get(sandboxName: string): Promise<SandboxInstance>;
55
- /**
56
- * List one page of sandboxes.
57
- *
58
- * The returned page exposes `data` for the current page, `meta` for cursor
59
- * metadata, and helpers to fetch more pages only when you need them.
60
- *
61
- * @example
62
- * ```ts
63
- * const page = await SandboxInstance.list({ limit: 50 });
64
- *
65
- * for (const sandbox of page.data) {
66
- * console.log(sandbox.metadata.name);
67
- * }
68
- *
69
- * const nextPage = await page.nextPage();
70
- * ```
71
- *
72
- * @example
73
- * ```ts
74
- * const page = await SandboxInstance.list({ limit: 100 });
75
- *
76
- * for await (const sandbox of page) {
77
- * console.log(sandbox.metadata.name);
78
- * }
79
- * ```
80
- */
81
- static list(query?: SandboxListQuery): Promise<import("../common/pagination.js").PaginatedList<SandboxInstance, {
82
- showTerminated?: boolean;
83
- cursor?: string;
84
- limit?: number;
85
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
86
- q?: string;
87
- }>>;
54
+ static list(): Promise<SandboxInstance[]>;
88
55
  static delete(sandboxName: string): Promise<SandboxModel>;
89
56
  delete(): Promise<SandboxModel>;
90
57
  static updateMetadata(sandboxName: string, metadata: SandboxUpdateMetadata): Promise<SandboxInstance>;
91
58
  static updateTtl(sandboxName: string, ttl: string): Promise<SandboxInstance>;
92
59
  static updateLifecycle(sandboxName: string, lifecycle: SandboxLifecycle): Promise<SandboxInstance>;
60
+ static updateNetwork(sandboxName: string, network: SandboxUpdateNetwork): Promise<SandboxInstance>;
93
61
  static createIfNotExists(sandbox: SandboxModel | SandboxCreateConfiguration): Promise<SandboxInstance>;
94
62
  static fromSession(session: SessionWithToken): Promise<SandboxInstance>;
95
63
  }
@@ -32,6 +32,9 @@ export type SandboxUpdateMetadata = {
32
32
  labels?: Record<string, string>;
33
33
  displayName?: string;
34
34
  };
35
+ export type SandboxUpdateNetwork = {
36
+ network?: SandboxNetwork;
37
+ };
35
38
  export type SandboxCreateConfiguration = {
36
39
  name?: string;
37
40
  image?: string;
@@ -1,13 +1,12 @@
1
- import { type ListVolumesData, type Volume } from "../client/index.js";
2
- export type VolumeListQuery = NonNullable<ListVolumesData["query"]>;
3
- export type VolumeCreateConfiguration = {
1
+ import { Volume } from "../client/index.js";
2
+ export interface VolumeCreateConfiguration {
4
3
  name?: string;
5
4
  displayName?: string;
6
5
  labels?: Record<string, string>;
7
6
  size?: number;
8
7
  region?: string;
9
8
  template?: string;
10
- };
9
+ }
11
10
  export declare class VolumeInstance {
12
11
  private volume;
13
12
  constructor(volume: Volume);
@@ -20,38 +19,7 @@ export declare class VolumeInstance {
20
19
  get region(): string | undefined;
21
20
  static create(config: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
22
21
  static get(volumeName: string): Promise<VolumeInstance>;
23
- /**
24
- * List one page of volumes.
25
- *
26
- * The returned page exposes `data` for the current page, `meta` for cursor
27
- * metadata, and helpers to fetch more pages only when you need them.
28
- *
29
- * @example
30
- * ```ts
31
- * const page = await VolumeInstance.list({ limit: 50 });
32
- *
33
- * for (const volume of page.data) {
34
- * console.log(volume.name);
35
- * }
36
- *
37
- * const nextPage = await page.nextPage();
38
- * ```
39
- *
40
- * @example
41
- * ```ts
42
- * const page = await VolumeInstance.list({ limit: 100 });
43
- *
44
- * for await (const volume of page) {
45
- * console.log(volume.name);
46
- * }
47
- * ```
48
- */
49
- static list(query?: VolumeListQuery): Promise<import("../common/pagination.js").PaginatedList<VolumeInstance, {
50
- cursor?: string;
51
- limit?: number;
52
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
53
- q?: string;
54
- }>>;
22
+ static list(): Promise<VolumeInstance[]>;
55
23
  static delete(volumeName: string): Promise<Volume>;
56
24
  delete(): Promise<Volume>;
57
25
  static update(volumeName: string, updates: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VolumeInstance = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const index_js_1 = require("../client/index.js");
6
- const pagination_js_1 = require("../common/pagination.js");
7
6
  const settings_js_1 = require("../common/settings.js");
8
7
  class VolumeInstance {
9
8
  volume;
@@ -89,46 +88,9 @@ class VolumeInstance {
89
88
  });
90
89
  return new VolumeInstance(data);
91
90
  }
92
- /**
93
- * List one page of volumes.
94
- *
95
- * The returned page exposes `data` for the current page, `meta` for cursor
96
- * metadata, and helpers to fetch more pages only when you need them.
97
- *
98
- * @example
99
- * ```ts
100
- * const page = await VolumeInstance.list({ limit: 50 });
101
- *
102
- * for (const volume of page.data) {
103
- * console.log(volume.name);
104
- * }
105
- *
106
- * const nextPage = await page.nextPage();
107
- * ```
108
- *
109
- * @example
110
- * ```ts
111
- * const page = await VolumeInstance.list({ limit: 100 });
112
- *
113
- * for await (const volume of page) {
114
- * console.log(volume.name);
115
- * }
116
- * ```
117
- */
118
- static async list(query) {
119
- const fetchPage = async (pageQuery) => {
120
- const { data } = await (0, index_js_1.listVolumes)({
121
- query: pageQuery,
122
- throwOnError: true,
123
- });
124
- return data;
125
- };
126
- return (0, pagination_js_1.createPaginatedList)({
127
- response: await fetchPage(query),
128
- fetchPage,
129
- mapItem: (volume) => new VolumeInstance(volume),
130
- query,
131
- });
91
+ static async list() {
92
+ const { data } = await (0, index_js_1.listVolumes)({ throwOnError: true });
93
+ return data.map((volume) => new VolumeInstance(volume));
132
94
  }
133
95
  static async delete(volumeName) {
134
96
  const { data } = await (0, index_js_1.deleteVolume)({