@wovvmap/contracts 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog.d.ts +427 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +21 -0
- package/dist/depthConfig.d.ts +112 -0
- package/dist/depthConfig.d.ts.map +1 -0
- package/dist/depthConfig.js +109 -0
- package/dist/discovery.d.ts +122 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +91 -0
- package/dist/endpoints.d.ts +63 -0
- package/dist/endpoints.d.ts.map +1 -0
- package/dist/endpoints.js +61 -0
- package/dist/events.d.ts +198 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +204 -0
- package/dist/geometry.d.ts +190 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +6 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/interaction.d.ts +37 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +32 -0
- package/dist/interactionScope.d.ts +15 -0
- package/dist/interactionScope.d.ts.map +1 -0
- package/dist/interactionScope.js +30 -0
- package/dist/metadata.d.ts +217 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +102 -0
- package/dist/multiFloor.d.ts +102 -0
- package/dist/multiFloor.d.ts.map +1 -0
- package/dist/multiFloor.js +30 -0
- package/dist/navigation/index.d.ts +17 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +14 -0
- package/dist/navigation/navigationConfig.d.ts +21 -0
- package/dist/navigation/navigationConfig.d.ts.map +1 -0
- package/dist/navigation/navigationConfig.js +18 -0
- package/dist/navigation/offlineRecovery.d.ts +29 -0
- package/dist/navigation/offlineRecovery.d.ts.map +1 -0
- package/dist/navigation/offlineRecovery.js +47 -0
- package/dist/navigation/offlineRouteConfig.d.ts +17 -0
- package/dist/navigation/offlineRouteConfig.d.ts.map +1 -0
- package/dist/navigation/offlineRouteConfig.js +53 -0
- package/dist/navigation/resolveNavigationConfig.d.ts +6 -0
- package/dist/navigation/resolveNavigationConfig.d.ts.map +1 -0
- package/dist/navigation/resolveNavigationConfig.js +50 -0
- package/dist/navigation/routeArtifacts.d.ts +130 -0
- package/dist/navigation/routeArtifacts.d.ts.map +1 -0
- package/dist/navigation/routeArtifacts.js +1 -0
- package/dist/navigation/routeDelivery.d.ts +83 -0
- package/dist/navigation/routeDelivery.d.ts.map +1 -0
- package/dist/navigation/routeDelivery.js +22 -0
- package/dist/navigation/routeJourneyValidation.d.ts +5 -0
- package/dist/navigation/routeJourneyValidation.d.ts.map +1 -0
- package/dist/navigation/routeJourneyValidation.js +65 -0
- package/dist/navigation/routeOperations.d.ts +70 -0
- package/dist/navigation/routeOperations.d.ts.map +1 -0
- package/dist/navigation/routeOperations.js +22 -0
- package/dist/navigation/routePlayback.d.ts +98 -0
- package/dist/navigation/routePlayback.d.ts.map +1 -0
- package/dist/navigation/routePlayback.js +44 -0
- package/dist/navigation/routeResponseValidation.d.ts +10 -0
- package/dist/navigation/routeResponseValidation.d.ts.map +1 -0
- package/dist/navigation/routeResponseValidation.js +280 -0
- package/dist/navigation/routeSnapshot.d.ts +5 -0
- package/dist/navigation/routeSnapshot.d.ts.map +1 -0
- package/dist/navigation/routeSnapshot.js +145 -0
- package/dist/navigation/routeState.d.ts +105 -0
- package/dist/navigation/routeState.d.ts.map +1 -0
- package/dist/navigation/routeState.js +1 -0
- package/dist/navigation/routeSteps.d.ts +27 -0
- package/dist/navigation/routeSteps.d.ts.map +1 -0
- package/dist/navigation/routeSteps.js +1 -0
- package/dist/navigation/savedRoute.d.ts +156 -0
- package/dist/navigation/savedRoute.d.ts.map +1 -0
- package/dist/navigation/savedRoute.js +68 -0
- package/dist/navigation/savedRouteValidation.d.ts +5 -0
- package/dist/navigation/savedRouteValidation.d.ts.map +1 -0
- package/dist/navigation/savedRouteValidation.js +298 -0
- package/dist/nodeLine.d.ts +45 -0
- package/dist/nodeLine.d.ts.map +1 -0
- package/dist/nodeLine.js +44 -0
- package/dist/nodePoint.d.ts +111 -0
- package/dist/nodePoint.d.ts.map +1 -0
- package/dist/nodePoint.js +152 -0
- package/dist/offerValidity.d.ts +11 -0
- package/dist/offerValidity.d.ts.map +1 -0
- package/dist/offerValidity.js +27 -0
- package/dist/offline.d.ts +60 -0
- package/dist/offline.d.ts.map +1 -0
- package/dist/offline.js +47 -0
- package/dist/preparedMap.d.ts +186 -0
- package/dist/preparedMap.d.ts.map +1 -0
- package/dist/preparedMap.js +6 -0
- package/dist/preparedMapIdentity.d.ts +3 -0
- package/dist/preparedMapIdentity.d.ts.map +1 -0
- package/dist/preparedMapIdentity.js +30 -0
- package/dist/publicAssets.d.ts +11 -0
- package/dist/publicAssets.d.ts.map +1 -0
- package/dist/publicAssets.js +5 -0
- package/dist/taxonomy.d.ts +50 -0
- package/dist/taxonomy.d.ts.map +1 -0
- package/dist/taxonomy.js +10 -0
- package/dist/theme.d.ts +143 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +141 -0
- package/dist/viewer.d.ts +333 -0
- package/dist/viewer.d.ts.map +1 -0
- package/dist/viewer.js +109 -0
- package/package.json +28 -3
- package/README.md +0 -3
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { RouteConnectorKind } from './routeState.js';
|
|
2
|
+
import type { RouteTravelDirection } from './routeArtifacts.js';
|
|
3
|
+
/** Display preferences only; these never become private route-planner inputs.
|
|
4
|
+
* Hinglish: Speed visual units mein hai, real walking ETA ya routing permission nahi. */
|
|
5
|
+
export declare const ROUTE_PLAYBACK_SPEEDS: readonly [0.5, 0.75, 1, 1.5, 2];
|
|
6
|
+
export declare const ROUTE_PLAYBACK_MODES: readonly ["full-route", "current-floor"];
|
|
7
|
+
export type RoutePlaybackSpeed = (typeof ROUTE_PLAYBACK_SPEEDS)[number];
|
|
8
|
+
export type RoutePlaybackMode = (typeof ROUTE_PLAYBACK_MODES)[number];
|
|
9
|
+
/** Portable preferences; defaults preserve existing camera and manual-step behavior.
|
|
10
|
+
* Hinglish: Follow/sync opt-in hain; platform apne flags nahi banayega. */
|
|
11
|
+
export interface RoutePlaybackOptions {
|
|
12
|
+
/** Optional presentation timings; zero/preserve keep immediate playback and the current camera.
|
|
13
|
+
* Hinglish: Delay sirf fresh Play/Replay par; route calculation ya walking ETA ka part nahi. */
|
|
14
|
+
readonly startDelayMs?: number;
|
|
15
|
+
readonly finishView?: 'preserve' | 'route-overview';
|
|
16
|
+
readonly finishDelayMs?: number;
|
|
17
|
+
readonly cameraFollow?: 'off' | 'follow';
|
|
18
|
+
readonly stepSync?: 'off' | 'highlight';
|
|
19
|
+
readonly mode?: RoutePlaybackMode;
|
|
20
|
+
readonly speed?: RoutePlaybackSpeed;
|
|
21
|
+
}
|
|
22
|
+
/** Small host-visible handoff summary; no coordinates, graph or visit buffers.
|
|
23
|
+
* Hinglish: UI ko sirf kis floor/connector par ja rahe hain pata chale. */
|
|
24
|
+
export interface RoutePlaybackTransition {
|
|
25
|
+
readonly fromFloorIndex: number;
|
|
26
|
+
readonly toFloorIndex: number;
|
|
27
|
+
readonly transport: RouteConnectorKind;
|
|
28
|
+
readonly direction: RouteTravelDirection | null;
|
|
29
|
+
readonly toFloorLabel?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface RoutePlaybackState extends RoutePlaybackOptions {
|
|
32
|
+
readonly status: 'idle' | 'starting' | 'countdown' | 'running' | 'transitioning' | 'paused' | 'stopped' | 'completed';
|
|
33
|
+
readonly countdownSeconds?: number;
|
|
34
|
+
readonly transition?: Readonly<RoutePlaybackTransition>;
|
|
35
|
+
readonly mode: RoutePlaybackMode;
|
|
36
|
+
readonly speed: RoutePlaybackSpeed;
|
|
37
|
+
readonly unavailableReason?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const DEFAULT_ROUTE_PLAYBACK_OPTIONS: Readonly<{
|
|
40
|
+
readonly mode: "full-route";
|
|
41
|
+
readonly speed: 1;
|
|
42
|
+
}>;
|
|
43
|
+
/** Narrow display adapter port, not a host payload or a second writable route store.
|
|
44
|
+
* Hinglish: Run/distance sirf rendering runtime mein; WebView messages mein kabhi nahi. */
|
|
45
|
+
export interface RoutePlaybackScope {
|
|
46
|
+
readonly runIndex: number;
|
|
47
|
+
readonly floorIndex: number;
|
|
48
|
+
readonly length: number;
|
|
49
|
+
readonly offset?: number;
|
|
50
|
+
readonly totalLength?: number;
|
|
51
|
+
readonly transition?: Readonly<RoutePlaybackTransition>;
|
|
52
|
+
}
|
|
53
|
+
export interface RoutePlaybackDriver {
|
|
54
|
+
readonly running: boolean;
|
|
55
|
+
tick(time: number): boolean;
|
|
56
|
+
resetClock(): void;
|
|
57
|
+
}
|
|
58
|
+
export interface RoutePlaybackBinding {
|
|
59
|
+
/** Optional camera presentation over accepted buffers only; cancellation never grants reverse travel.
|
|
60
|
+
* Hinglish: Full-route origin overview/current-floor exact visit; graph ya NodePoint lookup nahi. */
|
|
61
|
+
focusCompletion?(scope: RoutePlaybackScope, mode: RoutePlaybackMode, signal: AbortSignal): Promise<void>;
|
|
62
|
+
scope(mode: RoutePlaybackMode, bound?: RoutePlaybackScope): RoutePlaybackScope;
|
|
63
|
+
next?(scope: RoutePlaybackScope): RoutePlaybackScope | undefined;
|
|
64
|
+
/** Mount and adopt synchronously before publishing a floor event, then await existing render readiness.
|
|
65
|
+
* Hinglish: Floor observer ko old cursor/new floor na mile; signal newer intent ko priority deta hai. */
|
|
66
|
+
enter?(scope: RoutePlaybackScope, signal: AbortSignal, adopt: () => void): void | Promise<void>;
|
|
67
|
+
ready?(options?: Readonly<RoutePlaybackState>, signal?: AbortSignal): void | Promise<void>;
|
|
68
|
+
options?(options: Readonly<RoutePlaybackState>, running: boolean): void;
|
|
69
|
+
activeStep?(scope: RoutePlaybackScope, distance: number): {
|
|
70
|
+
readonly stepIndex: number;
|
|
71
|
+
readonly stepId: string;
|
|
72
|
+
} | null;
|
|
73
|
+
/** null detaches the driver safely even after resource disposal.
|
|
74
|
+
* Hinglish: Retired resource par bhi driver cleanup idempotent rahe. */
|
|
75
|
+
bind(driver: RoutePlaybackDriver | null): void;
|
|
76
|
+
position(scope: RoutePlaybackScope, distance: number, delta?: number): void;
|
|
77
|
+
release(): void;
|
|
78
|
+
}
|
|
79
|
+
/** Small readonly animation projection; coordinates and routing data never cross this event.
|
|
80
|
+
* Hinglish: Simulation time hai, walking ETA nahi; Native sirf ready public progress padhe. */
|
|
81
|
+
export interface RoutePlaybackProgress {
|
|
82
|
+
readonly routeSetId: string;
|
|
83
|
+
readonly routeId: string;
|
|
84
|
+
readonly playbackId: string;
|
|
85
|
+
readonly sequence: number;
|
|
86
|
+
readonly progress: number;
|
|
87
|
+
readonly elapsedSeconds: number;
|
|
88
|
+
readonly mode: RoutePlaybackMode;
|
|
89
|
+
readonly floorIndex: number;
|
|
90
|
+
readonly activeStep: {
|
|
91
|
+
readonly stepIndex: number;
|
|
92
|
+
readonly stepId: string;
|
|
93
|
+
} | null;
|
|
94
|
+
}
|
|
95
|
+
/** Allowlist the small event once at its read boundary; do not retain foreign object fields.
|
|
96
|
+
* Hinglish: Native/UI ko sirf public progress mile; invalid event existing state overwrite na kare. */
|
|
97
|
+
export declare function projectRoutePlaybackProgress(value: unknown): Readonly<RoutePlaybackProgress> | null;
|
|
98
|
+
//# sourceMappingURL=routePlayback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routePlayback.d.ts","sourceRoot":"","sources":["../../src/navigation/routePlayback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D;yFACyF;AACzF,eAAO,MAAM,qBAAqB,iCAAiD,CAAA;AACnF,eAAO,MAAM,oBAAoB,0CAA0D,CAAA;AAC3F,MAAM,MAAM,kBAAkB,GAAG,CAAC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@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Display preferences only; these never become private route-planner inputs.
|
|
2
|
+
* Hinglish: Speed visual units mein hai, real walking ETA ya routing permission nahi. */
|
|
3
|
+
export const ROUTE_PLAYBACK_SPEEDS = Object.freeze([0.5, 0.75, 1, 1.5, 2]);
|
|
4
|
+
export const ROUTE_PLAYBACK_MODES = Object.freeze(['full-route', 'current-floor']);
|
|
5
|
+
export const DEFAULT_ROUTE_PLAYBACK_OPTIONS = Object.freeze({
|
|
6
|
+
mode: 'full-route',
|
|
7
|
+
speed: 1,
|
|
8
|
+
});
|
|
9
|
+
/** Allowlist the small event once at its read boundary; do not retain foreign object fields.
|
|
10
|
+
* Hinglish: Native/UI ko sirf public progress mile; invalid event existing state overwrite na kare. */
|
|
11
|
+
export function projectRoutePlaybackProgress(value) {
|
|
12
|
+
if (!value || typeof value !== 'object')
|
|
13
|
+
return null;
|
|
14
|
+
const v = value;
|
|
15
|
+
if (![v.routeSetId, v.routeId, v.playbackId].every((x) => typeof x === 'string' && x.length > 0 && x.length < 200) ||
|
|
16
|
+
!Number.isSafeInteger(v.sequence) ||
|
|
17
|
+
v.sequence < 1 ||
|
|
18
|
+
!Number.isFinite(v.progress) ||
|
|
19
|
+
v.progress < 0 ||
|
|
20
|
+
v.progress > 1 ||
|
|
21
|
+
!Number.isFinite(v.elapsedSeconds) ||
|
|
22
|
+
v.elapsedSeconds < 0 ||
|
|
23
|
+
!Number.isSafeInteger(v.floorIndex) ||
|
|
24
|
+
!ROUTE_PLAYBACK_MODES.includes(v.mode) ||
|
|
25
|
+
(v.activeStep !== null &&
|
|
26
|
+
(!v.activeStep ||
|
|
27
|
+
!Number.isSafeInteger(v.activeStep.stepIndex) ||
|
|
28
|
+
v.activeStep.stepIndex < 0 ||
|
|
29
|
+
typeof v.activeStep.stepId !== 'string')))
|
|
30
|
+
return null;
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
routeSetId: v.routeSetId,
|
|
33
|
+
routeId: v.routeId,
|
|
34
|
+
playbackId: v.playbackId,
|
|
35
|
+
sequence: v.sequence,
|
|
36
|
+
progress: v.progress,
|
|
37
|
+
elapsedSeconds: v.elapsedSeconds,
|
|
38
|
+
mode: v.mode,
|
|
39
|
+
floorIndex: v.floorIndex,
|
|
40
|
+
activeStep: v.activeStep
|
|
41
|
+
? Object.freeze({ stepIndex: v.activeStep.stepIndex, stepId: v.activeStep.stepId })
|
|
42
|
+
: null,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type RouteGenerateResponse, type RouteGeometryResponse, type RouteStepsResponse, type RoutePlaybackIndexResponse } from './routeDelivery.js';
|
|
2
|
+
/** Validate one bounded instruction page at HTTP ingress; rendering ranges stay inside the runtime.
|
|
3
|
+
* Hinglish: Untrusted page yahin check ho; UI ko neeche sirf display allowlist milegi. */
|
|
4
|
+
export declare function validateRouteSteps(value: unknown): RouteStepsResponse;
|
|
5
|
+
/** Validate untrusted HTTP data once before resource creation. This checks buffers, never reconstructs a path.
|
|
6
|
+
* Hinglish: HTTP par runtime check zaroori hai; yahan graph/ribbon/instruction math nahi hoti. */
|
|
7
|
+
export declare function validateRouteSummary(value: unknown): RouteGenerateResponse;
|
|
8
|
+
export declare function validateRouteGeometry(value: unknown): RouteGeometryResponse;
|
|
9
|
+
export declare function validatePlaybackIndex(value: unknown): RoutePlaybackIndexResponse;
|
|
10
|
+
//# sourceMappingURL=routeResponseValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeResponseValidation.d.ts","sourceRoot":"","sources":["../../src/navigation/routeResponseValidation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAChC,MAAM,iBAAiB,CAAA;AAyCxB;0FAC0F;AAC1F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CA0ErE;AAED;kGACkG;AAClG,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CA+C1E;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAsI3E;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,CAKhF"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { ViewerCommandError } from '../events.js';
|
|
2
|
+
import {} from './routeDelivery.js';
|
|
3
|
+
import { validateRouteJourney } from './routeJourneyValidation.js';
|
|
4
|
+
const action = /^(start|straight|turn_left|turn_right|turn_around|arrive|take_(elevator|escalator|stairs|connection)(_up|_down)?|exit_(elevator|escalator|stairs|connection))$/;
|
|
5
|
+
const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
6
|
+
const finite = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
7
|
+
const index = (v) => finite(v) && Number.isSafeInteger(v) && v >= 0;
|
|
8
|
+
const id = (v) => typeof v === 'string' &&
|
|
9
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(v);
|
|
10
|
+
const text = (v) => typeof v === 'string';
|
|
11
|
+
const metric = (v) => v === null || (finite(v) && v >= 0);
|
|
12
|
+
const numbers = (v) => Array.isArray(v) && v.every((item) => finite(item) && Math.abs(item) <= 3.4028234663852886e38);
|
|
13
|
+
const source = (v) => {
|
|
14
|
+
if (!record(v) || !record(v.depthConfig))
|
|
15
|
+
return false;
|
|
16
|
+
const depth = v.depthConfig;
|
|
17
|
+
return (finite(depth.floorBaseDepth) &&
|
|
18
|
+
finite(depth.defaultUnitDepth) &&
|
|
19
|
+
(depth.customDepths === undefined ||
|
|
20
|
+
(record(depth.customDepths) && Object.values(depth.customDepths).every(finite))) &&
|
|
21
|
+
(depth.modeDepths === undefined ||
|
|
22
|
+
(record(depth.modeDepths) &&
|
|
23
|
+
Object.values(depth.modeDepths).every((mode) => record(mode) &&
|
|
24
|
+
finite(mode.unitDepth) &&
|
|
25
|
+
finite(mode.extraDepthPlane) &&
|
|
26
|
+
finite(mode.extraDepthSprite)))));
|
|
27
|
+
};
|
|
28
|
+
function invalid() {
|
|
29
|
+
throw new ViewerCommandError('Invalid route delivery response.', {
|
|
30
|
+
code: 'INVALID_ROUTE_RESPONSE',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Validate one bounded instruction page at HTTP ingress; rendering ranges stay inside the runtime.
|
|
34
|
+
* Hinglish: Untrusted page yahin check ho; UI ko neeche sirf display allowlist milegi. */
|
|
35
|
+
export function validateRouteSteps(value) {
|
|
36
|
+
if (!record(value) ||
|
|
37
|
+
!id(value.routeSetId) ||
|
|
38
|
+
!id(value.routeId) ||
|
|
39
|
+
!finite(value.expiresAt) ||
|
|
40
|
+
!index(value.offset) ||
|
|
41
|
+
!index(value.limit) ||
|
|
42
|
+
value.limit < 1 ||
|
|
43
|
+
value.limit > 50 ||
|
|
44
|
+
!index(value.total) ||
|
|
45
|
+
!Array.isArray(value.items) ||
|
|
46
|
+
value.items.length > value.limit ||
|
|
47
|
+
value.offset > value.total ||
|
|
48
|
+
value.offset + value.items.length > value.total ||
|
|
49
|
+
(value.nextOffset !== null &&
|
|
50
|
+
(!index(value.nextOffset) ||
|
|
51
|
+
value.nextOffset !== value.offset + value.items.length ||
|
|
52
|
+
value.nextOffset <= value.offset ||
|
|
53
|
+
value.nextOffset >= value.total)) ||
|
|
54
|
+
(value.nextOffset === null && value.offset + value.items.length !== value.total))
|
|
55
|
+
invalid();
|
|
56
|
+
const ids = new Set();
|
|
57
|
+
for (const step of value.items) {
|
|
58
|
+
if (!record(step) ||
|
|
59
|
+
!text(step.id) ||
|
|
60
|
+
ids.has(step.id) ||
|
|
61
|
+
!text(step.instruction) ||
|
|
62
|
+
!text(step.action) ||
|
|
63
|
+
!action.test(step.action) ||
|
|
64
|
+
step.icon !== step.action ||
|
|
65
|
+
!index(step.floorIndex) ||
|
|
66
|
+
(step.floorName !== undefined && !text(step.floorName)) ||
|
|
67
|
+
!metric(step.distanceMeters) ||
|
|
68
|
+
!metric(step.estimatedDurationSeconds) ||
|
|
69
|
+
(step.distanceText !== null && !text(step.distanceText)) ||
|
|
70
|
+
(step.timeText !== null && !text(step.timeText)))
|
|
71
|
+
invalid();
|
|
72
|
+
ids.add(step.id);
|
|
73
|
+
if (step.focusDirection !== undefined &&
|
|
74
|
+
(!numbers(step.focusDirection) || step.focusDirection.length !== 3))
|
|
75
|
+
invalid();
|
|
76
|
+
if (step.focusBounds !== undefined) {
|
|
77
|
+
const bounds = step.focusBounds;
|
|
78
|
+
if (!record(bounds) ||
|
|
79
|
+
!numbers(bounds.min) ||
|
|
80
|
+
!numbers(bounds.max) ||
|
|
81
|
+
bounds.min.length !== 3 ||
|
|
82
|
+
bounds.max.length !== 3 ||
|
|
83
|
+
bounds.min.some((v, i) => v > bounds.max[i]))
|
|
84
|
+
invalid();
|
|
85
|
+
}
|
|
86
|
+
if (step.geometryRanges !== undefined &&
|
|
87
|
+
(!Array.isArray(step.geometryRanges) ||
|
|
88
|
+
step.geometryRanges.some((range) => !record(range) ||
|
|
89
|
+
!['runIndex', 'vertexStart', 'vertexCount', 'indexStart', 'indexCount'].every((key) => index(range[key])))))
|
|
90
|
+
invalid();
|
|
91
|
+
}
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
/** Validate untrusted HTTP data once before resource creation. This checks buffers, never reconstructs a path.
|
|
95
|
+
* Hinglish: HTTP par runtime check zaroori hai; yahan graph/ribbon/instruction math nahi hoti. */
|
|
96
|
+
export function validateRouteSummary(value) {
|
|
97
|
+
if (!record(value) ||
|
|
98
|
+
!record(value.routeSet) ||
|
|
99
|
+
!record(value.config) ||
|
|
100
|
+
!finite(value.expiresAt))
|
|
101
|
+
invalid();
|
|
102
|
+
const set = value.routeSet;
|
|
103
|
+
if (!id(set.routeSetId) ||
|
|
104
|
+
!id(set.recommendedRouteId) ||
|
|
105
|
+
!text(set.policyRevision) ||
|
|
106
|
+
!source(set.source) ||
|
|
107
|
+
!Array.isArray(set.options) ||
|
|
108
|
+
set.options.length < 1 ||
|
|
109
|
+
set.options.length > 2)
|
|
110
|
+
invalid();
|
|
111
|
+
for (const option of set.options) {
|
|
112
|
+
if (!record(option) ||
|
|
113
|
+
!id(option.routeId) ||
|
|
114
|
+
!Array.isArray(option.floorIndices) ||
|
|
115
|
+
!option.floorIndices.every(index) ||
|
|
116
|
+
!Array.isArray(option.connectors) ||
|
|
117
|
+
!option.connectors.every((v) => ['elevator', 'escalator', 'stairs', 'connection'].includes(v)) ||
|
|
118
|
+
!metric(option.distanceMeters) ||
|
|
119
|
+
!metric(option.estimatedDurationSeconds) ||
|
|
120
|
+
(option.fallbackUsed !== undefined &&
|
|
121
|
+
(!text(option.fallbackUsed) ||
|
|
122
|
+
!['elevator_to_escalator', 'escalator_to_elevator'].includes(option.fallbackUsed))))
|
|
123
|
+
invalid();
|
|
124
|
+
for (const endpoint of [option.origin, option.destination])
|
|
125
|
+
if (!record(endpoint) ||
|
|
126
|
+
!text(endpoint.key) ||
|
|
127
|
+
!text(endpoint.name) ||
|
|
128
|
+
!index(endpoint.floorIndex) ||
|
|
129
|
+
!text(endpoint.floorName))
|
|
130
|
+
invalid();
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
export function validateRouteGeometry(value) {
|
|
135
|
+
if (!record(value) ||
|
|
136
|
+
!id(value.routeSetId) ||
|
|
137
|
+
!id(value.routeId) ||
|
|
138
|
+
!finite(value.expiresAt) ||
|
|
139
|
+
!record(value.artifact))
|
|
140
|
+
invalid();
|
|
141
|
+
const artifact = value.artifact;
|
|
142
|
+
if (artifact.formatVersion !== 1 ||
|
|
143
|
+
artifact.space !== 'floor-local' ||
|
|
144
|
+
!source(artifact.source) ||
|
|
145
|
+
!record(artifact.placement) ||
|
|
146
|
+
!['scale', 'elevation', 'width', 'height'].every((key) => {
|
|
147
|
+
const value = artifact.placement[key];
|
|
148
|
+
return (finite(value) && Number.isFinite(Math.fround(value)) && (key === 'elevation' || value > 0));
|
|
149
|
+
}) ||
|
|
150
|
+
!numbers(artifact.centerline) ||
|
|
151
|
+
artifact.centerline.length < 3 ||
|
|
152
|
+
artifact.centerline.length % 3 !== 0 ||
|
|
153
|
+
!Array.isArray(artifact.runs) ||
|
|
154
|
+
!artifact.runs.length ||
|
|
155
|
+
!index(artifact.stepCount) ||
|
|
156
|
+
typeof artifact.stepsPrepared !== 'boolean' ||
|
|
157
|
+
'steps' in artifact ||
|
|
158
|
+
!Array.isArray(artifact.markers) ||
|
|
159
|
+
!record(artifact.metrics))
|
|
160
|
+
invalid();
|
|
161
|
+
const last = artifact.centerline.length / 3 - 1, height = artifact.placement.height;
|
|
162
|
+
for (const marker of artifact.markers) {
|
|
163
|
+
if (!record(marker) ||
|
|
164
|
+
!text(marker.id) ||
|
|
165
|
+
!text(marker.kind) ||
|
|
166
|
+
!['origin', 'destination', 'connector_entry', 'connector_exit'].includes(marker.kind) ||
|
|
167
|
+
!index(marker.pathIndex) ||
|
|
168
|
+
marker.pathIndex > last ||
|
|
169
|
+
!index(marker.runIndex) ||
|
|
170
|
+
marker.runIndex >= artifact.runs.length ||
|
|
171
|
+
!index(marker.floorIndex))
|
|
172
|
+
invalid();
|
|
173
|
+
}
|
|
174
|
+
for (const run of artifact.runs) {
|
|
175
|
+
if (!record(run) ||
|
|
176
|
+
!text(run.id) ||
|
|
177
|
+
!index(run.floorIndex) ||
|
|
178
|
+
!text(run.floorLabel) ||
|
|
179
|
+
!index(run.fromPathIndex) ||
|
|
180
|
+
!index(run.toPathIndex) ||
|
|
181
|
+
run.toPathIndex < run.fromPathIndex ||
|
|
182
|
+
run.toPathIndex > last ||
|
|
183
|
+
!Array.isArray(run.edges))
|
|
184
|
+
invalid();
|
|
185
|
+
if (run.motion !== undefined) {
|
|
186
|
+
const motion = run.motion;
|
|
187
|
+
if (!record(motion) ||
|
|
188
|
+
!Array.isArray(motion.cumulativeLengths) ||
|
|
189
|
+
motion.cumulativeLengths.length !== run.edges.length + 1 ||
|
|
190
|
+
run.edges.length > run.toPathIndex - run.fromPathIndex ||
|
|
191
|
+
motion.cumulativeLengths[0] !== 0)
|
|
192
|
+
invalid();
|
|
193
|
+
for (let i = 0; i < run.edges.length; i++) {
|
|
194
|
+
const edge = run.edges[i], a = motion.cumulativeLengths[i], b = motion.cumulativeLengths[i + 1];
|
|
195
|
+
if (!finite(a) ||
|
|
196
|
+
!finite(b) ||
|
|
197
|
+
b <= a ||
|
|
198
|
+
!record(edge) ||
|
|
199
|
+
!index(edge.fromPathIndex) ||
|
|
200
|
+
!index(edge.toPathIndex) ||
|
|
201
|
+
edge.fromPathIndex < run.fromPathIndex ||
|
|
202
|
+
edge.toPathIndex > run.toPathIndex ||
|
|
203
|
+
edge.toPathIndex <= edge.fromPathIndex ||
|
|
204
|
+
(i > 0 && edge.fromPathIndex < run.edges[i - 1].toPathIndex))
|
|
205
|
+
invalid();
|
|
206
|
+
// Validate the actual GPU translation once at delivery, not in every animation frame.
|
|
207
|
+
// Hinglish: Height aur anchor alag finite hon tab bhi unka top overflow kar sakta hai.
|
|
208
|
+
const fromTop = artifact.centerline[edge.fromPathIndex * 3 + 1] + height, toTop = artifact.centerline[edge.toPathIndex * 3 + 1] + height;
|
|
209
|
+
if (!Number.isFinite(Math.fround(fromTop)) || !Number.isFinite(Math.fround(toTop)))
|
|
210
|
+
invalid();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (run.geometry === null)
|
|
214
|
+
continue;
|
|
215
|
+
const g = run.geometry;
|
|
216
|
+
if (!record(g) ||
|
|
217
|
+
!numbers(g.positions) ||
|
|
218
|
+
g.positions.length < 9 ||
|
|
219
|
+
g.positions.length % 3 !== 0 ||
|
|
220
|
+
!numbers(g.normals) ||
|
|
221
|
+
g.normals.length !== g.positions.length ||
|
|
222
|
+
(g.uvs !== null && (!numbers(g.uvs) || g.uvs.length !== (g.positions.length / 3) * 2)) ||
|
|
223
|
+
(g.indices !== null &&
|
|
224
|
+
(!Array.isArray(g.indices) ||
|
|
225
|
+
g.indices.length % 3 !== 0 ||
|
|
226
|
+
!g.indices.every((v) => index(v) && v < g.positions.length / 3))))
|
|
227
|
+
invalid();
|
|
228
|
+
}
|
|
229
|
+
validateRouteJourney(artifact.playbackJourney, artifact.runs);
|
|
230
|
+
if (artifact.playbackSteps !== undefined) {
|
|
231
|
+
validatePlaybackSpans(artifact.playbackSteps, artifact.stepCount);
|
|
232
|
+
for (const span of artifact.playbackSteps) {
|
|
233
|
+
const run = artifact.runs[span.runIndex];
|
|
234
|
+
if (!run ||
|
|
235
|
+
run.floorIndex !== span.floorIndex ||
|
|
236
|
+
span.toDistance > (run.motion?.cumulativeLengths.at(-1) ?? 0))
|
|
237
|
+
invalid();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return value;
|
|
241
|
+
}
|
|
242
|
+
/** Validate the small display index once at delivery, never in the frame loop.
|
|
243
|
+
* Hinglish: Ordered ready ranges hi accept hon; source/graph data is response mein nahi. */
|
|
244
|
+
function validatePlaybackSpans(value, total) {
|
|
245
|
+
if (!index(total) || !Array.isArray(value) || value.length !== total || value.length > 10000)
|
|
246
|
+
invalid();
|
|
247
|
+
let previousRun = -1, previousDistance = -1;
|
|
248
|
+
for (const [i, span] of value.entries()) {
|
|
249
|
+
if (!record(span) ||
|
|
250
|
+
span.stepIndex !== i ||
|
|
251
|
+
!text(span.stepId) ||
|
|
252
|
+
!span.stepId ||
|
|
253
|
+
!index(span.runIndex) ||
|
|
254
|
+
!index(span.floorIndex) ||
|
|
255
|
+
!finite(span.fromDistance) ||
|
|
256
|
+
!finite(span.toDistance) ||
|
|
257
|
+
span.fromDistance < 0 ||
|
|
258
|
+
span.toDistance < span.fromDistance ||
|
|
259
|
+
span.runIndex < previousRun ||
|
|
260
|
+
(span.runIndex === previousRun && span.fromDistance < previousDistance) ||
|
|
261
|
+
!text(span.action) ||
|
|
262
|
+
!action.test(span.action) ||
|
|
263
|
+
!Array.isArray(span.geometryRanges))
|
|
264
|
+
invalid();
|
|
265
|
+
for (const range of span.geometryRanges) {
|
|
266
|
+
if (!record(range) ||
|
|
267
|
+
range.runIndex !== span.runIndex ||
|
|
268
|
+
!['vertexStart', 'vertexCount', 'indexStart', 'indexCount'].every((k) => index(range[k])))
|
|
269
|
+
invalid();
|
|
270
|
+
}
|
|
271
|
+
previousRun = span.runIndex;
|
|
272
|
+
previousDistance = span.fromDistance;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
export function validatePlaybackIndex(value) {
|
|
276
|
+
if (!record(value) || !id(value.routeSetId) || !id(value.routeId) || !finite(value.expiresAt))
|
|
277
|
+
invalid();
|
|
278
|
+
validatePlaybackSpans(value.playbackSteps, value.stepCount);
|
|
279
|
+
return value;
|
|
280
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RouteState } from './routeState.js';
|
|
2
|
+
/** Copy only compact approved fields. Native projections must not retain geometry or arbitrary response extras.
|
|
3
|
+
* Hinglish: Store/event mein sirf summary rahe; raw geometry aur extra internal data strip ho. */
|
|
4
|
+
export declare function freezeRouteState(state: RouteState): RouteState;
|
|
5
|
+
//# sourceMappingURL=routeSnapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeSnapshot.d.ts","sourceRoot":"","sources":["../../src/navigation/routeSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AASnE;kGACkG;AAClG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAyI9D"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
function freeze(value) {
|
|
2
|
+
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
3
|
+
for (const child of Object.values(value))
|
|
4
|
+
freeze(child);
|
|
5
|
+
Object.freeze(value);
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
/** Copy only compact approved fields. Native projections must not retain geometry or arbitrary response extras.
|
|
10
|
+
* Hinglish: Store/event mein sirf summary rahe; raw geometry aur extra internal data strip ho. */
|
|
11
|
+
export function freezeRouteState(state) {
|
|
12
|
+
const source = state.routeSet?.source;
|
|
13
|
+
const depth = source?.depthConfig;
|
|
14
|
+
const ownedSource = source && depth
|
|
15
|
+
? {
|
|
16
|
+
formatVersion: source.formatVersion,
|
|
17
|
+
mallId: source.mallId,
|
|
18
|
+
environment: source.environment,
|
|
19
|
+
sourceVersion: source.sourceVersion,
|
|
20
|
+
sourceRevision: source.sourceRevision,
|
|
21
|
+
preparationVersion: source.preparationVersion,
|
|
22
|
+
brandEnvironment: source.brandEnvironment,
|
|
23
|
+
...(source.validUntil === undefined ? {} : { validUntil: source.validUntil }),
|
|
24
|
+
...(source.shapePreparation
|
|
25
|
+
? {
|
|
26
|
+
shapePreparation: {
|
|
27
|
+
version: source.shapePreparation.version,
|
|
28
|
+
type: source.shapePreparation.type,
|
|
29
|
+
scale: source.shapePreparation.scale,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
: {}),
|
|
33
|
+
depthConfig: {
|
|
34
|
+
floorBaseDepth: depth.floorBaseDepth,
|
|
35
|
+
defaultUnitDepth: depth.defaultUnitDepth,
|
|
36
|
+
...(depth.depthMultiplier === undefined
|
|
37
|
+
? {}
|
|
38
|
+
: { depthMultiplier: depth.depthMultiplier }),
|
|
39
|
+
...(depth.customDepths ? { customDepths: { ...depth.customDepths } } : {}),
|
|
40
|
+
...(depth.modeDepths
|
|
41
|
+
? {
|
|
42
|
+
modeDepths: Object.fromEntries(Object.entries(depth.modeDepths).map(([key, value]) => [
|
|
43
|
+
key,
|
|
44
|
+
{
|
|
45
|
+
unitDepth: value.unitDepth,
|
|
46
|
+
extraDepthPlane: value.extraDepthPlane,
|
|
47
|
+
extraDepthSprite: value.extraDepthSprite,
|
|
48
|
+
},
|
|
49
|
+
])),
|
|
50
|
+
}
|
|
51
|
+
: {}),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
: undefined;
|
|
55
|
+
const endpoint = (value) => ({
|
|
56
|
+
key: value.key,
|
|
57
|
+
name: value.name,
|
|
58
|
+
floorIndex: value.floorIndex,
|
|
59
|
+
floorName: value.floorName,
|
|
60
|
+
});
|
|
61
|
+
const result = {
|
|
62
|
+
...(state.playback
|
|
63
|
+
? {
|
|
64
|
+
playback: {
|
|
65
|
+
status: state.playback.status,
|
|
66
|
+
mode: state.playback.mode,
|
|
67
|
+
speed: state.playback.speed,
|
|
68
|
+
...(state.playback.startDelayMs !== undefined
|
|
69
|
+
? { startDelayMs: state.playback.startDelayMs }
|
|
70
|
+
: {}),
|
|
71
|
+
...(state.playback.finishView !== undefined
|
|
72
|
+
? { finishView: state.playback.finishView }
|
|
73
|
+
: {}),
|
|
74
|
+
...(state.playback.finishDelayMs !== undefined
|
|
75
|
+
? { finishDelayMs: state.playback.finishDelayMs }
|
|
76
|
+
: {}),
|
|
77
|
+
...(state.playback.countdownSeconds !== undefined
|
|
78
|
+
? { countdownSeconds: state.playback.countdownSeconds }
|
|
79
|
+
: {}),
|
|
80
|
+
...(state.playback.transition
|
|
81
|
+
? {
|
|
82
|
+
transition: {
|
|
83
|
+
fromFloorIndex: state.playback.transition.fromFloorIndex,
|
|
84
|
+
toFloorIndex: state.playback.transition.toFloorIndex,
|
|
85
|
+
transport: state.playback.transition.transport,
|
|
86
|
+
direction: state.playback.transition.direction,
|
|
87
|
+
...(state.playback.transition.toFloorLabel === undefined
|
|
88
|
+
? {}
|
|
89
|
+
: { toFloorLabel: state.playback.transition.toFloorLabel }),
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
: {}),
|
|
93
|
+
...(state.playback.cameraFollow !== undefined
|
|
94
|
+
? { cameraFollow: state.playback.cameraFollow }
|
|
95
|
+
: {}),
|
|
96
|
+
...(state.playback.stepSync !== undefined ? { stepSync: state.playback.stepSync } : {}),
|
|
97
|
+
...(state.playback.unavailableReason
|
|
98
|
+
? { unavailableReason: state.playback.unavailableReason }
|
|
99
|
+
: {}),
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
: {}),
|
|
103
|
+
stage: state.stage,
|
|
104
|
+
config: {
|
|
105
|
+
routes: state.config.routes,
|
|
106
|
+
activation: state.config.activation,
|
|
107
|
+
pathAnimation: state.config.pathAnimation,
|
|
108
|
+
simulation: state.config.simulation,
|
|
109
|
+
steps: state.config.steps,
|
|
110
|
+
},
|
|
111
|
+
map: state.map ? { mallId: state.map.mallId, revision: state.map.revision } : null,
|
|
112
|
+
routeSet: state.routeSet
|
|
113
|
+
? {
|
|
114
|
+
routeSetId: state.routeSet.routeSetId,
|
|
115
|
+
recommendedRouteId: state.routeSet.recommendedRouteId,
|
|
116
|
+
policyRevision: state.routeSet.policyRevision,
|
|
117
|
+
source: ownedSource,
|
|
118
|
+
options: state.routeSet.options.map((option) => ({
|
|
119
|
+
...(option.fallbackUsed ? { fallbackUsed: option.fallbackUsed } : {}),
|
|
120
|
+
routeId: option.routeId,
|
|
121
|
+
origin: endpoint(option.origin),
|
|
122
|
+
destination: endpoint(option.destination),
|
|
123
|
+
floorIndices: [...option.floorIndices],
|
|
124
|
+
connectors: [...option.connectors],
|
|
125
|
+
distanceMeters: option.distanceMeters,
|
|
126
|
+
estimatedDurationSeconds: option.estimatedDurationSeconds,
|
|
127
|
+
})),
|
|
128
|
+
}
|
|
129
|
+
: null,
|
|
130
|
+
selectedRouteId: state.selectedRouteId,
|
|
131
|
+
activeRouteId: state.activeRouteId,
|
|
132
|
+
...(state.selectedStep && state.stage === 'guiding'
|
|
133
|
+
? {
|
|
134
|
+
selectedStep: {
|
|
135
|
+
stepIndex: state.selectedStep.stepIndex,
|
|
136
|
+
stepId: state.selectedStep.stepId,
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
: {}),
|
|
140
|
+
...(state.stage === 'failed'
|
|
141
|
+
? { error: { code: state.error.code, message: state.error.message } }
|
|
142
|
+
: {}),
|
|
143
|
+
};
|
|
144
|
+
return freeze(result);
|
|
145
|
+
}
|