coss-cli 0.5.0 → 0.6.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/README.md CHANGED
@@ -68,6 +68,8 @@ ID and notarized by Apple (since 0.3.0), so one downloaded with a browser runs w
68
68
  | `coss risk assess --event <event>` | Assesses an event (`--email`, `--ip`, `--user`, `--content`, `--data '{…}'`…) and prints the decision, score and reasons. Sandbox fixtures (`192.0.2.1`, `disposable.test`, `[coss-test:spam]`…) produce each decision. |
69
69
  | `coss risk assessments`, `coss risk feedback <assessment> --outcome <outcome>` | Assessments (`--review open`: the review queue), and what a user turned out to be. |
70
70
  | `coss risk lists list`, `coss risk lists add <allow\|block> <type> <value>`, `coss risk lists remove <entry>` | The allow and block lists (`--note`, `--expires 7d`). |
71
+ | `coss scheduling hosts`, `coss scheduling bookings` | The environment's [hosts and bookings](https://coss.com/docs/scheduling). |
72
+ | `coss forms list`, `coss forms submissions <form>` | The environment's [forms](https://coss.com/docs/forms) and their endpoints, and a form's submissions (`--status held`: Risk's review queue). |
71
73
  | `coss domains list` | The organization's sending domains and their status. |
72
74
  | `coss domains add <domain>` | Adds a domain and prints the DNS records to publish (`--format bind` prints zone-file lines). |
73
75
  | `coss domains get <domain>` | A domain's records and what the last DNS check saw (verified, missing, mismatch). `--format bind` too. |
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as flushOutput, l as nodeIo, n as run } from "./run-DLGZnVHf.js";
2
+ import { c as flushOutput, l as nodeIo, n as run } from "./run-C97BDtxr.js";
3
3
  //#region src/cli.ts
4
4
  process.exitCode = await run(process.argv.slice(2), nodeIo());
5
5
  await flushOutput();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { u as CURSOR_FIELDS, t as HELP, r as VERSION, s as defaultConfigDir, i as generateSecret, l as nodeIo, n as run, a as sign, o as signatureHeaders } from "./run-DLGZnVHf.js";
1
+ export { u as CURSOR_FIELDS, t as HELP, r as VERSION, s as defaultConfigDir, i as generateSecret, l as nodeIo, n as run, a as sign, o as signatureHeaders } from "./run-C97BDtxr.js";
@@ -204,7 +204,7 @@ function requireArgs(positionals, count, usage) {
204
204
  return positionals;
205
205
  }
206
206
  /** Repeatable flags that may also be comma-separated: `--events a,b --events c`. */
