ezlogs-nextjs 0.1.0 → 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 (43) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +98 -688
  3. package/bin/install-triggers.cjs +1 -1
  4. package/dist/actors/index.d.cts +1 -1
  5. package/dist/actors/index.d.ts +1 -1
  6. package/dist/{configuration-D9x9Gvds.d.cts → configuration-aUYgA8-h.d.cts} +20 -3
  7. package/dist/{configuration-D9x9Gvds.d.ts → configuration-aUYgA8-h.d.ts} +20 -3
  8. package/dist/db/drizzle.cjs +17 -6
  9. package/dist/db/drizzle.js +17 -6
  10. package/dist/db/prisma.cjs +271 -76
  11. package/dist/db/prisma.d.cts +38 -1
  12. package/dist/db/prisma.d.ts +38 -1
  13. package/dist/db/prisma.js +270 -77
  14. package/dist/db/supabase.cjs +17 -6
  15. package/dist/db/supabase.js +17 -6
  16. package/dist/index.cjs +459 -222
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +459 -222
  20. package/dist/jobs/bullmq.cjs +6 -5
  21. package/dist/jobs/bullmq.d.cts +16 -8
  22. package/dist/jobs/bullmq.d.ts +16 -8
  23. package/dist/jobs/bullmq.js +6 -5
  24. package/dist/jobs/inngest.cjs +16 -6
  25. package/dist/jobs/inngest.js +16 -6
  26. package/dist/jobs/supabase-queues.cjs +16 -6
  27. package/dist/jobs/supabase-queues.js +16 -6
  28. package/dist/jobs/trigger.cjs +16 -6
  29. package/dist/jobs/trigger.js +16 -6
  30. package/dist/jobs/upstash-workflow.cjs +16 -6
  31. package/dist/jobs/upstash-workflow.js +16 -6
  32. package/dist/nextjs-plugin/index.cjs +18 -0
  33. package/dist/nextjs-plugin/index.js +18 -0
  34. package/dist/nextjs-plugin/loader.cjs +44 -34
  35. package/dist/nextjs-plugin/loader.d.cts +10 -0
  36. package/dist/nextjs-plugin/loader.d.ts +10 -0
  37. package/dist/nextjs-plugin/loader.js +44 -34
  38. package/dist/triggers/index.cjs +43 -8
  39. package/dist/triggers/index.d.cts +7 -0
  40. package/dist/triggers/index.d.ts +7 -0
  41. package/dist/triggers/index.js +43 -8
  42. package/package.json +3 -4
  43. package/sql/postgres/00_install.sql +1 -1
@@ -1,3 +1,40 @@
1
1
  declare function ezlogsPrisma(): unknown;
2
+ /**
3
+ * Wrap a `PrismaPg` adapter so its queryRaw/executeRaw/transactionContext
4
+ * methods run inside a snapshot the partnered `patchPrismaClient` deposits.
5
+ * Idempotent — passing a previously-wrapped adapter returns it unchanged.
6
+ *
7
+ * Customer wires this BEFORE constructing the PrismaClient:
8
+ *
9
+ * const adapter = patchPrismaPgAdapter(new PrismaPg(pool));
10
+ * const prisma = patchPrismaClient(new PrismaClient({ adapter }), adapter);
11
+ *
12
+ * Without this wrap, the snapshot we capture at the Prisma call site
13
+ * dies at the engine's NAPI boundary before adapter-pg's pool.query
14
+ * runs — the production bug. With it, the wrap reads the synchronously-
15
+ * deposited snapshot off the adapter and re-enters it just before
16
+ * the wrapped method delegates to the real adapter, restoring the
17
+ * agent's correlation/actor frames for the eventual SET LOCAL.
18
+ */
19
+ declare function patchPrismaPgAdapter<A extends object>(adapter: A): A;
20
+ /**
21
+ * Wrap a PrismaClient so every async method preserves the caller's
22
+ * AsyncLocalStorage context across the engine boundary. Idempotent.
23
+ *
24
+ * Composes `prisma.$extends(ezlogsPrisma())` internally so customers
25
+ * only have to write one wiring line for capture. If `adapter` is
26
+ * passed and is the result of `patchPrismaPgAdapter`, the Proxy uses
27
+ * an adapter-level serialization mutex to deposit the snapshot on the
28
+ * adapter synchronously before each method call and clear it after —
29
+ * the only correct way to thread per-call context through Prisma's
30
+ * NAPI engine boundary. Without the adapter arg, the wrapper still
31
+ * applies the capture extension but cannot fix the correlation bug;
32
+ * see `patchPrismaPgAdapter`'s docstring for the explanation.
33
+ *
34
+ * The returned value is typed as the same shape as the input. We
35
+ * cast back to `T` because runtime Proxy preserves the surface but
36
+ * TypeScript can't follow this through a generic.
37
+ */
38
+ declare function patchPrismaClient<T extends object>(prisma: T, adapter?: object): T;
2
39
 
