@sleepy-hollow/framework 0.3.3 → 0.3.5

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/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  createOperationalRoutes,
6
6
  defineConfiguration,
7
7
  resolveConfiguration
8
- } from "./chunk-4PPSJ2LE.js";
8
+ } from "./chunk-2GNHTFCZ.js";
9
9
  import {
10
10
  DatabaseConfigurationError,
11
11
  defineResource,
@@ -20,7 +20,7 @@ import {
20
20
  createSecurityRouter,
21
21
  defineSecurity,
22
22
  redactSecurityData
23
- } from "./chunk-LZ2HLHDW.js";
23
+ } from "./chunk-AADQFGT4.js";
24
24
  import {
25
25
  SchemaNormalizationError,
26
26
  createValidatedRouter,
@@ -28,15 +28,15 @@ import {
28
28
  normalizeRoutes,
29
29
  validationDiagnosticResult,
30
30
  z
31
- } from "./chunk-JRFHLLLF.js";
31
+ } from "./chunk-QY3TSXM6.js";
32
32
  import {
33
33
  HTTP_METHODS,
34
34
  RouteDiscoveryError,
35
35
  createRouter,
36
36
  defineRoute,
37
37
  discoverRoutes
38
- } from "./chunk-S3Z6CO7J.js";
39
- import "./chunk-LNJDFJGT.js";
38
+ } from "./chunk-LPPASMRR.js";
39
+ import "./chunk-EHBEUJIZ.js";
40
40
  import "./chunk-5WRI5ZAA.js";
41
41
  export {
42
42
  ConfigurationError,
package/dist/routing.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  createRouter,
5
5
  defineRoute,
6
6
  discoverRoutes
7
- } from "./chunk-S3Z6CO7J.js";
8
- import "./chunk-LNJDFJGT.js";
7
+ } from "./chunk-LPPASMRR.js";
8
+ import "./chunk-EHBEUJIZ.js";
9
9
  import "./chunk-5WRI5ZAA.js";
10
10
  export {
11
11
  HTTP_METHODS,
package/dist/security.js CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  createSecurityRouter,
6
6
  defineSecurity,
7
7
  redactSecurityData
8
- } from "./chunk-LZ2HLHDW.js";
9
- import "./chunk-JRFHLLLF.js";
10
- import "./chunk-S3Z6CO7J.js";
11
- import "./chunk-LNJDFJGT.js";
8
+ } from "./chunk-AADQFGT4.js";
9
+ import "./chunk-QY3TSXM6.js";
10
+ import "./chunk-LPPASMRR.js";
11
+ import "./chunk-EHBEUJIZ.js";
12
12
  import "./chunk-5WRI5ZAA.js";
13
13
  export {
14
14
  SecurityConfigurationError,
package/dist/server.d.ts CHANGED
@@ -1,10 +1,19 @@
1
- import * as node_http from 'node:http';
2
-
3
1
  type FetchHandler = (request: Request) => Response | Promise<Response>;
4
- /** Starts the Node HTTP adapter for a framework fetch handler. */
5
- declare function serve(handler: FetchHandler, options?: {
2
+ interface ServerOptions {
6
3
  readonly port?: number;
7
4
  readonly hostname?: string;
8
- }): node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>;
5
+ readonly signal?: AbortSignal;
6
+ readonly onListen?: () => void | Promise<void>;
7
+ }
8
+ interface HttpServer {
9
+ /** Resolves only after the underlying Node listener emits `listening`. */
10
+ readonly ready: Promise<void>;
11
+ /** Resolves on a normal close and rejects on a post-bind server failure. */
12
+ readonly finished: Promise<void>;
13
+ /** Stops accepting connections and waits for the listener to close. */
14
+ shutdown(): Promise<void>;
15
+ }
16
+ /** Starts the Node HTTP adapter for a framework fetch handler. */
17
+ declare function serve(handler: FetchHandler, options?: ServerOptions): HttpServer;
9
18
 
10
- export { type FetchHandler, serve };
19
+ export { type FetchHandler, type HttpServer, type ServerOptions, serve };
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-LNJDFJGT.js";
3
+ } from "./chunk-EHBEUJIZ.js";
4
4
  import "./chunk-5WRI5ZAA.js";
