@agentuity/sandbox 3.0.12 → 3.1.1

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 (122) hide show
  1. package/AGENTS.md +3 -3
  2. package/dist/api-reference.d.ts +1221 -0
  3. package/dist/api-reference.d.ts.map +1 -0
  4. package/dist/api-reference.js +1046 -0
  5. package/dist/api-reference.js.map +1 -0
  6. package/dist/base64.d.ts +2 -0
  7. package/dist/base64.d.ts.map +1 -0
  8. package/dist/base64.js +14 -0
  9. package/dist/base64.js.map +1 -0
  10. package/dist/client.d.ts +431 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +632 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/create.d.ts +203 -0
  15. package/dist/create.d.ts.map +1 -0
  16. package/dist/create.js +235 -0
  17. package/dist/create.js.map +1 -0
  18. package/dist/destroy.d.ts +23 -0
  19. package/dist/destroy.d.ts.map +1 -0
  20. package/dist/destroy.js +30 -0
  21. package/dist/destroy.js.map +1 -0
  22. package/dist/disk-checkpoint.d.ts +108 -0
  23. package/dist/disk-checkpoint.d.ts.map +1 -0
  24. package/dist/disk-checkpoint.js +124 -0
  25. package/dist/disk-checkpoint.js.map +1 -0
  26. package/dist/events.d.ts +56 -0
  27. package/dist/events.d.ts.map +1 -0
  28. package/dist/events.js +54 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/execute.d.ts +99 -0
  31. package/dist/execute.d.ts.map +1 -0
  32. package/dist/execute.js +138 -0
  33. package/dist/execute.js.map +1 -0
  34. package/dist/execution.d.ts +150 -0
  35. package/dist/execution.d.ts.map +1 -0
  36. package/dist/execution.js +120 -0
  37. package/dist/execution.js.map +1 -0
  38. package/dist/files.d.ts +283 -0
  39. package/dist/files.d.ts.map +1 -0
  40. package/dist/files.js +471 -0
  41. package/dist/files.js.map +1 -0
  42. package/dist/get.d.ts +288 -0
  43. package/dist/get.d.ts.map +1 -0
  44. package/dist/get.js +256 -0
  45. package/dist/get.js.map +1 -0
  46. package/dist/getStatus.d.ts +23 -0
  47. package/dist/getStatus.d.ts.map +1 -0
  48. package/dist/getStatus.js +53 -0
  49. package/dist/getStatus.js.map +1 -0
  50. package/dist/index.d.ts +42 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +22 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/job.d.ts +227 -0
  55. package/dist/job.d.ts.map +1 -0
  56. package/dist/job.js +109 -0
  57. package/dist/job.js.map +1 -0
  58. package/dist/list.d.ts +330 -0
  59. package/dist/list.d.ts.map +1 -0
  60. package/dist/list.js +209 -0
  61. package/dist/list.js.map +1 -0
  62. package/dist/pause.d.ts +39 -0
  63. package/dist/pause.d.ts.map +1 -0
  64. package/dist/pause.js +48 -0
  65. package/dist/pause.js.map +1 -0
  66. package/dist/resolve.d.ts +75 -0
  67. package/dist/resolve.d.ts.map +1 -0
  68. package/dist/resolve.js +76 -0
  69. package/dist/resolve.js.map +1 -0
  70. package/dist/resume.d.ts +23 -0
  71. package/dist/resume.d.ts.map +1 -0
  72. package/dist/resume.js +30 -0
  73. package/dist/resume.js.map +1 -0
  74. package/dist/run.d.ts +73 -0
  75. package/dist/run.d.ts.map +1 -0
  76. package/dist/run.js +568 -0
  77. package/dist/run.js.map +1 -0
  78. package/dist/runtime.d.ts +94 -0
  79. package/dist/runtime.d.ts.map +1 -0
  80. package/dist/runtime.js +82 -0
  81. package/dist/runtime.js.map +1 -0
  82. package/dist/snapshot-build.d.ts +48 -0
  83. package/dist/snapshot-build.d.ts.map +1 -0
  84. package/dist/snapshot-build.js +72 -0
  85. package/dist/snapshot-build.js.map +1 -0
  86. package/dist/snapshot.d.ts +596 -0
  87. package/dist/snapshot.d.ts.map +1 -0
  88. package/dist/snapshot.js +612 -0
  89. package/dist/snapshot.js.map +1 -0
  90. package/dist/types.d.ts +1010 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/types.js +853 -0
  93. package/dist/types.js.map +1 -0
  94. package/dist/util.d.ts +296 -0
  95. package/dist/util.d.ts.map +1 -0
  96. package/dist/util.js +234 -0
  97. package/dist/util.js.map +1 -0
  98. package/package.json +7 -2
  99. package/src/api-reference.ts +1094 -0
  100. package/src/base64.ts +14 -0
  101. package/src/client.ts +998 -0
  102. package/src/create.ts +273 -0
  103. package/src/destroy.ts +43 -0
  104. package/src/disk-checkpoint.ts +184 -0
  105. package/src/events.ts +72 -0
  106. package/src/execute.ts +167 -0
  107. package/src/execution.ts +152 -0
  108. package/src/files.ts +637 -0
  109. package/src/get.ts +291 -0
  110. package/src/getStatus.ts +72 -0
  111. package/src/index.ts +252 -18
  112. package/src/job.ts +161 -0
  113. package/src/list.ts +239 -0
  114. package/src/pause.ts +75 -0
  115. package/src/resolve.ts +96 -0
  116. package/src/resume.ts +41 -0
  117. package/src/run.ts +783 -0
  118. package/src/runtime.ts +106 -0
  119. package/src/snapshot-build.ts +94 -0
  120. package/src/snapshot.ts +791 -0
  121. package/src/types.ts +1033 -0
  122. package/src/util.ts +280 -0
