@data-fair/lib-common-types 1.5.0 → 1.5.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.
@@ -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":["_id","title","topic","sender","recipient","date"],"properties":{"_id":{"type":"string","title":"Identifiant","readOnly":true},"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":{"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"}}};
9
9
  const schema18 = {"type":"object","title":"Emitter","additionalProperties":false,"required":["type","id","name"],"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;
@@ -16,8 +16,8 @@ function validate14(data, {instancePath="", parentData, parentDataProperty, root
16
16
  let vErrors = null;
17
17
  let errors = 0;
18
18
  if(data && typeof data == "object" && !Array.isArray(data)){
19
- if(data._id === undefined){
20
- const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "_id"},message:"must have required property '"+"_id"+"'"};
19
+ if(data.title === undefined){
20
+ const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};
21
21
  if(vErrors === null){
22
22
  vErrors = [err0];
23
23
  }
@@ -26,8 +26,8 @@ vErrors.push(err0);
26
26
  }
27
27
  errors++;
28
28
  }
29
- if(data.title === undefined){
30
- const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};
29
+ if(data.topic === undefined){
30
+ const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "topic"},message:"must have required property '"+"topic"+"'"};
31
31
  if(vErrors === null){
32
32
  vErrors = [err1];
33
33
  }
@@ -36,8 +36,8 @@ vErrors.push(err1);
36
36
  }
37
37
  errors++;
38
38
  }
39
- if(data.topic === undefined){
40
- const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "topic"},message:"must have required property '"+"topic"+"'"};
39
+ if(data.sender === undefined){
40
+ const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sender"},message:"must have required property '"+"sender"+"'"};
41
41
  if(vErrors === null){
42
42
  vErrors = [err2];
43
43
  }
@@ -46,8 +46,8 @@ vErrors.push(err2);
46
46
  }
47
47
  errors++;
48
48
  }
49
- if(data.sender === undefined){
50
- const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sender"},message:"must have required property '"+"sender"+"'"};
49
+ if(data.recipient === undefined){
50
+ const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "recipient"},message:"must have required property '"+"recipient"+"'"};
51
51
  if(vErrors === null){
52
52
  vErrors = [err3];
53
53
  }
@@ -56,8 +56,8 @@ vErrors.push(err3);
56
56
  }
57
57
  errors++;
58
58
  }
59
- if(data.recipient === undefined){
60
- const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "recipient"},message:"must have required property '"+"recipient"+"'"};
59
+ if(data.date === undefined){
60
+ const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "date"},message:"must have required property '"+"date"+"'"};
61
61
  if(vErrors === null){
62
62
  vErrors = [err4];
63
63
  }
@@ -66,8 +66,9 @@ vErrors.push(err4);
66
66
  }
67
67
  errors++;
68
68
  }
69
- if(data.date === undefined){
70
- const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "date"},message:"must have required property '"+"date"+"'"};
69
+ for(const key0 in data){
70
+ if(!(func2.call(schema16.properties, key0))){
71
+ const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
71
72
  if(vErrors === null){
72
73
  vErrors = [err5];
73
74
  }
@@ -76,9 +77,10 @@ vErrors.push(err5);
76
77
  }
77
78
  errors++;
78
79
  }
79
- for(const key0 in data){
80
- if(!(func2.call(schema16.properties, key0))){
81
- const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
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"};
82
84
  if(vErrors === null){
83
85
  vErrors = [err6];
84
86
  }
@@ -88,9 +90,9 @@ vErrors.push(err6);
88
90
  errors++;
89
91
  }
90
92
  }
91
- if(data._id !== undefined){
92
- if(typeof data._id !== "string"){
93
- const err7 = {instancePath:instancePath+"/_id",schemaPath:"#/properties/_id/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"};
94
96
  if(vErrors === null){
95
97
  vErrors = [err7];
96
98
  }
@@ -100,9 +102,9 @@ vErrors.push(err7);
100
102
  errors++;
101
103
  }
102
104
  }
