@data-fair/lib-common-types 1.19.4 → 1.19.6

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.
@@ -2,6 +2,7 @@
2
2
  export const schemaExports: string[]
3
3
 
4
4
  // see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
5
+ export type GloballyUniqueId = string;
5
6
  export type Title = string;
6
7
  export type Content = string;
7
8
  export type HTMLContent = string;
@@ -23,6 +24,7 @@ export type ReceptionDate = string;
23
24
  export type Type1 = string;
24
25
 
25
26
  export type Event = {
27
+ _id?: GloballyUniqueId;
26
28
  title: Title | InternationalizedTitle;
27
29
  body?: Content | InternationalizedContent;
28
30
  htmlBody?: HTMLContent | InternationalizedHTMLContent;
package/event/schema.d.ts CHANGED
@@ -6,6 +6,10 @@ declare const _default: {
6
6
  additionalProperties: boolean;
7
7
  required: string[];
8
8
  properties: {
9
+ _id: {
10
+ type: string;
11
+ title: string;
12
+ };
9
13
  title: {
10
14
  oneOf: ({
11
15
  type: string;
package/event/schema.js CHANGED
@@ -14,6 +14,10 @@ export default {
14
14
  additionalProperties: false,
15
15
  required: ['title', 'topic', 'date'],
16
16
  properties: {
17
+ _id: {
18
+ type: 'string',
19
+ title: 'Globally unique id'
20
+ },
17
21
  title: {
18
22
  oneOf: [{
19
23
  type: 'string',
@@ -2,6 +2,8 @@
2
2
  export const schemaExports: string[]
3
3
 
4
4
  // see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
5
+ export type GloballyUniqueId = string;
6
+ export type GloballyUniqueIdOfTheEventSourceOfThisNotification = string;
5
7
  export type SiteDOrigineDeLaSouscription = string;
6
8
  export type Titre = string;
7
9
  export type Contenu = string;
@@ -14,9 +16,11 @@ export type TopicTitle = string;
14
16
  export type RecevoirLaNotificationSurVosAppareilsConfigures = "devices";
15
17
  export type RecevoirLaNotificationParEmail = "email";
16
18
  export type Sorties = ((RecevoirLaNotificationSurVosAppareilsConfigures | RecevoirLaNotificationParEmail) & string)[];
17
- export type CalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams = string;
19
+ export type DefiniExplicitementOuCalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams = string;
18
20
 
19
21
  export type Notification = {
22
+ _id?: GloballyUniqueId;
23
+ eventId?: GloballyUniqueIdOfTheEventSourceOfThisNotification;
20
24
  origin?: SiteDOrigineDeLaSouscription;
21
25
  title: Titre;
22
26
  body?: Contenu;
@@ -37,7 +41,7 @@ export type Notification = {
37
41
  [k: string]: unknown;
38
42
  };
39
43
  outputs?: Sorties;
40
- url?: CalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams;
44
+ url?: DefiniExplicitementOuCalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams;
41
45
  /**
42
46
  * reception date
43
47
  */
@@ -5,7 +5,7 @@ import { fullFormats } from "ajv-formats/dist/formats.js";
5
5
  "use strict";
6
6
  export const validate = validate14;
7
7
  export default validate14;
8
- const schema16 = {"$id":"https://github.com/data-fair/lib/notification","x-exports":["types","validate"],"title":"Notification","type":"object","additionalProperties":false,"required":["title","topic","sender","recipient","date"],"properties":{"origin":{"type":"string","title":"Site d'origine de la souscription","readOnly":true},"title":{"type":"string","title":"Titre"},"body":{"type":"string","title":"Contenu"},"htmlBody":{"type":"string","title":"Contenu HTML"},"locale":{"type":"string","title":"Langue de la notification","enum":["fr","en"]},"icon":{"type":"string","title":"URL de l'icone de la notification"},"sender":{"$ref":"https://github.com/data-fair/lib/event#/$defs/sender"},"topic":{"$ref":"https://github.com/data-fair/lib/event#/$defs/topicRef"},"recipient":{"type":"object","required":["id"],"readOnly":true,"properties":{"id":{"type":"string","description":"The unique id of the user"},"name":{"type":"string","description":"The display name of the user"}}},"outputs":{"type":"array","title":"Sorties","items":{"type":"string","oneOf":[{"const":"devices","title":"recevoir la notification sur vos appareils configurés"},{"const":"email","title":"recevoir la notification par email"}]}},"url":{"type":"string","title":"calculé à partir de subscription.urlTemplate et event.urlParams","readOnly":true},"date":{"readOnly":true,"type":"string","description":"reception date","format":"date-time"},"new":{"readOnly":true,"type":"boolean"},"extra":{"type":"object","description":"propriétés libres qui varient en fonction du type de notification"}}};
8
+ const schema16 = {"$id":"https://github.com/data-fair/lib/notification","x-exports":["types","validate"],"title":"Notification","type":"object","additionalProperties":false,"required":["title","topic","sender","recipient","date"],"properties":{"_id":{"type":"string","title":"Globally unique id"},"eventId":{"type":"string","title":"Globally unique id of the event source of this notification"},"origin":{"type":"string","title":"Site d'origine de la souscription","readOnly":true},"title":{"type":"string","title":"Titre"},"body":{"type":"string","title":"Contenu"},"htmlBody":{"type":"string","title":"Contenu HTML"},"locale":{"type":"string","title":"Langue de la notification","enum":["fr","en"]},"icon":{"type":"string","title":"URL de l'icone de la notification"},"sender":{"$ref":"https://github.com/data-fair/lib/event#/$defs/sender"},"topic":{"$ref":"https://github.com/data-fair/lib/event#/$defs/topicRef"},"recipient":{"type":"object","required":["id"],"readOnly":true,"properties":{"id":{"type":"string","description":"The unique id of the user"},"name":{"type":"string","description":"The display name of the user"}}},"outputs":{"type":"array","title":"Sorties","items":{"type":"string","oneOf":[{"const":"devices","title":"recevoir la notification sur vos appareils configurés"},{"const":"email","title":"recevoir la notification par email"}]}},"url":{"type":"string","title":"défini explicitement ou calculé à partir de subscription.urlTemplate et event.urlParams"},"date":{"type":"string","description":"reception date","format":"date-time"},"new":{"readOnly":true,"type":"boolean"},"extra":{"type":"object","description":"propriétés libres qui varient en fonction du type de notification"}}};
9
9
  const schema18 = {"type":"object","title":"Emitter","additionalProperties":false,"required":["type","id"],"properties":{"type":{"type":"string","enum":["user","organization"],"title":"Type"},"id":{"type":"string","description":"The unique id of the user or organization"},"name":{"type":"string","description":"The display name of the user or organization"},"role":{"type":"string","description":"If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role"},"department":{"type":"string","description":"If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department"},"departmentName":{"type":"string","description":"The display name of the department"}}};
10
10
  const schema19 = {"type":"object","additionalProperties":false,"required":["key"],"properties":{"key":{"type":"string","title":"Topic key"},"title":{"type":"string","title":"Topic title"}}};
11
11
  const func2 = Object.prototype.hasOwnProperty;
@@ -78,9 +78,9 @@ vErrors.push(err5);
78
78
  errors++;
79
79
  }
80
80
  }
81
- if(data.origin !== undefined){
82
- if(typeof data.origin !== "string"){
83
- const err6 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/type",keyword:"type",params:{type: "string"},message:"must be string"};
81
+ if(data._id !== undefined){
82
+ if(typeof data._id !== "string"){
83
+ const err6 = {instancePath:instancePath+"/_id",schemaPath:"#/properties/_id/type",keyword:"type",params:{type: "string"},message:"must be string"};
84
84
  if(vErrors === null){
85
85
  vErrors = [err6];
86
86
  }
@@ -90,9 +90,9 @@ vErrors.push(err6);
90
90
  errors++;
91
91
  }
92
92
  }
93
- if(data.title !== undefined){
94
- if(typeof data.title !== "string"){
95
- const err7 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};
93
+ if(data.eventId !== undefined){
94
+ if(typeof data.eventId !== "string"){
95
+ const err7 = {instancePath:instancePath+"/eventId",schemaPath:"#/properties/eventId/type",keyword:"type",params:{type: "string"},message:"must be string"};
96
96
  if(vErrors === null){
97
97
  vErrors = [err7];
98
98
  }
@@ -102,9 +102,9 @@ vErrors.push(err7);
102
102
  errors++;
103
103
  }
104
104
  }
105
- if(data.body !== undefined){
106
- if(typeof data.body !== "string"){
107
- const err8 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/type",keyword:"type",params:{type: "string"},message:"must be string"};
105
+ if(data.origin !== undefined){
106
+ if(typeof data.origin !== "string"){
107
+ const err8 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/type",keyword:"type",params:{type: "string"},message:"must be string"};
108
108
  if(vErrors === null){
109
109
  vErrors = [err8];
110
110
  }
@@ -114,9 +114,9 @@ vErrors.push(err8);
114
114
  errors++;
115
115
  }
116
116
  }
117
- if(data.htmlBody !== undefined){
118
- if(typeof data.htmlBody !== "string"){
119
- const err9 = {instancePath:instancePath+"/htmlBody",schemaPath:"#/properties/htmlBody/type",keyword:"type",params:{type: "string"},message:"must be string"};
117
+ if(data.title !== undefined){
118
+ if(typeof data.title !== "string"){
119
+ const err9 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};
120
120
  if(vErrors === null){
121
121
  vErrors = [err9];
122
122
  }
@@ -126,10 +126,9 @@ vErrors.push(err9);
126
126
  errors++;
127
127
  }
128
128
  }
129
- if(data.locale !== undefined){
130
- let data4 = data.locale;
131
- if(typeof data4 !== "string"){
132
- const err10 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};
129
+ if(data.body !== undefined){
130
+ if(typeof data.body !== "string"){
131
+ const err10 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/type",keyword:"type",params:{type: "string"},message:"must be string"};
133
132
  if(vErrors === null){
134
133
  vErrors = [err10];
135
134
  }
@@ -138,8 +137,10 @@ vErrors.push(err10);
138
137
  }
139
138
  errors++;
140
139
  }
141
- if(!((data4 === "fr") || (data4 === "en"))){
142
- const err11 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/enum",keyword:"enum",params:{allowedValues: schema16.properties.locale.enum},message:"must be equal to one of the allowed values"};
140
+ }
141
+ if(data.htmlBody !== undefined){
142
+ if(typeof data.htmlBody !== "string"){
143
+ const err11 = {instancePath:instancePath+"/htmlBody",schemaPath:"#/properties/htmlBody/type",keyword:"type",params:{type: "string"},message:"must be string"};
143
144
  if(vErrors === null){
144
145
  vErrors = [err11];
145
146
  }
@@ -149,9 +150,10 @@ vErrors.push(err11);
149
150
  errors++;
150
151
  }
151
152
  }
152
- if(data.icon !== undefined){
153
- if(typeof data.icon !== "string"){
154
- const err12 = {instancePath:instancePath+"/icon",schemaPath:"#/properties/icon/type",keyword:"type",params:{type: "string"},message:"must be string"};
153
+ if(data.locale !== undefined){
154
+ let data6 = data.locale;
155
+ if(typeof data6 !== "string"){
156
+ const err12 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};
155
157
  if(vErrors === null){
156
158
  vErrors = [err12];
157
159
  }
@@ -160,12 +162,8 @@ vErrors.push(err12);
160
162
  }
161
163
  errors++;
162
164
  }
163
- }
164
- if(data.sender !== undefined){
165
- let data6 = data.sender;
166
- if(data6 && typeof data6 == "object" && !Array.isArray(data6)){
167
- if(data6.type === undefined){
168
- const err13 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
165
+ if(!((data6 === "fr") || (data6 === "en"))){
166
+ const err13 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/enum",keyword:"enum",params:{allowedValues: schema16.properties.locale.enum},message:"must be equal to one of the allowed values"};
169
167
  if(vErrors === null){
170
168
  vErrors = [err13];
171
169
  }
@@ -174,8 +172,10 @@ vErrors.push(err13);
174
172
  }
175
173
  errors++;
176
174
  }
177
- if(data6.id === undefined){
178
- const err14 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
175
+ }
176
+ if(data.icon !== undefined){
177
+ if(typeof data.icon !== "string"){
178
+ const err14 = {instancePath:instancePath+"/icon",schemaPath:"#/properties/icon/type",keyword:"type",params:{type: "string"},message:"must be string"};
179
179
  if(vErrors === null){
180
180
  vErrors = [err14];
181
181
  }
@@ -184,9 +184,12 @@ vErrors.push(err14);
184
184
  }
185
185
  errors++;
186
186
  }
187
- for(const key1 in data6){
188
- if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
189
- const err15 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
187
+ }
188
+ if(data.sender !== undefined){
189
+ let data8 = data.sender;
190
+ if(data8 && typeof data8 == "object" && !Array.isArray(data8)){
191
+ if(data8.type === undefined){
192
+ const err15 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
190
193
  if(vErrors === null){
191
194
  vErrors = [err15];
192
195
  }
@@ -195,11 +198,8 @@ vErrors.push(err15);
195
198
  }
196
199
  errors++;
197
200
  }
198
- }
199
- if(data6.type !== undefined){
200
- let data7 = data6.type;
201
- if(typeof data7 !== "string"){
202
- const err16 = {instancePath:instancePath+"/sender/type",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
201
+ if(data8.id === undefined){
202
+ const err16 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
203
203
  if(vErrors === null){
204
204
  vErrors = [err16];
205
205
  }
@@ -208,8 +208,9 @@ vErrors.push(err16);
208
208
  }
209
209
  errors++;
210
210
  }
211
- if(!((data7 === "user") || (data7 === "organization"))){
212
- const err17 = {instancePath:instancePath+"/sender/type",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/type/enum",keyword:"enum",params:{allowedValues: schema18.properties.type.enum},message:"must be equal to one of the allowed values"};
211
+ for(const key1 in data8){
212
+ if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
213
+ const err17 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
213
214
  if(vErrors === null){
214
215
  vErrors = [err17];
215
216
  }
@@ -219,9 +220,10 @@ vErrors.push(err17);
219
220
  errors++;
220
221
  }
221
222
  }
222
- if(data6.id !== undefined){
223
- if(typeof data6.id !== "string"){
224
- const err18 = {instancePath:instancePath+"/sender/id",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
223
+ if(data8.type !== undefined){
224
+ let data9 = data8.type;
225
+ if(typeof data9 !== "string"){
226
+ const err18 = {instancePath:instancePath+"/sender/type",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
225
227
  if(vErrors === null){
226
228
  vErrors = [err18];
227
229
  }
@@ -230,10 +232,8 @@ vErrors.push(err18);
230
232
  }
231
233
  errors++;
232
234
  }
233
- }
234
- if(data6.name !== undefined){
235
- if(typeof data6.name !== "string"){
236
- const err19 = {instancePath:instancePath+"/sender/name",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
235
+ if(!((data9 === "user") || (data9 === "organization"))){
236
+ const err19 = {instancePath:instancePath+"/sender/type",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/type/enum",keyword:"enum",params:{allowedValues: schema18.properties.type.enum},message:"must be equal to one of the allowed values"};
237
237
  if(vErrors === null){
238
238
  vErrors = [err19];
239
239
  }
@@ -243,9 +243,9 @@ vErrors.push(err19);
243
243
  errors++;
244
244
  }
245
245
  }
246
- if(data6.role !== undefined){
247
- if(typeof data6.role !== "string"){
248
- const err20 = {instancePath:instancePath+"/sender/role",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
246
+ if(data8.id !== undefined){
247
+ if(typeof data8.id !== "string"){
248
+ const err20 = {instancePath:instancePath+"/sender/id",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
249
249
  if(vErrors === null){
250
250
  vErrors = [err20];
251
251
  }
@@ -255,9 +255,9 @@ vErrors.push(err20);
255
255
  errors++;
256
256
  }
257
257
  }
258
- if(data6.department !== undefined){
259
- if(typeof data6.department !== "string"){
260
- const err21 = {instancePath:instancePath+"/sender/department",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
258
+ if(data8.name !== undefined){
259
+ if(typeof data8.name !== "string"){
260
+ const err21 = {instancePath:instancePath+"/sender/name",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
261
261
  if(vErrors === null){
262
262
  vErrors = [err21];
263
263
  }
@@ -267,9 +267,9 @@ vErrors.push(err21);
267
267
  errors++;
268
268
  }
269
269
  }
270
- if(data6.departmentName !== undefined){
271
- if(typeof data6.departmentName !== "string"){
272
- const err22 = {instancePath:instancePath+"/sender/departmentName",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
270
+ if(data8.role !== undefined){
271
+ if(typeof data8.role !== "string"){
272
+ const err22 = {instancePath:instancePath+"/sender/role",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
273
273
  if(vErrors === null){
274
274
  vErrors = [err22];
275
275
  }
@@ -279,9 +279,9 @@ vErrors.push(err22);
279
279
  errors++;
280
280
  }
281
281
  }
282
- }
283
- else {
284
- const err23 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/type",keyword:"type",params:{type: "object"},message:"must be object"};
282
+ if(data8.department !== undefined){
283
+ if(typeof data8.department !== "string"){
284
+ const err23 = {instancePath:instancePath+"/sender/department",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
285
285
  if(vErrors === null){
286
286
  vErrors = [err23];
287
287
  }
@@ -291,11 +291,9 @@ vErrors.push(err23);
291
291
  errors++;
292
292
  }
293
293
  }
294
- if(data.topic !== undefined){
295
- let data13 = data.topic;
296
- if(data13 && typeof data13 == "object" && !Array.isArray(data13)){
297
- if(data13.key === undefined){
298
- const err24 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/required",keyword:"required",params:{missingProperty: "key"},message:"must have required property '"+"key"+"'"};
294
+ if(data8.departmentName !== undefined){
295
+ if(typeof data8.departmentName !== "string"){
296
+ const err24 = {instancePath:instancePath+"/sender/departmentName",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
299
297
  if(vErrors === null){
300
298
  vErrors = [err24];
301
299
  }
@@ -304,9 +302,10 @@ vErrors.push(err24);
304
302
  }
305
303
  errors++;
306
304
  }
307
- for(const key2 in data13){
308
- if(!((key2 === "key") || (key2 === "title"))){
309
- const err25 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
305
+ }
306
+ }
307
+ else {
308
+ const err25 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/type",keyword:"type",params:{type: "object"},message:"must be object"};
310
309
  if(vErrors === null){
311
310
  vErrors = [err25];
312
311
  }
@@ -316,9 +315,11 @@ vErrors.push(err25);
316
315
  errors++;
317
316
  }
318
317
  }
319
- if(data13.key !== undefined){
320
- if(typeof data13.key !== "string"){
321
- const err26 = {instancePath:instancePath+"/topic/key",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/properties/key/type",keyword:"type",params:{type: "string"},message:"must be string"};
318
+ if(data.topic !== undefined){
319
+ let data15 = data.topic;
320
+ if(data15 && typeof data15 == "object" && !Array.isArray(data15)){
321
+ if(data15.key === undefined){
322
+ const err26 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/required",keyword:"required",params:{missingProperty: "key"},message:"must have required property '"+"key"+"'"};
322
323
  if(vErrors === null){
323
324
  vErrors = [err26];
324
325
  }
@@ -327,10 +328,9 @@ vErrors.push(err26);
327
328
  }
328
329
  errors++;
329
330
  }
330
- }
331
- if(data13.title !== undefined){
332
- if(typeof data13.title !== "string"){
333
- const err27 = {instancePath:instancePath+"/topic/title",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};
331
+ for(const key2 in data15){
332
+ if(!((key2 === "key") || (key2 === "title"))){
333
+ const err27 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
334
334
  if(vErrors === null){
335
335
  vErrors = [err27];
336
336
  }
@@ -340,9 +340,9 @@ vErrors.push(err27);
340
340
  errors++;
341
341
  }
342
342
  }
343
- }
344
- else {
345
- const err28 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
343
+ if(data15.key !== undefined){
344
+ if(typeof data15.key !== "string"){
345
+ const err28 = {instancePath:instancePath+"/topic/key",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/properties/key/type",keyword:"type",params:{type: "string"},message:"must be string"};
346
346
  if(vErrors === null){
347
347
  vErrors = [err28];
348
348
  }
@@ -352,11 +352,9 @@ vErrors.push(err28);
352
352
  errors++;
353
353
  }
354
354
  }
355
- if(data.recipient !== undefined){
356
- let data16 = data.recipient;
357
- if(data16 && typeof data16 == "object" && !Array.isArray(data16)){
358
- if(data16.id === undefined){
359
- const err29 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
355
+ if(data15.title !== undefined){
356
+ if(typeof data15.title !== "string"){
357
+ const err29 = {instancePath:instancePath+"/topic/title",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};
360
358
  if(vErrors === null){
361
359
  vErrors = [err29];
362
360
  }
@@ -365,9 +363,10 @@ vErrors.push(err29);
365
363
  }
366
364
  errors++;
367
365
  }
368
- if(data16.id !== undefined){
369
- if(typeof data16.id !== "string"){
370
- const err30 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
366
+ }
367
+ }
368
+ else {
369
+ const err30 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
371
370
  if(vErrors === null){
372
371
  vErrors = [err30];
373
372
  }
@@ -377,9 +376,11 @@ vErrors.push(err30);
377
376
  errors++;
378
377
  }
379
378
  }
380
- if(data16.name !== undefined){
381
- if(typeof data16.name !== "string"){
382
- const err31 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
379
+ if(data.recipient !== undefined){
380
+ let data18 = data.recipient;
381
+ if(data18 && typeof data18 == "object" && !Array.isArray(data18)){
382
+ if(data18.id === undefined){
383
+ const err31 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
383
384
  if(vErrors === null){
384
385
  vErrors = [err31];
385
386
  }
@@ -388,66 +389,89 @@ vErrors.push(err31);
388
389
  }
389
390
  errors++;
390
391
  }
392
+ if(data18.id !== undefined){
393
+ if(typeof data18.id !== "string"){
394
+ const err32 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
395
+ if(vErrors === null){
396
+ vErrors = [err32];
397
+ }
398
+ else {
399
+ vErrors.push(err32);
400
+ }
401
+ errors++;
402
+ }
403
+ }
404
+ if(data18.name !== undefined){
405
+ if(typeof data18.name !== "string"){
406
+ const err33 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
407
+ if(vErrors === null){
408
+ vErrors = [err33];
409
+ }
410
+ else {
411
+ vErrors.push(err33);
412
+ }
413
+ errors++;
414
+ }
391
415
  }
392
416
  }
393
417
  else {
394
- const err32 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
418
+ const err34 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
395
419
  if(vErrors === null){
396
- vErrors = [err32];
420
+ vErrors = [err34];
397
421
  }
398
422
  else {
399
- vErrors.push(err32);
423
+ vErrors.push(err34);
400
424
  }
401
425
  errors++;
402
426
  }
403
427
  }
404
428
  if(data.outputs !== undefined){
405
- let data19 = data.outputs;
406
- if(Array.isArray(data19)){
407
- const len0 = data19.length;
429
+ let data21 = data.outputs;
430
+ if(Array.isArray(data21)){
431
+ const len0 = data21.length;
408
432
  for(let i0=0; i0<len0; i0++){
409
- let data20 = data19[i0];
410
- if(typeof data20 !== "string"){
411
- const err33 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
433
+ let data22 = data21[i0];
434
+ if(typeof data22 !== "string"){
435
+ const err35 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
412
436
  if(vErrors === null){
413
- vErrors = [err33];
437
+ vErrors = [err35];
414
438
  }
415
439
  else {
416
- vErrors.push(err33);
440
+ vErrors.push(err35);
417
441
  }
418
442
  errors++;
419
443
  }
420
- const _errs48 = errors;
444
+ const _errs52 = errors;
421
445
  let valid8 = false;
422
446
  let passing0 = null;
423
- const _errs49 = errors;
424
- if("devices" !== data20){
425
- const err34 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/0/const",keyword:"const",params:{allowedValue: "devices"},message:"must be equal to constant"};
447
+ const _errs53 = errors;
448
+ if("devices" !== data22){
449
+ const err36 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/0/const",keyword:"const",params:{allowedValue: "devices"},message:"must be equal to constant"};
426
450
  if(vErrors === null){
427
- vErrors = [err34];
451
+ vErrors = [err36];
428
452
  }
429
453
  else {
430
- vErrors.push(err34);
454
+ vErrors.push(err36);
431
455
  }
432
456
  errors++;
433
457
  }
434
- var _valid0 = _errs49 === errors;
458
+ var _valid0 = _errs53 === errors;
435
459
  if(_valid0){
436
460
  valid8 = true;
437
461
  passing0 = 0;
438
462
  }
439
- const _errs50 = errors;
440
- if("email" !== data20){
441
- const err35 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/1/const",keyword:"const",params:{allowedValue: "email"},message:"must be equal to constant"};
463
+ const _errs54 = errors;
464
+ if("email" !== data22){
465
+ const err37 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/1/const",keyword:"const",params:{allowedValue: "email"},message:"must be equal to constant"};
442
466
  if(vErrors === null){
443
- vErrors = [err35];
467
+ vErrors = [err37];
444
468
  }
445
469
  else {
446
- vErrors.push(err35);
470
+ vErrors.push(err37);
447
471
  }
448
472
  errors++;
449
473
  }
450
- var _valid0 = _errs50 === errors;
474
+ var _valid0 = _errs54 === errors;
451
475
  if(_valid0 && valid8){
452
476
  valid8 = false;
453
477
  passing0 = [passing0, 1];
@@ -459,20 +483,20 @@ passing0 = 1;
459
483
  }
460
484
  }
461
485
  if(!valid8){
462
- const err36 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
486
+ const err38 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
463
487
  if(vErrors === null){
464
- vErrors = [err36];
488
+ vErrors = [err38];
465
489
  }
466
490
  else {
467
- vErrors.push(err36);
491
+ vErrors.push(err38);
468
492
  }
469
493
  errors++;
470
494
  }
471
495
  else {
472
- errors = _errs48;
496
+ errors = _errs52;
473
497
  if(vErrors !== null){
474
- if(_errs48){
475
- vErrors.length = _errs48;
498
+ if(_errs52){
499
+ vErrors.length = _errs52;
476
500
  }
477
501
  else {
478
502
  vErrors = null;
@@ -482,86 +506,86 @@ vErrors = null;
482
506
  }
483
507
  }
484
508
  else {
485
- const err37 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
509
+ const err39 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
486
510
  if(vErrors === null){
487
- vErrors = [err37];
511
+ vErrors = [err39];
488
512
  }
489
513
  else {
490
- vErrors.push(err37);
514
+ vErrors.push(err39);
491
515
  }
492
516
  errors++;
493
517
  }
494
518
  }
495
519
  if(data.url !== undefined){
496
520
  if(typeof data.url !== "string"){
497
- const err38 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
521
+ const err40 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
498
522
  if(vErrors === null){
499
- vErrors = [err38];
523
+ vErrors = [err40];
500
524
  }
501
525
  else {
502
- vErrors.push(err38);
526
+ vErrors.push(err40);
503
527
  }
504
528
  errors++;
505
529
  }
506
530
  }
507
531
  if(data.date !== undefined){
508
- let data22 = data.date;
509
- if(typeof data22 === "string"){
510
- if(!(formats0.validate(data22))){
511
- const err39 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
532
+ let data24 = data.date;
533
+ if(typeof data24 === "string"){
534
+ if(!(formats0.validate(data24))){
535
+ const err41 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
512
536
  if(vErrors === null){
513
- vErrors = [err39];
537
+ vErrors = [err41];
514
538
  }
515
539
  else {
516
- vErrors.push(err39);
540
+ vErrors.push(err41);
517
541
  }
518
542
  errors++;
519
543
  }
520
544
  }
521
545
  else {
522
- const err40 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
546
+ const err42 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
523
547
  if(vErrors === null){
524
- vErrors = [err40];
548
+ vErrors = [err42];
525
549
  }
526
550
  else {
527
- vErrors.push(err40);
551
+ vErrors.push(err42);
528
552
  }
529
553
  errors++;
530
554
  }
531
555
  }
532
556
  if(data.new !== undefined){
533
557
  if(typeof data.new !== "boolean"){
534
- const err41 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
558
+ const err43 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
535
559
  if(vErrors === null){
536
- vErrors = [err41];
560
+ vErrors = [err43];
537
561
  }
538
562
  else {
539
- vErrors.push(err41);
563
+ vErrors.push(err43);
540
564
  }
541
565
  errors++;
542
566
  }
543
567
  }
544
568
  if(data.extra !== undefined){
545
- let data24 = data.extra;
546
- if(!(data24 && typeof data24 == "object" && !Array.isArray(data24))){
547
- const err42 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
569
+ let data26 = data.extra;
570
+ if(!(data26 && typeof data26 == "object" && !Array.isArray(data26))){
571
+ const err44 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
548
572
  if(vErrors === null){
549
- vErrors = [err42];
573
+ vErrors = [err44];
550
574
  }
551
575
  else {
552
- vErrors.push(err42);
576
+ vErrors.push(err44);
553
577
  }
554
578
  errors++;
555
579
  }
556
580
  }
557
581
  }
558
582
  else {
559
- const err43 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
583
+ const err45 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
560
584
  if(vErrors === null){
561
- vErrors = [err43];
585
+ vErrors = [err45];
562
586
  }
563
587
  else {
564
- vErrors.push(err43);
588
+ vErrors.push(err45);
565
589
  }
566
590
  errors++;
567
591
  }
@@ -6,6 +6,14 @@ declare const _default: {
6
6
  additionalProperties: boolean;
7
7
  required: string[];
8
8
  properties: {
9
+ _id: {
10
+ type: string;
11
+ title: string;
12
+ };
13
+ eventId: {
14
+ type: string;
15
+ title: string;
16
+ };
9
17
  origin: {
10
18
  type: string;
11
19
  title: string;
@@ -67,10 +75,8 @@ declare const _default: {
67
75
  url: {
68
76
  type: string;
69
77
  title: string;
70
- readOnly: boolean;
71
78
  };
72
79
  date: {
73
- readOnly: boolean;
74
80
  type: string;
75
81
  description: string;
76
82
  format: string;
@@ -6,6 +6,14 @@ export default {
6
6
  additionalProperties: false,
7
7
  required: ['title', 'topic', 'sender', 'recipient', 'date'],
8
8
  properties: {
9
+ _id: {
10
+ type: 'string',
11
+ title: 'Globally unique id'
12
+ },
13
+ eventId: {
14
+ type: 'string',
15
+ title: 'Globally unique id of the event source of this notification'
16
+ },
9
17
  origin: {
10
18
  type: 'string',
11
19
  title: 'Site d\'origine de la souscription',
@@ -66,11 +74,9 @@ export default {
66
74
  },
67
75
  url: {
68
76
  type: 'string',
69
- title: 'calculé à partir de subscription.urlTemplate et event.urlParams',
70
- readOnly: true
77
+ title: 'défini explicitement ou calculé à partir de subscription.urlTemplate et event.urlParams',
71
78
  },
72
79
  date: {
73
- readOnly: true,
74
80
  type: 'string',
75
81
  description: 'reception date',
76
82
  format: 'date-time'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.19.4",
3
+ "version": "1.19.6",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {