-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
203 lines (180 loc) · 4.45 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// Type definitions for @socialgouv/kali-data
/**
* Get a full agreement unist tree with its sections and articles.
*
* @see https://github.com/syntax-tree/unist
*/
export function getAgreement(agreementIdOrIdcc: number | string): KaliData.Agreement;
/**
* Get a flat unist array of all the articles an agreement contains.
* Each article includes its parent sections path, as an ordered list of their titles.
*
* @see https://github.com/syntax-tree/unist
*/
export function getAgreementArticlesWithPath(
agreementIdOrIdcc: number | string,
): KaliData.AgreementArticleWithPath[];
/**
* Convert any agreement ID or IDCC into a normalized agreement ID.
*/
export function getAgreementIdFromIdOrIdcc(agreementIdOrIdcc: number | string): string;
/**
* Get the full list of indexed agreements.
*/
export function getAgreements(): KaliData.IndexedAgreement[];
/**
* Get the full list of indexed articles.
*/
export function getArticles(): KaliData.IndexedArticle[];
/**
* Get an agreement article unist node with its parent sections path.
* The parent sections path is represented as an ordered array of their titles.
*
* @see https://github.com/syntax-tree/unist
*/
export function getArticleWithPath(articleIdOrCid: string): KaliData.AgreementArticleWithPath;
/**
* Get an indexed article.
*/
export function getIndexedArticle(articleIdOrCid: string): KaliData.IndexedArticle;
/**
* Check if an agreement is available.
*/
export function hasAgreement(agreementIdOrIdcc: number | string): boolean;
/**
* Check if an article is available.
*/
export function hasArticle(articleIdOrCid: string): boolean;
export as namespace KaliData;
/**
* TODO Check and describe types.
*/
/**
* Agreement or Article State.
*
* - ABROGE: ...
* - DENONCE: ...
* - MODIFIE: ...
* - PERIME: ...
* - REMPLACE: ...
* - VIGUEUR: ...
* - VIGUEUR_ETEN: ...
* - VIGUEUR_NON_ETEN: ...
*/
type State =
| "ABROGE"
| "DENONCE"
| "MODIFIE"
| "PERIME"
| "REMPLACE"
| "VIGUEUR"
| "VIGUEUR_ETEN"
| "VIGUEUR_NON_ETEN";
type Agreement = {
type: "convention collective";
data: AgreementData;
children: AgreementSection[];
};
type AgreementData = {
num: number;
title: string;
id: string;
shortTitle: string;
categorisation: string[];
};
type AgreementSection = {
type: "section";
data: AgreementSectionData;
children: (AgreementArticle | AgreementSection)[];
};
type AgreementSectionData = {
cid: string;
intOrdre: number;
id: string;
title: string;
etat: State;
};
type AgreementArticle = {
type: "article";
data: AgreementArticleData;
};
type AgreementArticleData = {
cid: string;
intOrdre: number;
id: string;
/** Legal index */
num?: string;
/** HTML content */
content: string;
etat: State;
surtitre?: string;
historique?: string;
lstLienModification: AgreementArticleDataLinkUpdate[];
};
type AgreementArticleDataLinkUpdate = {
textCid: string;
textTitle: string;
linkType:
| "ABROGATION"
| "ABROGE"
| "CREATION"
| "CREE"
| "DENONCE"
| "DENONCIATION"
| "ELARGISSEMENT"
| "ELARGIT"
| "ETEND"
| "EXTENSION"
| "MODIFICATION"
| "MODIFIE"
| "PEREMPTION"
| "PERIME";
linkOrientation: "cible" | "source";
articleNum: string;
articleId: string;
natureText: string;
/** Publication date (YYYY-MM-DD) */
datePubliTexte: string | null;
/** ??? date (YYYY-MM-DD) */
dateSignaTexte: string | null;
/** ??? date (YYYY-MM-DD) */
dateDebutCible: string | null;
};
type IndexedAgreement = {
active?: boolean;
/** Publication ISO date */
date_publi?: string;
effectif?: number;
etat?: State;
/** Agreement ID */
id?: string;
mtime?: number;
nature?: "IDCC";
/** Agreement IDCC */
num: number;
shortTitle: string;
texte_de_base?: string;
title: string;
url?: string;
synonymes?: string[];
fetchArticles?: boolean;
};
type IndexedArticle = {
/** Agreement ID */
agreementId: string;
/** Article CID */
articleCid: string;
/** Article ID */
articleId: string;
/** Sections path */
path: string[];
};
type AgreementArticleWithParentSections = AgreementArticle & {
sections: Array<{
type: "section";
data: AgreementSectionData;
}>;
};
type AgreementArticleWithPath = AgreementArticle & {
path: string[];
};