@newpeak/barista-cli 0.1.0 → 0.1.2

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 (182) hide show
  1. package/dist/commands/arabica/auth/index.d.ts +3 -0
  2. package/dist/commands/arabica/auth/index.d.ts.map +1 -0
  3. package/dist/commands/arabica/auth/index.js +244 -0
  4. package/dist/commands/arabica/auth/index.js.map +1 -0
  5. package/dist/commands/arabica/auth/login.d.ts +3 -0
  6. package/dist/commands/arabica/auth/login.d.ts.map +1 -0
  7. package/dist/commands/arabica/auth/login.js +5 -0
  8. package/dist/commands/arabica/auth/login.js.map +1 -0
  9. package/dist/commands/arabica/auth/logout.d.ts +3 -0
  10. package/dist/commands/arabica/auth/logout.d.ts.map +1 -0
  11. package/dist/commands/arabica/auth/logout.js +5 -0
  12. package/dist/commands/arabica/auth/logout.js.map +1 -0
  13. package/dist/commands/arabica/auth/register.d.ts +3 -0
  14. package/dist/commands/arabica/auth/register.d.ts.map +1 -0
  15. package/dist/commands/arabica/auth/register.js +5 -0
  16. package/dist/commands/arabica/auth/register.js.map +1 -0
  17. package/dist/commands/arabica/auth/status.d.ts +3 -0
  18. package/dist/commands/arabica/auth/status.d.ts.map +1 -0
  19. package/dist/commands/arabica/auth/status.js +5 -0
  20. package/dist/commands/arabica/auth/status.js.map +1 -0
  21. package/dist/commands/arabica/index.d.ts +3 -0
  22. package/dist/commands/arabica/index.d.ts.map +1 -0
  23. package/dist/commands/arabica/index.js +20 -0
  24. package/dist/commands/arabica/index.js.map +1 -0
  25. package/dist/commands/auth.d.ts +3 -0
  26. package/dist/commands/auth.d.ts.map +1 -0
  27. package/dist/commands/auth.js +92 -0
  28. package/dist/commands/auth.js.map +1 -0
  29. package/dist/commands/context.d.ts +3 -0
  30. package/dist/commands/context.d.ts.map +1 -0
  31. package/dist/commands/context.js +50 -0
  32. package/dist/commands/context.js.map +1 -0
  33. package/dist/commands/liberica/auth/index.d.ts +3 -0
  34. package/dist/commands/liberica/auth/index.d.ts.map +1 -0
  35. package/dist/commands/liberica/auth/index.js +152 -0
  36. package/dist/commands/liberica/auth/index.js.map +1 -0
  37. package/dist/commands/liberica/context/index.d.ts +3 -0
  38. package/dist/commands/liberica/context/index.d.ts.map +1 -0
  39. package/dist/commands/liberica/context/index.js +36 -0
  40. package/dist/commands/liberica/context/index.js.map +1 -0
  41. package/dist/commands/liberica/employees/create.d.ts +3 -0
  42. package/dist/commands/liberica/employees/create.d.ts.map +1 -0
  43. package/dist/commands/liberica/employees/create.js +262 -0
  44. package/dist/commands/liberica/employees/create.js.map +1 -0
  45. package/dist/commands/liberica/employees/delete.d.ts +3 -0
  46. package/dist/commands/liberica/employees/delete.d.ts.map +1 -0
  47. package/dist/commands/liberica/employees/delete.js +119 -0
  48. package/dist/commands/liberica/employees/delete.js.map +1 -0
  49. package/dist/commands/liberica/employees/disable.d.ts +3 -0
  50. package/dist/commands/liberica/employees/disable.d.ts.map +1 -0
  51. package/dist/commands/liberica/employees/disable.js +88 -0
  52. package/dist/commands/liberica/employees/disable.js.map +1 -0
  53. package/dist/commands/liberica/employees/enable.d.ts +3 -0
  54. package/dist/commands/liberica/employees/enable.d.ts.map +1 -0
  55. package/dist/commands/liberica/employees/enable.js +88 -0
  56. package/dist/commands/liberica/employees/enable.js.map +1 -0
  57. package/dist/commands/liberica/employees/get.d.ts +3 -0
  58. package/dist/commands/liberica/employees/get.d.ts.map +1 -0
  59. package/dist/commands/liberica/employees/get.js +104 -0
  60. package/dist/commands/liberica/employees/get.js.map +1 -0
  61. package/dist/commands/liberica/employees/index.d.ts +3 -0
  62. package/dist/commands/liberica/employees/index.d.ts.map +1 -0
  63. package/dist/commands/liberica/employees/index.js +21 -0
  64. package/dist/commands/liberica/employees/index.js.map +1 -0
  65. package/dist/commands/liberica/employees/list.d.ts +3 -0
  66. package/dist/commands/liberica/employees/list.d.ts.map +1 -0
  67. package/dist/commands/liberica/employees/list.js +98 -0
  68. package/dist/commands/liberica/employees/list.js.map +1 -0
  69. package/dist/commands/liberica/employees/update.d.ts +3 -0
  70. package/dist/commands/liberica/employees/update.d.ts.map +1 -0
  71. package/dist/commands/liberica/employees/update.js +147 -0
  72. package/dist/commands/liberica/employees/update.js.map +1 -0
  73. package/dist/commands/liberica/index.d.ts +3 -0
  74. package/dist/commands/liberica/index.d.ts.map +1 -0
  75. package/dist/commands/liberica/index.js +33 -0
  76. package/dist/commands/liberica/index.js.map +1 -0
  77. package/dist/commands/liberica/orgs/index.d.ts +3 -0
  78. package/dist/commands/liberica/orgs/index.d.ts.map +1 -0
  79. package/dist/commands/liberica/orgs/index.js +27 -0
  80. package/dist/commands/liberica/orgs/index.js.map +1 -0
  81. package/dist/commands/liberica/positions/index.d.ts +3 -0
  82. package/dist/commands/liberica/positions/index.d.ts.map +1 -0
  83. package/dist/commands/liberica/positions/index.js +24 -0
  84. package/dist/commands/liberica/positions/index.js.map +1 -0
  85. package/dist/commands/liberica/roles/index.d.ts +3 -0
  86. package/dist/commands/liberica/roles/index.d.ts.map +1 -0
  87. package/dist/commands/liberica/roles/index.js +50 -0
  88. package/dist/commands/liberica/roles/index.js.map +1 -0
  89. package/dist/commands/liberica/users/create.d.ts +3 -0
  90. package/dist/commands/liberica/users/create.d.ts.map +1 -0
  91. package/dist/commands/liberica/users/create.js +112 -0
  92. package/dist/commands/liberica/users/create.js.map +1 -0
  93. package/dist/commands/liberica/users/delete.d.ts +3 -0
  94. package/dist/commands/liberica/users/delete.d.ts.map +1 -0
  95. package/dist/commands/liberica/users/delete.js +41 -0
  96. package/dist/commands/liberica/users/delete.js.map +1 -0
  97. package/dist/commands/liberica/users/disable.d.ts +3 -0
  98. package/dist/commands/liberica/users/disable.d.ts.map +1 -0
  99. package/dist/commands/liberica/users/disable.js +34 -0
  100. package/dist/commands/liberica/users/disable.js.map +1 -0
  101. package/dist/commands/liberica/users/enable.d.ts +3 -0
  102. package/dist/commands/liberica/users/enable.d.ts.map +1 -0
  103. package/dist/commands/liberica/users/enable.js +24 -0
  104. package/dist/commands/liberica/users/enable.js.map +1 -0
  105. package/dist/commands/liberica/users/get.d.ts +3 -0
  106. package/dist/commands/liberica/users/get.d.ts.map +1 -0
  107. package/dist/commands/liberica/users/get.js +38 -0
  108. package/dist/commands/liberica/users/get.js.map +1 -0
  109. package/dist/commands/liberica/users/index.d.ts +3 -0
  110. package/dist/commands/liberica/users/index.d.ts.map +1 -0
  111. package/dist/commands/liberica/users/index.js +25 -0
  112. package/dist/commands/liberica/users/index.js.map +1 -0
  113. package/dist/commands/liberica/users/list.d.ts +3 -0
  114. package/dist/commands/liberica/users/list.d.ts.map +1 -0
  115. package/dist/commands/liberica/users/list.js +59 -0
  116. package/dist/commands/liberica/users/list.js.map +1 -0
  117. package/dist/commands/liberica/users/me.d.ts +3 -0
  118. package/dist/commands/liberica/users/me.d.ts.map +1 -0
  119. package/dist/commands/liberica/users/me.js +34 -0
  120. package/dist/commands/liberica/users/me.js.map +1 -0
  121. package/dist/commands/liberica/users/reset-password.d.ts +3 -0
  122. package/dist/commands/liberica/users/reset-password.d.ts.map +1 -0
  123. package/dist/commands/liberica/users/reset-password.js +35 -0
  124. package/dist/commands/liberica/users/reset-password.js.map +1 -0
  125. package/dist/commands/liberica/users/update.d.ts +3 -0
  126. package/dist/commands/liberica/users/update.d.ts.map +1 -0
  127. package/dist/commands/liberica/users/update.js +42 -0
  128. package/dist/commands/liberica/users/update.js.map +1 -0
  129. package/dist/core/api/client.d.ts +114 -0
  130. package/dist/core/api/client.d.ts.map +1 -0
  131. package/dist/core/api/client.js +644 -0
  132. package/dist/core/api/client.js.map +1 -0
  133. package/dist/core/auth/token-manager.d.ts +26 -0
  134. package/dist/core/auth/token-manager.d.ts.map +1 -0
  135. package/dist/core/auth/token-manager.js +158 -0
  136. package/dist/core/auth/token-manager.js.map +1 -0
  137. package/dist/core/config/manager.d.ts +17 -0
  138. package/dist/core/config/manager.d.ts.map +1 -0
  139. package/dist/core/config/manager.js +153 -0
  140. package/dist/core/config/manager.js.map +1 -0
  141. package/dist/index.d.ts +3 -0
  142. package/dist/index.d.ts.map +1 -0
  143. package/dist/index.js +33 -0
  144. package/dist/index.js.map +1 -0
  145. package/dist/types/employee.d.ts +87 -0
  146. package/dist/types/employee.d.ts.map +1 -0
  147. package/dist/types/employee.js +2 -0
  148. package/dist/types/employee.js.map +1 -0
  149. package/dist/types/index.d.ts +66 -0
  150. package/dist/types/index.d.ts.map +1 -0
  151. package/dist/types/index.js +4 -0
  152. package/dist/types/index.js.map +1 -0
  153. package/dist/types/org.d.ts +22 -0
  154. package/dist/types/org.d.ts.map +1 -0
  155. package/dist/types/org.js +2 -0
  156. package/dist/types/org.js.map +1 -0
  157. package/dist/types/position.d.ts +21 -0
  158. package/dist/types/position.d.ts.map +1 -0
  159. package/dist/types/position.js +2 -0
  160. package/dist/types/position.js.map +1 -0
  161. package/dist/types/user.d.ts +59 -0
  162. package/dist/types/user.d.ts.map +1 -0
  163. package/dist/types/user.js +2 -0
  164. package/dist/types/user.js.map +1 -0
  165. package/package.json +3 -2
  166. package/.eslintrc.json +0 -23
  167. package/.prettierrc +0 -9
  168. package/.sisyphus/notepads/liberica-employees/learnings.md +0 -73
  169. package/AGENTS.md +0 -270
  170. package/CONTRIBUTING.md +0 -291
  171. package/tests/unit/commands/arabica/auth.test.ts +0 -230
  172. package/tests/unit/commands/liberica/auth.test.ts +0 -175
  173. package/tests/unit/commands/liberica/context.test.ts +0 -98
  174. package/tests/unit/commands/liberica/employees/create.test.ts +0 -463
  175. package/tests/unit/commands/liberica/employees/disable.test.ts +0 -82
  176. package/tests/unit/commands/liberica/employees/enable.test.ts +0 -82
  177. package/tests/unit/commands/liberica/employees/get.test.ts +0 -111
  178. package/tests/unit/commands/liberica/employees/list.test.ts +0 -294
  179. package/tests/unit/commands/liberica/employees/update.test.ts +0 -210
  180. package/tests/unit/config.test.ts +0 -141
  181. package/tests/unit/types.test.ts +0 -195
  182. package/tsconfig.json +0 -20
