@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/src/project.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as k8s from '@kubernetes/client-node';
|
|
2
|
+
import { VirtualServer } from './nginx-ingress-types';
|
|
3
|
+
import { StoredParamValues } from '@ordinlabs/wsm-common/dist/param-types';
|
|
4
|
+
import { ProjectRole } from './rbac';
|
|
5
|
+
import { WorkspaceTemplateId } from './workspace';
|
|
6
|
+
import { HasHttpAccessRules } from './accessRules';
|
|
7
|
+
import {
|
|
8
|
+
HasId,
|
|
9
|
+
HasKubeStructureVersion,
|
|
10
|
+
isEntity,
|
|
11
|
+
isUnsavedEntity,
|
|
12
|
+
NamedDataObject,
|
|
13
|
+
UnsavedDataObject,
|
|
14
|
+
} from './base';
|
|
15
|
+
import { Developer } from './developer';
|
|
16
|
+
import { UserAssociation, UserAssociationId } from './memberships';
|
|
17
|
+
import { PublicKey } from './publicKey';
|
|
18
|
+
|
|
19
|
+
export type ProjectTemplateId = 'm2' | 'basicPhp';
|
|
20
|
+
|
|
21
|
+
export type MageRunType = 'store' | 'website';
|
|
22
|
+
|
|
23
|
+
export type MageConfig = {
|
|
24
|
+
name: string;
|
|
25
|
+
runType: MageRunType;
|
|
26
|
+
runCode: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type SubdomainConfig = MageConfig & {
|
|
30
|
+
useStorePaths?: boolean;
|
|
31
|
+
storePaths?: MageConfig[];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type ProjectInfo = NamedDataObject & {
|
|
35
|
+
projectTemplate: ProjectTemplateId;
|
|
36
|
+
// Must match the name on Workspace
|
|
37
|
+
workspaceTemplate: WorkspaceTemplateId;
|
|
38
|
+
lastSeen?: number;
|
|
39
|
+
};
|
|
40
|
+
export type MyProjectInfo = ProjectInfo & {
|
|
41
|
+
role?: ProjectRole;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type RepositorySpec = {
|
|
45
|
+
type?: 'git'; // one day we may support other repositories
|
|
46
|
+
url: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type Project = ProjectInfo &
|
|
50
|
+
HasHttpAccessRules &
|
|
51
|
+
HasKubeStructureVersion & {
|
|
52
|
+
subdomains: SubdomainConfig[];
|
|
53
|
+
projectParams: StoredParamValues<any>;
|
|
54
|
+
workspaceDefaultVolumeSize?: number;
|
|
55
|
+
// IMPORTANT: Must match the name on Workspace
|
|
56
|
+
workspaceParams: StoredParamValues<any>;
|
|
57
|
+
repositories: RepositorySpec[];
|
|
58
|
+
keyPairIds: string[];
|
|
59
|
+
|
|
60
|
+
// Calculated on creation
|
|
61
|
+
namespace: string;
|
|
62
|
+
// Calculated on creation
|
|
63
|
+
efsFolder: string;
|
|
64
|
+
nfsFolderSize: number;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type UnsavedProject = Omit<
|
|
68
|
+
UnsavedDataObject<Project>,
|
|
69
|
+
'namespace' | 'efsFolder' | 'kubeStructureVersion'
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
export function isUnsavedProject(obj: any): obj is UnsavedProject {
|
|
73
|
+
if (!isUnsavedEntity(obj)) return false;
|
|
74
|
+
const p = obj as UnsavedProject;
|
|
75
|
+
return Array.isArray(p.subdomains) && p.subdomains.length >= 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function isProject(obj: any): obj is Project {
|
|
79
|
+
if (!isEntity(obj) || !isUnsavedProject(obj)) return false;
|
|
80
|
+
// TODO: validate optional/defaulted fields
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type ProjectInspection = {
|
|
85
|
+
project: Project;
|
|
86
|
+
// The resolved parameters with defaults hydrated
|
|
87
|
+
resolvedParams: object;
|
|
88
|
+
ns?: k8s.V1Namespace;
|
|
89
|
+
// Volume claims used by the pod to store its local data
|
|
90
|
+
ebsVolumeClaims?: k8s.V1PersistentVolumeClaim[];
|
|
91
|
+
// Shared volume and claim
|
|
92
|
+
oldSharedVolumeClaim?: k8s.V1PersistentVolumeClaim;
|
|
93
|
+
oldSharedVolume?: k8s.V1PersistentVolume;
|
|
94
|
+
// The deployment that is scaled to manage pods.
|
|
95
|
+
deployment: k8s.V1Deployment;
|
|
96
|
+
// The pod containing services for use by workspaces.
|
|
97
|
+
currentPod?: k8s.V1Pod | null;
|
|
98
|
+
// The service enabling traffic to the pod.
|
|
99
|
+
service?: k8s.V1Service;
|
|
100
|
+
// The ConfigMap containing the developers' public keys.
|
|
101
|
+
sshConfig?: k8s.V1ConfigMap;
|
|
102
|
+
// The virtual servers for the project
|
|
103
|
+
virtualServers?: VirtualServer[];
|
|
104
|
+
// The public keys associated with this project
|
|
105
|
+
publicKeys?: PublicKey[];
|
|
106
|
+
// Events related to the pod
|
|
107
|
+
events?: k8s.CoreV1Event[];
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Project Memberships
|
|
111
|
+
|
|
112
|
+
export type UserProjectRoleId = UserAssociationId & {
|
|
113
|
+
projectId: string;
|
|
114
|
+
};
|
|
115
|
+
export type UserProjectRole = UserAssociation<ProjectRole, UserProjectRoleId>;
|
|
116
|
+
|
|
117
|
+
export type GitRepoRefInfo = {
|
|
118
|
+
type: 'tag' | 'note' | 'branch' | 'unknown';
|
|
119
|
+
name: string;
|
|
120
|
+
hash: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type GetProjectRepoRefsResult =
|
|
124
|
+
| {
|
|
125
|
+
ok: true;
|
|
126
|
+
refs: GitRepoRefInfo[];
|
|
127
|
+
}
|
|
128
|
+
| {
|
|
129
|
+
ok: false;
|
|
130
|
+
error: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export function isUserProjectRoleId(obj: any): obj is UserProjectRoleId {
|
|
134
|
+
return (
|
|
135
|
+
typeof obj?.userId === 'string' && typeof obj?.projectId === 'string'
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type ProjectMember = UserProjectRole & {
|
|
140
|
+
developer?: Developer;
|
|
141
|
+
fromGroup?: string;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export function isUserProjectRole(obj: any): obj is UserProjectRole {
|
|
145
|
+
return isUserProjectRoleId(obj.id) && typeof obj?.role === 'string';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Project group memberships
|
|
149
|
+
|
|
150
|
+
export type GroupProjectId = {
|
|
151
|
+
groupId: string;
|
|
152
|
+
projectId: string;
|
|
153
|
+
};
|
|
154
|
+
export type GroupProject = HasId<GroupProjectId>;
|
|
155
|
+
|
|
156
|
+
export function isGroupProjectId(obj: any): obj is GroupProjectId {
|
|
157
|
+
return (
|
|
158
|
+
obj &&
|
|
159
|
+
typeof obj.groupId === 'string' &&
|
|
160
|
+
typeof obj.projectId === 'string'
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function isGroupProject(obj: any): obj is GroupProject {
|
|
165
|
+
return obj && isGroupProjectId(obj.id);
|
|
166
|
+
}
|
package/src/publicKey.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DataObject } from './base';
|
|
2
|
+
|
|
3
|
+
export type PublicKey = DataObject & {
|
|
4
|
+
publicKey: string;
|
|
5
|
+
algorithm: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type AddKeyPairRequest = {
|
|
9
|
+
projectId: string;
|
|
10
|
+
mode: 'replace' | 'add';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type TestGitAccessRequest = {
|
|
14
|
+
keyId: string;
|
|
15
|
+
repoUrl: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type TestGitAccessResponse = {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
};
|
package/src/rbac.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isUnsavedWorkspace, Workspace } from './workspace';
|
|
2
|
+
import { Developer, isUnsavedDeveloper } from './developer';
|
|
3
|
+
import { isUnsavedProject, Project } from './project';
|
|
4
|
+
import { Group, isUnsavedGroup } from './group';
|
|
5
|
+
|
|
6
|
+
export type Entity = Developer | Project | Workspace | Group;
|
|
7
|
+
export type EntityType = 'project' | 'workspace' | 'developer' | 'group';
|
|
8
|
+
|
|
9
|
+
export function getEntityType(obj: any): EntityType | undefined {
|
|
10
|
+
if (isUnsavedWorkspace(obj)) {
|
|
11
|
+
return 'workspace';
|
|
12
|
+
} else if (isUnsavedDeveloper(obj)) {
|
|
13
|
+
return 'developer';
|
|
14
|
+
} else if (isUnsavedProject(obj)) {
|
|
15
|
+
return 'project';
|
|
16
|
+
} else if (isUnsavedGroup(obj)) {
|
|
17
|
+
return 'group';
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/reporting.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type TimeWindow = {
|
|
2
|
+
from: number;
|
|
3
|
+
to: number;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type TimeGranularity = 'fiveMinutes' | 'hour' | 'day' | 'week' | 'month';
|
|
7
|
+
|
|
8
|
+
export type UptimeProperties = {
|
|
9
|
+
startedById?: string;
|
|
10
|
+
ownerId?: string;
|
|
11
|
+
projectId?: string;
|
|
12
|
+
workspaceId?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type UptimePropertyName = keyof UptimeProperties;
|
|
16
|
+
|
|
17
|
+
export type UptimeQuery = {
|
|
18
|
+
when: TimeWindow;
|
|
19
|
+
where: UptimeProperties;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type GroupedUptimeQuery = UptimeQuery & {
|
|
23
|
+
groupBy?: UptimePropertyName;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type UptimeTimeSeriesQuery = GroupedUptimeQuery & {
|
|
27
|
+
granularity?: TimeGranularity;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type UptimeRecord = {
|
|
31
|
+
groupKey: string;
|
|
32
|
+
groupLabel?: string;
|
|
33
|
+
minutes: number;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type UptimeTimeSeriesEntry = {
|
|
37
|
+
ts: number;
|
|
38
|
+
total: number;
|
|
39
|
+
counts: UptimeRecord[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type UptimeTimeSeries = UptimeTimeSeriesEntry[];
|
|
43
|
+
|
|
44
|
+
export function getAllGroupKeys(series: UptimeTimeSeries): string[] {
|
|
45
|
+
const groupKeys = new Set<string>();
|
|
46
|
+
series.forEach((point) =>
|
|
47
|
+
point.counts.forEach((count) => groupKeys.add(count.groupKey))
|
|
48
|
+
);
|
|
49
|
+
return Array.from(groupKeys);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getAllGroupLabels(series: UptimeTimeSeries): string[] {
|
|
53
|
+
const groupLabels = new Set<string>();
|
|
54
|
+
series.forEach((point) =>
|
|
55
|
+
point.counts.forEach((count) =>
|
|
56
|
+
groupLabels.add(count.groupLabel || count.groupKey)
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
return Array.from(groupLabels);
|
|
60
|
+
}
|
package/src/requests.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ApplicationRole } from './rbac';
|
|
2
|
+
|
|
3
|
+
export type ListPodsRequest = {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
labelSelector?: Record<string, string>;
|
|
6
|
+
fieldSelector?: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type UpdateExpirationRequest = {
|
|
10
|
+
id: string;
|
|
11
|
+
deadline: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AuthRequest = {
|
|
15
|
+
token: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type UpdateUserRoleRequest = {
|
|
19
|
+
userId: string;
|
|
20
|
+
role: ApplicationRole;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type ChangePasswordRequest = {
|
|
24
|
+
developerId: string;
|
|
25
|
+
password?: string;
|
|
26
|
+
mustChangeOnNextLogin: boolean;
|
|
27
|
+
};
|
package/src/session.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Developer } from './developer';
|
|
2
|
+
import { NavData } from './navData';
|
|
3
|
+
|
|
4
|
+
export type ImpersonationResponse = {
|
|
5
|
+
developer: Developer;
|
|
6
|
+
navData: NavData;
|
|
7
|
+
hasPassword: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type SessionInfo = {
|
|
11
|
+
currentUser: Developer | null;
|
|
12
|
+
impersonatedFrom: Developer | null;
|
|
13
|
+
hasPassword: boolean;
|
|
14
|
+
};
|
package/src/workspace.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as k8s from '@kubernetes/client-node';
|
|
2
|
+
import { VirtualServer } from './nginx-ingress-types';
|
|
3
|
+
import { StoredParamValues } from '@ordinlabs/wsm-common/dist/param-types';
|
|
4
|
+
import { HasHttpAccessRules } from './accessRules';
|
|
5
|
+
import {
|
|
6
|
+
DataObject,
|
|
7
|
+
HasKubeStructureVersion,
|
|
8
|
+
isEntity,
|
|
9
|
+
isUnsavedEntity,
|
|
10
|
+
NamedDataObject,
|
|
11
|
+
UnsavedDataObject,
|
|
12
|
+
} from './base';
|
|
13
|
+
import { GitRepoRefInfo } from './project';
|
|
14
|
+
|
|
15
|
+
export type WorkspaceTemplateId =
|
|
16
|
+
| 'm2Ubuntu'
|
|
17
|
+
| 'm1V2'
|
|
18
|
+
| 'wordpressV2'
|
|
19
|
+
| 'drupalV2'
|
|
20
|
+
| 'laravel'
|
|
21
|
+
| 'm2'
|
|
22
|
+
| 'm1'
|
|
23
|
+
| 'wordpress'
|
|
24
|
+
| 'drupal';
|
|
25
|
+
|
|
26
|
+
export type WorkspaceInfo = NamedDataObject & {
|
|
27
|
+
projectId: string;
|
|
28
|
+
developerId: string;
|
|
29
|
+
lastSeen?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type WorkspaceInitType = 'empty' | 'repo' | 'install';
|
|
33
|
+
|
|
34
|
+
export type WorkspaceInitOptions = {
|
|
35
|
+
type: WorkspaceInitType;
|
|
36
|
+
repo?: string;
|
|
37
|
+
ref?: GitRepoRefInfo;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type Workspace = WorkspaceInfo &
|
|
41
|
+
HasHttpAccessRules &
|
|
42
|
+
HasKubeStructureVersion & {
|
|
43
|
+
volumeSize: number;
|
|
44
|
+
initOptions?: WorkspaceInitOptions;
|
|
45
|
+
initialized: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Represents a keypair in PrivateKey/PublicKey collections (shared ID, see crypto.ts).
|
|
49
|
+
* Used for SSH access into the workspace.
|
|
50
|
+
*/
|
|
51
|
+
keyPairId?: string;
|
|
52
|
+
|
|
53
|
+
// IMPORTANT: These field names must match those in Project
|
|
54
|
+
workspaceTemplate: WorkspaceTemplateId;
|
|
55
|
+
workspaceParams: StoredParamValues<any>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type UnsavedWorkspace = Omit<
|
|
59
|
+
UnsavedDataObject<Workspace>,
|
|
60
|
+
'kubeStructureVersion' | 'initialized' | 'lastSeen'
|
|
61
|
+
>;
|
|
62
|
+
|
|
63
|
+
export type WorkspaceDescription = DataObject & {
|
|
64
|
+
workspaceId: string;
|
|
65
|
+
description: string;
|
|
66
|
+
latest: boolean;
|
|
67
|
+
createdBy: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type UpdateWorkspaceDescriptionRequest = {
|
|
71
|
+
id: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type WorkspaceInspection = {
|
|
76
|
+
workspace: Workspace;
|
|
77
|
+
resolvedParams: object;
|
|
78
|
+
deployment: k8s.V1Deployment;
|
|
79
|
+
currentPod?: k8s.V1Pod;
|
|
80
|
+
initJob?: k8s.V1Job;
|
|
81
|
+
pvc?: k8s.V1PersistentVolumeClaim;
|
|
82
|
+
projectVolumes?: k8s.V1PersistentVolumeClaim[];
|
|
83
|
+
projectVirtualServers?: VirtualServer[];
|
|
84
|
+
internalService?: k8s.V1Service;
|
|
85
|
+
nodePortService?: k8s.V1Service;
|
|
86
|
+
ebsClaims?: k8s.V1PersistentVolumeClaim[];
|
|
87
|
+
ingress?: k8s.V1Ingress;
|
|
88
|
+
virtualServers?: VirtualServer[];
|
|
89
|
+
events?: k8s.CoreV1Event[];
|
|
90
|
+
description: WorkspaceDescription | null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type StartWorkspaceRequest = {
|
|
94
|
+
workspaceId: string;
|
|
95
|
+
expiration?: number;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export function isStartWorkspaceRequest(
|
|
99
|
+
obj: any
|
|
100
|
+
): obj is StartWorkspaceRequest {
|
|
101
|
+
return !!obj && typeof obj.workspaceId === 'string';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type WorkspaceInitLog = DataObject & {
|
|
105
|
+
log: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export function isUnsavedWorkspace(obj: any): obj is UnsavedWorkspace {
|
|
109
|
+
if (!isUnsavedEntity(obj)) return false;
|
|
110
|
+
return (
|
|
111
|
+
typeof obj.developerId === 'string' && typeof obj.projectId === 'string'
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function isWorkspace(obj: any): obj is Workspace {
|
|
116
|
+
return isEntity(obj) && isUnsavedWorkspace(obj);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function isWorkspaceLogRecord(obj: any): obj is WorkspaceInitLog {
|
|
120
|
+
return typeof obj.log === 'string' && isEntity(obj);
|
|
121
|
+
}
|