3
- export { ezlogsPrisma };
40
+ export { ezlogsPrisma, patchPrismaClient, patchPrismaPgAdapter };
@@ -1,3 +1,40 @@
1
1
  declare function ezlogsPrisma(): unknown;
2
+ /**
3
+ * Wrap a `PrismaPg` adapter so its queryRaw/executeRaw/transactionContext
4
+ * methods run inside a snapshot the partnered `patchPrismaClient` deposits.
5
+ * Idempotent — passing a previously-wrapped adapter returns it unchanged.
6
+ *
7
+ * Customer wires this BEFORE constructing the PrismaClient:
8
+ *
9
+ * const adapter = patchPrismaPgAdapter(new PrismaPg(pool));
10
+ * const prisma = patchPrismaClient(new PrismaClient({ adapter }), adapter);
11
+ *
12
+ * Without this wrap, the snapshot we capture at the Prisma call site
13
+ * dies at the engine's NAPI boundary before adapter-pg's pool.query
14
+ * runs — the production bug. With it, the wrap reads the synchronously-
15
+ * deposited snapshot off the adapter and re-enters it just before
16
+ * the wrapped method delegates to the real adapter, restoring the
17
+ * agent's correlation/actor frames for the eventual SET LOCAL.
18
+ */
19
+ declare function patchPrismaPgAdapter<A extends object>(adapter: A): A;
20
+ /**
21
+ * Wrap a PrismaClient so every async method preserves the caller's
22
+ * AsyncLocalStorage context across the engine boundary. Idempotent.
23
+ *
24
+ * Composes `prisma.$extends(ezlogsPrisma())` internally so customers
25
+ * only have to write one wiring line for capture. If `adapter` is
26
+ * passed and is the result of `patchPrismaPgAdapter`, the Proxy uses
27
+ * an adapter-level serialization mutex to deposit the snapshot on the
28
+ * adapter synchronously before each method call and clear it after —
29
+ * the only correct way to thread per-call context through Prisma's
30
+ * NAPI engine boundary. Without the adapter arg, the wrapper still
31
+ * applies the capture extension but cannot fix the correlation bug;
32
+ * see `patchPrismaPgAdapter`'s docstring for the explanation.
33
+ *
34
+ * The returned value is typed as the same shape as the input. We
35
+ * cast back to `T` because runtime Proxy preserves the surface but
36
+ * TypeScript can't follow this through a generic.
37
+ */
38
+ declare function patchPrismaClient<T extends object>(prisma: T, adapter?: object): T;
2
39
 
