@data-fair/lib-common-types 1.4.1 → 1.5.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.
@@ -7,8 +7,8 @@ export type Content = string;
7
7
  export type HTMLContent = string;
8
8
  export type URLOfEventIcon = string;
9
9
  export type Type = "user" | "organization";
10
- export type CleDuSujet = string;
11
- export type LibelleDuSujet = string;
10
+ export type TopicKey = string;
11
+ export type TopicTitle = string;
12
12
  export type Visibility = "public" | "private";
13
13
  export type ReceptionDate = string;
14
14
 
@@ -18,10 +18,7 @@ export interface Event {
18
18
  htmlBody?: HTMLContent | InternationalizedHTMLContent;
19
19
  icon?: URLOfEventIcon;
20
20
  sender: Emitter;
21
- topic: {
22
- key: CleDuSujet;
23
- title?: LibelleDuSujet;
24
- };
21
+ topic: TopicRef;
25
22
  urlParams?: UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl;
26
23
  visibility?: Visibility;
27
24
  date: ReceptionDate;
@@ -53,6 +50,10 @@ export interface InternationalizedHTMLContent {
53
50
  */
54
51
  [k: string]: string;
55
52
  }
53
+ /**
54
+ * This interface was referenced by `Event`'s JSON-Schema
55
+ * via the `definition` "sender".
56
+ */
56
57
  export interface Emitter {
57
58
  type: Type;
58
59
  /**
@@ -64,7 +65,6 @@ export interface Emitter {
64
65
  */
65
66
  name: string;
66
67
  /**
67
- * @deprecated
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
  */
70
70
  role?: string;
@@ -77,6 +77,14 @@ export interface Emitter {
77
77
  */
78
78
  departmentName?: string;
79
79
  }
80
+ /**
81
+ * This interface was referenced by `Event`'s JSON-Schema
82
+ * via the `definition` "topicRef".
83
+ */
84
+ export interface TopicRef {
85
+ key: TopicKey;
86
+ title?: TopicTitle;
87
+ }
80
88
  export interface UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl {
81
89
  /**
82
90
  * This interface was referenced by `UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl`'s JSON-Schema definition
@@ -84,32 +92,4 @@ export interface UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl {
84
92
  */
85
93
  [k: string]: string;
86
94
  }
87
- /**
88
- * This interface was referenced by `Event`'s JSON-Schema
89
- * via the `definition` "sender".
90
- */
91
- export interface Proprietaire {
92
- type: Type;
93
- /**
94
- * The unique id of the user or organization
95
- */
96
- id: string;
97
- /**
98
- * The display name of the user or organization
99
- */
100
- name: string;
101
- /**
102
- * @deprecated
103
- * If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
104
- */
105
- role?: string;
106
- /**
107
- * If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department
108
- */
109
- department?: string;
110
- /**
111
- * The display name of the department
112
- */
113
- departmentName?: string;
114
- }
115
95
 
package/event/schema.d.ts CHANGED
@@ -54,22 +54,9 @@ declare const _default: {
54
54
  };
55
55
  sender: {
56
56
  $ref: string;
57
- title: string;
58
57
  };
59
58
  topic: {
60
- type: string;
61
- additionalProperties: boolean;
62
- required: string[];
63
- properties: {
64
- key: {
65
- type: string;
66
- title: string;
67
- };
68
- title: {
69
- type: string;
70
- title: string;
71
- };
72
- };
59
+ $ref: string;
73
60
  };
74
61
  urlParams: {
75
62
  type: string;
@@ -118,7 +105,6 @@ declare const _default: {
118
105
  };
119
106
  role: {
120
107
  type: string;
121
- deprecated: boolean;
122
108
  description: string;
123
109
  };
124
110
  department: {
@@ -131,6 +117,21 @@ declare const _default: {
131
117
  };
132
118
  };
133
119
  };
120
+ topicRef: {
121
+ type: string;
122
+ additionalProperties: boolean;
123
+ required: string[];
124
+ properties: {
125
+ key: {
126
+ type: string;
127
+ title: string;
128
+ };
129
+ title: {
130
+ type: string;
131
+ title: string;
132
+ };
133
+ };
134
+ };
134
135
  };
135
136
  };
136
137
  export default _default;
package/event/schema.js CHANGED
@@ -37,22 +37,8 @@ export default {
37
37
  title: 'URL of event icon'
38
38
  },
39
39
  // sender is the owner of the topic
