@deadair/plugin-sdk 0.77.4 → 0.77.6
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/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.config.read.d.ts +18 -0
- package/dist/plugin.config.read.d.ts.map +1 -1
- package/dist/plugin.http.d.ts +44 -1
- package/dist/plugin.http.d.ts.map +1 -1
- package/dist/testing/fake.plugin.host.d.ts +20 -0
- package/dist/testing/fake.plugin.host.d.ts.map +1 -1
- package/dist/testing/index.js +24 -1
- package/dist/testing/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -442,6 +442,23 @@ function headersToRecord(headers) {
|
|
|
442
442
|
return record2;
|
|
443
443
|
}
|
|
444
444
|
__name(headersToRecord, "headersToRecord");
|
|
445
|
+
var UpstreamRequestError = class extends PluginError {
|
|
446
|
+
static {
|
|
447
|
+
__name(this, "UpstreamRequestError");
|
|
448
|
+
}
|
|
449
|
+
status;
|
|
450
|
+
constructor(status, message, failure = {}) {
|
|
451
|
+
super(message, {
|
|
452
|
+
cause: failure.cause
|
|
453
|
+
});
|
|
454
|
+
this.name = "UpstreamRequestError";
|
|
455
|
+
this.status = status;
|
|
456
|
+
this.withCode(failure.code ?? (status === void 0 ? "upstream" : pluginCodeForStatus(status)));
|
|
457
|
+
if (status !== void 0 && status !== 200) this.withUpstreamStatus(status);
|
|
458
|
+
if (failure.upstreamCode !== void 0) this.withUpstreamCode(failure.upstreamCode);
|
|
459
|
+
if (failure.retryAfterMs !== void 0) this.withRetry(failure.retryAfterMs);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
445
462
|
|
|
446
463
|
// src/html.text.ts
|
|
447
464
|
var NAMED_ENTITIES = {
|
|
@@ -1249,6 +1266,17 @@ function configBaseUrl(value) {
|
|
|
1249
1266
|
return (configString(value) ?? "").replace(/\/+$/, "");
|
|
1250
1267
|
}
|
|
1251
1268
|
__name(configBaseUrl, "configBaseUrl");
|
|
1269
|
+
function configLines(value) {
|
|
1270
|
+
if (typeof value !== "string") return [];
|
|
1271
|
+
return value.split(/[\n,]/).map((line) => line.trim()).filter((line) => line !== "");
|
|
1272
|
+
}
|
|
1273
|
+
__name(configLines, "configLines");
|
|
1274
|
+
function configFlag(value, fallback) {
|
|
1275
|
+
if (value === true || value === "true") return true;
|
|
1276
|
+
if (value === false || value === "false") return false;
|
|
1277
|
+
return fallback;
|
|
1278
|
+
}
|
|
1279
|
+
__name(configFlag, "configFlag");
|
|
1252
1280
|
async function readRowSecret(host, fieldKey, row, columnKey) {
|
|
1253
1281
|
const rowId = row[ROW_ID_KEY];
|
|
1254
1282
|
if (rowId === void 0 || rowId.length === 0) return void 0;
|
|
@@ -1468,6 +1496,7 @@ export {
|
|
|
1468
1496
|
ROW_ID_KEY,
|
|
1469
1497
|
SPEECH_CUES,
|
|
1470
1498
|
SPEECH_DELIVERIES,
|
|
1499
|
+
UpstreamRequestError,
|
|
1471
1500
|
baseForm,
|
|
1472
1501
|
collectGeneration,
|
|
1473
1502
|
configBaseUrl,
|
|
@@ -1479,6 +1508,8 @@ export {
|
|
|
1479
1508
|
configFieldSchema,
|
|
1480
1509
|
configFieldTypeSchema,
|
|
1481
1510
|
configFieldUnitSchema,
|
|
1511
|
+
configFlag,
|
|
1512
|
+
configLines,
|
|
1482
1513
|
configString,
|
|
1483
1514
|
cuesIn,
|
|
1484
1515
|
decodeEntities,
|