@data-fair/lib-common-types 1.20.0 → 1.20.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.
@@ -13,13 +13,11 @@ export type UnMembreDeLOrganisation = {
13
13
  mode: "member";
14
14
  type: "user";
15
15
  id: string;
16
- [k: string]: unknown;
17
16
  }
18
17
  export type UnEmail = {
19
18
  mode: "member";
20
19
  type: "user";
21
20
  email: AdresseMail;
22
- [k: string]: unknown;
23
21
  }
24
22
  export type UneOrganisationPartenaire = {
25
23
  mode: "member";
@@ -27,7 +25,6 @@ export type UneOrganisationPartenaire = {
27
25
  department?: "*";
28
26
  roles?: unknown[];
29
27
  id: string;
30
- [k: string]: unknown;
31
28
  }
32
29
  export type UnRoleOuDepartementDeMonOrganisation = {
33
30
  mode: "internal";
@@ -35,7 +32,6 @@ export type UnRoleOuDepartementDeMonOrganisation = {
35
32
  id: string;
36
33
  department?: string;
37
34
  roles?: string[];
38
- [k: string]: unknown;
39
35
  }
40
36
 
41
37
 
@@ -1,11 +1,12 @@
1
1
  /* eslint-disable */
2
2
  // @ts-nocheck
3
3
 
4
+ import equal from "ajv/dist/runtime/equal.js";
4
5
  "use strict";
5
6
  export const validate = validate14;
6
7
  export default validate14;
7
- const schema16 = {"$id":"https://github.com/data-fair/lib/access-ref","x-exports":["types","validate"],"title":"Access Ref","type":"object","oneOf":[{"title":"Un membre de l'organisation","layout":{"if":"context.owner.type === 'organization'"},"required":["mode","type","id"],"properties":{"mode":{"type":"string","const":"member"},"type":{"type":"string","const":"user"},"id":{"type":"string","layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/members","itemsResults":"data.results","itemTitle":"item.name","itemValue":"item.id","itemIcon":"`/simple-directory/api/avatars/user/${item.id}/avatar.png`"}}}}},{"title":"Un email","required":["mode","type","email"],"properties":{"mode":{"type":"string","const":"member"},"type":{"type":"string","const":"user"},"email":{"type":"string","title":"Adresse mail"}}},{"title":"Une organisation partenaire","layout":{"if":"context.owner.type === 'organization'"},"required":["mode","type","id"],"properties":{"mode":{"type":"string","const":"member"},"type":{"type":"string","const":"organization"},"department":{"type":"string","const":"*"},"roles":{"type":"array","const":[]},"id":{"type":"string","layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/partners","itemsResults":"data.results","itemTitle":"item.name","itemValue":"item.id","itemIcon":"`/simple-directory/api/avatars/organization/${item.id}/avatar.png`"}}}}},{"title":"Un role ou département de mon organisation","layout":{"if":"context.owner.type === 'organization'"},"required":["mode","type","id"],"properties":{"mode":{"type":"string","const":"internal"},"type":{"type":"string","const":"organization"},"id":{"type":"string"},"department":{"type":"string","layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/departments","itemsResults":"[...data.results, {id: \"*\", name: \"Tous les départements\"}, {id: \"-\", name: \"Racine de l'organisation uniquement\"}]","itemTitle":"item.name","itemValue":"item.id"}}},"roles":{"type":"array","items":{"type":"string"},"layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/roles","itemsResults":"data.results","itemTitle":"item.name","itemValue":"item.id"}}}}}]};
8
- const func0 = require("ajv/dist/runtime/equal").default;
8
+ const schema16 = {"$id":"https://github.com/data-fair/lib/access-ref","x-exports":["types","validate"],"title":"Access Ref","x-i18n-title":{"fr":"Référence d'accès","en":"Access Ref","es":"Referencia de acceso","it":"Riferimento di accesso","pt":"Referência de acesso","de":"Zugriffsreferenz"},"type":"object","discriminator":{"propertyName":"mode"},"oneOfLayout":{"emptyData":true},"oneOf":[{"title":"Un membre de l'organisation","x-i18n-title":{"fr":"Un membre de l'organisation","en":"An organization member","es":"Un miembro de la organización","it":"Un membro dell'organizzazione","pt":"Um membro da organização","de":"Ein Organisationsmitglied"},"layout":{"if":"context.owner.type === 'organization'"},"required":["mode","type","id"],"additionalProperties":false,"properties":{"mode":{"type":"string","const":"member"},"type":{"type":"string","const":"user"},"id":{"type":"string","layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/members","itemsResults":"data.results","itemTitle":"item.name","itemValue":"item.id","itemIcon":"`/simple-directory/api/avatars/user/${item.id}/avatar.png`"}}}}},{"title":"Un email","x-i18n-title":{"fr":"Un email","en":"An email","es":"Un correo electrónico","it":"Un'email","pt":"Um email","de":"Eine E-Mail"},"required":["mode","type","email"],"additionalProperties":false,"properties":{"mode":{"type":"string","const":"member"},"type":{"type":"string","const":"user"},"email":{"type":"string","title":"Adresse mail","x-i18n-title":{"fr":"Adresse mail","en":"Email address","es":"Dirección de correo","it":"Indirizzo email","pt":"Endereço de email","de":"E-Mail-Adresse"}}}},{"title":"Une organisation partenaire","x-i18n-title":{"fr":"Une organisation partenaire","en":"A partner organization","es":"Una organización asociada","it":"Un'organizzazione partner","pt":"Uma organização parceira","de":"Eine Partnerorganisation"},"layout":{"if":"context.owner.type === 'organization'"},"required":["mode","type","id"],"additionalProperties":false,"properties":{"mode":{"type":"string","const":"member"},"type":{"type":"string","const":"organization"},"department":{"type":"string","const":"*"},"roles":{"type":"array","const":[]},"id":{"type":"string","layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/partners","itemsResults":"data.results","itemTitle":"item.name","itemValue":"item.id","itemIcon":"`/simple-directory/api/avatars/organization/${item.id}/avatar.png`"}}}}},{"title":"Un role ou département de mon organisation","x-i18n-title":{"fr":"Un rôle ou département de mon organisation","en":"A role or department of my organization","es":"Un rol o departamento de mi organización","it":"Un ruolo o dipartimento della mia organizzazione","pt":"Um papel ou departamento da minha organização","de":"Eine Rolle oder Abteilung meiner Organisation"},"layout":{"if":"context.owner.type === 'organization'"},"required":["mode","type","id"],"additionalProperties":false,"properties":{"mode":{"type":"string","const":"internal"},"type":{"type":"string","const":"organization"},"id":{"type":"string"},"department":{"type":"string","layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/departments","itemsResults":"[...data.results, {id: \"*\", name: \"Tous les départements\"}, {id: \"-\", name: \"Racine de l'organisation uniquement\"}]","itemTitle":"item.name","itemValue":"item.id"}}},"roles":{"type":"array","items":{"type":"string"},"layout":{"getItems":{"url":"/simple-directory/api/organization/${context.owner.id}/roles","itemsResults":"data.results","itemTitle":"item.name","itemValue":"item.id"}}}}}]};
9
+ const func0 = equal;
9
10
 
