@data-fair/lib-common-types 1.7.1 → 1.8.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.
@@ -7,10 +7,18 @@ export type Content = string;
7
7
  export type HTMLContent = string;
8
8
  export type URLOfEventIcon = string;
9
9
  export type Type = "user" | "organization";
10
+ export type UserID = string;
11
+ export type UserName = string;
12
+ export type UserEmail = string;
13
+ export type OrganizationID = string;
14
+ export type OrganizationName = string;
15
+ export type OrganizationDepartment = string;
16
+ export type OrganizationDepartmentName = string;
10
17
  export type TopicKey = string;
11
18
  export type TopicTitle = string;
12
19
  export type Visibility = "public" | "private";
13
20
  export type ReceptionDate = string;
21
+ export type Type1 = string;
14
22
 
15
23
  export type Event = {
16
24
  title: Title | InternationalizedTitle;
@@ -18,6 +26,22 @@ export type Event = {
18
26
  htmlBody?: HTMLContent | InternationalizedHTMLContent;
19
27
  icon?: URLOfEventIcon;
20
28
  sender: Emitter;
29
+ originator?: {
30
+ user?: {
31
+ id?: UserID;
32
+ name?: UserName;
33
+ email?: UserEmail;
34
+ [k: string]: unknown;
35
+ };
36
+ organization?: {
37
+ id?: OrganizationID;
38
+ name?: OrganizationName;
39
+ department?: OrganizationDepartment;
40
+ departmentName?: OrganizationDepartmentName;
41
+ [k: string]: unknown;
42
+ };
43
+ [k: string]: unknown;
44
+ };
21
45
  topic: TopicRef;
22
46
  urlParams?: UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl;
23
47
  visibility?: Visibility;
@@ -28,6 +52,7 @@ export type Event = {
28
52
  extra?: {
29
53
  [k: string]: unknown;
30
54
  };
55
+ resource?: TheMainResourceConcernedByTheEvent;
31
56
  }
32
57
  export type InternationalizedTitle = {
33
58
  /**
@@ -92,4 +117,15 @@ export type UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl = {
92
117
  */
93
118
  [k: string]: string;
94
119
  }
120
+ export type TheMainResourceConcernedByTheEvent = {
121
+ type: Type1;
122
+ /**
123
+ * The unique id of the resource
124
+ */
125
+ id: string;
126
+ /**
127
+ * The display name of the resource
128
+ */
129
+ title?: string;
130
+ }
95
131
 
package/event/schema.d.ts CHANGED
@@ -55,6 +55,49 @@ declare const _default: {
55
55
  sender: {
56
56
  $ref: string;
57
57
  };
58
+ originator: {
59
+ type: string;
60
+ properties: {
61
+ user: {
62
+ type: string;
63
+ properties: {
64
+ id: {
65
+ type: string;
66
+ title: string;
67
+ };
68
+ name: {
69
+ type: string;
70
+ title: string;
71
+ };
72
+ email: {
73
+ type: string;
74
+ title: string;
75
+ };
76
+ };
77
+ };
78
+ organization: {
79
+ type: string;
80
+ properties: {
81
+ id: {
82
+ type: string;
83
+ title: string;
84
+ };
85
+ name: {
86
+ type: string;
87
+ title: string;
88
+ };
89
+ department: {
90
+ type: string;
91
+ title: string;
92
+ };
93
+ departmentName: {
94
+ type: string;
95
+ title: string;
96
+ };
97
+ };
98
+ };
99
+ };
100
+ };
58
101
  topic: {
59
102
  $ref: string;
60
103
  };
@@ -82,6 +125,26 @@ declare const _default: {
82
125
  type: string;
83
126
  description: string;
84
127
  };
128
+ resource: {
129
+ type: string;
130
+ title: string;
131
+ additionalProperties: boolean;
132
+ required: string[];
133
+ properties: {
134
+ type: {
135
+ type: string;
136
+ title: string;
137
+ };
138
+ id: {
139
+ type: string;
140
+ description: string;
141
+ };
142
+ title: {
143
+ type: string;
144
+ description: string;
145
+ };
146
+ };
147
+ };
85
148
  };
86
149
  $defs: {
87
150
  sender: {
package/event/schema.js CHANGED
@@ -38,6 +38,50 @@ export default {
38
38
  },
39
39
  // sender is the owner of the topic
40
40
  sender: { $ref: '#/$defs/sender' },
41
+ // originator is the account/user who triggered the event
42
+ originator: {
43
+ type: 'object',
44
+ properties: {
45
+ user: {
46
+ type: 'object',
47
+ properties: {
48
+ id: {
49
+ type: 'string',
50
+ title: 'User ID'
51
+ },
52
+ name: {
53
+ type: 'string',
54
+ title: 'User name'
55
+ },
56
+ email: {
57
+ type: 'string',
58
+ title: 'User email'
59
+ }
60
+ }
61
+ },
62
+ organization: {
63
+ type: 'object',
64
+ properties: {
65
+ id: {
66
+ type: 'string',
67
+ title: 'Organization ID'
68
+ },
69
+ name: {
70
+ type: 'string',
71
+ title: 'Organization name'
72
+ },
73
+ department: {
74
+ type: 'string',
75
+ title: 'Organization department'
76
+ },
77
+ departmentName: {
78
+ type: 'string',
79
+ title: 'Organization department name'
80
+ }
81
+ }
82
+ }
83
+ }
84
+ },
41
85
  topic: { $ref: '#/$defs/topicRef' },
42
86
  urlParams: {
43
87
  type: 'object',
@@ -60,6 +104,26 @@ export default {
60
104
  extra: {
61
105
  type: 'object',
62
106
  description: 'Free properties that varie depending on the type of event'
107
+ },
108
+ resource: {
109
+ type: 'object',
110
+ title: 'The main resource concerned by the event',
111
+ additionalProperties: false,
112
+ required: ['type', 'id'],
113
+ properties: {
114
+ type: {
115
+ type: 'string',
116
+ title: 'Type'
117
+ },
118
+ id: {
119
+ type: 'string',
120
+ description: 'The unique id of the resource'
121
+ },
122
+ title: {
123
+ type: 'string',
124
+ description: 'The display name of the resource'
125
+ }
126
+ }
63
127
  }
64
128
  },
65
129
  $defs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {