ezlogs-nextjs 0.4.1 → 0.4.3

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 (42) hide show
  1. package/README.md +21 -10
  2. package/dist/actors/index.d.cts +1 -1
  3. package/dist/actors/index.d.ts +1 -1
  4. package/dist/{chunk-B7SH6V7M.js → chunk-GI6BM4MR.js} +2 -1
  5. package/dist/{chunk-VROC3BO3.cjs → chunk-GMHOUAKD.cjs} +12 -12
  6. package/dist/{chunk-2X6IZ2JX.js → chunk-MHBS5FEP.js} +2 -2
  7. package/dist/{chunk-ULFJOPQ2.cjs → chunk-MMLQXSSD.cjs} +2 -1
  8. package/dist/{chunk-SH5NGIX3.js → chunk-NINIAL7M.js} +1 -1
  9. package/dist/{chunk-LMG2SNTF.cjs → chunk-NX4EL7BY.cjs} +4 -4
  10. package/dist/{chunk-ZSFJ3UQV.cjs → chunk-PS4U2GFJ.cjs} +5 -5
  11. package/dist/{chunk-GILAKFP7.cjs → chunk-R6IWVTX3.cjs} +21 -21
  12. package/dist/{chunk-KCCKURJW.js → chunk-U22T7QYY.js} +3 -3
  13. package/dist/{chunk-DLUZRHHW.js → chunk-YMIGZYFH.js} +1 -1
  14. package/dist/{chunk-OJKWSUMK.cjs → chunk-YXZZNZG6.cjs} +9 -9
  15. package/dist/{chunk-H4K5QDXE.js → chunk-Z2TM3LGG.js} +1 -1
  16. package/dist/{configuration-Pshqvpkk.d.cts → configuration-CJ5yKVlP.d.cts} +2 -1
  17. package/dist/{configuration-Pshqvpkk.d.ts → configuration-CJ5yKVlP.d.ts} +2 -1
  18. package/dist/db/drizzle.cjs +3 -3
  19. package/dist/db/drizzle.js +2 -2
  20. package/dist/db/postgres-js.cjs +4 -4
  21. package/dist/db/postgres-js.js +2 -2
  22. package/dist/db/prisma.cjs +12 -12
  23. package/dist/db/prisma.js +2 -2
  24. package/dist/db/supabase.cjs +11 -11
  25. package/dist/db/supabase.js +2 -2
  26. package/dist/index.cjs +156 -119
  27. package/dist/index.d.cts +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +62 -25
  30. package/dist/jobs/bullmq.cjs +16 -16
  31. package/dist/jobs/bullmq.js +4 -4
  32. package/dist/jobs/inngest.cjs +17 -17
  33. package/dist/jobs/inngest.js +4 -4
  34. package/dist/jobs/supabase-queues.cjs +9 -9
  35. package/dist/jobs/supabase-queues.js +4 -4
  36. package/dist/jobs/trigger.cjs +7 -7
  37. package/dist/jobs/trigger.js +4 -4
  38. package/dist/jobs/upstash-workflow.cjs +15 -15
  39. package/dist/jobs/upstash-workflow.js +4 -4
  40. package/dist/triggers/index.cjs +16 -16
  41. package/dist/triggers/index.js +5 -5
  42. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkOJKWSUMK_cjs = require('../chunk-OJKWSUMK.cjs');
4
- var chunkULFJOPQ2_cjs = require('../chunk-ULFJOPQ2.cjs');
3
+ var chunkYXZZNZG6_cjs = require('../chunk-YXZZNZG6.cjs');
4
+ var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
5
5
  var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
6
6
  require('../chunk-ZDSQYCYV.cjs');
7
7
 
