@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,2 @@
1
+ export * from "./role_pb";
2
+ export * from "./role";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // ===================================================================
3
+ // AUTO-GENERATED SECTION - ONLY EDIT BELOW THE CLOSING COMMENT BLOCK
4
+ // ===================================================================
5
+ // This section is automatically managed by protoc-gen-meshts.
6
+ //
7
+ // DO NOT EDIT ANYTHING IN THIS SECTION MANUALLY!
8
+ // Your changes will be overwritten during code generation.
9
+ //
10
+ // To add custom exports, scroll down to the
11
+ // "MANUAL EXPORTS" section indicated below.
12
+ // ===================================================================
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ // Generated exports
29
+ __exportStar(require("./role_pb"), exports);
30
+ // ===================================================================
31
+ // END OF AUTO-GENERATED SECTION
32
+ // ===================================================================
33
+ //
34
+ // MANUAL EXPORTS - ADD YOUR CUSTOM EXPORTS BELOW
35
+ //
36
+ // You can safely add your own export statements in this section.
37
+ // They will be preserved across code generation.
38
+ //
39
+ // Example:
40
+ // export * from "./my_custom_module";
41
+ // export { MyCustomClass } from "./another_module";
42
+ // ===================================================================
43
+ __exportStar(require("./role"), exports);
@@ -0,0 +1,71 @@
1
+ import { Role } from "./role_pb";
2
+ export declare const allRoles: Role[];
3
+ /**
4
+ * Converts a Role enum instance to a custom string representation.
5
+ * @param {Role} role - The role to convert.
6
+ * @returns {string} The custom string representation of the role.
7
+ */
8
+ export declare function roleToString(role: Role): string;
9
+ /**
10
+ * Converts a custom string representation to a Role enum instance.
11
+ * @param {string} roleStr - The custom string representation of the role.
12
+ * @returns {Role} The corresponding Role enum instance.
13
+ */
14
+ export declare function stringToRole(roleStr: string): Role;
15
+ /**
16
+ * Creates a role path resource name from a group ULID and role ID.
17
+ * @param {string} groupULID - The group ULID (26 characters).
18
+ * @param {number} roleId - The role ID enum value.
19
+ * @returns {string} The role path in format groups/{ULIDv2}/roles/{role_id}.
20
+ * @throws {Error} If the group ULID is invalid.
21
+ * @throws {Error} If the role ID is invalid.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * createRolePath('01ARZ3NDEKTSV4YWVF8F5BH32', Role.ROLE_IAM_ADMIN);
26
+ * // Returns: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32/roles/1000000'
27
+ * ```
28
+ */
29
+ export declare function createRolePath(groupULID: string, roleId: number): string;
30
+ /**
31
+ * Validates whether a role path is in the correct format.
32
+ * @param {string} rolePath - The role path to validate.
33
+ * @returns {boolean} True if the role path is valid, false otherwise.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * isValidRolePath('groups/01ARZ3NDEKTSV4YWVF8F5BH32Q/roles/1000000'); // true
38
+ * isValidRolePath('groups/01ARZ3NDEKTSV4YWVF8F5BH32Q/1000000'); // false (old format)
39
+ * ```
40
+ */
41
+ export declare function isValidRolePath(rolePath: string): boolean;
42
+ /**
43
+ * Extracts the role ID from a role path.
44
+ * @param {string} rolePath - The role path in format groups/{ULIDv2}/roles/{role_id}.
45
+ * @returns {number | null} The role ID if valid, null otherwise.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * extractRoleIdFromPath('groups/01ARZ3NDEKTSV4YWVF8F5BH32/roles/1000000');
50
+ * // Returns: 1000000
51
+ *
52
+ * extractRoleIdFromPath('invalid/path');
53
+ * // Returns: null
54
+ * ```
55
+ */
56
+ export declare function extractRoleIdFromPath(rolePath: string): number | null;
57
+ /**
58
+ * Extracts the group resource name from a role path.
59
+ * @param {string} rolePath - The role path in format groups/{ULIDv2}/roles/{role_id}.
60
+ * @returns {string | null} The group resource name (groups/{ULIDv2}) if valid, null otherwise.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * extractGroupFromRolePath('groups/01ARZ3NDEKTSV4YWVF8F5BH32/roles/1000000');
65
+ * // Returns: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
66
+ *
67
+ * extractGroupFromRolePath('invalid/path');
68
+ * // Returns: null
69
+ * ```
70
+ */
71
+ export declare function extractGroupFromRolePath(rolePath: string): string | null;
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allRoles = void 0;
4
+ exports.roleToString = roleToString;
5
+ exports.stringToRole = stringToRole;
6
+ exports.createRolePath = createRolePath;
7
+ exports.isValidRolePath = isValidRolePath;
8
+ exports.extractRoleIdFromPath = extractRoleIdFromPath;
9
+ exports.extractGroupFromRolePath = extractGroupFromRolePath;
10
+ const role_pb_1 = require("./role_pb");
11
+ // Get all roles as enum values
12
+ exports.allRoles = Object.values(role_pb_1.Role).filter((value) => typeof value === "number");
13
+ // Define explicit mappings between Role enums and custom string representations
14
+ const roleToStringMapping = {
15
+ [role_pb_1.Role.ROLE_UNSPECIFIED]: "Unspecified",
16
+ [role_pb_1.Role.ROLE_WALLET_ADMIN]: "Wallet Admin",
17
+ [role_pb_1.Role.ROLE_WALLET_VIEWER]: "Wallet Viewer",
18
+ [role_pb_1.Role.ROLE_WALLET_ACCOUNT_ADMIN]: "Wallet Account Admin",
19
+ [role_pb_1.Role.ROLE_WALLET_ACCOUNT_VIEWER]: "Wallet Account Viewer",
20
+ [role_pb_1.Role.ROLE_COMPLIANCE_ADMIN]: "Compliance Admin",
21
+ [role_pb_1.Role.ROLE_COMPLIANCE_VIEWER]: "Compliance Viewer",
22
+ [role_pb_1.Role.ROLE_COMPLIANCE_CLIENT_ADMIN]: "Compliance Client Admin",
23
+ [role_pb_1.Role.ROLE_COMPLIANCE_CLIENT_VIEWER]: "Compliance Client Viewer",
24
+ [role_pb_1.Role.ROLE_IAM_ADMIN]: "IAM Admin",
25
+ [role_pb_1.Role.ROLE_IAM_VIEWER]: "IAM Viewer",
26
+ [role_pb_1.Role.ROLE_IAM_API_USER_ADMIN]: "IAM API User Admin",
27
+ [role_pb_1.Role.ROLE_IAM_API_USER_VIEWER]: "IAM API User Viewer",
28
+ [role_pb_1.Role.ROLE_IAM_GROUP_ADMIN]: "IAM Group Admin",
29
+ [role_pb_1.Role.ROLE_IAM_GROUP_VIEWER]: "IAM Group Viewer",
30
+ [role_pb_1.Role.ROLE_IAM_USER_ADMIN]: "IAM User Admin",
31
+ [role_pb_1.Role.ROLE_IAM_USER_VIEWER]: "IAM User Viewer",
32
+ [role_pb_1.Role.ROLE_STUDIO_ADMIN]: "Studio Admin",
33
+ [role_pb_1.Role.ROLE_STUDIO_VIEWER]: "Studio Viewer",
34
+ [role_pb_1.Role.ROLE_STUDIO_INSTRUMENT_ADMIN]: "Studio Instrument Admin",
35
+ [role_pb_1.Role.ROLE_STUDIO_INSTRUMENT_VIEWER]: "Studio Instrument Viewer",
36
+ [role_pb_1.Role.ROLE_TRADING_ADMIN]: "Trading Admin",
37
+ [role_pb_1.Role.ROLE_TRADING_VIEWER]: "Trading Viewer",
38
+ [role_pb_1.Role.ROLE_TRADING_LIMIT_ORDER_ADMIN]: "Trading Limit Order Admin",
39
+ [role_pb_1.Role.ROLE_TRADING_LIMIT_ORDER_VIEWER]: "Trading Limit Order Viewer",
40
+ [role_pb_1.Role.ROLE_REPORTING_ADMIN]: "Reporting Admin",
41
+ [role_pb_1.Role.ROLE_REPORTING_VIEWER]: "Reporting Viewer",
42
+ [role_pb_1.Role.ROLE_LEDGER_ADMIN]: "Ledger Admin",
43
+ [role_pb_1.Role.ROLE_LEDGER_VIEWER]: "Ledger Viewer",
44
+ [role_pb_1.Role.ROLE_LEDGER_TRANSACTION_ADMIN]: "Ledger Transaction Admin",
45
+ [role_pb_1.Role.ROLE_LEDGER_TRANSACTION_VIEWER]: "Ledger Transaction Viewer",
46
+ [role_pb_1.Role.ROLE_MARKET_DATA_ADMIN]: "Market Data Admin",
47
+ [role_pb_1.Role.ROLE_MARKET_DATA_VIEWER]: "Market Data Viewer",
48
+ [role_pb_1.Role.ROLE_MARKET_DATA_PRICE_ADMIN]: "Market Data Price Admin",
49
+ [role_pb_1.Role.ROLE_MARKET_DATA_PRICE_VIEWER]: "Market Data Price Viewer",
50
+ };
51
+ // Reverse mapping from string to Role enum
52
+ const stringToRoleMapping = {};
53
+ for (const [key, value] of Object.entries(roleToStringMapping)) {
54
+ stringToRoleMapping[value] = Number(key);
55
+ }
56
+ class UnsupportedRoleError extends Error {
57
+ constructor(role) {
58
+ const message = `Unsupported Role: ${role}`;
59
+ super(message);
60
+ this.role = role;
61
+ }
62
+ }
63
+ /**
64
+ * Converts a Role enum instance to a custom string representation.
65
+ * @param {Role} role - The role to convert.
66
+ * @returns {string} The custom string representation of the role.
67
+ */
68
+ function roleToString(role) {
69
+ if (role in roleToStringMapping) {
70
+ return roleToStringMapping[role];
71
+ }
72
+ else {
73
+ throw new UnsupportedRoleError(role);
74
+ }
75
+ }
76
+ class UnsupportedRoleStringError extends Error {
77
+ constructor(roleStr) {
78
+ const message = `Unsupported role string: ${roleStr}`;
79
+ super(message);
80
+ this.roleStr = roleStr;
81
+ }
82
+ }
83
+ /**
84
+ * Converts a custom string representation to a Role enum instance.
85
+ * @param {string} roleStr - The custom string representation of the role.
86
+ * @returns {Role} The corresponding Role enum instance.
87
+ */
88
+ function stringToRole(roleStr) {
89
+ if (roleStr in stringToRoleMapping) {
90
+ return stringToRoleMapping[roleStr];
91
+ }
92
+ else {
93
+ throw new UnsupportedRoleStringError(roleStr);
94
+ }
95
+ }
96
+ /**
97
+ * Validates whether a ULID string is in the correct format.
98
+ * ULIDs use Crockford's base32 alphabet (0-9, A-Z excluding I, L, O, U) and are 26 characters long.
99
+ * @param {string} ulid - The ULID to validate.
100
+ * @returns {boolean} True if the ULID is valid, false otherwise.
101
+ */
102
+ function isValidULID(ulid) {
103
+ return /^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/.test(ulid);
104
+ }
105
+ /**
106
+ * Validates whether a role ID is in the valid range.
107
+ * Role IDs must be 7 or 8 digits and cannot start with 0.
108
+ * @param {number} roleId - The role ID to validate.
109
+ * @returns {boolean} True if the role ID is valid, false otherwise.
110
+ */
111
+ function isValidRoleId(roleId) {
112
+ return roleId >= 1000000 && roleId <= 99999999;
113
+ }
114
+ /**
115
+ * Creates a role path resource name from a group ULID and role ID.
116
+ * @param {string} groupULID - The group ULID (26 characters).
117
+ * @param {number} roleId - The role ID enum value.
118
+ * @returns {string} The role path in format groups/{ULIDv2}/roles/{role_id}.
119
+ * @throws {Error} If the group ULID is invalid.
120
+ * @throws {Error} If the role ID is invalid.
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * createRolePath('01ARZ3NDEKTSV4YWVF8F5BH32', Role.ROLE_IAM_ADMIN);
125
+ * // Returns: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32/roles/1000000'
126
+ * ```
127
+ */
128
+ function createRolePath(groupULID, roleId) {
129
+ if (!isValidULID(groupULID)) {
130
+ throw new Error(`Invalid group ULID: ${groupULID}. Must be 26 uppercase alphanumeric characters.`);
131
+ }
132
+ if (!isValidRoleId(roleId)) {
133
+ throw new Error(`Invalid role ID: ${roleId}. Must be between 1000000 and 99999999.`);
134
+ }
135
+ return `groups/${groupULID}/roles/${roleId}`;
136
+ }
137
+ /**
138
+ * Validates whether a role path is in the correct format.
139
+ * @param {string} rolePath - The role path to validate.
140
+ * @returns {boolean} True if the role path is valid, false otherwise.
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * isValidRolePath('groups/01ARZ3NDEKTSV4YWVF8F5BH32Q/roles/1000000'); // true
145
+ * isValidRolePath('groups/01ARZ3NDEKTSV4YWVF8F5BH32Q/1000000'); // false (old format)
146
+ * ```
147
+ */
148
+ function isValidRolePath(rolePath) {
149
+ return /^groups\/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}\/roles\/[1-9][0-9]{6,7}$/.test(rolePath);
150
+ }
151
+ /**
152
+ * Extracts the role ID from a role path.
153
+ * @param {string} rolePath - The role path in format groups/{ULIDv2}/roles/{role_id}.
154
+ * @returns {number | null} The role ID if valid, null otherwise.
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * extractRoleIdFromPath('groups/01ARZ3NDEKTSV4YWVF8F5BH32/roles/1000000');
159
+ * // Returns: 1000000
160
+ *
161
+ * extractRoleIdFromPath('invalid/path');
162
+ * // Returns: null
163
+ * ```
164
+ */
165
+ function extractRoleIdFromPath(rolePath) {
166
+ if (!isValidRolePath(rolePath)) {
167
+ return null;
168
+ }
169
+ const parts = rolePath.split("/");
170
+ return parseInt(parts[3], 10);
171
+ }
172
+ /**
173
+ * Extracts the group resource name from a role path.
174
+ * @param {string} rolePath - The role path in format groups/{ULIDv2}/roles/{role_id}.
175
+ * @returns {string | null} The group resource name (groups/{ULIDv2}) if valid, null otherwise.
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * extractGroupFromRolePath('groups/01ARZ3NDEKTSV4YWVF8F5BH32/roles/1000000');
180
+ * // Returns: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
181
+ *
182
+ * extractGroupFromRolePath('invalid/path');
183
+ * // Returns: null
184
+ * ```
185
+ */
186
+ function extractGroupFromRolePath(rolePath) {
187
+ if (!isValidRolePath(rolePath)) {
188
+ return null;
189
+ }
190
+ const parts = rolePath.split("/");
191
+ return `${parts[0]}/${parts[1]}`;
192
+ }
@@ -0,0 +1,41 @@
1
+ import * as jspb from 'google-protobuf'
2
+
3
+
4
+
5
+ export enum Role {
6
+ ROLE_UNSPECIFIED = 0,
7
+ ROLE_WALLET_ADMIN = 1000000,
8
+ ROLE_WALLET_VIEWER = 1000001,
9
+ ROLE_WALLET_ACCOUNT_ADMIN = 1000002,
10
+ ROLE_WALLET_ACCOUNT_VIEWER = 1000003,
11
+ ROLE_COMPLIANCE_ADMIN = 2000000,
12
+ ROLE_COMPLIANCE_VIEWER = 2000001,
13
+ ROLE_COMPLIANCE_CLIENT_ADMIN = 2000002,
14
+ ROLE_COMPLIANCE_CLIENT_VIEWER = 2000003,
15
+ ROLE_IAM_ADMIN = 3000000,
16
+ ROLE_IAM_VIEWER = 3000001,
17
+ ROLE_IAM_API_USER_ADMIN = 3000002,
18
+ ROLE_IAM_API_USER_VIEWER = 3000003,
19
+ ROLE_IAM_GROUP_ADMIN = 3000004,
20
+ ROLE_IAM_GROUP_VIEWER = 3000005,
21
+ ROLE_IAM_USER_ADMIN = 3000006,
22
+ ROLE_IAM_USER_VIEWER = 3000007,
23
+ ROLE_STUDIO_ADMIN = 4000000,
24
+ ROLE_STUDIO_VIEWER = 4000001,
25
+ ROLE_STUDIO_INSTRUMENT_ADMIN = 4000002,
26
+ ROLE_STUDIO_INSTRUMENT_VIEWER = 4000003,
27
+ ROLE_TRADING_ADMIN = 5000000,
28
+ ROLE_TRADING_VIEWER = 5000001,
29
+ ROLE_TRADING_LIMIT_ORDER_ADMIN = 5000002,
30
+ ROLE_TRADING_LIMIT_ORDER_VIEWER = 5000003,
31
+ ROLE_REPORTING_ADMIN = 6000000,
32
+ ROLE_REPORTING_VIEWER = 6000001,
33
+ ROLE_LEDGER_ADMIN = 7000000,
34
+ ROLE_LEDGER_VIEWER = 7000001,
35
+ ROLE_LEDGER_TRANSACTION_ADMIN = 7000002,
36
+ ROLE_LEDGER_TRANSACTION_VIEWER = 7000003,
37
+ ROLE_MARKET_DATA_ADMIN = 8000000,
38
+ ROLE_MARKET_DATA_VIEWER = 8000001,
39
+ ROLE_MARKET_DATA_PRICE_ADMIN = 8000002,
40
+ ROLE_MARKET_DATA_PRICE_VIEWER = 8000003,
41
+ }
@@ -0,0 +1,66 @@
1
+ // source: meshtrade/iam/role/v1/role.proto
2
+ /**
3
+ * @fileoverview
4
+ * @enhanceable
5
+ * @suppress {missingRequire} reports error on implicit type usages.
6
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
7
+ * field starts with 'MSG_' and isn't a translatable message.
8
+ * @public
9
+ */
10
+ // GENERATED CODE -- DO NOT EDIT!
11
+ /* eslint-disable */
12
+ // @ts-nocheck
13
+
14
+ var jspb = require('google-protobuf');
15
+ var goog = jspb;
16
+ var global =
17
+ (typeof globalThis !== 'undefined' && globalThis) ||
18
+ (typeof window !== 'undefined' && window) ||
19
+ (typeof global !== 'undefined' && global) ||
20
+ (typeof self !== 'undefined' && self) ||
21
+ (function () { return this; }).call(null) ||
22
+ Function('return this')();
23
+
24
+ goog.exportSymbol('proto.meshtrade.iam.role.v1.Role', null, global);
25
+ /**
26
+ * @enum {number}
27
+ */
28
+ proto.meshtrade.iam.role.v1.Role = {
29
+ ROLE_UNSPECIFIED: 0,
30
+ ROLE_WALLET_ADMIN: 1000000,
31
+ ROLE_WALLET_VIEWER: 1000001,
32
+ ROLE_WALLET_ACCOUNT_ADMIN: 1000002,
33
+ ROLE_WALLET_ACCOUNT_VIEWER: 1000003,
34
+ ROLE_COMPLIANCE_ADMIN: 2000000,
35
+ ROLE_COMPLIANCE_VIEWER: 2000001,
36
+ ROLE_COMPLIANCE_CLIENT_ADMIN: 2000002,
37
+ ROLE_COMPLIANCE_CLIENT_VIEWER: 2000003,
38
+ ROLE_IAM_ADMIN: 3000000,
39
+ ROLE_IAM_VIEWER: 3000001,
40
+ ROLE_IAM_API_USER_ADMIN: 3000002,
41
+ ROLE_IAM_API_USER_VIEWER: 3000003,
42
+ ROLE_IAM_GROUP_ADMIN: 3000004,
43
+ ROLE_IAM_GROUP_VIEWER: 3000005,
44
+ ROLE_IAM_USER_ADMIN: 3000006,
45
+ ROLE_IAM_USER_VIEWER: 3000007,
46
+ ROLE_STUDIO_ADMIN: 4000000,
47
+ ROLE_STUDIO_VIEWER: 4000001,
48
+ ROLE_STUDIO_INSTRUMENT_ADMIN: 4000002,
49
+ ROLE_STUDIO_INSTRUMENT_VIEWER: 4000003,
50
+ ROLE_TRADING_ADMIN: 5000000,
51
+ ROLE_TRADING_VIEWER: 5000001,
52
+ ROLE_TRADING_LIMIT_ORDER_ADMIN: 5000002,
53
+ ROLE_TRADING_LIMIT_ORDER_VIEWER: 5000003,
54
+ ROLE_REPORTING_ADMIN: 6000000,
55
+ ROLE_REPORTING_VIEWER: 6000001,
56
+ ROLE_LEDGER_ADMIN: 7000000,
57
+ ROLE_LEDGER_VIEWER: 7000001,
58
+ ROLE_LEDGER_TRANSACTION_ADMIN: 7000002,
59
+ ROLE_LEDGER_TRANSACTION_VIEWER: 7000003,
60
+ ROLE_MARKET_DATA_ADMIN: 8000000,
61
+ ROLE_MARKET_DATA_VIEWER: 8000001,
62
+ ROLE_MARKET_DATA_PRICE_ADMIN: 8000002,
63
+ ROLE_MARKET_DATA_PRICE_VIEWER: 8000003
64
+ };
65
+
66
+ goog.object.extend(exports, proto.meshtrade.iam.role.v1);
@@ -0,0 +1,4 @@
1
+ export * from "./service_grpc_web_client_meshts";
2
+ export * from "./service_grpc_web_pb";
3
+ export * from "./service_pb";
4
+ export * from "./user_pb";
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // ===================================================================
3
+ // AUTO-GENERATED SECTION - ONLY EDIT BELOW THE CLOSING COMMENT BLOCK
4
+ // ===================================================================
5
+ // This section is automatically managed by protoc-gen-meshts.
6
+ //
7
+ // DO NOT EDIT ANYTHING IN THIS SECTION MANUALLY!
8
+ // Your changes will be overwritten during code generation.
9
+ //
10
+ // To add custom exports, scroll down to the
11
+ // "MANUAL EXPORTS" section indicated below.
12
+ // ===================================================================
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ // Generated exports
29
+ __exportStar(require("./service_grpc_web_client_meshts"), exports);
30
+ __exportStar(require("./service_grpc_web_pb"), exports);
31
+ __exportStar(require("./service_pb"), exports);
32
+ __exportStar(require("./user_pb"), exports);
33
+ // ===================================================================
34
+ // END OF AUTO-GENERATED SECTION
35
+ // ===================================================================
36
+ //
37
+ // MANUAL EXPORTS - ADD YOUR CUSTOM EXPORTS BELOW
38
+ //
39
+ // You can safely add your own export statements in this section.
40
+ // They will be preserved across code generation.
41
+ //
42
+ // Example:
43
+ // export * from "./my_custom_module";
44
+ // export { MyCustomClass } from "./another_module";
45
+ // ===================================================================
@@ -0,0 +1,77 @@
1
+ import { AssignRolesToUserRequest, CreateUserRequest, GetUserByEmailRequest, GetUserRequest, ListUsersRequest, ListUsersResponse, RevokeRolesFromUserRequest, SearchUsersRequest, SearchUsersResponse, UpdateUserRequest } from "./service_pb";
2
+ import { User } from "./user_pb";
3
+ import { UnaryInterceptor } from "grpc-web";
4
+ import { ConfigOpts } from "../../../common/config";
5
+ /**
6
+ * Client for interacting with the meshtrade.iam.user.v1 user v1 API resource service.
7
+ */
8
+ export declare class UserServiceGrpcWebClientV1 {
9
+ private _service;
10
+ private readonly _config;
11
+ private readonly _interceptors;
12
+ /**
13
+ * Constructs an instance of UserServiceGrpcWebClientV1.
14
+ * @param {ConfigOpts} [config] - Optional configuration for the client.
15
+ * @param {UnaryInterceptor<any, any>[]} [interceptors] - For internal use by `withGroup`.
16
+ */
17
+ constructor(config?: ConfigOpts, interceptors?: UnaryInterceptor<any, any>[]);
18
+ /**
19
+ * Returns a new client instance configured to send the specified group
20
+ * resource name in the request headers for subsequent API calls.
21
+ *
22
+ * @param {string} group - The operating group context to inject into the request
23
+ * in the format `groups/{ulid}` where {ulid} is a 26-character ULID.
24
+ * Example: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
25
+ * @returns {UserServiceGrpcWebClientV1} A new, configured instance of the client.
26
+ * @throws {Error} If the group format is invalid (validation occurs in GroupHeaderInterceptor)
27
+ */
28
+ withGroup(group: string): UserServiceGrpcWebClientV1;
29
+ /**
30
+ * Performs assignrolestouser operation on user.
31
+ * @param {AssignRolesToUserRequest} request - The request object for assignrolestouser.
32
+ * @returns {Promise<User>} A promise that resolves with the user.
33
+ */
34
+ assignRolesToUser(request: AssignRolesToUserRequest): Promise<User>;
35
+ /**
36
+ * Performs revokerolesfromuser operation on user.
37
+ * @param {RevokeRolesFromUserRequest} request - The request object for revokerolesfromuser.
38
+ * @returns {Promise<User>} A promise that resolves with the user.
39
+ */
40
+ revokeRolesFromUser(request: RevokeRolesFromUserRequest): Promise<User>;
41
+ /**
42
+ * Retrieves an user.
43
+ * @param {GetUserRequest} request - The request object for getuser.
44
+ * @returns {Promise<User>} A promise that resolves with the user.
45
+ */
46
+ getUser(request: GetUserRequest): Promise<User>;
47
+ /**
48
+ * Retrieves an user.
49
+ * @param {GetUserByEmailRequest} request - The request object for getuserbyemail.
50
+ * @returns {Promise<User>} A promise that resolves with the user.
51
+ */
52
+ getUserByEmail(request: GetUserByEmailRequest): Promise<User>;
53
+ /**
54
+ * Retrieves a list of users.
55
+ * @param {ListUsersRequest} request - The request object for listusers.
56
+ * @returns {Promise<ListUsersResponse>} A promise that resolves with the list of users.
57
+ */
58
+ listUsers(request: ListUsersRequest): Promise<ListUsersResponse>;
59
+ /**
60
+ * Searches for users.
61
+ * @param {SearchUsersRequest} request - The request object for searchusers.
62
+ * @returns {Promise<SearchUsersResponse>} A promise that resolves with the search results.
63
+ */
64
+ searchUsers(request: SearchUsersRequest): Promise<SearchUsersResponse>;
65
+ /**
66
+ * Creates a new user.
67
+ * @param {CreateUserRequest} request - The request object for createuser.
68
+ * @returns {Promise<User>} A promise that resolves with the user.
69
+ */
70
+ createUser(request: CreateUserRequest): Promise<User>;
71
+ /**
72
+ * Updates an existing user.
73
+ * @param {UpdateUserRequest} request - The request object for updateuser.
74
+ * @returns {Promise<User>} A promise that resolves with the user.
75
+ */
76
+ updateUser(request: UpdateUserRequest): Promise<User>;
77
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ // @generated by protoc-gen-meshts v1
3
+ // @generated from file meshtrade/iam/user/v1/service.proto (package meshtrade.iam.user.v1, syntax proto3)
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UserServiceGrpcWebClientV1 = void 0;
7
+ const grpc_web_1 = require("../../../common/grpc_web");
8
+ const service_grpc_web_pb_1 = require("./service_grpc_web_pb");
9
+ const config_1 = require("../../../common/config");
10
+ const groupHeaderInterceptor_1 = require("../../../common/groupHeaderInterceptor");
11
+ /**
12
+ * Client for interacting with the meshtrade.iam.user.v1 user v1 API resource service.
13
+ */
14
+ class UserServiceGrpcWebClientV1 {
15
+ /**
16
+ * Constructs an instance of UserServiceGrpcWebClientV1.
17
+ * @param {ConfigOpts} [config] - Optional configuration for the client.
18
+ * @param {UnaryInterceptor<any, any>[]} [interceptors] - For internal use by `withGroup`.
19
+ */
20
+ constructor(config, interceptors) {
21
+ this._config = (0, config_1.getConfigFromOpts)(config);
22
+ this._interceptors = interceptors || [new grpc_web_1.LoggingInterceptor()];
23
+ // Construct the underlying gRPC-web service client
24
+ this._service = new service_grpc_web_pb_1.UserServicePromiseClient(this._config.apiServerURL, null, {
25
+ withCredentials: true,
26
+ unaryInterceptors: this._interceptors,
27
+ });
28
+ }
29
+ /**
30
+ * Returns a new client instance configured to send the specified group
31
+ * resource name in the request headers for subsequent API calls.
32
+ *
33
+ * @param {string} group - The operating group context to inject into the request
34
+ * in the format `groups/{ulid}` where {ulid} is a 26-character ULID.
35
+ * Example: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
36
+ * @returns {UserServiceGrpcWebClientV1} A new, configured instance of the client.
37
+ * @throws {Error} If the group format is invalid (validation occurs in GroupHeaderInterceptor)
38
+ */
39
+ withGroup(group) {
40
+ // Check if a GroupHeaderInterceptor already exists.
41
+ const hasGroupInterceptor = this._interceptors.some((interceptor) => interceptor instanceof groupHeaderInterceptor_1.GroupHeaderInterceptor);
42
+ if (hasGroupInterceptor) {
43
+ throw new Error("Attempted to set group context twice. A group has already been set for this client instance.");
44
+ }
45
+ // Create a new interceptor for the group context
46
+ const groupInterceptor = new groupHeaderInterceptor_1.GroupHeaderInterceptor(group);
47
+ // Return a new client instance with the existing interceptors plus the new one
48
+ return new UserServiceGrpcWebClientV1(this._config, [
49
+ ...this._interceptors,
50
+ groupInterceptor,
51
+ ]);
52
+ }
53
+ /**
54
+ * Performs assignrolestouser operation on user.
55
+ * @param {AssignRolesToUserRequest} request - The request object for assignrolestouser.
56
+ * @returns {Promise<User>} A promise that resolves with the user.
57
+ */
58
+ assignRolesToUser(request) {
59
+ return this._service.assignRolesToUser(request);
60
+ }
61
+ /**
62
+ * Performs revokerolesfromuser operation on user.
63
+ * @param {RevokeRolesFromUserRequest} request - The request object for revokerolesfromuser.
64
+ * @returns {Promise<User>} A promise that resolves with the user.
65
+ */
66
+ revokeRolesFromUser(request) {
67
+ return this._service.revokeRolesFromUser(request);
68
+ }
69
+ /**
70
+ * Retrieves an user.
71
+ * @param {GetUserRequest} request - The request object for getuser.
72
+ * @returns {Promise<User>} A promise that resolves with the user.
73
+ */
74
+ getUser(request) {
75
+ return this._service.getUser(request);
76
+ }
77
+ /**
78
+ * Retrieves an user.
79
+ * @param {GetUserByEmailRequest} request - The request object for getuserbyemail.
80
+ * @returns {Promise<User>} A promise that resolves with the user.
81
+ */
82
+ getUserByEmail(request) {
83
+ return this._service.getUserByEmail(request);
84
+ }
85
+ /**
86
+ * Retrieves a list of users.
87
+ * @param {ListUsersRequest} request - The request object for listusers.
88
+ * @returns {Promise<ListUsersResponse>} A promise that resolves with the list of users.
89
+ */
90
+ listUsers(request) {
91
+ return this._service.listUsers(request);
92
+ }
93
+ /**
94
+ * Searches for users.
95
+ * @param {SearchUsersRequest} request - The request object for searchusers.
96
+ * @returns {Promise<SearchUsersResponse>} A promise that resolves with the search results.
97
+ */
98
+ searchUsers(request) {
99
+ return this._service.searchUsers(request);
100
+ }
101
+ /**
102
+ * Creates a new user.
103
+ * @param {CreateUserRequest} request - The request object for createuser.
104
+ * @returns {Promise<User>} A promise that resolves with the user.
105
+ */
106
+ createUser(request) {
107
+ return this._service.createUser(request);
108
+ }
109
+ /**
110
+ * Updates an existing user.
111
+ * @param {UpdateUserRequest} request - The request object for updateuser.
112
+ * @returns {Promise<User>} A promise that resolves with the user.
113
+ */
114
+ updateUser(request) {
115
+ return this._service.updateUser(request);
116
+ }
117
+ }
118
+ exports.UserServiceGrpcWebClientV1 = UserServiceGrpcWebClientV1;