@containerbase/base 14.41.1 → 14.43.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.
package/README.md CHANGED
@@ -47,6 +47,16 @@ import { defaultDistro } from '@containerbase/base';
47
47
  defaultDistro; // 'noble'
48
48
  ```
49
49
 
50
+ The format of the published [tool-versions](https://github.com/containerbase/tool-versions/blob/main/docs/format.md) data is exported too, so its readers share one definition.
51
+ The zod schemas (`ToolVersions`, `VersionFiles`, `VersionIntegrity`, `ToolIndex`, `FormatIndex` and their parts) live behind the `zod` entry point, the zod free types behind the main one:
52
+
53
+ ```ts
54
+ import { ToolVersions } from '@containerbase/base/zod';
55
+ import type { ToolVersions as ToolVersionsType } from '@containerbase/base';
56
+ ```
57
+
58
+ The schemas ignore unknown keys and accept any arch name, so additive changes of the format don't break a reader; readers ignore files of an arch they don't know.
59
+
50
60
  ## Contents
51
61
 
52
62
  Each entry may carry the following metadata:
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { tools } from './data.ts';
2
2
  import type { DistroCode } from './types.ts';
3
3
  export type { DistroCode, InstallToolType, ToolMetadata, ToolType, } from './types.ts';
4
+ export type { FileIntegrity, FileReference, FormatIndex, ToolFile, ToolIndex, ToolVersion, ToolVersions, VersionFiles, VersionIntegrity, } from './tool-versions-types.ts';
4
5
  export { tools };
5
6
  /**
6
7
  * The Ubuntu release the default containerbase image is built from, the
@@ -0,0 +1,125 @@
1
+ import { z } from 'zod';
2
+ /** A file of a version: where to download it and how to verify it. */
3
+ export declare const ToolFile: z.ZodObject<{
4
+ name: z.ZodString;
5
+ url: z.ZodURL;
6
+ checksum: z.ZodString;
7
+ arch: z.ZodExactOptional<z.ZodString>;
8
+ distro: z.ZodExactOptional<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ /**
11
+ * An SRI-style sha256 digest of a published file's bytes, like npm's
12
+ * `integrity`.
13
+ */
14
+ export declare const FileIntegrity: z.ZodString;
15
+ /**
16
+ * A version `install-tool` can install, the flags are only set when true and
17
+ * `files` and `releaseTimestamp` only when known.
18
+ */
19
+ export declare const ToolVersion: z.ZodObject<{
20
+ version: z.ZodString;
21
+ prerelease: z.ZodExactOptional<z.ZodLiteral<true>>;
22
+ lts: z.ZodExactOptional<z.ZodLiteral<true>>;
23
+ releaseTimestamp: z.ZodExactOptional<z.ZodISODateTime>;
24
+ files: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
25
+ name: z.ZodString;
26
+ url: z.ZodURL;
27
+ checksum: z.ZodString;
28
+ arch: z.ZodExactOptional<z.ZodString>;
29
+ distro: z.ZodExactOptional<z.ZodString>;
30
+ }, z.core.$strip>>>;
31
+ constraints: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
32
+ }, z.core.$strip>;
33
+ /** The content of a `<tool>.json` file. */
34
+ export declare const ToolVersions: z.ZodObject<{
35
+ $schema: z.ZodExactOptional<z.ZodURL>;
36
+ tool: z.ZodString;
37
+ type: z.ZodExactOptional<z.ZodEnum<{
38
+ gem: "gem";
39
+ npm: "npm";
40
+ pip: "pip";
41
+ dotnet: "dotnet";
42
+ }>>;
43
+ sourceUrl: z.ZodExactOptional<z.ZodURL>;
44
+ homepage: z.ZodExactOptional<z.ZodURL>;
45
+ minVersion: z.ZodExactOptional<z.ZodString>;
46
+ distroMinVersion: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
47
+ updatedAt: z.ZodISODateTime;
48
+ versions: z.ZodArray<z.ZodObject<{
49
+ version: z.ZodString;
50
+ prerelease: z.ZodExactOptional<z.ZodLiteral<true>>;
51
+ lts: z.ZodExactOptional<z.ZodLiteral<true>>;
52
+ releaseTimestamp: z.ZodExactOptional<z.ZodISODateTime>;
53
+ files: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
54
+ name: z.ZodString;
55
+ url: z.ZodURL;
56
+ checksum: z.ZodString;
57
+ arch: z.ZodExactOptional<z.ZodString>;
58
+ distro: z.ZodExactOptional<z.ZodString>;
59
+ }, z.core.$strip>>>;
60
+ constraints: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
61
+ }, z.core.$strip>>;
62
+ }, z.core.$strip>;
63
+ /** The content of a `<tool>/<version>.json` file: the files of one version. */
64
+ export declare const VersionFiles: z.ZodObject<{
65
+ $schema: z.ZodExactOptional<z.ZodURL>;
66
+ tool: z.ZodString;
67
+ version: z.ZodString;
68
+ files: z.ZodArray<z.ZodObject<{
69
+ name: z.ZodString;
70
+ url: z.ZodURL;
71
+ checksum: z.ZodString;
72
+ arch: z.ZodExactOptional<z.ZodString>;
73
+ distro: z.ZodExactOptional<z.ZodString>;
74
+ }, z.core.$strip>>;
75
+ }, z.core.$strip>;
76
+ /**
77
+ * The content of a `<tool>.integrity.json` file: the integrity of each
78
+ * `<tool>/<version>.json` file, by version.
79
+ */
80
+ export declare const VersionIntegrity: z.ZodObject<{
81
+ $schema: z.ZodExactOptional<z.ZodURL>;
82
+ tool: z.ZodString;
83
+ versions: z.ZodRecord<z.ZodString, z.ZodString>;
84
+ }, z.core.$strip>;
85
+ /** A published file and the integrity of its bytes. */
86
+ export declare const FileReference: z.ZodObject<{
87
+ file: z.ZodString;
88
+ integrity: z.ZodString;
89
+ }, z.core.$strip>;
90
+ /** The content of the `v1/index.json` file. */
91
+ export declare const ToolIndex: z.ZodObject<{
92
+ $schema: z.ZodExactOptional<z.ZodURL>;
93
+ updatedAt: z.ZodISODateTime;
94
+ tools: z.ZodArray<z.ZodObject<{
95
+ tool: z.ZodString;
96
+ versionCount: z.ZodNumber;
97
+ slim: z.ZodObject<{
98
+ file: z.ZodString;
99
+ integrity: z.ZodString;
100
+ }, z.core.$strip>;
101
+ versionFiles: z.ZodExactOptional<z.ZodObject<{
102
+ file: z.ZodString;
103
+ integrity: z.ZodString;
104
+ }, z.core.$strip>>;
105
+ }, z.core.$strip>>;
106
+ }, z.core.$strip>;
107
+ /**
108
+ * The content of the root `index.json` file, which lists the published formats.
109
+ * It is minimal and stable: consumers pin a major version of the format and
110
+ * only read it to warn when their major is deprecated.
111
+ */
112
+ export declare const FormatIndex: z.ZodObject<{
113
+ $schema: z.ZodExactOptional<z.ZodURL>;
114
+ defaultDistro: z.ZodString;
115
+ formats: z.ZodArray<z.ZodObject<{
116
+ version: z.ZodNumber;
117
+ path: z.ZodString;
118
+ status: z.ZodEnum<{
119
+ current: "current";
120
+ preview: "preview";
121
+ deprecated: "deprecated";
122
+ }>;
123
+ removalDate: z.ZodExactOptional<z.ZodISODate>;
124
+ }, z.core.$strip>>;
125
+ }, z.core.$strip>;
@@ -0,0 +1,150 @@
1
+ import { z } from 'zod';
2
+ import { ToolType } from "./schema.js";
3
+ // Reader schemas of the published tool-versions format, see
4
+ // https://github.com/containerbase/tool-versions/blob/main/docs/format.md
5
+ //
6
+ // Keep in sync with the interfaces in `tool-versions-types.ts`, which are the
7
+ // zod free version used by the default export. The objects are plain
8
+ // `z.object`s, so unknown keys are dropped and additive changes of the format
9
+ // don't break readers. Optionals are exact, so the inferred types match the
10
+ // interfaces.
11
+ /** A file of a version: where to download it and how to verify it. */
12
+ export const ToolFile = z.object({
13
+ /** the file name */
14
+ name: z.string().min(1),
15
+ /** the https download url */
16
+ url: z.url({ protocol: /^https$/ }),
17
+ /** `<algorithm>:<lowercase hex>` */
18
+ checksum: z
19
+ .string()
20
+ .regex(/^(sha1:[0-9a-f]{40}|sha256:[0-9a-f]{64}|sha512:[0-9a-f]{128})$/),
21
+ /**
22
+ * the containerbase arch, like `amd64`, omitted for arch-independent files;
23
+ * readers ignore files of an arch they don't know
24
+ */
25
+ arch: z.string().min(1).exactOptional(),
26
+ /** the distro of a distro specific file, like `jammy` */
27
+ distro: z.string().min(1).exactOptional(),
28
+ });
29
+ /**
30
+ * An SRI-style sha256 digest of a published file's bytes, like npm's
31
+ * `integrity`.
32
+ */
33
+ export const FileIntegrity = z.string().regex(/^sha256-[0-9A-Za-z+/]{43}=$/);
34
+ /**
35
+ * A version `install-tool` can install, the flags are only set when true and
36
+ * `files` and `releaseTimestamp` only when known.
37
+ */
38
+ export const ToolVersion = z.object({
39
+ version: z.string().min(1),
40
+ prerelease: z.literal(true).exactOptional(),
41
+ lts: z.literal(true).exactOptional(),
42
+ /** when the version was released, in UTC */
43
+ releaseTimestamp: z.iso.datetime().exactOptional(),
44
+ /**
45
+ * sorted by name, not in the `<tool>.json` files, but in the
46
+ * `<tool>/<version>.json` ones
47
+ */
48
+ files: z.array(ToolFile).min(1).exactOptional(),
49
+ /**
50
+ * the runtime constraint of this version per parent tool, like
51
+ * `{ node: '>=20.17.0' }`, as the raw string in the registry's syntax, only
52
+ * present when the registry has one
53
+ */
54
+ constraints: z.record(z.string().min(1), z.string().min(1)).exactOptional(),
55
+ });
56
+ /**
57
+ * The url of the json schema of a published file, which identifies its format.
58
+ * It is the first property, optional so files published before it was added
59
+ * still parse.
60
+ */
61
+ const SchemaUrl = z.url({ protocol: /^https$/ }).exactOptional();
62
+ /** The content of a `<tool>.json` file. */
63
+ export const ToolVersions = z.object({
64
+ $schema: SchemaUrl,
65
+ tool: z.string(),
66
+ /** the package manager installing the tool, omitted for other tools */
67
+ type: ToolType.exactOptional(),
68
+ /** where the source code of the tool lives, omitted when unset */
69
+ sourceUrl: z.url({ protocol: /^https$/ }).exactOptional(),
70
+ /** the homepage of the tool, omitted when unset */
71
+ homepage: z.url({ protocol: /^https$/ }).exactOptional(),
72
+ /**
73
+ * the oldest version containerbase supports, on the `defaultDistro` of the
74
+ * root index, in the versioning of the tool. Older versions aren't listed.
75
+ * Omitted for tools without a limit.
76
+ */
77
+ minVersion: z.string().min(1).exactOptional(),
78
+ /**
79
+ * the oldest version on a distro, by codename, only for the distros whose
80
+ * floor differs from `minVersion`. Any codename is allowed, so new distros
81
+ * don't break readers.
82
+ */
83
+ distroMinVersion: z
84
+ .record(z.string().min(1), z.string().min(1))
85
+ .exactOptional(),
86
+ updatedAt: z.iso.datetime(),
87
+ /** newest first */
88
+ versions: z.array(ToolVersion),
89
+ });
90
+ /** The content of a `<tool>/<version>.json` file: the files of one version. */
91
+ export const VersionFiles = z.object({
92
+ $schema: SchemaUrl,
93
+ tool: z.string(),
94
+ version: z.string().min(1),
95
+ /** sorted by name */
96
+ files: z.array(ToolFile).min(1),
97
+ });
98
+ /**
99
+ * The content of a `<tool>.integrity.json` file: the integrity of each
100
+ * `<tool>/<version>.json` file, by version.
101
+ */
102
+ export const VersionIntegrity = z.object({
103
+ $schema: SchemaUrl,
104
+ tool: z.string(),
105
+ versions: z.record(z.string(), FileIntegrity),
106
+ });
107
+ /** A published file and the integrity of its bytes. */
108
+ export const FileReference = z.object({
109
+ file: z.string(),
110
+ integrity: FileIntegrity,
111
+ });
112
+ /** The content of the `v1/index.json` file. */
113
+ export const ToolIndex = z.object({
114
+ $schema: SchemaUrl,
115
+ updatedAt: z.iso.datetime(),
116
+ tools: z.array(z.object({
117
+ tool: z.string(),
118
+ versionCount: z.number().int().nonnegative(),
119
+ /** the `<tool>.json` file, the versions without their files */
120
+ slim: FileReference,
121
+ /**
122
+ * the `<tool>.integrity.json` file, with the integrity of each
123
+ * `<tool>/<version>.json` file, only for tools with files
124
+ */
125
+ versionFiles: FileReference.exactOptional(),
126
+ })),
127
+ });
128
+ /**
129
+ * The content of the root `index.json` file, which lists the published formats.
130
+ * It is minimal and stable: consumers pin a major version of the format and
131
+ * only read it to warn when their major is deprecated.
132
+ */
133
+ export const FormatIndex = z.object({
134
+ $schema: SchemaUrl,
135
+ /**
136
+ * the codename of the Ubuntu release the default image is built from, which
137
+ * the `minVersion` of the tools refers to
138
+ */
139
+ defaultDistro: z.string().min(1),
140
+ formats: z.array(z.object({
141
+ /** the major version of the format */
142
+ version: z.number().int().positive(),
143
+ /** the folder of the format, relative to the root */
144
+ path: z.string().min(1),
145
+ /** `current` is the format to use, `preview` is not stable yet */
146
+ status: z.enum(['current', 'preview', 'deprecated']),
147
+ /** the date a deprecated format is no longer published */
148
+ removalDate: z.iso.date().exactOptional(),
149
+ })),
150
+ });
@@ -0,0 +1,186 @@
1
+ import type { ToolType } from './types.ts';
2
+ /**
3
+ * A file of a version: where to download it and how to verify it.
4
+ */
5
+ export interface ToolFile {
6
+ /**
7
+ * The file name.
8
+ */
9
+ name: string;
10
+ /**
11
+ * The https download url.
12
+ */
13
+ url: string;
14
+ /**
15
+ * `<algorithm>:<lowercase hex>`
16
+ */
17
+ checksum: string;
18
+ /**
19
+ * The containerbase arch, like `amd64`, omitted for arch-independent files;
20
+ * readers ignore files of an arch they don't know.
21
+ */
22
+ arch?: string;
23
+ /**
24
+ * The distro of a distro specific file, like `jammy`.
25
+ */
26
+ distro?: string;
27
+ }
28
+ /**
29
+ * An SRI-style sha256 digest of a published file's bytes, like npm's
30
+ * `integrity`.
31
+ */
32
+ export type FileIntegrity = string;
33
+ /**
34
+ * A version `install-tool` can install, the flags are only set when true and
35
+ * `files` and `releaseTimestamp` only when known.
36
+ */
37
+ export interface ToolVersion {
38
+ version: string;
39
+ prerelease?: true;
40
+ lts?: true;
41
+ /**
42
+ * When the version was released, in UTC.
43
+ */
44
+ releaseTimestamp?: string;
45
+ /**
46
+ * Sorted by name, not in the `<tool>.json` files, but in the
47
+ * `<tool>/<version>.json` ones.
48
+ */
49
+ files?: ToolFile[];
50
+ /**
51
+ * The runtime constraint of this version per parent tool, like
52
+ * `{ node: '>=20.17.0' }`, as the raw string in the registry's syntax, only
53
+ * present when the registry has one.
54
+ */
55
+ constraints?: Record<string, string>;
56
+ }
57
+ /**
58
+ * The content of a `<tool>.json` file.
59
+ */
60
+ export interface ToolVersions {
61
+ /**
62
+ * The url of the json schema of the file, which identifies its format.
63
+ */
64
+ $schema?: string;
65
+ tool: string;
66
+ /**
67
+ * The package manager installing the tool, omitted for other tools.
68
+ */
69
+ type?: ToolType;
70
+ /**
71
+ * Where the source code of the tool lives, omitted when unset.
72
+ */
73
+ sourceUrl?: string;
74
+ /**
75
+ * The homepage of the tool, omitted when unset.
76
+ */
77
+ homepage?: string;
78
+ /**
79
+ * The oldest version containerbase supports, on the `defaultDistro` of the
80
+ * root index, in the versioning of the tool. Older versions aren't listed.
81
+ * Omitted for tools without a limit.
82
+ */
83
+ minVersion?: string;
84
+ /**
85
+ * The oldest version on a distro, by codename, only for the distros whose
86
+ * floor differs from `minVersion`. Any codename is allowed, so new distros
87
+ * don't break readers.
88
+ */
89
+ distroMinVersion?: Record<string, string>;
90
+ updatedAt: string;
91
+ /**
92
+ * Newest first.
93
+ */
94
+ versions: ToolVersion[];
95
+ }
96
+ /**
97
+ * The content of a `<tool>/<version>.json` file: the files of one version.
98
+ */
99
+ export interface VersionFiles {
100
+ /**
101
+ * The url of the json schema of the file, which identifies its format.
102
+ */
103
+ $schema?: string;
104
+ tool: string;
105
+ version: string;
106
+ /**
107
+ * Sorted by name.
108
+ */
109
+ files: ToolFile[];
110
+ }
111
+ /**
112
+ * The content of a `<tool>.integrity.json` file: the integrity of each
113
+ * `<tool>/<version>.json` file, by version.
114
+ */
115
+ export interface VersionIntegrity {
116
+ /**
117
+ * The url of the json schema of the file, which identifies its format.
118
+ */
119
+ $schema?: string;
120
+ tool: string;
121
+ versions: Record<string, FileIntegrity>;
122
+ }
123
+ /**
124
+ * A published file and the integrity of its bytes.
125
+ */
126
+ export interface FileReference {
127
+ file: string;
128
+ integrity: FileIntegrity;
129
+ }
130
+ /**
131
+ * The content of the `v1/index.json` file.
132
+ */
133
+ export interface ToolIndex {
134
+ /**
135
+ * The url of the json schema of the file, which identifies its format.
136
+ */
137
+ $schema?: string;
138
+ updatedAt: string;
139
+ tools: {
140
+ tool: string;
141
+ versionCount: number;
142
+ /**
143
+ * The `<tool>.json` file, the versions without their files.
144
+ */
145
+ slim: FileReference;
146
+ /**
147
+ * The `<tool>.integrity.json` file, with the integrity of each
148
+ * `<tool>/<version>.json` file, only for tools with files.
149
+ */
150
+ versionFiles?: FileReference;
151
+ }[];
152
+ }
153
+ /**
154
+ * The content of the root `index.json` file, which lists the published formats.
155
+ * It is minimal and stable: consumers pin a major version of the format and
156
+ * only read it to warn when their major is deprecated.
157
+ */
158
+ export interface FormatIndex {
159
+ /**
160
+ * The url of the json schema of the file, which identifies its format.
161
+ */
162
+ $schema?: string;
163
+ /**
164
+ * The codename of the Ubuntu release the default image is built from, which
165
+ * the `minVersion` of the tools refers to.
166
+ */
167
+ defaultDistro: string;
168
+ formats: {
169
+ /**
170
+ * The major version of the format.
171
+ */
172
+ version: number;
173
+ /**
174
+ * The folder of the format, relative to the root.
175
+ */
176
+ path: string;
177
+ /**
178
+ * `current` is the format to use, `preview` is not stable yet.
179
+ */
180
+ status: 'current' | 'preview' | 'deprecated';
181
+ /**
182
+ * The date a deprecated format is no longer published.
183
+ */
184
+ removalDate?: string;
185
+ }[];
186
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/zod.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export * from './schema.ts';
3
+ export * from './tool-versions-schema.ts';
3
4
  /**
4
5
  * Enum of all tool names supported by the containerbase version this package
5
6
  * was released with.
package/dist/zod.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { toolNames } from "./index.js";
3
3
  export * from "./schema.js";
4
+ export * from "./tool-versions-schema.js";
4
5
  /**
5
6
  * Enum of all tool names supported by the containerbase version this package
6
7
  * was released with.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@containerbase/base",
3
- "version": "14.41.1",
3
+ "version": "14.43.0",
4
4
  "description": "Metadata about the tools supported by containerbase",
5
5
  "keywords": [
6
6
  "containerbase",