@@ -62,7 +62,7 @@ async function runTagged(client, ctx) {
62
62
  if (!shouldTag(client, ctx)) return ctx.query(ctx.args);
63
63
  try {
64
64
  const results = await client.$transaction([
65
- client.$executeRawUnsafe(SET_CONTEXT_SQL, chunkULFJOPQ2_cjs.current(), chunkULFJOPQ2_cjs.getCurrentActor()?.id ?? ""),
65
+ client.$executeRawUnsafe(SET_CONTEXT_SQL, chunkMMLQXSSD_cjs.current(), chunkMMLQXSSD_cjs.getCurrentActor()?.id ?? ""),
66
66
  ctx.query(ctx.args)
67
67
  ]);
68
68
  return results[1];
@@ -81,12 +81,12 @@ function _resetPrismaTaggingForTests() {
81
81
  }
82
82
  function shouldTag(client, ctx) {
83
83
  if (!client || taggingDisabled.has(client)) return false;
84
- if (chunkULFJOPQ2_cjs.configuration().databaseReader == null) return false;
84
+ if (chunkMMLQXSSD_cjs.configuration().databaseReader == null) return false;
85
85
  if (!isPostgresClient(client)) return false;
86
86
  if (typeof client.$transaction !== "function" || typeof client.$executeRawUnsafe !== "function") {
87
87
  return false;
88
88
  }
89
- if (!chunkULFJOPQ2_cjs.current()) return false;
89
+ if (!chunkMMLQXSSD_cjs.current()) return false;
90
90
  const params = ctx.__internalParams;
91
91
  return params != null && !params.transaction;
92
92
  }
@@ -112,7 +112,7 @@ function recordPrismaOperation(ctx, result, table) {
112
112
  const dbOperation = OPERATION_TO_DB_OPERATION[ctx.operation];
113
113
  if (!dbOperation) return;
114
114
  if (isBatchResult(result)) {
115
- chunkOJKWSUMK_cjs.emitDbEvent({
115
+ chunkYXZZNZG6_cjs.emitDbEvent({
116
116
  modelClass: ctx.model,
117
117
  table,
118
118
  operation: dbOperation,
@@ -139,7 +139,7 @@ function recordPrismaOperation(ctx, result, table) {
139
139
  }
140
140
  function emitSingleRowEvent(ctx, dbOperation, row, table) {
141
141
  if (!isPlainObject(row)) {
142
- chunkOJKWSUMK_cjs.emitDbEvent({
142
+ chunkYXZZNZG6_cjs.emitDbEvent({
143
143
  modelClass: ctx.model,
144
144
  table,
145
145
  operation: dbOperation,
@@ -149,9 +149,9 @@ function emitSingleRowEvent(ctx, dbOperation, row, table) {
149
149
  }
150
150
  const rowObj = row;
151
151
  const resourceId = rowObj.id ?? null;
152
- const displayName = chunkOJKWSUMK_cjs.resolveDisplayName(ctx.model, rowObj);
152
+ const displayName = chunkYXZZNZG6_cjs.resolveDisplayName(ctx.model, rowObj);
153
153
  if (dbOperation === "create") {
154
- chunkOJKWSUMK_cjs.emitDbEvent({
154
+ chunkYXZZNZG6_cjs.emitDbEvent({
155
155
  modelClass: ctx.model,
156
156
  table,
157
157
  operation: "create",
@@ -166,7 +166,7 @@ function emitSingleRowEvent(ctx, dbOperation, row, table) {
166
166
  return;
167
167
  }
168
168
  if (dbOperation === "update") {
169
- chunkOJKWSUMK_cjs.emitDbEvent({
169
+ chunkYXZZNZG6_cjs.emitDbEvent({
170
170
  modelClass: ctx.model,
171
171
  table,
172
172
  operation: "update",
@@ -177,7 +177,7 @@ function emitSingleRowEvent(ctx, dbOperation, row, table) {
177
177
  });
178
178
  return;
179
179
  }
180
- chunkOJKWSUMK_cjs.emitDbEvent({
180
+ chunkYXZZNZG6_cjs.emitDbEvent({
181
181
  modelClass: ctx.model,
182
182
  table,
183
183
  operation: "destroy",
@@ -268,7 +268,7 @@ function patchPrismaClient(prisma, adapter) {
268
268
  if (prisma[EZLOGS_PRISMA_BRAND] === true) {
269
269
  return prisma;
270
270
  }
271
- const captureAndRun = chunkULFJOPQ2_cjs.makeAsyncContextCapture();
271
+ const captureAndRun = chunkMMLQXSSD_cjs.makeAsyncContextCapture();
272
272
  if (!captureAndRun) {
273
273
  chunkTWTG5ILJ_cjs.logger.debug(
274
274
  "patchPrismaClient: AsyncLocalStorage.snapshot() unavailable; skipping ALS bind, applying ezlogsPrisma() only."
package/dist/db/prisma.js CHANGED
@@ -1,5 +1,5 @@
1
- import { emitDbEvent, resolveDisplayName } from '../chunk-SH5NGIX3.js';
2
- import { current, getCurrentActor, configuration, makeAsyncContextCapture } from '../chunk-B7SH6V7M.js';
1
+ import { emitDbEvent, resolveDisplayName } from '../chunk-NINIAL7M.js';
2
+ import { current, getCurrentActor, configuration, makeAsyncContextCapture } from '../chunk-GI6BM4MR.js';
3
3
  import { logger } from '../chunk-FCFVIRQF.js';
4
4
  import '../chunk-SIAA4J6H.js';
5
5
 
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkOJKWSUMK_cjs = require('../chunk-OJKWSUMK.cjs');
4
- var chunkULFJOPQ2_cjs = require('../chunk-ULFJOPQ2.cjs');
3
+ var chunkYXZZNZG6_cjs = require('../chunk-YXZZNZG6.cjs');
4
+ var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
5
5
  var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
6
6
  require('../chunk-ZDSQYCYV.cjs');
7
7
 
8
8
  // src/db/supabase.ts
9
9
  function triggerPathWillCapture(table) {
10
- const config = chunkULFJOPQ2_cjs.configuration();
10
+ const config = chunkMMLQXSSD_cjs.configuration();
11
11
  if (!config.databaseReader) return false;
12
12
  const tracked = config.triggerTrackedTables;
13
13
  if (tracked === null) return false;
@@ -64,7 +64,7 @@ function wrapSupabase(client) {
64
64
  var GLOBAL_CLIENT_KEY = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:supabase-current-client");
65
65
  function registerActorSource(client) {
66
66
  try {
67
- const slot = chunkULFJOPQ2_cjs.currentActorSource();
67
+ const slot = chunkMMLQXSSD_cjs.currentActorSource();
68
68
  if (slot) {
69
69
  slot.client = client;
70
70
  slot.tried = false;
@@ -76,7 +76,7 @@ function registerActorSource(client) {
76
76
  }
77
77
  }
78
78
  async function tryExtractSupabaseActor() {
79
- const slot = chunkULFJOPQ2_cjs.currentActorSource();
79
+ const slot = chunkMMLQXSSD_cjs.currentActorSource();
80
80
  const client = slot ? slot.client : globalThis[GLOBAL_CLIENT_KEY];
81
81
  if (!client || typeof client.auth?.getUser !== "function") return null;
82
82
  try {
@@ -255,7 +255,7 @@ function emitFromMutation(ctx, values, result, filters, beforeRow) {
255
255
  return;
256
256
  }
257
257
  if (!isPlainObject(values)) {
258
- chunkOJKWSUMK_cjs.emitDbEvent({
258
+ chunkYXZZNZG6_cjs.emitDbEvent({
259
259
  modelClass: ctx.table,
260
260
  operation: ctx.operation,
261
261
  resourceId: idFromFilters(filters)
@@ -269,9 +269,9 @@ function emitFromMutation(ctx, values, result, filters, beforeRow) {
269
269
  function emitOneRow(ctx, values, resultRow, filters, beforeRow) {
270
270
  const resourceId = resultRow?.id ?? values.id ?? idFromFilters(filters) ?? null;
271
271
  const merged = beforeRow ?? resultRow ?? values;
272
- const displayName = chunkOJKWSUMK_cjs.resolveDisplayName(ctx.table, merged);
272
+ const displayName = chunkYXZZNZG6_cjs.resolveDisplayName(ctx.table, merged);
273
273
  if (ctx.operation === "create") {
274
- chunkOJKWSUMK_cjs.emitDbEvent({
274
+ chunkYXZZNZG6_cjs.emitDbEvent({
275
275
  modelClass: ctx.table,
276
276
  operation: "create",
277
277
  resourceId,
@@ -283,7 +283,7 @@ function emitOneRow(ctx, values, resultRow, filters, beforeRow) {
283
283
  }
284
284
  if (ctx.operation === "update") {
285
285
  const changes = buildUpdateChanges(values, beforeRow);
286
- chunkOJKWSUMK_cjs.emitDbEvent({
286
+ chunkYXZZNZG6_cjs.emitDbEvent({
287
287
  modelClass: ctx.table,
288
288
  operation: "update",
289
289
  resourceId,
@@ -297,8 +297,8 @@ function emitFromDelete(table, result, filters, beforeRow) {
297
297
  const resultRow = pickFirstResultRow(result);
298
298
  const resourceId = resultRow?.id ?? beforeRow?.id ?? idFromFilters(filters) ?? null;
299
299
  const richestRow = resultRow ?? beforeRow;
300
- const displayName = richestRow ? chunkOJKWSUMK_cjs.resolveDisplayName(table, richestRow) : null;
301
- chunkOJKWSUMK_cjs.emitDbEvent({
300
+ const displayName = richestRow ? chunkYXZZNZG6_cjs.resolveDisplayName(table, richestRow) : null;
301
+ chunkYXZZNZG6_cjs.emitDbEvent({
302
302
  modelClass: table,
303
303
  operation: "destroy",
304
304
  resourceId,
@@ -1,5 +1,5 @@
1
- import { emitDbEvent, resolveDisplayName } from '../chunk-SH5NGIX3.js';
2
- import { currentActorSource, configuration } from '../chunk-B7SH6V7M.js';
1
+ import { emitDbEvent, resolveDisplayName } from '../chunk-NINIAL7M.js';
2
+ import { currentActorSource, configuration } from '../chunk-GI6BM4MR.js';
3
3
  import { logger } from '../chunk-FCFVIRQF.js';
4
4
  import '../chunk-SIAA4J6H.js';
5
5