10
11
  function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
11
12
  /*# sourceURL="https://github.com/data-fair/lib/access-ref" */;
@@ -56,10 +57,9 @@ vErrors.push(err3);
56
57
  }
57
58
  errors++;
58
59
  }
59
- if(data.mode !== undefined){
60
- let data0 = data.mode;
61
- if(typeof data0 !== "string"){
62
- const err4 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/0/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
60
+ for(const key0 in data){
61
+ if(!(((key0 === "mode") || (key0 === "type")) || (key0 === "id"))){
62
+ const err4 = {instancePath,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
63
63
  if(vErrors === null){
64
64
  vErrors = [err4];
65
65
  }
@@ -68,8 +68,11 @@ vErrors.push(err4);
68
68
  }
69
69
  errors++;
70
70
  }
71
- if("member" !== data0){
72
- const err5 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/0/properties/mode/const",keyword:"const",params:{allowedValue: "member"},message:"must be equal to constant"};
71
+ }
72
+ if(data.mode !== undefined){
73
+ let data0 = data.mode;
74
+ if(typeof data0 !== "string"){
75
+ const err5 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/0/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
73
76
  if(vErrors === null){
74
77
  vErrors = [err5];
75
78
  }
@@ -78,38 +81,48 @@ vErrors.push(err5);
78
81
  }
79
82
  errors++;
80
83
  }
84
+ if("member" !== data0){
85
+ const err6 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/0/properties/mode/const",keyword:"const",params:{allowedValue: "member"},message:"must be equal to constant"};
86
+ if(vErrors === null){
87
+ vErrors = [err6];
88
+ }
89
+ else {
90
+ vErrors.push(err6);
91
+ }
92
+ errors++;
93
+ }
81
94
  }
82
95
  if(data.type !== undefined){
83
96
  let data1 = data.type;
84
97
  if(typeof data1 !== "string"){
85
- const err6 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
98
+ const err7 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
86
99
  if(vErrors === null){
87
- vErrors = [err6];
100
+ vErrors = [err7];
88
101
  }
89
102
  else {
90
- vErrors.push(err6);
103
+ vErrors.push(err7);
91
104
  }
92
105
  errors++;
93
106
  }
94
107
  if("user" !== data1){
95
- const err7 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue: "user"},message:"must be equal to constant"};
108
+ const err8 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue: "user"},message:"must be equal to constant"};
96
109
  if(vErrors === null){
97
- vErrors = [err7];
110
+ vErrors = [err8];
98
111
  }
