ezlogs-nextjs 0.4.1 → 0.4.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.
- package/README.md +13 -8
- package/dist/actors/index.d.cts +1 -1
- package/dist/actors/index.d.ts +1 -1
- package/dist/{chunk-B7SH6V7M.js → chunk-GI6BM4MR.js} +2 -1
- package/dist/{chunk-VROC3BO3.cjs → chunk-GMHOUAKD.cjs} +12 -12
- package/dist/{chunk-2X6IZ2JX.js → chunk-MHBS5FEP.js} +2 -2
- package/dist/{chunk-ULFJOPQ2.cjs → chunk-MMLQXSSD.cjs} +2 -1
- package/dist/{chunk-SH5NGIX3.js → chunk-NINIAL7M.js} +1 -1
- package/dist/{chunk-LMG2SNTF.cjs → chunk-NX4EL7BY.cjs} +4 -4
- package/dist/{chunk-ZSFJ3UQV.cjs → chunk-PS4U2GFJ.cjs} +5 -5
- package/dist/{chunk-GILAKFP7.cjs → chunk-R6IWVTX3.cjs} +21 -21
- package/dist/{chunk-KCCKURJW.js → chunk-U22T7QYY.js} +3 -3
- package/dist/{chunk-DLUZRHHW.js → chunk-YMIGZYFH.js} +1 -1
- package/dist/{chunk-OJKWSUMK.cjs → chunk-YXZZNZG6.cjs} +9 -9
- package/dist/{chunk-H4K5QDXE.js → chunk-Z2TM3LGG.js} +1 -1
- package/dist/{configuration-Pshqvpkk.d.cts → configuration-CJ5yKVlP.d.cts} +2 -1
- package/dist/{configuration-Pshqvpkk.d.ts → configuration-CJ5yKVlP.d.ts} +2 -1
- package/dist/db/drizzle.cjs +3 -3
- package/dist/db/drizzle.js +2 -2
- package/dist/db/postgres-js.cjs +4 -4
- package/dist/db/postgres-js.js +2 -2
- package/dist/db/prisma.cjs +12 -12
- package/dist/db/prisma.js +2 -2
- package/dist/db/supabase.cjs +11 -11
- package/dist/db/supabase.js +2 -2
- package/dist/index.cjs +100 -101
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -7
- package/dist/jobs/bullmq.cjs +16 -16
- package/dist/jobs/bullmq.js +4 -4
- package/dist/jobs/inngest.cjs +17 -17
- package/dist/jobs/inngest.js +4 -4
- package/dist/jobs/supabase-queues.cjs +9 -9
- package/dist/jobs/supabase-queues.js +4 -4
- package/dist/jobs/trigger.cjs +7 -7
- package/dist/jobs/trigger.js +4 -4
- package/dist/jobs/upstash-workflow.cjs +15 -15
- package/dist/jobs/upstash-workflow.js +4 -4
- package/dist/triggers/index.cjs +16 -16
- package/dist/triggers/index.js +5 -5
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InitOptions } from './configuration-
|
|
2
|
-
export { A as ActorContext, a as ActorFromRequest, b as ActorPrincipal, D as DisplayNameMap } from './configuration-
|
|
1
|
+
import { I as InitOptions } from './configuration-CJ5yKVlP.cjs';
|
|
2
|
+
export { A as ActorContext, a as ActorFromRequest, b as ActorPrincipal, D as DisplayNameMap } from './configuration-CJ5yKVlP.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* EventBuilder — port of ez_logs_agent/lib/ez_logs_agent/event_builder.rb.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InitOptions } from './configuration-
|
|
2
|
-
export { A as ActorContext, a as ActorFromRequest, b as ActorPrincipal, D as DisplayNameMap } from './configuration-
|
|
1
|
+
import { I as InitOptions } from './configuration-CJ5yKVlP.js';
|
|
2
|
+
export { A as ActorContext, a as ActorFromRequest, b as ActorPrincipal, D as DisplayNameMap } from './configuration-CJ5yKVlP.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* EventBuilder — port of ez_logs_agent/lib/ez_logs_agent/event_builder.rb.
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { patchPgClient } from './chunk-
|
|
2
|
-
import { flushAuditLog, runWithEmittedAuditIdsScope, auditLogInstalled, checkAuditLogAccess, detectTriggerTrackedTables, maintainAuditLogAfterRequests } from './chunk-
|
|
3
|
-
import { build, pushEvent, maskAuthParams, isAuthActionName, isAuthPath, scrubSecretsInText, buffer_exports, sanitizeRequestParams, passesLuhn, drainEvents, isSensitiveKey } from './chunk-
|
|
4
|
-
export { ArgError, build as buildEvent } from './chunk-
|
|
5
|
-
import { configuration, resolveCorrelation, runWithCorrelation, maybeExtractSupabaseActor, endCorrelationScope, getCurrentActor, current, makeAsyncContextCapture, runWithActorScope, setActor, DEFAULT_EXCLUDED_EXTENSIONS } from './chunk-
|
|
1
|
+
import { patchPgClient } from './chunk-Z2TM3LGG.js';
|
|
2
|
+
import { flushAuditLog, runWithEmittedAuditIdsScope, auditLogInstalled, checkAuditLogAccess, detectTriggerTrackedTables, maintainAuditLogAfterRequests } from './chunk-MHBS5FEP.js';
|
|
3
|
+
import { build, pushEvent, maskAuthParams, isAuthActionName, isAuthPath, scrubSecretsInText, buffer_exports, sanitizeRequestParams, passesLuhn, drainEvents, isSensitiveKey } from './chunk-NINIAL7M.js';
|
|
4
|
+
export { ArgError, build as buildEvent } from './chunk-NINIAL7M.js';
|
|
5
|
+
import { configuration, resolveCorrelation, runWithCorrelation, maybeExtractSupabaseActor, endCorrelationScope, getCurrentActor, current, makeAsyncContextCapture, runWithActorScope, setActor, DEFAULT_EXCLUDED_EXTENSIONS } from './chunk-GI6BM4MR.js';
|
|
6
6
|
import { logger, setLogLevel } from './chunk-FCFVIRQF.js';
|
|
7
7
|
import './chunk-SIAA4J6H.js';
|
|
8
8
|
|
|
@@ -2097,8 +2097,7 @@ function announceStartup(serverUrl, projectToken) {
|
|
|
2097
2097
|
if (g[STARTUP_ANNOUNCED_KEY]) return;
|
|
2098
2098
|
g[STARTUP_ANNOUNCED_KEY] = true;
|
|
2099
2099
|
if (!serverUrl || !projectToken) {
|
|
2100
|
-
|
|
2101
|
-
logger.warn(`not capturing: ${missing} missing in ezlogs.init() (check EZLOGS_SERVER_URL / EZLOGS_PROJECT_TOKEN)`);
|
|
2100
|
+
logger.warn("not capturing: projectToken missing in ezlogs.init() (check EZLOGS_PROJECT_TOKEN)");
|
|
2102
2101
|
return;
|
|
2103
2102
|
}
|
|
2104
2103
|
let host = serverUrl;
|
package/dist/jobs/bullmq.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunkR6IWVTX3_cjs = require('../chunk-R6IWVTX3.cjs');
|
|
4
|
+
require('../chunk-GMHOUAKD.cjs');
|
|
5
|
+
require('../chunk-YXZZNZG6.cjs');
|
|
6
|
+
var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
|
|
7
7
|
var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
|
|
8
8
|
require('../chunk-ZDSQYCYV.cjs');
|
|
9
9
|
|
|
@@ -39,7 +39,7 @@ function wrapBullQueue(queue) {
|
|
|
39
39
|
const wrappedAddBulk = (jobs) => {
|
|
40
40
|
const stamped = jobs.map((j) => ({ ...j, data: stampPayload(j.data) }));
|
|
41
41
|
const ours = stamped.map((j) => isOurs(j.data));
|
|
42
|
-
const token = ours.includes(true) ?
|
|
42
|
+
const token = ours.includes(true) ? chunkR6IWVTX3_cjs.signedActorToken(chunkMMLQXSSD_cjs.current()) : null;
|
|
43
43
|
return inOrder(
|
|
44
44
|
token,
|
|
45
45
|
(t) => originalAddBulk(stamped.map((j, i) => ours[i] ? { ...j, data: withActor(j.data, t) } : j))
|
|
@@ -70,8 +70,8 @@ function wrapBullWorker(worker) {
|
|
|
70
70
|
internals.processFn = function ezlogsProcess(...args) {
|
|
71
71
|
const job = args[0] ?? {};
|
|
72
72
|
if (typeof args[0] === "object" && args[0] !== null) reported.add(args[0]);
|
|
73
|
-
const correlationId =
|
|
74
|
-
const run = (actor) =>
|
|
73
|
+
const correlationId = chunkR6IWVTX3_cjs.extractCorrelationFromPayload(job.data);
|
|
74
|
+
const run = (actor) => chunkR6IWVTX3_cjs.runJobWithCapture(
|
|
75
75
|
{
|
|
76
76
|
jobClass: job.name ?? worker.name ?? "BullMQJob",
|
|
77
77
|
jobId: job.id !== void 0 && job.id !== null ? String(job.id) : null,
|
|
@@ -86,9 +86,9 @@ function wrapBullWorker(worker) {
|
|
|
86
86
|
},
|
|
87
87
|
() => Promise.resolve(original.apply(this, args))
|
|
88
88
|
);
|
|
89
|
-
const token = job.data?.[
|
|
89
|
+
const token = job.data?.[chunkR6IWVTX3_cjs.ACTOR_PAYLOAD_KEY];
|
|
90
90
|
if (!correlationId || token === void 0) return run(null);
|
|
91
|
-
return
|
|
91
|
+
return chunkR6IWVTX3_cjs.readActorToken(token, correlationId).then(run);
|
|
92
92
|
};
|
|
93
93
|
worker.on("failed", (...args) => {
|
|
94
94
|
const job = args[0];
|
|
@@ -129,10 +129,10 @@ function markWrapped(worker) {
|
|
|
129
129
|
}
|
|
130
130
|
function captureJob(job, worker, outcome, errorMessage) {
|
|
131
131
|
try {
|
|
132
|
-
const correlationId =
|
|
132
|
+
const correlationId = chunkR6IWVTX3_cjs.extractCorrelationFromPayload(job.data);
|
|
133
133
|
const startedAt = typeof job.timestamp === "number" ? new Date(job.timestamp) : /* @__PURE__ */ new Date();
|
|
134
134
|
const durationMs = job.timestamp ? Date.now() - job.timestamp : null;
|
|
135
|
-
|
|
135
|
+
chunkR6IWVTX3_cjs.emitJobEvent({
|
|
136
136
|
jobClass: job.name ?? worker.name ?? "BullMQJob",
|
|
137
137
|
jobId: job.id !== void 0 && job.id !== null ? String(job.id) : null,
|
|
138
138
|
queue: job.queueName ?? worker.name ?? null,
|
|
@@ -149,22 +149,22 @@ function captureJob(job, worker, outcome, errorMessage) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
function pendingActorTokenFor(data) {
|
|
152
|
-
return isOurs(data) ?
|
|
152
|
+
return isOurs(data) ? chunkR6IWVTX3_cjs.signedActorToken(chunkMMLQXSSD_cjs.current()) : null;
|
|
153
153
|
}
|
|
154
154
|
function isOurs(data) {
|
|
155
155
|
if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
|
|
156
156
|
const obj = data;
|
|
157
|
-
const id =
|
|
158
|
-
return Boolean(id) && obj[
|
|
157
|
+
const id = chunkMMLQXSSD_cjs.current();
|
|
158
|
+
return Boolean(id) && obj[chunkR6IWVTX3_cjs.CORRELATION_PAYLOAD_KEY] === id && !(chunkR6IWVTX3_cjs.ACTOR_PAYLOAD_KEY in obj);
|
|
159
159
|
}
|
|
160
160
|
function withActor(data, token) {
|
|
161
|
-
return token ? { ...data, [
|
|
161
|
+
return token ? { ...data, [chunkR6IWVTX3_cjs.ACTOR_PAYLOAD_KEY]: token } : data;
|
|
162
162
|
}
|
|
163
163
|
function stampPayload(data) {
|
|
164
164
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
165
165
|
return data;
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return chunkR6IWVTX3_cjs.stampCorrelationOnPayload(data, chunkR6IWVTX3_cjs.CORRELATION_PAYLOAD_KEY);
|
|
168
168
|
}
|
|
169
169
|
function describeError(error) {
|
|
170
170
|
if (error instanceof Error) return `${error.name}: ${error.message}`;
|
package/dist/jobs/bullmq.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { extractCorrelationFromPayload, ACTOR_PAYLOAD_KEY, readActorToken, emitJobEvent, signedActorToken, CORRELATION_PAYLOAD_KEY, stampCorrelationOnPayload, runJobWithCapture } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import { current } from '../chunk-
|
|
1
|
+
import { extractCorrelationFromPayload, ACTOR_PAYLOAD_KEY, readActorToken, emitJobEvent, signedActorToken, CORRELATION_PAYLOAD_KEY, stampCorrelationOnPayload, runJobWithCapture } from '../chunk-U22T7QYY.js';
|
|
2
|
+
import '../chunk-MHBS5FEP.js';
|
|
3
|
+
import '../chunk-NINIAL7M.js';
|
|
4
|
+
import { current } from '../chunk-GI6BM4MR.js';
|
|
5
5
|
import { logger } from '../chunk-FCFVIRQF.js';
|
|
6
6
|
import '../chunk-SIAA4J6H.js';
|
|
7
7
|
|
package/dist/jobs/inngest.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunkR6IWVTX3_cjs = require('../chunk-R6IWVTX3.cjs');
|
|
4
|
+
require('../chunk-GMHOUAKD.cjs');
|
|
5
|
+
require('../chunk-YXZZNZG6.cjs');
|
|
6
|
+
var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
|
|
7
7
|
var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
|
|
8
8
|
require('../chunk-ZDSQYCYV.cjs');
|
|
9
9
|
|
|
@@ -32,7 +32,7 @@ function ezlogsInngestMiddleware() {
|
|
|
32
32
|
const attempt = typeof args.ctx?.attempt === "number" ? args.ctx.attempt : 0;
|
|
33
33
|
const eventName = args.ctx?.event?.name ?? null;
|
|
34
34
|
const eventData = args.ctx?.event?.data;
|
|
35
|
-
const correlationId =
|
|
35
|
+
const correlationId = chunkR6IWVTX3_cjs.extractCorrelationFromPayload(args.ctx?.event?.data) ?? chunkMMLQXSSD_cjs.generate();
|
|
36
36
|
const startedAt = /* @__PURE__ */ new Date();
|
|
37
37
|
const startMs = startedAt.getTime();
|
|
38
38
|
return {
|
|
@@ -44,7 +44,7 @@ function ezlogsInngestMiddleware() {
|
|
|
44
44
|
const error = result?.error;
|
|
45
45
|
const outcome = error ? "failure" : "success";
|
|
46
46
|
const errorMessage = error ? formatError(error) : null;
|
|
47
|
-
|
|
47
|
+
chunkR6IWVTX3_cjs.emitJobEvent({
|
|
48
48
|
jobClass: fnId,
|
|
49
49
|
jobId: runId,
|
|
50
50
|
queue: eventName,
|
|
@@ -73,7 +73,7 @@ function ezlogsInngestMiddleware() {
|
|
|
73
73
|
// would carry the first request's id and actor).
|
|
74
74
|
transformInput(args) {
|
|
75
75
|
try {
|
|
76
|
-
const id =
|
|
76
|
+
const id = chunkMMLQXSSD_cjs.current();
|
|
77
77
|
if (!id) return;
|
|
78
78
|
if (!Array.isArray(args.payloads)) return;
|
|
79
79
|
const stamped = [];
|
|
@@ -87,13 +87,13 @@ function ezlogsInngestMiddleware() {
|
|
|
87
87
|
return payload;
|
|
88
88
|
}
|
|
89
89
|
const copy = { ...data, ezlogs_correlation_id: id };
|
|
90
|
-
if (!(
|
|
90
|
+
if (!(chunkR6IWVTX3_cjs.ACTOR_PAYLOAD_KEY in copy)) stamped.push(copy);
|
|
91
91
|
return { ...payload, data: copy };
|
|
92
92
|
});
|
|
93
|
-
const pending = stamped.length > 0 ?
|
|
93
|
+
const pending = stamped.length > 0 ? chunkR6IWVTX3_cjs.signedActorToken(id) : null;
|
|
94
94
|
if (!pending) return { payloads };
|
|
95
95
|
return pending.then((token) => {
|
|
96
|
-
if (token) for (const data of stamped) data[
|
|
96
|
+
if (token) for (const data of stamped) data[chunkR6IWVTX3_cjs.ACTOR_PAYLOAD_KEY] = token;
|
|
97
97
|
return { payloads };
|
|
98
98
|
});
|
|
99
99
|
} catch (error) {
|
|
@@ -107,20 +107,20 @@ function ezlogsInngestMiddleware() {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
async function runInsideInngestCorrelation(event, callback) {
|
|
110
|
-
const carried =
|
|
111
|
-
const id = carried ??
|
|
112
|
-
const token = event?.data?.[
|
|
113
|
-
const actor = carried && token !== void 0 ? await
|
|
110
|
+
const carried = chunkR6IWVTX3_cjs.extractCorrelationFromPayload(event?.data);
|
|
111
|
+
const id = carried ?? chunkMMLQXSSD_cjs.generate();
|
|
112
|
+
const token = event?.data?.[chunkR6IWVTX3_cjs.ACTOR_PAYLOAD_KEY];
|
|
113
|
+
const actor = carried && token !== void 0 ? await chunkR6IWVTX3_cjs.readActorToken(token, carried) : null;
|
|
114
114
|
const startedAt = /* @__PURE__ */ new Date();
|
|
115
115
|
const body = async () => {
|
|
116
116
|
try {
|
|
117
117
|
return await callback();
|
|
118
118
|
} finally {
|
|
119
|
-
await
|
|
119
|
+
await chunkR6IWVTX3_cjs.flushJobAuditLog(startedAt);
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
const scoped = () => body().finally(
|
|
123
|
-
return
|
|
122
|
+
const scoped = () => body().finally(chunkMMLQXSSD_cjs.endCorrelationScope);
|
|
123
|
+
return chunkMMLQXSSD_cjs.runWithCorrelation(id, () => chunkMMLQXSSD_cjs.runWithActorScope(scoped, actor));
|
|
124
124
|
}
|
|
125
125
|
function functionId(fn) {
|
|
126
126
|
try {
|
package/dist/jobs/inngest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ACTOR_PAYLOAD_KEY, signedActorToken, extractCorrelationFromPayload, emitJobEvent, readActorToken, flushJobAuditLog } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import { current, generate, runWithCorrelation, runWithActorScope, endCorrelationScope } from '../chunk-
|
|
1
|
+
import { ACTOR_PAYLOAD_KEY, signedActorToken, extractCorrelationFromPayload, emitJobEvent, readActorToken, flushJobAuditLog } from '../chunk-U22T7QYY.js';
|
|
2
|
+
import '../chunk-MHBS5FEP.js';
|
|
3
|
+
import '../chunk-NINIAL7M.js';
|
|
4
|
+
import { current, generate, runWithCorrelation, runWithActorScope, endCorrelationScope } from '../chunk-GI6BM4MR.js';
|
|
5
5
|
import { logger } from '../chunk-FCFVIRQF.js';
|
|
6
6
|
import '../chunk-SIAA4J6H.js';
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkR6IWVTX3_cjs = require('../chunk-R6IWVTX3.cjs');
|
|
4
|
+
require('../chunk-GMHOUAKD.cjs');
|
|
5
|
+
require('../chunk-YXZZNZG6.cjs');
|
|
6
|
+
require('../chunk-MMLQXSSD.cjs');
|
|
7
7
|
require('../chunk-TWTG5ILJ.cjs');
|
|
8
8
|
require('../chunk-ZDSQYCYV.cjs');
|
|
9
9
|
|
|
@@ -41,21 +41,21 @@ function wrapPgmqSchema(schema) {
|
|
|
41
41
|
}
|
|
42
42
|
function stampPgmqMessage(args) {
|
|
43
43
|
if ("message" in args && isPlainObject(args.message)) {
|
|
44
|
-
return { ...args, message:
|
|
44
|
+
return { ...args, message: chunkR6IWVTX3_cjs.stampCorrelationOnPayload(args.message) };
|
|
45
45
|
}
|
|
46
46
|
if (Array.isArray(args.messages)) {
|
|
47
47
|
return {
|
|
48
48
|
...args,
|
|
49
49
|
messages: args.messages.map(
|
|
50
|
-
(msg) => isPlainObject(msg) ?
|
|
50
|
+
(msg) => isPlainObject(msg) ? chunkR6IWVTX3_cjs.stampCorrelationOnPayload(msg) : msg
|
|
51
51
|
)
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
return args;
|
|
55
55
|
}
|
|
56
56
|
async function captureQueueMessage(meta, work) {
|
|
57
|
-
const correlationId =
|
|
58
|
-
return
|
|
57
|
+
const correlationId = chunkR6IWVTX3_cjs.extractCorrelationFromPayload(meta.message);
|
|
58
|
+
return chunkR6IWVTX3_cjs.runJobWithCapture(
|
|
59
59
|
{
|
|
60
60
|
jobClass: meta.queueName,
|
|
61
61
|
jobId: meta.messageId !== void 0 && meta.messageId !== null ? String(meta.messageId) : null,
|
|
@@ -69,7 +69,7 @@ async function captureQueueMessage(meta, work) {
|
|
|
69
69
|
}
|
|
70
70
|
function stampPgmqPayload(message) {
|
|
71
71
|
if (!isPlainObject(message)) return message;
|
|
72
|
-
return
|
|
72
|
+
return chunkR6IWVTX3_cjs.stampCorrelationOnPayload(message);
|
|
73
73
|
}
|
|
74
74
|
function isPlainObject(value) {
|
|
75
75
|
if (value === null || typeof value !== "object") return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { extractCorrelationFromPayload, runJobWithCapture, stampCorrelationOnPayload } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
import { extractCorrelationFromPayload, runJobWithCapture, stampCorrelationOnPayload } from '../chunk-U22T7QYY.js';
|
|
2
|
+
import '../chunk-MHBS5FEP.js';
|
|
3
|
+
import '../chunk-NINIAL7M.js';
|
|
4
|
+
import '../chunk-GI6BM4MR.js';
|
|
5
5
|
import '../chunk-FCFVIRQF.js';
|
|
6
6
|
import '../chunk-SIAA4J6H.js';
|
|
7
7
|
|
package/dist/jobs/trigger.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunkR6IWVTX3_cjs = require('../chunk-R6IWVTX3.cjs');
|
|
4
|
+
require('../chunk-GMHOUAKD.cjs');
|
|
5
|
+
require('../chunk-YXZZNZG6.cjs');
|
|
6
|
+
var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
|
|
7
7
|
var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
|
|
8
8
|
require('../chunk-ZDSQYCYV.cjs');
|
|
9
9
|
|
|
@@ -31,20 +31,20 @@ async function runWithEzlogsCapture(params) {
|
|
|
31
31
|
const queueName = ctx.run?.queue?.name ?? null;
|
|
32
32
|
const attemptNumber = ctx.attempt?.number ?? 1;
|
|
33
33
|
const retryCount = Math.max(0, attemptNumber - 1);
|
|
34
|
-
return
|
|
34
|
+
return chunkR6IWVTX3_cjs.runJobWithCapture(
|
|
35
35
|
{
|
|
36
36
|
jobClass: taskId,
|
|
37
37
|
jobId: runId,
|
|
38
38
|
queue: queueName,
|
|
39
39
|
retryCount,
|
|
40
|
-
correlationId:
|
|
40
|
+
correlationId: chunkR6IWVTX3_cjs.extractCorrelationFromPayload(params.payload),
|
|
41
41
|
payload: params.payload
|
|
42
42
|
},
|
|
43
43
|
() => params.next()
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
function stampPayloadForTrigger(payload) {
|
|
47
|
-
const id =
|
|
47
|
+
const id = chunkMMLQXSSD_cjs.current();
|
|
48
48
|
if (!id) return payload;
|
|
49
49
|
if (payload === null || typeof payload !== "object" || Array.isArray(payload)) {
|
|
50
50
|
return payload;
|
package/dist/jobs/trigger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { runJobWithCapture, extractCorrelationFromPayload } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import { current } from '../chunk-
|
|
1
|
+
import { runJobWithCapture, extractCorrelationFromPayload } from '../chunk-U22T7QYY.js';
|
|
2
|
+
import '../chunk-MHBS5FEP.js';
|
|
3
|
+
import '../chunk-NINIAL7M.js';
|
|
4
|
+
import { current } from '../chunk-GI6BM4MR.js';
|
|
5
5
|
import { logger } from '../chunk-FCFVIRQF.js';
|
|
6
6
|
import '../chunk-SIAA4J6H.js';
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunkR6IWVTX3_cjs = require('../chunk-R6IWVTX3.cjs');
|
|
4
|
+
require('../chunk-GMHOUAKD.cjs');
|
|
5
|
+
require('../chunk-YXZZNZG6.cjs');
|
|
6
|
+
var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
|
|
7
7
|
var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
|
|
8
8
|
require('../chunk-ZDSQYCYV.cjs');
|
|
9
9
|
|
|
@@ -29,7 +29,7 @@ function wrapWorkflowClient(client) {
|
|
|
29
29
|
if (typeof client.trigger === "function") {
|
|
30
30
|
const original = client.trigger.bind(client);
|
|
31
31
|
client.trigger = async (params) => {
|
|
32
|
-
if (
|
|
32
|
+
if (chunkMMLQXSSD_cjs.current()) await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
33
33
|
return original(
|
|
34
34
|
Array.isArray(params) ? await Promise.all(params.map(stampTriggerOptions)) : await stampTriggerOptions(params)
|
|
35
35
|
);
|
|
@@ -43,14 +43,14 @@ function wrapWorkflowClient(client) {
|
|
|
43
43
|
return client;
|
|
44
44
|
}
|
|
45
45
|
async function stampTriggerOptions(options) {
|
|
46
|
-
const current2 =
|
|
46
|
+
const current2 = chunkMMLQXSSD_cjs.current();
|
|
47
47
|
if (!current2 || !options || typeof options !== "object") return options;
|
|
48
48
|
const opts = options;
|
|
49
49
|
const headers = { ...opts.headers ?? {} };
|
|
50
50
|
const supplied = Object.keys(headers).find((k) => k.toLowerCase() === CORRELATION_HEADER);
|
|
51
51
|
const id = supplied ? headers[supplied] : current2;
|
|
52
52
|
if (!supplied) headers[CORRELATION_HEADER] = id;
|
|
53
|
-
const token = AGENT_CORRELATION_ID.test(id) ? await
|
|
53
|
+
const token = AGENT_CORRELATION_ID.test(id) ? await chunkR6IWVTX3_cjs.actorToken(id) : null;
|
|
54
54
|
if (token && !Object.keys(headers).some((k) => k.toLowerCase() === ACTOR_HEADER)) {
|
|
55
55
|
headers[ACTOR_HEADER] = token;
|
|
56
56
|
}
|
|
@@ -75,15 +75,15 @@ function wrapQStashClient(client) {
|
|
|
75
75
|
return client;
|
|
76
76
|
}
|
|
77
77
|
async function stampPublishRequest(request) {
|
|
78
|
-
const id =
|
|
78
|
+
const id = chunkMMLQXSSD_cjs.current();
|
|
79
79
|
if (!id || !request || typeof request !== "object") return request;
|
|
80
80
|
const headerKey = `${FORWARD_PREFIX}${CORRELATION_HEADER}`;
|
|
81
81
|
const raw = request.headers;
|
|
82
82
|
const headers = raw instanceof Headers || Array.isArray(raw) ? Object.fromEntries(new Headers(raw)) : { ...raw ?? {} };
|
|
83
83
|
if (Object.keys(headers).some((key) => key.toLowerCase() === headerKey)) return request;
|
|
84
84
|
headers[headerKey] = id;
|
|
85
|
-
await
|
|
86
|
-
const token = await
|
|
85
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
86
|
+
const token = await chunkR6IWVTX3_cjs.actorToken(id);
|
|
87
87
|
if (token) headers[`${FORWARD_PREFIX}${ACTOR_HEADER}`] = token;
|
|
88
88
|
return { ...request, headers };
|
|
89
89
|
}
|
|
@@ -92,11 +92,11 @@ async function captureWorkflowRequest(meta, work) {
|
|
|
92
92
|
const correlationId = readCorrelationFromHeaders(headers);
|
|
93
93
|
const runId = readHeader(headers, "upstash-workflow-runid");
|
|
94
94
|
const retried = parseRetried(readHeader(headers, "upstash-retried"));
|
|
95
|
-
const actor = correlationId ? await
|
|
95
|
+
const actor = correlationId ? await chunkR6IWVTX3_cjs.readActorToken(
|
|
96
96
|
readHeader(headers, ACTOR_HEADER) ?? readHeader(headers, `${FORWARD_PREFIX}${ACTOR_HEADER}`),
|
|
97
97
|
correlationId
|
|
98
|
-
) ?? await
|
|
99
|
-
return
|
|
98
|
+
) ?? await chunkR6IWVTX3_cjs.readActorToken(runId ? AGENT_RUN_ID.exec(runId)?.[2] : null, correlationId) : null;
|
|
99
|
+
return chunkR6IWVTX3_cjs.runJobWithCapture(
|
|
100
100
|
{
|
|
101
101
|
jobClass: meta.workflowName,
|
|
102
102
|
jobId: runId,
|
|
@@ -111,7 +111,7 @@ async function captureWorkflowRequest(meta, work) {
|
|
|
111
111
|
function emitUpstashWorkflowEvent(input) {
|
|
112
112
|
try {
|
|
113
113
|
const headers = input.request.headers;
|
|
114
|
-
|
|
114
|
+
chunkR6IWVTX3_cjs.emitJobEvent({
|
|
115
115
|
jobClass: input.workflowName,
|
|
116
116
|
jobId: readHeader(headers, "upstash-workflow-runid"),
|
|
117
117
|
queue: input.workflowName,
|
|
@@ -129,7 +129,7 @@ function emitUpstashWorkflowEvent(input) {
|
|
|
129
129
|
function randomHex(bytes) {
|
|
130
130
|
const buf = new Uint8Array(bytes);
|
|
131
131
|
globalThis.crypto.getRandomValues(buf);
|
|
132
|
-
return
|
|
132
|
+
return chunkR6IWVTX3_cjs.toHex(buf);
|
|
133
133
|
}
|
|
134
134
|
function readHeader(headers, name) {
|
|
135
135
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { actorToken, readActorToken, runJobWithCapture, emitJobEvent, toHex } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import { current, maybeExtractSupabaseActor } from '../chunk-
|
|
1
|
+
import { actorToken, readActorToken, runJobWithCapture, emitJobEvent, toHex } from '../chunk-U22T7QYY.js';
|
|
2
|
+
import '../chunk-MHBS5FEP.js';
|
|
3
|
+
import '../chunk-NINIAL7M.js';
|
|
4
|
+
import { current, maybeExtractSupabaseActor } from '../chunk-GI6BM4MR.js';
|
|
5
5
|
import { logger } from '../chunk-FCFVIRQF.js';
|
|
6
6
|
import '../chunk-SIAA4J6H.js';
|
|
7
7
|
|
package/dist/triggers/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
var
|
|
3
|
+
var chunkNX4EL7BY_cjs = require('../chunk-NX4EL7BY.cjs');
|
|
4
|
+
var chunkPS4U2GFJ_cjs = require('../chunk-PS4U2GFJ.cjs');
|
|
5
|
+
var chunkGMHOUAKD_cjs = require('../chunk-GMHOUAKD.cjs');
|
|
6
|
+
require('../chunk-YXZZNZG6.cjs');
|
|
7
|
+
var chunkMMLQXSSD_cjs = require('../chunk-MMLQXSSD.cjs');
|
|
8
8
|
var chunkTWTG5ILJ_cjs = require('../chunk-TWTG5ILJ.cjs');
|
|
9
9
|
require('../chunk-ZDSQYCYV.cjs');
|
|
10
10
|
var promises = require('fs/promises');
|
|
@@ -125,7 +125,7 @@ function skipReason(tableName, hasAuthColumns) {
|
|
|
125
125
|
for (const [pattern, reason] of NAMED_SKIPS) {
|
|
126
126
|
if (typeof pattern === "string" ? tableName === pattern : pattern.test(tableName)) return reason;
|
|
127
127
|
}
|
|
128
|
-
if (
|
|
128
|
+
if (chunkMMLQXSSD_cjs.AUTH_SESSION_TABLE_NAMES.test(tableName) && (hasAuthColumns !== false || /verif/i.test(tableName))) {
|
|
129
129
|
return "auth / session store (has token, expiry or session-data columns)";
|
|
130
130
|
}
|
|
131
131
|
return null;
|
|
@@ -332,43 +332,43 @@ function parseEnvEntries(text) {
|
|
|
332
332
|
|
|
333
333
|
Object.defineProperty(exports, "patchPgClient", {
|
|
334
334
|
enumerable: true,
|
|
335
|
-
get: function () { return
|
|
335
|
+
get: function () { return chunkNX4EL7BY_cjs.patchPgClient; }
|
|
336
336
|
});
|
|
337
337
|
Object.defineProperty(exports, "applyDatabaseContext", {
|
|
338
338
|
enumerable: true,
|
|
339
|
-
get: function () { return
|
|
339
|
+
get: function () { return chunkPS4U2GFJ_cjs.applyDatabaseContext; }
|
|
340
340
|
});
|
|
341
341
|
Object.defineProperty(exports, "getDatabaseContext", {
|
|
342
342
|
enumerable: true,
|
|
343
|
-
get: function () { return
|
|
343
|
+
get: function () { return chunkPS4U2GFJ_cjs.getDatabaseContext; }
|
|
344
344
|
});
|
|
345
345
|
Object.defineProperty(exports, "withDatabaseContext", {
|
|
346
346
|
enumerable: true,
|
|
347
|
-
get: function () { return
|
|
347
|
+
get: function () { return chunkPS4U2GFJ_cjs.withDatabaseContext; }
|
|
348
348
|
});
|
|
349
349
|
Object.defineProperty(exports, "detectTriggerTrackedTables", {
|
|
350
350
|
enumerable: true,
|
|
351
|
-
get: function () { return
|
|
351
|
+
get: function () { return chunkGMHOUAKD_cjs.detectTriggerTrackedTables; }
|
|
352
352
|
});
|
|
353
353
|
Object.defineProperty(exports, "emitAuditRows", {
|
|
354
354
|
enumerable: true,
|
|
355
|
-
get: function () { return
|
|
355
|
+
get: function () { return chunkGMHOUAKD_cjs.emitAuditRows; }
|
|
356
356
|
});
|
|
357
357
|
Object.defineProperty(exports, "flushAuditLog", {
|
|
358
358
|
enumerable: true,
|
|
359
|
-
get: function () { return
|
|
359
|
+
get: function () { return chunkGMHOUAKD_cjs.flushAuditLog; }
|
|
360
360
|
});
|
|
361
361
|
Object.defineProperty(exports, "pruneAuditLog", {
|
|
362
362
|
enumerable: true,
|
|
363
|
-
get: function () { return
|
|
363
|
+
get: function () { return chunkGMHOUAKD_cjs.pruneAuditLog; }
|
|
364
364
|
});
|
|
365
365
|
Object.defineProperty(exports, "readAuditRows", {
|
|
366
366
|
enumerable: true,
|
|
367
|
-
get: function () { return
|
|
367
|
+
get: function () { return chunkGMHOUAKD_cjs.readAuditRows; }
|
|
368
368
|
});
|
|
369
369
|
Object.defineProperty(exports, "sweepAuditLog", {
|
|
370
370
|
enumerable: true,
|
|
371
|
-
get: function () { return
|
|
371
|
+
get: function () { return chunkGMHOUAKD_cjs.sweepAuditLog; }
|
|
372
372
|
});
|
|
373
373
|
exports.buildTrackingSql = buildTrackingSql;
|
|
374
374
|
exports.detectEngine = detectEngine;
|
package/dist/triggers/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { patchPgClient } from '../chunk-
|
|
2
|
-
export { applyDatabaseContext, getDatabaseContext, withDatabaseContext } from '../chunk-
|
|
3
|
-
export { detectTriggerTrackedTables, emitAuditRows, flushAuditLog, pruneAuditLog, readAuditRows, sweepAuditLog } from '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import { AUTH_SESSION_TABLE_NAMES } from '../chunk-
|
|
1
|
+
export { patchPgClient } from '../chunk-Z2TM3LGG.js';
|
|
2
|
+
export { applyDatabaseContext, getDatabaseContext, withDatabaseContext } from '../chunk-YMIGZYFH.js';
|
|
3
|
+
export { detectTriggerTrackedTables, emitAuditRows, flushAuditLog, pruneAuditLog, readAuditRows, sweepAuditLog } from '../chunk-MHBS5FEP.js';
|
|
4
|
+
import '../chunk-NINIAL7M.js';
|
|
5
|
+
import { AUTH_SESSION_TABLE_NAMES } from '../chunk-GI6BM4MR.js';
|
|
6
6
|
import { logger } from '../chunk-FCFVIRQF.js';
|
|
7
7
|
import '../chunk-SIAA4J6H.js';
|
|
8
8
|
import { readFile } from 'fs/promises';
|
package/package.json
CHANGED