5
5
  export {
6
6
  serve
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TestingDiagnostic, P as ProblemExpectation, a as ProblemDetails, R as RequirementEvidence, B as BaselineCheck, b as RedTestResult, c as RedStateResult, C as CriterionTestRegistry, d as TestApplicationOptions, e as TestApplicationContext, f as TestManifest, g as TestExecutionResult, h as TraceabilityReport, i as CriterionTestSpec, j as CriterionTestDescriptor, k as RequirementDependency, l as TestSelection } from './types-Bet36nZS.js';
2
- export { A as ApprovedCriterion, m as CriterionTrace, J as JsonRequestOptions, n as JsonTestResponse, o as TestApplication, p as TestApplicationFactory, q as TestApplicationFactoryContext, r as TestApplicationFixtures, s as TestApplicationSecurityOptions, t as TestManifestEntry, u as TestResultStatus } from './types-Bet36nZS.js';
1
+ import { T as TestingDiagnostic, C as CriterionTestDescriptor, P as ProblemExpectation, a as ProblemDetails, R as RequirementEvidence, B as BaselineCheck, b as RedTestResult, c as RedStateResult, d as CriterionTestRegistry, e as TestApplicationOptions, f as TestApplicationContext, g as TestManifest, h as TestExecutionResult, i as TraceabilityReport, j as CriterionTestSpec, k as RequirementDependency, l as TestSelection } from './types-t92f8Gqs.js';
2
+ export { A as ApprovedCriterion, m as CriterionTrace, J as JsonRequestOptions, n as JsonTestResponse, o as TestApplication, p as TestApplicationFactory, q as TestApplicationFactoryContext, r as TestApplicationFixtures, s as TestApplicationSecurityOptions, t as TestManifestEntry, u as TestResultStatus } from './types-t92f8Gqs.js';
3
3
  import './types-BC7LJJ6G.js';
4
4
  import './types-BUXw3UwN.js';
5
5
  import 'drizzle-orm/better-sqlite3';
@@ -23,6 +23,16 @@ declare class TestingError extends Error {
23
23
  constructor(diagnostics: readonly TestingDiagnostic[]);
24
24
  }
25
25
 
