@objectstack/plugin-webhooks 17.0.0 → 17.1.0
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/CHANGELOG.md +214 -0
- package/dist/{chunk-Q4FEMGD6.cjs → chunk-DRHJ2M45.cjs} +61 -2
- package/dist/chunk-DRHJ2M45.cjs.map +1 -0
- package/dist/{chunk-GDCWDVDT.js → chunk-XERWWQKN.js} +61 -2
- package/dist/{chunk-GDCWDVDT.js.map → chunk-XERWWQKN.js.map} +1 -1
- package/dist/index.cjs +135 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -1
- package/dist/index.d.ts +66 -1
- package/dist/index.js +106 -3
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +2 -2
- package/dist/schema.d.cts +1188 -269
- package/dist/schema.d.ts +1188 -269
- package/dist/schema.js +1 -1
- package/dist/{translations-U32QIEPB.js → translations-IAKF6NAP.js} +1 -1
- package/dist/translations-IAKF6NAP.js.map +1 -0
- package/dist/{translations-H5ZYI6YP.cjs → translations-IHRALWSP.cjs} +1 -1
- package/dist/translations-IHRALWSP.cjs.map +1 -0
- package/package.json +7 -7
- package/dist/chunk-Q4FEMGD6.cjs.map +0 -1
- package/dist/translations-H5ZYI6YP.cjs.map +0 -1
- package/dist/translations-U32QIEPB.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkDRHJ2M45cjs = require('./chunk-DRHJ2M45.cjs');
|
|
4
4
|
|
|
5
5
|
// src/webhook-secret.ts
|
|
6
6
|
var WEBHOOK_SECRET_FIELD = "signing_secret";
|
|
@@ -1062,6 +1062,98 @@ function unbindWebhookProvenanceStamp(engine) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
|
+
// src/webhook-headers-gate.ts
|
|
1066
|
+
var WEBHOOK_HEADERS_SHAPE_REFUSAL_CODE = "VALIDATION_ERROR";
|
|
1067
|
+
var WEBHOOK_HEADERS_SHAPE_REFUSAL_STATUS = 400;
|
|
1068
|
+
var DECLARED_SHAPE = 'Custom HTTP headers sent with each delivery, as a JSON object ({"Authorization": "Bearer ..."})';
|
|
1069
|
+
var WebhookHeadersShapeError = class extends Error {
|
|
1070
|
+
constructor(object, field, diagnosis) {
|
|
1071
|
+
super(
|
|
1072
|
+
`Custom headers refused for "${object}.${field}": ${diagnosis}. The required shape is a FLAT JSON object of string values, which is what the field itself asks for \u2014 its description reads: "${DECLARED_SHAPE}". This is checked at the write door because one step later there is nothing left to check: the engine encrypts this value into sys_secret and every read path returns only the mask, so a stored value that can never be used is indistinguishable from one that works until the next delivery tries to send it \u2014 at which point the subscription parks and the report arrives an unbounded time later, in a different surface from the one it was typed into (#7986, #8558, #8566). ${HEADERS_REMEDY}`
|
|
1073
|
+
);
|
|
1074
|
+
this.code = WEBHOOK_HEADERS_SHAPE_REFUSAL_CODE;
|
|
1075
|
+
this.status = WEBHOOK_HEADERS_SHAPE_REFUSAL_STATUS;
|
|
1076
|
+
this.name = "WebhookHeadersShapeError";
|
|
1077
|
+
this.object = object;
|
|
1078
|
+
this.field = field;
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
function describeParsed(parsed) {
|
|
1082
|
+
if (parsed === null) return "null";
|
|
1083
|
+
if (Array.isArray(parsed)) return "a JSON array";
|
|
1084
|
+
if (typeof parsed !== "object") return `a JSON ${typeof parsed}`;
|
|
1085
|
+
const entries = Object.entries(parsed);
|
|
1086
|
+
if (entries.length === 0) {
|
|
1087
|
+
return 'an EMPTY JSON object, which is not the same thing as "send no custom headers"';
|
|
1088
|
+
}
|
|
1089
|
+
const bad = entries.filter(([, v]) => typeof v !== "string");
|
|
1090
|
+
if (bad.length > 0) {
|
|
1091
|
+
const named = bad.map(([k, v]) => `${JSON.stringify(k)} (${Array.isArray(v) ? "array" : v === null ? "null" : typeof v})`).join(", ");
|
|
1092
|
+
return `a JSON object, but the wire carries only strings and ${bad.length === 1 ? "this value is" : "these values are"} not a string: ${named}`;
|
|
1093
|
+
}
|
|
1094
|
+
return "a JSON object the header seam does not accept";
|
|
1095
|
+
}
|
|
1096
|
+
function describeRejected(value) {
|
|
1097
|
+
if (typeof value === "string") {
|
|
1098
|
+
let parsed;
|
|
1099
|
+
try {
|
|
1100
|
+
parsed = JSON.parse(value);
|
|
1101
|
+
} catch (e10) {
|
|
1102
|
+
return "the value is a string that is not valid JSON at all \u2014 check for unquoted keys or values ({X-Team: crm}), single quotes instead of double, or a trailing comma";
|
|
1103
|
+
}
|
|
1104
|
+
return `the value parses as JSON but is ${describeParsed(parsed)}`;
|
|
1105
|
+
}
|
|
1106
|
+
return `the value is ${describeParsed(value)}`;
|
|
1107
|
+
}
|
|
1108
|
+
function assertWritableWebhookHeaders(data, object = WEBHOOK_OBJECT, field = WEBHOOK_HEADERS_FIELD) {
|
|
1109
|
+
if (!data || typeof data !== "object") return;
|
|
1110
|
+
if (!Object.prototype.hasOwnProperty.call(data, field)) return;
|
|
1111
|
+
const value = data[field];
|
|
1112
|
+
if (value === null || typeof value === "undefined") return;
|
|
1113
|
+
if (value === "") return;
|
|
1114
|
+
if (isOpaqueSecretForm(value)) return;
|
|
1115
|
+
let serialized;
|
|
1116
|
+
if (typeof value === "string") {
|
|
1117
|
+
serialized = value;
|
|
1118
|
+
} else {
|
|
1119
|
+
try {
|
|
1120
|
+
serialized = JSON.stringify(value);
|
|
1121
|
+
} catch (e11) {
|
|
1122
|
+
throw new WebhookHeadersShapeError(
|
|
1123
|
+
object,
|
|
1124
|
+
field,
|
|
1125
|
+
"the value cannot be serialized to JSON at all (it contains a circular reference)"
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
if (typeof serialized !== "string") {
|
|
1129
|
+
throw new WebhookHeadersShapeError(object, field, `the value is a ${typeof value}`);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
if (parseStoredHeaders(serialized)) return;
|
|
1133
|
+
throw new WebhookHeadersShapeError(object, field, describeRejected(value));
|
|
1134
|
+
}
|
|
1135
|
+
var WEBHOOK_HEADERS_GATE_PACKAGE = "plugin-webhooks:headers-shape-gate";
|
|
1136
|
+
var GATE_PRIORITY = 50;
|
|
1137
|
+
function bindWebhookHeadersShapeGate(engine, logger) {
|
|
1138
|
+
if (typeof _optionalChain([engine, 'optionalAccess', _125 => _125.registerHook]) !== "function") return;
|
|
1139
|
+
const handler = (ctx) => {
|
|
1140
|
+
assertWritableWebhookHeaders(_optionalChain([ctx, 'optionalAccess', _126 => _126.input, 'optionalAccess', _127 => _127.data]));
|
|
1141
|
+
};
|
|
1142
|
+
for (const event of ["beforeInsert", "beforeUpdate"]) {
|
|
1143
|
+
engine.registerHook(event, handler, {
|
|
1144
|
+
object: WEBHOOK_OBJECT,
|
|
1145
|
+
packageId: WEBHOOK_HEADERS_GATE_PACKAGE,
|
|
1146
|
+
priority: GATE_PRIORITY
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
_optionalChain([logger, 'optionalAccess', _128 => _128.info, 'optionalCall', _129 => _129("[webhook] headers_secret shape gate bound (refuses non-flat-string-map plaintext)")]);
|
|
1150
|
+
}
|
|
1151
|
+
function unbindWebhookHeadersShapeGate(engine) {
|
|
1152
|
+
if (typeof _optionalChain([engine, 'optionalAccess', _130 => _130.unregisterHooksByPackage]) === "function") {
|
|
1153
|
+
engine.unregisterHooksByPackage(WEBHOOK_HEADERS_GATE_PACKAGE);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1065
1157
|
// src/webhook-outbox-plugin.ts
|
|
1066
1158
|
var WebhookOutboxPlugin = class {
|
|
1067
1159
|
constructor(options = {}) {
|
|
@@ -1092,7 +1184,7 @@ var WebhookOutboxPlugin = class {
|
|
|
1092
1184
|
scope: "system",
|
|
1093
1185
|
name: "Webhook Schemas",
|
|
1094
1186
|
description: "Registers sys_webhook (configuration). Deliveries use messaging's sys_http_delivery outbox.",
|
|
1095
|
-
objects: [
|
|
1187
|
+
objects: [_chunkDRHJ2M45cjs.SysWebhook],
|
|
1096
1188
|
navigationContributions: [
|
|
1097
1189
|
{
|
|
1098
1190
|
app: "setup",
|
|
@@ -1106,7 +1198,7 @@ var WebhookOutboxPlugin = class {
|
|
|
1106
1198
|
]
|
|
1107
1199
|
});
|
|
1108
1200
|
} else {
|
|
1109
|
-
_optionalChain([ctx, 'access',
|
|
1201
|
+
_optionalChain([ctx, 'access', _131 => _131.logger, 'access', _132 => _132.warn, 'optionalCall', _133 => _133(
|
|
1110
1202
|
"[webhook-outbox] manifest service unavailable \u2014 sys_webhook will NOT appear in REST or Studio nav. Register MetadataService before WebhookOutboxPlugin."
|
|
1111
1203
|
)]);
|
|
1112
1204
|
}
|
|
@@ -1115,12 +1207,12 @@ var WebhookOutboxPlugin = class {
|
|
|
1115
1207
|
try {
|
|
1116
1208
|
const i18n = ctx.getService("i18n");
|
|
1117
1209
|
if (i18n && typeof i18n.loadTranslations === "function") {
|
|
1118
|
-
const { WebhooksTranslations } = await Promise.resolve().then(() => _interopRequireWildcard(require("./translations-
|
|
1210
|
+
const { WebhooksTranslations } = await Promise.resolve().then(() => _interopRequireWildcard(require("./translations-IHRALWSP.cjs")));
|
|
1119
1211
|
for (const [locale, data] of Object.entries(WebhooksTranslations)) {
|
|
1120
1212
|
i18n.loadTranslations(locale, data);
|
|
1121
1213
|
}
|
|
1122
1214
|
}
|
|
1123
|
-
} catch (
|
|
1215
|
+
} catch (e12) {
|
|
1124
1216
|
}
|
|
1125
1217
|
});
|
|
1126
1218
|
}
|
|
@@ -1132,16 +1224,20 @@ var WebhookOutboxPlugin = class {
|
|
|
1132
1224
|
this.registerAdminRoutes(ctx);
|
|
1133
1225
|
});
|
|
1134
1226
|
}
|
|
1135
|
-
_optionalChain([ctx, 'access',
|
|
1227
|
+
_optionalChain([ctx, 'access', _134 => _134.logger, 'access', _135 => _135.info, 'optionalCall', _136 => _136("[webhook-outbox] initialised (delivery via shared messaging HTTP outbox)", {
|
|
1136
1228
|
autoEnqueue: autoEnqueueOpt !== false
|
|
1137
1229
|
})]);
|
|
1138
1230
|
}
|
|
1139
1231
|
async dispose() {
|
|
1140
|
-
await _optionalChain([this, 'access',
|
|
1232
|
+
await _optionalChain([this, 'access', _137 => _137.autoEnqueuer, 'optionalAccess', _138 => _138.stop, 'call', _139 => _139()]);
|
|
1141
1233
|
if (this.boundEngine) {
|
|
1142
1234
|
try {
|
|
1143
1235
|
unbindWebhookProvenanceStamp(this.boundEngine);
|
|
1144
|
-
} catch (
|
|
1236
|
+
} catch (e13) {
|
|
1237
|
+
}
|
|
1238
|
+
try {
|
|
1239
|
+
unbindWebhookHeadersShapeGate(this.boundEngine);
|
|
1240
|
+
} catch (e14) {
|
|
1145
1241
|
}
|
|
1146
1242
|
this.boundEngine = void 0;
|
|
1147
1243
|
}
|
|
@@ -1165,28 +1261,29 @@ var WebhookOutboxPlugin = class {
|
|
|
1165
1261
|
async bootDeclaredWebhooks(ctx) {
|
|
1166
1262
|
const engine = this.tryGetService(ctx, ["objectql", "data"]);
|
|
1167
1263
|
if (!engine) {
|
|
1168
|
-
_optionalChain([ctx, 'access',
|
|
1264
|
+
_optionalChain([ctx, 'access', _140 => _140.logger, 'access', _141 => _141.warn, 'optionalCall', _142 => _142("[webhook] declared-webhook bootstrap skipped \u2014 no data engine available")]);
|
|
1169
1265
|
return;
|
|
1170
1266
|
}
|
|
1171
1267
|
this.boundEngine = engine;
|
|
1172
1268
|
bindWebhookProvenanceStamp(engine, ctx.logger);
|
|
1269
|
+
bindWebhookHeadersShapeGate(engine, ctx.logger);
|
|
1173
1270
|
let metadataService;
|
|
1174
1271
|
try {
|
|
1175
1272
|
metadataService = ctx.getService("metadata");
|
|
1176
|
-
} catch (
|
|
1273
|
+
} catch (e15) {
|
|
1177
1274
|
}
|
|
1178
1275
|
try {
|
|
1179
1276
|
await bootstrapDeclaredWebhooks(engine, metadataService, ctx.logger);
|
|
1180
1277
|
} catch (err) {
|
|
1181
|
-
_optionalChain([ctx, 'access',
|
|
1182
|
-
error: _nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
1278
|
+
_optionalChain([ctx, 'access', _143 => _143.logger, 'access', _144 => _144.warn, 'optionalCall', _145 => _145("[webhook] declared-webhook bootstrap failed (dispatcher still serves admin rows)", {
|
|
1279
|
+
error: _nullishCoalesce(_optionalChain([err, 'optionalAccess', _146 => _146.message]), () => ( String(err)))
|
|
1183
1280
|
})]);
|
|
1184
1281
|
}
|
|
1185
1282
|
try {
|
|
1186
1283
|
await migrateLegacyWebhookSecrets(engine, ctx.logger);
|
|
1187
1284
|
} catch (err) {
|
|
1188
|
-
_optionalChain([ctx, 'access',
|
|
1189
|
-
error: _nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
1285
|
+
_optionalChain([ctx, 'access', _147 => _147.logger, 'access', _148 => _148.warn, 'optionalCall', _149 => _149("[webhook] legacy signing-secret sweep failed (rows left unchanged)", {
|
|
1286
|
+
error: _nullishCoalesce(_optionalChain([err, 'optionalAccess', _150 => _150.message]), () => ( String(err)))
|
|
1190
1287
|
})]);
|
|
1191
1288
|
}
|
|
1192
1289
|
}
|
|
@@ -1196,14 +1293,14 @@ var WebhookOutboxPlugin = class {
|
|
|
1196
1293
|
const realtime = this.tryGetService(ctx, ["realtime"]);
|
|
1197
1294
|
const messaging = this.getMessaging(ctx);
|
|
1198
1295
|
if (!engine || !realtime || !messaging) {
|
|
1199
|
-
_optionalChain([ctx, 'access',
|
|
1296
|
+
_optionalChain([ctx, 'access', _151 => _151.logger, 'access', _152 => _152.warn, 'optionalCall', _153 => _153(
|
|
1200
1297
|
"[webhook-auto-enqueuer] disabled \u2014 ObjectQL, Realtime, or Messaging service not available",
|
|
1201
1298
|
{ hasEngine: !!engine, hasRealtime: !!realtime, hasMessaging: !!messaging }
|
|
1202
1299
|
)]);
|
|
1203
1300
|
return;
|
|
1204
1301
|
}
|
|
1205
1302
|
if (!messaging.isHttpDeliveryReady()) {
|
|
1206
|
-
_optionalChain([ctx, 'access',
|
|
1303
|
+
_optionalChain([ctx, 'access', _154 => _154.logger, 'access', _155 => _155.warn, 'optionalCall', _156 => _156(
|
|
1207
1304
|
"[webhook-auto-enqueuer] messaging HTTP outbox not ready (no data engine / reliableDelivery off) \u2014 webhook deliveries will not be durable"
|
|
1208
1305
|
)]);
|
|
1209
1306
|
}
|
|
@@ -1217,7 +1314,7 @@ var WebhookOutboxPlugin = class {
|
|
|
1217
1314
|
);
|
|
1218
1315
|
await this.autoEnqueuer.start();
|
|
1219
1316
|
ctx.registerService("webhook.autoEnqueuer", this.autoEnqueuer);
|
|
1220
|
-
_optionalChain([ctx, 'access',
|
|
1317
|
+
_optionalChain([ctx, 'access', _157 => _157.logger, 'access', _158 => _158.info, 'optionalCall', _159 => _159("[webhook-auto-enqueuer] started (enqueues source=webhook onto sys_http_delivery)")]);
|
|
1221
1318
|
}
|
|
1222
1319
|
/**
|
|
1223
1320
|
* [#8069] Register {@link createWebhookRedeliverGuard} with messaging, so
|
|
@@ -1233,7 +1330,7 @@ var WebhookOutboxPlugin = class {
|
|
|
1233
1330
|
*/
|
|
1234
1331
|
installRedeliverGuard(ctx, messaging, engine, subscriptionsObject) {
|
|
1235
1332
|
if (typeof messaging.registerRedeliverGuard !== "function") {
|
|
1236
|
-
_optionalChain([ctx, 'access',
|
|
1333
|
+
_optionalChain([ctx, 'access', _160 => _160.logger, 'access', _161 => _161.error, 'optionalCall', _162 => _162(
|
|
1237
1334
|
"[webhook-outbox] messaging service exposes no registerRedeliverGuard() \u2014 redelivery of a webhook whose signing configuration is gone CANNOT be refused, so an operator pressing redeliver may send a delivery that can no longer be authenticated (#7799, #8069). The POST /api/v1/webhooks/redeliver endpoint is reachable by any authenticated user. Fix: upgrade @objectstack/service-messaging to a build that implements registerRedeliverGuard."
|
|
1238
1335
|
)]);
|
|
1239
1336
|
return;
|
|
@@ -1242,14 +1339,14 @@ var WebhookOutboxPlugin = class {
|
|
|
1242
1339
|
"webhook",
|
|
1243
1340
|
createWebhookRedeliverGuard(engine, subscriptionsObject)
|
|
1244
1341
|
);
|
|
1245
|
-
_optionalChain([ctx, 'access',
|
|
1342
|
+
_optionalChain([ctx, 'access', _163 => _163.logger, 'access', _164 => _164.debug, 'optionalCall', _165 => _165("[webhook-outbox] redeliver guard installed for source=webhook")]);
|
|
1246
1343
|
}
|
|
1247
1344
|
tryGetService(ctx, names) {
|
|
1248
1345
|
for (const n of names) {
|
|
1249
1346
|
try {
|
|
1250
1347
|
const svc = ctx.getService(n);
|
|
1251
1348
|
if (svc) return svc;
|
|
1252
|
-
} catch (
|
|
1349
|
+
} catch (e16) {
|
|
1253
1350
|
}
|
|
1254
1351
|
}
|
|
1255
1352
|
return void 0;
|
|
@@ -1262,7 +1359,7 @@ var WebhookOutboxPlugin = class {
|
|
|
1262
1359
|
registerAdminRoutes(ctx) {
|
|
1263
1360
|
const http = this.tryGetService(ctx, ["http-server"]);
|
|
1264
1361
|
if (!http || typeof http.getRawApp !== "function") {
|
|
1265
|
-
_optionalChain([ctx, 'access',
|
|
1362
|
+
_optionalChain([ctx, 'access', _166 => _166.logger, 'access', _167 => _167.debug, 'optionalCall', _168 => _168("[webhook-outbox] HTTP server not available; redeliver endpoint not mounted")]);
|
|
1266
1363
|
return;
|
|
1267
1364
|
}
|
|
1268
1365
|
const rawApp = http.getRawApp();
|
|
@@ -1279,10 +1376,10 @@ var WebhookOutboxPlugin = class {
|
|
|
1279
1376
|
let body;
|
|
1280
1377
|
try {
|
|
1281
1378
|
body = await c.req.json();
|
|
1282
|
-
} catch (
|
|
1379
|
+
} catch (e17) {
|
|
1283
1380
|
return c.json({ success: false, error: { code: "INVALID_REQUEST", message: "Request body must be JSON." } }, 400);
|
|
1284
1381
|
}
|
|
1285
|
-
const deliveryId = typeof _optionalChain([body, 'optionalAccess',
|
|
1382
|
+
const deliveryId = typeof _optionalChain([body, 'optionalAccess', _169 => _169.deliveryId]) === "string" ? body.deliveryId.trim() : "";
|
|
1286
1383
|
if (!deliveryId) {
|
|
1287
1384
|
return c.json(
|
|
1288
1385
|
{ success: false, error: { code: "MISSING_REQUIRED_FIELD", message: "Body must include `deliveryId: string`." } },
|
|
@@ -1291,24 +1388,24 @@ var WebhookOutboxPlugin = class {
|
|
|
1291
1388
|
}
|
|
1292
1389
|
try {
|
|
1293
1390
|
const row = await messaging.redeliverHttp(deliveryId);
|
|
1294
|
-
_optionalChain([ctx, 'access',
|
|
1391
|
+
_optionalChain([ctx, 'access', _170 => _170.logger, 'access', _171 => _171.info, 'optionalCall', _172 => _172("[webhook-outbox] redelivered", { deliveryId, requestedBy: userId })]);
|
|
1295
1392
|
return c.json({ success: true, data: { id: row.id, status: row.status } });
|
|
1296
1393
|
} catch (err) {
|
|
1297
|
-
const code = _optionalChain([err, 'optionalAccess',
|
|
1394
|
+
const code = _optionalChain([err, 'optionalAccess', _173 => _173.code]);
|
|
1298
1395
|
if (code === "RESOURCE_NOT_FOUND") {
|
|
1299
1396
|
return c.json({ success: false, error: { code, message: err.message } }, 404);
|
|
1300
1397
|
}
|
|
1301
1398
|
if (code === "DELIVERY_NOT_ELIGIBLE" || code === "DELIVERY_NEVER_SENT") {
|
|
1302
1399
|
return c.json({ success: false, error: { code, message: err.message } }, 409);
|
|
1303
1400
|
}
|
|
1304
|
-
_optionalChain([ctx, 'access',
|
|
1401
|
+
_optionalChain([ctx, 'access', _174 => _174.logger, 'access', _175 => _175.error, 'optionalCall', _176 => _176("[webhook-outbox] redeliver failed", err)]);
|
|
1305
1402
|
return c.json(
|
|
1306
|
-
{ success: false, error: { code: "INTERNAL_ERROR", message: _nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
1403
|
+
{ success: false, error: { code: "INTERNAL_ERROR", message: _nullishCoalesce(_optionalChain([err, 'optionalAccess', _177 => _177.message]), () => ( String(err))) } },
|
|
1307
1404
|
500
|
|
1308
1405
|
);
|
|
1309
1406
|
}
|
|
1310
1407
|
});
|
|
1311
|
-
_optionalChain([ctx, 'access',
|
|
1408
|
+
_optionalChain([ctx, 'access', _178 => _178.logger, 'access', _179 => _179.info, 'optionalCall', _180 => _180("[webhook-outbox] redeliver endpoint mounted at POST /api/v1/webhooks/redeliver")]);
|
|
1312
1409
|
}
|
|
1313
1410
|
async resolveSessionUserId(ctx, c) {
|
|
1314
1411
|
try {
|
|
@@ -1318,11 +1415,11 @@ var WebhookOutboxPlugin = class {
|
|
|
1318
1415
|
if (!api && typeof authService.getApi === "function") {
|
|
1319
1416
|
api = await authService.getApi();
|
|
1320
1417
|
}
|
|
1321
|
-
if (!_optionalChain([api, 'optionalAccess',
|
|
1418
|
+
if (!_optionalChain([api, 'optionalAccess', _181 => _181.getSession])) return void 0;
|
|
1322
1419
|
const session = await api.getSession({ headers: c.req.raw.headers });
|
|
1323
|
-
const uid2 = _optionalChain([session, 'optionalAccess',
|
|
1420
|
+
const uid2 = _optionalChain([session, 'optionalAccess', _182 => _182.user, 'optionalAccess', _183 => _183.id]);
|
|
1324
1421
|
return typeof uid2 === "string" && uid2.length > 0 ? uid2 : void 0;
|
|
1325
|
-
} catch (
|
|
1422
|
+
} catch (e18) {
|
|
1326
1423
|
return void 0;
|
|
1327
1424
|
}
|
|
1328
1425
|
}
|
|
@@ -1334,5 +1431,11 @@ var WebhookOutboxPlugin = class {
|
|
|
1334
1431
|
|
|
1335
1432
|
|
|
1336
1433
|
|
|
1337
|
-
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
exports.AutoEnqueuer = AutoEnqueuer; exports.SysWebhook = _chunkDRHJ2M45cjs.SysWebhook; exports.WEBHOOK_HEADERS_FIELD = WEBHOOK_HEADERS_FIELD; exports.WEBHOOK_HEADERS_SHAPE_REFUSAL_CODE = WEBHOOK_HEADERS_SHAPE_REFUSAL_CODE; exports.WEBHOOK_HEADERS_SHAPE_REFUSAL_STATUS = WEBHOOK_HEADERS_SHAPE_REFUSAL_STATUS; exports.WEBHOOK_SECRET_FIELD = WEBHOOK_SECRET_FIELD; exports.WebhookHeadersShapeError = WebhookHeadersShapeError; exports.WebhookOutboxPlugin = WebhookOutboxPlugin; exports.assertWritableWebhookHeaders = assertWritableWebhookHeaders; exports.bindWebhookHeadersShapeGate = bindWebhookHeadersShapeGate; exports.migrateLegacyWebhookSecrets = migrateLegacyWebhookSecrets; exports.unbindWebhookHeadersShapeGate = unbindWebhookHeadersShapeGate;
|
|
1338
1441
|
//# sourceMappingURL=index.cjs.map
|