@valbuild/server 0.72.3 → 0.73.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/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  - VAL_GIT_COMMIT
6
6
  - VAL_GIT_BRANCH
7
7
  - VAL_BUILD_URL
8
- - VAL_ORG_NAME (Proxy)
9
- - VAL_PROJECT_NAME (Proxy)
8
+ - VAL_PROJECT (Proxy)
10
9
 
11
10
  ![val auth flow](val_auth.png "Val Auth flow")
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  import ts from "typescript";
4
4
  import { ValFS } from "./ValFS.js";
5
+ import { Buffer } from "buffer";
5
6
  /**
6
7
  * An implementation of methods in the various ts.*Host interfaces
7
8
  * that uses ValFS to resolve modules and read/write files.
@@ -1,8 +1,16 @@
1
- import { SourcePath, ValidationError } from "@valbuild/core";
1
+ import { FileMetadata, ImageMetadata, SerializedSchema, Source, SourcePath, ValidationError } from "@valbuild/core";
2
2
  import { Patch } from "@valbuild/core/patch";
3
3
  export declare function createFixPatch(config: {
4
4
  projectRoot: string;
5
- }, apply: boolean, sourcePath: SourcePath, validationError: ValidationError): Promise<{
5
+ remoteHost: string;
6
+ }, apply: boolean, sourcePath: SourcePath, validationError: ValidationError, remoteFiles: {
7
+ [sourcePath: SourcePath]: {
8
+ ref: string;
9
+ metadata?: Record<string, unknown>;
10
+ };
11
+ }, moduleSource?: Source, moduleSchema?: SerializedSchema): Promise<{
6
12
  patch: Patch;
7
13
  remainingErrors: ValidationError[];
8
14
  } | undefined>;
15
+ export declare function getImageMetadata(projectRoot: string, validationError: ValidationError): Promise<ImageMetadata>;
16
+ export declare function getFileMetadata(projectRoot: string, validationError: ValidationError): Promise<FileMetadata>;
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ declare const SettingsSchema: z.ZodObject<{
3
+ publicProjectId: z.ZodString;
4
+ remoteFileBuckets: z.ZodArray<z.ZodObject<{
5
+ bucket: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ bucket: string;
8
+ }, {
9
+ bucket: string;
10
+ }>, "many">;
11
+ }, "strip", z.ZodTypeAny, {
12
+ publicProjectId: string;
13
+ remoteFileBuckets: {
14
+ bucket: string;
15
+ }[];
16
+ }, {
17
+ publicProjectId: string;
18
+ remoteFileBuckets: {
19
+ bucket: string;
20
+ }[];
21
+ }>;
22
+ type Settings = z.infer<typeof SettingsSchema>;
23
+ export declare function getSettings(projectName: string, auth: {
24
+ pat: string;
25
+ } | {
26
+ apiKey: string;
27
+ }): Promise<{
28
+ success: true;
29
+ data: Settings;
30
+ } | {
31
+ success: false;
32
+ message: string;
33
+ }>;
34
+ export {};
@@ -12,3 +12,6 @@ export { formatSyntaxErrorTree } from "./patch/ts/syntax.js";
12
12
  export { createFixPatch } from "./createFixPatch.js";
13
13
  export * from "./jwt.js";
14
14
  export type { ValServer } from "./ValServer.js";
15
+ export { getSettings } from "./getSettings.js";
16
+ export { getPersonalAccessTokenPath, parsePersonalAccessTokenFile, } from "./personalAccessTokens.js";
17
+ export { uploadRemoteFile } from "./uploadRemoteFile.js";
@@ -39,10 +39,13 @@ export declare function evaluateExpression(value: ts.Expression): result.Result<
39
39
  export declare function findObjectPropertyAssignment(value: ts.ObjectLiteralExpression, key: string): result.Result<LiteralPropertyAssignment | undefined, ValSyntaxErrorTree>;
40
40
  export declare function isValFileMethodCall(node: ts.Expression): node is ts.CallExpression;
41
41
  export declare function isValImageMethodCall(node: ts.Expression): node is ts.CallExpression;
42
+ export declare function isValRemoteMethodCall(node: ts.Expression): node is ts.CallExpression;
42
43
  export declare function findValFileNodeArg(node: ts.CallExpression): result.Result<ts.StringLiteral, ValSyntaxErrorTree>;
44
+ export declare function findValRemoteNodeArg(node: ts.CallExpression): result.Result<ts.StringLiteral, ValSyntaxErrorTree>;
43
45
  export declare function findValImageNodeArg(node: ts.CallExpression): result.Result<ts.StringLiteral, ValSyntaxErrorTree>;
44
46
  export declare function findValFileMetadataArg(node: ts.CallExpression): result.Result<ts.ObjectLiteralExpression | undefined, ValSyntaxErrorTree>;
45
47
  export declare function findValImageMetadataArg(node: ts.CallExpression): result.Result<ts.ObjectLiteralExpression | undefined, ValSyntaxErrorTree>;
48
+ export declare function findValRemoteMetadataArg(node: ts.CallExpression): result.Result<ts.ObjectLiteralExpression | undefined, ValSyntaxErrorTree>;
46
49
  /**
47
50
  * Given a list of expressions, validates that all the expressions are not
48
51
  * spread elements. In other words, it ensures that the expressions are the
@@ -0,0 +1,10 @@
1
+ export declare function getPersonalAccessTokenPath(root: string): string;
2
+ export declare function parsePersonalAccessTokenFile(content: string | undefined): {
3
+ success: true;
4
+ data: {
5
+ pat: string;
6
+ };
7
+ } | {
8
+ success: false;
9
+ error: string;
10
+ };
@@ -0,0 +1,25 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { SerializedFileSchema, SerializedImageSchema } from "@valbuild/core";
4
+ export declare function uploadRemoteFile(remoteHost: string, fileBuffer: Buffer, publicProjectId: string, bucket: string, filePath: `public/val/${string}`, schema: SerializedImageSchema | SerializedFileSchema, metadata: Record<string, unknown> | undefined, auth: {
5
+ pat: string;
6
+ } | {
7
+ apiKey: string;
8
+ }): Promise<{
9
+ success: true;
10
+ ref: string;
11
+ } | {
12
+ success: false;
13
+ error: string;
14
+ }>;
15
+ export declare function uploadRemoteRef(fileBuffer: Buffer, ref: string, auth: {
16
+ pat: string;
17
+ } | {
18
+ apiKey: string;
19
+ }): Promise<{
20
+ success: true;
21
+ ref: string;
22
+ } | {
23
+ success: false;
24
+ error: string;
25
+ }>;