99
112
  else {
100
- vErrors.push(err7);
113
+ vErrors.push(err8);
101
114
  }
102
115
  errors++;
103
116
  }
104
117
  }
105
118
  if(data.id !== undefined){
106
119
  if(typeof data.id !== "string"){
107
- const err8 = {instancePath:instancePath+"/id",schemaPath:"#/oneOf/0/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
120
+ const err9 = {instancePath:instancePath+"/id",schemaPath:"#/oneOf/0/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
108
121
  if(vErrors === null){
109
- vErrors = [err8];
122
+ vErrors = [err9];
110
123
  }
111
124
  else {
112
- vErrors.push(err8);
125
+ vErrors.push(err9);
113
126
  }
114
127
  errors++;
115
128
  }
@@ -120,57 +133,69 @@ if(_valid0){
120
133
  valid0 = true;
121
134
  passing0 = 0;
122
135
  }
123
- const _errs9 = errors;
136
+ const _errs10 = errors;
124
137
  if(data && typeof data == "object" && !Array.isArray(data)){
125
138
  if(data.mode === undefined){
126
- const err9 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};
139
+ const err10 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};
127
140
  if(vErrors === null){
128
- vErrors = [err9];
141
+ vErrors = [err10];
129
142
  }
130
143
  else {
131
- vErrors.push(err9);
144
+ vErrors.push(err10);
132
145
  }
133
146
  errors++;
134
147
  }
135
148
  if(data.type === undefined){
136
- const err10 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
149
+ const err11 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
137
150
  if(vErrors === null){
138
- vErrors = [err10];
151
+ vErrors = [err11];
139
152
  }
140
153
  else {
141
- vErrors.push(err10);
154
+ vErrors.push(err11);
142
155
  }
143
156
  errors++;
144
157
  }
145
158
  if(data.email === undefined){
146
- const err11 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "email"},message:"must have required property '"+"email"+"'"};
159
+ const err12 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "email"},message:"must have required property '"+"email"+"'"};
147
160
  if(vErrors === null){
148
- vErrors = [err11];
161
+ vErrors = [err12];
149
162
  }
150
163
  else {
151
- vErrors.push(err11);
164
+ vErrors.push(err12);
165
+ }
166
+ errors++;
167
+ }
168
+ for(const key1 in data){
169
+ if(!(((key1 === "mode") || (key1 === "type")) || (key1 === "email"))){
170
+ const err13 = {instancePath,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
171
+ if(vErrors === null){
172
+ vErrors = [err13];
173
+ }
174
+ else {
175
+ vErrors.push(err13);
152
176
  }
153
177
  errors++;
154
178
  }
179
+ }
155
180
  if(data.mode !== undefined){
156
181
  let data3 = data.mode;
157
182
  if(typeof data3 !== "string"){
158
- const err12 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/1/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
183
+ const err14 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/1/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
159
184
  if(vErrors === null){
160
- vErrors = [err12];
185
+ vErrors = [err14];
161
186
  }
162
187
  else {
163
- vErrors.push(err12);
188
+ vErrors.push(err14);
164
189
  }
165
190
  errors++;
166
191
  }
167
192
  if("member" !== data3){
168
- const err13 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/1/properties/mode/const",keyword:"const",params:{allowedValue: "member"},message:"must be equal to constant"};
193
+ const err15 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/1/properties/mode/const",keyword:"const",params:{allowedValue: "member"},message:"must be equal to constant"};
169
194
  if(vErrors === null){
170
- vErrors = [err13];
195
+ vErrors = [err15];
171
196
  }
172
197
  else {
173
- vErrors.push(err13);
198
+ vErrors.push(err15);
174
199
  }
175
200
  errors++;
176
201
  }
@@ -178,40 +203,40 @@ errors++;
178
203
  if(data.type !== undefined){
179
204
  let data4 = data.type;
180
205
  if(typeof data4 !== "string"){
181
- const err14 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
206
+ const err16 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
182
207
  if(vErrors === null){
183
- vErrors = [err14];
208
+ vErrors = [err16];
184
209
  }
185
210
  else {
186
- vErrors.push(err14);
211
+ vErrors.push(err16);
187
212
  }
188
213
  errors++;
189
214
  }
190
215
  if("user" !== data4){
191
- const err15 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue: "user"},message:"must be equal to constant"};
216
+ const err17 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue: "user"},message:"must be equal to constant"};
192
217
  if(vErrors === null){
193
- vErrors = [err15];
218
+ vErrors = [err17];
194
219
  }
