@valbuild/server 0.121.0 → 0.123.0
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/CHANGELOG.md +224 -0
- package/dist/declarations/src/ValOps.d.ts +67 -1
- package/dist/declarations/src/ValOpsFS.d.ts +14 -0
- package/dist/declarations/src/ValOpsHttp.d.ts +30 -0
- package/dist/declarations/src/externalRecords.d.ts +366 -0
- package/dist/declarations/src/fixHandlers.d.ts +13 -0
- package/dist/declarations/src/history/HistoryError.d.ts +90 -0
- package/dist/declarations/src/history/types.d.ts +126 -0
- package/dist/declarations/src/index.d.ts +8 -4
- package/dist/declarations/src/valServerConfig.d.ts +54 -14
- package/dist/valbuild-server.cjs.dev.js +2710 -2813
- package/dist/valbuild-server.cjs.prod.js +2710 -2813
- package/dist/valbuild-server.esm.js +2706 -2812
- package/package.json +3 -3
- package/dist/declarations/src/tools/createValTools.d.ts +0 -41
- package/dist/declarations/src/tools/defineTool.d.ts +0 -69
- package/dist/declarations/src/tools/index.d.ts +0 -3
- package/dist/declarations/src/tools/types.d.ts +0 -172
|
@@ -36,22 +36,25 @@ export declare function initHandlerOptions(route: string, opts: ValApiOptions, c
|
|
|
36
36
|
/**
|
|
37
37
|
* Build the data layer a {@link ValServerConfig} calls for.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* The http backend always sees the app's own API key. That is what the Studio
|
|
40
|
+
* wants — there the app has already verified a session cookie and is acting on
|
|
41
|
+
* the user's behalf under its own authority — and it is now the only shape:
|
|
42
|
+
* every caller that reaches here has been authenticated by the app itself, so
|
|
43
|
+
* there is no request left on which the app is a pipe rather than an authority.
|
|
43
44
|
*
|
|
44
|
-
*
|
|
45
|
-
* user's personal access token
|
|
46
|
-
* what the caller
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
45
|
+
* This took a parameter for the other case: a caller acting for a user it had
|
|
46
|
+
* *not* authenticated passed that user's personal access token, and the backend
|
|
47
|
+
* decided what the caller could do. `ValOpsHttp` still accepts such a token —
|
|
48
|
+
* the CLI's `debug` command uses the developer's own from `val login` — but no
|
|
49
|
+
* server request builds one any more, because a request the app cannot
|
|
50
|
+
* authenticate is now refused instead of relayed.
|
|
51
|
+
*
|
|
52
|
+
* What has not changed is why the API key must never stand in for a credential
|
|
53
|
+
* that was merely *absent*: it works, and it works for every project the key
|
|
54
|
+
* can reach, including the ones the caller cannot. Callers are refused for a
|
|
55
|
+
* missing credential well before this point.
|
|
51
56
|
*/
|
|
52
|
-
export declare function createValOps(valModules: ValModules, options: ValServerConfig
|
|
53
|
-
pat: string;
|
|
54
|
-
}): ValOpsFS | ValOpsHttp;
|
|
57
|
+
export declare function createValOps(valModules: ValModules, options: ValServerConfig): ValOpsFS | ValOpsHttp;
|
|
55
58
|
/**
|
|
56
59
|
* Hosts we send credentials to, and what each one puts at risk. They differ:
|
|
57
60
|
* only `valBuildUrl` hands back the app token that becomes the session cookie,
|
|
@@ -78,4 +81,41 @@ type CredentialBearingUrl = "valBuildUrl" | "valContentUrl";
|
|
|
78
81
|
* internal http host today.
|
|
79
82
|
*/
|
|
80
83
|
export declare function insecureUrlWarning(name: CredentialBearingUrl, url: string): string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Which credential talks to the content host about REMOTE FILES.
|
|
86
|
+
*
|
|
87
|
+
* A separate question from the one `createValOps` answers, and it has to be:
|
|
88
|
+
* `ValOps` is authenticated per caller, but remote files are project-level —
|
|
89
|
+
* looking up a project's public id and its buckets, and later pushing bytes to
|
|
90
|
+
* them, is the same operation whoever asked for it.
|
|
91
|
+
*
|
|
92
|
+
* The rule, in order:
|
|
93
|
+
*
|
|
94
|
+
* 1. The app's API key, if there is one. Proxy mode always has one; fs mode has
|
|
95
|
+
* one when `VAL_API_KEY` is set.
|
|
96
|
+
* 2. In fs mode, the developer's own `val login` token, read off disk. This is
|
|
97
|
+
* the same file `val validate --fix` reads, and it is why local remote
|
|
98
|
+
* uploads work with no configuration beyond having logged in.
|
|
99
|
+
* 3. Nothing, which is an error rather than a fallback.
|
|
100
|
+
*
|
|
101
|
+
* Lives here rather than inside `createValServer` because the MCP image tool
|
|
102
|
+
* needs the same answer, and this is the file that exists so that two callers
|
|
103
|
+
* cannot disagree about how a project is configured. A registry that decided it
|
|
104
|
+
* had no credential while the Studio in the same process had one would be a
|
|
105
|
+
* genuinely confusing afternoon.
|
|
106
|
+
*/
|
|
107
|
+
export type RemoteFileAuth = {
|
|
108
|
+
apiKey: string;
|
|
109
|
+
} | {
|
|
110
|
+
pat: string;
|
|
111
|
+
};
|
|
112
|
+
export type ResolveRemoteFileAuthResult = {
|
|
113
|
+
status: "success";
|
|
114
|
+
auth: RemoteFileAuth;
|
|
115
|
+
} | {
|
|
116
|
+
status: "error";
|
|
117
|
+
errorCode: "project-not-configured" | "pat-error";
|
|
118
|
+
message: string;
|
|
119
|
+
};
|
|
120
|
+
export declare function resolveRemoteFileAuth(options: ValServerConfig): Promise<ResolveRemoteFileAuthResult>;
|
|
81
121
|
export {};
|