@@ -0,0 +1,94 @@
1
+ import { type ListRuntimesResponse } from './types.ts';
2
+ import { z } from 'zod';
3
+ import { type APIClient } from '@agentuity/api';
4
+ export declare const RuntimeRequirementsSchema: z.ZodObject<{
5
+ memory: z.ZodOptional<z.ZodString>;
6
+ cpu: z.ZodOptional<z.ZodString>;
7
+ disk: z.ZodOptional<z.ZodString>;
8
+ networkEnabled: z.ZodBoolean;
9
+ }, z.core.$strip>;
10
+ export declare const RuntimeInfoSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ name: z.ZodString;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ iconUrl: z.ZodOptional<z.ZodString>;
15
+ brandColor: z.ZodOptional<z.ZodString>;
16
+ url: z.ZodOptional<z.ZodString>;
17
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
+ requirements: z.ZodOptional<z.ZodObject<{
19
+ memory: z.ZodOptional<z.ZodString>;
20
+ cpu: z.ZodOptional<z.ZodString>;
21
+ disk: z.ZodOptional<z.ZodString>;
22
+ networkEnabled: z.ZodBoolean;
23
+ }, z.core.$strip>>;
24
+ readme: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>;
26
+ export declare const ListRuntimesDataSchema: z.ZodObject<{
27
+ runtimes: z.ZodArray<z.ZodObject<{
28
+ id: z.ZodString;
29
+ name: z.ZodString;
30
+ description: z.ZodOptional<z.ZodString>;
31
+ iconUrl: z.ZodOptional<z.ZodString>;
32
+ brandColor: z.ZodOptional<z.ZodString>;
33
+ url: z.ZodOptional<z.ZodString>;
34
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ requirements: z.ZodOptional<z.ZodObject<{
36
+ memory: z.ZodOptional<z.ZodString>;
37
+ cpu: z.ZodOptional<z.ZodString>;
38
+ disk: z.ZodOptional<z.ZodString>;
39
+ networkEnabled: z.ZodBoolean;
40
+ }, z.core.$strip>>;
41
+ readme: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strip>>;
43
+ total: z.ZodNumber;
44
+ }, z.core.$strip>;
45
+ export declare const ListRuntimesResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ success: z.ZodLiteral<false>;
47
+ message: z.ZodString;
48
+ code: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ success: z.ZodLiteral<true>;
51
+ data: z.ZodObject<{
52
+ runtimes: z.ZodArray<z.ZodObject<{
53
+ id: z.ZodString;
54
+ name: z.ZodString;
55
+ description: z.ZodOptional<z.ZodString>;
56
+ iconUrl: z.ZodOptional<z.ZodString>;
57
+ brandColor: z.ZodOptional<z.ZodString>;
58
+ url: z.ZodOptional<z.ZodString>;
59
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
+ requirements: z.ZodOptional<z.ZodObject<{
61
+ memory: z.ZodOptional<z.ZodString>;
62
+ cpu: z.ZodOptional<z.ZodString>;
63
+ disk: z.ZodOptional<z.ZodString>;
64
+ networkEnabled: z.ZodBoolean;
65
+ }, z.core.$strip>>;
66
+ readme: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>>;
68
+ total: z.ZodNumber;
69
+ }, z.core.$strip>;
70
+ }, z.core.$strip>], "success">;
71
+ export declare const RuntimeListParamsSchema: z.ZodObject<{
72
+ limit: z.ZodOptional<z.ZodNumber>;
73
+ offset: z.ZodOptional<z.ZodNumber>;
74
+ sort: z.ZodOptional<z.ZodEnum<{
75
+ created: "created";
76
+ name: "name";
77
+ }>>;
78
+ direction: z.ZodOptional<z.ZodEnum<{
79
+ asc: "asc";
80
+ desc: "desc";
81
+ }>>;
82
+ orgId: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strip>;
84
+ export type RuntimeListParams = z.infer<typeof RuntimeListParamsSchema>;
85
+ /**
86
+ * Lists available sandbox runtimes with optional pagination.
87
+ *
88
+ * @param client - The API client to use for the request
89
+ * @param params - Optional parameters for pagination
90
+ * @returns List of runtimes with total count
91
+ * @throws {SandboxResponseError} If the request fails
92
+ */
93
+ export declare function runtimeList(client: APIClient, params?: RuntimeListParams): Promise<ListRuntimesResponse>;
94
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,oBAAoB,EAEzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAGnE,eAAO,MAAM,yBAAyB;;;;;iBAOK,CAAC;AAE5C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;iBAYmB,CAAC;AAElD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAKG,CAAC;AAEvC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;8BAA4C,CAAC;AAEpF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;iBAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CA+C/B"}
@@ -0,0 +1,82 @@
1
+ import { ListRuntimesParamsSchema, } from './types.js';
2
+ import { z } from 'zod';
3
+ import { APIResponseSchema } from '@agentuity/api';
4
+ import { throwSandboxError } from './util.js';
5
+ export const RuntimeRequirementsSchema = z
6
+ .object({
7
+ memory: z.string().optional().describe('Memory requirement (e.g., "1Gi")'),
8
+ cpu: z.string().optional().describe('CPU requirement (e.g., "1")'),
9
+ disk: z.string().optional().describe('Disk requirement (e.g., "500Mi")'),
10
+ networkEnabled: z.boolean().describe('Whether network access is enabled'),
11
+ })
12
+ .describe('Runtime resource requirements');
13
+ export const RuntimeInfoSchema = z
14
+ .object({
15
+ id: z.string().describe('Unique runtime identifier'),
16
+ name: z.string().describe('Runtime name (e.g., "bun:1", "python:3.14")'),
17
+ description: z.string().optional().describe('Optional description'),
18
+ iconUrl: z.string().optional().describe('URL for runtime icon'),
19
+ brandColor: z.string().optional().describe('Brand color for the runtime (hex color code)'),
20
+ url: z.string().optional().describe('URL for runtime documentation or homepage'),
21
+ tags: z.array(z.string()).optional().describe('Optional tags for categorization'),
22
+ requirements: RuntimeRequirementsSchema.optional().describe('Runtime resource requirements'),
23
+ readme: z.string().optional().describe('Readme content in markdown format'),
24
+ })
25
+ .describe('Information about a sandbox runtime');
26
+ export const ListRuntimesDataSchema = z
27
+ .object({
28
+ runtimes: z.array(RuntimeInfoSchema).describe('List of runtime entries'),
29
+ total: z.number().describe('Total number of runtimes'),
30
+ })
31
+ .describe('List of sandbox runtimes');
32
+ export const ListRuntimesResponseSchema = APIResponseSchema(ListRuntimesDataSchema);
33
+ export const RuntimeListParamsSchema = ListRuntimesParamsSchema.extend({
34
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
35
+ });
36
+ /**
37
+ * Lists available sandbox runtimes with optional pagination.
38
+ *
39
+ * @param client - The API client to use for the request
40
+ * @param params - Optional parameters for pagination
41
+ * @returns List of runtimes with total count
42
+ * @throws {SandboxResponseError} If the request fails
43
+ */
44
+ export async function runtimeList(client, params) {
45
+ const queryParams = new URLSearchParams();
46
+ if (params?.orgId) {
47
+ queryParams.set('orgId', params.orgId);
48
+ }
49
+ if (params?.limit !== undefined) {
50
+ queryParams.set('limit', params.limit.toString());
51
+ }
52
+ if (params?.offset !== undefined) {
53
+ queryParams.set('offset', params.offset.toString());
54
+ }
55
+ if (params?.sort) {
56
+ queryParams.set('sort', params.sort);
57
+ }
58
+ if (params?.direction) {
59
+ queryParams.set('direction', params.direction);
60
+ }
61
+ const queryString = queryParams.toString();
62
+ const url = `/sandbox/runtimes${queryString ? `?${queryString}` : ''}`;
63
+ const resp = await client.get(url, ListRuntimesResponseSchema);
64
+ if (resp.success) {
65
+ return {
66
+ runtimes: resp.data.runtimes.map((r) => ({
67
+ id: r.id,
68
+ name: r.name,
69
+ description: r.description,
70
+ iconUrl: r.iconUrl,
71
+ brandColor: r.brandColor,
72
+ url: r.url,
73
+ tags: r.tags,
74
+ requirements: r.requirements,
75
+ readme: r.readme,
76
+ })),
77
+ total: resp.data.total,
78
+ };
79
+ }
80
+ throwSandboxError(resp, {});
81
+ }
82
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,GAGxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,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0 +1,48 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Regex pattern for validating npm/bun package specifiers.
4
+ * Uses a blocklist approach: rejects shell injection characters while allowing
5
+ * all legitimate specifier formats (names, scoped packages, URLs, git refs, etc.).
6
+ *
7
+ * Valid examples: "typescript", "@types/node", "opencode-ai@1.2.3",
8
+ * "https://github.com/user/repo", "git+https://github.com/user/repo.git",
9
+ * "github:user/repo", "file:../local-pkg"
10
+ * Invalid examples: "foo bar", "pkg;rm -rf", "pkg|cat /etc/passwd", "$(evil)"
11
+ */
12
+ export declare const NPM_PACKAGE_NAME_PATTERN: RegExp;
13
+ /**
14
+ * Base schema for snapshot build configuration file (agentuity-snapshot.yaml)
15
+ * This is the canonical schema - used for JSON Schema generation.
16
+ */
17
+ export declare const SnapshotBuildFileBaseSchema: z.ZodObject<{
18
+ version: z.ZodLiteral<1>;
19
+ runtime: z.ZodString;
20
+ name: z.ZodOptional<z.ZodString>;
21
+ description: z.ZodOptional<z.ZodString>;
22
+ dir: z.ZodOptional<z.ZodString>;
23
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
27
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
28
+ public: z.ZodOptional<z.ZodBoolean>;
29
+ }, z.core.$strip>;
30
+ /**
31
+ * Schema with validation refinement - use this for parsing/validation.
32
+ * Ensures at least one of dependencies, files, env, or packages is specified.
33
+ */
34
+ export declare const SnapshotBuildFileSchema: z.ZodObject<{
35
+ version: z.ZodLiteral<1>;
36
+ runtime: z.ZodString;
37
+ name: z.ZodOptional<z.ZodString>;
38
+ description: z.ZodOptional<z.ZodString>;
39
+ dir: z.ZodOptional<z.ZodString>;
40
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
44
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
45
+ public: z.ZodOptional<z.ZodBoolean>;
46
+ }, z.core.$strip>;
47
+ export type SnapshotBuildFile = z.infer<typeof SnapshotBuildFileSchema>;
48
+ //# sourceMappingURL=snapshot-build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-build.d.ts","sourceRoot":"","sources":["../src/snapshot-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,QAAiB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;iBAwDgD,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;iBAWnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Regex pattern for validating npm/bun package specifiers.
4
+ * Uses a blocklist approach: rejects shell injection characters while allowing
5
+ * all legitimate specifier formats (names, scoped packages, URLs, git refs, etc.).
6
+ *
7
+ * Valid examples: "typescript", "@types/node", "opencode-ai@1.2.3",
8
+ * "https://github.com/user/repo", "git+https://github.com/user/repo.git",
9
+ * "github:user/repo", "file:../local-pkg"
10
+ * Invalid examples: "foo bar", "pkg;rm -rf", "pkg|cat /etc/passwd", "$(evil)"
11
+ */
12
+ export const NPM_PACKAGE_NAME_PATTERN = /^[^\s;`|$]+$/;
13
+ /**
14
+ * Base schema for snapshot build configuration file (agentuity-snapshot.yaml)
15
+ * This is the canonical schema - used for JSON Schema generation.
16
+ */
17
+ export const SnapshotBuildFileBaseSchema = z
18
+ .object({
19
+ version: z.literal(1).describe('Schema version, must be 1'),
20
+ runtime: z
21
+ .string()
22
+ .describe('Runtime identifier (name:tag format, e.g., bun:1, node:20, python:3.12)'),
23
+ name: z
24
+ .string()
25
+ .regex(/^[a-zA-Z0-9_-]+$/)
26
+ .optional()
27
+ .describe('Snapshot name (alphanumeric, underscores, dashes only)'),
28
+ description: z.string().optional().describe('Human-readable description of the snapshot'),
29
+ dir: z
30
+ .string()
31
+ .optional()
32
+ .describe('Subdirectory to use as the build context for file resolution (relative to the CLI directory argument)'),
33
+ dependencies: z
34
+ .array(z.string())
35
+ .optional()
36
+ .describe('List of apt packages to install. Supports version pinning: package=version or package=version* for prefix matching'),
37
+ packages: z
38
+ .array(z
39
+ .string()
40
+ .regex(NPM_PACKAGE_NAME_PATTERN, 'Invalid npm/bun package specifier: must not contain whitespace, semicolons, backticks, pipes, or dollar signs'))
41
+ .optional()
42
+ .describe('List of npm/bun packages to install globally via bun install -g. Example: opencode-ai, typescript'),
43
+ files: z
44
+ .array(z.string())
45
+ .optional()
46
+ .describe('Glob patterns for files to include from the build context. Supports negative patterns with ! prefix for exclusions'),
47
+ env: z.record(z.string(), z.string()).optional().describe(
48
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: describes the ${VAR} substitution syntax for users
49
+ 'Environment variables to set. Use ${VAR} syntax for build-time substitution via --env flag'),
50
+ metadata: z.record(z.string(), z.string()).optional().describe(
51
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: describes the ${VAR} substitution syntax for users
52
+ 'User-defined metadata key-value pairs. Use ${VAR} syntax for build-time substitution via --metadata flag'),
53
+ public: z
54
+ .boolean()
55
+ .optional()
56
+ .describe('Whether to make the snapshot publicly accessible (default: false)'),
57
+ })
58
+ .describe('Agentuity Snapshot Build File - defines a reproducible sandbox environment');
59
+ /**
60
+ * Schema with validation refinement - use this for parsing/validation.
61
+ * Ensures at least one of dependencies, files, env, or packages is specified.
62
+ */
63
+ export const SnapshotBuildFileSchema = SnapshotBuildFileBaseSchema.refine((data) => {
64
+ const hasDependencies = data.dependencies && data.dependencies.length > 0;
65
+ const hasFiles = data.files && data.files.length > 0;
66
+ const hasEnv = data.env && Object.keys(data.env).length > 0;
67
+ const hasPackages = data.packages && data.packages.length > 0;
68
+ return hasDependencies || hasFiles || hasEnv || hasPackages;
69
+ }, {
70
+ message: 'At least one of dependencies, files, env, or packages must be specified',
71
+ });
72
+ //# sourceMappingURL=snapshot-build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-build.js","sourceRoot":"","sources":["../src/snapshot-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC3D,OAAO,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,yEAAyE,CAAC;IACrF,IAAI,EAAE,CAAC;SACL,MAAM,EAAE;SACR,KAAK,CAAC,kBAAkB,CAAC;SACzB,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;IACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACzF,GAAG,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACR,uGAAuG,CACvG;IACF,YAAY,EAAE,CAAC;SACb,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACR,oHAAoH,CACpH;IACF,QAAQ,EAAE,CAAC;SACT,KAAK,CACL,CAAC;SACC,M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