@usa-open-data-connectors/usa-sources 0.1.1 → 0.1.3
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/dist/btsTransportationStats.d.ts +87 -0
- package/dist/btsTransportationStats.d.ts.map +1 -0
- package/dist/btsTransportationStats.js +132 -0
- package/dist/btsTransportationStats.js.map +1 -0
- package/dist/cdcSocrataCatalogue.d.ts +87 -0
- package/dist/cdcSocrataCatalogue.d.ts.map +1 -0
- package/dist/cdcSocrataCatalogue.js +132 -0
- package/dist/cdcSocrataCatalogue.js.map +1 -0
- package/dist/clinicalTrialsStudies.d.ts +92 -0
- package/dist/clinicalTrialsStudies.d.ts.map +1 -0
- package/dist/clinicalTrialsStudies.js +149 -0
- package/dist/clinicalTrialsStudies.js.map +1 -0
- package/dist/epaEnvirofactsFacilities.d.ts +94 -0
- package/dist/epaEnvirofactsFacilities.d.ts.map +1 -0
- package/dist/epaEnvirofactsFacilities.js +142 -0
- package/dist/epaEnvirofactsFacilities.js.map +1 -0
- package/dist/fdicBankDirectory.d.ts +78 -0
- package/dist/fdicBankDirectory.d.ts.map +1 -0
- package/dist/fdicBankDirectory.js +124 -0
- package/dist/fdicBankDirectory.js.map +1 -0
- package/dist/healthdataSocrataCatalogue.d.ts +87 -0
- package/dist/healthdataSocrataCatalogue.d.ts.map +1 -0
- package/dist/healthdataSocrataCatalogue.js +132 -0
- package/dist/healthdataSocrataCatalogue.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/ncbiPubmedSearch.d.ts +71 -0
- package/dist/ncbiPubmedSearch.d.ts.map +1 -0
- package/dist/ncbiPubmedSearch.js +128 -0
- package/dist/ncbiPubmedSearch.js.map +1 -0
- package/dist/nwsPointForecast.d.ts +99 -0
- package/dist/nwsPointForecast.d.ts.map +1 -0
- package/dist/nwsPointForecast.js +146 -0
- package/dist/nwsPointForecast.js.map +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +22 -0
- package/dist/registry.js.map +1 -1
- package/dist/secEdgarFilings.d.ts +103 -0
- package/dist/secEdgarFilings.d.ts.map +1 -0
- package/dist/secEdgarFilings.js +214 -0
- package/dist/secEdgarFilings.js.map +1 -0
- package/dist/treasuryDebtToPenny.d.ts +90 -0
- package/dist/treasuryDebtToPenny.d.ts.map +1 -0
- package/dist/treasuryDebtToPenny.js +170 -0
- package/dist/treasuryDebtToPenny.js.map +1 -0
- package/dist/usaspendingAgencies.d.ts +78 -0
- package/dist/usaspendingAgencies.d.ts.map +1 -0
- package/dist/usaspendingAgencies.js +121 -0
- package/dist/usaspendingAgencies.js.map +1 -0
- package/package.json +10 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { UsDataAdapter } from './types.js';
|
|
2
|
+
/** Adapter id for the National Weather Service point-forecast source. */
|
|
3
|
+
export declare const NWS_POINT_FORECAST_SOURCE_ID = "nws-point-forecast";
|
|
4
|
+
/**
|
|
5
|
+
* User-Agent header the National Weather Service asks every caller to send.
|
|
6
|
+
*
|
|
7
|
+
* The service returns an error page to a request that does not identify its
|
|
8
|
+
* operator, so the adapter sends a descriptive name and a contact address on
|
|
9
|
+
* every call. A real deployment should override the contact with its own.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NWS_USER_AGENT = "usa-open-data-connectors contact@example.com";
|
|
12
|
+
/**
|
|
13
|
+
* One forecast grid point, the service's lookup for a latitude and longitude.
|
|
14
|
+
*
|
|
15
|
+
* The point does not carry the forecast itself. It carries the grid the
|
|
16
|
+
* service snapped the coordinate to, plus the URLs that lead to the forecast,
|
|
17
|
+
* the hourly forecast, the raw grid data, and the nearby observations.
|
|
18
|
+
*/
|
|
19
|
+
export interface NwsForecastPoint {
|
|
20
|
+
/** Latitude of the point, as the service echoed it back. */
|
|
21
|
+
latitude: number;
|
|
22
|
+
/** Longitude of the point, as the service echoed it back. */
|
|
23
|
+
longitude: number;
|
|
24
|
+
/** City or place the point falls in, e.g. "Washington". */
|
|
25
|
+
city: string;
|
|
26
|
+
/** Two-letter state code the point falls in, e.g. "DC". */
|
|
27
|
+
state: string;
|
|
28
|
+
/** Forecast office code, e.g. "LWX". */
|
|
29
|
+
gridId: string;
|
|
30
|
+
gridX: number;
|
|
31
|
+
gridY: number;
|
|
32
|
+
/** URL of the forecast office that covers the point. */
|
|
33
|
+
forecastOfficeUrl: string;
|
|
34
|
+
/** URL of the daily forecast for the point. */
|
|
35
|
+
forecastUrl: string;
|
|
36
|
+
/** URL of the hourly forecast for the point. */
|
|
37
|
+
forecastHourlyUrl: string;
|
|
38
|
+
/** URL of the raw forecast grid data behind the point. */
|
|
39
|
+
forecastGridDataUrl: string;
|
|
40
|
+
/** URL of the observation stations near the point. */
|
|
41
|
+
observationStationsUrl: string;
|
|
42
|
+
/** Timezone the office uses, e.g. "America/New_York". */
|
|
43
|
+
timeZone: string;
|
|
44
|
+
/** Radar station code the office uses, or null when the service names none. */
|
|
45
|
+
radarStation: string | null;
|
|
46
|
+
/** URL of the county zone the point falls in. */
|
|
47
|
+
countyUrl: string;
|
|
48
|
+
/** URL of the fire weather zone the point falls in. */
|
|
49
|
+
fireWeatherZoneUrl: string;
|
|
50
|
+
}
|
|
51
|
+
/** Base URL for the National Weather Service API. */
|
|
52
|
+
export declare const NWS_API_BASE = "https://api.weather.gov";
|
|
53
|
+
/** Path of the point lookup that resolves a coordinate to a forecast grid. */
|
|
54
|
+
export declare const NWS_POINT_FORECAST_PATH = "/points";
|
|
55
|
+
/** Latitude of the default point, the Washington Monument in Washington, DC. */
|
|
56
|
+
export declare const NWS_DEFAULT_LATITUDE = 38.8894;
|
|
57
|
+
/** Longitude of the default point, the Washington Monument in Washington, DC. */
|
|
58
|
+
export declare const NWS_DEFAULT_LONGITUDE = -77.0352;
|
|
59
|
+
/**
|
|
60
|
+
* Builds the request URL for one point lookup.
|
|
61
|
+
*
|
|
62
|
+
* The endpoint is keyless. Coordinates are written the way the service takes
|
|
63
|
+
* them, latitude first and longitude second, with no space after the comma.
|
|
64
|
+
*
|
|
65
|
+
* @param latitude - the latitude to look up
|
|
66
|
+
* @param longitude - the longitude to look up
|
|
67
|
+
* @returns the full request URL
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildNwsPointUrl(latitude?: number, longitude?: number): string;
|
|
70
|
+
/**
|
|
71
|
+
* Parses one point lookup into the grid point and its forecast URLs.
|
|
72
|
+
*
|
|
73
|
+
* The service answers with a GeoJSON feature. A response whose type is not a
|
|
74
|
+
* feature or whose coordinates are not a latitude and longitude pair is a
|
|
75
|
+
* changed shape and stops the parse. The forecast and grid fields must also
|
|
76
|
+
* be present, because a point without them is not usable as a forecast entry.
|
|
77
|
+
*
|
|
78
|
+
* @param payload - the JSON body from the weather service
|
|
79
|
+
* @returns the grid point, its place, and the URLs that lead to the forecast
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseNwsPointForecastPayload(payload: unknown): NwsForecastPoint;
|
|
82
|
+
/**
|
|
83
|
+
* Reads one forecast grid point from the weather service.
|
|
84
|
+
*
|
|
85
|
+
* The service asks every caller to identify itself, so the request carries a
|
|
86
|
+
* descriptive User-Agent header. One keyless request resolves the coordinate
|
|
87
|
+
* to a grid point and returns the URLs that lead to the forecast.
|
|
88
|
+
*
|
|
89
|
+
* @param options - an optional latitude and longitude, plus a fetch stub
|
|
90
|
+
* @returns the grid point, its place, and the URLs that lead to the forecast
|
|
91
|
+
*/
|
|
92
|
+
export declare function fetchNwsPointForecast(options?: {
|
|
93
|
+
latitude?: number;
|
|
94
|
+
longitude?: number;
|
|
95
|
+
fetchImpl?: typeof globalThis.fetch;
|
|
96
|
+
}): Promise<NwsForecastPoint>;
|
|
97
|
+
/** National Weather Service forecast grid point for a coordinate, keyless. */
|
|
98
|
+
export declare const nwsPointForecastAdapter: UsDataAdapter<NwsForecastPoint>;
|
|
99
|
+
//# sourceMappingURL=nwsPointForecast.d.ts.map
|
|
@@ -0,0 +1 @@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B,WAAW,CAAC;AAmC9C;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,GAAE,MAA6B,EACvC,SAAS,GAAE,MAA8B,GACxC,MAAM,CAER;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAsD/E;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,CAAC,EAAE;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACrC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAc5B;AAED,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,gBAAgB,CAWnE,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UsSourceApiError, UsSourceParseError } from './errors.js';
|
|
3
|
+
import { readFixtureJson } from './fixtures.js';
|
|
4
|
+
/** Adapter id for the National Weather Service point-forecast source. */
|
|
5
|
+
export const NWS_POINT_FORECAST_SOURCE_ID = 'nws-point-forecast';
|
|
6
|
+
/**
|
|
7
|
+
* User-Agent header the National Weather Service asks every caller to send.
|
|
8
|
+
*
|
|
9
|
+
* The service returns an error page to a request that does not identify its
|
|
10
|
+
* operator, so the adapter sends a descriptive name and a contact address on
|
|
11
|
+
* every call. A real deployment should override the contact with its own.
|
|
12
|
+
*/
|
|
13
|
+
export const NWS_USER_AGENT = 'usa-open-data-connectors contact@example.com';
|
|
14
|
+
/** Base URL for the National Weather Service API. */
|
|
15
|
+
export const NWS_API_BASE = 'https://api.weather.gov';
|
|
16
|
+
/** Path of the point lookup that resolves a coordinate to a forecast grid. */
|
|
17
|
+
export const NWS_POINT_FORECAST_PATH = '/points';
|
|
18
|
+
/** Latitude of the default point, the Washington Monument in Washington, DC. */
|
|
19
|
+
export const NWS_DEFAULT_LATITUDE = 38.8894;
|
|
20
|
+
/** Longitude of the default point, the Washington Monument in Washington, DC. */
|
|
21
|
+
export const NWS_DEFAULT_LONGITUDE = -77.0352;
|
|
22
|
+
/** Committed snapshot, so a build works when the weather service is unreachable. */
|
|
23
|
+
const NWS_POINT_FORECAST_FIXTURE_FILENAME = 'nws-point-forecast-2026-10-05.json';
|
|
24
|
+
const NWS_PROPERTIES_SCHEMA = z.object({
|
|
25
|
+
city: z.string().optional(),
|
|
26
|
+
state: z.string().optional(),
|
|
27
|
+
gridId: z.string().optional(),
|
|
28
|
+
gridX: z.number().optional(),
|
|
29
|
+
gridY: z.number().optional(),
|
|
30
|
+
forecastOffice: z.string().optional(),
|
|
31
|
+
forecast: z.string().optional(),
|
|
32
|
+
forecastHourly: z.string().optional(),
|
|
33
|
+
forecastGridData: z.string().optional(),
|
|
34
|
+
observationStations: z.string().optional(),
|
|
35
|
+
timeZone: z.string().optional(),
|
|
36
|
+
radarStation: z.string().optional(),
|
|
37
|
+
county: z.string().optional(),
|
|
38
|
+
fireWeatherZone: z.string().optional(),
|
|
39
|
+
relativeLocation: z
|
|
40
|
+
.object({
|
|
41
|
+
properties: z
|
|
42
|
+
.object({ city: z.string().optional(), state: z.string().optional() })
|
|
43
|
+
.optional(),
|
|
44
|
+
})
|
|
45
|
+
.optional(),
|
|
46
|
+
});
|
|
47
|
+
const NWS_POINT_FORECAST_SCHEMA = z.object({
|
|
48
|
+
type: z.string().optional(),
|
|
49
|
+
geometry: z.object({ coordinates: z.array(z.number()).optional() }).optional(),
|
|
50
|
+
properties: NWS_PROPERTIES_SCHEMA.optional(),
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Builds the request URL for one point lookup.
|
|
54
|
+
*
|
|
55
|
+
* The endpoint is keyless. Coordinates are written the way the service takes
|
|
56
|
+
* them, latitude first and longitude second, with no space after the comma.
|
|
57
|
+
*
|
|
58
|
+
* @param latitude - the latitude to look up
|
|
59
|
+
* @param longitude - the longitude to look up
|
|
60
|
+
* @returns the full request URL
|
|
61
|
+
*/
|
|
62
|
+
export function buildNwsPointUrl(latitude = NWS_DEFAULT_LATITUDE, longitude = NWS_DEFAULT_LONGITUDE) {
|
|
63
|
+
return `${NWS_API_BASE}${NWS_POINT_FORECAST_PATH}/${latitude},${longitude}`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parses one point lookup into the grid point and its forecast URLs.
|
|
67
|
+
*
|
|
68
|
+
* The service answers with a GeoJSON feature. A response whose type is not a
|
|
69
|
+
* feature or whose coordinates are not a latitude and longitude pair is a
|
|
70
|
+
* changed shape and stops the parse. The forecast and grid fields must also
|
|
71
|
+
* be present, because a point without them is not usable as a forecast entry.
|
|
72
|
+
*
|
|
73
|
+
* @param payload - the JSON body from the weather service
|
|
74
|
+
* @returns the grid point, its place, and the URLs that lead to the forecast
|
|
75
|
+
*/
|
|
76
|
+
export function parseNwsPointForecastPayload(payload) {
|
|
77
|
+
const parsed = NWS_POINT_FORECAST_SCHEMA.safeParse(payload);
|
|
78
|
+
if (!parsed.success) {
|
|
79
|
+
throw new UsSourceParseError(NWS_POINT_FORECAST_SOURCE_ID, parsed.error.message);
|
|
80
|
+
}
|
|
81
|
+
if (parsed.data.type !== 'Feature') {
|
|
82
|
+
throw new UsSourceParseError(NWS_POINT_FORECAST_SOURCE_ID, `The response is not a GeoJSON feature: ${parsed.data.type ?? 'missing type'}`);
|
|
83
|
+
}
|
|
84
|
+
const coordinates = parsed.data.geometry?.coordinates;
|
|
85
|
+
const longitude = coordinates?.[0];
|
|
86
|
+
const latitude = coordinates?.[1];
|
|
87
|
+
if (longitude === undefined || latitude === undefined) {
|
|
88
|
+
throw new UsSourceParseError(NWS_POINT_FORECAST_SOURCE_ID, 'The response carried no coordinate pair');
|
|
89
|
+
}
|
|
90
|
+
const properties = parsed.data.properties;
|
|
91
|
+
if (properties?.gridId === undefined ||
|
|
92
|
+
properties.gridX === undefined ||
|
|
93
|
+
properties.gridY === undefined ||
|
|
94
|
+
properties.forecast === undefined ||
|
|
95
|
+
properties.forecastOffice === undefined) {
|
|
96
|
+
throw new UsSourceParseError(NWS_POINT_FORECAST_SOURCE_ID, 'The response carried no forecast grid for the point');
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
latitude,
|
|
100
|
+
longitude,
|
|
101
|
+
city: properties.relativeLocation?.properties?.city ?? '',
|
|
102
|
+
state: properties.relativeLocation?.properties?.state ?? '',
|
|
103
|
+
gridId: properties.gridId,
|
|
104
|
+
gridX: properties.gridX,
|
|
105
|
+
gridY: properties.gridY,
|
|
106
|
+
forecastOfficeUrl: properties.forecastOffice,
|
|
107
|
+
forecastUrl: properties.forecast,
|
|
108
|
+
forecastHourlyUrl: properties.forecastHourly ?? '',
|
|
109
|
+
forecastGridDataUrl: properties.forecastGridData ?? '',
|
|
110
|
+
observationStationsUrl: properties.observationStations ?? '',
|
|
111
|
+
timeZone: properties.timeZone ?? '',
|
|
112
|
+
radarStation: properties.radarStation ?? null,
|
|
113
|
+
countyUrl: properties.county ?? '',
|
|
114
|
+
fireWeatherZoneUrl: properties.fireWeatherZone ?? '',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Reads one forecast grid point from the weather service.
|
|
119
|
+
*
|
|
120
|
+
* The service asks every caller to identify itself, so the request carries a
|
|
121
|
+
* descriptive User-Agent header. One keyless request resolves the coordinate
|
|
122
|
+
* to a grid point and returns the URLs that lead to the forecast.
|
|
123
|
+
*
|
|
124
|
+
* @param options - an optional latitude and longitude, plus a fetch stub
|
|
125
|
+
* @returns the grid point, its place, and the URLs that lead to the forecast
|
|
126
|
+
*/
|
|
127
|
+
export async function fetchNwsPointForecast(options) {
|
|
128
|
+
const fetchImpl = options?.fetchImpl ?? globalThis.fetch;
|
|
129
|
+
const url = buildNwsPointUrl(options?.latitude ?? NWS_DEFAULT_LATITUDE, options?.longitude ?? NWS_DEFAULT_LONGITUDE);
|
|
130
|
+
const response = await fetchImpl(url, { headers: { 'User-Agent': NWS_USER_AGENT } });
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
throw new UsSourceApiError(NWS_POINT_FORECAST_SOURCE_ID, `HTTP ${response.status} reading the point forecast`);
|
|
133
|
+
}
|
|
134
|
+
return parseNwsPointForecastPayload(await response.json());
|
|
135
|
+
}
|
|
136
|
+
/** National Weather Service forecast grid point for a coordinate, keyless. */
|
|
137
|
+
export const nwsPointForecastAdapter = {
|
|
138
|
+
id: NWS_POINT_FORECAST_SOURCE_ID,
|
|
139
|
+
name: 'NWS point forecast',
|
|
140
|
+
auth: 'none',
|
|
141
|
+
description: 'The National Weather Service forecast grid point for a latitude and longitude, with the URLs that lead to the daily and hourly forecast.',
|
|
142
|
+
fetchLive: async (options) => fetchNwsPointForecast(options?.fetchImpl === undefined ? {} : { fetchImpl: options.fetchImpl }),
|
|
143
|
+
parse: (payload) => parseNwsPointForecastPayload(payload),
|
|
144
|
+
loadFixture: () => parseNwsPointForecastPayload(readFixtureJson(NWS_POINT_FORECAST_FIXTURE_FILENAME)),
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=nwsPointForecast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nwsPointForecast.js","sourceRoot":"","sources":["../src/nwsPointForecast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,yEAAyE;AACzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,8CAA8C,CAAC;AA0C7E,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAEtD,8EAA8E;AAC9E,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O,CAAC;IACzD,WAAW,EAAE,GAAG,EAAE,CAChB,4BAA4B,CAAC,eAAe,CAAC,mCAAmC,CAAC,CAAC;CACrF,CAAC"}
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAkB,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/E,iEAAiE;AACjE,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,EAuBnD,CAAC;AAEF,uCAAuC;AACvC,wBAAgB,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAE3E;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAAE,GACjE,OAAO,CAAC,aAAa,CAAC,CAwBxB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,CAAC,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACrC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAW3B"}
|
package/dist/registry.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { blsUnemploymentAdapter } from './blsSeries.js';
|
|
2
|
+
import { btsTransportationStatsAdapter } from './btsTransportationStats.js';
|
|
3
|
+
import { cdcSocrataCatalogueAdapter } from './cdcSocrataCatalogue.js';
|
|
4
|
+
import { clinicalTrialsStudiesAdapter } from './clinicalTrialsStudies.js';
|
|
5
|
+
import { epaEnvirofactsFacilitiesAdapter } from './epaEnvirofactsFacilities.js';
|
|
6
|
+
import { fdicBankDirectoryAdapter } from './fdicBankDirectory.js';
|
|
7
|
+
import { healthdataSocrataCatalogueAdapter } from './healthdataSocrataCatalogue.js';
|
|
8
|
+
import { ncbiPubmedSearchAdapter } from './ncbiPubmedSearch.js';
|
|
9
|
+
import { nwsPointForecastAdapter } from './nwsPointForecast.js';
|
|
10
|
+
import { secEdgarFilingsAdapter } from './secEdgarFilings.js';
|
|
11
|
+
import { treasuryDebtToPennyAdapter } from './treasuryDebtToPenny.js';
|
|
12
|
+
import { usaspendingAgenciesAdapter } from './usaspendingAgencies.js';
|
|
2
13
|
import { cdcCountyObesityAdapter } from './cdcCountyObesity.js';
|
|
3
14
|
import { cfpbConsumerComplaintsAdapter } from './cfpbConsumerComplaints.js';
|
|
4
15
|
import { cpscProductRecallsAdapter } from './cpscProductRecalls.js';
|
|
@@ -22,6 +33,17 @@ export const US_DATA_SOURCES = [
|
|
|
22
33
|
usgsPeakStreamflowAdapter,
|
|
23
34
|
cpscProductRecallsAdapter,
|
|
24
35
|
cfpbConsumerComplaintsAdapter,
|
|
36
|
+
treasuryDebtToPennyAdapter,
|
|
37
|
+
secEdgarFilingsAdapter,
|
|
38
|
+
fdicBankDirectoryAdapter,
|
|
39
|
+
clinicalTrialsStudiesAdapter,
|
|
40
|
+
nwsPointForecastAdapter,
|
|
41
|
+
usaspendingAgenciesAdapter,
|
|
42
|
+
epaEnvirofactsFacilitiesAdapter,
|
|
43
|
+
ncbiPubmedSearchAdapter,
|
|
44
|
+
cdcSocrataCatalogueAdapter,
|
|
45
|
+
healthdataSocrataCatalogueAdapter,
|
|
46
|
+
btsTransportationStatsAdapter,
|
|
25
47
|
];
|
|
26
48
|
/** Looks up a source adapter by id. */
|
|
27
49
|
export function getUsDataSource(id) {
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD,sBAAsB;IACtB,4BAA4B;IAC5B,uBAAuB;IACvB,4BAA4B;IAC5B,mBAAmB;IACnB,8BAA8B;IAC9B,+BAA+B;IAC/B,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,6BAA6B;CAC9B,CAAC;AAEF,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAAI,EAAU;IAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAiC,CAAC;AAC5F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAyB,EACzB,OAAkE;IAElE,IAA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K,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;YAC7C,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;SAClD,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { UsDataAdapter } from './types.js';
|
|
2
|
+
/** Adapter id for the SEC EDGAR submissions source. */
|
|
3
|
+
export declare const SEC_EDGAR_FILINGS_SOURCE_ID = "sec-edgar-filings";
|
|
4
|
+
/**
|
|
5
|
+
* User-Agent header the SEC asks every caller to send.
|
|
6
|
+
*
|
|
7
|
+
* The SEC blocks a request that does not identify its operator, so the
|
|
8
|
+
* adapter sends a descriptive name and a contact address on every call. A
|
|
9
|
+
* real deployment should override the contact with its own address.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SEC_EDGAR_USER_AGENT = "usa-open-data-connectors contact@example.com";
|
|
12
|
+
/** One filing in an issuer's recent submissions list. */
|
|
13
|
+
export interface SecEdgarFiling {
|
|
14
|
+
/** The SEC's accession number, e.g. "0001958244-26-000636". */
|
|
15
|
+
accessionNumber: string;
|
|
16
|
+
/** Date the filing was made, e.g. "2026-10-02". */
|
|
17
|
+
filingDate: string;
|
|
18
|
+
/** End of the period the filing covers, or null when the form has none. */
|
|
19
|
+
reportDate: string | null;
|
|
20
|
+
/** Form type, e.g. "4" or "10-Q". */
|
|
21
|
+
form: string;
|
|
22
|
+
/** Path to the filing's main document inside the filing archive. */
|
|
23
|
+
primaryDocument: string;
|
|
24
|
+
/** Description of the main document, or null when the form has none. */
|
|
25
|
+
primaryDocDescription: string | null;
|
|
26
|
+
/** Size of the filing in bytes, or null when the SEC did not report one. */
|
|
27
|
+
sizeBytes: number | null;
|
|
28
|
+
/** Whether the filing carries XBRL data. */
|
|
29
|
+
isXbrl: boolean;
|
|
30
|
+
/** Whether the filing carries inline XBRL data. */
|
|
31
|
+
isInlineXbrl: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** One form type and how many of the recent filings use it. */
|
|
34
|
+
export interface SecEdgarFormCount {
|
|
35
|
+
form: string;
|
|
36
|
+
count: number;
|
|
37
|
+
}
|
|
38
|
+
/** An issuer's profile plus its recent filings, folded for a story. */
|
|
39
|
+
export interface SecEdgarCompanyFilings {
|
|
40
|
+
/** Zero-padded Central Index Key, e.g. "0000320193". */
|
|
41
|
+
cik: string;
|
|
42
|
+
/** The issuer's registered name, e.g. "Apple Inc.". */
|
|
43
|
+
name: string;
|
|
44
|
+
entityType: string | null;
|
|
45
|
+
/** Standard Industrial Classification code. */
|
|
46
|
+
sic: string | null;
|
|
47
|
+
sicDescription: string | null;
|
|
48
|
+
/** Exchange tickers, empty when the issuer has none. */
|
|
49
|
+
tickers: string[];
|
|
50
|
+
/** Exchanges the issuer is listed on, empty when it has none. */
|
|
51
|
+
exchanges: string[];
|
|
52
|
+
/** Fiscal year end as the SEC writes it, e.g. "0926". */
|
|
53
|
+
fiscalYearEnd: string | null;
|
|
54
|
+
/** Recent filings, in the order the SEC sends them, newest first. */
|
|
55
|
+
filings: SecEdgarFiling[];
|
|
56
|
+
filingCount: number;
|
|
57
|
+
/** Date of the newest filing in the list, e.g. "2026-10-02". */
|
|
58
|
+
newestFilingDate: string;
|
|
59
|
+
/** Form types, most filings first, ties broken by form name. */
|
|
60
|
+
formCounts: SecEdgarFormCount[];
|
|
61
|
+
}
|
|
62
|
+
/** Base URL for the SEC EDGAR submissions service. */
|
|
63
|
+
export declare const SEC_EDGAR_SUBMISSIONS_API_BASE = "https://data.sec.gov/submissions";
|
|
64
|
+
/** Apple's Central Index Key, the issuer the committed fixture covers. */
|
|
65
|
+
export declare const SEC_EDGAR_APPLE_CIK = "0000320193";
|
|
66
|
+
/**
|
|
67
|
+
* Builds the request URL for one issuer's submissions file.
|
|
68
|
+
*
|
|
69
|
+
* The endpoint is keyless. The CIK is zero-padded to the ten digits the
|
|
70
|
+
* service expects, so a caller can pass "320193" as well as "0000320193".
|
|
71
|
+
*
|
|
72
|
+
* @param cik - the issuer's Central Index Key
|
|
73
|
+
* @returns the full request URL
|
|
74
|
+
*/
|
|
75
|
+
export declare function buildSecEdgarSubmissionsUrl(cik?: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Parses one submissions response into an issuer's profile and recent filings.
|
|
78
|
+
*
|
|
79
|
+
* A response without a filings block, or with parallel arrays that do not line
|
|
80
|
+
* up, stops the parse. A filing without a readable date is a changed shape and
|
|
81
|
+
* also stops the parse.
|
|
82
|
+
*
|
|
83
|
+
* @param payload - the JSON body from the SEC submissions service
|
|
84
|
+
* @returns the issuer's profile, its recent filings, and the form counts
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseSecEdgarFilingsPayload(payload: unknown): SecEdgarCompanyFilings;
|
|
87
|
+
/**
|
|
88
|
+
* Reads one issuer's recent filings from the SEC's submissions service.
|
|
89
|
+
*
|
|
90
|
+
* The SEC asks every caller to identify itself, so the request carries a
|
|
91
|
+
* descriptive User-Agent header. One keyless request covers the issuer's
|
|
92
|
+
* recent filings and a little under a thousand rows.
|
|
93
|
+
*
|
|
94
|
+
* @param options - an optional Central Index Key and fetch stub
|
|
95
|
+
* @returns the issuer's profile, its recent filings, and the form counts
|
|
96
|
+
*/
|
|
97
|
+
export declare function fetchSecEdgarFilings(options?: {
|
|
98
|
+
cik?: string;
|
|
99
|
+
fetchImpl?: typeof globalThis.fetch;
|
|
100
|
+
}): Promise<SecEdgarCompanyFilings>;
|
|
101
|
+
/** SEC EDGAR issuer submissions and recent filings, keyless. */
|
|
102
|
+
export declare const secEdgarFilingsAdapter: UsDataAdapter<SecEdgarCompanyFilings>;
|
|
103
|
+
//# sourceMappingURL=secEdgarFilings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secEdgarFilings.d.ts","sourceRoot":"","sources":["../src/secE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AqE;IACrE,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,qCAAqC,CAAC;AAEjF,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAuChD;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,GAAE,MAA4B,GAAG,MAAM,CASrF;AA0FD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,sBAAsB,CAqCpF;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,CAAC,EAAE;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACrC,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAWlC;AAED,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,sBAAsB,CAUxE,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UsSourceApiError, UsSourceParseError } from './errors.js';
|
|
3
|
+
import { readFixtureJson } from './fixtures.js';
|
|
4
|
+
/** Adapter id for the SEC EDGAR submissions source. */
|
|
5
|
+
export const SEC_EDGAR_FILINGS_SOURCE_ID = 'sec-edgar-filings';
|
|
6
|
+
/**
|
|
7
|
+
* User-Agent header the SEC asks every caller to send.
|
|
8
|
+
*
|
|
9
|
+
* The SEC blocks a request that does not identify its operator, so the
|
|
10
|
+
* adapter sends a descriptive name and a contact address on every call. A
|
|
11
|
+
* real deployment should override the contact with its own address.
|
|
12
|
+
*/
|
|
13
|
+
export const SEC_EDGAR_USER_AGENT = 'usa-open-data-connectors contact@example.com';
|
|
14
|
+
/** Base URL for the SEC EDGAR submissions service. */
|
|
15
|
+
export const SEC_EDGAR_SUBMISSIONS_API_BASE = 'https://data.sec.gov/submissions';
|
|
16
|
+
/** Apple's Central Index Key, the issuer the committed fixture covers. */
|
|
17
|
+
export const SEC_EDGAR_APPLE_CIK = '0000320193';
|
|
18
|
+
/** Committed snapshot, so a build works when the SEC host is unreachable. */
|
|
19
|
+
const SEC_EDGAR_FIXTURE_FILENAME = 'sec-edgar-filings-2026-10-05.json';
|
|
20
|
+
/** Shape of a CIK as the submissions service uses it. */
|
|
21
|
+
const CIK_PATTERN = /^\d{1,10}$/;
|
|
22
|
+
/** Shape of a filing date, e.g. "2026-10-02". */
|
|
23
|
+
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
24
|
+
// The SEC sends the recent filings as parallel arrays, one array per column,
|
|
25
|
+
// rather than one object per row. A field the form does not carry arrives as
|
|
26
|
+
// an empty string rather than a missing key.
|
|
27
|
+
const SEC_EDGAR_RECENT_SCHEMA = z.object({
|
|
28
|
+
accessionNumber: z.array(z.string()).optional(),
|
|
29
|
+
filingDate: z.array(z.string()).optional(),
|
|
30
|
+
reportDate: z.array(z.string()).optional(),
|
|
31
|
+
form: z.array(z.string()).optional(),
|
|
32
|
+
size: z.array(z.number()).optional(),
|
|
33
|
+
isXBRL: z.array(z.number()).optional(),
|
|
34
|
+
isInlineXBRL: z.array(z.number()).optional(),
|
|
35
|
+
primaryDocument: z.array(z.string()).optional(),
|
|
36
|
+
primaryDocDescription: z.array(z.string()).optional(),
|
|
37
|
+
});
|
|
38
|
+
const SEC_EDGAR_PAYLOAD_SCHEMA = z.object({
|
|
39
|
+
cik: z.string().optional(),
|
|
40
|
+
name: z.string().optional(),
|
|
41
|
+
entityType: z.string().optional(),
|
|
42
|
+
sic: z.string().optional(),
|
|
43
|
+
sicDescription: z.string().optional(),
|
|
44
|
+
tickers: z.array(z.string()).optional(),
|
|
45
|
+
exchanges: z.array(z.string()).optional(),
|
|
46
|
+
fiscalYearEnd: z.string().optional(),
|
|
47
|
+
stateOfIncorporation: z.string().optional(),
|
|
48
|
+
filings: z.object({ recent: SEC_EDGAR_RECENT_SCHEMA.optional() }).optional(),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Builds the request URL for one issuer's submissions file.
|
|
52
|
+
*
|
|
53
|
+
* The endpoint is keyless. The CIK is zero-padded to the ten digits the
|
|
54
|
+
* service expects, so a caller can pass "320193" as well as "0000320193".
|
|
55
|
+
*
|
|
56
|
+
* @param cik - the issuer's Central Index Key
|
|
57
|
+
* @returns the full request URL
|
|
58
|
+
*/
|
|
59
|
+
export function buildSecEdgarSubmissionsUrl(cik = SEC_EDGAR_APPLE_CIK) {
|
|
60
|
+
const trimmed = cik.trim();
|
|
61
|
+
if (!CIK_PATTERN.test(trimmed)) {
|
|
62
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, `A Central Index Key must be up to ten digits: ${cik}`);
|
|
63
|
+
}
|
|
64
|
+
return `${SEC_EDGAR_SUBMISSIONS_API_BASE}/CIK${trimmed.padStart(10, '0')}.json`;
|
|
65
|
+
}
|
|
66
|
+
/** Reads a column the SEC may omit, as an empty list. */
|
|
67
|
+
function columnOrEmpty(column) {
|
|
68
|
+
return column ?? [];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Zips the SEC's parallel filing arrays into one row per filing.
|
|
72
|
+
*
|
|
73
|
+
* The columns are parallel arrays, so a mismatch in their lengths means the
|
|
74
|
+
* response cannot be read as rows and stops the parse. A filing without a
|
|
75
|
+
* readable date is a changed shape and also stops the parse.
|
|
76
|
+
*
|
|
77
|
+
* @param recent - the recent filings object from the submissions file
|
|
78
|
+
* @returns one row per filing, in the order the SEC sent them
|
|
79
|
+
*/
|
|
80
|
+
function zipSecEdgarFilings(recent) {
|
|
81
|
+
const accessions = columnOrEmpty(recent.accessionNumber);
|
|
82
|
+
const dates = columnOrEmpty(recent.filingDate);
|
|
83
|
+
const reportDates = columnOrEmpty(recent.reportDate);
|
|
84
|
+
const forms = columnOrEmpty(recent.form);
|
|
85
|
+
const sizes = recent.size ?? [];
|
|
86
|
+
const xbrl = recent.isXBRL ?? [];
|
|
87
|
+
const inlineXbrl = recent.isInlineXBRL ?? [];
|
|
88
|
+
const primaryDocuments = columnOrEmpty(recent.primaryDocument);
|
|
89
|
+
const primaryDescriptions = columnOrEmpty(recent.primaryDocDescription);
|
|
90
|
+
const columns = [
|
|
91
|
+
{ name: 'filingDate', values: dates },
|
|
92
|
+
{ name: 'reportDate', values: reportDates },
|
|
93
|
+
{ name: 'form', values: forms },
|
|
94
|
+
{ name: 'size', values: sizes },
|
|
95
|
+
{ name: 'isXBRL', values: xbrl },
|
|
96
|
+
{ name: 'isInlineXBRL', values: inlineXbrl },
|
|
97
|
+
{ name: 'primaryDocument', values: primaryDocuments },
|
|
98
|
+
{ name: 'primaryDocDescription', values: primaryDescriptions },
|
|
99
|
+
];
|
|
100
|
+
for (const column of columns) {
|
|
101
|
+
if (column.values.length !== accessions.length) {
|
|
102
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, `The ${column.name} column holds ${column.values.length} entries, not ${accessions.length}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return accessions.map((accessionNumber, index) => {
|
|
106
|
+
const filingDate = dates[index] ?? '';
|
|
107
|
+
if (!ISO_DATE_PATTERN.test(filingDate)) {
|
|
108
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, `Unreadable filing date: ${filingDate}`);
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
accessionNumber,
|
|
112
|
+
filingDate,
|
|
113
|
+
reportDate: blankToNull(reportDates[index]),
|
|
114
|
+
form: forms[index] ?? '',
|
|
115
|
+
primaryDocument: primaryDocuments[index] ?? '',
|
|
116
|
+
primaryDocDescription: blankToNull(primaryDescriptions[index]),
|
|
117
|
+
sizeBytes: sizes[index] ?? null,
|
|
118
|
+
isXbrl: xbrl[index] === 1,
|
|
119
|
+
isInlineXbrl: inlineXbrl[index] === 1,
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/** Turns the SEC's empty-string sentinel into null, and keeps real text. */
|
|
124
|
+
function blankToNull(value) {
|
|
125
|
+
if (value === undefined || value.trim() === '') {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
/** Counts how often each form appears, most filings first, ties by name. */
|
|
131
|
+
function countSecEdgarForms(filings) {
|
|
132
|
+
const counts = new Map();
|
|
133
|
+
for (const filing of filings) {
|
|
134
|
+
counts.set(filing.form, (counts.get(filing.form) ?? 0) + 1);
|
|
135
|
+
}
|
|
136
|
+
return [...counts.entries()]
|
|
137
|
+
.sort(([leftForm, leftCount], [rightForm, rightCount]) => leftCount === rightCount ? leftForm.localeCompare(rightForm) : rightCount - leftCount)
|
|
138
|
+
.map(([form, count]) => ({ form, count }));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Parses one submissions response into an issuer's profile and recent filings.
|
|
142
|
+
*
|
|
143
|
+
* A response without a filings block, or with parallel arrays that do not line
|
|
144
|
+
* up, stops the parse. A filing without a readable date is a changed shape and
|
|
145
|
+
* also stops the parse.
|
|
146
|
+
*
|
|
147
|
+
* @param payload - the JSON body from the SEC submissions service
|
|
148
|
+
* @returns the issuer's profile, its recent filings, and the form counts
|
|
149
|
+
*/
|
|
150
|
+
export function parseSecEdgarFilingsPayload(payload) {
|
|
151
|
+
const parsed = SEC_EDGAR_PAYLOAD_SCHEMA.safeParse(payload);
|
|
152
|
+
if (!parsed.success) {
|
|
153
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, parsed.error.message);
|
|
154
|
+
}
|
|
155
|
+
const recent = parsed.data.filings?.recent;
|
|
156
|
+
if (recent === undefined) {
|
|
157
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, 'The response carried no filings');
|
|
158
|
+
}
|
|
159
|
+
const filings = zipSecEdgarFilings(recent);
|
|
160
|
+
if (filings.length === 0) {
|
|
161
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, 'The response carried no filings');
|
|
162
|
+
}
|
|
163
|
+
const newestFilingDate = filings
|
|
164
|
+
.map((filing) => filing.filingDate)
|
|
165
|
+
.sort()
|
|
166
|
+
.at(-1);
|
|
167
|
+
if (newestFilingDate === undefined) {
|
|
168
|
+
throw new UsSourceParseError(SEC_EDGAR_FILINGS_SOURCE_ID, 'No filing date to summarise');
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
cik: parsed.data.cik ?? '',
|
|
172
|
+
name: parsed.data.name ?? '',
|
|
173
|
+
entityType: blankToNull(parsed.data.entityType),
|
|
174
|
+
sic: blankToNull(parsed.data.sic),
|
|
175
|
+
sicDescription: blankToNull(parsed.data.sicDescription),
|
|
176
|
+
tickers: parsed.data.tickers ?? [],
|
|
177
|
+
exchanges: parsed.data.exchanges ?? [],
|
|
178
|
+
fiscalYearEnd: blankToNull(parsed.data.fiscalYearEnd),
|
|
179
|
+
filings,
|
|
180
|
+
filingCount: filings.length,
|
|
181
|
+
newestFilingDate,
|
|
182
|
+
formCounts: countSecEdgarForms(filings),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Reads one issuer's recent filings from the SEC's submissions service.
|
|
187
|
+
*
|
|
188
|
+
* The SEC asks every caller to identify itself, so the request carries a
|
|
189
|
+
* descriptive User-Agent header. One keyless request covers the issuer's
|
|
190
|
+
* recent filings and a little under a thousand rows.
|
|
191
|
+
*
|
|
192
|
+
* @param options - an optional Central Index Key and fetch stub
|
|
193
|
+
* @returns the issuer's profile, its recent filings, and the form counts
|
|
194
|
+
*/
|
|
195
|
+
export async function fetchSecEdgarFilings(options) {
|
|
196
|
+
const fetchImpl = options?.fetchImpl ?? globalThis.fetch;
|
|
197
|
+
const url = buildSecEdgarSubmissionsUrl(options?.cik ?? SEC_EDGAR_APPLE_CIK);
|
|
198
|
+
const response = await fetchImpl(url, { headers: { 'User-Agent': SEC_EDGAR_USER_AGENT } });
|
|
199
|
+
if (!response.ok) {
|
|
200
|
+
throw new UsSourceApiError(SEC_EDGAR_FILINGS_SOURCE_ID, `HTTP ${response.status} reading the submissions file`);
|
|
201
|
+
}
|
|
202
|
+
return parseSecEdgarFilingsPayload(await response.json());
|
|
203
|
+
}
|
|
204
|
+
/** SEC EDGAR issuer submissions and recent filings, keyless. */
|
|
205
|
+
export const secEdgarFilingsAdapter = {
|
|
206
|
+
id: SEC_EDGAR_FILINGS_SOURCE_ID,
|
|
207
|
+
name: 'SEC EDGAR filings',
|
|
208
|
+
auth: 'none',
|
|
209
|
+
description: "An issuer's recent filing history from SEC EDGAR, one row per filing, with the form type and the newest date in the list.",
|
|
210
|
+
fetchLive: async (options) => fetchSecEdgarFilings(options?.fetchImpl === undefined ? {} : { fetchImpl: options.fetchImpl }),
|
|
211
|
+
parse: (payload) => parseSecEdgarFilingsPayload(payload),
|
|
212
|
+
loadFixture: () => parseSecEdgarFilingsPayload(readFixtureJson(SEC_EDGAR_FIXTURE_FILENAME)),
|
|
213
|
+
};
|
|
214
|
+
//# sourceMappingURL=secEdgarFilings.js.map
|