@faable/faable 4.5.3 → 4.5.4
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/api/FaableApi.js
CHANGED
|
@@ -130,12 +130,19 @@ class FaableApi {
|
|
|
130
130
|
async issueAuthAccountToken(account_id) {
|
|
131
131
|
return data(this.client.post(`/auth-accounts/${account_id}/token`));
|
|
132
132
|
}
|
|
133
|
-
// Every app the caller can see, across projects
|
|
134
|
-
//
|
|
135
|
-
// app lives outside the active project must still resolve.
|
|
133
|
+
// Every app the caller can see, across projects (`faable link` offers them
|
|
134
|
+
// to pick from).
|
|
136
135
|
async list() {
|
|
137
136
|
return allPages(next => this.listApps({ pageSize: 200, next }, null));
|
|
138
137
|
}
|
|
138
|
+
// The apps linked to `repository` (the `org/repo` slug), across projects —
|
|
139
|
+
// filtered (and indexed) server side, so a staff session doesn't page
|
|
140
|
+
// through the whole platform to match one repository.
|
|
141
|
+
async appsByRepository(repository) {
|
|
142
|
+
return allPages(next => data(this.client.get(`/app`, {
|
|
143
|
+
params: { repository, ...page_params({ pageSize: 200, next }) }
|
|
144
|
+
})));
|
|
145
|
+
}
|
|
139
146
|
// One page of apps, scoped to `project` (default: the active project).
|
|
140
147
|
// `null` = unscoped. The api filters by the header, so an admin session
|
|
141
148
|
// doesn't page through the whole platform.
|
|
@@ -57,8 +57,7 @@ const find_app_id = async (explicit, ctxAppId, api, workdir = process.cwd()) =>
|
|
|
57
57
|
return app_id;
|
|
58
58
|
const repository = await getGitRemoteUrl(workdir);
|
|
59
59
|
if (repository) {
|
|
60
|
-
const
|
|
61
|
-
const matches = apps.filter(app => app.repository === repository);
|
|
60
|
+
const matches = await api.appsByRepository(repository);
|
|
62
61
|
if (matches.length === 1) {
|
|
63
62
|
const app = matches[0];
|
|
64
63
|
log.info(`🔎 Detected app "${app.name}" (${app.id}) from repository ${repository}`);
|
|
@@ -23,12 +23,12 @@ const upgrade = {
|
|
|
23
23
|
}
|
|
24
24
|
const spinner = ora(`Upgrading ${CLI_PACKAGE} ${version} → ${latest}`).start();
|
|
25
25
|
try {
|
|
26
|
-
await cmd(`npm install -g ${CLI_PACKAGE}@latest`, { timeout: 180_000 });
|
|
26
|
+
await cmd(`npm install -g --prefer-online ${CLI_PACKAGE}@latest`, { timeout: 180_000 });
|
|
27
27
|
spinner.succeed(`Upgraded to ${latest}`);
|
|
28
28
|
}
|
|
29
29
|
catch {
|
|
30
30
|
spinner.fail("Upgrade failed");
|
|
31
|
-
log.error(`❌ Could not upgrade automatically. Try manually: npm install -g ${CLI_PACKAGE}@latest`);
|
|
31
|
+
log.error(`❌ Could not upgrade automatically. Try manually: npm install -g --prefer-online ${CLI_PACKAGE}@latest`);
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
},
|