@privateaim/core-kit 0.8.3 → 0.8.5

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 (63) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/domains/analysis/entity.d.ts +0 -6
  3. package/dist/domains/analysis/entity.d.ts.map +1 -1
  4. package/dist/domains/analysis-bucket/entity.d.ts +0 -6
  5. package/dist/domains/analysis-bucket/entity.d.ts.map +1 -1
  6. package/dist/domains/analysis-bucket-file/entity.d.ts +0 -6
  7. package/dist/domains/analysis-bucket-file/entity.d.ts.map +1 -1
  8. package/dist/domains/analysis-log/entity.d.ts +0 -6
  9. package/dist/domains/analysis-log/entity.d.ts.map +1 -1
  10. package/dist/domains/analysis-node/entity.d.ts +0 -13
  11. package/dist/domains/analysis-node/entity.d.ts.map +1 -1
  12. package/dist/domains/analysis-permission/entity.d.ts +0 -6
  13. package/dist/domains/analysis-permission/entity.d.ts.map +1 -1
  14. package/dist/domains/constants.d.ts +1 -0
  15. package/dist/domains/constants.d.ts.map +1 -1
  16. package/dist/domains/index.d.ts +1 -0
  17. package/dist/domains/index.d.ts.map +1 -1
  18. package/dist/domains/master-image/entity.d.ts +0 -6
  19. package/dist/domains/master-image/entity.d.ts.map +1 -1
  20. package/dist/domains/master-image-event-log/entity.d.ts +13 -0
  21. package/dist/domains/master-image-event-log/entity.d.ts.map +1 -0
  22. package/dist/domains/master-image-event-log/index.d.ts +2 -0
  23. package/dist/domains/master-image-event-log/index.d.ts.map +1 -0
  24. package/dist/domains/master-image-group/entity.d.ts +0 -6
  25. package/dist/domains/master-image-group/entity.d.ts.map +1 -1
  26. package/dist/domains/node/entity.d.ts +1 -6
  27. package/dist/domains/node/entity.d.ts.map +1 -1
  28. package/dist/domains/project/entity.d.ts +0 -6
  29. package/dist/domains/project/entity.d.ts.map +1 -1
  30. package/dist/domains/project-node/entity.d.ts +0 -6
  31. package/dist/domains/project-node/entity.d.ts.map +1 -1
  32. package/dist/domains/registry/entity.d.ts +0 -6
  33. package/dist/domains/registry/entity.d.ts.map +1 -1
  34. package/dist/domains/registry-project/entity.d.ts +0 -6
  35. package/dist/domains/registry-project/entity.d.ts.map +1 -1
  36. package/dist/domains/types.d.ts +46 -18
  37. package/dist/domains/types.d.ts.map +1 -1
  38. package/dist/domains/utils.d.ts +4 -4
  39. package/dist/domains/utils.d.ts.map +1 -1
  40. package/dist/index.cjs +122 -87
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.mjs +91 -84
  43. package/dist/index.mjs.map +1 -1
  44. package/package.json +5 -5
  45. package/src/domains/analysis/entity.ts +0 -7
  46. package/src/domains/analysis-bucket/entity.ts +0 -7
  47. package/src/domains/analysis-bucket-file/entity.ts +0 -7
  48. package/src/domains/analysis-log/entity.ts +0 -7
  49. package/src/domains/analysis-node/entity.ts +0 -12
  50. package/src/domains/analysis-permission/entity.ts +0 -7
  51. package/src/domains/constants.ts +1 -0
  52. package/src/domains/index.ts +1 -0
  53. package/src/domains/master-image/entity.ts +0 -8
  54. package/src/domains/master-image-event-log/entity.ts +34 -0
  55. package/src/domains/master-image-event-log/index.ts +7 -0
  56. package/src/domains/master-image-group/entity.ts +0 -8
  57. package/src/domains/node/entity.ts +2 -7
  58. package/src/domains/project/entity.ts +0 -7
  59. package/src/domains/project-node/entity.ts +0 -7
  60. package/src/domains/registry/entity.ts +0 -8
  61. package/src/domains/registry-project/entity.ts +0 -7
  62. package/src/domains/types.ts +48 -78
  63. package/src/domains/utils.ts +8 -6
