@data-fair/lib-common-types 1.7.0 → 1.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,6 +11,7 @@ export type SessionState = {
11
11
  organization?: OrganizationMembership;
12
12
  account?: Account;
13
13
  accountRole?: string;
14
+ siteRole?: string;
14
15
  lang: string;
15
16
  /**
16
17
  * @deprecated
@@ -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/session-state","x-exports":["types","validate"],"type":"object","title":"session state","additionalProperties":false,"required":["lang"],"properties":{"user":{"$ref":"#/$defs/user"},"organization":{"$ref":"#/$defs/organizationMembership"},"account":{"$ref":"#/$defs/account"},"accountRole":{"type":"string"},"lang":{"type":"string"},"dark":{"deprecated":true,"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]},"rememberMe":{"type":"integer","enum":[1]},"siteOwner":{"$ref":"#/$defs/account"}}},"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"}}}}};
8
+ const schema16 = {"$id":"https://github.com/data-fair/lib/session-state","x-exports":["types","validate"],"type":"object","title":"session state","additionalProperties":false,"required":["lang"],"properties":{"user":{"$ref":"#/$defs/user"},"organization":{"$ref":"#/$defs/organizationMembership"},"account":{"$ref":"#/$defs/account"},"accountRole":{"type":"string"},"siteRole":{"type":"string"},"lang":{"type":"string"},"dark":{"deprecated":true,"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]},"rememberMe":{"type":"integer","enum":[1]},"siteOwner":{"$ref":"#/$defs/account"}}},"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
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 schema20 = {"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
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]},"rememberMe":{"type":"integer","enum":[1]},"siteOwner":{"$ref":"#/$defs/account"}}};
@@ -669,7 +669,7 @@ vErrors.push(err0);
669
669
  errors++;
670
670
  }
671
671
  for(const key0 in data){
672
- if(!((((((key0 === "user") || (key0 === "organization")) || (key0 === "account")) || (key0 === "accountRole")) || (key0 === "lang")) || (key0 === "dark"))){
672
+ if(!(((((((key0 === "user") || (key0 === "organization")) || (key0 === "account")) || (key0 === "accountRole")) || (key0 === "siteRole")) || (key0 === "lang")) || (key0 === "dark"))){
673
673
  const err1 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
674
674
  if(vErrors === null){
675
675
  vErrors = [err1];
@@ -966,9 +966,9 @@ vErrors.push(err25);
966
966
  errors++;
967
967
  }
968
968
  }
969
- if(data.lang !== undefined){
970
- if(typeof data.lang !== "string"){
971
- const err26 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
969
+ if(data.siteRole !== undefined){
970
+ if(typeof data.siteRole !== "string"){
971
+ const err26 = {instancePath:instancePath+"/siteRole",schemaPath:"#/properties/siteRole/type",keyword:"type",params:{type: "string"},message:"must be string"};
972
972
  if(vErrors === null){
973
973
  vErrors = [err26];
974
974
  }
@@ -978,9 +978,9 @@ vErrors.push(err26);
978
978
  errors++;
979
979
  }
980
980
  }
981
- if(data.dark !== undefined){
982
- if(typeof data.dark !== "boolean"){
983
- const err27 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
981
+ if(data.lang !== undefined){
982
+ if(typeof data.lang !== "string"){
983
+ const err27 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
984
984
  if(vErrors === null){
985
985
  vErrors = [err27];
986
986
  }
@@ -990,9 +990,9 @@ vErrors.push(err27);
990
990
  errors++;
991
991
  }
992
992
  }
993
- }
994
- else {
995
- const err28 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
993
+ if(data.dark !== undefined){
994
+ if(typeof data.dark !== "boolean"){
995
+ const err28 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
996
996
  if(vErrors === null){
997
997
  vErrors = [err28];
998
998
  }
@@ -1001,6 +1001,18 @@ vErrors.push(err28);
1001
1001
  }
1002
1002
  errors++;
1003
1003
  }
1004
+ }
1005
+ }
1006
+ else {
1007
+ const err29 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
1008
+ if(vErrors === null){
1009
+ vErrors = [err29];
1010
+ }
1011
+ else {
1012
+ vErrors.push(err29);
1013
+ }
1014
+ errors++;
1015
+ }
1004
1016
  validate14.errors = vErrors;
1005
1017
  return errors === 0;
1006
1018
  }
@@ -18,6 +18,9 @@ declare const _default: {
18
18
  accountRole: {
19
19
  type: string;
20
20
  };
21
+ siteRole: {
22
+ type: string;
23
+ };
21
24
  lang: {
22
25
  type: string;
23
26
  };
package/session/schema.js CHANGED
@@ -18,6 +18,9 @@ export default {
18
18
  accountRole: {
19
19
  type: 'string'
20
20
  },
21
+ siteRole: {
22
+ type: 'string'
23
+ },
21
24
  lang: {
22
25
  type: 'string'
23
26
  },