@shan8851/companies-house-cli 0.1.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.
- package/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +54 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/chargesCommand.d.ts +4 -0
- package/dist/commands/chargesCommand.d.ts.map +1 -0
- package/dist/commands/chargesCommand.js +121 -0
- package/dist/commands/chargesCommand.js.map +1 -0
- package/dist/commands/companyInfoCommand.d.ts +4 -0
- package/dist/commands/companyInfoCommand.d.ts.map +1 -0
- package/dist/commands/companyInfoCommand.js +123 -0
- package/dist/commands/companyInfoCommand.js.map +1 -0
- package/dist/commands/filingsCommand.d.ts +4 -0
- package/dist/commands/filingsCommand.d.ts.map +1 -0
- package/dist/commands/filingsCommand.js +93 -0
- package/dist/commands/filingsCommand.js.map +1 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +19 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/insolvencyCommand.d.ts +4 -0
- package/dist/commands/insolvencyCommand.d.ts.map +1 -0
- package/dist/commands/insolvencyCommand.js +48 -0
- package/dist/commands/insolvencyCommand.js.map +1 -0
- package/dist/commands/officersCommand.d.ts +4 -0
- package/dist/commands/officersCommand.d.ts.map +1 -0
- package/dist/commands/officersCommand.js +133 -0
- package/dist/commands/officersCommand.js.map +1 -0
- package/dist/commands/pscCommand.d.ts +4 -0
- package/dist/commands/pscCommand.d.ts.map +1 -0
- package/dist/commands/pscCommand.js +125 -0
- package/dist/commands/pscCommand.js.map +1 -0
- package/dist/commands/searchCompaniesCommand.d.ts +4 -0
- package/dist/commands/searchCompaniesCommand.d.ts.map +1 -0
- package/dist/commands/searchCompaniesCommand.js +76 -0
- package/dist/commands/searchCompaniesCommand.js.map +1 -0
- package/dist/commands/searchPeopleCommand.d.ts +4 -0
- package/dist/commands/searchPeopleCommand.d.ts.map +1 -0
- package/dist/commands/searchPeopleCommand.js +103 -0
- package/dist/commands/searchPeopleCommand.js.map +1 -0
- package/dist/commands/shared.d.ts +21 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +86 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/lib/companiesHouseClient.d.ts +50 -0
- package/dist/lib/companiesHouseClient.d.ts.map +1 -0
- package/dist/lib/companiesHouseClient.js +119 -0
- package/dist/lib/companiesHouseClient.js.map +1 -0
- package/dist/lib/companyNumber.d.ts +2 -0
- package/dist/lib/companyNumber.d.ts.map +1 -0
- package/dist/lib/companyNumber.js +8 -0
- package/dist/lib/companyNumber.js.map +1 -0
- package/dist/lib/config.d.ts +10 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +33 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/errors.d.ts +10 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +26 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/formatting.d.ts +19 -0
- package/dist/lib/formatting.d.ts.map +1 -0
- package/dist/lib/formatting.js +41 -0
- package/dist/lib/formatting.js.map +1 -0
- package/dist/lib/normalizers.d.ts +22 -0
- package/dist/lib/normalizers.d.ts.map +1 -0
- package/dist/lib/normalizers.js +235 -0
- package/dist/lib/normalizers.js.map +1 -0
- package/dist/lib/pagination.d.ts +15 -0
- package/dist/lib/pagination.d.ts.map +1 -0
- package/dist/lib/pagination.js +64 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/types/api.d.ts +282 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +2 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/cli.d.ts +27 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/cli.js +2 -0
- package/dist/types/cli.js.map +1 -0
- package/dist/types/normalized.d.ts +229 -0
- package/dist/types/normalized.d.ts.map +1 -0
- package/dist/types/normalized.js +2 -0
- package/dist/types/normalized.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { CommanderError, InvalidArgumentError } from "commander";
|
|
2
|
+
import { createCompaniesHouseClient } from "../lib/companiesHouseClient.js";
|
|
3
|
+
import { resolveCliConfig } from "../lib/config.js";
|
|
4
|
+
import { CliHandledError, toCliError } from "../lib/errors.js";
|
|
5
|
+
export const createDefaultRuntimeDependencies = () => ({
|
|
6
|
+
cwd: process.cwd(),
|
|
7
|
+
env: process.env,
|
|
8
|
+
fetchImplementation: fetch,
|
|
9
|
+
writeStderr: (text) => {
|
|
10
|
+
process.stderr.write(text);
|
|
11
|
+
},
|
|
12
|
+
writeStdout: (text) => {
|
|
13
|
+
process.stdout.write(text);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export const parsePositiveInteger = (value) => {
|
|
17
|
+
const parsedValue = Number.parseInt(value, 10);
|
|
18
|
+
if (!Number.isInteger(parsedValue) || parsedValue <= 0) {
|
|
19
|
+
throw new InvalidArgumentError("Expected a positive integer.");
|
|
20
|
+
}
|
|
21
|
+
return parsedValue;
|
|
22
|
+
};
|
|
23
|
+
export const parseNonNegativeInteger = (value) => {
|
|
24
|
+
const parsedValue = Number.parseInt(value, 10);
|
|
25
|
+
if (!Number.isInteger(parsedValue) || parsedValue < 0) {
|
|
26
|
+
throw new InvalidArgumentError("Expected a non-negative integer.");
|
|
27
|
+
}
|
|
28
|
+
return parsedValue;
|
|
29
|
+
};
|
|
30
|
+
export const addListOptions = (command) => command
|
|
31
|
+
.option("--items-per-page <number>", "Items to fetch per page.", parsePositiveInteger)
|
|
32
|
+
.option("--start-index <number>", "Zero-based start index.", parseNonNegativeInteger, 0)
|
|
33
|
+
.option("--all", "Fetch all available pages.");
|
|
34
|
+
export const resolveListOptions = (options) => {
|
|
35
|
+
if ((options.all ?? false) && (options.startIndex ?? 0) !== 0) {
|
|
36
|
+
throw new CommanderError(1, "command.invalidOption", "--all cannot be combined with a non-zero --start-index.");
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
all: options.all ?? false,
|
|
40
|
+
...(options.itemsPerPage !== undefined ? { itemsPerPage: options.itemsPerPage } : {}),
|
|
41
|
+
startIndex: options.startIndex ?? 0
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export const resolveOutputMode = (command) => {
|
|
45
|
+
const globalOptions = command.optsWithGlobals();
|
|
46
|
+
return globalOptions.json ? "json" : "human";
|
|
47
|
+
};
|
|
48
|
+
export const executeCommand = async ({ command, dependencies, execute, renderHuman }) => {
|
|
49
|
+
const outputMode = resolveOutputMode(command);
|
|
50
|
+
try {
|
|
51
|
+
const config = resolveCliConfig({
|
|
52
|
+
cwd: dependencies.cwd,
|
|
53
|
+
env: dependencies.env
|
|
54
|
+
});
|
|
55
|
+
const client = createCompaniesHouseClient({
|
|
56
|
+
apiKey: config.apiKey,
|
|
57
|
+
baseUrl: config.baseUrl,
|
|
58
|
+
fetchImplementation: dependencies.fetchImplementation
|
|
59
|
+
});
|
|
60
|
+
const envelope = await execute({
|
|
61
|
+
client
|
|
62
|
+
});
|
|
63
|
+
if (outputMode === "json") {
|
|
64
|
+
dependencies.writeStdout(`${JSON.stringify(envelope, null, 2)}\n`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
dependencies.writeStdout(`${renderHuman(envelope)}\n`);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const cliError = toCliError(error);
|
|
71
|
+
if (outputMode === "json") {
|
|
72
|
+
dependencies.writeStderr(`${JSON.stringify({
|
|
73
|
+
error: {
|
|
74
|
+
code: cliError.code,
|
|
75
|
+
message: cliError.message,
|
|
76
|
+
statusCode: cliError.statusCode ?? null
|
|
77
|
+
}
|
|
78
|
+
}, null, 2)}\n`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
dependencies.writeStderr(`Error: ${cliError.message}\n`);
|
|
82
|
+
}
|
|
83
|
+
throw new CliHandledError();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EACL,0BAA0B,EAE3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAwB,EAAE,CAAC,CAAC;IAC1E,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,mBAAmB,EAAE,KAAK;IAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAU,EAAE;IAC5D,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAE/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAA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,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,IAAI;iBACxC;aACF,EACD,IAAI,EACJ,CAAC,CACF,IAAI,CACN,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,WAAW,CAAC,UAAU,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,IAAI,eAAe,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ChargeListApiResponse, CompanyInsolvencyApiResponse, CompanyProfileApiResponse, CompanySearchApiResponse, FilingHistoryApiResponse, OfficerAppointmentListApiResponse, OfficerListApiResponse, OfficerSearchApiResponse, PscListApiResponse } from "../types/api.js";
|
|
2
|
+
export interface CompaniesHouseClientOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
fetchImplementation: typeof fetch;
|
|
6
|
+
}
|
|
7
|
+
export interface PaginatedApiRequest {
|
|
8
|
+
itemsPerPage?: number;
|
|
9
|
+
startIndex?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SearchCompaniesRequest extends PaginatedApiRequest {
|
|
12
|
+
query: string;
|
|
13
|
+
restrictions?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ListOfficersRequest extends PaginatedApiRequest {
|
|
16
|
+
companyNumber: string;
|
|
17
|
+
orderBy?: string;
|
|
18
|
+
registerType?: string;
|
|
19
|
+
registerView?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ListFilingsRequest extends PaginatedApiRequest {
|
|
22
|
+
category?: string;
|
|
23
|
+
companyNumber: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ListPscRequest extends PaginatedApiRequest {
|
|
26
|
+
companyNumber: string;
|
|
27
|
+
registerView?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SearchOfficersRequest extends PaginatedApiRequest {
|
|
30
|
+
query: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ListOfficerAppointmentsRequest extends PaginatedApiRequest {
|
|
33
|
+
officerId: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ListChargesRequest extends PaginatedApiRequest {
|
|
36
|
+
companyNumber: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CompaniesHouseClient {
|
|
39
|
+
getCompanyProfile: (companyNumber: string) => Promise<CompanyProfileApiResponse>;
|
|
40
|
+
getInsolvency: (companyNumber: string) => Promise<CompanyInsolvencyApiResponse | null>;
|
|
41
|
+
listCharges: (request: ListChargesRequest) => Promise<ChargeListApiResponse>;
|
|
42
|
+
listFilings: (request: ListFilingsRequest) => Promise<FilingHistoryApiResponse>;
|
|
43
|
+
listOfficerAppointments: (request: ListOfficerAppointmentsRequest) => Promise<OfficerAppointmentListApiResponse>;
|
|
44
|
+
listOfficers: (request: ListOfficersRequest) => Promise<OfficerListApiResponse>;
|
|
45
|
+
listPsc: (request: ListPscRequest) => Promise<PscListApiResponse>;
|
|
46
|
+
searchCompanies: (request: SearchCompaniesRequest) => Promise<CompanySearchApiResponse>;
|
|
47
|
+
searchOfficers: (request: SearchOfficersRequest) => Promise<OfficerSearchApiResponse>;
|
|
48
|
+
}
|
|
49
|
+
export declare const createCompaniesHouseClient: ({ apiKey, baseUrl, fetchImplementation }: CompaniesHouseClientOptions) => CompaniesHouseClient;
|
|
50
|
+
//# sourceMappingURL=companiesHouseClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companiesHouseClient.d.ts","sourceRoot":"","sources":["../../src/lib/companiesHouseClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,iCAAiC,EACjC,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAA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AE,kBAAkB,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAChF,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAChD,YAAY,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChF,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAClE,eAAe,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACxF,cAAc,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACvF;AAED,eAAO,MAAM,0BAA0B,GAAI,0CAIxC,2BAA2B,KAAG,oBAoIhC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { CompaniesHouseCliError } from "./errors.js";
|
|
2
|
+
const USER_AGENT = "companies-house-cli/0.1.0";
|
|
3
|
+
const safeParseJson = (text) => {
|
|
4
|
+
if (text.trim().length === 0) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(text);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return text;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const buildUrl = (baseUrl, path, query) => {
|
|
15
|
+
const normalizedBaseUrl = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
|
16
|
+
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
17
|
+
const url = new URL(normalizedPath, normalizedBaseUrl);
|
|
18
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
19
|
+
if (value === undefined || value === "") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
url.searchParams.set(key, String(value));
|
|
23
|
+
});
|
|
24
|
+
return url;
|
|
25
|
+
};
|
|
26
|
+
const createApiError = (statusCode, url, responseBody) => {
|
|
27
|
+
if (statusCode === 401) {
|
|
28
|
+
return new CompaniesHouseCliError("Companies House rejected the request. Check that COMPANIES_HOUSE_API_KEY is valid for the public data API.", "unauthorized", statusCode);
|
|
29
|
+
}
|
|
30
|
+
if (statusCode === 404) {
|
|
31
|
+
return new CompaniesHouseCliError("The requested Companies House resource was not found.", "not_found", statusCode);
|
|
32
|
+
}
|
|
33
|
+
if (statusCode === 429) {
|
|
34
|
+
return new CompaniesHouseCliError("Companies House rate-limited the request. Wait a moment and try again.", "rate_limited", statusCode);
|
|
35
|
+
}
|
|
36
|
+
const message = typeof responseBody === "object" &&
|
|
37
|
+
responseBody !== null &&
|
|
38
|
+
"error" in responseBody &&
|
|
39
|
+
typeof responseBody.error === "string"
|
|
40
|
+
? responseBody.error
|
|
41
|
+
: `Companies House returned HTTP ${statusCode} for ${url}.`;
|
|
42
|
+
return new CompaniesHouseCliError(message, "api_error", statusCode);
|
|
43
|
+
};
|
|
44
|
+
export const createCompaniesHouseClient = ({ apiKey, baseUrl, fetchImplementation }) => {
|
|
45
|
+
const authorizationHeader = `Basic ${Buffer.from(`${apiKey}:`).toString("base64")}`;
|
|
46
|
+
const requestJson = async (path, query, options) => {
|
|
47
|
+
const url = buildUrl(baseUrl, path, query);
|
|
48
|
+
let response;
|
|
49
|
+
try {
|
|
50
|
+
response = await fetchImplementation(url, {
|
|
51
|
+
headers: {
|
|
52
|
+
Accept: "application/json",
|
|
53
|
+
Authorization: authorizationHeader,
|
|
54
|
+
"User-Agent": USER_AGENT
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new CompaniesHouseCliError(error instanceof Error
|
|
60
|
+
? `Failed to reach Companies House: ${error.message}`
|
|
61
|
+
: "Failed to reach Companies House.", "network_error");
|
|
62
|
+
}
|
|
63
|
+
const responseText = await response.text();
|
|
64
|
+
const responseBody = safeParseJson(responseText);
|
|
65
|
+
if (response.status === 404 && options?.allowNotFound) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
if (!response.ok) {
|
|
69
|
+
throw createApiError(response.status, url.toString(), responseBody);
|
|
70
|
+
}
|
|
71
|
+
if (typeof responseBody !== "object" || responseBody === null) {
|
|
72
|
+
throw new CompaniesHouseCliError(`Companies House returned an invalid JSON payload for ${url.toString()}.`, "invalid_response");
|
|
73
|
+
}
|
|
74
|
+
return responseBody;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
getCompanyProfile: async (companyNumber) => (await requestJson(`/company/${companyNumber}`, {})),
|
|
78
|
+
getInsolvency: async (companyNumber) => await requestJson(`/company/${companyNumber}/insolvency`, {}, {
|
|
79
|
+
allowNotFound: true
|
|
80
|
+
}),
|
|
81
|
+
listCharges: async ({ companyNumber, itemsPerPage, startIndex }) => (await requestJson(`/company/${companyNumber}/charges`, {
|
|
82
|
+
items_per_page: itemsPerPage,
|
|
83
|
+
start_index: startIndex
|
|
84
|
+
})),
|
|
85
|
+
listFilings: async ({ category, companyNumber, itemsPerPage, startIndex }) => (await requestJson(`/company/${companyNumber}/filing-history`, {
|
|
86
|
+
category,
|
|
87
|
+
items_per_page: itemsPerPage,
|
|
88
|
+
start_index: startIndex
|
|
89
|
+
})),
|
|
90
|
+
listOfficerAppointments: async ({ officerId, itemsPerPage, startIndex }) => (await requestJson(`/officers/${officerId}/appointments`, {
|
|
91
|
+
items_per_page: itemsPerPage,
|
|
92
|
+
start_index: startIndex
|
|
93
|
+
})),
|
|
94
|
+
listOfficers: async ({ companyNumber, itemsPerPage, orderBy, registerType, registerView, startIndex }) => (await requestJson(`/company/${companyNumber}/officers`, {
|
|
95
|
+
items_per_page: itemsPerPage,
|
|
96
|
+
order_by: orderBy,
|
|
97
|
+
register_type: registerType,
|
|
98
|
+
register_view: registerView,
|
|
99
|
+
start_index: startIndex
|
|
100
|
+
})),
|
|
101
|
+
listPsc: async ({ companyNumber, itemsPerPage, registerView, startIndex }) => (await requestJson(`/company/${companyNumber}/persons-with-significant-control`, {
|
|
102
|
+
items_per_page: itemsPerPage,
|
|
103
|
+
register_view: registerView,
|
|
104
|
+
start_index: startIndex
|
|
105
|
+
})),
|
|
106
|
+
searchCompanies: async ({ itemsPerPage, query, restrictions, startIndex }) => (await requestJson("/search/companies", {
|
|
107
|
+
items_per_page: itemsPerPage,
|
|
108
|
+
q: query,
|
|
109
|
+
restrictions,
|
|
110
|
+
start_index: startIndex
|
|
111
|
+
})),
|
|
112
|
+
searchOfficers: async ({ itemsPerPage, query, startIndex }) => (await requestJson("/search/officers", {
|
|
113
|
+
items_per_page: itemsPerPage,
|
|
114
|
+
q: query,
|
|
115
|
+
start_index: startIndex
|
|
116
|
+
}))
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=companiesHouseClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companiesHouseClient.js","sourceRoot":"","sources":["../../src/lib/companiesHouseClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAiD/C,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE;IAC9C,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CACf,OAAe,EACf,IAAY,EACZ,KAAiC,EAC5B,EAAE;IACP,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OA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B,GAAI,eAAe,MAAM,KAAG,MAM9D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const SHORT_NUMERIC_COMPANY_NUMBER_PATTERN = /^\d{1,7}$/;
|
|
2
|
+
export const normalizeCompanyNumber = (companyNumber) => {
|
|
3
|
+
const trimmedCompanyNumber = companyNumber.trim();
|
|
4
|
+
return SHORT_NUMERIC_COMPANY_NUMBER_PATTERN.test(trimmedCompanyNumber)
|
|
5
|
+
? trimmedCompanyNumber.padStart(8, "0")
|
|
6
|
+
: trimmedCompanyNumber;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=companyNumber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companyNumber.js","sourceRoot":"","sources":["../../src/lib/companyNumber.ts"],"names":[],"mappings":"AAAA,MAAM,oCAAoC,GAAG,WAAW,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,aAAqB,EAAU,EAAE;IACtE,MAAM,oBAAoB,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;IAElD,OAAO,oCAAoC,CAAC,IAAI,CAAC,oBAAoB,CAAC;QACpE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;QACvC,CAAC,CAAC,oBAAoB,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CliConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ResolveCliConfigOptions {
|
|
6
|
+
cwd: string;
|
|
7
|
+
env: NodeJS.ProcessEnv;
|
|
8
|
+
}
|
|
9
|
+
export declare const resolveCliConfig: ({ cwd, env }: ResolveCliConfigOptions) => CliConfig;
|
|
10
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB;AAkBD,eAAO,MAAM,gBAAgB,GAAI,cAG9B,uBAAuB,KAAG,SAkB5B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { parse } from "dotenv";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { CompaniesHouseCliError } from "./errors.js";
|
|
6
|
+
const configSchema = z.object({
|
|
7
|
+
apiKey: z.string().trim().min(1)
|
|
8
|
+
});
|
|
9
|
+
const COMPANIES_HOUSE_BASE_URL = "https://api.company-information.service.gov.uk";
|
|
10
|
+
const readApiKeyFromDotEnv = (cwd) => {
|
|
11
|
+
const dotEnvPath = resolve(cwd, ".env");
|
|
12
|
+
if (!existsSync(dotEnvPath)) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const dotEnvContents = readFileSync(dotEnvPath, "utf8");
|
|
16
|
+
const parsedDotEnv = parse(dotEnvContents);
|
|
17
|
+
const apiKey = parsedDotEnv.COMPANIES_HOUSE_API_KEY;
|
|
18
|
+
return typeof apiKey === "string" && apiKey.trim().length > 0 ? apiKey.trim() : undefined;
|
|
19
|
+
};
|
|
20
|
+
export const resolveCliConfig = ({ cwd, env }) => {
|
|
21
|
+
const apiKey = env.COMPANIES_HOUSE_API_KEY?.trim() || readApiKeyFromDotEnv(cwd);
|
|
22
|
+
const parsedConfig = configSchema.safeParse({
|
|
23
|
+
apiKey
|
|
24
|
+
});
|
|
25
|
+
if (!parsedConfig.success) {
|
|
26
|
+
throw new CompaniesHouseCliError("Missing COMPANIES_HOUSE_API_KEY. Set it in your environment or add it to a local .env file.", "missing_api_key");
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
apiKey: parsedConfig.data.apiKey,
|
|
30
|
+
baseUrl: COMPANIES_HOUSE_BASE_URL
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjC,CAAC,CAAC;AAYH,MAAM,wBAAwB,GAAG,gDAAgD,CAAC;AAElF,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAsB,EAAE;IAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAExC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,cAAc,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,YAAY,CAAC,uBAAuB,CAAC;IAEpD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,GAAG,EACH,GAAG,EACqB,EAAa,EAAE;IACvC,MAAM,MAAM,GAAG,GAAG,CAAC,uBAAuB,EAAE,IAAI,EAAE,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAEhF,MAAM,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC;QAC1C,MAAM;KACP,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,sBAAsB,CAC9B,6FAA6F,EAC7F,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM;QAChC,OAAO,EAAE,wBAAwB;KAClC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class CompaniesHouseCliError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly statusCode: number | undefined;
|
|
4
|
+
constructor(message: string, code: string, statusCode?: number);
|
|
5
|
+
}
|
|
6
|
+
export declare class CliHandledError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare const toCliError: (error: unknown) => CompaniesHouseCliError;
|
|
10
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE5B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAMtE;AAED,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,sBAa3C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class CompaniesHouseCliError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
statusCode;
|
|
4
|
+
constructor(message, code, statusCode) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "CompaniesHouseCliError";
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.statusCode = statusCode;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class CliHandledError extends Error {
|
|
12
|
+
constructor() {
|
|
13
|
+
super("CLI error already handled");
|
|
14
|
+
this.name = "CliHandledError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const toCliError = (error) => {
|
|
18
|
+
if (error instanceof CompaniesHouseCliError) {
|
|
19
|
+
return error;
|
|
20
|
+
}
|
|
21
|
+
if (error instanceof Error) {
|
|
22
|
+
return new CompaniesHouseCliError(error.message, "unexpected_error");
|
|
23
|
+
}
|
|
24
|
+
return new CompaniesHouseCliError("An unexpected error occurred.", "unexpected_error");
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/B,IAAI,CAAS;IACb,UAAU,CAAqB;IAE/C,YAAmB,OAAe,EAAE,IAAY,EAAE,UAAmB;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC;QACE,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAA0B,EAAE;IACnE,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,sBAAsB,CAC/B,KAAK,CAAC,OAAO,EACb,kBAAkB,CACnB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,sBAAsB,CAAC,+BAA+B,EAAE,kBAAkB,CAAC,CAAC;AACzF,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NormalizedAddress, NormalizedDateOfBirth } from "../types/normalized.js";
|
|
2
|
+
export declare const formatAddress: (address: NormalizedAddress | null) => string | null;
|
|
3
|
+
export declare const formatDateOfBirth: (dateOfBirth: NormalizedDateOfBirth | null) => string | null;
|
|
4
|
+
export declare const formatBoolean: (value: boolean | null, labels: {
|
|
5
|
+
false: string;
|
|
6
|
+
true: string;
|
|
7
|
+
}) => string | null;
|
|
8
|
+
export declare const formatList: (values: string[]) => string | null;
|
|
9
|
+
export declare const renderKeyValueRows: (rows: Array<{
|
|
10
|
+
label: string;
|
|
11
|
+
value: string | null;
|
|
12
|
+
}>) => string[];
|
|
13
|
+
export declare const renderSection: (title: string, lines: string[]) => string | null;
|
|
14
|
+
export declare const joinSections: (sections: Array<string | null>) => string;
|
|
15
|
+
export declare const renderNumberedBlocks: (items: string[], renderItem: (item: string, index: number) => string[]) => string[];
|
|
16
|
+
export declare const withFallback: (value: string | null, fallback: string) => string;
|
|
17
|
+
export declare const compactRowValues: (...values: Array<string | null>) => string | null;
|
|
18
|
+
export declare const renderPaginationSummary: (returnedCount: number, totalResults: number | null, fetchedAll: boolean) => string;
|
|
19
|
+
//# sourceMappingURL=formatting.d.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QAAQ,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,KAAG,MAAM,GAAG,IAI3E,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,eAAe,MAAM,EACrB,cAAc,MAAM,GAAG,IAAI,EAC3B,YAAY,OAAO,KAClB,MAOwC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const compactStrings = (values) => values.filter((value) => typeof value === "string" && value.length > 0);
|
|
2
|
+
export const formatAddress = (address) => address?.formatted ?? null;
|
|
3
|
+
export const formatDateOfBirth = (dateOfBirth) => dateOfBirth?.formatted ?? null;
|
|
4
|
+
export const formatBoolean = (value, labels) => {
|
|
5
|
+
if (value === null) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return value ? labels.true : labels.false;
|
|
9
|
+
};
|
|
10
|
+
export const formatList = (values) => values.length > 0 ? values.join(", ") : null;
|
|
11
|
+
export const renderKeyValueRows = (rows) => rows
|
|
12
|
+
.filter((row) => row.value !== null)
|
|
13
|
+
.map((row) => `${row.label}: ${row.value}`);
|
|
14
|
+
export const renderSection = (title, lines) => {
|
|
15
|
+
if (lines.length === 0) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return [title, ...lines].join("\n");
|
|
19
|
+
};
|
|
20
|
+
export const joinSections = (sections) => sections.filter((section) => section !== null).join("\n\n");
|
|
21
|
+
export const renderNumberedBlocks = (items, renderItem) => items.flatMap((item, index) => {
|
|
22
|
+
const lines = renderItem(item, index);
|
|
23
|
+
const [firstLine, ...restLines] = lines;
|
|
24
|
+
if (!firstLine) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
return [`${index + 1}. ${firstLine}`, ...restLines.map((line) => ` ${line}`)];
|
|
28
|
+
});
|
|
29
|
+
export const withFallback = (value, fallback) => value ?? fallback;
|
|
30
|
+
export const compactRowValues = (...values) => {
|
|
31
|
+
const presentValues = compactStrings(values);
|
|
32
|
+
return presentValues.length > 0 ? presentValues.join(" | ") : null;
|
|
33
|
+
};
|
|
34
|
+
export const renderPaginationSummary = (returnedCount, totalResults, fetchedAll) => totalResults !== null
|
|
35
|
+
? fetchedAll
|
|
36
|
+
? `Fetched ${returnedCount} of ${totalResults} results.`
|
|
37
|
+
: `Showing ${returnedCount} of ${totalResults} results.`
|
|
38
|
+
: fetchedAll
|
|
39
|
+
? `Fetched ${returnedCount} results.`
|
|
40
|
+
: `Showing ${returnedCount} results.`;
|
|
41
|
+
//# sourceMappingURL=formatting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src/lib/formatting.ts"],"names":[],"mappings":"AAKA,MAAM,cAAc,GAAG,CAAC,MAAwC,EAAY,EAAE,CAC5E,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAE3F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAiC,EAAiB,EAAE,CAChF,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAyC,EAAiB,EAAE,CAC5F,WAAW,EAAE,SAAS,IAAI,IAAI,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAqB,EACrB,MAGC,EACc,EAAE;IACjB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAgB,EAAiB,EAAE,CAC5D,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CA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AM,IAAI,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAE,QAAgB,EAAU,EAAE,CAC7E,KAAK,IAAI,QAAQ,CAAC;AAEpB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,MAA4B,EAAiB,EAAE;IACjF,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE7C,OAAO,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,aAAqB,EACrB,YAA2B,EAC3B,UAAmB,EACX,EAAE,CACV,YAAY,KAAK,IAAI;IACnB,CAAC,CAAC,UAAU;QACV,CAAC,CAAC,WAAW,aAAa,OAAO,YAAY,WAAW;QACxD,CAAC,CAAC,WAAW,aAAa,OAAO,YAAY,WAAW;IAC1D,CAAC,CAAC,UAAU;QACV,CAAC,CAAC,WAAW,aAAa,WAAW;QACrC,CAAC,CAAC,WAAW,aAAa,WAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AddressApi, ChargeApiItem, CompanyInsolvencyApiResponse, CompanyProfileApiResponse, CompanySearchApiItem, FilingHistoryApiItem, InsolvencyCaseApi, OfficerApiItem, OfficerAppointmentApiItem, OfficerSearchApiItem, PscApiItem } from "../types/api.js";
|
|
2
|
+
import type { NormalizedAddress, NormalizedCharge, NormalizedCompanyProfile, NormalizedCompanySearchResult, NormalizedDateOfBirth, NormalizedFiling, NormalizedInsolvencyCase, NormalizedOfficer, NormalizedOfficerAppointment, NormalizedPersonSearchResult, NormalizedPsc } from "../types/normalized.js";
|
|
3
|
+
export declare const normalizeAddress: (address: AddressApi | undefined) => NormalizedAddress | null;
|
|
4
|
+
export declare const normalizeDateOfBirth: (dateOfBirth: {
|
|
5
|
+
day?: number;
|
|
6
|
+
month?: number;
|
|
7
|
+
year?: number;
|
|
8
|
+
} | undefined) => NormalizedDateOfBirth | null;
|
|
9
|
+
export declare const normalizeCompanySearchResult: (item: CompanySearchApiItem) => NormalizedCompanySearchResult;
|
|
10
|
+
export declare const normalizeCompanyProfile: (profile: CompanyProfileApiResponse) => NormalizedCompanyProfile;
|
|
11
|
+
export declare const normalizeOfficer: (item: OfficerApiItem) => NormalizedOfficer;
|
|
12
|
+
export declare const normalizeFiling: (item: FilingHistoryApiItem, options?: {
|
|
13
|
+
includeLinks?: boolean;
|
|
14
|
+
}) => NormalizedFiling;
|
|
15
|
+
export declare const normalizePsc: (item: PscApiItem) => NormalizedPsc;
|
|
16
|
+
export declare const extractOfficerId: (selfLink: string | undefined) => string | null;
|
|
17
|
+
export declare const normalizeOfficerAppointment: (item: OfficerAppointmentApiItem) => NormalizedOfficerAppointment;
|
|
18
|
+
export declare const normalizePersonSearchResult: (item: OfficerSearchApiItem, appointments: NormalizedOfficerAppointment[]) => NormalizedPersonSearchResult;
|
|
19
|
+
export declare const normalizeCharge: (item: ChargeApiItem) => NormalizedCharge;
|
|
20
|
+
export declare const normalizeInsolvencyCase: (insolvencyCase: InsolvencyCaseApi) => NormalizedInsolvencyCase;
|
|
21
|
+
export declare const normalizeInsolvencyCases: (insolvency: CompanyInsolvencyApiResponse | null) => NormalizedInsolvencyCase[];
|
|
22
|
+
//# sourceMappingURL=normalizers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizers.d.ts","sourceRoot":"","sources":["../../src/lib/normalizers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EAEjB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,UAAU,EACX,MAAM,iBAAiB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