@valbuild/server 0.63.2 → 0.64.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/dist/declarations/src/{createValApiRouter.d.ts → ValRouter.d.ts} +1 -1
- package/dist/declarations/src/ValServer.d.ts +13 -63
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/valbuild-server.cjs.dev.js +928 -812
- package/dist/valbuild-server.cjs.prod.js +928 -812
- package/dist/valbuild-server.esm.js +931 -815
- package/package.json +5 -4
@@ -113,7 +113,7 @@ type ValServerOverrides = Partial<{
|
|
113
113
|
*/
|
114
114
|
disableCache?: boolean;
|
115
115
|
}>;
|
116
|
-
export declare function createValServer(valModules: ValModules, route: string, opts: ValApiOptions, callbacks: ValServerCallbacks, formatter?: (code: string, filePath: string) => string): Promise<ValServer>;
|
116
|
+
export declare function createValServer(valModules: ValModules, route: string, opts: ValApiOptions, callbacks: ValServerCallbacks, formatter?: (code: string, filePath: string) => string | Promise<string>): Promise<ValServer>;
|
117
117
|
export declare function safeReadGit(cwd: string): Promise<{
|
118
118
|
commit?: string;
|
119
119
|
branch?: string;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { ValModules } from "@valbuild/core";
|
3
|
+
import { Api, ServerOf } from "@valbuild/shared/internal";
|
4
4
|
import { z } from "zod";
|
5
5
|
export type ValServerOptions = {
|
6
6
|
route: string;
|
7
7
|
valEnableRedirectUrl?: string;
|
8
8
|
valDisableRedirectUrl?: string;
|
9
|
-
formatter?: (code: string, filePath: string) => string
|
9
|
+
formatter?: (code: string, filePath: string) => string | Promise<string>;
|
10
10
|
valBuildUrl?: string;
|
11
11
|
valSecret?: string;
|
12
12
|
apiKey?: string;
|
@@ -15,7 +15,6 @@ export type ValServerOptions = {
|
|
15
15
|
export type ValServerConfig = ValServerOptions & ({
|
16
16
|
mode: "fs";
|
17
17
|
cwd: string;
|
18
|
-
formatter?: (code: string, filePath: string) => string;
|
19
18
|
} | {
|
20
19
|
mode: "http";
|
21
20
|
valContentUrl: string;
|
@@ -25,62 +24,8 @@ export type ValServerConfig = ValServerOptions & ({
|
|
25
24
|
branch: string;
|
26
25
|
root?: string;
|
27
26
|
});
|
28
|
-
export
|
29
|
-
|
30
|
-
private readonly options;
|
31
|
-
readonly callbacks: ValServerCallbacks;
|
32
|
-
private serverOps;
|
33
|
-
constructor(valModules: ValModules, options: ValServerConfig, callbacks: ValServerCallbacks);
|
34
|
-
enable(query: {
|
35
|
-
redirect_to?: string;
|
36
|
-
}): Promise<ValServerRedirectResult<VAL_ENABLE_COOKIE_NAME>>;
|
37
|
-
disable(query: {
|
38
|
-
redirect_to?: string;
|
39
|
-
}): Promise<ValServerRedirectResult<VAL_ENABLE_COOKIE_NAME>>;
|
40
|
-
authorize(query: {
|
41
|
-
redirect_to?: string;
|
42
|
-
}): Promise<ValServerRedirectResult<VAL_STATE_COOKIE | VAL_ENABLE_COOKIE_NAME>>;
|
43
|
-
callback(query: {
|
44
|
-
code?: string;
|
45
|
-
state?: string;
|
46
|
-
}, cookies: ValCookies<"val_state">): Promise<ValServerRedirectResult<"val_state" | "val_session" | "val_enable">>;
|
47
|
-
session(cookies: ValCookies<VAL_SESSION_COOKIE>): Promise<ValServerJsonResult<ValSession>>;
|
48
|
-
private consumeCode;
|
49
|
-
private getAuthorizeUrl;
|
50
|
-
private getAppErrorUrl;
|
51
|
-
getAuth(cookies: Partial<Record<"val_session", string>>): {
|
52
|
-
error: string;
|
53
|
-
} | {
|
54
|
-
id: string;
|
55
|
-
error?: undefined;
|
56
|
-
} | {
|
57
|
-
error: null;
|
58
|
-
id: null;
|
59
|
-
};
|
60
|
-
logout(): Promise<ValServerResult<VAL_SESSION_COOKIE | VAL_STATE_COOKIE>>;
|
61
|
-
getPatches(query: {
|
62
|
-
authors?: string[];
|
63
|
-
}, cookies: Partial<Record<"val_session", string>>): Promise<ValServerJsonResult<ApiGetPatchResponse>>;
|
64
|
-
deletePatches(query: {
|
65
|
-
id?: string[];
|
66
|
-
}, cookies: Partial<Record<"val_session", string>>): Promise<ValServerJsonResult<ApiDeletePatchResponse>>;
|
67
|
-
getSchema(cookies: Partial<Record<"val_session", string>>): Promise<ValServerJsonResult<ApiSchemaResponse>>;
|
68
|
-
putTree(body: unknown, treePath: string, query: {
|
69
|
-
patches_sha?: string;
|
70
|
-
validate_all?: string;
|
71
|
-
validate_sources?: string;
|
72
|
-
validate_binary_files?: string;
|
73
|
-
}, cookies: Partial<Record<"val_session", string>>): Promise<ValServerJsonResult<ApiTreeResponse>>;
|
74
|
-
postSave(body: unknown, cookies: Partial<Record<"val_session", string>>): Promise<ValServerJsonResult<ApiCommitResponse, ApiPostValidationErrorResponse>>;
|
75
|
-
getFiles(filePath: string, query: {
|
76
|
-
patch_id?: string;
|
77
|
-
}): Promise<ValServerError | {
|
78
|
-
status: 200 | 201;
|
79
|
-
headers?: Record<string, string>;
|
80
|
-
cookies?: ValServerResultCookies<never>;
|
81
|
-
body?: ReadableStream<Uint8Array>;
|
82
|
-
}>;
|
83
|
-
}
|
27
|
+
export type ValServer = ServerOf<Api>;
|
28
|
+
export declare const ValServer: (valModules: ValModules, options: ValServerConfig, callbacks: ValServerCallbacks) => ServerOf<Api>;
|
84
29
|
export type ValServerCallbacks = {
|
85
30
|
isEnabled: () => Promise<boolean>;
|
86
31
|
onEnable: (success: boolean) => Promise<void>;
|
@@ -95,14 +40,14 @@ declare const IntegratedServerJwtPayload: z.ZodObject<{
|
|
95
40
|
}, "strip", z.ZodTypeAny, {
|
96
41
|
project: string;
|
97
42
|
sub: string;
|
98
|
-
exp: number;
|
99
43
|
token: string;
|
44
|
+
exp: number;
|
100
45
|
org: string;
|
101
46
|
}, {
|
102
47
|
project: string;
|
103
48
|
sub: string;
|
104
|
-
exp: number;
|
105
49
|
token: string;
|
50
|
+
exp: number;
|
106
51
|
org: string;
|
107
52
|
}>;
|
108
53
|
export type IntegratedServerJwtPayload = z.infer<typeof IntegratedServerJwtPayload>;
|
@@ -116,6 +61,11 @@ export declare const ENABLE_COOKIE_VALUE: {
|
|
116
61
|
export declare function bufferToReadableStream(buffer: Buffer): ReadableStream<any>;
|
117
62
|
export declare function getRedirectUrl(query: {
|
118
63
|
redirect_to?: string | undefined;
|
119
|
-
}, overrideHost: string | undefined): string |
|
64
|
+
}, overrideHost: string | undefined): string | {
|
65
|
+
status: 400;
|
66
|
+
json: {
|
67
|
+
message: string;
|
68
|
+
};
|
69
|
+
};
|
120
70
|
export declare function guessMimeTypeFromPath(filePath: string): string | null;
|
121
71
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export type { ServiceOptions } from "./Service.js";
|
2
2
|
export { createService, Service } from "./Service.js";
|
3
|
-
export { createValApiRouter, createValServer, safeReadGit
|
3
|
+
export { createValApiRouter, createValServer, safeReadGit } from "./ValRouter.js";
|
4
4
|
export { ValModuleLoader } from "./ValModuleLoader.js";
|
5
5
|
export { getCompilerOptions } from "./getCompilerOptions.js";
|
6
6
|
export { ValSourceFileHandler } from "./ValSourceFileHandler.js";
|
@@ -12,3 +12,4 @@ export { formatSyntaxErrorTree } from "./patch/ts/syntax.js";
|
|
12
12
|
export { createFixPatch } from "./createFixPatch.js";
|
13
13
|
export { PatchJSON, Patch } from "./patch/validation.js";
|
14
14
|
export * from "./jwt.js";
|
15
|
+
export type { ValServer } from "./ValServer.js";
|