@appliance.sh/sdk 1.9.0 → 1.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appliance.sh/sdk",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "SDK for installing, running, and developing applications for the Appliance platform",
5
5
  "repository": "https://github.com/appliance-sh/appliance.sh",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './models/appliance';
1
+ export * from './models';
2
2
  export * from './version';
3
3
  export * from './result';
4
4
  export type * from './result';
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+
3
+ export enum ApplianceBaseType {
4
+ ApplianceAwsPublic = 'appliance-base-aws-public',
5
+ ApplianceAwsVpc = 'appliance-base-aws-vpc',
6
+ }
7
+
8
+ export const applianceBaseInput = z.object({
9
+ name: z.string(),
10
+ dns: z.object({
11
+ domainName: z.string(),
12
+ createZone: z.boolean().optional().default(true),
13
+ attachZone: z.boolean().optional().default(true),
14
+ }),
15
+ });
16
+
17
+ export const applianceBaseAwsInput = applianceBaseInput.extend({
18
+ region: z.string(),
19
+ });
20
+
21
+ export const applianceAwsPublicInput = applianceBaseAwsInput.extend({
22
+ type: z.literal(ApplianceBaseType.ApplianceAwsPublic),
23
+ });
24
+
25
+ export type ApplianceBaseAwsPublicInput = z.infer<typeof applianceAwsPublicInput>;
26
+
27
+ export const applianceAwsVpcInput = applianceBaseAwsInput.extend({
28
+ type: z.literal(ApplianceBaseType.ApplianceAwsVpc),
29
+ vpc: z.union([
30
+ z.object({
31
+ vpcCidr: z.string(),
32
+ numberOfAzs: z.number().int().min(1).max(3),
33
+ }),
34
+ z.object({
35
+ vpcId: z.string(),
36
+ }),
37
+ ]),
38
+ });
39
+
40
+ export type ApplianceBaseAwsVpcInput = z.infer<typeof applianceAwsPublicInput>;
41
+
42
+ export const applianceBaseConfigInput = z.discriminatedUnion('type', [applianceAwsPublicInput, applianceAwsVpcInput]);
43
+
44
+ export type ApplianceBaseConfigInput = z.infer<typeof applianceBaseConfigInput>;
45
+
46
+ export const applianceBaseConfig = applianceBaseInput.extend({
47
+ apiUrl: z.url(),
48
+ });
49
+
50
+ export type ApplianceBaseConfig = z.infer<typeof applianceBaseConfig>;
@@ -1,31 +1,50 @@
1
1
  import { z } from 'zod';
2
2
  import { portInput } from '../common';
3
3
 
4
- export const applianceBaseInput = z.object({
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
+
19
+ export const applianceTypeBase = 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
- export const applianceTypeContainerInput = applianceBaseInput.extend({
12
- type: z.literal('container'),
26
+ export const applianceTypeContainerInput = applianceTypeBase.extend({
27
+ type: z.literal(applianceTypeSchema.enum.container),
13
28
  port: portInput,
14
29
  });
15
30
 
16
- export const applianceTypeInput = applianceBaseInput.extend({
17
- type: z.literal('framework'),
31
+ export const applianceTypeFrameworkInput = applianceTypeBase.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(),
21
36
  excludes: z.array(z.string()).optional(),
22
37
  });
23
38
 
24
- export const applianceTypeOtherInput = applianceBaseInput.extend({
25
- type: z.literal('other'),
39
+ export const applianceTypeOtherInput = applianceTypeBase.extend({
40
+ type: z.literal(applianceTypeSchema.enum.other),
26
41
  });
27
42
 
28
- export const applianceInput = z.discriminatedUnion('type', [applianceTypeContainerInput, applianceTypeOtherInput]);
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>;
@@ -0,0 +1,2 @@
1
+ export * from './appliance';
2
+ export * from './appliance-base';