@@ -0,0 +1,24 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { configManager } from '../../../core/config/manager.js';
4
+ import { apiClient } from '../../../core/api/client.js';
5
+ export function createUserEnableCommand() {
6
+ const enableCommand = new Command('enable');
7
+ enableCommand.description('Enable a user');
8
+ enableCommand
9
+ .argument('<userId>', 'User ID')
10
+ .option('--force', 'Skip confirmation')
11
+ .action(async (userId, options) => {
12
+ const context = configManager.getCurrentContext();
13
+ const environment = options.env || context.environment;
14
+ const tenant = options.tenant || context.tenant;
15
+ const response = await apiClient.enableUser(environment, tenant, userId);
16
+ if (!response.success) {
17
+ console.error(chalk.red(`\n✗ Failed: ${response.error?.message}\n`));
18
+ process.exit(1);
19
+ }
20
+ console.log(chalk.green('\n✓ User enabled successfully\n'));
21
+ });
22
+ return enableCommand;
23
+ }
24
+ //# sourceMappingURL=enable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/enable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,uBAAuB;IACrC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,aAAa,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAE3C,aAAa;SACV,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;SAC/B,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC;SACtC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;QAClD,MAAM,WAAW,GAAI,OAAO,CAAC,GAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;QACxE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;QAEhD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAEzE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEL,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserGetCommand(): Command;
3
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,oBAAoB,IAAI,OAAO,CAuC9C"}
@@ -0,0 +1,38 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { configManager } from '../../../core/config/manager.js';
4
+ import { apiClient } from '../../../core/api/client.js';
5
+ export function createUserGetCommand() {
6
+ const getCommand = new Command('get');
7
+ getCommand.description('Get user details');
8
+ getCommand
9
+ .argument('<userId>', 'User ID')
10
+ .option('--json', 'Output as JSON')
11
+ .action(async (userId, options) => {
12
+ const context = configManager.getCurrentContext();
13
+ const environment = options.env || context.environment;
14
+ const tenant = options.tenant || context.tenant;
15
+ const response = await apiClient.getUser(environment, tenant, userId);
16
+ if (!response.success) {
17
+ console.error(chalk.red(`\n✗ Failed: ${response.error?.message}\n`));
18
+ process.exit(1);
19
+ }
20
+ const user = response.data;
21
+ if (options.json) {
22
+ console.log(JSON.stringify({ success: true, data: user }, null, 2));
23
+ return;
24
+ }
25
+ console.log(chalk.bold('\n👤 User Details\n'));
26
+ console.log(chalk.gray('ID: ') + user.userId);
27
+ console.log(chalk.gray('Name: ') + user.realName);
28
+ console.log(chalk.gray('Account: ') + user.account);
29
+ console.log(chalk.gray('Email: ') + (user.email || '-'));
30
+ console.log(chalk.gray('Status: ') + (user.statusFlag === 1 ? chalk.green('Enabled') : chalk.red('Disabled')));
31
+ console.log(chalk.gray('Employee: ') + (user.employeeName || '-'));
32
+ console.log(chalk.gray('Roles: ') + (user.roleNameList?.join(', ') || '-'));
33
+ console.log(chalk.gray('Created: ') + user.createTime);
34
+ console.log();
35
+ });
36
+ return getCommand;
37
+ }
38
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,oBAAoB;IAClC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,UAAU,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAE3C,UAAU;SACP,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;SAC/B,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;QAClD,MAAM,WAAW,GAAI,OAAO,CAAC,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GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACpH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEL,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUsersCommand(): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,kBAAkB,IAAI,OAAO,CAe5C"}
@@ -0,0 +1,25 @@
1
+ import { Command } from 'commander';
2
+ import { createUserCreateCommand } from './create.js';
3
+ import { createUserListCommand } from './list.js';
4
+ import { createUserGetCommand } from './get.js';
5
+ import { createUserUpdateCommand } from './update.js';
6
+ import { createUserDeleteCommand } from './delete.js';
7
+ import { createUserEnableCommand } from './enable.js';
8
+ import { createUserDisableCommand } from './disable.js';
9
+ import { createUserMeCommand } from './me.js';
10
+ import { createUserResetPasswordCommand } from './reset-password.js';
11
+ export function createUsersCommand() {
12
+ const usersCommand = new Command('users');
13
+ usersCommand.description('Manage users');
14
+ usersCommand.addCommand(createUserCreateCommand());
15
+ usersCommand.addCommand(createUserListCommand());
16
+ usersCommand.addCommand(createUserGetCommand());
17
+ usersCommand.addCommand(createUserUpdateCommand());
18
+ usersCommand.addCommand(createUserDeleteCommand());
19
+ usersCommand.addCommand(createUserEnableCommand());
20
+ usersCommand.addCommand(createUserDisableCommand());
21
+ usersCommand.addCommand(createUserMeCommand());
22
+ usersCommand.addCommand(createUserResetPasswordCommand());
23
+ return usersCommand;
24
+ }
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,UAAU,kBAAkB;IAChC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAEzC,YAAY,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACnD,YAAY,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACjD,YAAY,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAChD,YAAY,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACnD,YAAY,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACnD,YAAY,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACnD,YAAY,CAAC,UAAU,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACpD,YAAY,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC/C,YAAY,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAE1D,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserListCommand(): Command;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,qBAAqB,IAAI,OAAO,CA4D/C"}
@@ -0,0 +1,59 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import Table from 'cli-table3';
4
+ import { configManager } from '../../../core/config/manager.js';
5
+ import { apiClient } from '../../../core/api/client.js';
6
+ export function createUserListCommand() {
7
+ const listCommand = new Command('list');
8
+ listCommand.description('List users with pagination');
9
+ listCommand
10
+ .option('-p, --page <number>', 'Page number', '1')
11
+ .option('-s, --size <number>', 'Page size', '20')
12
+ .option('--status <status>', 'Status (1=enabled, 2=disabled)')
13
+ .option('--account <account>', 'Filter by account')
14
+ .option('--real-name <realName>', 'Filter by name')
15
+ .option('--json', 'Output as JSON')
16
+ .action(async (options) => {
17
+ const context = configManager.getCurrentContext();
18
+ const environment = options.env || context.environment;
19
+ const tenant = options.tenant || context.tenant;
20
+ const params = {
21
+ pageNo: parseInt(options.page) - 1,
22
+ pageSize: parseInt(options.size),
23
+ };
24
+ if (options.status)
25
+ params.status = parseInt(options.status);
26
+ if (options.account)
27
+ params.account = options.account;
28
+ if (options.realName)
29
+ params.realName = options.realName;
30
+ const response = await apiClient.listUsers(environment, tenant, params);
31
+ if (!response.success) {
32
+ console.error(chalk.red(`\n✗ Failed: ${response.error?.message}\n`));
33
+ process.exit(1);
34
+ }
35
+ const data = response.data;
36
+ const items = data?.rows || [];
37
+ if (options.json) {
38
+ console.log(JSON.stringify({ success: true, data: { items, pagination: data } }, null, 2));
39
+ return;
40
+ }
41
+ const table = new Table({
42
+ head: [chalk.bold('ID'), chalk.bold('Name'), chalk.bold('Account'), chalk.bold('Email'), chalk.bold('Status')],
43
+ colWidths: [10, 18, 18, 25, 10],
44
+ });
45
+ for (const user of items) {
46
+ table.push([
47
+ user.userId,
48
+ user.realName,
49
+ user.account,
50
+ user.email || '-',
51
+ user.statusFlag === 1 ? chalk.green('Enabled') : chalk.red('Disabled'),
52
+ ]);
53
+ }
54
+ console.log(table.toString());
55
+ console.log(chalk.gray(`\nTotal: ${data?.totalRows || 0} users`));
56
+ });
57
+ return listCommand;
58
+ }
59
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,qBAAqB;IACnC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,WAAW,CAAC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;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,SAAS,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEL,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserMeCommand(): Command;
3
+ //# sourceMappingURL=me.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,mBAAmB,IAAI,OAAO,CAmC7C"}
@@ -0,0 +1,34 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { configManager } from '../../../core/config/manager.js';
4
+ import { apiClient } from '../../../core/api/client.js';
5
+ export function createUserMeCommand() {
6
+ const meCommand = new Command('me');
7
+ meCommand.description('Get current user info');
8
+ meCommand
9
+ .option('--json', 'Output as JSON')
10
+ .action(async (options) => {
11
+ const context = configManager.getCurrentContext();
12
+ const environment = options.env || context.environment;
13
+ const tenant = options.tenant || context.tenant;
14
+ const response = await apiClient.getCurrentUser(environment, tenant);
15
+ if (!response.success) {
16
+ console.error(chalk.red(`\n✗ Failed: ${response.error?.message}\n`));
17
+ process.exit(1);
18
+ }
19
+ const user = response.data;
20
+ if (options.json) {
21
+ console.log(JSON.stringify({ success: true, data: user }, null, 2));
22
+ return;
23
+ }
24
+ console.log(chalk.bold('\n👤 Current User\n'));
25
+ console.log(chalk.gray('ID: ') + user.userId);
26
+ console.log(chalk.gray('Name: ') + user.realName);
27
+ console.log(chalk.gray('Account: ') + user.account);
28
+ console.log(chalk.gray('Email: ') + (user.email || '-'));
29
+ console.log(chalk.gray('Roles: ') + (user.roleNameList?.join(', ') || '-'));
30
+ console.log();
31
+ });
32
+ return meCommand;
33
+ }
34
+ //# sourceMappingURL=me.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"me.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,mBAAmB;IACjC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,SAAS,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAE/C,SAAS;SACN,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;QAClD,MAAM,WAAW,GAAI,OAAO,CAAC,GAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;QACxE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;QAEhD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAErE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAW,CAAC;QAElC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACpE,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEL,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserResetPasswordCommand(): Command;
3
+ //# sourceMappingURL=reset-password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/reset-password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,8BAA8B,IAAI,OAAO,CAkCxD"}
@@ -0,0 +1,35 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import { configManager } from '../../../core/config/manager.js';
5
+ import { apiClient } from '../../../core/api/client.js';
6
+ export function createUserResetPasswordCommand() {
7
+ const resetCommand = new Command('reset-password');
8
+ resetCommand.description('Reset user password');
9
+ resetCommand
10
+ .argument('<userId>', 'User ID')
11
+ .option('--force', 'Skip confirmation')
12
+ .action(async (userId, options) => {
13
+ const context = configManager.getCurrentContext();
14
+ const environment = options.env || context.environment;
15
+ const tenant = options.tenant || context.tenant;
16
+ if (!options.force) {
17
+ const { confirm } = await inquirer.prompt([
18
+ { type: 'confirm', name: 'confirm', message: `Reset password for user ${userId}?`, default: false },
19
+ ]);
20
+ if (!confirm) {
21
+ console.log(chalk.yellow('\n↩ Cancelled\n'));
22
+ process.exit(0);
23
+ }
24
+ }
25
+ const response = await apiClient.resetPassword(environment, tenant, userId);
26
+ if (!response.success) {
27
+ console.error(chalk.red(`\n✗ Failed: ${response.error?.message}\n`));
28
+ process.exit(1);
29
+ }
30
+ console.log(chalk.green('\n✓ Password reset successfully\n'));
31
+ console.log(chalk.yellow('Note: New password will be sent to user email\n'));
32
+ });
33
+ return resetCommand;
34
+ }
35
+ //# sourceMappingURL=reset-password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-password.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/reset-password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,8BAA8B;IAC5C,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnD,YAAY,C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CAAC,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,iDAAiD,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEL,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserUpdateCommand(): Command;
3
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,uBAAuB,IAAI,OAAO,CAyCjD"}
@@ -0,0 +1,42 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { configManager } from '../../../core/config/manager.js';
4
+ import { apiClient } from '../../../core/api/client.js';
5
+ export function createUserUpdateCommand() {
6
+ const updateCommand = new Command('update');
7
+ updateCommand.description('Update user information');
8
+ updateCommand
9
+ .argument('<userId>', 'User ID')
10
+ .option('-n, --name <name>', 'User real name')
11
+ .option('-e, --email <email>', 'User email')
12
+ .option('-r, --role-ids <roleIds>', 'Role IDs (comma-separated)')
13
+ .option('--dry-run', 'Preview without executing')
14
+ .option('--json', 'Output as JSON')
15
+ .action(async (userId, options) => {
16
+ const context = configManager.getCurrentContext();
17
+ const environment = options.env || context.environment;
18
+ const tenant = options.tenant || context.tenant;
19
+ const updateData = { userId };
20
+ if (options.name)
21
+ updateData.realName = options.name;
22
+ if (options.email)
23
+ updateData.email = options.email;
24
+ if (options.roleIds) {
25
+ updateData.roleIdList = options.roleIds.split(',').map((id) => id.trim());
26
+ }
27
+ if (options.dryRun) {
28
+ console.log(chalk.bold('\n🔍 Dry-Run Mode\n'));
29
+ console.log(chalk.gray('Update Data:'));
30
+ console.log(JSON.stringify(updateData, null, 2));
31
+ return;
32
+ }
33
+ const response = await apiClient.updateUser(environment, tenant, updateData);
34
+ if (!response.success) {
35
+ console.error(chalk.red(`\n✗ Failed: ${response.error?.message}\n`));
36
+ process.exit(1);
37
+ }
38
+ console.log(chalk.green('\n✓ User updated successfully\n'));
39
+ });
40
+ return updateCommand;
41
+ }
42
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,uBAAuB;IACrC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,aAAa,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAErD,aAAa;SACV,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;SAC/B,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;SAC7C,MAAM,CAAC,qBAAqB,EAAE,YAAY,CAAC;SAC3C,MAAM,CAAC,0BAA0B,EAAE,4BAA4B,CAAC;SAChE,MAAM,CAAC,WAAW,EAAE,2BAA2B,CAAC;SAChD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;QAClD,MAAM,WAAW,GAAI,OAAO,CAAC,GAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;QACxE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;QAEhD,MAAM,UAAU,GAAQ,EAAE,MAAM,EAAE,CAAC;QACnC,IAAI,OAAO,CAAC,IAAI;YAAE,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ateEmployeeRequest, UpdateEmployeeRequest, EmployeeQueryParams, EmployeeApiResponse } from '../../types/employee.js';
4
+ import { CreateUserRequest, UpdateUserRequest, UserQueryParams, UserApiResponse } from '../../types/user.js';
5
+ import { OrgListItem } from '../../types/org.js';
6
+ import { PositionListItem } from '../../types/position.js';
7
+ export interface LoginResponse {
8
+ token: string;
9
+ expiresAt?: string;
10
+ }
11
+ export declare class APIClient {
12
+ private client;
13
+ constructor(baseURL: string, timeout?: number);
14
+ login(service: Service, environment: Environment, tenant: string, username: string, password: string): Promise<APIResponse<LoginResponse>>;
15
+ loginArabica(environment: Environment, account: string, password: string, rememberMe?: boolean): Promise<APIResponse<LoginResponse>>;
16
+ registerArabica(environment: Environment, email: string, account: string, password: string, phone?: string, username?: string, policyContent?: string, privacyContent?: string): Promise<APIResponse<{
17
+ userId?: string;
18
+ }>>;
19
+ setAuthToken(token: string): void;
20
+ clearAuthToken(): void;
21
+ getClient(): AxiosInstance;
22
+ }
23
+ export declare function createAPIClient(service: Service, environment: Environment, tenant?: string): APIClient;
24
+ export declare const apiClient: {
25
+ login(service: Service, environment: Environment, tenant: string, username: string, password: string): Promise<APIResponse<LoginResponse>>;
26
+ loginArabica(environment: Environment, account: string, password: string, rememberMe?: boolean): Promise<APIResponse<LoginResponse>>;
27
+ registerArabica(environment: Environment, email: string, account: string, password: string, phone?: string, username?: string, policyContent?: string, privacyContent?: string): Promise<APIResponse<{
28
+ userId?: string;
29
+ }>>;
30
+ getCodeByType(environment: Environment, tenant: string, type: string): Promise<{
31
+ success: boolean;
32
+ data?: string;
33
+ error?: {
34
+ code: string;
35
+ message: string;
36
+ };
37
+ }>;
38
+ createEmployee(environment: Environment, tenant: string, data: CreateEmployeeRequest): Promise<EmployeeApiResponse>;
39
+ searchEmployees(environment: Environment, tenant: string, searchText: string): Promise<{
40
+ success: boolean;
41
+ data?: any[];
42
+ error?: {
43
+ code: string;
44
+ message: string;
45
+ };
46
+ }>;
47
+ listEmployees(environment: Environment, tenant: string, params: EmployeeQueryParams): Promise<EmployeeApiResponse>;
48
+ getEmployee(environment: Environment, tenant: string, employeeId: string): Promise<EmployeeApiResponse>;
49
+ updateEmployee(environment: Environment, tenant: string, data: UpdateEmployeeRequest): Promise<EmployeeApiResponse>;
50
+ disableEmployee(environment: Environment, tenant: string, employeeId: string): Promise<EmployeeApiResponse>;
51
+ enableEmployee(environment: Environment, tenant: string, employeeId: string): Promise<EmployeeApiResponse>;
52
+ deleteEmployee(environment: Environment, tenant: string, employeeId: string): Promise<EmployeeApiResponse>;
53
+ getOrgListName(environment: Environment, tenant: string): Promise<{
54
+ success: boolean;
55
+ data?: OrgListItem[];
56
+ error?: {
57
+ code: string;
58
+ message: string;
59
+ };
60
+ }>;
61
+ listPositions(environment: Environment, tenant: string): Promise<{
62
+ success: boolean;
63
+ data?: PositionListItem[];
64
+ error?: {
65
+ code: string;
66
+ message: string;
67
+ };
68
+ }>;
69
+ createUser(environment: Environment, tenant: string, data: CreateUserRequest): Promise<UserApiResponse>;
70
+ listUsers(environment: Environment, tenant: string, params: UserQueryParams): Promise<UserApiResponse>;
71
+ getUser(environment: Environment, tenant: string, userId: string): Promise<UserApiResponse>;
72
+ updateUser(environment: Environment, tenant: string, data: UpdateUserRequest): Promise<UserApiResponse>;
73
+ deleteUser(environment: Environment, tenant: string, userId: string): Promise<UserApiResponse>;
74
+ enableUser(environment: Environment, tenant: string, userId: string): Promise<UserApiResponse>;
75
+ disableUser(environment: Environment, tenant: string, userId: string): Promise<UserApiResponse>;
76
+ getCurrentUser(environment: Environment, tenant: string): Promise<UserApiResponse>;
77
+ getUserIndexInfo(environment: Environment, tenant: string): Promise<{
78
+ success: boolean;
79
+ data?: any;
80
+ error?: {
81
+ code: string;
82
+ message: string;
83
+ };
84
+ }>;
85
+ updateUserOrgOrApp(environment: Environment, tenant: string, params: {
86
+ newOrgId?: string;
87
+ newAppId?: string;
88
+ }): Promise<{
89
+ success: boolean;
90
+ data?: any;
91
+ error?: {
92
+ code: string;
93
+ message: string;
94
+ };
95
+ }>;
96
+ resetPassword(environment: Environment, tenant: string, userId: string): Promise<UserApiResponse>;
97
+ listRoles(environment: Environment, tenant: string): Promise<{
98
+ success: boolean;
99
+ data?: any[];
100
+ error?: {
101
+ code: string;
102
+ message: string;
103
+ };
104
+ }>;
105
+ existCheck(environment: Environment, tenant: string, account: string): Promise<{
106
+ success: boolean;
107
+ data?: boolean;
108
+ error?: {
109
+ code: string;
110
+ message: string;
111
+ };
112
+ }>;
113
+ };
114
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;gBAElB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAc;IAW9C,KAAK,CACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IA0ChC,YAAY,CA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