@data-fair/lib-common-types 1.16.0 → 1.16.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.
package/event/schema.js CHANGED
@@ -1,217 +1,217 @@
1
1
  const i18nMsg = (title) => ({
2
- type: 'object',
3
- title: `Internationalized ${title} `,
4
- patternProperties: {
5
- '.*': { type: 'string' }
6
- }
7
- // properties: ['fr', 'en'].reduce((/** @type {Record<string, any>} */props, locale) => { props[locale] = { type: 'string', title: locale }; return props }, {})
8
- })
2
+ type: 'object',
3
+ title: `Internationalized ${title} `,
4
+ patternProperties: {
5
+ '.*': { type: 'string' }
6
+ }
7
+ // properties: ['fr', 'en'].reduce((/** @type {Record<string, any>} */props, locale) => { props[locale] = { type: 'string', title: locale }; return props }, {})
8
+ });
9
9
  export default {
10
- $id: 'https://github.com/data-fair/lib/event',
11
- 'x-exports': ['types'],
12
- title: 'Event',
13
- type: 'object',
14
- additionalProperties: false,
15
- required: ['title', 'topic', 'date'],
16
- properties: {
17
- title: {
18
- oneOf: [{
19
- type: 'string',
20
- title: 'Title'
21
- }, i18nMsg('title')]
22
- },
23
- body: {
24
- oneOf: [{
25
- type: 'string',
26
- title: 'Content'
27
- }, i18nMsg('content')]
28
- },
29
- htmlBody: {
30
- oneOf: [{
31
- type: 'string',
32
- title: 'HTML content'
33
- }, i18nMsg('HTML content')]
34
- },
35
- icon: {
36
- type: 'string',
37
- title: 'URL of event icon'
38
- },
39
- // sender is the owner of the topic, topic is global if no sender is given
40
- sender: { $ref: '#/$defs/sender' },
41
- // originator is the account/user who triggered the event
42
- originator: {
43
- type: 'object',
44
- properties: {
45
- internalProcess: {
46
- type: 'object',
47
- properties: {
48
- id: { type: 'string' },
49
- title: { type: 'string' }
50
- }
10
+ $id: 'https://github.com/data-fair/lib/event',
11
+ 'x-exports': ['types'],
12
+ title: 'Event',
13
+ type: 'object',
14
+ additionalProperties: false,
15
+ required: ['title', 'topic', 'date'],
16
+ properties: {
17
+ title: {
18
+ oneOf: [{
19
+ type: 'string',
20
+ title: 'Title'
21
+ }, i18nMsg('title')]
51
22
  },
52
- apiKey: {
53
- type: 'object',
54
- properties: {
55
- id: { type: 'string' },
56
- title: { type: 'string' }
57
- }
23
+ body: {
24
+ oneOf: [{
25
+ type: 'string',
26
+ title: 'Content'
27
+ }, i18nMsg('content')]
58
28
  },
59
- user: {
60
- type: 'object',
61
- properties: {
62
- id: {
63
- type: 'string',
64
- title: 'User ID'
65
- },
66
- name: {
67
- type: 'string',
68
- title: 'User name'
69
- },
70
- email: {
71
- type: 'string',
72
- title: 'User email'
73
- },
74
- admin: {
75
- type: 'boolean',
76
- title: 'User was working as a platform admin'
77
- }
78
- }
29
+ htmlBody: {
30
+ oneOf: [{
31
+ type: 'string',
32
+ title: 'HTML content'
33
+ }, i18nMsg('HTML content')]
79
34
  },
80
- organization: {
81
- type: 'object',
82
- properties: {
83
- id: {
84
- type: 'string',
85
- title: 'Organization ID'
86
- },
87
- name: {
88
- type: 'string',
89
- title: 'Organization name'
90
- },
91
- department: {
92
- type: 'string',
93
- title: 'Organization department'
94
- },
95
- departmentName: {
96
- type: 'string',
97
- title: 'Organization department name'
98
- }
99
- }
100
- }
101
- }
102
- },
103
- topic: { $ref: '#/$defs/topicRef' },
104
- url: {
105
- type: 'string',
106
- title: 'explicitly defined url, alternative is to use urlTemplate in subscription and urlParams',
107
- },
108
- urlParams: {
109
- type: 'object',
110
- title: 'used to fill subscription.urlTemplate and so create notification.url',
111
- patternProperties: {
112
- '.*': { type: 'string' }
113
- }
114
- },
115
- visibility: {
116
- type: 'string',
117
- title: 'Visibility',
118
- enum: ['public', 'private'],
119
- default: 'private'
120
- },
121
- date: {
122
- type: 'string',
123
- title: 'Reception date',
124
- format: 'date-time'
125
- },
126
- extra: {
127
- type: 'object',
128
- description: 'Free properties that varie depending on the type of event'
129
- },
130
- resource: {
131
- type: 'object',
132
- title: 'The main resource concerned by the event',
133
- additionalProperties: false,
134
- required: ['type', 'id'],
135
- properties: {
136
- type: {
137
- type: 'string',
138
- title: 'Type'
35
+ icon: {
36
+ type: 'string',
37
+ title: 'URL of event icon'
139
38
  },
140
- id: {
141
- type: 'string',
142
- description: 'The unique id of the resource'
39
+ // sender is the owner of the topic, topic is global if no sender is given
40
+ sender: { $ref: '#/$defs/sender' },
41
+ // originator is the account/user who triggered the event
42
+ originator: {
43
+ type: 'object',
44
+ properties: {
45
+ internalProcess: {
46
+ type: 'object',
47
+ properties: {
48
+ id: { type: 'string' },
49
+ title: { type: 'string' }
50
+ }
51
+ },
52
+ apiKey: {
53
+ type: 'object',
54
+ properties: {
55
+ id: { type: 'string' },
56
+ title: { type: 'string' }
57
+ }
58
+ },
59
+ user: {
60
+ type: 'object',
61
+ properties: {
62
+ id: {
63
+ type: 'string',
64
+ title: 'User ID'
65
+ },
66
+ name: {
67
+ type: 'string',
68
+ title: 'User name'
69
+ },
70
+ email: {
71
+ type: 'string',
72
+ title: 'User email'
73
+ },
74
+ admin: {
75
+ type: 'boolean',
76
+ title: 'User was working as a platform admin'
77
+ }
78
+ }
79
+ },
80
+ organization: {
81
+ type: 'object',
82
+ properties: {
83
+ id: {
84
+ type: 'string',
85
+ title: 'Organization ID'
86
+ },
87
+ name: {
88
+ type: 'string',
89
+ title: 'Organization name'
90
+ },
91
+ department: {
92
+ type: 'string',
93
+ title: 'Organization department'
94
+ },
95
+ departmentName: {
96
+ type: 'string',
97
+ title: 'Organization department name'
98
+ }
99
+ }
100
+ }
101
+ }
143
102
  },
144
- title: {
145
- type: 'string',
146
- description: 'The display name of the resource'
147
- }
148
- }
149
- },
150
- subscribedRecipient: {
151
- type: 'object',
152
- title: 'Optional recipient target of the event',
153
- required: ['id'],
154
- readOnly: true,
155
- properties: {
156
- id: {
157
- type: 'string',
158
- description: 'The unique id of the user'
103
+ topic: { $ref: '#/$defs/topicRef' },
104
+ url: {
105
+ type: 'string',
106
+ title: 'explicitly defined url, alternative is to use urlTemplate in subscription and urlParams',
159
107
  },
160
- name: {
161
- type: 'string',
162
- description: 'The display name of the user'
163
- }
164
- }
165
- }
166
- },
167
- $defs: {
168
- sender: {
169
- type: 'object',
170
- title: 'Emitter',
171
- additionalProperties: false,
172
- required: ['type', 'id'],
173
- properties: {
174
- type: {
175
- type: 'string',
176
- enum: ['user', 'organization'],
177
- title: 'Type'
108
+ urlParams: {
109
+ type: 'object',
110
+ title: 'used to fill subscription.urlTemplate and so create notification.url',
111
+ patternProperties: {
112
+ '.*': { type: 'string' }
113
+ }
178
114
  },
179
- id: {
180
- type: 'string',
181
- description: 'The unique id of the user or organization'
115
+ visibility: {
116
+ type: 'string',
117
+ title: 'Visibility',
118
+ enum: ['public', 'private'],
119
+ default: 'private'
182
120
  },
183
- name: {
184
- type: 'string',
185
- description: 'The display name of the user or organization'
121
+ date: {
122
+ type: 'string',
123
+ title: 'Reception date',
124
+ format: 'date-time'
186
125
  },
187
- role: {
188
- type: 'string',
189
- description: 'If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role'
126
+ extra: {
127
+ type: 'object',
128
+ description: 'Free properties that varie depending on the type of event'
190
129
  },
191
- department: {
192
- type: 'string',
193
- description: 'If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department'
130
+ resource: {
131
+ type: 'object',
132
+ title: 'The main resource concerned by the event',
133
+ additionalProperties: false,
134
+ required: ['type', 'id'],
135
+ properties: {
136
+ type: {
137
+ type: 'string',
138
+ title: 'Type'
139
+ },
140
+ id: {
141
+ type: 'string',
142
+ description: 'The unique id of the resource'
143
+ },
144
+ title: {
145
+ type: 'string',
146
+ description: 'The display name of the resource'
147
+ }
148
+ }
194
149
  },
195
- departmentName: {
196
- type: 'string',
197
- description: 'The display name of the department'
150
+ subscribedRecipient: {
151
+ type: 'object',
152
+ title: 'Optional recipient target of the event',
153
+ required: ['id'],
154
+ readOnly: true,
155
+ properties: {
156
+ id: {
157
+ type: 'string',
158
+ description: 'The unique id of the user'
159
+ },
160
+ name: {
161
+ type: 'string',
162
+ description: 'The display name of the user'
163
+ }
164
+ }
198
165
  }
199
- }
200
166
  },
201
- topicRef: {
202
- type: 'object',
203
- additionalProperties: false,
204
- required: ['key'],
205
- properties: {
206
- key: {
207
- type: 'string',
208
- title: 'Topic key'
167
+ $defs: {
168
+ sender: {
169
+ type: 'object',
170
+ title: 'Emitter',
171
+ additionalProperties: false,
172
+ required: ['type', 'id'],
173
+ properties: {
174
+ type: {
175
+ type: 'string',
176
+ enum: ['user', 'organization'],
177
+ title: 'Type'
178
+ },
179
+ id: {
180
+ type: 'string',
181
+ description: 'The unique id of the user or organization'
182
+ },
183
+ name: {
184
+ type: 'string',
185
+ description: 'The display name of the user or organization'
186
+ },
187
+ role: {
188
+ type: 'string',
189
+ description: 'If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role'
190
+ },
191
+ department: {
192
+ type: 'string',
193
+ description: 'If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department'
194
+ },
195
+ departmentName: {
196
+ type: 'string',
197
+ description: 'The display name of the department'
198
+ }
199
+ }
209
200
  },
210
- title: {
211
- type: 'string',
212
- title: 'Topic title'
201
+ topicRef: {
202
+ type: 'object',
203
+ additionalProperties: false,
204
+ required: ['key'],
205
+ properties: {
206
+ key: {
207
+ type: 'string',
208
+ title: 'Topic key'
209
+ },
210
+ title: {
211
+ type: 'string',
212
+ title: 'Topic title'
213
+ }
214
+ }
213
215
  }
214
- }
215
216
  }
216
- }
217
- }
217
+ };
@@ -1 +1 @@
1
- export * from './.type/index.js'
1
+ export * from './.type/index.js';
@@ -1,87 +1,87 @@
1
1
  export default {
2
- $id: 'https://github.com/data-fair/lib/notification',
3
- 'x-exports': ['types', 'validate'],
4
- title: 'Notification',
5
- type: 'object',
6
- additionalProperties: false,
7
- required: ['title', 'topic', 'sender', 'recipient', 'date'],
8
- properties: {
9
- origin: {
10
- type: 'string',
11
- title: 'Site d\'origine de la souscription',
12
- readOnly: true
13
- },
14
- title: {
15
- type: 'string',
16
- title: 'Titre'
17
- },
18
- body: {
19
- type: 'string',
20
- title: 'Contenu'
21
- },
22
- htmlBody: {
23
- type: 'string',
24
- title: 'Contenu HTML'
25
- },
26
- locale: {
27
- type: 'string',
28
- title: 'Langue de la notification',
29
- enum: ['fr', 'en']
30
- },
31
- icon: {
32
- type: 'string',
33
- title: 'URL de l\'icone de la notification'
34
- },
35
- // sender is the owner of the topic
36
- sender: { $ref: 'https://github.com/data-fair/lib/event#/$defs/sender' },
37
- topic: { $ref: 'https://github.com/data-fair/lib/event#/$defs/topicRef' },
38
- recipient: {
39
- type: 'object',
40
- required: ['id'],
41
- readOnly: true,
42
- properties: {
43
- id: {
44
- type: 'string',
45
- description: 'The unique id of the user'
2
+ $id: 'https://github.com/data-fair/lib/notification',
3
+ 'x-exports': ['types', 'validate'],
4
+ title: 'Notification',
5
+ type: 'object',
6
+ additionalProperties: false,
7
+ required: ['title', 'topic', 'sender', 'recipient', 'date'],
8
+ properties: {
9
+ origin: {
10
+ type: 'string',
11
+ title: 'Site d\'origine de la souscription',
12
+ readOnly: true
46
13
  },
47
- name: {
48
- type: 'string',
49
- description: 'The display name of the user'
14
+ title: {
15
+ type: 'string',
16
+ title: 'Titre'
17
+ },
18
+ body: {
19
+ type: 'string',
20
+ title: 'Contenu'
21
+ },
22
+ htmlBody: {
23
+ type: 'string',
24
+ title: 'Contenu HTML'
25
+ },
26
+ locale: {
27
+ type: 'string',
28
+ title: 'Langue de la notification',
29
+ enum: ['fr', 'en']
30
+ },
31
+ icon: {
32
+ type: 'string',
33
+ title: 'URL de l\'icone de la notification'
34
+ },
35
+ // sender is the owner of the topic
36
+ sender: { $ref: 'https://github.com/data-fair/lib/event#/$defs/sender' },
37
+ topic: { $ref: 'https://github.com/data-fair/lib/event#/$defs/topicRef' },
38
+ recipient: {
39
+ type: 'object',
40
+ required: ['id'],
41
+ readOnly: true,
42
+ properties: {
43
+ id: {
44
+ type: 'string',
45
+ description: 'The unique id of the user'
46
+ },
47
+ name: {
48
+ type: 'string',
49
+ description: 'The display name of the user'
50
+ }
51
+ }
52
+ },
53
+ outputs: {
54
+ type: 'array',
55
+ title: 'Sorties',
56
+ items: {
57
+ type: 'string',
58
+ oneOf: [{
59
+ const: 'devices',
60
+ title: 'recevoir la notification sur vos appareils configurés'
61
+ }, {
62
+ const: 'email',
63
+ title: 'recevoir la notification par email'
64
+ }]
65
+ }
66
+ },
67
+ url: {
68
+ type: 'string',
69
+ title: 'calculé à partir de subscription.urlTemplate et event.urlParams',
70
+ readOnly: true
71
+ },
72
+ date: {
73
+ readOnly: true,
74
+ type: 'string',
75
+ description: 'reception date',
76
+ format: 'date-time'
77
+ },
78
+ new: {
79
+ readOnly: true,
80
+ type: 'boolean'
81
+ },
82
+ extra: {
83
+ type: 'object',
84
+ description: 'propriétés libres qui varient en fonction du type de notification'
50
85
  }
51
- }
52
- },
53
- outputs: {
54
- type: 'array',
55
- title: 'Sorties',
56
- items: {
57
- type: 'string',
58
- oneOf: [{
59
- const: 'devices',
60
- title: 'recevoir la notification sur vos appareils configurés'
61
- }, {
62
- const: 'email',
63
- title: 'recevoir la notification par email'
64
- }]
65
- }
66
- },
67
- url: {
68
- type: 'string',
69
- title: 'calculé à partir de subscription.urlTemplate et event.urlParams',
70
- readOnly: true
71
- },
72
- date: {
73
- readOnly: true,
74
- type: 'string',
75
- description: 'reception date',
76
- format: 'date-time'
77
- },
78
- new: {
79
- readOnly: true,
80
- type: 'boolean'
81
- },
82
- extra: {
83
- type: 'object',
84
- description: 'propriétés libres qui varient en fonction du type de notification'
85
86
  }
86
- }
87
- }
87
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {