Skip to content

Commit a23b4f4

Browse files
committed
feat: publish TrUAPI artifacts package
1 parent a7fa645 commit a23b4f4

10 files changed

Lines changed: 6927 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9+
"build:artifacts": "node --experimental-strip-types scripts/build-npm-artifacts.mjs",
910
"lint": "eslint .",
1011
"preview": "vite preview"
1112
},

packages/truapi/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Parity Technologies
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/truapi/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# @useragent-kit/truapi
2+
3+
Versioned TrUAPI protocol artifacts for products and hosts.
4+
5+
## Usage
6+
7+
```ts
8+
import { manifest, methods, type TrUApiMethodName } from "@useragent-kit/truapi/v0.2";
9+
10+
const firstMethod: TrUApiMethodName = methods[0].name;
11+
console.log(manifest.protocol.version, firstMethod);
12+
```
13+
14+
The raw manifest is also available at `@useragent-kit/truapi/v0.2/manifest.json`.

packages/truapi/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./v0.2/index.js";
2+
export { default } from "./v0.2/index.js";

packages/truapi/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./v0.2/index.js";
2+
export { default } from "./v0.2/index.js";

packages/truapi/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@useragent-kit/truapi",
3+
"version": "0.2.0",
4+
"description": "Versioned TrUAPI protocol artifacts: TypeScript types, method registry, and manifest.",
5+
"type": "module",
6+
"exports": {
7+
".": {
8+
"types": "./index.d.ts",
9+
"import": "./index.js"
10+
},
11+
"./v0.2": {
12+
"types": "./v0.2/index.d.ts",
13+
"import": "./v0.2/index.js"
14+
},
15+
"./v0.2/manifest.json": "./v0.2/manifest.json"
16+
},
17+
"files": [
18+
"LICENSE",
19+
"README.md",
20+
"index.d.ts",
21+
"index.js",
22+
"v0.2"
23+
],
24+
"sideEffects": false,
25+
"publishConfig": {
26+
"access": "public"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "git+https://github.com/paritytech/truapi.git",
31+
"directory": "packages/truapi"
32+
},
33+
"license": "MIT"
34+
}

packages/truapi/v0.2/index.d.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
export type TrUApiMethodKind = "request" | "subscription" | "reverse-subscription";
2+
export type TrUApiMethodName = "host_feature_supported" | "host_navigate_to" | "host_push_notification" | "host_device_permission" | "remote_permission" | "host_local_storage_read" | "host_local_storage_write" | "host_local_storage_clear" | "host_account_get" | "host_account_get_alias" | "host_account_create_proof" | "host_get_legacy_accounts" | "host_account_connection_status_subscribe" | "host_get_user_id" | "host_request_login" | "host_sign_payload" | "host_sign_raw" | "host_sign_raw_with_legacy_account" | "host_sign_payload_with_legacy_account" | "host_create_transaction" | "host_create_transaction_with_legacy_account" | "host_chat_create_room" | "host_chat_create_simple_group" | "host_chat_register_bot" | "host_chat_post_message" | "host_chat_list_subscribe" | "host_chat_action_subscribe" | "product_chat_custom_message_render_subscribe" | "remote_statement_store_subscribe" | "remote_statement_store_create_proof" | "remote_statement_store_submit" | "remote_preimage_lookup_subscribe" | "remote_chain_head_follow" | "remote_chain_head_header" | "remote_chain_head_body" | "remote_chain_head_storage" | "remote_chain_head_call" | "remote_chain_head_unpin" | "remote_chain_head_continue" | "remote_chain_head_stop_operation" | "remote_chain_spec_genesis_hash" | "remote_chain_spec_chain_name" | "remote_chain_spec_properties" | "remote_chain_transaction_broadcast" | "remote_chain_transaction_stop" | "host_payment_balance_subscribe" | "host_payment_top_up" | "host_payment_request" | "host_payment_status_subscribe" | "host_derive_entropy" | "host_theme_subscribe";
3+
export type TrUApiDataTypeName = "str" | "bool" | "u8" | "u32" | "u64" | "u128" | "compact" | "Hex" | "Bytes" | "BytesN" | "_void" | "Option" | "Nullable" | "Vector" | "Tuple" | "Struct" | "Enum" | "Status" | "Result" | "ErrEnum" | "GenesisHash" | "GenericErr" | "GenericError" | "AccountId" | "PublicKey" | "DotNsIdentifier" | "DerivationIndex" | "ProductAccountId" | "ProductAccount" | "LegacyAccount" | "ContextualAlias" | "RingLocationHint" | "RingLocation" | "RingVrfProof" | "AccountConnectionStatus" | "LoginResult" | "LoginError" | "UserIdentity" | "UserIdentityErr" | "RequestCredentialsErr" | "CreateProofErr" | "SigningPayload" | "RawPayload" | "SigningRawPayload" | "SigningPayloadPayload" | "SigningRawPayloadWithoutAccount" | "SigningPayloadWithoutAccount" | "SigningResult" | "SigningErr" | "TxPayloadExtensionV1" | "TxPayloadContextV1" | "TxPayloadV1" | "VersionedTxPayload" | "CreateTransactionErr" | "StorageKey" | "StorageValue" | "StorageErr" | "NavigateToErr" | "PushNotification" | "DevicePermission" | "RemotePermission" | "Feature" | "ChatRoomRequest" | "ChatRoomRegistrationStatus" | "ChatRoomRegistrationResult" | "SimpleGroupChatRequest" | "SimpleGroupChatResult" | "ChatBotRequest" | "ChatBotRegistrationStatus" | "ChatBotRegistrationResult" | "ChatRoomParticipation" | "ChatRoom" | "ChatAction" | "ChatActionLayout" | "ChatActions" | "ChatMedia" | "ChatRichText" | "ChatFile" | "ChatReaction" | "ChatCustomMessage" | "ChatMessageContent" | "ChatPostMessageResult" | "ActionTrigger" | "ChatCommand" | "ChatActionPayload" | "ReceivedChatAction" | "ChatRoomRegistrationErr" | "ChatBotRegistrationErr" | "ChatMessagePostingErr" | "Size" | "Dimensions" | "TypographyStyle" | "ButtonVariant" | "ColorToken" | "ContentAlignment" | "HorizontalAlignment" | "VerticalAlignment" | "Arrangement" | "Shape" | "BorderStyle" | "Modifier" | "CustomRendererNode" | "BlockHash" | "OperationId" | "RuntimeApi" | "RuntimeSpec" | "RuntimeType" | "StorageQueryType" | "StorageQueryItem" | "StorageResultItem" | "OperationStartedResult" | "ChainHeadEvent" | "Topic" | "Channel" | "DecryptionKey" | "TopicFilter" | "StatementProof" | "Statement" | "SignedStatement" | "SignedStatementsPage" | "StatementProofErr" | "PreimageKey" | "PreimageValue" | "Balance" | "PaymentId" | "Ed25519PrivateKey" | "PaymentBalance" | "PaymentTopUpSource" | "PaymentReceipt" | "PaymentStatus" | "PaymentBalanceErr" | "PaymentTopUpErr" | "PaymentRequestErr" | "PaymentStatusErr" | "Entropy" | "DeriveEntropyErr" | "Theme";
4+
5+
export interface TrUApiMethodArtifact {
6+
readonly name: TrUApiMethodName;
7+
readonly tag: number;
8+
readonly kind: TrUApiMethodKind;
9+
readonly group: string;
10+
readonly request: string;
11+
readonly response: string;
12+
readonly errorType: string | null;
13+
}
14+
15+
export interface TrUApiGroupArtifact {
16+
readonly id: string;
17+
readonly name: string;
18+
readonly description: string;
19+
readonly methods: readonly TrUApiMethodName[];
20+
}
21+
22+
export interface TrUApiDataTypeArtifact {
23+
readonly id: TrUApiDataTypeName;
24+
readonly name: string;
25+
readonly category: string;
26+
readonly source: string | null;
27+
readonly definition: string;
28+
readonly description: string;
29+
readonly fields: readonly { readonly name: string; readonly type: string; readonly description: string }[];
30+
readonly variants: readonly { readonly name: string; readonly type: string; readonly description: string }[];
31+
}
32+
33+
export interface TrUApiManifest {
34+
readonly schemaVersion: 1;
35+
readonly protocol: {
36+
readonly name: "TrUAPI";
37+
readonly version: "0.2";
38+
readonly source: { readonly repo: string; readonly path: string; readonly revision: string };
39+
readonly transport: "message-port";
40+
readonly wireFormat: "scale-host-api";
41+
};
42+
readonly methods: readonly TrUApiMethodArtifact[];
43+
readonly groups: readonly TrUApiGroupArtifact[];
44+
readonly dataTypes: readonly TrUApiDataTypeArtifact[];
45+
readonly deprecatedAliases: Readonly<Record<string, TrUApiMethodName>>;
46+
}
47+
48+
export declare const manifest: TrUApiManifest;
49+
export declare const methods: readonly TrUApiMethodArtifact[];
50+
export declare const groups: readonly TrUApiGroupArtifact[];
51+
export declare const dataTypes: readonly TrUApiDataTypeArtifact[];
52+
export declare const protocolVersion: "0.2";
53+
export default manifest;

0 commit comments

Comments
 (0)