@tricoteuses/assemblee 3.6.1 → 3.7.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/lib/eliasse-CP5wde9Z.js +275 -0
- package/lib/eliasse-details.d.ts +14 -0
- package/lib/eliasse-details.test.d.ts +1 -0
- package/lib/eliasse-retry.d.ts +54 -0
- package/lib/eliasse-retry.test.d.ts +1 -0
- package/lib/eliasse-socket.d.ts +22 -0
- package/lib/eliasse-socket.js +62 -8
- package/lib/eliasse-sync.d.ts +31 -3
- package/lib/eliasse-sync.js +116 -46
- package/lib/eliasse.d.ts +1 -0
- package/lib/eliasse.js +2 -150
- package/lib/open_data/artifacts.d.ts +4 -0
- package/lib/parsers.js +130 -68
- package/lib/scripts/prepare_targeted_documents.d.ts +1 -0
- package/lib/scripts/retrieve_documents.d.ts +4 -0
- package/lib/scripts/shared/senateur_photo.d.ts +1 -0
- package/lib/scripts/shared/senateur_photo.test.d.ts +1 -0
- package/lib/scripts/validate_targeted_document_content.d.ts +1 -0
- package/lib/targeted_documents.d.ts +14 -0
- package/lib/targeted_documents.test.d.ts +1 -0
- package/package.json +1 -1
package/lib/eliasse-sync.js
CHANGED
|
@@ -1,12 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, D as t, E as n, S as r, T as i, w as a } from "./eliasse-CP5wde9Z.js";
|
|
2
|
+
import { applyEliasseDerouleurUpdate as o, compareEliasseOrdre as s } from "./eliasse-socket.js";
|
|
3
|
+
//#region src/eliasse-details.ts
|
|
4
|
+
async function c(e, t, n = {}) {
|
|
5
|
+
let r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = new Set(e), s = /* @__PURE__ */ new Set(), c = AbortSignal.timeout(n.budgetMs ?? 5e3), l = !1, u, d = e.length ? [.../* @__PURE__ */ new Set([e[0], ...e.filter((e, t) => t % 5 == 2)])] : [];
|
|
6
|
+
for (let f of [...d, ...e]) if (!(r.has(f) || s.has(f))) {
|
|
7
|
+
if (c.aborted || l) break;
|
|
8
|
+
s.add(f);
|
|
9
|
+
try {
|
|
10
|
+
let e = await t(f, AbortSignal.any([c, AbortSignal.timeout(n.requestTimeoutMs ?? 15e3)]));
|
|
11
|
+
for (let t of e) o.has(t.uid) && r.set(t.uid, t);
|
|
12
|
+
r.has(f) || a.set(f, {
|
|
13
|
+
kind: "empty",
|
|
14
|
+
message: "Requested UID absent from neighbor window"
|
|
15
|
+
});
|
|
16
|
+
} catch (e) {
|
|
17
|
+
let t = i(e);
|
|
18
|
+
a.set(f, t), l = [
|
|
19
|
+
"network",
|
|
20
|
+
"timeout",
|
|
21
|
+
"rate-limit"
|
|
22
|
+
].includes(t.kind), t.kind === "rate-limit" && (u = t);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (let t of e) !r.has(t) && !s.has(t) && a.set(t, {
|
|
26
|
+
kind: "deferred",
|
|
27
|
+
message: "Batch interrupted before requesting this UID"
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
details: r,
|
|
31
|
+
failures: a,
|
|
32
|
+
rateLimit: u
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
2
36
|
//#region src/eliasse-sync.ts
|
|
3
|
-
function
|
|
37
|
+
function l(e) {
|
|
4
38
|
return e != null && e !== "" && e !== "Aucun";
|
|
5
39
|
}
|
|
6
|
-
function
|
|
40
|
+
function u(e) {
|
|
7
41
|
return JSON.stringify(e, (e, t) => typeof t != "object" || !t || Array.isArray(t) ? t : Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : +(e > t))));
|
|
8
42
|
}
|
|
9
|
-
var
|
|
43
|
+
var d = class {
|
|
10
44
|
constructor(e) {
|
|
11
45
|
this.options = e, this.tails = /* @__PURE__ */ new Map();
|
|
12
46
|
}
|
|
@@ -16,22 +50,24 @@ var i = class {
|
|
|
16
50
|
synchronize(e) {
|
|
17
51
|
return this.enqueue(e.uidExamen, () => this.http(e));
|
|
18
52
|
}
|
|
19
|
-
applyUpdate(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
53
|
+
applyUpdate(e, t) {
|
|
54
|
+
let n = this.options.now?.() ?? Date.now();
|
|
55
|
+
return this.enqueue(e.uidExamen, async () => {
|
|
56
|
+
let r = await this.options.repository.load(e.uidExamen);
|
|
57
|
+
if (r.derouleur === void 0 || t.version !== r.derouleur.version + 1) return this.http(e);
|
|
58
|
+
let i = t.places.flatMap((e) => e.amendements.map((t) => ({
|
|
24
59
|
amendement: t,
|
|
25
60
|
place: {
|
|
26
61
|
id: e.id,
|
|
27
62
|
libelle: e.libelle ?? r.derouleur.places.find((t) => t.id === e.id)?.libelle
|
|
28
63
|
}
|
|
29
64
|
})));
|
|
30
|
-
return this.process(
|
|
65
|
+
return this.process(e, r, o(r.derouleur, t), i, void 0, "patch", n);
|
|
31
66
|
});
|
|
32
67
|
}
|
|
33
68
|
saveStatistics(e, t) {
|
|
34
|
-
|
|
69
|
+
let n = this.options.now?.() ?? Date.now();
|
|
70
|
+
return this.enqueue(e, () => this.options.repository.saveStatistics(e, t, n));
|
|
35
71
|
}
|
|
36
72
|
enqueue(e, t) {
|
|
37
73
|
let n = (this.tails.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
|
|
@@ -40,66 +76,100 @@ var i = class {
|
|
|
40
76
|
}).catch(() => void 0), n;
|
|
41
77
|
}
|
|
42
78
|
async http(e) {
|
|
43
|
-
let t = await this.options.repository.load(e.uidExamen), [n, r] = await Promise.all([this.options.fetchDerouleur(e)
|
|
79
|
+
let t = await this.options.repository.load(e.uidExamen), [n, r] = await Promise.all([this.options.fetchDerouleur(e).then((e) => ({
|
|
80
|
+
value: e,
|
|
81
|
+
at: this.options.now?.() ?? Date.now()
|
|
82
|
+
})), this.options.fetchStatistiques(e).then((e) => ({
|
|
83
|
+
value: e,
|
|
84
|
+
at: this.options.now?.() ?? Date.now()
|
|
85
|
+
})).catch((e) => {
|
|
44
86
|
this.options.onError?.(e);
|
|
45
87
|
})]);
|
|
46
|
-
return this.process(e, t, n, [], r);
|
|
88
|
+
return this.process(e, t, n.value, [], r?.value, "http", n.at, r?.at);
|
|
47
89
|
}
|
|
48
|
-
async process(e,
|
|
49
|
-
let
|
|
90
|
+
async process(e, n, r, a, o, c = "http", d, f) {
|
|
91
|
+
let p = this.options.now?.() ?? Date.now(), m = new Map(n.amendements.map((e) => [e.uid, { ...e }])), h = r.places.flatMap((e) => e.amendements.map((t) => ({
|
|
50
92
|
amendement: t,
|
|
51
93
|
place: {
|
|
52
94
|
id: e.id,
|
|
53
95
|
libelle: e.libelle
|
|
54
96
|
}
|
|
55
97
|
})));
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
for (let e of [...
|
|
59
|
-
let t = e.amendement.uid,
|
|
60
|
-
|
|
61
|
-
...
|
|
98
|
+
h.sort((e, t) => s(e.amendement.ordre, t.amendement.ordre));
|
|
99
|
+
let g = new Set(h.filter((e) => e.amendement.estVisible !== !1).map((e) => e.amendement.uid)), _ = new Set(h.filter((e) => e.amendement.estVisible !== !1 && !l(e.amendement.sort)).slice(0, this.options.limit ?? 25).map((e) => e.amendement.uid)), v = e.uidAmendement ?? void 0;
|
|
100
|
+
for (let e of [...h, ...a]) {
|
|
101
|
+
let t = e.amendement.uid, n = m.get(t), r = u(n?.row) !== u(e), i = l(e.amendement.sort) || t === v || _.has(t) || n?.present === !0 && !g.has(t);
|
|
102
|
+
m.set(t, {
|
|
103
|
+
...n,
|
|
62
104
|
uid: t,
|
|
63
105
|
row: e,
|
|
64
|
-
present:
|
|
65
|
-
detailPending:
|
|
66
|
-
detailRetryAt:
|
|
106
|
+
present: g.has(t),
|
|
107
|
+
detailPending: n?.detailPending === !0 || i && (n?.detail === void 0 || r || (t === v || _.has(t)) && p - (n?.detailFetchedAt ?? 0) >= (this.options.detailRefreshMs ?? 6e4)),
|
|
108
|
+
detailRetryAt: r || n?.present === !1 && g.has(t) ? void 0 : n?.detailRetryAt,
|
|
109
|
+
detailRetry: r || n?.present === !1 && g.has(t) ? void 0 : n?.detailRetry
|
|
67
110
|
});
|
|
68
111
|
}
|
|
69
|
-
for (let e of
|
|
70
|
-
|
|
71
|
-
uid:
|
|
112
|
+
for (let e of m.values()) g.has(e.uid) || (e.present && (e.detailPending = !0, e.detailRetryAt = void 0), e.present = !1);
|
|
113
|
+
v !== void 0 && !m.has(v) && m.set(v, {
|
|
114
|
+
uid: v,
|
|
72
115
|
present: !1,
|
|
73
116
|
detailPending: !0
|
|
74
117
|
});
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
118
|
+
let y = v === void 0 ? void 0 : m.get(v);
|
|
119
|
+
y !== void 0 && p - (y.detailFetchedAt ?? 0) >= (this.options.detailRefreshMs ?? 6e4) && (y.detailPending = !0), y?.detailRetryAt !== void 0 && (y.detailRetryAt = Math.min(y.detailRetryAt, p + Math.min(this.options.retryMs ?? 6e4, 15e3)));
|
|
120
|
+
for (let e of m.values()) e.detailPending && e.detailPendingSince === void 0 && (e.detailPendingSince = p);
|
|
121
|
+
let b = new Set(n.amendements.filter((e) => e.present && !g.has(e.uid)).map((e) => e.uid)), x = (e) => e.uid === v ? 0 : l(e.row?.amendement.sort) ? 1 : b.has(e.uid) ? 2 : _.has(e.uid) ? 3 : e.present ? 4 : 5, S = [...m.values()].filter((e) => e.detailPending && (e.detailRetryAt ?? 0) <= p).sort((e, t) => x(e) - x(t) || (e.detailFetchedAt ?? 0) - (t.detailFetchedAt ?? 0) || s(e.row?.amendement.ordre ?? "", t.row?.amendement.ordre ?? "")).slice(0, Math.max(0, this.options.limit ?? 25)), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
|
|
122
|
+
if (S.length > 0) try {
|
|
123
|
+
let t = await this.options.fetchDetails(e, S.map((e) => e.uid));
|
|
124
|
+
t instanceof Map ? C = t : (C = t.details, w = t.failures);
|
|
80
125
|
} catch (e) {
|
|
81
|
-
this.options.onError?.(e);
|
|
126
|
+
this.options.onError?.(e), w = new Map(S.map((t) => [t.uid, i(e)]));
|
|
82
127
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
128
|
+
let T = this.options.now?.() ?? Date.now();
|
|
129
|
+
for (let e of S) {
|
|
130
|
+
if (w.get(e.uid)?.kind === "deferred") {
|
|
131
|
+
e.detailRetryAt = T + (e.uid === v ? Math.min(this.options.retryMs ?? 6e4, 15e3) : this.options.retryMs ?? 6e4);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
e.detailAttempts = (e.detailAttempts ?? 0) + 1;
|
|
135
|
+
let n = C.get(e.uid);
|
|
136
|
+
if (n !== void 0) e.detail = n, e.detailFetchedAt = T, e.detailPending = !1, e.detailPendingSince = void 0, e.detailRetryAt = void 0, e.detailRetry = e.detailRetry === void 0 ? void 0 : {
|
|
137
|
+
...e.detailRetry,
|
|
138
|
+
attempts: 0,
|
|
139
|
+
nextRetryAt: void 0,
|
|
140
|
+
lastSuccessAt: T
|
|
141
|
+
};
|
|
86
142
|
else {
|
|
87
|
-
let
|
|
88
|
-
e.
|
|
143
|
+
let n = this.options.retryMs ?? 6e4;
|
|
144
|
+
e.detailRetry = t(e.detailRetry, w.get(e.uid) ?? {
|
|
145
|
+
kind: "empty",
|
|
146
|
+
message: "Requested UID absent from detail response"
|
|
147
|
+
}, T, {
|
|
148
|
+
baseMs: e.uid === v ? Math.min(n, 15e3) : n,
|
|
149
|
+
maxMs: e.uid === v ? Math.min(n, 15e3) : e.present ? n : this.options.historicalRetryMaxMs ?? 216e5,
|
|
150
|
+
random: this.options.random
|
|
151
|
+
}), e.detailRetryAt = e.detailRetry.nextRetryAt;
|
|
89
152
|
}
|
|
90
153
|
}
|
|
91
|
-
let
|
|
92
|
-
revision:
|
|
93
|
-
derouleur:
|
|
94
|
-
amendements: [...
|
|
154
|
+
let E = {
|
|
155
|
+
revision: n.revision,
|
|
156
|
+
derouleur: r,
|
|
157
|
+
amendements: [...m.values()]
|
|
95
158
|
};
|
|
96
159
|
return {
|
|
97
|
-
...await this.options.repository.commit(e,
|
|
160
|
+
...await this.options.repository.commit(e, E, o, {
|
|
161
|
+
source: c,
|
|
162
|
+
snapshotReceivedAt: d,
|
|
163
|
+
statisticsReceivedAt: f
|
|
164
|
+
}),
|
|
98
165
|
source: c,
|
|
99
|
-
version:
|
|
100
|
-
|
|
166
|
+
version: r.version,
|
|
167
|
+
receivedAt: d,
|
|
168
|
+
pendingDetails: E.amendements.filter((e) => e.detailPending).length,
|
|
169
|
+
pendingCurrentDetails: E.amendements.filter((e) => e.detailPending && e.present).length,
|
|
170
|
+
pendingHistoricalDetails: E.amendements.filter((e) => e.detailPending && !e.present).length
|
|
101
171
|
};
|
|
102
172
|
}
|
|
103
173
|
};
|
|
104
174
|
//#endregion
|
|
105
|
-
export {
|
|
175
|
+
export { r as EliasseRequestError, e as EliasseRequestScheduler, a as EliasseRetryDeferredError, d as EliasseSynchronizer, i as classifyEliasseFailure, c as fetchEliasseDetailBatch, l as isEliasseKnownSort, n as mapEliasseConcurrent, t as nextEliasseRetry };
|
package/lib/eliasse.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ export declare const eliasseStatistiquesSchema: z.ZodType<EliasseStatistiques>;
|
|
|
151
151
|
* amendements), eg. `17` for `EXANR5L17PO419610B3058P0D1`.
|
|
152
152
|
*/
|
|
153
153
|
export declare function eliasseUidLegislature(uid: string): number | undefined;
|
|
154
|
+
export { EliasseRequestError, classifyEliasseFailure } from './eliasse-retry.js';
|
|
154
155
|
export declare function fetchEliasseOrganes(options?: EliasseFetchOptions): Promise<EliasseOrgane[]>;
|
|
155
156
|
export declare function fetchEliasseExamens(options?: EliasseFetchOptions): Promise<EliasseExamen[]>;
|
|
156
157
|
export declare function fetchEliasseProchainsADiscuter(options?: EliasseFetchOptions): Promise<EliasseProchainADiscuter[]>;
|
package/lib/eliasse.js
CHANGED
|
@@ -1,150 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/eliasse.ts
|
|
4
|
-
var n = "https://eliasse.assemblee-nationale.fr/api-eliasse/", r = t.object({
|
|
5
|
-
uid: t.string(),
|
|
6
|
-
abreviation: t.string(),
|
|
7
|
-
libelle: t.string(),
|
|
8
|
-
libelleAbrege: t.string(),
|
|
9
|
-
libelleAbregeRaccourci: t.string(),
|
|
10
|
-
dateFin: t.string().nullable()
|
|
11
|
-
}), i = t.object({
|
|
12
|
-
codeMinefi: t.string().nullable().optional(),
|
|
13
|
-
libelle: t.string().nullable().optional(),
|
|
14
|
-
missionLibelle: t.string().nullable().optional(),
|
|
15
|
-
nombreAmendementsMissionTotal: t.number().nullable().optional(),
|
|
16
|
-
nombreAmendementsMissionExamines: t.number().nullable().optional(),
|
|
17
|
-
nombreAmendementsMissionRestants: t.number().nullable().optional()
|
|
18
|
-
}), a = t.object({
|
|
19
|
-
uid: t.string(),
|
|
20
|
-
organeRef: t.string(),
|
|
21
|
-
statut: t.string(),
|
|
22
|
-
texte: t.object({
|
|
23
|
-
uid: t.string(),
|
|
24
|
-
libelle: t.string(),
|
|
25
|
-
bibard: t.string(),
|
|
26
|
-
partie: t.number()
|
|
27
|
-
}),
|
|
28
|
-
estSecondeDeliberation: t.boolean(),
|
|
29
|
-
missions: t.array(i)
|
|
30
|
-
}), o = t.object({
|
|
31
|
-
uidOrgane: t.string(),
|
|
32
|
-
uidTexte: t.string(),
|
|
33
|
-
uidExamen: t.string(),
|
|
34
|
-
uidAmendement: t.string().nullable()
|
|
35
|
-
}), s = t.object({ libelle: t.string() }), c = t.object({
|
|
36
|
-
id: t.string(),
|
|
37
|
-
uid: t.string(),
|
|
38
|
-
numero: t.string(),
|
|
39
|
-
estSousAmendement: t.boolean(),
|
|
40
|
-
sort: t.string().nullable(),
|
|
41
|
-
ordre: t.string(),
|
|
42
|
-
auteur: s,
|
|
43
|
-
positionDiscussionIdentique: t.string().nullable(),
|
|
44
|
-
positionDiscussionCommune: t.string().nullable(),
|
|
45
|
-
positionDiscussionIdentiqueSousAmendement: t.string().nullable(),
|
|
46
|
-
positionDiscussionCommuneSousAmendement: t.string().nullable(),
|
|
47
|
-
estVisible: t.boolean(),
|
|
48
|
-
codeMinefi: t.string().nullable(),
|
|
49
|
-
numeroParent: t.string().nullable().optional(),
|
|
50
|
-
amendementParentRef: t.string().nullable().optional()
|
|
51
|
-
}), l = t.object({
|
|
52
|
-
places: t.array(t.object({
|
|
53
|
-
id: t.string(),
|
|
54
|
-
libelle: t.string(),
|
|
55
|
-
amendements: t.array(c)
|
|
56
|
-
})),
|
|
57
|
-
version: t.number()
|
|
58
|
-
}), u = t.object({
|
|
59
|
-
divisionRef: t.string().nullable(),
|
|
60
|
-
titre: t.string().nullable(),
|
|
61
|
-
articleDesignationCourte: t.string().nullable(),
|
|
62
|
-
articleDesignation: t.string().nullable(),
|
|
63
|
-
type: t.string().nullable(),
|
|
64
|
-
avantApres: t.string().nullable(),
|
|
65
|
-
urlDivisionTexteVise: t.string().nullable(),
|
|
66
|
-
estArticleAdditionnel: t.boolean(),
|
|
67
|
-
estChapitreAdditionnel: t.boolean(),
|
|
68
|
-
contenuHtml: t.string().nullable()
|
|
69
|
-
}), d = t.object({
|
|
70
|
-
typeAuteur: t.string().nullable(),
|
|
71
|
-
ref: t.string().nullable(),
|
|
72
|
-
libelle: t.string(),
|
|
73
|
-
urlPhoto: t.string().nullable(),
|
|
74
|
-
urlFicheActeur: t.string().nullable()
|
|
75
|
-
}), f = t.object({
|
|
76
|
-
uid: t.string(),
|
|
77
|
-
libelle: t.string(),
|
|
78
|
-
prenom: t.string().nullable(),
|
|
79
|
-
nom: t.string().nullable(),
|
|
80
|
-
civilite: t.string().nullable(),
|
|
81
|
-
urlPhoto: t.string().nullable(),
|
|
82
|
-
urlFicheActeur: t.string().nullable()
|
|
83
|
-
}), p = t.object({
|
|
84
|
-
uid: t.string(),
|
|
85
|
-
numero: t.string(),
|
|
86
|
-
numeroParent: t.string().nullable(),
|
|
87
|
-
amendementParentRef: t.string().nullable(),
|
|
88
|
-
estSousAmendement: t.boolean(),
|
|
89
|
-
sort: t.string().nullable(),
|
|
90
|
-
ordre: t.string(),
|
|
91
|
-
division: u.nullable(),
|
|
92
|
-
auteur: d.nullable(),
|
|
93
|
-
auteurParent: d.nullable(),
|
|
94
|
-
cosignataires: t.array(f),
|
|
95
|
-
cosignatairesSuffixe: t.string().nullable(),
|
|
96
|
-
cosignatairesLibelle: t.string().nullable(),
|
|
97
|
-
positionDiscussionIdentique: t.string().nullable(),
|
|
98
|
-
positionDiscussionCommune: t.string().nullable(),
|
|
99
|
-
positionDiscussionIdentiqueSousAmendement: t.string().nullable(),
|
|
100
|
-
positionDiscussionCommuneSousAmendement: t.string().nullable(),
|
|
101
|
-
dispositif: t.string().nullable(),
|
|
102
|
-
exposeSommaire: t.string().nullable(),
|
|
103
|
-
contenuHtmlDuTexteDeReference: t.string().nullable(),
|
|
104
|
-
missionLibelle: t.string().nullable()
|
|
105
|
-
}), m = t.object({
|
|
106
|
-
codeMinefi: t.string().nullable().optional(),
|
|
107
|
-
missionLibelle: t.string().nullable().optional(),
|
|
108
|
-
nombreAmendementsMissionTotal: t.number().nullable().optional(),
|
|
109
|
-
nombreAmendementsMissionExamines: t.number().nullable().optional(),
|
|
110
|
-
nombreAmendementsMissionRestants: t.number().nullable().optional()
|
|
111
|
-
}), h = t.object({
|
|
112
|
-
nombreAmendementsTotal: t.number(),
|
|
113
|
-
nombreAmendementsExamines: t.number(),
|
|
114
|
-
nombreAmendementsRestants: t.number(),
|
|
115
|
-
missions: t.array(m)
|
|
116
|
-
});
|
|
117
|
-
function g(e) {
|
|
118
|
-
let t = /L(\d+)/.exec(e);
|
|
119
|
-
return t === null ? void 0 : Number(t[1]);
|
|
120
|
-
}
|
|
121
|
-
async function _(t, n, r, i) {
|
|
122
|
-
let a = i?.baseUrl ?? "https://eliasse.assemblee-nationale.fr/api-eliasse/", o = new URL(t, a.endsWith("/") ? a : `${a}/`), s = await fetch(o, {
|
|
123
|
-
headers: { Accept: "application/json" },
|
|
124
|
-
signal: i?.signal
|
|
125
|
-
});
|
|
126
|
-
if (!s.ok) throw Error(`Eliasse request failed: ${s.status} ${s.statusText} ${o}`);
|
|
127
|
-
let c = await s.json(), l = n.safeParse(c);
|
|
128
|
-
if (!l.success) throw Error(`Invalid Eliasse ${r} received from ${o}:\n${e(r, l.error, c)}`);
|
|
129
|
-
return c;
|
|
130
|
-
}
|
|
131
|
-
function v(e) {
|
|
132
|
-
return _("organes", t.array(r), "organes", e);
|
|
133
|
-
}
|
|
134
|
-
function y(e) {
|
|
135
|
-
return _("examens", t.array(a), "examens", e);
|
|
136
|
-
}
|
|
137
|
-
function b(e) {
|
|
138
|
-
return _("prochainadiscuter", t.array(o), "prochains à discuter", e);
|
|
139
|
-
}
|
|
140
|
-
function x(e, t) {
|
|
141
|
-
return _(`examens/${encodeURIComponent(e)}/derouleur`, l, "dérouleur", t);
|
|
142
|
-
}
|
|
143
|
-
function S(e, t) {
|
|
144
|
-
return _(`examens/${encodeURIComponent(e)}/statistiques`, h, "statistiques", t);
|
|
145
|
-
}
|
|
146
|
-
function C(e, n, r, i) {
|
|
147
|
-
return _(`textes/${encodeURIComponent(e)}/examens/${encodeURIComponent(n)}/amendements/${encodeURIComponent(r)}/with_neighbors`, t.array(p), "amendements", i);
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
export { d as eliasseAmendementAuteurSchema, p as eliasseAmendementSchema, f as eliasseCosignataireSchema, n as eliasseDefaultBaseUrl, c as eliasseDerouleurAmendementSchema, s as eliasseDerouleurAuteurSchema, l as eliasseDerouleurSchema, u as eliasseDivisionSchema, a as eliasseExamenSchema, i as eliasseMissionSchema, r as eliasseOrganeSchema, o as eliasseProchainADiscuterSchema, m as eliasseStatistiquesMissionSchema, h as eliasseStatistiquesSchema, g as eliasseUidLegislature, C as fetchEliasseAmendementWithNeighbors, x as fetchEliasseDerouleur, y as fetchEliasseExamens, v as fetchEliasseOrganes, b as fetchEliasseProchainsADiscuter, S as fetchEliasseStatistiques };
|
|
1
|
+
import { S as e, T as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, x, y as S } from "./eliasse-CP5wde9Z.js";
|
|
2
|
+
export { e as EliasseRequestError, t as classifyEliasseFailure, v as eliasseAmendementAuteurSchema, p as eliasseAmendementSchema, g as eliasseCosignataireSchema, u as eliasseDefaultBaseUrl, r as eliasseDerouleurAmendementSchema, m as eliasseDerouleurAuteurSchema, _ as eliasseDerouleurSchema, a as eliasseDivisionSchema, d as eliasseExamenSchema, y as eliasseMissionSchema, o as eliasseOrganeSchema, s as eliasseProchainADiscuterSchema, h as eliasseStatistiquesMissionSchema, f as eliasseStatistiquesSchema, l as eliasseUidLegislature, c as fetchEliasseAmendementWithNeighbors, n as fetchEliasseDerouleur, b as fetchEliasseExamens, S as fetchEliasseOrganes, i as fetchEliasseProchainsADiscuter, x as fetchEliasseStatistiques };
|
|
@@ -11,12 +11,14 @@ export interface ArtifactManifest extends ArtifactVersion {
|
|
|
11
11
|
sha256: string;
|
|
12
12
|
}
|
|
13
13
|
export interface DiscoveryOptions {
|
|
14
|
+
circuitBreakerCooldownMs?: number;
|
|
14
15
|
fetch?: typeof fetch;
|
|
15
16
|
probeCount?: number;
|
|
16
17
|
timeoutMs?: number;
|
|
17
18
|
}
|
|
18
19
|
export interface DownloadOptions {
|
|
19
20
|
chunkSizeBytes?: number;
|
|
21
|
+
circuitBreakerCooldownMs?: number;
|
|
20
22
|
fetch?: typeof fetch;
|
|
21
23
|
maxRetryDurationMs?: number;
|
|
22
24
|
now?: () => number;
|
|
@@ -37,6 +39,8 @@ export interface DownloadRetryEvent {
|
|
|
37
39
|
request: number;
|
|
38
40
|
sourceUrl: string;
|
|
39
41
|
}
|
|
42
|
+
/** Forget a previously tripped circuit breaker (mainly useful in tests). */
|
|
43
|
+
export declare function resetCircuitBreaker(): void;
|
|
40
44
|
export declare function formatDuration(milliseconds: number): string;
|
|
41
45
|
export interface ErrorDiagnostic {
|
|
42
46
|
cause?: ErrorDiagnostic;
|