@data-fair/lib-common-types 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,185 @@
1
+ /* eslint-disable */
2
+
3
+
4
+ import validate from './validate.js'
5
+ import { assertValid as assertValidGeneric } from '@data-fair/lib-node/validation.js'
6
+
7
+ export const schemaExports = [
8
+ "types",
9
+ "validate",
10
+ "schema"
11
+ ]
12
+
13
+ export { validate } from './validate.js'
14
+ export const assertValid = (data, options) => {
15
+ assertValidGeneric(validate, data, options)
16
+ }
17
+ export const returnValid = (data, options) => {
18
+ assertValid(data, options)
19
+ return data
20
+ }
21
+
22
+ export const schema = {
23
+ "$id": "https://github.com/data-fair/lib/session-state",
24
+ "x-exports": [
25
+ "types",
26
+ "validate",
27
+ "schema"
28
+ ],
29
+ "type": "object",
30
+ "title": "session state",
31
+ "additionalProperties": false,
32
+ "properties": {
33
+ "user": {
34
+ "$ref": "#/$defs/user"
35
+ },
36
+ "organization": {
37
+ "$ref": "#/$defs/organizationMembership"
38
+ },
39
+ "account": {
40
+ "$ref": "#/$defs/account"
41
+ },
42
+ "accountRole": {
43
+ "type": "string"
44
+ },
45
+ "lang": {
46
+ "type": "string"
47
+ },
48
+ "dark": {
49
+ "type": "boolean"
50
+ }
51
+ },
52
+ "$defs": {
53
+ "organizationMembership": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "required": [
57
+ "id",
58
+ "name",
59
+ "role"
60
+ ],
61
+ "properties": {
62
+ "id": {
63
+ "type": "string"
64
+ },
65
+ "name": {
66
+ "type": "string"
67
+ },
68
+ "role": {
69
+ "type": "string"
70
+ },
71
+ "department": {
72
+ "type": "string"
73
+ },
74
+ "departmentName": {
75
+ "type": "string"
76
+ },
77
+ "dflt": {
78
+ "type": "boolean"
79
+ }
80
+ }
81
+ },
82
+ "userRef": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": [
86
+ "id",
87
+ "name"
88
+ ],
89
+ "properties": {
90
+ "id": {
91
+ "type": "string"
92
+ },
93
+ "name": {
94
+ "type": "string"
95
+ }
96
+ }
97
+ },
98
+ "user": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": [
102
+ "email",
103
+ "id",
104
+ "name",
105
+ "organizations"
106
+ ],
107
+ "properties": {
108
+ "email": {
109
+ "type": "string",
110
+ "format": "email"
111
+ },
112
+ "id": {
113
+ "type": "string"
114
+ },
115
+ "name": {
116
+ "type": "string"
117
+ },
118
+ "organizations": {
119
+ "type": "array",
120
+ "items": {
121
+ "$ref": "#/$defs/organizationMembership"
122
+ }
123
+ },
124
+ "isAdmin": {
125
+ "type": "integer",
126
+ "enum": [
127
+ 0,
128
+ 1
129
+ ]
130
+ },
131
+ "adminMode": {
132
+ "type": "integer",
133
+ "enum": [
134
+ 0,
135
+ 1
136
+ ]
137
+ },
138
+ "asAdmin": {
139
+ "$ref": "#/$defs/userRef"
140
+ },
141
+ "pd": {
142
+ "type": "string",
143
+ "format": "date"
144
+ },
145
+ "ipa": {
146
+ "type": "integer",
147
+ "enum": [
148
+ 0,
149
+ 1
150
+ ]
151
+ }
152
+ }
153
+ },
154
+ "account": {
155
+ "type": "object",
156
+ "additionalProperties": false,
157
+ "required": [
158
+ "type",
159
+ "id",
160
+ "name"
161
+ ],
162
+ "properties": {
163
+ "type": {
164
+ "type": "string",
165
+ "enum": [
166
+ "user",
167
+ "organization"
168
+ ]
169
+ },
170
+ "id": {
171
+ "type": "string"
172
+ },
173
+ "name": {
174
+ "type": "string"
175
+ },
176
+ "department": {
177
+ "type": "string"
178
+ },
179
+ "departmentName": {
180
+ "type": "string"
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }