@meshtrade/api-old 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 +117 -0
- package/dist/buf/validate/validate_pb.js +17134 -0
- package/dist/meshtrade/common/config.d.ts +7 -0
- package/dist/meshtrade/common/config.js +9 -0
- package/dist/meshtrade/common/groupHeaderInterceptor.d.ts +64 -0
- package/dist/meshtrade/common/groupHeaderInterceptor.js +76 -0
- package/dist/meshtrade/common/grpc_web.d.ts +18 -0
- package/dist/meshtrade/common/grpc_web.js +34 -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 +91 -0
- package/dist/meshtrade/compliance/client/v1/client_pb.js +645 -0
- package/dist/meshtrade/compliance/client/v1/company_pb.d.ts +178 -0
- package/dist/meshtrade/compliance/client/v1/company_pb.js +1322 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_pb.d.ts +56 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_pb.js +422 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.d.ts +15 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.js +40 -0
- package/dist/meshtrade/compliance/client/v1/fund_pb.d.ts +42 -0
- package/dist/meshtrade/compliance/client/v1/fund_pb.js +321 -0
- package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.d.ts +11 -0
- package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.js +36 -0
- package/dist/meshtrade/compliance/client/v1/index.d.ts +18 -0
- package/dist/meshtrade/compliance/client/v1/index.js +61 -0
- package/dist/meshtrade/compliance/client/v1/industry_classification_pb.d.ts +50 -0
- package/dist/meshtrade/compliance/client/v1/industry_classification_pb.js +386 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.d.ts +22 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.js +47 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_pb.d.ts +94 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_pb.js +729 -0
- package/dist/meshtrade/compliance/client/v1/pep_status_pb.d.ts +10 -0
- package/dist/meshtrade/compliance/client/v1/pep_status_pb.js +35 -0
- package/dist/meshtrade/compliance/client/v1/service_grpc_web_client_meshts.d.ts +47 -0
- package/dist/meshtrade/compliance/client/v1/service_grpc_web_client_meshts.js +78 -0
- package/dist/meshtrade/compliance/client/v1/service_grpc_web_pb.d.ts +56 -0
- package/dist/meshtrade/compliance/client/v1/service_grpc_web_pb.js +270 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.d.ts +79 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.js +660 -0
- package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.d.ts +29 -0
- package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.js +54 -0
- package/dist/meshtrade/compliance/client/v1/tax_residency_pb.d.ts +27 -0
- package/dist/meshtrade/compliance/client/v1/tax_residency_pb.js +208 -0
- package/dist/meshtrade/compliance/client/v1/trust_pb.d.ts +42 -0
- package/dist/meshtrade/compliance/client/v1/trust_pb.js +321 -0
- package/dist/meshtrade/compliance/client/v1/verification_status_pb.d.ts +11 -0
- package/dist/meshtrade/compliance/client/v1/verification_status_pb.js +36 -0
- package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.d.ts +27 -0
- package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.js +208 -0
- package/dist/meshtrade/iam/api_user/v1/api_user_pb.d.ts +57 -0
- package/dist/meshtrade/iam/api_user/v1/api_user_pb.js +376 -0
- package/dist/meshtrade/iam/api_user/v1/index.d.ts +5 -0
- package/dist/meshtrade/iam/api_user/v1/index.js +46 -0
- package/dist/meshtrade/iam/api_user/v1/service_grpc_web_client_meshts.d.ts +83 -0
- package/dist/meshtrade/iam/api_user/v1/service_grpc_web_client_meshts.js +126 -0
- package/dist/meshtrade/iam/api_user/v1/service_grpc_web_pb.d.ts +128 -0
- package/dist/meshtrade/iam/api_user/v1/service_grpc_web_pb.js +636 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.d.ts +219 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.js +1866 -0
- package/dist/meshtrade/iam/group/v1/group_pb.d.ts +35 -0
- package/dist/meshtrade/iam/group/v1/group_pb.js +268 -0
- package/dist/meshtrade/iam/group/v1/index.d.ts +4 -0
- package/dist/meshtrade/iam/group/v1/index.js +45 -0
- package/dist/meshtrade/iam/group/v1/service_grpc_web_client_meshts.d.ts +59 -0
- package/dist/meshtrade/iam/group/v1/service_grpc_web_client_meshts.js +94 -0
- package/dist/meshtrade/iam/group/v1/service_grpc_web_pb.d.ts +80 -0
- package/dist/meshtrade/iam/group/v1/service_grpc_web_pb.js +394 -0
- package/dist/meshtrade/iam/group/v1/service_pb.d.ts +200 -0
- package/dist/meshtrade/iam/group/v1/service_pb.js +1664 -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 +41 -0
- package/dist/meshtrade/iam/role/v1/role_pb.js +66 -0
- package/dist/meshtrade/iam/user/v1/index.d.ts +4 -0
- package/dist/meshtrade/iam/user/v1/index.js +45 -0
- package/dist/meshtrade/iam/user/v1/service_grpc_web_client_meshts.d.ts +77 -0
- package/dist/meshtrade/iam/user/v1/service_grpc_web_client_meshts.js +118 -0
- package/dist/meshtrade/iam/user/v1/service_grpc_web_pb.d.ts +116 -0
- package/dist/meshtrade/iam/user/v1/service_grpc_web_pb.js +577 -0
- package/dist/meshtrade/iam/user/v1/service_pb.d.ts +262 -0
- package/dist/meshtrade/iam/user/v1/service_pb.js +2202 -0
- package/dist/meshtrade/iam/user/v1/user_pb.d.ts +37 -0
- package/dist/meshtrade/iam/user/v1/user_pb.js +294 -0
- package/dist/meshtrade/ledger/transaction/v1/index.d.ts +6 -0
- package/dist/meshtrade/ledger/transaction/v1/index.js +47 -0
- package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_client_meshts.d.ts +56 -0
- package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_client_meshts.js +96 -0
- package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_pb.d.ts +41 -0
- package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_pb.js +204 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.d.ts +79 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.js +638 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.d.ts +13 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.js +38 -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 +14 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.js +39 -0
- package/dist/meshtrade/market_data/price/v1/index.d.ts +4 -0
- package/dist/meshtrade/market_data/price/v1/index.js +45 -0
- package/dist/meshtrade/market_data/price/v1/price_pb.d.ts +45 -0
- package/dist/meshtrade/market_data/price/v1/price_pb.js +356 -0
- package/dist/meshtrade/market_data/price/v1/service_grpc_web_client_meshts.d.ts +35 -0
- package/dist/meshtrade/market_data/price/v1/service_grpc_web_client_meshts.js +62 -0
- package/dist/meshtrade/market_data/price/v1/service_grpc_web_pb.d.ts +32 -0
- package/dist/meshtrade/market_data/price/v1/service_grpc_web_pb.js +150 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.d.ts +34 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.js +256 -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 +44 -0
- package/dist/meshtrade/option/method_options/v1/method_options_pb.js +314 -0
- package/dist/meshtrade/reporting/account_report/v1/account_report_pb.d.ts +112 -0
- package/dist/meshtrade/reporting/account_report/v1/account_report_pb.js +897 -0
- package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.d.ts +26 -0
- package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.js +206 -0
- package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.d.ts +50 -0
- package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.js +393 -0
- package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.d.ts +66 -0
- package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.js +460 -0
- package/dist/meshtrade/reporting/account_report/v1/index.d.ts +8 -0
- package/dist/meshtrade/reporting/account_report/v1/index.js +49 -0
- package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_client_meshts.d.ts +41 -0
- package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_client_meshts.js +70 -0
- package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_pb.d.ts +44 -0
- package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_pb.js +213 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.d.ts +99 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.js +796 -0
- package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.d.ts +62 -0
- package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.js +495 -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 +38 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_pb.js +291 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.d.ts +34 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.js +59 -0
- package/dist/meshtrade/studio/instrument/v1/unit_pb.d.ts +25 -0
- package/dist/meshtrade/studio/instrument/v1/unit_pb.js +50 -0
- package/dist/meshtrade/trading/limit_order/v1/index.d.ts +4 -0
- package/dist/meshtrade/trading/limit_order/v1/index.js +45 -0
- package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.d.ts +83 -0
- package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.js +559 -0
- package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_client_meshts.d.ts +87 -0
- package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_client_meshts.js +136 -0
- package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_pb.d.ts +102 -0
- package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_pb.js +509 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.d.ts +203 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.js +1692 -0
- package/dist/meshtrade/trading/market_order/v1/index.d.ts +4 -0
- package/dist/meshtrade/trading/market_order/v1/index.js +45 -0
- package/dist/meshtrade/trading/market_order/v1/market_order_pb.d.ts +22 -0
- package/dist/meshtrade/trading/market_order/v1/market_order_pb.js +176 -0
- package/dist/meshtrade/trading/market_order/v1/service_grpc_web_client_meshts.d.ts +35 -0
- package/dist/meshtrade/trading/market_order/v1/service_grpc_web_client_meshts.js +62 -0
- package/dist/meshtrade/trading/market_order/v1/service_grpc_web_pb.d.ts +32 -0
- package/dist/meshtrade/trading/market_order/v1/service_grpc_web_pb.js +146 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.d.ts +24 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.js +180 -0
- package/dist/meshtrade/type/v1/address_pb.d.ts +44 -0
- package/dist/meshtrade/type/v1/address_pb.js +352 -0
- package/dist/meshtrade/type/v1/amount.d.ts +13 -0
- package/dist/meshtrade/type/v1/amount.js +66 -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 +32 -0
- package/dist/meshtrade/type/v1/amount_pb.js +252 -0
- package/dist/meshtrade/type/v1/contact_details_pb.d.ts +54 -0
- package/dist/meshtrade/type/v1/contact_details_pb.js +416 -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 +30 -0
- package/dist/meshtrade/type/v1/date_pb.js +236 -0
- package/dist/meshtrade/type/v1/decimalConversions.d.ts +24 -0
- package/dist/meshtrade/type/v1/decimalConversions.js +40 -0
- package/dist/meshtrade/type/v1/decimal_pb.d.ts +22 -0
- package/dist/meshtrade/type/v1/decimal_pb.js +176 -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 +14 -0
- package/dist/meshtrade/type/v1/ledger_pb.js +39 -0
- package/dist/meshtrade/type/v1/sorting_pb.d.ts +9 -0
- package/dist/meshtrade/type/v1/sorting_pb.js +34 -0
- package/dist/meshtrade/type/v1/time_of_day.d.ts +74 -0
- package/dist/meshtrade/type/v1/time_of_day.js +205 -0
- package/dist/meshtrade/type/v1/time_of_day_pb.d.ts +34 -0
- package/dist/meshtrade/type/v1/time_of_day_pb.js +266 -0
- package/dist/meshtrade/type/v1/token.d.ts +4 -0
- package/dist/meshtrade/type/v1/token.js +24 -0
- package/dist/meshtrade/type/v1/tokenWrapper.d.ts +49 -0
- package/dist/meshtrade/type/v1/tokenWrapper.js +76 -0
- package/dist/meshtrade/type/v1/token_pb.d.ts +31 -0
- package/dist/meshtrade/type/v1/token_pb.js +238 -0
- package/dist/meshtrade/wallet/account/v1/account_pb.d.ts +149 -0
- package/dist/meshtrade/wallet/account/v1/account_pb.js +1160 -0
- package/dist/meshtrade/wallet/account/v1/index.d.ts +4 -0
- package/dist/meshtrade/wallet/account/v1/index.js +45 -0
- package/dist/meshtrade/wallet/account/v1/service_grpc_web_client_meshts.d.ts +83 -0
- package/dist/meshtrade/wallet/account/v1/service_grpc_web_client_meshts.js +126 -0
- package/dist/meshtrade/wallet/account/v1/service_grpc_web_pb.d.ts +128 -0
- package/dist/meshtrade/wallet/account/v1/service_grpc_web_pb.js +638 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.d.ts +350 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.js +2930 -0
- package/package.json +171 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfigFromOpts = getConfigFromOpts;
|
|
4
|
+
function getConfigFromOpts(config) {
|
|
5
|
+
const apiServerURL = config?.apiServerURL ?? "http://localhost:10000";
|
|
6
|
+
return {
|
|
7
|
+
apiServerURL,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Request, UnaryInterceptor, UnaryResponse } from "grpc-web";
|
|
2
|
+
import { Message } from "google-protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Interceptor to inject operating group context into an API call
|
|
5
|
+
* by adding a `x-group` header to the request metadata.
|
|
6
|
+
*
|
|
7
|
+
* The group context determines the scope of operations and resource access
|
|
8
|
+
* within the Meshtrade platform's hierarchical group ownership model.
|
|
9
|
+
*
|
|
10
|
+
* This interceptor validates that the provided group follows the correct
|
|
11
|
+
* resource name format: `groups/{ulid}` where {ulid} is a 26-character
|
|
12
|
+
* ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
13
|
+
*
|
|
14
|
+
* @template TReq The request message type.
|
|
15
|
+
* @template TResp The response message type.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Create an interceptor with a valid group resource name
|
|
20
|
+
* const interceptor = new GroupHeaderInterceptor('groups/01ARZ3NDEKTSV4YWVF8F5BH32');
|
|
21
|
+
*
|
|
22
|
+
* // Use with a gRPC client
|
|
23
|
+
* const client = new SomeServiceClient(url, null, {
|
|
24
|
+
* unaryInterceptors: [interceptor]
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class GroupHeaderInterceptor<TReq extends Message, TResp extends Message> implements UnaryInterceptor<TReq, TResp> {
|
|
29
|
+
private readonly group;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new GroupHeaderInterceptor instance.
|
|
32
|
+
*
|
|
33
|
+
* @param group - The group resource name in the format `groups/{ulid}` where
|
|
34
|
+
* {ulid} is a 26-character ULID identifier. This determines
|
|
35
|
+
* the operating group context for all API requests.
|
|
36
|
+
* @throws {Error} If the group format is invalid
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // Valid group format
|
|
41
|
+
* new GroupHeaderInterceptor('groups/01ARZ3NDEKTSV4YWVF8F5BH32');
|
|
42
|
+
*
|
|
43
|
+
* // Invalid formats (will throw errors)
|
|
44
|
+
* new GroupHeaderInterceptor('01ARZ3NDEKTSV4YWVF8F5BH32'); // Missing "groups/" prefix
|
|
45
|
+
* new GroupHeaderInterceptor('groups/invalid'); // Invalid ULID format
|
|
46
|
+
* new GroupHeaderInterceptor('users/01ARZ3NDEKTSV4YWVF8F5BH32'); // Wrong resource type
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
constructor(group: string);
|
|
50
|
+
/**
|
|
51
|
+
* Intercepts the gRPC request to inject the group context into the metadata.
|
|
52
|
+
*
|
|
53
|
+
* This method adds an `x-group` header to the request metadata containing
|
|
54
|
+
* the group resource name. The backend authorization layer uses this header
|
|
55
|
+
* to determine the operating group scope for the request.
|
|
56
|
+
*
|
|
57
|
+
* @param request - The gRPC request to intercept
|
|
58
|
+
* @param invoker - The function to invoke the actual gRPC call
|
|
59
|
+
* @returns Promise resolving to the gRPC response
|
|
60
|
+
*
|
|
61
|
+
* @override
|
|
62
|
+
*/
|
|
63
|
+
intercept(request: Request<TReq, TResp>, invoker: (request: Request<TReq, TResp>) => Promise<UnaryResponse<TReq, TResp>>): Promise<UnaryResponse<TReq, TResp>>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupHeaderInterceptor = void 0;
|
|
4
|
+
const validation_1 = require("./validation");
|
|
5
|
+
/**
|
|
6
|
+
* Interceptor to inject operating group context into an API call
|
|
7
|
+
* by adding a `x-group` header to the request metadata.
|
|
8
|
+
*
|
|
9
|
+
* The group context determines the scope of operations and resource access
|
|
10
|
+
* within the Meshtrade platform's hierarchical group ownership model.
|
|
11
|
+
*
|
|
12
|
+
* This interceptor validates that the provided group follows the correct
|
|
13
|
+
* resource name format: `groups/{ulid}` where {ulid} is a 26-character
|
|
14
|
+
* ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
15
|
+
*
|
|
16
|
+
* @template TReq The request message type.
|
|
17
|
+
* @template TResp The response message type.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Create an interceptor with a valid group resource name
|
|
22
|
+
* const interceptor = new GroupHeaderInterceptor('groups/01ARZ3NDEKTSV4YWVF8F5BH32');
|
|
23
|
+
*
|
|
24
|
+
* // Use with a gRPC client
|
|
25
|
+
* const client = new SomeServiceClient(url, null, {
|
|
26
|
+
* unaryInterceptors: [interceptor]
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
class GroupHeaderInterceptor {
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new GroupHeaderInterceptor instance.
|
|
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
|
+
* @throws {Error} If the group format is invalid
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // Valid group format
|
|
42
|
+
* new GroupHeaderInterceptor('groups/01ARZ3NDEKTSV4YWVF8F5BH32');
|
|
43
|
+
*
|
|
44
|
+
* // Invalid formats (will throw errors)
|
|
45
|
+
* new GroupHeaderInterceptor('01ARZ3NDEKTSV4YWVF8F5BH32'); // Missing "groups/" prefix
|
|
46
|
+
* new GroupHeaderInterceptor('groups/invalid'); // Invalid ULID format
|
|
47
|
+
* new GroupHeaderInterceptor('users/01ARZ3NDEKTSV4YWVF8F5BH32'); // Wrong resource type
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
constructor(group) {
|
|
51
|
+
this.group = group;
|
|
52
|
+
if (!(0, validation_1.isValidGroupResourceName)(group)) {
|
|
53
|
+
throw new Error(`Invalid group format: "${group}". Group must be in the format "groups/{ulid}" ` +
|
|
54
|
+
`where {ulid} is a 26-character ULID (e.g., "groups/01ARZ3NDEKTSV4YWVF8F5BH32").`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Intercepts the gRPC request to inject the group context into the metadata.
|
|
59
|
+
*
|
|
60
|
+
* This method adds an `x-group` header to the request metadata containing
|
|
61
|
+
* the group resource name. The backend authorization layer uses this header
|
|
62
|
+
* to determine the operating group scope for the request.
|
|
63
|
+
*
|
|
64
|
+
* @param request - The gRPC request to intercept
|
|
65
|
+
* @param invoker - The function to invoke the actual gRPC call
|
|
66
|
+
* @returns Promise resolving to the gRPC response
|
|
67
|
+
*
|
|
68
|
+
* @override
|
|
69
|
+
*/
|
|
70
|
+
intercept(request, invoker) {
|
|
71
|
+
const metadata = request.getMetadata();
|
|
72
|
+
metadata["x-group"] = this.group;
|
|
73
|
+
return invoker(request);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.GroupHeaderInterceptor = GroupHeaderInterceptor;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UnaryInterceptor, Request, UnaryResponse } from "grpc-web";
|
|
2
|
+
/**
|
|
3
|
+
* `LoggingInterceptor` is a class responsible for intercepting requests and logging out requests and responses.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LoggingInterceptor implements UnaryInterceptor<unknown, unknown> {
|
|
6
|
+
/**
|
|
7
|
+
* Intercepts a request to add the loggingorization token to its metadata.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} request - The request object.
|
|
10
|
+
* @param {Function} request.getMetadata - A function that returns the request's metadata.
|
|
11
|
+
* @param {unknown} invoker - A function responsible for processing the request.
|
|
12
|
+
* Expected to be of type `function`, but can be of any type.
|
|
13
|
+
*
|
|
14
|
+
* @returns {unknown} The result of the `invoker` function, if it is a function.
|
|
15
|
+
* Otherwise, logs an error and doesn't return anything.
|
|
16
|
+
*/
|
|
17
|
+
intercept(request: Request<unknown, unknown>, invoker: (request: Request<unknown, unknown>) => Promise<UnaryResponse<unknown, unknown>>): Promise<UnaryResponse<unknown, unknown>>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoggingInterceptor = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* `LoggingInterceptor` is a class responsible for intercepting requests and logging out requests and responses.
|
|
6
|
+
*/
|
|
7
|
+
class LoggingInterceptor {
|
|
8
|
+
/**
|
|
9
|
+
* Intercepts a request to add the loggingorization token to its metadata.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} request - The request object.
|
|
12
|
+
* @param {Function} request.getMetadata - A function that returns the request's metadata.
|
|
13
|
+
* @param {unknown} invoker - A function responsible for processing the request.
|
|
14
|
+
* Expected to be of type `function`, but can be of any type.
|
|
15
|
+
*
|
|
16
|
+
* @returns {unknown} The result of the `invoker` function, if it is a function.
|
|
17
|
+
* Otherwise, logs an error and doesn't return anything.
|
|
18
|
+
*/
|
|
19
|
+
async intercept(request, invoker) {
|
|
20
|
+
// log request
|
|
21
|
+
console.debug("request: ", request.getMethodDescriptor().getName(), request);
|
|
22
|
+
// perform grpc call in a try catch so that error can be logged
|
|
23
|
+
try {
|
|
24
|
+
const response = await invoker(request);
|
|
25
|
+
console.debug("response: ", request.getMethodDescriptor().getName(), response);
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
console.error(`error: ${request.getMethodDescriptor().getName()}`, e);
|
|
30
|
+
throw e;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.LoggingInterceptor = LoggingInterceptor;
|
|
@@ -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,91 @@
|
|
|
1
|
+
import * as jspb from 'google-protobuf'
|
|
2
|
+
|
|
3
|
+
import * as buf_validate_validate_pb from '../../../../buf/validate/validate_pb'; // proto import: "buf/validate/validate.proto"
|
|
4
|
+
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb'; // proto import: "google/protobuf/timestamp.proto"
|
|
5
|
+
import * as meshtrade_compliance_client_v1_company_pb from '../../../../meshtrade/compliance/client/v1/company_pb'; // proto import: "meshtrade/compliance/client/v1/company.proto"
|
|
6
|
+
import * as meshtrade_compliance_client_v1_fund_pb from '../../../../meshtrade/compliance/client/v1/fund_pb'; // proto import: "meshtrade/compliance/client/v1/fund.proto"
|
|
7
|
+
import * as meshtrade_compliance_client_v1_natural_person_pb from '../../../../meshtrade/compliance/client/v1/natural_person_pb'; // proto import: "meshtrade/compliance/client/v1/natural_person.proto"
|
|
8
|
+
import * as meshtrade_compliance_client_v1_trust_pb from '../../../../meshtrade/compliance/client/v1/trust_pb'; // proto import: "meshtrade/compliance/client/v1/trust.proto"
|
|
9
|
+
import * as meshtrade_compliance_client_v1_verification_status_pb from '../../../../meshtrade/compliance/client/v1/verification_status_pb'; // proto import: "meshtrade/compliance/client/v1/verification_status.proto"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export class Client extends jspb.Message {
|
|
13
|
+
getName(): string;
|
|
14
|
+
setName(value: string): Client;
|
|
15
|
+
|
|
16
|
+
getOwner(): string;
|
|
17
|
+
setOwner(value: string): Client;
|
|
18
|
+
|
|
19
|
+
getDisplayName(): string;
|
|
20
|
+
setDisplayName(value: string): Client;
|
|
21
|
+
|
|
22
|
+
getNaturalPerson(): meshtrade_compliance_client_v1_natural_person_pb.NaturalPerson | undefined;
|
|
23
|
+
setNaturalPerson(value?: meshtrade_compliance_client_v1_natural_person_pb.NaturalPerson): Client;
|
|
24
|
+
hasNaturalPerson(): boolean;
|
|
25
|
+
clearNaturalPerson(): Client;
|
|
26
|
+
|
|
27
|
+
getCompany(): meshtrade_compliance_client_v1_company_pb.Company | undefined;
|
|
28
|
+
setCompany(value?: meshtrade_compliance_client_v1_company_pb.Company): Client;
|
|
29
|
+
hasCompany(): boolean;
|
|
30
|
+
clearCompany(): Client;
|
|
31
|
+
|
|
32
|
+
getFund(): meshtrade_compliance_client_v1_fund_pb.Fund | undefined;
|
|
33
|
+
setFund(value?: meshtrade_compliance_client_v1_fund_pb.Fund): Client;
|
|
34
|
+
hasFund(): boolean;
|
|
35
|
+
clearFund(): Client;
|
|
36
|
+
|
|
37
|
+
getTrust(): meshtrade_compliance_client_v1_trust_pb.Trust | undefined;
|
|
38
|
+
setTrust(value?: meshtrade_compliance_client_v1_trust_pb.Trust): Client;
|
|
39
|
+
hasTrust(): boolean;
|
|
40
|
+
clearTrust(): Client;
|
|
41
|
+
|
|
42
|
+
getVerificationStatus(): meshtrade_compliance_client_v1_verification_status_pb.VerificationStatus;
|
|
43
|
+
setVerificationStatus(value: meshtrade_compliance_client_v1_verification_status_pb.VerificationStatus): Client;
|
|
44
|
+
|
|
45
|
+
getVerificationAuthority(): string;
|
|
46
|
+
setVerificationAuthority(value: string): Client;
|
|
47
|
+
|
|
48
|
+
getVerificationDate(): google_protobuf_timestamp_pb.Timestamp | undefined;
|
|
49
|
+
setVerificationDate(value?: google_protobuf_timestamp_pb.Timestamp): Client;
|
|
50
|
+
hasVerificationDate(): boolean;
|
|
51
|
+
clearVerificationDate(): Client;
|
|
52
|
+
|
|
53
|
+
getNextVerificationDate(): google_protobuf_timestamp_pb.Timestamp | undefined;
|
|
54
|
+
setNextVerificationDate(value?: google_protobuf_timestamp_pb.Timestamp): Client;
|
|
55
|
+
hasNextVerificationDate(): boolean;
|
|
56
|
+
clearNextVerificationDate(): Client;
|
|
57
|
+
|
|
58
|
+
getLegalPersonCase(): Client.LegalPersonCase;
|
|
59
|
+
|
|
60
|
+
serializeBinary(): Uint8Array;
|
|
61
|
+
toObject(includeInstance?: boolean): Client.AsObject;
|
|
62
|
+
static toObject(includeInstance: boolean, msg: Client): Client.AsObject;
|
|
63
|
+
static serializeBinaryToWriter(message: Client, writer: jspb.BinaryWriter): void;
|
|
64
|
+
static deserializeBinary(bytes: Uint8Array): Client;
|
|
65
|
+
static deserializeBinaryFromReader(message: Client, reader: jspb.BinaryReader): Client;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export namespace Client {
|
|
69
|
+
export type AsObject = {
|
|
70
|
+
name: string,
|
|
71
|
+
owner: string,
|
|
72
|
+
displayName: string,
|
|
73
|
+
naturalPerson?: meshtrade_compliance_client_v1_natural_person_pb.NaturalPerson.AsObject,
|
|
74
|
+
company?: meshtrade_compliance_client_v1_company_pb.Company.AsObject,
|
|
75
|
+
fund?: meshtrade_compliance_client_v1_fund_pb.Fund.AsObject,
|
|
76
|
+
trust?: meshtrade_compliance_client_v1_trust_pb.Trust.AsObject,
|
|
77
|
+
verificationStatus: meshtrade_compliance_client_v1_verification_status_pb.VerificationStatus,
|
|
78
|
+
verificationAuthority: string,
|
|
79
|
+
verificationDate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
|
|
80
|
+
nextVerificationDate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export enum LegalPersonCase {
|
|
84
|
+
LEGAL_PERSON_NOT_SET = 0,
|
|
85
|
+
NATURAL_PERSON = 4,
|
|
86
|
+
COMPANY = 5,
|
|
87
|
+
FUND = 6,
|
|
88
|
+
TRUST = 7,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|