103
- if(data.origin !== undefined){
104
- if(typeof data.origin !== "string"){
105
- const err8 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"};
106
108
  if(vErrors === null){
107
109
  vErrors = [err8];
108
110
  }
@@ -112,9 +114,9 @@ vErrors.push(err8);
112
114
  errors++;
113
115
  }
114
116
  }
115
- if(data.title !== undefined){
116
- if(typeof data.title !== "string"){
117
- const err9 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"};
118
120
  if(vErrors === null){
119
121
  vErrors = [err9];
120
122
  }
@@ -124,9 +126,10 @@ vErrors.push(err9);
124
126
  errors++;
125
127
  }
126
128
  }
127
- if(data.body !== undefined){
128
- if(typeof data.body !== "string"){
129
- const err10 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"};
130
133
  if(vErrors === null){
131
134
  vErrors = [err10];
132
135
  }
@@ -135,10 +138,8 @@ vErrors.push(err10);
135
138
  }
136
139
  errors++;
137
140
  }
138
- }
139
- if(data.htmlBody !== undefined){
140
- if(typeof data.htmlBody !== "string"){
141
- const err11 = {instancePath:instancePath+"/htmlBody",schemaPath:"#/properties/htmlBody/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"};
142
143
  if(vErrors === null){
143
144
  vErrors = [err11];
144
145
  }
@@ -148,10 +149,9 @@ vErrors.push(err11);
148
149
  errors++;
149
150
  }
150
151
  }
151
- if(data.locale !== undefined){
152
- let data5 = data.locale;
153
- if(typeof data5 !== "string"){
154
- const err12 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"};
155
155
  if(vErrors === null){
156
156
  vErrors = [err12];
157
157
  }
@@ -160,8 +160,12 @@ vErrors.push(err12);
160
160
  }
161
161
  errors++;
162
162
  }
163
- if(!((data5 === "fr") || (data5 === "en"))){
164
- 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"};
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
169
  if(vErrors === null){
166
170
  vErrors = [err13];
167
171
  }
@@ -170,10 +174,8 @@ vErrors.push(err13);
170
174
  }
171
175
  errors++;
172
176
  }
173
- }
174
- if(data.icon !== undefined){
175
- if(typeof data.icon !== "string"){
176
- const err14 = {instancePath:instancePath+"/icon",schemaPath:"#/properties/icon/type",keyword:"type",params:{type: "string"},message:"must be string"};
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"+"'"};
177
179
  if(vErrors === null){
178
180
  vErrors = [err14];
179
181
  }
@@ -182,12 +184,8 @@ vErrors.push(err14);
182
184
  }
183
185
  errors++;
184
186
  }
