@newpeak/barista-cli 0.1.1 → 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 +1 -1
  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,147 @@
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 createEmployeeUpdateCommand() {
7
+ const updateCommand = new Command('update');
8
+ updateCommand
9
+ .description('Update employee information')
10
+ .argument('<id>', 'Employee ID')
11
+ .option('-n, --name <name>', 'Employee name')
12
+ .option('-p, --phone <phone>', 'Phone number')
13
+ .option('-e, --email <email>', 'Email address')
14
+ .option('--position-id <positionId>', 'Position ID')
15
+ .option('-d, --joined-date <date>', 'Joined date (YYYY-MM-DD)')
16
+ .option('--org-id <orgId>', 'Organization (department) ID')
17
+ .option('--dry-run', 'Preview changes without making API call')
18
+ .option('--json', 'Output result as JSON')
19
+ .action(async (id, options) => {
20
+ const context = configManager.getCurrentContext();
21
+ const environment = context.environment;
22
+ const tenant = context.tenant;
23
+ const employeeId = id;
24
+ const fields = {};
25
+ if (options.name)
26
+ fields.employeeName = options.name;
27
+ if (options.phone)
28
+ fields.employeePhone = options.phone;
29
+ if (options.email)
30
+ fields.employeeEmail = options.email;
31
+ if (options.positionId)
32
+ fields.positionId = options.positionId;
33
+ if (options.joinedDate)
34
+ fields.employeeJoinedDate = options.joinedDate;
35
+ if (options.orgId)
36
+ fields.organizationId = options.orgId;
37
+ const providedFields = Object.keys(fields).filter((k) => fields[k] !== undefined);
38
+ if (providedFields.length === 0) {
39
+ console.error(chalk.red('\nāœ— No fields to update. Provide at least one of: --name, --phone, --email, --position-id, --joined-date, --org-id\n'));
40
+ process.exit(1);
41
+ }
42
+ if (options.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(options.email)) {
43
+ console.error(chalk.red('\nāœ— Invalid email format\n'));
44
+ process.exit(1);
45
+ }
46
+ if (options.phone && !/^\+?[\d\s\-()]+$/.test(options.phone)) {
47
+ console.error(chalk.red('\nāœ— Invalid phone number format\n'));
48
+ process.exit(1);
49
+ }
50
+ if (options.joinedDate && !/^\d{4}-\d{2}-\d{2}$/.test(options.joinedDate)) {
51
+ console.error(chalk.red('\nāœ— Invalid date format. Use YYYY-MM-DD\n'));
52
+ process.exit(1);
53
+ }
54
+ if (options.dryRun) {
55
+ console.log(chalk.bold(`\nšŸ‘¤ Update Employee — Dry Run (${environment})\n`));
56
+ console.log(chalk.gray(` Employee ID: ${employeeId}`));
57
+ console.log(chalk.gray('\n Changes to be applied:'));
58
+ for (const field of providedFields) {
59
+ const label = field.replace(/([A-Z])/g, (m) => ` ${m.toLowerCase()}`).trim();
60
+ console.log(chalk.cyan(` ${label}: "${fields[field]}"`));
61
+ }
62
+ console.log();
63
+ return;
64
+ }
65
+ let currentEmployee;
66
+ try {
67
+ const employeeResponse = await apiClient.getEmployee(environment, tenant, employeeId);
68
+ if (!employeeResponse.success || !employeeResponse.data) {
69
+ console.error(chalk.red(`\nāœ— Employee not found: ${employeeId}`));
70
+ if (employeeResponse.error?.message) {
71
+ console.error(chalk.gray(` ${employeeResponse.error.message}`));
72
+ }
73
+ if (employeeResponse.error?.code) {
74
+ console.error(chalk.gray(` Error code: ${employeeResponse.error.code}`));
75
+ }
76
+ console.error();
77
+ process.exit(1);
78
+ }
79
+ currentEmployee = employeeResponse.data;
80
+ }
81
+ catch (error) {
82
+ console.error(chalk.red(`\nāœ— Failed to fetch employee: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
83
+ process.exit(1);
84
+ }
85
+ console.log(chalk.bold(`\nšŸ‘¤ Update Employee (${environment})\n`));
86
+ console.log(chalk.gray(` Employee ID: ${employeeId}`));
87
+ console.log(chalk.gray(` Current Name: ${currentEmployee.employeeName}`));
88
+ console.log(chalk.gray('\n Changes:'));
89
+ for (const field of providedFields) {
90
+ const label = field.replace(/([A-Z])/g, (m) => ` ${m.toLowerCase()}`).trim();
91
+ const currentVal = currentEmployee[field] ?? '(not set)';
92
+ const newVal = fields[field];
93
+ console.log(chalk.cyan(` ${label}: "${currentVal}" → "${newVal}"`));
94
+ }
95
+ const { confirm } = await inquirer.prompt([
96
+ {
97
+ type: 'confirm',
98
+ name: 'confirm',
99
+ message: 'Apply these changes?',
100
+ default: true,
101
+ },
102
+ ]);
103
+ if (!confirm) {
104
+ console.log(chalk.gray('\n Operation cancelled.\n'));
105
+ process.exit(0);
106
+ }
107
+ const updateData = { employeeId, ...fields };
108
+ try {
109
+ const response = await apiClient.updateEmployee(environment, tenant, updateData);
110
+ if (response.success) {
111
+ if (options.json) {
112
+ console.log(JSON.stringify({ success: true, data: response.data }, null, 2));
113
+ }
114
+ else {
115
+ console.log(chalk.green(`\nāœ“ Employee updated successfully\n`));
116
+ }
117
+ }
118
+ else {
119
+ if (options.json) {
120
+ console.log(JSON.stringify({ success: false, error: response.error }, null, 2));
121
+ }
122
+ else {
123
+ console.error(chalk.red(`\nāœ— Update failed: ${response.error?.message || 'Unknown error'}`));
124
+ if (response.error?.code) {
125
+ console.error(chalk.gray(` Error code: ${response.error.code}`));
126
+ }
127
+ console.error();
128
+ }
129
+ process.exit(1);
130
+ }
131
+ }
132
+ catch (error) {
133
+ if (options.json) {
134
+ console.log(JSON.stringify({
135
+ success: false,
136
+ error: { message: error instanceof Error ? error.message : 'Unknown error' },
137
+ }));
138
+ }
139
+ else {
140
+ console.error(chalk.red(`\nāœ— Error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
141
+ }
142
+ process.exit(1);
143
+ }
144
+ });
145
+ return updateCommand;
146
+ }
147
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/liberica/employees/update.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;AAIxD,MAAM,U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.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/liberica/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,qBAAqB,IAAI,OAAO,CAyB/C"}
@@ -0,0 +1,33 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { createLibericaAuthCommand } from './auth/index.js';
4
+ import { createLibericaContextCommand } from './context/index.js';
5
+ import { createEmployeesCommand } from './employees/index.js';
6
+ import { createUsersCommand } from './users/index.js';
7
+ import { createOrgsCommand } from './orgs/index.js';
8
+ import { createPositionsCommand } from './positions/index.js';
9
+ import { createRolesCommand } from './roles/index.js';
10
+ export function createLibericaCommand() {
11
+ const libericaCommand = new Command('liberica');
12
+ libericaCommand.description('Liberica production management operations');
13
+ libericaCommand.addCommand(createLibericaAuthCommand());
14
+ libericaCommand.addCommand(createLibericaContextCommand());
15
+ libericaCommand.addCommand(createEmployeesCommand());
16
+ libericaCommand.addCommand(createUsersCommand());
17
+ libericaCommand.addCommand(createOrgsCommand());
18
+ libericaCommand.addCommand(createPositionsCommand());
19
+ libericaCommand.addCommand(createRolesCommand());
20
+ libericaCommand.action(() => {
21
+ console.log(chalk.bold('\nā˜• Liberica Commands\n'));
22
+ console.log(' Use "barista liberica auth <command>" for authentication');
23
+ console.log(' Use "barista liberica context <command>" for context management');
24
+ console.log(' Use "barista liberica employees <command>" for employee management');
25
+ console.log(' Use "barista liberica users <command>" for user management');
26
+ console.log(' Use "barista liberica orders <command>" for order operations');
27
+ console.log(' Use "barista liberica products <command>" for product operations');
28
+ console.log(' Use "barista liberica production <command>" for production operations');
29
+ console.log('\n Run "barista liberica <command> --help" for more details\n');
30
+ });
31
+ return libericaCommand;
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/liberica/index.ts"],"names":[],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ACjF,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;QAC9E,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;QACvF,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createOrgsCommand(): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/orgs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,iBAAiB,IAAI,OAAO,CA2B3C"}
@@ -0,0 +1,27 @@
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 createOrgsCommand() {
6
+ const orgsCommand = new Command('orgs');
7
+ orgsCommand.description('List organizations');
8
+ orgsCommand
9
+ .command('list')
10
+ .description('List all organizations')
11
+ .option('--json', 'Output as JSON')
12
+ .action(async (options) => {
13
+ const context = configManager.getCurrentContext();
14
+ const environment = options.env || context.environment;
15
+ const tenant = options.tenant || context.tenant;
16
+ const response = await apiClient.getOrgListName(environment, tenant);
17
+ if (!response.success) {
18
+ console.error(chalk.red(`\nāœ— Failed: ${response.error?.message}\n`));
19
+ process.exit(1);
20
+ }
21
+ const orgs = response.data || [];
22
+ // Always show full IDs
23
+ console.log(JSON.stringify({ success: true, data: orgs }, null, 2));
24
+ });
25
+ return orgsCommand;
26
+ }
27
+ //# sourceM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,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEL,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createPositionsCommand(): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/positions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,sBAAsB,IAAI,OAAO,CAwBhD"}
@@ -0,0 +1,24 @@
1
+ import { Command } from 'commander';
2
+ import { configManager } from '../../../core/config/manager.js';
3
+ import { apiClient } from '../../../core/api/client.js';
4
+ export function createPositionsCommand() {
5
+ const positionsCommand = new Command('positions');
6
+ positionsCommand.description('List positions');
7
+ positionsCommand
8
+ .command('list')
9
+ .description('List all positions')
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.listPositions(environment, tenant);
15
+ if (!response.success) {
16
+ console.error(`\nāœ— Failed: ${response.error?.message}\n`);
17
+ process.exit(1);
18
+ }
19
+ const positions = response.data || [];
20
+ console.log(JSON.stringify({ success: true, data: positions }, null, 2));
21
+ });
22
+ return positionsCommand;
23
+ }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/liberica/positions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,UAAU,sBAAsB;IACpC,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAClD,gBAAgB,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE/C,gBAAgB;SACb,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oBAAoB,CAAC;SACjC,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,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAEpE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,eAAe,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEL,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createRolesCommand(): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/roles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,kBAAkB,IAAI,OAAO,CAmD5C"}
@@ -0,0 +1,50 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import Table from 'cli-table3';
4
+ import { apiClient } from '../../../core/api/client.js';
5
+ import { configManager } from '../../../core/config/manager.js';
6
+ export function createRolesCommand() {
7
+ const rolesCommand = new Command('roles');
8
+ rolesCommand.description('List roles');
9
+ rolesCommand
10
+ .command('list')
11
+ .description('List all available roles')
12
+ .option('--json', 'Output as JSON')
13
+ .action(async (options) => {
14
+ const context = configManager.getCurrentContext();
15
+ const environment = options.env || context.environment;
16
+ const tenant = options.tenant || context.tenant;
17
+ try {
18
+ const response = await apiClient.listRoles(environment, tenant);
19
+ if (!response.success) {
20
+ console.error(chalk.red(`\nāœ— Failed: ${response.error?.message}\n`));
21
+ process.exit(1);
22
+ }
23
+ const roles = response.data || [];
24
+ if (options.json) {
25
+ console.log(JSON.stringify({ success: true, data: roles }, null, 2));
26
+ return;
27
+ }
28
+ const table = new Table({
29
+ head: [chalk.bold('ID'), chalk.bold('Role Code'), chalk.bold('Role Name'), chalk.bold('Status')],
30
+ colWidths: [20, 20, 20, 10],
31
+ });
32
+ for (const role of roles) {
33
+ table.push([
34
+ role.roleId,
35
+ role.roleCode || '-',
36
+ role.roleName || '-',
37
+ role.statusFlag === 1 ? chalk.green('Enabled') : chalk.red('Disabled'),
38
+ ]);
39
+ }
40
+ console.log(table.toString());
41
+ console.log(chalk.gray(`\nTotal: ${roles.length} roles`));
42
+ }
43
+ catch (error) {
44
+ console.error(chalk.red(`\nāœ— Error: ${error.message}\n`));
45
+ process.exit(1);
46
+ }
47
+ });
48
+ return rolesCommand;
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/liberica/roles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,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export declare function createUserCreateCommand(): Command;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,uBAAuB,IAAI,OAAO,CA6HjD"}
@@ -0,0 +1,112 @@
1
+ import { Command } from 'commander';
2
+ import { configManager } from '../../../core/config/manager.js';
3
+ import { apiClient } from '../../../core/api/client.js';
4
+ import chalk from 'chalk';
5
+ export function createUserCreateCommand() {
6
+ const createCommand = new Command('create');
7
+ createCommand.description('Create a new user');
8
+ createCommand
9
+ .option('-n, --name <name>', 'User real name (required)')
10
+ .option('-a, --account <account>', 'User account (required)')
11
+ .option('-e, --email <email>', 'User email')
12
+ .option('-r, --role-ids <roleIds>', 'Role IDs (comma-separated, required)')
13
+ .option('--employee-code <employeeCode>', 'Employee code (optional, used to find employee)')
14
+ .option('--employee-name <employeeName>', 'Employee name (optional, used to find employee)')
15
+ .option('--org-id <orgId>', 'Organization ID (optional, auto-assigned if not provided)')
16
+ .option('--dry-run', 'Preview without executing')
17
+ .option('--json', 'Output as JSON')
18
+ .action(async (options) => {
19
+ // Commander.js boolean flag parsing workaround
20
+ options.dryRun = process.argv.includes('--dry-run');
21
+ options.json = process.argv.includes('--json');
22
+ const context = configManager.getCurrentContext();
23
+ const environment = options.env || context.environment;
24
+ const tenant = options.tenant || context.tenant;
25
+ if (!options.name || !options.account || !options.roleIds) {
26
+ console.error(chalk.red('\nāœ— Missing required options: --name, --account, --role-ids\n'));
27
+ createCommand.help();
28
+ }
29
+ const roleIdList = options.roleIds.split(',').map((id) => id.trim());
30
+ const userData = {
31
+ realName: options.name,
32
+ account: options.account,
33
+ email: options.email,
34
+ roleIdList,
35
+ };
36
+ if (options.employeeCode || options.employeeName) {
37
+ const searchText = options.employeeCode || options.employeeName;
38
+ const searchResponse = await apiClient.searchEmployees(environment, tenant, searchText);
39
+ if (!searchResponse.success) {
40
+ console.error(chalk.red(`\nāœ— čŒå‘˜ęœē“¢å¤±č“„: ${searchResponse.error?.message}\n`));
41
+ process.exit(1);
42
+ }
43
+ let employees = searchResponse.data || [];
44
+ if (options.employeeCode && options.employeeName) {
45
+ employees = employees.filter((emp) => emp.code === options.employeeCode &&
46
+ emp.name && emp.name.includes(options.employeeName));
47
+ }
48
+ else if (options.employeeCode) {
49
+ employees = employees.filter((emp) => emp.code === options.employeeCode);
50
+ }
51
+ else if (options.employeeName) {
52
+ employees = employees.filter((emp) => emp.name && emp.name.includes(options.employeeName));
53
+ }
54
+ if (employees.length === 0) {
55
+ console.error(chalk.red('\nāœ— ęœŖę‰¾åˆ°åŒ¹é…ēš„čŒå‘˜\n'));
56
+ process.exit(1);
57
+ }
58
+ if (employees.length > 1) {
59
+ console.error(chalk.red(`\nāœ— ę‰¾åˆ°å¤šäøŖčŒå‘˜ļ¼ŒčÆ·ä½æē”Øę›“ē²¾ē”®ēš„ę”ä»¶\n`));
60
+ process.exit(1);
61
+ }
62
+ const employee = employees[0];
63
+ userData.employeeCode = employee.code;
64
+ userData.employeeNumber = employee.no;
65
+ userData.employeeId = employee.id;
66
+ }
67
+ // ę£€ęŸ„č“¦å·ę˜Æå¦å·²å­˜åœØ
68
+ const existCheckResponse = await apiClient.existCheck(environment, tenant, options.account);
69
+ if (!existCheckResponse.success) {
70
+ console.error(chalk.red(`\nāœ— č“¦å·ę ”éŖŒå¤±č“„: ${existCheckResponse.error?.message}\n`));
71
+ process.exit(1);
72
+ }
73
+ // å¦‚ęžœč“¦å·å·²å­˜åœØļ¼Œę ¹ę®ęØ”å¼å¤„ē†
74
+ if (existCheckResponse.data === false) {
75
+ if (options.dryRun) {
76
+ console.log(chalk.yellow(`\nāš ļø č­¦å‘Š: č“¦å· "${options.account}" 已存在 (dry-runęØ”å¼ē»§ē»­é¢„č§ˆ)\n`));
77
+ }
78
+ else {
79
+ console.error(chalk.red(`\nāœ— č“¦å· "${options.account}" å·²å­˜åœØļ¼ŒčÆ·ä½æē”Øå…¶ä»–č“¦å·\n`));
80
+ process.exit(1);
81
+ }
82
+ }
83
+ if (!options.dryRun) {
84
+ try {
85
+ const userIndexResponse = await apiClient.getUserIndexInfo(environment, tenant);
86
+ if (userIndexResponse.success && userIndexResponse.data?.userOrgInfoList?.length > 0) {
87
+ const firstOrg = userIndexResponse.data.userOrgInfoList[0];
88
+ await apiClient.updateUserOrgOrApp(environment, tenant, { newOrgId: String(firstOrg.orgId) });
89
+ }
90
+ }
91
+ catch (err) {
92
+ }
93
+ }
94
+ if (options.dryRun) {
95
+ console.log(chalk.bold('\nšŸ” Dry-Run Mode: No changes will be made\n'));
96
+ console.log(chalk.gray('User Data:'));
97
+ console.log(JSON.stringify(userData, null, 2));
98
+ return;
99
+ }
100
+ const response = await apiClient.createUser(environment, tenant, userData);
101
+ if (!response.success) {
102
+ console.error(chalk.red(`\nāœ— Failed: ${response.error?.message}\n`));
103
+ process.exit(1);
104
+ }
105
+ console.log(chalk.green('\nāœ“ User created successfully\n'));
106
+ if (options.json) {
107
+ console.log(JSON.stringify({ success: true, data: response.data }, null, 2));
108
+ }
109
+ });
110
+ return createCommand;
111
+ }
112
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,uBAAuB;IACrC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,aAAa,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAE/C,aAAa;SACV,MAAM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AAC;QAED,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAE3E,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;QAC5D,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserDeleteCommand(): Command;
3
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,uBAAuB,IAAI,OAAO,CAyCjD"}
@@ -0,0 +1,41 @@
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 createUserDeleteCommand() {
7
+ const deleteCommand = new Command('delete');
8
+ deleteCommand.description('Delete a user');
9
+ deleteCommand
10
+ .argument('<userId>', 'User ID')
11
+ .option('--force', 'Skip confirmation')
12
+ .option('--dry-run', 'Preview without executing')
13
+ .option('--json', 'Output as JSON')
14
+ .action(async (userId, options) => {
15
+ const context = configManager.getCurrentContext();
16
+ const environment = options.env || context.environment;
17
+ const tenant = options.tenant || context.tenant;
18
+ if (options.dryRun) {
19
+ console.log(chalk.bold('\nšŸ” Dry-Run Mode\n'));
20
+ console.log(chalk.gray(`Would delete user: ${userId}`));
21
+ return;
22
+ }
23
+ if (!options.force) {
24
+ const { confirm } = await inquirer.prompt([
25
+ { type: 'confirm', name: 'confirm', message: `Delete user ${userId}?`, default: false },
26
+ ]);
27
+ if (!confirm) {
28
+ console.log(chalk.yellow('\n↩ Cancelled\n'));
29
+ process.exit(0);
30
+ }
31
+ }
32
+ const response = await apiClient.deleteUser(environment, tenant, userId);
33
+ if (!response.success) {
34
+ console.error(chalk.red(`\nāœ— Failed: ${response.error?.message}\n`));
35
+ process.exit(1);
36
+ }
37
+ console.log(chalk.green('\nāœ“ User deleted successfully\n'));
38
+ });
39
+ return deleteCommand;
40
+ }
41
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/delete.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,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,C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AG,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 createUserDisableCommand(): Command;
3
+ //# sourceMappingURL=disable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/disable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,wBAAwB,IAAI,OAAO,CAiClD"}
@@ -0,0 +1,34 @@
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 createUserDisableCommand() {
7
+ const disableCommand = new Command('disable');
8
+ disableCommand.description('Disable a user');
9
+ disableCommand
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: `Disable 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.disableUser(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āœ“ User disabled successfully\n'));
31
+ });
32
+ return disableCommand;
33
+ }
34
+ //# sourceMappingURL=disable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../../src/commands/liberica/users/disable.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,wBAAwB;IACtC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,cAAc,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE7C,cAAc;SACX,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,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;gBACxC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,MAAM,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE;aACzF,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;gBAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE1E,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,kCAAkC,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEL,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createUserEnableCommand(): Command;
3
+ //# sourceMappingURL=enable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.d.ts","sourceRoot":"","sources":["../../../../src/commands/liberica/users/enable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,uBAAuB,IAAI,OAAO,CAuBjD"}