@gapi/gcli 1.8.256 → 1.8.257
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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## 2026-11-07 - cli-browser-login: login: upload URL defaults to <API origin>/upload-lambda; --ci needs no --key
|
|
2
|
+
|
|
3
|
+
**Feature:** cli-browser-login · **Type:** fix
|
|
4
|
+
|
|
5
|
+
- `gcli login` without `--uploadUrl` now uses the API URL's **origin** +
|
|
6
|
+
`/upload-lambda` (`src/commands/auth/login-urls.ts`). It used to append
|
|
7
|
+
to the whole `--url`: `https://pubsub.graphql-server.com/graphql` ->
|
|
8
|
+
`.../graphql/upload-lambda`, `https://api.lambforge.com/` ->
|
|
9
|
+
`...//upload-lambda`. An explicit `--uploadUrl` still wins.
|
|
10
|
+
- `GraphqlClienAPI.getConfig()` applies the same default when the
|
|
11
|
+
`upload-url` file is missing (older logins) or empty (`mcp:start`
|
|
12
|
+
login-gate), so `lambda:create/update` always has an upload server.
|
|
13
|
+
- `gcli login --ci --token <t>` without `--key` crashed:
|
|
14
|
+
`TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument ... Received
|
|
15
|
+
undefined` (the key file was written with `undefined`). It now writes
|
|
16
|
+
`''` - the key only refreshes Firebase tokens, never a CI token.
|
|
17
|
+
- **Test:** `npx jest test/login-urls.spec.ts`; manually, in a throwaway
|
|
18
|
+
HOME: `HOME=$(mktemp -d) node release/index.js login --ci --token x --url
|
|
19
|
+
https://api.lambforge.com` -> exit 0, `~/.graphql-server/upload-url` =
|
|
20
|
+
`https://api.lambforge.com/upload-lambda`, `key` empty.
|
|
21
|
+
- **Debug:** uploads going to the wrong host -> `cat
|
|
22
|
+
~/.graphql-server/url ~/.graphql-server/upload-url`; re-login with
|
|
23
|
+
`--uploadUrl` to override.
|
|
24
|
+
- **Verification:** 3 new unit tests; full gcli suite 142/142 (18 suites);
|
|
25
|
+
`tsc --noEmit` clean; built CLI run with no URL, api.lambforge.com,
|
|
26
|
+
graphql-server's `/graphql` URL and an explicit `--uploadUrl`, all
|
|
27
|
+
without `--key`: every run exits 0 with the expected files.
|
|
@@ -8,6 +8,13 @@ Canonical doc: graphql-server `docs/features/cli-browser-login.md`.
|
|
|
8
8
|
- `src/commands/auth/login.ts`: no `--token` runs the browser flow;
|
|
9
9
|
`loginWithToken` is the shared path that writes `~/.graphql-server/`
|
|
10
10
|
(`silent` for MCP).
|
|
11
|
+
- `src/commands/auth/login-urls.ts`: `defaultUploadUrl(apiUrl)` = the API
|
|
12
|
+
URL's origin + `/upload-lambda` (no `--url` -> `https://api.lambforge.com`);
|
|
13
|
+
`resolveUploadUrl(uploadUrl, apiUrl)` - an explicit `--uploadUrl` wins.
|
|
14
|
+
Used by `loginWithToken` and by `GraphqlClienAPI.getConfig()` (missing or
|
|
15
|
+
empty `upload-url` file -> derived from `url`).
|
|
16
|
+
- `--ci` needs no `--key`: the key file gets `''` (a CI token is never
|
|
17
|
+
refreshed through Firebase).
|
|
11
18
|
- `src/commands/proxy/login-gate.ts`: `mcp:start` before login serves only
|
|
12
19
|
`LambforgeLogin`.
|
|
13
|
-
- Tests: `test/browser-login.spec.ts`.
|
|
20
|
+
- Tests: `test/browser-login.spec.ts`, `test/login-urls.spec.ts`.
|
package/package.json
CHANGED
package/release/index.js
CHANGED
|
@@ -14276,13 +14276,13 @@ var require_catchError = __commonJS({
|
|
|
14276
14276
|
var innerFrom_1 = require_innerFrom();
|
|
14277
14277
|
var OperatorSubscriber_1 = require_OperatorSubscriber();
|
|
14278
14278
|
var lift_1 = require_lift();
|
|
14279
|
-
function
|
|
14279
|
+
function catchError13(selector) {
|
|
14280
14280
|
return lift_1.operate(function(source, subscriber) {
|
|
14281
14281
|
var innerSub = null;
|
|
14282
14282
|
var syncUnsub = false;
|
|
14283
14283
|
var handledResult;
|
|
14284
14284
|
innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, void 0, void 0, function(err) {
|
|
14285
|
-
handledResult = innerFrom_1.innerFrom(selector(err,
|
|
14285
|
+
handledResult = innerFrom_1.innerFrom(selector(err, catchError13(selector)(source)));
|
|
14286
14286
|
if (innerSub) {
|
|
14287
14287
|
innerSub.unsubscribe();
|
|
14288
14288
|
innerSub = null;
|
|
@@ -14298,7 +14298,7 @@ var require_catchError = __commonJS({
|
|
|
14298
14298
|
}
|
|
14299
14299
|
});
|
|
14300
14300
|
}
|
|
14301
|
-
exports2.catchError =
|
|
14301
|
+
exports2.catchError = catchError13;
|
|
14302
14302
|
}
|
|
14303
14303
|
});
|
|
14304
14304
|
|
|
@@ -35994,6 +35994,23 @@ var require_index_cjs3 = __commonJS({
|
|
|
35994
35994
|
}
|
|
35995
35995
|
});
|
|
35996
35996
|
|
|
35997
|
+
// src/commands/auth/login-urls.ts
|
|
35998
|
+
var MAIN_LAMBFORGE_API, defaultUploadUrl, resolveUploadUrl;
|
|
35999
|
+
var init_login_urls = __esm({
|
|
36000
|
+
"src/commands/auth/login-urls.ts"() {
|
|
36001
|
+
MAIN_LAMBFORGE_API = "https://api.lambforge.com";
|
|
36002
|
+
defaultUploadUrl = (apiUrl) => {
|
|
36003
|
+
const base = apiUrl?.trim() || MAIN_LAMBFORGE_API;
|
|
36004
|
+
try {
|
|
36005
|
+
return `${new URL(base).origin}/upload-lambda`;
|
|
36006
|
+
} catch {
|
|
36007
|
+
return `${base.replace(/\/+$/, "")}/upload-lambda`;
|
|
36008
|
+
}
|
|
36009
|
+
};
|
|
36010
|
+
resolveUploadUrl = (uploadUrl, apiUrl) => uploadUrl?.trim() || defaultUploadUrl(apiUrl);
|
|
36011
|
+
}
|
|
36012
|
+
});
|
|
36013
|
+
|
|
35997
36014
|
// src/types.ts
|
|
35998
36015
|
var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory, runnerDirectory, workspacesDirectory;
|
|
35999
36016
|
var init_types = __esm({
|
|
@@ -36527,6 +36544,7 @@ var init_gql_client = __esm({
|
|
|
36527
36544
|
firebase = __toESM(require_index_cjs3());
|
|
36528
36545
|
import_rxjs2 = __toESM(require_cjs());
|
|
36529
36546
|
import_operators = __toESM(require_operators());
|
|
36547
|
+
init_login_urls();
|
|
36530
36548
|
init_read_file();
|
|
36531
36549
|
init_types();
|
|
36532
36550
|
init_types2();
|
|
@@ -37568,7 +37586,9 @@ var init_gql_client = __esm({
|
|
|
37568
37586
|
readFileAsObservable(generationTimeDirectory).pipe(
|
|
37569
37587
|
(0, import_operators.map)((date5) => Number(date5))
|
|
37570
37588
|
),
|
|
37571
|
-
|
|
37589
|
+
// Older logins have no upload-url file; the proxy's login-gate
|
|
37590
|
+
// writes an empty one - both fall back to <API origin>/upload-lambda.
|
|
37591
|
+
readFileAsObservable(uploadUrlDirectory).pipe((0, import_operators.catchError)(() => (0, import_rxjs2.of)("")))
|
|
37572
37592
|
]).pipe(
|
|
37573
37593
|
(0, import_operators.map)(([token, url2, refresh, key, timeGenerated, uploadUrl]) => ({
|
|
37574
37594
|
token,
|
|
@@ -37577,7 +37597,7 @@ var init_gql_client = __esm({
|
|
|
37577
37597
|
key,
|
|
37578
37598
|
timeGenerated,
|
|
37579
37599
|
expired: force || (Date.now() - timeGenerated) / 1e3 > 1800,
|
|
37580
|
-
uploadUrl
|
|
37600
|
+
uploadUrl: resolveUploadUrl(uploadUrl, url2)
|
|
37581
37601
|
})),
|
|
37582
37602
|
(0, import_operators.switchMap)(
|
|
37583
37603
|
(config2) => config2.expired ? this.refreshToken(config2.key, config2.refresh).pipe(
|
|
@@ -38089,7 +38109,8 @@ var init_login = __esm({
|
|
|
38089
38109
|
init_types();
|
|
38090
38110
|
init_gql_client();
|
|
38091
38111
|
init_browser_login();
|
|
38092
|
-
|
|
38112
|
+
init_login_urls();
|
|
38113
|
+
MainLambforgeAPI = MAIN_LAMBFORGE_API;
|
|
38093
38114
|
login_default = async (cmd) => {
|
|
38094
38115
|
if (!cmd.token && !cmd.ci) {
|
|
38095
38116
|
const { token, key } = await browserLogin(cmd.url || MainLambforgeAPI, {
|
|
@@ -38125,12 +38146,15 @@ var init_login = __esm({
|
|
|
38125
38146
|
encoding: "utf-8"
|
|
38126
38147
|
}
|
|
38127
38148
|
),
|
|
38128
|
-
|
|
38149
|
+
// `--ci` does not need a key (a CI token is never refreshed
|
|
38150
|
+
// through Firebase); writing `undefined` used to crash
|
|
38151
|
+
// ("The data argument must be of type string").
|
|
38152
|
+
(0, import_util2.promisify)(import_fs2.writeFile)(keyDirectory, cmd.key ?? "", {
|
|
38129
38153
|
encoding: "utf-8"
|
|
38130
38154
|
}),
|
|
38131
38155
|
(0, import_util2.promisify)(import_fs2.writeFile)(
|
|
38132
38156
|
uploadUrlDirectory,
|
|
38133
|
-
cmd.uploadUrl
|
|
38157
|
+
resolveUploadUrl(cmd.uploadUrl, cmd.url),
|
|
38134
38158
|
{
|
|
38135
38159
|
encoding: "utf-8"
|
|
38136
38160
|
}
|