@sjawhar/pi-envoy 16.29.0 → 16.30.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/dist/dispatch.js +14 -4
- package/dist/envoy.js +796 -758
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -14975,6 +14975,17 @@ function isIdPrefix(value) {
|
|
|
14975
14975
|
function pictureCaption(name) {
|
|
14976
14976
|
return name.replace(/[\\[\]`]/g, "\\$&").replace(/\s+/g, " ");
|
|
14977
14977
|
}
|
|
14978
|
+
var PICTURE_CAPTION = String.raw`(?:\\.|[^\\\]\n]){0,512}`;
|
|
14979
|
+
var PICTURE_ADDRESS = String.raw`dispatch://[^\s()]{1,2048}@v[1-9][0-9]{0,18}`;
|
|
14980
|
+
var PICTURE_TITLE = String.raw`(?:\s{1,4}"(?:\\.|[^\\"]){0,256}")?`;
|
|
14981
|
+
var PICTURE_SYNTAX = String.raw`!\[${PICTURE_CAPTION}\]\((${PICTURE_ADDRESS})${PICTURE_TITLE}\)`;
|
|
14982
|
+
function pictureSyntax() {
|
|
14983
|
+
return new RegExp(PICTURE_SYNTAX, "g");
|
|
14984
|
+
}
|
|
14985
|
+
function blockPlaceholder(type) {
|
|
14986
|
+
return `[${type}]`;
|
|
14987
|
+
}
|
|
14988
|
+
var PICTURE_PLACEHOLDER = blockPlaceholder("image");
|
|
14978
14989
|
var PICTURE_TYPES = {
|
|
14979
14990
|
"image/png": true,
|
|
14980
14991
|
"image/jpeg": true,
|
|
@@ -18108,9 +18119,9 @@ class DispatchClient {
|
|
|
18108
18119
|
async messageReply(id, input, options = {}) {
|
|
18109
18120
|
return this.#json("POST", ["api", "v1", "messages", id, "reply"], input, options.followUp === true ? { follow_up: "true" } : undefined);
|
|
18110
18121
|
}
|
|
18111
|
-
async deliveryReply(resource, id, input) {
|
|
18122
|
+
async deliveryReply(resource, id, input, options = {}) {
|
|
18112
18123
|
const collection = resource === "message" ? "messages" : "comments";
|
|
18113
|
-
await this.#json("POST", ["api", "v1", collection, id, "reply"], input);
|
|
18124
|
+
await this.#json("POST", ["api", "v1", collection, id, "reply"], input, options.followUp === true ? { follow_up: "true" } : undefined);
|
|
18114
18125
|
}
|
|
18115
18126
|
async getMessage(issue, id) {
|
|
18116
18127
|
return this.#json("GET", [
|
|
@@ -18646,9 +18657,8 @@ function withPictureLines(text, lines) {
|
|
|
18646
18657
|
${lines.join(`
|
|
18647
18658
|
`)}`;
|
|
18648
18659
|
}
|
|
18649
|
-
var PICTURE_SYNTAX = /!\[(?:\\.|[^\\\]])*\]\((dispatch:\/\/[^\s()]+@v[1-9][0-9]*)(?:\s+"(?:\\.|[^\\"])*")?\)/g;
|
|
18650
18660
|
function pictureAddresses(text) {
|
|
18651
|
-
return [...text.matchAll(
|
|
18661
|
+
return [...text.matchAll(pictureSyntax())].map((match) => match[1]);
|
|
18652
18662
|
}
|
|
18653
18663
|
function picturesNewestFirst(texts) {
|
|
18654
18664
|
const ordered = texts.map((item, index) => ({ item, index, at: Date.parse(item.at) })).sort((left, right) => (Number.isNaN(right.at) ? 0 : right.at) - (Number.isNaN(left.at) ? 0 : left.at) || left.index - right.index);
|