@data-fair/lib-common-types 0.1.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.
- package/account/.type/index.d.ts +29 -0
- package/account/.type/index.js +83 -0
- package/account/.type/validate.js +128 -0
- package/account/index.js +1 -0
- package/application/.type/index.d.ts +100 -0
- package/application/.type/index.js +161 -0
- package/application/index.js +1 -0
- package/package.json +14 -0
- package/session/.type/index.d.ts +66 -0
- package/session/.type/index.js +185 -0
- package/session/.type/validate.js +777 -0
- package/session/index.js +78 -0
|
@@ -0,0 +1,777 @@
|
|
|
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/session-state","x-exports":["types","validate","schema"],"type":"object","title":"session state","additionalProperties":false,"properties":{"user":{"$ref":"#/$defs/user"},"organization":{"$ref":"#/$defs/organizationMembership"},"account":{"$ref":"#/$defs/account"},"accountRole":{"type":"string"},"lang":{"type":"string"},"dark":{"type":"boolean"}},"$defs":{"organizationMembership":{"type":"object","additionalProperties":false,"required":["id","name","role"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"},"dflt":{"type":"boolean"}}},"userRef":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"user":{"type":"object","additionalProperties":false,"required":["email","id","name","organizations"],"properties":{"email":{"type":"string","format":"email"},"id":{"type":"string"},"name":{"type":"string"},"organizations":{"type":"array","items":{"$ref":"#/$defs/organizationMembership"}},"isAdmin":{"type":"integer","enum":[0,1]},"adminMode":{"type":"integer","enum":[0,1]},"asAdmin":{"$ref":"#/$defs/userRef"},"pd":{"type":"string","format":"date"},"ipa":{"type":"integer","enum":[0,1]}}},"account":{"type":"object","additionalProperties":false,"required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}}}}};
|
|
9
|
+
const schema18 = {"type":"object","additionalProperties":false,"required":["id","name","role"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"},"dflt":{"type":"boolean"}}};
|
|
10
|
+
const schema21 = {"type":"object","additionalProperties":false,"required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}}};
|
|
11
|
+
const schema17 = {"type":"object","additionalProperties":false,"required":["email","id","name","organizations"],"properties":{"email":{"type":"string","format":"email"},"id":{"type":"string"},"name":{"type":"string"},"organizations":{"type":"array","items":{"$ref":"#/$defs/organizationMembership"}},"isAdmin":{"type":"integer","enum":[0,1]},"adminMode":{"type":"integer","enum":[0,1]},"asAdmin":{"$ref":"#/$defs/userRef"},"pd":{"type":"string","format":"date"},"ipa":{"type":"integer","enum":[0,1]}}};
|
|
12
|
+
const schema19 = {"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}};
|
|
13
|
+
const func2 = Object.prototype.hasOwnProperty;
|
|
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;
|
|
15
|
+
const formats2 = fullFormats.date;
|
|
16
|
+
|
|
17
|
+
function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
|
|
18
|
+
let vErrors = null;
|
|
19
|
+
let errors = 0;
|
|
20
|
+
if(data && typeof data == "object" && !Array.isArray(data)){
|
|
21
|
+
if(data.email === undefined){
|
|
22
|
+
const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "email"},message:"must have required property '"+"email"+"'"};
|
|
23
|
+
if(vErrors === null){
|
|
24
|
+
vErrors = [err0];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
vErrors.push(err0);
|
|
28
|
+
}
|
|
29
|
+
errors++;
|
|
30
|
+
}
|
|
31
|
+
if(data.id === undefined){
|
|
32
|
+
const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
33
|
+
if(vErrors === null){
|
|
34
|
+
vErrors = [err1];
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
vErrors.push(err1);
|
|
38
|
+
}
|
|
39
|
+
errors++;
|
|
40
|
+
}
|
|
41
|
+
if(data.name === undefined){
|
|
42
|
+
const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
43
|
+
if(vErrors === null){
|
|
44
|
+
vErrors = [err2];
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
vErrors.push(err2);
|
|
48
|
+
}
|
|
49
|
+
errors++;
|
|
50
|
+
}
|
|
51
|
+
if(data.organizations === undefined){
|
|
52
|
+
const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "organizations"},message:"must have required property '"+"organizations"+"'"};
|
|
53
|
+
if(vErrors === null){
|
|
54
|
+
vErrors = [err3];
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
vErrors.push(err3);
|
|
58
|
+
}
|
|
59
|
+
errors++;
|
|
60
|
+
}
|
|
61
|
+
for(const key0 in data){
|
|
62
|
+
if(!(func2.call(schema17.properties, key0))){
|
|
63
|
+
const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
|
|
64
|
+
if(vErrors === null){
|
|
65
|
+
vErrors = [err4];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
vErrors.push(err4);
|
|
69
|
+
}
|
|
70
|
+
errors++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if(data.email !== undefined){
|
|
74
|
+
let data0 = data.email;
|
|
75
|
+
if(typeof data0 === "string"){
|
|
76
|
+
if(!(formats0.test(data0))){
|
|
77
|
+
const err5 = {instancePath:instancePath+"/email",schemaPath:"#/properties/email/format",keyword:"format",params:{format: "email"},message:"must match format \""+"email"+"\""};
|
|
78
|
+
if(vErrors === null){
|
|
79
|
+
vErrors = [err5];
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
vErrors.push(err5);
|
|
83
|
+
}
|
|
84
|
+
errors++;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const err6 = {instancePath:instancePath+"/email",schemaPath:"#/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
89
|
+
if(vErrors === null){
|
|
90
|
+
vErrors = [err6];
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
vErrors.push(err6);
|
|
94
|
+
}
|
|
95
|
+
errors++;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if(data.id !== undefined){
|
|
99
|
+
if(typeof data.id !== "string"){
|
|
100
|
+
const err7 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
101
|
+
if(vErrors === null){
|
|
102
|
+
vErrors = [err7];
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
vErrors.push(err7);
|
|
106
|
+
}
|
|
107
|
+
errors++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if(data.name !== undefined){
|
|
111
|
+
if(typeof data.name !== "string"){
|
|
112
|
+
const err8 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
113
|
+
if(vErrors === null){
|
|
114
|
+
vErrors = [err8];
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
vErrors.push(err8);
|
|
118
|
+
}
|
|
119
|
+
errors++;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if(data.organizations !== undefined){
|
|
123
|
+
let data3 = data.organizations;
|
|
124
|
+
if(Array.isArray(data3)){
|
|
125
|
+
const len0 = data3.length;
|
|
126
|
+
for(let i0=0; i0<len0; i0++){
|
|
127
|
+
let data4 = data3[i0];
|
|
128
|
+
if(data4 && typeof data4 == "object" && !Array.isArray(data4)){
|
|
129
|
+
if(data4.id === undefined){
|
|
130
|
+
const err9 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
131
|
+
if(vErrors === null){
|
|
132
|
+
vErrors = [err9];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
vErrors.push(err9);
|
|
136
|
+
}
|
|
137
|
+
errors++;
|
|
138
|
+
}
|
|
139
|
+
if(data4.name === undefined){
|
|
140
|
+
const err10 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
141
|
+
if(vErrors === null){
|
|
142
|
+
vErrors = [err10];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
vErrors.push(err10);
|
|
146
|
+
}
|
|
147
|
+
errors++;
|
|
148
|
+
}
|
|
149
|
+
if(data4.role === undefined){
|
|
150
|
+
const err11 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "role"},message:"must have required property '"+"role"+"'"};
|
|
151
|
+
if(vErrors === null){
|
|
152
|
+
vErrors = [err11];
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
vErrors.push(err11);
|
|
156
|
+
}
|
|
157
|
+
errors++;
|
|
158
|
+
}
|
|
159
|
+
for(const key1 in data4){
|
|
160
|
+
if(!((((((key1 === "id") || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName")) || (key1 === "dflt"))){
|
|
161
|
+
const err12 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
|
|
162
|
+
if(vErrors === null){
|
|
163
|
+
vErrors = [err12];
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
vErrors.push(err12);
|
|
167
|
+
}
|
|
168
|
+
errors++;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if(data4.id !== undefined){
|
|
172
|
+
if(typeof data4.id !== "string"){
|
|
173
|
+
const err13 = {instancePath:instancePath+"/organizations/" + i0+"/id",schemaPath:"#/$defs/organizationMembership/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
174
|
+
if(vErrors === null){
|
|
175
|
+
vErrors = [err13];
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
vErrors.push(err13);
|
|
179
|
+
}
|
|
180
|
+
errors++;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if(data4.name !== undefined){
|
|
184
|
+
if(typeof data4.name !== "string"){
|
|
185
|
+
const err14 = {instancePath:instancePath+"/organizations/" + i0+"/name",schemaPath:"#/$defs/organizationMembership/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
186
|
+
if(vErrors === null){
|
|
187
|
+
vErrors = [err14];
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
vErrors.push(err14);
|
|
191
|
+
}
|
|
192
|
+
errors++;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if(data4.role !== undefined){
|
|
196
|
+
if(typeof data4.role !== "string"){
|
|
197
|
+
const err15 = {instancePath:instancePath+"/organizations/" + i0+"/role",schemaPath:"#/$defs/organizationMembership/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
198
|
+
if(vErrors === null){
|
|
199
|
+
vErrors = [err15];
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
vErrors.push(err15);
|
|
203
|
+
}
|
|
204
|
+
errors++;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if(data4.department !== undefined){
|
|
208
|
+
if(typeof data4.department !== "string"){
|
|
209
|
+
const err16 = {instancePath:instancePath+"/organizations/" + i0+"/department",schemaPath:"#/$defs/organizationMembership/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
210
|
+
if(vErrors === null){
|
|
211
|
+
vErrors = [err16];
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
vErrors.push(err16);
|
|
215
|
+
}
|
|
216
|
+
errors++;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if(data4.departmentName !== undefined){
|
|
220
|
+
if(typeof data4.departmentName !== "string"){
|
|
221
|
+
const err17 = {instancePath:instancePath+"/organizations/" + i0+"/departmentName",schemaPath:"#/$defs/organizationMembership/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
222
|
+
if(vErrors === null){
|
|
223
|
+
vErrors = [err17];
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
vErrors.push(err17);
|
|
227
|
+
}
|
|
228
|
+
errors++;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if(data4.dflt !== undefined){
|
|
232
|
+
if(typeof data4.dflt !== "boolean"){
|
|
233
|
+
const err18 = {instancePath:instancePath+"/organizations/" + i0+"/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
234
|
+
if(vErrors === null){
|
|
235
|
+
vErrors = [err18];
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
vErrors.push(err18);
|
|
239
|
+
}
|
|
240
|
+
errors++;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const err19 = {instancePath:instancePath+"/organizations/" + i0,schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
246
|
+
if(vErrors === null){
|
|
247
|
+
vErrors = [err19];
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
vErrors.push(err19);
|
|
251
|
+
}
|
|
252
|
+
errors++;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
const err20 = {instancePath:instancePath+"/organizations",schemaPath:"#/properties/organizations/type",keyword:"type",params:{type: "array"},message:"must be array"};
|
|
258
|
+
if(vErrors === null){
|
|
259
|
+
vErrors = [err20];
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
vErrors.push(err20);
|
|
263
|
+
}
|
|
264
|
+
errors++;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if(data.isAdmin !== undefined){
|
|
268
|
+
let data11 = data.isAdmin;
|
|
269
|
+
if(!((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11)))){
|
|
270
|
+
const err21 = {instancePath:instancePath+"/isAdmin",schemaPath:"#/properties/isAdmin/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
|
|
271
|
+
if(vErrors === null){
|
|
272
|
+
vErrors = [err21];
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
vErrors.push(err21);
|
|
276
|
+
}
|
|
277
|
+
errors++;
|
|
278
|
+
}
|
|
279
|
+
if(!((data11 === 0) || (data11 === 1))){
|
|
280
|
+
const err22 = {instancePath:instancePath+"/isAdmin",schemaPath:"#/properties/isAdmin/enum",keyword:"enum",params:{allowedValues: schema17.properties.isAdmin.enum},message:"must be equal to one of the allowed values"};
|
|
281
|
+
if(vErrors === null){
|
|
282
|
+
vErrors = [err22];
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
vErrors.push(err22);
|
|
286
|
+
}
|
|
287
|
+
errors++;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if(data.adminMode !== undefined){
|
|
291
|
+
let data12 = data.adminMode;
|
|
292
|
+
if(!((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12)))){
|
|
293
|
+
const err23 = {instancePath:instancePath+"/adminMode",schemaPath:"#/properties/adminMode/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
|
|
294
|
+
if(vErrors === null){
|
|
295
|
+
vErrors = [err23];
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
vErrors.push(err23);
|
|
299
|
+
}
|
|
300
|
+
errors++;
|
|
301
|
+
}
|
|
302
|
+
if(!((data12 === 0) || (data12 === 1))){
|
|
303
|
+
const err24 = {instancePath:instancePath+"/adminMode",schemaPath:"#/properties/adminMode/enum",keyword:"enum",params:{allowedValues: schema17.properties.adminMode.enum},message:"must be equal to one of the allowed values"};
|
|
304
|
+
if(vErrors === null){
|
|
305
|
+
vErrors = [err24];
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
vErrors.push(err24);
|
|
309
|
+
}
|
|
310
|
+
errors++;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if(data.asAdmin !== undefined){
|
|
314
|
+
let data13 = data.asAdmin;
|
|
315
|
+
if(data13 && typeof data13 == "object" && !Array.isArray(data13)){
|
|
316
|
+
if(data13.id === undefined){
|
|
317
|
+
const err25 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
318
|
+
if(vErrors === null){
|
|
319
|
+
vErrors = [err25];
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
vErrors.push(err25);
|
|
323
|
+
}
|
|
324
|
+
errors++;
|
|
325
|
+
}
|
|
326
|
+
if(data13.name === undefined){
|
|
327
|
+
const err26 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
328
|
+
if(vErrors === null){
|
|
329
|
+
vErrors = [err26];
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
vErrors.push(err26);
|
|
333
|
+
}
|
|
334
|
+
errors++;
|
|
335
|
+
}
|
|
336
|
+
for(const key2 in data13){
|
|
337
|
+
if(!((key2 === "id") || (key2 === "name"))){
|
|
338
|
+
const err27 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
|
|
339
|
+
if(vErrors === null){
|
|
340
|
+
vErrors = [err27];
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
vErrors.push(err27);
|
|
344
|
+
}
|
|
345
|
+
errors++;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if(data13.id !== undefined){
|
|
349
|
+
if(typeof data13.id !== "string"){
|
|
350
|
+
const err28 = {instancePath:instancePath+"/asAdmin/id",schemaPath:"#/$defs/userRef/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
351
|
+
if(vErrors === null){
|
|
352
|
+
vErrors = [err28];
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
vErrors.push(err28);
|
|
356
|
+
}
|
|
357
|
+
errors++;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if(data13.name !== undefined){
|
|
361
|
+
if(typeof data13.name !== "string"){
|
|
362
|
+
const err29 = {instancePath:instancePath+"/asAdmin/name",schemaPath:"#/$defs/userRef/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
363
|
+
if(vErrors === null){
|
|
364
|
+
vErrors = [err29];
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
vErrors.push(err29);
|
|
368
|
+
}
|
|
369
|
+
errors++;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
const err30 = {instancePath:instancePath+"/asAdmin",schemaPath:"#/$defs/userRef/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
375
|
+
if(vErrors === null){
|
|
376
|
+
vErrors = [err30];
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
vErrors.push(err30);
|
|
380
|
+
}
|
|
381
|
+
errors++;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if(data.pd !== undefined){
|
|
385
|
+
let data16 = data.pd;
|
|
386
|
+
if(typeof data16 === "string"){
|
|
387
|
+
if(!(formats2.validate(data16))){
|
|
388
|
+
const err31 = {instancePath:instancePath+"/pd",schemaPath:"#/properties/pd/format",keyword:"format",params:{format: "date"},message:"must match format \""+"date"+"\""};
|
|
389
|
+
if(vErrors === null){
|
|
390
|
+
vErrors = [err31];
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
vErrors.push(err31);
|
|
394
|
+
}
|
|
395
|
+
errors++;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
const err32 = {instancePath:instancePath+"/pd",schemaPath:"#/properties/pd/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
400
|
+
if(vErrors === null){
|
|
401
|
+
vErrors = [err32];
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
vErrors.push(err32);
|
|
405
|
+
}
|
|
406
|
+
errors++;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if(data.ipa !== undefined){
|
|
410
|
+
let data17 = data.ipa;
|
|
411
|
+
if(!((typeof data17 == "number") && (!(data17 % 1) && !isNaN(data17)))){
|
|
412
|
+
const err33 = {instancePath:instancePath+"/ipa",schemaPath:"#/properties/ipa/type",keyword:"type",params:{type: "integer"},message:"must be integer"};
|
|
413
|
+
if(vErrors === null){
|
|
414
|
+
vErrors = [err33];
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
vErrors.push(err33);
|
|
418
|
+
}
|
|
419
|
+
errors++;
|
|
420
|
+
}
|
|
421
|
+
if(!((data17 === 0) || (data17 === 1))){
|
|
422
|
+
const err34 = {instancePath:instancePath+"/ipa",schemaPath:"#/properties/ipa/enum",keyword:"enum",params:{allowedValues: schema17.properties.ipa.enum},message:"must be equal to one of the allowed values"};
|
|
423
|
+
if(vErrors === null){
|
|
424
|
+
vErrors = [err34];
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
vErrors.push(err34);
|
|
428
|
+
}
|
|
429
|
+
errors++;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
const err35 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
435
|
+
if(vErrors === null){
|
|
436
|
+
vErrors = [err35];
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
vErrors.push(err35);
|
|
440
|
+
}
|
|
441
|
+
errors++;
|
|
442
|
+
}
|
|
443
|
+
validate15.errors = vErrors;
|
|
444
|
+
return errors === 0;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
|
|
449
|
+
/*# sourceURL="https://github.com/data-fair/lib/session-state" */;
|
|
450
|
+
let vErrors = null;
|
|
451
|
+
let errors = 0;
|
|
452
|
+
if(data && typeof data == "object" && !Array.isArray(data)){
|
|
453
|
+
for(const key0 in data){
|
|
454
|
+
if(!((((((key0 === "user") || (key0 === "organization")) || (key0 === "account")) || (key0 === "accountRole")) || (key0 === "lang")) || (key0 === "dark"))){
|
|
455
|
+
const err0 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
|
|
456
|
+
if(vErrors === null){
|
|
457
|
+
vErrors = [err0];
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
vErrors.push(err0);
|
|
461
|
+
}
|
|
462
|
+
errors++;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if(data.user !== undefined){
|
|
466
|
+
if(!(validate15(data.user, {instancePath:instancePath+"/user",parentData:data,parentDataProperty:"user",rootData}))){
|
|
467
|
+
vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);
|
|
468
|
+
errors = vErrors.length;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
if(data.organization !== undefined){
|
|
472
|
+
let data1 = data.organization;
|
|
473
|
+
if(data1 && typeof data1 == "object" && !Array.isArray(data1)){
|
|
474
|
+
if(data1.id === undefined){
|
|
475
|
+
const err1 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
476
|
+
if(vErrors === null){
|
|
477
|
+
vErrors = [err1];
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
vErrors.push(err1);
|
|
481
|
+
}
|
|
482
|
+
errors++;
|
|
483
|
+
}
|
|
484
|
+
if(data1.name === undefined){
|
|
485
|
+
const err2 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
486
|
+
if(vErrors === null){
|
|
487
|
+
vErrors = [err2];
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
vErrors.push(err2);
|
|
491
|
+
}
|
|
492
|
+
errors++;
|
|
493
|
+
}
|
|
494
|
+
if(data1.role === undefined){
|
|
495
|
+
const err3 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/required",keyword:"required",params:{missingProperty: "role"},message:"must have required property '"+"role"+"'"};
|
|
496
|
+
if(vErrors === null){
|
|
497
|
+
vErrors = [err3];
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
vErrors.push(err3);
|
|
501
|
+
}
|
|
502
|
+
errors++;
|
|
503
|
+
}
|
|
504
|
+
for(const key1 in data1){
|
|
505
|
+
if(!((((((key1 === "id") || (key1 === "name")) || (key1 === "role")) || (key1 === "department")) || (key1 === "departmentName")) || (key1 === "dflt"))){
|
|
506
|
+
const err4 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
|
|
507
|
+
if(vErrors === null){
|
|
508
|
+
vErrors = [err4];
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
vErrors.push(err4);
|
|
512
|
+
}
|
|
513
|
+
errors++;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if(data1.id !== undefined){
|
|
517
|
+
if(typeof data1.id !== "string"){
|
|
518
|
+
const err5 = {instancePath:instancePath+"/organization/id",schemaPath:"#/$defs/organizationMembership/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
519
|
+
if(vErrors === null){
|
|
520
|
+
vErrors = [err5];
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
vErrors.push(err5);
|
|
524
|
+
}
|
|
525
|
+
errors++;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if(data1.name !== undefined){
|
|
529
|
+
if(typeof data1.name !== "string"){
|
|
530
|
+
const err6 = {instancePath:instancePath+"/organization/name",schemaPath:"#/$defs/organizationMembership/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
531
|
+
if(vErrors === null){
|
|
532
|
+
vErrors = [err6];
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
vErrors.push(err6);
|
|
536
|
+
}
|
|
537
|
+
errors++;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if(data1.role !== undefined){
|
|
541
|
+
if(typeof data1.role !== "string"){
|
|
542
|
+
const err7 = {instancePath:instancePath+"/organization/role",schemaPath:"#/$defs/organizationMembership/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
543
|
+
if(vErrors === null){
|
|
544
|
+
vErrors = [err7];
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
vErrors.push(err7);
|
|
548
|
+
}
|
|
549
|
+
errors++;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if(data1.department !== undefined){
|
|
553
|
+
if(typeof data1.department !== "string"){
|
|
554
|
+
const err8 = {instancePath:instancePath+"/organization/department",schemaPath:"#/$defs/organizationMembership/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
555
|
+
if(vErrors === null){
|
|
556
|
+
vErrors = [err8];
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
vErrors.push(err8);
|
|
560
|
+
}
|
|
561
|
+
errors++;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if(data1.departmentName !== undefined){
|
|
565
|
+
if(typeof data1.departmentName !== "string"){
|
|
566
|
+
const err9 = {instancePath:instancePath+"/organization/departmentName",schemaPath:"#/$defs/organizationMembership/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
567
|
+
if(vErrors === null){
|
|
568
|
+
vErrors = [err9];
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
vErrors.push(err9);
|
|
572
|
+
}
|
|
573
|
+
errors++;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if(data1.dflt !== undefined){
|
|
577
|
+
if(typeof data1.dflt !== "boolean"){
|
|
578
|
+
const err10 = {instancePath:instancePath+"/organization/dflt",schemaPath:"#/$defs/organizationMembership/properties/dflt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
579
|
+
if(vErrors === null){
|
|
580
|
+
vErrors = [err10];
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
vErrors.push(err10);
|
|
584
|
+
}
|
|
585
|
+
errors++;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
const err11 = {instancePath:instancePath+"/organization",schemaPath:"#/$defs/organizationMembership/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
591
|
+
if(vErrors === null){
|
|
592
|
+
vErrors = [err11];
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
vErrors.push(err11);
|
|
596
|
+
}
|
|
597
|
+
errors++;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if(data.account !== undefined){
|
|
601
|
+
let data8 = data.account;
|
|
602
|
+
if(data8 && typeof data8 == "object" && !Array.isArray(data8)){
|
|
603
|
+
if(data8.type === undefined){
|
|
604
|
+
const err12 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
605
|
+
if(vErrors === null){
|
|
606
|
+
vErrors = [err12];
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
vErrors.push(err12);
|
|
610
|
+
}
|
|
611
|
+
errors++;
|
|
612
|
+
}
|
|
613
|
+
if(data8.id === undefined){
|
|
614
|
+
const err13 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
615
|
+
if(vErrors === null){
|
|
616
|
+
vErrors = [err13];
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
vErrors.push(err13);
|
|
620
|
+
}
|
|
621
|
+
errors++;
|
|
622
|
+
}
|
|
623
|
+
if(data8.name === undefined){
|
|
624
|
+
const err14 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
625
|
+
if(vErrors === null){
|
|
626
|
+
vErrors = [err14];
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
vErrors.push(err14);
|
|
630
|
+
}
|
|
631
|
+
errors++;
|
|
632
|
+
}
|
|
633
|
+
for(const key2 in data8){
|
|
634
|
+
if(!(((((key2 === "type") || (key2 === "id")) || (key2 === "name")) || (key2 === "department")) || (key2 === "departmentName"))){
|
|
635
|
+
const err15 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
|
|
636
|
+
if(vErrors === null){
|
|
637
|
+
vErrors = [err15];
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
vErrors.push(err15);
|
|
641
|
+
}
|
|
642
|
+
errors++;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if(data8.type !== undefined){
|
|
646
|
+
let data9 = data8.type;
|
|
647
|
+
if(typeof data9 !== "string"){
|
|
648
|
+
const err16 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
649
|
+
if(vErrors === null){
|
|
650
|
+
vErrors = [err16];
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
vErrors.push(err16);
|
|
654
|
+
}
|
|
655
|
+
errors++;
|
|
656
|
+
}
|
|
657
|
+
if(!((data9 === "user") || (data9 === "organization"))){
|
|
658
|
+
const err17 = {instancePath:instancePath+"/account/type",schemaPath:"#/$defs/account/properties/type/enum",keyword:"enum",params:{allowedValues: schema21.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
659
|
+
if(vErrors === null){
|
|
660
|
+
vErrors = [err17];
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
vErrors.push(err17);
|
|
664
|
+
}
|
|
665
|
+
errors++;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
if(data8.id !== undefined){
|
|
669
|
+
if(typeof data8.id !== "string"){
|
|
670
|
+
const err18 = {instancePath:instancePath+"/account/id",schemaPath:"#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
671
|
+
if(vErrors === null){
|
|
672
|
+
vErrors = [err18];
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
vErrors.push(err18);
|
|
676
|
+
}
|
|
677
|
+
errors++;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if(data8.name !== undefined){
|
|
681
|
+
if(typeof data8.name !== "string"){
|
|
682
|
+
const err19 = {instancePath:instancePath+"/account/name",schemaPath:"#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
683
|
+
if(vErrors === null){
|
|
684
|
+
vErrors = [err19];
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
vErrors.push(err19);
|
|
688
|
+
}
|
|
689
|
+
errors++;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if(data8.department !== undefined){
|
|
693
|
+
if(typeof data8.department !== "string"){
|
|
694
|
+
const err20 = {instancePath:instancePath+"/account/department",schemaPath:"#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
695
|
+
if(vErrors === null){
|
|
696
|
+
vErrors = [err20];
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
vErrors.push(err20);
|
|
700
|
+
}
|
|
701
|
+
errors++;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if(data8.departmentName !== undefined){
|
|
705
|
+
if(typeof data8.departmentName !== "string"){
|
|
706
|
+
const err21 = {instancePath:instancePath+"/account/departmentName",schemaPath:"#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
707
|
+
if(vErrors === null){
|
|
708
|
+
vErrors = [err21];
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
vErrors.push(err21);
|
|
712
|
+
}
|
|
713
|
+
errors++;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
else {
|
|
718
|
+
const err22 = {instancePath:instancePath+"/account",schemaPath:"#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
719
|
+
if(vErrors === null){
|
|
720
|
+
vErrors = [err22];
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
vErrors.push(err22);
|
|
724
|
+
}
|
|
725
|
+
errors++;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if(data.accountRole !== undefined){
|
|
729
|
+
if(typeof data.accountRole !== "string"){
|
|
730
|
+
const err23 = {instancePath:instancePath+"/accountRole",schemaPath:"#/properties/accountRole/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
731
|
+
if(vErrors === null){
|
|
732
|
+
vErrors = [err23];
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
vErrors.push(err23);
|
|
736
|
+
}
|
|
737
|
+
errors++;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
if(data.lang !== undefined){
|
|
741
|
+
if(typeof data.lang !== "string"){
|
|
742
|
+
const err24 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
743
|
+
if(vErrors === null){
|
|
744
|
+
vErrors = [err24];
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
vErrors.push(err24);
|
|
748
|
+
}
|
|
749
|
+
errors++;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
if(data.dark !== undefined){
|
|
753
|
+
if(typeof data.dark !== "boolean"){
|
|
754
|
+
const err25 = {instancePath:instancePath+"/dark",schemaPath:"#/properties/dark/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
755
|
+
if(vErrors === null){
|
|
756
|
+
vErrors = [err25];
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
vErrors.push(err25);
|
|
760
|
+
}
|
|
761
|
+
errors++;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
const err26 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
767
|
+
if(vErrors === null){
|
|
768
|
+
vErrors = [err26];
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
vErrors.push(err26);
|
|
772
|
+
}
|
|
773
|
+
errors++;
|
|
774
|
+
}
|
|
775
|
+
validate14.errors = vErrors;
|
|
776
|
+
return errors === 0;
|
|
777
|
+
}
|