207
- function list$1(value) {
207
+ function list$2(value) {
208
208
  return (value === void 0 ? [] : Array.isArray(value) ? value : [value]).flatMap((item) => item.split(",")).map((item) => item.trim()).filter(Boolean);
209
209
  }
210
210
  /** `name=value` flags as pairs (a usage error for anything else). */
@@ -437,7 +437,7 @@ function shorten(text, max) {
437
437
  function minute(iso) {
438
438
  return iso ? iso.slice(0, 16).replace("T", " ") : "";
439
439
  }
440
- function statusStyle$4(status) {
440
+ function statusStyle$5(status) {
441
441
  if (status === "delivered" || status === "sent" || status === "received") return "green";
442
442
  if (status === "queued" || status === "scheduled" || status === "delivery_delayed" || status === "in_progress") return "yellow";
443
443
  if (status === "canceled") return "dim";
@@ -1256,7 +1256,7 @@ function checkedFormat(format) {
1256
1256
  if (format !== void 0 && format !== "table" && format !== "bind") throw new UsageError(`--format takes table or bind; got "${format}".`);
1257
1257
  return format;
1258
1258
  }
1259
- async function client$3(context) {
1259
+ async function client$4(context) {
1260
1260
  return clientFor(context.io, await resolveCredentials(context));
1261
1261
  }
1262
1262
  const domainsListCommand = defineCommand({
@@ -1269,7 +1269,7 @@ const domainsListCommand = defineCommand({
1269
1269
  } },
1270
1270
  run: async ({ context }) => {
1271
1271
  const { out } = context;
1272
- const { data, error } = await (await client$3(context)).domains.list({ signal: context.io.signal });
1272
+ const { data, error } = await (await client$4(context)).domains.list({ signal: context.io.signal });
1273
1273
  if (error) throw apiError("Couldn't list the domains", error);
1274
1274
  if (out.json) {
1275
1275
  for (const domain of data.data) out.data(domain);
@@ -1335,7 +1335,7 @@ const domainsAddCommand = defineCommand({
1335
1335
  const { out } = context;
1336
1336
  const name = onePositional(positionals, "domain", "domains add");
1337
1337
  const format = checkedFormat(values.format);
1338
- const { data, error } = await (await client$3(context)).domains.create({ name }, { signal: context.io.signal });
1338
+ const { data, error } = await (await client$4(context)).domains.create({ name }, { signal: context.io.signal });
1339
1339
  if (error) throw apiError(`Couldn't add ${name}`, error);
1340
1340
  if (out.json || format === "bind") {
1341
1341
  printDomain(out, data, format);
@@ -1365,7 +1365,7 @@ const domainsGetCommand = defineCommand({
1365
1365
  run: async ({ values, positionals, context }) => {
1366
1366
  const ref = onePositional(positionals, "domain", "domains get");
1367
1367
  const format = checkedFormat(values.format);
1368
- const domain = await findDomain(await client$3(context), ref);
1368
+ const domain = await findDomain(await client$4(context), ref);
1369
1369
  printDomain(context.out, domain, format);
1370
1370
  return 0;
1371
1371
  }
@@ -1517,7 +1517,7 @@ async function waitForOutcome$1(context, coss, email, options) {
1517
1517
  settled: settled$1(current, options.simulate)
1518
1518
  };
1519
1519
  }
1520
- function statusStyle$3(status) {
1520
+ function statusStyle$4(status) {
1521
1521
  if (status === "delivered" || status === "sent") return "green";
1522
1522
  if (status === "queued" || status === "scheduled" || status === "delivery_delayed") return "yellow";
1523
1523
  return "red";
@@ -1686,8 +1686,8 @@ async function emailsSend({ values, context }) {
1686
1686
  events: outcome.events
1687
1687
  });
1688
1688
  else {
1689
- out.line(`${outcome.email.id} ${out.style(statusStyle$3(outcome.email.status), outcome.email.status)}`);
1690
- for (const recipient of outcome.email.recipients) out.line(` ${recipient.address} ${out.style(statusStyle$3(recipient.status), recipient.status)}`);
1689
+ out.line(`${outcome.email.id} ${out.style(statusStyle$4(outcome.email.status), outcome.email.status)}`);
1690
+ for (const recipient of outcome.email.recipients) out.line(` ${recipient.address} ${out.style(statusStyle$4(recipient.status), recipient.status)}`);
1691
1691
  if (outcome.events.length > 0) out.line();
1692
1692
  for (const event of outcome.events) out.line(` ${out.style("dim", event.occurred_at)} ${event.type}${event.recipient ? ` ${event.recipient}` : ""}`);
1693
1693
  }
@@ -1813,7 +1813,7 @@ function oneId(positionals, command) {
1813
1813
  if (id === void 0 || extra.length > 0) throw new UsageError(`Pass one email id: \`coss ${command} email_…\`.`);
1814
1814
  return id;
1815
1815
  }
1816
- async function client$2(context) {
1816
+ async function client$3(context) {
1817
1817
  return clientFor(context.io, await resolveCredentials(context));
1818
1818
  }
1819
1819
  const emailsListCommand = defineCommand({
@@ -1885,15 +1885,15 @@ async function emailsList({ values, context }) {
1885
1885
  const now = io.now();
1886
1886
  const params = {
1887
1887
  ...values.to && { to: values.to },
1888
- ...values.status && { status: checked$1(list$1(values.status), EMAIL_STATUSES, "status") },
1889
- ...values["recipient-status"] && { recipient_status: checked$1(list$1(values["recipient-status"]), RECIPIENT_STATUSES, "recipient-status") },
1888
+ ...values.status && { status: checked$1(list$2(values.status), EMAIL_STATUSES, "status") },
1889
+ ...values["recipient-status"] && { recipient_status: checked$1(list$2(values["recipient-status"]), RECIPIENT_STATUSES, "recipient-status") },
1890
1890
  ...values.query && { q: values.query },
1891
1891
  ...values.category && { category: values.category },
1892
1892
  ...values.batch && { batch_id: values.batch },
1893
1893
  created_after: time$1(values.since, "since", now),
1894
1894
  created_before: time$1(values.until, "until", now)
1895
1895
  };
1896
- const coss = await client$2(context);
1896
+ const coss = await client$3(context);
1897
1897
  const emails = [];
1898
1898
  let after;
1899
1899
  while (emails.length < limit) {
@@ -1961,7 +1961,7 @@ async function emailsGet({ values, positionals, context }) {
1961
1961
  const { io, out } = context;
1962
1962
  const id = oneId(positionals, "emails get");
1963
1963
  if (values.text && values.html) throw new UsageError("Pass --text or --html, not both.");
1964
- const { data: email, error } = await (await client$2(context)).email.get(id, { signal: io.signal });
1964
+ const { data: email, error } = await (await client$3(context)).email.get(id, { signal: io.signal });
1965
1965
  if (io.signal.aborted) return 130;
1966
1966
  if (error) throw apiError("Couldn't read the email", error);
1967
1967
  if (out.json) {
@@ -1979,7 +1979,7 @@ async function emailsGet({ values, positionals, context }) {
1979
1979
  }
1980
1980
  function printEmail(out, email) {
1981
1981
  const status = deliveryStatus(email);
1982
- out.line(`${out.style("bold", email.id)} ${out.style(statusStyle$4(status), status)}${email.sandbox ? out.style("dim", " (sandbox)") : ""}`);
1982
+ out.line(`${out.style("bold", email.id)} ${out.style(statusStyle$5(status), status)}${email.sandbox ? out.style("dim", " (sandbox)") : ""}`);
1983
1983
  field$1(out, "From", email.from);
1984
1984
  field$1(out, "Subject", email.subject);
1985
1985
  field$1(out, "Reply-To", email.reply_to.join(", "));
@@ -1991,7 +1991,7 @@ function printEmail(out, email) {
1991
1991
  field$1(out, "Sent", email.sent_at);
1992
1992
  if (email.failure) out.line(` ${out.style("dim", "Failure".padEnd(11))}${out.style("red", email.failure.code)}: ${printable(email.failure.message)}`);
1993
1993
  out.line();
1994
- for (const recipient of email.recipients) out.line(` ${recipient.type.padEnd(4)}${printable(recipient.address)} ${out.style(statusStyle$4(recipient.status), recipient.status)}`);
1994
+ for (const recipient of email.recipients) out.line(` ${recipient.type.padEnd(4)}${printable(recipient.address)} ${out.style(statusStyle$5(recipient.status), recipient.status)}`);
1995
1995
  const tracking = email.tracking;
1996
1996
  if (tracking.opens || tracking.clicks) {
1997
1997
  out.line();
@@ -2016,7 +2016,7 @@ const emailsEventsCommand = defineCommand({
2016
2016
  run: async ({ positionals, context }) => {
2017
2017
  const { io, out } = context;
2018
2018
  const id = oneId(positionals, "emails events");
2019
- const { data, error } = await (await client$2(context)).email.listEvents(id, { signal: io.signal });
2019
+ const { data, error } = await (await client$3(context)).email.listEvents(id, { signal: io.signal });
2020
2020
  if (io.signal.aborted) return 130;
2021
2021
  if (error) throw apiError("Couldn't read the email's events", error);
2022
2022
  if (data.data.length === 0 && !out.json) out.info("No events yet.");
@@ -2074,7 +2074,7 @@ function steps(out, next, indent) {
2074
2074
  async function emailsDiagnose({ values, positionals, context }) {
2075
2075
  const { io, out } = context;
2076
2076
  if (values.to !== void 0 && positionals.length > 0) throw new UsageError("Pass an email id or --to, not both.");
2077
- const coss = await client$2(context);
2077
+ const coss = await client$3(context);
2078
2078
  let id;
2079
2079
  if (values.to !== void 0) {
2080
2080
  const { data, error } = await coss.email.list({
@@ -2108,7 +2108,7 @@ async function emailsDiagnose({ values, positionals, context }) {
2108
2108
  }
2109
2109
  for (const recipient of diagnosis.recipients) {
2110
2110
  out.line();
2111
- out.line(` ${printable(recipient.address)} ${out.style(statusStyle$4(recipient.outcome), recipient.outcome)}`);
2111
+ out.line(` ${printable(recipient.address)} ${out.style(statusStyle$5(recipient.outcome), recipient.outcome)}`);
2112
2112
  out.line(` ${recipient.explanation}`);
2113
2113
  if (recipient.details) details(out, recipient.details);
2114
2114
  steps(out, recipient.next_steps, " ");
@@ -2124,13 +2124,135 @@ async function emailsDiagnose({ values, positionals, context }) {
2124
2124
  return 0;
2125
2125
  }
2126
2126
  //#endregion
2127
+ //#region src/commands/forms.ts
2128
+ const STATUSES$1 = [
2129
+ "accepted",
2130
+ "held",
2131
+ "spam",
2132
+ "pending_confirmation"
2133
+ ];
2134
+ const LIMIT$4 = {
2135
+ type: "string",
2136
+ value: "<n>",
2137
+ description: "How many to show, 1-100 (default 20)"
2138
+ };
2139
+ async function formsClient(context) {
2140
+ return clientFor(context.io, await resolveCredentials(context));
2141
+ }
2142
+ function limitOf$3(value) {
2143
+ if (value === void 0) return void 0;
2144
+ const limit = Number(value);
2145
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new UsageError("--limit takes a number from 1 to 100.");
2146
+ return limit;
2147
+ }
2148
+ function when$3(iso) {
2149
+ return iso.slice(0, 16).replace("T", " ");
2150
+ }
2151
+ function statusStyle$3(status) {
2152
+ return status === "accepted" ? "green" : status === "spam" ? "red" : "yellow";
2153
+ }
2154
+ const FORMS_COMMANDS = [defineCommand({
2155
+ name: "forms list",
2156
+ summary: "List forms",
2157
+ description: "Lists the environment's forms, newest first, with the endpoint each posts to.",
2158
+ flags: {
2159
+ limit: LIMIT$4,
2160
+ json: {
2161
+ type: "boolean",
2162
+ description: "One form per line, as JSON"
2163
+ }
2164
+ },
2165
+ run: async ({ values, context }) => {
2166
+ const { data, error } = await (await formsClient(context)).forms.list({ ...values.limit !== void 0 && { limit: limitOf$3(values.limit) } });
2167
+ if (error) throw apiError("Couldn't list the forms", error);
2168
+ const { out } = context;
2169
+ if (out.json) {
2170
+ for (const item of data.data) out.data(item);
2171
+ return 0;
2172
+ }
2173
+ if (data.data.length === 0) {
2174
+ out.info("No forms.");
2175
+ return 0;
2176
+ }
2177
+ const lines = table([[
2178
+ "ID",
2179
+ "NAME",
2180
+ "ENABLED",
2181
+ "ENDPOINT"
2182
+ ], ...data.data.map((item) => [
2183
+ item.id,
2184
+ printable(item.name),
2185
+ item.enabled && !item.disabled_by_admin ? "yes" : out.style("yellow", "no"),
2186
+ item.endpoint
2187
+ ])]);
2188
+ out.line(out.style("dim", lines[0] ?? ""));
2189
+ for (const line of lines.slice(1)) out.line(line);
2190
+ return 0;
2191
+ }
2192
+ }), defineCommand({
2193
+ name: "forms submissions",
2194
+ summary: "List a form's submissions (--status held: Risk's review queue)",
2195
+ usage: "<form> [--status <status>]",
2196
+ description: "Lists a form's submissions, newest first. Their values are what someone typed into the form.",
2197
+ flags: {
2198
+ status: {
2199
+ type: "string",
2200
+ value: "<status>",
2201
+ choices: STATUSES$1,
2202
+ description: "Only this status: accepted, held, spam or pending_confirmation"
2203
+ },
2204
+ limit: LIMIT$4,
2205
+ json: {
2206
+ type: "boolean",
2207
+ description: "One submission per line, as JSON"
2208
+ }
2209
+ },
2210
+ positionals: true,
2211
+ run: async ({ values, positionals, context }) => {
2212
+ const [formId] = requireArgs(positionals, 1, "forms submissions <form>");
2213
+ const status = values.status;
2214
+ if (status !== void 0 && !STATUSES$1.includes(status)) throw new UsageError(`--status takes ${STATUSES$1.join(", ")}; got "${status}".`);
2215
+ const { data, error } = await (await formsClient(context)).forms.submissions.list(formId, {
2216
+ ...status !== void 0 && { status: [status] },
2217
+ ...values.limit !== void 0 && { limit: limitOf$3(values.limit) }
2218
+ });
2219
+ if (error) throw apiError("Couldn't list the submissions", error);
2220
+ const { out } = context;
2221
+ if (out.json) {
2222
+ for (const item of data.data) out.data(item);
2223
+ return 0;
2224
+ }
2225
+ if (data.data.length === 0) {
2226
+ out.info("No submissions.");
2227
+ return 0;
2228
+ }
2229
+ const lines = table([[
2230
+ "ID",
2231
+ "STATUS",
2232
+ "FROM",
2233
+ "FIELDS",
2234
+ "RECEIVED"
2235
+ ], ...data.data.map((item) => [
2236
+ item.id,
2237
+ out.style(statusStyle$3(item.status), item.status),
2238
+ printable(item.submitter_email ?? ""),
2239
+ printable(Object.keys(item.data).join(", ")),
2240
+ when$3(item.created_at)
2241
+ ])]);
2242
+ out.line(out.style("dim", lines[0] ?? ""));
2243
+ for (const line of lines.slice(1)) out.line(line);
2244
+ if (data.has_more) out.info(out.style("dim", `There are more: \`coss api forms/${formId}/submissions --paginate\` lists them all.`));
2245
+ return 0;
2246
+ }
2247
+ })];
2248
+ //#endregion
2127
2249
  //#region src/commands/hooks.ts
2128
2250
  const DELIVERY_STATUSES$1 = [
2129
2251
  "pending",
2130
2252
  "succeeded",
2131
2253
  "failed"
2132
2254
  ];
2133
- const LIMIT$2 = {
2255
+ const LIMIT$3 = {
2134
2256
  type: "string",
2135
2257
  value: "<n>",
2136
2258
  description: "How many to show, 1-100 (default 50)"
@@ -2138,14 +2260,14 @@ const LIMIT$2 = {
2138
2260
  async function hooksClient(context) {
2139
2261
  return clientFor(context.io, await resolveCredentials(context));
2140
2262
  }
2141
- function limitOf$1(value) {
2263
+ function limitOf$2(value) {
2142
2264
  if (value === void 0) return void 0;
2143
2265
  const limit = Number(value);
2144
2266
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new UsageError("--limit takes a number from 1 to 100.");
2145
2267
  return limit;
2146
2268
  }
2147
2269
  /** `2026-10-15 12:00` */
2148
- function when$1(iso) {
2270
+ function when$2(iso) {
2149
2271
  return iso ? iso.slice(0, 16).replace("T", " ") : "";
2150
2272
  }
2151
2273
  /** One JSON object per item with --json, else a table under its headings (or `empty`). */
@@ -2180,14 +2302,14 @@ const appsList = defineCommand({
2180
2302
  summary: "List the environment's Hooks applications",
2181
2303
  description: "Lists the environment's applications (one per customer of yours, each with its own endpoints and portal), newest first.",
2182
2304
  flags: {
2183
- limit: LIMIT$2,
2305
+ limit: LIMIT$3,
2184
2306
  json: {
2185
2307
  type: "boolean",
2186
2308
  description: "One application per line, as JSON"
2187
2309
  }
2188
2310
  },
2189
2311
  run: async ({ values, context }) => {
2190
- const { data, error } = await (await hooksClient(context)).hooks.applications.list({ limit: limitOf$1(values.limit) });
2312
+ const { data, error } = await (await hooksClient(context)).hooks.applications.list({ limit: limitOf$2(values.limit) });
2191
2313
  if (error) throw apiError("Couldn't list the applications", error);
2192
2314
  printList(context.out, data, {
2193
2315
  headings: [
@@ -2200,7 +2322,7 @@ const appsList = defineCommand({
2200
2322
  app.id,
2201
2323
  app.uid ?? "",
2202
2324
  app.name,
2203
- when$1(app.created_at)
2325
+ when$2(app.created_at)
2204
2326
  ],
2205
2327
  empty: "No applications yet: `coss hooks apps create <name>` adds one.",
2206
2328
  more: "There are more: `coss api hooks/applications --paginate` lists them all."
@@ -2255,7 +2377,7 @@ const eventTypesList = defineCommand({
2255
2377
  type: "boolean",
2256
2378
  description: "Also list archived types"
2257
2379
  },
2258
- limit: LIMIT$2,
2380
+ limit: LIMIT$3,
2259
2381
  json: {
2260
2382
  type: "boolean",
2261
2383
  description: "One event type per line, as JSON"
@@ -2263,7 +2385,7 @@ const eventTypesList = defineCommand({
2263
2385
  },
2264
2386
  run: async ({ values, context }) => {
2265
2387
  const { data, error } = await (await hooksClient(context)).hooks.eventTypes.list({
2266
- limit: limitOf$1(values.limit),
2388
+ limit: limitOf$2(values.limit),
2267
2389
  ...values.archived && { include_archived: true }
2268
2390
  });
2269
2391
  if (error) throw apiError("Couldn't list the event types", error);
@@ -2356,7 +2478,7 @@ const endpointsList = defineCommand({
2356
2478
  endpoint.id,
2357
2479
  endpoint.url,
2358
2480
  endpoint.filter_types.length > 0 ? endpoint.filter_types.join(",") : "all",
2359
- !endpoint.enabled ? out.style("red", `disabled (${endpoint.disabled_reason ?? "manual"})`) : endpoint.failing_since ? out.style("yellow", `failing since ${when$1(endpoint.failing_since)}`) : out.style("green", "enabled")
2481
+ !endpoint.enabled ? out.style("red", `disabled (${endpoint.disabled_reason ?? "manual"})`) : endpoint.failing_since ? out.style("yellow", `failing since ${when$2(endpoint.failing_since)}`) : out.style("green", "enabled")
2360
2482
  ],
2361
2483
  empty: `No endpoints: \`coss hooks endpoints add ${app} --url <url>\` adds one.`
2362
2484
  });
@@ -2404,7 +2526,7 @@ const endpointsAdd = defineCommand({
2404
2526
  rateLimit = Number(values["rate-limit"]);
2405
2527
  if (!Number.isInteger(rateLimit) || rateLimit < 1 || rateLimit > 1e3) throw new UsageError("--rate-limit takes a number from 1 to 1000.");
2406
2528
  }
2407
- const types = list$1(values.types);
2529
+ const types = list$2(values.types);
2408
2530
  const { data, error } = await (await hooksClient(context)).hooks.endpoints.create(app, {
2409
2531
  url: values.url,
2410
2532
  ...types.length > 0 && { filter_types: types },
@@ -2507,7 +2629,7 @@ const DELIVERIES_FLAGS$1 = {
2507
2629
  choices: DELIVERY_STATUSES$1,
2508
2630
  description: "pending, succeeded or failed"
2509
2631
  },
2510
- limit: LIMIT$2,
2632
+ limit: LIMIT$3,
2511
2633
  json: {
2512
2634
  type: "boolean",
2513
2635
  description: "One delivery per line, as JSON"
@@ -2570,7 +2692,7 @@ const HOOKS_COMMANDS = [
2570
2692
  endpoint: values.endpoint,
2571
2693
  message: values.message,
2572
2694
  status: values.status,
2573
- limit: limitOf$1(values.limit)
2695
+ limit: limitOf$2(values.limit)
2574
2696
  });
2575
2697
  const { out } = context;
2576
2698
  printList(out, page, {
@@ -2590,7 +2712,7 @@ const HOOKS_COMMANDS = [
2590
2712
  delivery.last_error ?? (delivery.last_status_code === null ? "" : String(delivery.last_status_code)),
2591
2713
  delivery.endpoint_id,
2592
2714
  delivery.message_id,
2593
- when$1(delivery.created_at)
2715
+ when$2(delivery.created_at)
2594
2716
  ],
2595
2717
  empty: "No deliveries.",
2596
2718
  more: "There are more: narrow with --endpoint, --message or --status, or raise --limit."
@@ -2616,7 +2738,7 @@ const HOOKS_COMMANDS = [
2616
2738
  if (list.error) throw apiError("Couldn't list the delivery's attempts", list.error);
2617
2739
  const { out } = context;
2618
2740
  if (!out.json) {
2619
- const next = delivery.data.next_attempt_at ? `, next attempt ${when$1(delivery.data.next_attempt_at)}` : "";
2741
+ const next = delivery.data.next_attempt_at ? `, next attempt ${when$2(delivery.data.next_attempt_at)}` : "";
2620
2742
  out.line(`${delivery.data.id} ${out.style(statusStyle$2(delivery.data.status), delivery.data.status)} → ${delivery.data.endpoint_id}${out.style("dim", `${next}`)}`);
2621
2743
  }
2622
2744
  printList(out, list.data, {
@@ -2627,7 +2749,7 @@ const HOOKS_COMMANDS = [
2627
2749
  "RESPONSE"
2628
2750
  ],
2629
2751
  row: (attempt) => [
2630
- when$1(attempt.attempted_at),
2752
+ when$2(attempt.attempted_at),
2631
2753
  attempt.status_code === null ? out.style("red", printable(attempt.error ?? "no response")) : out.style(attempt.status_code < 300 ? "green" : "red", String(attempt.status_code)),
2632
2754
  `${attempt.duration_ms}ms`,
2633
2755
  printable(attempt.response_excerpt ?? "").replace(/\s+/g, " ").slice(0, 80)
@@ -2699,7 +2821,7 @@ const HOOKS_COMMANDS = [
2699
2821
  if (out.json) out.data(data);
2700
2822
  else {
2701
2823
  out.line(data.url);
2702
- out.info(out.style("dim", `Works until ${when$1(data.expires_at)} UTC${data.read_only ? ", read-only" : ""}.`));
2824
+ out.info(out.style("dim", `Works until ${when$2(data.expires_at)} UTC${data.read_only ? ", read-only" : ""}.`));
2703
2825
  }
2704
2826
  if (values.open && !await io.openBrowser(data.url)) throw new CliError("Couldn't open a browser: open the link above yourself.");
2705
2827
  return 0;
@@ -2927,12 +3049,12 @@ async function inboxGet({ values, positionals, context }) {
2927
3049
  }
2928
3050
  //#endregion
2929
3051
  //#region src/commands/inboxes.ts
2930
- const LIMIT$1 = {
3052
+ const LIMIT$2 = {
2931
3053
  type: "string",
2932
3054
  value: "<n>",
2933
3055
  description: "How many to show, 1-100 (default 20)"
2934
3056
  };
2935
- async function client$1(context) {
3057
+ async function client$2(context) {
2936
3058
  return clientFor(context.io, await resolveCredentials(context));
2937
3059
  }
2938
3060
  const list = defineCommand({
@@ -2940,14 +3062,14 @@ const list = defineCommand({
2940
3062
  summary: "List the environment's inboxes",
2941
3063
  description: "Lists the environment's inboxes (addresses for agents), newest first.",
2942
3064
  flags: {
2943
- limit: LIMIT$1,
3065
+ limit: LIMIT$2,
2944
3066
  json: {
2945
3067
  type: "boolean",
2946
3068
  description: "One inbox per line, as JSON"
2947
3069
  }
2948
3070
  },
2949
3071
  run: async ({ values, context }) => {
2950
- const { data, error } = await (await client$1(context)).inboxes.list({ limit: limitOf$1(values.limit) });
3072
+ const { data, error } = await (await client$2(context)).inboxes.list({ limit: limitOf$2(values.limit) });
2951
3073
  if (error) throw apiError("Couldn't list the inboxes", error);
2952
3074
  printList(context.out, data, {
2953
3075
  headings: [
@@ -2962,7 +3084,7 @@ const list = defineCommand({
2962
3084
  inbox.address,
2963
3085
  inbox.display_name ?? "",
2964
3086
  inbox.can_send ? "yes" : "no",
2965
- when$1(inbox.created_at)
3087
+ when$2(inbox.created_at)
2966
3088
  ],
2967
3089
  empty: "No inboxes yet: `coss inboxes create` makes one.",
2968
3090
  more: "There are more: `coss api inboxes --paginate` lists them all."
@@ -3001,7 +3123,7 @@ const create = defineCommand({
3001
3123
  }
3002
3124
  },
3003
3125
  run: async ({ values, context }) => {
3004
- const { data, error } = await (await client$1(context)).inboxes.create({
3126
+ const { data, error } = await (await client$2(context)).inboxes.create({
3005
3127
  ...values.username !== void 0 && { username: values.username },
3006
3128
  ...values.domain !== void 0 && { domain: values.domain },
3007
3129
  ...values.name !== void 0 && { display_name: values.name },
@@ -3023,7 +3145,7 @@ const threads = defineCommand({
3023
3145
  usage: "<inbox> [options]",
3024
3146
  description: "Lists the inbox's threads, latest activity first; ● marks one whose latest message is inbound (it awaits a reply).",
3025
3147
  flags: {
3026
- limit: LIMIT$1,
3148
+ limit: LIMIT$2,
3027
3149
  json: {
3028
3150
  type: "boolean",
3029
3151
  description: "One thread per line, as JSON"
@@ -3032,7 +3154,7 @@ const threads = defineCommand({
3032
3154
  positionals: true,
3033
3155
  run: async ({ values, positionals, context }) => {
3034
3156
  const [inboxId] = requireArgs(positionals, 1, "inboxes threads <inbox>");
3035
- const { data, error } = await (await client$1(context)).inboxes.threads.list(inboxId, { limit: limitOf$1(values.limit) });
3157
+ const { data, error } = await (await client$2(context)).inboxes.threads.list(inboxId, { limit: limitOf$2(values.limit) });
3036
3158
  if (error) throw apiError("Couldn't list the threads", error);
3037
3159
  printList(context.out, data, {
3038
3160
  headings: [
@@ -3049,7 +3171,7 @@ const threads = defineCommand({
3049
3171
  printable(thread.subject ?? "(no subject)"),
3050
3172
  printable(thread.participants.join(", ")),
3051
3173
  String(thread.message_count),
3052
- when$1(thread.last_message_at)
3174
+ when$2(thread.last_message_at)
3053
3175
  ],
3054
3176
  empty: "No conversations yet.",
3055
3177
  more: "There are more: raise --limit, or `coss api inboxes/<inbox>/threads --paginate`."
@@ -3059,7 +3181,7 @@ const threads = defineCommand({
3059
3181
  });
3060
3182
  function printMessage(out, message, full) {
3061
3183
  const arrow = message.direction === "inbound" ? out.style("cyan", "←") : out.style("green", "→");
3062
- out.line(`${arrow} ${out.style("bold", printable(message.from ?? "(unknown sender)"))} ${out.style("dim", `${when$1(message.created_at)} ${message.id}`)}`);
3184
+ out.line(`${arrow} ${out.style("bold", printable(message.from ?? "(unknown sender)"))} ${out.style("dim", `${when$2(message.created_at)} ${message.id}`)}`);
3063
3185
  if (message.direction === "outbound") out.line(` ${out.style("dim", `to ${printable(message.to.join(", "))} · ${message.status}`)}`);
3064
3186
  for (const attachment of message.attachments) out.line(` ${out.style("dim", `📎 ${printable(attachment.filename ?? "(unnamed)")}`)}`);
3065
3187
  const text = full ? message.text : message.extracted_text;
@@ -3089,7 +3211,7 @@ const INBOXES_COMMANDS = [
3089
3211
  positionals: true,
3090
3212
  run: async ({ values, positionals, context }) => {
3091
3213
  const [inboxId, threadId] = requireArgs(positionals, 2, "inboxes thread <inbox> <thread>");
3092
- const { data, error } = await (await client$1(context)).inboxes.threads.get(inboxId, threadId);
3214
+ const { data, error } = await (await client$2(context)).inboxes.threads.get(inboxId, threadId);
3093
3215
  if (error) throw apiError("Couldn't read the thread", error);
3094
3216
  const { out } = context;
3095
3217
  if (out.json) {
@@ -3127,7 +3249,7 @@ const INBOXES_COMMANDS = [
3127
3249
  run: async ({ values, positionals, context }) => {
3128
3250
  const [inboxId, messageId] = requireArgs(positionals, 2, "inboxes reply <inbox> <message> --text <text>");
3129
3251
  if (!values.text) throw new UsageError("Pass the reply with --text <text>.");
3130
- const { data, error } = await (await client$1(context)).inboxes.messages.reply(inboxId, messageId, {
3252
+ const { data, error } = await (await client$2(context)).inboxes.messages.reply(inboxId, messageId, {
3131
3253
  text: values.text,
3132
3254
  ...values.all && { reply_all: true }
3133
3255
  });
@@ -3802,7 +3924,7 @@ async function ignoredByGit(io, dir, file) {
3802
3924
  //#endregion
3803
3925
  //#region src/version.ts
3804
3926
  /** The package version (`coss --version`, the forwarded requests' user agent). */
3805
- const VERSION = "0.5.0";
3927
+ const VERSION = "0.6.0";
3806
3928
  //#endregion
3807
3929
  //#region src/listen/forward.ts
3808
3930
  /** Posting an event to the local URL, as coss.com would post it to an endpoint. */
@@ -3840,8 +3962,22 @@ function describe(error) {
3840
3962
  if (error?.name === "AbortError") return "interrupted";
3841
3963
  return error instanceof Error ? error.message : String(error);
3842
3964
  }
3965
+ const TRACEPARENT = /^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/;
3966
+ /**
3967
+ * The `traceparent` coss.com's own delivery sends for this event (its `data.traceparent`: an email
3968
+ * or text message sent with one), so a forwarded event continues the sender's trace the same way.
3969
+ */
3970
+ function traceparentOf(body) {
3971
+ try {
3972
+ const value = JSON.parse(body)?.data?.traceparent;
3973
+ return typeof value === "string" && TRACEPARENT.test(value) ? value : null;
3974
+ } catch {
3975
+ return null;
3976
+ }
3977
+ }
3843
3978
  async function forwardEvent(io, input) {
3844
3979
  const timestamp = Math.floor(io.now().getTime() / 1e3);
3980
+ const traceparent = traceparentOf(input.body);
3845
3981
  const started = performance.now();
3846
3982
  try {
3847
3983
  const response = await io.fetch(input.url, {
@@ -3849,6 +3985,7 @@ async function forwardEvent(io, input) {
3849
3985
  headers: [
3850
3986
  ["content-type", "application/json"],
3851
3987
  ["user-agent", `coss-cli/${VERSION} (coss listen)`],
3988
+ ...traceparent ? [["traceparent", traceparent]] : [],
3852
3989
  ...input.headers,
3853
3990
  ...Object.entries(signatureHeaders({
3854
3991
  secret: input.secret,
@@ -3955,7 +4092,7 @@ async function run$1(context, values) {
3955
4092
  const { io, out } = context;
3956
4093
  const target = typeof values["forward-to"] === "string" ? normalizeTarget(values["forward-to"]) : null;
3957
4094
  const headers = (values.header ?? []).map(parseHeader);
3958
- const eventTypes = list$1(values.events);
4095
+ const eventTypes = list$2(values.events);
3959
4096
  const credentials = await resolveCredentials(context);
3960
4097
  const coss = clientFor(io, credentials, {
3961
4098
  timeout: CLIENT_TIMEOUT_MS,
@@ -4224,13 +4361,13 @@ const logsTailCommand = defineCommand({
4224
4361
  });
4225
4362
  async function logsTail({ values, context }) {
4226
4363
  const { io, out } = context;
4227
- const sources = checked(list$1(values.source), SOURCES, "source");
4228
- const levels = checked(list$1(values.level), LEVELS, "level");
4364
+ const sources = checked(list$2(values.source), SOURCES, "source");
4365
+ const levels = checked(list$2(values.level), LEVELS, "level");
4229
4366
  const filters = {
4230
4367
  ...sources.length > 0 && { source: sources },
4231
4368
  ...levels.length > 0 && { level: levels },
4232
- ...values.type && { type: list$1(values.type) },
4233
- ...values.status && { status: list$1(values.status) },
4369
+ ...values.type && { type: list$2(values.type) },
4370
+ ...values.status && { status: list$2(values.status) },
4234
4371
  ...values.query && { q: values.query }
4235
4372
  };
4236
4373
  const intervalMs = values.interval === void 0 ? 2e3 : Number(values.interval);
@@ -4280,37 +4417,48 @@ async function logsTail({ values, context }) {
4280
4417
  //#endregion
4281
4418
  //#region src/commands/open.ts
4282
4419
  /**
4283
- * Dashboard pages by name: the environment's (under `/<org>/projects/<project>/<env>`) and the
4284
- * organization's (under `/<org>`), as in `apps/web/src/lib/navigation.ts`.
4420
+ * Dashboard pages by name: the environment's (under `/<org>/<project>/<env>`) and the
4421
+ * organization's (under `/<org>/settings`), as in `@coss/dashboard-routes`.
4285
4422
  */
4286
4423
  const ENVIRONMENT_PAGES = {
4287
4424
  overview: "",
4288
- emails: "/emails",
4289
- templates: "/templates",
4290
- received: "/received",
4291
- suppressions: "/suppressions",
4292
- tracking: "/tracking",
4293
- broadcasts: "/broadcasts",
4294
- contacts: "/contacts",
4295
- audiences: "/audiences",
4296
- segments: "/segments",
4297
- topics: "/topics",
4298
- marketing: "/marketing",
4299
- risk: "/risk",
4425
+ home: "",
4426
+ products: "/products",
4427
+ email: "/email",
4428
+ emails: "/email/messages",
4429
+ templates: "/email/templates",
4430
+ received: "/email/received",
4431
+ suppressions: "/email/suppressions",
4432
+ subaccounts: "/email/subaccounts",
4433
+ tracking: "/email/tracking",
4434
+ domains: "/email/domains",
4435
+ "dedicated-ips": "/email/dedicated-ips",
4436
+ reputation: "/email/reputation",
4437
+ broadcasts: "/marketing",
4438
+ contacts: "/marketing/contacts",
4439
+ audiences: "/marketing/audiences",
4440
+ segments: "/marketing/segments",
4441
+ topics: "/marketing/topics",
4442
+ marketing: "/marketing/settings",
4443
+ inboxes: "/inboxes",
4444
+ sms: "/sms",
4445
+ verify: "/verify",
4446
+ sign: "/sign",
4447
+ forms: "/forms",
4300
4448
  hooks: "/hooks",
4301
- "api-keys": "/api-keys",
4302
- webhooks: "/webhooks",
4303
- logs: "/logs",
4304
- "log-drains": "/log-drains"
4449
+ risk: "/risk",
4450
+ developers: "/developers",
4451
+ "api-keys": "/developers/api-keys",
4452
+ webhooks: "/developers/webhooks",
4453
+ logs: "/developers/logs",
4454
+ "log-drains": "/developers/log-drains"
4305
4455
  };
4306
4456
  const ORGANIZATION_PAGES = {
4307
- projects: "",
4308
- domains: "/domains",
4309
- "dedicated-ips": "/dedicated-ips",
4310
- members: "/members",
4311
- reputation: "/reputation",
4312
4457
  settings: "/settings",
4458
+ projects: "/settings/projects",
4459
+ members: "/settings/members",
4313
4460
  billing: "/settings/billing",
4461
+ spend: "/settings/spend",
4314
4462
  "audit-log": "/settings/audit"
4315
4463
  };
4316
4464
  const PAGES = [...Object.keys(ENVIRONMENT_PAGES), ...Object.keys(ORGANIZATION_PAGES)];
@@ -4319,7 +4467,7 @@ function dashboardPageUrl(dashboardUrl, slugs, page) {
4319
4467
  const org = `${dashboardUrl}/${encodeURIComponent(slugs.organization)}`;
4320
4468
  const organizationPage = ORGANIZATION_PAGES[page];
4321
4469
  if (organizationPage !== void 0) return `${org}${organizationPage}`;
4322
- return `${`${org}/projects/${encodeURIComponent(slugs.project)}/${encodeURIComponent(slugs.environment)}`}${ENVIRONMENT_PAGES[page] ?? ""}`;
4470
+ return `${`${org}/${encodeURIComponent(slugs.project)}/${encodeURIComponent(slugs.environment)}`}${ENVIRONMENT_PAGES[page] ?? ""}`;
4323
4471
  }
4324
4472
  /**
4325
4473
  * The environment's slugs, asked of the API (slugs can be renamed since login), or else the ones
@@ -4491,7 +4639,7 @@ const ENTRY_TYPES = [
4491
4639
  "country",
4492
4640
  "user"
4493
4641
  ];
4494
- const LIMIT = {
4642
+ const LIMIT$1 = {
4495
4643
  type: "string",
4496
4644
  value: "<n>",
4497
4645
  description: "How many to show, 1-100 (default 50)"
@@ -4504,13 +4652,13 @@ function oneOf(value, allowed, flag) {
4504
4652
  if (!allowed.includes(value)) throw new UsageError(`${flag} takes ${allowed.join(", ")}; got "${value}".`);
4505
4653
  return value;
4506
4654
  }
4507
- function limitOf(value) {
4655
+ function limitOf$1(value) {
4508
4656
  if (value === void 0) return void 0;
4509
4657
  const limit = Number(value);
4510
4658
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new UsageError("--limit takes a number from 1 to 100.");
4511
4659
  return limit;
4512
4660
  }
4513
- function when(iso) {
4661
+ function when$1(iso) {
4514
4662
  return iso ? iso.slice(0, 16).replace("T", " ") : "";
4515
4663
  }
4516
4664
  function decisionStyle(decision) {
@@ -4655,7 +4803,7 @@ const assessments = defineCommand({
4655
4803
  choices: ["open", "resolved"],
4656
4804
  description: "open (the review queue: reviews without feedback yet) or resolved"
4657
4805
  },
4658
- limit: LIMIT,
4806
+ limit: LIMIT$1,
4659
4807
  json: {
4660
4808
  type: "boolean",
4661
4809
  description: "One assessment per line, as JSON"
@@ -4670,7 +4818,7 @@ const assessments = defineCommand({
4670
4818
  ...event && { event },
4671
4819
  ...review && { review_status: review },
4672
4820
  ...values.user !== void 0 && { user_id: values.user },
4673
- ...values.limit !== void 0 && { limit: limitOf(values.limit) }
4821
+ ...values.limit !== void 0 && { limit: limitOf$1(values.limit) }
4674
4822
  });
4675
4823
  if (error) throw apiError("Couldn't list the assessments", error);
4676
4824
  const { out } = context;
@@ -4697,7 +4845,7 @@ const assessments = defineCommand({
4697
4845
  item.score.toFixed(2),
4698
4846
  printable(item.user.email ?? item.user.id ?? ""),
4699
4847
  item.outcome ?? (item.review_status === "open" ? out.style("yellow", "to review") : ""),
4700
- when(item.created_at)
4848
+ when$1(item.created_at)
4701
4849
  ])]);
4702
4850
  out.line(out.style("dim", lines[0] ?? ""));
4703
4851
  for (const line of lines.slice(1)) out.line(line);
@@ -4760,7 +4908,7 @@ const listsList = defineCommand({
4760
4908
  choices: ENTRY_TYPES,
4761
4909
  description: "email, domain, ip, asn, country or user"
4762
4910
  },
4763
- limit: LIMIT,
4911
+ limit: LIMIT$1,
4764
4912
  json: {
4765
4913
  type: "boolean",
4766
4914
  description: "One entry per line, as JSON"
@@ -4772,7 +4920,7 @@ const listsList = defineCommand({
4772
4920
  const { data, error } = await (await riskClient(context)).risk.lists.list({
4773
4921
  ...listName && { list: listName },
4774
4922
  ...type && { type },
4775
- ...values.limit !== void 0 && { limit: limitOf(values.limit) }
4923
+ ...values.limit !== void 0 && { limit: limitOf$1(values.limit) }
4776
4924
  });
4777
4925
  if (error) throw apiError("Couldn't list the entries", error);
4778
4926
  const { out } = context;
@@ -4796,7 +4944,7 @@ const listsList = defineCommand({
4796
4944
  out.style(entry.list === "allow" ? "green" : "red", entry.list),
4797
4945
  entry.type,
4798
4946
  printable(entry.value),
4799
- when(entry.expires_at),
4947
+ when$1(entry.expires_at),
4800
4948
  printable(entry.note ?? "")
4801
4949
  ])]);
4802
4950
  out.line(out.style("dim", lines[0] ?? ""));
@@ -4885,6 +5033,126 @@ const RISK_COMMANDS = [
4885
5033
  })
4886
5034
  ];
4887
5035
  //#endregion
5036
+ //#region src/commands/scheduling.ts
5037
+ const STATUSES = [
5038
+ "held",
5039
+ "pending_approval",
5040
+ "confirmed",
5041
+ "cancelled",
5042
+ "declined"
5043
+ ];
5044
+ const LIMIT = {
5045
+ type: "string",
5046
+ value: "<n>",
5047
+ description: "How many to show, 1-100 (default 20)"
5048
+ };
5049
+ async function client$1(context) {
5050
+ return clientFor(context.io, await resolveCredentials(context));
5051
+ }
5052
+ function limitOf(value) {
5053
+ if (value === void 0) return void 0;
5054
+ const limit = Number(value);
5055
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new UsageError("--limit takes a number from 1 to 100.");
5056
+ return limit;
5057
+ }
5058
+ const when = (iso) => iso.slice(0, 16).replace("T", " ");
5059
+ const SCHEDULING_COMMANDS = [defineCommand({
5060
+ name: "scheduling hosts",
5061
+ summary: "List the people who can be booked",
5062
+ description: "Lists the environment's scheduling hosts, newest first.",
5063
+ flags: {
5064
+ limit: LIMIT,
5065
+ json: {
5066
+ type: "boolean",
5067
+ description: "One host per line, as JSON"
5068
+ }
5069
+ },
5070
+ run: async ({ values, context }) => {
5071
+ const { data, error } = await (await client$1(context)).scheduling.hosts.list({ ...values.limit !== void 0 && { limit: limitOf(values.limit) } });
5072
+ if (error) throw apiError("Couldn't list the hosts", error);
5073
+ const { out } = context;
5074
+ if (out.json) {
5075
+ for (const item of data.data) out.data(item);
5076
+ return 0;
5077
+ }
5078
+ if (data.data.length === 0) {
5079
+ out.info("No hosts.");
5080
+ return 0;
5081
+ }
5082
+ const lines = table([[
5083
+ "ID",
5084
+ "UID",
5085
+ "NAME",
5086
+ "TIME ZONE",
5087
+ "STATUS"
5088
+ ], ...data.data.map((item) => [
5089
+ item.id,
5090
+ printable(item.uid ?? ""),
5091
+ printable(item.name),
5092
+ item.time_zone,
5093
+ item.status === "active" ? item.status : out.style("yellow", item.status)
5094
+ ])]);
5095
+ out.line(out.style("dim", lines[0] ?? ""));
5096
+ for (const line of lines.slice(1)) out.line(line);
5097
+ return 0;
5098
+ }
5099
+ }), defineCommand({
5100
+ name: "scheduling bookings",
5101
+ summary: "List bookings",
5102
+ description: "Lists the environment's bookings, newest first.",
5103
+ flags: {
5104
+ host: {
5105
+ type: "string",
5106
+ value: "<host>",
5107
+ description: "Only this host (id or uid)"
5108
+ },
5109
+ status: {
5110
+ type: "string",
5111
+ value: "<status>",
5112
+ choices: STATUSES,
5113
+ description: "Only this status: held, pending_approval, confirmed, cancelled or declined"
5114
+ },
5115
+ limit: LIMIT,
5116
+ json: {
5117
+ type: "boolean",
5118
+ description: "One booking per line, as JSON"
5119
+ }
5120
+ },
5121
+ run: async ({ values, context }) => {
5122
+ const status = values.status;
5123
+ if (status !== void 0 && !STATUSES.includes(status)) throw new UsageError(`--status takes ${STATUSES.join(", ")}; got "${status}".`);
5124
+ const { data, error } = await (await client$1(context)).scheduling.bookings.list({
5125
+ ...values.host !== void 0 && { host: values.host },
5126
+ ...status !== void 0 && { status },
5127
+ ...values.limit !== void 0 && { limit: limitOf(values.limit) }
5128
+ });
5129
+ if (error) throw apiError("Couldn't list the bookings", error);
5130
+ const { out } = context;
5131
+ if (out.json) {
5132
+ for (const item of data.data) out.data(item);
5133
+ return 0;
5134
+ }
5135
+ if (data.data.length === 0) {
5136
+ out.info("No bookings.");
5137
+ return 0;
5138
+ }
5139
+ const lines = table([[
5140
+ "ID",
5141
+ "START",
5142
+ "TITLE",
5143
+ "STATUS"
5144
+ ], ...data.data.map((item) => [
5145
+ item.id,
5146
+ when(item.start),
5147
+ printable(item.title),
5148
+ item.status === "confirmed" ? out.style("green", item.status) : out.style("yellow", item.status)
5149
+ ])]);
5150
+ out.line(out.style("dim", lines[0] ?? ""));
5151
+ for (const line of lines.slice(1)) out.line(line);
5152
+ return 0;
5153
+ }
5154
+ })];
5155
+ //#endregion
4888
5156
  //#region src/sms/simulate.ts
4889
5157
  /**
4890
5158
  * The SMS simulator: numbers whose outcome is known in advance in sandbox environments (coss.com's
@@ -5864,7 +6132,7 @@ async function addEndpoint({ values, positionals, context }) {
5864
6132
  const { io, out } = context;
5865
6133
  const [url] = requireArgs(positionals, 1, "webhooks add <url>");
5866
6134
  if (url === void 0 || !/^https?:\/\//i.test(url)) throw new UsageError("Pass an http(s) URL: `coss webhooks add https://example.com/webhooks`.");
5867
- const events = list$1(values.events);
6135
+ const events = list$2(values.events);
5868
6136
  const unknown = events.filter((type) => !WEBHOOK_EVENT_TYPES.includes(type));
5869
6137
  if (unknown.length > 0) throw new UsageError(`Unknown event type ${unknown.map((type) => `"${type}"`).join(", ")}. See https://coss.com/docs/webhooks.`);
5870
6138
  const coss = clientFor(io, await resolveCredentials(context));
@@ -6064,6 +6332,8 @@ const COMMANDS = [
6064
6332
  webhooksRetryCommand,
6065
6333
  ...HOOKS_COMMANDS,
6066
6334
  ...RISK_COMMANDS,
6335
+ ...FORMS_COMMANDS,
6336
+ ...SCHEDULING_COMMANDS,
6067
6337
  domainsListCommand,
6068
6338
  domainsAddCommand,
6069
6339
  domainsGetCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coss-cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "The coss.com command line: sign in, send test emails and text messages, tail your environment's log, and forward webhook events to localhost with `coss listen`.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://coss.com/docs/cli",
@@ -43,7 +43,7 @@
43
43
  "test": "bun test"
44
44
  },
45
45
  "dependencies": {
46
- "coss": "^0.10.0"
46
+ "coss": "^0.11.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@arethetypeswrong/core": "0.18.5",