@scrolled/nav-graph 0.1.0 → 0.1.1-dev.0fe9d51
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 +38 -24
- package/dist/dsl/builder.d.ts +23 -5
- package/dist/dsl/builder.d.ts.map +1 -1
- package/dist/dsl/builder.js +5 -3
- package/dist/dsl/builder.js.map +1 -1
- package/dist/dsl/index.d.ts +1 -1
- package/dist/dsl/index.d.ts.map +1 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/graphs/starter/index.d.ts.map +1 -1
- package/dist/graphs/starter/index.js +9 -3
- package/dist/graphs/starter/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/schema.d.ts +83 -19
- package/dist/ir/schema.d.ts.map +1 -1
- package/dist/ir/schema.js +14 -2
- package/dist/ir/schema.js.map +1 -1
- package/dist/ir/types.d.ts +11 -3
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/types.js +9 -1
- package/dist/ir/types.js.map +1 -1
- package/dist/path/findPath.d.ts +27 -0
- package/dist/path/findPath.d.ts.map +1 -1
- package/dist/path/findPath.js +128 -27
- package/dist/path/findPath.js.map +1 -1
- package/dist/path/index.d.ts +2 -2
- package/dist/path/index.d.ts.map +1 -1
- package/dist/path/index.js +1 -1
- package/dist/path/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -10,16 +10,21 @@ the design.
|
|
|
10
10
|
(`src/ir/`). Branded `NodeId` / `GroupId`, the `TravelEdge` and `Requirement`
|
|
11
11
|
unions, and a Zod schema that mirrors them.
|
|
12
12
|
- **DSL** — `defineGraph(...)`, region scopes, and the verb methods (`walk`,
|
|
13
|
-
`portalTo`, `npcTo`, `itemTo`, `skillTo`) authors call on node
|
|
14
|
-
(`src/dsl/`).
|
|
15
|
-
|
|
13
|
+
`transportTo`, `portalTo`, `npcTo`, `itemTo`, `skillTo`) authors call on node
|
|
14
|
+
handles (`src/dsl/`). `walk` and `transportTo` accept a `seconds` travel time;
|
|
15
|
+
`transportTo` models a boarded conveyance (boat/train/carpet) that is instant
|
|
16
|
+
with fast travel and costs its ride time without it. The requirement
|
|
17
|
+
constructors (`meso`, `item`, `quest`, `level`) live here too. The DSL emits
|
|
18
|
+
`NavGraphSource` — nothing more.
|
|
16
19
|
- **Compiler** — `compileGraph(source)` validates the source with Zod, runs the
|
|
17
20
|
pre-merge duplicate pass, expands bidirectional edges, and freezes adjacency
|
|
18
21
|
into a runtime `NavGraph` (`src/compile/`).
|
|
19
|
-
- **Pathfinding** — `findPath(graph, from, to, opts?)` is
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
- **Pathfinding** — `findPath(graph, from, to, opts?)` is a least-time Dijkstra:
|
|
23
|
+
`walk` and `transport` edges cost their `seconds` (or a method default), every
|
|
24
|
+
other method is instant, and `opts.fastTravel` waives `transport` time so
|
|
25
|
+
routes prefer boats over long walks. Supports optional per-edge eligibility
|
|
26
|
+
filtering; when filtering disconnects the destination it returns the best
|
|
27
|
+
unfiltered path with blocking step indices flagged (`src/path/`).
|
|
23
28
|
- **JSON** — `toJSON(graph)` serializes a compiled graph to the portability
|
|
24
29
|
shape (`src/json/`); `vite-node src/cli/export.ts` runs it from the command
|
|
25
30
|
line.
|
|
@@ -52,25 +57,34 @@ against the trust relationship npm has on file for this package + workflow.
|
|
|
52
57
|
That's it — npm will accept publishes only from this workflow file in this
|
|
53
58
|
repo. No long-lived credentials live anywhere.
|
|
54
59
|
|
|
55
|
-
**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
**Release flow (pre-1.0 — fast iteration).** The
|
|
61
|
+
[publish workflow](../../.github/workflows/nav-graph-publish.yml) runs on
|
|
62
|
+
every push to `main` that touches `packages/nav-graph/**` and picks a mode
|
|
63
|
+
based on whether `package.json`'s version is already on npm:
|
|
64
|
+
|
|
65
|
+
| `package.json` version | What ships | npm dist-tag | Pull with |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| Not yet on npm (you bumped) | The version as-is | `latest` | `npm i @scrolled/nav-graph` |
|
|
68
|
+
| Already on npm (unchanged) | `<version>-dev.<sha7>` | `dev` | `npm i @scrolled/nav-graph@dev` |
|
|
69
|
+
|
|
70
|
+
So the day-to-day loop is just: edit code, commit, push. Each push gets a
|
|
71
|
+
unique `0.1.0-dev.<sha7>` build under the `dev` tag — pullable immediately,
|
|
72
|
+
pinnable by full version, never overwritten. When you're ready to cut a
|
|
73
|
+
stable release, bump the version in `package.json` to a value that isn't on
|
|
74
|
+
npm yet, push, and that publishes to `latest`.
|
|
75
|
+
|
|
76
|
+
Either mode runs typecheck + tests + `tsc` build, then `npm publish
|
|
77
|
+
--provenance`. The OIDC handshake happens inside the npm CLI; the tarball
|
|
78
|
+
gets a Sigstore-signed provenance attestation that shows on the package
|
|
79
|
+
page.
|
|
68
80
|
|
|
69
81
|
**Dry-run a build without publishing:** trigger the workflow manually from
|
|
70
82
|
the Actions tab with `dry_run: true`. It uploads the packed tarball as an
|
|
71
|
-
artifact so you can inspect it.
|
|
83
|
+
artifact so you can inspect it before flipping the toggle off.
|
|
72
84
|
|
|
73
85
|
The published tarball contains only `dist/` (compiled JS + .d.ts +
|
|
74
|
-
sourcemaps), `LICENSE`, and `README.md`. `
|
|
75
|
-
|
|
76
|
-
inside this monorepo
|
|
86
|
+
sourcemaps), `LICENSE`, and `README.md`. `main`/`types`/`exports` in
|
|
87
|
+
`package.json` point directly at `dist/`; running tests or the export CLI
|
|
88
|
+
inside this monorepo works without consulting the exports field (Vitest and
|
|
89
|
+
the CLI use relative imports), so the dist-only exports don't get in the way
|
|
90
|
+
of source-tree dev.
|
package/dist/dsl/builder.d.ts
CHANGED
|
@@ -14,19 +14,37 @@ export interface EdgeOpts {
|
|
|
14
14
|
* - npcTo / itemTo / skillTo default directed → set true for paired transit.
|
|
15
15
|
*/
|
|
16
16
|
both?: boolean;
|
|
17
|
-
/** Reserved for the future weighted-cost model. */
|
|
18
|
-
weight?: number;
|
|
19
17
|
notes?: string;
|
|
20
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for a timed edge. Only `walk` and `transport` (boats/trains/carpets)
|
|
21
|
+
* take time, so `seconds` lives here and not on the base `EdgeOpts` — portal /
|
|
22
|
+
* npc / item / skill transitions are instant and the type system rejects a
|
|
23
|
+
* `seconds` on them.
|
|
24
|
+
*/
|
|
25
|
+
export interface TimedEdgeOpts extends EdgeOpts {
|
|
26
|
+
/**
|
|
27
|
+
* Estimated travel time, in seconds. On a `transport` edge this is the ride
|
|
28
|
+
* time when the traveller has no fast-travel ticket; with fast travel the ride
|
|
29
|
+
* is instant (see `findPath`). Drives weighted routing.
|
|
30
|
+
*/
|
|
31
|
+
seconds?: number;
|
|
32
|
+
}
|
|
21
33
|
export interface NodeHandle {
|
|
22
34
|
readonly id: NodeId;
|
|
23
|
-
walk(other: NodeHandle, opts?:
|
|
35
|
+
walk(other: NodeHandle, opts?: TimedEdgeOpts): void;
|
|
36
|
+
/**
|
|
37
|
+
* A boarded conveyance — boat, train, magic carpet. Bidirectional by default
|
|
38
|
+
* (vehicles round-trip). Takes `seconds` unless the route is found with fast
|
|
39
|
+
* travel, which makes every transport hop instant.
|
|
40
|
+
*/
|
|
41
|
+
transportTo(other: NodeHandle, opts?: TimedEdgeOpts): void;
|
|
24
42
|
portalTo(other: NodeHandle, opts?: EdgeOpts): void;
|
|
25
43
|
npcTo(other: NodeHandle, opts?: EdgeOpts): void;
|
|
26
44
|
itemTo(other: NodeHandle, opts?: EdgeOpts): void;
|
|
27
45
|
skillTo(other: NodeHandle, opts?: EdgeOpts): void;
|
|
28
|
-
/** Escape hatch when none of the named verbs fit. */
|
|
29
|
-
edgeTo(other: NodeHandle, method: TravelMethod, opts?:
|
|
46
|
+
/** Escape hatch when none of the named verbs fit. `seconds` applies only if method is 'walk' or 'transport'. */
|
|
47
|
+
edgeTo(other: NodeHandle, method: TravelMethod, opts?: TimedEdgeOpts): void;
|
|
30
48
|
}
|
|
31
49
|
export interface RegionScope {
|
|
32
50
|
node(id: string, name: string, opts?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/dsl/builder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,UAAU,EAGV,cAAc,EACd,MAAM,EACN,WAAW,EAEX,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,oEAAoE;IACpE,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/dsl/builder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,UAAU,EAGV,cAAc,EACd,MAAM,EACN,WAAW,EAEX,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,oEAAoE;IACpE,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAK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;IAC5B,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAqMD,wBAAgB,WAAW,CACzB,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC3B,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,GAC5B,cAAc,CAIhB"}
|
package/dist/dsl/builder.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { asGroupId, asNodeId } from '../ir/types';
|
|
10
10
|
const VERB_DEFAULTS = {
|
|
11
11
|
walk: { method: 'walk', defaultBidirectional: true },
|
|
12
|
+
transportTo: { method: 'transport', defaultBidirectional: true },
|
|
12
13
|
portalTo: { method: 'portal', defaultBidirectional: true },
|
|
13
14
|
npcTo: { method: 'npc', defaultBidirectional: false },
|
|
14
15
|
itemTo: { method: 'item', defaultBidirectional: false },
|
|
@@ -86,8 +87,9 @@ class Builder {
|
|
|
86
87
|
id,
|
|
87
88
|
edgeTo: (other, method, opts) => this.pushEdge(id, other.id, { ...opts, method, defaultBidirectional: false }),
|
|
88
89
|
// The named verbs are populated below — keeps the type explicit while
|
|
89
|
-
// avoiding
|
|
90
|
+
// avoiding six near-identical method bodies.
|
|
90
91
|
walk: () => undefined,
|
|
92
|
+
transportTo: () => undefined,
|
|
91
93
|
portalTo: () => undefined,
|
|
92
94
|
npcTo: () => undefined,
|
|
93
95
|
itemTo: () => undefined,
|
|
@@ -99,7 +101,7 @@ class Builder {
|
|
|
99
101
|
return handle;
|
|
100
102
|
}
|
|
101
103
|
pushEdge(from, to, opts) {
|
|
102
|
-
const { method, defaultBidirectional, both, cost, require, ref, via,
|
|
104
|
+
const { method, defaultBidirectional, both, cost, require, ref, via, seconds, notes } = opts;
|
|
103
105
|
const requirements = mergeRequirements(cost, require);
|
|
104
106
|
const bidirectional = both ?? defaultBidirectional;
|
|
105
107
|
const edge = {
|
|
@@ -110,7 +112,7 @@ class Builder {
|
|
|
110
112
|
...(via !== undefined ? { via } : {}),
|
|
111
113
|
...(ref ? { refs: ref } : {}),
|
|
112
114
|
...(requirements ? { requirements } : {}),
|
|
113
|
-
...(
|
|
115
|
+
...(seconds !== undefined ? { seconds } : {}),
|
|
114
116
|
...(notes !== undefined ? { notes } : {}),
|
|
115
117
|
};
|
|
116
118
|
this.edges.push(edge);
|
package/dist/dsl/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/dsl/builder.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gFAAgF;AAChF,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,yEAAyE;AACzE,4EAA4E;AAC5E,oEAAoE;AAapE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/dsl/builder.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gFAAgF;AAChF,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,yEAAyE;AACzE,4EAA4E;AAC5E,oEAAoE;AAapE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA0ElD,MAAM,aAAa,GAGf;IACF,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE;IACpD,WAAW,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE;IAChE,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE;IAC1D,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE;IACrD,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,KAAK,EAAE;IACvD,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EA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B,IAAI,OAAO;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAA2B,EAC3B,EAA6B;IAE7B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5C,EAAE,CAAC,OAAO,CAAC,CAAC;IACZ,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC"}
|
package/dist/dsl/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { defineGraph } from './builder';
|
|
2
|
-
export type { EdgeOpts, GraphBuilder, NodeHandle, RegionScope } from './builder';
|
|
2
|
+
export type { EdgeOpts, GraphBuilder, NodeHandle, RegionScope, TimedEdgeOpts, } from './builder';
|
|
3
3
|
export { item, level, meso, quest } from './requirements';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dsl/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dsl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dsl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/dsl/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dsl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dsl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphs/starter/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphs/starter/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,cA+D1B,CAAC"}
|
|
@@ -7,8 +7,8 @@ export const starterGraph = defineGraph({ profileId: 'starter-demo' }, (g) => {
|
|
|
7
7
|
const riverside = r.node('riverside', 'Riverside');
|
|
8
8
|
const meadow = r.node('meadow', 'Meadow Crossing');
|
|
9
9
|
const oldFort = r.node('old-fort', 'Old Fort');
|
|
10
|
-
riverside.walk(meadow);
|
|
11
|
-
meadow.walk(oldFort);
|
|
10
|
+
riverside.walk(meadow, { seconds: 90 });
|
|
11
|
+
meadow.walk(oldFort, { seconds: 120 });
|
|
12
12
|
riverside.npcTo(oldFort, {
|
|
13
13
|
via: 'Hire the wagon driver at the inn',
|
|
14
14
|
cost: meso(500),
|
|
@@ -19,7 +19,7 @@ export const starterGraph = defineGraph({ profileId: 'starter-demo' }, (g) => {
|
|
|
19
19
|
g.region('coast', 'Eastern Coast', (r) => {
|
|
20
20
|
const harbour = r.node('harbour', 'Harbour Town');
|
|
21
21
|
const lighthouse = r.node('lighthouse', 'Lighthouse Point');
|
|
22
|
-
harbour.walk(lighthouse);
|
|
22
|
+
harbour.walk(lighthouse, { seconds: 150 });
|
|
23
23
|
harbour.skillTo(lighthouse, {
|
|
24
24
|
via: 'Use the bridge-keeper teleport',
|
|
25
25
|
cost: meso(100),
|
|
@@ -29,6 +29,7 @@ export const starterGraph = defineGraph({ profileId: 'starter-demo' }, (g) => {
|
|
|
29
29
|
const trailhead = r.node('trailhead', 'Trailhead');
|
|
30
30
|
const summit = r.node('summit', 'Summit Shrine');
|
|
31
31
|
trailhead.walk(summit, {
|
|
32
|
+
seconds: 300,
|
|
32
33
|
require: [level(20)],
|
|
33
34
|
notes: 'Steep climb — recommended past level 20.',
|
|
34
35
|
});
|
|
@@ -50,5 +51,10 @@ export const starterGraph = defineGraph({ profileId: 'starter-demo' }, (g) => {
|
|
|
50
51
|
require: [quest(7_001)],
|
|
51
52
|
ref: { questId: 7_001 },
|
|
52
53
|
});
|
|
54
|
+
g.ref('harbour').transportTo(g.ref('summit'), {
|
|
55
|
+
via: 'Board the summit ferry',
|
|
56
|
+
seconds: 480,
|
|
57
|
+
notes: 'A long ride — instant with a fast-travel ticket.',
|
|
58
|
+
});
|
|
53
59
|
});
|
|
54
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graphs/starter/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,CAAC,MAAM,YAAY,GAAmB,WAAW,CACrD,EAAE,SAAS,EAAE,cAAc,EAAE,EAC7B,CAAC,CAAC,EAAE,EAAE;IACJ,CAA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AA0B;KAChC,CAAC,CAAC;IACH,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;QAC3C,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;KAC/C,CAAC,CAAC;IACH,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;QACzC,GAAG,EAAE,yBAAyB;QAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QAChB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;KAC1B,CAAC,CAAC;IACH,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACvC,GAAG,EAAE,qDAAqD;QAC1D,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;KACxB,CAAC,CAAC;IACH,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC5C,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,GAAG;QACZ,KAAK,EAAE,kDAAkD;KAC1D,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ export type { AreaNode, EntityRefs, GroupDef, GroupId, NavGraphSource, NodeId, R
|
|
|
2
2
|
export { TRAVEL_METHODS, asGroupId, asNodeId } from './ir/types';
|
|
3
3
|
export { navGraphSourceSchema } from './ir/schema';
|
|
4
4
|
export { defineGraph } from './dsl/builder';
|
|
5
|
-
export type { EdgeOpts, GraphBuilder, NodeHandle, RegionScope, } from './dsl/builder';
|
|
5
|
+
export type { EdgeOpts, GraphBuilder, NodeHandle, RegionScope, TimedEdgeOpts, } from './dsl/builder';
|
|
6
6
|
export { item, level, meso, quest } from './dsl/requirements';
|
|
7
7
|
export { compileGraph } from './compile/compileGraph';
|
|
8
8
|
export type { NavGraph } from './compile/compileGraph';
|
|
9
|
-
export { findPath } from './path/findPath';
|
|
9
|
+
export { DEFAULT_TRANSPORT_SECONDS, DEFAULT_WALK_SECONDS, edgeSeconds, findPath, } from './path/findPath';
|
|
10
10
|
export { eligibilityFilter } from './path/eligibility';
|
|
11
|
-
export type { FindPathOptions, PathResult, UserCapability, } from './path/index';
|
|
11
|
+
export type { EdgeCostOptions, FindPathOptions, PathResult, UserCapability, } from './path/index';
|
|
12
12
|
export { toJSON } from './json/toJSON';
|
|
13
13
|
export type { NavGraphJSON } from './json/toJSON';
|
|
14
14
|
export { DEFAULT_GRAPH_ID, GRAPHS, getGraph, listGraphIds, } from './graphs/index';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,YAAY,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,cAAc,EACd,MAAM,EACN,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,YAAY,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,cAAc,EACd,MAAM,EACN,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,eAAe,EACf,UAAU,EACV,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { item, level, meso, quest } from './dsl/requirements';
|
|
|
12
12
|
// Compiler
|
|
13
13
|
export { compileGraph } from './compile/compileGraph';
|
|
14
14
|
// Pathfinding
|
|
15
|
-
export { findPath } from './path/findPath';
|
|
15
|
+
export { DEFAULT_TRANSPORT_SECONDS, DEFAULT_WALK_SECONDS, edgeSeconds, findPath, } from './path/findPath';
|
|
16
16
|
export { eligibilityFilter } from './path/eligibility';
|
|
17
17
|
// Portability
|
|
18
18
|
export { toJSON } from './json/toJSON';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,8DAA8D;AAc9D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,gBAAgB;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,8DAA8D;AAc9D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,gBAAgB;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9D,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,cAAc;AACd,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQvD,cAAc;AACd,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,oFAAoF;AACpF,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
package/dist/ir/schema.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { GroupId, NodeId, Requirement } from './types';
|
|
3
3
|
declare const nodeIdSchema: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
4
4
|
declare const groupIdSchema: z.ZodEffects<z.ZodString, GroupId, string>;
|
|
5
|
-
declare const travelMethodSchema: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
|
|
5
|
+
declare const travelMethodSchema: z.ZodEnum<["walk", "transport", "portal", "npc", "item", "skill", "other"]>;
|
|
6
6
|
declare const requirementSchema: z.ZodType<Requirement>;
|
|
7
7
|
declare const entityRefsSchema: z.ZodObject<{
|
|
8
8
|
itemId: z.ZodOptional<z.ZodNumber>;
|
|
@@ -32,11 +32,11 @@ declare const areaNodeSchema: z.ZodObject<{
|
|
|
32
32
|
name: string;
|
|
33
33
|
group?: string | undefined;
|
|
34
34
|
}>;
|
|
35
|
-
declare const travelEdgeSchema: z.ZodObject<{
|
|
35
|
+
declare const travelEdgeSchema: z.ZodEffects<z.ZodObject<{
|
|
36
36
|
from: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
37
37
|
to: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
38
38
|
bidirectional: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
-
method: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
|
|
39
|
+
method: z.ZodEnum<["walk", "transport", "portal", "npc", "item", "skill", "other"]>;
|
|
40
40
|
via: z.ZodOptional<z.ZodString>;
|
|
41
41
|
refs: z.ZodOptional<z.ZodObject<{
|
|
42
42
|
itemId: z.ZodOptional<z.ZodNumber>;
|
|
@@ -52,7 +52,7 @@ declare const travelEdgeSchema: z.ZodObject<{
|
|
|
52
52
|
npcId?: number | undefined;
|
|
53
53
|
}>>;
|
|
54
54
|
requirements: z.ZodOptional<z.ZodArray<z.ZodType<Requirement, z.ZodTypeDef, Requirement>, "many">>;
|
|
55
|
-
|
|
55
|
+
seconds: z.ZodOptional<z.ZodNumber>;
|
|
56
56
|
notes: z.ZodOptional<z.ZodString>;
|
|
57
57
|
}, "strip", z.ZodTypeAny, {
|
|
58
58
|
from: string & {
|
|
@@ -61,7 +61,7 @@ declare const travelEdgeSchema: z.ZodObject<{
|
|
|
61
61
|
to: string & {
|
|
62
62
|
readonly __brand: "NodeId";
|
|
63
63
|
};
|
|
64
|
-
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
64
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
65
65
|
bidirectional?: boolean | undefined;
|
|
66
66
|
via?: string | undefined;
|
|
67
67
|
refs?: {
|
|
@@ -70,12 +70,12 @@ declare const travelEdgeSchema: z.ZodObject<{
|
|
|
70
70
|
npcId?: number | undefined;
|
|
71
71
|
} | undefined;
|
|
72
72
|
requirements?: Requirement[] | undefined;
|
|
73
|
-
|
|
73
|
+
seconds?: number | undefined;
|
|
74
74
|
notes?: string | undefined;
|
|
75
75
|
}, {
|
|
76
76
|
from: string;
|
|
77
77
|
to: string;
|
|
78
|
-
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
78
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
79
79
|
bidirectional?: boolean | undefined;
|
|
80
80
|
via?: string | undefined;
|
|
81
81
|
refs?: {
|
|
@@ -84,7 +84,39 @@ declare const travelEdgeSchema: z.ZodObject<{
|
|
|
84
84
|
npcId?: number | undefined;
|
|
85
85
|
} | undefined;
|
|
86
86
|
requirements?: Requirement[] | undefined;
|
|
87
|
-
|
|
87
|
+
seconds?: number | undefined;
|
|
88
|
+
notes?: string | undefined;
|
|
89
|
+
}>, {
|
|
90
|
+
from: string & {
|
|
91
|
+
readonly __brand: "NodeId";
|
|
92
|
+
};
|
|
93
|
+
to: string & {
|
|
94
|
+
readonly __brand: "NodeId";
|
|
95
|
+
};
|
|
96
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
97
|
+
bidirectional?: boolean | undefined;
|
|
98
|
+
via?: string | undefined;
|
|
99
|
+
refs?: {
|
|
100
|
+
itemId?: number | undefined;
|
|
101
|
+
questId?: number | undefined;
|
|
102
|
+
npcId?: number | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
requirements?: Requirement[] | undefined;
|
|
105
|
+
seconds?: number | undefined;
|
|
106
|
+
notes?: string | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
from: string;
|
|
109
|
+
to: string;
|
|
110
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
111
|
+
bidirectional?: boolean | undefined;
|
|
112
|
+
via?: string | undefined;
|
|
113
|
+
refs?: {
|
|
114
|
+
itemId?: number | undefined;
|
|
115
|
+
questId?: number | undefined;
|
|
116
|
+
npcId?: number | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
requirements?: Requirement[] | undefined;
|
|
119
|
+
seconds?: number | undefined;
|
|
88
120
|
notes?: string | undefined;
|
|
89
121
|
}>;
|
|
90
122
|
declare const groupDefSchema: z.ZodObject<{
|
|
@@ -116,11 +148,11 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
116
148
|
name: string;
|
|
117
149
|
group?: string | undefined;
|
|
118
150
|
}>, "many">;
|
|
119
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
151
|
+
edges: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
120
152
|
from: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
121
153
|
to: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
122
154
|
bidirectional: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
-
method: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
|
|
155
|
+
method: z.ZodEnum<["walk", "transport", "portal", "npc", "item", "skill", "other"]>;
|
|
124
156
|
via: z.ZodOptional<z.ZodString>;
|
|
125
157
|
refs: z.ZodOptional<z.ZodObject<{
|
|
126
158
|
itemId: z.ZodOptional<z.ZodNumber>;
|
|
@@ -136,7 +168,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
136
168
|
npcId?: number | undefined;
|
|
137
169
|
}>>;
|
|
138
170
|
requirements: z.ZodOptional<z.ZodArray<z.ZodType<Requirement, z.ZodTypeDef, Requirement>, "many">>;
|
|
139
|
-
|
|
171
|
+
seconds: z.ZodOptional<z.ZodNumber>;
|
|
140
172
|
notes: z.ZodOptional<z.ZodString>;
|
|
141
173
|
}, "strip", z.ZodTypeAny, {
|
|
142
174
|
from: string & {
|
|
@@ -145,7 +177,39 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
145
177
|
to: string & {
|
|
146
178
|
readonly __brand: "NodeId";
|
|
147
179
|
};
|
|
148
|
-
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
180
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
181
|
+
bidirectional?: boolean | undefined;
|
|
182
|
+
via?: string | undefined;
|
|
183
|
+
refs?: {
|
|
184
|
+
itemId?: number | undefined;
|
|
185
|
+
questId?: number | undefined;
|
|
186
|
+
npcId?: number | undefined;
|
|
187
|
+
} | undefined;
|
|
188
|
+
requirements?: Requirement[] | undefined;
|
|
189
|
+
seconds?: number | undefined;
|
|
190
|
+
notes?: string | undefined;
|
|
191
|
+
}, {
|
|
192
|
+
from: string;
|
|
193
|
+
to: string;
|
|
194
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
195
|
+
bidirectional?: boolean | undefined;
|
|
196
|
+
via?: string | undefined;
|
|
197
|
+
refs?: {
|
|
198
|
+
itemId?: number | undefined;
|
|
199
|
+
questId?: number | undefined;
|
|
200
|
+
npcId?: number | undefined;
|
|
201
|
+
} | undefined;
|
|
202
|
+
requirements?: Requirement[] | undefined;
|
|
203
|
+
seconds?: number | undefined;
|
|
204
|
+
notes?: string | undefined;
|
|
205
|
+
}>, {
|
|
206
|
+
from: string & {
|
|
207
|
+
readonly __brand: "NodeId";
|
|
208
|
+
};
|
|
209
|
+
to: string & {
|
|
210
|
+
readonly __brand: "NodeId";
|
|
211
|
+
};
|
|
212
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
149
213
|
bidirectional?: boolean | undefined;
|
|
150
214
|
via?: string | undefined;
|
|
151
215
|
refs?: {
|
|
@@ -154,12 +218,12 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
154
218
|
npcId?: number | undefined;
|
|
155
219
|
} | undefined;
|
|
156
220
|
requirements?: Requirement[] | undefined;
|
|
157
|
-
|
|
221
|
+
seconds?: number | undefined;
|
|
158
222
|
notes?: string | undefined;
|
|
159
223
|
}, {
|
|
160
224
|
from: string;
|
|
161
225
|
to: string;
|
|
162
|
-
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
226
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
163
227
|
bidirectional?: boolean | undefined;
|
|
164
228
|
via?: string | undefined;
|
|
165
229
|
refs?: {
|
|
@@ -168,7 +232,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
168
232
|
npcId?: number | undefined;
|
|
169
233
|
} | undefined;
|
|
170
234
|
requirements?: Requirement[] | undefined;
|
|
171
|
-
|
|
235
|
+
seconds?: number | undefined;
|
|
172
236
|
notes?: string | undefined;
|
|
173
237
|
}>, "many">;
|
|
174
238
|
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -199,7 +263,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
199
263
|
to: string & {
|
|
200
264
|
readonly __brand: "NodeId";
|
|
201
265
|
};
|
|
202
|
-
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
266
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
203
267
|
bidirectional?: boolean | undefined;
|
|
204
268
|
via?: string | undefined;
|
|
205
269
|
refs?: {
|
|
@@ -208,7 +272,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
208
272
|
npcId?: number | undefined;
|
|
209
273
|
} | undefined;
|
|
210
274
|
requirements?: Requirement[] | undefined;
|
|
211
|
-
|
|
275
|
+
seconds?: number | undefined;
|
|
212
276
|
notes?: string | undefined;
|
|
213
277
|
}[];
|
|
214
278
|
groups?: {
|
|
@@ -227,7 +291,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
227
291
|
edges: {
|
|
228
292
|
from: string;
|
|
229
293
|
to: string;
|
|
230
|
-
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
294
|
+
method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "other";
|
|
231
295
|
bidirectional?: boolean | undefined;
|
|
232
296
|
via?: string | undefined;
|
|
233
297
|
refs?: {
|
|
@@ -236,7 +300,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
|
|
|
236
300
|
npcId?: number | undefined;
|
|
237
301
|
} | undefined;
|
|
238
302
|
requirements?: Requirement[] | undefined;
|
|
239
|
-
|
|
303
|
+
seconds?: number | undefined;
|
|
240
304
|
notes?: string | undefined;
|
|
241
305
|
}[];
|
|
242
306
|
groups?: {
|
package/dist/ir/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/ir/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG5D,QAAA,MAAM,YAAY,2CAIc,CAAC;AAEjC,QAAA,MAAM,aAAa,4CAIc,CAAC;AAElC,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/ir/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG5D,QAAA,MAAM,YAAY,2CAIc,CAAC;AAEjC,QAAA,MAAM,aAAa,4CAIc,CAAC;AAElC,QAAA,MAAM,kBAAkB,6EAAyB,CAAC;AAElD,QAAA,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAU5C,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;EAIpB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;EAIlB,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBlB,CAAC;AAEL,QAAA,MAAM,cAAc;;;;;;;;;;;EAGlB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK/B,CAAC;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,CAAC"}
|
package/dist/ir/schema.js
CHANGED
|
@@ -35,7 +35,8 @@ const areaNodeSchema = z.object({
|
|
|
35
35
|
name: z.string().min(1),
|
|
36
36
|
group: groupIdSchema.optional(),
|
|
37
37
|
});
|
|
38
|
-
const travelEdgeSchema = z
|
|
38
|
+
const travelEdgeSchema = z
|
|
39
|
+
.object({
|
|
39
40
|
from: nodeIdSchema,
|
|
40
41
|
to: nodeIdSchema,
|
|
41
42
|
bidirectional: z.boolean().optional(),
|
|
@@ -43,8 +44,19 @@ const travelEdgeSchema = z.object({
|
|
|
43
44
|
via: z.string().optional(),
|
|
44
45
|
refs: entityRefsSchema.optional(),
|
|
45
46
|
requirements: z.array(requirementSchema).optional(),
|
|
46
|
-
|
|
47
|
+
seconds: z.number().positive().optional(),
|
|
47
48
|
notes: z.string().optional(),
|
|
49
|
+
})
|
|
50
|
+
.superRefine((edge, ctx) => {
|
|
51
|
+
if (edge.seconds !== undefined &&
|
|
52
|
+
edge.method !== 'walk' &&
|
|
53
|
+
edge.method !== 'transport') {
|
|
54
|
+
ctx.addIssue({
|
|
55
|
+
code: z.ZodIssueCode.custom,
|
|
56
|
+
path: ['seconds'],
|
|
57
|
+
message: `seconds is only valid on walk or transport edges; "${edge.method}" transitions are instant.`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
48
60
|
});
|
|
49
61
|
const groupDefSchema = z.object({
|
|
50
62
|
id: groupIdSchema,
|
package/dist/ir/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/ir/schema.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CAAC,sBAAsB,EAAE,8CAA8C,CAAC;KAC7E,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAW,CAAC,CAAC;AAEjC,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CAAC,sBAAsB,EAAE,+CAA+C,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AAE,aAAa;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,CAAC"}
|
package/dist/ir/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type NodeId = string & {
|
|
|
6
6
|
export type GroupId = string & {
|
|
7
7
|
readonly __brand: 'GroupId';
|
|
8
8
|
};
|
|
9
|
-
export declare const TRAVEL_METHODS: readonly ["walk", "portal", "npc", "item", "skill", "other"];
|
|
9
|
+
export declare const TRAVEL_METHODS: readonly ["walk", "transport", "portal", "npc", "item", "skill", "other"];
|
|
10
10
|
export type TravelMethod = (typeof TRAVEL_METHODS)[number];
|
|
11
11
|
export type Requirement = {
|
|
12
12
|
kind: 'meso';
|
|
@@ -43,8 +43,16 @@ export interface TravelEdge {
|
|
|
43
43
|
via?: string;
|
|
44
44
|
refs?: EntityRefs;
|
|
45
45
|
requirements?: Requirement[];
|
|
46
|
-
/**
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Estimated travel time for this edge, in seconds. Valid only on the timed
|
|
48
|
+
* methods — `walk` and `transport` (boats/trains/carpets); every other method
|
|
49
|
+
* is an instant transition and the schema rejects `seconds` on it. Pathfinding
|
|
50
|
+
* minimizes the summed time of a route (Dijkstra). Omit when unknown — untimed
|
|
51
|
+
* timed-edges fall back to their method default, so a graph with no times set
|
|
52
|
+
* still routes sensibly. A `transport` edge's time is waived entirely when the
|
|
53
|
+
* route is found with fast travel enabled (see `findPath`).
|
|
54
|
+
*/
|
|
55
|
+
seconds?: number;
|
|
48
56
|
notes?: string;
|
|
49
57
|
}
|
|
50
58
|
export interface GroupDef {
|
package/dist/ir/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAKA,qFAAqF;AACrF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,kFAAkF;AAClF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/D,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAKA,qFAAqF;AACrF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,kFAAkF;AAClF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/D,eAAO,MAAM,cAAc,2EAQjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QA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AS,GAAI,GAAG,MAAM,KAAG,OAAuB,CAAC"}
|
package/dist/ir/types.js
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
// autocomplete, and compile errors instead of writing JSON or a query language.
|
|
3
3
|
// The shapes here are the schema the rest of the package operates on; the
|
|
4
4
|
// runtime mirror lives next door in `schema.ts` (Zod).
|
|
5
|
-
export const TRAVEL_METHODS = [
|
|
5
|
+
export const TRAVEL_METHODS = [
|
|
6
|
+
'walk',
|
|
7
|
+
'transport',
|
|
8
|
+
'portal',
|
|
9
|
+
'npc',
|
|
10
|
+
'item',
|
|
11
|
+
'skill',
|
|
12
|
+
'other',
|
|
13
|
+
];
|
|
6
14
|
/** Helper for narrowing string literals to the branded id types. */
|
|
7
15
|
export const asNodeId = (s) => s;
|
|
8
16
|
export const asGroupId = (s) => s;
|
package/dist/ir/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,0EAA0E;AAC1E,uDAAuD;AAQvD,MAAM,CAAC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,0EAA0E;AAC1E,uDAAuD;AAQvD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM;IACN,WAAW;IACX,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;CACC,CAAC;AAwDX,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAW,CAAC;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAW,EAAE,CAAC,CAAY,CAAC"}
|
package/dist/path/findPath.d.ts
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import type { NavGraph } from '../compile/compileGraph';
|
|
2
2
|
import type { NodeId, TravelEdge } from '../ir/types';
|
|
3
|
+
/** Assumed travel time, in seconds, for a walk edge that declares no `seconds`. */
|
|
4
|
+
export declare const DEFAULT_WALK_SECONDS = 60;
|
|
5
|
+
/**
|
|
6
|
+
* Assumed ride time, in seconds, for a transport edge that declares no
|
|
7
|
+
* `seconds`. Longer than a walk hop: boarding a boat/train means waiting for it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_TRANSPORT_SECONDS = 300;
|
|
10
|
+
/** Cost inputs that depend on the traveller, not the edge. */
|
|
11
|
+
export interface EdgeCostOptions {
|
|
12
|
+
/** When true, `transport` hops are instant (the player has a fast-travel ticket). */
|
|
13
|
+
fastTravel?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Travel time an edge contributes to a route. `walk` always costs time;
|
|
17
|
+
* `transport` costs its ride time unless `fastTravel` waives it; portal / npc /
|
|
18
|
+
* item / skill transitions teleport the player instantly.
|
|
19
|
+
*/
|
|
20
|
+
export declare function edgeSeconds(edge: TravelEdge, opts?: EdgeCostOptions): number;
|
|
3
21
|
export interface PathResult {
|
|
4
22
|
status: 'found' | 'unreachable' | 'unreachable-when-filtered';
|
|
5
23
|
steps: TravelEdge[];
|
|
24
|
+
/** Total estimated travel time of `steps`, in seconds. 0 when `steps` empty. */
|
|
25
|
+
totalSeconds: number;
|
|
6
26
|
fallback?: {
|
|
7
27
|
steps: TravelEdge[];
|
|
28
|
+
totalSeconds: number;
|
|
8
29
|
/** Indices into `fallback.steps` whose eligibility predicate failed. */
|
|
9
30
|
blocked: number[];
|
|
10
31
|
};
|
|
11
32
|
}
|
|
12
33
|
export interface FindPathOptions {
|
|
13
34
|
eligible?: (edge: TravelEdge) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* When true, `transport` hops (boats/trains/carpets) are treated as instant —
|
|
37
|
+
* the traveller holds a fast-travel ticket. Affects route *cost*, never
|
|
38
|
+
* *reachability*: transports are always traversable either way.
|
|
39
|
+
*/
|
|
40
|
+
fastTravel?: boolean;
|
|
14
41
|
}
|
|
15
42
|
export declare function findPath(graph: NavGraph, from: NodeId, to: NodeId, opts?: FindPathOptions): PathResult;
|
|
16
43
|
//# sourceMappingURL=findPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPath.d.ts","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findPath.d.ts","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,eAAoB,GAAG,MAAM,CAShF;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,2BAA2B,CAAC;IAC9D,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,UAAU,EAAE,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,wEAAwE;QACxE,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,eAAoB,GACzB,UAAU,CA+BZ"}
|
package/dist/path/findPath.js
CHANGED
|
@@ -1,37 +1,74 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Weighted pathfinding: least-time Dijkstra over the compiled adjacency.
|
|
2
|
+
//
|
|
3
|
+
// Two methods cost time — `walk` and `transport` (boats/trains/carpets). Each
|
|
4
|
+
// costs its declared `seconds`, or its method default when untimed, so a graph
|
|
5
|
+
// with no times set still routes sensibly. Every other method (portal, npc,
|
|
6
|
+
// item, skill) is a teleport-like transition, treated as instant.
|
|
7
|
+
//
|
|
8
|
+
// `transport` time is *conditional*: with fast travel enabled (the player holds
|
|
9
|
+
// a fast-travel ticket), every transport hop is instant, so routes prefer boats
|
|
10
|
+
// over long walks; without it, transports cost their ride time and the router
|
|
11
|
+
// may route around them.
|
|
2
12
|
//
|
|
3
13
|
// When an eligibility predicate is supplied:
|
|
4
|
-
// 1. Run
|
|
14
|
+
// 1. Run Dijkstra with the predicate pruning candidate edges.
|
|
5
15
|
// 2. If the destination is reachable that way, return `status: 'found'`.
|
|
6
|
-
// 3. Otherwise run
|
|
7
|
-
// `status: 'unreachable-when-filtered'` with the unfiltered path as
|
|
16
|
+
// 3. Otherwise run Dijkstra again *without* the filter. If a path exists,
|
|
17
|
+
// return `status: 'unreachable-when-filtered'` with the unfiltered path as
|
|
8
18
|
// `fallback` and the step indices the filter blocked. This is FR7 — the
|
|
9
19
|
// app never has to surface a blank "no path" state when the graph itself
|
|
10
20
|
// is connected.
|
|
11
|
-
// 4. If the unfiltered
|
|
21
|
+
// 4. If the unfiltered search also fails, return `status: 'unreachable'`.
|
|
22
|
+
/** Assumed travel time, in seconds, for a walk edge that declares no `seconds`. */
|
|
23
|
+
export const DEFAULT_WALK_SECONDS = 60;
|
|
24
|
+
/**
|
|
25
|
+
* Assumed ride time, in seconds, for a transport edge that declares no
|
|
26
|
+
* `seconds`. Longer than a walk hop: boarding a boat/train means waiting for it.
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_TRANSPORT_SECONDS = 300;
|
|
29
|
+
/**
|
|
30
|
+
* Travel time an edge contributes to a route. `walk` always costs time;
|
|
31
|
+
* `transport` costs its ride time unless `fastTravel` waives it; portal / npc /
|
|
32
|
+
* item / skill transitions teleport the player instantly.
|
|
33
|
+
*/
|
|
34
|
+
export function edgeSeconds(edge, opts = {}) {
|
|
35
|
+
switch (edge.method) {
|
|
36
|
+
case 'walk':
|
|
37
|
+
return edge.seconds ?? DEFAULT_WALK_SECONDS;
|
|
38
|
+
case 'transport':
|
|
39
|
+
return opts.fastTravel ? 0 : (edge.seconds ?? DEFAULT_TRANSPORT_SECONDS);
|
|
40
|
+
default:
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
12
44
|
export function findPath(graph, from, to, opts = {}) {
|
|
13
45
|
assertNodeKnown(graph, from, 'from');
|
|
14
46
|
assertNodeKnown(graph, to, 'to');
|
|
15
47
|
if (from === to)
|
|
16
|
-
return { status: 'found', steps: [] };
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
48
|
+
return { status: 'found', steps: [], totalSeconds: 0 };
|
|
49
|
+
const cost = { fastTravel: opts.fastTravel };
|
|
50
|
+
const filtered = opts.eligible
|
|
51
|
+
? dijkstra(graph, from, to, cost, opts.eligible)
|
|
52
|
+
: null;
|
|
53
|
+
if (filtered) {
|
|
54
|
+
return { status: 'found', steps: filtered.steps, totalSeconds: filtered.totalSeconds };
|
|
55
|
+
}
|
|
56
|
+
const unfiltered = dijkstra(graph, from, to, cost);
|
|
21
57
|
if (!unfiltered)
|
|
22
|
-
return { status: 'unreachable', steps: [] };
|
|
58
|
+
return { status: 'unreachable', steps: [], totalSeconds: 0 };
|
|
23
59
|
if (!opts.eligible) {
|
|
24
|
-
return { status: 'found', steps: unfiltered };
|
|
60
|
+
return { status: 'found', steps: unfiltered.steps, totalSeconds: unfiltered.totalSeconds };
|
|
25
61
|
}
|
|
26
62
|
const blocked = [];
|
|
27
|
-
unfiltered.forEach((edge, i) => {
|
|
63
|
+
unfiltered.steps.forEach((edge, i) => {
|
|
28
64
|
if (!opts.eligible(edge))
|
|
29
65
|
blocked.push(i);
|
|
30
66
|
});
|
|
31
67
|
return {
|
|
32
68
|
status: 'unreachable-when-filtered',
|
|
33
69
|
steps: [],
|
|
34
|
-
|
|
70
|
+
totalSeconds: 0,
|
|
71
|
+
fallback: { steps: unfiltered.steps, totalSeconds: unfiltered.totalSeconds, blocked },
|
|
35
72
|
};
|
|
36
73
|
}
|
|
37
74
|
function assertNodeKnown(graph, id, label) {
|
|
@@ -39,23 +76,31 @@ function assertNodeKnown(graph, id, label) {
|
|
|
39
76
|
throw new Error(`findPath ${label} references undeclared node "${id}".`);
|
|
40
77
|
}
|
|
41
78
|
}
|
|
42
|
-
function
|
|
79
|
+
function dijkstra(graph, from, to, cost, eligible) {
|
|
80
|
+
const dist = new Map([[from, 0]]);
|
|
43
81
|
const cameFrom = new Map();
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
82
|
+
const settled = new Set();
|
|
83
|
+
const frontier = new MinHeap();
|
|
84
|
+
frontier.push(from, 0);
|
|
85
|
+
while (!frontier.isEmpty()) {
|
|
86
|
+
const node = frontier.pop();
|
|
87
|
+
if (settled.has(node))
|
|
88
|
+
continue; // stale heap entry — already finalized
|
|
48
89
|
if (node === to)
|
|
49
|
-
return reconstruct(cameFrom, from, to);
|
|
50
|
-
|
|
51
|
-
|
|
90
|
+
return { steps: reconstruct(cameFrom, from, to), totalSeconds: dist.get(to) };
|
|
91
|
+
settled.add(node);
|
|
92
|
+
const base = dist.get(node);
|
|
93
|
+
for (const edge of graph.adjacency.get(node) ?? []) {
|
|
52
94
|
if (eligible && !eligible(edge))
|
|
53
95
|
continue;
|
|
54
|
-
if (
|
|
96
|
+
if (settled.has(edge.to))
|
|
55
97
|
continue;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
98
|
+
const next = base + edgeSeconds(edge, cost);
|
|
99
|
+
if (next < (dist.get(edge.to) ?? Infinity)) {
|
|
100
|
+
dist.set(edge.to, next);
|
|
101
|
+
cameFrom.set(edge.to, edge);
|
|
102
|
+
frontier.push(edge.to, next);
|
|
103
|
+
}
|
|
59
104
|
}
|
|
60
105
|
}
|
|
61
106
|
return null;
|
|
@@ -66,7 +111,7 @@ function reconstruct(cameFrom, from, to) {
|
|
|
66
111
|
while (cursor !== from) {
|
|
67
112
|
const edge = cameFrom.get(cursor);
|
|
68
113
|
if (!edge) {
|
|
69
|
-
// Defensive:
|
|
114
|
+
// Defensive: Dijkstra only stores cameFrom for reachable nodes, so this
|
|
70
115
|
// branch is unreachable in practice — but typing the lookup demands it.
|
|
71
116
|
throw new Error(`Path reconstruction broke at "${cursor}".`);
|
|
72
117
|
}
|
|
@@ -75,4 +120,60 @@ function reconstruct(cameFrom, from, to) {
|
|
|
75
120
|
}
|
|
76
121
|
return steps.reverse();
|
|
77
122
|
}
|
|
123
|
+
// Binary min-heap keyed by tentative distance. Uses lazy deletion — a node can
|
|
124
|
+
// appear more than once and settled entries are skipped on pop.
|
|
125
|
+
class MinHeap {
|
|
126
|
+
nodes = [];
|
|
127
|
+
keys = [];
|
|
128
|
+
isEmpty() {
|
|
129
|
+
return this.nodes.length === 0;
|
|
130
|
+
}
|
|
131
|
+
push(node, key) {
|
|
132
|
+
this.nodes.push(node);
|
|
133
|
+
this.keys.push(key);
|
|
134
|
+
this.bubbleUp(this.nodes.length - 1);
|
|
135
|
+
}
|
|
136
|
+
pop() {
|
|
137
|
+
if (this.nodes.length === 0)
|
|
138
|
+
return undefined;
|
|
139
|
+
const top = this.nodes[0];
|
|
140
|
+
const lastNode = this.nodes.pop();
|
|
141
|
+
const lastKey = this.keys.pop();
|
|
142
|
+
if (this.nodes.length > 0) {
|
|
143
|
+
this.nodes[0] = lastNode;
|
|
144
|
+
this.keys[0] = lastKey;
|
|
145
|
+
this.bubbleDown(0);
|
|
146
|
+
}
|
|
147
|
+
return top;
|
|
148
|
+
}
|
|
149
|
+
bubbleUp(i) {
|
|
150
|
+
while (i > 0) {
|
|
151
|
+
const parent = (i - 1) >> 1;
|
|
152
|
+
if (this.keys[parent] <= this.keys[i])
|
|
153
|
+
break;
|
|
154
|
+
this.swap(i, parent);
|
|
155
|
+
i = parent;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
bubbleDown(i) {
|
|
159
|
+
const n = this.nodes.length;
|
|
160
|
+
for (;;) {
|
|
161
|
+
const left = 2 * i + 1;
|
|
162
|
+
const right = left + 1;
|
|
163
|
+
let smallest = i;
|
|
164
|
+
if (left < n && this.keys[left] < this.keys[smallest])
|
|
165
|
+
smallest = left;
|
|
166
|
+
if (right < n && this.keys[right] < this.keys[smallest])
|
|
167
|
+
smallest = right;
|
|
168
|
+
if (smallest === i)
|
|
169
|
+
break;
|
|
170
|
+
this.swap(i, smallest);
|
|
171
|
+
i = smallest;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
swap(a, b) {
|
|
175
|
+
[this.nodes[a], this.nodes[b]] = [this.nodes[b], this.nodes[a]];
|
|
176
|
+
[this.keys[a], this.keys[b]] = [this.keys[b], this.keys[a]];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
78
179
|
//# sourceMappingURL=findPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPath.js","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"findPath.js","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,kEAAkE;AAClE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AAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;YACvB,IAAI,QAAQ,GAAG,CAAC,CAAC;YACjB,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAAE,QAAQ,GAAG,IAAI,CAAC;YACvE,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAAE,QAAQ,GAAG,KAAK,CAAC;YAC1E,IAAI,QAAQ,KAAK,CAAC;gBAAE,MAAM;YAC1B,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;YACvB,CAAC,GAAG,QAAQ,CAAC;QACf,CAAC;IACH,CAAC;IAEO,IAAI,CAAC,CAAS,EAAE,CAAS;QAC/B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
package/dist/path/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { eligibilityFilter } from './eligibility';
|
|
2
2
|
export type { UserCapability } from './eligibility';
|
|
3
|
-
export { findPath } from './findPath';
|
|
4
|
-
export type { FindPathOptions, PathResult } from './findPath';
|
|
3
|
+
export { DEFAULT_TRANSPORT_SECONDS, DEFAULT_WALK_SECONDS, edgeSeconds, findPath, } from './findPath';
|
|
4
|
+
export type { EdgeCostOptions, FindPathOptions, PathResult } from './findPath';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/path/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/path/index.js
CHANGED
package/dist/path/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrolled/nav-graph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-dev.0fe9d51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Framework-agnostic graph core: IR types + Zod schema, an authoring DSL, a compiler (IR → runtime adjacency), and pathfinding (BFS + eligibility). The engine behind Scrolled Navigator; usable standalone in Node and the browser.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"README.md",
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
32
|
+
"main": "./src/index.ts",
|
|
33
|
+
"module": "./src/index.ts",
|
|
34
|
+
"types": "./src/index.ts",
|
|
32
35
|
"exports": {
|
|
33
36
|
".": "./src/index.ts",
|
|
34
37
|
"./ir": "./src/ir/index.ts",
|