@scrolled/nav-graph 0.1.0-dev.2dfa085
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/LICENSE +200 -0
- package/README.md +83 -0
- package/dist/compile/compileGraph.d.ts +15 -0
- package/dist/compile/compileGraph.d.ts.map +1 -0
- package/dist/compile/compileGraph.js +92 -0
- package/dist/compile/compileGraph.js.map +1 -0
- package/dist/compile/index.d.ts +3 -0
- package/dist/compile/index.d.ts.map +1 -0
- package/dist/compile/index.js +2 -0
- package/dist/compile/index.js.map +1 -0
- package/dist/dsl/builder.d.ts +45 -0
- package/dist/dsl/builder.d.ts.map +1 -0
- package/dist/dsl/builder.js +177 -0
- package/dist/dsl/builder.js.map +1 -0
- package/dist/dsl/index.d.ts +4 -0
- package/dist/dsl/index.d.ts.map +1 -0
- package/dist/dsl/index.js +3 -0
- package/dist/dsl/index.js.map +1 -0
- package/dist/dsl/requirements.d.ts +9 -0
- package/dist/dsl/requirements.d.ts.map +1 -0
- package/dist/dsl/requirements.js +12 -0
- package/dist/dsl/requirements.js.map +1 -0
- package/dist/graphs/index.d.ts +6 -0
- package/dist/graphs/index.d.ts.map +1 -0
- package/dist/graphs/index.js +15 -0
- package/dist/graphs/index.js.map +1 -0
- package/dist/graphs/starter/index.d.ts +3 -0
- package/dist/graphs/starter/index.d.ts.map +1 -0
- package/dist/graphs/starter/index.js +54 -0
- package/dist/graphs/starter/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/index.d.ts +4 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/index.js +3 -0
- package/dist/ir/index.js.map +1 -0
- package/dist/ir/schema.d.ts +248 -0
- package/dist/ir/schema.d.ts.map +1 -0
- package/dist/ir/schema.js +60 -0
- package/dist/ir/schema.js.map +1 -0
- package/dist/ir/types.d.ts +63 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/types.js +9 -0
- package/dist/ir/types.js.map +1 -0
- package/dist/json/index.d.ts +3 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/index.js +2 -0
- package/dist/json/index.js.map +1 -0
- package/dist/json/toJSON.d.ts +5 -0
- package/dist/json/toJSON.d.ts.map +1 -0
- package/dist/json/toJSON.js +10 -0
- package/dist/json/toJSON.js.map +1 -0
- package/dist/path/eligibility.d.ts +10 -0
- package/dist/path/eligibility.d.ts.map +1 -0
- package/dist/path/eligibility.js +39 -0
- package/dist/path/eligibility.js.map +1 -0
- package/dist/path/findPath.d.ts +16 -0
- package/dist/path/findPath.d.ts.map +1 -0
- package/dist/path/findPath.js +78 -0
- package/dist/path/findPath.js.map +1 -0
- package/dist/path/index.d.ts +5 -0
- package/dist/path/index.d.ts.map +1 -0
- package/dist/path/index.js +3 -0
- package/dist/path/index.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +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;AAuDlD,MAAM,aAAa,GAGf;IACF,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE;IACpD,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,E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,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"}
|
|
@@ -0,0 +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,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dsl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Requirement } from '../ir/types';
|
|
2
|
+
export declare const meso: (amount: number) => Requirement;
|
|
3
|
+
export declare const item: (itemId: number, opts?: {
|
|
4
|
+
consumed?: boolean;
|
|
5
|
+
quantity?: number;
|
|
6
|
+
}) => Requirement;
|
|
7
|
+
export declare const quest: (questId: number) => Requirement;
|
|
8
|
+
export declare const level: (min: number) => Requirement;
|
|
9
|
+
//# sourceMappingURL=requirements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirements.d.ts","sourceRoot":"","sources":["../../src/dsl/requirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,eAAO,MAAM,IAAI,GAAI,QAAQ,MAAM,KAAG,WAAyC,CAAC;AAEhF,eAAO,MAAM,IAAI,GACf,QAAQ,MAAM,EACd,OAAO;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,KAC/C,WAKD,CAAC;AAEH,eAAO,MAAM,KAAK,GAAI,SAAS,MAAM,KAAG,WAA2C,CAAC;AAEpF,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,KAAG,WAAuC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Authoring sugar so a requirement list reads like prose:
|
|
2
|
+
// require: [item(4031746, { consumed: true }), level(30)]
|
|
3
|
+
export const meso = (amount) => ({ kind: 'meso', amount });
|
|
4
|
+
export const item = (itemId, opts) => ({
|
|
5
|
+
kind: 'item',
|
|
6
|
+
itemId,
|
|
7
|
+
consumed: opts?.consumed ?? false,
|
|
8
|
+
...(opts?.quantity != null ? { quantity: opts.quantity } : {}),
|
|
9
|
+
});
|
|
10
|
+
export const quest = (questId) => ({ kind: 'quest', questId });
|
|
11
|
+
export const level = (min) => ({ kind: 'level', min });
|
|
12
|
+
//# sourceMappingURL=requirements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirements.js","sourceRoot":"","sources":["../../src/dsl/requirements.ts"],"names":[],"mappings":"AAEA,0DAA0D;AAC1D,4DAA4D;AAE5D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,MAAc,EAAe,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAc,EACd,IAAgD,EACnC,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM;IACZ,MAAM;IACN,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,KAAK;IACjC,GAAG,CAAC,IAAI,EAAE,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAC/D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAe,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAe,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NavGraphSource } from '../ir/types';
|
|
2
|
+
export declare const GRAPHS: Readonly<Record<string, NavGraphSource>>;
|
|
3
|
+
export declare const DEFAULT_GRAPH_ID: string;
|
|
4
|
+
export declare function getGraph(profileId: string): NavGraphSource | undefined;
|
|
5
|
+
export declare function listGraphIds(): string[];
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphs/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAE1D,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAEvD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEtE;AAED,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Registry of authored graphs, keyed by `profileId`. The CLI looks them up
|
|
2
|
+
// here; the future Navigator app will resolve the active profile and pull the
|
|
3
|
+
// matching source the same way.
|
|
4
|
+
import { starterGraph } from './starter/index';
|
|
5
|
+
export const GRAPHS = Object.freeze({
|
|
6
|
+
[starterGraph.profileId]: starterGraph,
|
|
7
|
+
});
|
|
8
|
+
export const DEFAULT_GRAPH_ID = starterGraph.profileId;
|
|
9
|
+
export function getGraph(profileId) {
|
|
10
|
+
return GRAPHS[profileId];
|
|
11
|
+
}
|
|
12
|
+
export function listGraphIds() {
|
|
13
|
+
return Object.keys(GRAPHS);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphs/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,gCAAgC;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,MAAM,GAA6C,MAAM,CAAC,MAAM,CAAC;IAC5E,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,YAAY;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,CAAC;AAEvD,MAAM,UAAU,QAAQ,CAAC,SAAiB;IACxC,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +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,cAyD1B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Demo graph used by the default CLI run and the connectivity test. Names
|
|
2
|
+
// below are generic placeholders — see ../README.md for authoring rules.
|
|
3
|
+
import { defineGraph } from '../../dsl/builder';
|
|
4
|
+
import { item, level, meso, quest } from '../../dsl/requirements';
|
|
5
|
+
export const starterGraph = defineGraph({ profileId: 'starter-demo' }, (g) => {
|
|
6
|
+
g.region('plains', 'Western Plains', (r) => {
|
|
7
|
+
const riverside = r.node('riverside', 'Riverside');
|
|
8
|
+
const meadow = r.node('meadow', 'Meadow Crossing');
|
|
9
|
+
const oldFort = r.node('old-fort', 'Old Fort');
|
|
10
|
+
riverside.walk(meadow);
|
|
11
|
+
meadow.walk(oldFort);
|
|
12
|
+
riverside.npcTo(oldFort, {
|
|
13
|
+
via: 'Hire the wagon driver at the inn',
|
|
14
|
+
cost: meso(500),
|
|
15
|
+
ref: { npcId: 9_000_001 },
|
|
16
|
+
notes: 'Faster than walking; no return trip.',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
g.region('coast', 'Eastern Coast', (r) => {
|
|
20
|
+
const harbour = r.node('harbour', 'Harbour Town');
|
|
21
|
+
const lighthouse = r.node('lighthouse', 'Lighthouse Point');
|
|
22
|
+
harbour.walk(lighthouse);
|
|
23
|
+
harbour.skillTo(lighthouse, {
|
|
24
|
+
via: 'Use the bridge-keeper teleport',
|
|
25
|
+
cost: meso(100),
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
g.region('mountain', 'Mountain Pass', (r) => {
|
|
29
|
+
const trailhead = r.node('trailhead', 'Trailhead');
|
|
30
|
+
const summit = r.node('summit', 'Summit Shrine');
|
|
31
|
+
trailhead.walk(summit, {
|
|
32
|
+
require: [level(20)],
|
|
33
|
+
notes: 'Steep climb — recommended past level 20.',
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
g.ref('riverside').portalTo(g.ref('harbour'), {
|
|
37
|
+
via: 'Take the trade road east',
|
|
38
|
+
});
|
|
39
|
+
g.ref('harbour').itemTo(g.ref('lighthouse'), {
|
|
40
|
+
via: 'Use a Lighthouse Pass at the dock',
|
|
41
|
+
require: [item(2_000_001, { consumed: true })],
|
|
42
|
+
});
|
|
43
|
+
g.ref('harbour').npcTo(g.ref('trailhead'), {
|
|
44
|
+
via: 'Take the mountain coach',
|
|
45
|
+
cost: meso(1500),
|
|
46
|
+
ref: { npcId: 9_000_010 },
|
|
47
|
+
});
|
|
48
|
+
g.ref('old-fort').npcTo(g.ref('summit'), {
|
|
49
|
+
via: 'Speak to the surveyor (after completing the survey)',
|
|
50
|
+
require: [quest(7_001)],
|
|
51
|
+
ref: { questId: 7_001 },
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE;QACzC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAE/C,SAAS,CAAC,IAAI,CAAC,MAA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;QAC5C,GAAG,EAAE,0BAA0B;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;AACL,CAAC,CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type { AreaNode, EntityRefs, GroupDef, GroupId, NavGraphSource, NodeId, Requirement, TravelEdge, TravelMethod, } from './ir/types';
|
|
2
|
+
export { TRAVEL_METHODS, asGroupId, asNodeId } from './ir/types';
|
|
3
|
+
export { navGraphSourceSchema } from './ir/schema';
|
|
4
|
+
export { defineGraph } from './dsl/builder';
|
|
5
|
+
export type { EdgeOpts, GraphBuilder, NodeHandle, RegionScope, } from './dsl/builder';
|
|
6
|
+
export { item, level, meso, quest } from './dsl/requirements';
|
|
7
|
+
export { compileGraph } from './compile/compileGraph';
|
|
8
|
+
export type { NavGraph } from './compile/compileGraph';
|
|
9
|
+
export { findPath } from './path/findPath';
|
|
10
|
+
export { eligibilityFilter } from './path/eligibility';
|
|
11
|
+
export type { FindPathOptions, PathResult, UserCapability, } from './path/index';
|
|
12
|
+
export { toJSON } from './json/toJSON';
|
|
13
|
+
export type { NavGraphJSON } from './json/toJSON';
|
|
14
|
+
export { DEFAULT_GRAPH_ID, GRAPHS, getGraph, listGraphIds, } from './graphs/index';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,GACZ,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,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EACV,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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Public surface for @scrolled/nav-graph.
|
|
2
|
+
//
|
|
3
|
+
// The package is grouped into four leaf modules — `ir`, `dsl`, `compile`,
|
|
4
|
+
// `path` (plus `json` for portability) — and this barrel re-exports the bits
|
|
5
|
+
// app code consumes. Importing from the deep paths is fine too; e.g. tests
|
|
6
|
+
// pull `defineGraph` from `@scrolled/nav-graph/dsl` directly.
|
|
7
|
+
export { TRAVEL_METHODS, asGroupId, asNodeId } from './ir/types';
|
|
8
|
+
export { navGraphSourceSchema } from './ir/schema';
|
|
9
|
+
// Authoring DSL
|
|
10
|
+
export { defineGraph } from './dsl/builder';
|
|
11
|
+
export { item, level, meso, quest } from './dsl/requirements';
|
|
12
|
+
// Compiler
|
|
13
|
+
export { compileGraph } from './compile/compileGraph';
|
|
14
|
+
// Pathfinding
|
|
15
|
+
export { findPath } from './path/findPath';
|
|
16
|
+
export { eligibilityFilter } from './path/eligibility';
|
|
17
|
+
// Portability
|
|
18
|
+
export { toJSON } from './json/toJSON';
|
|
19
|
+
// Authored graphs registry (per-profile NavGraphSources). See src/graphs/README.md.
|
|
20
|
+
export { DEFAULT_GRAPH_ID, GRAPHS, getGraph, listGraphIds, } from './graphs/index';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AAO5C,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,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAOvD,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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { AreaNode, EntityRefs, GroupDef, GroupId, NavGraphSource, NodeId, Requirement, TravelEdge, TravelMethod, } from './types';
|
|
2
|
+
export { TRAVEL_METHODS, asGroupId, asNodeId } from './types';
|
|
3
|
+
export { navGraphSourceSchema } from './schema';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ir/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,cAAc,EACd,MAAM,EACN,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/ir/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ir/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { GroupId, NodeId, Requirement } from './types';
|
|
3
|
+
declare const nodeIdSchema: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
4
|
+
declare const groupIdSchema: z.ZodEffects<z.ZodString, GroupId, string>;
|
|
5
|
+
declare const travelMethodSchema: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
|
|
6
|
+
declare const requirementSchema: z.ZodType<Requirement>;
|
|
7
|
+
declare const entityRefsSchema: z.ZodObject<{
|
|
8
|
+
itemId: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
questId: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
npcId: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
itemId?: number | undefined;
|
|
13
|
+
questId?: number | undefined;
|
|
14
|
+
npcId?: number | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
itemId?: number | undefined;
|
|
17
|
+
questId?: number | undefined;
|
|
18
|
+
npcId?: number | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
declare const areaNodeSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
group: z.ZodOptional<z.ZodEffects<z.ZodString, GroupId, string>>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
id: string & {
|
|
26
|
+
readonly __brand: "NodeId";
|
|
27
|
+
};
|
|
28
|
+
name: string;
|
|
29
|
+
group?: GroupId | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
group?: string | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
declare const travelEdgeSchema: z.ZodObject<{
|
|
36
|
+
from: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
37
|
+
to: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
38
|
+
bidirectional: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
method: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
|
|
40
|
+
via: z.ZodOptional<z.ZodString>;
|
|
41
|
+
refs: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
itemId: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
questId: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
npcId: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
itemId?: number | undefined;
|
|
47
|
+
questId?: number | undefined;
|
|
48
|
+
npcId?: number | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
itemId?: number | undefined;
|
|
51
|
+
questId?: number | undefined;
|
|
52
|
+
npcId?: number | undefined;
|
|
53
|
+
}>>;
|
|
54
|
+
requirements: z.ZodOptional<z.ZodArray<z.ZodType<Requirement, z.ZodTypeDef, Requirement>, "many">>;
|
|
55
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
from: string & {
|
|
59
|
+
readonly __brand: "NodeId";
|
|
60
|
+
};
|
|
61
|
+
to: string & {
|
|
62
|
+
readonly __brand: "NodeId";
|
|
63
|
+
};
|
|
64
|
+
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
65
|
+
bidirectional?: boolean | undefined;
|
|
66
|
+
via?: string | undefined;
|
|
67
|
+
refs?: {
|
|
68
|
+
itemId?: number | undefined;
|
|
69
|
+
questId?: number | undefined;
|
|
70
|
+
npcId?: number | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
requirements?: Requirement[] | undefined;
|
|
73
|
+
weight?: number | undefined;
|
|
74
|
+
notes?: string | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
from: string;
|
|
77
|
+
to: string;
|
|
78
|
+
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
79
|
+
bidirectional?: boolean | undefined;
|
|
80
|
+
via?: string | undefined;
|
|
81
|
+
refs?: {
|
|
82
|
+
itemId?: number | undefined;
|
|
83
|
+
questId?: number | undefined;
|
|
84
|
+
npcId?: number | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
requirements?: Requirement[] | undefined;
|
|
87
|
+
weight?: number | undefined;
|
|
88
|
+
notes?: string | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
declare const groupDefSchema: z.ZodObject<{
|
|
91
|
+
id: z.ZodEffects<z.ZodString, GroupId, string>;
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
id: string & {
|
|
95
|
+
readonly __brand: "GroupId";
|
|
96
|
+
};
|
|
97
|
+
name: string;
|
|
98
|
+
}, {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
}>;
|
|
102
|
+
export declare const navGraphSourceSchema: z.ZodObject<{
|
|
103
|
+
profileId: z.ZodString;
|
|
104
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
105
|
+
id: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
group: z.ZodOptional<z.ZodEffects<z.ZodString, GroupId, string>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
id: string & {
|
|
110
|
+
readonly __brand: "NodeId";
|
|
111
|
+
};
|
|
112
|
+
name: string;
|
|
113
|
+
group?: GroupId | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
group?: string | undefined;
|
|
118
|
+
}>, "many">;
|
|
119
|
+
edges: z.ZodArray<z.ZodObject<{
|
|
120
|
+
from: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
121
|
+
to: z.ZodEffects<z.ZodString, NodeId, string>;
|
|
122
|
+
bidirectional: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
method: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
|
|
124
|
+
via: z.ZodOptional<z.ZodString>;
|
|
125
|
+
refs: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
itemId: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
questId: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
npcId: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
itemId?: number | undefined;
|
|
131
|
+
questId?: number | undefined;
|
|
132
|
+
npcId?: number | undefined;
|
|
133
|
+
}, {
|
|
134
|
+
itemId?: number | undefined;
|
|
135
|
+
questId?: number | undefined;
|
|
136
|
+
npcId?: number | undefined;
|
|
137
|
+
}>>;
|
|
138
|
+
requirements: z.ZodOptional<z.ZodArray<z.ZodType<Requirement, z.ZodTypeDef, Requirement>, "many">>;
|
|
139
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
from: string & {
|
|
143
|
+
readonly __brand: "NodeId";
|
|
144
|
+
};
|
|
145
|
+
to: string & {
|
|
146
|
+
readonly __brand: "NodeId";
|
|
147
|
+
};
|
|
148
|
+
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
149
|
+
bidirectional?: boolean | undefined;
|
|
150
|
+
via?: string | undefined;
|
|
151
|
+
refs?: {
|
|
152
|
+
itemId?: number | undefined;
|
|
153
|
+
questId?: number | undefined;
|
|
154
|
+
npcId?: number | undefined;
|
|
155
|
+
} | undefined;
|
|
156
|
+
requirements?: Requirement[] | undefined;
|
|
157
|
+
weight?: number | undefined;
|
|
158
|
+
notes?: string | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
from: string;
|
|
161
|
+
to: string;
|
|
162
|
+
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
163
|
+
bidirectional?: boolean | undefined;
|
|
164
|
+
via?: string | undefined;
|
|
165
|
+
refs?: {
|
|
166
|
+
itemId?: number | undefined;
|
|
167
|
+
questId?: number | undefined;
|
|
168
|
+
npcId?: number | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
requirements?: Requirement[] | undefined;
|
|
171
|
+
weight?: number | undefined;
|
|
172
|
+
notes?: string | undefined;
|
|
173
|
+
}>, "many">;
|
|
174
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
175
|
+
id: z.ZodEffects<z.ZodString, GroupId, string>;
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
id: string & {
|
|
179
|
+
readonly __brand: "GroupId";
|
|
180
|
+
};
|
|
181
|
+
name: string;
|
|
182
|
+
}, {
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
}>, "many">>;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
profileId: string;
|
|
188
|
+
nodes: {
|
|
189
|
+
id: string & {
|
|
190
|
+
readonly __brand: "NodeId";
|
|
191
|
+
};
|
|
192
|
+
name: string;
|
|
193
|
+
group?: GroupId | undefined;
|
|
194
|
+
}[];
|
|
195
|
+
edges: {
|
|
196
|
+
from: string & {
|
|
197
|
+
readonly __brand: "NodeId";
|
|
198
|
+
};
|
|
199
|
+
to: string & {
|
|
200
|
+
readonly __brand: "NodeId";
|
|
201
|
+
};
|
|
202
|
+
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
203
|
+
bidirectional?: boolean | undefined;
|
|
204
|
+
via?: string | undefined;
|
|
205
|
+
refs?: {
|
|
206
|
+
itemId?: number | undefined;
|
|
207
|
+
questId?: number | undefined;
|
|
208
|
+
npcId?: number | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
requirements?: Requirement[] | undefined;
|
|
211
|
+
weight?: number | undefined;
|
|
212
|
+
notes?: string | undefined;
|
|
213
|
+
}[];
|
|
214
|
+
groups?: {
|
|
215
|
+
id: string & {
|
|
216
|
+
readonly __brand: "GroupId";
|
|
217
|
+
};
|
|
218
|
+
name: string;
|
|
219
|
+
}[] | undefined;
|
|
220
|
+
}, {
|
|
221
|
+
profileId: string;
|
|
222
|
+
nodes: {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
group?: string | undefined;
|
|
226
|
+
}[];
|
|
227
|
+
edges: {
|
|
228
|
+
from: string;
|
|
229
|
+
to: string;
|
|
230
|
+
method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
|
|
231
|
+
bidirectional?: boolean | undefined;
|
|
232
|
+
via?: string | undefined;
|
|
233
|
+
refs?: {
|
|
234
|
+
itemId?: number | undefined;
|
|
235
|
+
questId?: number | undefined;
|
|
236
|
+
npcId?: number | undefined;
|
|
237
|
+
} | undefined;
|
|
238
|
+
requirements?: Requirement[] | undefined;
|
|
239
|
+
weight?: number | undefined;
|
|
240
|
+
notes?: string | undefined;
|
|
241
|
+
}[];
|
|
242
|
+
groups?: {
|
|
243
|
+
id: string;
|
|
244
|
+
name: string;
|
|
245
|
+
}[] | undefined;
|
|
246
|
+
}>;
|
|
247
|
+
export { areaNodeSchema, entityRefsSchema, groupDefSchema, groupIdSchema, nodeIdSchema, requirementSchema, travelEdgeSchema, travelMethodSchema, };
|
|
248
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +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,gEAAyB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC;AAEH,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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Runtime mirror of `./types.ts` for validation. compileGraph parses through
|
|
2
|
+
// these at load time, and the export CLI re-parses on round-trip. Branded ids
|
|
3
|
+
// are plain strings on the wire — branding is a TypeScript-only convenience.
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { TRAVEL_METHODS } from './types';
|
|
6
|
+
const nodeIdSchema = z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/, 'NodeId must be kebab-case (a-z, 0-9, hyphen)')
|
|
10
|
+
.transform((s) => s);
|
|
11
|
+
const groupIdSchema = z
|
|
12
|
+
.string()
|
|
13
|
+
.min(1)
|
|
14
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/, 'GroupId must be kebab-case (a-z, 0-9, hyphen)')
|
|
15
|
+
.transform((s) => s);
|
|
16
|
+
const travelMethodSchema = z.enum(TRAVEL_METHODS);
|
|
17
|
+
const requirementSchema = z.discriminatedUnion('kind', [
|
|
18
|
+
z.object({ kind: z.literal('meso'), amount: z.number().int().nonnegative() }),
|
|
19
|
+
z.object({
|
|
20
|
+
kind: z.literal('item'),
|
|
21
|
+
itemId: z.number().int().positive(),
|
|
22
|
+
consumed: z.boolean(),
|
|
23
|
+
quantity: z.number().int().positive().optional(),
|
|
24
|
+
}),
|
|
25
|
+
z.object({ kind: z.literal('quest'), questId: z.number().int().positive() }),
|
|
26
|
+
z.object({ kind: z.literal('level'), min: z.number().int().min(1).max(300) }),
|
|
27
|
+
]);
|
|
28
|
+
const entityRefsSchema = z.object({
|
|
29
|
+
itemId: z.number().int().positive().optional(),
|
|
30
|
+
questId: z.number().int().positive().optional(),
|
|
31
|
+
npcId: z.number().int().positive().optional(),
|
|
32
|
+
});
|
|
33
|
+
const areaNodeSchema = z.object({
|
|
34
|
+
id: nodeIdSchema,
|
|
35
|
+
name: z.string().min(1),
|
|
36
|
+
group: groupIdSchema.optional(),
|
|
37
|
+
});
|
|
38
|
+
const travelEdgeSchema = z.object({
|
|
39
|
+
from: nodeIdSchema,
|
|
40
|
+
to: nodeIdSchema,
|
|
41
|
+
bidirectional: z.boolean().optional(),
|
|
42
|
+
method: travelMethodSchema,
|
|
43
|
+
via: z.string().optional(),
|
|
44
|
+
refs: entityRefsSchema.optional(),
|
|
45
|
+
requirements: z.array(requirementSchema).optional(),
|
|
46
|
+
weight: z.number().nonnegative().optional(),
|
|
47
|
+
notes: z.string().optional(),
|
|
48
|
+
});
|
|
49
|
+
const groupDefSchema = z.object({
|
|
50
|
+
id: groupIdSchema,
|
|
51
|
+
name: z.string().min(1),
|
|
52
|
+
});
|
|
53
|
+
export const navGraphSourceSchema = z.object({
|
|
54
|
+
profileId: z.string().min(1),
|
|
55
|
+
nodes: z.array(areaNodeSchema),
|
|
56
|
+
edges: z.array(travelEdgeSchema),
|
|
57
|
+
groups: z.array(groupDefSchema).optional(),
|
|
58
|
+
});
|
|
59
|
+
export { areaNodeSchema, entityRefsSchema, groupDefSchema, groupIdSchema, nodeIdSchema, requirementSchema, travelEdgeSchema, travelMethodSchema, };
|
|
60
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +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,CAAC;KAC9E,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAY,CAAC,CAAC;AAElC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAElD,MAAM,iBAAiB,GAA2B,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7E,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;IAC7E,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,C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. kebab-case. NOT a game map id. */
|
|
2
|
+
export type NodeId = string & {
|
|
3
|
+
readonly __brand: 'NodeId';
|
|
4
|
+
};
|
|
5
|
+
/** Author-invented region cluster id used for grouping (future semantic zoom). */
|
|
6
|
+
export type GroupId = string & {
|
|
7
|
+
readonly __brand: 'GroupId';
|
|
8
|
+
};
|
|
9
|
+
export declare const TRAVEL_METHODS: readonly ["walk", "portal", "npc", "item", "skill", "other"];
|
|
10
|
+
export type TravelMethod = (typeof TRAVEL_METHODS)[number];
|
|
11
|
+
export type Requirement = {
|
|
12
|
+
kind: 'meso';
|
|
13
|
+
amount: number;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'item';
|
|
16
|
+
itemId: number;
|
|
17
|
+
consumed: boolean;
|
|
18
|
+
quantity?: number;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'quest';
|
|
21
|
+
questId: number;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'level';
|
|
24
|
+
min: number;
|
|
25
|
+
};
|
|
26
|
+
export interface AreaNode {
|
|
27
|
+
id: NodeId;
|
|
28
|
+
name: string;
|
|
29
|
+
group?: GroupId;
|
|
30
|
+
}
|
|
31
|
+
export interface EntityRefs {
|
|
32
|
+
itemId?: number;
|
|
33
|
+
questId?: number;
|
|
34
|
+
npcId?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface TravelEdge {
|
|
37
|
+
from: NodeId;
|
|
38
|
+
to: NodeId;
|
|
39
|
+
/** Default false (directed from→to). The compiler expands `true` into a pair. */
|
|
40
|
+
bidirectional?: boolean;
|
|
41
|
+
method: TravelMethod;
|
|
42
|
+
/** Free-text description shown in directions, e.g. "Talk to the sailor". */
|
|
43
|
+
via?: string;
|
|
44
|
+
refs?: EntityRefs;
|
|
45
|
+
requirements?: Requirement[];
|
|
46
|
+
/** Reserved for the future weighted-cost model; BFS ignores it. */
|
|
47
|
+
weight?: number;
|
|
48
|
+
notes?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface GroupDef {
|
|
51
|
+
id: GroupId;
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
export interface NavGraphSource {
|
|
55
|
+
profileId: string;
|
|
56
|
+
nodes: AreaNode[];
|
|
57
|
+
edges: TravelEdge[];
|
|
58
|
+
groups?: GroupDef[];
|
|
59
|
+
}
|
|
60
|
+
/** Helper for narrowing string literals to the branded id types. */
|
|
61
|
+
export declare const asNodeId: (s: string) => NodeId;
|
|
62
|
+
export declare const asGroupId: (s: string) => GroupId;
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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,8DAA+D,CAAC;AAC3F,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,QAAQ,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED,oEAAoE;AACpE,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MAAqB,CAAC;AAC3D,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,OAAuB,CAAC"}
|
package/dist/ir/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The Navigator graph IR. Authored as TypeScript so contributors get types,
|
|
2
|
+
// autocomplete, and compile errors instead of writing JSON or a query language.
|
|
3
|
+
// The shapes here are the schema the rest of the package operates on; the
|
|
4
|
+
// runtime mirror lives next door in `schema.ts` (Zod).
|
|
5
|
+
export const TRAVEL_METHODS = ['walk', 'portal', 'npc', 'item', 'skill', 'other'];
|
|
6
|
+
/** Helper for narrowing string literals to the branded id types. */
|
|
7
|
+
export const asNodeId = (s) => s;
|
|
8
|
+
export const asGroupId = (s) => s;
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +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,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAgD3F,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"}
|