openmates 0.9.0-alpha.6 → 0.9.0-alpha.8
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/{chunk-S6QOFKWN.js → chunk-5JRPF2IM.js} +14 -2
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1687,6 +1687,7 @@ var MATE_NAMES = {
|
|
|
1687
1687
|
onboarding_support: "Suki"
|
|
1688
1688
|
};
|
|
1689
1689
|
var DEFAULT_API_URL = process.env.OPENMATES_API_URL ?? "https://api.openmates.org";
|
|
1690
|
+
var SETTINGS_GET_RATE_LIMIT_RETRY_MS = 61e3;
|
|
1690
1691
|
function deriveAppUrl(apiUrl) {
|
|
1691
1692
|
if (process.env.OPENMATES_APP_URL) {
|
|
1692
1693
|
return process.env.OPENMATES_APP_URL.replace(/\/$/, "");
|
|
@@ -2617,10 +2618,18 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
2617
2618
|
async settingsGet(path) {
|
|
2618
2619
|
this.requireSession();
|
|
2619
2620
|
const normalizedPath = this.normalizePath(path);
|
|
2620
|
-
|
|
2621
|
+
let response = await this.http.get(
|
|
2621
2622
|
normalizedPath,
|
|
2622
2623
|
this.getCliRequestHeaders()
|
|
2623
2624
|
);
|
|
2625
|
+
if (response.status === 429) {
|
|
2626
|
+
process.stderr.write(
|
|
2627
|
+
`Rate limited by settings API; retrying in ${Math.ceil(SETTINGS_GET_RATE_LIMIT_RETRY_MS / 1e3)}s...
|
|
2628
|
+
`
|
|
2629
|
+
);
|
|
2630
|
+
await new Promise((resolve4) => setTimeout(resolve4, SETTINGS_GET_RATE_LIMIT_RETRY_MS));
|
|
2631
|
+
response = await this.http.get(normalizedPath, this.getCliRequestHeaders());
|
|
2632
|
+
}
|
|
2624
2633
|
if (!response.ok) {
|
|
2625
2634
|
throw new Error(`Settings GET failed with HTTP ${response.status}`);
|
|
2626
2635
|
}
|
|
@@ -6437,7 +6446,7 @@ async function main() {
|
|
|
6437
6446
|
apiUrl: typeof parsed.flags["api-url"] === "string" ? parsed.flags["api-url"] : void 0
|
|
6438
6447
|
});
|
|
6439
6448
|
const redactor = new OutputRedactor();
|
|
6440
|
-
if (client.hasSession()) {
|
|
6449
|
+
if (client.hasSession() && shouldInitializeRedactor(command, subcommand)) {
|
|
6441
6450
|
try {
|
|
6442
6451
|
const memories = await client.listMemories();
|
|
6443
6452
|
redactor.initializeFromMemories(memories);
|
|
@@ -6545,6 +6554,9 @@ async function main() {
|
|
|
6545
6554
|
}
|
|
6546
6555
|
throw new Error(`Unknown command '${command}'. Run 'openmates help'.`);
|
|
6547
6556
|
}
|
|
6557
|
+
function shouldInitializeRedactor(command, subcommand) {
|
|
6558
|
+
return command === "chats" && ["new", "send", "incognito"].includes(subcommand ?? "");
|
|
6559
|
+
}
|
|
6548
6560
|
async function handleChats(client, subcommand, rest, flags, redactor) {
|
|
6549
6561
|
if (!subcommand || subcommand === "help" || flags.help === true) {
|
|
6550
6562
|
printChatsHelp();
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED