@adaas/a-utils 0.1.18 → 0.1.20

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 (50) hide show
  1. package/dist/index.cjs +45 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.mts +964 -354
  4. package/dist/index.d.ts +964 -354
  5. package/dist/index.mjs +44 -2372
  6. package/dist/index.mjs.map +1 -1
  7. package/examples/A-Channel-examples.ts +13 -11
  8. package/examples/A-Command-examples-2.ts +429 -0
  9. package/examples/A-Command-examples.ts +487 -202
  10. package/examples/A-StateMachine-examples.ts +609 -0
  11. package/package.json +3 -2
  12. package/src/index.ts +1 -2
  13. package/src/lib/A-Channel/A-Channel.component.ts +14 -74
  14. package/src/lib/A-Channel/A-Channel.error.ts +5 -5
  15. package/src/lib/A-Channel/A-Channel.types.ts +2 -10
  16. package/src/lib/A-Channel/A-ChannelRequest.context.ts +25 -74
  17. package/src/lib/A-Command/A-Command.constants.ts +78 -23
  18. package/src/lib/A-Command/A-Command.entity.ts +447 -119
  19. package/src/lib/A-Command/A-Command.error.ts +11 -0
  20. package/src/lib/A-Command/A-Command.types.ts +96 -20
  21. package/src/lib/A-Command/A-CommandExecution.context.ts +0 -0
  22. package/src/lib/A-Command/README.md +164 -68
  23. package/src/lib/A-Config/A-Config.container.ts +2 -2
  24. package/src/lib/A-Config/A-Config.context.ts +19 -5
  25. package/src/lib/A-Config/components/ConfigReader.component.ts +1 -1
  26. package/src/lib/A-Logger/A-Logger.component.ts +211 -35
  27. package/src/lib/A-Logger/A-Logger.constants.ts +50 -10
  28. package/src/lib/A-Logger/A-Logger.env.ts +17 -1
  29. package/src/lib/A-Memory/A-Memory.component.ts +440 -0
  30. package/src/lib/A-Memory/A-Memory.constants.ts +49 -0
  31. package/src/lib/A-Memory/A-Memory.context.ts +14 -118
  32. package/src/lib/A-Memory/A-Memory.error.ts +21 -0
  33. package/src/lib/A-Memory/A-Memory.types.ts +21 -0
  34. package/src/lib/A-Operation/A-Operation.context.ts +58 -0
  35. package/src/lib/A-Operation/A-Operation.types.ts +47 -0
  36. package/src/lib/A-StateMachine/A-StateMachine.component.ts +258 -0
  37. package/src/lib/A-StateMachine/A-StateMachine.constants.ts +18 -0
  38. package/src/lib/A-StateMachine/A-StateMachine.error.ts +10 -0
  39. package/src/lib/A-StateMachine/A-StateMachine.types.ts +20 -0
  40. package/src/lib/A-StateMachine/A-StateMachineTransition.context.ts +41 -0
  41. package/src/lib/A-StateMachine/README.md +391 -0
  42. package/tests/A-Channel.test.ts +17 -14
  43. package/tests/A-Command.test.ts +548 -460
  44. package/tests/A-Logger.test.ts +8 -4
  45. package/tests/A-Memory.test.ts +151 -115
  46. package/tests/A-Schedule.test.ts +2 -2
  47. package/tests/A-StateMachine.test.ts +760 -0
  48. package/tsup.config.ts +30 -13
  49. package/dist/index.js +0 -2398
  50. package/dist/index.js.map +0 -1
package/tsup.config.ts CHANGED
@@ -1,15 +1,32 @@
1
1
  import { defineConfig } from "tsup";
2
2
 
3
- export default defineConfig({
4
- entry: ["src/index.ts"], // 👈 adjust if your main file is elsewhere
5
- format: ["esm", "cjs"], // both Node (CJS) and ESM builds
6
- dts: true, // generate declaration files
7
- sourcemap: true, // helpful for debugging
8
- clean: true, // clear dist/ before build
9
- target: "es2020", // good for both Node 18+ and browsers
10
- treeshake: true, // ✅ enable tree-shaking
11
- skipNodeModulesBundle: true, // do NOT bundle node_modules (leave them external)
12
- splitting: false, // one file per format (simpler)
13
- minify: false, // optional: turn on if you want smaller bundle
14
- platform: "neutral", // 👈 important: works in Node & browser
15
- });
3
+ export default defineConfig((options) => ({
4
+ entry: ["src/index.ts"],
5
+ format: ["esm", "cjs"],
6
+ dts: true,
7
+ clean: !options.watch,
8
+ sourcemap: true,
9
+ target: "es2020",
10
+ minify: !options.watch,
11
+ treeshake: "recommended",
12
+ skipNodeModulesBundle: true,
13
+ splitting: false,
14
+ silent: false,
15
+ platform: "neutral",
16
+ // Add hash to filenames for cache busting in production builds
17
+ outExtension({ format }) {
18
+ return {
19
+ js: format === "esm" ? `.mjs` : `.cjs`,
20
+ };
21
+ },
22
+ // Extra optimization options (for 2025 esbuild)
23
+ esbuildOptions(options) {
24
+ options.keepNames = true; // Preserve class/function names for better debugging
25
+ options.charset = "utf8";
26
+ },
27
+
28
+ // Enable minification for output size (production only)
29
+ minifyWhitespace: !options.watch,
30
+ minifyIdentifiers: !options.watch,
31
+ minifySyntax: !options.watch,
32
+ }));