@valbuild/server 0.63.5 → 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/ValServer.d.ts +12 -63
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/valbuild-server.cjs.dev.js +911 -759
- package/dist/valbuild-server.cjs.prod.js +911 -759
- package/dist/valbuild-server.esm.js +915 -763
- package/package.json +5 -4
- /package/dist/declarations/src/{createValApiRouter.d.ts → ValRouter.d.ts} +0 -0
@@ -1,6 +1,6 @@
|
|
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;
|
@@ -24,64 +24,8 @@ export type ValServerConfig = ValServerOptions & ({
|
|
24
24
|
branch: string;
|
25
25
|
root?: string;
|
26
26
|
});
|
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
|
-
}
|
27
|
+
export type ValServer = ServerOf<Api>;
|
28
|
+
export declare const ValServer: (valModules: ValModules, options: ValServerConfig, callbacks: ValServerCallbacks) => ServerOf<Api>;
|
85
29
|
export type ValServerCallbacks = {
|
86
30
|
isEnabled: () => Promise<boolean>;
|
87
31
|
onEnable: (success: boolean) => Promise<void>;
|
@@ -96,14 +40,14 @@ declare const IntegratedServerJwtPayload: z.ZodObject<{
|
|
96
40
|
}, "strip", z.ZodTypeAny, {
|
97
41
|
project: string;
|
98
42
|
sub: string;
|
99
|
-
exp: number;
|
100
43
|
token: string;
|
44
|
+
exp: number;
|
101
45
|
org: string;
|
102
46
|
}, {
|
103
47
|
project: string;
|
104
48
|
sub: string;
|
105
|
-
exp: number;
|
106
49
|
token: string;
|
50
|
+
exp: number;
|
107
51
|
org: string;
|
108
52
|
}>;
|
109
53
|
export type IntegratedServerJwtPayload = z.infer<typeof IntegratedServerJwtPayload>;
|
@@ -117,6 +61,11 @@ export declare const ENABLE_COOKIE_VALUE: {
|
|
117
61
|
export declare function bufferToReadableStream(buffer: Buffer): ReadableStream<any>;
|
118
62
|
export declare function getRedirectUrl(query: {
|
119
63
|
redirect_to?: string | undefined;
|
120
|
-
}, overrideHost: string | undefined): string |
|
64
|
+
}, overrideHost: string | undefined): string | {
|
65
|
+
status: 400;
|
66
|
+
json: {
|
67
|
+
message: string;
|
68
|
+
};
|
69
|
+
};
|
121
70
|
export declare function guessMimeTypeFromPath(filePath: string): string | null;
|
122
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";
|