veryfront 0.1.1205 → 0.1.1207
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/esm/cli/commands/build/command.d.ts +17 -0
- package/esm/cli/commands/build/command.d.ts.map +1 -1
- package/esm/cli/commands/build/command.js +44 -1
- package/esm/cli/shared/build-extensions.d.ts +37 -0
- package/esm/cli/shared/build-extensions.d.ts.map +1 -0
- package/esm/cli/shared/build-extensions.js +42 -0
- package/esm/deno.js +1 -1
- package/esm/src/agent/streaming/lifecycle/watchdog-compat-adapter.d.ts.map +1 -1
- package/esm/src/agent/streaming/lifecycle/watchdog-compat-adapter.js +7 -1
- package/esm/src/config/schemas/config.schema.d.ts +18 -2
- package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
- package/esm/src/config/schemas/config.schema.js +28 -1
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +12 -1
- package/esm/src/platform/compat/dns.d.ts +60 -0
- package/esm/src/platform/compat/dns.d.ts.map +1 -1
- package/esm/src/platform/compat/dns.js +127 -4
- package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
- package/esm/src/platform/environment.d.ts.map +1 -1
- package/esm/src/platform/environment.js +7 -1
- package/esm/src/proxy/asset-handler.d.ts.map +1 -1
- package/esm/src/proxy/asset-handler.js +23 -15
- package/esm/src/release-assets/css-compile.d.ts +11 -1
- package/esm/src/release-assets/css-compile.d.ts.map +1 -1
- package/esm/src/release-assets/css-compile.js +11 -1
- package/esm/src/security/http/base-handler.d.ts.map +1 -1
- package/esm/src/security/http/base-handler.js +0 -1
- package/esm/src/security/http/config.d.ts +0 -3
- package/esm/src/security/http/config.d.ts.map +1 -1
- package/esm/src/security/http/config.js +2 -8
- package/esm/src/security/http/csp-directives.d.ts +28 -0
- package/esm/src/security/http/csp-directives.d.ts.map +1 -0
- package/esm/src/security/http/csp-directives.js +67 -0
- package/esm/src/security/http/platform-asset-origins.d.ts +27 -0
- package/esm/src/security/http/platform-asset-origins.d.ts.map +1 -0
- package/esm/src/security/http/platform-asset-origins.js +33 -0
- package/esm/src/security/http/response/builder.d.ts +0 -1
- package/esm/src/security/http/response/builder.d.ts.map +1 -1
- package/esm/src/security/http/response/builder.js +0 -2
- package/esm/src/security/http/response/fluent-methods.d.ts +0 -1
- package/esm/src/security/http/response/fluent-methods.d.ts.map +1 -1
- package/esm/src/security/http/response/fluent-methods.js +1 -1
- package/esm/src/security/http/response/security-handler.d.ts +11 -3
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +145 -68
- package/esm/src/security/http/response/static-helpers.d.ts +0 -2
- package/esm/src/security/http/response/static-helpers.d.ts.map +1 -1
- package/esm/src/security/http/response/types.d.ts +0 -1
- package/esm/src/security/http/response/types.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/styles-css.handler.d.ts +15 -0
- package/esm/src/server/handlers/dev/styles-css.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/styles-css.handler.js +79 -28
- package/esm/src/server/handlers/request/api/security-headers.d.ts.map +1 -1
- package/esm/src/server/handlers/request/api/security-headers.js +2 -2
- package/esm/src/server/production-server.d.ts +11 -0
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +10 -0
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts +1 -4
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/handler-context-builder.js +1 -3
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +2 -3
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts +0 -1
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-runtime-context.js +0 -1
- package/esm/src/server/unhandled-rejection-guard.d.ts +39 -0
- package/esm/src/server/unhandled-rejection-guard.d.ts.map +1 -0
- package/esm/src/server/unhandled-rejection-guard.js +119 -0
- package/esm/src/types/server.d.ts +6 -2
- package/esm/src/types/server.d.ts.map +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import type { BuildOptions } from "./types.js";
|
|
2
2
|
/** @internal */
|
|
3
3
|
export declare function runWithBundlerShutdown<T>(operation: () => Promise<T>, stopBundler?: () => Promise<void>): Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* Release the extensions composed for this build.
|
|
6
|
+
*
|
|
7
|
+
* Extensions can hold timers and other resources, and `teardownAll()` also
|
|
8
|
+
* clears the process-global contract registry that `orchestrateExtensions`
|
|
9
|
+
* populated. `veryfront eval` and `veryfront serve` already do this; the build
|
|
10
|
+
* did not, so a command that composes extensions left them running.
|
|
11
|
+
*
|
|
12
|
+
* A teardown failure never changes the build's outcome. The build has already
|
|
13
|
+
* produced its result by this point, and `runWithBundlerShutdown` sets the
|
|
14
|
+
* same precedent by preserving the build error over a shutdown one.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function releaseBuildExtensions(loader: {
|
|
19
|
+
teardownAll: () => Promise<void>;
|
|
20
|
+
} | undefined): Promise<void>;
|
|
4
21
|
export declare function formatBuildOutputPath(projectDir: string, outputDir: string): string;
|
|
5
22
|
export declare function buildCommand(options: BuildOptions): Promise<void>;
|
|
6
23
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,gBAAgB;AAChB,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,WAAW,GAAE,MAAM,OAAO,CAAC,IAAI,CAG9B,GACA,OAAO,CAAC,CAAC,CAAC,CAiBZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GAAG,SAAS,GACvD,OAAO,CAAC,IAAI,CAAC,CASf;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAwGjE"}
|
|
@@ -9,6 +9,7 @@ import { handleBuildError } from "./error-handler.js";
|
|
|
9
9
|
import { displayBuildSuccess } from "./stats-display.js";
|
|
10
10
|
import { isJsonMode, streamJsonLine } from "../../shared/json-output.js";
|
|
11
11
|
import { ensureBuiltinContentProcessor } from "../../shared/ensure-content-processor.js";
|
|
12
|
+
import { setupBuildCliExtensions } from "../../shared/build-extensions.js";
|
|
12
13
|
/** @internal */
|
|
13
14
|
export async function runWithBundlerShutdown(operation, stopBundler = async () => {
|
|
14
15
|
const { stop } = await import("../../../src/extensions/bundler/index.js");
|
|
@@ -32,6 +33,32 @@ export async function runWithBundlerShutdown(operation, stopBundler = async () =
|
|
|
32
33
|
await stopBundler();
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Release the extensions composed for this build.
|
|
38
|
+
*
|
|
39
|
+
* Extensions can hold timers and other resources, and `teardownAll()` also
|
|
40
|
+
* clears the process-global contract registry that `orchestrateExtensions`
|
|
41
|
+
* populated. `veryfront eval` and `veryfront serve` already do this; the build
|
|
42
|
+
* did not, so a command that composes extensions left them running.
|
|
43
|
+
*
|
|
44
|
+
* A teardown failure never changes the build's outcome. The build has already
|
|
45
|
+
* produced its result by this point, and `runWithBundlerShutdown` sets the
|
|
46
|
+
* same precedent by preserving the build error over a shutdown one.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export async function releaseBuildExtensions(loader) {
|
|
51
|
+
if (!loader)
|
|
52
|
+
return;
|
|
53
|
+
try {
|
|
54
|
+
await loader.teardownAll();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
if (!isJsonMode()) {
|
|
58
|
+
cliLogger.warn("Extension teardown failed after the build");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
35
62
|
export function formatBuildOutputPath(projectDir, outputDir) {
|
|
36
63
|
return relative(projectDir, resolve(projectDir, outputDir)).replace(/\\/g, "/");
|
|
37
64
|
}
|
|
@@ -40,6 +67,14 @@ export function buildCommand(options) {
|
|
|
40
67
|
const outputDir = options.outputDir ?? join(options.projectDir, "dist");
|
|
41
68
|
const startTime = Date.now();
|
|
42
69
|
const dryRun = options.dryRun ?? false;
|
|
70
|
+
let extensions;
|
|
71
|
+
// exit() does not run `finally`, so the JSON error path below releases
|
|
72
|
+
// explicitly before exiting. Clearing the handle keeps that idempotent.
|
|
73
|
+
const releaseExtensions = async () => {
|
|
74
|
+
const loader = extensions;
|
|
75
|
+
extensions = undefined;
|
|
76
|
+
await releaseBuildExtensions(loader);
|
|
77
|
+
};
|
|
43
78
|
try {
|
|
44
79
|
if (isJsonMode()) {
|
|
45
80
|
streamJsonLine({ type: "step", name: "config", status: "started" });
|
|
@@ -49,7 +84,11 @@ export function buildCommand(options) {
|
|
|
49
84
|
}
|
|
50
85
|
const stats = await runWithBundlerShutdown(async () => {
|
|
51
86
|
const adapter = await runtime.get();
|
|
52
|
-
await getConfig(options.projectDir, adapter);
|
|
87
|
+
const config = await getConfig(options.projectDir, adapter);
|
|
88
|
+
// Compose the project's extensions before anything that resolves a
|
|
89
|
+
// contract. Only server bootstrap used to do this, so the build ran
|
|
90
|
+
// with whatever one-off shims had been added and failed on the rest.
|
|
91
|
+
extensions = await setupBuildCliExtensions(options.projectDir, config);
|
|
53
92
|
await ensureBuiltinContentProcessor();
|
|
54
93
|
if (isJsonMode()) {
|
|
55
94
|
streamJsonLine({ type: "step", name: "config", status: "completed" });
|
|
@@ -104,11 +143,15 @@ export function buildCommand(options) {
|
|
|
104
143
|
success: false,
|
|
105
144
|
error: error instanceof Error ? error.message : String(error),
|
|
106
145
|
});
|
|
146
|
+
await releaseExtensions();
|
|
107
147
|
const { exit } = await import("../../../src/platform/index.js");
|
|
108
148
|
exit(1);
|
|
109
149
|
return;
|
|
110
150
|
}
|
|
111
151
|
handleBuildError(error);
|
|
112
152
|
}
|
|
153
|
+
finally {
|
|
154
|
+
await releaseExtensions();
|
|
155
|
+
}
|
|
113
156
|
}, { "cli.projectDir": options.projectDir });
|
|
114
157
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension composition for `veryfront build`.
|
|
3
|
+
*
|
|
4
|
+
* Extension orchestration used to happen only in server bootstrap, so commands
|
|
5
|
+
* that never start a server ran with an almost empty contract registry. The
|
|
6
|
+
* build path compensated with one-off shims (`ensureCliBundlerContracts`,
|
|
7
|
+
* `ensureBuiltinContentProcessor`) that covered the contracts someone had
|
|
8
|
+
* already been bitten by, and nothing else.
|
|
9
|
+
*
|
|
10
|
+
* CSS was the contract nobody had added a shim for. A scaffolded project whose
|
|
11
|
+
* stylesheet is `@import "tailwindcss";` reached the release-asset CSS compile
|
|
12
|
+
* with no CSSProcessor registered and failed with:
|
|
13
|
+
*
|
|
14
|
+
* Missing extension for contract "CSSProcessor".
|
|
15
|
+
* Install it with: deno add @veryfront/ext-css-tailwind
|
|
16
|
+
*
|
|
17
|
+
* The extension was installed the whole time. `veryfront dev` compiled the same
|
|
18
|
+
* stylesheet correctly because starting a server orchestrated it.
|
|
19
|
+
*
|
|
20
|
+
* Composing extensions here fixes that class of failure rather than one
|
|
21
|
+
* instance of it, and honors what the project configures: a project that
|
|
22
|
+
* declares `ext-css-lightning` gets its own processor instead of whichever one
|
|
23
|
+
* a shim happened to hardcode. `veryfront eval` already does this.
|
|
24
|
+
*
|
|
25
|
+
* @module cli/shared/build-extensions
|
|
26
|
+
*/
|
|
27
|
+
import { orchestrateExtensions } from "../../src/extensions/index.js";
|
|
28
|
+
type OrchestrateExtensions = typeof orchestrateExtensions;
|
|
29
|
+
type OrchestrateOptions = Parameters<OrchestrateExtensions>[0];
|
|
30
|
+
/**
|
|
31
|
+
* Compose the extensions a production build needs.
|
|
32
|
+
*
|
|
33
|
+
* `orchestrate` is a test seam and defaults to the real implementation.
|
|
34
|
+
*/
|
|
35
|
+
export declare function setupBuildCliExtensions(projectDir: string, config: OrchestrateOptions["config"], orchestrate?: OrchestrateExtensions): Promise<Awaited<ReturnType<OrchestrateExtensions>>>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=build-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-extensions.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/build-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE,KAAK,qBAAqB,GAAG,OAAO,qBAAqB,CAAC;AAC1D,KAAK,kBAAkB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EACpC,WAAW,GAAE,qBAA6C,GACzD,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAOrD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension composition for `veryfront build`.
|
|
3
|
+
*
|
|
4
|
+
* Extension orchestration used to happen only in server bootstrap, so commands
|
|
5
|
+
* that never start a server ran with an almost empty contract registry. The
|
|
6
|
+
* build path compensated with one-off shims (`ensureCliBundlerContracts`,
|
|
7
|
+
* `ensureBuiltinContentProcessor`) that covered the contracts someone had
|
|
8
|
+
* already been bitten by, and nothing else.
|
|
9
|
+
*
|
|
10
|
+
* CSS was the contract nobody had added a shim for. A scaffolded project whose
|
|
11
|
+
* stylesheet is `@import "tailwindcss";` reached the release-asset CSS compile
|
|
12
|
+
* with no CSSProcessor registered and failed with:
|
|
13
|
+
*
|
|
14
|
+
* Missing extension for contract "CSSProcessor".
|
|
15
|
+
* Install it with: deno add @veryfront/ext-css-tailwind
|
|
16
|
+
*
|
|
17
|
+
* The extension was installed the whole time. `veryfront dev` compiled the same
|
|
18
|
+
* stylesheet correctly because starting a server orchestrated it.
|
|
19
|
+
*
|
|
20
|
+
* Composing extensions here fixes that class of failure rather than one
|
|
21
|
+
* instance of it, and honors what the project configures: a project that
|
|
22
|
+
* declares `ext-css-lightning` gets its own processor instead of whichever one
|
|
23
|
+
* a shim happened to hardcode. `veryfront eval` already does this.
|
|
24
|
+
*
|
|
25
|
+
* @module cli/shared/build-extensions
|
|
26
|
+
*/
|
|
27
|
+
import { orchestrateExtensions } from "../../src/extensions/index.js";
|
|
28
|
+
import { cliLogger } from "../utils/index.js";
|
|
29
|
+
import { createBuiltinExtensions } from "../../src/extensions/builtin-extensions.js";
|
|
30
|
+
/**
|
|
31
|
+
* Compose the extensions a production build needs.
|
|
32
|
+
*
|
|
33
|
+
* `orchestrate` is a test seam and defaults to the real implementation.
|
|
34
|
+
*/
|
|
35
|
+
export async function setupBuildCliExtensions(projectDir, config, orchestrate = orchestrateExtensions) {
|
|
36
|
+
return await orchestrate({
|
|
37
|
+
projectDir,
|
|
38
|
+
config,
|
|
39
|
+
logger: cliLogger.component("build-extensions"),
|
|
40
|
+
builtinExtensions: createBuiltinExtensions(),
|
|
41
|
+
});
|
|
42
|
+
}
|
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchdog-compat-adapter.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/streaming/lifecycle/watchdog-compat-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"watchdog-compat-adapter.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/streaming/lifecycle/watchdog-compat-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AASlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,qDAAqD;AACrD,eAAO,MAAM,mCAAmC,SAAU,CAAC;AAC3D,6DAA6D;AAC7D,eAAO,MAAM,2CAA2C,SAAU,CAAC;AAEnE,0DAA0D;AAC1D,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,sBAAsB,GACtB,cAAc,GACd,gBAAgB,CAAC;AAErB,sCAAsC;AACtC,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,uBAAuB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,uBAAuB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C;;;;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B,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1B,0EAA0E;AAC1E,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAAC,GACzC,yBAAyB,CAmD3B;AAED,8EAA8E;AAC9E,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,yBAAyB;;+BAmEhD,uBAAuB,GAAG,IAAI;;mBAcvC,kBAAkB,CAAC,eAAe,CAAC;;EAqCrD"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
-
|
|
2
|
+
// Import from process/env.ts, not the process.ts barrel. This module is
|
|
3
|
+
// reachable from the `veryfront/chat` client entry, and the barrel also
|
|
4
|
+
// re-exports runCommand from process/command.ts, which pulls
|
|
5
|
+
// platform/compat/dynamic-import.ts and its `new Function` into the client
|
|
6
|
+
// bundle. Project pages ship a CSP without 'unsafe-eval', so that throws
|
|
7
|
+
// EvalError and kills hydration before first paint.
|
|
8
|
+
import { getHostEnv } from "../../../platform/compat/process/env.js";
|
|
3
9
|
import { createAbsoluteDeadline } from "./deadlines.js";
|
|
4
10
|
/** Default value for chat stream idle timeout ms. */
|
|
5
11
|
export const DEFAULT_CHAT_STREAM_IDLE_TIMEOUT_MS = 120_000;
|
|
@@ -125,7 +125,15 @@ export declare const getVeryfrontConfigSchema: () => import("../../internal-agen
|
|
|
125
125
|
token: import("../../internal-agents/schema.js").Schema<string>;
|
|
126
126
|
}> | undefined>;
|
|
127
127
|
}>> | undefined>;
|
|
128
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Extra CSP sources, merged into the platform's baseline policy.
|
|
130
|
+
*
|
|
131
|
+
* Additive: `{ fontSrc: ["https://fonts.gstatic.com"] }` keeps every
|
|
132
|
+
* default and adds that origin. `null` drops the platform's optional
|
|
133
|
+
* sources for one directive (e.g. `styleSrc: null` removes
|
|
134
|
+
* `'unsafe-inline'`) while keeping the ones the renderer requires.
|
|
135
|
+
*/
|
|
136
|
+
csp: import("../../internal-agents/schema.js").Schema<Record<string, string[] | null> | undefined>;
|
|
129
137
|
remoteHosts: import("../../internal-agents/schema.js").Schema<string[] | undefined>;
|
|
130
138
|
cors: import("../../internal-agents/schema.js").Schema<boolean | import("../../extensions/schema/schema-validator.js").InferShape<{
|
|
131
139
|
origin: import("../../internal-agents/schema.js").Schema<string | string[] | CorsOriginValidator | undefined>;
|
|
@@ -594,7 +602,15 @@ export declare const veryfrontConfigSchema: import("../../internal-agents/schema
|
|
|
594
602
|
token: import("../../internal-agents/schema.js").Schema<string>;
|
|
595
603
|
}> | undefined>;
|
|
596
604
|
}>> | undefined>;
|
|
597
|
-
|
|
605
|
+
/**
|
|
606
|
+
* Extra CSP sources, merged into the platform's baseline policy.
|
|
607
|
+
*
|
|
608
|
+
* Additive: `{ fontSrc: ["https://fonts.gstatic.com"] }` keeps every
|
|
609
|
+
* default and adds that origin. `null` drops the platform's optional
|
|
610
|
+
* sources for one directive (e.g. `styleSrc: null` removes
|
|
611
|
+
* `'unsafe-inline'`) while keeping the ones the renderer requires.
|
|
612
|
+
*/
|
|
613
|
+
csp: import("../../internal-agents/schema.js").Schema<Record<string, string[] | null> | undefined>;
|
|
598
614
|
remoteHosts: import("../../internal-agents/schema.js").Schema<string[] | undefined>;
|
|
599
615
|
cors: import("../../internal-agents/schema.js").Schema<boolean | import("../../extensions/schema/schema-validator.js").InferShape<{
|
|
600
616
|
origin: import("../../internal-agents/schema.js").Schema<string | string[] | CorsOriginValidator | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/config/schemas/config.schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/config/schemas/config.schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAahF,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,qCAAqC,CAAC;AAiG7C,KAAK,mBAAmB,GAAG,CACzB,MAAM,EAAE,MAAM,KACX,OAAO,GAAG,MAAM,CAAC;AAkMtB,eAAO,MAAM,wBAAwB;;;;;QAQ3B,2GAA2G;;;;;;;;;;;;;;;IA0B/G,wFAAwF;;IAExF,0FAA0F;;;;;;;;QAWtF;;;;WAIG;;;;;;;;;;;;;;;;;;;;;YAkCC,gFAAgF;;;YAGhF;;;eAGG;;;gBAIC,6EAA6E;;;;QAuCrF;;;;;;;;;;;;;;;;;WAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0DH;;;;;;;WAOG;;;;;;;;;;;QA0BH;;;;;;;;;;;;;;;WAeG;;;;;;;;;;QAKH;;;;;;WAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA+JK,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAwD3D,kFAAkF;;YAElF,oFAAoF;;YAEpF,+EAA+E;;YAE/E,mEAAmE;;;;;;;;;;;;;;;;;;YA2BnE,mCAAmC;;YAEnC,8CAA8C;;YAE9C,sBAAsB;;YAEtB,mDAAmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoFvD,yDAAyD;;QAEzD,iDAAiD;;;YAI7C,iEAAiE;;;;;;;IAkBzE,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AAuC;;QAGnC,2CAA2C;;;IAM/C,0EAA0E;;QAGtE,6DAA6D;;;IAcjE;;;OAGG;;;;;;;;;IAmBH;;;;;;OAMG;;;YAUO,+DAA+D;;;;IAoBzE;;;;;;;;;OASG;;IAEH,0CAA0C;;QAGtC,8CAA8C;;QAE9C,gEAAgE;;QAEhE,yCAAyC;;QAEzC,qCAAqC;;QAErC,sBAAsB;;QAEtB,gCAAgC;;YAG5B,qDAAqD;;YAErD,qDAAqD;;YAErD,oDAAoD;;;QAMxD,oCAAoC;;YAGhC,4EAA4E;;YAE5E,8DAA8D;;YAE9D,8EAA8E;;;;IAcnB,CAAC;AAG1E,KAAK,uBAAuB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC;AACxF,KAAK,4BAA4B,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC;AAE5F,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,uBAAuB,EAAE,cAAc,CAAC,GAAG;IAC5E,YAAY,CAAC,EAAE,6BAA6B,CAAC;CAC9C,CAAC;AACF,yEAAyE;AACzE,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,4BAA4B,EAAE,cAAc,CAAC,GAAG;IACtF,YAAY,CAAC,EAAE,6BAA6B,CAAC;CAC9C,CAAC;AAGF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAsBvE;AAmCD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAEhF"}
|
|
@@ -3,6 +3,7 @@ import { isAbsolute } from "../../platform/compat/path/index.js";
|
|
|
3
3
|
import { CONFIG_VALIDATION_FAILED } from "../../errors/error-registry.js";
|
|
4
4
|
import { MAX_REMOTE_INTEGRATION_TOOL_NAME_LENGTH, MAX_SOURCE_INTEGRATION_POLICY_INTEGRATIONS, MAX_SOURCE_INTEGRATION_POLICY_SEGMENT_LENGTH, MAX_SOURCE_INTEGRATION_POLICY_TOOL_IDS, } from "../../integrations/limits.js";
|
|
5
5
|
import { ALL_INTEGRATION_NAMES } from "../../integrations/schema.js";
|
|
6
|
+
import { EXAMPLE_CSP_DIRECTIVES, isCspDirectiveName, } from "../../security/http/csp-directives.js";
|
|
6
7
|
import { MAX_CACHE_TTL_MILLISECONDS } from "../../cache/backends/ttl.js";
|
|
7
8
|
import { MAX_PORT, MIN_PORT } from "../../utils/constants/network.js";
|
|
8
9
|
import { HTTP_TOKEN_PATTERN, isBoundedCorsOrigin, isBoundedCorsOriginList, isBoundedCorsTokenList, MAX_CORS_MAX_AGE, MAX_CORS_ORIGIN_COUNT, MAX_CORS_ORIGIN_LENGTH, MAX_CORS_TOKEN_COUNT, MAX_CORS_TOKEN_LENGTH, } from "../../utils/cors-policy-limits.js";
|
|
@@ -385,7 +386,33 @@ export const getVeryfrontConfigSchema = defineSchema((v) => v
|
|
|
385
386
|
.strict()
|
|
386
387
|
.refine((auth) => !(auth.basic && auth.bearer), "Configure either basic or bearer authentication, not both")
|
|
387
388
|
.optional(),
|
|
388
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Extra CSP sources, merged into the platform's baseline policy.
|
|
391
|
+
*
|
|
392
|
+
* Additive: `{ fontSrc: ["https://fonts.gstatic.com"] }` keeps every
|
|
393
|
+
* default and adds that origin. `null` drops the platform's optional
|
|
394
|
+
* sources for one directive (e.g. `styleSrc: null` removes
|
|
395
|
+
* `'unsafe-inline'`) while keeping the ones the renderer requires.
|
|
396
|
+
*/
|
|
397
|
+
csp: v
|
|
398
|
+
.record(v.string(), v.union([v.array(v.string()), v.null()]))
|
|
399
|
+
.superRefine((csp, ctx) => {
|
|
400
|
+
for (const key of Object.keys(csp)) {
|
|
401
|
+
if (isCspDirectiveName(key))
|
|
402
|
+
continue;
|
|
403
|
+
// Browsers ignore unknown directives silently, so a typo would
|
|
404
|
+
// otherwise read as configured and protect nothing.
|
|
405
|
+
ctx.addIssue({
|
|
406
|
+
message: `Unknown Content-Security-Policy directive "${key}". ` +
|
|
407
|
+
`Use a directive name such as ${EXAMPLE_CSP_DIRECTIVES.join(", ")} (camelCase or kebab-case).`,
|
|
408
|
+
// Relative to the refined value, which is already
|
|
409
|
+
// `security.csp`. Prefixing "csp" would report
|
|
410
|
+
// `security.csp.csp.<key>`.
|
|
411
|
+
path: [key],
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
})
|
|
415
|
+
.optional(),
|
|
389
416
|
remoteHosts: v
|
|
390
417
|
.array(v.string().max(MAX_REMOTE_HOST_URL_LENGTH).url())
|
|
391
418
|
.max(MAX_REMOTE_HOST_COUNT)
|