@ordinlabs/wsm-types 2.2.2
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/LICENSE.md +674 -0
- package/README.md +4 -0
- package/dist/accessRules.d.ts +16 -0
- package/dist/accessRules.js +3 -0
- package/dist/accessRules.js.map +1 -0
- package/dist/apiKey.d.ts +14 -0
- package/dist/apiKey.js +3 -0
- package/dist/apiKey.js.map +1 -0
- package/dist/base.d.ts +20 -0
- package/dist/base.js +12 -0
- package/dist/base.js.map +1 -0
- package/dist/clientConfig.d.ts +13 -0
- package/dist/clientConfig.js +3 -0
- package/dist/clientConfig.js.map +1 -0
- package/dist/developer.d.ts +15 -0
- package/dist/developer.js +13 -0
- package/dist/developer.js.map +1 -0
- package/dist/group.d.ts +17 -0
- package/dist/group.js +21 -0
- package/dist/group.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/k8s.d.ts +11 -0
- package/dist/k8s.js +3 -0
- package/dist/k8s.js.map +1 -0
- package/dist/login.d.ts +32 -0
- package/dist/login.js +7 -0
- package/dist/login.js.map +1 -0
- package/dist/memberships.d.ts +7 -0
- package/dist/memberships.js +3 -0
- package/dist/memberships.js.map +1 -0
- package/dist/navData.d.ts +15 -0
- package/dist/navData.js +3 -0
- package/dist/navData.js.map +1 -0
- package/dist/network.d.ts +21 -0
- package/dist/network.js +12 -0
- package/dist/network.js.map +1 -0
- package/dist/nginx-ingress-types.d.ts +187 -0
- package/dist/nginx-ingress-types.js +6 -0
- package/dist/nginx-ingress-types.js.map +1 -0
- package/dist/node.d.ts +11 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/dist/project.d.ts +91 -0
- package/dist/project.js +37 -0
- package/dist/project.js.map +1 -0
- package/dist/publicKey.d.ts +17 -0
- package/dist/publicKey.js +3 -0
- package/dist/publicKey.js.map +1 -0
- package/dist/rbac.d.ts +3 -0
- package/dist/rbac.js +3 -0
- package/dist/rbac.js.map +1 -0
- package/dist/reflection.d.ts +7 -0
- package/dist/reflection.js +23 -0
- package/dist/reflection.js.map +1 -0
- package/dist/reporting.d.ts +35 -0
- package/dist/reporting.js +16 -0
- package/dist/reporting.js.map +1 -0
- package/dist/requests.d.ts +22 -0
- package/dist/requests.js +3 -0
- package/dist/requests.js.map +1 -0
- package/dist/session.d.ts +12 -0
- package/dist/session.js +3 -0
- package/dist/session.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/workspace.d.ts +69 -0
- package/dist/workspace.js +23 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +39 -0
- package/src/accessRules.ts +18 -0
- package/src/apiKey.ts +16 -0
- package/src/base.ts +35 -0
- package/src/clientConfig.ts +13 -0
- package/src/developer.ts +29 -0
- package/src/group.ts +38 -0
- package/src/index.ts +21 -0
- package/src/k8s.ts +4 -0
- package/src/login.ts +36 -0
- package/src/memberships.ts +12 -0
- package/src/navData.ts +16 -0
- package/src/network.ts +35 -0
- package/src/nginx-ingress-types.ts +218 -0
- package/src/node.ts +13 -0
- package/src/project.ts +166 -0
- package/src/publicKey.ts +21 -0
- package/src/rbac.ts +5 -0
- package/src/reflection.ts +19 -0
- package/src/reporting.ts +60 -0
- package/src/requests.ts +27 -0
- package/src/session.ts +14 -0
- package/src/workspace.ts +121 -0
- package/tsconfig.json +10 -0
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ordinlabs/wsm-types",
|
|
3
|
+
"version": "2.2.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "rimraf dist",
|
|
8
|
+
"clean:modules": "rimraf node_modules",
|
|
9
|
+
"prettify": "prettier \"src/**/*.ts\" --write",
|
|
10
|
+
"build": "tsc -b",
|
|
11
|
+
"build:prod": "npm run clean && npm run build",
|
|
12
|
+
"test": "jest --verbose",
|
|
13
|
+
"watch": "tsc --watch"
|
|
14
|
+
},
|
|
15
|
+
"license": "LGPL-3.0-only",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@ordinlabs/prettier-config-wsm": "^2.2.2",
|
|
18
|
+
"@types/jest": "^27.4.1",
|
|
19
|
+
"@types/jsbn": "^1.2.30",
|
|
20
|
+
"jest": "26.6.0",
|
|
21
|
+
"prettier": "^2.6.2",
|
|
22
|
+
"rimraf": "^3.0.2",
|
|
23
|
+
"ts-jest": "^26.5.6",
|
|
24
|
+
"typescript": "^4.9"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@kubernetes/client-node": "^0.20.0",
|
|
28
|
+
"cuid": "^2.1.8",
|
|
29
|
+
"ip-address": "^8.1.0",
|
|
30
|
+
"moment": "^2.29.3",
|
|
31
|
+
"moment-timezone": "^0.5.34"
|
|
32
|
+
},
|
|
33
|
+
"prettier": "@ordinlabs/prettier-config-wsm",
|
|
34
|
+
"gitHead": "fda36ef46bf4d285c80dd7c20d5e350ed09d37a6",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public",
|
|
37
|
+
"registry": "https://registry.npmjs.org/"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AllowListEntry = {
|
|
2
|
+
value: string;
|
|
3
|
+
comment?: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type HttpAccessRule = {
|
|
7
|
+
id: string;
|
|
8
|
+
anyIp: boolean;
|
|
9
|
+
allowedIps?: AllowListEntry[];
|
|
10
|
+
anyPath: boolean;
|
|
11
|
+
allowedPaths?: AllowListEntry[];
|
|
12
|
+
enableCloudEditing?: boolean;
|
|
13
|
+
comment?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type HasHttpAccessRules = {
|
|
17
|
+
httpAccessRules?: HttpAccessRule[];
|
|
18
|
+
};
|
package/src/apiKey.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type APIKeyInfo = {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
note: string;
|
|
5
|
+
created: number;
|
|
6
|
+
expiresAt: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type APIKey = APIKeyInfo & {
|
|
10
|
+
secret: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type CreateAPIKeyRequest = {
|
|
14
|
+
note: string;
|
|
15
|
+
expiresAt: number;
|
|
16
|
+
};
|
package/src/base.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type HasId<K = string> = {
|
|
2
|
+
id: K;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type DatedObject = {
|
|
6
|
+
created: number;
|
|
7
|
+
lastModified: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type HasKubeStructureVersion = {
|
|
11
|
+
kubeStructureVersion: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type IdAndName<K = string> = {
|
|
15
|
+
id: K;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type DataObject<K = string> = HasId<K> & DatedObject;
|
|
20
|
+
export type NamedDataObject<K = string> = IdAndName<K> & DatedObject;
|
|
21
|
+
export type UnsavedDataObject<T extends DataObject> = Omit<
|
|
22
|
+
T,
|
|
23
|
+
'id' | 'created' | 'lastModified'
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export type Optional<Type, Key extends keyof Type> = Omit<Type, Key> &
|
|
27
|
+
Partial<Pick<Type, Key>>;
|
|
28
|
+
|
|
29
|
+
export function isEntity(obj: any): obj is DataObject<string> {
|
|
30
|
+
return typeof obj?.id === 'string' && isUnsavedEntity(obj);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isUnsavedEntity(obj: any): obj is UnsavedDataObject<any> {
|
|
34
|
+
return typeof obj === 'object' && typeof obj?.name === 'string';
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ClientConfig = {
|
|
2
|
+
appVersion: string;
|
|
3
|
+
sshHost: string;
|
|
4
|
+
sshNamePrefix: string;
|
|
5
|
+
workspaceDomain: string;
|
|
6
|
+
projectTemplateDefaults: Record<string, object>;
|
|
7
|
+
workspaceTemplateDefaults: Record<string, object>;
|
|
8
|
+
serverIpRanges: string[];
|
|
9
|
+
defaultTimezone: string;
|
|
10
|
+
authProviders: string[];
|
|
11
|
+
approvedGoogleDomains: string[];
|
|
12
|
+
vpnSupportEnabled: boolean;
|
|
13
|
+
};
|
package/src/developer.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ApplicationRole } from './rbac';
|
|
2
|
+
import {
|
|
3
|
+
isEntity,
|
|
4
|
+
isUnsavedEntity,
|
|
5
|
+
NamedDataObject,
|
|
6
|
+
UnsavedDataObject,
|
|
7
|
+
} from './base';
|
|
8
|
+
|
|
9
|
+
export type DeveloperInfo = NamedDataObject & {
|
|
10
|
+
email: string;
|
|
11
|
+
appRole?: ApplicationRole;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type Developer = DeveloperInfo & {
|
|
15
|
+
/** @deprecated use `publicKeys` instead */
|
|
16
|
+
publicKey?: string;
|
|
17
|
+
publicKeys: string[];
|
|
18
|
+
timezone?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type UnsavedDeveloper = UnsavedDataObject<Developer>;
|
|
22
|
+
|
|
23
|
+
export function isUnsavedDeveloper(obj: any): obj is UnsavedDeveloper {
|
|
24
|
+
return isUnsavedEntity(obj) && typeof obj.email === 'string';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isDeveloper(obj: any): obj is Developer {
|
|
28
|
+
return isEntity(obj) && isUnsavedDeveloper(obj);
|
|
29
|
+
}
|
package/src/group.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isEntity,
|
|
3
|
+
isUnsavedEntity,
|
|
4
|
+
NamedDataObject,
|
|
5
|
+
UnsavedDataObject,
|
|
6
|
+
} from './base';
|
|
7
|
+
import { GroupRole } from './rbac';
|
|
8
|
+
import { UserAssociation, UserAssociationId } from './memberships';
|
|
9
|
+
|
|
10
|
+
export type GroupInfo = NamedDataObject;
|
|
11
|
+
export type MyGroupInfo = GroupInfo & {
|
|
12
|
+
role?: GroupRole;
|
|
13
|
+
};
|
|
14
|
+
export type Group = GroupInfo;
|
|
15
|
+
export type UnsavedGroup = UnsavedDataObject<Group>;
|
|
16
|
+
|
|
17
|
+
export function isUnsavedGroup(obj: any): obj is UnsavedGroup {
|
|
18
|
+
return isUnsavedEntity(obj);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function isGroup(obj: any): obj is Group {
|
|
22
|
+
return isEntity(obj) && isUnsavedGroup(obj);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// User memberships
|
|
26
|
+
|
|
27
|
+
export type UserGroupRoleId = UserAssociationId & {
|
|
28
|
+
groupId: string;
|
|
29
|
+
};
|
|
30
|
+
export type UserGroupRole = UserAssociation<GroupRole, UserGroupRoleId>;
|
|
31
|
+
|
|
32
|
+
export function isUserGroupRoleId(obj: any): obj is UserGroupRoleId {
|
|
33
|
+
return typeof obj?.userId === 'string' && typeof obj?.groupId === 'string';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function isUserGroupRole(obj: any): obj is UserGroupRole {
|
|
37
|
+
return isUserGroupRoleId(obj.id) && typeof obj?.role === 'string';
|
|
38
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './accessRules';
|
|
2
|
+
export * from './apiKey';
|
|
3
|
+
export * from './base';
|
|
4
|
+
export * from './clientConfig';
|
|
5
|
+
export * from './developer';
|
|
6
|
+
export * from './group';
|
|
7
|
+
export * from './login';
|
|
8
|
+
export * from './memberships';
|
|
9
|
+
export * from './navData';
|
|
10
|
+
export * from './network';
|
|
11
|
+
export * from './node';
|
|
12
|
+
export * from './project';
|
|
13
|
+
export * from './publicKey';
|
|
14
|
+
export * from './reflection';
|
|
15
|
+
export * from './reporting';
|
|
16
|
+
export * from './requests';
|
|
17
|
+
export * from './session';
|
|
18
|
+
export * from './workspace';
|
|
19
|
+
export * from './k8s';
|
|
20
|
+
export * from './nginx-ingress-types';
|
|
21
|
+
export * from './rbac';
|
package/src/k8s.ts
ADDED
package/src/login.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Developer } from './developer';
|
|
2
|
+
import { NavData } from './navData';
|
|
3
|
+
|
|
4
|
+
export type PasswordOptions = {
|
|
5
|
+
mustChange: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type PasswordMetadata = PasswordOptions & {
|
|
9
|
+
failureCount: number;
|
|
10
|
+
lastChanged: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const BAD_LOGIN_CREDENTIALS = 1;
|
|
14
|
+
export const TOO_MANY_LOGIN_FAILURES = 2;
|
|
15
|
+
export const LOGIN_BLOCKED = 3;
|
|
16
|
+
export type LoginErrorCode =
|
|
17
|
+
| typeof BAD_LOGIN_CREDENTIALS
|
|
18
|
+
| typeof TOO_MANY_LOGIN_FAILURES
|
|
19
|
+
| typeof LOGIN_BLOCKED;
|
|
20
|
+
export type LoginRequest = {
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
rememberMe: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type LoginSuccess = {
|
|
26
|
+
success: true;
|
|
27
|
+
mustChangePassword: boolean;
|
|
28
|
+
developer: Developer;
|
|
29
|
+
};
|
|
30
|
+
export type LoginFailure = {
|
|
31
|
+
success: false;
|
|
32
|
+
errorCode: LoginErrorCode;
|
|
33
|
+
};
|
|
34
|
+
export type LoginResult = LoginSuccess | LoginFailure;
|
|
35
|
+
export type RPCLoginSuccess = LoginSuccess & { navData: NavData };
|
|
36
|
+
export type RPCLoginResult = RPCLoginSuccess | LoginFailure;
|
package/src/navData.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ClientConfig } from './clientConfig';
|
|
2
|
+
import { WorkspaceInfo } from './workspace';
|
|
3
|
+
import { MyProjectInfo } from './project';
|
|
4
|
+
import { DeveloperInfo } from './developer';
|
|
5
|
+
import { MyGroupInfo } from './group';
|
|
6
|
+
import { NodeInfo, RunningPodInfo } from './node';
|
|
7
|
+
|
|
8
|
+
export type NavData = {
|
|
9
|
+
config: ClientConfig;
|
|
10
|
+
workspaces: WorkspaceInfo[];
|
|
11
|
+
projects: MyProjectInfo[];
|
|
12
|
+
developers: DeveloperInfo[];
|
|
13
|
+
groups: MyGroupInfo[];
|
|
14
|
+
nodes: NodeInfo[];
|
|
15
|
+
runningPods: RunningPodInfo;
|
|
16
|
+
};
|
package/src/network.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DataObject, Optional, UnsavedDataObject } from './base';
|
|
2
|
+
|
|
3
|
+
export type PortMapTypes = 'xdebug' | 'custom';
|
|
4
|
+
|
|
5
|
+
export type PortMap = {
|
|
6
|
+
type: PortMapTypes;
|
|
7
|
+
label: string;
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type UnsavedPortMap = Optional<PortMap, 'from'>;
|
|
13
|
+
|
|
14
|
+
export type WireGuardPeer = DataObject & {
|
|
15
|
+
label: string;
|
|
16
|
+
userId: string;
|
|
17
|
+
publicKey: string;
|
|
18
|
+
privateKey: string;
|
|
19
|
+
preSharedKey: string;
|
|
20
|
+
ipAddress: string;
|
|
21
|
+
portMaps?: (PortMap | UnsavedPortMap)[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type UnsavedWireGuardPeer = Optional<
|
|
25
|
+
UnsavedDataObject<WireGuardPeer>,
|
|
26
|
+
'publicKey' | 'privateKey' | 'preSharedKey' | 'ipAddress'
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export function isUnsavedWireGuardPeer(obj: any): obj is UnsavedWireGuardPeer {
|
|
30
|
+
return typeof obj === 'object' && typeof obj?.id === 'undefined';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isWireGuardPeer(obj: any): obj is WireGuardPeer {
|
|
34
|
+
return typeof obj === 'object' && typeof obj?.id === 'string';
|
|
35
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/*
|
|
2
|
+
See https://docs.nginx.com/nginx-ingress-controller/configuration/virtualserver-and-virtualserverroute-resources/
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
KubernetesListObject,
|
|
7
|
+
KubernetesObject,
|
|
8
|
+
} from '@kubernetes/client-node';
|
|
9
|
+
|
|
10
|
+
export type VirtualServer = KubernetesObject & {
|
|
11
|
+
spec: VirtualServerSpec;
|
|
12
|
+
status?: {
|
|
13
|
+
externalEndpoints?: {
|
|
14
|
+
ip?: string;
|
|
15
|
+
ports?: string;
|
|
16
|
+
}[];
|
|
17
|
+
message?: string;
|
|
18
|
+
reason?: string;
|
|
19
|
+
state?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type VirtualServerRoute = KubernetesObject & {
|
|
24
|
+
spec: VirtualServerRouteSpec;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type VirtualServerList = KubernetesListObject<VirtualServer>;
|
|
28
|
+
export type VirtualServerRouteList = KubernetesListObject<VirtualServerRoute>;
|
|
29
|
+
|
|
30
|
+
export type VirtualServerSpec = {
|
|
31
|
+
host: string;
|
|
32
|
+
tls?: TLS;
|
|
33
|
+
policies?: Policy[];
|
|
34
|
+
upstreams?: Upstream[];
|
|
35
|
+
routes?: Route[];
|
|
36
|
+
ingressClassName?: string;
|
|
37
|
+
'http-snippets'?: string;
|
|
38
|
+
'server-snippets'?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type VirtualServerRouteSpec = {
|
|
42
|
+
host: string;
|
|
43
|
+
upstreams?: Upstream[];
|
|
44
|
+
subroutes?: Subroute[];
|
|
45
|
+
ingressClassName?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type Subroute = {
|
|
49
|
+
path: string;
|
|
50
|
+
policies?: Policy[];
|
|
51
|
+
action?: Action;
|
|
52
|
+
splits?: Split[];
|
|
53
|
+
matches?: Matches;
|
|
54
|
+
errorPages?: ErrorPage[];
|
|
55
|
+
'location-snippets'?: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type TLS = {
|
|
59
|
+
secret?: string;
|
|
60
|
+
redirect?: {
|
|
61
|
+
enable?: boolean;
|
|
62
|
+
code?: number;
|
|
63
|
+
basedOn?: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type Policy = {
|
|
68
|
+
name: string;
|
|
69
|
+
namespace?: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type Timeouts = {
|
|
73
|
+
'connect-timeout'?: string;
|
|
74
|
+
'read-timeout'?: string;
|
|
75
|
+
'send-timeout'?: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type Upstream = Timeouts & {
|
|
79
|
+
name: string;
|
|
80
|
+
service: string;
|
|
81
|
+
subselector?: Record<string, string>;
|
|
82
|
+
'use-cluster-ip'?: boolean;
|
|
83
|
+
port: number;
|
|
84
|
+
'lb-method'?: string;
|
|
85
|
+
'fail-timeout'?: string;
|
|
86
|
+
'max-fails'?: number;
|
|
87
|
+
'max-conns'?: number;
|
|
88
|
+
keepalive?: number;
|
|
89
|
+
'next-upstream'?: string;
|
|
90
|
+
'next-upstream-timeout'?: string;
|
|
91
|
+
'next-upstream-tries'?: number;
|
|
92
|
+
'client-max-body-size'?: string;
|
|
93
|
+
tls?: {
|
|
94
|
+
enable?: boolean;
|
|
95
|
+
};
|
|
96
|
+
healthCheck?: HealthCheck;
|
|
97
|
+
'slow-start'?: string;
|
|
98
|
+
queue?: {
|
|
99
|
+
size: number;
|
|
100
|
+
timeout?: string;
|
|
101
|
+
};
|
|
102
|
+
buffering?: boolean;
|
|
103
|
+
buffers?: {
|
|
104
|
+
number: number;
|
|
105
|
+
size: string;
|
|
106
|
+
};
|
|
107
|
+
'buffer-size'?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type HealthCheck = Timeouts & {
|
|
111
|
+
enable?: boolean;
|
|
112
|
+
path?: string;
|
|
113
|
+
interval?: string;
|
|
114
|
+
jitter?: string;
|
|
115
|
+
fails?: number;
|
|
116
|
+
passes?: number;
|
|
117
|
+
port?: number;
|
|
118
|
+
tls?: {
|
|
119
|
+
enable?: boolean;
|
|
120
|
+
};
|
|
121
|
+
headers: Header[];
|
|
122
|
+
statusMatch: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
type Header = {
|
|
126
|
+
name: string;
|
|
127
|
+
value?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type Route = {
|
|
131
|
+
path: string;
|
|
132
|
+
policies?: Policy[];
|
|
133
|
+
action?: Action;
|
|
134
|
+
splits?: Split[];
|
|
135
|
+
matches?: Matches;
|
|
136
|
+
route?: string;
|
|
137
|
+
errorPages?: ErrorPage[];
|
|
138
|
+
'location-snippets'?: string;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
type PassAction = {
|
|
142
|
+
pass: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
type RedirectAction = {
|
|
146
|
+
redirect: {
|
|
147
|
+
url: string;
|
|
148
|
+
code?: number;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
type ReturnAction = {
|
|
153
|
+
return: {
|
|
154
|
+
code?: number;
|
|
155
|
+
type?: string;
|
|
156
|
+
body: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
type ProxyAction = {
|
|
161
|
+
proxy: {
|
|
162
|
+
upstream: string;
|
|
163
|
+
requestHeaders?: ProxyRequestHeaders;
|
|
164
|
+
responseHeaders?: ProxyResponseHeaders;
|
|
165
|
+
rewritePath?: string;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
type ProxyRequestHeaders = {
|
|
170
|
+
pass?: boolean;
|
|
171
|
+
set: Header[];
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
type ProxyResponseHeaders = {
|
|
175
|
+
hide?: boolean;
|
|
176
|
+
pass?: string[];
|
|
177
|
+
ignore?: string[];
|
|
178
|
+
add?: AddHeader[];
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
type AddHeader = Header & {
|
|
182
|
+
always?: boolean;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type Action = PassAction | RedirectAction | ReturnAction | ProxyAction;
|
|
186
|
+
|
|
187
|
+
export type Split = {
|
|
188
|
+
weight: number;
|
|
189
|
+
action: Action;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export type Matches = {
|
|
193
|
+
conditions: Condition[];
|
|
194
|
+
action?: Action;
|
|
195
|
+
splits?: Split[];
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export type Condition = {
|
|
199
|
+
header?: string;
|
|
200
|
+
cookie?: string;
|
|
201
|
+
argument?: string;
|
|
202
|
+
variable?: string;
|
|
203
|
+
value: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export type ErrorPage = {
|
|
207
|
+
codes: number[];
|
|
208
|
+
redirect?: {
|
|
209
|
+
code?: number;
|
|
210
|
+
url: string;
|
|
211
|
+
};
|
|
212
|
+
return?: {
|
|
213
|
+
code?: number;
|
|
214
|
+
type?: string;
|
|
215
|
+
body: string;
|
|
216
|
+
headers?: Header[];
|
|
217
|
+
};
|
|
218
|
+
};
|
package/src/node.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IdAndName } from './base';
|
|
2
|
+
|
|
3
|
+
export type NodeInfo = IdAndName & {
|
|
4
|
+
launchDate: number;
|
|
5
|
+
labels: Record<string, string>;
|
|
6
|
+
annotations: Record<string, string>;
|
|
7
|
+
ip: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type RunningPodInfo = {
|
|
11
|
+
projects: Record<string, number>;
|
|
12
|
+
workspaces: Record<string, number>;
|
|
13
|
+
};
|