@justanalyticsapp/node 0.2.1 → 0.3.1

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 (40) hide show
  1. package/dist/client.d.ts +23 -1
  2. package/dist/client.js +139 -1
  3. package/dist/client.js.map +1 -1
  4. package/dist/integrations/axios-integration.d.ts +53 -0
  5. package/dist/integrations/axios-integration.js +217 -0
  6. package/dist/integrations/axios-integration.js.map +1 -0
  7. package/dist/integrations/drizzle.d.ts +54 -0
  8. package/dist/integrations/drizzle.js +236 -0
  9. package/dist/integrations/drizzle.js.map +1 -0
  10. package/dist/integrations/http.d.ts +3 -1
  11. package/dist/integrations/http.js +12 -1
  12. package/dist/integrations/http.js.map +1 -1
  13. package/dist/integrations/mongodb.d.ts +50 -0
  14. package/dist/integrations/mongodb.js +256 -0
  15. package/dist/integrations/mongodb.js.map +1 -0
  16. package/dist/integrations/mysql.d.ts +56 -0
  17. package/dist/integrations/mysql.js +298 -0
  18. package/dist/integrations/mysql.js.map +1 -0
  19. package/dist/integrations/next.d.ts +41 -0
  20. package/dist/integrations/next.js +204 -0
  21. package/dist/integrations/next.js.map +1 -1
  22. package/dist/integrations/pg.d.ts +31 -3
  23. package/dist/integrations/pg.js +100 -29
  24. package/dist/integrations/pg.js.map +1 -1
  25. package/dist/integrations/postgres-js.d.ts +57 -0
  26. package/dist/integrations/postgres-js.js +306 -0
  27. package/dist/integrations/postgres-js.js.map +1 -0
  28. package/dist/integrations/prisma.d.ts +54 -0
  29. package/dist/integrations/prisma.js +182 -0
  30. package/dist/integrations/prisma.js.map +1 -0
  31. package/dist/integrations/redis.d.ts +6 -0
  32. package/dist/integrations/redis.js +21 -35
  33. package/dist/integrations/redis.js.map +1 -1
  34. package/dist/integrations/upstash-redis.d.ts +43 -0
  35. package/dist/integrations/upstash-redis.js +166 -0
  36. package/dist/integrations/upstash-redis.js.map +1 -0
  37. package/dist/utils/safe-require.d.ts +22 -0
  38. package/dist/utils/safe-require.js +36 -0
  39. package/dist/utils/safe-require.js.map +1 -0
  40. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * @file packages/node-sdk/src/utils/safe-require.ts
4
+ * @description Bundler-opaque dynamic require utility.
5
+ *
6
+ * Turbopack, Webpack, esbuild, and Rollup all statically analyze `require('...')`
7
+ * calls and try to resolve the module at build time -- even inside try/catch.
8
+ * This causes build errors for applications that don't have all of our optional
9
+ * peer dependencies installed.
10
+ *
11
+ * Using `new Function('id', 'return require(id)')` creates an indirect require
12
+ * call that no bundler can statically analyze, so the module path is resolved
13
+ * only at runtime. If the module is not installed, `safeRequire` returns `null`
14
+ * instead of throwing.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.safeRequire = safeRequire;
18
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
19
+ const dynamicRequire = new Function('id', 'return require(id)');
20
+ /**
21
+ * Dynamically require a module without being traced by bundlers.
22
+ * Returns `null` if the module is not installed or cannot be loaded.
23
+ *
24
+ * @param id - The module specifier (e.g., 'pg', '@prisma/client', 'ioredis')
25
+ * @returns The module exports, or `null` if the module is unavailable
26
+ */
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ function safeRequire(id) {
29
+ try {
30
+ return dynamicRequire(id);
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ //# sourceMappingURL=safe-require.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-require.js","sourceRoot":"","sources":["../../src/utils/safe-require.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAaH,kCAMC;AAjBD,8DAA8D;AAC9D,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAwB,CAAC;AAEvF;;;;;;GAMG;AACH,8DAA8D;AAC9D,SAAgB,WAAW,CAAC,EAAU;IACpC,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justanalyticsapp/node",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "JustAnalytics Node.js SDK for distributed tracing and observability",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",