@data-fair/lib-common-types 1.19.4 → 1.19.5
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/.type/index.d.ts +2 -0
- package/event/schema.d.ts +4 -0
- package/event/schema.js +4 -0
- package/notification/.type/index.d.ts +2 -0
- package/notification/.type/validate.js +157 -145
- package/notification/schema.d.ts +4 -0
- package/notification/schema.js +4 -0
- package/package.json +1 -1
package/event/.type/index.d.ts
CHANGED
|
@@ -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
package/event/schema.js
CHANGED
|
@@ -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 GloballyUniqueIdOfTheEventSourceOfThisNotification = string;
|
|
5
6
|
export type SiteDOrigineDeLaSouscription = string;
|
|
6
7
|
export type Titre = string;
|
|
7
8
|
export type Contenu = string;
|
|
@@ -17,6 +18,7 @@ export type Sorties = ((RecevoirLaNotificationSurVosAppareilsConfigures | Recevo
|
|
|
17
18
|
export type CalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams = string;
|
|
18
19
|
|
|
19
20
|
export type Notification = {
|
|
21
|
+
eventId?: GloballyUniqueIdOfTheEventSourceOfThisNotification;
|
|
20
22
|
origin?: SiteDOrigineDeLaSouscription;
|
|
21
23
|
title: Titre;
|
|
22
24
|
body?: Contenu;
|
|
@@ -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":{"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":"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"],"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.
|
|
82
|
-
if(typeof data.
|
|
83
|
-
const err6 = {instancePath:instancePath+"/
|
|
81
|
+
if(data.eventId !== undefined){
|
|
82
|
+
if(typeof data.eventId !== "string"){
|
|
83
|
+
const err6 = {instancePath:instancePath+"/eventId",schemaPath:"#/properties/eventId/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.
|
|
94
|
-
if(typeof data.
|
|
95
|
-
const err7 = {instancePath:instancePath+"/
|
|
93
|
+
if(data.origin !== undefined){
|
|
94
|
+
if(typeof data.origin !== "string"){
|
|
95
|
+
const err7 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/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.
|
|
106
|
-
if(typeof data.
|
|
107
|
-
const err8 = {instancePath:instancePath+"/
|
|
105
|
+
if(data.title !== undefined){
|
|
106
|
+
if(typeof data.title !== "string"){
|
|
107
|
+
const err8 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/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.
|
|
118
|
-
if(typeof data.
|
|
119
|
-
const err9 = {instancePath:instancePath+"/
|
|
117
|
+
if(data.body !== undefined){
|
|
118
|
+
if(typeof data.body !== "string"){
|
|
119
|
+
const err9 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/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.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const err10 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
129
|
+
if(data.htmlBody !== undefined){
|
|
130
|
+
if(typeof data.htmlBody !== "string"){
|
|
131
|
+
const err10 = {instancePath:instancePath+"/htmlBody",schemaPath:"#/properties/htmlBody/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
133
132
|
if(vErrors === null){
|
|
134
133
|
vErrors = [err10];
|
|
135
134
|
}
|
|
@@ -138,8 +137,11 @@ vErrors.push(err10);
|
|
|
138
137
|
}
|
|
139
138
|
errors++;
|
|
140
139
|
}
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
}
|
|
141
|
+
if(data.locale !== undefined){
|
|
142
|
+
let data5 = data.locale;
|
|
143
|
+
if(typeof data5 !== "string"){
|
|
144
|
+
const err11 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
143
145
|
if(vErrors === null){
|
|
144
146
|
vErrors = [err11];
|
|
145
147
|
}
|
|
@@ -148,10 +150,8 @@ vErrors.push(err11);
|
|
|
148
150
|
}
|
|
149
151
|
errors++;
|
|
150
152
|
}
|
|
151
|
-
|
|
152
|
-
|
|
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(!((data5 === "fr") || (data5 === "en"))){
|
|
154
|
+
const err12 = {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"};
|
|
155
155
|
if(vErrors === null){
|
|
156
156
|
vErrors = [err12];
|
|
157
157
|
}
|
|
@@ -161,11 +161,9 @@ vErrors.push(err12);
|
|
|
161
161
|
errors++;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
if(data.
|
|
165
|
-
|
|
166
|
-
|
|
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"+"'"};
|
|
164
|
+
if(data.icon !== undefined){
|
|
165
|
+
if(typeof data.icon !== "string"){
|
|
166
|
+
const err13 = {instancePath:instancePath+"/icon",schemaPath:"#/properties/icon/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
169
167
|
if(vErrors === null){
|
|
170
168
|
vErrors = [err13];
|
|
171
169
|
}
|
|
@@ -174,8 +172,12 @@ vErrors.push(err13);
|
|
|
174
172
|
}
|
|
175
173
|
errors++;
|
|
176
174
|
}
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
}
|
|
176
|
+
if(data.sender !== undefined){
|
|
177
|
+
let data7 = data.sender;
|
|
178
|
+
if(data7 && typeof data7 == "object" && !Array.isArray(data7)){
|
|
179
|
+
if(data7.type === undefined){
|
|
180
|
+
const err14 = {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"+"'"};
|
|
179
181
|
if(vErrors === null){
|
|
180
182
|
vErrors = [err14];
|
|
181
183
|
}
|
|
@@ -184,9 +186,8 @@ vErrors.push(err14);
|
|
|
184
186
|
}
|
|
185
187
|
errors++;
|
|
186
188
|
}
|
|
187
|
-
|
|
188
|
-
|
|
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"};
|
|
189
|
+
if(data7.id === undefined){
|
|
190
|
+
const err15 = {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"+"'"};
|
|
190
191
|
if(vErrors === null){
|
|
191
192
|
vErrors = [err15];
|
|
192
193
|
}
|
|
@@ -195,11 +196,9 @@ vErrors.push(err15);
|
|
|
195
196
|
}
|
|
196
197
|
errors++;
|
|
197
198
|
}
|
|
198
|
-
|
|
199
|
-
if(
|
|
200
|
-
|
|
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"};
|
|
199
|
+
for(const key1 in data7){
|
|
200
|
+
if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
|
|
201
|
+
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"};
|
|
203
202
|
if(vErrors === null){
|
|
204
203
|
vErrors = [err16];
|
|
205
204
|
}
|
|
@@ -208,8 +207,11 @@ vErrors.push(err16);
|
|
|
208
207
|
}
|
|
209
208
|
errors++;
|
|
210
209
|
}
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
}
|
|
211
|
+
if(data7.type !== undefined){
|
|
212
|
+
let data8 = data7.type;
|
|
213
|
+
if(typeof data8 !== "string"){
|
|
214
|
+
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"};
|
|
213
215
|
if(vErrors === null){
|
|
214
216
|
vErrors = [err17];
|
|
215
217
|
}
|
|
@@ -218,10 +220,8 @@ vErrors.push(err17);
|
|
|
218
220
|
}
|
|
219
221
|
errors++;
|
|
220
222
|
}
|
|
221
|
-
|
|
222
|
-
|
|
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 === "user") || (data8 === "organization"))){
|
|
224
|
+
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"};
|
|
225
225
|
if(vErrors === null){
|
|
226
226
|
vErrors = [err18];
|
|
227
227
|
}
|
|
@@ -231,9 +231,9 @@ vErrors.push(err18);
|
|
|
231
231
|
errors++;
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
if(
|
|
235
|
-
if(typeof
|
|
236
|
-
const err19 = {instancePath:instancePath+"/sender/
|
|
234
|
+
if(data7.id !== undefined){
|
|
235
|
+
if(typeof data7.id !== "string"){
|
|
236
|
+
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"};
|
|
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(
|
|
247
|
-
if(typeof
|
|
248
|
-
const err20 = {instancePath:instancePath+"/sender/
|
|
246
|
+
if(data7.name !== undefined){
|
|
247
|
+
if(typeof data7.name !== "string"){
|
|
248
|
+
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"};
|
|
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(
|
|
259
|
-
if(typeof
|
|
260
|
-
const err21 = {instancePath:instancePath+"/sender/
|
|
258
|
+
if(data7.role !== undefined){
|
|
259
|
+
if(typeof data7.role !== "string"){
|
|
260
|
+
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"};
|
|
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(
|
|
271
|
-
if(typeof
|
|
272
|
-
const err22 = {instancePath:instancePath+"/sender/
|
|
270
|
+
if(data7.department !== undefined){
|
|
271
|
+
if(typeof data7.department !== "string"){
|
|
272
|
+
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"};
|
|
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
|
-
|
|
284
|
-
const err23 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/type",keyword:"type",params:{type: "
|
|
282
|
+
if(data7.departmentName !== undefined){
|
|
283
|
+
if(typeof data7.departmentName !== "string"){
|
|
284
|
+
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"};
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
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"};
|
|
299
297
|
if(vErrors === null){
|
|
300
298
|
vErrors = [err24];
|
|
301
299
|
}
|
|
@@ -304,9 +302,12 @@ vErrors.push(err24);
|
|
|
304
302
|
}
|
|
305
303
|
errors++;
|
|
306
304
|
}
|
|
307
|
-
|
|
308
|
-
if(
|
|
309
|
-
|
|
305
|
+
}
|
|
306
|
+
if(data.topic !== undefined){
|
|
307
|
+
let data14 = data.topic;
|
|
308
|
+
if(data14 && typeof data14 == "object" && !Array.isArray(data14)){
|
|
309
|
+
if(data14.key === undefined){
|
|
310
|
+
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"+"'"};
|
|
310
311
|
if(vErrors === null){
|
|
311
312
|
vErrors = [err25];
|
|
312
313
|
}
|
|
@@ -315,10 +316,9 @@ vErrors.push(err25);
|
|
|
315
316
|
}
|
|
316
317
|
errors++;
|
|
317
318
|
}
|
|
318
|
-
|
|
319
|
-
if(
|
|
320
|
-
|
|
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"};
|
|
319
|
+
for(const key2 in data14){
|
|
320
|
+
if(!((key2 === "key") || (key2 === "title"))){
|
|
321
|
+
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"};
|
|
322
322
|
if(vErrors === null){
|
|
323
323
|
vErrors = [err26];
|
|
324
324
|
}
|
|
@@ -328,9 +328,9 @@ vErrors.push(err26);
|
|
|
328
328
|
errors++;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
if(
|
|
332
|
-
if(typeof
|
|
333
|
-
const err27 = {instancePath:instancePath+"/topic/
|
|
331
|
+
if(data14.key !== undefined){
|
|
332
|
+
if(typeof data14.key !== "string"){
|
|
333
|
+
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"};
|
|
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
|
-
|
|
345
|
-
const err28 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/type",keyword:"type",params:{type: "
|
|
343
|
+
if(data14.title !== undefined){
|
|
344
|
+
if(typeof data14.title !== "string"){
|
|
345
|
+
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"};
|
|
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
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
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"};
|
|
360
358
|
if(vErrors === null){
|
|
361
359
|
vErrors = [err29];
|
|
362
360
|
}
|
|
@@ -365,9 +363,12 @@ vErrors.push(err29);
|
|
|
365
363
|
}
|
|
366
364
|
errors++;
|
|
367
365
|
}
|
|
368
|
-
|
|
369
|
-
if(
|
|
370
|
-
|
|
366
|
+
}
|
|
367
|
+
if(data.recipient !== undefined){
|
|
368
|
+
let data17 = data.recipient;
|
|
369
|
+
if(data17 && typeof data17 == "object" && !Array.isArray(data17)){
|
|
370
|
+
if(data17.id === undefined){
|
|
371
|
+
const err30 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
371
372
|
if(vErrors === null){
|
|
372
373
|
vErrors = [err30];
|
|
373
374
|
}
|
|
@@ -376,10 +377,9 @@ vErrors.push(err30);
|
|
|
376
377
|
}
|
|
377
378
|
errors++;
|
|
378
379
|
}
|
|
379
|
-
|
|
380
|
-
if(
|
|
381
|
-
|
|
382
|
-
const err31 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
380
|
+
if(data17.id !== undefined){
|
|
381
|
+
if(typeof data17.id !== "string"){
|
|
382
|
+
const err31 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
383
383
|
if(vErrors === null){
|
|
384
384
|
vErrors = [err31];
|
|
385
385
|
}
|
|
@@ -389,9 +389,9 @@ vErrors.push(err31);
|
|
|
389
389
|
errors++;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const err32 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "
|
|
392
|
+
if(data17.name !== undefined){
|
|
393
|
+
if(typeof data17.name !== "string"){
|
|
394
|
+
const err32 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
395
395
|
if(vErrors === null){
|
|
396
396
|
vErrors = [err32];
|
|
397
397
|
}
|
|
@@ -401,14 +401,9 @@ vErrors.push(err32);
|
|
|
401
401
|
errors++;
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const len0 = data19.length;
|
|
408
|
-
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"};
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
const err33 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
412
407
|
if(vErrors === null){
|
|
413
408
|
vErrors = [err33];
|
|
414
409
|
}
|
|
@@ -417,12 +412,15 @@ vErrors.push(err33);
|
|
|
417
412
|
}
|
|
418
413
|
errors++;
|
|
419
414
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
let
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
415
|
+
}
|
|
416
|
+
if(data.outputs !== undefined){
|
|
417
|
+
let data20 = data.outputs;
|
|
418
|
+
if(Array.isArray(data20)){
|
|
419
|
+
const len0 = data20.length;
|
|
420
|
+
for(let i0=0; i0<len0; i0++){
|
|
421
|
+
let data21 = data20[i0];
|
|
422
|
+
if(typeof data21 !== "string"){
|
|
423
|
+
const err34 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
426
424
|
if(vErrors === null){
|
|
427
425
|
vErrors = [err34];
|
|
428
426
|
}
|
|
@@ -431,23 +429,37 @@ vErrors.push(err34);
|
|
|
431
429
|
}
|
|
432
430
|
errors++;
|
|
433
431
|
}
|
|
434
|
-
|
|
432
|
+
const _errs50 = errors;
|
|
433
|
+
let valid8 = false;
|
|
434
|
+
let passing0 = null;
|
|
435
|
+
const _errs51 = errors;
|
|
436
|
+
if("devices" !== data21){
|
|
437
|
+
const err35 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/0/const",keyword:"const",params:{allowedValue: "devices"},message:"must be equal to constant"};
|
|
438
|
+
if(vErrors === null){
|
|
439
|
+
vErrors = [err35];
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
vErrors.push(err35);
|
|
443
|
+
}
|
|
444
|
+
errors++;
|
|
445
|
+
}
|
|
446
|
+
var _valid0 = _errs51 === errors;
|
|
435
447
|
if(_valid0){
|
|
436
448
|
valid8 = true;
|
|
437
449
|
passing0 = 0;
|
|
438
450
|
}
|
|
439
|
-
const
|
|
440
|
-
if("email" !==
|
|
441
|
-
const
|
|
451
|
+
const _errs52 = errors;
|
|
452
|
+
if("email" !== data21){
|
|
453
|
+
const err36 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/1/const",keyword:"const",params:{allowedValue: "email"},message:"must be equal to constant"};
|
|
442
454
|
if(vErrors === null){
|
|
443
|
-
vErrors = [
|
|
455
|
+
vErrors = [err36];
|
|
444
456
|
}
|
|
445
457
|
else {
|
|
446
|
-
vErrors.push(
|
|
458
|
+
vErrors.push(err36);
|
|
447
459
|
}
|
|
448
460
|
errors++;
|
|
449
461
|
}
|
|
450
|
-
var _valid0 =
|
|
462
|
+
var _valid0 = _errs52 === errors;
|
|
451
463
|
if(_valid0 && valid8){
|
|
452
464
|
valid8 = false;
|
|
453
465
|
passing0 = [passing0, 1];
|
|
@@ -459,20 +471,20 @@ passing0 = 1;
|
|
|
459
471
|
}
|
|
460
472
|
}
|
|
461
473
|
if(!valid8){
|
|
462
|
-
const
|
|
474
|
+
const err37 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
|
|
463
475
|
if(vErrors === null){
|
|
464
|
-
vErrors = [
|
|
476
|
+
vErrors = [err37];
|
|
465
477
|
}
|
|
466
478
|
else {
|
|
467
|
-
vErrors.push(
|
|
479
|
+
vErrors.push(err37);
|
|
468
480
|
}
|
|
469
481
|
errors++;
|
|
470
482
|
}
|
|
471
483
|
else {
|
|
472
|
-
errors =
|
|
484
|
+
errors = _errs50;
|
|
473
485
|
if(vErrors !== null){
|
|
474
|
-
if(
|
|
475
|
-
vErrors.length =
|
|
486
|
+
if(_errs50){
|
|
487
|
+
vErrors.length = _errs50;
|
|
476
488
|
}
|
|
477
489
|
else {
|
|
478
490
|
vErrors = null;
|
|
@@ -482,86 +494,86 @@ vErrors = null;
|
|
|
482
494
|
}
|
|
483
495
|
}
|
|
484
496
|
else {
|
|
485
|
-
const
|
|
497
|
+
const err38 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
|
|
486
498
|
if(vErrors === null){
|
|
487
|
-
vErrors = [
|
|
499
|
+
vErrors = [err38];
|
|
488
500
|
}
|
|
489
501
|
else {
|
|
490
|
-
vErrors.push(
|
|
502
|
+
vErrors.push(err38);
|
|
491
503
|
}
|
|
492
504
|
errors++;
|
|
493
505
|
}
|
|
494
506
|
}
|
|
495
507
|
if(data.url !== undefined){
|
|
496
508
|
if(typeof data.url !== "string"){
|
|
497
|
-
const
|
|
509
|
+
const err39 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
498
510
|
if(vErrors === null){
|
|
499
|
-
vErrors = [
|
|
511
|
+
vErrors = [err39];
|
|
500
512
|
}
|
|
501
513
|
else {
|
|
502
|
-
vErrors.push(
|
|
514
|
+
vErrors.push(err39);
|
|
503
515
|
}
|
|
504
516
|
errors++;
|
|
505
517
|
}
|
|
506
518
|
}
|
|
507
519
|
if(data.date !== undefined){
|
|
508
|
-
let
|
|
509
|
-
if(typeof
|
|
510
|
-
if(!(formats0.validate(
|
|
511
|
-
const
|
|
520
|
+
let data23 = data.date;
|
|
521
|
+
if(typeof data23 === "string"){
|
|
522
|
+
if(!(formats0.validate(data23))){
|
|
523
|
+
const err40 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
|
|
512
524
|
if(vErrors === null){
|
|
513
|
-
vErrors = [
|
|
525
|
+
vErrors = [err40];
|
|
514
526
|
}
|
|
515
527
|
else {
|
|
516
|
-
vErrors.push(
|
|
528
|
+
vErrors.push(err40);
|
|
517
529
|
}
|
|
518
530
|
errors++;
|
|
519
531
|
}
|
|
520
532
|
}
|
|
521
533
|
else {
|
|
522
|
-
const
|
|
534
|
+
const err41 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
523
535
|
if(vErrors === null){
|
|
524
|
-
vErrors = [
|
|
536
|
+
vErrors = [err41];
|
|
525
537
|
}
|
|
526
538
|
else {
|
|
527
|
-
vErrors.push(
|
|
539
|
+
vErrors.push(err41);
|
|
528
540
|
}
|
|
529
541
|
errors++;
|
|
530
542
|
}
|
|
531
543
|
}
|
|
532
544
|
if(data.new !== undefined){
|
|
533
545
|
if(typeof data.new !== "boolean"){
|
|
534
|
-
const
|
|
546
|
+
const err42 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
535
547
|
if(vErrors === null){
|
|
536
|
-
vErrors = [
|
|
548
|
+
vErrors = [err42];
|
|
537
549
|
}
|
|
538
550
|
else {
|
|
539
|
-
vErrors.push(
|
|
551
|
+
vErrors.push(err42);
|
|
540
552
|
}
|
|
541
553
|
errors++;
|
|
542
554
|
}
|
|
543
555
|
}
|
|
544
556
|
if(data.extra !== undefined){
|
|
545
|
-
let
|
|
546
|
-
if(!(
|
|
547
|
-
const
|
|
557
|
+
let data25 = data.extra;
|
|
558
|
+
if(!(data25 && typeof data25 == "object" && !Array.isArray(data25))){
|
|
559
|
+
const err43 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
548
560
|
if(vErrors === null){
|
|
549
|
-
vErrors = [
|
|
561
|
+
vErrors = [err43];
|
|
550
562
|
}
|
|
551
563
|
else {
|
|
552
|
-
vErrors.push(
|
|
564
|
+
vErrors.push(err43);
|
|
553
565
|
}
|
|
554
566
|
errors++;
|
|
555
567
|
}
|
|
556
568
|
}
|
|
557
569
|
}
|
|
558
570
|
else {
|
|
559
|
-
const
|
|
571
|
+
const err44 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
560
572
|
if(vErrors === null){
|
|
561
|
-
vErrors = [
|
|
573
|
+
vErrors = [err44];
|
|
562
574
|
}
|
|
563
575
|
else {
|
|
564
|
-
vErrors.push(
|
|
576
|
+
vErrors.push(err44);
|
|
565
577
|
}
|
|
566
578
|
errors++;
|
|
567
579
|
}
|
package/notification/schema.d.ts
CHANGED
package/notification/schema.js
CHANGED
|
@@ -6,6 +6,10 @@ export default {
|
|
|
6
6
|
additionalProperties: false,
|
|
7
7
|
required: ['title', 'topic', 'sender', 'recipient', 'date'],
|
|
8
8
|
properties: {
|
|
9
|
+
eventId: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
title: 'Globally unique id of the event source of this notification'
|
|
12
|
+
},
|
|
9
13
|
origin: {
|
|
10
14
|
type: 'string',
|
|
11
15
|
title: 'Site d\'origine de la souscription',
|