@getdial/cli 0.25.0 → 0.25.2
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/commands/message/send.js +0 -1
- package/dist/lib/api.js +9 -1
- package/dist/lib/ops/messages.js +4 -1
- package/dist/mcp/schemas.js +1 -0
- package/package.json +1 -1
- package/skills.tar.gz +0 -0
package/dist/lib/api.js
CHANGED
|
@@ -33,7 +33,15 @@ async function apiRequest(method, path, body, apiKey, extraHeaders) {
|
|
|
33
33
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
34
34
|
return { ok: true, status: res.statusCode, data: parsed };
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
// The server's `error` field is usually a string, but validation failures
|
|
37
|
+
// return a structured object (Zod's flatten). Stringify those as JSON rather
|
|
38
|
+
// than letting them coerce to "[object Object]", so the real reason survives.
|
|
39
|
+
const rawError = parsed?.error;
|
|
40
|
+
const errMsg = typeof rawError === "string"
|
|
41
|
+
? rawError
|
|
42
|
+
: rawError != null
|
|
43
|
+
? JSON.stringify(rawError)
|
|
44
|
+
: text || `HTTP ${res.statusCode}`;
|
|
37
45
|
return { ok: false, status: res.statusCode, error: errMsg };
|
|
38
46
|
}
|
|
39
47
|
catch (err) {
|
package/dist/lib/ops/messages.js
CHANGED
|
@@ -4,7 +4,10 @@ import { DialError } from "./errors.js";
|
|
|
4
4
|
export async function sendMessage(opts) {
|
|
5
5
|
const auth = requireAuth();
|
|
6
6
|
const fromNumberId = requireFromNumberId(auth, opts.fromNumberId);
|
|
7
|
-
|
|
7
|
+
// No `channel`: the server determines it from the from-number (a standard number
|
|
8
|
+
// sends SMS; an iMessage number sends iMessage with RCS/SMS fallback) and its send
|
|
9
|
+
// schema is strict — sending a stale `channel` field is rejected as a 400.
|
|
10
|
+
const res = await apiPost("/api/v1/messages", { to: opts.to, body: opts.body, fromNumberId }, auth.apiKey);
|
|
8
11
|
if (!res.ok)
|
|
9
12
|
throw new DialError("send_failed", res.error, res.status);
|
|
10
13
|
return res.data.message;
|
package/dist/mcp/schemas.js
CHANGED
|
@@ -37,6 +37,7 @@ export const messageSchema = z
|
|
|
37
37
|
channel: z.string().optional(),
|
|
38
38
|
direction: z.string().optional(),
|
|
39
39
|
status: statusSchema,
|
|
40
|
+
statusError: z.string().nullish().describe("Failure reason when status is undelivered/failed"),
|
|
40
41
|
createdAt: z.string().optional(),
|
|
41
42
|
})
|
|
42
43
|
.passthrough();
|
package/package.json
CHANGED
package/skills.tar.gz
CHANGED
|
Binary file
|