@data-fair/lib-common-types 1.3.1 → 1.4.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,69 @@
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 CleDuSujet = string;
10
+ export type LibelleDuSujet = string;
11
+ export type Visibility = "public" | "private";
12
+ export type ReceptionDate = string;
13
+
14
+ export interface Event {
15
+ title: Title | InternationalizedTitle;
16
+ body?: Content | InternationalizedContent;
17
+ htmlBody?: HTMLContent | InternationalizedHTMLContent;
18
+ icon?: URLOfEventIcon;
19
+ sender: Emitter;
20
+ topic: {
21
+ key: CleDuSujet;
22
+ title?: LibelleDuSujet;
23
+ };
24
+ urlParams?: UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl;
25
+ visibility?: Visibility;
26
+ date: ReceptionDate;
27
+ /**
28
+ * Free properties that varie depending on the type of event
29
+ */
30
+ extra?: {
31
+ [k: string]: unknown;
32
+ };
33
+ }
34
+ export interface InternationalizedTitle {
35
+ /**
36
+ * This interface was referenced by `InternationalizedTitle`'s JSON-Schema definition
37
+ * via the `patternProperty` ".*".
38
+ */
39
+ [k: string]: string;
40
+ }
41
+ export interface InternationalizedContent {
42
+ /**
43
+ * This interface was referenced by `InternationalizedContent`'s JSON-Schema definition
44
+ * via the `patternProperty` ".*".
45
+ */
46
+ [k: string]: string;
47
+ }
48
+ export interface InternationalizedHTMLContent {
49
+ /**
50
+ * This interface was referenced by `InternationalizedHTMLContent`'s JSON-Schema definition
51
+ * via the `patternProperty` ".*".
52
+ */
53
+ [k: string]: string;
54
+ }
55
+ export interface Emitter {
56
+ type: "user" | "organization";
57
+ id: string;
58
+ name: string;
59
+ department?: string;
60
+ departmentName?: string;
61
+ }
62
+ export interface UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl {
63
+ /**
64
+ * This interface was referenced by `UsedToFillSubscriptionUrlTemplateAndSoCreateNotificationUrl`'s JSON-Schema definition
65
+ * via the `patternProperty` ".*".
66
+ */
67
+ [k: string]: string;
68
+ }
69
+
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+
3
+
4
+
5
+ export const schemaExports = [
6
+ "types"
7
+ ]
@@ -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,100 @@
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
+ };
100
+ export default _default;
@@ -0,0 +1,79 @@
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: 'https://github.com/data-fair/lib/session-state#/$defs/account', 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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-common-types",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Shared schemas and built type definitions in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "scripts": {