@appliance.sh/sdk 1.8.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 +3 -3
- package/src/common.ts +3 -0
- package/src/index.ts +2 -0
- package/src/models/appliance.ts +34 -5
- package/src/models/deployment.ts +7 -0
- package/src/result.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appliance.sh/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.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",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
"require": "./dist/cjs/index.js",
|
|
12
12
|
"import": "./dist/esm/index.js",
|
|
13
|
-
"types": "./dist/types"
|
|
13
|
+
"types": "./dist/types/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"types": "./dist/types",
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "tsc --module commonjs --outDir dist/cjs && tsc --moduleResolution
|
|
17
|
+
"build": "tsc --module commonjs --outDir dist/cjs && tsc --moduleResolution nodenext --module NodeNext --outDir dist/esm && npm run postbuild && npm link",
|
|
18
18
|
"clean": "rm -rf ./dist/",
|
|
19
19
|
"dev:setup": "npm link",
|
|
20
20
|
"postbuild": "npx ts-node scripts/postbuild.ts",
|
package/src/common.ts
ADDED
package/src/index.ts
CHANGED
package/src/models/appliance.ts
CHANGED
|
@@ -1,21 +1,50 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { portInput } from '../common';
|
|
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);
|
|
2
18
|
|
|
3
19
|
export const applianceBaseInput = z.object({
|
|
4
20
|
manifest: z.literal('v1'),
|
|
5
21
|
name: z.string(),
|
|
6
|
-
version: z.string(),
|
|
7
|
-
scripts: z.record(z.string(), z.string()),
|
|
22
|
+
version: z.string().optional(),
|
|
23
|
+
scripts: z.record(z.string(), z.string()).optional(),
|
|
8
24
|
});
|
|
9
25
|
|
|
10
26
|
export const applianceTypeContainerInput = applianceBaseInput.extend({
|
|
11
|
-
type: z.literal(
|
|
27
|
+
type: z.literal(applianceTypeSchema.enum.container),
|
|
28
|
+
port: portInput,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const applianceTypeFrameworkInput = applianceBaseInput.extend({
|
|
32
|
+
type: z.literal(applianceTypeSchema.enum.framework),
|
|
33
|
+
framework: z.string().optional().default('auto'),
|
|
34
|
+
port: portInput.optional(),
|
|
35
|
+
includes: z.array(z.string()).optional(),
|
|
36
|
+
excludes: z.array(z.string()).optional(),
|
|
12
37
|
});
|
|
13
38
|
|
|
14
39
|
export const applianceTypeOtherInput = applianceBaseInput.extend({
|
|
15
|
-
type: z.literal(
|
|
40
|
+
type: z.literal(applianceTypeSchema.enum.other),
|
|
16
41
|
});
|
|
17
42
|
|
|
18
|
-
export const applianceInput = z.discriminatedUnion('type', [
|
|
43
|
+
export const applianceInput = z.discriminatedUnion('type', [
|
|
44
|
+
applianceTypeContainerInput,
|
|
45
|
+
applianceTypeFrameworkInput,
|
|
46
|
+
applianceTypeOtherInput,
|
|
47
|
+
]);
|
|
19
48
|
|
|
20
49
|
export type ApplianceInput = z.infer<typeof applianceInput>;
|
|
21
50
|
export type Appliance = z.output<typeof applianceInput>;
|
package/src/result.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type Result<T> = ResultSuccess<T> | ResultError<T>;
|
|
2
|
+
export type ResultSuccess<T> = { success: true; data: T; error?: never };
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
export type ResultError<T> = { success: false; data?: never; error: Error };
|