@gapi/gcli 1.8.252 → 1.8.253
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,17 @@
|
|
|
1
|
+
## 2026-11-02 - mcp-proxy: mcp:start refreshes the login token per request instead of failing every call with 401 after an hour
|
|
2
|
+
|
|
3
|
+
**Feature:** mcp-proxy · **Type:** fix
|
|
4
|
+
|
|
5
|
+
- `src/commands/proxy/start.ts`: `performFetch` sets `Authorization` from
|
|
6
|
+
`currentToken()` (via `GraphqlClienAPI.getConfig()`, refreshed after
|
|
7
|
+
30 min; concurrent requests share one refresh) on every forwarded request.
|
|
8
|
+
The token used to be fixed in the transport's `requestInit` at startup, and
|
|
9
|
+
the 401 retry only fixed that one request - and never ran anyway, because
|
|
10
|
+
the upstream returns 200 with the subgraph's 401 inside the tool result.
|
|
11
|
+
- New feature doc `docs/features/mcp-proxy.md` (plan 16 C4 in graphql-server).
|
|
12
|
+
- **Test:** `npx jest --coverage=false test/mcp-proxy-token.spec.ts` - token
|
|
13
|
+
read per request, one shared refresh, forced refresh + retry on 401.
|
|
14
|
+
- **Debug:** gateway log `auth/id-token-expired`; proxy stderr `[DEBUG]
|
|
15
|
+
Request failed with 401. Refreshing token...`.
|
|
16
|
+
- **Verification:** 129/129 gcli tests, `tsc --noEmit` clean, eslint clean;
|
|
17
|
+
live check pending (needs an MCP session running > 1 h on the new build).
|
package/docs/features/README.md
CHANGED
|
@@ -38,3 +38,4 @@ Outline (drop sections that don't apply):
|
|
|
38
38
|
| `workflows` | [workflows.md](workflows.md) | `workflow:*` commands incl. AI drafts (`workflow:generate`); canonical doc in graphql-server-lambdas |
|
|
39
39
|
| `virtual-clusters` | [virtual-clusters.md](virtual-clusters.md) | cluster:create --virtual, provider: vcluster (slice; canonical in graphql-server-functions) |
|
|
40
40
|
| `self-managed-nodes` | [self-managed-nodes.md](self-managed-nodes.md) | `cluster:attach/nodes/detach` - your own machine as a Talos worker (slice; canonical in graphql-server-functions) |
|
|
41
|
+
| `mcp-proxy` | [mcp-proxy.md](mcp-proxy.md) | `gcli mcp:start` - local stdio MCP server forwarding to the platform MCP endpoint; token refreshed per request |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# MCP proxy (`gcli mcp:start`)
|
|
2
|
+
|
|
3
|
+
**Feature slug:** `mcp-proxy` · history: `node scripts/changelog.mjs render --feature mcp-proxy`.
|
|
4
|
+
|
|
5
|
+
`gcli mcp:start` is a stdio MCP server that Claude Code / other clients run
|
|
6
|
+
locally (`claude mcp add --scope user lambforge -- gcli mcp:start`). It
|
|
7
|
+
forwards every request to the platform's MCP endpoint
|
|
8
|
+
(`<login url without /graphql>/mcp`, or `--url`) over streamable HTTP, as the
|
|
9
|
+
`gcli login` user. Code: `src/commands/proxy/start.ts`.
|
|
10
|
+
|
|
11
|
+
## Auth
|
|
12
|
+
|
|
13
|
+
The login token is a Firebase ID token (1 h). Every forwarded request reads
|
|
14
|
+
it through `GraphqlClienAPI.getConfig()`, which refreshes it after 30 min
|
|
15
|
+
(`currentToken()`, one shared refresh for concurrent requests). An HTTP
|
|
16
|
+
401/403 forces a refresh and one retry.
|
|
17
|
+
|
|
18
|
+
Until 2026-11-02 the token was fixed at startup: after an hour every tool
|
|
19
|
+
call failed with `401: Unauthorized`. The upstream answers HTTP 200 with the
|
|
20
|
+
subgraph's 401 inside the tool result, so the 401 retry never fired - the
|
|
21
|
+
gateway logs `auth/id-token-expired`.
|
|
22
|
+
|
|
23
|
+
## How to debug
|
|
24
|
+
|
|
25
|
+
- All tools 401 at once: the gateway's `[GATEWAY][ERROR]` log names the
|
|
26
|
+
reason (`auth/id-token-expired` = token). `gcli project:list` refreshes
|
|
27
|
+
the stored token; a proxy older than this fix needs a reconnect (`/mcp`).
|
|
28
|
+
- Tools missing from the list: the proxy forwards whatever the deployed
|
|
29
|
+
`mcp` lambda serves - compare with
|
|
30
|
+
`graphql-server-functions/packages/mcp/lambforge.yaml` (plan 16 D3).
|
package/package.json
CHANGED
package/release/index.js
CHANGED
|
@@ -76037,7 +76037,7 @@ ${lanes.join("\n")}
|
|
|
76037
76037
|
var parseDiagnostics;
|
|
76038
76038
|
var jsDocDiagnostics;
|
|
76039
76039
|
var syntaxCursor;
|
|
76040
|
-
var
|
|
76040
|
+
var currentToken2;
|
|
76041
76041
|
var nodeCount;
|
|
76042
76042
|
var identifiers;
|
|
76043
76043
|
var identifierCount;
|
|
@@ -76584,60 +76584,60 @@ ${lanes.join("\n")}
|
|
|
76584
76584
|
return scanner2.hasPrecedingJSDocComment();
|
|
76585
76585
|
}
|
|
76586
76586
|
function token() {
|
|
76587
|
-
return
|
|
76587
|
+
return currentToken2;
|
|
76588
76588
|
}
|
|
76589
76589
|
function nextTokenWithoutCheck() {
|
|
76590
|
-
return
|
|
76590
|
+
return currentToken2 = scanner2.scan();
|
|
76591
76591
|
}
|
|
76592
76592
|
function nextTokenAnd(func) {
|
|
76593
76593
|
nextToken();
|
|
76594
76594
|
return func();
|
|
76595
76595
|
}
|
|
76596
76596
|
function nextToken() {
|
|
76597
|
-
if (isKeyword(
|
|
76597
|
+
if (isKeyword(currentToken2) && (scanner2.hasUnicodeEscape() || scanner2.hasExtendedUnicodeEscape())) {
|
|
76598
76598
|
parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), Diagnostics.Keywords_cannot_contain_escape_characters);
|
|
76599
76599
|
}
|
|
76600
76600
|
return nextTokenWithoutCheck();
|
|
76601
76601
|
}
|
|
76602
76602
|
function nextTokenJSDoc() {
|
|
76603
|
-
return
|
|
76603
|
+
return currentToken2 = scanner2.scanJsDocToken();
|
|
76604
76604
|
}
|
|
76605
76605
|
function nextJSDocCommentTextToken(inBackticks) {
|
|
76606
|
-
return
|
|
76606
|
+
return currentToken2 = scanner2.scanJSDocCommentTextToken(inBackticks);
|
|
76607
76607
|
}
|
|
76608
76608
|
function reScanGreaterToken() {
|
|
76609
|
-
return
|
|
76609
|
+
return currentToken2 = scanner2.reScanGreaterToken();
|
|
76610
76610
|
}
|
|
76611
76611
|
function reScanSlashToken() {
|
|
76612
|
-
return
|
|
76612
|
+
return currentToken2 = scanner2.reScanSlashToken();
|
|
76613
76613
|
}
|
|
76614
76614
|
function reScanTemplateToken(isTaggedTemplate) {
|
|
76615
|
-
return
|
|
76615
|
+
return currentToken2 = scanner2.reScanTemplateToken(isTaggedTemplate);
|
|
76616
76616
|
}
|
|
76617
76617
|
function reScanLessThanToken() {
|
|
76618
|
-
return
|
|
76618
|
+
return currentToken2 = scanner2.reScanLessThanToken();
|
|
76619
76619
|
}
|
|
76620
76620
|
function reScanHashToken() {
|
|
76621
|
-
return
|
|
76621
|
+
return currentToken2 = scanner2.reScanHashToken();
|
|
76622
76622
|
}
|
|
76623
76623
|
function scanJsxIdentifier() {
|
|
76624
|
-
return
|
|
76624
|
+
return currentToken2 = scanner2.scanJsxIdentifier();
|
|
76625
76625
|
}
|
|
76626
76626
|
function scanJsxText() {
|
|
76627
|
-
return
|
|
76627
|
+
return currentToken2 = scanner2.scanJsxToken();
|
|
76628
76628
|
}
|
|
76629
76629
|
function scanJsxAttributeValue() {
|
|
76630
|
-
return
|
|
76630
|
+
return currentToken2 = scanner2.scanJsxAttributeValue();
|
|
76631
76631
|
}
|
|
76632
76632
|
function speculationHelper(callback, speculationKind) {
|
|
76633
|
-
const saveToken =
|
|
76633
|
+
const saveToken = currentToken2;
|
|
76634
76634
|
const saveParseDiagnosticsLength = parseDiagnostics.length;
|
|
76635
76635
|
const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
|
|
76636
76636
|
const saveContextFlags = contextFlags;
|
|
76637
76637
|
const result = speculationKind !== 0 ? scanner2.lookAhead(callback) : scanner2.tryScan(callback);
|
|
76638
76638
|
Debug.assert(saveContextFlags === contextFlags);
|
|
76639
76639
|
if (!result || speculationKind !== 0) {
|
|
76640
|
-
|
|
76640
|
+
currentToken2 = saveToken;
|
|
76641
76641
|
if (speculationKind !== 2) {
|
|
76642
76642
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
76643
76643
|
}
|
|
@@ -78634,8 +78634,8 @@ ${lanes.join("\n")}
|
|
|
78634
78634
|
19
|
|
78635
78635
|
/* OpenBraceToken */
|
|
78636
78636
|
);
|
|
78637
|
-
const
|
|
78638
|
-
if (
|
|
78637
|
+
const currentToken22 = token();
|
|
78638
|
+
if (currentToken22 === 118 || currentToken22 === 132) {
|
|
78639
78639
|
nextToken();
|
|
78640
78640
|
} else {
|
|
78641
78641
|
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(
|
|
@@ -78648,7 +78648,7 @@ ${lanes.join("\n")}
|
|
|
78648
78648
|
/* ColonToken */
|
|
78649
78649
|
);
|
|
78650
78650
|
attributes = parseImportAttributes(
|
|
78651
|
-
|
|
78651
|
+
currentToken22,
|
|
78652
78652
|
/*skipKeyword*/
|
|
78653
78653
|
true
|
|
78654
78654
|
);
|
|
@@ -79838,10 +79838,10 @@ ${lanes.join("\n")}
|
|
|
79838
79838
|
const pos = getNodePos();
|
|
79839
79839
|
const node = factory2.createJsxText(
|
|
79840
79840
|
scanner2.getTokenValue(),
|
|
79841
|
-
|
|
79841
|
+
currentToken2 === 13
|
|
79842
79842
|
/* JsxTextAllWhiteSpaces */
|
|
79843
79843
|
);
|
|
79844
|
-
|
|
79844
|
+
currentToken2 = scanner2.scanJsxToken();
|
|
79845
79845
|
return finishNode(node, pos);
|
|
79846
79846
|
}
|
|
79847
79847
|
function parseJsxChild(openingTag, token2) {
|
|
@@ -79884,7 +79884,7 @@ ${lanes.join("\n")}
|
|
|
79884
79884
|
const saveParsingContext = parsingContext;
|
|
79885
79885
|
parsingContext |= 1 << 14;
|
|
79886
79886
|
while (true) {
|
|
79887
|
-
const child = parseJsxChild(openingTag,
|
|
79887
|
+
const child = parseJsxChild(openingTag, currentToken2 = scanner2.reScanJsxToken());
|
|
79888
79888
|
if (!child) break;
|
|
79889
79889
|
list.push(child);
|
|
79890
79890
|
if (isJsxOpeningElement(openingTag) && (child == null ? void 0 : child.kind) === 285 && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) {
|
|
@@ -81114,11 +81114,11 @@ ${lanes.join("\n")}
|
|
|
81114
81114
|
nextToken();
|
|
81115
81115
|
return token() === 166 || token() === 11 || token() === 42 || token() === 19 || tokenIsIdentifierOrKeyword(token());
|
|
81116
81116
|
case 95:
|
|
81117
|
-
let
|
|
81118
|
-
if (
|
|
81119
|
-
|
|
81117
|
+
let currentToken22 = nextToken();
|
|
81118
|
+
if (currentToken22 === 156) {
|
|
81119
|
+
currentToken22 = lookAhead(nextToken);
|
|
81120
81120
|
}
|
|
81121
|
-
if (
|
|
81121
|
+
if (currentToken22 === 64 || currentToken22 === 42 || currentToken22 === 19 || currentToken22 === 90 || currentToken22 === 130 || currentToken22 === 60) {
|
|
81122
81122
|
return true;
|
|
81123
81123
|
}
|
|
81124
81124
|
continue;
|
|
@@ -82319,9 +82319,9 @@ ${lanes.join("\n")}
|
|
|
82319
82319
|
return importClause;
|
|
82320
82320
|
}
|
|
82321
82321
|
function tryParseImportAttributes() {
|
|
82322
|
-
const
|
|
82323
|
-
if ((
|
|
82324
|
-
return parseImportAttributes(
|
|
82322
|
+
const currentToken22 = token();
|
|
82323
|
+
if ((currentToken22 === 118 || currentToken22 === 132) && !scanner2.hasPrecedingLineBreak()) {
|
|
82324
|
+
return parseImportAttributes(currentToken22);
|
|
82325
82325
|
}
|
|
82326
82326
|
}
|
|
82327
82327
|
function parseImportAttribute() {
|
|
@@ -82615,9 +82615,9 @@ ${lanes.join("\n")}
|
|
|
82615
82615
|
moduleSpecifier = parseModuleSpecifier();
|
|
82616
82616
|
}
|
|
82617
82617
|
}
|
|
82618
|
-
const
|
|
82619
|
-
if (moduleSpecifier && (
|
|
82620
|
-
attributes = parseImportAttributes(
|
|
82618
|
+
const currentToken22 = token();
|
|
82619
|
+
if (moduleSpecifier && (currentToken22 === 118 || currentToken22 === 132) && !scanner2.hasPrecedingLineBreak()) {
|
|
82620
|
+
attributes = parseImportAttributes(currentToken22);
|
|
82621
82621
|
}
|
|
82622
82622
|
parseSemicolon();
|
|
82623
82623
|
setAwaitContext(savedAwaitContext);
|
|
@@ -82701,7 +82701,7 @@ ${lanes.join("\n")}
|
|
|
82701
82701
|
/* ParseAll */
|
|
82702
82702
|
);
|
|
82703
82703
|
scanner2.setText(content, start3, length2);
|
|
82704
|
-
|
|
82704
|
+
currentToken2 = scanner2.scan();
|
|
82705
82705
|
const jsDocTypeExpression = parseJSDocTypeExpression();
|
|
82706
82706
|
const sourceFile = createSourceFile2(
|
|
82707
82707
|
"file.js",
|
|
@@ -82789,7 +82789,7 @@ ${lanes.join("\n")}
|
|
|
82789
82789
|
}
|
|
82790
82790
|
JSDocParser2.parseIsolatedJSDocComment = parseIsolatedJSDocComment2;
|
|
82791
82791
|
function parseJSDocComment(parent2, start3, length2) {
|
|
82792
|
-
const saveToken =
|
|
82792
|
+
const saveToken = currentToken2;
|
|
82793
82793
|
const saveParseDiagnosticsLength = parseDiagnostics.length;
|
|
82794
82794
|
const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
|
|
82795
82795
|
const comment = doInsideOfContext(16777216, () => parseJSDocCommentWorker(start3, length2));
|
|
@@ -82800,7 +82800,7 @@ ${lanes.join("\n")}
|
|
|
82800
82800
|
}
|
|
82801
82801
|
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
82802
82802
|
}
|
|
82803
|
-
|
|
82803
|
+
currentToken2 = saveToken;
|
|
82804
82804
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
82805
82805
|
parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
|
|
82806
82806
|
return comment;
|
|
@@ -195179,18 +195179,18 @@ ${lanes.join("\n")}
|
|
|
195179
195179
|
const importedFiles = [];
|
|
195180
195180
|
let ambientExternalModules;
|
|
195181
195181
|
let lastToken;
|
|
195182
|
-
let
|
|
195182
|
+
let currentToken2;
|
|
195183
195183
|
let braceNesting = 0;
|
|
195184
195184
|
let externalModule = false;
|
|
195185
195185
|
function nextToken() {
|
|
195186
|
-
lastToken =
|
|
195187
|
-
|
|
195188
|
-
if (
|
|
195186
|
+
lastToken = currentToken2;
|
|
195187
|
+
currentToken2 = scanner.scan();
|
|
195188
|
+
if (currentToken2 === 19) {
|
|
195189
195189
|
braceNesting++;
|
|
195190
|
-
} else if (
|
|
195190
|
+
} else if (currentToken2 === 20) {
|
|
195191
195191
|
braceNesting--;
|
|
195192
195192
|
}
|
|
195193
|
-
return
|
|
195193
|
+
return currentToken2;
|
|
195194
195194
|
}
|
|
195195
195195
|
function getFileReference() {
|
|
195196
195196
|
const fileName = scanner.getTokenValue();
|
|
@@ -218276,11 +218276,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218276
218276
|
};
|
|
218277
218277
|
}
|
|
218278
218278
|
function getJSDocParameterCompletions(sourceFile, position, checker, options, preferences, tagNameOnly) {
|
|
218279
|
-
const
|
|
218280
|
-
if (!isJSDocTag(
|
|
218279
|
+
const currentToken2 = getTokenAtPosition(sourceFile, position);
|
|
218280
|
+
if (!isJSDocTag(currentToken2) && !isJSDoc(currentToken2)) {
|
|
218281
218281
|
return [];
|
|
218282
218282
|
}
|
|
218283
|
-
const jsDoc = isJSDoc(
|
|
218283
|
+
const jsDoc = isJSDoc(currentToken2) ? currentToken2 : currentToken2.parent;
|
|
218284
218284
|
if (!isJSDoc(jsDoc)) {
|
|
218285
218285
|
return [];
|
|
218286
218286
|
}
|
|
@@ -220132,10 +220132,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220132
220132
|
const typeChecker = program2.getTypeChecker();
|
|
220133
220133
|
const inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
220134
220134
|
let start3 = timestamp();
|
|
220135
|
-
let
|
|
220135
|
+
let currentToken2 = getTokenAtPosition(sourceFile, position);
|
|
220136
220136
|
log("getCompletionData: Get current token: " + (timestamp() - start3));
|
|
220137
220137
|
start3 = timestamp();
|
|
220138
|
-
const insideComment = isInComment(sourceFile, position,
|
|
220138
|
+
const insideComment = isInComment(sourceFile, position, currentToken2);
|
|
220139
220139
|
log("getCompletionData: Is inside comment: " + (timestamp() - start3));
|
|
220140
220140
|
let insideJsDocTagTypeExpression = false;
|
|
220141
220141
|
let insideJsDocImportTag = false;
|
|
@@ -220157,7 +220157,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220157
220157
|
}
|
|
220158
220158
|
}
|
|
220159
220159
|
}
|
|
220160
|
-
const tag = getJsDocTagAtPosition(
|
|
220160
|
+
const tag = getJsDocTagAtPosition(currentToken2, position);
|
|
220161
220161
|
if (tag) {
|
|
220162
220162
|
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
|
|
220163
220163
|
return {
|
|
@@ -220170,8 +220170,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220170
220170
|
} else {
|
|
220171
220171
|
const typeExpression = tryGetTypeExpressionFromTag(tag);
|
|
220172
220172
|
if (typeExpression) {
|
|
220173
|
-
|
|
220174
|
-
if (!
|
|
220173
|
+
currentToken2 = getTokenAtPosition(sourceFile, position);
|
|
220174
|
+
if (!currentToken2 || !isDeclarationName(currentToken2) && (currentToken2.parent.kind !== 349 || currentToken2.parent.name !== currentToken2)) {
|
|
220175
220175
|
insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression);
|
|
220176
220176
|
}
|
|
220177
220177
|
}
|
|
@@ -220191,7 +220191,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220191
220191
|
const previousToken = tokens.previousToken;
|
|
220192
220192
|
let contextToken = tokens.contextToken;
|
|
220193
220193
|
log("getCompletionData: Get previous token: " + (timestamp() - start3));
|
|
220194
|
-
let node =
|
|
220194
|
+
let node = currentToken2;
|
|
220195
220195
|
let propertyAccessToConvert;
|
|
220196
220196
|
let isRightOfDot = false;
|
|
220197
220197
|
let isRightOfQuestionDot = false;
|
|
@@ -220263,16 +220263,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220263
220263
|
contextToken = parent2;
|
|
220264
220264
|
parent2 = parent2.parent;
|
|
220265
220265
|
}
|
|
220266
|
-
if (
|
|
220267
|
-
switch (
|
|
220266
|
+
if (currentToken2.parent === location) {
|
|
220267
|
+
switch (currentToken2.kind) {
|
|
220268
220268
|
case 32:
|
|
220269
|
-
if (
|
|
220270
|
-
location =
|
|
220269
|
+
if (currentToken2.parent.kind === 285 || currentToken2.parent.kind === 287) {
|
|
220270
|
+
location = currentToken2;
|
|
220271
220271
|
}
|
|
220272
220272
|
break;
|
|
220273
220273
|
case 44:
|
|
220274
|
-
if (
|
|
220275
|
-
location =
|
|
220274
|
+
if (currentToken2.parent.kind === 286) {
|
|
220275
|
+
location = currentToken2;
|
|
220276
220276
|
}
|
|
220277
220277
|
break;
|
|
220278
220278
|
}
|
|
@@ -232469,30 +232469,30 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
232469
232469
|
scanner2.resetTokenState(savedPos);
|
|
232470
232470
|
scanner2.scan();
|
|
232471
232471
|
}
|
|
232472
|
-
let
|
|
232472
|
+
let currentToken2 = getNextToken(n, expectedScanAction);
|
|
232473
232473
|
const token = createTextRangeWithKind(
|
|
232474
232474
|
scanner2.getTokenFullStart(),
|
|
232475
232475
|
scanner2.getTokenEnd(),
|
|
232476
|
-
|
|
232476
|
+
currentToken2
|
|
232477
232477
|
);
|
|
232478
232478
|
if (trailingTrivia) {
|
|
232479
232479
|
trailingTrivia = void 0;
|
|
232480
232480
|
}
|
|
232481
232481
|
while (scanner2.getTokenFullStart() < endPos) {
|
|
232482
|
-
|
|
232483
|
-
if (!isTrivia(
|
|
232482
|
+
currentToken2 = scanner2.scan();
|
|
232483
|
+
if (!isTrivia(currentToken2)) {
|
|
232484
232484
|
break;
|
|
232485
232485
|
}
|
|
232486
232486
|
const trivia = createTextRangeWithKind(
|
|
232487
232487
|
scanner2.getTokenFullStart(),
|
|
232488
232488
|
scanner2.getTokenEnd(),
|
|
232489
|
-
|
|
232489
|
+
currentToken2
|
|
232490
232490
|
);
|
|
232491
232491
|
if (!trailingTrivia) {
|
|
232492
232492
|
trailingTrivia = [];
|
|
232493
232493
|
}
|
|
232494
232494
|
trailingTrivia.push(trivia);
|
|
232495
|
-
if (
|
|
232495
|
+
if (currentToken2 === 4) {
|
|
232496
232496
|
scanner2.scan();
|
|
232497
232497
|
break;
|
|
232498
232498
|
}
|
|
@@ -235660,8 +235660,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
235660
235660
|
return 0;
|
|
235661
235661
|
}
|
|
235662
235662
|
const lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
|
235663
|
-
const
|
|
235664
|
-
const isObjectLiteral =
|
|
235663
|
+
const currentToken2 = getTokenAtPosition(sourceFile, position);
|
|
235664
|
+
const isObjectLiteral = currentToken2.kind === 19 && currentToken2.parent.kind === 211;
|
|
235665
235665
|
if (options.indentStyle === 1 || isObjectLiteral) {
|
|
235666
235666
|
return getBlockIndent(sourceFile, position, options);
|
|
235667
235667
|
}
|
|
@@ -235677,7 +235677,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
235677
235677
|
219,
|
|
235678
235678
|
220
|
|
235679
235679
|
/* ArrowFunction */
|
|
235680
|
-
].includes(
|
|
235680
|
+
].includes(currentToken2.parent.kind);
|
|
235681
235681
|
const indentSize = useTheSameBaseIndentation ? 0 : options.indentSize;
|
|
235682
235682
|
return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize;
|
|
235683
235683
|
}
|
|
@@ -319672,7 +319672,9 @@ var init_zod = __esm({
|
|
|
319672
319672
|
// src/commands/proxy/start.ts
|
|
319673
319673
|
var start_exports = {};
|
|
319674
319674
|
__export(start_exports, {
|
|
319675
|
-
|
|
319675
|
+
currentToken: () => currentToken,
|
|
319676
|
+
default: () => startProxy,
|
|
319677
|
+
performFetch: () => performFetch
|
|
319676
319678
|
});
|
|
319677
319679
|
async function startProxy(cmd) {
|
|
319678
319680
|
return (0, import_rxjs46.lastValueFrom)(
|
|
@@ -319784,7 +319786,7 @@ async function startProxy(cmd) {
|
|
|
319784
319786
|
)
|
|
319785
319787
|
);
|
|
319786
319788
|
}
|
|
319787
|
-
var import_rxjs46, import_operators31, import_stream2, performFetch;
|
|
319789
|
+
var import_rxjs46, import_operators31, import_stream2, pendingToken, currentToken, withToken, performFetch;
|
|
319788
319790
|
var init_start = __esm({
|
|
319789
319791
|
"src/commands/proxy/start.ts"() {
|
|
319790
319792
|
init_client2();
|
|
@@ -319796,26 +319798,40 @@ var init_start = __esm({
|
|
|
319796
319798
|
import_stream2 = require("stream");
|
|
319797
319799
|
init_zod();
|
|
319798
319800
|
init_gql_client();
|
|
319801
|
+
pendingToken = null;
|
|
319802
|
+
currentToken = (force = false) => {
|
|
319803
|
+
if (!pendingToken || force) {
|
|
319804
|
+
pendingToken = (0, import_rxjs46.lastValueFrom)(
|
|
319805
|
+
GraphqlClienAPI.getConfig(force).pipe(
|
|
319806
|
+
(0, import_operators31.take)(1),
|
|
319807
|
+
(0, import_operators31.map)((config2) => config2.token)
|
|
319808
|
+
)
|
|
319809
|
+
).finally(() => {
|
|
319810
|
+
pendingToken = null;
|
|
319811
|
+
});
|
|
319812
|
+
}
|
|
319813
|
+
return pendingToken;
|
|
319814
|
+
};
|
|
319815
|
+
withToken = (init, token) => {
|
|
319816
|
+
const headers = new Headers(init?.headers);
|
|
319817
|
+
headers.set("Authorization", token);
|
|
319818
|
+
return { ...init, headers };
|
|
319819
|
+
};
|
|
319799
319820
|
performFetch = (input, init) => {
|
|
319800
|
-
return (0, import_rxjs46.from)(
|
|
319821
|
+
return (0, import_rxjs46.from)(currentToken()).pipe(
|
|
319822
|
+
(0, import_operators31.switchMap)((token) => fetch(input, withToken(init, token))),
|
|
319801
319823
|
(0, import_operators31.switchMap)((res) => {
|
|
319802
319824
|
if (res.status === 401 || res.status === 403) {
|
|
319803
319825
|
process.stderr.write(
|
|
319804
319826
|
`[DEBUG] Request failed with ${res.status}. Refreshing token...
|
|
319805
319827
|
`
|
|
319806
319828
|
);
|
|
319807
|
-
return
|
|
319808
|
-
(0, import_operators31.
|
|
319809
|
-
(0, import_operators31.switchMap)((config2) => {
|
|
319829
|
+
return (0, import_rxjs46.from)(currentToken(true)).pipe(
|
|
319830
|
+
(0, import_operators31.switchMap)((token) => {
|
|
319810
319831
|
process.stderr.write(
|
|
319811
319832
|
"[DEBUG] Token refreshed. Retrying request...\n"
|
|
319812
319833
|
);
|
|
319813
|
-
|
|
319814
|
-
headers.set("Authorization", config2.token);
|
|
319815
|
-
return fetch(input, {
|
|
319816
|
-
...init,
|
|
319817
|
-
headers
|
|
319818
|
-
});
|
|
319834
|
+
return fetch(input, withToken(init, token));
|
|
319819
319835
|
})
|
|
319820
319836
|
);
|
|
319821
319837
|
}
|