@data-fair/lib-common-types 1.4.0 → 1.4.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.
@@ -6,8 +6,9 @@ export type Title = string;
6
6
  export type Content = string;
7
7
  export type HTMLContent = string;
8
8
  export type URLOfEventIcon = string;
9
- export type CleDuSujet = string;
10
- export type LibelleDuSujet = string;
9
+ export type Type = "user" | "organization";
10
+ export type TopicKey = string;
11
+ export type TopicTitle = string;
11
12
  export type Visibility = "public" | "private";
12
13
  export type ReceptionDate = string;
13
14
 
@@ -17,10 +18,7 @@ export interface Event {
17
18
  htmlBody?: HTMLContent | InternationalizedHTMLContent;
18
19
  icon?: URLOfEventIcon;
19
20
  sender: Emitter;
20
- topic: {
21
- key: CleDuSujet;
22
- title?: LibelleDuSujet;
23
- };
21
+ topic: TopicRef;
24
22
  urlParams?: UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl;
25
23
  visibility?: Visibility;
26
24
  date: ReceptionDate;
@@ -52,13 +50,42 @@ export interface InternationalizedHTMLContent {
52
50
  */
53
51
  [k: string]: string;
54
52
  }
53
+ /**
54
+ * This interface was referenced by `Event`'s JSON-Schema
55
+ * via the `definition` "sender".
56
+ */
55
57
  export interface Emitter {
56
- type: "user" | "organization";
58
+ type: Type;
59
+ /**
60
+ * The unique id of the user or organization
61
+ */
57
62
  id: string;
63
+ /**
64
+ * The display name of the user or organization
65
+ */
58
66
  name: string;
67
+ /**
68
+ * @deprecated
69
+ * If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
70
+ */
71
+ role?: string;
72
+ /**
73
+ * If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department
74
+ */
59
75
  department?: string;
76
+ /**
77
+ * The display name of the department
78
+ */
60
79
  departmentName?: string;
61
80
  }
81
+ /**
82
+ * This interface was referenced by `Event`'s JSON-Schema
83
+ * via the `definition` "topicRef".
84
+ */
85
+ export interface TopicRef {
86
+ key: TopicKey;
87
+ title?: TopicTitle;
88
+ }
62
89
  export interface UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl {
63
90
  /**
64
91
  * This interface was referenced by `UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl`'s JSON-Schema definition
package/event/schema.d.ts CHANGED
@@ -54,22 +54,9 @@ declare const _default: {
54
54
  };
55
55
  sender: {
56
56
  $ref: string;
57
- title: string;
58
57
  };
59
58
  topic: {
60
- type: string;
61
- additionalProperties: boolean;
62
- required: string[];
63
- properties: {
64
- key: {
65
- type: string;
66
- title: string;
67
- };
68
- title: {
69
- type: string;
70
- title: string;
71
- };
72
- };
59
+ $ref: string;
73
60
  };
74
61
  urlParams: {
75
62
  type: string;
@@ -96,5 +83,56 @@ declare const _default: {
96
83
  description: string;
97
84
  };
98
85
  };
86
+ $defs: {
87
+ sender: {
88
+ type: string;
89
+ title: string;
90
+ additionalProperties: boolean;
91
+ required: string[];
92
+ properties: {
93
+ type: {
94
+ type: string;
95
+ enum: string[];
96
+ title: string;
97
+ };
98
+ id: {
99
+ type: string;
100
+ description: string;
101
+ };
102
+ name: {
103
+ type: string;
104
+ description: string;
105
+ };
106
+ role: {
107
+ type: string;
108
+ deprecated: boolean;
109
+ description: string;
110
+ };
111
+ department: {
112
+ type: string;
113
+ description: string;
114
+ };
115
+ departmentName: {
116
+ type: string;
117
+ description: string;
118
+ };
119
+ };
120
+ };
121
+ topicRef: {
122
+ type: string;
123
+ additionalProperties: boolean;
124
+ required: string[];
125
+ properties: {
126
+ key: {
127
+ type: string;
128
+ title: string;
129
+ };
130
+ title: {
131
+ type: string;
132
+ title: string;
133
+ };
134
+ };
135
+ };
136
+ };
99
137
  };
100
138
  export default _default;
package/event/schema.js CHANGED
@@ -37,22 +37,8 @@ export default {
37
37
  title: 'URL of event icon'
38
38
  },
39
39
  // sender is the owner of the topic
40
- sender: { $ref: 'https://github.com/data-fair/lib/session-state#/$defs/account', title: 'Emitter' },
41
- topic: {
42
- type: 'object',
43
- additionalProperties: false,
44
- required: ['key'],
45
- properties: {
46
- key: {
47
- type: 'string',
48
- title: 'Clé du sujet'
49
- },
50
- title: {
51
- type: 'string',
52
- title: 'Libellé du sujet'
53
- }
54
- }
55
- },
40
+ sender: { $ref: '#/$defs/sender' },
41
+ topic: { $ref: '#/$defs/topicRef' },
56
42
  urlParams: {
57
43
  type: 'object',
58
44
  title: 'used to fill subscription.urlTemplate and so create notification.url',
@@ -75,5 +61,56 @@ export default {
75
61
  type: 'object',
76
62
  description: 'Free properties that varie depending on the type of event'
77
63
  }
64
+ },
65
+ $defs: {
66
+ sender: {
67
+ type: 'object',
68
+ title: 'Emitter',
69
+ additionalProperties: false,
70
+ required: ['type', 'id', 'name'],
71
+ properties: {
72
+ type: {
73
+ type: 'string',
74
+ enum: ['user', 'organization'],
75
+ title: 'Type'
76
+ },
77
+ id: {
78
+ type: 'string',
79
+ description: 'The unique id of the user or organization'
80
+ },
81
+ name: {
82
+ type: 'string',
83
+ description: 'The display name of the user or organization'
84
+ },
85
+ role: {
86
+ type: 'string',
87
+ deprecated: true,
88
+ description: 'If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role'
89
+ },
90
+ department: {
91
+ type: 'string',
92
+ description: 'If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department'
93
+ },
94
+ departmentName: {
95
+ type: 'string',
96
+ description: 'The display name of the department'
97
+ }
98
+ }
99
+ },
100
+ topicRef: {
101
+ type: 'object',
102
+ additionalProperties: false,
103
+ required: ['key'],
104
+ properties: {
105
+ key: {
106
+ type: 'string',
107
+ title: 'Topic key'
108
+ },
109
+ title: {
110
+ type: 'string',
111
+ title: 'Topic title'
112
+ }
113
+ }
114
+ }
78
115
  }
79
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {