@meshtrade/api-web 1.30.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/README.md +68 -0
- package/dist/buf/validate/validate_pb.d.ts +4597 -0
- package/dist/buf/validate/validate_pb.js +354 -0
- package/dist/google/type/date_pb.d.ts +52 -0
- package/dist/google/type/date_pb.js +26 -0
- package/dist/meshtrade/common/config.d.ts +7 -0
- package/dist/meshtrade/common/config.js +9 -0
- package/dist/meshtrade/common/connectInterceptors.d.ts +73 -0
- package/dist/meshtrade/common/connectInterceptors.js +126 -0
- package/dist/meshtrade/common/validation.d.ts +62 -0
- package/dist/meshtrade/common/validation.js +77 -0
- package/dist/meshtrade/compliance/client/v1/client_pb.d.ts +138 -0
- package/dist/meshtrade/compliance/client/v1/client_pb.js +23 -0
- package/dist/meshtrade/compliance/client/v1/company_pb.d.ts +313 -0
- package/dist/meshtrade/compliance/client/v1/company_pb.js +100 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_pb.d.ts +81 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_pb.js +22 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.d.ts +88 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.js +95 -0
- package/dist/meshtrade/compliance/client/v1/fund_pb.d.ts +65 -0
- package/dist/meshtrade/compliance/client/v1/fund_pb.js +18 -0
- package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.d.ts +55 -0
- package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.js +62 -0
- package/dist/meshtrade/compliance/client/v1/index.d.ts +16 -0
- package/dist/meshtrade/compliance/client/v1/index.js +59 -0
- package/dist/meshtrade/compliance/client/v1/industry_classification_pb.d.ts +86 -0
- package/dist/meshtrade/compliance/client/v1/industry_classification_pb.js +16 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.d.ts +133 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.js +140 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_pb.d.ts +143 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_pb.js +24 -0
- package/dist/meshtrade/compliance/client/v1/pep_status_pb.d.ts +46 -0
- package/dist/meshtrade/compliance/client/v1/pep_status_pb.js +53 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.d.ts +123 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.js +45 -0
- package/dist/meshtrade/compliance/client/v1/service_web_meshts.d.ts +48 -0
- package/dist/meshtrade/compliance/client/v1/service_web_meshts.js +92 -0
- package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.d.ts +180 -0
- package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.js +187 -0
- package/dist/meshtrade/compliance/client/v1/tax_residency_pb.d.ts +40 -0
- package/dist/meshtrade/compliance/client/v1/tax_residency_pb.js +17 -0
- package/dist/meshtrade/compliance/client/v1/trust_pb.d.ts +65 -0
- package/dist/meshtrade/compliance/client/v1/trust_pb.js +18 -0
- package/dist/meshtrade/compliance/client/v1/verification_status_pb.d.ts +57 -0
- package/dist/meshtrade/compliance/client/v1/verification_status_pb.js +64 -0
- package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.d.ts +43 -0
- package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.js +17 -0
- package/dist/meshtrade/iam/api_user/v1/api_user_pb.d.ts +152 -0
- package/dist/meshtrade/iam/api_user/v1/api_user_pb.js +95 -0
- package/dist/meshtrade/iam/api_user/v1/index.d.ts +4 -0
- package/dist/meshtrade/iam/api_user/v1/index.js +45 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.d.ts +343 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.js +86 -0
- package/dist/meshtrade/iam/api_user/v1/service_web_meshts.d.ts +84 -0
- package/dist/meshtrade/iam/api_user/v1/service_web_meshts.js +152 -0
- package/dist/meshtrade/iam/group/v1/group_pb.d.ts +58 -0
- package/dist/meshtrade/iam/group/v1/group_pb.js +17 -0
- package/dist/meshtrade/iam/group/v1/index.d.ts +3 -0
- package/dist/meshtrade/iam/group/v1/index.js +44 -0
- package/dist/meshtrade/iam/group/v1/service_pb.d.ts +306 -0
- package/dist/meshtrade/iam/group/v1/service_pb.js +75 -0
- package/dist/meshtrade/iam/group/v1/service_web_meshts.d.ts +60 -0
- package/dist/meshtrade/iam/group/v1/service_web_meshts.js +112 -0
- package/dist/meshtrade/iam/role/v1/index.d.ts +2 -0
- package/dist/meshtrade/iam/role/v1/index.js +43 -0
- package/dist/meshtrade/iam/role/v1/role.d.ts +71 -0
- package/dist/meshtrade/iam/role/v1/role.js +192 -0
- package/dist/meshtrade/iam/role/v1/role_pb.d.ts +164 -0
- package/dist/meshtrade/iam/role/v1/role_pb.js +171 -0
- package/dist/meshtrade/iam/user/v1/index.d.ts +3 -0
- package/dist/meshtrade/iam/user/v1/index.js +44 -0
- package/dist/meshtrade/iam/user/v1/service_pb.d.ts +379 -0
- package/dist/meshtrade/iam/user/v1/service_pb.js +90 -0
- package/dist/meshtrade/iam/user/v1/service_web_meshts.d.ts +78 -0
- package/dist/meshtrade/iam/user/v1/service_web_meshts.js +142 -0
- package/dist/meshtrade/iam/user/v1/user_pb.d.ts +58 -0
- package/dist/meshtrade/iam/user/v1/user_pb.js +17 -0
- package/dist/meshtrade/ledger/transaction/v1/index.d.ts +5 -0
- package/dist/meshtrade/ledger/transaction/v1/index.js +46 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.d.ts +102 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.js +41 -0
- package/dist/meshtrade/ledger/transaction/v1/service_web_meshts.d.ts +50 -0
- package/dist/meshtrade/ledger/transaction/v1/service_web_meshts.js +91 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.d.ts +46 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.js +53 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state.d.ts +14 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state.js +64 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.d.ts +50 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.js +57 -0
- package/dist/meshtrade/market_data/price/v1/index.d.ts +3 -0
- package/dist/meshtrade/market_data/price/v1/index.js +44 -0
- package/dist/meshtrade/market_data/price/v1/price_pb.d.ts +50 -0
- package/dist/meshtrade/market_data/price/v1/price_pb.js +19 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.d.ts +48 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.js +27 -0
- package/dist/meshtrade/market_data/price/v1/service_web_meshts.d.ts +36 -0
- package/dist/meshtrade/market_data/price/v1/service_web_meshts.js +72 -0
- package/dist/meshtrade/option/method_options/v1/index.d.ts +1 -0
- package/dist/meshtrade/option/method_options/v1/index.js +42 -0
- package/dist/meshtrade/option/method_options/v1/method_options_pb.d.ts +132 -0
- package/dist/meshtrade/option/method_options/v1/method_options_pb.js +108 -0
- package/dist/meshtrade/reporting/account_report/v1/account_report_pb.d.ts +136 -0
- package/dist/meshtrade/reporting/account_report/v1/account_report_pb.js +28 -0
- package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.d.ts +39 -0
- package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.js +16 -0
- package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.d.ts +66 -0
- package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.js +18 -0
- package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.d.ts +139 -0
- package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.js +80 -0
- package/dist/meshtrade/reporting/account_report/v1/index.d.ts +7 -0
- package/dist/meshtrade/reporting/account_report/v1/index.js +48 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.d.ts +162 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.js +46 -0
- package/dist/meshtrade/reporting/account_report/v1/service_web_meshts.d.ts +42 -0
- package/dist/meshtrade/reporting/account_report/v1/service_web_meshts.js +82 -0
- package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.d.ts +80 -0
- package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.js +18 -0
- package/dist/meshtrade/studio/instrument/v1/index.d.ts +3 -0
- package/dist/meshtrade/studio/instrument/v1/index.js +44 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_pb.d.ts +53 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_pb.js +18 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.d.ts +214 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.js +221 -0
- package/dist/meshtrade/studio/instrument/v1/unit_pb.d.ts +148 -0
- package/dist/meshtrade/studio/instrument/v1/unit_pb.js +155 -0
- package/dist/meshtrade/trading/limit_order/v1/index.d.ts +3 -0
- package/dist/meshtrade/trading/limit_order/v1/index.js +44 -0
- package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.d.ts +211 -0
- package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.js +111 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.d.ts +357 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.js +73 -0
- package/dist/meshtrade/trading/limit_order/v1/service_web_meshts.d.ts +81 -0
- package/dist/meshtrade/trading/limit_order/v1/service_web_meshts.js +141 -0
- package/dist/meshtrade/trading/market_order/v1/index.d.ts +3 -0
- package/dist/meshtrade/trading/market_order/v1/index.js +44 -0
- package/dist/meshtrade/trading/market_order/v1/market_order_pb.d.ts +20 -0
- package/dist/meshtrade/trading/market_order/v1/market_order_pb.js +16 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.d.ts +34 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.js +22 -0
- package/dist/meshtrade/trading/market_order/v1/service_web_meshts.d.ts +36 -0
- package/dist/meshtrade/trading/market_order/v1/service_web_meshts.js +72 -0
- package/dist/meshtrade/type/v1/address_pb.d.ts +82 -0
- package/dist/meshtrade/type/v1/address_pb.js +16 -0
- package/dist/meshtrade/type/v1/amount.d.ts +13 -0
- package/dist/meshtrade/type/v1/amount.js +68 -0
- package/dist/meshtrade/type/v1/amountWrapper.d.ts +74 -0
- package/dist/meshtrade/type/v1/amountWrapper.js +98 -0
- package/dist/meshtrade/type/v1/amount_pb.d.ts +44 -0
- package/dist/meshtrade/type/v1/amount_pb.js +18 -0
- package/dist/meshtrade/type/v1/contact_details_pb.d.ts +98 -0
- package/dist/meshtrade/type/v1/contact_details_pb.js +16 -0
- package/dist/meshtrade/type/v1/date.d.ts +49 -0
- package/dist/meshtrade/type/v1/date.js +136 -0
- package/dist/meshtrade/type/v1/date_pb.d.ts +50 -0
- package/dist/meshtrade/type/v1/date_pb.js +16 -0
- package/dist/meshtrade/type/v1/decimalConversions.d.ts +24 -0
- package/dist/meshtrade/type/v1/decimalConversions.js +39 -0
- package/dist/meshtrade/type/v1/decimal_pb.d.ts +24 -0
- package/dist/meshtrade/type/v1/decimal_pb.js +16 -0
- package/dist/meshtrade/type/v1/index.d.ts +15 -0
- package/dist/meshtrade/type/v1/index.js +56 -0
- package/dist/meshtrade/type/v1/ledger.d.ts +27 -0
- package/dist/meshtrade/type/v1/ledger.js +115 -0
- package/dist/meshtrade/type/v1/ledger_pb.d.ts +83 -0
- package/dist/meshtrade/type/v1/ledger_pb.js +90 -0
- package/dist/meshtrade/type/v1/sorting_pb.d.ts +35 -0
- package/dist/meshtrade/type/v1/sorting_pb.js +42 -0
- package/dist/meshtrade/type/v1/time_of_day.d.ts +74 -0
- package/dist/meshtrade/type/v1/time_of_day.js +199 -0
- package/dist/meshtrade/type/v1/time_of_day_pb.d.ts +67 -0
- package/dist/meshtrade/type/v1/time_of_day_pb.js +16 -0
- package/dist/meshtrade/type/v1/token.d.ts +4 -0
- package/dist/meshtrade/type/v1/token.js +23 -0
- package/dist/meshtrade/type/v1/tokenWrapper.d.ts +49 -0
- package/dist/meshtrade/type/v1/tokenWrapper.js +92 -0
- package/dist/meshtrade/type/v1/token_pb.d.ts +56 -0
- package/dist/meshtrade/type/v1/token_pb.js +17 -0
- package/dist/meshtrade/wallet/account/v1/account_pb.d.ts +264 -0
- package/dist/meshtrade/wallet/account/v1/account_pb.js +74 -0
- package/dist/meshtrade/wallet/account/v1/index.d.ts +3 -0
- package/dist/meshtrade/wallet/account/v1/index.js +44 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.d.ts +559 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.js +112 -0
- package/dist/meshtrade/wallet/account/v1/service_web_meshts.d.ts +84 -0
- package/dist/meshtrade/wallet/account/v1/service_web_meshts.js +152 -0
- package/package.json +171 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connect-ES interceptors for the Meshtrade API client (Web/Browser).
|
|
3
|
+
*
|
|
4
|
+
* Provides interceptor utilities for use with @connectrpc/connect clients,
|
|
5
|
+
* including group context injection for multi-tenant operations.
|
|
6
|
+
*
|
|
7
|
+
* ## Authentication in Browser Environments
|
|
8
|
+
*
|
|
9
|
+
* The Web SDK uses browser-native cookie-based authentication via the
|
|
10
|
+
* `credentials: 'include'` fetch option. This automatically sends HTTP-only
|
|
11
|
+
* cookies (like AccessToken) with each request, which is the standard and
|
|
12
|
+
* secure authentication pattern for browser applications.
|
|
13
|
+
*
|
|
14
|
+
* Unlike the Node.js SDK which supports explicit API key and JWT interceptors,
|
|
15
|
+
* the Web SDK relies on the browser's automatic cookie handling. This is why
|
|
16
|
+
* this module only provides group context and logging interceptors - authentication
|
|
17
|
+
* is handled implicitly by the browser's cookie mechanism.
|
|
18
|
+
*
|
|
19
|
+
* For backend/server-side authentication needs, use the Node.js SDK instead
|
|
20
|
+
* (@meshtrade/api-node), which provides explicit API key and JWT token support.
|
|
21
|
+
*/
|
|
22
|
+
import { Interceptor } from "@connectrpc/connect";
|
|
23
|
+
/**
|
|
24
|
+
* Creates a Connect-ES interceptor that injects operating group context
|
|
25
|
+
* into API requests by adding an `x-group` header.
|
|
26
|
+
*
|
|
27
|
+
* The group context determines the scope of operations and resource access
|
|
28
|
+
* within the Meshtrade platform's hierarchical group ownership model.
|
|
29
|
+
*
|
|
30
|
+
* This interceptor validates that the provided group follows the correct
|
|
31
|
+
* resource name format: `groups/{ulid}` where {ulid} is a 26-character
|
|
32
|
+
* ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
33
|
+
*
|
|
34
|
+
* @param group - The group resource name in the format `groups/{ulid}` where
|
|
35
|
+
* {ulid} is a 26-character ULID identifier. This determines
|
|
36
|
+
* the operating group context for all API requests.
|
|
37
|
+
* @returns An interceptor function that adds the group header to all requests
|
|
38
|
+
* @throws {Error} If the group format is invalid
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* // Create an interceptor with a valid group resource name
|
|
43
|
+
* const groupInterceptor = createGroupInterceptor('groups/01ARZ3NDEKTSV4YWVF8F5BH32');
|
|
44
|
+
*
|
|
45
|
+
* // Use with a Connect-ES client
|
|
46
|
+
* const transport = createGrpcWebTransport({
|
|
47
|
+
* baseUrl: 'https://api.example.com',
|
|
48
|
+
* interceptors: [groupInterceptor]
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* const client = createPromiseClient(MyService, transport);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function createGroupInterceptor(group: string): Interceptor & {
|
|
55
|
+
groupContext: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Creates a logging interceptor that logs all requests and responses.
|
|
59
|
+
* Useful for debugging and development.
|
|
60
|
+
*
|
|
61
|
+
* @returns An interceptor function that logs request/response details
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const loggingInterceptor = createLoggingInterceptor();
|
|
66
|
+
*
|
|
67
|
+
* const transport = createGrpcWebTransport({
|
|
68
|
+
* baseUrl: 'https://api.example.com',
|
|
69
|
+
* interceptors: [loggingInterceptor]
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function createLoggingInterceptor(): Interceptor;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Connect-ES interceptors for the Meshtrade API client (Web/Browser).
|
|
4
|
+
*
|
|
5
|
+
* Provides interceptor utilities for use with @connectrpc/connect clients,
|
|
6
|
+
* including group context injection for multi-tenant operations.
|
|
7
|
+
*
|
|
8
|
+
* ## Authentication in Browser Environments
|
|
9
|
+
*
|
|
10
|
+
* The Web SDK uses browser-native cookie-based authentication via the
|
|
11
|
+
* `credentials: 'include'` fetch option. This automatically sends HTTP-only
|
|
12
|
+
* cookies (like AccessToken) with each request, which is the standard and
|
|
13
|
+
* secure authentication pattern for browser applications.
|
|
14
|
+
*
|
|
15
|
+
* Unlike the Node.js SDK which supports explicit API key and JWT interceptors,
|
|
16
|
+
* the Web SDK relies on the browser's automatic cookie handling. This is why
|
|
17
|
+
* this module only provides group context and logging interceptors - authentication
|
|
18
|
+
* is handled implicitly by the browser's cookie mechanism.
|
|
19
|
+
*
|
|
20
|
+
* For backend/server-side authentication needs, use the Node.js SDK instead
|
|
21
|
+
* (@meshtrade/api-node), which provides explicit API key and JWT token support.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.createGroupInterceptor = createGroupInterceptor;
|
|
25
|
+
exports.createLoggingInterceptor = createLoggingInterceptor;
|
|
26
|
+
const validation_1 = require("./validation");
|
|
27
|
+
/**
|
|
28
|
+
* Creates a Connect-ES interceptor that injects operating group context
|
|
29
|
+
* into API requests by adding an `x-group` header.
|
|
30
|
+
*
|
|
31
|
+
* The group context determines the scope of operations and resource access
|
|
32
|
+
* within the Meshtrade platform's hierarchical group ownership model.
|
|
33
|
+
*
|
|
34
|
+
* This interceptor validates that the provided group follows the correct
|
|
35
|
+
* resource name format: `groups/{ulid}` where {ulid} is a 26-character
|
|
36
|
+
* ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
37
|
+
*
|
|
38
|
+
* @param group - The group resource name in the format `groups/{ulid}` where
|
|
39
|
+
* {ulid} is a 26-character ULID identifier. This determines
|
|
40
|
+
* the operating group context for all API requests.
|
|
41
|
+
* @returns An interceptor function that adds the group header to all requests
|
|
42
|
+
* @throws {Error} If the group format is invalid
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* // Create an interceptor with a valid group resource name
|
|
47
|
+
* const groupInterceptor = createGroupInterceptor('groups/01ARZ3NDEKTSV4YWVF8F5BH32');
|
|
48
|
+
*
|
|
49
|
+
* // Use with a Connect-ES client
|
|
50
|
+
* const transport = createGrpcWebTransport({
|
|
51
|
+
* baseUrl: 'https://api.example.com',
|
|
52
|
+
* interceptors: [groupInterceptor]
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* const client = createPromiseClient(MyService, transport);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function createGroupInterceptor(group) {
|
|
59
|
+
// Validate the group resource name format
|
|
60
|
+
if (!(0, validation_1.isValidGroupResourceName)(group)) {
|
|
61
|
+
throw new Error(`Invalid group format: "${group}". Group must be in the format "groups/{ulid}" ` +
|
|
62
|
+
`where {ulid} is a 26-character ULID (e.g., "groups/01ARZ3NDEKTSV4YWVF8F5BH32").`);
|
|
63
|
+
}
|
|
64
|
+
// Create the interceptor function
|
|
65
|
+
const interceptor = (next) => async (req) => {
|
|
66
|
+
// Add the x-group header to the request
|
|
67
|
+
req.header.set("x-group", group);
|
|
68
|
+
// Call the next interceptor in the chain
|
|
69
|
+
return await next(req);
|
|
70
|
+
};
|
|
71
|
+
// Add a marker property so we can identify group interceptors
|
|
72
|
+
// This is used in the withGroup method to prevent double-setting
|
|
73
|
+
return Object.assign(interceptor, { groupContext: group });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates a logging interceptor that logs all requests and responses.
|
|
77
|
+
* Useful for debugging and development.
|
|
78
|
+
*
|
|
79
|
+
* @returns An interceptor function that logs request/response details
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const loggingInterceptor = createLoggingInterceptor();
|
|
84
|
+
*
|
|
85
|
+
* const transport = createGrpcWebTransport({
|
|
86
|
+
* baseUrl: 'https://api.example.com',
|
|
87
|
+
* interceptors: [loggingInterceptor]
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
function createLoggingInterceptor() {
|
|
92
|
+
return (next) => async (req) => {
|
|
93
|
+
// Convert headers to plain object for logging
|
|
94
|
+
const headers = {};
|
|
95
|
+
req.header.forEach((value, key) => {
|
|
96
|
+
headers[key] = value;
|
|
97
|
+
});
|
|
98
|
+
// Log the request
|
|
99
|
+
console.log(`[Connect] ${req.method.name} request:`, {
|
|
100
|
+
service: req.service.typeName,
|
|
101
|
+
method: req.method.name,
|
|
102
|
+
headers,
|
|
103
|
+
});
|
|
104
|
+
try {
|
|
105
|
+
// Call the next interceptor and get the response
|
|
106
|
+
const response = await next(req);
|
|
107
|
+
// Log successful response
|
|
108
|
+
console.log(`[Connect] ${req.method.name} response:`, {
|
|
109
|
+
service: req.service.typeName,
|
|
110
|
+
method: req.method.name,
|
|
111
|
+
status: "success",
|
|
112
|
+
});
|
|
113
|
+
return response;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
// Log error
|
|
117
|
+
console.error(`[Connect] ${req.method.name} error:`, {
|
|
118
|
+
service: req.service.typeName,
|
|
119
|
+
method: req.method.name,
|
|
120
|
+
error: error,
|
|
121
|
+
});
|
|
122
|
+
// Re-throw the error
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic validation utilities for Meshtrade API resource names and identifiers.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Validates if a string is a valid ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
6
|
+
*
|
|
7
|
+
* Note: This implementation uses a simplified character set for ULIDs that includes
|
|
8
|
+
* all uppercase letters A-Z and digits 0-9, unlike the standard ULID specification
|
|
9
|
+
* which excludes certain ambiguous characters (I, L, O, U).
|
|
10
|
+
*
|
|
11
|
+
* ULIDs in this system are 26-character identifiers that are:
|
|
12
|
+
* - Lexicographically sortable
|
|
13
|
+
* - Uppercase alphanumeric only
|
|
14
|
+
* - Contain timestamp information for natural ordering
|
|
15
|
+
*
|
|
16
|
+
* @param ulid - The string to validate as a ULID
|
|
17
|
+
* @returns true if the string is a valid ULID format, false otherwise
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* isValidULID('01ARZ3NDEKTSV4YWVF8F5BH32'); // true
|
|
22
|
+
* isValidULID('invalid'); // false
|
|
23
|
+
* isValidULID('01arz3ndektsv4ywvf8f5bh32'); // false (lowercase)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function isValidULID(ulid: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Validates if a resource name follows the groups/{ulid} format.
|
|
29
|
+
*
|
|
30
|
+
* Group resource names in the Meshtrade API follow the pattern "groups/{ulid}"
|
|
31
|
+
* where {ulid} is a 26-character ULID identifier.
|
|
32
|
+
*
|
|
33
|
+
* @param resourceName - The resource name string to validate
|
|
34
|
+
* @returns true if the resource name is a valid group resource name, false otherwise
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* isValidGroupResourceName('groups/01ARZ3NDEKTSV4YWVF8F5BH32'); // true
|
|
39
|
+
* isValidGroupResourceName('groups/invalid'); // false
|
|
40
|
+
* isValidGroupResourceName('users/01ARZ3NDEKTSV4YWVF8F5BH32'); // false
|
|
41
|
+
* isValidGroupResourceName('01ARZ3NDEKTSV4YWVF8F5BH32'); // false
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function isValidGroupResourceName(resourceName: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Validates a protobuf request message before sending to the server.
|
|
47
|
+
*
|
|
48
|
+
* This function serves as a client-side validation hook that can be extended
|
|
49
|
+
* to include protovalidate integration or other validation logic.
|
|
50
|
+
*
|
|
51
|
+
* Currently performs basic null/undefined checks. Future enhancements may include
|
|
52
|
+
* protovalidate integration for comprehensive message validation.
|
|
53
|
+
*
|
|
54
|
+
* @param request - The protobuf request message to validate
|
|
55
|
+
* @throws {Error} If the request is null or undefined
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* validateRequest(myRequest); // Throws if request is invalid
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateRequest(request: unknown): void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic validation utilities for Meshtrade API resource names and identifiers.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidULID = isValidULID;
|
|
7
|
+
exports.isValidGroupResourceName = isValidGroupResourceName;
|
|
8
|
+
exports.validateRequest = validateRequest;
|
|
9
|
+
/**
|
|
10
|
+
* Validates if a string is a valid ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
11
|
+
*
|
|
12
|
+
* Note: This implementation uses a simplified character set for ULIDs that includes
|
|
13
|
+
* all uppercase letters A-Z and digits 0-9, unlike the standard ULID specification
|
|
14
|
+
* which excludes certain ambiguous characters (I, L, O, U).
|
|
15
|
+
*
|
|
16
|
+
* ULIDs in this system are 26-character identifiers that are:
|
|
17
|
+
* - Lexicographically sortable
|
|
18
|
+
* - Uppercase alphanumeric only
|
|
19
|
+
* - Contain timestamp information for natural ordering
|
|
20
|
+
*
|
|
21
|
+
* @param ulid - The string to validate as a ULID
|
|
22
|
+
* @returns true if the string is a valid ULID format, false otherwise
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* isValidULID('01ARZ3NDEKTSV4YWVF8F5BH32'); // true
|
|
27
|
+
* isValidULID('invalid'); // false
|
|
28
|
+
* isValidULID('01arz3ndektsv4ywvf8f5bh32'); // false (lowercase)
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function isValidULID(ulid) {
|
|
32
|
+
return /^[0-9A-Z]{26}$/.test(ulid);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validates if a resource name follows the groups/{ulid} format.
|
|
36
|
+
*
|
|
37
|
+
* Group resource names in the Meshtrade API follow the pattern "groups/{ulid}"
|
|
38
|
+
* where {ulid} is a 26-character ULID identifier.
|
|
39
|
+
*
|
|
40
|
+
* @param resourceName - The resource name string to validate
|
|
41
|
+
* @returns true if the resource name is a valid group resource name, false otherwise
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* isValidGroupResourceName('groups/01ARZ3NDEKTSV4YWVF8F5BH32'); // true
|
|
46
|
+
* isValidGroupResourceName('groups/invalid'); // false
|
|
47
|
+
* isValidGroupResourceName('users/01ARZ3NDEKTSV4YWVF8F5BH32'); // false
|
|
48
|
+
* isValidGroupResourceName('01ARZ3NDEKTSV4YWVF8F5BH32'); // false
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
function isValidGroupResourceName(resourceName) {
|
|
52
|
+
return /^groups\/[0-9A-Z]{26}$/.test(resourceName);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validates a protobuf request message before sending to the server.
|
|
56
|
+
*
|
|
57
|
+
* This function serves as a client-side validation hook that can be extended
|
|
58
|
+
* to include protovalidate integration or other validation logic.
|
|
59
|
+
*
|
|
60
|
+
* Currently performs basic null/undefined checks. Future enhancements may include
|
|
61
|
+
* protovalidate integration for comprehensive message validation.
|
|
62
|
+
*
|
|
63
|
+
* @param request - The protobuf request message to validate
|
|
64
|
+
* @throws {Error} If the request is null or undefined
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* validateRequest(myRequest); // Throws if request is invalid
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
function validateRequest(request) {
|
|
72
|
+
if (request === null || request === undefined) {
|
|
73
|
+
throw new Error("Request cannot be null or undefined");
|
|
74
|
+
}
|
|
75
|
+
// Future: Integrate protovalidate for comprehensive message validation
|
|
76
|
+
// For now, basic validation is sufficient as the server also validates
|
|
77
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
3
|
+
import type { Company } from "./company_pb";
|
|
4
|
+
import type { Fund } from "./fund_pb";
|
|
5
|
+
import type { NaturalPerson } from "./natural_person_pb";
|
|
6
|
+
import type { Trust } from "./trust_pb";
|
|
7
|
+
import type { VerificationStatus } from "./verification_status_pb";
|
|
8
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
9
|
+
/**
|
|
10
|
+
* Describes the file meshtrade/compliance/client/v1/client.proto.
|
|
11
|
+
*/
|
|
12
|
+
export declare const file_meshtrade_compliance_client_v1_client: GenFile;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Client represents an authorized legal entity, which can be either an individual (KYC)
|
|
16
|
+
* or a business (KYB). It serves as the central resource for all compliance information
|
|
17
|
+
* and verification status related to a single party.
|
|
18
|
+
*
|
|
19
|
+
* @generated from message meshtrade.compliance.client.v1.Client
|
|
20
|
+
*/
|
|
21
|
+
export type Client = Message<"meshtrade.compliance.client.v1.Client"> & {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* The unique, immutable, and canonical name of the client resource in the format clients/{client_id}.
|
|
25
|
+
* The {client_id} is a system-generated unique identifier (e.g., UUID) that will never change. This name field will never change and should be used as the permanent primary key for this resource in all systems.
|
|
26
|
+
* System set on creation.
|
|
27
|
+
*
|
|
28
|
+
* @generated from field: string name = 1;
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* The resource name of the group that owns this client in the format groups/{group_id}.
|
|
34
|
+
* This field establishes the ownership link and can be updated if the client's ownership changes,
|
|
35
|
+
* without affecting the client's stable `name`.
|
|
36
|
+
* The executing user needs to have permission to perform client.Create in this group.
|
|
37
|
+
* Required on creation.
|
|
38
|
+
*
|
|
39
|
+
* @generated from field: string owner = 2;
|
|
40
|
+
*/
|
|
41
|
+
owner: string;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* A non-unique, user-provided name for the client, used for display purposes
|
|
45
|
+
* in user interfaces and reports.
|
|
46
|
+
* Required on creation.
|
|
47
|
+
*
|
|
48
|
+
* @generated from field: string display_name = 3;
|
|
49
|
+
*/
|
|
50
|
+
displayName: string;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* Contains the specific data for the legal entity type.
|
|
54
|
+
* Only one of these may be set at a time.
|
|
55
|
+
*
|
|
56
|
+
* @generated from oneof meshtrade.compliance.client.v1.Client.legal_person
|
|
57
|
+
*/
|
|
58
|
+
legalPerson: {
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* Set when the legal entity is an individual human being.
|
|
62
|
+
*
|
|
63
|
+
* @generated from field: meshtrade.compliance.client.v1.NaturalPerson natural_person = 4;
|
|
64
|
+
*/
|
|
65
|
+
value: NaturalPerson;
|
|
66
|
+
case: "naturalPerson";
|
|
67
|
+
} | {
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* Set when the legal entity is a company or corporation.
|
|
71
|
+
*
|
|
72
|
+
* @generated from field: meshtrade.compliance.client.v1.Company company = 5;
|
|
73
|
+
*/
|
|
74
|
+
value: Company;
|
|
75
|
+
case: "company";
|
|
76
|
+
} | {
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* Set when the legal entity is an investment fund.
|
|
80
|
+
*
|
|
81
|
+
* @generated from field: meshtrade.compliance.client.v1.Fund fund = 6;
|
|
82
|
+
*/
|
|
83
|
+
value: Fund;
|
|
84
|
+
case: "fund";
|
|
85
|
+
} | {
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* Set when the legal entity is a trust.
|
|
89
|
+
*
|
|
90
|
+
* @generated from field: meshtrade.compliance.client.v1.Trust trust = 7;
|
|
91
|
+
*/
|
|
92
|
+
value: Trust;
|
|
93
|
+
case: "trust";
|
|
94
|
+
} | {
|
|
95
|
+
case: undefined;
|
|
96
|
+
value?: undefined;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* The definitive, most recent compliance status of the client (e.g., VERIFICATION_STATUS_VERIFIED, VERIFICATION_STATUS_FAILED).
|
|
101
|
+
* Must always be a valid field
|
|
102
|
+
*
|
|
103
|
+
* @generated from field: meshtrade.compliance.client.v1.VerificationStatus verification_status = 8;
|
|
104
|
+
*/
|
|
105
|
+
verificationStatus: VerificationStatus;
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* The resource name of the client (acting as a verifier) that last set the
|
|
109
|
+
* `verification_status`. This provides an audit trail for status changes.
|
|
110
|
+
* System set when verification_status changes.
|
|
111
|
+
*
|
|
112
|
+
* @generated from field: string verification_authority = 9;
|
|
113
|
+
*/
|
|
114
|
+
verificationAuthority: string;
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* The timestamp when the `verification_status` was last set to a conclusive
|
|
118
|
+
* state, specifically `VERIFICATION_STATUS_VERIFIED`.
|
|
119
|
+
* System set when verification_status changes to VERIFICATION_STATUS_VERIFIED.
|
|
120
|
+
*
|
|
121
|
+
* @generated from field: google.protobuf.Timestamp verification_date = 10;
|
|
122
|
+
*/
|
|
123
|
+
verificationDate?: Timestamp;
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* The timestamp indicating when the client's next periodic compliance review
|
|
127
|
+
* is due. This field drives re-verification workflows.
|
|
128
|
+
* Optional for Verification.
|
|
129
|
+
*
|
|
130
|
+
* @generated from field: google.protobuf.Timestamp next_verification_date = 11;
|
|
131
|
+
*/
|
|
132
|
+
nextVerificationDate?: Timestamp;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Describes the message meshtrade.compliance.client.v1.Client.
|
|
136
|
+
* Use `create(ClientSchema)` to create a new message.
|
|
137
|
+
*/
|
|
138
|
+
export declare const ClientSchema: GenMessage<Client>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
|
|
3
|
+
// @generated from file meshtrade/compliance/client/v1/client.proto (package meshtrade.compliance.client.v1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ClientSchema = exports.file_meshtrade_compliance_client_v1_client = void 0;
|
|
7
|
+
const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
|
|
8
|
+
const validate_pb_1 = require("../../../../buf/validate/validate_pb");
|
|
9
|
+
const wkt_1 = require("@bufbuild/protobuf/wkt");
|
|
10
|
+
const company_pb_1 = require("./company_pb");
|
|
11
|
+
const fund_pb_1 = require("./fund_pb");
|
|
12
|
+
const natural_person_pb_1 = require("./natural_person_pb");
|
|
13
|
+
const trust_pb_1 = require("./trust_pb");
|
|
14
|
+
const verification_status_pb_1 = require("./verification_status_pb");
|
|
15
|
+
/**
|
|
16
|
+
* Describes the file meshtrade/compliance/client/v1/client.proto.
|
|
17
|
+
*/
|
|
18
|
+
exports.file_meshtrade_compliance_client_v1_client = (0, codegenv2_1.fileDesc)("CittZXNodHJhZGUvY29tcGxpYW5jZS9jbGllbnQvdjEvY2xpZW50LnByb3RvEh5tZXNodHJhZGUuY29tcGxpYW5jZS5jbGllbnQudjEi+gcKBkNsaWVudBK4AQoEbmFtZRgBIAEoCUKpAbpIpQG6AaEBChRuYW1lLmZvcm1hdC5vcHRpb25hbBI0bmFtZSBtdXN0IGJlIGVtcHR5IG9yIGluIHRoZSBmb3JtYXQgY2xpZW50cy97VUxJRHYyfRpTc2l6ZSh0aGlzKSA9PSAwIHx8IHRoaXMubWF0Y2hlcygnXmNsaWVudHMvWzAxMjM0NTY3ODlBQkNERUZHSEpLTU5QUVJTVFZXWFlaXXsyNn0kJykSSwoFb3duZXIYAiABKAlCPLpIOcgBAXI0Mi9eZ3JvdXBzL1swMTIzNDU2Nzg5QUJDREVGR0hKS01OUFFSU1RWV1hZWl17MjZ9JJgBIRIjCgxkaXNwbGF5X25hbWUYAyABKAlCDbpICsgBAXIFEAEY/wESRwoObmF0dXJhbF9wZXJzb24YBCABKAsyLS5tZXNodHJhZGUuY29tcGxpYW5jZS5jbGllbnQudjEuTmF0dXJhbFBlcnNvbkgAEjoKB2NvbXBhbnkYBSABKAsyJy5tZXNodHJhZGUuY29tcGxpYW5jZS5jbGllbnQudjEuQ29tcGFueUgAEjQKBGZ1bmQYBiABKAsyJC5tZXNodHJhZGUuY29tcGxpYW5jZS5jbGllbnQudjEuRnVuZEgAEjYKBXRydXN0GAcgASgLMiUubWVzaHRyYWRlLmNvbXBsaWFuY2UuY2xpZW50LnYxLlRydXN0SAASXAoTdmVyaWZpY2F0aW9uX3N0YXR1cxgIIAEoDjIyLm1lc2h0cmFkZS5jb21wbGlhbmNlLmNsaWVudC52MS5WZXJpZmljYXRpb25TdGF0dXNCC7pICMgBAYIBAhABEu4BChZ2ZXJpZmljYXRpb25fYXV0aG9yaXR5GAkgASgJQs0BukjJAboBxQEKJnZlcmlmaWNhdGlvbl9hdXRob3JpdHkuZm9ybWF0Lm9wdGlvbmFsEkZ2ZXJpZmljYXRpb25fYXV0aG9yaXR5IG11c3QgYmUgZW1wdHkgb3IgaW4gdGhlIGZvcm1hdCBjbGllbnRzL3tVTElEdjJ9GlNzaXplKHRoaXMpID09IDAgfHwgdGhpcy5tYXRjaGVzKCdeY2xpZW50cy9bMDEyMzQ1Njc4OUFCQ0RFRkdISktNTlBRUlNUVldYWVpdezI2fSQnKRI1ChF2ZXJpZmljYXRpb25fZGF0ZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASOgoWbmV4dF92ZXJpZmljYXRpb25fZGF0ZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCDgoMbGVnYWxfcGVyc29uQmMKJWNvLm1lc2h0cmFkZS5hcGkuY29tcGxpYW5jZS5jbGllbnQudjFaOmdpdGh1Yi5jb20vbWVzaHRyYWRlL2FwaS9nby9jb21wbGlhbmNlL2NsaWVudC92MTtjbGllbnRfdjFiBnByb3RvMw", [validate_pb_1.file_buf_validate_validate, wkt_1.file_google_protobuf_timestamp, company_pb_1.file_meshtrade_compliance_client_v1_company, fund_pb_1.file_meshtrade_compliance_client_v1_fund, natural_person_pb_1.file_meshtrade_compliance_client_v1_natural_person, trust_pb_1.file_meshtrade_compliance_client_v1_trust, verification_status_pb_1.file_meshtrade_compliance_client_v1_verification_status]);
|
|
19
|
+
/**
|
|
20
|
+
* Describes the message meshtrade.compliance.client.v1.Client.
|
|
21
|
+
* Use `create(ClientSchema)` to create a new message.
|
|
22
|
+
*/
|
|
23
|
+
exports.ClientSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_compliance_client_v1_client, 0);
|