@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.
Files changed (93) hide show
  1. package/LICENSE.md +674 -0
  2. package/README.md +4 -0
  3. package/dist/accessRules.d.ts +16 -0
  4. package/dist/accessRules.js +3 -0
  5. package/dist/accessRules.js.map +1 -0
  6. package/dist/apiKey.d.ts +14 -0
  7. package/dist/apiKey.js +3 -0
  8. package/dist/apiKey.js.map +1 -0
  9. package/dist/base.d.ts +20 -0
  10. package/dist/base.js +12 -0
  11. package/dist/base.js.map +1 -0
  12. package/dist/clientConfig.d.ts +13 -0
  13. package/dist/clientConfig.js +3 -0
  14. package/dist/clientConfig.js.map +1 -0
  15. package/dist/developer.d.ts +15 -0
  16. package/dist/developer.js +13 -0
  17. package/dist/developer.js.map +1 -0
  18. package/dist/group.d.ts +17 -0
  19. package/dist/group.js +21 -0
  20. package/dist/group.js.map +1 -0
  21. package/dist/index.d.ts +21 -0
  22. package/dist/index.js +38 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/k8s.d.ts +11 -0
  25. package/dist/k8s.js +3 -0
  26. package/dist/k8s.js.map +1 -0
  27. package/dist/login.d.ts +32 -0
  28. package/dist/login.js +7 -0
  29. package/dist/login.js.map +1 -0
  30. package/dist/memberships.d.ts +7 -0
  31. package/dist/memberships.js +3 -0
  32. package/dist/memberships.js.map +1 -0
  33. package/dist/navData.d.ts +15 -0
  34. package/dist/navData.js +3 -0
  35. package/dist/navData.js.map +1 -0
  36. package/dist/network.d.ts +21 -0
  37. package/dist/network.js +12 -0
  38. package/dist/network.js.map +1 -0
  39. package/dist/nginx-ingress-types.d.ts +187 -0
  40. package/dist/nginx-ingress-types.js +6 -0
  41. package/dist/nginx-ingress-types.js.map +1 -0
  42. package/dist/node.d.ts +11 -0
  43. package/dist/node.js +3 -0
  44. package/dist/node.js.map +1 -0
  45. package/dist/project.d.ts +91 -0
  46. package/dist/project.js +37 -0
  47. package/dist/project.js.map +1 -0
  48. package/dist/publicKey.d.ts +17 -0
  49. package/dist/publicKey.js +3 -0
  50. package/dist/publicKey.js.map +1 -0
  51. package/dist/rbac.d.ts +3 -0
  52. package/dist/rbac.js +3 -0
  53. package/dist/rbac.js.map +1 -0
  54. package/dist/reflection.d.ts +7 -0
  55. package/dist/reflection.js +23 -0
  56. package/dist/reflection.js.map +1 -0
  57. package/dist/reporting.d.ts +35 -0
  58. package/dist/reporting.js +16 -0
  59. package/dist/reporting.js.map +1 -0
  60. package/dist/requests.d.ts +22 -0
  61. package/dist/requests.js +3 -0
  62. package/dist/requests.js.map +1 -0
  63. package/dist/session.d.ts +12 -0
  64. package/dist/session.js +3 -0
  65. package/dist/session.js.map +1 -0
  66. package/dist/tsconfig.tsbuildinfo +1 -0
  67. package/dist/workspace.d.ts +69 -0
  68. package/dist/workspace.js +23 -0
  69. package/dist/workspace.js.map +1 -0
  70. package/package.json +39 -0
  71. package/src/accessRules.ts +18 -0
  72. package/src/apiKey.ts +16 -0
  73. package/src/base.ts +35 -0
  74. package/src/clientConfig.ts +13 -0
  75. package/src/developer.ts +29 -0
  76. package/src/group.ts +38 -0
  77. package/src/index.ts +21 -0
  78. package/src/k8s.ts +4 -0
  79. package/src/login.ts +36 -0
  80. package/src/memberships.ts +12 -0
  81. package/src/navData.ts +16 -0
  82. package/src/network.ts +35 -0
  83. package/src/nginx-ingress-types.ts +218 -0
  84. package/src/node.ts +13 -0
  85. package/src/project.ts +166 -0
  86. package/src/publicKey.ts +21 -0
  87. package/src/rbac.ts +5 -0
  88. package/src/reflection.ts +19 -0
  89. package/src/reporting.ts +60 -0
  90. package/src/requests.ts +27 -0
  91. package/src/session.ts +14 -0
  92. package/src/workspace.ts +121 -0
  93. package/tsconfig.json +10 -0
