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