@ty_krystal/sei-ai 0.1.8 → 0.1.12

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 (57) hide show
  1. package/README.md +1 -21
  2. package/dist/commands/api-docs.d.ts +1 -1
  3. package/dist/commands/api-docs.js +1 -1
  4. package/dist/commands/call.d.ts +1 -1
  5. package/dist/commands/call.js +1 -1
  6. package/dist/commands/dict/add-category.d.ts +1 -1
  7. package/dist/commands/dict/add-category.js +1 -1
  8. package/dist/commands/dict/add-item.d.ts +1 -1
  9. package/dist/commands/dict/add-item.js +1 -1
  10. package/dist/commands/dict/list.d.ts +1 -1
  11. package/dist/commands/dict/list.js +1 -1
  12. package/dist/commands/init/base-data.d.ts +1 -1
  13. package/dist/commands/init/base-data.js +1 -1
  14. package/dist/commands/query-sql.d.ts +1 -1
  15. package/dist/commands/query-sql.js +1 -1
  16. package/dist/commands/query.d.ts +1 -1
  17. package/dist/commands/query.js +1 -1
  18. package/dist/commands/relogin.d.ts +1 -1
  19. package/dist/commands/relogin.js +1 -1
  20. package/dist/commands/save.d.ts +1 -1
  21. package/dist/commands/save.js +1 -1
  22. package/dist/commands.d.ts +24 -0
  23. package/dist/commands.js +23 -0
  24. package/dist/core/cli-actions.d.ts +94 -0
  25. package/dist/core/cli-actions.js +155 -0
  26. package/dist/core/cli-helpers.d.ts +39 -0
  27. package/dist/core/cli-helpers.js +246 -0
  28. package/dist/core/command-base/context.d.ts +6 -0
  29. package/dist/core/command-base/context.js +10 -0
  30. package/dist/core/command-base/output.d.ts +2 -0
  31. package/dist/core/command-base/output.js +6 -0
  32. package/dist/core/command-base/payload.d.ts +7 -0
  33. package/dist/core/command-base/payload.js +33 -0
  34. package/dist/core/command-base/sei-command.d.ts +42 -0
  35. package/dist/core/command-base/sei-command.js +88 -0
  36. package/dist/core/config.d.ts +3 -0
  37. package/dist/core/config.js +82 -0
  38. package/dist/core/constants.d.ts +35 -0
  39. package/dist/core/constants.js +48 -0
  40. package/dist/core/env.d.ts +1 -0
  41. package/dist/core/env.js +55 -0
  42. package/dist/core/errors.d.ts +10 -0
  43. package/dist/core/errors.js +55 -0
  44. package/dist/core/index.d.ts +14 -0
  45. package/dist/core/index.js +14 -0
  46. package/dist/core/logger.d.ts +2 -0
  47. package/dist/core/logger.js +71 -0
  48. package/dist/core/openapi.d.ts +2 -0
  49. package/dist/core/openapi.js +261 -0
  50. package/dist/core/sei-client.d.ts +25 -0
  51. package/dist/core/sei-client.js +535 -0
  52. package/dist/core/types.d.ts +139 -0
  53. package/dist/core/types.js +1 -0
  54. package/dist/core/utils.d.ts +12 -0
  55. package/dist/core/utils.js +53 -0
  56. package/oclif.manifest.json +376 -328
  57. package/package.json +14 -8
@@ -0,0 +1,53 @@
1
+ export function isObject(value) {
2
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
3
+ }
4
+ export function toTrimmedString(value) {
5
+ return typeof value === 'string' ? value.trim() : '';
6
+ }
7
+ export function stringifySafe(value) {
8
+ try {
9
+ return JSON.stringify(value, null, 2);
10
+ }
11
+ catch {
12
+ return String(value);
13
+ }
14
+ }
15
+ export function truncateText(value, limit) {
16
+ const text = String(value ?? '');
17
+ return text.length > limit ? `${text.slice(0, limit)}...` : text;
18
+ }
19
+ export function uniqueStrings(values) {
20
+ return [...new Set([...values].map((value) => value.trim()).filter(Boolean))];
21
+ }
22
+ export function normalizeBaseUrl(value) {
23
+ const text = toTrimmedString(value);
24
+ if (!text) {
25
+ throw new Error('base URL 不能为空');
26
+ }
27
+ return text.replace(/\/+$/, '');
28
+ }
29
+ export function normalizePath(value) {
30
+ const text = toTrimmedString(value);
31
+ if (!text) {
32
+ return '/';
33
+ }
34
+ if (text.startsWith('http://') || text.startsWith('https://')) {
35
+ try {
36
+ return new URL(text).pathname || '/';
37
+ }
38
+ catch {
39
+ return '/';
40
+ }
41
+ }
42
+ return text.startsWith('/') ? text : `/${text}`;
43
+ }
44
+ export function makeUrl(baseUrl, path) {
45
+ if (path.startsWith('http://') || path.startsWith('https://')) {
46
+ return path;
47
+ }
48
+ return `${normalizeBaseUrl(baseUrl)}${normalizePath(path)}`;
49
+ }
50
+ export function toPositiveInteger(value, fallback) {
51
+ const parsed = Number(value);
52
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
53
+ }