@comms-id/company 0.2.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 +15 -0
- package/README.md +30 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +6 -0
- package/dist/descriptor.d.ts +15 -0
- package/dist/descriptor.js +20 -0
- package/dist/fixtures.d.ts +5 -0
- package/dist/fixtures.js +10 -0
- package/dist/generated/client.d.ts +10 -0
- package/dist/generated/client.js +7 -0
- package/dist/generated/fixtures.d.ts +2 -0
- package/dist/generated/fixtures.js +85 -0
- package/dist/generated/operations.d.ts +6 -0
- package/dist/generated/operations.js +674 -0
- package/dist/generated/types.d.ts +88 -0
- package/dist/generated/types.js +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/runtime/browser-core.d.ts +23 -0
- package/dist/runtime/browser-core.js +41 -0
- package/dist/runtime/environment.d.ts +5 -0
- package/dist/runtime/environment.js +30 -0
- package/dist/runtime/errors.d.ts +29 -0
- package/dist/runtime/errors.js +40 -0
- package/dist/runtime/fixture-core.d.ts +7 -0
- package/dist/runtime/fixture-core.js +26 -0
- package/dist/runtime/http.d.ts +34 -0
- package/dist/runtime/http.js +165 -0
- package/dist/runtime/server-core.d.ts +26 -0
- package/dist/runtime/server-core.js +39 -0
- package/dist/runtime/sign.d.ts +22 -0
- package/dist/runtime/sign.js +41 -0
- package/dist/runtime/validate.d.ts +57 -0
- package/dist/runtime/validate.js +175 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +8 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Copyright (c) 2026 COMMS.ID PTY LTD. Proprietary software; not open source.
|
|
2
|
+
|
|
3
|
+
Subject to the Comms.ID policy agreement, you may install, copy, bundle, run and
|
|
4
|
+
deliver this client or component within your applications, adapt the supplied
|
|
5
|
+
component source, and use the designated local functions and fixtures offline.
|
|
6
|
+
Hosted operations are provided by the Comms.ID service.
|
|
7
|
+
|
|
8
|
+
You may keep replies for your own customers and transactions, and your registered
|
|
9
|
+
application may relay requests for its own users.
|
|
10
|
+
|
|
11
|
+
You may not republish these packages as a standalone offering, resell access, offer
|
|
12
|
+
a substitute lookup service, or harvest replies to reconstruct or redistribute a
|
|
13
|
+
source dataset.
|
|
14
|
+
|
|
15
|
+
Preserve this notice and any applicable third-party notices.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @comms-id/company
|
|
2
|
+
|
|
3
|
+
Typed client for the Comms.ID Company API (`https://api.comms.id/company/v1`): Australian companies from ASIC's public registers: search by name, look up one by ACN.
|
|
4
|
+
|
|
5
|
+
`src/` is generated from the Company contract (`packages/asic-public-registers/openapi/company.v1.json`) by `@comms-id/forge-transformers`. Do not edit it: change the contract and run `pnpm --filter @comms-id/forge-transformers generate`.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createCompanyClient } from "@comms-id/company/server";
|
|
9
|
+
|
|
10
|
+
const client = createCompanyClient({
|
|
11
|
+
clientId: process.env.COMMS_ID_CLIENT_ID!,
|
|
12
|
+
privateJwk: JSON.parse(process.env.COMMS_ID_PRIVATE_JWK!),
|
|
13
|
+
});
|
|
14
|
+
const reply = await client.lookup({"acn": "001234567"});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Operations
|
|
18
|
+
|
|
19
|
+
- `lookup`: Look up one nine-digit ACN in the company snapshot. ABN lookup is not offered in v1. At most ten rows; no uniqueness or complete history claim.
|
|
20
|
+
- `search`: Search the company snapshot by case-insensitive name prefix and optional exact status. Default eight rows, maximum ten, no paging. A snapshot miss does not prove absence from the live register.
|
|
21
|
+
|
|
22
|
+
Every operation is a read, safe to repeat, and is retried after a retryable failure. A reply that is not a match is one of the outcomes of the reply convention: an error with `outcomeOf(error)` of `no-match`, `source-unavailable` or `failed`; an outage is never a "no match".
|
|
23
|
+
|
|
24
|
+
## Test it first
|
|
25
|
+
|
|
26
|
+
`createCompanyFixtureClient()` from `@comms-id/company/fixtures` answers from the contract's own examples with no network and says so (`fixture: true`). To call the TEST service (synthetic replies, your development app's key), pass `environment: "test"`; going live changes only the environment and the key.
|
|
27
|
+
|
|
28
|
+
Entries: `.` (types and errors, safe in a browser), `./server` (signs each call), `./browser` (your relay route; never signs), `./fixtures` (LOCAL FIXTURES, no network), `./descriptor` (what `@comms-id/relay` may forward).
|
|
29
|
+
|
|
30
|
+
The package is private until the publishing path exists (#515). `LICENSE` is the consumer client licence.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CompanyClient } from "./generated/client.js";
|
|
2
|
+
import { type BrowserOptions } from "./runtime/browser-core.js";
|
|
3
|
+
export type { Environment } from "./runtime/environment.js";
|
|
4
|
+
export type { BrowserOptions, CapabilityOptions, RelayOptions } from "./runtime/browser-core.js";
|
|
5
|
+
export declare const createCompanyBrowserClient: (options: BrowserOptions) => CompanyClient;
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Generated by @comms-id/forge-transformers from the service's OpenAPI contract. Do not edit: change the contract and regenerate.
|
|
2
|
+
// Browser entry: it never signs and holds no secret. Use the consumer's relay route, or a
|
|
3
|
+
// short-lived capability that the caller supplies.
|
|
4
|
+
import { buildClient } from "./generated/client.js";
|
|
5
|
+
import { createBrowserTransport } from "./runtime/browser-core.js";
|
|
6
|
+
export const createCompanyBrowserClient = (options) => buildClient(createBrowserTransport(options));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const companyProduct: {
|
|
2
|
+
readonly product: "company";
|
|
3
|
+
readonly audience: "asic-registers";
|
|
4
|
+
readonly scope: "asic-registers:read";
|
|
5
|
+
readonly maxBodyBytes: 16384;
|
|
6
|
+
readonly operations: readonly [{
|
|
7
|
+
readonly name: "lookup";
|
|
8
|
+
readonly method: "POST";
|
|
9
|
+
readonly path: "/company/v1/lookup";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "search";
|
|
12
|
+
readonly method: "POST";
|
|
13
|
+
readonly path: "/company/v1/search";
|
|
14
|
+
}];
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Generated by @comms-id/forge-transformers from the service's OpenAPI contract. Do not edit: change the contract and regenerate.
|
|
2
|
+
// The product descriptor that @comms-id/relay reads: which operations may be forwarded.
|
|
3
|
+
export const companyProduct = {
|
|
4
|
+
product: "company",
|
|
5
|
+
audience: "asic-registers",
|
|
6
|
+
scope: "asic-registers:read",
|
|
7
|
+
maxBodyBytes: 16_384,
|
|
8
|
+
operations: [
|
|
9
|
+
{
|
|
10
|
+
"name": "lookup",
|
|
11
|
+
"method": "POST",
|
|
12
|
+
"path": "/company/v1/lookup"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "search",
|
|
16
|
+
"method": "POST",
|
|
17
|
+
"path": "/company/v1/search"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
};
|
package/dist/fixtures.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @comms-id/forge-transformers from the service's OpenAPI contract. Do not edit: change the contract and regenerate.
|
|
2
|
+
// LOCAL FIXTURES: no network. The client runs the same request and reply checks as a real call.
|
|
3
|
+
import { buildClient } from "./generated/client.js";
|
|
4
|
+
import { fixtures } from "./generated/fixtures.js";
|
|
5
|
+
import { createFixtureTransport } from "./runtime/fixture-core.js";
|
|
6
|
+
export { FIXTURE_HEADER, FIXTURE_NOTICE } from "./runtime/fixture-core.js";
|
|
7
|
+
export const createCompanyFixtureClient = () => ({
|
|
8
|
+
...buildClient(createFixtureTransport(fixtures)),
|
|
9
|
+
fixture: true,
|
|
10
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CallOptions, type TransportConfig } from "../runtime/http.js";
|
|
2
|
+
import type { LookupRequest, LookupResponse, SearchRequest, SearchResponse } from "./types.js";
|
|
3
|
+
/** The client of Comms.ID Company: one method for each operation. */
|
|
4
|
+
export interface CompanyClient {
|
|
5
|
+
/** Look up one nine-digit ACN in the company snapshot. ABN lookup is not offered in v1. At most ten rows; no uniqueness or complete history claim. */
|
|
6
|
+
readonly lookup: (input: LookupRequest, options?: CallOptions) => Promise<LookupResponse>;
|
|
7
|
+
/** Search the company snapshot by case-insensitive name prefix and optional exact status. Default eight rows, maximum ten, no paging. A snapshot miss does not prove absence from the live register. */
|
|
8
|
+
readonly search: (input: SearchRequest, options?: CallOptions) => Promise<SearchResponse>;
|
|
9
|
+
}
|
|
10
|
+
export declare const buildClient: (transport: TransportConfig) => CompanyClient;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @comms-id/forge-transformers from the service's OpenAPI contract. Do not edit: change the contract and regenerate.
|
|
2
|
+
import { call } from "../runtime/http.js";
|
|
3
|
+
import { operations } from "./operations.js";
|
|
4
|
+
export const buildClient = (transport) => ({
|
|
5
|
+
lookup: (input, options) => call(transport, operations.lookup, input, options),
|
|
6
|
+
search: (input, options) => call(transport, operations.search, input, options),
|
|
7
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Generated by @comms-id/forge-transformers from the service's OpenAPI contract. Do not edit: change the contract and regenerate.
|
|
2
|
+
// Every reply is the example in the contract.
|
|
3
|
+
/** LOCAL FIXTURES: one canned reply for each operation path. Fake data. */
|
|
4
|
+
export const fixtures = {
|
|
5
|
+
"/company/v1/lookup": {
|
|
6
|
+
"activatedAt": "2026-10-01T00:01:00Z",
|
|
7
|
+
"attribution": "Australian Securities and Investments Commission via data.gov.au; Creative Commons Attribution 3.0 Australia",
|
|
8
|
+
"generation": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
9
|
+
"license": "http://creativecommons.org/licenses/by/3.0/au/",
|
|
10
|
+
"limit": 10,
|
|
11
|
+
"mode": "snapshot",
|
|
12
|
+
"offset": 0,
|
|
13
|
+
"records": [
|
|
14
|
+
{
|
|
15
|
+
"register": "companies",
|
|
16
|
+
"acn": "001234567",
|
|
17
|
+
"name": "EXAMPLE COMPANY PTY LTD",
|
|
18
|
+
"status": "Registered",
|
|
19
|
+
"abn": "99001234567",
|
|
20
|
+
"type": null,
|
|
21
|
+
"companyClass": null,
|
|
22
|
+
"subClass": null,
|
|
23
|
+
"registeredAt": null,
|
|
24
|
+
"deregisteredAt": null,
|
|
25
|
+
"previousState": null,
|
|
26
|
+
"stateRegistrationNumber": null,
|
|
27
|
+
"currentName": null,
|
|
28
|
+
"currentNameIndicator": null,
|
|
29
|
+
"currentNameStartedAt": null
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"register": "companies",
|
|
33
|
+
"source": {
|
|
34
|
+
"datasetId": "asic-companies",
|
|
35
|
+
"resourceId": "fictional-example",
|
|
36
|
+
"url": "https://data.gov.au/",
|
|
37
|
+
"modifiedAt": "2026-09-30T00:00:00Z",
|
|
38
|
+
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
39
|
+
"bytes": 100,
|
|
40
|
+
"format": "CSV",
|
|
41
|
+
"observedAt": "2026-10-01T00:00:00Z",
|
|
42
|
+
"license": "http://creativecommons.org/licenses/by/3.0/au/"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"/company/v1/search": {
|
|
46
|
+
"activatedAt": "2026-10-01T00:01:00Z",
|
|
47
|
+
"attribution": "Australian Securities and Investments Commission via data.gov.au; Creative Commons Attribution 3.0 Australia",
|
|
48
|
+
"generation": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
49
|
+
"license": "http://creativecommons.org/licenses/by/3.0/au/",
|
|
50
|
+
"limit": 8,
|
|
51
|
+
"mode": "snapshot",
|
|
52
|
+
"offset": 0,
|
|
53
|
+
"records": [
|
|
54
|
+
{
|
|
55
|
+
"register": "companies",
|
|
56
|
+
"acn": "001234567",
|
|
57
|
+
"name": "EXAMPLE COMPANY PTY LTD",
|
|
58
|
+
"status": "Registered",
|
|
59
|
+
"abn": "99001234567",
|
|
60
|
+
"type": null,
|
|
61
|
+
"companyClass": null,
|
|
62
|
+
"subClass": null,
|
|
63
|
+
"registeredAt": null,
|
|
64
|
+
"deregisteredAt": null,
|
|
65
|
+
"previousState": null,
|
|
66
|
+
"stateRegistrationNumber": null,
|
|
67
|
+
"currentName": null,
|
|
68
|
+
"currentNameIndicator": null,
|
|
69
|
+
"currentNameStartedAt": null
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"register": "companies",
|
|
73
|
+
"source": {
|
|
74
|
+
"datasetId": "asic-companies",
|
|
75
|
+
"resourceId": "fictional-example",
|
|
76
|
+
"url": "https://data.gov.au/",
|
|
77
|
+
"modifiedAt": "2026-09-30T00:00:00Z",
|
|
78
|
+
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
79
|
+
"bytes": 100,
|
|
80
|
+
"format": "CSV",
|
|
81
|
+
"observedAt": "2026-10-01T00:00:00Z",
|
|
82
|
+
"license": "http://creativecommons.org/licenses/by/3.0/au/"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Operation } from "../runtime/http.js";
|
|
2
|
+
export type OperationName = "lookup" | "search";
|
|
3
|
+
/** The operations of Comms.ID Company, with the schemas the client checks. */
|
|
4
|
+
export declare const operations: Readonly<Record<OperationName, Operation>>;
|
|
5
|
+
/** The error codes the contract documents for each operation. */
|
|
6
|
+
export declare const errorCodes: Readonly<Record<OperationName, readonly string[]>>;
|