@data-fair/lib-common-types 1.1.0 → 1.2.0

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.
@@ -21,7 +21,7 @@ export interface AccountKeys {
21
21
  }
22
22
 
23
23
 
24
- export const validate: (data: any) => data is Account
25
- export const assertValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => asserts data is Account
26
- export const returnValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => Account
24
+ export declare function validate(data: any): data is Account
25
+ export declare function assertValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): asserts data is Account
26
+ export declare function returnValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): Account
27
27
 
@@ -10,10 +10,10 @@ export const schemaExports = [
10
10
  ]
11
11
 
12
12
  export { validate } from './validate.js'
13
- export const assertValid = (data, options) => {
13
+ export function assertValid(data, options) {
14
14
  assertValidGeneric(validate, data, options)
15
15
  }
16
- export const returnValid = (data, options) => {
16
+ export function returnValid(data, options) {
17
17
  assertValid(data, options)
18
18
  return data
19
19
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "prepublishOnly": "cd .. && npm run prepublishOnly"
7
+ "prepublishOnly": "cd .. && npm run prepublishOnly",
8
+ "build": "cd .. && npm run build"
8
9
  },
9
10
  "devDependencies": {},
10
11
  "files": [
@@ -2,6 +2,10 @@
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 ShortForIgnorePersonalAccount = 1;
6
+ export type IsTheUserComingFromACoreIDProvider = 1;
7
+ export type ShortForOrgStorage = 1;
8
+
5
9
  export interface SessionState {
6
10
  user?: User;
7
11
  organization?: OrganizationMembership;
@@ -19,11 +23,13 @@ export interface User {
19
23
  id: string;
20
24
  name: string;
21
25
  organizations: OrganizationMembership[];
22
- isAdmin?: 0 | 1;
23
- adminMode?: 0 | 1;
26
+ isAdmin?: 1;
27
+ adminMode?: 1;
24
28
  asAdmin?: UserRef;
25
29
  pd?: string;
26
- ipa?: 0 | 1;
30
+ ipa?: ShortForIgnorePersonalAccount;
31
+ idp?: IsTheUserComingFromACoreIDProvider;
32
+ os?: ShortForOrgStorage;
27
33
  }
28
34
  /**
29
35
  * This interface was referenced by `SessionState`'s JSON-Schema
@@ -35,7 +41,7 @@ export interface OrganizationMembership {
35
41
  role: string;
36
42
  department?: string;
37
43
  departmentName?: string;
38
- dflt?: boolean;
44
+ dflt?: 1;
39
45
  }
40
46
  /**
41
47
  * This interface was referenced by `SessionState`'s JSON-Schema
@@ -58,7 +64,7 @@ export interface Account {
58
64
  }
59
65
 
60
66
 
61
- export const validate: (data: any) => data is SessionState
62
- export const assertValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => asserts data is SessionState
63
- export const returnValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => SessionState
67
+ export declare function validate(data: any): data is SessionState
68
+ export declare function assertValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): asserts data is SessionState
69
+ export declare function returnValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): SessionState
64
70
 
@@ -10,10 +10,10 @@ export const schemaExports = [
10
10
  ]
11
11
 
12
12
  export { validate } from './validate.js'
13
- export const assertValid = (data, options) => {
13
+ export function assertValid(data, options) {
14
14
  assertValidGeneric(validate, data, options)
15
15
  }
16
- export const returnValid = (data, options) => {
16
+ export function returnValid(data, options) {
17
17
  assertValid(data, options)
18
18
  return data
19
19
  }
@@ -5,10 +5,10 @@ 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/session-state","x-exports":["types","validate"],"type":"object","title":"session state","additionalProperties":false,"properties":{"user":{"$ref":"#/$defs/user"},"organization":{"$ref":"#/$defs/organizationMembership"},"account":{"$ref":"#/$defs/account"},"accountRole":{"type":"string"},"lang":{"type":"string"},"dark":{"type":"boolean"}},"$defs":{"organizationMembership":{"type":"object","additionalProperties":false,"required":["id","name","role"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"},"dflt":{"type":"boolean"}}},"userRef":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"user":{"type":"object","additionalProperties":false,"required":["email","id","name","organizations"],"properties":{"email":{"type":"string","format":"email"},"id":{"type":"string"},"name":{"type":"string"},"organizations":{"type":"array","items":{"$ref":"#/$defs/organizationMembership"}},"isAdmin":{"type":"integer","enum":[0,1]},"adminMode":{"type":"integer","enum":[0,1]},"asAdmin":{"$ref":"#/$defs/userRef"},"pd":{"type":"string","format":"date"},"ipa":{"type":"integer","enum":[0,1]}}},"account":{"type":"object","additionalProperties":false,"required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}}}}};
9
- const schema18 = {"type":"object","additionalProperties":false,"required":["id","name","role"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"},"dflt":{"type":"boolean"}}};
8
+ const schema16 = {"$id":"https://github.com/data-fair/lib/session-state","x-exports":["types","validate"],"type":"object","title":"session state","additionalProperties":false,"properties":{"user":{"$ref":"#/$defs/user"},"organization":{"$ref":"#/$defs/organizationMembership"},"account":{"$ref":"#/$defs/account"},"accountRole":{"type":"string"},"lang":{"type":"string"},"dark":{"type":"boolean"}},"$defs":{"organizationMembership":{"type":"object","additionalProperties":false,"required":["id","name","role"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"},"dflt":{"type":"integer","enum":[1]}}},"userRef":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"user":{"type":"object","additionalProperties":false,"required":["email","id","name","organizations"],"properties":{"email":{"type":"string","format":"email"},"id":{"type":"string"},"name":{"type":"string"},"organizations":{"type":"array","items":{"$ref":"#/$defs/organizationMembership"}},"isAdmin":{"type":"integer","enum":[1]},"adminMode":{"type":"integer","enum":[1]},"asAdmin":{"$ref":"#/$defs/userRef"},"pd":{"type":"string","format":"date"},"ipa":{"type":"integer","title":"short for ignorePersonalAccount","enum":[1]},"idp":{"type":"integer","title":"Is the user coming from a core ID provider ?","enum":[1]},"os":{"type":"integer","title":"short for orgStorage","enum":[1]}}},"account":{"type":"object","additionalProperties":false,"required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}}}}};
9
+ const schema18 = {"type":"object","additionalProperties":false,"required":["id","name","role"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"},"dflt":{"type":"integer","enum":[1]}}};
10
10
  const schema21 = {"type":"object","additionalProperties":false,"required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}}};
11
- const schema17 = {"type":"object","additionalProperties":false,"required":["email","id","name","organizations"],"properties":{"email":{"type":"string","format":"email"},"id":{"type":"string"},"name":{"type":"string"},"organizations":{"type":"array","items":{"$ref":"#/$defs/organizationMembership"}},"isAdmin":{"type":"integer","enum":[0,1]},"adminMode":{"type":"integer","enum":[0,1]},"asAdmin":{"$ref":"#/$defs/userRef"},"pd":{"type":"string","format":"date"},"ipa":{"type":"integer","enum":[0,1]}}};
11
+ const schema17 = {"type":"object","additionalProperties":false,"required":["email","id","name","organizations"],"properties":{"email":{"type":"string","format":"email"},"id":{"type":"string"},"name":{"type":"string"},"organizations":{"type":"array","items":{"$ref":"#/$defs/organizationMembership"}},"isAdmin":{"type":"integer","enum":[1]},"adminMode":{"type":"integer","enum":[1]},"asAdmin":{"$ref":"#/$defs/userRef"},"pd":{"type":"string","format":"date"},"ipa":{"type":"integer","title":"short for ignorePersonalAccount","enum":[1]},"idp":{"type":"integer","title":"Is the user coming from a core ID provider ?","enum":[1]},"os":{"type":"integer","title":"short for orgStorage","enum":[1]}}};
12
12
  const schema19 = {"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}};
13
13
  const func2 = Object.prototype.hasOwnProperty;
14
14
  const formats0 = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
@@ -229,8 +229,9 @@ errors++;
229
229
  }
230
230
  }
231
231
  if(data4.dflt !== undefined){
232
- if(typeof data4.dflt !== "boolean"){
233
- const err18 = {instancePath:instancePath+"/organizations/" + i0+"/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
232
+ let data10 = data4.dflt;
233
+ if(!((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10)))){
234
+ const err18 = {instancePath:instancePath+"/organizations/" + i0+"/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
234
235
  if(vErrors === null){
235
236
  vErrors = [err18];
236
237
  }
@@ -239,10 +240,8 @@ vErrors.push(err18);
239
240
  }
240
241
  errors++;
241
242
  }
242
- }
243
- }
244
- else {
245
- const err19 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
243
+ if(!(data10 === 1)){
244
+ const err19 = {instancePath:instancePath+"/organizations/" + i0+"/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/enum",keyword:"enum",params:{allowedValues: schema18.properties.dflt.enum},message:"must be equal to one of the allowed values"};
246
245
  if(vErrors === null){
247
246
  vErrors = [err19];
248
247
  }
@@ -254,7 +253,7 @@ errors++;
254
253
  }
255
254
  }
256
255
  else {
257
- const err20 = {instancePath:instancePath+"/organizations",schemaPath:"#/properties/organizations/type",keyword:"type",params:{type: "array"},message:"must be array"};
256
+ const err20 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
258
257
  if(vErrors === null){
259
258
  vErrors = [err20];
260
259
  }
@@ -264,10 +263,9 @@ vErrors.push(err20);
264
263
  errors++;
265
264
  }
266
265
  }
267
- if(data.isAdmin !== undefined){
268
- let data11 = data.isAdmin;
269
- if(!((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11)))){
270
- const err21 = {instancePath:instancePath+"/isAdmin",schemaPath:"#/properties/isAdmin/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
266
+ }
267
+ else {
268
+ const err21 = {instancePath:instancePath+"/organizations",schemaPath:"#/properties/organizations/type",keyword:"type",params:{type: "array"},message:"must be array"};
271
269
  if(vErrors === null){
272
270
  vErrors = [err21];
273
271
  }
@@ -276,8 +274,11 @@ vErrors.push(err21);
276
274
  }
277
275
  errors++;
278
276
  }
279
- if(!((data11 === 0) || (data11 === 1))){
280
- const err22 = {instancePath:instancePath+"/isAdmin",schemaPath:"#/properties/isAdmin/enum",keyword:"enum",params:{allowedValues: schema17.properties.isAdmin.enum},message:"must be equal to one of the allowed values"};
277
+ }
278
+ if(data.isAdmin !== undefined){
279
+ let data11 = data.isAdmin;
280
+ if(!((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11)))){
281
+ const err22 = {instancePath:instancePath+"/isAdmin",schemaPath:"#/properties/isAdmin/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
281
282
  if(vErrors === null){
282
283
  vErrors = [err22];
283
284
  }
@@ -286,11 +287,8 @@ vErrors.push(err22);
286
287
  }
287
288
  errors++;
288
289
  }
289
- }
290
- if(data.adminMode !== undefined){
291
- let data12 = data.adminMode;
292
- if(!((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12)))){
293
- const err23 = {instancePath:instancePath+"/adminMode",schemaPath:"#/properties/adminMode/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
290
+ if(!(data11 === 1)){
291
+ const err23 = {instancePath:instancePath+"/isAdmin",schemaPath:"#/properties/isAdmin/enum",keyword:"enum",params:{allowedValues: schema17.properties.isAdmin.enum},message:"must be equal to one of the allowed values"};
294
292
  if(vErrors === null){
295
293
  vErrors = [err23];
296
294
  }
@@ -299,8 +297,11 @@ vErrors.push(err23);
299
297
  }
300
298
  errors++;
301
299
  }
302
- if(!((data12 === 0) || (data12 === 1))){
303
- const err24 = {instancePath:instancePath+"/adminMode",schemaPath:"#/properties/adminMode/enum",keyword:"enum",params:{allowedValues: schema17.properties.adminMode.enum},message:"must be equal to one of the allowed values"};
300
+ }
301
+ if(data.adminMode !== undefined){
302
+ let data12 = data.adminMode;
303
+ if(!((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12)))){
304
+ const err24 = {instancePath:instancePath+"/adminMode",schemaPath:"#/properties/adminMode/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
304
305
  if(vErrors === null){
305
306
  vErrors = [err24];
306
307
  }
@@ -309,74 +310,84 @@ vErrors.push(err24);
309
310
  }
310
311
  errors++;
311
312
  }
313
+ if(!(data12 === 1)){
314
+ const err25 = {instancePath:instancePath+"/adminMode",schemaPath:"#/properties/adminMode/enum",keyword:"enum",params:{allowedValues: schema17.properties.adminMode.enum},message:"must be equal to one of the allowed values"};
315
+ if(vErrors === null){
316
+ vErrors = [err25];
317
+ }
318
+ else {
319
+ vErrors.push(err25);
320
+ }
321
+ errors++;
322
+ }
312
323
  }
313
324
  if(data.asAdmin !== undefined){
314
325
  let data13 = data.asAdmin;
315
326
  if(data13 && typeof data13 == "object" && !Array.isArray(data13)){
316
327
  if(data13.id === undefined){
317
- const err25 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
328
+ const err26 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
318
329
  if(vErrors === null){
319
- vErrors = [err25];
330
+ vErrors = [err26];
320
331
  }
321
332
  else {
322
- vErrors.push(err25);
333
+ vErrors.push(err26);
323
334
  }
324
335
  errors++;
325
336
  }
326
337
  if(data13.name === undefined){
327
- const err26 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
338
+ const err27 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
328
339
  if(vErrors === null){
329
- vErrors = [err26];
340
+ vErrors = [err27];
330
341
  }
331
342
  else {
332
- vErrors.push(err26);
343
+ vErrors.push(err27);
333
344
  }
334
345
  errors++;
335
346
  }
336
347
  for(const key2 in data13){
337
348
  if(!((key2 === "id") || (key2 === "name"))){
338
- const err27 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
349
+ const err28 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
339
350
  if(vErrors === null){
340
- vErrors = [err27];
351
+ vErrors = [err28];
341
352
  }
342
353
  else {
343
- vErrors.push(err27);
354
+ vErrors.push(err28);
344
355
  }
345
356
  errors++;
346
357
  }
347
358
  }
348
359
  if(data13.id !== undefined){
349
360
  if(typeof data13.id !== "string"){
350
- const err28 = {instancePath:instancePath+"/asAdmin/id",schemaPath:"#/$defs/userRef/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
361
+ const err29 = {instancePath:instancePath+"/asAdmin/id",schemaPath:"#/$defs/userRef/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
351
362
  if(vErrors === null){
352
- vErrors = [err28];
363
+ vErrors = [err29];
353
364
  }
354
365
  else {
355
- vErrors.push(err28);
366
+ vErrors.push(err29);
356
367
  }
357
368
  errors++;
358
369
  }
359
370
  }
360
371
  if(data13.name !== undefined){
361
372
  if(typeof data13.name !== "string"){
362
- const err29 = {instancePath:instancePath+"/asAdmin/name",schemaPath:"#/$defs/userRef/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
373
+ const err30 = {instancePath:instancePath+"/asAdmin/name",schemaPath:"#/$defs/userRef/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
363
374
  if(vErrors === null){
364
- vErrors = [err29];
375
+ vErrors = [err30];
365
376
  }
366
377
  else {
367
- vErrors.push(err29);
378
+ vErrors.push(err30);
368
379
  }
369
380
  errors++;
370
381
  }
371
382
  }
372
383
  }
373
384
  else {
374
- const err30 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
385
+ const err31 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
375
386
  if(vErrors === null){
376
- vErrors = [err30];
387
+ vErrors = [err31];
377
388
  }
378
389
  else {
379
- vErrors.push(err30);
390
+ vErrors.push(err31);
380
391
  }
381
392
  errors++;
382
393
  }
@@ -385,23 +396,23 @@ if(data.pd !== undefined){
385
396
  let data16 = data.pd;
386
397
  if(typeof data16 === "string"){
387
398
  if(!(formats2.validate(data16))){
388
- const err31 = {instancePath:instancePath+"/pd",schemaPath:"#/properties/pd/format",keyword:"format",params:{format: "date"},message:"must match format \""+"date"+"\""};
399
+ const err32 = {instancePath:instancePath+"/pd",schemaPath:"#/properties/pd/format",keyword:"format",params:{format: "date"},message:"must match format \""+"date"+"\""};
389
400
  if(vErrors === null){
390
- vErrors = [err31];
401
+ vErrors = [err32];
391
402
  }
392
403
  else {
393
- vErrors.push(err31);
404
+ vErrors.push(err32);
394
405
  }
395
406
  errors++;
396
407
  }
397
408
  }
398
409
  else {
399
- const err32 = {instancePath:instancePath+"/pd",schemaPath:"#/properties/pd/type",keyword:"type",params:{type: "string"},message:"must be string"};
410
+ const err33 = {instancePath:instancePath+"/pd",schemaPath:"#/properties/pd/type",keyword:"type",params:{type: "string"},message:"must be string"};
400
411
  if(vErrors === null){
401
- vErrors = [err32];
412
+ vErrors = [err33];
402
413
  }
403
414
  else {
404
- vErrors.push(err32);
415
+ vErrors.push(err33);
405
416
  }
406
417
  errors++;
407
418
  }
@@ -409,34 +420,80 @@ errors++;
409
420
  if(data.ipa !== undefined){
410
421
  let data17 = data.ipa;
411
422
  if(!((typeof data17 == "number") && (!(data17 % 1) && !isNaN(data17)))){
412
- const err33 = {instancePath:instancePath+"/ipa",schemaPath:"#/properties/ipa/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
423
+ const err34 = {instancePath:instancePath+"/ipa",schemaPath:"#/properties/ipa/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
413
424
  if(vErrors === null){
414
- vErrors = [err33];
425
+ vErrors = [err34];
415
426
  }
416
427
  else {
417
- vErrors.push(err33);
428
+ vErrors.push(err34);
418
429
  }
419
430
  errors++;
420
431
  }
421
- if(!((data17 === 0) || (data17 === 1))){
422
- const err34 = {instancePath:instancePath+"/ipa",schemaPath:"#/properties/ipa/enum",keyword:"enum",params:{allowedValues: schema17.properties.ipa.enum},message:"must be equal to one of the allowed values"};
432
+ if(!(data17 === 1)){
433
+ const err35 = {instancePath:instancePath+"/ipa",schemaPath:"#/properties/ipa/enum",keyword:"enum",params:{allowedValues: schema17.properties.ipa.enum},message:"must be equal to one of the allowed values"};
423
434
  if(vErrors === null){
424
- vErrors = [err34];
435
+ vErrors = [err35];
425
436
  }
426
437
  else {
427
- vErrors.push(err34);
438
+ vErrors.push(err35);
428
439
  }
429
440
  errors++;
430
441
  }
431
442
  }
443
+ if(data.idp !== undefined){
444
+ let data18 = data.idp;
445
+ if(!((typeof data18 == "number") && (!(data18 % 1) && !isNaN(data18)))){
446
+ const err36 = {instancePath:instancePath+"/idp",schemaPath:"#/properties/idp/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
447
+ if(vErrors === null){
448
+ vErrors = [err36];
432
449
  }
433
450
  else {
434
- const err35 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
451
+ vErrors.push(err36);
452
+ }
453
+ errors++;
454
+ }
455
+ if(!(data18 === 1)){
456
+ const err37 = {instancePath:instancePath+"/idp",schemaPath:"#/properties/idp/enum",keyword:"enum",params:{allowedValues: schema17.properties.idp.enum},message:"must be equal to one of the allowed values"};
435
457
  if(vErrors === null){
436
- vErrors = [err35];
458
+ vErrors = [err37];
437
459
  }
438
460
  else {
439
- vErrors.push(err35);
461
+ vErrors.push(err37);
462
+ }
463
+ errors++;
464
+ }
465
+ }
466
+ if(data.os !== undefined){
467
+ let data19 = data.os;
468
+ if(!((typeof data19 == "number") && (!(data19 % 1) && !isNaN(data19)))){
469
+ const err38 = {instancePath:instancePath+"/os",schemaPath:"#/properties/os/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
470
+ if(vErrors === null){
471
+ vErrors = [err38];
472
+ }
473
+ else {
474
+ vErrors.push(err38);
475
+ }
476
+ errors++;
477
+ }
478
+ if(!(data19 === 1)){
479
+ const err39 = {instancePath:instancePath+"/os",schemaPath:"#/properties/os/enum",keyword:"enum",params:{allowedValues: schema17.properties.os.enum},message:"must be equal to one of the allowed values"};
480
+ if(vErrors === null){
481
+ vErrors = [err39];
482
+ }
483
+ else {
484
+ vErrors.push(err39);
485
+ }
486
+ errors++;
487
+ }
488
+ }
489
+ }
490
+ else {
491
+ const err40 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
492
+ if(vErrors === null){
493
+ vErrors = [err40];
494
+ }
495
+ else {
496
+ vErrors.push(err40);
440
497
  }
441
498
  errors++;
442
499
  }
@@ -574,8 +631,9 @@ errors++;
574
631
  }
575
632
  }
576
633
  if(data1.dflt !== undefined){
577
- if(typeof data1.dflt !== "boolean"){
578
- const err10 = {instancePath:instancePath+"/organization/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
634
+ let data7 = data1.dflt;
635
+ if(!((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7)))){
636
+ const err10 = {instancePath:instancePath+"/organization/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
579
637
  if(vErrors === null){
580
638
  vErrors = [err10];
581
639
  }
@@ -584,15 +642,25 @@ vErrors.push(err10);
584
642
  }
585
643
  errors++;
586
644
  }
645
+ if(!(data7 === 1)){
646
+ const err11 = {instancePath:instancePath+"/organization/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/enum",keyword:"enum",params:{allowedValues: schema18.properties.dflt.enum},message:"must be equal to one of the allowed values"};
647
+ if(vErrors === null){
648
+ vErrors = [err11];
649
+ }
650
+ else {
651
+ vErrors.push(err11);
652
+ }
653
+ errors++;
654
+ }
587
655
  }
588
656
  }
589
657
  else {
590
- const err11 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
658
+ const err12 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
591
659
  if(vErrors === null){
592
- vErrors = [err11];
660
+ vErrors = [err12];
593
661
  }
594
662
  else {
595
- vErrors.push(err11);
663
+ vErrors.push(err12);
596
664
  }
597
665
  errors++;
598
666
  }
@@ -601,43 +669,43 @@ if(data.account !== undefined){
601
669
  let data8 = data.account;
602
670
  if(data8 && typeof data8 == "object" && !Array.isArray(data8)){
603
671
  if(data8.type === undefined){
604
- const err12 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
672
+ const err13 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
605
673
  if(vErrors === null){
606
- vErrors = [err12];
674
+ vErrors = [err13];
607
675
  }
608
676
  else {
609
- vErrors.push(err12);
677
+ vErrors.push(err13);
610
678
  }
611
679
  errors++;
612
680
  }
613
681
  if(data8.id === undefined){
614
- const err13 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
682
+ const err14 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
615
683
  if(vErrors === null){
616
- vErrors = [err13];
684
+ vErrors = [err14];
617
685
  }
618
686
  else {
619
- vErrors.push(err13);
687
+ vErrors.push(err14);
620
688
  }
621
689
  errors++;
622
690
  }
623
691
  if(data8.name === undefined){
624
- const err14 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
692
+ const err15 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
625
693
  if(vErrors === null){
626
- vErrors = [err14];
694
+ vErrors = [err15];
627
695
  }
628
696
  else {
629
- vErrors.push(err14);
697
+ vErrors.push(err15);
630
698
  }
631
699
  errors++;
632
700
  }
633
701
  for(const key2 in data8){
634
702
  if(!(((((key2 === "type") || (key2 === "id")) || (key2 === "name")) || (key2 === "department")) || (key2 === "departmentName"))){
635
- const err15 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
703
+ const err16 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
636
704
  if(vErrors === null){
637
- vErrors = [err15];
705
+ vErrors = [err16];
638
706
  }
639
707
  else {
640
- vErrors.push(err15);
708
+ vErrors.push(err16);
641
709
  }
642
710
  errors++;
643
711
  }
@@ -645,130 +713,130 @@ errors++;
645
713
  if(data8.type !== undefined){
646
714
  let data9 = data8.type;
647
715
  if(typeof data9 !== "string"){
648
- const err16 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
716
+ const err17 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
649
717
  if(vErrors === null){
650
- vErrors = [err16];
718
+ vErrors = [err17];
651
719
  }
652
720
  else {
653
- vErrors.push(err16);
721
+ vErrors.push(err17);
654
722
  }
655
723
  errors++;
656
724
  }
657
725
  if(!((data9 === "user") || (data9 === "organization"))){
658
- const err17 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/enum",keyword:"enum",params:{allowedValues: schema21.properties.type.enum},message:"must be equal to one of the allowed values"};
726
+ const err18 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/enum",keyword:"enum",params:{allowedValues: schema21.properties.type.enum},message:"must be equal to one of the allowed values"};
659
727
  if(vErrors === null){
660
- vErrors = [err17];
728
+ vErrors = [err18];
661
729
  }
662
730
  else {
663
- vErrors.push(err17);
731
+ vErrors.push(err18);
664
732
  }
665
733
  errors++;
666
734
  }
667
735
  }
668
736
  if(data8.id !== undefined){
669
737
  if(typeof data8.id !== "string"){
670
- const err18 = {instancePath:instancePath+"/account/id",schemaPath:"#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
738
+ const err19 = {instancePath:instancePath+"/account/id",schemaPath:"#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
671
739
  if(vErrors === null){
672
- vErrors = [err18];
740
+ vErrors = [err19];
673
741
  }
674
742
  else {
675
- vErrors.push(err18);
743
+ vErrors.push(err19);
676
744
  }
677
745
  errors++;
678
746
  }
679
747
  }
680
748
  if(data8.name !== undefined){
681
749
  if(typeof data8.name !== "string"){
682
- const err19 = {instancePath:instancePath+"/account/name",schemaPath:"#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
750
+ const err20 = {instancePath:instancePath+"/account/name",schemaPath:"#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
683
751
  if(vErrors === null){
684
- vErrors = [err19];
752
+ vErrors = [err20];
685
753
  }
686
754
  else {
687
- vErrors.push(err19);
755
+ vErrors.push(err20);
688
756
  }
689
757
  errors++;
690
758
  }
691
759
  }
692
760
  if(data8.department !== undefined){
693
761
  if(typeof data8.department !== "string"){
694
- const err20 = {instancePath:instancePath+"/account/department",schemaPath:"#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
762
+ const err21 = {instancePath:instancePath+"/account/department",schemaPath:"#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
695
763
  if(vErrors === null){
696
- vErrors = [err20];
764
+ vErrors = [err21];
697
765
  }
698
766
  else {
699
- vErrors.push(err20);
767
+ vErrors.push(err21);
700
768
  }
701
769
  errors++;
702
770
  }
703
771
  }
704
772
  if(data8.departmentName !== undefined){
705
773
  if(typeof data8.departmentName !== "string"){
706
- const err21 = {instancePath:instancePath+"/account/departmentName",schemaPath:"#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
774
+ const err22 = {instancePath:instancePath+"/account/departmentName",schemaPath:"#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
707
775
  if(vErrors === null){
708
- vErrors = [err21];
776
+ vErrors = [err22];
709
777
  }
710
778
  else {
711
- vErrors.push(err21);
779
+ vErrors.push(err22);
712
780
  }
713
781
  errors++;
714
782
  }
715
783
  }
716
784
  }
717
785
  else {
718
- const err22 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
786
+ const err23 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
719
787
  if(vErrors === null){
720
- vErrors = [err22];
788
+ vErrors = [err23];
721
789
  }
722
790
  else {
723
- vErrors.push(err22);
791
+ vErrors.push(err23);
724
792
  }
725
793
  errors++;
726
794
  }
727
795
  }
728
796
  if(data.accountRole !== undefined){
729
797
  if(typeof data.accountRole !== "string"){
730
- const err23 = {instancePath:instancePath+"/accountRole",schemaPath:"#/properties/accountRole/type",keyword:"type",params:{type: "string"},message:"must be string"};
798
+ const err24 = {instancePath:instancePath+"/accountRole",schemaPath:"#/properties/accountRole/type",keyword:"type",params:{type: "string"},message:"must be string"};
731
799
  if(vErrors === null){
732
- vErrors = [err23];
800
+ vErrors = [err24];
733
801
  }
734
802
  else {
735
- vErrors.push(err23);
803
+ vErrors.push(err24);
736
804
  }
737
805
  errors++;
738
806
  }
739
807
  }
740
808
  if(data.lang !== undefined){
741
809
  if(typeof data.lang !== "string"){
742
- const err24 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
810
+ const err25 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
743
811
  if(vErrors === null){
744
- vErrors = [err24];
812
+ vErrors = [err25];
745
813
  }
746
814
  else {
747
- vErrors.push(err24);
815
+ vErrors.push(err25);
748
816
  }
749
817
  errors++;
750
818
  }
751
819
  }
752
820
  if(data.dark !== undefined){
753
821
  if(typeof data.dark !== "boolean"){
754
- const err25 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
822
+ const err26 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
755
823
  if(vErrors === null){
756
- vErrors = [err25];
824
+ vErrors = [err26];
757
825
  }
758
826
  else {
759
- vErrors.push(err25);
827
+ vErrors.push(err26);
760
828
  }
761
829
  errors++;
762
830
  }
763
831
  }
764
832
  }
765
833
  else {
766
- const err26 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
834
+ const err27 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
767
835
  if(vErrors === null){
768
- vErrors = [err26];
836
+ vErrors = [err27];
769
837
  }
770
838
  else {
771
- vErrors.push(err26);
839
+ vErrors.push(err27);
772
840
  }
773
841
  errors++;
774
842
  }
@@ -47,6 +47,7 @@ declare const _default: {
47
47
  };
48
48
  dflt: {
49
49
  type: string;
50
+ enum: number[];
50
51
  };
51
52
  };
52
53
  };
@@ -101,6 +102,17 @@ declare const _default: {
101
102
  };
102
103
  ipa: {
103
104
  type: string;
105
+ title: string;
106
+ enum: number[];
107
+ };
108
+ idp: {
109
+ type: string;
110
+ title: string;
111
+ enum: number[];
112
+ };
113
+ os: {
114
+ type: string;
115
+ title: string;
104
116
  enum: number[];
105
117
  };
106
118
  };
package/session/schema.js CHANGED
@@ -50,7 +50,8 @@ export default {
50
50
  type: 'string'
51
51
  },
52
52
  dflt: {
53
- type: 'boolean'
53
+ type: 'integer',
54
+ enum: [1]
54
55
  }
55
56
  }
56
57
  },
@@ -98,17 +99,11 @@ export default {
98
99
  },
99
100
  isAdmin: {
100
101
  type: 'integer',
101
- enum: [
102
- 0,
103
- 1
104
- ]
102
+ enum: [1]
105
103
  },
106
104
  adminMode: {
107
105
  type: 'integer',
108
- enum: [
109
- 0,
110
- 1
111
- ]
106
+ enum: [1]
112
107
  },
113
108
  asAdmin: {
114
109
  $ref: '#/$defs/userRef'
@@ -119,10 +114,18 @@ export default {
119
114
  },
120
115
  ipa: {
121
116
  type: 'integer',
122
- enum: [
123
- 0,
124
- 1
125
- ]
117
+ title: 'short for ignorePersonalAccount',
118
+ enum: [1]
119
+ },
120
+ idp: {
121
+ type: 'integer',
122
+ title: 'Is the user coming from a core ID provider ?',
123
+ enum: [1]
124
+ },
125
+ os: {
126
+ type: 'integer',
127
+ title: 'short for orgStorage',
128
+ enum: [1]
126
129
  }
127
130
  }
128
131
  },