@buddy-works/sandbox-sdk 0.1.6-rc.1 → 0.1.7

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/index.d.mts CHANGED
@@ -433,6 +433,14 @@ type TunnelView = {
433
433
  * The url of the tunnel
434
434
  */
435
435
  endpoint_url?: string;
436
+ /**
437
+ * Whether the tunnel is connected to the edge (tunnel is established)
438
+ */
439
+ active?: boolean;
440
+ /**
441
+ * Latency to the target in milliseconds. When >= 0 the target is reachable
442
+ */
443
+ target_latency?: number;
436
444
  };
437
445
  type SandboxFetchView = {
438
446
  /**
@@ -703,6 +711,9 @@ type SnapshotView = {
703
711
  create_date?: Date;
704
712
  created_by?: MemberView;
705
713
  };
714
+ /**
715
+ * The list of variables you can use the action
716
+ */
706
717
  type EnvironmentVariableView = {
707
718
  /**
708
719
  * The ID of the variable
@@ -1120,6 +1131,14 @@ type TunnelViewWritable = {
1120
1131
  * The url of the tunnel
1121
1132
  */
1122
1133
  endpoint_url?: string;
1134
+ /**
1135
+ * Whether the tunnel is connected to the edge (tunnel is established)
1136
+ */
1137
+ active?: boolean;
1138
+ /**
1139
+ * Latency to the target in milliseconds. When >= 0 the target is reachable
1140
+ */
1141
+ target_latency?: number;
1123
1142
  };
1124
1143
  type CreateNewSandboxRequestWritable = {
1125
1144
  /**
package/dist/index.mjs CHANGED
@@ -357,6 +357,94 @@ const zPipelinePropertyView = z.object({
357
357
  value: z.string().optional()
358
358
  });
359
359
  /**
360
+ * MSSQL authentication credentials
361
+ */
362
+ const zMssqlAuthView = z.object({
363
+ method: z.enum(["PASSWORD"]).optional(),
364
+ username: z.string(),
365
+ password: z.string()
366
+ });
367
+ /**
368
+ * MongoDB authentication credentials
369
+ */
370
+ const zMongoAuthView = z.object({
371
+ method: z.enum(["PASSWORD"]).optional(),
372
+ username: z.string(),
373
+ password: z.string()
374
+ });
375
+ /**
376
+ * PostgreSQL authentication credentials
377
+ */
378
+ const zPostgresqlAuthView = z.object({
379
+ method: z.enum(["PASSWORD"]).optional(),
380
+ username: z.string(),
381
+ password: z.string()
382
+ });
383
+ /**
384
+ * MySQL authentication credentials
385
+ */
386
+ const zMysqlAuthView = z.object({
387
+ method: z.enum(["PASSWORD"]).optional(),
388
+ username: z.string(),
389
+ password: z.string()
390
+ });
391
+ /**
392
+ * Define proxy servers' authentication method using the following parameters
393
+ */
394
+ const zSshAuthView = z.object({
395
+ method: z.enum([
396
+ "PASSWORD",
397
+ "SSH_KEY",
398
+ "ASSETS_KEY",
399
+ "PROXY_CREDENTIALS",
400
+ "PROXY_KEY"
401
+ ]),
402
+ username: z.string().optional(),
403
+ password: z.string().optional(),
404
+ asset: z.string().optional(),
405
+ passphrase: z.string().optional(),
406
+ key: z.string().optional(),
407
+ key_path: z.string().optional()
408
+ });
409
+ /**
410
+ * Kubernetes cluster authentication method
411
+ */
412
+ const zK8sAuthView = z.object({
413
+ method: z.enum([
414
+ "PASS",
415
+ "CERT",
416
+ "TOKEN"
417
+ ]),
418
+ username: z.string().optional(),
419
+ password: z.string().optional(),
420
+ certificate_authority: z.string().optional(),
421
+ client_certificate: z.string().optional(),
422
+ client_key: z.string().optional(),
423
+ token: z.string().optional()
424
+ });
425
+ /**
426
+ * Authentication details
427
+ */
428
+ const zGitAuthView = z.object({
429
+ method: z.enum([
430
+ "HTTP",
431
+ "SSH_KEY",
432
+ "ASSETS_KEY",
433
+ "CURRENT"
434
+ ]),
435
+ username: z.string().optional(),
436
+ password: z.string().optional(),
437
+ asset: z.string().optional(),
438
+ key: z.string().optional()
439
+ });
440
+ /**
441
+ * Authentication details
442
+ */
443
+ const zFtpAuthView = z.object({
444
+ username: z.string(),
445
+ password: z.string()
446
+ });
447
+ /**
360
448
  * Defines how the target can be used (as deployment target, proxy, or both)
361
449
  */
362
450
  const zUseAsView = z.object({
@@ -468,94 +556,6 @@ const zShortProjectView = z.object({
468
556
  access: z.enum(["PRIVATE", "PUBLIC"]).optional(),
469
557
  create_date: z.iso.datetime().optional()
470
558
  });
471
- /**
472
- * MSSQL authentication credentials
473
- */
474
- const zMssqlAuthView = z.object({
475
- method: z.enum(["PASSWORD"]).optional(),
476
- username: z.string(),
477
- password: z.string()
478
- });
479
- /**
480
- * MongoDB authentication credentials
481
- */
482
- const zMongoAuthView = z.object({
483
- method: z.enum(["PASSWORD"]).optional(),
484
- username: z.string(),
485
- password: z.string()
486
- });
487
- /**
488
- * PostgreSQL authentication credentials
489
- */
490
- const zPostgresqlAuthView = z.object({
491
- method: z.enum(["PASSWORD"]).optional(),
492
- username: z.string(),
493
- password: z.string()
494
- });
495
- /**
496
- * MySQL authentication credentials
497
- */
498
- const zMysqlAuthView = z.object({
499
- method: z.enum(["PASSWORD"]).optional(),
500
- username: z.string(),
501
- password: z.string()
502
- });
503
- /**
504
- * Define proxy servers' authentication method using the following parameters
505
- */
506
- const zSshAuthView = z.object({
507
- method: z.enum([
508
- "PASSWORD",
509
- "SSH_KEY",
510
- "ASSETS_KEY",
511
- "PROXY_CREDENTIALS",
512
- "PROXY_KEY"
513
- ]),
514
- username: z.string().optional(),
515
- password: z.string().optional(),
516
- asset: z.string().optional(),
517
- passphrase: z.string().optional(),
518
- key: z.string().optional(),
519
- key_path: z.string().optional()
520
- });
521
- /**
522
- * Kubernetes cluster authentication method
523
- */
524
- const zK8sAuthView = z.object({
525
- method: z.enum([
526
- "PASS",
527
- "CERT",
528
- "TOKEN"
529
- ]),
530
- username: z.string().optional(),
531
- password: z.string().optional(),
532
- certificate_authority: z.string().optional(),
533
- client_certificate: z.string().optional(),
534
- client_key: z.string().optional(),
535
- token: z.string().optional()
536
- });
537
- /**
538
- * Authentication details
539
- */
540
- const zGitAuthView = z.object({
541
- method: z.enum([
542
- "HTTP",
543
- "SSH_KEY",
544
- "ASSETS_KEY",
545
- "CURRENT"
546
- ]),
547
- username: z.string().optional(),
548
- password: z.string().optional(),
549
- asset: z.string().optional(),
550
- key: z.string().optional()
551
- });
552
- /**
553
- * Authentication details
554
- */
555
- const zFtpAuthView = z.object({
556
- username: z.string(),
557
- password: z.string()
558
- });
559
559
  const zIdsView = z.object({
560
560
  url: z.string().readonly().optional(),
561
561
  html_url: z.string().readonly().optional(),
@@ -921,7 +921,9 @@ const zTunnelView = z.object({
921
921
  timeout: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }).optional(),
922
922
  http: zHttpSettingsView.optional(),
923
923
  tls: zTlsSettingsView.optional(),
924
- endpoint_url: z.string().optional()
924
+ endpoint_url: z.string().optional(),
925
+ active: z.boolean().optional(),
926
+ target_latency: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }).optional()
925
927
  });
926
928
  const zSandboxFetchView = z.object({
927
929
  type: z.enum([
@@ -1111,6 +1113,9 @@ const zCreateNewSandboxRequest = z.object({
1111
1113
  timeout: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }).optional(),
1112
1114
  permissions: zPermissionsView.optional()
1113
1115
  });
1116
+ /**
1117
+ * The list of variables you can use the action
1118
+ */
1114
1119
  const zEnvironmentVariableView = z.object({
1115
1120
  id: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }).optional(),
1116
1121
  key: z.string().optional(),
@@ -1539,7 +1544,9 @@ const zTunnelViewWritable = z.object({
1539
1544
  timeout: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }).optional(),
1540
1545
  http: zHttpSettingsViewWritable.optional(),
1541
1546
  tls: zTlsSettingsViewWritable.optional(),
1542
- endpoint_url: z.string().optional()
1547
+ endpoint_url: z.string().optional(),
1548
+ active: z.boolean().optional(),
1549
+ target_latency: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }).optional()
1543
1550
  });