195
220
  else {
196
- vErrors.push(err15);
221
+ vErrors.push(err17);
197
222
  }
198
223
  errors++;
199
224
  }
200
225
  }
201
226
  if(data.email !== undefined){
202
227
  if(typeof data.email !== "string"){
203
- const err16 = {instancePath:instancePath+"/email",schemaPath:"#/oneOf/1/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"};
228
+ const err18 = {instancePath:instancePath+"/email",schemaPath:"#/oneOf/1/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"};
204
229
  if(vErrors === null){
205
- vErrors = [err16];
230
+ vErrors = [err18];
206
231
  }
207
232
  else {
208
- vErrors.push(err16);
233
+ vErrors.push(err18);
209
234
  }
210
235
  errors++;
211
236
  }
212
237
  }
213
238
  }
214
- var _valid0 = _errs9 === errors;
239
+ var _valid0 = _errs10 === errors;
215
240
  if(_valid0 && valid0){
216
241
  valid0 = false;
217
242
  passing0 = [passing0, 1];
@@ -221,57 +246,69 @@ if(_valid0){
221
246
  valid0 = true;
222
247
  passing0 = 1;
223
248
  }
224
- const _errs16 = errors;
249
+ const _errs18 = errors;
225
250
  if(data && typeof data == "object" && !Array.isArray(data)){
226
251
  if(data.mode === undefined){
227
- const err17 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};
252
+ const err19 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};
228
253
  if(vErrors === null){
229
- vErrors = [err17];
254
+ vErrors = [err19];
230
255
  }
231
256
  else {
232
- vErrors.push(err17);
257
+ vErrors.push(err19);
233
258
  }
234
259
  errors++;
235
260
  }
236
261
  if(data.type === undefined){
237
- const err18 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
262
+ const err20 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
238
263
  if(vErrors === null){
239
- vErrors = [err18];
264
+ vErrors = [err20];
240
265
  }
241
266
  else {
242
- vErrors.push(err18);
267
+ vErrors.push(err20);
243
268
  }
244
269
  errors++;
245
270
  }
246
271
  if(data.id === undefined){
247
- const err19 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
272
+ const err21 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
248
273
  if(vErrors === null){
249
- vErrors = [err19];
274
+ vErrors = [err21];
250
275
  }
251
276
  else {
252
- vErrors.push(err19);
277
+ vErrors.push(err21);
278
+ }
279
+ errors++;
280
+ }
281
+ for(const key2 in data){
282
+ if(!(((((key2 === "mode") || (key2 === "type")) || (key2 === "department")) || (key2 === "roles")) || (key2 === "id"))){
283
+ const err22 = {instancePath,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
284
+ if(vErrors === null){
285
+ vErrors = [err22];
286
+ }
287
+ else {
288
+ vErrors.push(err22);
253
289
  }
254
290
  errors++;
255
291
  }
292
+ }
256
293
  if(data.mode !== undefined){
257
294
  let data6 = data.mode;
258
295
  if(typeof data6 !== "string"){
259
- const err20 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/2/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
296
+ const err23 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/2/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
260
297
  if(vErrors === null){
261
- vErrors = [err20];
298
+ vErrors = [err23];
262
299
  }
263
300
  else {
264
- vErrors.push(err20);
301
+ vErrors.push(err23);
265
302
  }
266
303
  errors++;
267
304
  }
268
305
  if("member" !== data6){
269
- const err21 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/2/properties/mode/const",keyword:"const",params:{allowedValue: "member"},message:"must be equal to constant"};
306
+ const err24 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/2/properties/mode/const",keyword:"const",params:{allowedValue: "member"},message:"must be equal to constant"};
270
307
  if(vErrors === null){
271
- vErrors = [err21];
308
+ vErrors = [err24];
272
309
  }
273
310
  else {
274
- vErrors.push(err21);
311
+ vErrors.push(err24);
275
312
  }
276
313
  errors++;
277
314
  }
@@ -279,22 +316,22 @@ errors++;
279
316
  if(data.type !== undefined){
280
317
  let data7 = data.type;
281
318
  if(typeof data7 !== "string"){
282
- const err22 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
319
+ const err25 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
283
320
  if(vErrors === null){
284
- vErrors = [err22];
321
+ vErrors = [err25];
285
322
  }
286
323
  else {
287
- vErrors.push(err22);
324
+ vErrors.push(err25);
288
325
  }
289
326
  errors++;
290
327
  }
291
328
  if("organization" !== data7){
292
- const err23 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue: "organization"},message:"must be equal to constant"};
329
+ const err26 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue: "organization"},message:"must be equal to constant"};
293
330
  if(vErrors === null){
294
- vErrors = [err23];
331
+ vErrors = [err26];
295
332
  }