26
+ /**
27
+ * Internal hook used by the CLI to inspect criterion registrations without
28
+ * executing the native test runner. Symbol.for keeps the hook shared when a
29
+ * project imports the published testing entry point.
30
+ */
31
+ declare const CRITERION_TEST_DISCOVERY: unique symbol;
32
+ interface CriterionTestDiscovery {
33
+ readonly onRegistered: (descriptor: CriterionTestDescriptor) => void;
34
+ }
35
+
26
36
  /**
27
37
  * Builds a registry that registers tests against approved criteria.
28
38
  *
@@ -154,4 +164,4 @@ declare function selectAffectedTests(options: {
154
164
  readonly hasUnownedSharedChange?: boolean;
155
165
  }): TestSelection;
156
166
 
157
- export { BaselineCheck, CriterionTestDescriptor, CriterionTestRegistry, CriterionTestSpec, ProblemDetails, ProblemExpectation, RedStateResult, RedTestResult, RequirementDependency, RequirementEvidence, TestApplicationContext, TestApplicationOptions, TestExecutionResult, TestManifest, TestSelection, TestingDiagnostic, TestingError, TraceabilityReport, assertProblem, classifyRedState, createCriterionRegistry, createTestApplication, createTestManifest, createTraceabilityReport, criterionTest, selectAffectedTests };
167
+ export { BaselineCheck, CRITERION_TEST_DISCOVERY, CriterionTestDescriptor, type CriterionTestDiscovery, CriterionTestRegistry, CriterionTestSpec, ProblemDetails, ProblemExpectation, RedStateResult, RedTestResult, RequirementDependency, RequirementEvidence, TestApplicationContext, TestApplicationOptions, TestExecutionResult, TestManifest, TestSelection, TestingDiagnostic, TestingError, TraceabilityReport, assertProblem, classifyRedState, createCriterionRegistry, createTestApplication, createTestManifest, createTraceabilityReport, criterionTest, selectAffectedTests };
package/dist/testing.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ CRITERION_TEST_DISCOVERY,
2
3
  TestingError,
3
4
  assertProblem,
4
5
  classifyRedState,
@@ -8,14 +9,15 @@ import {
8
9
  createTraceabilityReport,
9
10
  criterionTest,
10
11
  selectAffectedTests
11
- } from "./chunk-M4D63YC7.js";
12
+ } from "./chunk-YBEJCNGD.js";
12
13
  import "./chunk-BAKXP7IR.js";
13
- import "./chunk-LZ2HLHDW.js";
14
- import "./chunk-JRFHLLLF.js";
15
- import "./chunk-S3Z6CO7J.js";
16
- import "./chunk-LNJDFJGT.js";
14
+ import "./chunk-AADQFGT4.js";
15
+ import "./chunk-QY3TSXM6.js";
16
+ import "./chunk-LPPASMRR.js";
17
+ import "./chunk-EHBEUJIZ.js";
17
18
  import "./chunk-5WRI5ZAA.js";
18
19
  export {
20
+ CRITERION_TEST_DISCOVERY,
19
21
  TestingError,
20
22
  assertProblem,
21
23
  classifyRedState,
@@ -387,4 +387,4 @@ interface TestSelection {
387
387
  readonly diagnostics: readonly TestingDiagnostic[];
388
388
  }
389
389
 
390
- export type { ApprovedCriterion as A, BaselineCheck as B, CriterionTestRegistry as C, JsonRequestOptions as J, ProblemExpectation as P, RequirementEvidence as R, TestingDiagnostic as T, ProblemDetails as a, RedTestResult as b, RedStateResult as c, TestApplicationOptions as d, TestApplicationContext as e, TestManifest as f, TestExecutionResult as g, TraceabilityReport as h, CriterionTestSpec as i, CriterionTestDescriptor as j, RequirementDependency as k, TestSelection as l, CriterionTrace as m, JsonTestResponse as n, TestApplication as o, TestApplicationFactory as p, TestApplicationFactoryContext as q, TestApplicationFixtures as r, TestApplicationSecurityOptions as s, TestManifestEntry as t, TestResultStatus as u };
390
+ export type { ApprovedCriterion as A, BaselineCheck as B, CriterionTestDescriptor as C, JsonRequestOptions as J, ProblemExpectation as P, RequirementEvidence as R, TestingDiagnostic as T, ProblemDetails as a, RedTestResult as b, RedStateResult as c, CriterionTestRegistry as d, TestApplicationOptions as e, TestApplicationContext as f, TestManifest as g, TestExecutionResult as h, TraceabilityReport as i, CriterionTestSpec as j, RequirementDependency as k, TestSelection as l, CriterionTrace as m, JsonTestResponse as n, TestApplication as o, TestApplicationFactory as p, TestApplicationFactoryContext as q, TestApplicationFixtures as r, TestApplicationSecurityOptions as s, TestManifestEntry as t, TestResultStatus as u };
@@ -5,9 +5,9 @@ import {
5
5
  normalizeRoutes,
6
6
  validationDiagnosticResult,
7
7
  z
8
- } from "./chunk-JRFHLLLF.js";
9
- import "./chunk-S3Z6CO7J.js";
10
- import "./chunk-LNJDFJGT.js";
8
+ } from "./chunk-QY3TSXM6.js";
9
+ import "./chunk-LPPASMRR.js";
10
+ import "./chunk-EHBEUJIZ.js";
11
11
  import "./chunk-5WRI5ZAA.js";
12
12
  export {
13
13
  SchemaNormalizationError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleepy-hollow/framework",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "A specification-governed Node and Bun framework for HTTP services.",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {
@@ -1,47 +0,0 @@
1
- // runtime/server.ts
2
- import { createServer } from "http";
3
- import { resolve } from "path";
4
- import { pathToFileURL } from "url";
5
- function nodeRequest(request) {
6
- const origin = `http://${request.headers.host ?? "localhost"}`;
7
- return new Request(new URL(request.url ?? "/", origin), {
8
- method: request.method,
9
- headers: request.headers,
10
- body: request.method === "GET" || request.method === "HEAD" ? void 0 : request,
11
- // Node requires this for streaming request bodies.
12
- duplex: "half"
13
- });
14
- }
15
- function serve(handler, options = {}) {
16
- const server = createServer(async (incoming, outgoing) => {
17
- try {
18
- const response = await handler(nodeRequest(incoming));
19
- outgoing.statusCode = response.status;
20
- response.headers.forEach((value, name) => outgoing.setHeader(name, value));
21
- const body = response.body ? Buffer.from(await response.arrayBuffer()) : void 0;
22
- outgoing.end(body);
23
- } catch {
24
- outgoing.statusCode = 500;
25
- outgoing.setHeader("content-type", "application/problem+json");
26
- outgoing.end(JSON.stringify({ type: "about:blank", title: "Internal Server Error", status: 500 }));
27
- }
28
- });
29
- server.listen(options.port ?? Number(process.env.PORT ?? 3e3), options.hostname ?? "0.0.0.0");
30
- return server;
31
- }
32
- async function startConfiguredApplication() {
33
- const entry = process.env.HOLLOW_APP_MODULE;
34
- if (!entry) throw new Error("HOLLOW_APP_MODULE must name the compiled application module.");
35
- const loaded = await import(pathToFileURL(resolve(entry)).href);
36
- const handler = typeof loaded.fetch === "function" ? loaded.fetch : loaded.default;
37
- if (typeof handler !== "function") throw new Error("The configured application module must export a fetch handler.");
38
- serve(handler);
39
- }
40
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
41
- await startConfiguredApplication();
42
- }
43
-
44
- export {
45
- serve
46
- };
47
- //# sourceMappingURL=chunk-LNJDFJGT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../runtime/server.ts"],"sourcesContent":["import { createServer } from \"http\";\nimport { resolve } from \"path\";\nimport { pathToFileURL } from \"url\";\n\nexport type FetchHandler = (request: Request) => Response | Promise<Response>;\n\nfunction nodeRequest(request: import(\"http\").IncomingMessage): Request {\n const origin = `http://${request.headers.host ?? \"localhost\"}`;\n return new Request(new URL(request.url ?? \"/\", origin), {\n method: request.method,\n headers: request.headers as HeadersInit,\n body: request.method === \"GET\" || request.method === \"HEAD\" ? undefined : request,\n // Node requires this for streaming request bodies.\n duplex: \"half\",\n } as RequestInit);\n}\n\n/** Starts the Node HTTP adapter for a framework fetch handler. */\nexport function serve(handler: FetchHandler, options: { readonly port?: number; readonly hostname?: string } = {}) {\n const server = createServer(async (incoming, outgoing) => {\n try {\n const response = await handler(nodeRequest(incoming));\n outgoing.statusCode = response.status;\n response.headers.forEach((value, name) => outgoing.setHeader(name, value));\n const body = response.body ? Buffer.from(await response.arrayBuffer()) : undefined;\n outgoing.end(body);\n } catch {\n outgoing.statusCode = 500;\n outgoing.setHeader(\"content-type\", \"application/problem+json\");\n outgoing.end(JSON.stringify({ type: \"about:blank\", title: \"Internal Server Error\", status: 500 }));\n }\n });\n server.listen(options.port ?? Number(process.env.PORT ?? 3000), options.hostname ?? \"0.0.0.0\");\n return server;\n}\n\nasync function startConfiguredApplication(): Promise<void> {\n const entry = process.env.HOLLOW_APP_MODULE;\n if (!entry) throw new Error(\"HOLLOW_APP_MODULE must name the compiled application module.\");\n const loaded = await import(pathToFileURL(resolve(entry)).href) as { fetch?: unknown; default?: unknown };\n const handler = typeof loaded.fetch === \"function\" ? loaded.fetch : loaded.default;\n if (typeof handler !== \"function\") throw new Error(\"The configured application module must export a fetch handler.\");\n serve(handler as FetchHandler);\n}\n\nif (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {\n await startConfiguredApplication();\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAI9B,SAAS,YAAY,SAAkD;AACrE,QAAM,SAAS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