@data-fair/lib-common-types 1.0.0 → 1.2.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.
@@ -21,9 +21,7 @@ export interface AccountKeys {
21
21
  }
22
22
 
23
23
 
24
- export const validate: (data: any) => data is Account
25
- export const assertValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => asserts data is Account
26
- export const returnValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => Account
27
-
28
- export const schema: any
29
-
24
+ export declare function validate(data: any): data is Account
25
+ export declare function assertValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): asserts data is Account
26
+ export declare function returnValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): Account
27
+
@@ -6,78 +6,14 @@ import { assertValid as assertValidGeneric } from '@data-fair/lib-node/validatio
6
6
 
7
7
  export const schemaExports = [
8
8
  "types",
9
- "validate",
10
- "schema"
9
+ "validate"
11
10
  ]
12
11
 
13
12
  export { validate } from './validate.js'
14
- export const assertValid = (data, options) => {
13
+ export function assertValid(data, options) {
15
14
  assertValidGeneric(validate, data, options)
16
15
  }
17
- export const returnValid = (data, options) => {
16
+ export function returnValid(data, options) {
18
17
  assertValid(data, options)
19
18
  return data
20
19
  }
21
-
22
- export const schema = {
23
- "$id": "https://github.com/data-fair/lib/account",
24
- "x-exports": [
25
- "types",
26
- "validate",
27
- "schema"
28
- ],
29
- "type": "object",
30
- "title": "account",
31
- "required": [
32
- "type",
33
- "id",
34
- "name"
35
- ],
36
- "properties": {
37
- "type": {
38
- "type": "string",
39
- "enum": [
40
- "user",
41
- "organization"
42
- ]
43
- },
44
- "id": {
45
- "type": "string"
46
- },
47
- "name": {
48
- "type": "string"
49
- },
50
- "department": {
51
- "type": "string"
52
- },
53
- "departmentName": {
54
- "type": "string"
55
- }
56
- },
57
- "$defs": {
58
- "accountKeys": {
59
- "type": "object",
60
- "title": "account keys",
61
- "required": [
62
- "type",
63
- "id"
64
- ],
65
- "additionalProperties": false,
66
- "properties": {
67
- "type": {
68
- "type": "string",
69
- "enum": [
70
- "user",
71
- "organization"
72
- ]
73
- },
74
- "id": {
75
- "type": "string"
76
- },
77
- "department": {
78
- "type": "string"
79
- }
80
- }
81
- }
82
- }
83
- }
@@ -4,7 +4,7 @@
4
4
  "use strict";
5
5
  export const validate = validate14;
6
6
  export default validate14;
7
- const schema16 = {"$id":"https://github.com/data-fair/lib/account","x-exports":["types","validate","schema"],"type":"object","title":"account","required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}},"$defs":{"accountKeys":{"type":"object","title":"account keys","required":["type","id"],"additionalProperties":false,"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"department":{"type":"string"}}}}};
7
+ const schema16 = {"$id":"https://github.com/data-fair/lib/account","x-exports":["types","validate"],"type":"object","title":"account","required":["type","id","name"],"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"name":{"type":"string"},"department":{"type":"string"},"departmentName":{"type":"string"}},"$defs":{"accountKeys":{"type":"object","title":"account keys","required":["type","id"],"additionalProperties":false,"properties":{"type":{"type":"string","enum":["user","organization"]},"id":{"type":"string"},"department":{"type":"string"}}}}};
8
8
 
9
9
  function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
10
10
  /*# sourceURL="https://github.com/data-fair/lib/account" */;
@@ -0,0 +1,46 @@
1
+ declare const _default: {
2
+ $id: string;
3
+ 'x-exports': string[];
4
+ type: string;
5
+ title: string;
6
+ required: string[];
7
+ properties: {
8
+ type: {
9
+ type: string;
10
+ enum: string[];
11
+ };
12
+ id: {
13
+ type: string;
14
+ };
15
+ name: {
16
+ type: string;
17
+ };
18
+ department: {
19
+ type: string;
20
+ };
21
+ departmentName: {
22
+ type: string;
23
+ };
24
+ };
25
+ $defs: {
26
+ accountKeys: {
27
+ type: string;
28
+ title: string;
29
+ required: string[];
30
+ additionalProperties: boolean;
31
+ properties: {
32
+ type: {
33
+ type: string;
34
+ enum: string[];
35
+ };
36
+ id: {
37
+ type: string;
38
+ };
39
+ department: {
40
+ type: string;
41
+ };
42
+ };
43
+ };
44
+ };
45
+ };
46
+ export default _default;
@@ -0,0 +1,45 @@
1
+ export default {
2
+ $id: 'https://github.com/data-fair/lib/account',
3
+ 'x-exports': ['types', 'validate'],
4
+ type: 'object',
5
+ title: 'account',
6
+ required: ['type', 'id', 'name'],
7
+ properties: {
8
+ type: {
9
+ type: 'string',
10
+ enum: ['user', 'organization']
11
+ },
12
+ id: {
13
+ type: 'string'
14
+ },
15
+ name: {
16
+ type: 'string'
17
+ },
18
+ department: {
19
+ type: 'string'
20
+ },
21
+ departmentName: {
22
+ type: 'string'
23
+ }
24
+ },
25
+ $defs: {
26
+ accountKeys: {
27
+ type: 'object',
28
+ title: 'account keys',
29
+ required: ['type', 'id'],
30
+ additionalProperties: false,
31
+ properties: {
32
+ type: {
33
+ type: 'string',
34
+ enum: ['user', 'organization']
35
+ },
36
+ id: {
37
+ type: 'string'
38
+ },
39
+ department: {
40
+ type: 'string'
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
@@ -95,6 +95,3 @@ export interface Field {
95
95
  [k: string]: unknown;
96
96
  }
97
97
 
98
-
99
- export const schema: any
100
-
@@ -3,159 +3,5 @@
3
3
 
4
4
 
5
5
  export const schemaExports = [
6
- "types",
7
- "schema"
6
+ "types"
8
7
  ]
9
-
10
- export const schema = {
11
- "$id": "https://github.com/data-fair/lib/application",
12
- "title": "Application",
13
- "x-exports": [
14
- "types",
15
- "schema"
16
- ],
17
- "type": "object",
18
- "required": [
19
- "id",
20
- "title",
21
- "exposedUrl",
22
- "href",
23
- "wsUrl",
24
- "owner",
25
- "configuration"
26
- ],
27
- "properties": {
28
- "id": {
29
- "type": "string",
30
- "description": "Globally unique identifier of the application"
31
- },
32
- "title": {
33
- "type": "string",
34
- "description": "Short title of the application"
35
- },
36
- "exposedUrl": {
37
- "type": "string",
38
- "description": "The URL where this application is exposed"
39
- },
40
- "href": {
41
- "type": "string",
42
- "description": "The URL where this resource can be fetched"
43
- },
44
- "wsUrl": {
45
- "type": "string",
46
- "description": "The URL where this application can be accessed through a websocket"
47
- },
48
- "owner": {
49
- "$ref": "https://github.com/data-fair/lib/account#/$defs/accountKeys"
50
- },
51
- "configuration": {
52
- "type": "object",
53
- "description": "A free format configuration object used by applications. A minimal common structure is used to ensure proper linking between applications and datasets and remote services",
54
- "additionalProperties": true,
55
- "properties": {
56
- "datasets": {
57
- "type": "array",
58
- "items": {
59
- "$ref": "#/$defs/dataset"
60
- }
61
- }
62
- }
63
- }
64
- },
65
- "$defs": {
66
- "dataset": {
67
- "type": [
68
- "object",
69
- "null"
70
- ],
71
- "required": [
72
- "href",
73
- "id",
74
- "title",
75
- "finalizedAt"
76
- ],
77
- "properties": {
78
- "href": {
79
- "type": "string"
80
- },
81
- "id": {
82
- "type": "string"
83
- },
84
- "title": {
85
- "type": "string"
86
- },
87
- "key": {
88
- "type": "string",
89
- "description": "Not the id of the dataset, but a key inside this configuration object to define the role of the dataset in this context."
90
- },
91
- "schema": {
92
- "type": "array",
93
- "items": {
94
- "$ref": "#/$defs/field"
95
- }
96
- },
97
- "finalizedAt": {
98
- "type": "string",
99
- "format": "date-time"
100
- }
101
- }
102
- },
103
- "field": {
104
- "type": "object",
105
- "required": [
106
- "key",
107
- "type"
108
- ],
109
- "properties": {
110
- "key": {
111
- "type": "string"
112
- },
113
- "type": {
114
- "type": "string"
115
- },
116
- "format": {
117
- "type": "string"
118
- },
119
- "title": {
120
- "type": "string"
121
- },
122
- "x-originalName": {
123
- "type": "string"
124
- },
125
- "x-group": {
126
- "type": "string"
127
- },
128
- "x-refersTo": {
129
- "deprecated": true,
130
- "type": [
131
- "string",
132
- "null"
133
- ]
134
- },
135
- "x-concept": {
136
- "type": "object",
137
- "properties": {
138
- "id": {
139
- "type": "string"
140
- },
141
- "title": {
142
- "type": "string"
143
- },
144
- "primary": {
145
- "type": "boolean"
146
- }
147
- }
148
- },
149
- "x-labels": {
150
- "type": "object",
151
- "additionalProperties": {
152
- "type": "string"
153
- }
154
- },
155
- "x-labelsRestricted": {
156
- "type": "boolean"
157
- }
158
- }
159
- }
160
- }
161
- }
@@ -0,0 +1,128 @@
1
+ declare const _default: {
2
+ $id: string;
3
+ title: string;
4
+ 'x-exports': string[];
5
+ type: string;
6
+ required: string[];
7
+ properties: {
8
+ id: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ title: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ exposedUrl: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ href: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ wsUrl: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ owner: {
29
+ $ref: string;
30
+ };
31
+ configuration: {
32
+ type: string;
33
+ description: string;
34
+ additionalProperties: boolean;
35
+ properties: {
36
+ datasets: {
37
+ type: string;
38
+ items: {
39
+ $ref: string;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ };
45
+ $defs: {
46
+ dataset: {
47
+ type: string[];
48
+ required: string[];
49
+ properties: {
50
+ href: {
51
+ type: string;
52
+ };
53
+ id: {
54
+ type: string;
55
+ };
56
+ title: {
57
+ type: string;
58
+ };
59
+ key: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ schema: {
64
+ type: string;
65
+ items: {
66
+ $ref: string;
67
+ };
68
+ };
69
+ finalizedAt: {
70
+ type: string;
71
+ format: string;
72
+ };
73
+ };
74
+ };
75
+ field: {
76
+ type: string;
77
+ required: string[];
78
+ properties: {
79
+ key: {
80
+ type: string;
81
+ };
82
+ type: {
83
+ type: string;
84
+ };
85
+ format: {
86
+ type: string;
87
+ };
88
+ title: {
89
+ type: string;
90
+ };
91
+ 'x-originalName': {
92
+ type: string;
93
+ };
94
+ 'x-group': {
95
+ type: string;
96
+ };
97
+ 'x-refersTo': {
98
+ deprecated: boolean;
99
+ type: string[];
100
+ };
101
+ 'x-concept': {
102
+ type: string;
103
+ properties: {
104
+ id: {
105
+ type: string;
106
+ };
107
+ title: {
108
+ type: string;
109
+ };
110
+ primary: {
111
+ type: string;
112
+ };
113
+ };
114
+ };
115
+ 'x-labels': {
116
+ type: string;
117
+ additionalProperties: {
118
+ type: string;
119
+ };
120
+ };
121
+ 'x-labelsRestricted': {
122
+ type: string;
123
+ };
124
+ };
125
+ };
126
+ };
127
+ };
128
+ export default _default;
@@ -0,0 +1,138 @@
1
+ export default {
2
+ $id: 'https://github.com/data-fair/lib/application',
3
+ title: 'Application',
4
+ 'x-exports': ['types'],
5
+ type: 'object',
6
+ required: [
7
+ 'id',
8
+ 'title',
9
+ 'exposedUrl',
10
+ 'href',
11
+ 'wsUrl',
12
+ 'owner',
13
+ 'configuration'
14
+ ],
15
+ properties: {
16
+ id: {
17
+ type: 'string',
18
+ description: 'Globally unique identifier of the application'
19
+ },
20
+ title: {
21
+ type: 'string',
22
+ description: 'Short title of the application'
23
+ },
24
+ exposedUrl: {
25
+ type: 'string',
26
+ description: 'The URL where this application is exposed'
27
+ },
28
+ href: {
29
+ type: 'string',
30
+ description: 'The URL where this resource can be fetched'
31
+ },
32
+ wsUrl: {
33
+ type: 'string',
34
+ description: 'The URL where this application can be accessed through a websocket'
35
+ },
36
+ owner: {
37
+ $ref: 'https://github.com/data-fair/lib/account#/$defs/accountKeys'
38
+ },
39
+ configuration: {
40
+ type: 'object',
41
+ description: 'A free format configuration object used by applications. A minimal common structure is used to ensure proper linking between applications and datasets and remote services',
42
+ additionalProperties: true,
43
+ properties: {
44
+ datasets: {
45
+ type: 'array',
46
+ items: {
47
+ $ref: '#/$defs/dataset'
48
+ }
49
+ }
50
+ }
51
+ }
52
+ },
53
+ $defs: {
54
+ dataset: {
55
+ type: [
56
+ 'object',
57
+ 'null'
58
+ ],
59
+ required: [
60
+ 'href',
61
+ 'id',
62
+ 'title',
63
+ 'finalizedAt'
64
+ ],
65
+ properties: {
66
+ href: {
67
+ type: 'string'
68
+ },
69
+ id: {
70
+ type: 'string'
71
+ },
72
+ title: {
73
+ type: 'string'
74
+ },
75
+ key: {
76
+ type: 'string',
77
+ description: 'Not the id of the dataset, but a key inside this configuration object to define the role of the dataset in this context.'
78
+ },
79
+ schema: {
80
+ type: 'array',
81
+ items: {
82
+ $ref: '#/$defs/field'
83
+ }
84
+ },
85
+ finalizedAt: {
86
+ type: 'string',
87
+ format: 'date-time'
88
+ }
89
+ }
90
+ },
91
+ field: {
92
+ type: 'object',
93
+ required: [
94
+ 'key',
95
+ 'type'
96
+ ],
97
+ properties: {
98
+ key: {
99
+ type: 'string'
100
+ },
101
+ type: {
102
+ type: 'string'
103
+ },
104
+ format: {
105
+ type: 'string'
106
+ },
107
+ title: {
108
+ type: 'string'
109
+ },
110
+ 'x-originalName': {
111
+ type: 'string'
112
+ },
113
+ 'x-group': { type: 'string' },
114
+ 'x-refersTo': {
115
+ deprecated: true,
116
+ type: ['string', 'null']
117
+ },
118
+ 'x-concept': {
119
+ type: 'object',
120
+ properties: {
121
+ id: { type: 'string' },
122
+ title: { type: 'string' },
123
+ primary: { type: 'boolean' }
124
+ }
125
+ },
126
+ 'x-labels': {
127
+ type: 'object',
128
+ additionalProperties: {
129
+ type: 'string'
130
+ }
131
+ },
132
+ 'x-labelsRestricted': {
133
+ type: 'boolean'
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
+ "scripts": {
7
+ "prepublishOnly": "cd .. && npm run prepublishOnly",
8
+ "build": "cd .. && npm run build"
9
+ },
6
10
  "devDependencies": {},
7
11
  "files": [
8
12
  "**/schema.json",
@@ -2,6 +2,10 @@
2
2
  export const schemaExports: string[]
3
3
 
4
4
  // see https://github.com/bcherny/json-schema-to-typescript/issues/439 if some types are not exported
5
+ export type ShortForIgnorePersonalAccount = 1;
6
+ export type IsTheUserComingFromACoreIDProvider = 1;
7
+ export type ShortForOrgStorage = 1;
8
+
5
9
  export interface SessionState {
6
10
  user?: User;
7
11
  organization?: OrganizationMembership;
@@ -19,11 +23,13 @@ export interface User {
19
23
  id: string;
20
24
  name: string;
21
25
  organizations: OrganizationMembership[];
22
- isAdmin?: 0 | 1;
23
- adminMode?: 0 | 1;
26
+ isAdmin?: 1;
27
+ adminMode?: 1;
24
28
  asAdmin?: UserRef;
25
29
  pd?: string;
26
- ipa?: 0 | 1;
30
+ ipa?: ShortForIgnorePersonalAccount;
31
+ idp?: IsTheUserComingFromACoreIDProvider;
32
+ os?: ShortForOrgStorage;
27
33
  }
28
34
  /**
29
35
  * This interface was referenced by `SessionState`'s JSON-Schema
@@ -35,7 +41,7 @@ export interface OrganizationMembership {
35
41
  role: string;
36
42
  department?: string;
37
43
  departmentName?: string;
38
- dflt?: boolean;
44
+ dflt?: 1;
39
45
  }
40
46
  /**
41
47
  * This interface was referenced by `SessionState`'s JSON-Schema
@@ -58,9 +64,7 @@ export interface Account {
58
64
  }
59
65
 
60
66
 
61
- export const validate: (data: any) => data is SessionState
62
- export const assertValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => asserts data is SessionState
63
- export const returnValid: (data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions) => SessionState
64
-
65
- export const schema: any
66
-
67
+ export declare function validate(data: any): data is SessionState
68
+ export declare function assertValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): asserts data is SessionState
69
+ export declare function returnValid(data: any, options?: import('@data-fair/lib-node/validation.js').AssertValidOptions): SessionState
70
+