@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.
Files changed (205) hide show
  1. package/README.md +117 -0
  2. package/dist/buf/validate/validate_pb.js +17134 -0
  3. package/dist/meshtrade/common/config.d.ts +7 -0
  4. package/dist/meshtrade/common/config.js +9 -0
  5. package/dist/meshtrade/common/groupHeaderInterceptor.d.ts +64 -0
  6. package/dist/meshtrade/common/groupHeaderInterceptor.js +76 -0
  7. package/dist/meshtrade/common/grpc_web.d.ts +18 -0
  8. package/dist/meshtrade/common/grpc_web.js +34 -0
  9. package/dist/meshtrade/common/validation.d.ts +62 -0
  10. package/dist/meshtrade/common/validation.js +77 -0
  11. package/dist/meshtrade/compliance/client/v1/client_pb.d.ts +91 -0
  12. package/dist/meshtrade/compliance/client/v1/client_pb.js +645 -0
  13. package/dist/meshtrade/compliance/client/v1/company_pb.d.ts +178 -0
  14. package/dist/meshtrade/compliance/client/v1/company_pb.js +1322 -0
  15. package/dist/meshtrade/compliance/client/v1/company_representative_pb.d.ts +56 -0
  16. package/dist/meshtrade/compliance/client/v1/company_representative_pb.js +422 -0
  17. package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.d.ts +15 -0
  18. package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.js +40 -0
  19. package/dist/meshtrade/compliance/client/v1/fund_pb.d.ts +42 -0
  20. package/dist/meshtrade/compliance/client/v1/fund_pb.js +321 -0
  21. package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.d.ts +11 -0
  22. package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.js +36 -0
  23. package/dist/meshtrade/compliance/client/v1/index.d.ts +18 -0
  24. package/dist/meshtrade/compliance/client/v1/index.js +61 -0
  25. package/dist/meshtrade/compliance/client/v1/industry_classification_pb.d.ts +50 -0
  26. package/dist/meshtrade/compliance/client/v1/industry_classification_pb.js +386 -0
  27. package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.d.ts +22 -0
  28. package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.js +47 -0
  29. package/dist/meshtrade/compliance/client/v1/natural_person_pb.d.ts +94 -0
  30. package/dist/meshtrade/compliance/client/v1/natural_person_pb.js +729 -0
  31. package/dist/meshtrade/compliance/client/v1/pep_status_pb.d.ts +10 -0
  32. package/dist/meshtrade/compliance/client/v1/pep_status_pb.js +35 -0
  33. package/dist/meshtrade/compliance/client/v1/service_grpc_web_client_meshts.d.ts +47 -0
  34. package/dist/meshtrade/compliance/client/v1/service_grpc_web_client_meshts.js +78 -0
  35. package/dist/meshtrade/compliance/client/v1/service_grpc_web_pb.d.ts +56 -0
  36. package/dist/meshtrade/compliance/client/v1/service_grpc_web_pb.js +270 -0
  37. package/dist/meshtrade/compliance/client/v1/service_pb.d.ts +79 -0
  38. package/dist/meshtrade/compliance/client/v1/service_pb.js +660 -0
  39. package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.d.ts +29 -0
  40. package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.js +54 -0
  41. package/dist/meshtrade/compliance/client/v1/tax_residency_pb.d.ts +27 -0
  42. package/dist/meshtrade/compliance/client/v1/tax_residency_pb.js +208 -0
  43. package/dist/meshtrade/compliance/client/v1/trust_pb.d.ts +42 -0
  44. package/dist/meshtrade/compliance/client/v1/trust_pb.js +321 -0
  45. package/dist/meshtrade/compliance/client/v1/verification_status_pb.d.ts +11 -0
  46. package/dist/meshtrade/compliance/client/v1/verification_status_pb.js +36 -0
  47. package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.d.ts +27 -0
  48. package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.js +208 -0
  49. package/dist/meshtrade/iam/api_user/v1/api_user_pb.d.ts +57 -0
  50. package/dist/meshtrade/iam/api_user/v1/api_user_pb.js +376 -0
  51. package/dist/meshtrade/iam/api_user/v1/index.d.ts +5 -0
  52. package/dist/meshtrade/iam/api_user/v1/index.js +46 -0
  53. package/dist/meshtrade/iam/api_user/v1/service_grpc_web_client_meshts.d.ts +83 -0
  54. package/dist/meshtrade/iam/api_user/v1/service_grpc_web_client_meshts.js +126 -0
  55. package/dist/meshtrade/iam/api_user/v1/service_grpc_web_pb.d.ts +128 -0
  56. package/dist/meshtrade/iam/api_user/v1/service_grpc_web_pb.js +636 -0
  57. package/dist/meshtrade/iam/api_user/v1/service_pb.d.ts +219 -0
  58. package/dist/meshtrade/iam/api_user/v1/service_pb.js +1866 -0
  59. package/dist/meshtrade/iam/group/v1/group_pb.d.ts +35 -0
  60. package/dist/meshtrade/iam/group/v1/group_pb.js +268 -0
  61. package/dist/meshtrade/iam/group/v1/index.d.ts +4 -0
  62. package/dist/meshtrade/iam/group/v1/index.js +45 -0
  63. package/dist/meshtrade/iam/group/v1/service_grpc_web_client_meshts.d.ts +59 -0
  64. package/dist/meshtrade/iam/group/v1/service_grpc_web_client_meshts.js +94 -0
  65. package/dist/meshtrade/iam/group/v1/service_grpc_web_pb.d.ts +80 -0
  66. package/dist/meshtrade/iam/group/v1/service_grpc_web_pb.js +394 -0
  67. package/dist/meshtrade/iam/group/v1/service_pb.d.ts +200 -0
  68. package/dist/meshtrade/iam/group/v1/service_pb.js +1664 -0
  69. package/dist/meshtrade/iam/role/v1/index.d.ts +2 -0
  70. package/dist/meshtrade/iam/role/v1/index.js +43 -0
  71. package/dist/meshtrade/iam/role/v1/role.d.ts +71 -0
  72. package/dist/meshtrade/iam/role/v1/role.js +192 -0
  73. package/dist/meshtrade/iam/role/v1/role_pb.d.ts +41 -0
  74. package/dist/meshtrade/iam/role/v1/role_pb.js +66 -0
  75. package/dist/meshtrade/iam/user/v1/index.d.ts +4 -0
  76. package/dist/meshtrade/iam/user/v1/index.js +45 -0
  77. package/dist/meshtrade/iam/user/v1/service_grpc_web_client_meshts.d.ts +77 -0
  78. package/dist/meshtrade/iam/user/v1/service_grpc_web_client_meshts.js +118 -0
  79. package/dist/meshtrade/iam/user/v1/service_grpc_web_pb.d.ts +116 -0
  80. package/dist/meshtrade/iam/user/v1/service_grpc_web_pb.js +577 -0
  81. package/dist/meshtrade/iam/user/v1/service_pb.d.ts +262 -0
  82. package/dist/meshtrade/iam/user/v1/service_pb.js +2202 -0
  83. package/dist/meshtrade/iam/user/v1/user_pb.d.ts +37 -0
  84. package/dist/meshtrade/iam/user/v1/user_pb.js +294 -0
  85. package/dist/meshtrade/ledger/transaction/v1/index.d.ts +6 -0
  86. package/dist/meshtrade/ledger/transaction/v1/index.js +47 -0
  87. package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_client_meshts.d.ts +56 -0
  88. package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_client_meshts.js +96 -0
  89. package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_pb.d.ts +41 -0
  90. package/dist/meshtrade/ledger/transaction/v1/service_grpc_web_pb.js +204 -0
  91. package/dist/meshtrade/ledger/transaction/v1/service_pb.d.ts +79 -0
  92. package/dist/meshtrade/ledger/transaction/v1/service_pb.js +638 -0
  93. package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.d.ts +13 -0
  94. package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.js +38 -0
  95. package/dist/meshtrade/ledger/transaction/v1/transaction_state.d.ts +14 -0
  96. package/dist/meshtrade/ledger/transaction/v1/transaction_state.js +64 -0
  97. package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.d.ts +14 -0
  98. package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.js +39 -0
  99. package/dist/meshtrade/market_data/price/v1/index.d.ts +4 -0
  100. package/dist/meshtrade/market_data/price/v1/index.js +45 -0
  101. package/dist/meshtrade/market_data/price/v1/price_pb.d.ts +45 -0
  102. package/dist/meshtrade/market_data/price/v1/price_pb.js +356 -0
  103. package/dist/meshtrade/market_data/price/v1/service_grpc_web_client_meshts.d.ts +35 -0
  104. package/dist/meshtrade/market_data/price/v1/service_grpc_web_client_meshts.js +62 -0
  105. package/dist/meshtrade/market_data/price/v1/service_grpc_web_pb.d.ts +32 -0
  106. package/dist/meshtrade/market_data/price/v1/service_grpc_web_pb.js +150 -0
  107. package/dist/meshtrade/market_data/price/v1/service_pb.d.ts +34 -0
  108. package/dist/meshtrade/market_data/price/v1/service_pb.js +256 -0
  109. package/dist/meshtrade/option/method_options/v1/index.d.ts +1 -0
  110. package/dist/meshtrade/option/method_options/v1/index.js +42 -0
  111. package/dist/meshtrade/option/method_options/v1/method_options_pb.d.ts +44 -0
  112. package/dist/meshtrade/option/method_options/v1/method_options_pb.js +314 -0
  113. package/dist/meshtrade/reporting/account_report/v1/account_report_pb.d.ts +112 -0
  114. package/dist/meshtrade/reporting/account_report/v1/account_report_pb.js +897 -0
  115. package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.d.ts +26 -0
  116. package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.js +206 -0
  117. package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.d.ts +50 -0
  118. package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.js +393 -0
  119. package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.d.ts +66 -0
  120. package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.js +460 -0
  121. package/dist/meshtrade/reporting/account_report/v1/index.d.ts +8 -0
  122. package/dist/meshtrade/reporting/account_report/v1/index.js +49 -0
  123. package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_client_meshts.d.ts +41 -0
  124. package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_client_meshts.js +70 -0
  125. package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_pb.d.ts +44 -0
  126. package/dist/meshtrade/reporting/account_report/v1/service_grpc_web_pb.js +213 -0
  127. package/dist/meshtrade/reporting/account_report/v1/service_pb.d.ts +99 -0
  128. package/dist/meshtrade/reporting/account_report/v1/service_pb.js +796 -0
  129. package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.d.ts +62 -0
  130. package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.js +495 -0
  131. package/dist/meshtrade/studio/instrument/v1/index.d.ts +3 -0
  132. package/dist/meshtrade/studio/instrument/v1/index.js +44 -0
  133. package/dist/meshtrade/studio/instrument/v1/instrument_pb.d.ts +38 -0
  134. package/dist/meshtrade/studio/instrument/v1/instrument_pb.js +291 -0
  135. package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.d.ts +34 -0
  136. package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.js +59 -0
  137. package/dist/meshtrade/studio/instrument/v1/unit_pb.d.ts +25 -0
  138. package/dist/meshtrade/studio/instrument/v1/unit_pb.js +50 -0
  139. package/dist/meshtrade/trading/limit_order/v1/index.d.ts +4 -0
  140. package/dist/meshtrade/trading/limit_order/v1/index.js +45 -0
  141. package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.d.ts +83 -0
  142. package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.js +559 -0
  143. package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_client_meshts.d.ts +87 -0
  144. package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_client_meshts.js +136 -0
  145. package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_pb.d.ts +102 -0
  146. package/dist/meshtrade/trading/limit_order/v1/service_grpc_web_pb.js +509 -0
  147. package/dist/meshtrade/trading/limit_order/v1/service_pb.d.ts +203 -0
  148. package/dist/meshtrade/trading/limit_order/v1/service_pb.js +1692 -0
  149. package/dist/meshtrade/trading/market_order/v1/index.d.ts +4 -0
  150. package/dist/meshtrade/trading/market_order/v1/index.js +45 -0
  151. package/dist/meshtrade/trading/market_order/v1/market_order_pb.d.ts +22 -0
  152. package/dist/meshtrade/trading/market_order/v1/market_order_pb.js +176 -0
  153. package/dist/meshtrade/trading/market_order/v1/service_grpc_web_client_meshts.d.ts +35 -0
  154. package/dist/meshtrade/trading/market_order/v1/service_grpc_web_client_meshts.js +62 -0
  155. package/dist/meshtrade/trading/market_order/v1/service_grpc_web_pb.d.ts +32 -0
  156. package/dist/meshtrade/trading/market_order/v1/service_grpc_web_pb.js +146 -0
  157. package/dist/meshtrade/trading/market_order/v1/service_pb.d.ts +24 -0
  158. package/dist/meshtrade/trading/market_order/v1/service_pb.js +180 -0
  159. package/dist/meshtrade/type/v1/address_pb.d.ts +44 -0
  160. package/dist/meshtrade/type/v1/address_pb.js +352 -0
  161. package/dist/meshtrade/type/v1/amount.d.ts +13 -0
  162. package/dist/meshtrade/type/v1/amount.js +66 -0
  163. package/dist/meshtrade/type/v1/amountWrapper.d.ts +74 -0
  164. package/dist/meshtrade/type/v1/amountWrapper.js +98 -0
  165. package/dist/meshtrade/type/v1/amount_pb.d.ts +32 -0
  166. package/dist/meshtrade/type/v1/amount_pb.js +252 -0
  167. package/dist/meshtrade/type/v1/contact_details_pb.d.ts +54 -0
  168. package/dist/meshtrade/type/v1/contact_details_pb.js +416 -0
  169. package/dist/meshtrade/type/v1/date.d.ts +49 -0
  170. package/dist/meshtrade/type/v1/date.js +136 -0
  171. package/dist/meshtrade/type/v1/date_pb.d.ts +30 -0
  172. package/dist/meshtrade/type/v1/date_pb.js +236 -0
  173. package/dist/meshtrade/type/v1/decimalConversions.d.ts +24 -0
  174. package/dist/meshtrade/type/v1/decimalConversions.js +40 -0
  175. package/dist/meshtrade/type/v1/decimal_pb.d.ts +22 -0
  176. package/dist/meshtrade/type/v1/decimal_pb.js +176 -0
  177. package/dist/meshtrade/type/v1/index.d.ts +15 -0
  178. package/dist/meshtrade/type/v1/index.js +56 -0
  179. package/dist/meshtrade/type/v1/ledger.d.ts +27 -0
  180. package/dist/meshtrade/type/v1/ledger.js +115 -0
  181. package/dist/meshtrade/type/v1/ledger_pb.d.ts +14 -0
  182. package/dist/meshtrade/type/v1/ledger_pb.js +39 -0
  183. package/dist/meshtrade/type/v1/sorting_pb.d.ts +9 -0
  184. package/dist/meshtrade/type/v1/sorting_pb.js +34 -0
  185. package/dist/meshtrade/type/v1/time_of_day.d.ts +74 -0
  186. package/dist/meshtrade/type/v1/time_of_day.js +205 -0
  187. package/dist/meshtrade/type/v1/time_of_day_pb.d.ts +34 -0
  188. package/dist/meshtrade/type/v1/time_of_day_pb.js +266 -0
  189. package/dist/meshtrade/type/v1/token.d.ts +4 -0
  190. package/dist/meshtrade/type/v1/token.js +24 -0
  191. package/dist/meshtrade/type/v1/tokenWrapper.d.ts +49 -0
  192. package/dist/meshtrade/type/v1/tokenWrapper.js +76 -0
  193. package/dist/meshtrade/type/v1/token_pb.d.ts +31 -0
  194. package/dist/meshtrade/type/v1/token_pb.js +238 -0
  195. package/dist/meshtrade/wallet/account/v1/account_pb.d.ts +149 -0
  196. package/dist/meshtrade/wallet/account/v1/account_pb.js +1160 -0
  197. package/dist/meshtrade/wallet/account/v1/index.d.ts +4 -0
  198. package/dist/meshtrade/wallet/account/v1/index.js +45 -0
  199. package/dist/meshtrade/wallet/account/v1/service_grpc_web_client_meshts.d.ts +83 -0
  200. package/dist/meshtrade/wallet/account/v1/service_grpc_web_client_meshts.js +126 -0
  201. package/dist/meshtrade/wallet/account/v1/service_grpc_web_pb.d.ts +128 -0
  202. package/dist/meshtrade/wallet/account/v1/service_grpc_web_pb.js +638 -0
  203. package/dist/meshtrade/wallet/account/v1/service_pb.d.ts +350 -0
  204. package/dist/meshtrade/wallet/account/v1/service_pb.js +2930 -0
  205. package/package.json +171 -0
@@ -0,0 +1,7 @@
1
+ export type ConfigOpts = {
2
+ apiServerURL?: string;
3
+ };
4
+ export type Config = {
5
+ apiServerURL: string;
6
+ };
7
+ export declare function getConfigFromOpts(config?: ConfigOpts): Config;
@@ -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
+