@data-fair/lib-common-types 1.5.2 → 1.5.4
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 +1 -1
- package/event/schema.js +1 -1
- package/notification/.type/index.d.ts +1 -1
- package/notification/.type/validate.js +88 -98
- package/package.json +1 -1
- package/session/index.js +2 -1
package/event/.type/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export type Emitter = {
|
|
|
63
63
|
/**
|
|
64
64
|
* The display name of the user or organization
|
|
65
65
|
*/
|
|
66
|
-
name
|
|
66
|
+
name?: string;
|
|
67
67
|
/**
|
|
68
68
|
* If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
|
|
69
69
|
*/
|
package/event/schema.js
CHANGED
|
@@ -59,7 +59,7 @@ export type Emitter = {
|
|
|
59
59
|
/**
|
|
60
60
|
* The display name of the user or organization
|
|
61
61
|
*/
|
|
62
|
-
name
|
|
62
|
+
name?: string;
|
|
63
63
|
/**
|
|
64
64
|
* If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
|
|
65
65
|
*/
|
|
@@ -6,7 +6,7 @@ import { fullFormats } from "ajv-formats/dist/formats.js";
|
|
|
6
6
|
export const validate = validate14;
|
|
7
7
|
export default validate14;
|
|
8
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
|
-
const schema18 = {"type":"object","title":"Emitter","additionalProperties":false,"required":["type","id"
|
|
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;
|
|
12
12
|
const formats0 = fullFormats["date-time"];
|
|
@@ -184,24 +184,14 @@ vErrors.push(err14);
|
|
|
184
184
|
}
|
|
185
185
|
errors++;
|
|
186
186
|
}
|
|
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"+"'"};
|
|
189
|
-
if(vErrors === null){
|
|
190
|
-
vErrors = [err15];
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
vErrors.push(err15);
|
|
194
|
-
}
|
|
195
|
-
errors++;
|
|
196
|
-
}
|
|
197
187
|
for(const key1 in data6){
|
|
198
188
|
if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
|
|
199
|
-
const
|
|
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"};
|
|
200
190
|
if(vErrors === null){
|
|
201
|
-
vErrors = [
|
|
191
|
+
vErrors = [err15];
|
|
202
192
|
}
|
|
203
193
|
else {
|
|
204
|
-
vErrors.push(
|
|
194
|
+
vErrors.push(err15);
|
|
205
195
|
}
|
|
206
196
|
errors++;
|
|
207
197
|
}
|
|
@@ -209,94 +199,94 @@ errors++;
|
|
|
209
199
|
if(data6.type !== undefined){
|
|
210
200
|
let data7 = data6.type;
|
|
211
201
|
if(typeof data7 !== "string"){
|
|
212
|
-
const
|
|
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"};
|
|
213
203
|
if(vErrors === null){
|
|
214
|
-
vErrors = [
|
|
204
|
+
vErrors = [err16];
|
|
215
205
|
}
|
|
216
206
|
else {
|
|
217
|
-
vErrors.push(
|
|
207
|
+
vErrors.push(err16);
|
|
218
208
|
}
|
|
219
209
|
errors++;
|
|
220
210
|
}
|
|
221
211
|
if(!((data7 === "user") || (data7 === "organization"))){
|
|
222
|
-
const
|
|
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"};
|
|
223
213
|
if(vErrors === null){
|
|
224
|
-
vErrors = [
|
|
214
|
+
vErrors = [err17];
|
|
225
215
|
}
|
|
226
216
|
else {
|
|
227
|
-
vErrors.push(
|
|
217
|
+
vErrors.push(err17);
|
|
228
218
|
}
|
|
229
219
|
errors++;
|
|
230
220
|
}
|
|
231
221
|
}
|
|
232
222
|
if(data6.id !== undefined){
|
|
233
223
|
if(typeof data6.id !== "string"){
|
|
234
|
-
const
|
|
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"};
|
|
235
225
|
if(vErrors === null){
|
|
236
|
-
vErrors = [
|
|
226
|
+
vErrors = [err18];
|
|
237
227
|
}
|
|
238
228
|
else {
|
|
239
|
-
vErrors.push(
|
|
229
|
+
vErrors.push(err18);
|
|
240
230
|
}
|
|
241
231
|
errors++;
|
|
242
232
|
}
|
|
243
233
|
}
|
|
244
234
|
if(data6.name !== undefined){
|
|
245
235
|
if(typeof data6.name !== "string"){
|
|
246
|
-
const
|
|
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"};
|
|
247
237
|
if(vErrors === null){
|
|
248
|
-
vErrors = [
|
|
238
|
+
vErrors = [err19];
|
|
249
239
|
}
|
|
250
240
|
else {
|
|
251
|
-
vErrors.push(
|
|
241
|
+
vErrors.push(err19);
|
|
252
242
|
}
|
|
253
243
|
errors++;
|
|
254
244
|
}
|
|
255
245
|
}
|
|
256
246
|
if(data6.role !== undefined){
|
|
257
247
|
if(typeof data6.role !== "string"){
|
|
258
|
-
const
|
|
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"};
|
|
259
249
|
if(vErrors === null){
|
|
260
|
-
vErrors = [
|
|
250
|
+
vErrors = [err20];
|
|
261
251
|
}
|
|
262
252
|
else {
|
|
263
|
-
vErrors.push(
|
|
253
|
+
vErrors.push(err20);
|
|
264
254
|
}
|
|
265
255
|
errors++;
|
|
266
256
|
}
|
|
267
257
|
}
|
|
268
258
|
if(data6.department !== undefined){
|
|
269
259
|
if(typeof data6.department !== "string"){
|
|
270
|
-
const
|
|
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"};
|
|
271
261
|
if(vErrors === null){
|
|
272
|
-
vErrors = [
|
|
262
|
+
vErrors = [err21];
|
|
273
263
|
}
|
|
274
264
|
else {
|
|
275
|
-
vErrors.push(
|
|
265
|
+
vErrors.push(err21);
|
|
276
266
|
}
|
|
277
267
|
errors++;
|
|
278
268
|
}
|
|
279
269
|
}
|
|
280
270
|
if(data6.departmentName !== undefined){
|
|
281
271
|
if(typeof data6.departmentName !== "string"){
|
|
282
|
-
const
|
|
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"};
|
|
283
273
|
if(vErrors === null){
|
|
284
|
-
vErrors = [
|
|
274
|
+
vErrors = [err22];
|
|
285
275
|
}
|
|
286
276
|
else {
|
|
287
|
-
vErrors.push(
|
|
277
|
+
vErrors.push(err22);
|
|
288
278
|
}
|
|
289
279
|
errors++;
|
|
290
280
|
}
|
|
291
281
|
}
|
|
292
282
|
}
|
|
293
283
|
else {
|
|
294
|
-
const
|
|
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"};
|
|
295
285
|
if(vErrors === null){
|
|
296
|
-
vErrors = [
|
|
286
|
+
vErrors = [err23];
|
|
297
287
|
}
|
|
298
288
|
else {
|
|
299
|
-
vErrors.push(
|
|
289
|
+
vErrors.push(err23);
|
|
300
290
|
}
|
|
301
291
|
errors++;
|
|
302
292
|
}
|
|
@@ -305,59 +295,59 @@ if(data.topic !== undefined){
|
|
|
305
295
|
let data13 = data.topic;
|
|
306
296
|
if(data13 && typeof data13 == "object" && !Array.isArray(data13)){
|
|
307
297
|
if(data13.key === undefined){
|
|
308
|
-
const
|
|
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"+"'"};
|
|
309
299
|
if(vErrors === null){
|
|
310
|
-
vErrors = [
|
|
300
|
+
vErrors = [err24];
|
|
311
301
|
}
|
|
312
302
|
else {
|
|
313
|
-
vErrors.push(
|
|
303
|
+
vErrors.push(err24);
|
|
314
304
|
}
|
|
315
305
|
errors++;
|
|
316
306
|
}
|
|
317
307
|
for(const key2 in data13){
|
|
318
308
|
if(!((key2 === "key") || (key2 === "title"))){
|
|
319
|
-
const
|
|
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"};
|
|
320
310
|
if(vErrors === null){
|
|
321
|
-
vErrors = [
|
|
311
|
+
vErrors = [err25];
|
|
322
312
|
}
|
|
323
313
|
else {
|
|
324
|
-
vErrors.push(
|
|
314
|
+
vErrors.push(err25);
|
|
325
315
|
}
|
|
326
316
|
errors++;
|
|
327
317
|
}
|
|
328
318
|
}
|
|
329
319
|
if(data13.key !== undefined){
|
|
330
320
|
if(typeof data13.key !== "string"){
|
|
331
|
-
const
|
|
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"};
|
|
332
322
|
if(vErrors === null){
|
|
333
|
-
vErrors = [
|
|
323
|
+
vErrors = [err26];
|
|
334
324
|
}
|
|
335
325
|
else {
|
|
336
|
-
vErrors.push(
|
|
326
|
+
vErrors.push(err26);
|
|
337
327
|
}
|
|
338
328
|
errors++;
|
|
339
329
|
}
|
|
340
330
|
}
|
|
341
331
|
if(data13.title !== undefined){
|
|
342
332
|
if(typeof data13.title !== "string"){
|
|
343
|
-
const
|
|
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"};
|
|
344
334
|
if(vErrors === null){
|
|
345
|
-
vErrors = [
|
|
335
|
+
vErrors = [err27];
|
|
346
336
|
}
|
|
347
337
|
else {
|
|
348
|
-
vErrors.push(
|
|
338
|
+
vErrors.push(err27);
|
|
349
339
|
}
|
|
350
340
|
errors++;
|
|
351
341
|
}
|
|
352
342
|
}
|
|
353
343
|
}
|
|
354
344
|
else {
|
|
355
|
-
const
|
|
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"};
|
|
356
346
|
if(vErrors === null){
|
|
357
|
-
vErrors = [
|
|
347
|
+
vErrors = [err28];
|
|
358
348
|
}
|
|
359
349
|
else {
|
|
360
|
-
vErrors.push(
|
|
350
|
+
vErrors.push(err28);
|
|
361
351
|
}
|
|
362
352
|
errors++;
|
|
363
353
|
}
|
|
@@ -366,47 +356,47 @@ if(data.recipient !== undefined){
|
|
|
366
356
|
let data16 = data.recipient;
|
|
367
357
|
if(data16 && typeof data16 == "object" && !Array.isArray(data16)){
|
|
368
358
|
if(data16.id === undefined){
|
|
369
|
-
const
|
|
359
|
+
const err29 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
370
360
|
if(vErrors === null){
|
|
371
|
-
vErrors = [
|
|
361
|
+
vErrors = [err29];
|
|
372
362
|
}
|
|
373
363
|
else {
|
|
374
|
-
vErrors.push(
|
|
364
|
+
vErrors.push(err29);
|
|
375
365
|
}
|
|
376
366
|
errors++;
|
|
377
367
|
}
|
|
378
368
|
if(data16.id !== undefined){
|
|
379
369
|
if(typeof data16.id !== "string"){
|
|
380
|
-
const
|
|
370
|
+
const err30 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
381
371
|
if(vErrors === null){
|
|
382
|
-
vErrors = [
|
|
372
|
+
vErrors = [err30];
|
|
383
373
|
}
|
|
384
374
|
else {
|
|
385
|
-
vErrors.push(
|
|
375
|
+
vErrors.push(err30);
|
|
386
376
|
}
|
|
387
377
|
errors++;
|
|
388
378
|
}
|
|
389
379
|
}
|
|
390
380
|
if(data16.name !== undefined){
|
|
391
381
|
if(typeof data16.name !== "string"){
|
|
392
|
-
const
|
|
382
|
+
const err31 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
393
383
|
if(vErrors === null){
|
|
394
|
-
vErrors = [
|
|
384
|
+
vErrors = [err31];
|
|
395
385
|
}
|
|
396
386
|
else {
|
|
397
|
-
vErrors.push(
|
|
387
|
+
vErrors.push(err31);
|
|
398
388
|
}
|
|
399
389
|
errors++;
|
|
400
390
|
}
|
|
401
391
|
}
|
|
402
392
|
}
|
|
403
393
|
else {
|
|
404
|
-
const
|
|
394
|
+
const err32 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
405
395
|
if(vErrors === null){
|
|
406
|
-
vErrors = [
|
|
396
|
+
vErrors = [err32];
|
|
407
397
|
}
|
|
408
398
|
else {
|
|
409
|
-
vErrors.push(
|
|
399
|
+
vErrors.push(err32);
|
|
410
400
|
}
|
|
411
401
|
errors++;
|
|
412
402
|
}
|
|
@@ -418,12 +408,12 @@ const len0 = data19.length;
|
|
|
418
408
|
for(let i0=0; i0<len0; i0++){
|
|
419
409
|
let data20 = data19[i0];
|
|
420
410
|
if(typeof data20 !== "string"){
|
|
421
|
-
const
|
|
411
|
+
const err33 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
422
412
|
if(vErrors === null){
|
|
423
|
-
vErrors = [
|
|
413
|
+
vErrors = [err33];
|
|
424
414
|
}
|
|
425
415
|
else {
|
|
426
|
-
vErrors.push(
|
|
416
|
+
vErrors.push(err33);
|
|
427
417
|
}
|
|
428
418
|
errors++;
|
|
429
419
|
}
|
|
@@ -432,12 +422,12 @@ let valid8 = false;
|
|
|
432
422
|
let passing0 = null;
|
|
433
423
|
const _errs49 = errors;
|
|
434
424
|
if("devices" !== data20){
|
|
435
|
-
const
|
|
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"};
|
|
436
426
|
if(vErrors === null){
|
|
437
|
-
vErrors = [
|
|
427
|
+
vErrors = [err34];
|
|
438
428
|
}
|
|
439
429
|
else {
|
|
440
|
-
vErrors.push(
|
|
430
|
+
vErrors.push(err34);
|
|
441
431
|
}
|
|
442
432
|
errors++;
|
|
443
433
|
}
|
|
@@ -448,12 +438,12 @@ passing0 = 0;
|
|
|
448
438
|
}
|
|
449
439
|
const _errs50 = errors;
|
|
450
440
|
if("email" !== data20){
|
|
451
|
-
const
|
|
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"};
|
|
452
442
|
if(vErrors === null){
|
|
453
|
-
vErrors = [
|
|
443
|
+
vErrors = [err35];
|
|
454
444
|
}
|
|
455
445
|
else {
|
|
456
|
-
vErrors.push(
|
|
446
|
+
vErrors.push(err35);
|
|
457
447
|
}
|
|
458
448
|
errors++;
|
|
459
449
|
}
|
|
@@ -469,12 +459,12 @@ passing0 = 1;
|
|
|
469
459
|
}
|
|
470
460
|
}
|
|
471
461
|
if(!valid8){
|
|
472
|
-
const
|
|
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"};
|
|
473
463
|
if(vErrors === null){
|
|
474
|
-
vErrors = [
|
|
464
|
+
vErrors = [err36];
|
|
475
465
|
}
|
|
476
466
|
else {
|
|
477
|
-
vErrors.push(
|
|
467
|
+
vErrors.push(err36);
|
|
478
468
|
}
|
|
479
469
|
errors++;
|
|
480
470
|
}
|
|
@@ -492,24 +482,24 @@ vErrors = null;
|
|
|
492
482
|
}
|
|
493
483
|
}
|
|
494
484
|
else {
|
|
495
|
-
const
|
|
485
|
+
const err37 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
|
|
496
486
|
if(vErrors === null){
|
|
497
|
-
vErrors = [
|
|
487
|
+
vErrors = [err37];
|
|
498
488
|
}
|
|
499
489
|
else {
|
|
500
|
-
vErrors.push(
|
|
490
|
+
vErrors.push(err37);
|
|
501
491
|
}
|
|
502
492
|
errors++;
|
|
503
493
|
}
|
|
504
494
|
}
|
|
505
495
|
if(data.url !== undefined){
|
|
506
496
|
if(typeof data.url !== "string"){
|
|
507
|
-
const
|
|
497
|
+
const err38 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
508
498
|
if(vErrors === null){
|
|
509
|
-
vErrors = [
|
|
499
|
+
vErrors = [err38];
|
|
510
500
|
}
|
|
511
501
|
else {
|
|
512
|
-
vErrors.push(
|
|
502
|
+
vErrors.push(err38);
|
|
513
503
|
}
|
|
514
504
|
errors++;
|
|
515
505
|
}
|
|
@@ -518,35 +508,35 @@ if(data.date !== undefined){
|
|
|
518
508
|
let data22 = data.date;
|
|
519
509
|
if(typeof data22 === "string"){
|
|
520
510
|
if(!(formats0.validate(data22))){
|
|
521
|
-
const
|
|
511
|
+
const err39 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
|
|
522
512
|
if(vErrors === null){
|
|
523
|
-
vErrors = [
|
|
513
|
+
vErrors = [err39];
|
|
524
514
|
}
|
|
525
515
|
else {
|
|
526
|
-
vErrors.push(
|
|
516
|
+
vErrors.push(err39);
|
|
527
517
|
}
|
|
528
518
|
errors++;
|
|
529
519
|
}
|
|
530
520
|
}
|
|
531
521
|
else {
|
|
532
|
-
const
|
|
522
|
+
const err40 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
533
523
|
if(vErrors === null){
|
|
534
|
-
vErrors = [
|
|
524
|
+
vErrors = [err40];
|
|
535
525
|
}
|
|
536
526
|
else {
|
|
537
|
-
vErrors.push(
|
|
527
|
+
vErrors.push(err40);
|
|
538
528
|
}
|
|
539
529
|
errors++;
|
|
540
530
|
}
|
|
541
531
|
}
|
|
542
532
|
if(data.new !== undefined){
|
|
543
533
|
if(typeof data.new !== "boolean"){
|
|
544
|
-
const
|
|
534
|
+
const err41 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
545
535
|
if(vErrors === null){
|
|
546
|
-
vErrors = [
|
|
536
|
+
vErrors = [err41];
|
|
547
537
|
}
|
|
548
538
|
else {
|
|
549
|
-
vErrors.push(
|
|
539
|
+
vErrors.push(err41);
|
|
550
540
|
}
|
|
551
541
|
errors++;
|
|
552
542
|
}
|
|
@@ -554,24 +544,24 @@ errors++;
|
|
|
554
544
|
if(data.extra !== undefined){
|
|
555
545
|
let data24 = data.extra;
|
|
556
546
|
if(!(data24 && typeof data24 == "object" && !Array.isArray(data24))){
|
|
557
|
-
const
|
|
547
|
+
const err42 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
558
548
|
if(vErrors === null){
|
|
559
|
-
vErrors = [
|
|
549
|
+
vErrors = [err42];
|
|
560
550
|
}
|
|
561
551
|
else {
|
|
562
|
-
vErrors.push(
|
|
552
|
+
vErrors.push(err42);
|
|
563
553
|
}
|
|
564
554
|
errors++;
|
|
565
555
|
}
|
|
566
556
|
}
|
|
567
557
|
}
|
|
568
558
|
else {
|
|
569
|
-
const
|
|
559
|
+
const err43 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
570
560
|
if(vErrors === null){
|
|
571
|
-
vErrors = [
|
|
561
|
+
vErrors = [err43];
|
|
572
562
|
}
|
|
573
563
|
else {
|
|
574
|
-
vErrors.push(
|
|
564
|
+
vErrors.push(err43);
|
|
575
565
|
}
|
|
576
566
|
errors++;
|
|
577
567
|
}
|
package/package.json
CHANGED
package/session/index.js
CHANGED
|
@@ -22,8 +22,9 @@ function matchAccount (userAccount, resourceAccount, acceptDepAsRoot = false) {
|
|
|
22
22
|
export function getAccountRole (sessionState, account, options = {}) {
|
|
23
23
|
if (!isAuthenticated(sessionState)) { return null }
|
|
24
24
|
if (sessionState.user.adminMode) { return 'admin' }
|
|
25
|
+
// user is always admin of themself even if currently switched in an orga
|
|
26
|
+
if (account.type === 'user' && sessionState.user.id === account.id) { return 'admin' }
|
|
25
27
|
if (options.allAccounts) {
|
|
26
|
-
if (account.type === 'user' && sessionState.user.id === account.id) { return 'admin' }
|
|
27
28
|
for (const org of sessionState.user.organizations) {
|
|
28
29
|
if (matchAccount({ type: 'organization', id: org.id, department: org.department }, account, options.acceptDepAsRoot)) { return org.role }
|
|
29
30
|
}
|