@deadair/plugin-sdk 0.77.5 → 0.77.7

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 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 = {
@@ -978,6 +995,13 @@ function baseForm(value) {
978
995
  return normalize(value.replace(PARENTHETICAL, " ").split(/\s+[-–—]\s+/)[0] ?? value);
979
996
  }
980
997
  __name(baseForm, "baseForm");
998
+ function textAgreement(candidate, reference) {
999
+ if (!candidate) return "none";
1000
+ if (normalize(candidate) === normalize(reference)) return "exact";
1001
+ if (baseForm(candidate) === baseForm(reference)) return "base";
1002
+ return "none";
1003
+ }
1004
+ __name(textAgreement, "textAgreement");
981
1005
 
982
1006
  // src/plausible.audio.ts
983
1007
  var MIN_PLAUSIBLE_AUDIO_BYTES = 256;
@@ -1249,6 +1273,17 @@ function configBaseUrl(value) {
1249
1273
  return (configString(value) ?? "").replace(/\/+$/, "");
1250
1274
  }
1251
1275
  __name(configBaseUrl, "configBaseUrl");
1276
+ function configLines(value) {
1277
+ if (typeof value !== "string") return [];
1278
+ return value.split(/[\n,]/).map((line) => line.trim()).filter((line) => line !== "");
1279
+ }
1280
+ __name(configLines, "configLines");
1281
+ function configFlag(value, fallback) {
1282
+ if (value === true || value === "true") return true;
1283
+ if (value === false || value === "false") return false;
1284
+ return fallback;
1285
+ }
1286
+ __name(configFlag, "configFlag");
1252
1287
  async function readRowSecret(host, fieldKey, row, columnKey) {
1253
1288
  const rowId = row[ROW_ID_KEY];
1254
1289
  if (rowId === void 0 || rowId.length === 0) return void 0;
@@ -1468,6 +1503,7 @@ export {
1468
1503
  ROW_ID_KEY,
1469
1504
  SPEECH_CUES,
1470
1505
  SPEECH_DELIVERIES,
1506
+ UpstreamRequestError,
1471
1507
  baseForm,
1472
1508
  collectGeneration,
1473
1509
  configBaseUrl,
@@ -1479,6 +1515,8 @@ export {
1479
1515
  configFieldSchema,
1480
1516
  configFieldTypeSchema,
1481
1517
  configFieldUnitSchema,
1518
+ configFlag,
1519
+ configLines,
1482
1520
  configString,
1483
1521
  cuesIn,
1484
1522
  decodeEntities,
@@ -1515,6 +1553,7 @@ export {
1515
1553
  sentToProblems,
1516
1554
  sentencesOf,
1517
1555
  sentencesWithin,
1556
+ textAgreement,
1518
1557
  toPluginError,
1519
1558
  truncateSentences,
1520
1559
  truncateUpstreamMessage,