296
333
  else {
297
- vErrors.push(err23);
334
+ vErrors.push(err26);
298
335
  }
299
336
  errors++;
300
337
  }
@@ -302,22 +339,22 @@ errors++;
302
339
  if(data.department !== undefined){
303
340
  let data8 = data.department;
304
341
  if(typeof data8 !== "string"){
305
- const err24 = {instancePath:instancePath+"/department",schemaPath:"#/oneOf/2/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
342
+ const err27 = {instancePath:instancePath+"/department",schemaPath:"#/oneOf/2/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
306
343
  if(vErrors === null){
307
- vErrors = [err24];
344
+ vErrors = [err27];
308
345
  }
309
346
  else {
310
- vErrors.push(err24);
347
+ vErrors.push(err27);
311
348
  }
312
349
  errors++;
313
350
  }
314
351
  if("*" !== data8){
315
- const err25 = {instancePath:instancePath+"/department",schemaPath:"#/oneOf/2/properties/department/const",keyword:"const",params:{allowedValue: "*"},message:"must be equal to constant"};
352
+ const err28 = {instancePath:instancePath+"/department",schemaPath:"#/oneOf/2/properties/department/const",keyword:"const",params:{allowedValue: "*"},message:"must be equal to constant"};
316
353
  if(vErrors === null){
317
- vErrors = [err25];
354
+ vErrors = [err28];
318
355
  }
319
356
  else {
320
- vErrors.push(err25);
357
+ vErrors.push(err28);
321
358
  }
322
359
  errors++;
323
360
  }
@@ -325,40 +362,40 @@ errors++;
325
362
  if(data.roles !== undefined){
326
363
  let data9 = data.roles;
327
364
  if(!(Array.isArray(data9))){
328
- const err26 = {instancePath:instancePath+"/roles",schemaPath:"#/oneOf/2/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"};
365
+ const err29 = {instancePath:instancePath+"/roles",schemaPath:"#/oneOf/2/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"};
329
366
  if(vErrors === null){
330
- vErrors = [err26];
367
+ vErrors = [err29];
331
368
  }
332
369
  else {
333
- vErrors.push(err26);
370
+ vErrors.push(err29);
334
371
  }
335
372
  errors++;
336
373
  }
337
374
  if(!func0(data9, schema16.oneOf[2].properties.roles.const)){
338
- const err27 = {instancePath:instancePath+"/roles",schemaPath:"#/oneOf/2/properties/roles/const",keyword:"const",params:{allowedValue: schema16.oneOf[2].properties.roles.const},message:"must be equal to constant"};
375
+ const err30 = {instancePath:instancePath+"/roles",schemaPath:"#/oneOf/2/properties/roles/const",keyword:"const",params:{allowedValue: schema16.oneOf[2].properties.roles.const},message:"must be equal to constant"};
339
376
  if(vErrors === null){
340
- vErrors = [err27];
377
+ vErrors = [err30];
341
378
  }
342
379
  else {
343
- vErrors.push(err27);
380
+ vErrors.push(err30);
344
381
  }
345
382
  errors++;
346
383
  }
347
384
  }
348
385
  if(data.id !== undefined){
349
386
  if(typeof data.id !== "string"){
350
- const err28 = {instancePath:instancePath+"/id",schemaPath:"#/oneOf/2/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
387
+ const err31 = {instancePath:instancePath+"/id",schemaPath:"#/oneOf/2/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
351
388
  if(vErrors === null){
352
- vErrors = [err28];
389
+ vErrors = [err31];
353
390
  }
354
391
  else {
355
- vErrors.push(err28);
392
+ vErrors.push(err31);
356
393
  }
357
394
  errors++;
358
395
  }
359
396
  }
360
397
  }
361
- var _valid0 = _errs16 === errors;
398
+ var _valid0 = _errs18 === errors;
362
399
  if(_valid0 && valid0){
363
400
  valid0 = false;
364
401
  passing0 = [passing0, 2];
@@ -368,57 +405,69 @@ if(_valid0){
368
405
  valid0 = true;
369
406
  passing0 = 2;
370
407
  }
371
- const _errs27 = errors;
408
+ const _errs30 = errors;
372
409
  if(data && typeof data == "object" && !Array.isArray(data)){
373
410
  if(data.mode === undefined){
374
- const err29 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};
411
+ const err32 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};
375
412
  if(vErrors === null){
376
- vErrors = [err29];
413
+ vErrors = [err32];
377
414
  }
378
415
  else {
379
- vErrors.push(err29);
416
+ vErrors.push(err32);
380
417
  }
381
418
  errors++;
382
419
  }
383
420
  if(data.type === undefined){
384
- const err30 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
421
+ const err33 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
385
422
  if(vErrors === null){
386
- vErrors = [err30];
423
+ vErrors = [err33];
387
424
  }
388
425
  else {
389
- vErrors.push(err30);
426
+ vErrors.push(err33);
390
427
  }
391
428
  errors++;
392
429
  }
393
430
  if(data.id === undefined){
394
- const err31 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
431
+ const err34 = {instancePath,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
395
432
  if(vErrors === null){
396
- vErrors = [err31];
433
+ vErrors = [err34];
397
434
  }
398
435
  else {
399
- vErrors.push(err31);
436
+ vErrors.push(err34);
437
+ }
438
+ errors++;
439
+ }
440
+ for(const key3 in data){
441
+ if(!(((((key3 === "mode") || (key3 === "type")) || (key3 === "id")) || (key3 === "department")) || (key3 === "roles"))){
442
+ const err35 = {instancePath,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};
443
+ if(vErrors === null){
444
+ vErrors = [err35];
445
+ }
446
+ else {
447
+ vErrors.push(err35);
400
448
  }
401
449
  errors++;
402
450
  }
451
+ }
403
452
  if(data.mode !== undefined){
404
453
  let data11 = data.mode;
405
454
  if(typeof data11 !== "string"){
406
- const err32 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/3/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
455
+ const err36 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/3/properties/mode/type",keyword:"type",params:{type: "string"},message:"must be string"};
407
456
  if(vErrors === null){
408
- vErrors = [err32];
457
+ vErrors = [err36];
409
458
  }
410
459
  else {
411
- vErrors.push(err32);
460
+ vErrors.push(err36);
412
461
  }
413
462
  errors++;
414
463
  }
415
464
  if("internal" !== data11){
416
- const err33 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/3/properties/mode/const",keyword:"const",params:{allowedValue: "internal"},message:"must be equal to constant"};
465
+ const err37 = {instancePath:instancePath+"/mode",schemaPath:"#/oneOf/3/properties/mode/const",keyword:"const",params:{allowedValue: "internal"},message:"must be equal to constant"};
417
466
  if(vErrors === null){
418
- vErrors = [err33];
467
+ vErrors = [err37];
419
468
  }
420
469
  else {
421
- vErrors.push(err33);
470
+ vErrors.push(err37);
422
471
  }
423
472
  errors++;
424
473
  }
@@ -426,46 +475,46 @@ errors++;
426
475
  if(data.type !== undefined){
427
476
  let data12 = data.type;
428
477
  if(typeof data12 !== "string"){
429
- const err34 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/3/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
478
+ const err38 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/3/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
430
479
  if(vErrors === null){
431
- vErrors = [err34];
480
+ vErrors = [err38];
432
481
  }
433
482
  else {
434
- vErrors.push(err34);
483
+ vErrors.push(err38);
435
484
  }
436
485
  errors++;
437
486
  }
438
487
  if("organization" !== data12){
439
- const err35 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue: "organization"},message:"must be equal to constant"};
488
+ const err39 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue: "organization"},message:"must be equal to constant"};
440
489
  if(vErrors === null){
441
- vErrors = [err35];
490
+ vErrors = [err39];
442
491
  }
443
492
  else {
444
- vErrors.push(err35);
493
+ vErrors.push(err39);
445
494
  }
446
495
  errors++;
447
496
  }
448
497
  }
449
498
  if(data.id !== undefined){
450
499
  if(typeof data.id !== "string"){
451
- const err36 = {instancePath:instancePath+"/id",schemaPath:"#/oneOf/3/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
500
+ const err40 = {instancePath:instancePath+"/id",schemaPath:"#/oneOf/3/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
452
501
  if(vErrors === null){
453
- vErrors = [err36];
502
+ vErrors = [err40];
454
503
  }
455
504
  else {
456
- vErrors.push(err36);
505
+ vErrors.push(err40);
457
506
  }
458
507
  errors++;
459
508
  }
460
509
  }
461
510
  if(data.department !== undefined){
462
511
  if(typeof data.department !== "string"){
463
- const err37 = {instancePath:instancePath+"/department",schemaPath:"#/oneOf/3/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
512
+ const err41 = {instancePath:instancePath+"/department",schemaPath:"#/oneOf/3/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
464
513
  if(vErrors === null){
465
- vErrors = [err37];
514
+ vErrors = [err41];
466
515
  }
467
516
  else {
468
- vErrors.push(err37);
517
+ vErrors.push(err41);
469
518
  }
470
519
  errors++;
471
520
  }
@@ -476,30 +525,30 @@ if(Array.isArray(data15)){
476
525
  const len0 = data15.length;
477
526
  for(let i0=0; i0<len0; i0++){
478
527
  if(typeof data15[i0] !== "string"){
479
- const err38 = {instancePath:instancePath+"/roles/" + i0,schemaPath:"#/oneOf/3/properties/roles/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
528
+ const err42 = {instancePath:instancePath+"/roles/" + i0,schemaPath:"#/oneOf/3/properties/roles/items/type",keyword:"type",params:{type: "string"},message:"must be string"};
480
529
  if(vErrors === null){
481
- vErrors = [err38];
530
+ vErrors = [err42];
482
531
  }
483
532
  else {
484
- vErrors.push(err38);
533
+ vErrors.push(err42);
485
534
  }
486
535
  errors++;
487
536
  }
488
537
  }
489
538
  }
490
539
  else {
491
- const err39 = {instancePath:instancePath+"/roles",schemaPath:"#/oneOf/3/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"};
540
+ const err43 = {instancePath:instancePath+"/roles",schemaPath:"#/oneOf/3/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"};
492
541
  if(vErrors === null){
493
- vErrors = [err39];
542
+ vErrors = [err43];
494
543
  }
495
544
  else {
496
- vErrors.push(err39);
545
+ vErrors.push(err43);
497
546
  }
498
547
  errors++;
499
548
  }
500
549
  }
501
550
  }
502
- var _valid0 = _errs27 === errors;
551
+ var _valid0 = _errs30 === errors;
503
552
  if(_valid0 && valid0){
504
553
  valid0 = false;
505
554
  passing0 = [passing0, 3];
@@ -513,12 +562,12 @@ passing0 = 3;
513
562
  }
514
563
  }
515
564
  if(!valid0){
516
- const err40 = {instancePath,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
565
+ const err44 = {instancePath,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
517
566
  if(vErrors === null){
518
- vErrors = [err40];
567
+ vErrors = [err44];
519
568
  }
520
569
  else {
521
- vErrors.push(err40);
570
+ vErrors.push(err44);
522
571
  }
523
572
  errors++;
524
573
  }
@@ -5,9 +5,9 @@ export * from './.type/index.js';
5
5
  export const matchAccessRef = (session, accessRef) => {
6
6
  // Check by user, not active account
7
7
  if (accessRef.type === 'user') {
8
- if (accessRef.id)
8
+ if ('id' in accessRef)
9
9
  return session.user.id === accessRef.id;
10
- if (accessRef.email)
10
+ if ('email' in accessRef)
11
11
  return session.user.email === accessRef.email;
12
12
  return false;
13
13
  }
@@ -2,13 +2,36 @@ declare const _default: {
2
2
  $id: string;
3
3
  'x-exports': string[];
4
4
  title: string;
5
+ 'x-i18n-title': {
6
+ fr: string;
7
+ en: string;
8
+ es: string;
9
+ it: string;
10
+ pt: string;
11
+ de: string;
12
+ };
5
13
  type: string;
14
+ discriminator: {
15
+ propertyName: string;
16
+ };
17
+ oneOfLayout: {
18
+ emptyData: boolean;
19
+ };
6
20
  oneOf: ({
7
21
  title: string;
22
+ 'x-i18n-title': {
23
+ fr: string;
24
+ en: string;
25
+ es: string;
26
+ it: string;
27
+ pt: string;
28
+ de: string;
29
+ };
8
30
  layout: {
9
31
  if: string;
10
32
  };
11
33
  required: string[];
34
+ additionalProperties: boolean;
12
35
  properties: {
13
36
  mode: {
14
37
  type: string;
@@ -36,7 +59,16 @@ declare const _default: {
36
59
  };
37
60
  } | {
38
61
  title: string;
62
+ 'x-i18n-title': {
63
+ fr: string;
64
+ en: string;
65
+ es: string;
66
+ it: string;
67
+ pt: string;
68
+ de: string;
69
+ };
39
70
  required: string[];
71
+ additionalProperties: boolean;
40
72
  properties: {
41
73
  mode: {
42
74
  type: string;
@@ -49,6 +81,14 @@ declare const _default: {
49
81
  email: {
50
82
  type: string;
51
83
  title: string;
84
+ 'x-i18n-title': {
85
+ fr: string;
86
+ en: string;
87
+ es: string;
88
+ it: string;
89
+ pt: string;
90
+ de: string;
91
+ };
52
92
  };
53
93
  id?: undefined;
54
94
  department?: undefined;
@@ -57,10 +97,19 @@ declare const _default: {
57
97
  layout?: undefined;
58
98
  } | {
59
99
  title: string;
100
+ 'x-i18n-title': {
101
+ fr: string;
102
+ en: string;
103
+ es: string;
104
+ it: string;
105
+ pt: string;
106
+ de: string;
107
+ };
60
108
  layout: {
61
109
  if: string;
62
110
  };
63
111
  required: string[];
112
+ additionalProperties: boolean;
64
113
  properties: {
65
114
  mode: {
66
115
  type: string;
@@ -97,10 +146,19 @@ declare const _default: {
97
146
  };
98
147
  } | {
99
148
  title: string;
149
+ 'x-i18n-title': {
150
+ fr: string;
151
+ en: string;
152
+ es: string;
153
+ it: string;
154
+ pt: string;
155
+ de: string;
156
+ };
100
157
  layout: {
101
158
  if: string;
102
159
  };
103
160
  required: string[];
161
+ additionalProperties: boolean;
104
162
  properties: {
105
163
  mode: {
106
164
  type: string;
@@ -3,12 +3,35 @@ export default {
3
3
  $id: 'https://github.com/data-fair/lib/access-ref',
4
4
  'x-exports': ['types', 'validate'],
5
5
  title: 'Access Ref',
6
+ 'x-i18n-title': {
7
+ fr: 'Référence d\'accès',
8
+ en: 'Access Ref',
9
+ es: 'Referencia de acceso',
10
+ it: 'Riferimento di accesso',
11
+ pt: 'Referência de acesso',
12
+ de: 'Zugriffsreferenz'
13
+ },
6
14
  type: 'object',
15
+ discriminator: {
16
+ propertyName: 'mode'
17
+ },
18
+ oneOfLayout: {
19
+ emptyData: true
20
+ },
7
21
  oneOf: [
8
22
  {
9
23
  title: "Un membre de l'organisation",
24
+ 'x-i18n-title': {
25
+ fr: "Un membre de l'organisation",
26
+ en: 'An organization member',
27
+ es: 'Un miembro de la organización',
28
+ it: "Un membro dell'organizzazione",
29
+ pt: 'Um membro da organização',
30
+ de: 'Ein Organisationsmitglied'
31
+ },
10
32
  layout: { if: "context.owner.type === 'organization'" },
11
33
  required: ['mode', 'type', 'id'],
34
+ additionalProperties: false,
12
35
  properties: {
13
36
  mode: { type: 'string', const: 'member' },
14
37
  type: { type: 'string', const: 'user' },
@@ -28,17 +51,46 @@ export default {
28
51
  },
29
52
  {
30
53
  title: 'Un email',
54
+ 'x-i18n-title': {
55
+ fr: 'Un email',
56
+ en: 'An email',
57
+ es: 'Un correo electrónico',
58
+ it: "Un'email",
59
+ pt: 'Um email',
60
+ de: 'Eine E-Mail'
61
+ },
31
62
  required: ['mode', 'type', 'email'],
63
+ additionalProperties: false,
32
64
  properties: {
33
65
  mode: { type: 'string', const: 'member' },
34
66
  type: { type: 'string', const: 'user' },
35
- email: { type: 'string', title: 'Adresse mail' }
67
+ email: {
68
+ type: 'string',
69
+ title: 'Adresse mail',
70
+ 'x-i18n-title': {
71
+ fr: 'Adresse mail',
72
+ en: 'Email address',
73
+ es: 'Dirección de correo',
74
+ it: 'Indirizzo email',
75
+ pt: 'Endereço de email',
76
+ de: 'E-Mail-Adresse'
77
+ }
78
+ }
36
79
  }
37
80
  },
38
81
  {
39
82
  title: 'Une organisation partenaire',
83
+ 'x-i18n-title': {
84
+ fr: 'Une organisation partenaire',
85
+ en: 'A partner organization',
86
+ es: 'Una organización asociada',
87
+ it: "Un'organizzazione partner",
88
+ pt: 'Uma organização parceira',
89
+ de: 'Eine Partnerorganisation'
90
+ },
40
91
  layout: { if: "context.owner.type === 'organization'" },
41
92
  required: ['mode', 'type', 'id'],
93
+ additionalProperties: false,
42
94
  properties: {
43
95
  mode: { type: 'string', const: 'member' },
44
96
  type: { type: 'string', const: 'organization' },
@@ -60,8 +112,17 @@ export default {
60
112
  },
61
113
  {
62
114
  title: 'Un role ou département de mon organisation',
115
+ 'x-i18n-title': {
116
+ fr: 'Un rôle ou département de mon organisation',
117
+ en: 'A role or department of my organization',
118
+ es: 'Un rol o departamento de mi organización',
119
+ it: 'Un ruolo o dipartimento della mia organizzazione',
120
+ pt: 'Um papel ou departamento da minha organização',
121
+ de: 'Eine Rolle oder Abteilung meiner Organisation'
122
+ },
63
123
  layout: { if: "context.owner.type === 'organization'" },
64
124
  required: ['mode', 'type', 'id'],
125
+ additionalProperties: false,
65
126
  properties: {
66
127
  mode: { type: 'string', const: 'internal' },
67
128
  type: { type: 'string', const: 'organization' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {