@data-fair/types-portals 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/access-account-ref/.type/index.d.ts +38 -0
- package/access-account-ref/.type/index.js +7 -0
- package/access-account-ref/index.d.ts +1 -0
- package/index.ts +7 -0
- package/package.json +20 -0
- package/post-search-page/.type/index.d.ts +67 -0
- package/post-search-page/.type/index.js +19 -0
- package/post-search-page/.type/validate.js +466 -0
- package/post-search-page/index.d.ts +1 -0
- package/search-page/.type/index.d.ts +73 -0
- package/search-page/.type/index.js +19 -0
- package/search-page/.type/validate.js +538 -0
- package/search-page/index.d.ts +1 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
export const schemaExports: string[]
|
|
3
|
+
|
|
4
|
+
// see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
|
|
5
|
+
/**
|
|
6
|
+
* A flexible account reference used to grant permissions, private access, etc
|
|
7
|
+
*/
|
|
8
|
+
export type AccessAccountRef = {
|
|
9
|
+
/**
|
|
10
|
+
* If the entity is a user or an organization
|
|
11
|
+
*/
|
|
12
|
+
type: "user" | "organization";
|
|
13
|
+
/**
|
|
14
|
+
* Identifier of the entity
|
|
15
|
+
*/
|
|
16
|
+
id?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Name of the entity
|
|
19
|
+
*/
|
|
20
|
+
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Email of the user (can be used as an alternative to the id)
|
|
23
|
+
*/
|
|
24
|
+
email?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Identifier of the department or "*" for any department (same as empty) or "-" for no department
|
|
27
|
+
*/
|
|
28
|
+
department?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Name of the department
|
|
31
|
+
*/
|
|
32
|
+
departmentName?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Role name
|
|
35
|
+
*/
|
|
36
|
+
role?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.type/index.js'
|
package/index.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SearchPage } from './search-page/index.ts'
|
|
2
|
+
import type { PostSearchPage } from './post-search-page/index.ts'
|
|
3
|
+
import type { AccessAccountRef } from './access-account-ref/index.ts'
|
|
4
|
+
|
|
5
|
+
export type { SearchPage }
|
|
6
|
+
export type { PostSearchPage }
|
|
7
|
+
export type { AccessAccountRef }
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@data-fair/types-portals",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared types between @data-fair/portals service and other linked services.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"prepublishOnly": "npm run build-types",
|
|
9
|
+
"build-types": "df-build-types ./"
|
|
10
|
+
},
|
|
11
|
+
"author": "",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "v24"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"**.ts",
|
|
17
|
+
"**/.type/**"
|
|
18
|
+
],
|
|
19
|
+
"license": "AGPL-3.0-only"
|
|
20
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
export const schemaExports: string[]
|
|
3
|
+
|
|
4
|
+
// see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
|
|
5
|
+
export type PostSearchPage = {
|
|
6
|
+
/**
|
|
7
|
+
* Portal ID
|
|
8
|
+
*/
|
|
9
|
+
portal: string;
|
|
10
|
+
owner: Account;
|
|
11
|
+
resource: {
|
|
12
|
+
type: "dataset" | "application";
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
public?: boolean;
|
|
16
|
+
privateAccess?: AccessAccountRef[];
|
|
17
|
+
/**
|
|
18
|
+
* Status of the search page indexing. Use toIndex to index or reindex, toDelete to remove from the index.
|
|
19
|
+
*/
|
|
20
|
+
indexingStatus?: "toIndex" | "toDelete";
|
|
21
|
+
}
|
|
22
|
+
export type Account = {
|
|
23
|
+
type: "user" | "organization";
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
department?: string;
|
|
27
|
+
departmentName?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A flexible account reference used to grant permissions, private access, etc
|
|
31
|
+
*/
|
|
32
|
+
export type AccessAccountRef = {
|
|
33
|
+
/**
|
|
34
|
+
* If the entity is a user or an organization
|
|
35
|
+
*/
|
|
36
|
+
type: "user" | "organization";
|
|
37
|
+
/**
|
|
38
|
+
* Identifier of the entity
|
|
39
|
+
*/
|
|
40
|
+
id?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Name of the entity
|
|
43
|
+
*/
|
|
44
|
+
name?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Email of the user (can be used as an alternative to the id)
|
|
47
|
+
*/
|
|
48
|
+
email?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Identifier of the department or "*" for any department (same as empty) or "-" for no department
|
|
51
|
+
*/
|
|
52
|
+
department?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Name of the department
|
|
55
|
+
*/
|
|
56
|
+
departmentName?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Role name
|
|
59
|
+
*/
|
|
60
|
+
role?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export declare function validate(data: any): data is PostSearchPage
|
|
65
|
+
export declare function assertValid(data: any, options?: import('@data-fair/lib-validation').AssertValidOptions): asserts data is PostSearchPage
|
|
66
|
+
export declare function returnValid(data: any, options?: import('@data-fair/lib-validation').AssertValidOptions): PostSearchPage
|
|
67
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import validate from './validate.js'
|
|
5
|
+
import { assertValid as assertValidGeneric } from '@data-fair/lib-validation'
|
|
6
|
+
|
|
7
|
+
export const schemaExports = [
|
|
8
|
+
"types",
|
|
9
|
+
"validate"
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
export { validate } from './validate.js'
|
|
13
|
+
export function assertValid(data, options) {
|
|
14
|
+
assertValidGeneric(validate, data, options)
|
|
15
|
+
}
|
|
16
|
+
export function returnValid(data, options) {
|
|
17
|
+
assertValid(data, options)
|
|
18
|
+
return data
|
|
19
|
+
}
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
export const validate = validate14;
|
|
6
|
+
export default validate14;
|
|
7
|
+
const schema16 = {"$id":"https://github.com/data-fair/portals/search-page/post-search-page","x-exports":["types","validate"],"title":"Post search page","type":"object","additionalProperties":false,"required":["portal","owner","resource"],"properties":{"portal":{"type":"string","description":"Portal ID"},"owner":{"$ref":"https://github.com/data-fair/lib/session-state#/$defs/account"},"resource":{"additionalProperties":false,"required":["type","id"],"properties":{"type":{"type":"string","enum":["dataset","application"]},"id":{"type":"string"}}},"public":{"type":"boolean"},"privateAccess":{"type":"array","items":{"$ref":"https://github.com/data-fair/portals/access-account-ref"}},"indexingStatus":{"type":"string","enum":["toIndex","toDelete"],"description":"Status of the search page indexing. Use toIndex to index or reindex, toDelete to remove from the index."}}};
|
|
8
|
+
const schema22 = {"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 schema26 = {"$id":"https://github.com/data-fair/portals/access-account-ref","title":"Access account ref","x-exports":["types"],"type":"object","description":"A flexible account reference used to grant permissions, private access, etc","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["user","organization"],"description":"If the entity is a user or an organization"},"id":{"type":"string","description":"Identifier of the entity"},"name":{"type":"string","description":"Name of the entity"},"email":{"type":"string","description":"Email of the user (can be used as an alternative to the id)"},"department":{"type":"string","description":"Identifier of the department or \"*\" for any department (same as empty) or \"-\" for no department"},"departmentName":{"type":"string","description":"Name of the department"},"role":{"type":"string","description":"Role name"}}};
|
|
10
|
+
|
|
11
|
+
function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
|
|
12
|
+
/*# sourceURL="https://github.com/data-fair/portals/search-page/post-search-page" */;
|
|
13
|
+
let vErrors = null;
|
|
14
|
+
let errors = 0;
|
|
15
|
+
if(data && typeof data == "object" && !Array.isArray(data)){
|
|
16
|
+
if(data.portal === undefined){
|
|
17
|
+
const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "portal"},message:"must have required property '"+"portal"+"'"};
|
|
18
|
+
if(vErrors === null){
|
|
19
|
+
vErrors = [err0];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
vErrors.push(err0);
|
|
23
|
+
}
|
|
24
|
+
errors++;
|
|
25
|
+
}
|
|
26
|
+
if(data.owner === undefined){
|
|
27
|
+
const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "owner"},message:"must have required property '"+"owner"+"'"};
|
|
28
|
+
if(vErrors === null){
|
|
29
|
+
vErrors = [err1];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
vErrors.push(err1);
|
|
33
|
+
}
|
|
34
|
+
errors++;
|
|
35
|
+
}
|
|
36
|
+
if(data.resource === undefined){
|
|
37
|
+
const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "resource"},message:"must have required property '"+"resource"+"'"};
|
|
38
|
+
if(vErrors === null){
|
|
39
|
+
vErrors = [err2];
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
vErrors.push(err2);
|
|
43
|
+
}
|
|
44
|
+
errors++;
|
|
45
|
+
}
|
|
46
|
+
for(const key0 in data){
|
|
47
|
+
if(!((((((key0 === "portal") || (key0 === "owner")) || (key0 === "resource")) || (key0 === "public")) || (key0 === "privateAccess")) || (key0 === "indexingStatus"))){
|
|
48
|
+
const err3 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
|
|
49
|
+
if(vErrors === null){
|
|
50
|
+
vErrors = [err3];
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
vErrors.push(err3);
|
|
54
|
+
}
|
|
55
|
+
errors++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if(data.portal !== undefined){
|
|
59
|
+
if(typeof data.portal !== "string"){
|
|
60
|
+
const err4 = {instancePath:instancePath+"/portal",schemaPath:"#/properties/portal/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
61
|
+
if(vErrors === null){
|
|
62
|
+
vErrors = [err4];
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
vErrors.push(err4);
|
|
66
|
+
}
|
|
67
|
+
errors++;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if(data.owner !== undefined){
|
|
71
|
+
let data1 = data.owner;
|
|
72
|
+
if(data1 && typeof data1 == "object" && !Array.isArray(data1)){
|
|
73
|
+
if(data1.type === undefined){
|
|
74
|
+
const err5 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
75
|
+
if(vErrors === null){
|
|
76
|
+
vErrors = [err5];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
vErrors.push(err5);
|
|
80
|
+
}
|
|
81
|
+
errors++;
|
|
82
|
+
}
|
|
83
|
+
if(data1.id === undefined){
|
|
84
|
+
const err6 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
85
|
+
if(vErrors === null){
|
|
86
|
+
vErrors = [err6];
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
vErrors.push(err6);
|
|
90
|
+
}
|
|
91
|
+
errors++;
|
|
92
|
+
}
|
|
93
|
+
if(data1.name === undefined){
|
|
94
|
+
const err7 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
95
|
+
if(vErrors === null){
|
|
96
|
+
vErrors = [err7];
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
vErrors.push(err7);
|
|
100
|
+
}
|
|
101
|
+
errors++;
|
|
102
|
+
}
|
|
103
|
+
for(const key1 in data1){
|
|
104
|
+
if(!(((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "department")) || (key1 === "departmentName"))){
|
|
105
|
+
const err8 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
|
|
106
|
+
if(vErrors === null){
|
|
107
|
+
vErrors = [err8];
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
vErrors.push(err8);
|
|
111
|
+
}
|
|
112
|
+
errors++;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if(data1.type !== undefined){
|
|
116
|
+
let data2 = data1.type;
|
|
117
|
+
if(typeof data2 !== "string"){
|
|
118
|
+
const err9 = {instancePath:instancePath+"/owner/type",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
119
|
+
if(vErrors === null){
|
|
120
|
+
vErrors = [err9];
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
vErrors.push(err9);
|
|
124
|
+
}
|
|
125
|
+
errors++;
|
|
126
|
+
}
|
|
127
|
+
if(!((data2 === "user") || (data2 === "organization"))){
|
|
128
|
+
const err10 = {instancePath:instancePath+"/owner/type",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/type/enum",keyword:"enum",params:{allowedValues: schema22.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
129
|
+
if(vErrors === null){
|
|
130
|
+
vErrors = [err10];
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
vErrors.push(err10);
|
|
134
|
+
}
|
|
135
|
+
errors++;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if(data1.id !== undefined){
|
|
139
|
+
if(typeof data1.id !== "string"){
|
|
140
|
+
const err11 = {instancePath:instancePath+"/owner/id",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
141
|
+
if(vErrors === null){
|
|
142
|
+
vErrors = [err11];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
vErrors.push(err11);
|
|
146
|
+
}
|
|
147
|
+
errors++;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if(data1.name !== undefined){
|
|
151
|
+
if(typeof data1.name !== "string"){
|
|
152
|
+
const err12 = {instancePath:instancePath+"/owner/name",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
153
|
+
if(vErrors === null){
|
|
154
|
+
vErrors = [err12];
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
vErrors.push(err12);
|
|
158
|
+
}
|
|
159
|
+
errors++;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if(data1.department !== undefined){
|
|
163
|
+
if(typeof data1.department !== "string"){
|
|
164
|
+
const err13 = {instancePath:instancePath+"/owner/department",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
165
|
+
if(vErrors === null){
|
|
166
|
+
vErrors = [err13];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
vErrors.push(err13);
|
|
170
|
+
}
|
|
171
|
+
errors++;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if(data1.departmentName !== undefined){
|
|
175
|
+
if(typeof data1.departmentName !== "string"){
|
|
176
|
+
const err14 = {instancePath:instancePath+"/owner/departmentName",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
177
|
+
if(vErrors === null){
|
|
178
|
+
vErrors = [err14];
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
vErrors.push(err14);
|
|
182
|
+
}
|
|
183
|
+
errors++;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const err15 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
189
|
+
if(vErrors === null){
|
|
190
|
+
vErrors = [err15];
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
vErrors.push(err15);
|
|
194
|
+
}
|
|
195
|
+
errors++;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if(data.resource !== undefined){
|
|
199
|
+
let data7 = data.resource;
|
|
200
|
+
if(data7 && typeof data7 == "object" && !Array.isArray(data7)){
|
|
201
|
+
if(data7.type === undefined){
|
|
202
|
+
const err16 = {instancePath:instancePath+"/resource",schemaPath:"#/properties/resource/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
203
|
+
if(vErrors === null){
|
|
204
|
+
vErrors = [err16];
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
vErrors.push(err16);
|
|
208
|
+
}
|
|
209
|
+
errors++;
|
|
210
|
+
}
|
|
211
|
+
if(data7.id === undefined){
|
|
212
|
+
const err17 = {instancePath:instancePath+"/resource",schemaPath:"#/properties/resource/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
213
|
+
if(vErrors === null){
|
|
214
|
+
vErrors = [err17];
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
vErrors.push(err17);
|
|
218
|
+
}
|
|
219
|
+
errors++;
|
|
220
|
+
}
|
|
221
|
+
for(const key2 in data7){
|
|
222
|
+
if(!((key2 === "type") || (key2 === "id"))){
|
|
223
|
+
const err18 = {instancePath:instancePath+"/resource",schemaPath:"#/properties/resource/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
|
|
224
|
+
if(vErrors === null){
|
|
225
|
+
vErrors = [err18];
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
vErrors.push(err18);
|
|
229
|
+
}
|
|
230
|
+
errors++;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if(data7.type !== undefined){
|
|
234
|
+
let data8 = data7.type;
|
|
235
|
+
if(typeof data8 !== "string"){
|
|
236
|
+
const err19 = {instancePath:instancePath+"/resource/type",schemaPath:"#/properties/resource/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
237
|
+
if(vErrors === null){
|
|
238
|
+
vErrors = [err19];
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
vErrors.push(err19);
|
|
242
|
+
}
|
|
243
|
+
errors++;
|
|
244
|
+
}
|
|
245
|
+
if(!((data8 === "dataset") || (data8 === "application"))){
|
|
246
|
+
const err20 = {instancePath:instancePath+"/resource/type",schemaPath:"#/properties/resource/properties/type/enum",keyword:"enum",params:{allowedValues: schema16.properties.resource.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
247
|
+
if(vErrors === null){
|
|
248
|
+
vErrors = [err20];
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
vErrors.push(err20);
|
|
252
|
+
}
|
|
253
|
+
errors++;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if(data7.id !== undefined){
|
|
257
|
+
if(typeof data7.id !== "string"){
|
|
258
|
+
const err21 = {instancePath:instancePath+"/resource/id",schemaPath:"#/properties/resource/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
259
|
+
if(vErrors === null){
|
|
260
|
+
vErrors = [err21];
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
vErrors.push(err21);
|
|
264
|
+
}
|
|
265
|
+
errors++;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if(data.public !== undefined){
|
|
271
|
+
if(typeof data.public !== "boolean"){
|
|
272
|
+
const err22 = {instancePath:instancePath+"/public",schemaPath:"#/properties/public/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
273
|
+
if(vErrors === null){
|
|
274
|
+
vErrors = [err22];
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
vErrors.push(err22);
|
|
278
|
+
}
|
|
279
|
+
errors++;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if(data.privateAccess !== undefined){
|
|
283
|
+
let data11 = data.privateAccess;
|
|
284
|
+
if(Array.isArray(data11)){
|
|
285
|
+
const len0 = data11.length;
|
|
286
|
+
for(let i0=0; i0<len0; i0++){
|
|
287
|
+
let data12 = data11[i0];
|
|
288
|
+
if(data12 && typeof data12 == "object" && !Array.isArray(data12)){
|
|
289
|
+
if(data12.type === undefined){
|
|
290
|
+
const err23 = {instancePath:instancePath+"/privateAccess/" + i0,schemaPath:"https://github.com/data-fair/portals/access-account-ref/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
291
|
+
if(vErrors === null){
|
|
292
|
+
vErrors = [err23];
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
vErrors.push(err23);
|
|
296
|
+
}
|
|
297
|
+
errors++;
|
|
298
|
+
}
|
|
299
|
+
for(const key3 in data12){
|
|
300
|
+
if(!(((((((key3 === "type") || (key3 === "id")) || (key3 === "name")) || (key3 === "email")) || (key3 === "department")) || (key3 === "departmentName")) || (key3 === "role"))){
|
|
301
|
+
const err24 = {instancePath:instancePath+"/privateAccess/" + i0,schemaPath:"https://github.com/data-fair/portals/access-account-ref/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};
|
|
302
|
+
if(vErrors === null){
|
|
303
|
+
vErrors = [err24];
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
vErrors.push(err24);
|
|
307
|
+
}
|
|
308
|
+
errors++;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if(data12.type !== undefined){
|
|
312
|
+
let data13 = data12.type;
|
|
313
|
+
if(typeof data13 !== "string"){
|
|
314
|
+
const err25 = {instancePath:instancePath+"/privateAccess/" + i0+"/type",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
315
|
+
if(vErrors === null){
|
|
316
|
+
vErrors = [err25];
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
vErrors.push(err25);
|
|
320
|
+
}
|
|
321
|
+
errors++;
|
|
322
|
+
}
|
|
323
|
+
if(!((data13 === "user") || (data13 === "organization"))){
|
|
324
|
+
const err26 = {instancePath:instancePath+"/privateAccess/" + i0+"/type",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/type/enum",keyword:"enum",params:{allowedValues: schema26.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
325
|
+
if(vErrors === null){
|
|
326
|
+
vErrors = [err26];
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
vErrors.push(err26);
|
|
330
|
+
}
|
|
331
|
+
errors++;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if(data12.id !== undefined){
|
|
335
|
+
if(typeof data12.id !== "string"){
|
|
336
|
+
const err27 = {instancePath:instancePath+"/privateAccess/" + i0+"/id",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
337
|
+
if(vErrors === null){
|
|
338
|
+
vErrors = [err27];
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
vErrors.push(err27);
|
|
342
|
+
}
|
|
343
|
+
errors++;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if(data12.name !== undefined){
|
|
347
|
+
if(typeof data12.name !== "string"){
|
|
348
|
+
const err28 = {instancePath:instancePath+"/privateAccess/" + i0+"/name",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
349
|
+
if(vErrors === null){
|
|
350
|
+
vErrors = [err28];
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
vErrors.push(err28);
|
|
354
|
+
}
|
|
355
|
+
errors++;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if(data12.email !== undefined){
|
|
359
|
+
if(typeof data12.email !== "string"){
|
|
360
|
+
const err29 = {instancePath:instancePath+"/privateAccess/" + i0+"/email",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
361
|
+
if(vErrors === null){
|
|
362
|
+
vErrors = [err29];
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
vErrors.push(err29);
|
|
366
|
+
}
|
|
367
|
+
errors++;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if(data12.department !== undefined){
|
|
371
|
+
if(typeof data12.department !== "string"){
|
|
372
|
+
const err30 = {instancePath:instancePath+"/privateAccess/" + i0+"/department",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
373
|
+
if(vErrors === null){
|
|
374
|
+
vErrors = [err30];
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
vErrors.push(err30);
|
|
378
|
+
}
|
|
379
|
+
errors++;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if(data12.departmentName !== undefined){
|
|
383
|
+
if(typeof data12.departmentName !== "string"){
|
|
384
|
+
const err31 = {instancePath:instancePath+"/privateAccess/" + i0+"/departmentName",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
385
|
+
if(vErrors === null){
|
|
386
|
+
vErrors = [err31];
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
vErrors.push(err31);
|
|
390
|
+
}
|
|
391
|
+
errors++;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if(data12.role !== undefined){
|
|
395
|
+
if(typeof data12.role !== "string"){
|
|
396
|
+
const err32 = {instancePath:instancePath+"/privateAccess/" + i0+"/role",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
397
|
+
if(vErrors === null){
|
|
398
|
+
vErrors = [err32];
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
vErrors.push(err32);
|
|
402
|
+
}
|
|
403
|
+
errors++;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
const err33 = {instancePath:instancePath+"/privateAccess/" + i0,schemaPath:"https://github.com/data-fair/portals/access-account-ref/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
409
|
+
if(vErrors === null){
|
|
410
|
+
vErrors = [err33];
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
vErrors.push(err33);
|
|
414
|
+
}
|
|
415
|
+
errors++;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
const err34 = {instancePath:instancePath+"/privateAccess",schemaPath:"#/properties/privateAccess/type",keyword:"type",params:{type: "array"},message:"must be array"};
|
|
421
|
+
if(vErrors === null){
|
|
422
|
+
vErrors = [err34];
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
vErrors.push(err34);
|
|
426
|
+
}
|
|
427
|
+
errors++;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if(data.indexingStatus !== undefined){
|
|
431
|
+
let data20 = data.indexingStatus;
|
|
432
|
+
if(typeof data20 !== "string"){
|
|
433
|
+
const err35 = {instancePath:instancePath+"/indexingStatus",schemaPath:"#/properties/indexingStatus/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
434
|
+
if(vErrors === null){
|
|
435
|
+
vErrors = [err35];
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
vErrors.push(err35);
|
|
439
|
+
}
|
|
440
|
+
errors++;
|
|
441
|
+
}
|
|
442
|
+
if(!((data20 === "toIndex") || (data20 === "toDelete"))){
|
|
443
|
+
const err36 = {instancePath:instancePath+"/indexingStatus",schemaPath:"#/properties/indexingStatus/enum",keyword:"enum",params:{allowedValues: schema16.properties.indexingStatus.enum},message:"must be equal to one of the allowed values"};
|
|
444
|
+
if(vErrors === null){
|
|
445
|
+
vErrors = [err36];
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
vErrors.push(err36);
|
|
449
|
+
}
|
|
450
|
+
errors++;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
const err37 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
456
|
+
if(vErrors === null){
|
|
457
|
+
vErrors = [err37];
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
vErrors.push(err37);
|
|
461
|
+
}
|
|
462
|
+
errors++;
|
|
463
|
+
}
|
|
464
|
+
validate14.errors = vErrors;
|
|
465
|
+
return errors === 0;
|
|
466
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.type/index.js'
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
export const schemaExports: string[]
|
|
3
|
+
|
|
4
|
+
// see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
|
|
5
|
+
export type SearchPage = {
|
|
6
|
+
_id: string;
|
|
7
|
+
owner: Account;
|
|
8
|
+
/**
|
|
9
|
+
* Last indexing date of this page
|
|
10
|
+
*/
|
|
11
|
+
indexedAt?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Portal ID
|
|
14
|
+
*/
|
|
15
|
+
portal: string;
|
|
16
|
+
resource: {
|
|
17
|
+
type: "page" | "reuse" | "dataset" | "application";
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Full path of the resource on the portal
|
|
22
|
+
*/
|
|
23
|
+
path: string;
|
|
24
|
+
public?: boolean;
|
|
25
|
+
privateAccess?: AccessAccountRef[];
|
|
26
|
+
indexingStatus?: "ok" | "toIndex" | "toDelete";
|
|
27
|
+
}
|
|
28
|
+
export type Account = {
|
|
29
|
+
type: "user" | "organization";
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
department?: string;
|
|
33
|
+
departmentName?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A flexible account reference used to grant permissions, private access, etc
|
|
37
|
+
*/
|
|
38
|
+
export type AccessAccountRef = {
|
|
39
|
+
/**
|
|
40
|
+
* If the entity is a user or an organization
|
|
41
|
+
*/
|
|
42
|
+
type: "user" | "organization";
|
|
43
|
+
/**
|
|
44
|
+
* Identifier of the entity
|
|
45
|
+
*/
|
|
46
|
+
id?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Name of the entity
|
|
49
|
+
*/
|
|
50
|
+
name?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Email of the user (can be used as an alternative to the id)
|
|
53
|
+
*/
|
|
54
|
+
email?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Identifier of the department or "*" for any department (same as empty) or "-" for no department
|
|
57
|
+
*/
|
|
58
|
+
department?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Name of the department
|
|
61
|
+
*/
|
|
62
|
+
departmentName?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Role name
|
|
65
|
+
*/
|
|
66
|
+
role?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export declare function validate(data: any): data is SearchPage
|
|
71
|
+
export declare function assertValid(data: any, options?: import('@data-fair/lib-validation').AssertValidOptions): asserts data is SearchPage
|
|
72
|
+
export declare function returnValid(data: any, options?: import('@data-fair/lib-validation').AssertValidOptions): SearchPage
|
|
73
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import validate from './validate.js'
|
|
5
|
+
import { assertValid as assertValidGeneric } from '@data-fair/lib-validation'
|
|
6
|
+
|
|
7
|
+
export const schemaExports = [
|
|
8
|
+
"types",
|
|
9
|
+
"validate"
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
export { validate } from './validate.js'
|
|
13
|
+
export function assertValid(data, options) {
|
|
14
|
+
assertValidGeneric(validate, data, options)
|
|
15
|
+
}
|
|
16
|
+
export function returnValid(data, options) {
|
|
17
|
+
assertValid(data, options)
|
|
18
|
+
return data
|
|
19
|
+
}
|
|
@@ -0,0 +1,538 @@
|
|
|
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/portals/search-page","x-exports":["types","validate"],"title":"Search page","type":"object","additionalProperties":false,"required":["_id","owner","resource","portal","path"],"properties":{"_id":{"type":"string","readOnly":true},"owner":{"$ref":"https://github.com/data-fair/lib/session-state#/$defs/account"},"indexedAt":{"type":"string","description":"Last indexing date of this page","format":"date-time"},"portal":{"type":"string","description":"Portal ID"},"resource":{"additionalProperties":false,"required":["type","id"],"properties":{"type":{"type":"string","enum":["page","reuse","dataset","application"]},"id":{"type":"string"}}},"path":{"type":"string","description":"Full path of the resource on the portal"},"public":{"type":"boolean"},"privateAccess":{"type":"array","items":{"$ref":"https://github.com/data-fair/portals/access-account-ref"}},"indexingStatus":{"type":"string","enum":["ok","toIndex","toDelete"]}}};
|
|
9
|
+
const schema22 = {"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"}}};
|
|
10
|
+
const schema26 = {"$id":"https://github.com/data-fair/portals/access-account-ref","title":"Access account ref","x-exports":["types"],"type":"object","description":"A flexible account reference used to grant permissions, private access, etc","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["user","organization"],"description":"If the entity is a user or an organization"},"id":{"type":"string","description":"Identifier of the entity"},"name":{"type":"string","description":"Name of the entity"},"email":{"type":"string","description":"Email of the user (can be used as an alternative to the id)"},"department":{"type":"string","description":"Identifier of the department or \"*\" for any department (same as empty) or \"-\" for no department"},"departmentName":{"type":"string","description":"Name of the department"},"role":{"type":"string","description":"Role name"}}};
|
|
11
|
+
const func2 = Object.prototype.hasOwnProperty;
|
|
12
|
+
const formats4 = fullFormats["date-time"];
|
|
13
|
+
|
|
14
|
+
function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
|
|
15
|
+
/*# sourceURL="https://github.com/data-fair/portals/search-page" */;
|
|
16
|
+
let vErrors = null;
|
|
17
|
+
let errors = 0;
|
|
18
|
+
if(data && typeof data == "object" && !Array.isArray(data)){
|
|
19
|
+
if(data._id === undefined){
|
|
20
|
+
const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "_id"},message:"must have required property '"+"_id"+"'"};
|
|
21
|
+
if(vErrors === null){
|
|
22
|
+
vErrors = [err0];
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
vErrors.push(err0);
|
|
26
|
+
}
|
|
27
|
+
errors++;
|
|
28
|
+
}
|
|
29
|
+
if(data.owner === undefined){
|
|
30
|
+
const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "owner"},message:"must have required property '"+"owner"+"'"};
|
|
31
|
+
if(vErrors === null){
|
|
32
|
+
vErrors = [err1];
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
vErrors.push(err1);
|
|
36
|
+
}
|
|
37
|
+
errors++;
|
|
38
|
+
}
|
|
39
|
+
if(data.resource === undefined){
|
|
40
|
+
const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "resource"},message:"must have required property '"+"resource"+"'"};
|
|
41
|
+
if(vErrors === null){
|
|
42
|
+
vErrors = [err2];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
vErrors.push(err2);
|
|
46
|
+
}
|
|
47
|
+
errors++;
|
|
48
|
+
}
|
|
49
|
+
if(data.portal === undefined){
|
|
50
|
+
const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "portal"},message:"must have required property '"+"portal"+"'"};
|
|
51
|
+
if(vErrors === null){
|
|
52
|
+
vErrors = [err3];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
vErrors.push(err3);
|
|
56
|
+
}
|
|
57
|
+
errors++;
|
|
58
|
+
}
|
|
59
|
+
if(data.path === undefined){
|
|
60
|
+
const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "path"},message:"must have required property '"+"path"+"'"};
|
|
61
|
+
if(vErrors === null){
|
|
62
|
+
vErrors = [err4];
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
vErrors.push(err4);
|
|
66
|
+
}
|
|
67
|
+
errors++;
|
|
68
|
+
}
|
|
69
|
+
for(const key0 in data){
|
|
70
|
+
if(!(func2.call(schema16.properties, key0))){
|
|
71
|
+
const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};
|
|
72
|
+
if(vErrors === null){
|
|
73
|
+
vErrors = [err5];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
vErrors.push(err5);
|
|
77
|
+
}
|
|
78
|
+
errors++;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if(data._id !== undefined){
|
|
82
|
+
if(typeof data._id !== "string"){
|
|
83
|
+
const err6 = {instancePath:instancePath+"/_id",schemaPath:"#/properties/_id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
84
|
+
if(vErrors === null){
|
|
85
|
+
vErrors = [err6];
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
vErrors.push(err6);
|
|
89
|
+
}
|
|
90
|
+
errors++;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if(data.owner !== undefined){
|
|
94
|
+
let data1 = data.owner;
|
|
95
|
+
if(data1 && typeof data1 == "object" && !Array.isArray(data1)){
|
|
96
|
+
if(data1.type === undefined){
|
|
97
|
+
const err7 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
98
|
+
if(vErrors === null){
|
|
99
|
+
vErrors = [err7];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
vErrors.push(err7);
|
|
103
|
+
}
|
|
104
|
+
errors++;
|
|
105
|
+
}
|
|
106
|
+
if(data1.id === undefined){
|
|
107
|
+
const err8 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
108
|
+
if(vErrors === null){
|
|
109
|
+
vErrors = [err8];
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
vErrors.push(err8);
|
|
113
|
+
}
|
|
114
|
+
errors++;
|
|
115
|
+
}
|
|
116
|
+
if(data1.name === undefined){
|
|
117
|
+
const err9 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};
|
|
118
|
+
if(vErrors === null){
|
|
119
|
+
vErrors = [err9];
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
vErrors.push(err9);
|
|
123
|
+
}
|
|
124
|
+
errors++;
|
|
125
|
+
}
|
|
126
|
+
for(const key1 in data1){
|
|
127
|
+
if(!(((((key1 === "type") || (key1 === "id")) || (key1 === "name")) || (key1 === "department")) || (key1 === "departmentName"))){
|
|
128
|
+
const err10 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};
|
|
129
|
+
if(vErrors === null){
|
|
130
|
+
vErrors = [err10];
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
vErrors.push(err10);
|
|
134
|
+
}
|
|
135
|
+
errors++;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if(data1.type !== undefined){
|
|
139
|
+
let data2 = data1.type;
|
|
140
|
+
if(typeof data2 !== "string"){
|
|
141
|
+
const err11 = {instancePath:instancePath+"/owner/type",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
142
|
+
if(vErrors === null){
|
|
143
|
+
vErrors = [err11];
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
vErrors.push(err11);
|
|
147
|
+
}
|
|
148
|
+
errors++;
|
|
149
|
+
}
|
|
150
|
+
if(!((data2 === "user") || (data2 === "organization"))){
|
|
151
|
+
const err12 = {instancePath:instancePath+"/owner/type",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/type/enum",keyword:"enum",params:{allowedValues: schema22.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
152
|
+
if(vErrors === null){
|
|
153
|
+
vErrors = [err12];
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
vErrors.push(err12);
|
|
157
|
+
}
|
|
158
|
+
errors++;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if(data1.id !== undefined){
|
|
162
|
+
if(typeof data1.id !== "string"){
|
|
163
|
+
const err13 = {instancePath:instancePath+"/owner/id",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
164
|
+
if(vErrors === null){
|
|
165
|
+
vErrors = [err13];
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
vErrors.push(err13);
|
|
169
|
+
}
|
|
170
|
+
errors++;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if(data1.name !== undefined){
|
|
174
|
+
if(typeof data1.name !== "string"){
|
|
175
|
+
const err14 = {instancePath:instancePath+"/owner/name",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
176
|
+
if(vErrors === null){
|
|
177
|
+
vErrors = [err14];
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
vErrors.push(err14);
|
|
181
|
+
}
|
|
182
|
+
errors++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if(data1.department !== undefined){
|
|
186
|
+
if(typeof data1.department !== "string"){
|
|
187
|
+
const err15 = {instancePath:instancePath+"/owner/department",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
188
|
+
if(vErrors === null){
|
|
189
|
+
vErrors = [err15];
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
vErrors.push(err15);
|
|
193
|
+
}
|
|
194
|
+
errors++;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if(data1.departmentName !== undefined){
|
|
198
|
+
if(typeof data1.departmentName !== "string"){
|
|
199
|
+
const err16 = {instancePath:instancePath+"/owner/departmentName",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
200
|
+
if(vErrors === null){
|
|
201
|
+
vErrors = [err16];
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
vErrors.push(err16);
|
|
205
|
+
}
|
|
206
|
+
errors++;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
const err17 = {instancePath:instancePath+"/owner",schemaPath:"https://github.com/data-fair/lib/session-state#/$defs/account/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
212
|
+
if(vErrors === null){
|
|
213
|
+
vErrors = [err17];
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
vErrors.push(err17);
|
|
217
|
+
}
|
|
218
|
+
errors++;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if(data.indexedAt !== undefined){
|
|
222
|
+
let data7 = data.indexedAt;
|
|
223
|
+
if(typeof data7 === "string"){
|
|
224
|
+
if(!(formats4.validate(data7))){
|
|
225
|
+
const err18 = {instancePath:instancePath+"/indexedAt",schemaPath:"#/properties/indexedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};
|
|
226
|
+
if(vErrors === null){
|
|
227
|
+
vErrors = [err18];
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
vErrors.push(err18);
|
|
231
|
+
}
|
|
232
|
+
errors++;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
const err19 = {instancePath:instancePath+"/indexedAt",schemaPath:"#/properties/indexedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
237
|
+
if(vErrors === null){
|
|
238
|
+
vErrors = [err19];
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
vErrors.push(err19);
|
|
242
|
+
}
|
|
243
|
+
errors++;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if(data.portal !== undefined){
|
|
247
|
+
if(typeof data.portal !== "string"){
|
|
248
|
+
const err20 = {instancePath:instancePath+"/portal",schemaPath:"#/properties/portal/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
249
|
+
if(vErrors === null){
|
|
250
|
+
vErrors = [err20];
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
vErrors.push(err20);
|
|
254
|
+
}
|
|
255
|
+
errors++;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if(data.resource !== undefined){
|
|
259
|
+
let data9 = data.resource;
|
|
260
|
+
if(data9 && typeof data9 == "object" && !Array.isArray(data9)){
|
|
261
|
+
if(data9.type === undefined){
|
|
262
|
+
const err21 = {instancePath:instancePath+"/resource",schemaPath:"#/properties/resource/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
263
|
+
if(vErrors === null){
|
|
264
|
+
vErrors = [err21];
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
vErrors.push(err21);
|
|
268
|
+
}
|
|
269
|
+
errors++;
|
|
270
|
+
}
|
|
271
|
+
if(data9.id === undefined){
|
|
272
|
+
const err22 = {instancePath:instancePath+"/resource",schemaPath:"#/properties/resource/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};
|
|
273
|
+
if(vErrors === null){
|
|
274
|
+
vErrors = [err22];
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
vErrors.push(err22);
|
|
278
|
+
}
|
|
279
|
+
errors++;
|
|
280
|
+
}
|
|
281
|
+
for(const key2 in data9){
|
|
282
|
+
if(!((key2 === "type") || (key2 === "id"))){
|
|
283
|
+
const err23 = {instancePath:instancePath+"/resource",schemaPath:"#/properties/resource/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};
|
|
284
|
+
if(vErrors === null){
|
|
285
|
+
vErrors = [err23];
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
vErrors.push(err23);
|
|
289
|
+
}
|
|
290
|
+
errors++;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if(data9.type !== undefined){
|
|
294
|
+
let data10 = data9.type;
|
|
295
|
+
if(typeof data10 !== "string"){
|
|
296
|
+
const err24 = {instancePath:instancePath+"/resource/type",schemaPath:"#/properties/resource/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
297
|
+
if(vErrors === null){
|
|
298
|
+
vErrors = [err24];
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
vErrors.push(err24);
|
|
302
|
+
}
|
|
303
|
+
errors++;
|
|
304
|
+
}
|
|
305
|
+
if(!((((data10 === "page") || (data10 === "reuse")) || (data10 === "dataset")) || (data10 === "application"))){
|
|
306
|
+
const err25 = {instancePath:instancePath+"/resource/type",schemaPath:"#/properties/resource/properties/type/enum",keyword:"enum",params:{allowedValues: schema16.properties.resource.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
307
|
+
if(vErrors === null){
|
|
308
|
+
vErrors = [err25];
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
vErrors.push(err25);
|
|
312
|
+
}
|
|
313
|
+
errors++;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if(data9.id !== undefined){
|
|
317
|
+
if(typeof data9.id !== "string"){
|
|
318
|
+
const err26 = {instancePath:instancePath+"/resource/id",schemaPath:"#/properties/resource/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
319
|
+
if(vErrors === null){
|
|
320
|
+
vErrors = [err26];
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
vErrors.push(err26);
|
|
324
|
+
}
|
|
325
|
+
errors++;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if(data.path !== undefined){
|
|
331
|
+
if(typeof data.path !== "string"){
|
|
332
|
+
const err27 = {instancePath:instancePath+"/path",schemaPath:"#/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
333
|
+
if(vErrors === null){
|
|
334
|
+
vErrors = [err27];
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
vErrors.push(err27);
|
|
338
|
+
}
|
|
339
|
+
errors++;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if(data.public !== undefined){
|
|
343
|
+
if(typeof data.public !== "boolean"){
|
|
344
|
+
const err28 = {instancePath:instancePath+"/public",schemaPath:"#/properties/public/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
|
345
|
+
if(vErrors === null){
|
|
346
|
+
vErrors = [err28];
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
vErrors.push(err28);
|
|
350
|
+
}
|
|
351
|
+
errors++;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if(data.privateAccess !== undefined){
|
|
355
|
+
let data14 = data.privateAccess;
|
|
356
|
+
if(Array.isArray(data14)){
|
|
357
|
+
const len0 = data14.length;
|
|
358
|
+
for(let i0=0; i0<len0; i0++){
|
|
359
|
+
let data15 = data14[i0];
|
|
360
|
+
if(data15 && typeof data15 == "object" && !Array.isArray(data15)){
|
|
361
|
+
if(data15.type === undefined){
|
|
362
|
+
const err29 = {instancePath:instancePath+"/privateAccess/" + i0,schemaPath:"https://github.com/data-fair/portals/access-account-ref/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};
|
|
363
|
+
if(vErrors === null){
|
|
364
|
+
vErrors = [err29];
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
vErrors.push(err29);
|
|
368
|
+
}
|
|
369
|
+
errors++;
|
|
370
|
+
}
|
|
371
|
+
for(const key3 in data15){
|
|
372
|
+
if(!(((((((key3 === "type") || (key3 === "id")) || (key3 === "name")) || (key3 === "email")) || (key3 === "department")) || (key3 === "departmentName")) || (key3 === "role"))){
|
|
373
|
+
const err30 = {instancePath:instancePath+"/privateAccess/" + i0,schemaPath:"https://github.com/data-fair/portals/access-account-ref/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};
|
|
374
|
+
if(vErrors === null){
|
|
375
|
+
vErrors = [err30];
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
vErrors.push(err30);
|
|
379
|
+
}
|
|
380
|
+
errors++;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if(data15.type !== undefined){
|
|
384
|
+
let data16 = data15.type;
|
|
385
|
+
if(typeof data16 !== "string"){
|
|
386
|
+
const err31 = {instancePath:instancePath+"/privateAccess/" + i0+"/type",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
387
|
+
if(vErrors === null){
|
|
388
|
+
vErrors = [err31];
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
vErrors.push(err31);
|
|
392
|
+
}
|
|
393
|
+
errors++;
|
|
394
|
+
}
|
|
395
|
+
if(!((data16 === "user") || (data16 === "organization"))){
|
|
396
|
+
const err32 = {instancePath:instancePath+"/privateAccess/" + i0+"/type",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/type/enum",keyword:"enum",params:{allowedValues: schema26.properties.type.enum},message:"must be equal to one of the allowed values"};
|
|
397
|
+
if(vErrors === null){
|
|
398
|
+
vErrors = [err32];
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
vErrors.push(err32);
|
|
402
|
+
}
|
|
403
|
+
errors++;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if(data15.id !== undefined){
|
|
407
|
+
if(typeof data15.id !== "string"){
|
|
408
|
+
const err33 = {instancePath:instancePath+"/privateAccess/" + i0+"/id",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
409
|
+
if(vErrors === null){
|
|
410
|
+
vErrors = [err33];
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
vErrors.push(err33);
|
|
414
|
+
}
|
|
415
|
+
errors++;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if(data15.name !== undefined){
|
|
419
|
+
if(typeof data15.name !== "string"){
|
|
420
|
+
const err34 = {instancePath:instancePath+"/privateAccess/" + i0+"/name",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
421
|
+
if(vErrors === null){
|
|
422
|
+
vErrors = [err34];
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
vErrors.push(err34);
|
|
426
|
+
}
|
|
427
|
+
errors++;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if(data15.email !== undefined){
|
|
431
|
+
if(typeof data15.email !== "string"){
|
|
432
|
+
const err35 = {instancePath:instancePath+"/privateAccess/" + i0+"/email",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/email/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
433
|
+
if(vErrors === null){
|
|
434
|
+
vErrors = [err35];
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
vErrors.push(err35);
|
|
438
|
+
}
|
|
439
|
+
errors++;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if(data15.department !== undefined){
|
|
443
|
+
if(typeof data15.department !== "string"){
|
|
444
|
+
const err36 = {instancePath:instancePath+"/privateAccess/" + i0+"/department",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/department/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
445
|
+
if(vErrors === null){
|
|
446
|
+
vErrors = [err36];
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
vErrors.push(err36);
|
|
450
|
+
}
|
|
451
|
+
errors++;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if(data15.departmentName !== undefined){
|
|
455
|
+
if(typeof data15.departmentName !== "string"){
|
|
456
|
+
const err37 = {instancePath:instancePath+"/privateAccess/" + i0+"/departmentName",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/departmentName/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
457
|
+
if(vErrors === null){
|
|
458
|
+
vErrors = [err37];
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
vErrors.push(err37);
|
|
462
|
+
}
|
|
463
|
+
errors++;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if(data15.role !== undefined){
|
|
467
|
+
if(typeof data15.role !== "string"){
|
|
468
|
+
const err38 = {instancePath:instancePath+"/privateAccess/" + i0+"/role",schemaPath:"https://github.com/data-fair/portals/access-account-ref/properties/role/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
469
|
+
if(vErrors === null){
|
|
470
|
+
vErrors = [err38];
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
vErrors.push(err38);
|
|
474
|
+
}
|
|
475
|
+
errors++;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
const err39 = {instancePath:instancePath+"/privateAccess/" + i0,schemaPath:"https://github.com/data-fair/portals/access-account-ref/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
481
|
+
if(vErrors === null){
|
|
482
|
+
vErrors = [err39];
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
vErrors.push(err39);
|
|
486
|
+
}
|
|
487
|
+
errors++;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
const err40 = {instancePath:instancePath+"/privateAccess",schemaPath:"#/properties/privateAccess/type",keyword:"type",params:{type: "array"},message:"must be array"};
|
|
493
|
+
if(vErrors === null){
|
|
494
|
+
vErrors = [err40];
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
vErrors.push(err40);
|
|
498
|
+
}
|
|
499
|
+
errors++;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if(data.indexingStatus !== undefined){
|
|
503
|
+
let data23 = data.indexingStatus;
|
|
504
|
+
if(typeof data23 !== "string"){
|
|
505
|
+
const err41 = {instancePath:instancePath+"/indexingStatus",schemaPath:"#/properties/indexingStatus/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
|
506
|
+
if(vErrors === null){
|
|
507
|
+
vErrors = [err41];
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
vErrors.push(err41);
|
|
511
|
+
}
|
|
512
|
+
errors++;
|
|
513
|
+
}
|
|
514
|
+
if(!(((data23 === "ok") || (data23 === "toIndex")) || (data23 === "toDelete"))){
|
|
515
|
+
const err42 = {instancePath:instancePath+"/indexingStatus",schemaPath:"#/properties/indexingStatus/enum",keyword:"enum",params:{allowedValues: schema16.properties.indexingStatus.enum},message:"must be equal to one of the allowed values"};
|
|
516
|
+
if(vErrors === null){
|
|
517
|
+
vErrors = [err42];
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
vErrors.push(err42);
|
|
521
|
+
}
|
|
522
|
+
errors++;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
const err43 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
|
|
528
|
+
if(vErrors === null){
|
|
529
|
+
vErrors = [err43];
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
vErrors.push(err43);
|
|
533
|
+
}
|
|
534
|
+
errors++;
|
|
535
|
+
}
|
|
536
|
+
validate14.errors = vErrors;
|
|
537
|
+
return errors === 0;
|
|
538
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.type/index.js'
|