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