@comms-id/asx 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 +16 -0
- package/dist/generated/operations.d.ts +6 -0
- package/dist/generated/operations.js +894 -0
- package/dist/generated/types.d.ts +135 -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/asx
|
|
2
|
+
|
|
3
|
+
Typed client for the Comms.ID ASX API (`https://api.comms.id/asx/v1`): ASX-listed companies: suggest as a user types, and look one up.
|
|
4
|
+
|
|
5
|
+
`src/` is generated from the ASX contract (`packages/asx-service/openapi/asx.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 { createAsxClient } from "@comms-id/asx/server";
|
|
9
|
+
|
|
10
|
+
const client = createAsxClient({
|
|
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({"ticker": "BHP"});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Operations
|
|
18
|
+
|
|
19
|
+
- `lookup`: Look up an ASX-listed company by ticker, live or from the stored directory.
|
|
20
|
+
- `suggest`: Suggest ASX-listed companies for a ticker or name prefix, at most ten.
|
|
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
|
+
`createAsxFixtureClient()` from `@comms-id/asx/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 AsxClient } 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 createAsxBrowserClient: (options: BrowserOptions) => AsxClient;
|
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 createAsxBrowserClient = (options) => buildClient(createBrowserTransport(options));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const asxProduct: {
|
|
2
|
+
readonly product: "asx";
|
|
3
|
+
readonly audience: "asx-lookup";
|
|
4
|
+
readonly scope: "asx";
|
|
5
|
+
readonly maxBodyBytes: 16384;
|
|
6
|
+
readonly operations: readonly [{
|
|
7
|
+
readonly name: "lookup";
|
|
8
|
+
readonly method: "POST";
|
|
9
|
+
readonly path: "/asx/v1/lookup";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "suggest";
|
|
12
|
+
readonly method: "POST";
|
|
13
|
+
readonly path: "/asx/v1/suggest";
|
|
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 asxProduct = {
|
|
4
|
+
product: "asx",
|
|
5
|
+
audience: "asx-lookup",
|
|
6
|
+
scope: "asx",
|
|
7
|
+
maxBodyBytes: 16_384,
|
|
8
|
+
operations: [
|
|
9
|
+
{
|
|
10
|
+
"name": "lookup",
|
|
11
|
+
"method": "POST",
|
|
12
|
+
"path": "/asx/v1/lookup"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "suggest",
|
|
16
|
+
"method": "POST",
|
|
17
|
+
"path": "/asx/v1/suggest"
|
|
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 createAsxFixtureClient = () => ({
|
|
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, SuggestRequest, SuggestResponse } from "./types.js";
|
|
3
|
+
/** The client of Comms.ID ASX: one method for each operation. */
|
|
4
|
+
export interface AsxClient {
|
|
5
|
+
/** Look up an ASX-listed company by ticker, live or from the stored directory. */
|
|
6
|
+
readonly lookup: (input: LookupRequest, options?: CallOptions) => Promise<LookupResponse>;
|
|
7
|
+
/** Suggest ASX-listed companies for a ticker or name prefix, at most ten. */
|
|
8
|
+
readonly suggest: (input: SuggestRequest, options?: CallOptions) => Promise<SuggestResponse>;
|
|
9
|
+
}
|
|
10
|
+
export declare const buildClient: (transport: TransportConfig) => AsxClient;
|
|
@@ -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
|
+
suggest: (input, options) => call(transport, operations.suggest, input, options),
|
|
7
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
"/asx/v1/lookup": {
|
|
6
|
+
"status": "missing",
|
|
7
|
+
"source": "live",
|
|
8
|
+
"startedAt": "2026-10-03T00:00:00.000Z",
|
|
9
|
+
"observedAt": "2026-10-03T00:00:01.000Z"
|
|
10
|
+
},
|
|
11
|
+
"/asx/v1/suggest": {
|
|
12
|
+
"source": "live",
|
|
13
|
+
"directoryObservedAt": "2026-10-03T00:00:00.000Z",
|
|
14
|
+
"suggestions": []
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Operation } from "../runtime/http.js";
|
|
2
|
+
export type OperationName = "lookup" | "suggest";
|
|
3
|
+
/** The operations of Comms.ID ASX, 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[]>>;
|