@@ -0,0 +1,91 @@
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 { HasId, HasKubeStructureVersion, NamedDataObject, UnsavedDataObject } from './base';
8
+ import { Developer } from './developer';
9
+ import { UserAssociation, UserAssociationId } from './memberships';
10
+ import { PublicKey } from './publicKey';
11
+ export type ProjectTemplateId = 'm2' | 'basicPhp';
12
+ export type MageRunType = 'store' | 'website';
13
+ export type MageConfig = {
14
+ name: string;
15
+ runType: MageRunType;
16
+ runCode: string;
17
+ };
18
+ export type SubdomainConfig = MageConfig & {
19
+ useStorePaths?: boolean;
20
+ storePaths?: MageConfig[];
21
+ };
22
+ export type ProjectInfo = NamedDataObject & {
23
+ projectTemplate: ProjectTemplateId;
24
+ workspaceTemplate: WorkspaceTemplateId;
25
+ lastSeen?: number;
26
+ };
27
+ export type MyProjectInfo = ProjectInfo & {
28
+ role?: ProjectRole;
29
+ };
30
+ export type RepositorySpec = {
31
+ type?: 'git';
32
+ url: string;
33
+ };
34
+ export type Project = ProjectInfo & HasHttpAccessRules & HasKubeStructureVersion & {
35
+ subdomains: SubdomainConfig[];
36
+ projectParams: StoredParamValues<any>;
37
+ workspaceDefaultVolumeSize?: number;
38
+ workspaceParams: StoredParamValues<any>;
39
+ repositories: RepositorySpec[];
40
+ keyPairIds: string[];
41
+ namespace: string;
42
+ efsFolder: string;
43
+ nfsFolderSize: number;
44
+ };
45
+ export type UnsavedProject = Omit<UnsavedDataObject<Project>, 'namespace' | 'efsFolder' | 'kubeStructureVersion'>;
46
+ export declare function isUnsavedProject(obj: any): obj is UnsavedProject;
47
+ export declare function isProject(obj: any): obj is Project;
48
+ export type ProjectInspection = {
49
+ project: Project;
50
+ resolvedParams: object;
51
+ ns?: k8s.V1Namespace;
52
+ ebsVolumeClaims?: k8s.V1PersistentVolumeClaim[];
53
+ oldSharedVolumeClaim?: k8s.V1PersistentVolumeClaim;
54
+ oldSharedVolume?: k8s.V1PersistentVolume;
55
+ deployment: k8s.V1Deployment;
56
+ currentPod?: k8s.V1Pod | null;
57
+ service?: k8s.V1Service;
58
+ sshConfig?: k8s.V1ConfigMap;
59
+ virtualServers?: VirtualServer[];
60
+ publicKeys?: PublicKey[];
61
+ events?: k8s.CoreV1Event[];
62
+ };
63
+ export type UserProjectRoleId = UserAssociationId & {
64
+ projectId: string;
65
+ };
66
+ export type UserProjectRole = UserAssociation<ProjectRole, UserProjectRoleId>;
67
+ export type GitRepoRefInfo = {
68
+ type: 'tag' | 'note' | 'branch' | 'unknown';
69
+ name: string;
70
+ hash: string;
71
+ };
72
+ export type GetProjectRepoRefsResult = {
73
+ ok: true;
74
+ refs: GitRepoRefInfo[];
75
+ } | {
76
+ ok: false;
77
+ error: string;
78
+ };
79
+ export declare function isUserProjectRoleId(obj: any): obj is UserProjectRoleId;
80
+ export type ProjectMember = UserProjectRole & {
81
+ developer?: Developer;
82
+ fromGroup?: string;
83
+ };
84
+ export declare function isUserProjectRole(obj: any): obj is UserProjectRole;
85
+ export type GroupProjectId = {
86
+ groupId: string;
87
+ projectId: string;
88
+ };
89
+ export type GroupProject = HasId<GroupProjectId>;
90
+ export declare function isGroupProjectId(obj: any): obj is GroupProjectId;
91
+ export declare function isGroupProject(obj: any): obj is GroupProject;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGroupProject = exports.isGroupProjectId = exports.isUserProjectRole = exports.isUserProjectRoleId = exports.isProject = exports.isUnsavedProject = void 0;
4
+ const base_1 = require("./base");
5
+ function isUnsavedProject(obj) {
6
+ if (!(0, base_1.isUnsavedEntity)(obj))
7
+ return false;
8
+ const p = obj;
9
+ return Array.isArray(p.subdomains) && p.subdomains.length >= 1;
10
+ }
11
+ exports.isUnsavedProject = isUnsavedProject;
12
+ function isProject(obj) {
13
+ if (!(0, base_1.isEntity)(obj) || !isUnsavedProject(obj))
14
+ return false;
15
+ // TODO: validate optional/defaulted fields
16
+ return true;
17
+ }
18
+ exports.isProject = isProject;
19
+ function isUserProjectRoleId(obj) {
20
+ return (typeof (obj === null || obj === void 0 ? void 0 : obj.userId) === 'string' && typeof (obj === null || obj === void 0 ? void 0 : obj.projectId) === 'string');
21
+ }
22
+ exports.isUserProjectRoleId = isUserProjectRoleId;
23
+ function isUserProjectRole(obj) {
24
+ return isUserProjectRoleId(obj.id) && typeof (obj === null || obj === void 0 ? void 0 : obj.role) === 'string';
25
+ }
26
+ exports.isUserProjectRole = isUserProjectRole;
27
+ function isGroupProjectId(obj) {
28
+ return (obj &&
29
+ typeof obj.groupId === 'string' &&
30
+ typeof obj.projectId === 'string');
31
+ }
32
+ exports.isGroupProjectId = isGroupProjectId;
33
+ function isGroupProject(obj) {
34
+ return obj && isGroupProjectId(obj.id);
35
+ }
36
+ exports.isGroupProject = isGroupProject;
37
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":";;;AAMA,iCAOgB;AA0DhB,SAAgB,gBAAgB,CAAC,GAAQ;IACrC,IAAI,CAAC,IAAA,sBAAe,EAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,MAAM,CAAC,GAAG,GAAqB,CAAC;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;AACnE,CAAC;AAJD,4CAIC;AAED,SAAgB,SAAS,CAAC,GAAQ;IAC9B,IAAI,CAAC,IAAA,eAAQ,EAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AAChB,CAAC;AAJD,8BAIC;AAmDD,SAAgB,mBAAmB,CAAC,GAAQ;IACxC,OAAO,CACH,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAA,KAAK,QAAQ,IAAI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,SAAS,CAAA,KAAK,QAAQ,CACxE,CAAC;AACN,CAAC;AAJD,kDAIC;AAOD,SAAgB,iBAAiB,CAAC,GAAQ;IACtC,OAAO,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA,KAAK,QAAQ,CAAC;AACxE,CAAC;AAFD,8CAEC;AAUD,SAAgB,gBAAgB,CAAC,GAAQ;IACrC,OAAO,CACH,GAAG;QACH,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,CACpC,CAAC;AACN,CAAC;AAND,4CAMC;AAED,SAAgB,cAAc,CAAC,GAAQ;IACnC,OAAO,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC;AAFD,wCAEC"}
@@ -0,0 +1,17 @@
1
+ import { DataObject } from './base';
2
+ export type PublicKey = DataObject & {
3
+ publicKey: string;
4
+ algorithm: string;
5
+ };
6
+ export type AddKeyPairRequest = {
7
+ projectId: string;
8
+ mode: 'replace' | 'add';
9
+ };
10
+ export type TestGitAccessRequest = {
11
+ keyId: string;
12
+ repoUrl: string;
13
+ };
14
+ export type TestGitAccessResponse = {
15
+ ok: boolean;
16
+ error?: string;
17
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=publicKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicKey.js","sourceRoot":"","sources":["../src/publicKey.ts"],"names":[],"mappings":""}
package/dist/rbac.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type ApplicationRole = 'user' | 'projectManager' | 'admin' | 'blocked';
2
+ export type ProjectRole = 'member' | 'admin' | 'owner' | 'guest';
3
+ export type GroupRole = 'member' | 'admin' | 'owner';
package/dist/rbac.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=rbac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac.js","sourceRoot":"","sources":["../src/rbac.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { Workspace } from './workspace';
2
+ import { Developer } from './developer';
3
+ import { Project } from './project';
4
+ import { Group } from './group';
5
+ export type Entity = Developer | Project | Workspace | Group;
6
+ export type EntityType = 'project' | 'workspace' | 'developer' | 'group';
7
+ export declare function getEntityType(obj: any): EntityType | undefined;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEntityType = void 0;
4
+ const workspace_1 = require("./workspace");
5
+ const developer_1 = require("./developer");
6
+ const project_1 = require("./project");
7
+ const group_1 = require("./group");
8
+ function getEntityType(obj) {
9
+ if ((0, workspace_1.isUnsavedWorkspace)(obj)) {
10
+ return 'workspace';
11
+ }
12
+ else if ((0, developer_1.isUnsavedDeveloper)(obj)) {
13
+ return 'developer';
14
+ }
15
+ else if ((0, project_1.isUnsavedProject)(obj)) {
16
+ return 'project';
17
+ }
18
+ else if ((0, group_1.isUnsavedGroup)(obj)) {
19
+ return 'group';
20
+ }
21
+ }
22
+ exports.getEntityType = getEntityType;
23
+ //# sourceMappingURL=reflection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflection.js","sourceRoot":"","sources":["../src/reflection.ts"],"names":[],"mappings":";;;AAAA,2CAA4D;AAC5D,2CAA4D;AAC5D,uCAAsD;AACtD,mCAAgD;AAKhD,SAAgB,aAAa,CAAC,GAAQ;IAClC,IAAI,IAAA,8BAAkB,EAAC,GAAG,CAAC,EAAE;QACzB,OAAO,WAAW,CAAC;KACtB;SAAM,IAAI,IAAA,8BAAkB,EAAC,GAAG,CAAC,EAAE;QAChC,OAAO,WAAW,CAAC;KACtB;SAAM,IAAI,IAAA,0BAAgB,EAAC,GAAG,CAAC,EAAE;QAC9B,OAAO,SAAS,CAAC;KACpB;SAAM,IAAI,IAAA,sBAAc,EAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,OAAO,CAAC;KAClB;AACL,CAAC;AAVD,sCAUC"}
@@ -0,0 +1,35 @@
1
+ export type TimeWindow = {
2
+ from: number;
3
+ to: number;
4
+ };
5
+ export type TimeGranularity = 'fiveMinutes' | 'hour' | 'day' | 'week' | 'month';
6
+ export type UptimeProperties = {
7
+ startedById?: string;
8
+ ownerId?: string;
9
+ projectId?: string;
10
+ workspaceId?: string;
11
+ };
12
+ export type UptimePropertyName = keyof UptimeProperties;
13
+ export type UptimeQuery = {
14
+ when: TimeWindow;
15
+ where: UptimeProperties;
16
+ };
17
+ export type GroupedUptimeQuery = UptimeQuery & {
18
+ groupBy?: UptimePropertyName;
19
+ };
20
+ export type UptimeTimeSeriesQuery = GroupedUptimeQuery & {
21
+ granularity?: TimeGranularity;
22
+ };
23
+ export type UptimeRecord = {
24
+ groupKey: string;
25
+ groupLabel?: string;
26
+ minutes: number;
27
+ };
28
+ export type UptimeTimeSeriesEntry = {
29
+ ts: number;
30
+ total: number;
31
+ counts: UptimeRecord[];
32
+ };
33
+ export type UptimeTimeSeries = UptimeTimeSeriesEntry[];
34
+ export declare function getAllGroupKeys(series: UptimeTimeSeries): string[];
35
+ export declare function getAllGroupLabels(series: UptimeTimeSeries): string[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllGroupLabels = exports.getAllGroupKeys = void 0;
4
+ function getAllGroupKeys(series) {
5
+ const groupKeys = new Set();
6
+ series.forEach((point) => point.counts.forEach((count) => groupKeys.add(count.groupKey)));
7
+ return Array.from(groupKeys);
8
+ }
9
+ exports.getAllGroupKeys = getAllGroupKeys;
10
+ function getAllGroupLabels(series) {
11
+ const groupLabels = new Set();
12
+ series.forEach((point) => point.counts.forEach((count) => groupLabels.add(count.groupLabel || count.groupKey)));
13
+ return Array.from(groupLabels);
14
+ }
15
+ exports.getAllGroupLabels = getAllGroupLabels;
16
+ //# sourceMappingURL=reporting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporting.js","sourceRoot":"","sources":["../src/reporting.ts"],"names":[],"mappings":";;;AA2CA,SAAgB,eAAe,CAAC,MAAwB;IACpD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CACjE,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAND,0CAMC;AAED,SAAgB,iBAAiB,CAAC,MAAwB;IACtD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3B,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC,CACtD,CACJ,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AARD,8CAQC"}
@@ -0,0 +1,22 @@
1
+ import { ApplicationRole } from './rbac';
2
+ export type ListPodsRequest = {
3
+ namespace?: string;
4
+ labelSelector?: Record<string, string>;
5
+ fieldSelector?: Record<string, string>;
6
+ };
7
+ export type UpdateExpirationRequest = {
8
+ id: string;
9
+ deadline: number;
10
+ };
11
+ export type AuthRequest = {
12
+ token: string;
13
+ };
14
+ export type UpdateUserRoleRequest = {
15
+ userId: string;
16
+ role: ApplicationRole;
17
+ };
18
+ export type ChangePasswordRequest = {
19
+ developerId: string;
20
+ password?: string;
21
+ mustChangeOnNextLogin: boolean;
22
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["../src/requests.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { Developer } from './developer';
2
+ import { NavData } from './navData';
3
+ export type ImpersonationResponse = {
4
+ developer: Developer;
5
+ navData: NavData;
6
+ hasPassword: boolean;
7
+ };
8
+ export type SessionInfo = {
9
+ currentUser: Developer | null;
10
+ impersonatedFrom: Developer | null;
11
+ hasPassword: boolean;
12
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":""}