@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,298 @@
|
|
|
1
|
+
import { ViewerCommandError } from '../events.js';
|
|
2
|
+
import { samePreparedMapIdentity } from '../preparedMapIdentity.js';
|
|
3
|
+
import { NavigationConfigValues } from './navigationConfig.js';
|
|
4
|
+
import { validateRouteGeometry, validateRouteSummary, validateRouteSteps, } from './routeResponseValidation.js';
|
|
5
|
+
const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
6
|
+
const finite = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
7
|
+
const integer = (v) => finite(v) && Number.isSafeInteger(v) && v >= 0;
|
|
8
|
+
const text = (v) => typeof v === 'string' && v.length > 0 && v.length <= 512;
|
|
9
|
+
const code = (v) => text(v) || finite(v);
|
|
10
|
+
const oneOf = (v, values) => typeof v === 'string' && values.includes(v);
|
|
11
|
+
function requireValid(v) {
|
|
12
|
+
if (!v)
|
|
13
|
+
throw new ViewerCommandError('Invalid saved route.', { code: 'OFFLINE_ROUTE_INVALID' });
|
|
14
|
+
}
|
|
15
|
+
function fields(v, required, optional = '') {
|
|
16
|
+
const r = required.split(' ').filter(Boolean), o = optional.split(' ').filter(Boolean);
|
|
17
|
+
requireValid(record(v) &&
|
|
18
|
+
r.every((k) => Object.hasOwn(v, k)) &&
|
|
19
|
+
Object.keys(v).every((k) => r.includes(k) || o.includes(k)));
|
|
20
|
+
}
|
|
21
|
+
function endpoint(v) {
|
|
22
|
+
requireValid(record(v));
|
|
23
|
+
if (v.kind === 'node') {
|
|
24
|
+
fields(v, 'kind key');
|
|
25
|
+
requireValid(text(v.key) && !v.key.includes('<->'));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (v.kind === 'amenity') {
|
|
29
|
+
fields(v, 'kind amenityId');
|
|
30
|
+
requireValid(code(v.amenityId));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
fields(v, 'kind request');
|
|
34
|
+
requireValid(v.kind === 'group');
|
|
35
|
+
const r = v.request;
|
|
36
|
+
fields(r, 'groupId', 'mallId activeFloorIndex query mode sortBy floorSecondarySortBy filter');
|
|
37
|
+
requireValid(text(r.groupId) &&
|
|
38
|
+
(r.mallId === undefined || text(r.mallId)) &&
|
|
39
|
+
(r.activeFloorIndex === undefined ||
|
|
40
|
+
(finite(r.activeFloorIndex) && Number.isSafeInteger(r.activeFloorIndex))) &&
|
|
41
|
+
(r.query === undefined || (typeof r.query === 'string' && r.query.length <= 512)) &&
|
|
42
|
+
(r.mode === undefined || oneOf(r.mode, ['catalog', 'search'])) &&
|
|
43
|
+
(r.sortBy === undefined ||
|
|
44
|
+
oneOf(r.sortBy, [
|
|
45
|
+
'default',
|
|
46
|
+
'relevance',
|
|
47
|
+
'asc',
|
|
48
|
+
'desc',
|
|
49
|
+
'floor_proximity',
|
|
50
|
+
'paid_promotion_asc',
|
|
51
|
+
'paid_promotion_desc',
|
|
52
|
+
'paid_promotion_weight',
|
|
53
|
+
'paid_promotion_floor',
|
|
54
|
+
])) &&
|
|
55
|
+
(r.floorSecondarySortBy === undefined ||
|
|
56
|
+
oneOf(r.floorSecondarySortBy, ['relevance', 'asc', 'desc'])));
|
|
57
|
+
if (r.filter !== undefined) {
|
|
58
|
+
fields(r.filter, '', 'categoryCode subCategoryCode amenityId offersOnly floorIndex');
|
|
59
|
+
const f = r.filter;
|
|
60
|
+
requireValid(['categoryCode', 'subCategoryCode', 'amenityId'].every((k) => f[k] === undefined || code(f[k])) &&
|
|
61
|
+
(f.offersOnly === undefined || typeof f.offersOnly === 'boolean') &&
|
|
62
|
+
(f.floorIndex === undefined ||
|
|
63
|
+
(finite(f.floorIndex) && Number.isSafeInteger(f.floorIndex))));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function source(v) {
|
|
67
|
+
fields(v, 'formatVersion mallId environment sourceVersion sourceRevision preparationVersion brandEnvironment depthConfig', 'validUntil shapePreparation');
|
|
68
|
+
requireValid(v.formatVersion === 1 &&
|
|
69
|
+
['mallId', 'environment', 'sourceRevision', 'preparationVersion'].every((k) => text(v[k])) &&
|
|
70
|
+
oneOf(v.sourceVersion, ['v1', 'v2']) &&
|
|
71
|
+
oneOf(v.brandEnvironment, ['sit', 'prod']) &&
|
|
72
|
+
(v.validUntil === undefined || integer(v.validUntil)));
|
|
73
|
+
fields(v.depthConfig, 'floorBaseDepth defaultUnitDepth', 'depthMultiplier customDepths modeDepths');
|
|
74
|
+
if (v.shapePreparation !== undefined) {
|
|
75
|
+
fields(v.shapePreparation, 'version type scale');
|
|
76
|
+
requireValid(v.shapePreparation.version === '1' &&
|
|
77
|
+
oneOf(v.shapePreparation.type, ['flat', 'extruded']) &&
|
|
78
|
+
finite(v.shapePreparation.scale) &&
|
|
79
|
+
v.shapePreparation.scale > 0);
|
|
80
|
+
}
|
|
81
|
+
const d = v.depthConfig;
|
|
82
|
+
requireValid(d.depthMultiplier === undefined || finite(d.depthMultiplier));
|
|
83
|
+
if (d.modeDepths !== undefined) {
|
|
84
|
+
requireValid(record(d.modeDepths));
|
|
85
|
+
for (const m of Object.values(d.modeDepths))
|
|
86
|
+
fields(m, 'unitDepth extraDepthPlane extraDepthSprite');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function range(v) {
|
|
90
|
+
fields(v, 'runIndex vertexStart vertexCount indexStart indexCount');
|
|
91
|
+
requireValid(Object.values(v).every(integer));
|
|
92
|
+
}
|
|
93
|
+
/** Strict saved JSON schema supplements the existing live artifact validators, once at ingress.
|
|
94
|
+
* Hinglish: Ready display data hi chale; unknown private fields reject hon, graph/path dobara na bane. */
|
|
95
|
+
export function validateSavedRouteDocument(value) {
|
|
96
|
+
fields(value, 'formatVersion savedRouteId issuedAt validUntil replayClass apiOrigin origin destination preferences config routeSet selectedRouteId alternativeStatus options', 'apiEndpoint');
|
|
97
|
+
requireValid(value.formatVersion === 1 &&
|
|
98
|
+
text(value.savedRouteId) &&
|
|
99
|
+
value.replayClass === 'static' &&
|
|
100
|
+
integer(value.issuedAt) &&
|
|
101
|
+
integer(value.validUntil) &&
|
|
102
|
+
value.validUntil > value.issuedAt &&
|
|
103
|
+
text(value.selectedRouteId) &&
|
|
104
|
+
text(value.apiOrigin) &&
|
|
105
|
+
(value.apiEndpoint === undefined || text(value.apiEndpoint)));
|
|
106
|
+
endpoint(value.origin);
|
|
107
|
+
endpoint(value.destination);
|
|
108
|
+
fields(value.preferences, '', 'allow preferredTransport fallback stepFree');
|
|
109
|
+
const p = value.preferences;
|
|
110
|
+
if (p.allow !== undefined) {
|
|
111
|
+
fields(p.allow, '', 'elevator escalator stairs');
|
|
112
|
+
requireValid(Object.values(p.allow).every((v) => typeof v === 'boolean'));
|
|
113
|
+
}
|
|
114
|
+
requireValid((p.preferredTransport === undefined ||
|
|
115
|
+
oneOf(p.preferredTransport, ['elevator', 'escalator', 'any'])) &&
|
|
116
|
+
(p.fallback === undefined || oneOf(p.fallback, ['alternate', 'none'])) &&
|
|
117
|
+
(p.stepFree === undefined || typeof p.stepFree === 'boolean'));
|
|
118
|
+
fields(value.config, 'routes activation pathAnimation simulation steps');
|
|
119
|
+
for (const [k, values] of Object.entries(NavigationConfigValues))
|
|
120
|
+
requireValid(values.includes(value.config[k]));
|
|
121
|
+
fields(value.routeSet, 'routeSetId recommendedRouteId policyRevision source options');
|
|
122
|
+
const set = value.routeSet;
|
|
123
|
+
requireValid(text(set.policyRevision));
|
|
124
|
+
source(set.source);
|
|
125
|
+
for (const ref of [value.origin, value.destination]) {
|
|
126
|
+
if (ref.kind === 'group' && ref.request.mallId !== undefined)
|
|
127
|
+
requireValid(ref.request.mallId === set.source.mallId);
|
|
128
|
+
}
|
|
129
|
+
const summary = validateRouteSummary({
|
|
130
|
+
routeSet: set,
|
|
131
|
+
config: value.config,
|
|
132
|
+
expiresAt: value.validUntil,
|
|
133
|
+
});
|
|
134
|
+
requireValid(oneOf(value.alternativeStatus, ['disabled', 'found', 'unavailable', 'budget_exhausted']) &&
|
|
135
|
+
Array.isArray(value.options) &&
|
|
136
|
+
value.options.length === summary.routeSet.options.length &&
|
|
137
|
+
(value.alternativeStatus === 'found') === (value.options.length === 2) &&
|
|
138
|
+
new Set(summary.routeSet.options.map((o) => o.routeId)).size === value.options.length &&
|
|
139
|
+
summary.routeSet.options.some((o) => o.routeId === value.selectedRouteId) &&
|
|
140
|
+
summary.routeSet.options.some((o) => o.routeId === set.recommendedRouteId));
|
|
141
|
+
const metricFields = 'calibrationId distanceMeters walkingDurationSeconds estimatedDurationSeconds distanceText timeText';
|
|
142
|
+
for (const [i, option] of value.options.entries()) {
|
|
143
|
+
fields(option, 'routeId artifact');
|
|
144
|
+
requireValid(option.routeId === summary.routeSet.options[i].routeId);
|
|
145
|
+
const s = summary.routeSet.options[i];
|
|
146
|
+
requireValid((value.origin.kind !== 'node' || value.origin.key === s.origin.key) &&
|
|
147
|
+
(value.destination.kind !== 'node' || value.destination.key === s.destination.key));
|
|
148
|
+
fields(s, 'routeId origin destination floorIndices connectors distanceMeters estimatedDurationSeconds', 'fallbackUsed');
|
|
149
|
+
fields(s.origin, 'key name floorIndex floorName');
|
|
150
|
+
fields(s.destination, 'key name floorIndex floorName');
|
|
151
|
+
const a = option.artifact;
|
|
152
|
+
fields(a, 'formatVersion source space placement centerline runs markers stepsPrepared steps metrics playbackJourney playbackSteps');
|
|
153
|
+
source(a.source);
|
|
154
|
+
requireValid(samePreparedMapIdentity(a.source, summary.routeSet.source) &&
|
|
155
|
+
a.stepsPrepared === true &&
|
|
156
|
+
Array.isArray(a.steps) &&
|
|
157
|
+
a.steps.length > 0 &&
|
|
158
|
+
a.steps.length <= 10000);
|
|
159
|
+
fields(a.placement, 'scale elevation width height');
|
|
160
|
+
fields(a.metrics, metricFields);
|
|
161
|
+
requireValid(Object.entries(a.metrics).every(([k, v]) => k === 'calibrationId' || k.endsWith('Text')
|
|
162
|
+
? v === null || text(v)
|
|
163
|
+
: v === null || (finite(v) && v >= 0)));
|
|
164
|
+
requireValid(a.metrics.distanceMeters === s.distanceMeters &&
|
|
165
|
+
a.metrics.estimatedDurationSeconds === s.estimatedDurationSeconds);
|
|
166
|
+
fields(a.playbackJourney, 'version totalLength visits');
|
|
167
|
+
requireValid(Array.isArray(a.playbackJourney.visits));
|
|
168
|
+
for (const visit of a.playbackJourney.visits) {
|
|
169
|
+
fields(visit, 'runIndex offset length next');
|
|
170
|
+
if (visit.next !== null)
|
|
171
|
+
fields(visit.next, 'runIndex transport direction');
|
|
172
|
+
}
|
|
173
|
+
requireValid(Array.isArray(a.runs) &&
|
|
174
|
+
a.runs.length <= 10000 &&
|
|
175
|
+
Array.isArray(a.markers) &&
|
|
176
|
+
Array.isArray(a.playbackSteps));
|
|
177
|
+
for (const run of a.runs) {
|
|
178
|
+
fields(run, 'id floorIndex floorLabel fromPathIndex toPathIndex geometry edges', 'motion');
|
|
179
|
+
requireValid(Array.isArray(run.edges));
|
|
180
|
+
if (run.motion !== undefined)
|
|
181
|
+
fields(run.motion, 'cumulativeLengths');
|
|
182
|
+
if (run.geometry === null)
|
|
183
|
+
requireValid(run.edges.length === 0);
|
|
184
|
+
else {
|
|
185
|
+
requireValid(run.motion !== undefined);
|
|
186
|
+
fields(run.geometry, 'positions normals uvs indices groups edgePositions bounds');
|
|
187
|
+
requireValid(Array.isArray(run.geometry.groups) &&
|
|
188
|
+
Array.isArray(run.geometry.edgePositions) &&
|
|
189
|
+
run.geometry.edgePositions.every((v) => finite(v) && Number.isFinite(Math.fround(v))) &&
|
|
190
|
+
run.geometry.edgePositions.length % 6 === 0);
|
|
191
|
+
for (const group of run.geometry.groups) {
|
|
192
|
+
fields(group, 'start count materialIndex');
|
|
193
|
+
requireValid(Object.values(group).every(integer));
|
|
194
|
+
const capacity = Array.isArray(run.geometry.indices)
|
|
195
|
+
? run.geometry.indices.length
|
|
196
|
+
: Array.isArray(run.geometry.positions)
|
|
197
|
+
? run.geometry.positions.length / 3
|
|
198
|
+
: 0;
|
|
199
|
+
requireValid(Number(group.start) + Number(group.count) <= capacity);
|
|
200
|
+
}
|
|
201
|
+
if (run.geometry.bounds !== null) {
|
|
202
|
+
fields(run.geometry.bounds, 'min max');
|
|
203
|
+
for (const point of Object.values(run.geometry.bounds)) {
|
|
204
|
+
fields(point, 'x y z');
|
|
205
|
+
requireValid(Object.values(point).every(finite));
|
|
206
|
+
}
|
|
207
|
+
const bounds = run.geometry.bounds;
|
|
208
|
+
requireValid(['x', 'y', 'z'].every((k) => bounds.min[k] <= bounds.max[k]));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
for (const edge of run.edges) {
|
|
212
|
+
fields(edge, 'fromPathIndex toPathIndex vertexStart vertexCount indexStart indexCount');
|
|
213
|
+
requireValid(Object.values(edge).every(integer) &&
|
|
214
|
+
record(run.geometry) &&
|
|
215
|
+
Array.isArray(run.geometry.positions) &&
|
|
216
|
+
Array.isArray(run.geometry.indices) &&
|
|
217
|
+
Number(edge.vertexStart) + Number(edge.vertexCount) <=
|
|
218
|
+
run.geometry.positions.length / 3 &&
|
|
219
|
+
Number(edge.indexStart) + Number(edge.indexCount) <= run.geometry.indices.length);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
for (const marker of a.markers) {
|
|
223
|
+
fields(marker, 'id kind pathIndex runIndex floorIndex label transport direction');
|
|
224
|
+
requireValid(text(marker.label) &&
|
|
225
|
+
[null, 'elevator', 'escalator', 'stairs', 'connection'].includes(marker.transport) &&
|
|
226
|
+
[null, 'up', 'down'].includes(marker.direction));
|
|
227
|
+
}
|
|
228
|
+
for (const span of a.playbackSteps) {
|
|
229
|
+
fields(span, 'stepIndex stepId runIndex floorIndex fromDistance toDistance action geometryRanges');
|
|
230
|
+
requireValid(Array.isArray(span.geometryRanges));
|
|
231
|
+
span.geometryRanges.forEach(range);
|
|
232
|
+
}
|
|
233
|
+
const { steps, ...geometry } = a;
|
|
234
|
+
const validated = validateRouteGeometry({
|
|
235
|
+
routeSetId: set.routeSetId,
|
|
236
|
+
routeId: option.routeId,
|
|
237
|
+
expiresAt: value.validUntil,
|
|
238
|
+
artifact: { ...geometry, stepCount: steps.length },
|
|
239
|
+
}).artifact;
|
|
240
|
+
requireValid(JSON.stringify([...new Set(validated.runs.map((r) => r.floorIndex))]) ===
|
|
241
|
+
JSON.stringify(s.floorIndices));
|
|
242
|
+
for (const marker of validated.markers) {
|
|
243
|
+
const run = validated.runs[marker.runIndex];
|
|
244
|
+
requireValid(marker.floorIndex === run.floorIndex &&
|
|
245
|
+
marker.pathIndex >= run.fromPathIndex &&
|
|
246
|
+
marker.pathIndex <= run.toPathIndex);
|
|
247
|
+
}
|
|
248
|
+
const stepIds = new Set();
|
|
249
|
+
for (const [j, step] of steps.entries()) {
|
|
250
|
+
fields(step, 'id action icon instruction floorIndex runIndex anchorPathIndex fromPathIndex toPathIndex distanceMeters estimatedDurationSeconds distanceText timeText geometryRanges focusBounds', 'focusDirection');
|
|
251
|
+
// Manual replay must use private-backend prepared focus bounds, never reconstruct them locally.
|
|
252
|
+
// Hinglish: Saved step complete ho; missing focus data par client path dobara prepare na kare.
|
|
253
|
+
fields(step.focusBounds, 'min max');
|
|
254
|
+
validateRouteSteps({
|
|
255
|
+
routeSetId: set.routeSetId,
|
|
256
|
+
routeId: option.routeId,
|
|
257
|
+
expiresAt: value.validUntil,
|
|
258
|
+
items: [step],
|
|
259
|
+
total: steps.length,
|
|
260
|
+
offset: j,
|
|
261
|
+
limit: 1,
|
|
262
|
+
nextOffset: j + 1 < steps.length ? j + 1 : null,
|
|
263
|
+
});
|
|
264
|
+
const run = validated.runs[Number(step.runIndex)], span = validated.playbackSteps[j];
|
|
265
|
+
requireValid(text(step.id) &&
|
|
266
|
+
!stepIds.has(step.id) &&
|
|
267
|
+
run &&
|
|
268
|
+
step.floorIndex === run.floorIndex &&
|
|
269
|
+
integer(step.fromPathIndex) &&
|
|
270
|
+
integer(step.toPathIndex) &&
|
|
271
|
+
integer(step.anchorPathIndex) &&
|
|
272
|
+
step.toPathIndex < validated.centerline.length / 3 &&
|
|
273
|
+
step.fromPathIndex <= step.toPathIndex &&
|
|
274
|
+
(String(step.action).startsWith('take_') ||
|
|
275
|
+
(step.fromPathIndex >= run.fromPathIndex && step.toPathIndex <= run.toPathIndex)) &&
|
|
276
|
+
step.anchorPathIndex >= run.fromPathIndex &&
|
|
277
|
+
step.anchorPathIndex <= run.toPathIndex &&
|
|
278
|
+
step.anchorPathIndex >= step.fromPathIndex &&
|
|
279
|
+
step.anchorPathIndex <= step.toPathIndex &&
|
|
280
|
+
span.stepId === step.id &&
|
|
281
|
+
span.action === step.action &&
|
|
282
|
+
span.runIndex === step.runIndex &&
|
|
283
|
+
Array.isArray(step.geometryRanges));
|
|
284
|
+
stepIds.add(step.id);
|
|
285
|
+
requireValid(step.geometryRanges.length === span.geometryRanges.length);
|
|
286
|
+
for (const [rangeIndex, r] of step.geometryRanges.entries()) {
|
|
287
|
+
range(r);
|
|
288
|
+
const savedRange = span.geometryRanges[rangeIndex];
|
|
289
|
+
requireValid(['runIndex', 'vertexStart', 'vertexCount', 'indexStart', 'indexCount'].every((k) => r[k] === savedRange[k]));
|
|
290
|
+
const target = validated.runs[r.runIndex]?.geometry;
|
|
291
|
+
requireValid(target &&
|
|
292
|
+
Number(r.vertexStart) + Number(r.vertexCount) <= target.positions.length / 3 &&
|
|
293
|
+
Number(r.indexStart) + Number(r.indexCount) <= (target.indices?.length ?? 0));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return value;
|
|
298
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file nodeLine.ts
|
|
3
|
+
* @description Geometric path connection (edge) between two distinct NodePoints in the 3D map.
|
|
4
|
+
* Is file me 3D map ke do points ke beech ke connection (rasta ya edge) ka contract hai.
|
|
5
|
+
*/
|
|
6
|
+
import type { Point3D } from './geometry.js';
|
|
7
|
+
import type { NodePoint } from './nodePoint.js';
|
|
8
|
+
/**
|
|
9
|
+
* Geometric connection (edge) between two NodePoints for pathfinding and route drawing.
|
|
10
|
+
* Do NodePoints ke beech geometric line jo navigation aur raste banane ke kaam aati hai.
|
|
11
|
+
*/
|
|
12
|
+
export declare class NodeLine {
|
|
13
|
+
/**
|
|
14
|
+
* Unique connection key identifier (e.g. "node1-node2").
|
|
15
|
+
* Connection ki unique key ID.
|
|
16
|
+
*/
|
|
17
|
+
key: string;
|
|
18
|
+
/**
|
|
19
|
+
* Starting 3D coordinate vector.
|
|
20
|
+
* Shuruati point ka 3D position vector.
|
|
21
|
+
*/
|
|
22
|
+
a: Point3D;
|
|
23
|
+
/**
|
|
24
|
+
* Ending 3D coordinate vector.
|
|
25
|
+
* Antim point ka 3D position vector.
|
|
26
|
+
*/
|
|
27
|
+
b: Point3D;
|
|
28
|
+
/**
|
|
29
|
+
* Linear euclidean distance between point A and point B.
|
|
30
|
+
* Point A aur Point B ke beech ki doori.
|
|
31
|
+
*/
|
|
32
|
+
distance: number;
|
|
33
|
+
/**
|
|
34
|
+
* Optional direct object reference to the starting NodePoint for graph traversal.
|
|
35
|
+
* Shuruati NodePoint ka direct reference (fast traversal ke liye).
|
|
36
|
+
*/
|
|
37
|
+
pointA?: NodePoint;
|
|
38
|
+
/**
|
|
39
|
+
* Optional direct object reference to the destination NodePoint.
|
|
40
|
+
* Manzil ke NodePoint ka direct reference.
|
|
41
|
+
*/
|
|
42
|
+
pointB?: NodePoint;
|
|
43
|
+
constructor();
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=nodeLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeLine.d.ts","sourceRoot":"","sources":["../src/nodeLine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;;GAGG;AACH,qBAAa,QAAQ;IACnB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAK;IAEhB;;;OAGG;IACH,CAAC,EAAE,OAAO,CAAuB;IAEjC;;;OAGG;IACH,CAAC,EAAE,OAAO,CAAuB;IAEjC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAI;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;;CAKnB"}
|
package/dist/nodeLine.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file nodeLine.ts
|
|
3
|
+
* @description Geometric path connection (edge) between two distinct NodePoints in the 3D map.
|
|
4
|
+
* Is file me 3D map ke do points ke beech ke connection (rasta ya edge) ka contract hai.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Geometric connection (edge) between two NodePoints for pathfinding and route drawing.
|
|
8
|
+
* Do NodePoints ke beech geometric line jo navigation aur raste banane ke kaam aati hai.
|
|
9
|
+
*/
|
|
10
|
+
export class NodeLine {
|
|
11
|
+
/**
|
|
12
|
+
* Unique connection key identifier (e.g. "node1-node2").
|
|
13
|
+
* Connection ki unique key ID.
|
|
14
|
+
*/
|
|
15
|
+
key = '';
|
|
16
|
+
/**
|
|
17
|
+
* Starting 3D coordinate vector.
|
|
18
|
+
* Shuruati point ka 3D position vector.
|
|
19
|
+
*/
|
|
20
|
+
a = { x: 0, y: 0, z: 0 };
|
|
21
|
+
/**
|
|
22
|
+
* Ending 3D coordinate vector.
|
|
23
|
+
* Antim point ka 3D position vector.
|
|
24
|
+
*/
|
|
25
|
+
b = { x: 0, y: 0, z: 0 };
|
|
26
|
+
/**
|
|
27
|
+
* Linear euclidean distance between point A and point B.
|
|
28
|
+
* Point A aur Point B ke beech ki doori.
|
|
29
|
+
*/
|
|
30
|
+
distance = 0;
|
|
31
|
+
/**
|
|
32
|
+
* Optional direct object reference to the starting NodePoint for graph traversal.
|
|
33
|
+
* Shuruati NodePoint ka direct reference (fast traversal ke liye).
|
|
34
|
+
*/
|
|
35
|
+
pointA;
|
|
36
|
+
/**
|
|
37
|
+
* Optional direct object reference to the destination NodePoint.
|
|
38
|
+
* Manzil ke NodePoint ka direct reference.
|
|
39
|
+
*/
|
|
40
|
+
pointB;
|
|
41
|
+
constructor() {
|
|
42
|
+
// Defaults initialized above
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file nodePoint.ts
|
|
3
|
+
* @description Public business projection and minimal renderer presentation record.
|
|
4
|
+
* Hinglish: Public details/render placement yahan hain; canonical source NodePoint private API mein hai.
|
|
5
|
+
*/
|
|
6
|
+
import type { Point3D, shapeDetail } from './geometry.js';
|
|
7
|
+
import { type Assets, type ContactInfo, type NodePointOffer, type PaidPromotionKeywordWeights, type PublicOfferData, type WeeklyHours } from './metadata.js';
|
|
8
|
+
/**
|
|
9
|
+
* Neighbor connection descriptor used for graph navigation and pathfinding.
|
|
10
|
+
* Rasta dhundhne (pathfinding) ke liye padosi node point ki jankari.
|
|
11
|
+
*/
|
|
12
|
+
export interface colleague {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
key: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Public visual and text asset subset exposed to UI consumers.
|
|
20
|
+
* Excludes internal placement geometry (area, rotate, width, height, textSize) and 3D shape pointImages.
|
|
21
|
+
*
|
|
22
|
+
* Hinglish: Public consumers ko milne wale store assets; isme internal placement geometry ya 3D pointImages nahi hote.
|
|
23
|
+
*/
|
|
24
|
+
export interface PublicNodeAssets {
|
|
25
|
+
locationName: {
|
|
26
|
+
text: string;
|
|
27
|
+
} | null;
|
|
28
|
+
logo: string | null;
|
|
29
|
+
brandLogo: string | null;
|
|
30
|
+
brandImages: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Public business data contract exposed to UI consumers, stores, catalog pages, and events.
|
|
34
|
+
* Contains only consumer-facing store metadata without geometry, navigation graph, or class methods.
|
|
35
|
+
* Optional taxonomy, amenity, offer, and promotion fields are included only when present and non-empty
|
|
36
|
+
* (preserving numeric `0` IDs while omitting `undefined`, empty strings, and empty offer/promotion collections).
|
|
37
|
+
*
|
|
38
|
+
* Hinglish: Public consumers, stores, catalog pages aur events ke liye business details ka contract;
|
|
39
|
+
* isme internal geometry, graph connections ya class methods shamil nahi hote.
|
|
40
|
+
* Optional fields (`categoryCode`, `subCategoryCode`, `amenitiesId`, `offers`, `paidPromotion`) tabhi aati hain
|
|
41
|
+
* jab data available aur non-empty ho (`0` IDs preserve hoti hain).
|
|
42
|
+
*/
|
|
43
|
+
export interface PublicNodeData {
|
|
44
|
+
key: string;
|
|
45
|
+
type: string;
|
|
46
|
+
floorIndex: number;
|
|
47
|
+
floorName: string;
|
|
48
|
+
categoryCode?: string | number;
|
|
49
|
+
subCategoryCode?: string | number;
|
|
50
|
+
/** Resolved public taxonomy labels; no category memberships are attached to a node.
|
|
51
|
+
* Hinglish: Sirf category/subcategory ka naam milega; unke saare nodes yahan nahi aayenge. */
|
|
52
|
+
categoryName?: string;
|
|
53
|
+
subCategoryName?: string;
|
|
54
|
+
/** Existing source hours without their private relation ID.
|
|
55
|
+
* Hinglish: Dukan ka public weekly schedule hai; source weeklyHoursId private rahega. */
|
|
56
|
+
weeklyHours?: WeeklyHours;
|
|
57
|
+
amenitiesId?: string | number;
|
|
58
|
+
offers?: PublicOfferData[];
|
|
59
|
+
paidPromotion?: PaidPromotionKeywordWeights;
|
|
60
|
+
contactInfo: ContactInfo;
|
|
61
|
+
assets: PublicNodeAssets;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Deeply freezes a `PublicNodeData` projection in place so shared per-map public projections
|
|
65
|
+
* (reused across categories, subcategories, amenities, and `getPublicNodeByKey`) cannot be
|
|
66
|
+
* accidentally mutated by external consumers.
|
|
67
|
+
*
|
|
68
|
+
* Hinglish: `PublicNodeData` aur uske nested objects/arrays ko deeply freeze karta hai taaki
|
|
69
|
+
* shared public projections me koi external caller accidental mutation na kar sake.
|
|
70
|
+
*/
|
|
71
|
+
export declare function freezePublicNodeData(data: PublicNodeData): Readonly<PublicNodeData>;
|
|
72
|
+
/**
|
|
73
|
+
* Client presentation record; the canonical source NodePoint lives in the private API.
|
|
74
|
+
* Existing renderer-facing name is retained; private brand/graph/source fields are not hydrated.
|
|
75
|
+
* Hinglish: Client par sirf public details aur ready placement hain; raw node ka backup nahi hai.
|
|
76
|
+
*/
|
|
77
|
+
export declare class NodePoint {
|
|
78
|
+
key: string;
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
z: number;
|
|
82
|
+
type: string;
|
|
83
|
+
floorIndex: number;
|
|
84
|
+
floorName: string;
|
|
85
|
+
shapeDetail: shapeDetail;
|
|
86
|
+
contactInfo: ContactInfo;
|
|
87
|
+
assets: Assets;
|
|
88
|
+
offers: NodePointOffer[];
|
|
89
|
+
categoryCode?: string | number;
|
|
90
|
+
subCategoryCode?: string | number;
|
|
91
|
+
categoryName?: string;
|
|
92
|
+
subCategoryName?: string;
|
|
93
|
+
weeklyHours?: WeeklyHours;
|
|
94
|
+
amenitiesId?: string | number;
|
|
95
|
+
paidPromotion?: PaidPromotionKeywordWeights;
|
|
96
|
+
getXYZ(): Point3D;
|
|
97
|
+
/** Presentation compatibility helper; never hydrates raw polygons, brands or navigation adjacency.
|
|
98
|
+
* Hinglish: Sirf public/render fields hain; canonical NodePoint builder aur private graph server par hain. */
|
|
99
|
+
static from(source: NodePoint | Partial<NodePoint>): NodePoint;
|
|
100
|
+
toPublicDetails(): PublicNodeData;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Projects canonical public business details from a `NodePoint` instance or a plain canonical
|
|
104
|
+
* `Partial<NodePoint>` record without cloning geometry (`shapeDetail.shape`) or navigation graph (`colleague`).
|
|
105
|
+
* Single owner of public field mapping reused by `NodePoint.prototype.toPublicDetails()` and `toPublicNodeData()`.
|
|
106
|
+
*
|
|
107
|
+
* Hinglish: `NodePoint` instance ya plain canonical node record se bina geometry/graph clone kiye
|
|
108
|
+
* sirf public business fields ka fresh JSON-safe copy return karta hai.
|
|
109
|
+
*/
|
|
110
|
+
export declare function projectPublicNodeDetails(source: Partial<NodePoint>): PublicNodeData;
|
|
111
|
+
//# sourceMappingURL=nodePoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodePoint.d.ts","sourceRoot":"","sources":["../src/nodePoint.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACrC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACjC;kGAC8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;6FACyF;IACzF,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;IAC1B,aAAa,CAAC,EAAE,2BAA2B,CAAA;IAC3C,WAAW,EAAE,WAAW,CAAA;IACxB,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC,CAqBnF;AAED;;;;GAIG;AACH,qBAAa,SAAS;IACpB,GAAG,SAAK;IACR,CAAC,SAAI;IACL,CAAC,SAAI;IACL,CAAC,SAAI;IACL,IAAI,SAAK;IACT,UAAU,SAAI;IACd,SAAS,SAAK;IACd,WAAW,EAAE,WAAW,CAAuD;IAC/E,WAAW,EAAE,WAAW,CAAyE;IACjG,MAAM,EAAE,MAAM,CAMb;IACD,MAAM,EAAE,cAAc,EAAE,CAAK;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,aAAa,CAAC,EAAE,2BAA2B,CAAA;IAE3C,MAAM,IAAI,OAAO;IAIjB;kHAC8G;IAC9G,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS;IA2B9D,eAAe,IAAI,cAAc;CAGlC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,cAAc,CA6CnF"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file nodePoint.ts
|
|
3
|
+
* @description Public business projection and minimal renderer presentation record.
|
|
4
|
+
* Hinglish: Public details/render placement yahan hain; canonical source NodePoint private API mein hai.
|
|
5
|
+
*/
|
|
6
|
+
import { toPublicOfferData, toPublicPaidPromotion, toPublicWeeklyHours, } from './metadata.js';
|
|
7
|
+
/**
|
|
8
|
+
* Deeply freezes a `PublicNodeData` projection in place so shared per-map public projections
|
|
9
|
+
* (reused across categories, subcategories, amenities, and `getPublicNodeByKey`) cannot be
|
|
10
|
+
* accidentally mutated by external consumers.
|
|
11
|
+
*
|
|
12
|
+
* Hinglish: `PublicNodeData` aur uske nested objects/arrays ko deeply freeze karta hai taaki
|
|
13
|
+
* shared public projections me koi external caller accidental mutation na kar sake.
|
|
14
|
+
*/
|
|
15
|
+
export function freezePublicNodeData(data) {
|
|
16
|
+
Object.freeze(data.contactInfo);
|
|
17
|
+
if (data.assets.locationName) {
|
|
18
|
+
Object.freeze(data.assets.locationName);
|
|
19
|
+
}
|
|
20
|
+
Object.freeze(data.assets.brandImages);
|
|
21
|
+
Object.freeze(data.assets);
|
|
22
|
+
if (data.offers) {
|
|
23
|
+
for (const offer of data.offers) {
|
|
24
|
+
Object.freeze(offer);
|
|
25
|
+
}
|
|
26
|
+
Object.freeze(data.offers);
|
|
27
|
+
}
|
|
28
|
+
if (data.paidPromotion) {
|
|
29
|
+
Object.freeze(data.paidPromotion);
|
|
30
|
+
}
|
|
31
|
+
if (data.weeklyHours) {
|
|
32
|
+
for (const hours of Object.values(data.weeklyHours))
|
|
33
|
+
Object.freeze(hours);
|
|
34
|
+
Object.freeze(data.weeklyHours);
|
|
35
|
+
}
|
|
36
|
+
return Object.freeze(data);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Client presentation record; the canonical source NodePoint lives in the private API.
|
|
40
|
+
* Existing renderer-facing name is retained; private brand/graph/source fields are not hydrated.
|
|
41
|
+
* Hinglish: Client par sirf public details aur ready placement hain; raw node ka backup nahi hai.
|
|
42
|
+
*/
|
|
43
|
+
export class NodePoint {
|
|
44
|
+
key = '';
|
|
45
|
+
x = 0;
|
|
46
|
+
y = 0;
|
|
47
|
+
z = 0;
|
|
48
|
+
type = '';
|
|
49
|
+
floorIndex = 0;
|
|
50
|
+
floorName = '';
|
|
51
|
+
shapeDetail = { shape: [], depth: 0, floorBash: false, color: '' };
|
|
52
|
+
contactInfo = { description: '', phone_no: '', website: '', email: '', address: '' };
|
|
53
|
+
assets = {
|
|
54
|
+
locationName: null,
|
|
55
|
+
pointImages: null,
|
|
56
|
+
logo: null,
|
|
57
|
+
brandLogo: null,
|
|
58
|
+
brandImages: [],
|
|
59
|
+
};
|
|
60
|
+
offers = [];
|
|
61
|
+
categoryCode;
|
|
62
|
+
subCategoryCode;
|
|
63
|
+
amenitiesId;
|
|
64
|
+
paidPromotion;
|
|
65
|
+
getXYZ() {
|
|
66
|
+
return { x: this.x, y: this.y, z: this.z };
|
|
67
|
+
}
|
|
68
|
+
/** Presentation compatibility helper; never hydrates raw polygons, brands or navigation adjacency.
|
|
69
|
+
* Hinglish: Sirf public/render fields hain; canonical NodePoint builder aur private graph server par hain. */
|
|
70
|
+
static from(source) {
|
|
71
|
+
if (source instanceof NodePoint)
|
|
72
|
+
return source;
|
|
73
|
+
const node = new NodePoint();
|
|
74
|
+
Object.assign(node, projectPublicNodeDetails(source));
|
|
75
|
+
node.x = source.x ?? 0;
|
|
76
|
+
node.y = source.y ?? 0;
|
|
77
|
+
node.z = source.z ?? 0;
|
|
78
|
+
if (source.shapeDetail) {
|
|
79
|
+
const detail = source.shapeDetail;
|
|
80
|
+
node.shapeDetail = {
|
|
81
|
+
shape: [],
|
|
82
|
+
depth: detail.depth ?? 0,
|
|
83
|
+
floorBash: Boolean(detail.floorBash),
|
|
84
|
+
color: detail.color ?? '',
|
|
85
|
+
...(detail.category !== undefined ? { category: detail.category } : {}),
|
|
86
|
+
...(detail.shapeType !== undefined ? { shapeType: detail.shapeType } : {}),
|
|
87
|
+
...(detail.prepared !== undefined ? { prepared: detail.prepared } : {}),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
node.assets = {
|
|
91
|
+
...node.assets,
|
|
92
|
+
locationName: source.assets?.locationName ?? null,
|
|
93
|
+
pointImages: source.assets?.pointImages ?? null,
|
|
94
|
+
};
|
|
95
|
+
return node;
|
|
96
|
+
}
|
|
97
|
+
toPublicDetails() {
|
|
98
|
+
return projectPublicNodeDetails(this);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Projects canonical public business details from a `NodePoint` instance or a plain canonical
|
|
103
|
+
* `Partial<NodePoint>` record without cloning geometry (`shapeDetail.shape`) or navigation graph (`colleague`).
|
|
104
|
+
* Single owner of public field mapping reused by `NodePoint.prototype.toPublicDetails()` and `toPublicNodeData()`.
|
|
105
|
+
*
|
|
106
|
+
* Hinglish: `NodePoint` instance ya plain canonical node record se bina geometry/graph clone kiye
|
|
107
|
+
* sirf public business fields ka fresh JSON-safe copy return karta hai.
|
|
108
|
+
*/
|
|
109
|
+
export function projectPublicNodeDetails(source) {
|
|
110
|
+
const publicOffers = Array.isArray(source.offers) && source.offers.length > 0
|
|
111
|
+
? source.offers.map((offer) => toPublicOfferData(offer))
|
|
112
|
+
: undefined;
|
|
113
|
+
const publicPaidPromotion = toPublicPaidPromotion(source.paidPromotion);
|
|
114
|
+
const weeklyHours = toPublicWeeklyHours(source.weeklyHours);
|
|
115
|
+
return {
|
|
116
|
+
key: source.key ?? '',
|
|
117
|
+
type: source.type ?? '',
|
|
118
|
+
floorIndex: source.floorIndex ?? 0,
|
|
119
|
+
floorName: source.floorName ?? '',
|
|
120
|
+
...(source.categoryCode !== undefined && source.categoryCode !== ''
|
|
121
|
+
? { categoryCode: source.categoryCode }
|
|
122
|
+
: {}),
|
|
123
|
+
...(source.subCategoryCode !== undefined && source.subCategoryCode !== ''
|
|
124
|
+
? { subCategoryCode: source.subCategoryCode }
|
|
125
|
+
: {}),
|
|
126
|
+
...(typeof source.categoryName === 'string' && source.categoryName.trim() !== ''
|
|
127
|
+
? { categoryName: source.categoryName }
|
|
128
|
+
: {}),
|
|
129
|
+
...(typeof source.subCategoryName === 'string' && source.subCategoryName.trim() !== ''
|
|
130
|
+
? { subCategoryName: source.subCategoryName }
|
|
131
|
+
: {}),
|
|
132
|
+
...(weeklyHours ? { weeklyHours } : {}),
|
|
133
|
+
...(source.amenitiesId !== undefined && source.amenitiesId !== ''
|
|
134
|
+
? { amenitiesId: source.amenitiesId }
|
|
135
|
+
: {}),
|
|
136
|
+
...(publicOffers ? { offers: publicOffers } : {}),
|
|
137
|
+
...(publicPaidPromotion ? { paidPromotion: publicPaidPromotion } : {}),
|
|
138
|
+
contactInfo: {
|
|
139
|
+
description: source.contactInfo?.description ?? '',
|
|
140
|
+
phone_no: source.contactInfo?.phone_no ?? '',
|
|
141
|
+
website: source.contactInfo?.website ?? '',
|
|
142
|
+
email: source.contactInfo?.email ?? '',
|
|
143
|
+
address: source.contactInfo?.address ?? '',
|
|
144
|
+
},
|
|
145
|
+
assets: {
|
|
146
|
+
locationName: source.assets?.locationName ? { text: source.assets.locationName.text } : null,
|
|
147
|
+
logo: source.assets?.logo ?? null,
|
|
148
|
+
brandLogo: source.assets?.brandLogo ?? null,
|
|
149
|
+
brandImages: Array.isArray(source.assets?.brandImages) ? [...source.assets.brandImages] : [],
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|