@@ -14,6 +14,7 @@ export * from './analysis-permission';
14
14
  export * from './realm';
15
15
  export * from './master-image-group';
16
16
  export * from './master-image';
17
+ export * from './master-image-event-log';
17
18
  export * from './project';
18
19
  export * from './project-node';
19
20
  export * from './registry';
@@ -5,9 +5,6 @@
5
5
  * view the LICENSE file that was distributed with this source code.
6
6
  */
7
7
 
8
- import type { DomainType } from '../constants';
9
- import type { DomainEventBaseContext } from '../types-base';
10
-
11
8
  export interface MasterImage {
12
9
  id: string;
13
10
 
@@ -29,8 +26,3 @@ export interface MasterImage {
29
26
 
30
27
  updated_at: Date;
31
28
  }
32
-
33
- export type MasterImageEventContext = DomainEventBaseContext & {
34
- type: `${DomainType.MASTER_IMAGE}`,
35
- data: MasterImage
36
- };
@@ -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 { MasterImage } from '../master-image';
9
+
10
+ export interface MasterImageEventLog {
11
+ id: string;
12
+
13
+ name: string;
14
+
15
+ data: unknown | null;
16
+
17
+ // ------------------------------------------------------------------
18
+
19
+ expiring: boolean;
20
+
21
+ expires_at: Date;
22
+
23
+ // ------------------------------------------------------------------
24
+
25
+ master_image_id: string | null;
26
+
27
+ master_image: MasterImage | null;
28
+
29
+ // ------------------------------------------------------------------
30
+
31
+ created_at: Date;
32
+
33
+ updated_at: Date;
34
+ }
@@ -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';
@@ -5,9 +5,6 @@
5
5
  * view the LICENSE file that was distributed with this source code.
6
6
  */
7
7
 
8
- import type { DomainType } from '../constants';
9
- import type { DomainEventBaseContext } from '../types-base';
10
-
11
8
  export interface MasterImageGroup {
12
9
  id: string;
13
10
 
@@ -27,8 +24,3 @@ export interface MasterImageGroup {
27
24
 
28
25
  updated_at: Date;
29
26
  }
30
-
31
- export type MasterImageGroupEventContext = DomainEventBaseContext & {
32
- type: `${DomainType.MASTER_IMAGE_GROUP}`,
33
- data: MasterImageGroup
34
- };
@@ -6,10 +6,8 @@
6
6
  */
7
7
 
8
8
  import type { Realm, Robot } from '@authup/core-kit';
9
- import type { DomainType } from '../constants';
10
9
  import type { RegistryProject } from '../registry-project';
11
10
  import type { Registry } from '../registry';
12
- import type { DomainEventBaseContext } from '../types-base';
13
11
  import type { NodeType } from './constants';
14
12
 
15
13
  export interface Node {
@@ -17,6 +15,8 @@ export interface Node {
17
15
 
18
16
  external_name: string | null;
19
17
 
18
+ public_key: string | null;
19
+
20
20
  name: string;
21
21
 
22
22
  hidden: boolean;
@@ -49,8 +49,3 @@ export interface Node {
49
49
 
50
50
  updated_at: Date;
51
51
  }
52
-
53
- export type NodeEventContext = DomainEventBaseContext & {
54
- type: `${DomainType.NODE}`,
55
- data: Node
56
- };
@@ -6,9 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { Realm, Robot, User } from '@authup/core-kit';
9
- import type { DomainType } from '../constants';
10
9
  import type { MasterImage } from '../master-image';
11
- import type { DomainEventBaseContext } from '../types-base';
12
10
 
13
11
  export interface Project {
14
12
  id: string;
@@ -41,8 +39,3 @@ export interface Project {
41
39
 
42
40
  master_image: MasterImage | null;
43
41
  }
44
-
45
- export type ProjectEventContext = DomainEventBaseContext & {
46
- type: `${DomainType.PROJECT}`,
47
- data: Project
48
- };
@@ -6,10 +6,8 @@
6
6
  */
7
7
 
8
8
  import type { Realm } from '@authup/core-kit';
9
- import type { DomainType } from '../constants';
10
9
  import type { Project } from '../project';
11
10
  import type { Node } from '../node';
12
- import type { DomainEventBaseContext } from '../types-base';
13
11
  import type { ProjectNodeApprovalStatus } from './constants';
14
12
 
15
13
  export interface ProjectNode {
@@ -39,8 +37,3 @@ export interface ProjectNode {
39
37
 
40
38
  node_realm_id: Realm['id'];
41
39
  }
42
-
43
- export type ProjectNodeEventContext = DomainEventBaseContext & {
44
- type: `${DomainType.PROJECT_NODE}`,
45
- data: ProjectNode
46
- };
@@ -5,9 +5,6 @@
5
5
  * view the LICENSE file that was distributed with this source code.
6
6
  */
7
7
 
8
- import type { DomainType } from '../constants';
9
- import type { DomainEventBaseContext } from '../types-base';
10
-
11
8
  export interface Registry {
12
9
  id: string;
13
10
 
@@ -27,8 +24,3 @@ export interface Registry {
27
24
 
28
25
  updated_at: Date;
29
26
  }
30
-
31
- export type RegistryEventContext = DomainEventBaseContext & {
32
- type: `${DomainType.REGISTRY}`,
33
- data: Registry
34
- };
@@ -6,9 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { Realm } from '@authup/core-kit';
9
- import type { DomainType } from '../constants';
10
9
  import type { Registry } from '../registry';
11
- import type { DomainEventBaseContext } from '../types-base';
12
10
  import type { RegistryProjectType } from './constants';
13
11
 
14
12
  export interface RegistryProject {
@@ -57,8 +55,3 @@ export interface RegistryProject {
57
55
 
58
56
  updated_at: Date;
59
57
  }
60
-
61
- export type RegistryProjectEventContext = DomainEventBaseContext & {
62
- type: `${DomainType.REGISTRY_PROJECT}`,
63
- data: RegistryProject
64
- };
@@ -5,94 +5,64 @@
5
5
  * view the LICENSE file that was distributed with this source code.
6
6
  */
7
7
 
8
- import type { AnalysisBucket, AnalysisBucketEventContext } from './analysis-bucket';
8
+ import type { AnalysisBucket } from './analysis-bucket';
9
9
  import type {
10
10
  DomainEventName, DomainEventSubscriptionName, DomainSubType, DomainType,
11
11
  } from './constants';
12
- import type { MasterImage, MasterImageEventContext } from './master-image';
13
- import type { MasterImageGroup, MasterImageGroupEventContext } from './master-image-group';
14
- import type { Project, ProjectEventContext } from './project';
15
- import type { ProjectNode, ProjectNodeEventContext } from './project-node';
16
- import type { Registry, RegistryEventContext } from './registry';
17
- import type { RegistryProject, RegistryProjectEventContext } from './registry-project';
18
- import type { Node, NodeEventContext } from './node';
19
- import type { Analysis, AnalysisEventContext } from './analysis';
20
- import type { AnalysisBucketFile, AnalysisFileEventContext } from './analysis-bucket-file';
21
- import type { AnalysisLog, AnalysisLogEventContext } from './analysis-log';
22
- import type { AnalysisNode, TrainStationEventContext } from './analysis-node';
12
+ import type { MasterImage } from './master-image';
13
+ import type { MasterImageEventLog } from './master-image-event-log';
14
+ import type { MasterImageGroup } from './master-image-group';
15
+ import type { Project } from './project';
16
+ import type { ProjectNode } from './project-node';
17
+ import type { Registry } from './registry';
18
+ import type { RegistryProject } from './registry-project';
19
+ import type { Node } from './node';
20
+ import type { Analysis } from './analysis';
21
+ import type { AnalysisBucketFile } from './analysis-bucket-file';
22
+ import type { AnalysisLog } from './analysis-log';
23
+ import type { AnalysisNode } from './analysis-node';
23
24
 
24
- export type DomainsEventContext = MasterImageEventContext |
25
- MasterImageGroupEventContext |
26
- ProjectEventContext |
27
- ProjectNodeEventContext |
28
- RegistryEventContext |
29
- RegistryProjectEventContext |
30
- NodeEventContext |
31
- AnalysisEventContext |
32
- AnalysisLogEventContext |
33
- AnalysisFileEventContext |
34
- TrainStationEventContext;
25
+ type DomainTypeMapRaw = {
26
+ [DomainType.MASTER_IMAGE]: MasterImage,
27
+ [DomainType.MASTER_IMAGE_EVENT_LOG]: MasterImageEventLog,
28
+ [DomainType.MASTER_IMAGE_GROUP]: MasterImageGroup,
29
+ [DomainType.PROJECT]: Project,
30
+ [DomainType.PROJECT_NODE]: ProjectNode,
31
+ [DomainSubType.PROJECT_NODE_IN]: ProjectNode,
32
+ [DomainSubType.PROJECT_NODE_OUT]: ProjectNode,
33
+ [DomainType.REGISTRY]: Registry,
34
+ [DomainType.REGISTRY_PROJECT]: RegistryProject
35
+ [DomainType.NODE]: Node,
36
+ [DomainType.ANALYSIS]: Analysis,
37
+ [DomainType.ANALYSIS_BUCKET]: AnalysisBucket,
38
+ [DomainType.ANALYSIS_BUCKET_FILE]: AnalysisBucketFile,
39
+ [DomainType.ANALYSIS_LOG]: AnalysisLog,
40
+ [DomainType.ANALYSIS_NODE]: AnalysisNode,
41
+ [DomainSubType.ANALYSIS_NODE_IN]: AnalysisNode,
42
+ [DomainSubType.ANALYSIS_NODE_OUT]: AnalysisNode,
43
+ };
35
44
 
36
- export type DomainEventContext<T extends `${DomainType}` | `${DomainSubType}`> =
37
- T extends `${DomainType.MASTER_IMAGE}` ?
38
- MasterImageEventContext :
39
- T extends `${DomainType.MASTER_IMAGE_GROUP}` ?
40
- MasterImageGroupEventContext :
41
- T extends `${DomainType.PROJECT}` ?
42
- ProjectEventContext :
43
- T extends `${DomainType.PROJECT_NODE}` | `${DomainSubType.PROJECT_NODE_IN}` | `${DomainSubType.PROJECT_NODE_OUT}` ?
44
- ProjectNodeEventContext :
45
- T extends `${DomainType.REGISTRY}` ?
46
- RegistryEventContext :
47
- T extends `${DomainType.REGISTRY_PROJECT}` ?
48
- RegistryProjectEventContext :
49
- T extends `${DomainType.NODE}` ?
50
- NodeEventContext :
51
- T extends `${DomainType.ANALYSIS}` ?
52
- AnalysisEventContext :
53
- T extends `${DomainType.ANALYSIS_BUCKET}` ?
54
- AnalysisBucketEventContext :
55
- T extends `${DomainType.ANALYSIS_LOG}` ?
56
- AnalysisLogEventContext :
57
- T extends `${DomainType.ANALYSIS_BUCKET_FILE}` ?
58
- AnalysisFileEventContext :
59
- T extends `${DomainType.ANALYSIS_NODE}` | `${DomainSubType.ANALYSIS_NODE_IN}` | `${DomainSubType.ANALYSIS_NODE_OUT}` ?
60
- TrainStationEventContext :
61
- never;
45
+ export type DomainTypeMap = {
46
+ [K in keyof DomainTypeMapRaw as `${K}`]: DomainTypeMapRaw[K]
47
+ };
62
48
 
63
- export type DomainEntity<T extends `${DomainType}` | `${DomainSubType}`> =
64
- T extends `${DomainType.MASTER_IMAGE}` ?
65
- MasterImage :
66
- T extends `${DomainType.MASTER_IMAGE_GROUP}` ?
67
- MasterImageGroup :
68
- T extends `${DomainType.PROJECT}` ?
69
- Project :
70
- T extends `${DomainType.PROJECT_NODE}` | `${DomainSubType.PROJECT_NODE_IN}` | `${DomainSubType.PROJECT_NODE_OUT}` ?
71
- ProjectNode :
72
- T extends `${DomainType.REGISTRY}` ?
73
- Registry :
74
- T extends `${DomainType.REGISTRY_PROJECT}` ?
75
- RegistryProject :
76
- T extends `${DomainType.NODE}` ?
77
- Node :
78
- T extends `${DomainType.ANALYSIS}` ?
79
- Analysis :
80
- T extends `${DomainType.ANALYSIS_BUCKET}` ?
81
- AnalysisBucket :
82
- T extends `${DomainType.ANALYSIS_LOG}` ?
83
- AnalysisLog :
84
- T extends `${DomainType.ANALYSIS_BUCKET_FILE}` ?
85
- AnalysisBucketFile :
86
- T extends `${DomainType.ANALYSIS_NODE}` | `${DomainSubType.ANALYSIS_NODE_IN}` | `${DomainSubType.ANALYSIS_NODE_OUT}` ?
87
- AnalysisNode :
88
- never;
49
+ export type EventRecord<
50
+ T extends string,
51
+ D extends Record<string, any>,
52
+ > = {
53
+ type: T,
54
+ data: D,
55
+ event: `${DomainEventName}`,
56
+ };
89
57
 
90
- export type DomainInput = `${DomainType}` | DomainType | `${DomainSubType}` | DomainSubType;
58
+ export type DomainsEvents = {
59
+ [T in keyof DomainTypeMap]: EventRecord<T, DomainTypeMap[T]>
60
+ }[keyof DomainTypeMap];
91
61
 
92
62
  export type DomainEventFullName<
93
- T extends DomainInput = DomainInput,
63
+ T extends string,
94
64
  > = `${T}${Capitalize<`${DomainEventName}`>}`;
95
65
 
96
66
  export type DomainEventSubscriptionFullName<
97
- T extends DomainInput = DomainInput,
67
+ T extends string,
98
68
  > = `${T}${Capitalize<`${DomainEventSubscriptionName}`>}`;
@@ -8,11 +8,13 @@
8
8
  import type {
9
9
  DomainEventName, DomainEventSubscriptionName,
10
10
  } from './constants';
11
- import type { DomainEventFullName, DomainEventSubscriptionFullName, DomainInput } from './types';
11
+ import type {
12
+ DomainEventFullName, DomainEventSubscriptionFullName,
13
+ } from './types';
12
14
 
13
- export function buildDomainEventFullName<T extends DomainInput>(
15
+ export function buildDomainEventFullName<T extends string>(
14
16
  type: T,
15
- event: `${DomainEventName}` | DomainEventName,
17
+ event: `${DomainEventName}`,
16
18
  ) : DomainEventFullName<T> {
17
19
  const eventCapitalized = event.substring(0, 1).toUpperCase() + event.substring(1);
18
20
 
@@ -20,17 +22,17 @@ export function buildDomainEventFullName<T extends DomainInput>(
20
22
  }
21
23
 
22
24
  export function buildDomainEventSubscriptionFullName<
23
- T extends DomainInput,
25
+ T extends string,
24
26
  >(
25
27
  type: T,
26
- event: `${DomainEventSubscriptionName}` | DomainEventSubscriptionName,
28
+ event: `${DomainEventSubscriptionName}`,
27
29
  ) : DomainEventSubscriptionFullName<T> {
28
30
  const eventCapitalized = event.substring(0, 1).toUpperCase() + event.substring(1);
29
31
 
30
32
  return type + eventCapitalized as DomainEventSubscriptionFullName<T>;
31
33
  }
32
34
 
33
- export function buildDomainChannelName(type: DomainInput, id?: string | number) {
35
+ export function buildDomainChannelName(type: string, id?: string | number) {
34
36
  return `${type}${id ? `:${id}` : ''}`;
35
37
  }
36
38