openmates 0.12.0-alpha.0 → 0.12.0-alpha.1

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.
@@ -42933,6 +42933,30 @@ function printSkillResult(app, skill, raw) {
42933
42933
  const items = group.results;
42934
42934
  if (Array.isArray(items)) totalItems += items.length;
42935
42935
  }
42936
+ if (totalItems === 0) {
42937
+ header(
42938
+ `${capitalise(app)} \u203A ${capitalise(skill)} \x1B[2m(${credits !== null ? `${credits} credits` : "no results"})\x1B[0m
42939
+ `
42940
+ );
42941
+ console.log("No results found.");
42942
+ const topLevelReason = str2(data.no_result_reason) ?? str2(data.error);
42943
+ if (topLevelReason) kv("reason", topLevelReason, 12);
42944
+ for (const group of topResults) {
42945
+ const reason = str2(group.no_result_reason) ?? str2(group.error);
42946
+ if (reason) kv("reason", reason, 12);
42947
+ const groupSuggestions = group.suggestions;
42948
+ if (Array.isArray(groupSuggestions) && groupSuggestions.length > 0) {
42949
+ kv("try", groupSuggestions.map((value) => String(value)).join(" \xB7 "), 12);
42950
+ }
42951
+ }
42952
+ const responseSuggestions = data.suggestions_follow_up_requests;
42953
+ if (Array.isArray(responseSuggestions) && responseSuggestions.length > 0) {
42954
+ kv("try", responseSuggestions.map((value) => String(value)).join(" \xB7 "), 12);
42955
+ }
42956
+ const provider = str2(data.provider);
42957
+ if (provider) console.log(`\x1B[2mProvider: ${provider}\x1B[0m`);
42958
+ return;
42959
+ }
42936
42960
  if (totalItems > 0) {
42937
42961
  header(
42938
42962
  `${capitalise(app)} \u203A ${capitalise(skill)} \x1B[2m(${totalItems} result${totalItems !== 1 ? "s" : ""}${credits !== null ? `, ${credits} credits` : ""})\x1B[0m
@@ -43003,13 +43027,10 @@ function printSkillResultItem(item, num, total) {
43003
43027
  if (dur) parts.push(`(${dur})`);
43004
43028
  console.log(` ${parts.join(" ")}`);
43005
43029
  }
43006
- printGenericObject(item, 1);
43007
43030
  if (typeof item.booking_token === "string") {
43008
- const token = item.booking_token;
43009
- const ctxFlag = item.booking_context && typeof item.booking_context === "object" ? ` --context '${JSON.stringify(item.booking_context)}'` : "";
43010
43031
  console.log(`\x1B[2m \u2192 Get booking URL (25 credits):\x1B[0m`);
43011
43032
  console.log(
43012
- `\x1B[2m openmates apps travel booking-link --token "${token}"${ctxFlag}\x1B[0m`
43033
+ `\x1B[2m rerun with --json to copy booking_token, then use openmates apps travel booking-link\x1B[0m`
43013
43034
  );
43014
43035
  }
43015
43036
  console.log("");
@@ -43023,7 +43044,38 @@ function printSkillResultItem(item, num, total) {
43023
43044
  if (rating) summary.push(`\u2605 ${rating}`);
43024
43045
  if (price) summary.push(price);
43025
43046
  console.log(`${numLabel}\x1B[1m${name}\x1B[0m ${summary.join(" \xB7 ")}`);
43026
- printGenericObject(item, 1);
43047
+ const amenities = Array.isArray(item.amenities) ? item.amenities.map((value) => String(value)).slice(0, 6) : [];
43048
+ if (amenities.length > 0) kv("amenities", amenities.join(", "), 14);
43049
+ const reviews = item.reviews;
43050
+ if (reviews !== void 0 && reviews !== null) kv("reviews", String(reviews), 14);
43051
+ const link = str2(item.link) ?? str2(item.url);
43052
+ if (link) kv("url", link, 14);
43053
+ console.log("");
43054
+ return;
43055
+ }
43056
+ if (itemType === "event_result") {
43057
+ const title2 = str2(item.title) ?? str2(item.name) ?? "Untitled event";
43058
+ const provider = str2(item.provider);
43059
+ const start = str2(item.date_start);
43060
+ const end = str2(item.date_end);
43061
+ const venue = item.venue;
43062
+ const venueName = venue && typeof venue === "object" ? str2(venue.name) : null;
43063
+ const city = venue && typeof venue === "object" ? str2(venue.city) : null;
43064
+ const price = formatEventPrice(item);
43065
+ const summary = [provider, price].filter(Boolean).join(" \xB7 ");
43066
+ console.log(`${numLabel}\x1B[1m${title2}\x1B[0m${summary ? ` ${summary}` : ""}`);
43067
+ if (start || end) {
43068
+ console.log(` ${[start, end ? `\u2192 ${end}` : null].filter(Boolean).join(" ")}`);
43069
+ }
43070
+ if (venueName || city) kv("venue", [venueName, city].filter(Boolean).join(", "), 14);
43071
+ const constraints = item.constraint_matches;
43072
+ if (constraints && typeof constraints === "object") {
43073
+ for (const [key, value] of Object.entries(constraints)) {
43074
+ if (value !== void 0 && value !== null && value !== "") kv(key, String(value), 14);
43075
+ }
43076
+ }
43077
+ const url = str2(item.url);
43078
+ if (url) kv("url", url, 14);
43027
43079
  console.log("");
43028
43080
  return;
43029
43081
  }
@@ -43049,6 +43101,19 @@ function printSkillResultItem(item, num, total) {
43049
43101
  }
43050
43102
  console.log("");
43051
43103
  }
43104
+ function formatEventPrice(item) {
43105
+ const fee = item.fee;
43106
+ if (fee && typeof fee === "object") {
43107
+ const feeRecord = fee;
43108
+ const amount = str2(feeRecord.amount) ?? str2(feeRecord.display) ?? str2(feeRecord.min);
43109
+ const currency = str2(feeRecord.currency);
43110
+ if (amount) return currency && !amount.includes(currency) ? `${amount} ${currency}` : amount;
43111
+ }
43112
+ const price = str2(item.price);
43113
+ if (price) return price;
43114
+ if (item.is_paid === false) return "free";
43115
+ return null;
43116
+ }
43052
43117
  function printWhoAmI(user) {
43053
43118
  header("Account\n");
43054
43119
  const show = (k, label) => {
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-JJYSEKOE.js";
5
+ } from "./chunk-GJPN6PKK.js";
6
6
  import "./chunk-AXNRPVLE.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getExtForLang,
8
8
  parseNewChatSuggestionText,
9
9
  serializeToYaml
10
- } from "./chunk-JJYSEKOE.js";
10
+ } from "./chunk-GJPN6PKK.js";
11
11
  import "./chunk-AXNRPVLE.js";
12
12
  export {
13
13
  MATE_NAMES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.12.0-alpha.0",
3
+ "version": "0.12.0-alpha.1",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",