openmates 0.11.0-alpha.23 → 0.11.0-alpha.24
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-Z7CD2LI4.js → chunk-PT6ABNJW.js} +17 -4
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -3639,12 +3639,14 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
3639
3639
|
}
|
|
3640
3640
|
return this.resolveAsyncSkillResponse(response.data, headers);
|
|
3641
3641
|
}
|
|
3642
|
-
getCodeRunStreamAuth() {
|
|
3642
|
+
async getCodeRunStreamAuth() {
|
|
3643
3643
|
const session = this.session;
|
|
3644
3644
|
if (!session) return null;
|
|
3645
|
+
await this.refreshWsToken();
|
|
3645
3646
|
const token = session.wsToken || session.cookies.auth_refresh_token;
|
|
3646
3647
|
if (!token) return null;
|
|
3647
|
-
|
|
3648
|
+
const fallbackToken = session.cookies.auth_refresh_token;
|
|
3649
|
+
return { sessionId: session.sessionId, token, fallbackToken };
|
|
3648
3650
|
}
|
|
3649
3651
|
async getCodeRunStatus(path, apiKey) {
|
|
3650
3652
|
const headers = {
|
|
@@ -9317,7 +9319,7 @@ async function handleCodeRun(client, flags, apiKey) {
|
|
|
9317
9319
|
if (!result?.execution_id || !result.status_path) {
|
|
9318
9320
|
throw new Error("Code Run did not return an execution id.");
|
|
9319
9321
|
}
|
|
9320
|
-
const streamAuth = apiKey ? null : client.getCodeRunStreamAuth();
|
|
9322
|
+
const streamAuth = apiKey ? null : await client.getCodeRunStreamAuth();
|
|
9321
9323
|
let finalStatus;
|
|
9322
9324
|
if (streamAuth && result.stream_path) {
|
|
9323
9325
|
const url = buildCodeRunStreamUrl({
|
|
@@ -9326,7 +9328,18 @@ async function handleCodeRun(client, flags, apiKey) {
|
|
|
9326
9328
|
sessionId: streamAuth.sessionId,
|
|
9327
9329
|
token: streamAuth.token
|
|
9328
9330
|
});
|
|
9329
|
-
|
|
9331
|
+
try {
|
|
9332
|
+
finalStatus = await streamCodeRunToTerminal(url, flags.json === true);
|
|
9333
|
+
} catch (err) {
|
|
9334
|
+
if (!streamAuth.fallbackToken || streamAuth.fallbackToken === streamAuth.token) throw err;
|
|
9335
|
+
const fallbackUrl = buildCodeRunStreamUrl({
|
|
9336
|
+
apiUrl: client.apiUrl,
|
|
9337
|
+
executionId: result.execution_id,
|
|
9338
|
+
sessionId: streamAuth.sessionId,
|
|
9339
|
+
token: streamAuth.fallbackToken
|
|
9340
|
+
});
|
|
9341
|
+
finalStatus = await streamCodeRunToTerminal(fallbackUrl, flags.json === true);
|
|
9342
|
+
}
|
|
9330
9343
|
} else {
|
|
9331
9344
|
finalStatus = await pollCodeRunStatus(client, result.status_path, apiKey, flags.json === true);
|
|
9332
9345
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -618,10 +618,11 @@ declare class OpenMatesClient {
|
|
|
618
618
|
inputData: Record<string, unknown>;
|
|
619
619
|
apiKey?: string;
|
|
620
620
|
}): Promise<unknown>;
|
|
621
|
-
getCodeRunStreamAuth(): {
|
|
621
|
+
getCodeRunStreamAuth(): Promise<{
|
|
622
622
|
sessionId: string;
|
|
623
623
|
token: string;
|
|
624
|
-
|
|
624
|
+
fallbackToken?: string;
|
|
625
|
+
} | null>;
|
|
625
626
|
getCodeRunStatus(path: string, apiKey?: string): Promise<Record<string, unknown>>;
|
|
626
627
|
/**
|
|
627
628
|
* Look up a booking URL for a flight using its booking_token.
|
package/dist/index.js
CHANGED