@privateaim/core-kit 0.6.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.
Files changed (191) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/LICENSE +202 -0
  3. package/README.md +5 -0
  4. package/dist/constants.d.ts +6 -0
  5. package/dist/constants.d.ts.map +1 -0
  6. package/dist/domains/analysis/constants.d.ts +47 -0
  7. package/dist/domains/analysis/constants.d.ts.map +1 -0
  8. package/dist/domains/analysis/entity.d.ts +30 -0
  9. package/dist/domains/analysis/entity.d.ts.map +1 -0
  10. package/dist/domains/analysis/index.d.ts +3 -0
  11. package/dist/domains/analysis/index.d.ts.map +1 -0
  12. package/dist/domains/analysis-bucket/constants.d.ts +6 -0
  13. package/dist/domains/analysis-bucket/constants.d.ts.map +1 -0
  14. package/dist/domains/analysis-bucket/entity.d.ts +20 -0
  15. package/dist/domains/analysis-bucket/entity.d.ts.map +1 -0
  16. package/dist/domains/analysis-bucket/index.d.ts +4 -0
  17. package/dist/domains/analysis-bucket/index.d.ts.map +1 -0
  18. package/dist/domains/analysis-bucket/utils.d.ts +4 -0
  19. package/dist/domains/analysis-bucket/utils.d.ts.map +1 -0
  20. package/dist/domains/analysis-bucket-file/entity.d.ts +25 -0
  21. package/dist/domains/analysis-bucket-file/entity.d.ts.map +1 -0
  22. package/dist/domains/analysis-bucket-file/index.d.ts +2 -0
  23. package/dist/domains/analysis-bucket-file/index.d.ts.map +1 -0
  24. package/dist/domains/analysis-log/entity.d.ts +50 -0
  25. package/dist/domains/analysis-log/entity.d.ts.map +1 -0
  26. package/dist/domains/analysis-log/index.d.ts +2 -0
  27. package/dist/domains/analysis-log/index.d.ts.map +1 -0
  28. package/dist/domains/analysis-node/constants.d.ts +20 -0
  29. package/dist/domains/analysis-node/constants.d.ts.map +1 -0
  30. package/dist/domains/analysis-node/entity.d.ts +35 -0
  31. package/dist/domains/analysis-node/entity.d.ts.map +1 -0
  32. package/dist/domains/analysis-node/index.d.ts +3 -0
  33. package/dist/domains/analysis-node/index.d.ts.map +1 -0
  34. package/dist/domains/constants.d.ts +31 -0
  35. package/dist/domains/constants.d.ts.map +1 -0
  36. package/dist/domains/index.d.ts +20 -0
  37. package/dist/domains/index.d.ts.map +1 -0
  38. package/dist/domains/master-image/constants.d.ts +8 -0
  39. package/dist/domains/master-image/constants.d.ts.map +1 -0
  40. package/dist/domains/master-image/entity.d.ts +18 -0
  41. package/dist/domains/master-image/entity.d.ts.map +1 -0
  42. package/dist/domains/master-image/index.d.ts +3 -0
  43. package/dist/domains/master-image/index.d.ts.map +1 -0
  44. package/dist/domains/master-image-group/entity.d.ts +17 -0
  45. package/dist/domains/master-image-group/entity.d.ts.map +1 -0
  46. package/dist/domains/master-image-group/index.d.ts +2 -0
  47. package/dist/domains/master-image-group/index.d.ts.map +1 -0
  48. package/dist/domains/node/constants.d.ts +15 -0
  49. package/dist/domains/node/constants.d.ts.map +1 -0
  50. package/dist/domains/node/entity.d.ts +27 -0
  51. package/dist/domains/node/entity.d.ts.map +1 -0
  52. package/dist/domains/node/index.d.ts +3 -0
  53. package/dist/domains/node/index.d.ts.map +1 -0
  54. package/dist/domains/permission/constants.d.ts +88 -0
  55. package/dist/domains/permission/constants.d.ts.map +1 -0
  56. package/dist/domains/permission/index.d.ts +2 -0
  57. package/dist/domains/permission/index.d.ts.map +1 -0
  58. package/dist/domains/project/entity.d.ts +20 -0
  59. package/dist/domains/project/entity.d.ts.map +1 -0
  60. package/dist/domains/project/index.d.ts +2 -0
  61. package/dist/domains/project/index.d.ts.map +1 -0
  62. package/dist/domains/project-node/constants.d.ts +9 -0
  63. package/dist/domains/project-node/constants.d.ts.map +1 -0
  64. package/dist/domains/project-node/entity.d.ts +24 -0
  65. package/dist/domains/project-node/entity.d.ts.map +1 -0
  66. package/dist/domains/project-node/index.d.ts +3 -0
  67. package/dist/domains/project-node/index.d.ts.map +1 -0
  68. package/dist/domains/realm/index.d.ts +2 -0
  69. package/dist/domains/realm/index.d.ts.map +1 -0
  70. package/dist/domains/realm/socket.d.ts +4 -0
  71. package/dist/domains/realm/socket.d.ts.map +1 -0
  72. package/dist/domains/registry/constants.d.ts +2 -0
  73. package/dist/domains/registry/constants.d.ts.map +1 -0
  74. package/dist/domains/registry/entity.d.ts +16 -0
  75. package/dist/domains/registry/entity.d.ts.map +1 -0
  76. package/dist/domains/registry/index.d.ts +4 -0
  77. package/dist/domains/registry/index.d.ts.map +1 -0
  78. package/dist/domains/registry/utils.d.ts +3 -0
  79. package/dist/domains/registry/utils.d.ts.map +1 -0
  80. package/dist/domains/registry-project/constants.d.ts +9 -0
  81. package/dist/domains/registry-project/constants.d.ts.map +1 -0
  82. package/dist/domains/registry-project/entity.d.ts +28 -0
  83. package/dist/domains/registry-project/entity.d.ts.map +1 -0
  84. package/dist/domains/registry-project/index.d.ts +5 -0
  85. package/dist/domains/registry-project/index.d.ts.map +1 -0
  86. package/dist/domains/registry-project/socket.d.ts +3 -0
  87. package/dist/domains/registry-project/socket.d.ts.map +1 -0
  88. package/dist/domains/registry-project/utils.d.ts +2 -0
  89. package/dist/domains/registry-project/utils.d.ts.map +1 -0
  90. package/dist/domains/service/constants.d.ts +5 -0
  91. package/dist/domains/service/constants.d.ts.map +1 -0
  92. package/dist/domains/service/index.d.ts +5 -0
  93. package/dist/domains/service/index.d.ts.map +1 -0
  94. package/dist/domains/service/registry/constants.d.ts +28 -0
  95. package/dist/domains/service/registry/constants.d.ts.map +1 -0
  96. package/dist/domains/service/registry/index.d.ts +2 -0
  97. package/dist/domains/service/registry/index.d.ts.map +1 -0
  98. package/dist/domains/service/secret-engine/constants.d.ts +7 -0
  99. package/dist/domains/service/secret-engine/constants.d.ts.map +1 -0
  100. package/dist/domains/service/secret-engine/index.d.ts +3 -0
  101. package/dist/domains/service/secret-engine/index.d.ts.map +1 -0
  102. package/dist/domains/service/secret-engine/type.d.ts +3 -0
  103. package/dist/domains/service/secret-engine/type.d.ts.map +1 -0
  104. package/dist/domains/service/station-registry/constants.d.ts +4 -0
  105. package/dist/domains/service/station-registry/constants.d.ts.map +1 -0
  106. package/dist/domains/service/station-registry/index.d.ts +2 -0
  107. package/dist/domains/service/station-registry/index.d.ts.map +1 -0
  108. package/dist/domains/types-base.d.ts +11 -0
  109. package/dist/domains/types-base.d.ts.map +1 -0
  110. package/dist/domains/types.d.ts +20 -0
  111. package/dist/domains/types.d.ts.map +1 -0
  112. package/dist/domains/utils.d.ts +7 -0
  113. package/dist/domains/utils.d.ts.map +1 -0
  114. package/dist/error/constants.d.ts +4 -0
  115. package/dist/error/constants.d.ts.map +1 -0
  116. package/dist/error/entities/connection-string.d.ts +5 -0
  117. package/dist/error/entities/connection-string.d.ts.map +1 -0
  118. package/dist/error/entities/index.d.ts +2 -0
  119. package/dist/error/entities/index.d.ts.map +1 -0
  120. package/dist/error/index.d.ts +3 -0
  121. package/dist/error/index.d.ts.map +1 -0
  122. package/dist/index.cjs +488 -0
  123. package/dist/index.cjs.map +1 -0
  124. package/dist/index.d.ts +4 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.mjs +469 -0
  127. package/dist/index.mjs.map +1 -0
  128. package/package.json +40 -0
  129. package/rollup.config.mjs +19 -0
  130. package/src/constants.ts +12 -0
  131. package/src/domains/analysis/constants.ts +78 -0
  132. package/src/domains/analysis/entity.ts +72 -0
  133. package/src/domains/analysis/index.ts +9 -0
  134. package/src/domains/analysis-bucket/constants.ts +12 -0
  135. package/src/domains/analysis-bucket/entity.ts +41 -0
  136. package/src/domains/analysis-bucket/index.ts +10 -0
  137. package/src/domains/analysis-bucket/utils.ts +28 -0
  138. package/src/domains/analysis-bucket-file/entity.ts +55 -0
  139. package/src/domains/analysis-bucket-file/index.ts +8 -0
  140. package/src/domains/analysis-log/entity.ts +78 -0
  141. package/src/domains/analysis-log/index.ts +8 -0
  142. package/src/domains/analysis-node/constants.ts +33 -0
  143. package/src/domains/analysis-node/entity.ts +65 -0
  144. package/src/domains/analysis-node/index.ts +9 -0
  145. package/src/domains/constants.ts +40 -0
  146. package/src/domains/index.ts +26 -0
  147. package/src/domains/master-image/constants.ts +15 -0
  148. package/src/domains/master-image/entity.ts +36 -0
  149. package/src/domains/master-image/index.ts +8 -0
  150. package/src/domains/master-image-group/entity.ts +34 -0
  151. package/src/domains/master-image-group/index.ts +7 -0
  152. package/src/domains/node/constants.ts +23 -0
  153. package/src/domains/node/entity.ts +56 -0
  154. package/src/domains/node/index.ts +9 -0
  155. package/src/domains/permission/constants.ts +46 -0
  156. package/src/domains/permission/index.ts +8 -0
  157. package/src/domains/project/entity.ts +40 -0
  158. package/src/domains/project/index.ts +8 -0
  159. package/src/domains/project-node/constants.ts +16 -0
  160. package/src/domains/project-node/entity.ts +46 -0
  161. package/src/domains/project-node/index.ts +9 -0
  162. package/src/domains/realm/index.ts +8 -0
  163. package/src/domains/realm/socket.ts +18 -0
  164. package/src/domains/registry/constants.ts +8 -0
  165. package/src/domains/registry/entity.ts +34 -0
  166. package/src/domains/registry/index.ts +10 -0
  167. package/src/domains/registry/utils.ts +15 -0
  168. package/src/domains/registry-project/constants.ts +15 -0
  169. package/src/domains/registry-project/entity.ts +64 -0
  170. package/src/domains/registry-project/index.ts +11 -0
  171. package/src/domains/registry-project/socket.ts +12 -0
  172. package/src/domains/registry-project/utils.ts +12 -0
  173. package/src/domains/service/constants.ts +14 -0
  174. package/src/domains/service/index.ts +11 -0
  175. package/src/domains/service/registry/constants.ts +40 -0
  176. package/src/domains/service/registry/index.ts +8 -0
  177. package/src/domains/service/secret-engine/constants.ts +14 -0
  178. package/src/domains/service/secret-engine/index.ts +9 -0
  179. package/src/domains/service/secret-engine/type.ts +10 -0
  180. package/src/domains/service/station-registry/constants.ts +10 -0
  181. package/src/domains/service/station-registry/index.ts +8 -0
  182. package/src/domains/types-base.ts +21 -0
  183. package/src/domains/types.ts +98 -0
  184. package/src/domains/utils.ts +41 -0
  185. package/src/error/constants.ts +10 -0
  186. package/src/error/entities/connection-string.ts +26 -0
  187. package/src/error/entities/index.ts +8 -0
  188. package/src/error/index.ts +9 -0
  189. package/src/index.ts +10 -0
  190. package/tsconfig.build.json +11 -0
  191. package/tsconfig.json +10 -0
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+ export * from './entity';
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum NodeType {
9
+ AGGREGATOR = 'aggregator',
10
+ DEFAULT = 'default',
11
+ }
12
+
13
+ export enum NodeSocketClientEventName {
14
+ CONNECT = 'nodeConnect',
15
+ DISCONNECT = 'nodeDisconnect',
16
+ MESSAGE = 'nodeMessage',
17
+ }
18
+
19
+ export enum NodeSocketServerEventName {
20
+ CONNECTED = 'nodeConnected',
21
+ DISCONNECTED = 'nodeDisconnected',
22
+ MESSAGE = 'nodeMessage',
23
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { Realm, Robot } from '@authup/core-kit';
9
+ import type { DomainType } from '../constants';
10
+ import type { RegistryProject } from '../registry-project';
11
+ import type { Registry } from '../registry';
12
+ import type { DomainEventBaseContext } from '../types-base';
13
+ import type { NodeType } from './constants';
14
+
15
+ export interface Node {
16
+ id: string;
17
+
18
+ external_name: string | null;
19
+
20
+ name: string;
21
+
22
+ hidden: boolean;
23
+
24
+ type: `${NodeType}`;
25
+
26
+ online: boolean;
27
+
28
+ // ------------------------------------------------------------------
29
+
30
+ registry_id: Registry['id'];
31
+
32
+ registry: Registry;
33
+
34
+ registry_project_id: RegistryProject['id'] | null;
35
+
36
+ registry_project: RegistryProject;
37
+
38
+ // ------------------------------------------------------------------
39
+
40
+ robot_id: Robot['id'] | null;
41
+
42
+ // ------------------------------------------------------------------
43
+
44
+ realm_id: Realm['id'];
45
+
46
+ // ------------------------------------------------------------------
47
+
48
+ created_at: Date;
49
+
50
+ updated_at: Date;
51
+ }
52
+
53
+ export type NodeEventContext = DomainEventBaseContext & {
54
+ type: `${DomainType.NODE}`,
55
+ data: Node
56
+ };
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
9
+ export * from './entity';
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import { PermissionName as AuthPermissionName } from '@authup/core-kit';
9
+
10
+ export enum PermissionKey {
11
+ BUCKET_ADD = 'bucket_add',
12
+ BUCKET_EDIT = 'bucket_edit',
13
+ BUCKET_DROP = 'bucket_drop',
14
+
15
+ PROJECT_ADD = 'project_add',
16
+ PROJECT_DROP = 'project_drop',
17
+ PROJECT_EDIT = 'project_edit',
18
+ PROJECT_APPROVE = 'project_approve',
19
+
20
+ REGISTRY_MANAGE = 'registry_manage',
21
+ REGISTRY_PROJECT_MANAGE = 'registry_project_manage',
22
+
23
+ NODE_ADD = 'node_add',
24
+ NODE_DROP = 'node_drop',
25
+ NODE_EDIT = 'node_edit',
26
+
27
+ ANALYSIS_APPROVE = 'analysis_approve',
28
+ ANALYSIS_EDIT = 'analysis_edit',
29
+ ANALYSIS_ADD = 'analysis_add',
30
+ ANALYSIS_EXECUTION_START = 'analysis_execution_start',
31
+ ANALYSIS_EXECUTION_STOP = 'analysis_execution_stop',
32
+ ANALYSIS_DROP = 'analysis_drop',
33
+ ANALYSIS_RESULT_READ = 'analysis_result_read', // todo: this is maybe not required anymore
34
+
35
+ MASTER_IMAGE_MANAGE = 'master_image_manage',
36
+ MASTER_IMAGE_GROUP_MANAGE = 'master_image_group_manage',
37
+
38
+ SERVICE_MANAGE = 'service_manage',
39
+ }
40
+
41
+ export const PermissionID = {
42
+ ...PermissionKey,
43
+ ...AuthPermissionName,
44
+ };
45
+
46
+ export type PermissionIDType = typeof PermissionID[keyof typeof PermissionID];
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { Realm, User } from '@authup/core-kit';
9
+ import type { DomainType } from '../constants';
10
+ import type { MasterImage } from '../master-image';
11
+ import type { DomainEventBaseContext } from '../types-base';
12
+
13
+ export interface Project {
14
+ id: string;
15
+
16
+ name: string;
17
+
18
+ analyses: number;
19
+
20
+ // ------------------------------------------------------------------
21
+
22
+ created_at: Date;
23
+
24
+ updated_at: Date;
25
+
26
+ // ------------------------------------------------------------------
27
+
28
+ realm_id: Realm['id'];
29
+
30
+ user_id: User['id'];
31
+
32
+ master_image_id: MasterImage['id'] | null;
33
+
34
+ master_image: MasterImage | null;
35
+ }
36
+
37
+ export type ProjectEventContext = DomainEventBaseContext & {
38
+ type: `${DomainType.PROJECT}`,
39
+ data: Project
40
+ };
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './entity';
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum ProjectNodeApprovalCommand {
9
+ APPROVE = 'approve',
10
+ REJECT = 'reject',
11
+ }
12
+
13
+ export enum ProjectNodeApprovalStatus {
14
+ REJECTED = 'rejected',
15
+ APPROVED = 'approved',
16
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { Realm } from '@authup/core-kit';
9
+ import type { DomainType } from '../constants';
10
+ import type { Project } from '../project';
11
+ import type { Node } from '../node';
12
+ import type { DomainEventBaseContext } from '../types-base';
13
+ import type { ProjectNodeApprovalStatus } from './constants';
14
+
15
+ export interface ProjectNode {
16
+ id: string;
17
+
18
+ approval_status: ProjectNodeApprovalStatus | null;
19
+
20
+ comment: string | null;
21
+
22
+ // ------------------------------------------------------------------
23
+
24
+ created_at: Date;
25
+
26
+ updated_at: Date;
27
+
28
+ // ------------------------------------------------------------------
29
+
30
+ project_id: Project['id'];
31
+
32
+ project: Project;
33
+
34
+ project_realm_id: Realm['id'];
35
+
36
+ node_id: Node['id'];
37
+
38
+ node: Node;
39
+
40
+ node_realm_id: Realm['id'];
41
+ }
42
+
43
+ export type ProjectNodeEventContext = DomainEventBaseContext & {
44
+ type: `${DomainType.PROJECT_NODE}`,
45
+ data: ProjectNode
46
+ };
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
9
+ export * from './entity';
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2022-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './socket';
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) 2022-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { Realm } from '@authup/core-kit';
9
+
10
+ export function buildSocketRealmNamespaceName(realmId: Realm['id']) {
11
+ return `/resources#${realmId}`;
12
+ }
13
+
14
+ export function parseSocketRealmNamespaceName(name: string) : string | undefined {
15
+ return name.startsWith('/resources#') ?
16
+ name.substring('/resources#'.length) :
17
+ name;
18
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export const registryRobotSecretRegex = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$/;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { DomainType } from '../constants';
9
+ import type { DomainEventBaseContext } from '../types-base';
10
+
11
+ export interface Registry {
12
+ id: string;
13
+
14
+ name: string;
15
+
16
+ host: string;
17
+
18
+ // ------------------------------------------------------------------
19
+
20
+ account_name: string | null;
21
+
22
+ account_secret: string | null;
23
+
24
+ // ------------------------------------------------------------------
25
+
26
+ created_at: Date;
27
+
28
+ updated_at: Date;
29
+ }
30
+
31
+ export type RegistryEventContext = DomainEventBaseContext & {
32
+ type: `${DomainType.REGISTRY}`,
33
+ data: Registry
34
+ };
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright (c) 2022-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
9
+ export * from './entity';
10
+ export * from './utils';
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2022-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { Registry } from './entity';
9
+
10
+ export function buildRegistryClientConnectionStringFromRegistry(entity: Registry) {
11
+ // todo: support other registries beside harbor and v2.0
12
+
13
+ const url = `https://${entity.host}/api/v2.0/`;
14
+ return `${entity.account_name}:${entity.account_secret}@${url}`;
15
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2022-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum RegistryProjectType {
9
+ DEFAULT = 'default',
10
+ AGGREGATOR = 'aggregator',
11
+ INCOMING = 'incoming',
12
+ OUTGOING = 'outgoing',
13
+ MASTER_IMAGES = 'masterImages',
14
+ NODE = 'node',
15
+ }
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { Realm } from '@authup/core-kit';
9
+ import type { DomainType } from '../constants';
10
+ import type { Registry } from '../registry';
11
+ import type { DomainEventBaseContext } from '../types-base';
12
+ import type { RegistryProjectType } from './constants';
13
+
14
+ export interface RegistryProject {
15
+ id: string;
16
+
17
+ name: string;
18
+
19
+ type: `${RegistryProjectType}`;
20
+
21
+ public: boolean;
22
+
23
+ // ------------------------------------------------------------------
24
+
25
+ // a-z0-9-_ {0,255}
26
+ external_name: string;
27
+
28
+ external_id: string | null;
29
+
30
+ // ------------------------------------------------------------------
31
+
32
+ account_id: string | null;
33
+
34
+ account_name: string | null;
35
+
36
+ account_secret: string | null;
37
+
38
+ // ------------------------------------------------------------------
39
+
40
+ webhook_name: string | null;
41
+
42
+ webhook_exists: boolean | null;
43
+
44
+ // ------------------------------------------------------------------
45
+
46
+ registry_id: Registry['id'];
47
+
48
+ registry: Registry;
49
+
50
+ // ------------------------------------------------------------------
51
+
52
+ realm_id: Realm['id'] | null;
53
+
54
+ // ------------------------------------------------------------------
55
+
56
+ created_at: Date;
57
+
58
+ updated_at: Date;
59
+ }
60
+
61
+ export type RegistryProjectEventContext = DomainEventBaseContext & {
62
+ type: `${DomainType.REGISTRY_PROJECT}`,
63
+ data: RegistryProject
64
+ };
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (c) 2022-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
9
+ export * from './entity';
10
+ export * from './socket';
11
+ export * from './utils';
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { RegistryProject } from './entity';
9
+
10
+ export function buildSocketRegistryProjectRoomName(id?: RegistryProject['id']) {
11
+ return `registry-projects${id ? `#${id}` : ''}`;
12
+ }
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (c) 2023-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import { createNanoID } from '@privateaim/kit';
9
+
10
+ export function generateRegistryProjectId() {
11
+ return createNanoID('0123456789abcdefghijklmnopqrstuvwxyz');
12
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum ServiceID {
9
+ // Core Service(s)
10
+ SYSTEM = 'system',
11
+
12
+ // Third Party Service(s)
13
+ REGISTRY = 'registry',
14
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './registry';
9
+ export * from './secret-engine';
10
+ export * from './constants';
11
+ export * from './station-registry';
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum RegistryAPICommand {
9
+ SETUP = 'setup',
10
+ CLEANUP = 'cleanup',
11
+ DELETE = 'delete',
12
+
13
+ PROJECT_LINK = 'projectLink',
14
+ PROJECT_UNLINK = 'projectUnlink',
15
+ }
16
+
17
+ /**
18
+ * Incoming train project name
19
+ */
20
+ export const REGISTRY_INCOMING_PROJECT_NAME = 'incoming';
21
+
22
+ /**
23
+ * Outgoing train project name
24
+ */
25
+ export const REGISTRY_OUTGOING_PROJECT_NAME = 'outgoing';
26
+
27
+ /**
28
+ * Master Image project name
29
+ */
30
+ export const REGISTRY_MASTER_IMAGE_PROJECT_NAME = 'master';
31
+
32
+ /**
33
+ * Latest image tag
34
+ */
35
+ export const REGISTRY_ARTIFACT_TAG_LATEST = 'latest';
36
+
37
+ /**
38
+ * base image tag
39
+ */
40
+ export const REGISTRY_ARTIFACT_TAG_BASE = 'base';
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum SecretStorageAPICommand {
9
+ ENGINE_CREATE = 'engineCreate',
10
+
11
+ ENGINE_KEY_SAVE = 'engineKeySave',
12
+ ENGINE_KEY_PULL = 'engineKeyPull',
13
+ ENGINE_KEY_DROP = 'engineKeyDrop',
14
+ }
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
9
+ export * from './type';
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { SecretStorageAPICommand } from './constants';
9
+
10
+ export type SecretStorageCommandType = `${SecretStorageAPICommand}`;
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export enum StationRegistryAPICommand {
9
+ SYNC = 'sync',
10
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ export * from './constants';
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright (c) 2021-2024.
3
+ * Author Peter Placzek (tada5hi)
4
+ * For the full copyright and license information,
5
+ * view the LICENSE file that was distributed with this source code.
6
+ */
7
+
8
+ import type { DomainEventName } from './constants';
9
+
10
+ export type DomainEntityWithID = {
11
+ [key: string]: any,
12
+ id: any
13
+ };
14
+ export type DomainEntityID<T> = T extends DomainEntityWithID ?
15
+ T['id'] :
16
+ never;
17
+
18
+ export type DomainEventBaseContext = {
19
+ event: `${DomainEventName}`,
20
+ type: string
21
+ };