@tricoteuses/assemblee 3.2.14 → 3.2.15
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/datasets.d.ts +1 -1
- package/lib/open_data/artifacts.d.ts +37 -0
- package/lib/open_data/artifacts.test.d.ts +1 -0
- package/lib/scripts/monitor_open_data_updates.d.ts +21 -0
- package/lib/scripts/monitor_open_data_updates.test.d.ts +1 -0
- package/lib/scripts/retrieve_open_data.d.ts +38 -19
- package/lib/scripts/retrieve_open_data.test.d.ts +1 -0
- package/package.json +1 -1
package/lib/datasets.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface Dataset {
|
|
|
4
4
|
filename: string;
|
|
5
5
|
ignoreForWeb?: boolean;
|
|
6
6
|
legislature: Legislature;
|
|
7
|
-
repairZip?: (dataset: Dataset, dataDir: string) => void;
|
|
7
|
+
repairZip?: (dataset: Dataset, dataDir: string) => Promise<void> | void;
|
|
8
8
|
structure: DatasetStructure;
|
|
9
9
|
title: string;
|
|
10
10
|
url?: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ArtifactVersion {
|
|
2
|
+
backend: string | null;
|
|
3
|
+
cdnPop: string | null;
|
|
4
|
+
contentLength: number | null;
|
|
5
|
+
etag: string | null;
|
|
6
|
+
lastModified: string | null;
|
|
7
|
+
sourceUrl: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ArtifactManifest extends ArtifactVersion {
|
|
10
|
+
acceptedAt: string;
|
|
11
|
+
sha256: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DiscoveryOptions {
|
|
14
|
+
fetch?: typeof fetch;
|
|
15
|
+
probeCount?: number;
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface DownloadOptions {
|
|
19
|
+
fetch?: typeof fetch;
|
|
20
|
+
retries?: number;
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function versionFromResponse(response: Response, sourceUrl: string): ArtifactVersion;
|
|
24
|
+
export declare function compareArtifactVersions(left: ArtifactVersion, right: ArtifactVersion): number;
|
|
25
|
+
export declare function isStrictlyNewer(candidate: ArtifactVersion, accepted: ArtifactVersion | undefined): boolean;
|
|
26
|
+
export declare function artifactVersionKey(version: ArtifactVersion): string;
|
|
27
|
+
export declare function probeArtifact(url: string, options?: DiscoveryOptions): Promise<ArtifactVersion>;
|
|
28
|
+
export declare function discoverFreshestArtifact(url: string, options?: DiscoveryOptions): Promise<{
|
|
29
|
+
freshest: ArtifactVersion;
|
|
30
|
+
observations: ArtifactVersion[];
|
|
31
|
+
}>;
|
|
32
|
+
export declare function downloadArtifact(candidate: ArtifactVersion, partPath: string, options?: DownloadOptions): Promise<{
|
|
33
|
+
sha256: string;
|
|
34
|
+
version: ArtifactVersion;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function readManifest(manifestPath: string): Promise<ArtifactManifest | undefined>;
|
|
37
|
+
export declare function writeJsonAtomic(filePath: string, value: unknown): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,22 @@
|
|
|
1
|
+
import { Dataset } from '../datasets.js';
|
|
2
|
+
export interface MonitoredDataset {
|
|
3
|
+
category: string;
|
|
4
|
+
dataset: Dataset;
|
|
5
|
+
legislature: number;
|
|
6
|
+
seedSlots: string[];
|
|
7
|
+
}
|
|
8
|
+
interface PendingUpdate {
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
pipelineId?: number;
|
|
11
|
+
versionKey: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DatasetState {
|
|
14
|
+
observations: string[];
|
|
15
|
+
pending?: PendingUpdate;
|
|
16
|
+
seenOrigins: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function buildMonitoredDatasets(): MonitoredDataset[];
|
|
19
|
+
export declare function isDatasetDue(monitored: MonitoredDataset, datasetState: DatasetState, now: Date): boolean;
|
|
20
|
+
export declare function delayBeforeDeadline(delay: number, deadline: number, now?: number): number;
|
|
21
|
+
export declare function scheduledPipelineIsStale(maxStartDelayMinutes: number, pipelineSource?: string | undefined, pipelineCreatedAt?: string | undefined, now?: number): boolean;
|
|
1
22
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { Dataset } from '../datasets.js';
|
|
2
3
|
type ProcessDatasetArguments = {
|
|
3
4
|
dataset: Dataset;
|
|
@@ -5,90 +6,108 @@ type ProcessDatasetArguments = {
|
|
|
5
6
|
options: Options;
|
|
6
7
|
};
|
|
7
8
|
declare const retrieveOpenDataParser: import('zod-opts').Parser<{
|
|
9
|
+
dataset: {
|
|
10
|
+
description: string;
|
|
11
|
+
type: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
12
|
+
};
|
|
8
13
|
fetch: {
|
|
9
14
|
alias: string;
|
|
10
15
|
description: string;
|
|
11
|
-
type:
|
|
16
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
+
};
|
|
18
|
+
"manifest-dir": {
|
|
19
|
+
description: string;
|
|
20
|
+
type: z.ZodOptional<z.ZodString>;
|
|
21
|
+
};
|
|
22
|
+
"only-if-new": {
|
|
23
|
+
description: string;
|
|
24
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
+
};
|
|
26
|
+
"probe-count": {
|
|
27
|
+
description: string;
|
|
28
|
+
type: z.ZodDefault<z.ZodNumber>;
|
|
12
29
|
};
|
|
13
30
|
categories: {
|
|
14
31
|
alias: string;
|
|
15
32
|
description: string;
|
|
16
|
-
type:
|
|
33
|
+
type: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
17
34
|
};
|
|
18
35
|
legislature: {
|
|
19
36
|
alias: string;
|
|
20
37
|
description: string;
|
|
21
|
-
type:
|
|
38
|
+
type: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
22
39
|
};
|
|
23
40
|
silent: {
|
|
24
41
|
alias: string;
|
|
25
42
|
description: string;
|
|
26
|
-
type:
|
|
43
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
27
44
|
};
|
|
28
45
|
verbose: {
|
|
29
46
|
alias: string;
|
|
30
47
|
description: string;
|
|
31
|
-
type:
|
|
48
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
32
49
|
};
|
|
33
50
|
"only-recent": {
|
|
34
51
|
description: string;
|
|
35
|
-
type:
|
|
52
|
+
type: z.ZodOptional<z.ZodNumber>;
|
|
36
53
|
};
|
|
37
54
|
skipReindent: {
|
|
38
55
|
description: string;
|
|
39
|
-
type:
|
|
56
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
40
57
|
};
|
|
41
58
|
keepDir: {
|
|
42
59
|
description: string;
|
|
43
|
-
type:
|
|
60
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
44
61
|
};
|
|
45
62
|
clone: {
|
|
46
63
|
alias: string;
|
|
47
64
|
description: string;
|
|
48
|
-
type:
|
|
65
|
+
type: z.ZodOptional<z.ZodString>;
|
|
49
66
|
};
|
|
50
67
|
commit: {
|
|
51
68
|
alias: string;
|
|
52
69
|
description: string;
|
|
53
|
-
type:
|
|
70
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
54
71
|
};
|
|
55
72
|
remote: {
|
|
56
73
|
alias: string;
|
|
57
74
|
description: string;
|
|
58
|
-
type:
|
|
75
|
+
type: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
76
|
};
|
|
60
77
|
pull: {
|
|
61
78
|
alias: string;
|
|
62
79
|
description: string;
|
|
63
|
-
type:
|
|
80
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
64
81
|
};
|
|
65
82
|
fetchDocuments: {
|
|
66
83
|
description: string;
|
|
67
|
-
type:
|
|
84
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
68
85
|
};
|
|
69
86
|
parseDocuments: {
|
|
70
87
|
description: string;
|
|
71
|
-
type:
|
|
88
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
72
89
|
};
|
|
73
90
|
format: {
|
|
74
91
|
alias: string;
|
|
75
92
|
description: string;
|
|
76
|
-
type:
|
|
93
|
+
type: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
77
94
|
};
|
|
78
95
|
fetchVideos: {
|
|
79
96
|
description: string;
|
|
80
|
-
type:
|
|
97
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
81
98
|
};
|
|
82
99
|
fetchCrCommissions: {
|
|
83
100
|
description: string;
|
|
84
|
-
type:
|
|
101
|
+
type: z.ZodDefault<z.ZodBoolean>;
|
|
85
102
|
};
|
|
86
103
|
}, [{
|
|
87
104
|
description: string;
|
|
88
|
-
type:
|
|
105
|
+
type: z.ZodString;
|
|
89
106
|
name: "dataDir";
|
|
90
107
|
}]>;
|
|
91
108
|
type Options = ReturnType<typeof retrieveOpenDataParser.parse>;
|
|
109
|
+
export declare function publishDataset(stagedDataPath: string, dataPath: string, partZipPath: string | undefined, zipPath: string): Promise<void>;
|
|
110
|
+
export declare function recoverPublication(dataPath: string): Promise<void>;
|
|
92
111
|
/**
|
|
93
112
|
* Processes a dataset by fetching, unzipping, and converting files from XML to JSON format.
|
|
94
113
|
*
|
|
@@ -97,5 +116,5 @@ type Options = ReturnType<typeof retrieveOpenDataParser.parse>;
|
|
|
97
116
|
* @param {any} options - Options to control the processing behavior, such as fetching and silent mode.
|
|
98
117
|
* @returns {Promise<void>} A promise that resolves when the dataset processing is complete.
|
|
99
118
|
*/
|
|
100
|
-
export declare function processDataset({ dataset, dataDir, options
|
|
119
|
+
export declare function processDataset({ dataset, dataDir, options, }: ProcessDatasetArguments): Promise<void>;
|
|
101
120
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|