@primitivedotdev/sdk 1.25.0 → 1.26.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.
|
@@ -73,9 +73,9 @@ function prepareSignalEmail(input, dependencies) {
|
|
|
73
73
|
payload.note = input.note;
|
|
74
74
|
}
|
|
75
75
|
} else if (input.kind !== "read") {
|
|
76
|
-
check(input.kind === "working", "invalid signal kind");
|
|
76
|
+
check(input.kind === "working" || input.kind === "typing", "invalid signal kind");
|
|
77
77
|
milliseconds(input.expiresAtMs);
|
|
78
|
-
check(input.expiresAtMs > now && input.expiresAtMs - now <= 6e4,
|
|
78
|
+
check(input.expiresAtMs > now && input.expiresAtMs - now <= 6e4, `${input.kind} expiry must be within 60 seconds`);
|
|
79
79
|
expires = input.expiresAtMs;
|
|
80
80
|
}
|
|
81
81
|
const interaction = dependencies.uuid().toLowerCase(), step = dependencies.uuid().toLowerCase();
|
|
@@ -135,6 +135,7 @@ async function sendPreparedSignal(sendMail, prepared, options) {
|
|
|
135
135
|
function signalText(kind, status, note) {
|
|
136
136
|
if (kind === "read") return "I read your message.";
|
|
137
137
|
if (kind === "working") return "I am working on your message.";
|
|
138
|
+
if (kind === "typing") return "I am composing a reply to your message.";
|
|
138
139
|
const bodies = {
|
|
139
140
|
received: "Received your message.",
|
|
140
141
|
will_process: "I intend to process your message.",
|
|
@@ -198,9 +199,10 @@ function fallback(result) {
|
|
|
198
199
|
if (!exactKeys(e, ENVELOPE_KEYS) || e.protocol_version !== 1 || ![
|
|
199
200
|
"ack",
|
|
200
201
|
"read",
|
|
201
|
-
"working"
|
|
202
|
+
"working",
|
|
203
|
+
"typing"
|
|
202
204
|
].includes(e.protocol) || e.step !== e.protocol || e.prev_step_id !== null || e.interaction_id.split("@")[0]?.toLowerCase() === e.step_id.toLowerCase()) return null;
|
|
203
|
-
if (e.protocol
|
|
205
|
+
if (["working", "typing"].includes(e.protocol) ? !utcExpiry(e.expires_at) : e.expires_at !== null) return null;
|
|
204
206
|
if (!e.payload || typeof e.payload !== "object" || Array.isArray(e.payload)) return null;
|
|
205
207
|
const p = e.payload;
|
|
206
208
|
if (!exactKeys(p, e.protocol === "ack" ? ["subject_message_id", "status"] : ["subject_message_id"], e.protocol === "ack" ? ["note"] : [])) return null;
|
package/package.json
CHANGED