@orkestrel/scaffold 0.0.118 → 0.0.120
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/bin/main.js +15 -15
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/platforms/windows.md +2 -1
- package/dist/host/agents/skills/orkestrel-journey/references/layer.md +10 -10
- package/dist/host/agents/skills/orkestrel-journey/references/statechart.md +1 -1
- package/dist/host/agents/skills/orkestrel-journey/references/styles.md +3 -3
- package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +2 -1
- package/dist/host/claude/agents/orkestrel.md +27 -26
- package/dist/host/claude/rules/names.md +3 -2
- package/dist/host/claude/rules/tests.md +4 -2
- package/dist/host/claude/rules/typescript.md +2 -3
- package/dist/host/claude/rules/workspace.md +2 -1
- package/dist/host/guides/abort.md +0 -4
- package/dist/host/guides/budget.md +1 -5
- package/dist/host/guides/codec.md +18 -3
- package/dist/host/guides/contract.md +23 -44
- package/dist/host/guides/csv.md +86 -93
- package/dist/host/guides/database.md +0 -4
- package/dist/host/guides/emitter.md +0 -2
- package/dist/host/guides/form.md +26 -47
- package/dist/host/guides/html.md +3 -7
- package/dist/host/guides/indexeddb.md +28 -32
- package/dist/host/guides/jsonrpc.md +187 -0
- package/dist/host/guides/markdown.md +132 -141
- package/dist/host/guides/msg.md +47 -63
- package/dist/host/guides/ndjson.md +0 -4
- package/dist/host/guides/pool.md +0 -4
- package/dist/host/guides/process.md +71 -79
- package/dist/host/guides/reason.md +30 -36
- package/dist/host/guides/router.md +11 -18
- package/dist/host/guides/scaffold.md +147 -137
- package/dist/host/guides/sqlite.md +0 -4
- package/dist/host/guides/sse.md +6 -10
- package/dist/host/guides/table.md +481 -493
- package/dist/host/guides/template.md +0 -4
- package/dist/host/guides/test.md +46 -66
- package/dist/host/guides/timeout.md +0 -6
- package/dist/host/guides/tool.md +2 -6
- package/dist/host/guides/websocket.md +0 -4
- package/dist/host/manifest.json +100 -428
- package/dist/host/tests/setupPolicy.ts +18 -6
- package/dist/src/core/index.cjs +171 -122
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +236 -213
- package/dist/src/core/index.d.ts +236 -213
- package/dist/src/core/index.js +159 -111
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +62 -39
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +59 -54
- package/dist/src/server/index.d.ts +59 -54
- package/dist/src/server/index.js +63 -40
- package/dist/src/server/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -106,33 +106,33 @@ The definitions & subjects capability layer's stateful workspace builders: mutat
|
|
|
106
106
|
|
|
107
107
|
Plain-data constructors for the declarative definition vocabulary — no lifecycle, no emitter, no identity. Reach for the entity factories earlier when you need a working instance instead.
|
|
108
108
|
|
|
109
|
-
| Name | Kind | Signature | Summary
|
|
110
|
-
| ------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
111
|
-
| `createCheck` | function | `(field: FieldPath, operator: Comparison, value: unknown) => Check` | Creates a `Check` — one field predicate.
|
|
112
|
-
| `createAtom` | function | `(field: FieldPath, operator: Comparison, value: unknown) => Expression` | Creates an atom `Expression` — a leaf wrapping one `Check`.
|
|
113
|
-
| `createCompound` | function | `(operator: LogicalOperator, operands: readonly Expression[]) => Expression` | Creates a compound `Expression` — a logical connective over nested operands.
|
|
114
|
-
| `createRule` | function | `(id: string, premises: readonly Expression[], conclusion: Expression, overrides?: Partial<Omit<Rule, 'id' \| 'premises' \| 'conclusion'>>) => Rule` | Creates a `Rule` — premises and a conclusion.
|
|
115
|
-
| `createTransform` | function | `(operator: MathOperation, operand?: number) => Transform` | Creates a `Transform` — one math step.
|
|
116
|
-
| `createBounds` | function | `(minimum?: number, maximum?: number) => Bounds` | Creates a `Bounds` — an inclusive numeric clamp.
|
|
117
|
-
| `createVariable` | function | `(name: string) => SymbolicExpression` | Creates a variable `SymbolicExpression` leaf.
|
|
118
|
-
| `createConstant` | function | `(value: number) => SymbolicExpression` | Creates a constant `SymbolicExpression` leaf.
|
|
119
|
-
| `createOperation` | function | `(operator: MathOperation, left: SymbolicExpression, right?: SymbolicExpression) => SymbolicExpression` | Creates an operation `SymbolicExpression` node.
|
|
120
|
-
| `createEquation` | function | `(id: string, left: SymbolicExpression, right: SymbolicExpression, target: string, overrides?: Partial<Omit<Equation, 'id' \| 'left' \| 'right' \| 'target'>>) => Equation` | Creates an `Equation` — `left = right`, solved for `target`.
|
|
121
|
-
| `createFact` | function | `(id: string, predicate: string, terms: readonly unknown[], confidence?: number) => Fact` | Creates a `Fact` — a predicate over positional terms.
|
|
122
|
-
| `createInference` | function | `(id: string, premises: readonly Fact[], conclusion: Fact, overrides?: Partial<Omit<Inference, 'id' \| 'premises' \| 'conclusion'>>) => Inference` | Creates an `Inference` — premise patterns and a conclusion pattern.
|
|
123
|
-
| `createStaticSource` | function | `(value: number) =>
|
|
124
|
-
| `createFieldSource` | function | `(field: FieldPath) =>
|
|
125
|
-
| `createLookupSource` | function | `(field: FieldPath, table: Readonly<Record<string, number>>) =>
|
|
126
|
-
| `createRangeSource` | function | `(field: FieldPath, ranges: readonly FactorRange[]) =>
|
|
127
|
-
| `createStaticFactor` | function | `(id: string, value: number, overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a static `
|
|
128
|
-
| `createFieldFactor` | function | `(id: string, field: FieldPath, overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a field `
|
|
129
|
-
| `createLookupFactor` | function | `(id: string, field: FieldPath, table: Readonly<Record<string, number>>, overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a lookup `
|
|
130
|
-
| `createRangeFactor` | function | `(id: string, field: FieldPath, ranges: readonly FactorRange[], overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a range `
|
|
131
|
-
| `createFactorGroup` | function | `(id: string, aggregation: Aggregation, factors: readonly Factor[], overrides?: Partial<Omit<FactorGroup, 'id' \| 'aggregation' \| 'factors'>>) => FactorGroup` | Creates a `FactorGroup`.
|
|
132
|
-
| `createQuantitativeDefinition` | function | `(id: string, name: string, groups: readonly FactorGroup[], overrides?: Partial<Omit<QuantitativeDefinition, 'reasoning' \| 'id' \| 'name' \| 'groups'>>) => QuantitativeDefinition` | Creates a `QuantitativeDefinition`.
|
|
133
|
-
| `createLogicalDefinition` | function | `(id: string, name: string, rules: readonly Rule[], overrides?: Partial<Omit<LogicalDefinition, 'reasoning' \| 'id' \| 'name' \| 'rules'>>) => LogicalDefinition` | Creates a `LogicalDefinition`.
|
|
134
|
-
| `createSymbolicDefinition` | function | `(id: string, name: string, equations: readonly Equation[], overrides?: Partial<Omit<SymbolicDefinition, 'reasoning' \| 'id' \| 'name' \| 'equations'>>) => SymbolicDefinition` | Creates a `SymbolicDefinition`.
|
|
135
|
-
| `createInferentialDefinition` | function | `(id: string, name: string, facts: readonly Fact[], inferences: readonly Inference[], overrides?: Partial<Omit<InferentialDefinition, 'reasoning' \| 'id' \| 'name' \| 'facts' \| 'inferences'>>) => InferentialDefinition` | Creates an `InferentialDefinition`.
|
|
109
|
+
| Name | Kind | Signature | Summary |
|
|
110
|
+
| ------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| `createCheck` | function | `(field: FieldPath, operator: Comparison, value: unknown) => Check` | Creates a `Check` — one field predicate. |
|
|
112
|
+
| `createAtom` | function | `(field: FieldPath, operator: Comparison, value: unknown) => Expression` | Creates an atom `Expression` — a leaf wrapping one `Check`. |
|
|
113
|
+
| `createCompound` | function | `(operator: LogicalOperator, operands: readonly Expression[]) => Expression` | Creates a compound `Expression` — a logical connective over nested operands. |
|
|
114
|
+
| `createRule` | function | `(id: string, premises: readonly Expression[], conclusion: Expression, overrides?: Partial<Omit<Rule, 'id' \| 'premises' \| 'conclusion'>>) => Rule` | Creates a `Rule` — premises and a conclusion. |
|
|
115
|
+
| `createTransform` | function | `(operator: MathOperation, operand?: number) => Transform` | Creates a `Transform` — one math step. |
|
|
116
|
+
| `createBounds` | function | `(minimum?: number, maximum?: number) => Bounds` | Creates a `Bounds` — an inclusive numeric clamp. |
|
|
117
|
+
| `createVariable` | function | `(name: string) => SymbolicExpression` | Creates a variable `SymbolicExpression` leaf. |
|
|
118
|
+
| `createConstant` | function | `(value: number) => SymbolicExpression` | Creates a constant `SymbolicExpression` leaf. |
|
|
119
|
+
| `createOperation` | function | `(operator: MathOperation, left: SymbolicExpression, right?: SymbolicExpression) => SymbolicExpression` | Creates an operation `SymbolicExpression` node. |
|
|
120
|
+
| `createEquation` | function | `(id: string, left: SymbolicExpression, right: SymbolicExpression, target: string, overrides?: Partial<Omit<Equation, 'id' \| 'left' \| 'right' \| 'target'>>) => Equation` | Creates an `Equation` — `left = right`, solved for `target`. |
|
|
121
|
+
| `createFact` | function | `(id: string, predicate: string, terms: readonly unknown[], confidence?: number) => Fact` | Creates a `Fact` — a predicate over positional terms. |
|
|
122
|
+
| `createInference` | function | `(id: string, premises: readonly Fact[], conclusion: Fact, overrides?: Partial<Omit<Inference, 'id' \| 'premises' \| 'conclusion'>>) => Inference` | Creates an `Inference` — premise patterns and a conclusion pattern. |
|
|
123
|
+
| `createStaticSource` | function | `(value: number) => FactorSource` | Creates a static `FactorSource` — a fixed number. |
|
|
124
|
+
| `createFieldSource` | function | `(field: FieldPath) => FactorSource` | Creates a field `FactorSource` — a subject field read as a number. |
|
|
125
|
+
| `createLookupSource` | function | `(field: FieldPath, table: Readonly<Record<string, number>>) => FactorSource` | Creates a lookup `FactorSource` — a subject field mapped through a table. |
|
|
126
|
+
| `createRangeSource` | function | `(field: FieldPath, ranges: readonly FactorRange[]) => FactorSource` | Creates a range `FactorSource` — a numeric subject field banded through ordered ranges (first match wins). |
|
|
127
|
+
| `createStaticFactor` | function | `(id: string, value: number, overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a static `FactorSource`. |
|
|
128
|
+
| `createFieldFactor` | function | `(id: string, field: FieldPath, overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a field `FactorSource`. |
|
|
129
|
+
| `createLookupFactor` | function | `(id: string, field: FieldPath, table: Readonly<Record<string, number>>, overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a lookup `FactorSource`. |
|
|
130
|
+
| `createRangeFactor` | function | `(id: string, field: FieldPath, ranges: readonly FactorRange[], overrides?: Partial<Omit<Factor, 'id' \| 'source'>>) => Factor` | Creates a `Factor` over a range `FactorSource`. |
|
|
131
|
+
| `createFactorGroup` | function | `(id: string, aggregation: Aggregation, factors: readonly Factor[], overrides?: Partial<Omit<FactorGroup, 'id' \| 'aggregation' \| 'factors'>>) => FactorGroup` | Creates a `FactorGroup`. |
|
|
132
|
+
| `createQuantitativeDefinition` | function | `(id: string, name: string, groups: readonly FactorGroup[], overrides?: Partial<Omit<QuantitativeDefinition, 'reasoning' \| 'id' \| 'name' \| 'groups'>>) => QuantitativeDefinition` | Creates a `QuantitativeDefinition`. |
|
|
133
|
+
| `createLogicalDefinition` | function | `(id: string, name: string, rules: readonly Rule[], overrides?: Partial<Omit<LogicalDefinition, 'reasoning' \| 'id' \| 'name' \| 'rules'>>) => LogicalDefinition` | Creates a `LogicalDefinition`. |
|
|
134
|
+
| `createSymbolicDefinition` | function | `(id: string, name: string, equations: readonly Equation[], overrides?: Partial<Omit<SymbolicDefinition, 'reasoning' \| 'id' \| 'name' \| 'equations'>>) => SymbolicDefinition` | Creates a `SymbolicDefinition`. |
|
|
135
|
+
| `createInferentialDefinition` | function | `(id: string, name: string, facts: readonly Fact[], inferences: readonly Inference[], overrides?: Partial<Omit<InferentialDefinition, 'reasoning' \| 'id' \| 'name' \| 'facts' \| 'inferences'>>) => InferentialDefinition` | Creates an `InferentialDefinition`. |
|
|
136
136
|
|
|
137
137
|
Every value factory returns a fresh object and omits absent optional keys entirely, so its output round-trips the exact-record validators in § Validators.
|
|
138
138
|
|
|
@@ -145,7 +145,7 @@ Every value factory returns a fresh object and omits absent optional keys entire
|
|
|
145
145
|
| `roundTo` | function | `(value: number, precision?: number) => number` | Rounds a number to a fixed count of decimal places. |
|
|
146
146
|
| `matchesBounds` | function | `(value: unknown, range: unknown) => boolean` | Checks whether a value falls inside an inclusive range expressed as an array. |
|
|
147
147
|
| `emptyAggregate` | function | `(aggregation: Aggregation) => number` | Returns the empty-input identity of one `Aggregation`. |
|
|
148
|
-
| `resolveSource` | function | `(source:
|
|
148
|
+
| `resolveSource` | function | `(source: FactorSource, subject: Subject, fallback?: number) => number \| undefined` | Resolves one `FactorSource` against a subject, falling back when it cannot. |
|
|
149
149
|
| `equalValues` | function | `(left: unknown, right: unknown) => boolean` | Determines whether two values are SameValueZero-equal — strict `===` with `NaN` equal to itself (and, unlike `Object.is`, `+0` equal to `-0`). |
|
|
150
150
|
| `sortByPriority` | function | `<T extends { readonly priority?: number; }>(items: readonly T[]) => readonly T[]` | Sorts items ascending by `priority ?? DEFAULT_PRIORITY` — a stable copy sort. |
|
|
151
151
|
| `findDuplicates` | function | `(items: ReadonlyArray<{ readonly id: string; }>) => readonly string[]` | Collects the ids that appear more than once in an id-carrying list — each duplicated id reported once, in first-occurrence order. |
|
|
@@ -222,8 +222,6 @@ The definitions & subjects capability layer (§ Classes) adds a pure, copy-on-wr
|
|
|
222
222
|
|
|
223
223
|
Total guards return `false`, never throw, for adversarial input such as junk, cycles, and hostile prototypes. Input guards compose the [contracts](contract.md) combinators. Result guards use bespoke open member checks and retain those combinators for nested values. Exactness follows who produces the value, not who declares the type: caller-supplied input records are exact, while package or foreign-interface result records are open to extra members. Numeric input fields guard with `isFiniteNumber` (JSON cannot carry `NaN` / `±Infinity`); the recursive input shapes recurse through `lazyOf`.
|
|
224
224
|
|
|
225
|
-
In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
226
|
-
|
|
227
225
|
| Name | Kind | Signature | Summary |
|
|
228
226
|
| -------------------------- | -------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
229
227
|
| `isReasoning` | const | `Guard<Reasoning>` | Determines whether a value is a `Reasoning` literal. |
|
|
@@ -238,7 +236,7 @@ In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
|
238
236
|
| `isTransform` | function | `(value: unknown) => value is Transform` | Determines whether a value is a `Transform` — one math step. |
|
|
239
237
|
| `isBounds` | function | `(value: unknown) => value is Bounds` | Determines whether a value is a `Bounds` — an inclusive numeric clamp. |
|
|
240
238
|
| `isFactorRange` | function | `(value: unknown) => value is FactorRange` | Determines whether a value is a `FactorRange` — one band of a range source. |
|
|
241
|
-
| `isSource` | function | `(value: unknown) => value is
|
|
239
|
+
| `isSource` | function | `(value: unknown) => value is FactorSource` | Determines whether a value is a `FactorSource` — a static, field, lookup, or range factor source, discriminated by `origin`. |
|
|
242
240
|
| `isFactor` | function | `(value: unknown) => value is Factor` | Determines whether a value is a `Factor` — one scored input of a quantitative group. |
|
|
243
241
|
| `isFactorGroup` | function | `(value: unknown) => value is FactorGroup` | Determines whether a value is a `FactorGroup` — a group of factors aggregated into one value. |
|
|
244
242
|
| `isExpression` | function | `(value: unknown) => value is Expression` | Determines whether a value is an `Expression` — a boolean expression tree of atoms and compounds, discriminated by `form`. |
|
|
@@ -282,8 +280,6 @@ In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
|
282
280
|
|
|
283
281
|
### Constants
|
|
284
282
|
|
|
285
|
-
A `Shape` cell holds the constant's declared type.
|
|
286
|
-
|
|
287
283
|
| Name | Kind | Signature | Summary |
|
|
288
284
|
| -------------------------- | ----- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
289
285
|
| `DEFAULT_REASON_BAIL` | const | `true` | Holds the default `bail` for the `Reason` orchestrator — a reasoner throw is rethrown after the `error` emit. Default: `true`. |
|
|
@@ -308,8 +304,6 @@ A `Shape` cell holds the constant's declared type.
|
|
|
308
304
|
|
|
309
305
|
### Types
|
|
310
306
|
|
|
311
|
-
A `Shape` cell holds an interface's data members as bare names in braces, `?` marking an optional member and `plus` introducing its call-signature members, and a type alias's own type literal with a union's arms escaped as `\|`.
|
|
312
|
-
|
|
313
307
|
| Name | Kind | Signature | Summary |
|
|
314
308
|
| ----------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
315
309
|
| `Reasoning` | type | `'quantitative' \| 'logical' \| 'symbolic' \| 'inferential'` | Names the reasoning strategies — the axis a `Definition` and a `ReasonResult` discriminate on. |
|
|
@@ -327,7 +321,7 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
|
|
|
327
321
|
| `FieldSource` | interface | `{ origin, field }` | Represents a factor source reading a subject field as a number. |
|
|
328
322
|
| `LookupSource` | interface | `{ origin, field, table }` | Represents a factor source mapping a subject field through a lookup table. |
|
|
329
323
|
| `RangeSource` | interface | `{ origin, field, ranges }` | Represents a factor source banding a numeric subject field through ordered ranges. |
|
|
330
|
-
| `
|
|
324
|
+
| `FactorSource` | type | `StaticSource \| FieldSource \| LookupSource \| RangeSource` | Represents a static, field, lookup, or range factor source, discriminated by `origin`. |
|
|
331
325
|
| `FactorRange` | interface | `{ bounds?, value }` | Represents one band of a `RangeSource` — an optional inclusive bounds test and the value it yields. |
|
|
332
326
|
| `Factor` | interface | `{ id, name, description?, source, fallback?, checks?, transforms?, bounds?, weight?, priority?, enabled?, required? }` | Represents one scored input of a quantitative group. |
|
|
333
327
|
| `FactorGroup` | interface | `{ id, name, description?, factors, aggregation, base?, bounds?, enabled?, strict? }` | Represents a group of factors aggregated into one value. |
|
|
@@ -58,21 +58,18 @@ Browser and server usage appear under [Patterns](#patterns).
|
|
|
58
58
|
|
|
59
59
|
### Constants
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `TIER_PARAM` | const | `1` | Names the specificity tier for a \*\*param\*\* path segment (`:name`) — ranks below a literal segment and above a wildcard segment at the same position. |
|
|
69
|
-
| `TIER_WILDCARD` | const | `0` | Names the specificity tier for a \*\*wildcard\*\* path segment (`*name`) — the lowest tier; a wildcard only ever wins against another wildcard shape (an equal-specificity tie resolved by registration order). |
|
|
61
|
+
| Name | Kind | Signature | Summary |
|
|
62
|
+
| --------------- | ----- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `METHOD_LIST` | const | `readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]` | Lists the HTTP methods a `DispatcherInterface` registers routes under, in canonical order — a frozen literal tuple, and the single source the `Method` type, `HTTP_METHODS`, and `parseMethod` are all derived from. |
|
|
64
|
+
| `HTTP_METHODS` | const | `ReadonlySet<string>` | Holds every HTTP method a `DispatcherInterface` registers routes under as a `ReadonlySet` — backs the registration guard (`add` rejects any `method` outside this set). |
|
|
65
|
+
| `TIER_LITERAL` | const | `2` | Names the specificity tier for a \*\*literal\*\* path segment (`/users`) — the highest tier, always outranking a param or wildcard segment at the same position. |
|
|
66
|
+
| `TIER_PARAM` | const | `1` | Names the specificity tier for a \*\*param\*\* path segment (`:name`) — ranks below a literal segment and above a wildcard segment at the same position. |
|
|
67
|
+
| `TIER_WILDCARD` | const | `0` | Names the specificity tier for a \*\*wildcard\*\* path segment (`*name`) — the lowest tier; a wildcard only ever wins against another wildcard shape (an equal-specificity tie resolved by registration order). |
|
|
70
68
|
|
|
71
69
|
### Helpers
|
|
72
70
|
|
|
73
71
|
| Name | Kind | Signature | Summary |
|
|
74
72
|
| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
75
|
-
| `escapeRegExp` | function | `(value: string) => string` | Escapes every regex metacharacter in a literal string so it can be embedded inside a larger `RegExp` source without being interpreted as syntax. |
|
|
76
73
|
| `canonicalizePath` | function | `(path: string) => string` | Canonicalizes a route path for registry identity — strips a single trailing slash, except the root `/` (and the empty pattern). The trailing-slash fold `compilePath` normalizes a pattern through, so identity agrees with the matcher. |
|
|
77
74
|
| `computeDispatchKey` | function | `(entry: RouteEntry<{ readonly method: Method; }>) => string` | Computes the canonical `METHOD /path` registry key for a method-dimensioned dispatcher route. |
|
|
78
75
|
| `compilePath` | function | `(path: string, sensitive?: boolean) => CompiledPath` | Compiles a route path pattern into an anchored regex and its ordered param names. |
|
|
@@ -98,8 +95,6 @@ A `Shape` cell holds the constant's declared type.
|
|
|
98
95
|
|
|
99
96
|
### Guards
|
|
100
97
|
|
|
101
|
-
In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
102
|
-
|
|
103
98
|
| Name | Kind | Signature | Summary |
|
|
104
99
|
| ------------------- | -------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
105
100
|
| `isEncryptedSocket` | function | `(socket: unknown) => socket is { readonly encrypted: true; }` | Determines whether a `node:http` connection socket is TLS-encrypted — the total, never-throwing narrow `buildRequest` uses to pick the derived scheme (`https` vs `http`). |
|
|
@@ -123,8 +118,6 @@ In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
|
123
118
|
|
|
124
119
|
### Types
|
|
125
120
|
|
|
126
|
-
A `Shape` cell holds an interface's data members as bare names in braces, `?` marking an optional member and `plus` introducing its call-signature members, and a type alias's own type literal with a union's arms escaped as `\|`.
|
|
127
|
-
|
|
128
121
|
| Name | Kind | Signature | Summary |
|
|
129
122
|
| ------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
130
123
|
| `PathParams` | type | `{ readonly [K in keyof PathParamsRaw<Path>]: PathParamsRaw<Path>[K]; }` | Extracts `{ name: string }` param records from a path pattern at the type level — the typed half of the path grammar. |
|
|
@@ -141,7 +134,7 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
|
|
|
141
134
|
| `RouterOptions` | interface | `{ entries?, sensitive?, key? }` | Represents the options for `createRouter` — an optional initial entry set, the case-sensitivity toggle, and the dedup identity function. |
|
|
142
135
|
| `RouterInterface` | interface | `{ count, add(), match(), entries(), group(), clear() }` | Represents the path-matching + registry engine contract (the behavioral-interface role for the one-class-per-file `Router`). Registers `{ path, meta, name? }` entries (compiling each path once) and resolves a concrete pathname to the most specific matching entry — a literal segment beats a param beats a wildcard at the earliest differing segment, registration-order-independent. The shared engine both the `Navigator` (browser) and the `Dispatcher` (core, method-dimensioned) compose. |
|
|
143
136
|
| `GroupInterface` | interface | `{ prefix, add(), group() }` | Represents a prefix-scoped registration handle over a `RouterInterface` — pure string composition, no independent state or storage. |
|
|
144
|
-
| `Method` | type | `(typeof METHOD_LIST)[number]` | Names the HTTP methods a `DispatcherInterface` dimensions dispatch over — derived from `METHOD_LIST`, whose membership counterpart is `
|
|
137
|
+
| `Method` | type | `(typeof METHOD_LIST)[number]` | Names the HTTP methods a `DispatcherInterface` dimensions dispatch over — derived from `METHOD_LIST`, whose membership counterpart is `HTTP_METHODS`. |
|
|
145
138
|
| `RouteContext` | interface | `{ params, pattern, url, state }` | Represents the ambient context a `RouteHandler` receives alongside the raw `Request` — decoded params, the winning pattern, the parsed URL, and the consumer's opaque per-request state. |
|
|
146
139
|
| `RouteHandler` | type | `(request: Request, context: RouteContext<Path, TState>) => Response \| Promise<Response>` | Receives the raw fetch `Request` plus its typed `RouteContext` and returns (or resolves) a fetch `Response`. |
|
|
147
140
|
| `RouteInput` | interface | `{ method, path, handler, name? }` | Represents one route registration input for `DispatcherInterface.add` — the method-dimensioned counterpart of `RouteEntry`. |
|
|
@@ -161,7 +154,7 @@ A `Shape` cell holds an interface's data members as bare names in braces, `?` ma
|
|
|
161
154
|
The `count` member of `RouterInterface`, the `prefix` member of `GroupInterface` and
|
|
162
155
|
`DispatchGroupInterface`, the `router` and `emitter` members of `DispatcherInterface`, and the
|
|
163
156
|
`router`, `emitter`, and `active` members of `NavigatorInterface` are all `readonly` data members
|
|
164
|
-
(the preceding Surface rows) — the call-signature members each `
|
|
157
|
+
(the preceding Surface rows) — the call-signature members each `Signature` cell names with parentheses are
|
|
165
158
|
documented under [Methods](#methods).
|
|
166
159
|
|
|
167
160
|
## Methods
|
|
@@ -701,8 +694,8 @@ const server = http.createServer((incoming, response) => {
|
|
|
701
694
|
`DispatchGroup` direct construction and group + nested group registration
|
|
702
695
|
with prefixes composed.
|
|
703
696
|
- [`tests/src/core/helpers.test.ts`](../tests/src/core/helpers.test.ts) —
|
|
704
|
-
`
|
|
705
|
-
trailing-slash folding, case sensitivity, the wildcard-not-final throw),
|
|
697
|
+
`canonicalizePath`, `computeDispatchKey`, `compilePath` (literal/param/wildcard, escaped
|
|
698
|
+
regex metacharacters, trailing-slash folding, case sensitivity, the wildcard-not-final throw),
|
|
706
699
|
`decodeParam` (including a malformed `%` escape), `matchPath`,
|
|
707
700
|
`classifySegment` (the literal-vs-param classification fix regression
|
|
708
701
|
case), `computeSpecificity`, `compareSpecificity`, `joinPaths`, and
|