40
- sender: { $ref: '#/$defs/sender', title: 'Emitter' },
41
- topic: {
42
- type: 'object',
43
- additionalProperties: false,
44
- required: ['key'],
45
- properties: {
46
- key: {
47
- type: 'string',
48
- title: 'Clé du sujet'
49
- },
50
- title: {
51
- type: 'string',
52
- title: 'Libellé du sujet'
53
- }
54
- }
55
- },
40
+ sender: { $ref: '#/$defs/sender' },
41
+ topic: { $ref: '#/$defs/topicRef' },
56
42
  urlParams: {
57
43
  type: 'object',
58
44
  title: 'used to fill subscription.urlTemplate and so create notification.url',
@@ -79,7 +65,7 @@ export default {
79
65
  $defs: {
80
66
  sender: {
81
67
  type: 'object',
82
- title: 'Propriétaire',
68
+ title: 'Emitter',
83
69
  additionalProperties: false,
84
70
  required: ['type', 'id', 'name'],
85
71
  properties: {
@@ -98,7 +84,6 @@ export default {
98
84
  },
99
85
  role: {
100
86
  type: 'string',
101
- deprecated: true,
102
87
  description: 'If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role'
103
88
  },
104
89
  department: {
@@ -110,6 +95,21 @@ export default {
110
95
  description: 'The display name of the department'
111
96
  }
112
97
  }
98
+ },
99
+ topicRef: {
100
+ type: 'object',
101
+ additionalProperties: false,
102
+ required: ['key'],
103
+ properties: {
104
+ key: {
105
+ type: 'string',
106
+ title: 'Topic key'
107
+ },
108
+ title: {
109
+ type: 'string',
110
+ title: 'Topic title'
111
+ }
112
+ }
113
113
  }
114
114
  }
115
115
  }
@@ -0,0 +1,87 @@
1
+
2
+ export const schemaExports: string[]
3
+
4
+ // see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
5
+ export type Identifiant = string;
6
+ export type SiteDOrigineDeLaSouscription = string;
7
+ export type Titre = string;
8
+ export type Contenu = string;
9
+ export type ContenuHTML = string;
10
+ export type LangueDeLaNotification = "fr" | "en";
11
+ export type URLDeLIconeDeLaNotification = string;
12
+ export type Type = "user" | "organization";
13
+ export type TopicKey = string;
14
+ export type TopicTitle = string;
15
+ export type RecevoirLaNotificationSurVosAppareilsConfigures = "devices";
16
+ export type RecevoirLaNotificationParEmail = "email";
17
+ export type Sorties = ((RecevoirLaNotificationSurVosAppareilsConfigures | RecevoirLaNotificationParEmail) & string)[];
18
+ export type CalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams = string;
19
+
20
+ export interface Notification {
21
+ _id: Identifiant;
22
+ origin?: SiteDOrigineDeLaSouscription;
23
+ title: Titre;
24
+ body?: Contenu;
25
+ htmlBody?: ContenuHTML;
26
+ locale?: LangueDeLaNotification;
27
+ icon?: URLDeLIconeDeLaNotification;
28
+ sender: Emitter;
29
+ topic: TopicRef;
30
+ recipient: {
31
+ /**
32
+ * The unique id of the user
33
+ */
34
+ id: string;
35
+ /**
36
+ * The display name of the user
37
+ */
38
+ name?: string;
39
+ [k: string]: unknown;
40
+ };
41
+ outputs?: Sorties;
42
+ url?: CalculeAPartirDeSubscriptionUrlTemplateEtEventUrlParams;
43
+ /**
44
+ * reception date
45
+ */
46
+ date: string;
47
+ new?: boolean;
48
+ /**
49
+ * propriétés libres qui varient en fonction du type de notification
50
+ */
51
+ extra?: {
52
+ [k: string]: unknown;
53
+ };
54
+ }
55
+ export interface Emitter {
56
+ type: Type;
57
+ /**
58
+ * The unique id of the user or organization
59
+ */
60
+ id: string;
61
+ /**
62
+ * The display name of the user or organization
63
+ */
64
+ name: string;
65
+ /**
66
+ * If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
67
+ */
68
+ role?: string;
69
+ /**
70
+ * If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department
71
+ */
72
+ department?: string;
73
+ /**
74
+ * The display name of the department
75
+ */
76
+ departmentName?: string;
77
+ }
78
+ export interface TopicRef {
79
+ key: TopicKey;
80
+ title?: TopicTitle;
81
+ }
82
+
83
+
84
+ export declare function validate(data: any): data is Notification
85
+ export declare function assertValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): asserts data is Notification
86
+ export declare function returnValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): Notification
87
+
@@ -0,0 +1,19 @@
1
+ /* eslint-disable */
2
+
3
+
4
+ import validate from './validate.js'
5
+ import { assertValid as assertValidGeneric } from '@data-fair/lib-node/validation.js'
6
+
7
+ export const schemaExports = [
8
+ "types",
9
+ "validate"
10
+ ]
11
+
12
+ export { validate } from './validate.js'
13
+ export function assertValid(data, options) {
14
+ assertValidGeneric(validate, data, options)
15
+ }
16
+ export function returnValid(data, options) {
17
+ assertValid(data, options)
18
+ return data
19
+ }
@@ -0,0 +1,602 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+
4
+ import { fullFormats } from "ajv-formats/dist/formats.js";
5
+ "use strict";
6
+ export const validate = validate14;
7
+ export default validate14;
8
+ const schema16 = {"$id":"https://github.com/data-fair/lib/notification","x-exports":["types","validate"],"title":"Notification","type":"object","additionalProperties":false,"required":["_id","title","topic","sender","recipient","date"],"properties":{"_id":{"type":"string","title":"Identifiant","readOnly":true},"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","name"],"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
+ const schema19 = {"type":"object","additionalProperties":false,"required":["key"],"properties":{"key":{"type":"string","title":"Topic key"},"title":{"type":"string","title":"Topic title"}}};
11
+ const func2 = Object.prototype.hasOwnProperty;
12
+ const formats0 = fullFormats["date-time"];
13
+
14
+ function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
15
+ /*# sourceURL="https://github.com/data-fair/lib/notification" */;
16
+ let vErrors = null;
17
+ let errors = 0;
18
+ if(data && typeof data == "object" && !Array.isArray(data)){
19
+ if(data._id === undefined){
20
+ const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "_id"},message:"must have required property '"+"_id"+"'"};
21
+ if(vErrors === null){
22
+ vErrors = [err0];
23
+ }
24
+ else {
25
+ vErrors.push(err0);
26
+ }
27
+ errors++;
28
+ }
29
+ if(data.title === undefined){
30
+ const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};
31
+ if(vErrors === null){
32
+ vErrors = [err1];
33
+ }
34
+ else {
35
+ vErrors.push(err1);
36
+ }
37
+ errors++;
38
+ }
39
+ if(data.topic === undefined){
40
+ const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "topic"},message:"must have required property '"+"topic"+"'"};
41
+ if(vErrors === null){
42
+ vErrors = [err2];
43
+ }
44
+ else {
45
+ vErrors.push(err2);
46
+ }
47
+ errors++;
48
+ }
49
+ if(data.sender === undefined){
50
+ const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sender"},message:"must have required property '"+"sender"+"'"};
51
+ if(vErrors === null){
52
+ vErrors = [err3];
53
+ }
54
+ else {
55
+ vErrors.push(err3);
56
+ }
57
+ errors++;
58
+ }
59
+ if(data.recipient === undefined){
60
+ const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "recipient"},message:"must have required property '"+"recipient"+"'"};
61
+ if(vErrors === null){
62
+ vErrors = [err4];
63
+ }
64
+ else {
65
+ vErrors.push(err4);
66
+ }
67
+ errors++;
68
+ }
69
+ if(data.date === undefined){
70
+ const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "date"},message:"must have required property '"+"date"+"'"};
71
+ if(vErrors === null){
72
+ vErrors = [err5];
73
+ }
74
+ else {
75
+ vErrors.push(err5);
76
+ }
77
+ errors++;
78
+ }
79
+ for(const key0 in data){
80
+ if(!(func2.call(schema16.properties, key0))){
81
+ const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
82
+ if(vErrors === null){
83
+ vErrors = [err6];
84
+ }
85
+ else {
86
+ vErrors.push(err6);
87
+ }
88
+ errors++;
89
+ }
90
+ }
91
+ if(data._id !== undefined){
92
+ if(typeof data._id !== "string"){
93
+ const err7 = {instancePath:instancePath+"/_id",schemaPath:"#/properties/_id/type",keyword:"type",params:{type: "string"},message:"must be string"};
94
+ if(vErrors === null){
95
+ vErrors = [err7];
96
+ }
97
+ else {
98
+ vErrors.push(err7);
99
+ }
100
+ errors++;
101
+ }
102
+ }
103
+ if(data.origin !== undefined){
104
+ if(typeof data.origin !== "string"){
105
+ const err8 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/type",keyword:"type",params:{type: "string"},message:"must be string"};
106
+ if(vErrors === null){
107
+ vErrors = [err8];
108
+ }
109
+ else {
110
+ vErrors.push(err8);
111
+ }
112
+ errors++;
113
+ }
114
+ }
115
+ if(data.title !== undefined){
116
+ if(typeof data.title !== "string"){
117
+ const err9 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};
118
+ if(vErrors === null){
119
+ vErrors = [err9];
120
+ }
121
+ else {
122
+ vErrors.push(err9);
123
+ }
124
+ errors++;
125
+ }
126
+ }
127
+ if(data.body !== undefined){
128
+ if(typeof data.body !== "string"){
129
+ const err10 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/type",keyword:"type",params:{type: "string"},message:"must be string"};
130
+ if(vErrors === null){
131
+ vErrors = [err10];
132
+ }
133
+ else {
134
+ vErrors.push(err10);
135
+ }
136
+ errors++;
137
+ }
138
+ }
139
+ if(data.htmlBody !== undefined){
140
+ if(typeof data.htmlBody !== "string"){
141
+ const err11 = {instancePath:instancePath+"/htmlBody",schemaPath:"#/properties/htmlBody/type",keyword:"type",params:{type: "string"},message:"must be string"};
142
+ if(vErrors === null){
143
+ vErrors = [err11];
144
+ }
145
+ else {
146
+ vErrors.push(err11);
147
+ }
148
+ errors++;
149
+ }
150
+ }
151
+ if(data.locale !== undefined){
152
+ let data5 = data.locale;
153
+ if(typeof data5 !== "string"){
154
+ const err12 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};
155
+ if(vErrors === null){
156
+ vErrors = [err12];
157
+ }
158
+ else {
159
+ vErrors.push(err12);
160
+ }
161
+ errors++;
162
+ }
163
+ if(!((data5 === "fr") || (data5 === "en"))){
164
+ const err13 = {instancePath:instancePath+"/locale",schemaPath:"#/properties/locale/enum",keyword:"enum",params:{allowedValues: schema16.properties.locale.enum},message:"must be equal to one of the allowed values"};
165
+ if(vErrors === null){
166
+ vErrors = [err13];
167
+ }
168
+ else {
169
+ vErrors.push(err13);
170
+ }
171
+ errors++;
172
+ }
173
+ }
174
+ if(data.icon !== undefined){
175
+ if(typeof data.icon !== "string"){
176
+ const err14 = {instancePath:instancePath+"/icon",schemaPath:"#/properties/icon/type",keyword:"type",params:{type: "string"},message:"must be string"};
177
+ if(vErrors === null){
178
+ vErrors = [err14];
179
+ }
180
+ else {
181
+ vErrors.push(err14);
182
+ }
183
+ errors++;
184
+ }
185
+ }
186
+ if(data.sender !== undefined){
187
+ let data7 = data.sender;
188
+ if(data7 && typeof data7 == "object" && !Array.isArray(data7)){
189
+ if(data7.type === undefined){
190
+ const err15 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
191
+ if(vErrors === null){
192
+ vErrors = [err15];
193
+ }
194
+ else {
195
+ vErrors.push(err15);
196
+ }
197
+ errors++;
198
+ }
199
+ if(data7.id === undefined){
200
+ const err16 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
201
+ if(vErrors === null){
202
+ vErrors = [err16];
203
+ }
204
+ else {
205
+ vErrors.push(err16);
206
+ }
207
+ errors++;
208
+ }
209
+ if(data7.name === undefined){
210
+ const err17 = {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"+"'"};
211
+ if(vErrors === null){
212
+ vErrors = [err17];
213
+ }
214
+ else {
215
+ vErrors.push(err17);
216
+ }
217
+ errors++;
218
+ }
219
+ for(const key1 in data7){
220
+ if(!((((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName"))){
221
+ const err18 = {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"};
222
+ if(vErrors === null){
223
+ vErrors = [err18];
224
+ }
225
+ else {
226
+ vErrors.push(err18);
227
+ }
228
+ errors++;
229
+ }
230
+ }
231
+ if(data7.type !== undefined){
232
+ let data8 = data7.type;
233
+ if(typeof data8 !== "string"){
234
+ const err19 = {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"};
235
+ if(vErrors === null){
236
+ vErrors = [err19];
237
+ }
238
+ else {
239
+ vErrors.push(err19);
240
+ }
241
+ errors++;
242
+ }
243
+ if(!((data8 === "user") || (data8 === "organization"))){
244
+ const err20 = {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"};
245
+ if(vErrors === null){
246
+ vErrors = [err20];
247
+ }
248
+ else {
249
+ vErrors.push(err20);
250
+ }
251
+ errors++;
252
+ }
253
+ }
254
+ if(data7.id !== undefined){
255
+ if(typeof data7.id !== "string"){
256
+ const err21 = {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"};
257
+ if(vErrors === null){
258
+ vErrors = [err21];
259
+ }
260
+ else {
261
+ vErrors.push(err21);
262
+ }
263
+ errors++;
264
+ }
265
+ }
266
+ if(data7.name !== undefined){
267
+ if(typeof data7.name !== "string"){
268
+ const err22 = {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"};
269
+ if(vErrors === null){
270
+ vErrors = [err22];
271
+ }
272
+ else {
273
+ vErrors.push(err22);
274
+ }
275
+ errors++;
276
+ }
277
+ }
278
+ if(data7.role !== undefined){
279
+ if(typeof data7.role !== "string"){
280
+ const err23 = {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"};
281
+ if(vErrors === null){
282
+ vErrors = [err23];
283
+ }
284
+ else {
285
+ vErrors.push(err23);
286
+ }
287
+ errors++;
288
+ }
289
+ }
290
+ if(data7.department !== undefined){
291
+ if(typeof data7.department !== "string"){
292
+ const err24 = {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"};
293
+ if(vErrors === null){
294
+ vErrors = [err24];
295
+ }
296
+ else {
297
+ vErrors.push(err24);
298
+ }
299
+ errors++;
300
+ }
301
+ }
302
+ if(data7.departmentName !== undefined){
303
+ if(typeof data7.departmentName !== "string"){
304
+ const err25 = {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"};
305
+ if(vErrors === null){
306
+ vErrors = [err25];
307
+ }
308
+ else {
309
+ vErrors.push(err25);
310
+ }
311
+ errors++;
312
+ }
313
+ }
314
+ }
315
+ else {
316
+ const err26 = {instancePath:instancePath+"/sender",schemaPath:"https://github.com/data-fair/lib/event#/$defs/sender/type",keyword:"type",params:{type: "object"},message:"must be object"};
317
+ if(vErrors === null){
318
+ vErrors = [err26];
319
+ }
320
+ else {
321
+ vErrors.push(err26);
322
+ }
323
+ errors++;
324
+ }
325
+ }
326
+ if(data.topic !== undefined){
327
+ let data14 = data.topic;
328
+ if(data14 && typeof data14 == "object" && !Array.isArray(data14)){
329
+ if(data14.key === undefined){
330
+ const err27 = {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"+"'"};
331
+ if(vErrors === null){
332
+ vErrors = [err27];
333
+ }
334
+ else {
335
+ vErrors.push(err27);
336
+ }
337
+ errors++;
338
+ }
339
+ for(const key2 in data14){
340
+ if(!((key2 === "key") || (key2 === "title"))){
341
+ const err28 = {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"};
342
+ if(vErrors === null){
343
+ vErrors = [err28];
344
+ }
345
+ else {
346
+ vErrors.push(err28);
347
+ }
348
+ errors++;
349
+ }
350
+ }
351
+ if(data14.key !== undefined){
352
+ if(typeof data14.key !== "string"){
353
+ const err29 = {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"};
354
+ if(vErrors === null){
355
+ vErrors = [err29];
356
+ }
357
+ else {
358
+ vErrors.push(err29);
359
+ }
360
+ errors++;
361
+ }
362
+ }
363
+ if(data14.title !== undefined){
364
+ if(typeof data14.title !== "string"){
365
+ const err30 = {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"};
366
+ if(vErrors === null){
367
+ vErrors = [err30];
368
+ }
369
+ else {
370
+ vErrors.push(err30);
371
+ }
372
+ errors++;
373
+ }
374
+ }
375
+ }
376
+ else {
377
+ const err31 = {instancePath:instancePath+"/topic",schemaPath:"https://github.com/data-fair/lib/event#/$defs/topicRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
378
+ if(vErrors === null){
379
+ vErrors = [err31];
380
+ }
381
+ else {
382
+ vErrors.push(err31);
383
+ }
384
+ errors++;
385
+ }
386
+ }
387
+ if(data.recipient !== undefined){
388
+ let data17 = data.recipient;
389
+ if(data17 && typeof data17 == "object" && !Array.isArray(data17)){
390
+ if(data17.id === undefined){
391
+ const err32 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
392
+ if(vErrors === null){
393
+ vErrors = [err32];
394
+ }
395
+ else {
396
+ vErrors.push(err32);
397
+ }
398
+ errors++;
399
+ }
400
+ if(data17.id !== undefined){
401
+ if(typeof data17.id !== "string"){
402
+ const err33 = {instancePath:instancePath+"/recipient/id",schemaPath:"#/properties/recipient/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
403
+ if(vErrors === null){
404
+ vErrors = [err33];
405
+ }
406
+ else {
407
+ vErrors.push(err33);
408
+ }
409
+ errors++;
410
+ }
411
+ }
412
+ if(data17.name !== undefined){
413
+ if(typeof data17.name !== "string"){
414
+ const err34 = {instancePath:instancePath+"/recipient/name",schemaPath:"#/properties/recipient/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
415
+ if(vErrors === null){
416
+ vErrors = [err34];
417
+ }
418
+ else {
419
+ vErrors.push(err34);
420
+ }
421
+ errors++;
422
+ }
423
+ }
424
+ }
425
+ else {
426
+ const err35 = {instancePath:instancePath+"/recipient",schemaPath:"#/properties/recipient/type",keyword:"type",params:{type: "object"},message:"must be object"};
427
+ if(vErrors === null){
428
+ vErrors = [err35];
429
+ }
430
+ else {
431
+ vErrors.push(err35);
432
+ }
433
+ errors++;
434
+ }
435
+ }
436
+ if(data.outputs !== undefined){
437
+ let data20 = data.outputs;
438
+ if(Array.isArray(data20)){
439
+ const len0 = data20.length;
440
+ for(let i0=0; i0<len0; i0++){
441
+ let data21 = data20[i0];
442
+ if(typeof data21 !== "string"){
443
+ const err36 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
444
+ if(vErrors === null){
445
+ vErrors = [err36];
446
+ }
447
+ else {
448
+ vErrors.push(err36);
449
+ }
450
+ errors++;
451
+ }
452
+ const _errs50 = errors;
453
+ let valid8 = false;
454
+ let passing0 = null;
455
+ const _errs51 = errors;
456
+ if("devices" !== data21){
457
+ const err37 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/0/const",keyword:"const",params:{allowedValue: "devices"},message:"must be equal to constant"};
458
+ if(vErrors === null){
459
+ vErrors = [err37];
460
+ }
461
+ else {
462
+ vErrors.push(err37);
463
+ }
464
+ errors++;
465
+ }
466
+ var _valid0 = _errs51 === errors;
467
+ if(_valid0){
468
+ valid8 = true;
469
+ passing0 = 0;
470
+ }
471
+ const _errs52 = errors;
472
+ if("email" !== data21){
473
+ const err38 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf/1/const",keyword:"const",params:{allowedValue: "email"},message:"must be equal to constant"};
474
+ if(vErrors === null){
475
+ vErrors = [err38];
476
+ }
477
+ else {
478
+ vErrors.push(err38);
479
+ }
480
+ errors++;
481
+ }
482
+ var _valid0 = _errs52 === errors;
483
+ if(_valid0 && valid8){
484
+ valid8 = false;
485
+ passing0 = [passing0, 1];
486
+ }
487
+ else {
488
+ if(_valid0){
489
+ valid8 = true;
490
+ passing0 = 1;
491
+ }
492
+ }
493
+ if(!valid8){
494
+ const err39 = {instancePath:instancePath+"/outputs/" + i0,schemaPath:"#/properties/outputs/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
495
+ if(vErrors === null){
496
+ vErrors = [err39];
497
+ }
498
+ else {
499
+ vErrors.push(err39);
500
+ }
501
+ errors++;
502
+ }
503
+ else {
504
+ errors = _errs50;
505
+ if(vErrors !== null){
506
+ if(_errs50){
507
+ vErrors.length = _errs50;
508
+ }
509
+ else {
510
+ vErrors = null;
511
+ }
512
+ }
513
+ }
514
+ }
515
+ }
516
+ else {
517
+ const err40 = {instancePath:instancePath+"/outputs",schemaPath:"#/properties/outputs/type",keyword:"type",params:{type: "array"},message:"must be array"};
518
+ if(vErrors === null){
519
+ vErrors = [err40];
520
+ }
521
+ else {
522
+ vErrors.push(err40);
523
+ }
524
+ errors++;
525
+ }
526
+ }
527
+ if(data.url !== undefined){
528
+ if(typeof data.url !== "string"){
529
+ const err41 = {instancePath:instancePath+"/url",schemaPath:"#/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};
530
+ if(vErrors === null){
531
+ vErrors = [err41];
532
+ }
533
+ else {
534
+ vErrors.push(err41);
535
+ }
536
+ errors++;
537
+ }
538
+ }
539
+ if(data.date !== undefined){
540
+ let data23 = data.date;
541
+ if(typeof data23 === "string"){
542
+ if(!(formats0.validate(data23))){
543
+ const err42 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
544
+ if(vErrors === null){
545
+ vErrors = [err42];
546
+ }
547
+ else {
548
+ vErrors.push(err42);
549
+ }
550
+ errors++;
551
+ }
552
+ }
553
+ else {
554
+ const err43 = {instancePath:instancePath+"/date",schemaPath:"#/properties/date/type",keyword:"type",params:{type: "string"},message:"must be string"};
555
+ if(vErrors === null){
556
+ vErrors = [err43];
557
+ }
558
+ else {
559
+ vErrors.push(err43);
560
+ }
561
+ errors++;
562
+ }
563
+ }
564
+ if(data.new !== undefined){
565
+ if(typeof data.new !== "boolean"){
566
+ const err44 = {instancePath:instancePath+"/new",schemaPath:"#/properties/new/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
567
+ if(vErrors === null){
568
+ vErrors = [err44];
569
+ }
570
+ else {
571
+ vErrors.push(err44);
572
+ }
573
+ errors++;
574
+ }
575
+ }
576
+ if(data.extra !== undefined){
577
+ let data25 = data.extra;
578
+ if(!(data25 && typeof data25 == "object" && !Array.isArray(data25))){
579
+ const err45 = {instancePath:instancePath+"/extra",schemaPath:"#/properties/extra/type",keyword:"type",params:{type: "object"},message:"must be object"};
580
+ if(vErrors === null){
581
+ vErrors = [err45];
582
+ }
583
+ else {
584
+ vErrors.push(err45);
585
+ }
586
+ errors++;
587
+ }
588
+ }
589
+ }
590
+ else {
591
+ const err46 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
592
+ if(vErrors === null){
593
+ vErrors = [err46];
594
+ }
595
+ else {
596
+ vErrors.push(err46);
597
+ }
598
+ errors++;
599
+ }
600
+ validate14.errors = vErrors;
601
+ return errors === 0;
602
+ }
@@ -0,0 +1 @@
1
+ export * from './.type/index.js';
@@ -0,0 +1 @@
1
+ export * from './.type/index.js'
@@ -0,0 +1,93 @@
1
+ declare const _default: {
2
+ $id: string;
3
+ 'x-exports': string[];
4
+ title: string;
5
+ type: string;
6
+ additionalProperties: boolean;
7
+ required: string[];
8
+ properties: {
9
+ _id: {
10
+ type: string;
11
+ title: string;
12
+ readOnly: boolean;
13
+ };
14
+ origin: {
15
+ type: string;
16
+ title: string;
17
+ readOnly: boolean;
18
+ };
19
+ title: {
20
+ type: string;
21
+ title: string;
22
+ };
23
+ body: {
24
+ type: string;
25
+ title: string;
26
+ };
27
+ htmlBody: {
28
+ type: string;
29
+ title: string;
30
+ };
31
+ locale: {
32
+ type: string;
33
+ title: string;
34
+ enum: string[];
35
+ };
36
+ icon: {
37
+ type: string;
38
+ title: string;
39
+ };
40
+ sender: {
41
+ $ref: string;
42
+ };
43
+ topic: {
44
+ $ref: string;
45
+ };
46
+ recipient: {
47
+ type: string;
48
+ required: string[];
49
+ readOnly: boolean;
50
+ properties: {
51
+ id: {
52
+ type: string;
53
+ description: string;
54
+ };
55
+ name: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ };
60
+ };
61
+ outputs: {
62
+ type: string;
63
+ title: string;
64
+ items: {
65
+ type: string;
66
+ oneOf: {
67
+ const: string;
68
+ title: string;
69
+ }[];
70
+ };
71
+ };
72
+ url: {
73
+ type: string;
74
+ title: string;
75
+ readOnly: boolean;
76
+ };
77
+ date: {
78
+ readOnly: boolean;
79
+ type: string;
80
+ description: string;
81
+ format: string;
82
+ };
83
+ new: {
84
+ readOnly: boolean;
85
+ type: string;
86
+ };
87
+ extra: {
88
+ type: string;
89
+ description: string;
90
+ };
91
+ };
92
+ };
93
+ export default _default;
@@ -0,0 +1,92 @@
1
+ export default {
2
+ $id: 'https://github.com/data-fair/lib/notification',
3
+ 'x-exports': ['types', 'validate'],
4
+ title: 'Notification',
5
+ type: 'object',
6
+ additionalProperties: false,
7
+ required: ['_id', 'title', 'topic', 'sender', 'recipient', 'date'],
8
+ properties: {
9
+ _id: {
10
+ type: 'string',
11
+ title: 'Identifiant',
12
+ readOnly: true
13
+ },
14
+ origin: {
15
+ type: 'string',
16
+ title: 'Site d\'origine de la souscription',
17
+ readOnly: true
18
+ },
19
+ title: {
20
+ type: 'string',
21
+ title: 'Titre'
22
+ },
23
+ body: {
24
+ type: 'string',
25
+ title: 'Contenu'
26
+ },
27
+ htmlBody: {
28
+ type: 'string',
29
+ title: 'Contenu HTML'
30
+ },
31
+ locale: {
32
+ type: 'string',
33
+ title: 'Langue de la notification',
34
+ enum: ['fr', 'en']
35
+ },
36
+ icon: {
37
+ type: 'string',
38
+ title: 'URL de l\'icone de la notification'
39
+ },
40
+ // sender is the owner of the topic
41
+ sender: { $ref: 'https://github.com/data-fair/lib/event#/$defs/sender' },
42
+ topic: { $ref: 'https://github.com/data-fair/lib/event#/$defs/topicRef' },
43
+ recipient: {
44
+ type: 'object',
45
+ required: ['id'],
46
+ readOnly: true,
47
+ properties: {
48
+ id: {
49
+ type: 'string',
50
+ description: 'The unique id of the user'
51
+ },
52
+ name: {
53
+ type: 'string',
54
+ description: 'The display name of the user'
55
+ }
56
+ }
57
+ },
58
+ outputs: {
59
+ type: 'array',
60
+ title: 'Sorties',
61
+ items: {
62
+ type: 'string',
63
+ oneOf: [{
64
+ const: 'devices',
65
+ title: 'recevoir la notification sur vos appareils configurés'
66
+ }, {
67
+ const: 'email',
68
+ title: 'recevoir la notification par email'
69
+ }]
70
+ }
71
+ },
72
+ url: {
73
+ type: 'string',
74
+ title: 'calculé à partir de subscription.urlTemplate et event.urlParams',
75
+ readOnly: true
76
+ },
77
+ date: {
78
+ readOnly: true,
79
+ type: 'string',
80
+ description: 'reception date',
81
+ format: 'date-time'
82
+ },
83
+ new: {
84
+ readOnly: true,
85
+ type: 'boolean'
86
+ },
87
+ extra: {
88
+ type: 'object',
89
+ description: 'propriétés libres qui varient en fonction du type de notification'
90
+ }
91
+ }
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@ export interface User {
30
30
  ipa?: ShortForIgnorePersonalAccount;
31
31
  idp?: IsTheUserComingFromACoreIDProvider;
32
32
  os?: ShortForOrgStorage;
33
- rememberMe?: boolean;
33
+ rememberMe?: 1;
34
34
  }
35
35
  /**
36
36
  * This interface was referenced by `SessionState`'s JSON-Schema
@@ -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":"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":"boolean"}}},"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,"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"}}}}};
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
- 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":"boolean"}}};
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]}}};
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;
@@ -487,8 +487,9 @@ errors++;
487
487
  }
488
488
  }
489
489
  if(data.rememberMe !== undefined){
490
- if(typeof data.rememberMe !== "boolean"){
491
- const err40 = {instancePath:instancePath+"/rememberMe",schemaPath:"#/properties/rememberMe/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
490
+ let data20 = data.rememberMe;
491
+ if(!((typeof data20 == "number") && (!(data20 % 1) && !isNaN(data20)))){
492
+ const err40 = {instancePath:instancePath+"/rememberMe",schemaPath:"#/properties/rememberMe/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
492
493
  if(vErrors === null){
493
494
  vErrors = [err40];
494
495
  }
@@ -497,15 +498,25 @@ vErrors.push(err40);
497
498
  }
498
499
  errors++;
499
500
  }
501
+ if(!(data20 === 1)){
502
+ const err41 = {instancePath:instancePath+"/rememberMe",schemaPath:"#/properties/rememberMe/enum",keyword:"enum",params:{allowedValues: schema17.properties.rememberMe.enum},message:"must be equal to one of the allowed values"};
503
+ if(vErrors === null){
504
+ vErrors = [err41];
505
+ }
506
+ else {
507
+ vErrors.push(err41);
508
+ }
509
+ errors++;
510
+ }
500
511
  }
501
512
  }
502
513
  else {
503
- const err41 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
514
+ const err42 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
504
515
  if(vErrors === null){
505
- vErrors = [err41];
516
+ vErrors = [err42];
506
517
  }
507
518
  else {
508
- vErrors.push(err41);
519
+ vErrors.push(err42);
509
520
  }
510
521
  errors++;
511
522
  }
@@ -117,6 +117,7 @@ declare const _default: {
117
117
  };
118
118
  rememberMe: {
119
119
  type: string;
120
+ enum: number[];
120
121
  };
121
122
  };
122
123
  };
package/session/schema.js CHANGED
@@ -128,7 +128,8 @@ export default {
128
128
  enum: [1]
129
129
  },
130
130
  rememberMe: {
131
- type: 'boolean'
131
+ type: 'integer',
132
+ enum: [1]
132
133
  }
133
134
  }
134
135
  },