@buddy-works/sandbox-sdk 0.1.5 → 0.1.6-rc.0

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 (4) hide show
  1. package/README.md +22 -0
  2. package/dist/index.d.mts +134 -36
  3. package/dist/index.mjs +1636 -1556
  4. package/package.json +66 -65
package/README.md CHANGED
@@ -56,6 +56,7 @@ const sandbox = await Sandbox.create({
56
56
  os: "ubuntu:24.04",
57
57
  first_boot_commands: "apt-get update && apt-get install -y curl",
58
58
  apps: ["node server.js", "python worker.py"],
59
+ timeout: 600, // auto-stop after 10 minutes of inactivity
59
60
  });
60
61
 
61
62
  // List apps
@@ -73,6 +74,27 @@ const { logs } = await sandbox.getAppLogs(appId);
73
74
  console.log(logs);
74
75
  ```
75
76
 
77
+ ## Fetching repositories and artifacts
78
+
79
+ Use `fetch` to clone repositories or download artifacts into the sandbox on
80
+ first boot. Each entry sets a `type` (`PROJECT_REPO`, `PUBLIC_REPO`, or
81
+ `ARTIFACT`) plus the fields relevant to it.
82
+
83
+ ```typescript
84
+ await Sandbox.create({
85
+ identifier: "my-sandbox",
86
+ fetch: [
87
+ {
88
+ type: "PUBLIC_REPO",
89
+ repository: "https://github.com/octocat/Hello-World",
90
+ ref: "master",
91
+ path: "/workspace/hello",
92
+ build_command: "echo built",
93
+ },
94
+ ],
95
+ });
96
+ ```
97
+
76
98
  ## Regions
77
99
 
78
100
  Configure the API region:
package/dist/index.d.mts CHANGED
@@ -10,7 +10,7 @@ type GroupPermissionView = {
10
10
  /**
11
11
  * The access level for the group
12
12
  */
13
- access_level?: "DENIED" | "READ_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT" | "USE_ONLY";
13
+ access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
14
14
  };
15
15
  type UserPermissionView = {
16
16
  /**
@@ -20,7 +20,24 @@ type UserPermissionView = {
20
20
  /**
21
21
  * The access level for the user
22
22
  */
23
- access_level?: "DENIED" | "READ_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT" | "USE_ONLY";
23
+ access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
24
+ };
25
+ /**
26
+ * Access permissions configuration
27
+ */
28
+ type PermissionsView = {
29
+ /**
30
+ * Access level for other workspace members
31
+ */
32
+ others?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
33
+ /**
34
+ * List of specific users with their access levels
35
+ */
36
+ users?: Array<UserPermissionView>;
37
+ /**
38
+ * List of user groups with their access levels
39
+ */
40
+ groups?: Array<GroupPermissionView>;
24
41
  };
25
42
  type IdsView = {
26
43
  /**
@@ -48,17 +65,37 @@ type IdsView = {
48
65
  */
49
66
  environment_id?: string;
50
67
  /**
51
- * The ID of the package
68
+ * The ID of the artifact
52
69
  */
53
- pkg_id?: string;
70
+ artifact_id?: string;
54
71
  /**
55
- * The ID of the package version
72
+ * The ID of the artifact version
56
73
  */
57
- pkg_version_id?: string;
74
+ artifact_version_id?: string;
58
75
  /**
59
76
  * The ID of the sandbox
60
77
  */
61
78
  sandbox_id?: string;
79
+ /**
80
+ * The ID of the unit test suite
81
+ */
82
+ unit_test_suite_id?: string;
83
+ /**
84
+ * The ID of the visual test suite
85
+ */
86
+ visual_test_suite_id?: string;
87
+ /**
88
+ * The ID of the crawl suite
89
+ */
90
+ crawl_suite_id?: string;
91
+ /**
92
+ * The ID of the distribution
93
+ */
94
+ distribution_id?: string;
95
+ /**
96
+ * The ID of the route
97
+ */
98
+ route_id?: string;
62
99
  };
63
100
  /**
64
101
  * Sandbox reference
@@ -120,7 +157,7 @@ type IntegrationIdView = {
120
157
  /**
121
158
  * The type of integration
122
159
  */
123
- type?: "GIT_HUB" | "BITBUCKET" | "GOOGLE" | "DIGITAL_OCEAN" | "SLACK" | "MODULUS" | "HEROKU" | "AMAZON" | "GIT_LAB" | "SHOPIFY" | "GIT_HUB_ENTERPRISE" | "GIT_LAB_ENTERPRISE" | "PUSHOVER" | "PUSHBULLET" | "RACKSPACE" | "CUSTOM" | "CLOUDFLARE" | "NEW_RELIC" | "SENTRY" | "ROLLBAR" | "DATADOG" | "DO_SPACES" | "HONEYBADGER" | "VULTR" | "SENTRY_ENTERPRISE" | "LOGGLY" | "HIP_CHAT" | "FIREBASE" | "TELEGRAM" | "AZURE" | "UPCLOUD" | "GHOST_INSPECTOR" | "NETLIFY" | "AZURE_CLOUD" | "MICROSOFT_TEAMS" | "GOOGLE_SERVICE_ACCOUNT" | "GOOGLE_PLAY_STORE" | "DOCKER_HUB" | "APP_STORE" | "GIT_HUB_APP" | "GIT_HUB_APP_ENTERPRISE" | "GIT_HUB_API" | "ATOP" | "SNYK" | "STACK_HAWK" | "BLACKFIRE" | "BACKBLAZE" | "ONE_LOGIN" | "OKTA" | "CONTENTFUL" | "JIRA";
160
+ type?: "GIT_HUB" | "BITBUCKET" | "GOOGLE" | "DIGITAL_OCEAN" | "SLACK" | "MODULUS" | "HEROKU" | "AMAZON" | "GIT_LAB" | "SHOPIFY" | "GIT_HUB_ENTERPRISE" | "GIT_LAB_ENTERPRISE" | "PUSHOVER" | "PUSHBULLET" | "RACKSPACE" | "CUSTOM" | "CLOUDFLARE" | "NEW_RELIC" | "SENTRY" | "ROLLBAR" | "DATADOG" | "DO_SPACES" | "HONEYBADGER" | "VULTR" | "SENTRY_ENTERPRISE" | "LOGGLY" | "HIP_CHAT" | "FIREBASE" | "TELEGRAM" | "AZURE" | "UPCLOUD" | "GHOST_INSPECTOR" | "NETLIFY" | "AZURE_CLOUD" | "MICROSOFT_TEAMS" | "GOOGLE_SERVICE_ACCOUNT" | "GOOGLE_PLAY_STORE" | "DOCKER_HUB" | "APP_STORE" | "GIT_HUB_APP" | "GIT_HUB_APP_ENTERPRISE" | "GIT_HUB_API" | "ATOP" | "SNYK" | "STACK_HAWK" | "BLACKFIRE" | "BACKBLAZE" | "ONE_LOGIN" | "OKTA" | "CONTENTFUL" | "JIRA" | "NPM_REGISTRY" | "ANTHROPIC";
124
161
  /**
125
162
  * The authentication method used by the integration
126
163
  */
@@ -275,23 +312,6 @@ type ProjectView = {
275
312
  */
276
313
  without_repository?: boolean;
277
314
  };
278
- /**
279
- * Access permissions configuration
280
- */
281
- type PermissionsView = {
282
- /**
283
- * Access level for other workspace members
284
- */
285
- others?: "DENIED" | "READ_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT" | "USE_ONLY";
286
- /**
287
- * List of specific users with their access levels
288
- */
289
- users?: Array<UserPermissionView>;
290
- /**
291
- * List of user groups with their access levels
292
- */
293
- groups?: Array<GroupPermissionView>;
294
- };
295
315
  /**
296
316
  * The TLS/SSL encryption settings of the tunnel
297
317
  */
@@ -414,6 +434,32 @@ type TunnelView = {
414
434
  */
415
435
  endpoint_url?: string;
416
436
  };
437
+ type SandboxFetchView = {
438
+ /**
439
+ * The type of the fetch item: PROJECT_REPO, PUBLIC_REPO, or ARTIFACT
440
+ */
441
+ type?: "PROJECT_REPO" | "PUBLIC_REPO" | "ARTIFACT";
442
+ /**
443
+ * The URL of the git repository (for PUBLIC_REPO type)
444
+ */
445
+ repository?: string;
446
+ /**
447
+ * The branch, tag, or commit to checkout. Defaults to the default branch
448
+ */
449
+ ref?: string;
450
+ /**
451
+ * The target path where the item will be cloned/downloaded. Defaults to the app directory
452
+ */
453
+ path?: string;
454
+ /**
455
+ * The command to run after fetching
456
+ */
457
+ build_command?: string;
458
+ /**
459
+ * The artifact identifier in format pkg:version (for ARTIFACT type)
460
+ */
461
+ artifact?: string;
462
+ };
417
463
  type SandboxAppView = {
418
464
  /**
419
465
  * The auto-generated ID of the app
@@ -607,15 +653,15 @@ type EnvironmentVariableView = {
607
653
  */
608
654
  defaults?: string;
609
655
  /**
610
- * Specifies where to copy the file on each run. Set if `type` is `SSH_KEY`
656
+ * Specifies where to copy the file on each run. Set if `type` is `FILE`, `SSH_KEY`, `SSH_PUBLIC_KEY`, `IOS_KEYCHAIN`, or `IOS_PROVISION_PROFILES`
611
657
  */
612
658
  file_path?: string;
613
659
  /**
614
- * File permission set on copy to a container on each run. Set if `type` is `SSH_KEY`
660
+ * File permission set on copy to a container on each run. Set if `type` is `FILE`, `SSH_KEY`, `SSH_PUBLIC_KEY`, `IOS_KEYCHAIN`, or `IOS_PROVISION_PROFILES`
615
661
  */
616
662
  file_chmod?: string;
617
663
  /**
618
- * Set if `type` is `SSH_KEY`. If it's `NONE`, the variable can be used as a parameter in an action. For `CONTAINER`, the given key is additionally copied to an action container on each run
664
+ * Set if `type` is `FILE`, `SSH_KEY`, `SSH_PUBLIC_KEY`, `IOS_KEYCHAIN`, or `IOS_PROVISION_PROFILES`. If it's `NONE`, the variable can be used as a parameter in an action. For `CONTAINER`, the given key is additionally copied to an action container on each run
619
665
  */
620
666
  file_place?: "NONE" | "CONTAINER";
621
667
  /**
@@ -643,9 +689,13 @@ type EnvironmentVariableView = {
643
689
  */
644
690
  passphrase?: string;
645
691
  /**
646
- * GPG key identifier
692
+ * Key identifier for iOS certificates, provisioning profiles, or GPG keys
647
693
  */
648
694
  key_identifier?: string;
695
+ /**
696
+ * Set to `true` to disable the variable. Disabled variables are not injected anywhere
697
+ */
698
+ disabled?: boolean;
649
699
  };
650
700
  type CloneSandboxRequest = {
651
701
  /**
@@ -710,6 +760,10 @@ type SandboxResponse = {
710
760
  * The list of apps (run commands) for the sandbox
711
761
  */
712
762
  apps?: Array<SandboxAppView>;
763
+ /**
764
+ * The list of items (repositories and artifacts) to fetch into the sandbox
765
+ */
766
+ fetch?: Array<SandboxFetchView>;
713
767
  /**
714
768
  * The timeout in seconds after which the sandbox will be automatically stopped
715
769
  */
@@ -726,6 +780,14 @@ type SandboxResponse = {
726
780
  * The tunnel endpoints of the sandbox
727
781
  */
728
782
  endpoints?: Array<TunnelView>;
783
+ /**
784
+ * The SSH hostname
785
+ */
786
+ ssh_host?: string;
787
+ /**
788
+ * The SSH port
789
+ */
790
+ ssh_port?: number;
729
791
  project?: ProjectView;
730
792
  permissions?: PermissionsView;
731
793
  /**
@@ -770,15 +832,15 @@ type AddVariableInObjectRequestWritable = {
770
832
  */
771
833
  defaults?: string;
772
834
  /**
773
- * Specifies where to copy the file on each run. Set if `type` is `SSH_KEY`
835
+ * Specifies where to copy the file on each run. Set if `type` is `FILE`, `SSH_KEY`, `SSH_PUBLIC_KEY`, `IOS_KEYCHAIN`, or `IOS_PROVISION_PROFILES`
774
836
  */
775
837
  file_path?: string;
776
838
  /**
777
- * File permission set on copy to a container on each run. Set if `type` is `SSH_KEY`
839
+ * File permission set on copy to a container on each run. Set if `type` is `FILE`, `SSH_KEY`, `SSH_PUBLIC_KEY`, `IOS_KEYCHAIN`, or `IOS_PROVISION_PROFILES`
778
840
  */
779
841
  file_chmod?: string;
780
842
  /**
781
- * Set if `type` is `SSH_KEY`. If it's `NONE`, the variable can be used as a parameter in an action. For `CONTAINER`, the given key is additionally copied to an action container on each run
843
+ * Set if `type` is `FILE`, `SSH_KEY`, `SSH_PUBLIC_KEY`, `IOS_KEYCHAIN`, or `IOS_PROVISION_PROFILES`. If it's `NONE`, the variable can be used as a parameter in an action. For `CONTAINER`, the given key is additionally copied to an action container on each run
782
844
  */
783
845
  file_place?: "NONE" | "CONTAINER";
784
846
  /**
@@ -790,9 +852,13 @@ type AddVariableInObjectRequestWritable = {
790
852
  */
791
853
  passphrase?: string;
792
854
  /**
793
- * GPG key identifier
855
+ * Key identifier for iOS certificates, provisioning profiles, or GPG keys
794
856
  */
795
857
  key_identifier?: string;
858
+ /**
859
+ * Set to `true` to disable the variable. Disabled variables are not injected anywhere
860
+ */
861
+ disabled?: boolean;
796
862
  /**
797
863
  * The type of the added variable
798
864
  */
@@ -945,6 +1011,10 @@ type CreateNewSandboxRequestWritable = {
945
1011
  * The list of apps (run commands) for the sandbox
946
1012
  */
947
1013
  apps?: Array<string>;
1014
+ /**
1015
+ * The list of items (repositories and artifacts) to fetch into the sandbox
1016
+ */
1017
+ fetch?: Array<SandboxFetchView>;
948
1018
  /**
949
1019
  * The list of tags associated with the sandbox
950
1020
  */
@@ -1031,17 +1101,45 @@ type GetIdentifiersData = {
1031
1101
  */
1032
1102
  environment?: string;
1033
1103
  /**
1034
- * The human-readable ID of the package
1104
+ * The human-readable ID of the artifact
1035
1105
  */
1036
- package?: string;
1106
+ artifact?: string;
1037
1107
  /**
1038
- * The version of the package
1108
+ * The version of the artifact
1039
1109
  */
1040
- package_version?: string;
1110
+ artifact_version?: string;
1041
1111
  /**
1042
1112
  * The human-readable ID of the sandbox
1043
1113
  */
1044
1114
  sandbox?: string;
1115
+ /**
1116
+ * The human-readable ID of the unit test suite
1117
+ */
1118
+ unit_test_suite?: string;
1119
+ /**
1120
+ * The human-readable ID of the visual test suite
1121
+ */
1122
+ visual_test_suite?: string;
1123
+ /**
1124
+ * The human-readable ID of the crawl suite
1125
+ */
1126
+ crawl_suite?: string;
1127
+ /**
1128
+ * The human-readable ID of the distribution
1129
+ */
1130
+ distribution?: string;
1131
+ /**
1132
+ * The subdomain of the route. Resolved together with route_domain and route_path against the parent distribution.
1133
+ */
1134
+ route_subdomain?: string;
1135
+ /**
1136
+ * The domain of the route. Required to resolve a route.
1137
+ */
1138
+ route_domain?: string;
1139
+ /**
1140
+ * The path of the route. Resolved together with route_subdomain and route_domain against the parent distribution.
1141
+ */
1142
+ route_path?: string;
1045
1143
  };
1046
1144
  url: "/workspaces/{workspace_domain}/identifiers";
1047
1145
  };