@data-fair/lib-common-types 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +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 interface Account {
5
+ export type Account = {
6
6
  type: "user" | "organization";
7
7
  id: string;
8
8
  name: string;
@@ -14,7 +14,7 @@ export interface Account {
14
14
  * This interface was referenced by `Account`'s JSON-Schema
15
15
  * via the `definition` "accountKeys".
16
16
  */
17
- export interface AccountKeys {
17
+ export type AccountKeys = {
18
18
  type: "user" | "organization";
19
19
  id: string;
20
20
  department?: string;
package/account/schema.js CHANGED
@@ -1,3 +1,4 @@
1
+ // TODO: remove this, duplicate of session/schema.ts
1
2
  export default {
2
3
  $id: 'https://github.com/data-fair/lib/account',
3
4
  'x-exports': ['types', 'validate'],
@@ -31,7 +31,7 @@ export type Dataset1 = {
31
31
  [k: string]: unknown;
32
32
  } | null;
33
33
 
34
- export interface Application {
34
+ export type Application = {
35
35
  /**
36
36
  * Globally unique identifier of the application
37
37
  */
@@ -62,7 +62,7 @@ export interface Application {
62
62
  };
63
63
  [k: string]: unknown;
64
64
  }
65
- export interface AccountKeys {
65
+ export type AccountKeys = {
66
66
  type: "user" | "organization";
67
67
  id: string;
68
68
  department?: string;
@@ -71,7 +71,7 @@ export interface AccountKeys {
71
71
  * This interface was referenced by `Application`'s JSON-Schema
72
72
  * via the `definition` "field".
73
73
  */
74
- export interface Field {
74
+ export type Field = {
75
75
  key: string;
76
76
  type: string;
77
77
  format?: string;
@@ -12,7 +12,7 @@ export type TopicTitle = string;
12
12
  export type Visibility = "public" | "private";
13
13
  export type ReceptionDate = string;
14
14
 
15
- export interface Event {
15
+ export type Event = {
16
16
  title: Title | InternationalizedTitle;
17
17
  body?: Content | InternationalizedContent;
18
18
  htmlBody?: HTMLContent | InternationalizedHTMLContent;
@@ -29,21 +29,21 @@ export interface Event {
29
29
  [k: string]: unknown;
30
30
  };
31
31
  }
32
- export interface InternationalizedTitle {
32
+ export type InternationalizedTitle = {
33
33
  /**
34
34
  * This interface was referenced by `InternationalizedTitle`'s JSON-Schema definition
35
35
  * via the `patternProperty` ".*".
36
36
  */
37
37
  [k: string]: string;
38
38
  }
39
- export interface InternationalizedContent {
39
+ export type InternationalizedContent = {
40
40
  /**
41
41
  * This interface was referenced by `InternationalizedContent`'s JSON-Schema definition
42
42
  * via the `patternProperty` ".*".
43
43
  */
44
44
  [k: string]: string;
45
45
  }
46
- export interface InternationalizedHTMLContent {
46
+ export type InternationalizedHTMLContent = {
47
47
  /**
48
48
  * This interface was referenced by `InternationalizedHTMLContent`'s JSON-Schema definition
49
49
  * via the `patternProperty` ".*".
@@ -54,7 +54,7 @@ export interface InternationalizedHTMLContent {
54
54
  * This interface was referenced by `Event`'s JSON-Schema
55
55
  * via the `definition` "sender".
56
56
  */
57
- export interface Emitter {
57
+ export type Emitter = {
58
58
  type: Type;
59
59
  /**
60
60
  * The unique id of the user or organization
@@ -81,11 +81,11 @@ export interface Emitter {
81
81
  * This interface was referenced by `Event`'s JSON-Schema
82
82
  * via the `definition` "topicRef".
83
83
  */
84
- export interface TopicRef {
84
+ export type TopicRef = {
85
85
  key: TopicKey;
86
86
  title?: TopicTitle;
87
87
  }
88
- export interface UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl {
88
+ export type UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl = {
89
89
  /**
90
90
  * This interface was referenced by `UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl`'s JSON-Schema definition
91
91
  * via the `patternProperty` ".*".
@@ -16,7 +16,7 @@ export type RecevoirLaNotificationParEmail = "email";
16
16
  export type Sorties = ((RecevoirLaNotificationSurVosAppareilsConfigures | RecevoirLaNotificationParEmail) & string)[];
17
17
  export type CalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams = string;
18
18
 
19
- export interface Notification {
19
+ export type Notification = {
20
20
  origin?: SiteDOrigineDeLaSouscription;
21
21
  title: Titre;
22
22
  body?: Contenu;
@@ -50,7 +50,7 @@ export interface Notification {
50
50
  [k: string]: unknown;
51
51
  };
52
52
  }
53
- export interface Emitter {
53
+ export type Emitter = {
54
54
  type: Type;
55
55
  /**
56
56
  * The unique id of the user or organization
@@ -73,7 +73,7 @@ export interface Emitter {
73
73
  */
74
74
  departmentName?: string;
75
75
  }
76
- export interface TopicRef {
76
+ export type TopicRef = {
77
77
  key: TopicKey;
78
78
  title?: TopicTitle;
79
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,19 +6,22 @@ export type ShortForIgnorePersonalAccount = 1;
6
6
  export type IsTheUserComingFromACoreIDProvider = 1;
7
7
  export type ShortForOrgStorage = 1;
8
8
 
9
- export interface SessionState {
9
+ export type SessionState = {
10
10
  user?: User;
11
11
  organization?: OrganizationMembership;
12
12
  account?: Account;
13
13
  accountRole?: string;
14
- lang?: string;
14
+ lang: string;
15
+ /**
16
+ * @deprecated
17
+ */
15
18
  dark?: boolean;
16
19
  }
17
20
  /**
18
21
  * This interface was referenced by `SessionState`'s JSON-Schema
19
22
  * via the `definition` "user".
20
23
  */
21
- export interface User {
24
+ export type User = {
22
25
  email: string;
23
26
  id: string;
24
27
  name: string;
@@ -36,7 +39,7 @@ export interface User {
36
39
  * This interface was referenced by `SessionState`'s JSON-Schema
37
40
  * via the `definition` "organizationMembership".
38
41
  */
39
- export interface OrganizationMembership {
42
+ export type OrganizationMembership = {
40
43
  id: string;
41
44
  name: string;
42
45
  role: string;
@@ -48,7 +51,7 @@ export interface OrganizationMembership {
48
51
  * This interface was referenced by `SessionState`'s JSON-Schema
49
52
  * via the `definition` "userRef".
50
53
  */
51
- export interface UserRef {
54
+ export type UserRef = {
52
55
  id: string;
53
56
  name: string;
54
57
  }
@@ -56,7 +59,7 @@ export interface UserRef {
56
59
  * This interface was referenced by `SessionState`'s JSON-Schema
57
60
  * via the `definition` "account".
58
61
  */
59
- export interface Account {
62
+ export type Account = {
60
63
  type: "user" | "organization";
61
64
  id: string;
62
65
  name: string;
@@ -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,"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]},"rememberMe":{"type":"integer","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"}}}}};
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]}}},"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 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
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]}}};
@@ -530,9 +530,8 @@ function validate14(data, {instancePath="", parentData, parentDataProperty, root
530
530
  let vErrors = null;
531
531
  let errors = 0;
532
532
  if(data && typeof data == "object" && !Array.isArray(data)){
533
- for(const key0 in data){
534
- if(!((((((key0 === "user") || (key0 === "organization")) || (key0 === "account")) || (key0 === "accountRole")) || (key0 === "lang")) || (key0 === "dark"))){
535
- const err0 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
533
+ if(data.lang === undefined){
534
+ const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lang"},message:"must have required property '"+"lang"+"'"};
536
535
  if(vErrors === null){
537
536
  vErrors = [err0];
538
537
  }
@@ -541,6 +540,17 @@ vErrors.push(err0);
541
540
  }
542
541
  errors++;
543
542
  }
543
+ for(const key0 in data){
544
+ if(!((((((key0 === "user") || (key0 === "organization")) || (key0 === "account")) || (key0 === "accountRole")) || (key0 === "lang")) || (key0 === "dark"))){
545
+ const err1 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
546
+ if(vErrors === null){
547
+ vErrors = [err1];
548
+ }
549
+ else {
550
+ vErrors.push(err1);
551
+ }
552
+ errors++;
553
+ }
544
554
  }
545
555
  if(data.user !== undefined){
546
556
  if(!(validate15(data.user, {instancePath:instancePath+"/user",parentData:data,parentDataProperty:"user",rootData}))){
@@ -552,103 +562,103 @@ if(data.organization !== undefined){
552
562
  let data1 = data.organization;
553
563
  if(data1 && typeof data1 == "object" && !Array.isArray(data1)){
554
564
  if(data1.id === undefined){
555
- const err1 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
565
+ const err2 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
556
566
  if(vErrors === null){
557
- vErrors = [err1];
567
+ vErrors = [err2];
558
568
  }
559
569
  else {
560
- vErrors.push(err1);
570
+ vErrors.push(err2);
561
571
  }
562
572
  errors++;
563
573
  }
564
574
  if(data1.name === undefined){
565
- const err2 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
575
+ const err3 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
566
576
  if(vErrors === null){
567
- vErrors = [err2];
577
+ vErrors = [err3];
568
578
  }
569
579
  else {
570
- vErrors.push(err2);
580
+ vErrors.push(err3);
571
581
  }
572
582
  errors++;
573
583
  }
574
584
  if(data1.role === undefined){
575
- const err3 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "role"},message:"must have required property '"+"role"+"'"};
585
+ const err4 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "role"},message:"must have required property '"+"role"+"'"};
576
586
  if(vErrors === null){
577
- vErrors = [err3];
587
+ vErrors = [err4];
578
588
  }
579
589
  else {
580
- vErrors.push(err3);
590
+ vErrors.push(err4);
581
591
  }
582
592
  errors++;
583
593
  }
584
594
  for(const key1 in data1){
585
595
  if(!((((((key1 === "id") || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName")) || (key1 === "dflt"))){
586
- const err4 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
596
+ const err5 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
587
597
  if(vErrors === null){
588
- vErrors = [err4];
598
+ vErrors = [err5];
589
599
  }
590
600
  else {
591
- vErrors.push(err4);
601
+ vErrors.push(err5);
592
602
  }
593
603
  errors++;
594
604
  }
595
605
  }
596
606
  if(data1.id !== undefined){
597
607
  if(typeof data1.id !== "string"){
598
- const err5 = {instancePath:instancePath+"/organization/id",schemaPath:"#/$defs/organizationMembership/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
608
+ const err6 = {instancePath:instancePath+"/organization/id",schemaPath:"#/$defs/organizationMembership/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
599
609
  if(vErrors === null){
600
- vErrors = [err5];
610
+ vErrors = [err6];
601
611
  }
602
612
  else {
603
- vErrors.push(err5);
613
+ vErrors.push(err6);
604
614
  }
605
615
  errors++;
606
616
  }
607
617
  }
608
618
  if(data1.name !== undefined){
609
619
  if(typeof data1.name !== "string"){
610
- const err6 = {instancePath:instancePath+"/organization/name",schemaPath:"#/$defs/organizationMembership/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
620
+ const err7 = {instancePath:instancePath+"/organization/name",schemaPath:"#/$defs/organizationMembership/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
611
621
  if(vErrors === null){
612
- vErrors = [err6];
622
+ vErrors = [err7];
613
623
  }
614
624
  else {
615
- vErrors.push(err6);
625
+ vErrors.push(err7);
616
626
  }
617
627
  errors++;
618
628
  }
619
629
  }
620
630
  if(data1.role !== undefined){
621
631
  if(typeof data1.role !== "string"){
622
- const err7 = {instancePath:instancePath+"/organization/role",schemaPath:"#/$defs/organizationMembership/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
632
+ const err8 = {instancePath:instancePath+"/organization/role",schemaPath:"#/$defs/organizationMembership/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
623
633
  if(vErrors === null){
624
- vErrors = [err7];
634
+ vErrors = [err8];
625
635
  }
626
636
  else {
627
- vErrors.push(err7);
637
+ vErrors.push(err8);
628
638
  }
629
639
  errors++;
630
640
  }
631
641
  }
632
642
  if(data1.department !== undefined){
633
643
  if(typeof data1.department !== "string"){
634
- const err8 = {instancePath:instancePath+"/organization/department",schemaPath:"#/$defs/organizationMembership/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
644
+ const err9 = {instancePath:instancePath+"/organization/department",schemaPath:"#/$defs/organizationMembership/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
635
645
  if(vErrors === null){
636
- vErrors = [err8];
646
+ vErrors = [err9];
637
647
  }
638
648
  else {
639
- vErrors.push(err8);
649
+ vErrors.push(err9);
640
650
  }
641
651
  errors++;
642
652
  }
643
653
  }
644
654
  if(data1.departmentName !== undefined){
645
655
  if(typeof data1.departmentName !== "string"){
646
- const err9 = {instancePath:instancePath+"/organization/departmentName",schemaPath:"#/$defs/organizationMembership/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
656
+ const err10 = {instancePath:instancePath+"/organization/departmentName",schemaPath:"#/$defs/organizationMembership/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
647
657
  if(vErrors === null){
648
- vErrors = [err9];
658
+ vErrors = [err10];
649
659
  }
650
660
  else {
651
- vErrors.push(err9);
661
+ vErrors.push(err10);
652
662
  }
653
663
  errors++;
654
664
  }
@@ -656,34 +666,34 @@ errors++;
656
666
  if(data1.dflt !== undefined){
657
667
  let data7 = data1.dflt;
658
668
  if(!((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7)))){
659
- const err10 = {instancePath:instancePath+"/organization/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
669
+ const err11 = {instancePath:instancePath+"/organization/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
660
670
  if(vErrors === null){
661
- vErrors = [err10];
671
+ vErrors = [err11];
662
672
  }
663
673
  else {
664
- vErrors.push(err10);
674
+ vErrors.push(err11);
665
675
  }
666
676
  errors++;
667
677
  }
668
678
  if(!(data7 === 1)){
669
- 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"};
679
+ const err12 = {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"};
670
680
  if(vErrors === null){
671
- vErrors = [err11];
681
+ vErrors = [err12];
672
682
  }
673
683
  else {
674
- vErrors.push(err11);
684
+ vErrors.push(err12);
675
685
  }
676
686
  errors++;
677
687
  }
678
688
  }
679
689
  }
680
690
  else {
681
- const err12 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
691
+ const err13 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
682
692
  if(vErrors === null){
683
- vErrors = [err12];
693
+ vErrors = [err13];
684
694
  }
685
695
  else {
686
- vErrors.push(err12);
696
+ vErrors.push(err13);
687
697
  }
688
698
  errors++;
689
699
  }
@@ -692,43 +702,43 @@ if(data.account !== undefined){
692
702
  let data8 = data.account;
693
703
  if(data8 && typeof data8 == "object" && !Array.isArray(data8)){
694
704
  if(data8.type === undefined){
695
- const err13 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
705
+ const err14 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
696
706
  if(vErrors === null){
697
- vErrors = [err13];
707
+ vErrors = [err14];
698
708
  }
699
709
  else {
700
- vErrors.push(err13);
710
+ vErrors.push(err14);
701
711
  }
702
712
  errors++;
703
713
  }
704
714
  if(data8.id === undefined){
705
- const err14 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
715
+ const err15 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
706
716
  if(vErrors === null){
707
- vErrors = [err14];
717
+ vErrors = [err15];
708
718
  }
709
719
  else {
710
- vErrors.push(err14);
720
+ vErrors.push(err15);
711
721
  }
712
722
  errors++;
713
723
  }
714
724
  if(data8.name === undefined){
715
- const err15 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
725
+ const err16 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
716
726
  if(vErrors === null){
717
- vErrors = [err15];
727
+ vErrors = [err16];
718
728
  }
719
729
  else {
720
- vErrors.push(err15);
730
+ vErrors.push(err16);
721
731
  }
722
732
  errors++;
723
733
  }
724
734
  for(const key2 in data8){
725
735
  if(!(((((key2 === "type") || (key2 === "id")) || (key2 === "name")) || (key2 === "department")) || (key2 === "departmentName"))){
726
- const err16 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
736
+ const err17 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
727
737
  if(vErrors === null){
728
- vErrors = [err16];
738
+ vErrors = [err17];
729
739
  }
730
740
  else {
731
- vErrors.push(err16);
741
+ vErrors.push(err17);
732
742
  }
733
743
  errors++;
734
744
  }
@@ -736,130 +746,130 @@ errors++;
736
746
  if(data8.type !== undefined){
737
747
  let data9 = data8.type;
738
748
  if(typeof data9 !== "string"){
739
- const err17 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
749
+ const err18 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
740
750
  if(vErrors === null){
741
- vErrors = [err17];
751
+ vErrors = [err18];
742
752
  }
743
753
  else {
744
- vErrors.push(err17);
754
+ vErrors.push(err18);
745
755
  }
746
756
  errors++;
747
757
  }
748
758
  if(!((data9 === "user") || (data9 === "organization"))){
749
- 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"};
759
+ const err19 = {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"};
750
760
  if(vErrors === null){
751
- vErrors = [err18];
761
+ vErrors = [err19];
752
762
  }
753
763
  else {
754
- vErrors.push(err18);
764
+ vErrors.push(err19);
755
765
  }
756
766
  errors++;
757
767
  }
758
768
  }
759
769
  if(data8.id !== undefined){
760
770
  if(typeof data8.id !== "string"){
761
- const err19 = {instancePath:instancePath+"/account/id",schemaPath:"#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
771
+ const err20 = {instancePath:instancePath+"/account/id",schemaPath:"#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
762
772
  if(vErrors === null){
763
- vErrors = [err19];
773
+ vErrors = [err20];
764
774
  }
765
775
  else {
766
- vErrors.push(err19);
776
+ vErrors.push(err20);
767
777
  }
768
778
  errors++;
769
779
  }
770
780
  }
771
781
  if(data8.name !== undefined){
772
782
  if(typeof data8.name !== "string"){
773
- const err20 = {instancePath:instancePath+"/account/name",schemaPath:"#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
783
+ const err21 = {instancePath:instancePath+"/account/name",schemaPath:"#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
774
784
  if(vErrors === null){
775
- vErrors = [err20];
785
+ vErrors = [err21];
776
786
  }
777
787
  else {
778
- vErrors.push(err20);
788
+ vErrors.push(err21);
779
789
  }
780
790
  errors++;
781
791
  }
782
792
  }
783
793
  if(data8.department !== undefined){
784
794
  if(typeof data8.department !== "string"){
785
- const err21 = {instancePath:instancePath+"/account/department",schemaPath:"#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
795
+ const err22 = {instancePath:instancePath+"/account/department",schemaPath:"#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
786
796
  if(vErrors === null){
787
- vErrors = [err21];
797
+ vErrors = [err22];
788
798
  }
789
799
  else {
790
- vErrors.push(err21);
800
+ vErrors.push(err22);
791
801
  }
792
802
  errors++;
793
803
  }
794
804
  }
795
805
  if(data8.departmentName !== undefined){
796
806
  if(typeof data8.departmentName !== "string"){
797
- const err22 = {instancePath:instancePath+"/account/departmentName",schemaPath:"#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
807
+ const err23 = {instancePath:instancePath+"/account/departmentName",schemaPath:"#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
798
808
  if(vErrors === null){
799
- vErrors = [err22];
809
+ vErrors = [err23];
800
810
  }
801
811
  else {
802
- vErrors.push(err22);
812
+ vErrors.push(err23);
803
813
  }
804
814
  errors++;
805
815
  }
806
816
  }
807
817
  }
808
818
  else {
809
- const err23 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
819
+ const err24 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
810
820
  if(vErrors === null){
811
- vErrors = [err23];
821
+ vErrors = [err24];
812
822
  }
813
823
  else {
814
- vErrors.push(err23);
824
+ vErrors.push(err24);
815
825
  }
816
826
  errors++;
817
827
  }
818
828
  }
819
829
  if(data.accountRole !== undefined){
820
830
  if(typeof data.accountRole !== "string"){
821
- const err24 = {instancePath:instancePath+"/accountRole",schemaPath:"#/properties/accountRole/type",keyword:"type",params:{type: "string"},message:"must be string"};
831
+ const err25 = {instancePath:instancePath+"/accountRole",schemaPath:"#/properties/accountRole/type",keyword:"type",params:{type: "string"},message:"must be string"};
822
832
  if(vErrors === null){
823
- vErrors = [err24];
833
+ vErrors = [err25];
824
834
  }
825
835
  else {
826
- vErrors.push(err24);
836
+ vErrors.push(err25);
827
837
  }
828
838
  errors++;
829
839
  }
830
840
  }
831
841
  if(data.lang !== undefined){
832
842
  if(typeof data.lang !== "string"){
833
- const err25 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
843
+ const err26 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
834
844
  if(vErrors === null){
835
- vErrors = [err25];
845
+ vErrors = [err26];
836
846
  }
837
847
  else {
838
- vErrors.push(err25);
848
+ vErrors.push(err26);
839
849
  }
840
850
  errors++;
841
851
  }
842
852
  }
843
853
  if(data.dark !== undefined){
844
854
  if(typeof data.dark !== "boolean"){
845
- const err26 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
855
+ const err27 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
846
856
  if(vErrors === null){
847
- vErrors = [err26];
857
+ vErrors = [err27];
848
858
  }
849
859
  else {
850
- vErrors.push(err26);
860
+ vErrors.push(err27);
851
861
  }
852
862
  errors++;
853
863
  }
854
864
  }
855
865
  }
856
866
  else {
857
- const err27 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
867
+ const err28 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
858
868
  if(vErrors === null){
859
- vErrors = [err27];
869
+ vErrors = [err28];
860
870
  }
861
871
  else {
862
- vErrors.push(err27);
872
+ vErrors.push(err28);
863
873
  }
864
874
  errors++;
865
875
  }
@@ -1,5 +1,5 @@
1
- import type { AccountKeys } from '../account/index.js';
2
- import { type SessionState } from './.type/index.js';
1
+ import { type SessionState, type Account } from './.type/index.js';
2
+ export type AccountKeys = Pick<Account, 'type' | 'id' | 'department'>;
3
3
  export type SessionStateAuthenticated = SessionState & Required<Pick<SessionState, 'user' | 'account' | 'accountRole'>>;
4
4
  export * from './.type/index.js';
5
5
  export declare function isAuthenticated(sessionState: SessionState): sessionState is SessionStateAuthenticated;
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  type: string;
5
5
  title: string;
6
6
  additionalProperties: boolean;
7
+ required: string[];
7
8
  properties: {
8
9
  user: {
9
10
  $ref: string;
@@ -21,6 +22,7 @@ declare const _default: {
21
22
  type: string;
22
23
  };
23
24
  dark: {
25
+ deprecated: boolean;
24
26
  type: string;
25
27
  };
26
28
  };
package/session/schema.js CHANGED
@@ -4,6 +4,7 @@ export default {
4
4
  type: 'object',
5
5
  title: 'session state',
6
6
  additionalProperties: false,
7
+ required: ['lang'],
7
8
  properties: {
8
9
  user: {
9
10
  $ref: '#/$defs/user'
@@ -21,6 +22,7 @@ export default {
21
22
  type: 'string'
22
23
  },
23
24
  dark: {
25
+ deprecated: true,
24
26
  type: 'boolean'
25
27
  }
26
28
  },
@@ -1,2 +0,0 @@
1
- import { type SessionState } from './.type/index.js'
2
- export type SessionStateAuthenticated = SessionState & Required<Pick<SessionState, 'user' | 'account' | 'accountRole'>>
package/session/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {}
2
- // # sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=