heim 0.1.0-alpha.2 → 0.1.0-alpha.3

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/types.d.ts CHANGED
@@ -1,294 +1,394 @@
1
- import type { HeimTypes } from "./gen/heim";
2
- import type { ComposeSpecification } from "./gen/compose";
3
-
4
- declare global {
5
- /**
6
- * This is the main entry point for defining an application using the heim TypeScript library.
7
- */
8
- function defineApp(config: AppConfig): AppConfig;
9
-
10
- // Types
11
- type AppConfig = {
12
- /**
13
- * The manifest is the metadata of the app that describes its name, version, description, and other relevant information.
14
- */
15
- manifest: Manifest | ((ctx: ManifestContext) => Manifest);
16
- /**
17
- * The user interface configuration defines how the app's UI should be set up, including the services it provides, the ports it uses, and whether it requires authentication.
18
- * It is optional, and if not provided, the app will only render the console as the user interface.
19
- */
20
- ui?: UserInterface | ((ctx: UserInterfaceContext) => UserInterface);
21
- /**
22
- * The compose configuration defines the Docker Compose specification for the app, including the services, volumes, networks, and other Docker resources that the app requires to run.
23
- */
24
- compose: Compose | ((ctx: ComposeContext) => Compose);
25
- /**
26
- * The migrations configuration defines the migrations (e.g. for databases) that need to be executed when the app is updated to a new version.
27
- */
28
- migrations?: Migration[] | ((ctx: MigrationContext) => Migration[]);
29
- /**
30
- * The backup configuration defines which volumes of the app should be backed up. It also allows specifying a custom backup command.
31
- */
32
- backup?: Backup | ((ctx: BackupContext) => Backup);
33
- /**
34
- * The restore configuration defines how to restore the app from a backup, including any custom restore commands that need to be executed before the restore process.
35
- */
36
- restore?: Restore | ((ctx: RestoreContext) => Restore);
37
- /**
38
- * The hooks configuration defines custom logic that should be executed at specific points in the app's lifecycle, such as before or after certain actions.
39
- */
40
- hooks?: Hooks | ((ctx: HooksContext) => Hooks);
41
- };
42
- type Manifest = HeimTypes["manifest"];
43
- type ManifestContext = {};
44
- type UserInterface = HeimTypes["ui"];
45
- type UserInterfaceContext = {};
46
- type Compose = ComposeSpecification;
47
- type ComposeContext = {
48
- data: {
49
- /**
50
- * Returns the path to a directory that can be used for shared storage between apps.
51
- */
52
- getSharedStorageDir(): string;
53
- };
54
-
55
- system: {
56
- /**
57
- * Returns a list of common IANA timezones, e.g. ["Europe/Berlin", "America/New_York", ...].
58
- */
59
- timezones(): string[];
60
- /**
61
- * Returns the system's current timezone in IANA format, e.g. "Europe/Berlin".
62
- * This is determined by the host environment and may not be accurate if the user
63
- * has recently changed their timezone or if the host environment does not provide this information.
64
- */
65
- timezone(): string;
66
- };
67
-
68
- input: {
69
- /**
70
- * If the storageKey is unknown, it prompts the user for input and returns the entered value.
71
- * If the storageKey is known, it returns the previously entered value without prompting the user.
72
- * @param storageKey A unique key to store the input value, e.g. "db-username"
73
- * @param opts Options for the input prompt
74
- */
75
- text(
76
- /**
77
- * A unique key to store the input value, e.g. "db-username". The input value is stored under the provided storageKey and can be edited by the user later.
78
- */
79
- storageKey: string,
80
- opts: {
81
- /**
82
- * The message to display to the user when prompting for input, e.g. "Enter your database username".
83
- */
84
- message: string;
85
- /**
86
- * An optional default value to pre-fill the input field, e.g. "admin".
87
- */
88
- defaultValue?: string;
89
- /**
90
- * If true, the input will allow multiple lines to be entered. Default is false.
91
- */
92
- multiLine?: boolean;
93
- /**
94
- * If true, the input will be masked (e.g. for passwords). Default is false.
95
- */
96
- mask?: string;
97
- validate?: (value: string | undefined) => string | undefined;
98
- },
99
- ): string;
100
- /**
101
- * If the storageKey is unknown, it prompts the user for confirmation and returns the user's choice as a boolean.
102
- * If the storageKey is known, it returns the previously entered value without prompting the user.
103
- * @param storageKey A unique key to store the confirmation value, e.g. "ebnable-feature-x"
104
- * @param opts Options for the confirmation prompt
105
- */
106
- confirm(
107
- /**
108
- * A unique key to store the confirmation value, e.g. "enable-feature-x". The confirmation value is stored under the provided storageKey and can be edited by the user later.
109
- */
110
- storageKey: string,
111
- opts: {
112
- /**
113
- * The message to display to the user when prompting for confirmation, e.g. "Do you want to enable feature X?".
114
- */
115
- message: string;
116
- /**
117
- * An optional default value to pre-fill the confirmation, e.g. true (which would correspond to "Yes"). Default is false.
118
- */
119
- defaultValue?: boolean;
120
- /**
121
- * The text to display for the confirmation, e.g. "Yes". Default is "Yes".
122
- */
123
- confirmText?: string;
124
- /**
125
- * The text to display for the rejection, e.g. "No". Default is "No".
126
- */
127
- rejectText?: string;
128
- },
129
- ): boolean;
130
- /**
131
- * If the storageKey is unknown, it prompts the user to select one option from a list and returns the selected value.
132
- * If the storageKey is known, it returns the previously selected value without prompting the user.
133
- * @param storageKey A unique key to store the selected value, e.g. "storage-type"
134
- * @param opts Options for the select prompt
135
- */
136
- select<V extends string>(
137
- /**
138
- * A unique key to store the selected value, e.g. "storage-type". The selected value is stored under the provided storageKey and can be edited by the user later.
139
- */
140
- storageKey: string,
141
- opts: {
142
- /**
143
- * The message to display to the user when prompting for selection, e.g. "Select your storage type".
144
- */
145
- message: string;
146
- /**
147
- * A list of options to choose from, where each option has a value (which is returned when the option is selected) and a label (which is displayed to the user). For example: [{ value: "hdd", label: "Hard Drive" }, { value: "ssd", label: "Solid State Drive" }].
148
- */
149
- options: { value: V; label: string }[];
150
- /**
151
- * An optional default value to pre-select an option, e.g. "ssd". The defaultValue must match one of the values in the options array.
152
- */
153
- defaultValue?: V;
154
- },
155
- ): V;
156
- /**
157
- * If the storageKey is unknown, it prompts the user to select zero, one or more options from a list and returns the selected values as an array.
158
- * If the storageKey is known, it returns the previously selected values without prompting the user.
159
- * @param storageKey A unique key to store the selected values, e.g. "feature-flags". The selected values are stored under the provided storageKey and can be edited by the user later.
160
- * @param opts Options for the multiselect prompt
161
- */
162
- multiselect<V extends string>(
163
- /**
164
- * A unique key to store the selected values, e.g. "feature-flags". The selected values are stored under the provided storageKey and can be edited by the user later.
165
- */
166
- storageKey: string,
167
- opts: {
168
- /**
169
- * The message to display to the user when prompting for selection, e.g. "Select the video encoding backends you want to use".
170
- */
171
- message: string;
172
- /**
173
- * A list of options to choose from, where each option has a value (which is returned when the option is selected) and a label (which is displayed to the user). For example: [{ value: "h264", label: "H.264" }, { value: "vp9", label: "VP9" }, { value: "av1", label: "AV1" }].
174
- */
175
- options: { value: V; label: string }[];
176
- /**
177
- * An optional list of default values to pre-select options, e.g. ["h264", "vp9"]. The defaultValues must match the values in the options array.
178
- */
179
- defaultValue?: V[];
180
- },
181
- ): V[];
182
- };
183
-
184
- crypto: {
185
- /**
186
- * Generates a random password with the specified options.
187
- * @param opts Options for password generation
188
- */
189
- password(opts?: {
190
- /**
191
- * The length of the generated password. Default is 16.
192
- */
193
- length?: number;
194
- /**
195
- * Exclude numbers from the generated password. Default is false.
196
- */
197
- excludeNumbers?: boolean;
198
- /**
199
- * Exclude special characters from the generated password. Default is false.
200
- */
201
- excludeSpecial?: boolean;
202
- }): string;
203
- };
204
- };
205
-
206
- type Migration = {
207
- /**
208
- * The version of the migration. This should be a string that can be compared to determine the order of migrations, e.g. "1.0.0", "2023-01-01", etc.
209
- */
210
- version: string;
211
- /**
212
- * A description of the migration, e.g. "Add new database schema for feature X".
213
- */
214
- description: string;
215
- /**
216
- * The command to execute for the migration. This can be a shell command or a script that performs the necessary changes for the migration.
217
- */
218
- command: string | string[];
219
- };
220
- type MigrationContext = {};
221
-
222
- /**
223
- * The backup configuration of the app.
224
- */
225
- type Backup = {
226
- /**
227
- * The volumes configuration defines which volumes of the app should be included or excluded in the backup. Each entry in the
228
- * include or exclude list can be a volume name (string) to include or exclude the entire volume, or an object with a volume
229
- * name and file filters to include or exclude only specific files within that volume. If neither the include nor the exclude
230
- * list is set, all volumes will be included in the backup. If both lists are set, only the volumes in the include list that
231
- * are not in the exclude list will be included in the backup.
232
- */
233
- volumes?: {
234
- /**
235
- * A list of volumes to include in the backup. Each entry can be a volume name (string) to include the entire volume,
236
- * or an object with a volume name and file filters to include only specific files within that volume.
237
- * If neither this list nor the exclude list is set, all volumes will be included.
238
- * If both lists are set, only the volumes in the include list that are not in the exclude list will be included.
239
- */
240
- include?: (string | VolumeFilter)[];
241
- /**
242
- * A list of volumes to exclude from the backup. Each entry can be a volume name (string) to exclude the entire volume,
243
- * or an object with a volume name and file filters to exclude only specific files within that volume.
244
- * If neither this list nor the include list is set, all volumes will be included.
245
- * If both lists are set, only the volumes in the include list that are not in the exclude list will be included.
246
- */
247
- exclude?: (string | VolumeFilter)[];
248
- };
249
- /**
250
- * Additional files to include in the backup that are not part of any volume. The key is the name of the artifact and the value
251
- * is the path to the file or directory to include in the backup.
252
- * The key is used to identify the artifact in the backup and can be used in the restore process to get the artifact.
253
- */
254
- artifacts?: Record<string, string>;
255
- };
256
- type VolumeFilter = {
257
- /**
258
- * The name of the volume.
259
- */
260
- name: string;
261
- /**
262
- * File path patterns (globs) to include within this volume.
263
- * If neither this nor the exclude property is set, the entire volume will be included.
264
- * If both include and exclude are set, only the files that match the include patterns and do not match the exclude patterns will be included.
265
- */
266
- include?: string[];
267
- /**
268
- * File path patterns (globs) to exclude within this volume.
269
- * If neither this nor the include property is set, the entire volume will be included.
270
- * If both include and exclude are set, only the files that match the include patterns and do not match the exclude patterns will be included.
271
- */
272
- exclude?: string[];
273
- };
274
- type BackupContext = {
275
- config: Map<string, string>;
276
- exec: (service: string, command: string | string[]) => void;
277
- log: Log;
278
- };
279
- type Restore = void;
280
- type RestoreContext = {
281
- config: Map<string, string>;
282
- exec: (service: string, command: string | string[]) => void;
283
- artifacts: Map<string, string>;
284
- log: Log;
285
- };
286
- type Hooks = HeimTypes["hooks"];
287
- type HooksContext = {};
288
-
289
- type Log = {
290
- info: (message: string) => void;
291
- warning: (message: string) => void;
292
- error: (message: string) => void;
293
- };
294
- }
1
+ import type { ComposeSpecification } from "./gen/compose";
2
+
3
+ declare global {
4
+ /**
5
+ * This is the main entry point for defining an application using the heim TypeScript library.
6
+ */
7
+ function defineApp(config: AppConfig): AppConfig;
8
+
9
+ // Types
10
+ type AppConfig = {
11
+ /**
12
+ * The metadata is the descriptive information of the app such as its name, version, description, and other relevant information.
13
+ */
14
+ metadata: Metadata;
15
+ /**
16
+ * The user interface configuration defines how the app's UI should be set up, including the services it provides, the ports it uses, and whether it requires authentication.
17
+ * It is optional, and if not provided, the app will only render the console as the user interface.
18
+ */
19
+ ui?: UserInterface | ((ctx: UserInterfaceContext) => UserInterface);
20
+ /**
21
+ * The compose configuration defines the Docker Compose specification for the app, including the services, volumes, networks, and other Docker resources that the app requires to run.
22
+ */
23
+ compose: Compose | ((ctx: ComposeContext) => Compose);
24
+ /**
25
+ * The backup configuration defines which volumes of the app should be backed up. It also allows specifying a custom backup command.
26
+ */
27
+ backup?: Backup | ((ctx: BackupContext) => Backup);
28
+ /**
29
+ * The restore configuration defines how to restore the app from a backup, including any custom restore commands that need to be executed before the restore process.
30
+ */
31
+ restore?: Restore | ((ctx: RestoreContext) => Restore);
32
+ };
33
+
34
+ type Metadata = {
35
+ /**
36
+ * Part of the id of the app. It needs to be unique within one namespace.
37
+ */
38
+ slug: string;
39
+ /**
40
+ * The version of the app, must be a valid semver version.
41
+ */
42
+ version: string;
43
+ /**
44
+ * Display name shown in the UI.
45
+ */
46
+ title: LocalizedString | string;
47
+ /**
48
+ * A short description of the app.
49
+ */
50
+ tagline: LocalizedString1 | string;
51
+ /**
52
+ * The description of the app. It needs to be a markdown file.
53
+ */
54
+ readme?: LocalizedString2 | string;
55
+ /**
56
+ * The category of the app.
57
+ */
58
+ category:
59
+ | "books"
60
+ | "medical"
61
+ | "business"
62
+ | "music"
63
+ | "developer-tools"
64
+ | "navigation"
65
+ | "education"
66
+ | "news"
67
+ | "entertainment"
68
+ | "photo-and-video"
69
+ | "finance"
70
+ | "productivity"
71
+ | "food-and-drink"
72
+ | "reference"
73
+ | "games"
74
+ | "graphics-and-design"
75
+ | "shopping"
76
+ | "health-and-fitness"
77
+ | "social-networking"
78
+ | "lifestyle"
79
+ | "sports"
80
+ | "kids"
81
+ | "travel"
82
+ | "magazines-and-newspapers"
83
+ | "utilities"
84
+ | "weather";
85
+ /**
86
+ * The developer (individual person or company) of the app. This is either you or the original developer of the software.
87
+ */
88
+ developer: string;
89
+ /**
90
+ * The icon of the app. It needs to be an SVG file.
91
+ */
92
+ icon?: string;
93
+ /**
94
+ * A list of images that showcase the app.
95
+ */
96
+ galleryImages?: string[] | LocalizedString3;
97
+ /**
98
+ * The website of the app.
99
+ */
100
+ website?: string;
101
+ /**
102
+ * The version control repository of the app (e.g. GitHub).
103
+ */
104
+ repository?: string;
105
+ /**
106
+ * The support website of the app.
107
+ */
108
+ support?: string;
109
+ /**
110
+ * The license file of the app.
111
+ */
112
+ license?: LocalizedString4 | string;
113
+ /**
114
+ * The minimum version of heim that is required to run the app. This is used to prevent users from installing an app that requires features of a newer version of heim.
115
+ */
116
+ minHeimVersion?: string;
117
+ };
118
+
119
+ type UserInterface = {
120
+ /**
121
+ * The name of the compose service that provides the user interface.
122
+ */
123
+ service: string;
124
+ /**
125
+ * The port of the compose service that provides the user interface. Note that this port does NOT need to be exposed by the container runtime.
126
+ */
127
+ port: number;
128
+ /**
129
+ * The url path of the compose service that provides the user interface.
130
+ */
131
+ path?: string;
132
+ /**
133
+ * Whether the user interface of this app has an auth in front of it. Can be 'true' if the app itself provides an authentication mechanism or is intended to be public.
134
+ */
135
+ hasAuth?: boolean;
136
+ };
137
+ type UserInterfaceContext = GlobalContext;
138
+
139
+ type Compose = ComposeSpecification;
140
+ type ComposeContext = GlobalContext;
141
+
142
+ type Backup = {
143
+ /**
144
+ * The volumes configuration defines which volumes of the app should be included or excluded in the backup. Each entry in the
145
+ * include or exclude list can be a volume name (string) to include or exclude the entire volume, or an object with a volume
146
+ * name and file filters to include or exclude only specific files within that volume. If neither the include nor the exclude
147
+ * list is set, all volumes will be included in the backup. If both lists are set, only the volumes in the include list that
148
+ * are not in the exclude list will be included in the backup.
149
+ */
150
+ volumes?: {
151
+ /**
152
+ * A list of volumes to include in the backup. Each entry can be a volume name (string) to include the entire volume,
153
+ * or an object with a volume name and file filters to include only specific files within that volume.
154
+ * If neither this list nor the exclude list is set, all volumes will be included.
155
+ * If both lists are set, only the volumes in the include list that are not in the exclude list will be included.
156
+ */
157
+ include?: (string | VolumeFilter)[];
158
+ /**
159
+ * A list of volumes to exclude from the backup. Each entry can be a volume name (string) to exclude the entire volume,
160
+ * or an object with a volume name and file filters to exclude only specific files within that volume.
161
+ * If neither this list nor the include list is set, all volumes will be included.
162
+ * If both lists are set, only the volumes in the include list that are not in the exclude list will be included.
163
+ */
164
+ exclude?: (string | VolumeFilter)[];
165
+ };
166
+ /**
167
+ * Additional files to include in the backup that are not part of any volume. The key is the name of the artifact and the value
168
+ * is the path to the file or directory to include in the backup.
169
+ * The key is used to identify the artifact in the backup and can be used in the restore process to get the artifact.
170
+ */
171
+ artifacts?: Record<string, ArrayBuffer>;
172
+ };
173
+ type VolumeFilter = {
174
+ /**
175
+ * The name of the volume.
176
+ */
177
+ name: string;
178
+ /**
179
+ * File path patterns (globs) to include within this volume.
180
+ * If neither this nor the exclude property is set, the entire volume will be included.
181
+ * If both include and exclude are set, only the files that match the include patterns and do not match the exclude patterns will be included.
182
+ */
183
+ include?: string[];
184
+ /**
185
+ * File path patterns (globs) to exclude within this volume.
186
+ * If neither this nor the include property is set, the entire volume will be included.
187
+ * If both include and exclude are set, only the files that match the include patterns and do not match the exclude patterns will be included.
188
+ */
189
+ exclude?: string[];
190
+ };
191
+ type BackupContext = GlobalContext & AppContext;
192
+
193
+ type Restore = {};
194
+ type RestoreContext = GlobalContext & AppContext;
195
+
196
+ // General types
197
+
198
+ type GlobalContext = {
199
+ log: {
200
+ /**
201
+ * Logs an informational message to the user.
202
+ */
203
+ info: (message: string) => void;
204
+ /**
205
+ * Logs a warning message to the user.
206
+ */
207
+ warning: (message: string) => void;
208
+ /**
209
+ * Logs an error message to the user.
210
+ */
211
+ error: (message: string) => void;
212
+ };
213
+
214
+ data: {
215
+ /**
216
+ * Returns the path to a directory that can be used for shared storage between apps.
217
+ */
218
+ sharedStorageDir(): string;
219
+ };
220
+
221
+ config: {
222
+ /**
223
+ * Returns a previously stored configuration value for the given key. If the key does not exist, it returns null.
224
+ * @param key The key of the configuration item to retrieve.
225
+ */
226
+ getItem(key: string): string | null;
227
+ /**
228
+ * Stores a configuration value for the given key.
229
+ * @param key The key of the configuration item to store.
230
+ * @param value The value to store.
231
+ */
232
+ setItem(key: string, value: string): void;
233
+ /**
234
+ * Removes a configuration value for the given key.
235
+ * @param key The key of the configuration item to remove.
236
+ */
237
+ removeItem(key: string): void;
238
+ /**
239
+ * Returns the number of configuration items stored.
240
+ */
241
+ size(): number;
242
+ /**
243
+ * Returns the key of the configuration item at the given index. If the index is out of bounds, it returns null.
244
+ * @param index The index of the configuration item.
245
+ */
246
+ key(index: number): string | null;
247
+ /**
248
+ * Removes all configuration items for this app.
249
+ */
250
+ clear(): void;
251
+ };
252
+
253
+ system: {
254
+ /**
255
+ * Returns a list of common IANA timezones, e.g. ["Europe/Berlin", "America/New_York", ...].
256
+ */
257
+ timezones(): string[];
258
+ /**
259
+ * Returns the system's current timezone in IANA format, e.g. "Europe/Berlin".
260
+ * This is determined by the host environment and can be overridden by the user.
261
+ * If no override is set and the host environment does not provide a timezone, it defaults to "UTC".
262
+ */
263
+ timezone(): string;
264
+ };
265
+
266
+ input: {
267
+ /**
268
+ * If the id is unknown, it prompts the user for input and returns the entered value.
269
+ * If the id is known, it returns the previously entered value without prompting the user.
270
+ * @param id A unique id to store the input value, e.g. "db-username"
271
+ * @param opts Options for the input prompt
272
+ */
273
+ text(opts: {
274
+ /**
275
+ * The message to display to the user when prompting for input, e.g. "Enter your database username".
276
+ */
277
+ message: string;
278
+ /**
279
+ * An optional default value to pre-fill the input field, e.g. "admin".
280
+ */
281
+ defaultValue?: string;
282
+ /**
283
+ * If true, the input will allow multiple lines to be entered. Default is false.
284
+ */
285
+ multiLine?: boolean;
286
+ /**
287
+ * If true, the input will be masked (e.g. for passwords). Default is false.
288
+ */
289
+ mask?: string;
290
+ validate?: (value: string | undefined) => string | undefined;
291
+ }): string;
292
+ /**
293
+ * If the id is unknown, it prompts the user for confirmation and returns the user's choice as a boolean.
294
+ * If the id is known, it returns the previously entered value without prompting the user.
295
+ * @param id A unique id to store the confirmation value, e.g. "ebnable-feature-x"
296
+ * @param opts Options for the confirmation prompt
297
+ */
298
+ confirm(opts: {
299
+ /**
300
+ * The message to display to the user when prompting for confirmation, e.g. "Do you want to enable feature X?".
301
+ */
302
+ message: string;
303
+ /**
304
+ * An optional default value to pre-fill the confirmation, e.g. true (which would correspond to "Yes"). Default is false.
305
+ */
306
+ defaultValue?: boolean;
307
+ /**
308
+ * The text to display for the confirmation, e.g. "Yes". Default is "Yes".
309
+ */
310
+ confirmText?: string;
311
+ /**
312
+ * The text to display for the rejection, e.g. "No". Default is "No".
313
+ */
314
+ rejectText?: string;
315
+ }): boolean;
316
+ /**
317
+ * If the id is unknown, it prompts the user to select one option from a list and returns the selected value.
318
+ * If the id is known, it returns the previously selected value without prompting the user.
319
+ * @param id A unique id to store the selected value, e.g. "storage-type"
320
+ * @param opts Options for the select prompt
321
+ */
322
+ select<V extends string>(opts: {
323
+ /**
324
+ * The message to display to the user when prompting for selection, e.g. "Select your storage type".
325
+ */
326
+ message: string;
327
+ /**
328
+ * A list of options to choose from, where each option has a value (which is returned when the option is selected) and a label (which is displayed to the user). For example: [{ value: "hdd", label: "Hard Drive" }, { value: "ssd", label: "Solid State Drive" }].
329
+ */
330
+ options: { value: V; label: string }[];
331
+ /**
332
+ * An optional default value to pre-select an option, e.g. "ssd". The defaultValue must match one of the values in the options array.
333
+ */
334
+ defaultValue?: V;
335
+ }): V;
336
+ /**
337
+ * If the id is unknown, it prompts the user to select zero, one or more options from a list and returns the selected values as an array.
338
+ * If the id is known, it returns the previously selected values without prompting the user.
339
+ * @param id A unique id to store the selected values, e.g. "feature-flags". The selected values are stored under the provided id and can be edited by the user later.
340
+ * @param opts Options for the multiselect prompt
341
+ */
342
+ multiselect<V extends string>(opts: {
343
+ /**
344
+ * The message to display to the user when prompting for selection, e.g. "Select the video encoding backends you want to use".
345
+ */
346
+ message: string;
347
+ /**
348
+ * A list of options to choose from, where each option has a value (which is returned when the option is selected) and a label (which is displayed to the user). For example: [{ value: "h264", label: "H.264" }, { value: "vp9", label: "VP9" }, { value: "av1", label: "AV1" }].
349
+ */
350
+ options: { value: V; label: string }[];
351
+ /**
352
+ * An optional list of default values to pre-select options, e.g. ["h264", "vp9"]. The defaultValues must match the values in the options array.
353
+ */
354
+ defaultValues?: V[];
355
+ }): V[];
356
+ };
357
+
358
+ crypto: {
359
+ /**
360
+ * Generates a random password with the specified options.
361
+ * @param opts Options for password generation
362
+ */
363
+ password(opts?: {
364
+ /**
365
+ * The length of the generated password. Default is 16.
366
+ */
367
+ length?: number;
368
+ /**
369
+ * Exclude numbers from the generated password. Default is false.
370
+ */
371
+ excludeNumbers?: boolean;
372
+ /**
373
+ * Exclude special characters from the generated password. Default is false.
374
+ */
375
+ excludeSpecial?: boolean;
376
+ }): string;
377
+ };
378
+ };
379
+
380
+ type AppContext = {
381
+ /**
382
+ * A key-value store that holds all the configuration values for the app, including user input values and values set by the app itself.
383
+ */
384
+ config: Map<string, string>;
385
+ /**
386
+ * Executes a command in the container of a specific service. Uses docker compose exec under the hood.
387
+ */
388
+ exec: (service: string, command: string | string[]) => void;
389
+ /**
390
+ * A key-value store that holds all the artifacts generated by the app, such as backup files, logs, and other data.
391
+ */
392
+ artifacts: Map<string, ArrayBuffer>;
393
+ };
394
+ }