@valbuild/server 0.60.21 → 0.60.23

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.
@@ -22,6 +22,7 @@ export interface ValServerBufferHost {
22
22
  export declare class LocalValServer extends ValServer {
23
23
  readonly options: LocalValServerOptions;
24
24
  readonly callbacks: ValServerCallbacks;
25
+ private readonly host;
25
26
  private static readonly PATCHES_DIR;
26
27
  private static readonly FILES_DIR;
27
28
  private readonly patchesRootPath;
@@ -41,12 +42,13 @@ export declare class LocalValServer extends ValServer {
41
42
  private getFileMetadataPath;
42
43
  private getPatchFilePath;
43
44
  private badRequest;
44
- protected ensureRemoteFSInitialized(): Promise<result.Result<undefined, ValServerError>>;
45
+ protected ensureInitialized(): Promise<result.Result<undefined, ValServerError>>;
45
46
  protected getModule(moduleId: ModuleId, options: {
46
47
  validate: boolean;
47
48
  source: boolean;
48
49
  schema: boolean;
49
50
  }): Promise<SerializedModuleContent>;
51
+ protected getAllModules(treePath: string): Promise<ModuleId[]>;
50
52
  protected execCommit(patches: [PatchId, ModuleId, Patch][]): Promise<{
51
53
  status: 200;
52
54
  json: Record<ModuleId, {
@@ -6,25 +6,19 @@ import { IValFSHost } from "./ValFSHost.js";
6
6
  import { SerializedModuleContent } from "./SerializedModuleContent.js";
7
7
  import { ModuleId, ModulePath } from "@valbuild/core";
8
8
  export type ServiceOptions = {
9
- /**
10
- * Relative path to the val.config.js file from the root directory.
11
- *
12
- * @example "./val.config"
13
- */
14
- valConfigPath?: string;
15
9
  /**
16
10
  * Disable cache for transpilation
17
11
  *
18
12
  * @default false
19
- * */
13
+ */
20
14
  disableCache?: boolean;
21
15
  };
22
16
  export declare function createService(projectRoot: string, opts: ServiceOptions, host?: IValFSHost, loader?: ValModuleLoader): Promise<Service>;
23
17
  export declare class Service {
24
18
  readonly sourceFileHandler: ValSourceFileHandler;
25
19
  private readonly runtime;
26
- readonly valConfigPath: string;
27
- constructor({ valConfigPath }: ServiceOptions, sourceFileHandler: ValSourceFileHandler, runtime: QuickJSRuntime);
20
+ readonly projectRoot: string;
21
+ constructor(projectRoot: string, sourceFileHandler: ValSourceFileHandler, runtime: QuickJSRuntime);
28
22
  get(moduleId: ModuleId, modulePath: ModulePath, options?: {
29
23
  validate: boolean;
30
24
  source: boolean;
@@ -6,7 +6,6 @@ import { Operation } from "@valbuild/core/patch";
6
6
  import { Patch } from "./patch/validation.js";
7
7
  import { ModuleId, PatchId } from "@valbuild/core";
8
8
  import { SerializedModuleContent } from "./SerializedModuleContent.js";
9
- import { IValFSHost } from "./ValFSHost.js";
10
9
  export type ValServerOptions = {
11
10
  valEnableRedirectUrl?: string;
12
11
  valDisableRedirectUrl?: string;
@@ -17,17 +16,15 @@ export type ValServerOptions = {
17
16
  };
18
17
  export declare abstract class ValServer implements IValServer {
19
18
  readonly cwd: string;
20
- readonly host: IValFSHost;
21
19
  readonly options: ValServerOptions;
22
20
  readonly callbacks: ValServerCallbacks;
23
- constructor(cwd: string, host: IValFSHost, options: ValServerOptions, callbacks: ValServerCallbacks);
21
+ constructor(cwd: string, options: ValServerOptions, callbacks: ValServerCallbacks);
24
22
  enable(query: {
25
23
  redirect_to?: string;
26
24
  }): Promise<ValServerRedirectResult<VAL_ENABLE_COOKIE_NAME>>;
27
25
  disable(query: {
28
26
  redirect_to?: string;
29
27
  }): Promise<ValServerRedirectResult<VAL_ENABLE_COOKIE_NAME>>;
30
- private getAllModules;
31
28
  getTree(treePath: string, query: {
32
29
  patch?: string;
33
30
  schema?: string;
@@ -38,6 +35,7 @@ export declare abstract class ValServer implements IValServer {
38
35
  postCommit(rawBody: unknown, cookies: ValCookies<VAL_SESSION_COOKIE>, requestHeaders: RequestHeaders): Promise<ValServerJsonResult<ApiCommitResponse, ApiPostValidationErrorResponse>>;
39
36
  private applyAllPatchesThenValidate;
40
37
  private revalidateImageAndFileValidation;
38
+ protected abstract getAllModules(treePath: string): Promise<ModuleId[]>;
41
39
  protected sortPatchIds(patchesByModule: Record<ModuleId, {
42
40
  patch: Patch;
43
41
  patch_id: PatchId;
@@ -58,7 +56,7 @@ export declare abstract class ValServer implements IValServer {
58
56
  * 1) The remote FS, if applicable, is initialized
59
57
  * 2) The error is returned via API if the remote FS could not be initialized
60
58
  * */
61
- protected abstract ensureRemoteFSInitialized(errorMessageType: string, cookies: ValCookies<VAL_SESSION_COOKIE>): Promise<result.Result<undefined, ValServerError>>;
59
+ protected abstract ensureInitialized(errorMessageType: string, cookies: ValCookies<VAL_SESSION_COOKIE>): Promise<result.Result<undefined, ValServerError>>;
62
60
  protected abstract getModule(moduleId: ModuleId, options: {
63
61
  validate: boolean;
64
62
  source: boolean;
@@ -162,3 +160,4 @@ export type RequestHeaders = {
162
160
  host?: string | null;
163
161
  "x-forwarded-proto"?: string | null;
164
162
  };
163
+ export declare function debugTiming<R>(id: string, fn: () => Promise<R>): Promise<R>;
@@ -2,7 +2,13 @@ import { ServiceOptions } from "./Service.js";
2
2
  import { IValServer, ValServerCallbacks } from "./ValServer.js";
3
3
  import { ValConfig } from "@valbuild/core";
4
4
  import { ValServerGenericResult } from "@valbuild/shared/internal";
5
- export type ValApiOptions = ValServerOverrides & ServiceOptions & ValConfig;
5
+ type Versions = {
6
+ versions?: {
7
+ core?: string;
8
+ next?: string;
9
+ };
10
+ };
11
+ export type ValApiOptions = ValServerOverrides & ServiceOptions & ValConfig & Versions;
6
12
  type ValServerOverrides = Partial<{
7
13
  /**
8
14
  * Override the Val API key.