3
- export { ezlogsPrisma };
40
+ export { ezlogsPrisma, patchPrismaClient, patchPrismaPgAdapter };
package/dist/db/prisma.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'crypto';
2
-
3
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
3
  }) : x)(function(x) {
@@ -42,6 +40,86 @@ var logger = {
42
40
  error: (message) => safeWrite("error", message)
43
41
  };
44
42
 
43
+ // src/edge-fallback.ts
44
+ var ALS_CTOR = loadAsyncLocalStorage();
45
+ function loadAsyncLocalStorage() {
46
+ const fromGlobal = globalThis.AsyncLocalStorage;
47
+ if (typeof fromGlobal === "function") return fromGlobal;
48
+ try {
49
+ const req = typeof __require !== "undefined" ? __require : (
50
+ // In ESM, `createRequire` is the official escape hatch.
51
+ // We pull it via globalThis to avoid a static `import`
52
+ // that would itself be browser-bundled.
53
+ void 0
54
+ );
55
+ if (typeof req === "function") {
56
+ const moduleName = ["async", "hooks"].join("_");
57
+ const mod = req("node:" + moduleName);
58
+ if (typeof mod.AsyncLocalStorage === "function") return mod.AsyncLocalStorage;
59
+ }
60
+ } catch {
61
+ }
62
+ return null;
63
+ }
64
+ function makeAsyncContextCapture() {
65
+ if (!ALS_CTOR) return null;
66
+ const ctor = ALS_CTOR;
67
+ if (typeof ctor.snapshot !== "function") return null;
68
+ const snapshot = ctor.snapshot.bind(ctor);
69
+ return () => {
70
+ const runSnapshot = snapshot();
71
+ return (fn) => runSnapshot(fn);
72
+ };
73
+ }
74
+ function createScopedStorage(key = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:default-scoped-storage")) {
75
+ const globalStore = globalThis;
76
+ let entry = globalStore[key];
77
+ if (!entry) {
78
+ const als2 = (() => {
79
+ if (!ALS_CTOR) return null;
80
+ try {
81
+ return new ALS_CTOR();
82
+ } catch {
83
+ return null;
84
+ }
85
+ })();
86
+ entry = { als: als2, edgeFallback: null };
87
+ globalStore[key] = entry;
88
+ }
89
+ const als = entry.als;
90
+ const stateRef = entry;
91
+ return {
92
+ read() {
93
+ if (als) return als.getStore()?.value ?? null;
94
+ return stateRef.edgeFallback?.value ?? null;
95
+ },
96
+ run(value, callback) {
97
+ if (als) return als.run({ value }, callback);
98
+ const previous = stateRef.edgeFallback;
99
+ stateRef.edgeFallback = { value };
100
+ try {
101
+ return callback();
102
+ } finally {
103
+ stateRef.edgeFallback = previous;
104
+ }
105
+ },
106
+ update(value) {
107
+ if (als) {
108
+ const store = als.getStore();
109
+ if (store) store.value = value;
110
+ return;
111
+ }
112
+ stateRef.edgeFallback = { value };
113
+ },
114
+ _resetForTests() {
115
+ stateRef.edgeFallback = null;
116
+ },
117
+ _isAsyncLocalStorage() {
118
+ return als !== null;
119
+ }
120
+ };
121
+ }
122
+
45
123
  // src/configuration.ts
46
124
  var DEFAULT_EXCLUDED_PATHS = Object.freeze([
47
125
  // Next.js / Vercel infrastructure noise
@@ -88,9 +166,8 @@ var DEFAULT_EXCLUDED_TABLES = Object.freeze([
88
166
  ]);
89
167
  var DEFAULT_EXCLUDED_JOB_CLASSES = Object.freeze([]);
90
168
  var DEFAULT_EXCLUDED_GRAPHQL_OPERATIONS = Object.freeze(["IntrospectionQuery", "__*"]);
91
- var DEFAULT_SERVER_URL = "https://app.ezlogs.io";
92
169
  var Configuration = class {
93
- serverUrl = DEFAULT_SERVER_URL;
170
+ serverUrl = null;
94
171
  projectToken = null;
95
172
  captureHttp = true;
96
173
  captureDb = true;
@@ -102,6 +179,7 @@ var Configuration = class {
102
179
  logLevel = "warn";
103
180
  patchGlobalFetch = true;
104
181
  actorFromSupabase = true;
182
+ allowInsecureTransport = false;
105
183
  excludedPaths = [];
106
184
  excludedTables = [];
107
185
  excludedJobClasses = [];
@@ -129,7 +207,7 @@ var Configuration = class {
129
207
  */
130
208
  triggerTrackedTables = null;
131
209
  apply(options) {
132
- if (options.serverUrl !== void 0) this.serverUrl = options.serverUrl;
210
+ this.serverUrl = options.serverUrl;
133
211
  this.projectToken = options.projectToken;
134
212
  if (options.captureHttp !== void 0) this.captureHttp = options.captureHttp;
135
213
  if (options.captureDb !== void 0) this.captureDb = options.captureDb;
@@ -154,6 +232,9 @@ var Configuration = class {
154
232
  if (options.patchGlobalFetch !== void 0) {
155
233
  this.patchGlobalFetch = options.patchGlobalFetch;
156
234
  }
235
+ if (options.allowInsecureTransport !== void 0) {
236
+ this.allowInsecureTransport = options.allowInsecureTransport;
237
+ }
157
238
  if (options.actorFromSupabase !== void 0) {
158
239
  this.actorFromSupabase = options.actorFromSupabase;
159
240
  }
@@ -405,76 +486,6 @@ function describe2(error) {
405
486
  return String(error);
406
487
  }
407
488
 
408
- // src/edge-fallback.ts
409
- var ALS_CTOR = loadAsyncLocalStorage();
410
- function loadAsyncLocalStorage() {
411
- const fromGlobal = globalThis.AsyncLocalStorage;
412
- if (typeof fromGlobal === "function") return fromGlobal;
413
- try {
414
- const req = typeof __require !== "undefined" ? __require : (
415
- // In ESM, `createRequire` is the official escape hatch.
416
- // We pull it via globalThis to avoid a static `import`
417
- // that would itself be browser-bundled.
418
- void 0
419
- );
420
- if (typeof req === "function") {
421
- const moduleName = ["async", "hooks"].join("_");
422
- const mod = req("node:" + moduleName);
423
- if (typeof mod.AsyncLocalStorage === "function") return mod.AsyncLocalStorage;
424
- }
425
- } catch {
426
- }
427
- return null;
428
- }
429
- function createScopedStorage(key = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:default-scoped-storage")) {
430
- const globalStore = globalThis;
431
- let entry = globalStore[key];
432
- if (!entry) {
433
- const als2 = (() => {
434
- if (!ALS_CTOR) return null;
435
- try {
436
- return new ALS_CTOR();
437
- } catch {
438
- return null;
439
- }
440
- })();
441
- entry = { als: als2, edgeFallback: null };
442
- globalStore[key] = entry;
443
- }
444
- const als = entry.als;
445
- const stateRef = entry;
446
- return {
447
- read() {
448
- if (als) return als.getStore()?.value ?? null;
449
- return stateRef.edgeFallback?.value ?? null;
450
- },
451
- run(value, callback) {
452
- if (als) return als.run({ value }, callback);
453
- const previous = stateRef.edgeFallback;
454
- stateRef.edgeFallback = { value };
455
- try {
456
- return callback();
457
- } finally {
458
- stateRef.edgeFallback = previous;
459
- }
460
- },
461
- update(value) {
462
- if (als) {
463
- const store = als.getStore();
464
- if (store) store.value = value;
465
- return;
466
- }
467
- stateRef.edgeFallback = { value };
468
- },
469
- _resetForTests() {
470
- stateRef.edgeFallback = null;
471
- },
472
- _isAsyncLocalStorage() {
473
- return als !== null;
474
- }
475
- };
476
- }
477
-
478
489
  // src/correlation.ts
479
490
  var storage = createScopedStorage(
480
491
  /* @__PURE__ */ Symbol.for("ezlogs-nextjs:correlation-storage")
@@ -512,7 +523,17 @@ var DB_SENSITIVE_PATTERNS = Object.freeze([
512
523
  "credit_card",
513
524
  "ssn",
514
525
  "social_security",
515
- "encrypted"
526
+ "encrypted",
527
+ "private_key",
528
+ "public_key",
529
+ "signing_key",
530
+ "pem",
531
+ "cipher",
532
+ "nonce",
533
+ "salt",
534
+ "digest",
535
+ "signature",
536
+ "hmac"
516
537
  ]);
517
538
  function emitDbEvent(input) {
518
539
  try {
@@ -820,5 +841,177 @@ function describeError2(error) {
820
841
  if (error instanceof Error) return `${error.name}: ${error.message}`;
821
842
  return String(error);
822
843
  }
844
+ var EZLOGS_PRISMA_BRAND = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:prismaPatched");
845
+ var EZLOGS_ADAPTER_BRAND = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:prismaPgAdapterPatched");
846
+ var ADAPTER_SNAPSHOT_KEY = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:prismaPgSnapshot");
847
+ var ADAPTER_MUTEX_KEY = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:prismaPgMutex");
848
+ var RAW_METHODS = /* @__PURE__ */ new Set([
849
+ "$transaction",
850
+ "$queryRaw",
851
+ "$queryRawUnsafe",
852
+ "$executeRaw",
853
+ "$executeRawUnsafe",
854
+ "$runCommandRaw"
855
+ ]);
856
+ var MODEL_METHODS = /* @__PURE__ */ new Set([
857
+ "create",
858
+ "createMany",
859
+ "createManyAndReturn",
860
+ "findUnique",
861
+ "findUniqueOrThrow",
862
+ "findFirst",
863
+ "findFirstOrThrow",
864
+ "findMany",
865
+ "update",
866
+ "updateMany",
867
+ "upsert",
868
+ "delete",
869
+ "deleteMany",
870
+ "count",
871
+ "aggregate",
872
+ "groupBy"
873
+ ]);
874
+ function patchPrismaPgAdapter(adapter) {
875
+ if (!adapter || typeof adapter !== "object") return adapter;
876
+ const adapterRec = adapter;
877
+ if (adapterRec[EZLOGS_ADAPTER_BRAND] === true) return adapter;
878
+ for (const method of ["queryRaw", "executeRaw", "transactionContext"]) {
879
+ const original = adapterRec[method];
880
+ if (typeof original !== "function") continue;
881
+ adapterRec[method] = function ezlogsPatchedAdapterMethod(...args) {
882
+ const snapshot = adapterRec[ADAPTER_SNAPSHOT_KEY];
883
+ const invoke = () => original.apply(this, args);
884
+ if (snapshot) return snapshot(invoke);
885
+ return invoke();
886
+ };
887
+ }
888
+ adapterRec[EZLOGS_ADAPTER_BRAND] = true;
889
+ return adapter;
890
+ }
891
+ function patchPrismaClient(prisma, adapter) {
892
+ if (!prisma || typeof prisma !== "object") {
893
+ return prisma;
894
+ }
895
+ if (prisma[EZLOGS_PRISMA_BRAND] === true) {
896
+ return prisma;
897
+ }
898
+ const captureAndRun = makeAsyncContextCapture();
899
+ if (!captureAndRun) {
900
+ logger.debug(
901
+ "patchPrismaClient: AsyncLocalStorage.snapshot() unavailable; skipping ALS bind, applying ezlogsPrisma() only."
902
+ );
903
+ return applyEzlogsExtension(prisma);
904
+ }
905
+ const patchedAdapter = adapter && typeof adapter === "object" && adapter[EZLOGS_ADAPTER_BRAND] === true ? adapter : null;
906
+ if (adapter && !patchedAdapter) {
907
+ logger.debug(
908
+ "patchPrismaClient: adapter is not the output of patchPrismaPgAdapter(). Correlation_id will be NULL on concurrent requests. Wrap the adapter first."
909
+ );
910
+ }
911
+ const extended = applyEzlogsExtension(prisma);
912
+ const wrapped = buildClientProxy(extended, captureAndRun, patchedAdapter);
913
+ return wrapped;
914
+ }
915
+ function applyEzlogsExtension(prisma) {
916
+ const client = prisma;
917
+ if (typeof client.$extends !== "function") {
918
+ logger.debug(
919
+ "patchPrismaClient: client has no $extends; skipping ezlogsPrisma extension."
920
+ );
921
+ return prisma;
922
+ }
923
+ try {
924
+ return client.$extends(ezlogsPrisma());
925
+ } catch (error) {
926
+ logger.debug(`patchPrismaClient: $extends failed: ${describeError2(error)}`);
927
+ return prisma;
928
+ }
929
+ }
930
+ function buildClientProxy(client, captureAndRun, adapter) {
931
+ const modelProxyCache = /* @__PURE__ */ new WeakMap();
932
+ return new Proxy(client, {
933
+ get(target, prop, receiver) {
934
+ if (prop === EZLOGS_PRISMA_BRAND) return true;
935
+ const value = Reflect.get(target, prop, receiver);
936
+ if (typeof prop !== "string") return value;
937
+ if (RAW_METHODS.has(prop) && typeof value === "function") {
938
+ return bindFunctionInSnapshot(value, target, captureAndRun, adapter);
939
+ }
940
+ if (isLikelyModelDelegate(value)) {
941
+ const cached = modelProxyCache.get(value);
942
+ if (cached) return cached;
943
+ const wrappedDelegate = buildModelProxy(value, captureAndRun, adapter);
944
+ modelProxyCache.set(value, wrappedDelegate);
945
+ return wrappedDelegate;
946
+ }
947
+ return value;
948
+ }
949
+ });
950
+ }
951
+ function buildModelProxy(delegate, captureAndRun, adapter) {
952
+ return new Proxy(delegate, {
953
+ get(target, prop, receiver) {
954
+ const value = Reflect.get(target, prop, receiver);
955
+ if (typeof prop === "string" && MODEL_METHODS.has(prop) && typeof value === "function") {
956
+ return bindFunctionInSnapshot(value, target, captureAndRun, adapter);
957
+ }
958
+ return value;
959
+ }
960
+ });
961
+ }
962
+ function bindFunctionInSnapshot(fn, thisArg, captureAndRun, adapter) {
963
+ return function bound(...args) {
964
+ const run = captureAndRun();
965
+ const boundArgs = args.map(
966
+ (a) => typeof a === "function" ? wrapCallbackInSnapshot(a, run) : a
967
+ );
968
+ const invoke = () => Reflect.apply(fn, thisArg, boundArgs);
969
+ if (!adapter) return run(invoke);
970
+ return enterAdapterMutex(
971
+ adapter,
972
+ () => run(() => {
973
+ adapter[ADAPTER_SNAPSHOT_KEY] = run;
974
+ let result;
975
+ try {
976
+ result = invoke();
977
+ } catch (sync) {
978
+ adapter[ADAPTER_SNAPSHOT_KEY] = null;
979
+ throw sync;
980
+ }
981
+ if (isThenable(result)) {
982
+ return result.finally(() => {
983
+ adapter[ADAPTER_SNAPSHOT_KEY] = null;
984
+ });
985
+ }
986
+ adapter[ADAPTER_SNAPSHOT_KEY] = null;
987
+ return result;
988
+ })
989
+ );
990
+ };
991
+ }
992
+ function enterAdapterMutex(adapter, body) {
993
+ const prev = adapter[ADAPTER_MUTEX_KEY] ?? Promise.resolve();
994
+ const next = prev.then(() => body());
995
+ adapter[ADAPTER_MUTEX_KEY] = next.then(
996
+ () => void 0,
997
+ () => void 0
998
+ );
999
+ return next;
1000
+ }
1001
+ function isThenable(value) {
1002
+ return value !== null && typeof value === "object" && typeof value.then === "function";
1003
+ }
1004
+ function wrapCallbackInSnapshot(cb, run) {
1005
+ return function wrapped(...args) {
1006
+ return run(() => Reflect.apply(cb, this, args));
1007
+ };
1008
+ }
1009
+ function isLikelyModelDelegate(value) {
1010
+ if (!value || typeof value !== "object") return false;
1011
+ if (Array.isArray(value)) return false;
1012
+ if (value instanceof Date) return false;
1013
+ const candidate = value;
1014
+ return typeof candidate.create === "function" && typeof candidate.findMany === "function";
1015
+ }
823
1016
 
824
- export { ezlogsPrisma };
1017
+ export { ezlogsPrisma, patchPrismaClient, patchPrismaPgAdapter };
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('crypto');
4
-
5
3
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
4
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
5
  }) : x)(function(x) {
@@ -90,9 +88,8 @@ var DEFAULT_EXCLUDED_TABLES = Object.freeze([
90
88
  ]);
91
89
  var DEFAULT_EXCLUDED_JOB_CLASSES = Object.freeze([]);
92
90
  var DEFAULT_EXCLUDED_GRAPHQL_OPERATIONS = Object.freeze(["IntrospectionQuery", "__*"]);
93
- var DEFAULT_SERVER_URL = "https://app.ezlogs.io";
94
91
  var Configuration = class {
95
- serverUrl = DEFAULT_SERVER_URL;
92
+ serverUrl = null;
96
93
  projectToken = null;
97
94
  captureHttp = true;
98
95
  captureDb = true;
@@ -104,6 +101,7 @@ var Configuration = class {
104
101
  logLevel = "warn";
105
102
  patchGlobalFetch = true;
106
103
  actorFromSupabase = true;
104
+ allowInsecureTransport = false;
107
105
  excludedPaths = [];
108
106
  excludedTables = [];
109
107
  excludedJobClasses = [];
@@ -131,7 +129,7 @@ var Configuration = class {
131
129
  */
132
130
  triggerTrackedTables = null;
133
131
  apply(options) {
134
- if (options.serverUrl !== void 0) this.serverUrl = options.serverUrl;
132
+ this.serverUrl = options.serverUrl;
135
133
  this.projectToken = options.projectToken;
136
134
  if (options.captureHttp !== void 0) this.captureHttp = options.captureHttp;
137
135
  if (options.captureDb !== void 0) this.captureDb = options.captureDb;
@@ -156,6 +154,9 @@ var Configuration = class {
156
154
  if (options.patchGlobalFetch !== void 0) {
157
155
  this.patchGlobalFetch = options.patchGlobalFetch;
158
156
  }
157
+ if (options.allowInsecureTransport !== void 0) {
158
+ this.allowInsecureTransport = options.allowInsecureTransport;
159
+ }
159
160
  if (options.actorFromSupabase !== void 0) {
160
161
  this.actorFromSupabase = options.actorFromSupabase;
161
162
  }
@@ -514,7 +515,17 @@ var DB_SENSITIVE_PATTERNS = Object.freeze([
514
515
  "credit_card",
515
516
  "ssn",
516
517
  "social_security",
517
- "encrypted"
518
+ "encrypted",
519
+ "private_key",
520
+ "public_key",
521
+ "signing_key",
522
+ "pem",
523
+ "cipher",
524
+ "nonce",
525
+ "salt",
526
+ "digest",
527
+ "signature",
528
+ "hmac"
518
529
  ]);
519
530
  function emitDbEvent(input) {
520
531
  try {
@@ -1,5 +1,3 @@
1
- import 'crypto';
2
-
3
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
3
  }) : x)(function(x) {
@@ -88,9 +86,8 @@ var DEFAULT_EXCLUDED_TABLES = Object.freeze([
88
86
  ]);
89
87
  var DEFAULT_EXCLUDED_JOB_CLASSES = Object.freeze([]);
90
88
  var DEFAULT_EXCLUDED_GRAPHQL_OPERATIONS = Object.freeze(["IntrospectionQuery", "__*"]);
91
- var DEFAULT_SERVER_URL = "https://app.ezlogs.io";
92
89
  var Configuration = class {
93
- serverUrl = DEFAULT_SERVER_URL;
90
+ serverUrl = null;
94
91
  projectToken = null;
95
92
  captureHttp = true;
96
93
  captureDb = true;
@@ -102,6 +99,7 @@ var Configuration = class {
102
99
  logLevel = "warn";
103
100
  patchGlobalFetch = true;
104
101
  actorFromSupabase = true;
102
+ allowInsecureTransport = false;
105
103
  excludedPaths = [];
106
104
  excludedTables = [];
107
105
  excludedJobClasses = [];
@@ -129,7 +127,7 @@ var Configuration = class {
129
127
  */
130
128
  triggerTrackedTables = null;
131
129
  apply(options) {
132
- if (options.serverUrl !== void 0) this.serverUrl = options.serverUrl;
130
+ this.serverUrl = options.serverUrl;
133
131
  this.projectToken = options.projectToken;
134
132
  if (options.captureHttp !== void 0) this.captureHttp = options.captureHttp;
135
133
  if (options.captureDb !== void 0) this.captureDb = options.captureDb;
@@ -154,6 +152,9 @@ var Configuration = class {
154
152
  if (options.patchGlobalFetch !== void 0) {
155
153
  this.patchGlobalFetch = options.patchGlobalFetch;
156
154
  }
155
+ if (options.allowInsecureTransport !== void 0) {
156
+ this.allowInsecureTransport = options.allowInsecureTransport;
157
+ }
157
158
  if (options.actorFromSupabase !== void 0) {
158
159
  this.actorFromSupabase = options.actorFromSupabase;
159
160
  }
@@ -512,7 +513,17 @@ var DB_SENSITIVE_PATTERNS = Object.freeze([
512
513
  "credit_card",
513
514
  "ssn",
514
515
  "social_security",
515
- "encrypted"
516
+ "encrypted",
517
+ "private_key",
518
+ "public_key",
519
+ "signing_key",
520
+ "pem",
521
+ "cipher",
522
+ "nonce",
523
+ "salt",
524
+ "digest",
525
+ "signature",
526
+ "hmac"
516
527
  ]);
517
528
  function emitDbEvent(input) {
518
529
  try {