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.
- package/README.md +21 -10
- 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 +156 -119
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +62 -25
- 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.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkNX4EL7BY_cjs = require('./chunk-NX4EL7BY.cjs');
|
|
4
|
+
var chunkGMHOUAKD_cjs = require('./chunk-GMHOUAKD.cjs');
|
|
5
|
+
var chunkYXZZNZG6_cjs = 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
|
|
|
@@ -12,7 +12,7 @@ var REQUEST_TIMEOUT_MS = 1e4;
|
|
|
12
12
|
var transport = {
|
|
13
13
|
async send(events) {
|
|
14
14
|
if (!events || events.length === 0) return "success";
|
|
15
|
-
const config =
|
|
15
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
16
16
|
const serverUrl = config.serverUrl;
|
|
17
17
|
if (!serverUrl) {
|
|
18
18
|
chunkTWTG5ILJ_cjs.logger.error("Transport: serverUrl not configured");
|
|
@@ -104,7 +104,7 @@ function applyJitter(base) {
|
|
|
104
104
|
}
|
|
105
105
|
function retryAttempts() {
|
|
106
106
|
try {
|
|
107
|
-
const value =
|
|
107
|
+
const value = chunkMMLQXSSD_cjs.configuration().retryAttempts;
|
|
108
108
|
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
109
109
|
return 3;
|
|
110
110
|
}
|
|
@@ -123,7 +123,7 @@ var GLOBAL_KEY = /* @__PURE__ */ Symbol.for("ezlogs-nextjs:flush-scheduler-state
|
|
|
123
123
|
function state() {
|
|
124
124
|
const g = globalThis;
|
|
125
125
|
if (!g[GLOBAL_KEY]) {
|
|
126
|
-
g[GLOBAL_KEY] = { timer: null, inFlight: false };
|
|
126
|
+
g[GLOBAL_KEY] = { timer: null, inFlight: false, current: null, followUp: null };
|
|
127
127
|
}
|
|
128
128
|
return g[GLOBAL_KEY];
|
|
129
129
|
}
|
|
@@ -151,32 +151,52 @@ var flushScheduler = {
|
|
|
151
151
|
isRunning() {
|
|
152
152
|
return state().timer !== null;
|
|
153
153
|
},
|
|
154
|
-
/**
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Drain and send now; resolves once this caller's events are sent (or
|
|
156
|
+
* dropped). If a send is already running, one more drain is queued after
|
|
157
|
+
* it, so events buffered since that send started are covered too: on
|
|
158
|
+
* serverless, overlapping requests each hand this promise to waitUntil.
|
|
159
|
+
* Concurrent callers share that single follow-up, so a slow server never
|
|
160
|
+
* builds a queue.
|
|
161
|
+
*/
|
|
162
|
+
flushNow() {
|
|
163
|
+
const s = state();
|
|
164
|
+
if (!s.inFlight || !s.current) return tick();
|
|
165
|
+
if (!s.followUp) {
|
|
166
|
+
s.followUp = s.current.then(() => {
|
|
167
|
+
s.followUp = null;
|
|
168
|
+
return tick();
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return s.followUp;
|
|
157
172
|
}
|
|
158
173
|
};
|
|
159
|
-
|
|
174
|
+
function tick() {
|
|
160
175
|
const s = state();
|
|
161
|
-
if (s.inFlight) return;
|
|
176
|
+
if (s.inFlight && s.current) return s.current;
|
|
162
177
|
s.inFlight = true;
|
|
178
|
+
s.current = runTick().finally(() => {
|
|
179
|
+
s.inFlight = false;
|
|
180
|
+
s.current = null;
|
|
181
|
+
});
|
|
182
|
+
return s.current;
|
|
183
|
+
}
|
|
184
|
+
async function runTick() {
|
|
163
185
|
try {
|
|
164
|
-
const events =
|
|
186
|
+
const events = chunkYXZZNZG6_cjs.drainEvents();
|
|
165
187
|
if (events.length > 0) await retrySender.send(events);
|
|
166
|
-
const reader =
|
|
188
|
+
const reader = chunkMMLQXSSD_cjs.configuration().databaseReader;
|
|
167
189
|
if (!reader) return;
|
|
168
|
-
await
|
|
169
|
-
const swept =
|
|
190
|
+
await chunkGMHOUAKD_cjs.maintainAuditLogAfterRequests(reader);
|
|
191
|
+
const swept = chunkYXZZNZG6_cjs.drainEvents();
|
|
170
192
|
if (swept.length > 0) await retrySender.send(swept);
|
|
171
193
|
} catch (error) {
|
|
172
194
|
chunkTWTG5ILJ_cjs.logger.error(`FlushScheduler tick failed: ${describeError3(error)}`);
|
|
173
|
-
} finally {
|
|
174
|
-
s.inFlight = false;
|
|
175
195
|
}
|
|
176
196
|
}
|
|
177
197
|
function sendInterval() {
|
|
178
198
|
try {
|
|
179
|
-
const value =
|
|
199
|
+
const value = chunkMMLQXSSD_cjs.configuration().sendInterval;
|
|
180
200
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
181
201
|
return 5e3;
|
|
182
202
|
}
|
|
@@ -199,7 +219,7 @@ function patchGlobalFetch() {
|
|
|
199
219
|
if (typeof globalThis.fetch !== "function") return;
|
|
200
220
|
originalFetch = globalThis.fetch;
|
|
201
221
|
const wrapped = (input, init) => {
|
|
202
|
-
const id =
|
|
222
|
+
const id = chunkMMLQXSSD_cjs.current();
|
|
203
223
|
if (!id) return originalFetch.call(globalThis, input, init);
|
|
204
224
|
try {
|
|
205
225
|
const enriched = injectHeader(input, init, id);
|
|
@@ -335,7 +355,7 @@ function buildHttpSourceData(input) {
|
|
|
335
355
|
source.graphql_variables = input.graphql.graphql_variables;
|
|
336
356
|
}
|
|
337
357
|
} else {
|
|
338
|
-
const params =
|
|
358
|
+
const params = chunkYXZZNZG6_cjs.sanitizeRequestParams(input.rawParams, input.excludedVariableKeys);
|
|
339
359
|
if (params !== null) source.request_params = params;
|
|
340
360
|
}
|
|
341
361
|
return compact(source);
|
|
@@ -485,7 +505,7 @@ function determineOutcome(statusCode, exception, graphqlResponseErrors, response
|
|
|
485
505
|
}
|
|
486
506
|
var MAX_SPECIFIC_ERROR_LENGTH = 200;
|
|
487
507
|
function capErrorText(text) {
|
|
488
|
-
const out =
|
|
508
|
+
const out = chunkYXZZNZG6_cjs.scrubSecretsInText(text, { emails: true });
|
|
489
509
|
return out.length <= MAX_SPECIFIC_ERROR_LENGTH ? out : `${out.slice(0, MAX_SPECIFIC_ERROR_LENGTH - 1)}\u2026`;
|
|
490
510
|
}
|
|
491
511
|
var GENERIC_ERROR_TEXT = /^(?:validation(?: error| failed)?|invalid (?:input|request|data|body|payload|params|parameters|arguments)|bad request|unprocessable(?: entity| content)?|error|failed|request failed)[.!]?$/i;
|
|
@@ -523,9 +543,9 @@ function fieldMessage(path, message, userPatterns) {
|
|
|
523
543
|
const text = message?.replace(/\s+/g, " ").trim().replace(/received\s+("[^"]*"|'[^']*'|`[^`]*`)/gi, "received [FILTERED]");
|
|
524
544
|
if (!text) return null;
|
|
525
545
|
const keys = path.filter((k) => k !== null && k !== "");
|
|
526
|
-
if (keys.some((k) =>
|
|
546
|
+
if (keys.some((k) => chunkYXZZNZG6_cjs.isSensitiveKey(k, userPatterns))) return null;
|
|
527
547
|
if (keys.length > 0) return `${keys.join(".")}: ${text}`;
|
|
528
|
-
return text.split(/[^A-Za-z0-9_]+/).some((w) => w !== "" &&
|
|
548
|
+
return text.split(/[^A-Za-z0-9_]+/).some((w) => w !== "" && chunkYXZZNZG6_cjs.isSensitiveKey(w, userPatterns)) ? null : text;
|
|
529
549
|
}
|
|
530
550
|
function pathKey(segment) {
|
|
531
551
|
if (typeof segment === "string") return segment;
|
|
@@ -706,7 +726,7 @@ function parseGraphqlBody(body, excludedOperations, excludedVariableKeys) {
|
|
|
706
726
|
return { metadata: "skip" };
|
|
707
727
|
}
|
|
708
728
|
const operationType = inferOperationTypeFromQuery(queryString) ?? inferOperationTypeFromName(operationName);
|
|
709
|
-
const sanitizedVariables =
|
|
729
|
+
const sanitizedVariables = chunkYXZZNZG6_cjs.sanitizeRequestParams(obj.variables, excludedVariableKeys);
|
|
710
730
|
return {
|
|
711
731
|
metadata: {
|
|
712
732
|
graphql_operation: operationName ?? "anonymous",
|
|
@@ -764,7 +784,7 @@ function captureRoute(handler, context = {}) {
|
|
|
764
784
|
return handler(...invokeArgs);
|
|
765
785
|
};
|
|
766
786
|
try {
|
|
767
|
-
if (!
|
|
787
|
+
if (!chunkMMLQXSSD_cjs.configuration().captureHttp) {
|
|
768
788
|
return Promise.resolve(runHandler(...args));
|
|
769
789
|
}
|
|
770
790
|
const request = args[0];
|
|
@@ -774,8 +794,8 @@ function captureRoute(handler, context = {}) {
|
|
|
774
794
|
const snapshot = await snapshotRequest(request);
|
|
775
795
|
if (snapshot === null) return Promise.resolve(runHandler(...args));
|
|
776
796
|
snapshot.rawParams = mergeRouteParams(snapshot.rawParams, await readRouteParams(args[1]));
|
|
777
|
-
const correlationId =
|
|
778
|
-
return await
|
|
797
|
+
const correlationId = chunkMMLQXSSD_cjs.resolveCorrelation(request.headers ?? null);
|
|
798
|
+
return await chunkMMLQXSSD_cjs.runWithCorrelation(
|
|
779
799
|
correlationId,
|
|
780
800
|
() => runWithActorAndAuditScope(async () => {
|
|
781
801
|
await maybeRunActorHook(request);
|
|
@@ -788,7 +808,7 @@ function captureRoute(handler, context = {}) {
|
|
|
788
808
|
let followed = false;
|
|
789
809
|
let handlerMs = null;
|
|
790
810
|
const finish = async () => {
|
|
791
|
-
await
|
|
811
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
792
812
|
await emitEvent({
|
|
793
813
|
snapshot,
|
|
794
814
|
context,
|
|
@@ -799,11 +819,8 @@ function captureRoute(handler, context = {}) {
|
|
|
799
819
|
durationMs: handlerMs ?? Date.now() - startMs,
|
|
800
820
|
startedAt: new Date(startMs)
|
|
801
821
|
});
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
chunkULFJOPQ2_cjs.endCorrelationScope();
|
|
822
|
+
await flushOnServerless();
|
|
823
|
+
chunkMMLQXSSD_cjs.endCorrelationScope();
|
|
807
824
|
};
|
|
808
825
|
try {
|
|
809
826
|
response = await Promise.resolve(runHandler(...args));
|
|
@@ -814,7 +831,7 @@ function captureRoute(handler, context = {}) {
|
|
|
814
831
|
}
|
|
815
832
|
const trpcRoute = isTrpcRoute(snapshot.rawParams, context.routeModulePath ?? null);
|
|
816
833
|
responseErrorMessage = await readResponseErrorMessage(response, trpcRoute);
|
|
817
|
-
const trpcStream = responseErrorMessage === null && trpcRoute ? trpcStreamErrorScanner(
|
|
834
|
+
const trpcStream = responseErrorMessage === null && trpcRoute ? trpcStreamErrorScanner(chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys) : null;
|
|
818
835
|
const followedResponse = followBody(
|
|
819
836
|
response,
|
|
820
837
|
snapshot.method,
|
|
@@ -862,12 +879,12 @@ function withMiddlewareCapture(middleware) {
|
|
|
862
879
|
return middleware(req, ...mRest);
|
|
863
880
|
};
|
|
864
881
|
try {
|
|
865
|
-
const correlationId =
|
|
882
|
+
const correlationId = chunkMMLQXSSD_cjs.resolveCorrelation(request.headers);
|
|
866
883
|
try {
|
|
867
884
|
request.headers.set(CORRELATION_HEADER, correlationId);
|
|
868
885
|
} catch {
|
|
869
886
|
}
|
|
870
|
-
return await
|
|
887
|
+
return await chunkMMLQXSSD_cjs.runWithCorrelation(
|
|
871
888
|
correlationId,
|
|
872
889
|
() => runWithActorAndAuditScope(async () => {
|
|
873
890
|
const startMs = Date.now();
|
|
@@ -882,7 +899,7 @@ function withMiddlewareCapture(middleware) {
|
|
|
882
899
|
try {
|
|
883
900
|
if (shouldEmitPageNavigation(request)) {
|
|
884
901
|
await maybeRunActorHook(request);
|
|
885
|
-
await
|
|
902
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
886
903
|
await emitPageNavigationEvent({
|
|
887
904
|
request,
|
|
888
905
|
statusCode: typeof response?.status === "number" ? response.status : null,
|
|
@@ -894,7 +911,7 @@ function withMiddlewareCapture(middleware) {
|
|
|
894
911
|
chunkTWTG5ILJ_cjs.logger.debug(`page navigation capture failed: ${describeError5(error)}`);
|
|
895
912
|
}
|
|
896
913
|
return response;
|
|
897
|
-
}).finally(
|
|
914
|
+
}).finally(chunkMMLQXSSD_cjs.endCorrelationScope)
|
|
898
915
|
);
|
|
899
916
|
} catch (preCaptureError) {
|
|
900
917
|
if (middlewareInvoked) throw preCaptureError;
|
|
@@ -955,25 +972,25 @@ async function emitPageNavigationEvent(input) {
|
|
|
955
972
|
userAgent,
|
|
956
973
|
remoteIp,
|
|
957
974
|
contentType: null,
|
|
958
|
-
excludedVariableKeys:
|
|
975
|
+
excludedVariableKeys: chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys
|
|
959
976
|
});
|
|
960
977
|
const { outcome, error_message } = determineOutcome(
|
|
961
978
|
input.statusCode,
|
|
962
979
|
null,
|
|
963
980
|
null
|
|
964
981
|
);
|
|
965
|
-
const event =
|
|
982
|
+
const event = chunkYXZZNZG6_cjs.build({
|
|
966
983
|
source_type: "http_request",
|
|
967
984
|
source_data: sourceData,
|
|
968
985
|
outcome,
|
|
969
|
-
correlation_id:
|
|
986
|
+
correlation_id: chunkMMLQXSSD_cjs.current(),
|
|
970
987
|
resource_ids: [],
|
|
971
|
-
context:
|
|
988
|
+
context: chunkMMLQXSSD_cjs.getCurrentActor() ? { actor: chunkMMLQXSSD_cjs.getCurrentActor() } : null,
|
|
972
989
|
duration_ms: input.durationMs,
|
|
973
990
|
error_message,
|
|
974
991
|
timestamp: input.startedAt
|
|
975
992
|
});
|
|
976
|
-
|
|
993
|
+
chunkYXZZNZG6_cjs.pushEvent(event);
|
|
977
994
|
} catch (error) {
|
|
978
995
|
chunkTWTG5ILJ_cjs.logger.error(`page navigation emit failed: ${describeError5(error)}`);
|
|
979
996
|
}
|
|
@@ -998,7 +1015,7 @@ function capturePagesApi(handler, context = {}) {
|
|
|
998
1015
|
return handler(...invokeArgs);
|
|
999
1016
|
};
|
|
1000
1017
|
try {
|
|
1001
|
-
if (!
|
|
1018
|
+
if (!chunkMMLQXSSD_cjs.configuration().captureHttp) {
|
|
1002
1019
|
return Promise.resolve(runHandler(...args));
|
|
1003
1020
|
}
|
|
1004
1021
|
const req = args[0];
|
|
@@ -1006,10 +1023,10 @@ function capturePagesApi(handler, context = {}) {
|
|
|
1006
1023
|
if (!req || !res) return Promise.resolve(runHandler(...args));
|
|
1007
1024
|
const snapshot = snapshotPagesRequest(req);
|
|
1008
1025
|
if (snapshot === null) return Promise.resolve(runHandler(...args));
|
|
1009
|
-
const correlationId =
|
|
1026
|
+
const correlationId = chunkMMLQXSSD_cjs.resolveCorrelation({
|
|
1010
1027
|
get: (name) => readPagesHeader(req, name)
|
|
1011
1028
|
});
|
|
1012
|
-
return await
|
|
1029
|
+
return await chunkMMLQXSSD_cjs.runWithCorrelation(
|
|
1013
1030
|
correlationId,
|
|
1014
1031
|
() => runWithActorAndAuditScope(async () => {
|
|
1015
1032
|
await maybeRunActorHookFromPages(req);
|
|
@@ -1022,7 +1039,7 @@ function capturePagesApi(handler, context = {}) {
|
|
|
1022
1039
|
exception = e instanceof Error ? e : new Error(String(e));
|
|
1023
1040
|
throw e;
|
|
1024
1041
|
} finally {
|
|
1025
|
-
await
|
|
1042
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
1026
1043
|
await emitEvent({
|
|
1027
1044
|
snapshot,
|
|
1028
1045
|
context,
|
|
@@ -1032,10 +1049,8 @@ function capturePagesApi(handler, context = {}) {
|
|
|
1032
1049
|
durationMs: Date.now() - startMs,
|
|
1033
1050
|
startedAt: new Date(startMs)
|
|
1034
1051
|
});
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1038
|
-
chunkULFJOPQ2_cjs.endCorrelationScope();
|
|
1052
|
+
await flushOnServerless();
|
|
1053
|
+
chunkMMLQXSSD_cjs.endCorrelationScope();
|
|
1039
1054
|
}
|
|
1040
1055
|
})
|
|
1041
1056
|
);
|
|
@@ -1056,12 +1071,12 @@ function captureServerAction(action, actionName) {
|
|
|
1056
1071
|
return action(...invokeArgs);
|
|
1057
1072
|
};
|
|
1058
1073
|
try {
|
|
1059
|
-
if (!
|
|
1074
|
+
if (!chunkMMLQXSSD_cjs.configuration().captureHttp) {
|
|
1060
1075
|
return Promise.resolve(runAction(...args));
|
|
1061
1076
|
}
|
|
1062
1077
|
const headersAdapter = await readNextHeadersAsAdapter();
|
|
1063
|
-
const correlationId =
|
|
1064
|
-
return await
|
|
1078
|
+
const correlationId = chunkMMLQXSSD_cjs.resolveCorrelation(headersAdapter);
|
|
1079
|
+
return await chunkMMLQXSSD_cjs.runWithCorrelation(
|
|
1065
1080
|
correlationId,
|
|
1066
1081
|
() => runWithActorAndAuditScope(async () => {
|
|
1067
1082
|
const startMs = Date.now();
|
|
@@ -1070,7 +1085,7 @@ function captureServerAction(action, actionName) {
|
|
|
1070
1085
|
await maybeRunActorHookFromServerAction();
|
|
1071
1086
|
try {
|
|
1072
1087
|
const result = await Promise.resolve(runAction(...args));
|
|
1073
|
-
await
|
|
1088
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
1074
1089
|
const failure = classifyServerActionResult(result);
|
|
1075
1090
|
await emitServerActionEvent({
|
|
1076
1091
|
actionName,
|
|
@@ -1086,7 +1101,7 @@ function captureServerAction(action, actionName) {
|
|
|
1086
1101
|
return result;
|
|
1087
1102
|
} catch (e) {
|
|
1088
1103
|
if (isNextControlFlowError(e)) {
|
|
1089
|
-
await
|
|
1104
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
1090
1105
|
const controlStatus = nextControlFlowStatus(e) ?? 200;
|
|
1091
1106
|
await emitServerActionEvent({
|
|
1092
1107
|
actionName,
|
|
@@ -1102,7 +1117,7 @@ function captureServerAction(action, actionName) {
|
|
|
1102
1117
|
throw e;
|
|
1103
1118
|
}
|
|
1104
1119
|
exception = e instanceof Error ? e : new Error(String(e));
|
|
1105
|
-
await
|
|
1120
|
+
await chunkMMLQXSSD_cjs.maybeExtractSupabaseActor();
|
|
1106
1121
|
await emitServerActionEvent({
|
|
1107
1122
|
actionName,
|
|
1108
1123
|
statusCode: 500,
|
|
@@ -1113,10 +1128,8 @@ function captureServerAction(action, actionName) {
|
|
|
1113
1128
|
});
|
|
1114
1129
|
throw e;
|
|
1115
1130
|
} finally {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1119
|
-
chunkULFJOPQ2_cjs.endCorrelationScope();
|
|
1131
|
+
await flushOnServerless();
|
|
1132
|
+
chunkMMLQXSSD_cjs.endCorrelationScope();
|
|
1120
1133
|
}
|
|
1121
1134
|
})
|
|
1122
1135
|
);
|
|
@@ -1144,7 +1157,7 @@ async function __ezlogs_run_inline_server_action(actionName, body) {
|
|
|
1144
1157
|
return wrapped();
|
|
1145
1158
|
}
|
|
1146
1159
|
function classifyServerActionResult(result) {
|
|
1147
|
-
const classifier =
|
|
1160
|
+
const classifier = chunkMMLQXSSD_cjs.configuration().isServerActionError;
|
|
1148
1161
|
if (classifier) {
|
|
1149
1162
|
try {
|
|
1150
1163
|
const verdict = classifier(result);
|
|
@@ -1220,7 +1233,7 @@ function hasErrorEntries(errors, depth = 0) {
|
|
|
1220
1233
|
return Object.values(errors).some((v) => hasErrorEntries(v, depth + 1));
|
|
1221
1234
|
}
|
|
1222
1235
|
function formStateErrorMessage(r) {
|
|
1223
|
-
const patterns =
|
|
1236
|
+
const patterns = chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys;
|
|
1224
1237
|
const specific = Array.isArray(r.errors) ? specificErrorMessage({ errors: r.errors }, patterns) ?? specificErrorMessage({ formErrors: r.errors }, patterns) : specificErrorMessage({ fieldErrors: r.errors }, patterns);
|
|
1225
1238
|
if (specific) return capErrorText(specific);
|
|
1226
1239
|
if (typeof r.message === "string" && r.message.trim().length > 0) {
|
|
@@ -1248,7 +1261,7 @@ function defaultErrorMessage(result) {
|
|
|
1248
1261
|
}
|
|
1249
1262
|
var MAX_ERROR_MESSAGE_LENGTH = 200;
|
|
1250
1263
|
function specificOrOwn(result, error) {
|
|
1251
|
-
const specific = isGenericErrorText(error) ? specificErrorMessage(result,
|
|
1264
|
+
const specific = isGenericErrorText(error) ? specificErrorMessage(result, chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys) : null;
|
|
1252
1265
|
return capErrorText(specific ?? error);
|
|
1253
1266
|
}
|
|
1254
1267
|
function truncate(value) {
|
|
@@ -1266,7 +1279,7 @@ function isZodErrorLike(value) {
|
|
|
1266
1279
|
return Array.isArray(issues) && issues.length > 0;
|
|
1267
1280
|
}
|
|
1268
1281
|
function formatZodIssues(issues) {
|
|
1269
|
-
const patterns =
|
|
1282
|
+
const patterns = chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys;
|
|
1270
1283
|
const messages = [];
|
|
1271
1284
|
for (const issue of issues) {
|
|
1272
1285
|
const m = issueMessage(issue, patterns);
|
|
@@ -1355,7 +1368,7 @@ function redirectPath(target, requestHost) {
|
|
|
1355
1368
|
const url = new URL(target, "http://ezlogs.internal");
|
|
1356
1369
|
if (absolute && (!requestHost || url.host.toLowerCase() !== requestHost.toLowerCase())) return null;
|
|
1357
1370
|
const path = url.pathname.split("/").map((seg) => /^[A-Za-z0-9_-]{20,}$/.test(seg) && !UUID.test(seg) ? "[FILTERED]" : seg).join("/");
|
|
1358
|
-
return path ?
|
|
1371
|
+
return path ? chunkYXZZNZG6_cjs.scrubSecretsInText(path, { emails: true }) : null;
|
|
1359
1372
|
} catch {
|
|
1360
1373
|
return null;
|
|
1361
1374
|
}
|
|
@@ -1369,9 +1382,9 @@ async function emitServerActionEvent(input) {
|
|
|
1369
1382
|
const fromPage = referer ?? nextUrl ?? null;
|
|
1370
1383
|
const argParams = extractServerActionArgs(input.args, input.actionName);
|
|
1371
1384
|
const combined = argParams !== null || fromPage !== null ? { ...argParams ?? {}, ...fromPage !== null ? { from_page: fromPage } : {} } : null;
|
|
1372
|
-
const requestParams =
|
|
1385
|
+
const requestParams = chunkYXZZNZG6_cjs.maskAuthParams(
|
|
1373
1386
|
combined,
|
|
1374
|
-
|
|
1387
|
+
chunkYXZZNZG6_cjs.isAuthActionName(input.actionName) || chunkYXZZNZG6_cjs.isAuthPath(pathOf(fromPage))
|
|
1375
1388
|
);
|
|
1376
1389
|
const syntheticUrl = new URL(
|
|
1377
1390
|
`http://localhost/__server-action/${encodeURIComponent(input.actionName)}`
|
|
@@ -1386,7 +1399,7 @@ async function emitServerActionEvent(input) {
|
|
|
1386
1399
|
userAgent,
|
|
1387
1400
|
remoteIp: extractRemoteIp(await readNextHeadersAsAdapter()),
|
|
1388
1401
|
contentType: null,
|
|
1389
|
-
excludedVariableKeys:
|
|
1402
|
+
excludedVariableKeys: chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys
|
|
1390
1403
|
});
|
|
1391
1404
|
if (input.redirectTo) {
|
|
1392
1405
|
const host = await readNextHeader("x-forwarded-host") ?? await readNextHeader("host");
|
|
@@ -1398,18 +1411,18 @@ async function emitServerActionEvent(input) {
|
|
|
1398
1411
|
input.exception,
|
|
1399
1412
|
null
|
|
1400
1413
|
);
|
|
1401
|
-
const event =
|
|
1414
|
+
const event = chunkYXZZNZG6_cjs.build({
|
|
1402
1415
|
source_type: "http_request",
|
|
1403
1416
|
source_data: sourceData,
|
|
1404
1417
|
outcome,
|
|
1405
|
-
correlation_id:
|
|
1418
|
+
correlation_id: chunkMMLQXSSD_cjs.current(),
|
|
1406
1419
|
resource_ids: [],
|
|
1407
|
-
context:
|
|
1420
|
+
context: chunkMMLQXSSD_cjs.getCurrentActor() ? { actor: chunkMMLQXSSD_cjs.getCurrentActor() } : null,
|
|
1408
1421
|
duration_ms: input.durationMs,
|
|
1409
1422
|
error_message,
|
|
1410
1423
|
timestamp: input.startedAt
|
|
1411
1424
|
});
|
|
1412
|
-
|
|
1425
|
+
chunkYXZZNZG6_cjs.pushEvent(event);
|
|
1413
1426
|
} catch (error) {
|
|
1414
1427
|
chunkTWTG5ILJ_cjs.logger.error(`server-action capture emit failed: ${describeError5(error)}`);
|
|
1415
1428
|
}
|
|
@@ -1492,7 +1505,7 @@ function actionWords(name) {
|
|
|
1492
1505
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([a-zA-Z])(\d)/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
1493
1506
|
}
|
|
1494
1507
|
function looksLikeCardNumber(digits, paymentAction) {
|
|
1495
|
-
if (digits.length < 13 || digits.length > 19 || !
|
|
1508
|
+
if (digits.length < 13 || digits.length > 19 || !chunkYXZZNZG6_cjs.passesLuhn(digits)) return false;
|
|
1496
1509
|
return paymentAction || digits.length === 15 || digits.length === 16;
|
|
1497
1510
|
}
|
|
1498
1511
|
function maskPositional(value, flags) {
|
|
@@ -1580,7 +1593,7 @@ function serializeArgValue(value) {
|
|
|
1580
1593
|
return void 0;
|
|
1581
1594
|
}
|
|
1582
1595
|
async function captureHttpEvent(input) {
|
|
1583
|
-
if (!
|
|
1596
|
+
if (!chunkMMLQXSSD_cjs.configuration().captureHttp) return;
|
|
1584
1597
|
const snapshot = await snapshotRequest(input.request);
|
|
1585
1598
|
if (snapshot === null) return;
|
|
1586
1599
|
let graphqlErrorMessage = null;
|
|
@@ -1646,7 +1659,7 @@ async function snapshotRequest(request) {
|
|
|
1646
1659
|
return { method, url, userAgent, remoteIp, contentType, rawParams, graphqlBody, serverActionId };
|
|
1647
1660
|
}
|
|
1648
1661
|
async function maybeRunActorHook(request) {
|
|
1649
|
-
const hook =
|
|
1662
|
+
const hook = chunkMMLQXSSD_cjs.configuration().actorFromRequest;
|
|
1650
1663
|
let hookResult = null;
|
|
1651
1664
|
if (hook) {
|
|
1652
1665
|
try {
|
|
@@ -1659,7 +1672,7 @@ async function maybeRunActorHook(request) {
|
|
|
1659
1672
|
applyActorFromHookAndUa(hookResult, userAgent);
|
|
1660
1673
|
}
|
|
1661
1674
|
async function maybeRunActorHookFromPages(req) {
|
|
1662
|
-
const hook =
|
|
1675
|
+
const hook = chunkMMLQXSSD_cjs.configuration().actorFromRequest;
|
|
1663
1676
|
let hookResult = null;
|
|
1664
1677
|
if (hook) {
|
|
1665
1678
|
try {
|
|
@@ -1673,7 +1686,7 @@ async function maybeRunActorHookFromPages(req) {
|
|
|
1673
1686
|
applyActorFromHookAndUa(hookResult, userAgent);
|
|
1674
1687
|
}
|
|
1675
1688
|
async function maybeRunActorHookFromServerAction() {
|
|
1676
|
-
const hook =
|
|
1689
|
+
const hook = chunkMMLQXSSD_cjs.configuration().actorFromRequest;
|
|
1677
1690
|
const headers = await loadNextHeaders();
|
|
1678
1691
|
if (!hook && !headers) {
|
|
1679
1692
|
chunkTWTG5ILJ_cjs.logger.debug("actorFromRequest (server action): no hook + no next/headers");
|
|
@@ -1818,7 +1831,7 @@ function readPagesHeader(req, name) {
|
|
|
1818
1831
|
async function emitEvent(input) {
|
|
1819
1832
|
try {
|
|
1820
1833
|
await flushTriggerAuditLog();
|
|
1821
|
-
const config =
|
|
1834
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
1822
1835
|
let graphql = null;
|
|
1823
1836
|
if (input.snapshot.graphqlBody !== null) {
|
|
1824
1837
|
const parsed = parseGraphqlBody(
|
|
@@ -1834,9 +1847,9 @@ async function emitEvent(input) {
|
|
|
1834
1847
|
method: input.snapshot.method,
|
|
1835
1848
|
url: input.snapshot.url,
|
|
1836
1849
|
statusCode: input.statusCode,
|
|
1837
|
-
rawParams:
|
|
1850
|
+
rawParams: chunkYXZZNZG6_cjs.maskAuthParams(
|
|
1838
1851
|
unwrapTrpcParams(input.snapshot.rawParams, input.snapshot.url, input.context.routeModulePath ?? null),
|
|
1839
|
-
|
|
1852
|
+
chunkYXZZNZG6_cjs.isAuthPath(input.snapshot.url.pathname)
|
|
1840
1853
|
),
|
|
1841
1854
|
routeModulePath: input.context.routeModulePath ?? null,
|
|
1842
1855
|
serverActionName,
|
|
@@ -1854,20 +1867,20 @@ async function emitEvent(input) {
|
|
|
1854
1867
|
input.responseErrorMessage ?? null
|
|
1855
1868
|
);
|
|
1856
1869
|
const contextValue = buildContext();
|
|
1857
|
-
const event =
|
|
1870
|
+
const event = chunkYXZZNZG6_cjs.build({
|
|
1858
1871
|
source_type: "http_request",
|
|
1859
1872
|
source_data: sourceData,
|
|
1860
1873
|
outcome,
|
|
1861
|
-
correlation_id:
|
|
1874
|
+
correlation_id: chunkMMLQXSSD_cjs.current(),
|
|
1862
1875
|
resource_ids: [],
|
|
1863
1876
|
context: contextValue,
|
|
1864
1877
|
duration_ms: input.durationMs,
|
|
1865
1878
|
error_message,
|
|
1866
1879
|
timestamp: input.startedAt
|
|
1867
1880
|
});
|
|
1868
|
-
|
|
1881
|
+
chunkYXZZNZG6_cjs.pushEvent(event);
|
|
1869
1882
|
} catch (error) {
|
|
1870
|
-
const cid =
|
|
1883
|
+
const cid = chunkMMLQXSSD_cjs.current();
|
|
1871
1884
|
const cidLabel = cid ? ` (correlation_id=${cid})` : "";
|
|
1872
1885
|
chunkTWTG5ILJ_cjs.logger.error(`http capture emit failed${cidLabel}: ${describeError5(error)}`);
|
|
1873
1886
|
}
|
|
@@ -1875,7 +1888,7 @@ async function emitEvent(input) {
|
|
|
1875
1888
|
function followBody(response, method, onDone, onChunk) {
|
|
1876
1889
|
try {
|
|
1877
1890
|
if (!response.body || method === "HEAD" || response.bodyUsed) return null;
|
|
1878
|
-
const capture =
|
|
1891
|
+
const capture = chunkMMLQXSSD_cjs.makeAsyncContextCapture();
|
|
1879
1892
|
if (!capture) return null;
|
|
1880
1893
|
const keepAlive = isServerless() ? platformWaitUntil() : null;
|
|
1881
1894
|
if (isServerless() && !keepAlive) return null;
|
|
@@ -1929,6 +1942,31 @@ function followBody(response, method, onDone, onChunk) {
|
|
|
1929
1942
|
return null;
|
|
1930
1943
|
}
|
|
1931
1944
|
}
|
|
1945
|
+
var SERVERLESS_INLINE_FLUSH_MS = 2e3;
|
|
1946
|
+
async function flushOnServerless() {
|
|
1947
|
+
if (!isServerless()) return;
|
|
1948
|
+
try {
|
|
1949
|
+
const waitUntil = platformWaitUntil();
|
|
1950
|
+
if (waitUntil) {
|
|
1951
|
+
waitUntil(flushScheduler.flushNow());
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
} catch (e) {
|
|
1955
|
+
chunkTWTG5ILJ_cjs.logger.debug(`waitUntil unavailable, flushing inline: ${describeError5(e)}`);
|
|
1956
|
+
}
|
|
1957
|
+
let timer;
|
|
1958
|
+
try {
|
|
1959
|
+
await Promise.race([
|
|
1960
|
+
flushScheduler.flushNow(),
|
|
1961
|
+
new Promise((resolve) => {
|
|
1962
|
+
timer = setTimeout(resolve, SERVERLESS_INLINE_FLUSH_MS);
|
|
1963
|
+
})
|
|
1964
|
+
]);
|
|
1965
|
+
} catch {
|
|
1966
|
+
} finally {
|
|
1967
|
+
clearTimeout(timer);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1932
1970
|
function platformWaitUntil() {
|
|
1933
1971
|
for (const key of ["@next/request-context", "@vercel/request-context"]) {
|
|
1934
1972
|
try {
|
|
@@ -1941,23 +1979,23 @@ function platformWaitUntil() {
|
|
|
1941
1979
|
return null;
|
|
1942
1980
|
}
|
|
1943
1981
|
function buildContext() {
|
|
1944
|
-
const currentActor =
|
|
1982
|
+
const currentActor = chunkMMLQXSSD_cjs.getCurrentActor();
|
|
1945
1983
|
if (!currentActor) return null;
|
|
1946
1984
|
return { actor: currentActor };
|
|
1947
1985
|
}
|
|
1948
1986
|
async function flushTriggerAuditLog() {
|
|
1949
|
-
const reader =
|
|
1987
|
+
const reader = chunkMMLQXSSD_cjs.configuration().databaseReader;
|
|
1950
1988
|
if (!reader) return;
|
|
1951
|
-
await
|
|
1989
|
+
await chunkGMHOUAKD_cjs.flushAuditLog(reader);
|
|
1952
1990
|
}
|
|
1953
1991
|
function runWithActorAndAuditScope(callback) {
|
|
1954
|
-
if (
|
|
1955
|
-
return
|
|
1992
|
+
if (chunkMMLQXSSD_cjs.configuration().databaseReader == null) {
|
|
1993
|
+
return chunkMMLQXSSD_cjs.runWithActorScope(callback);
|
|
1956
1994
|
}
|
|
1957
|
-
return
|
|
1995
|
+
return chunkMMLQXSSD_cjs.runWithActorScope(() => chunkGMHOUAKD_cjs.runWithEmittedAuditIdsScope(callback));
|
|
1958
1996
|
}
|
|
1959
1997
|
function isExcludedPath(path, method) {
|
|
1960
|
-
const config =
|
|
1998
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
1961
1999
|
const normalizedMethod = (method ?? "").toUpperCase();
|
|
1962
2000
|
for (const pattern of config.allExcludedPaths()) {
|
|
1963
2001
|
if (typeof pattern === "string") {
|
|
@@ -1969,7 +2007,7 @@ function isExcludedPath(path, method) {
|
|
|
1969
2007
|
return true;
|
|
1970
2008
|
}
|
|
1971
2009
|
}
|
|
1972
|
-
if (hasExcludedExtension(path,
|
|
2010
|
+
if (hasExcludedExtension(path, chunkMMLQXSSD_cjs.DEFAULT_EXCLUDED_EXTENSIONS)) return true;
|
|
1973
2011
|
return false;
|
|
1974
2012
|
}
|
|
1975
2013
|
function extractRemoteIp(headers) {
|
|
@@ -2015,7 +2053,7 @@ async function readResponseErrorMessage(response, trpcRoute = false) {
|
|
|
2015
2053
|
const text = await response.clone().text();
|
|
2016
2054
|
if (!text || text.length > MAX_ERROR_BODY_LENGTH) return null;
|
|
2017
2055
|
const parsed = safeJsonParse2(text);
|
|
2018
|
-
const trpc = trpcErrorMessage(parsed,
|
|
2056
|
+
const trpc = trpcErrorMessage(parsed, chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys);
|
|
2019
2057
|
if (trpc) return trpc;
|
|
2020
2058
|
if (response.status === 207) return null;
|
|
2021
2059
|
const body = parsed;
|
|
@@ -2024,9 +2062,9 @@ async function readResponseErrorMessage(response, trpcRoute = false) {
|
|
|
2024
2062
|
const raw = [body.error, body.message, nested?.message].find(
|
|
2025
2063
|
(v) => typeof v === "string" && v.trim().length > 0
|
|
2026
2064
|
);
|
|
2027
|
-
const specific = !raw || isGenericErrorText(raw) ? specificErrorMessage(body,
|
|
2065
|
+
const specific = !raw || isGenericErrorText(raw) ? specificErrorMessage(body, chunkMMLQXSSD_cjs.configuration().excludedGraphqlVariableKeys) : null;
|
|
2028
2066
|
if (specific) return capErrorText(specific);
|
|
2029
|
-
return raw ? truncate(
|
|
2067
|
+
return raw ? truncate(chunkYXZZNZG6_cjs.scrubSecretsInText(raw.trim(), { emails: true })) : null;
|
|
2030
2068
|
} catch {
|
|
2031
2069
|
return null;
|
|
2032
2070
|
}
|
|
@@ -2050,23 +2088,23 @@ function applyActorFromHookAndUa(hookResult, userAgent) {
|
|
|
2050
2088
|
const uaMatch = classifyUserAgent(userAgent);
|
|
2051
2089
|
if (hookResult != null && typeof hookResult === "object" && !Array.isArray(hookResult)) {
|
|
2052
2090
|
if (uaMatch === null) {
|
|
2053
|
-
|
|
2091
|
+
chunkMMLQXSSD_cjs.setActor(hookResult);
|
|
2054
2092
|
return;
|
|
2055
2093
|
}
|
|
2056
2094
|
const hookObj = hookResult;
|
|
2057
2095
|
const existingKind = hookObj.kind;
|
|
2058
2096
|
if (typeof existingKind === "string" && existingKind.length > 0) {
|
|
2059
|
-
|
|
2097
|
+
chunkMMLQXSSD_cjs.setActor(hookObj);
|
|
2060
2098
|
return;
|
|
2061
2099
|
}
|
|
2062
|
-
|
|
2100
|
+
chunkMMLQXSSD_cjs.setActor({ ...hookObj, kind: uaMatch.kind });
|
|
2063
2101
|
return;
|
|
2064
2102
|
}
|
|
2065
2103
|
if (uaMatch !== null) {
|
|
2066
|
-
|
|
2104
|
+
chunkMMLQXSSD_cjs.setActor(synthesizeAgentActor(uaMatch));
|
|
2067
2105
|
return;
|
|
2068
2106
|
}
|
|
2069
|
-
|
|
2107
|
+
chunkMMLQXSSD_cjs.setActor(null);
|
|
2070
2108
|
}
|
|
2071
2109
|
function synthesizeAgentActor(detection) {
|
|
2072
2110
|
return {
|
|
@@ -2098,8 +2136,7 @@ function announceStartup(serverUrl, projectToken) {
|
|
|
2098
2136
|
if (g[STARTUP_ANNOUNCED_KEY]) return;
|
|
2099
2137
|
g[STARTUP_ANNOUNCED_KEY] = true;
|
|
2100
2138
|
if (!serverUrl || !projectToken) {
|
|
2101
|
-
|
|
2102
|
-
chunkTWTG5ILJ_cjs.logger.warn(`not capturing: ${missing} missing in ezlogs.init() (check EZLOGS_SERVER_URL / EZLOGS_PROJECT_TOKEN)`);
|
|
2139
|
+
chunkTWTG5ILJ_cjs.logger.warn("not capturing: projectToken missing in ezlogs.init() (check EZLOGS_PROJECT_TOKEN)");
|
|
2103
2140
|
return;
|
|
2104
2141
|
}
|
|
2105
2142
|
let host = serverUrl;
|
|
@@ -2115,7 +2152,7 @@ function _resetStartupAnnouncementForTests() {
|
|
|
2115
2152
|
}
|
|
2116
2153
|
var ezlogs = {
|
|
2117
2154
|
init(options) {
|
|
2118
|
-
const config =
|
|
2155
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
2119
2156
|
config.apply(options);
|
|
2120
2157
|
if (options.logLevel) chunkTWTG5ILJ_cjs.setLogLevel(options.logLevel);
|
|
2121
2158
|
warnIfInsecureServerUrl(config.serverUrl, config.allowInsecureTransport);
|
|
@@ -2134,7 +2171,7 @@ var ezlogs = {
|
|
|
2134
2171
|
}
|
|
2135
2172
|
});
|
|
2136
2173
|
} else if (options.patchDatabaseClient) {
|
|
2137
|
-
|
|
2174
|
+
chunkNX4EL7BY_cjs.patchPgClient(
|
|
2138
2175
|
options.patchDatabaseClient
|
|
2139
2176
|
);
|
|
2140
2177
|
}
|
|
@@ -2181,7 +2218,7 @@ function detectDatabaseUrlFromEnv() {
|
|
|
2181
2218
|
return null;
|
|
2182
2219
|
}
|
|
2183
2220
|
async function autoWireTriggerPathFromDatabaseUrl(options) {
|
|
2184
|
-
const config =
|
|
2221
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
2185
2222
|
let pg;
|
|
2186
2223
|
try {
|
|
2187
2224
|
const dynImport = new Function(
|
|
@@ -2200,7 +2237,7 @@ async function autoWireTriggerPathFromDatabaseUrl(options) {
|
|
|
2200
2237
|
max: 4
|
|
2201
2238
|
});
|
|
2202
2239
|
const reader = (sql, params) => pool.query(sql, params);
|
|
2203
|
-
if (await
|
|
2240
|
+
if (await chunkGMHOUAKD_cjs.auditLogInstalled(reader) === false) {
|
|
2204
2241
|
warnAuditLogMissing();
|
|
2205
2242
|
void pool.end?.().catch(() => {
|
|
2206
2243
|
});
|
|
@@ -2209,21 +2246,21 @@ async function autoWireTriggerPathFromDatabaseUrl(options) {
|
|
|
2209
2246
|
if (config.databaseReader === null) {
|
|
2210
2247
|
config.databaseReader = reader;
|
|
2211
2248
|
}
|
|
2212
|
-
|
|
2213
|
-
void
|
|
2249
|
+
chunkNX4EL7BY_cjs.patchPgClient(pg);
|
|
2250
|
+
void chunkGMHOUAKD_cjs.checkAuditLogAccess(reader);
|
|
2214
2251
|
runTriggerTrackedTablesDetection();
|
|
2215
2252
|
}
|
|
2216
2253
|
function applyDatabaseReaderDefaults() {
|
|
2217
|
-
const config =
|
|
2254
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
2218
2255
|
const reader = config.databaseReader;
|
|
2219
2256
|
if (!reader) return;
|
|
2220
|
-
|
|
2257
|
+
chunkGMHOUAKD_cjs.auditLogInstalled(reader).then((installed) => {
|
|
2221
2258
|
if (installed === false && config.databaseReader === reader) {
|
|
2222
2259
|
config.databaseReader = null;
|
|
2223
2260
|
warnAuditLogMissing();
|
|
2224
2261
|
return;
|
|
2225
2262
|
}
|
|
2226
|
-
if (installed === true) void
|
|
2263
|
+
if (installed === true) void chunkGMHOUAKD_cjs.checkAuditLogAccess(reader);
|
|
2227
2264
|
runTriggerTrackedTablesDetection();
|
|
2228
2265
|
}).catch(() => {
|
|
2229
2266
|
});
|
|
@@ -2234,10 +2271,10 @@ function warnAuditLogMissing() {
|
|
|
2234
2271
|
);
|
|
2235
2272
|
}
|
|
2236
2273
|
function runTriggerTrackedTablesDetection() {
|
|
2237
|
-
const config =
|
|
2274
|
+
const config = chunkMMLQXSSD_cjs.configuration();
|
|
2238
2275
|
if (!config.databaseReader) return;
|
|
2239
2276
|
if (config.triggerTrackedTables !== null) return;
|
|
2240
|
-
|
|
2277
|
+
chunkGMHOUAKD_cjs.detectTriggerTrackedTables(config.databaseReader).then((tables) => {
|
|
2241
2278
|
if (tables === null) {
|
|
2242
2279
|
chunkTWTG5ILJ_cjs.logger.debug(
|
|
2243
2280
|
"trigger-tracked-table detection failed; falling back to suppress-all on `databaseReader` paths. Untracked tables will not appear in the dashboard until detection succeeds or the table is added with `SELECT ezlogs_track('table_name')`."
|
|
@@ -2277,16 +2314,16 @@ function warnIfInsecureServerUrl(serverUrl, allowInsecure) {
|
|
|
2277
2314
|
);
|
|
2278
2315
|
}
|
|
2279
2316
|
function _internalsForTests() {
|
|
2280
|
-
return { buffer:
|
|
2317
|
+
return { buffer: chunkYXZZNZG6_cjs.buffer_exports, flushScheduler };
|
|
2281
2318
|
}
|
|
2282
2319
|
|
|
2283
2320
|
Object.defineProperty(exports, "ArgError", {
|
|
2284
2321
|
enumerable: true,
|
|
2285
|
-
get: function () { return
|
|
2322
|
+
get: function () { return chunkYXZZNZG6_cjs.ArgError; }
|
|
2286
2323
|
});
|
|
2287
2324
|
Object.defineProperty(exports, "buildEvent", {
|
|
2288
2325
|
enumerable: true,
|
|
2289
|
-
get: function () { return
|
|
2326
|
+
get: function () { return chunkYXZZNZG6_cjs.build; }
|
|
2290
2327
|
});
|
|
2291
2328
|
exports.__ezlogs_run_inline_server_action = __ezlogs_run_inline_server_action;
|
|
2292
2329
|
exports._detectDatabaseUrlFromEnvForTests = _detectDatabaseUrlFromEnvForTests;
|