@aidra/pmx-io 0.0.0-stage → 9.14.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 (67) hide show
  1. package/README.md +69 -2
  2. package/bin/pmx-io-node.js +143 -0
  3. package/index.d.ts +381 -0
  4. package/index.js +27 -0
  5. package/index.mjs +47 -0
  6. package/lib/actions.js +120 -0
  7. package/lib/activate.js +402 -0
  8. package/lib/application.js +106 -0
  9. package/lib/bun.js +155 -0
  10. package/lib/config.js +67 -0
  11. package/lib/constants.js +17 -0
  12. package/lib/debug.js +48 -0
  13. package/lib/esm-hooks.mjs +111 -0
  14. package/lib/exit.js +79 -0
  15. package/lib/features/metrics.js +409 -0
  16. package/lib/features/notify.js +358 -0
  17. package/lib/features/profiling.js +208 -0
  18. package/lib/hooks.js +151 -0
  19. package/lib/inbound.js +174 -0
  20. package/lib/integrations.js +372 -0
  21. package/lib/itg/amqplib.js +169 -0
  22. package/lib/itg/bullmq.js +141 -0
  23. package/lib/itg/common.js +657 -0
  24. package/lib/itg/dbcomment.js +114 -0
  25. package/lib/itg/index.js +103 -0
  26. package/lib/itg/ioredis.js +212 -0
  27. package/lib/itg/kafkajs.js +205 -0
  28. package/lib/itg/mongodb.js +322 -0
  29. package/lib/itg/mysql2.js +205 -0
  30. package/lib/itg/nats.js +531 -0
  31. package/lib/itg/noderedis.js +236 -0
  32. package/lib/itg/pg.js +253 -0
  33. package/lib/itg/pgqueue.js +305 -0
  34. package/lib/itg/postgres.js +252 -0
  35. package/lib/itg/redis-common.js +265 -0
  36. package/lib/itg/sql.js +302 -0
  37. package/lib/metrics/service.js +286 -0
  38. package/lib/metrics/types.js +342 -0
  39. package/lib/modules.js +260 -0
  40. package/lib/node-options.js +62 -0
  41. package/lib/otel/bridge.js +797 -0
  42. package/lib/otel/env.js +114 -0
  43. package/lib/outbound.js +362 -0
  44. package/lib/pmx.js +757 -0
  45. package/lib/relay/hub.js +279 -0
  46. package/lib/relay/transport.js +253 -0
  47. package/lib/standalone/activate.js +307 -0
  48. package/lib/standalone/capture.js +55 -0
  49. package/lib/standalone/container.js +909 -0
  50. package/lib/standalone/transport.js +1023 -0
  51. package/lib/tracing/context.js +90 -0
  52. package/lib/tracing/control.js +124 -0
  53. package/lib/tracing/exporter.js +115 -0
  54. package/lib/tracing/index.js +242 -0
  55. package/lib/tracing/logs.js +176 -0
  56. package/lib/tracing/options.js +105 -0
  57. package/lib/tracing/paths.js +34 -0
  58. package/lib/tracing/tracer.js +850 -0
  59. package/lib/tracing/w3c.js +415 -0
  60. package/lib/transport/ipc.js +97 -0
  61. package/lib/transport/ws.js +511 -0
  62. package/lib/util.js +109 -0
  63. package/package.json +48 -4
  64. package/preload.cjs +26 -0
  65. package/preload.mjs +25 -0
  66. package/standalone.cjs +16 -0
  67. package/standalone.mjs +17 -0
package/preload.mjs ADDED
@@ -0,0 +1,25 @@
1
+ // Copyright (c) 2026 Mike Warriner. All rights reserved. Proprietary — see LICENSE.
2
+
3
+ // ES module preload, injected with `--import` only when ESM instrumentation (tracing) is
4
+ // enabled (02 D-05, 80 INJ-010). It shares state with preload.cjs (which Node runs first),
5
+ // activates on its own when used alone, and registers the module customization hooks that wrap
6
+ // ES-module libraries when tracing is on (NIO-085, NIO-210). It never registers a hook otherwise.
7
+
8
+ import { createRequire } from 'node:module'
9
+
10
+ const require = createRequire(import.meta.url)
11
+
12
+ try {
13
+ const env = process.env
14
+ const alreadyActive = Boolean(globalThis[Symbol.for('@pmx/io:preload-state')])
15
+ if (alreadyActive || ((env.PMX_IO === '1' || (!env.PMX_IO && env.PMX_IO_HUB && env.PMX_IO_STANDALONE !== '1')) &&
16
+ env.pmx !== 'false' && env.automation !== 'false')) {
17
+ const activation = require('./lib/activate.js')
18
+ activation.activate()
19
+ activation.registerEsmHooks()
20
+ }
21
+ } catch (err) {
22
+ try {
23
+ process.stderr.write('[pmx] instrumentation disabled: ' + (err && err.message) + '\n')
24
+ } catch (_) {}
25
+ }
package/standalone.cjs ADDED
@@ -0,0 +1,16 @@
1
+ // Copyright (c) 2026 Mike Warriner. All rights reserved. Proprietary — see LICENSE.
2
+ 'use strict'
3
+
4
+ // Standalone preload entry `@aidra/pmx-io/standalone` (80 NIO-261): for
5
+ // `node --require @aidra/pmx-io/standalone app.js`, NODE_OPTIONS and the `pmx-io-node` launcher. Sets
6
+ // PMX_IO_STANDALONE=1 (and PMX_IO_ROOT_PID when unset), adds itself to NODE_OPTIONS so that Node
7
+ // descendants load it too, then activates as the tree's root or as a relay (NIO-263). Any failure
8
+ // leaves the app untouched.
9
+
10
+ try {
11
+ require('./lib/standalone/activate.js').fromPreload()
12
+ } catch (err) {
13
+ try {
14
+ process.stderr.write('[@pm2/io] standalone mode disabled: ' + (err && err.message) + '\n')
15
+ } catch (_) {}
16
+ }
package/standalone.mjs ADDED
@@ -0,0 +1,17 @@
1
+ // Copyright (c) 2026 Mike Warriner. All rights reserved. Proprietary — see LICENSE.
2
+
3
+ // Standalone preload entry for `--import` (80 NIO-261): activates like standalone.cjs and, when
4
+ // tracing is enabled, registers the module customization hooks of NIO-085.
5
+
6
+ import { createRequire } from 'node:module'
7
+
8
+ const require = createRequire(import.meta.url)
9
+
10
+ try {
11
+ require('./lib/standalone/activate.js').fromPreload()
12
+ require('./lib/activate.js').registerEsmHooks()
13
+ } catch (err) {
14
+ try {
15
+ process.stderr.write('[@pm2/io] standalone mode disabled: ' + (err && err.message) + '\n')
16
+ } catch (_) {}
17
+ }