@layers/amba 4.1.6 → 4.1.7
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/index.js +13 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -660,6 +660,13 @@ function isPatShape(token) {
|
|
|
660
660
|
*/
|
|
661
661
|
async function browserAuthFlow() {
|
|
662
662
|
return new Promise((resolve, reject) => {
|
|
663
|
+
let timeout;
|
|
664
|
+
const settle = (outcome) => {
|
|
665
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
666
|
+
server.close();
|
|
667
|
+
server.closeAllConnections();
|
|
668
|
+
outcome();
|
|
669
|
+
};
|
|
663
670
|
const server = createServer((req, res) => {
|
|
664
671
|
const url = new URL(req.url ?? "/", `http://localhost`);
|
|
665
672
|
if (url.pathname !== "/callback") {
|
|
@@ -672,20 +679,16 @@ async function browserAuthFlow() {
|
|
|
672
679
|
const expiresAt = url.searchParams.get("expires_at");
|
|
673
680
|
if (!accessToken || !refreshToken || !expiresAt) {
|
|
674
681
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
675
|
-
res.end("<html><body><h2>Authentication failed</h2><p>Missing token parameters. Please try again.</p></body></html>");
|
|
676
|
-
server.close();
|
|
677
|
-
reject(/* @__PURE__ */ new Error("Missing token parameters in callback"));
|
|
682
|
+
res.end("<html><body><h2>Authentication failed</h2><p>Missing token parameters. Please try again.</p></body></html>", () => settle(() => reject(/* @__PURE__ */ new Error("Missing token parameters in callback"))));
|
|
678
683
|
return;
|
|
679
684
|
}
|
|
680
|
-
res.writeHead(200, { "Content-Type": "text/html" });
|
|
681
|
-
res.end("<html><body style=\"font-family:system-ui;text-align:center;padding:3rem\"><h2>Authenticated!</h2><p>You can close this window and return to the terminal.</p></body></html>");
|
|
682
685
|
const creds = {
|
|
683
686
|
access_token: accessToken,
|
|
684
687
|
refresh_token: refreshToken,
|
|
685
688
|
expires_at: expiresAt
|
|
686
689
|
};
|
|
687
|
-
|
|
688
|
-
resolve(creds);
|
|
690
|
+
res.writeHead(200, { "Content-Type": "text/html" });
|
|
691
|
+
res.end("<html><body style=\"font-family:system-ui;text-align:center;padding:3rem\"><h2>Authenticated!</h2><p>You can close this window and return to the terminal.</p></body></html>", () => settle(() => resolve(creds)));
|
|
689
692
|
});
|
|
690
693
|
server.listen(0, "127.0.0.1", () => {
|
|
691
694
|
const addr = server.address();
|
|
@@ -703,9 +706,8 @@ async function browserAuthFlow() {
|
|
|
703
706
|
console.log(pc.yellow(` Please open this URL manually:`));
|
|
704
707
|
console.log(` ${pc.underline(authUrl)}`);
|
|
705
708
|
});
|
|
706
|
-
setTimeout(() => {
|
|
707
|
-
|
|
708
|
-
reject(/* @__PURE__ */ new Error("Authentication timed out. Please try again."));
|
|
709
|
+
timeout = setTimeout(() => {
|
|
710
|
+
settle(() => reject(/* @__PURE__ */ new Error("Authentication timed out. Please try again.")));
|
|
709
711
|
}, 12e4);
|
|
710
712
|
});
|
|
711
713
|
});
|
|
@@ -9778,7 +9780,7 @@ async function diffConfigCommand(file = DEFAULT_BUNDLE_FILE, options = {}) {
|
|
|
9778
9780
|
//#endregion
|
|
9779
9781
|
//#region src/index.ts
|
|
9780
9782
|
const program = new Command();
|
|
9781
|
-
program.name("amba").description("amba — agent-native backend-as-a-service for mobile apps.").version("4.1.
|
|
9783
|
+
program.name("amba").description("amba — agent-native backend-as-a-service for mobile apps.").version("4.1.7");
|
|
9782
9784
|
program.option("--token <pat>", "Use a Personal Access Token for headless / CI / agent use (overrides ~/.amba/credentials.json + AMBA_PAT env)");
|
|
9783
9785
|
program.hook("preAction", (thisCommand) => {
|
|
9784
9786
|
setBearerOverride(resolveTokenSource({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers/amba",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"description": "amba — agent-native backend-as-a-service. Functions, collections, storage, AI, email, queues, sites, and `amba ship` to take an Expo app live on the App Store + Google Play. `npx @layers/amba init` to start.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|