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