@data-fair/lib-common-types 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/event/.type/index.d.ts +115 -0
- package/event/.type/index.js +7 -0
- package/event/index.d.ts +1 -0
- package/event/index.js +1 -0
- package/event/schema.d.ts +136 -0
- package/event/schema.js +115 -0
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
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 Title = string;
|
|
6
|
+
export type Content = string;
|
|
7
|
+
export type HTMLContent = string;
|
|
8
|
+
export type URLOfEventIcon = string;
|
|
9
|
+
export type Type = "user" | "organization";
|
|
10
|
+
export type CleDuSujet = string;
|
|
11
|
+
export type LibelleDuSujet = string;
|
|
12
|
+
export type Visibility = "public" | "private";
|
|
13
|
+
export type ReceptionDate = string;
|
|
14
|
+
|
|
15
|
+
export interface Event {
|
|
16
|
+
title: Title | InternationalizedTitle;
|
|
17
|
+
body?: Content | InternationalizedContent;
|
|
18
|
+
htmlBody?: HTMLContent | InternationalizedHTMLContent;
|
|
19
|
+
icon?: URLOfEventIcon;
|
|
20
|
+
sender: Emitter;
|
|
21
|
+
topic: {
|
|
22
|
+
key: CleDuSujet;
|
|
23
|
+
title?: LibelleDuSujet;
|
|
24
|
+
};
|
|
25
|
+
urlParams?: UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl;
|
|
26
|
+
visibility?: Visibility;
|
|
27
|
+
date: ReceptionDate;
|
|
28
|
+
/**
|
|
29
|
+
* Free properties that varie depending on the type of event
|
|
30
|
+
*/
|
|
31
|
+
extra?: {
|
|
32
|
+
[k: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface InternationalizedTitle {
|
|
36
|
+
/**
|
|
37
|
+
* This interface was referenced by `InternationalizedTitle`'s JSON-Schema definition
|
|
38
|
+
* via the `patternProperty` ".*".
|
|
39
|
+
*/
|
|
40
|
+
[k: string]: string;
|
|
41
|
+
}
|
|
42
|
+
export interface InternationalizedContent {
|
|
43
|
+
/**
|
|
44
|
+
* This interface was referenced by `InternationalizedContent`'s JSON-Schema definition
|
|
45
|
+
* via the `patternProperty` ".*".
|
|
46
|
+
*/
|
|
47
|
+
[k: string]: string;
|
|
48
|
+
}
|
|
49
|
+
export interface InternationalizedHTMLContent {
|
|
50
|
+
/**
|
|
51
|
+
* This interface was referenced by `InternationalizedHTMLContent`'s JSON-Schema definition
|
|
52
|
+
* via the `patternProperty` ".*".
|
|
53
|
+
*/
|
|
54
|
+
[k: string]: string;
|
|
55
|
+
}
|
|
56
|
+
export interface Emitter {
|
|
57
|
+
type: Type;
|
|
58
|
+
/**
|
|
59
|
+
* The unique id of the user or organization
|
|
60
|
+
*/
|
|
61
|
+
id: string;
|
|
62
|
+
/**
|
|
63
|
+
* The display name of the user or organization
|
|
64
|
+
*/
|
|
65
|
+
name: string;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated
|
|
68
|
+
* If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
|
|
69
|
+
*/
|
|
70
|
+
role?: string;
|
|
71
|
+
/**
|
|
72
|
+
* If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department
|
|
73
|
+
*/
|
|
74
|
+
department?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The display name of the department
|
|
77
|
+
*/
|
|
78
|
+
departmentName?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl {
|
|
81
|
+
/**
|
|
82
|
+
* This interface was referenced by `UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl`'s JSON-Schema definition
|
|
83
|
+
* via the `patternProperty` ".*".
|
|
84
|
+
*/
|
|
85
|
+
[k: string]: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* This interface was referenced by `Event`'s JSON-Schema
|
|
89
|
+
* via the `definition` "sender".
|
|
90
|
+
*/
|
|
91
|
+
export interface Proprietaire {
|
|
92
|
+
type: Type;
|
|
93
|
+
/**
|
|
94
|
+
* The unique id of the user or organization
|
|
95
|
+
*/
|
|
96
|
+
id: string;
|
|
97
|
+
/**
|
|
98
|
+
* The display name of the user or organization
|
|
99
|
+
*/
|
|
100
|
+
name: string;
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated
|
|
103
|
+
* If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role
|
|
104
|
+
*/
|
|
105
|
+
role?: string;
|
|
106
|
+
/**
|
|
107
|
+
* If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department
|
|
108
|
+
*/
|
|
109
|
+
department?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The display name of the department
|
|
112
|
+
*/
|
|
113
|
+
departmentName?: string;
|
|
114
|
+
}
|
|
115
|
+
|
package/event/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.type/index.js';
|
package/event/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.type/index.js'
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
$id: string;
|
|
3
|
+
'x-exports': string[];
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
additionalProperties: boolean;
|
|
7
|
+
required: string[];
|
|
8
|
+
properties: {
|
|
9
|
+
title: {
|
|
10
|
+
oneOf: ({
|
|
11
|
+
type: string;
|
|
12
|
+
title: string;
|
|
13
|
+
patternProperties: {
|
|
14
|
+
'.*': {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
} | {
|
|
19
|
+
type: string;
|
|
20
|
+
title: string;
|
|
21
|
+
})[];
|
|
22
|
+
};
|
|
23
|
+
body: {
|
|
24
|
+
oneOf: ({
|
|
25
|
+
type: string;
|
|
26
|
+
title: string;
|
|
27
|
+
patternProperties: {
|
|
28
|
+
'.*': {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
type: string;
|
|
34
|
+
title: string;
|
|
35
|
+
})[];
|
|
36
|
+
};
|
|
37
|
+
htmlBody: {
|
|
38
|
+
oneOf: ({
|
|
39
|
+
type: string;
|
|
40
|
+
title: string;
|
|
41
|
+
patternProperties: {
|
|
42
|
+
'.*': {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
type: string;
|
|
48
|
+
title: string;
|
|
49
|
+
})[];
|
|
50
|
+
};
|
|
51
|
+
icon: {
|
|
52
|
+
type: string;
|
|
53
|
+
title: string;
|
|
54
|
+
};
|
|
55
|
+
sender: {
|
|
56
|
+
$ref: string;
|
|
57
|
+
title: string;
|
|
58
|
+
};
|
|
59
|
+
topic: {
|
|
60
|
+
type: string;
|
|
61
|
+
additionalProperties: boolean;
|
|
62
|
+
required: string[];
|
|
63
|
+
properties: {
|
|
64
|
+
key: {
|
|
65
|
+
type: string;
|
|
66
|
+
title: string;
|
|
67
|
+
};
|
|
68
|
+
title: {
|
|
69
|
+
type: string;
|
|
70
|
+
title: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
urlParams: {
|
|
75
|
+
type: string;
|
|
76
|
+
title: string;
|
|
77
|
+
patternProperties: {
|
|
78
|
+
'.*': {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
visibility: {
|
|
84
|
+
type: string;
|
|
85
|
+
title: string;
|
|
86
|
+
enum: string[];
|
|
87
|
+
default: string;
|
|
88
|
+
};
|
|
89
|
+
date: {
|
|
90
|
+
type: string;
|
|
91
|
+
title: string;
|
|
92
|
+
format: string;
|
|
93
|
+
};
|
|
94
|
+
extra: {
|
|
95
|
+
type: string;
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
$defs: {
|
|
100
|
+
sender: {
|
|
101
|
+
type: string;
|
|
102
|
+
title: string;
|
|
103
|
+
additionalProperties: boolean;
|
|
104
|
+
required: string[];
|
|
105
|
+
properties: {
|
|
106
|
+
type: {
|
|
107
|
+
type: string;
|
|
108
|
+
enum: string[];
|
|
109
|
+
title: string;
|
|
110
|
+
};
|
|
111
|
+
id: {
|
|
112
|
+
type: string;
|
|
113
|
+
description: string;
|
|
114
|
+
};
|
|
115
|
+
name: {
|
|
116
|
+
type: string;
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
role: {
|
|
120
|
+
type: string;
|
|
121
|
+
deprecated: boolean;
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
124
|
+
department: {
|
|
125
|
+
type: string;
|
|
126
|
+
description: string;
|
|
127
|
+
};
|
|
128
|
+
departmentName: {
|
|
129
|
+
type: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export default _default;
|
package/event/schema.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
const i18nMsg = (title) => ({
|
|
2
|
+
type: 'object',
|
|
3
|
+
title: `Internationalized ${title} `,
|
|
4
|
+
patternProperties: {
|
|
5
|
+
'.*': { type: 'string' }
|
|
6
|
+
}
|
|
7
|
+
// properties: ['fr', 'en'].reduce((/** @type {Record<string, any>} */props, locale) => { props[locale] = { type: 'string', title: locale }; return props }, {})
|
|
8
|
+
})
|
|
9
|
+
export default {
|
|
10
|
+
$id: 'https://github.com/data-fair/lib/event',
|
|
11
|
+
'x-exports': ['types'],
|
|
12
|
+
title: 'Event',
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
required: ['title', 'topic', 'sender', 'date'],
|
|
16
|
+
properties: {
|
|
17
|
+
title: {
|
|
18
|
+
oneOf: [{
|
|
19
|
+
type: 'string',
|
|
20
|
+
title: 'Title'
|
|
21
|
+
}, i18nMsg('title')]
|
|
22
|
+
},
|
|
23
|
+
body: {
|
|
24
|
+
oneOf: [{
|
|
25
|
+
type: 'string',
|
|
26
|
+
title: 'Content'
|
|
27
|
+
}, i18nMsg('content')]
|
|
28
|
+
},
|
|
29
|
+
htmlBody: {
|
|
30
|
+
oneOf: [{
|
|
31
|
+
type: 'string',
|
|
32
|
+
title: 'HTML content'
|
|
33
|
+
}, i18nMsg('HTML content')]
|
|
34
|
+
},
|
|
35
|
+
icon: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
title: 'URL of event icon'
|
|
38
|
+
},
|
|
39
|
+
// sender is the owner of the topic
|
|
40
|
+
sender: { $ref: '#/$defs/sender', title: 'Emitter' },
|
|
41
|
+
topic: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
required: ['key'],
|
|
45
|
+
properties: {
|
|
46
|
+
key: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
title: 'Clé du sujet'
|
|
49
|
+
},
|
|
50
|
+
title: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
title: 'Libellé du sujet'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
urlParams: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
title: 'used to fill subscription.urlTemplate and so create notification.url',
|
|
59
|
+
patternProperties: {
|
|
60
|
+
'.*': { type: 'string' }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
visibility: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
title: 'Visibility',
|
|
66
|
+
enum: ['public', 'private'],
|
|
67
|
+
default: 'private'
|
|
68
|
+
},
|
|
69
|
+
date: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
title: 'Reception date',
|
|
72
|
+
format: 'date-time'
|
|
73
|
+
},
|
|
74
|
+
extra: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
description: 'Free properties that varie depending on the type of event'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
$defs: {
|
|
80
|
+
sender: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
title: 'Propriétaire',
|
|
83
|
+
additionalProperties: false,
|
|
84
|
+
required: ['type', 'id', 'name'],
|
|
85
|
+
properties: {
|
|
86
|
+
type: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
enum: ['user', 'organization'],
|
|
89
|
+
title: 'Type'
|
|
90
|
+
},
|
|
91
|
+
id: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'The unique id of the user or organization'
|
|
94
|
+
},
|
|
95
|
+
name: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'The display name of the user or organization'
|
|
98
|
+
},
|
|
99
|
+
role: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
deprecated: true,
|
|
102
|
+
description: 'If this is set and owner is an organization, this restrict ownership to users of this organization having this role or admin role'
|
|
103
|
+
},
|
|
104
|
+
department: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
description: 'If this is set and owner is an organization, this gives ownership to users of this organization that belong to this department'
|
|
107
|
+
},
|
|
108
|
+
departmentName: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: 'The display name of the department'
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|