1544
1551
  const zUpdateSandboxRequestWritable = z.object({
1545
1552
  name: z.string().optional(),
@@ -2353,6 +2360,7 @@ const zUploadSandboxFilePath = z.object({
2353
2360
  sandbox_id: z.string(),
2354
2361
  path: z.string().regex(/.*/)
2355
2362
  });
2363
+ const zUploadSandboxFileQuery = z.object({ userName: z.string().optional().default("buddy") });
2356
2364
  /**
2357
2365
  * File uploaded successfully
2358
2366
  */
@@ -2444,7 +2452,7 @@ const zUpdateIntegrationPath = z.object({
2444
2452
  //#endregion
2445
2453
  //#region package.json
2446
2454
  var name = "@buddy-works/sandbox-sdk";
2447
- var version = "0.1.6-rc.1";
2455
+ var version = "0.1.7";
2448
2456
 
2449
2457
  //#endregion
2450
2458
  //#region src/utils/environment.ts
@@ -4066,7 +4074,12 @@ var Sandbox = class Sandbox {
4066
4074
  while (true) {
4067
4075
  await this.refresh();
4068
4076
  if (this.data.setup_status === "SUCCESS") return;
4069
- if (this.data.setup_status === "FAILED") throw new Error(`Sandbox ${sandboxId} setup failed. Status: ${this.data.setup_status}`);
4077
+ if (this.data.setup_status === "FAILED") {
4078
+ const logs = this.data.boot_logs ?? [];
4079
+ const recent = logs.slice(-20);
4080
+ const tail = recent.join("\n");
4081
+ throw new Error(`Sandbox ${sandboxId} setup failed.${tail ? `\nBoot logs (last ${recent.length} of ${logs.length} lines):\n${tail}` : " No boot logs were returned."}`);
4082
+ }
4070
4083
  if (this.data.setup_status === "STALE") throw new Error(`Sandbox ${sandboxId} setup is stale. The first_boot_commands were changed but not applied. Recreate the sandbox to apply them.`);
4071
4084
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
4072
4085
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buddy-works/sandbox-sdk",
3
- "version": "0.1.6-rc.1",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for managing sandboxes through the Buddy API",
6
6
  "main": "./dist/index.mjs",