185
- }
186
- if(data.sender !== undefined){
187
- let data7 = data.sender;
188
- if(data7 && typeof data7 == "object" && !Array.isArray(data7)){
189
- if(data7.type === undefined){
190
- 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"+"'"};
187
+ if(data6.name === undefined){
188
+ const err15 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
191
189
  if(vErrors === null){
192
190
  vErrors = [err15];
193
191
  }
@@ -196,8 +194,9 @@ vErrors.push(err15);
196
194
  }
197
195
  errors++;
198
196
  }
199
- if(data7.id === undefined){
200
- 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"+"'"};
197
+ for(const key1 in data6){
198
+ if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
199
+ const err16 = {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"};
201
200
  if(vErrors === null){
202
201
  vErrors = [err16];
203
202
  }
@@ -206,8 +205,11 @@ vErrors.push(err16);
206
205
  }
207
206
  errors++;
208
207
  }
209
- if(data7.name === undefined){
210
- const err17 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
208
+ }
209
+ if(data6.type !== undefined){
210
+ let data7 = data6.type;
211
+ if(typeof data7 !== "string"){
212
+ const err17 = {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"};
211
213
  if(vErrors === null){
212
214
  vErrors = [err17];
213
215
  }
@@ -216,9 +218,8 @@ vErrors.push(err17);
216
218
  }
217
219
  errors++;
218
220
  }
219
- for(const key1 in data7){
220
- if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
221
- const err18 = {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"};
221
+ if(!((data7 === "user") || (data7 === "organization"))){
222
+ const err18 = {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"};
222
223
  if(vErrors === null){
223
224
  vErrors = [err18];
224
225
  }
@@ -228,10 +229,9 @@ vErrors.push(err18);
228
229
  errors++;
229
230
  }
230
231
  }
231
- if(data7.type !== undefined){
232
- let data8 = data7.type;
233
- if(typeof data8 !== "string"){
234
- const err19 = {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"};
232
+ if(data6.id !== undefined){
233
+ if(typeof data6.id !== "string"){
234
+ const err19 = {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"};
235
235
  if(vErrors === null){
236
236
  vErrors = [err19];
237
237
  }
@@ -240,8 +240,10 @@ vErrors.push(err19);
240
240
  }
241
241
  errors++;
242
242
  }
243
- if(!((data8 === "user") || (data8 === "organization"))){
244
- const err20 = {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"};
243
+ }
244
+ if(data6.name !== undefined){
245
+ if(typeof data6.name !== "string"){
246
+ const err20 = {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"};
245
247
  if(vErrors === null){
246
248
  vErrors = [err20];
247
249
  }
@@ -251,9 +253,9 @@ vErrors.push(err20);
251
253
  errors++;
252
254
  }
253
255
  }
254
- if(data7.id !== undefined){
255
- if(typeof data7.id !== "string"){
256
- const err21 = {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"};
256
+ if(data6.role !== undefined){
257
+ if(typeof data6.role !== "string"){
258
+ const err21 = {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"};
257
259
  if(vErrors === null){
258
260
  vErrors = [err21];
259
261
  }
@@ -263,9 +265,9 @@ vErrors.push(err21);
263
265
  errors++;
264
266
  }
265
267
  }
266
- if(data7.name !== undefined){
267
- if(typeof data7.name !== "string"){
268
- const err22 = {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"};
268
+ if(data6.department !== undefined){
269
+ if(typeof data6.department !== "string"){
270
+ const err22 = {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"};
269
271
  if(vErrors === null){
270
272
  vErrors = [err22];
271
273
  }
@@ -275,9 +277,9 @@ vErrors.push(err22);
275
277
  errors++;
276
278
  }
277
279
  }
278
- if(data7.role !== undefined){
279
- if(typeof data7.role !== "string"){
280
- const err23 = {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"};
280
+ if(data6.departmentName !== undefined){
281
+ if(typeof data6.departmentName !== "string"){
282
+ const err23 = {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"};
281
283
  if(vErrors === null){
282
284
  vErrors = [err23];
283
285
  }
@@ -287,9 +289,9 @@ vErrors.push(err23);
287
289
  errors++;
288
290
  }
289
291
  }
290
- if(data7.department !== undefined){
291
- if(typeof data7.department !== "string"){
292
- const err24 = {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"};
292
+ }
293
+ else {
294
+ const err24 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/type",keyword:"type",params:{type: "object"},message:"must be object"};
293
295
  if(vErrors === null){
294
296
  vErrors = [err24];
295
297
  }
@@ -299,9 +301,11 @@ vErrors.push(err24);
299
301
  errors++;
300
302
  }
301
303
  }
302
- if(data7.departmentName !== undefined){
303
- if(typeof data7.departmentName !== "string"){
304
- const err25 = {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"};
304
+ if(data.topic !== undefined){
305
+ let data13 = data.topic;
306
+ if(data13 && typeof data13 == "object" && !Array.isArray(data13)){
307
+ if(data13.key === undefined){
308
+ const err25 = {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"+"'"};
305
309
  if(vErrors === null){
306
310
  vErrors = [err25];
307
311
  }
@@ -310,10 +314,9 @@ vErrors.push(err25);
310
314
  }
311
315
  errors++;
312
316
  }
313
- }
314
- }
315
- else {
316
- const err26 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/type",keyword:"type",params:{type: "object"},message:"must be object"};
317
+ for(const key2 in data13){
318
+ if(!((key2 === "key") || (key2 === "title"))){
319
+ const err26 = {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"};
317
320
  if(vErrors === null){
318
321
  vErrors = [err26];
319
322
  }
@@ -323,11 +326,9 @@ vErrors.push(err26);
323
326
  errors++;
324
327
  }
325
328
  }
326
- if(data.topic !== undefined){
327
- let data14 = data.topic;
328
- if(data14 && typeof data14 == "object" && !Array.isArray(data14)){
329
- if(data14.key === undefined){
330
- const err27 = {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"+"'"};
329
+ if(data13.key !== undefined){
330
+ if(typeof data13.key !== "string"){
331
+ const err27 = {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"};
331
332
  if(vErrors === null){
332
333
  vErrors = [err27];
333
334
  }
@@ -336,9 +337,10 @@ vErrors.push(err27);
336
337
  }
337
338
  errors++;
338
339
  }
339
- for(const key2 in data14){
340
- if(!((key2 === "key") || (key2 === "title"))){
341
- const err28 = {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"};
340
+ }
341
+ if(data13.title !== undefined){
342
+ if(typeof data13.title !== "string"){
343
+ const err28 = {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"};
342
344
  if(vErrors === null){
343
345
  vErrors = [err28];
344
346
  }
@@ -348,9 +350,9 @@ vErrors.push(err28);
348
350
  errors++;
349
351
  }
350
352
  }
351
- if(data14.key !== undefined){
352
- if(typeof data14.key !== "string"){
353
- const err29 = {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"};
353
+ }
354
+ else {
355
+ const err29 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
354
356
  if(vErrors === null){
355
357
  vErrors = [err29];
356
358
  }
@@ -360,9 +362,11 @@ vErrors.push(err29);
360
362
  errors++;
361
363
  }
362
364
  }
363
- if(data14.title !== undefined){
364
- if(typeof data14.title !== "string"){
365
- const err30 = {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"};
365
+ if(data.recipient !== undefined){
366
+ let data16 = data.recipient;
367
+ if(data16 && typeof data16 == "object" && !Array.isArray(data16)){
368
+ if(data16.id === undefined){
369
+ const err30 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
366
370
  if(vErrors === null){
367
371
  vErrors = [err30];
368
372
  }
@@ -371,10 +375,9 @@ vErrors.push(err30);
371
375
  }
372
376
  errors++;
373
377
  }
374
- }
375
- }
376
- else {
377
- const err31 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
378
+ if(data16.id !== undefined){
379
+ if(typeof data16.id !== "string"){
380
+ const err31 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
378
381
  if(vErrors === null){
379
382
  vErrors = [err31];
380
383
  }
@@ -384,11 +387,9 @@ vErrors.push(err31);
384
387
  errors++;
385
388
  }
386
389
  }
387
- if(data.recipient !== undefined){
388
- let data17 = data.recipient;
389
- if(data17 && typeof data17 == "object" && !Array.isArray(data17)){
390
- if(data17.id === undefined){
391
- const err32 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
390
+ if(data16.name !== undefined){
391
+ if(typeof data16.name !== "string"){
392
+ const err32 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
392
393
  if(vErrors === null){
393
394
  vErrors = [err32];
394
395
  }
@@ -397,89 +398,66 @@ vErrors.push(err32);
397
398
  }
398
399
  errors++;
399
400
  }
400
- if(data17.id !== undefined){
401
- if(typeof data17.id !== "string"){
402
- const err33 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
403
- if(vErrors === null){
404
- vErrors = [err33];
405
- }
406
- else {
407
- vErrors.push(err33);
408
- }
409
- errors++;
410
- }
411
- }
412
- if(data17.name !== undefined){
413
- if(typeof data17.name !== "string"){
414
- const err34 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
415
- if(vErrors === null){
416
- vErrors = [err34];
417
- }
418
- else {
419
- vErrors.push(err34);
420
- }
421
- errors++;
422
- }
423
401
  }
424
402
  }
425
403
  else {
426
- const err35 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
404
+ const err33 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
427
405
  if(vErrors === null){
428
- vErrors = [err35];
406
+ vErrors = [err33];
429
407
  }
430
408
  else {
431
- vErrors.push(err35);
409
+ vErrors.push(err33);
432
410
  }
433
411
  errors++;
434
412
  }
435
413
  }
436
414
  if(data.outputs !== undefined){
437
- let data20 = data.outputs;
438
- if(Array.isArray(data20)){
439
- const len0 = data20.length;
415
+ let data19 = data.outputs;
416
+ if(Array.isArray(data19)){
417
+ const len0 = data19.length;
440
418
  for(let i0=0; i0<len0; i0++){
441
- let data21 = data20[i0];
442
- if(typeof data21 !== "string"){
443
- const err36 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
419
+ let data20 = data19[i0];
420
+ if(typeof data20 !== "string"){
421
+ const err34 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
444
422
  if(vErrors === null){
445
- vErrors = [err36];
423
+ vErrors = [err34];
446
424
  }
447
425
  else {
448
- vErrors.push(err36);
426
+ vErrors.push(err34);
449
427
  }
450
428
  errors++;
451
429
  }
452
- const _errs50 = errors;
430
+ const _errs48 = errors;
453
431
  let valid8 = false;
454
432
  let passing0 = null;
455
- const _errs51 = errors;
456
- if("devices" !== data21){
457
- const err37 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/0/const",keyword:"const",params:{allowedValue: "devices"},message:"must be equal to constant"};
433
+ const _errs49 = errors;
434
+ if("devices" !== data20){
435
+ const err35 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/0/const",keyword:"const",params:{allowedValue: "devices"},message:"must be equal to constant"};
458
436
  if(vErrors === null){
459
- vErrors = [err37];
437
+ vErrors = [err35];
460
438
  }
461
439
  else {
462
- vErrors.push(err37);
440
+ vErrors.push(err35);
463
441
  }
464
442
  errors++;
465
443
  }
466
- var _valid0 = _errs51 === errors;
444
+ var _valid0 = _errs49 === errors;
467
445
  if(_valid0){
468
446
  valid8 = true;
469
447
  passing0 = 0;
470
448
  }
471
- const _errs52 = errors;
472
- if("email" !== data21){
473
- const err38 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/1/const",keyword:"const",params:{allowedValue: "email"},message:"must be equal to constant"};
449
+ const _errs50 = errors;
450
+ if("email" !== data20){
451
+ const err36 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/1/const",keyword:"const",params:{allowedValue: "email"},message:"must be equal to constant"};
474
452
  if(vErrors === null){
475
- vErrors = [err38];
453
+ vErrors = [err36];
476
454
  }
477
455
  else {
478
- vErrors.push(err38);
456
+ vErrors.push(err36);
479
457
  }
480
458
  errors++;
481
459
  }
482
- var _valid0 = _errs52 === errors;
460
+ var _valid0 = _errs50 === errors;
483
461
  if(_valid0 && valid8){
484
462
  valid8 = false;
485
463
  passing0 = [passing0, 1];
@@ -491,20 +469,20 @@ passing0 = 1;
491
469
  }
492
470
  }
493
471
  if(!valid8){
494
- const err39 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
472
+ const err37 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
495
473
  if(vErrors === null){
496
- vErrors = [err39];
474
+ vErrors = [err37];
497
475
  }
498
476
  else {
499
- vErrors.push(err39);
477
+ vErrors.push(err37);
500
478
  }
501
479
  errors++;
502
480
  }
503
481
  else {
504
- errors = _errs50;
482
+ errors = _errs48;
505
483
  if(vErrors !== null){
506
- if(_errs50){
507
- vErrors.length = _errs50;
484
+ if(_errs48){
485
+ vErrors.length = _errs48;
508
486
  }
509
487
  else {
510
488
  vErrors = null;
@@ -514,86 +492,86 @@ vErrors = null;
514
492
  }
515
493
  }
516
494
  else {
517
- const err40 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
495
+ const err38 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
518
496
  if(vErrors === null){
519
- vErrors = [err40];
497
+ vErrors = [err38];
520
498
  }
521
499
  else {
522
- vErrors.push(err40);
500
+ vErrors.push(err38);
523
501
  }
524
502
  errors++;
525
503
  }
526
504
  }
527
505
  if(data.url !== undefined){
528
506
  if(typeof data.url !== "string"){
529
- const err41 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
507
+ const err39 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
530
508
  if(vErrors === null){
531
- vErrors = [err41];
509
+ vErrors = [err39];
532
510
  }
533
511
  else {
534
- vErrors.push(err41);
512
+ vErrors.push(err39);
535
513
  }
536
514
  errors++;
537
515
  }
538
516
  }
539
517
  if(data.date !== undefined){
540
- let data23 = data.date;
541
- if(typeof data23 === "string"){
542
- if(!(formats0.validate(data23))){
543
- const err42 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
518
+ let data22 = data.date;
519
+ if(typeof data22 === "string"){
520
+ if(!(formats0.validate(data22))){
521
+ const err40 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
544
522
  if(vErrors === null){
545
- vErrors = [err42];
523
+ vErrors = [err40];
546
524
  }
547
525
  else {
548
- vErrors.push(err42);
526
+ vErrors.push(err40);
549
527
  }
550
528
  errors++;
551
529
  }
552
530
  }
553
531
  else {
554
- const err43 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
532
+ const err41 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
555
533
  if(vErrors === null){
556
- vErrors = [err43];
534
+ vErrors = [err41];
557
535
  }
558
536
  else {
559
- vErrors.push(err43);
537
+ vErrors.push(err41);
560
538
  }
561
539
  errors++;
562
540
  }
563
541
  }
564
542
  if(data.new !== undefined){
565
543
  if(typeof data.new !== "boolean"){
566
- const err44 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
544
+ const err42 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
567
545
  if(vErrors === null){
568
- vErrors = [err44];
546
+ vErrors = [err42];
569
547
  }
570
548
  else {
571
- vErrors.push(err44);
549
+ vErrors.push(err42);
572
550
  }
573
551
  errors++;
574
552
  }
575
553
  }
576
554
  if(data.extra !== undefined){
577
- let data25 = data.extra;
578
- if(!(data25 && typeof data25 == "object" && !Array.isArray(data25))){
579
- const err45 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
555
+ let data24 = data.extra;
556
+ if(!(data24 && typeof data24 == "object" && !Array.isArray(data24))){
557
+ const err43 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
580
558
  if(vErrors === null){
581
- vErrors = [err45];
559
+ vErrors = [err43];
582
560
  }
583
561
  else {
584
- vErrors.push(err45);
562
+ vErrors.push(err43);
585
563
  }
586
564
  errors++;
587
565
  }
588
566
  }
589
567
  }
590
568
  else {
591
- const err46 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
569
+ const err44 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
592
570
  if(vErrors === null){
593
- vErrors = [err46];
571
+ vErrors = [err44];
594
572
  }
595
573
  else {
596
- vErrors.push(err46);
574
+ vErrors.push(err44);
597
575
  }
598
576
  errors++;
599
577
  }