@appliance.sh/sdk 1.9.0 → 1.10.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/package.json +1 -1
- package/src/models/appliance.ts +26 -7
package/package.json
CHANGED
package/src/models/appliance.ts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { portInput } from '../common';
|
|
3
3
|
|
|
4
|
+
export enum ApplianceType {
|
|
5
|
+
container = 'container',
|
|
6
|
+
framework = 'framework',
|
|
7
|
+
other = 'other',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum ApplianceFramework {
|
|
11
|
+
Auto = 'auto',
|
|
12
|
+
Python = 'python',
|
|
13
|
+
Node = 'node',
|
|
14
|
+
Other = 'other',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const applianceTypeSchema = z.enum(ApplianceType);
|
|
18
|
+
|
|
4
19
|
export const applianceBaseInput = z.object({
|
|
5
20
|
manifest: z.literal('v1'),
|
|
6
21
|
name: z.string(),
|
|
7
|
-
version: z.string(),
|
|
8
|
-
scripts: z.record(z.string(), z.string()),
|
|
22
|
+
version: z.string().optional(),
|
|
23
|
+
scripts: z.record(z.string(), z.string()).optional(),
|
|
9
24
|
});
|
|
10
25
|
|
|
11
26
|
export const applianceTypeContainerInput = applianceBaseInput.extend({
|
|
12
|
-
type: z.literal(
|
|
27
|
+
type: z.literal(applianceTypeSchema.enum.container),
|
|
13
28
|
port: portInput,
|
|
14
29
|
});
|
|
15
30
|
|
|
16
|
-
export const
|
|
17
|
-
type: z.literal(
|
|
31
|
+
export const applianceTypeFrameworkInput = applianceBaseInput.extend({
|
|
32
|
+
type: z.literal(applianceTypeSchema.enum.framework),
|
|
18
33
|
framework: z.string().optional().default('auto'),
|
|
19
34
|
port: portInput.optional(),
|
|
20
35
|
includes: z.array(z.string()).optional(),
|
|
@@ -22,10 +37,14 @@ export const applianceTypeInput = applianceBaseInput.extend({
|
|
|
22
37
|
});
|
|
23
38
|
|
|
24
39
|
export const applianceTypeOtherInput = applianceBaseInput.extend({
|
|
25
|
-
type: z.literal(
|
|
40
|
+
type: z.literal(applianceTypeSchema.enum.other),
|
|
26
41
|
});
|
|
27
42
|
|
|
28
|
-
export const applianceInput = z.discriminatedUnion('type', [
|
|
43
|
+
export const applianceInput = z.discriminatedUnion('type', [
|
|
44
|
+
applianceTypeContainerInput,
|
|
45
|
+
applianceTypeFrameworkInput,
|
|
46
|
+
applianceTypeOtherInput,
|
|
47
|
+
]);
|
|
29
48
|
|
|
30
49
|
export type ApplianceInput = z.infer<typeof applianceInput>;
|
|
31
50
|
export type Appliance = z.output<typeof applianceInput>;
|