@valbuild/server 0.16.3 → 0.17.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.
@@ -3,15 +3,19 @@ import { Service } from "./Service.js";
3
3
  import { ValServer } from "./ValServer.js";
4
4
  export type LocalValServerOptions = {
5
5
  service: Service;
6
+ git: {
7
+ commit?: string;
8
+ branch?: string;
9
+ };
6
10
  };
7
11
  export declare class LocalValServer implements ValServer {
8
12
  readonly options: LocalValServerOptions;
9
13
  constructor(options: LocalValServerOptions);
10
14
  session(_req: express.Request, res: express.Response): Promise<void>;
11
- getIds(req: express.Request<{
12
- 0: string;
13
- }>, res: express.Response): Promise<void>;
14
- patchIds(req: express.Request<{
15
+ getTree(req: express.Request, res: express.Response): Promise<void>;
16
+ enable(req: express.Request, res: express.Response): Promise<void>;
17
+ disable(req: express.Request, res: express.Response): Promise<void>;
18
+ postPatches(req: express.Request<{
15
19
  0: string;
16
20
  }>, res: express.Response): Promise<void>;
17
21
  private badRequest;
@@ -4,11 +4,11 @@ export interface ValServer {
4
4
  callback(req: express.Request, res: express.Response): Promise<void>;
5
5
  logout(req: express.Request, res: express.Response): Promise<void>;
6
6
  session(req: express.Request, res: express.Response): Promise<void>;
7
- getIds(req: express.Request<{
8
- 0: string;
9
- }>, res: express.Response): Promise<void>;
10
- patchIds(req: express.Request<{
7
+ postPatches(req: express.Request<{
11
8
  0: string;
12
9
  }>, res: express.Response): Promise<void>;
13
10
  commit(req: express.Request, res: express.Response): Promise<void>;
11
+ enable(req: express.Request, res: express.Response): Promise<void>;
12
+ disable(req: express.Request, res: express.Response): Promise<void>;
13
+ getTree(req: express.Request, res: express.Response): Promise<void>;
14
14
  }
@@ -66,6 +66,16 @@ type ValServerOverrides = Partial<{
66
66
  * @example "https://app.val.build"
67
67
  */
68
68
  valBuildUrl: string;
69
+ /**
70
+ * The base url of Val content.
71
+ *
72
+ * Typically this should not be set.
73
+ *
74
+ * Can also be overridden using the VAL_CONTENT_URL env var.
75
+ *
76
+ * @example "https://content.val.build"
77
+ */
78
+ valContentUrl: string;
69
79
  /**
70
80
  * The full name of this Val project.
71
81
  *
@@ -74,6 +84,30 @@ type ValServerOverrides = Partial<{
74
84
  * @example "myorg/my-project"
75
85
  */
76
86
  valName: string;
87
+ /**
88
+ * After Val is enabled, redirect to this url.
89
+ *
90
+ * May be used to setup a custom flow after enabling Val.
91
+ *
92
+ *This can be set using the VAL_ENABLE_REDIRECT_URL env var.
93
+ *
94
+ * @example "/api/draft/enable"
95
+ */
96
+ valEnableRedirectUrl?: string;
97
+ /**
98
+ * After Val is disabled, redirect to this url.
99
+ *
100
+ * May be used to setup a custom flow after disabling Val.
101
+ *
102
+ * This can be set using the VAL_DISABLE_REDIRECT_URL env var.
103
+ *
104
+ * @example "/api/draft/enable"
105
+ */
106
+ valDisableRedirectUrl?: string;
107
+ }>;
108
+ export declare function safeReadGit(cwd: string): Promise<{
109
+ commit?: string;
110
+ branch?: string;
77
111
  }>;
78
112
  export declare function createRequestListener(route: string, opts: Opts): RequestListener;
79
113
  export {};
@@ -1,7 +1,7 @@
1
1
  export type { ServiceOptions } from "./Service.js";
2
2
  export { createService, Service } from "./Service.js";
3
3
  export { createRequestHandler } from "./createRequestHandler.js";
4
- export { createRequestListener } from "./hosting.js";
4
+ export { createRequestListener, safeReadGit } from "./hosting.js";
5
5
  export { ValModuleLoader } from "./ValModuleLoader.js";
6
6
  export { getCompilerOptions } from "./getCompilerOptions.js";
7
7
  export { ValSourceFileHandler } from "./ValSourceFileHandler.js";
@@ -6,4 +6,4 @@ import { QuickJSRuntime } from "quickjs-emscripten";
6
6
  import ts from "typescript";
7
7
  import { SerializedModuleContent } from "./SerializedModuleContent.js";
8
8
  export declare const patchValFile: (id: string, valConfigPath: string, patch: Patch, sourceFileHandler: ValSourceFileHandler, runtime: QuickJSRuntime) => Promise<SerializedModuleContent>;
9
- export declare const patchSourceFile: (sourceFile: ts.SourceFile, patch: Patch) => result.Result<ts.SourceFile, ValSyntaxErrorTree | PatchError>;
9
+ export declare const patchSourceFile: (sourceFile: ts.SourceFile | string, patch: Patch) => result.Result<ts.SourceFile, ValSyntaxErrorTree | PatchError>;