@wovvmap/map-data 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/README.md +65 -2
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +16 -0
- package/dist/adapters/sdkApiAdapter.d.ts +20 -0
- package/dist/adapters/sdkApiAdapter.d.ts.map +1 -0
- package/dist/adapters/sdkApiAdapter.js +31 -0
- package/dist/adapters/types.d.ts +84 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +8 -0
- package/dist/cache/mallMapCache.types.d.ts +32 -0
- package/dist/cache/mallMapCache.types.d.ts.map +1 -0
- package/dist/cache/mallMapCache.types.js +1 -0
- package/dist/cache/memoryMallMapCache.d.ts +37 -0
- package/dist/cache/memoryMallMapCache.d.ts.map +1 -0
- package/dist/cache/memoryMallMapCache.js +44 -0
- package/dist/catalog/catalogIndexReadPort.d.ts +35 -0
- package/dist/catalog/catalogIndexReadPort.d.ts.map +1 -0
- package/dist/catalog/catalogIndexReadPort.js +1 -0
- package/dist/catalog/catalogReader.d.ts +496 -0
- package/dist/catalog/catalogReader.d.ts.map +1 -0
- package/dist/catalog/catalogReader.js +1799 -0
- package/dist/catalog/index.d.ts +9 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +6 -0
- package/dist/catalog/offerAvailability.d.ts +25 -0
- package/dist/catalog/offerAvailability.d.ts.map +1 -0
- package/dist/catalog/offerAvailability.js +107 -0
- package/dist/controllers/mallController.d.ts +69 -0
- package/dist/controllers/mallController.d.ts.map +1 -0
- package/dist/controllers/mallController.js +92 -0
- package/dist/controllers/mallController.types.d.ts +10 -0
- package/dist/controllers/mallController.types.d.ts.map +1 -0
- package/dist/controllers/mallController.types.js +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/indexer/nodeDataIndexer.types.d.ts +16 -0
- package/dist/indexer/nodeDataIndexer.types.d.ts.map +1 -0
- package/dist/indexer/nodeDataIndexer.types.js +1 -0
- package/dist/models/catalog.d.ts +2 -0
- package/dist/models/catalog.d.ts.map +1 -0
- package/dist/models/catalog.js +1 -0
- package/dist/models/floor.d.ts +16 -0
- package/dist/models/floor.d.ts.map +1 -0
- package/dist/models/floor.js +1 -0
- package/dist/models/mall.d.ts +29 -0
- package/dist/models/mall.d.ts.map +1 -0
- package/dist/models/mall.js +1 -0
- package/dist/parser/index.d.ts +3 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +1 -0
- package/dist/parser/mapParser.types.d.ts +34 -0
- package/dist/parser/mapParser.types.d.ts.map +1 -0
- package/dist/parser/mapParser.types.js +1 -0
- package/dist/parser/mapParserService.d.ts +8 -0
- package/dist/parser/mapParserService.d.ts.map +1 -0
- package/dist/parser/mapParserService.js +61 -0
- package/dist/prepared/index.d.ts +3 -0
- package/dist/prepared/index.d.ts.map +1 -0
- package/dist/prepared/index.js +2 -0
- package/dist/prepared/preparedGeometryValidation.d.ts +6 -0
- package/dist/prepared/preparedGeometryValidation.d.ts.map +1 -0
- package/dist/prepared/preparedGeometryValidation.js +76 -0
- package/dist/prepared/preparedMapFields.d.ts +36 -0
- package/dist/prepared/preparedMapFields.d.ts.map +1 -0
- package/dist/prepared/preparedMapFields.js +205 -0
- package/dist/prepared/preparedMapReader.d.ts +68 -0
- package/dist/prepared/preparedMapReader.d.ts.map +1 -0
- package/dist/prepared/preparedMapReader.js +231 -0
- package/dist/prepared/preparedMapValidation.d.ts +23 -0
- package/dist/prepared/preparedMapValidation.d.ts.map +1 -0
- package/dist/prepared/preparedMapValidation.js +216 -0
- package/dist/search/catalogEndpointLookup.d.ts +23 -0
- package/dist/search/catalogEndpointLookup.d.ts.map +1 -0
- package/dist/search/catalogEndpointLookup.js +56 -0
- package/dist/search/catalogSearchService.d.ts +182 -0
- package/dist/search/catalogSearchService.d.ts.map +1 -0
- package/dist/search/catalogSearchService.js +653 -0
- package/dist/search/searchProfiles.d.ts +240 -0
- package/dist/search/searchProfiles.d.ts.map +1 -0
- package/dist/search/searchProfiles.js +364 -0
- package/dist/services/mallService.d.ts +82 -0
- package/dist/services/mallService.d.ts.map +1 -0
- package/dist/services/mallService.js +230 -0
- package/dist/services/mallService.types.d.ts +51 -0
- package/dist/services/mallService.types.d.ts.map +1 -0
- package/dist/services/mallService.types.js +1 -0
- package/dist/transport/fetchHttpClient.d.ts +25 -0
- package/dist/transport/fetchHttpClient.d.ts.map +1 -0
- package/dist/transport/fetchHttpClient.js +170 -0
- package/dist/transport/httpClient.types.d.ts +26 -0
- package/dist/transport/httpClient.types.d.ts.map +1 -0
- package/dist/transport/httpClient.types.js +1 -0
- package/dist/transport/httpTransportError.d.ts +25 -0
- package/dist/transport/httpTransportError.d.ts.map +1 -0
- package/dist/transport/httpTransportError.js +16 -0
- package/package.json +33 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Public exports for the `@wovvmap/map-data` catalog reader module.
|
|
4
|
+
* `@wovvmap/map-data` ke catalog reader module ke public exports.
|
|
5
|
+
*/
|
|
6
|
+
export { CatalogReader, CatalogReadError, clonePublicAmenityData, clonePublicCategoryData, clonePublicSubCategoryData, createCatalogReader, DEFAULT_CATALOG_PAGE_LIMIT, MAX_CATALOG_PAGE_LIMIT, resolveRecommendedAmenityFloor, } from './catalogReader.js';
|
|
7
|
+
export type { CatalogReadErrorCode, CatalogReaderOptions, CommittedCatalogSource, PreparedCatalogCommitCandidate, PreparedTaxonomyRecord, PreparedTaxonomySummary, } from './catalogReader.js';
|
|
8
|
+
export type { CatalogIndexReadPort } from './catalogIndexReadPort.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/catalog/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Public exports for the `@wovvmap/map-data` catalog reader module.
|
|
4
|
+
* `@wovvmap/map-data` ke catalog reader module ke public exports.
|
|
5
|
+
*/
|
|
6
|
+
export { CatalogReader, CatalogReadError, clonePublicAmenityData, clonePublicCategoryData, clonePublicSubCategoryData, createCatalogReader, DEFAULT_CATALOG_PAGE_LIMIT, MAX_CATALOG_PAGE_LIMIT, resolveRecommendedAmenityFloor, } from './catalogReader.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PublicNodeData, type PublicOfferData } from '@wovvmap/contracts';
|
|
2
|
+
import type { CatalogIndexReadPort } from './catalogIndexReadPort.js';
|
|
3
|
+
/** Indexed offer-only clock state; transitions revisit due stores, never the whole NodePoint collection.
|
|
4
|
+
* Hinglish: Sirf offer-bearing indexed keys hain; date boundary par due stores update hon, full map scan nahi. */
|
|
5
|
+
export declare class OfferAvailability {
|
|
6
|
+
private readonly indexer;
|
|
7
|
+
private readonly now;
|
|
8
|
+
private readonly entries;
|
|
9
|
+
private readonly boundaries;
|
|
10
|
+
private readonly times;
|
|
11
|
+
private cursor;
|
|
12
|
+
private observedAt;
|
|
13
|
+
private readonly active;
|
|
14
|
+
private projections;
|
|
15
|
+
private keyCache;
|
|
16
|
+
constructor(indexer: CatalogIndexReadPort, now: () => number);
|
|
17
|
+
get nextChangeAt(): number | undefined;
|
|
18
|
+
refresh(): boolean;
|
|
19
|
+
has(key: string): boolean;
|
|
20
|
+
offers(key: string): readonly PublicOfferData[];
|
|
21
|
+
keys(candidates: readonly string[]): readonly string[];
|
|
22
|
+
publicNode(key: string): Readonly<PublicNodeData> | undefined;
|
|
23
|
+
private evaluate;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=offerAvailability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerAvailability.d.ts","sourceRoot":"","sources":["../../src/catalog/offerAvailability.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAKlE;kHACkH;AAClH,qBAAa,iBAAiB;IAU1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAVtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiC;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,MAAM,CAAI;IAClB,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;IACvE,OAAO,CAAC,WAAW,CAA8C;IACjE,OAAO,CAAC,QAAQ,CAAsD;gBAEnD,OAAO,EAAE,oBAAoB,EAC7B,GAAG,EAAE,MAAM,MAAM;IAyBpC,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAErC;IACD,OAAO,IAAI,OAAO;IAqBlB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAGzB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,eAAe,EAAE;IAG/C,IAAI,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAOtD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS;IAU7D,OAAO,CAAC,QAAQ;CAKjB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getOfferWindow, toPublicOfferData, } from '@wovvmap/contracts';
|
|
2
|
+
const empty = Object.freeze([]);
|
|
3
|
+
/** Indexed offer-only clock state; transitions revisit due stores, never the whole NodePoint collection.
|
|
4
|
+
* Hinglish: Sirf offer-bearing indexed keys hain; date boundary par due stores update hon, full map scan nahi. */
|
|
5
|
+
export class OfferAvailability {
|
|
6
|
+
indexer;
|
|
7
|
+
now;
|
|
8
|
+
entries = new Map();
|
|
9
|
+
boundaries = new Map();
|
|
10
|
+
times;
|
|
11
|
+
cursor = 0;
|
|
12
|
+
observedAt;
|
|
13
|
+
active = new Map();
|
|
14
|
+
projections = new Map();
|
|
15
|
+
keyCache = new WeakMap();
|
|
16
|
+
constructor(indexer, now) {
|
|
17
|
+
this.indexer = indexer;
|
|
18
|
+
this.now = now;
|
|
19
|
+
this.observedAt = now();
|
|
20
|
+
// Consume the existing sparse offer index; ordinary nodes/geometry are not visited.
|
|
21
|
+
// Hinglish: Ready offer-key index use ho; bina offers wale nodes ko dobara na padhein.
|
|
22
|
+
for (const key of indexer.getAllOfferNodeKeys()) {
|
|
23
|
+
const entries = [];
|
|
24
|
+
for (const source of indexer.getNodeByKey(key)?.offers ?? []) {
|
|
25
|
+
const window = getOfferWindow(source);
|
|
26
|
+
if (!window)
|
|
27
|
+
continue;
|
|
28
|
+
const offer = Object.freeze(toPublicOfferData(source));
|
|
29
|
+
entries.push({ offer, ...window });
|
|
30
|
+
for (const time of [window.from, Number.isFinite(window.to) ? window.to + 1 : Infinity]) {
|
|
31
|
+
if (!Number.isFinite(time))
|
|
32
|
+
continue;
|
|
33
|
+
let keys = this.boundaries.get(time);
|
|
34
|
+
if (!keys)
|
|
35
|
+
this.boundaries.set(time, (keys = new Set()));
|
|
36
|
+
keys.add(key);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
this.entries.set(key, entries);
|
|
40
|
+
this.evaluate(key, entries, this.observedAt);
|
|
41
|
+
}
|
|
42
|
+
this.times = [...this.boundaries.keys()].sort((a, b) => a - b);
|
|
43
|
+
while ((this.times[this.cursor] ?? Infinity) <= this.observedAt)
|
|
44
|
+
this.cursor++;
|
|
45
|
+
}
|
|
46
|
+
get nextChangeAt() {
|
|
47
|
+
return this.times[this.cursor];
|
|
48
|
+
}
|
|
49
|
+
refresh() {
|
|
50
|
+
const now = this.now();
|
|
51
|
+
if (now >= this.observedAt && now < (this.nextChangeAt ?? Infinity))
|
|
52
|
+
return false;
|
|
53
|
+
const due = new Set();
|
|
54
|
+
if (now < this.observedAt) {
|
|
55
|
+
// A device clock correction re-evaluates only offer entries and resets their boundary cursor.
|
|
56
|
+
// Hinglish: Device clock peeche jaye to bhi sirf offer index resolve ho; raw nodes nahi.
|
|
57
|
+
for (const key of this.entries.keys())
|
|
58
|
+
due.add(key);
|
|
59
|
+
this.cursor = 0;
|
|
60
|
+
}
|
|
61
|
+
while ((this.times[this.cursor] ?? Infinity) <= now) {
|
|
62
|
+
for (const key of this.boundaries.get(this.times[this.cursor]))
|
|
63
|
+
due.add(key);
|
|
64
|
+
this.cursor++;
|
|
65
|
+
}
|
|
66
|
+
this.observedAt = now;
|
|
67
|
+
if (!due.size)
|
|
68
|
+
return false;
|
|
69
|
+
for (const key of due)
|
|
70
|
+
this.evaluate(key, this.entries.get(key), now);
|
|
71
|
+
this.projections = new Map();
|
|
72
|
+
this.keyCache = new WeakMap();
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
has(key) {
|
|
76
|
+
return (this.active.get(key)?.length ?? 0) > 0;
|
|
77
|
+
}
|
|
78
|
+
offers(key) {
|
|
79
|
+
return this.active.get(key) ?? empty;
|
|
80
|
+
}
|
|
81
|
+
keys(candidates) {
|
|
82
|
+
const saved = this.keyCache.get(candidates);
|
|
83
|
+
if (saved)
|
|
84
|
+
return saved;
|
|
85
|
+
const keys = candidates.filter((key) => this.has(key));
|
|
86
|
+
this.keyCache.set(candidates, keys);
|
|
87
|
+
return keys;
|
|
88
|
+
}
|
|
89
|
+
publicNode(key) {
|
|
90
|
+
const source = this.indexer.getPublicNodeByKey(key);
|
|
91
|
+
if (!source || !source.offers?.length)
|
|
92
|
+
return source;
|
|
93
|
+
let node = this.projections.get(key);
|
|
94
|
+
if (!node) {
|
|
95
|
+
node = Object.freeze({ ...source, offers: this.offers(key) });
|
|
96
|
+
this.projections.set(key, node);
|
|
97
|
+
}
|
|
98
|
+
return node;
|
|
99
|
+
}
|
|
100
|
+
evaluate(key, entries, now) {
|
|
101
|
+
const offers = [];
|
|
102
|
+
for (const entry of entries)
|
|
103
|
+
if (now >= entry.from && now <= entry.to)
|
|
104
|
+
offers.push(entry.offer);
|
|
105
|
+
this.active.set(key, Object.freeze(offers));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { MallApiAdapter, MallApiRequestOptions } from '../adapters/types.js';
|
|
2
|
+
import type { MallApiVersion, MallListResponse, MallMapData } from '../models/mall.js';
|
|
3
|
+
import { MallService } from '../services/mallService.js';
|
|
4
|
+
import type { MallControllerInit } from './mallController.types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Public controller coordinating mall map data loading and active mall retrieval.
|
|
7
|
+
* Serves as the primary public entry point for applications (React, Angular, React Native).
|
|
8
|
+
* Automatically provides sensible defaults (baseUrl, endpoint, environment) that can be overridden.
|
|
9
|
+
*
|
|
10
|
+
* Hinglish: Mall map data fetch karne aur active malls get karne ka main public controller.
|
|
11
|
+
* Isme default baseUrl aur environment pre-configured hain. Caller inhe constructor ya function call me override kar sakta hai.
|
|
12
|
+
*/
|
|
13
|
+
export declare class MallController {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(init?: MallControllerInit);
|
|
16
|
+
/**
|
|
17
|
+
* Reference to the underlying MallService.
|
|
18
|
+
* Hinglish: Underlying MallService instance ka reference.
|
|
19
|
+
*/
|
|
20
|
+
get service(): MallService;
|
|
21
|
+
/**
|
|
22
|
+
* Currently active API version ('v1' | 'v2').
|
|
23
|
+
* Hinglish: Currently configured API version.
|
|
24
|
+
*/
|
|
25
|
+
get version(): MallApiVersion;
|
|
26
|
+
/**
|
|
27
|
+
* Currently configured base URL.
|
|
28
|
+
* Hinglish: Configured base URL (default: "http://localhost:5180").
|
|
29
|
+
*/
|
|
30
|
+
get baseUrl(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Currently configured backend environment.
|
|
33
|
+
* Hinglish: Configured environment (default: "prod").
|
|
34
|
+
*/
|
|
35
|
+
get environment(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Fetches the complete map data for the specified mall ID.
|
|
38
|
+
* Supports passing an AbortSignal or request options override.
|
|
39
|
+
*
|
|
40
|
+
* Hinglish: Mall ID ke mutabik complete map data load karta hai.
|
|
41
|
+
*/
|
|
42
|
+
getMallMapData(mallId: string, optionsOrSignal?: MallApiRequestOptions | AbortSignal): Promise<MallMapData>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches the list of active malls from Strapi.
|
|
45
|
+
* Supports passing an AbortSignal or request options override.
|
|
46
|
+
*
|
|
47
|
+
* Hinglish: Strapi se active malls ki list return karta hai.
|
|
48
|
+
*/
|
|
49
|
+
getActiveMalls(optionsOrSignal?: MallApiRequestOptions | AbortSignal): Promise<MallListResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Switches the active API version and adapter on the underlying service.
|
|
52
|
+
* Hinglish: Underlying service par API version aur adapter switch karta hai.
|
|
53
|
+
*/
|
|
54
|
+
setApiVersion(version: MallApiVersion, customAdapter?: MallApiAdapter): void;
|
|
55
|
+
/**
|
|
56
|
+
* Switches the active backend environment ('sit' | 'prod').
|
|
57
|
+
* Hinglish: Active backend environment switch karta hai ('sit' ya 'prod').
|
|
58
|
+
*/
|
|
59
|
+
setEnvironment(environment: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Invalidates cached data for a specific mall or clears all cached maps.
|
|
62
|
+
* Hinglish: Specific mall ka cache ya pura cache reset/clear karta hai.
|
|
63
|
+
*/
|
|
64
|
+
clearCache(mallId?: string): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
/** Create the same data controller for every SDK adapter.
|
|
67
|
+
* Hinglish: Har SDK ke liye controller factory ek hi owner me rahe. */
|
|
68
|
+
export declare function createMallController(init?: MallControllerInit): MallController;
|
|
69
|
+
//# sourceMappingURL=mallController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mallController.d.ts","sourceRoot":"","sources":["../../src/controllers/mallController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEhE;;;;;;;GAOG;AACH,qBAAa,cAAc;;gBAGb,IAAI,GAAE,kBAAuB;IAQzC;;;OAGG;IACH,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,cAAc,CAE5B;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;;;;OAKG;IACG,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,qBAAqB,GAAG,WAAW,GACpD,OAAO,CAAC,WAAW,CAAC;IAIvB;;;;;OAKG;IACG,cAAc,CAClB,eAAe,CAAC,EAAE,qBAAqB,GAAG,WAAW,GACpD,OAAO,CAAC,gBAAgB,CAAC;IAI5B;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,cAAc,GAAG,IAAI;IAI5E;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIzC;;;OAGG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD;AAED;uEACuE;AACvE,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,cAAc,CAE9E"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { MallService } from '../services/mallService.js';
|
|
2
|
+
/**
|
|
3
|
+
* Public controller coordinating mall map data loading and active mall retrieval.
|
|
4
|
+
* Serves as the primary public entry point for applications (React, Angular, React Native).
|
|
5
|
+
* Automatically provides sensible defaults (baseUrl, endpoint, environment) that can be overridden.
|
|
6
|
+
*
|
|
7
|
+
* Hinglish: Mall map data fetch karne aur active malls get karne ka main public controller.
|
|
8
|
+
* Isme default baseUrl aur environment pre-configured hain. Caller inhe constructor ya function call me override kar sakta hai.
|
|
9
|
+
*/
|
|
10
|
+
export class MallController {
|
|
11
|
+
#service;
|
|
12
|
+
constructor(init = {}) {
|
|
13
|
+
if (init instanceof MallService) {
|
|
14
|
+
this.#service = init;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
this.#service = new MallService(init);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reference to the underlying MallService.
|
|
22
|
+
* Hinglish: Underlying MallService instance ka reference.
|
|
23
|
+
*/
|
|
24
|
+
get service() {
|
|
25
|
+
return this.#service;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Currently active API version ('v1' | 'v2').
|
|
29
|
+
* Hinglish: Currently configured API version.
|
|
30
|
+
*/
|
|
31
|
+
get version() {
|
|
32
|
+
return this.#service.version;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Currently configured base URL.
|
|
36
|
+
* Hinglish: Configured base URL (default: "http://localhost:5180").
|
|
37
|
+
*/
|
|
38
|
+
get baseUrl() {
|
|
39
|
+
return this.#service.baseUrl;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Currently configured backend environment.
|
|
43
|
+
* Hinglish: Configured environment (default: "prod").
|
|
44
|
+
*/
|
|
45
|
+
get environment() {
|
|
46
|
+
return this.#service.environment;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Fetches the complete map data for the specified mall ID.
|
|
50
|
+
* Supports passing an AbortSignal or request options override.
|
|
51
|
+
*
|
|
52
|
+
* Hinglish: Mall ID ke mutabik complete map data load karta hai.
|
|
53
|
+
*/
|
|
54
|
+
async getMallMapData(mallId, optionsOrSignal) {
|
|
55
|
+
return this.#service.getMallMapData(mallId, optionsOrSignal);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Fetches the list of active malls from Strapi.
|
|
59
|
+
* Supports passing an AbortSignal or request options override.
|
|
60
|
+
*
|
|
61
|
+
* Hinglish: Strapi se active malls ki list return karta hai.
|
|
62
|
+
*/
|
|
63
|
+
async getActiveMalls(optionsOrSignal) {
|
|
64
|
+
return this.#service.getActiveMalls(optionsOrSignal);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Switches the active API version and adapter on the underlying service.
|
|
68
|
+
* Hinglish: Underlying service par API version aur adapter switch karta hai.
|
|
69
|
+
*/
|
|
70
|
+
setApiVersion(version, customAdapter) {
|
|
71
|
+
this.#service.setAdapter(version, customAdapter);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Switches the active backend environment ('sit' | 'prod').
|
|
75
|
+
* Hinglish: Active backend environment switch karta hai ('sit' ya 'prod').
|
|
76
|
+
*/
|
|
77
|
+
setEnvironment(environment) {
|
|
78
|
+
this.#service.setEnvironment(environment);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Invalidates cached data for a specific mall or clears all cached maps.
|
|
82
|
+
* Hinglish: Specific mall ka cache ya pura cache reset/clear karta hai.
|
|
83
|
+
*/
|
|
84
|
+
async clearCache(mallId) {
|
|
85
|
+
return this.#service.clearCache(mallId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Create the same data controller for every SDK adapter.
|
|
89
|
+
* Hinglish: Har SDK ke liye controller factory ek hi owner me rahe. */
|
|
90
|
+
export function createMallController(init) {
|
|
91
|
+
return new MallController(init);
|
|
92
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MallService } from '../services/mallService.js';
|
|
2
|
+
import type { MallServiceOptions } from '../services/mallService.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Initialization options for MallController.
|
|
5
|
+
* Can receive an existing MallService instance or configuration options to create one.
|
|
6
|
+
*
|
|
7
|
+
* Hinglish: MallController ko initialize karne ke options. Ya to direct MallService instance de sakte hain ya service options.
|
|
8
|
+
*/
|
|
9
|
+
export type MallControllerInit = MallService | MallServiceOptions;
|
|
10
|
+
//# sourceMappingURL=mallController.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mallController.types.d.ts","sourceRoot":"","sources":["../../src/controllers/mallController.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './search/searchProfiles.js';
|
|
2
|
+
export { CatalogSearchService, createCatalogSearchService } from './search/catalogSearchService.js';
|
|
3
|
+
export type { ViewerCatalogSearchServiceOptions, PreparedCatalogSearchCandidate, } from './search/catalogSearchService.js';
|
|
4
|
+
export { createCatalogEndpointLookup } from './search/catalogEndpointLookup.js';
|
|
5
|
+
export { MallController, createMallController } from './controllers/mallController.js';
|
|
6
|
+
export type { MallControllerInit } from './controllers/mallController.types.js';
|
|
7
|
+
export { MallService } from './services/mallService.js';
|
|
8
|
+
export type { MallServiceOptions } from './services/mallService.types.js';
|
|
9
|
+
export { ADAPTERS, DEFAULT_ADAPTER, DEFAULT_BASE_URL, DEFAULT_MALL_ENVIRONMENT, DEFAULT_V1_ENDPOINT, DEFAULT_V2_ENDPOINT, getAdapter, registerAdapter, SdkApiAdapter, } from './adapters/index.js';
|
|
10
|
+
export type { MallApiAdapter, MallApiRequestOptions, MallDataInfo, FloorImage, FloorCameraViewStore, FloorViewState, DeviceViewState, CameraState, ControlState, } from './adapters/index.js';
|
|
11
|
+
export { MemoryMallMapCache } from './cache/memoryMallMapCache.js';
|
|
12
|
+
export type { MallMapCache } from './cache/mallMapCache.types.js';
|
|
13
|
+
export { createFetchHttpClient, FetchHttpClient } from './transport/fetchHttpClient.js';
|
|
14
|
+
export { HttpTransportError } from './transport/httpTransportError.js';
|
|
15
|
+
export type { HttpClient, HttpRequestOptions } from './transport/httpClient.types.js';
|
|
16
|
+
export type { HttpTransportErrorCode, HttpTransportErrorDetails, } from './transport/httpTransportError.js';
|
|
17
|
+
export type { Amenity, Category, SubCategory } from './models/catalog.js';
|
|
18
|
+
export type { MallApiVersion, MallEnvironment, MallListResponse, MallMapData, MallMapLoaderData, MallMetadataResponse, } from './models/mall.js';
|
|
19
|
+
export type { PreparedMapReader as NodeDataIndexerService } from './prepared/index.js';
|
|
20
|
+
export { CatalogReader, CatalogReadError, clonePublicAmenityData, clonePublicCategoryData, clonePublicSubCategoryData, createCatalogReader, DEFAULT_CATALOG_PAGE_LIMIT, MAX_CATALOG_PAGE_LIMIT, resolveRecommendedAmenityFloor, } from './catalog/index.js';
|
|
21
|
+
export type { CatalogReadErrorCode, CatalogIndexReadPort, CatalogReaderOptions, CommittedCatalogSource, PreparedCatalogCommitCandidate, PreparedTaxonomyRecord, PreparedTaxonomySummary, } from './catalog/index.js';
|
|
22
|
+
export { createPreparedMapReader, PreparedMapReader, PreparedMapReadError } from './prepared/index.js';
|
|
23
|
+
export type { AmenityAvailabilityReadOptions, AmenityFloorAvailability, CatalogDiscoveryChannel, CatalogFilterInput, CatalogFloorSecondarySortMode, CatalogGroupMembersPage, CatalogGroupMembersRequest, CatalogGroupReadOptions, CatalogGroupStoreRow, CatalogItemForTarget, CatalogPage, CatalogPageForTarget, CatalogPaginationInput, CatalogReadPort, CatalogReadRequest, CatalogSearchPage, CatalogSearchQueryInput, CatalogSingleStoreRow, CatalogSortMode, CatalogStoreRow, CatalogTarget, CatalogTargetItemMap, DiscoveryChannelSnapshot, DiscoveryQueryParams, DiscoveryQueryStatus, PublicAmenityData, PublicCatalogOfferItem, PublicCategoryData, PublicNodeData, PublicNodeGroupData, PublicNodeGroupMemberSummary, PublicOfferData, PublicSubCategoryData, StructuredCommandErrorData, } from '@wovvmap/contracts';
|
|
24
|
+
export { defaultMapParserService, MapParserService } from './parser/index.js';
|
|
25
|
+
export type { MapParserOptions, ParsedMapResult } from './parser/index.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAChG,YAAY,EACV,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAG5E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnF,YAAY,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAGtE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAClF,YAAY,EACV,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAA;AAGvC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACtE,YAAY,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAA;AAGtB,YAAY,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAGnF,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AAIxB,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACnG,YAAY,EACV,8BAA8B,EAC9B,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Shared catalog/search composition / Hinglish: Viewer aur server ke liye ek portable owner.
|
|
2
|
+
export * from './search/searchProfiles.js';
|
|
3
|
+
export { CatalogSearchService, createCatalogSearchService } from './search/catalogSearchService.js';
|
|
4
|
+
export { createCatalogEndpointLookup } from './search/catalogEndpointLookup.js';
|
|
5
|
+
// Controllers
|
|
6
|
+
export { MallController, createMallController } from './controllers/mallController.js';
|
|
7
|
+
// Services
|
|
8
|
+
export { MallService } from './services/mallService.js';
|
|
9
|
+
// SDK API transport; proprietary source adapters are private.
|
|
10
|
+
export { ADAPTERS, DEFAULT_ADAPTER, DEFAULT_BASE_URL, DEFAULT_MALL_ENVIRONMENT, DEFAULT_V1_ENDPOINT, DEFAULT_V2_ENDPOINT, getAdapter, registerAdapter, SdkApiAdapter, } from './adapters/index.js';
|
|
11
|
+
// Cache
|
|
12
|
+
export { MemoryMallMapCache } from './cache/memoryMallMapCache.js';
|
|
13
|
+
// Transport
|
|
14
|
+
export { createFetchHttpClient, FetchHttpClient } from './transport/fetchHttpClient.js';
|
|
15
|
+
export { HttpTransportError } from './transport/httpTransportError.js';
|
|
16
|
+
// Catalog Reader (Phase 1D CatalogReadPort implementation)
|
|
17
|
+
export { CatalogReader, CatalogReadError, clonePublicAmenityData, clonePublicCategoryData, clonePublicSubCategoryData, createCatalogReader, DEFAULT_CATALOG_PAGE_LIMIT, MAX_CATALOG_PAGE_LIMIT, resolveRecommendedAmenityFloor, } from './catalog/index.js';
|
|
18
|
+
// Prepared data boundary shared by browser and WebView after private API preparation.
|
|
19
|
+
// Hinglish: Private API ka ready packet dono render hosts isi reader se use karte hain.
|
|
20
|
+
export { createPreparedMapReader, PreparedMapReader, PreparedMapReadError } from './prepared/index.js';
|
|
21
|
+
// Prepared packet reader facade (legacy service name retained for integration compatibility).
|
|
22
|
+
export { defaultMapParserService, MapParserService } from './parser/index.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Amenity, Category, SubCategory } from '../models/catalog.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serializable taxonomy and environment context for `NodeDataIndexerService`.
|
|
4
|
+
* Preserved across `getSnapshot()` and `hydrateSnapshot()` so parent-category relations,
|
|
5
|
+
* valid taxonomy codes, and active `brandEnvironment` survive cache/IPC round-trips without guessing.
|
|
6
|
+
*
|
|
7
|
+
* Hinglish: Indexer ka JSON-safe context (`brandEnvironment` aur normalized taxonomy definitions)
|
|
8
|
+
* jo snapshot export aur hydration me preserve rehta hai.
|
|
9
|
+
*/
|
|
10
|
+
export interface IndexerContextSnapshot {
|
|
11
|
+
brandEnvironment?: 'sit' | 'prod';
|
|
12
|
+
categories?: Record<string, Category> | null;
|
|
13
|
+
subCategories?: Record<string, SubCategory> | null;
|
|
14
|
+
amenities?: Record<string, Amenity> | null;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=nodeDataIndexer.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeDataIndexer.types.d.ts","sourceRoot":"","sources":["../../src/indexer/nodeDataIndexer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEvE;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAA;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI,CAAA;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/models/catalog.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PreparedDeviceView, PreparedFloor } from '@wovvmap/contracts';
|
|
2
|
+
/** Client floor/camera records use prepared world coordinates, independent of source DTO versions.
|
|
3
|
+
* Hinglish: V1/V2 raw type ke bajay dono SDK same ready floor/camera fields use karte hain. */
|
|
4
|
+
export type FloorImage = Omit<PreparedFloor, 'bounds' | 'viewState' | 'id' | 'index'> & {
|
|
5
|
+
id?: string;
|
|
6
|
+
index?: number;
|
|
7
|
+
};
|
|
8
|
+
export type FloorViewState = {
|
|
9
|
+
pc?: PreparedDeviceView;
|
|
10
|
+
mobile?: PreparedDeviceView;
|
|
11
|
+
};
|
|
12
|
+
export type FloorCameraViewStore = Record<number, FloorViewState>;
|
|
13
|
+
export type DeviceViewState = PreparedDeviceView;
|
|
14
|
+
export type CameraState = PreparedDeviceView['camera'];
|
|
15
|
+
export type ControlState = PreparedDeviceView['controls'];
|
|
16
|
+
//# sourceMappingURL=floor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floor.d.ts","sourceRoot":"","sources":["../../src/models/floor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAE3E;+FAC+F;AAC/F,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,GAAG;IACtF,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,CAAC,EAAE,kBAAkB,CAAC;IAAC,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAAA;AACrF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AACjE,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAA;AAChD,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AACtD,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MallSummary, PreparedMapData } from '@wovvmap/contracts';
|
|
2
|
+
export type { MallDataInfo } from '../adapters/types.js';
|
|
3
|
+
/** Public responses retain the existing list/document wrapper; data_json is a prepared packet.
|
|
4
|
+
* Hinglish: Wrapper same hai; original CMS payload public SDK mein nahi aata. */
|
|
5
|
+
export type MallMapData = MallSummary & {
|
|
6
|
+
readonly data_json?: PreparedMapData;
|
|
7
|
+
};
|
|
8
|
+
export type MallListResponse = {
|
|
9
|
+
data: MallMapData[];
|
|
10
|
+
meta?: {
|
|
11
|
+
pagination?: {
|
|
12
|
+
page?: number;
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
pageCount?: number;
|
|
15
|
+
total?: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type MallApiVersion = 'v1' | 'v2';
|
|
20
|
+
export type MallEnvironment = 'sit' | 'prod';
|
|
21
|
+
export interface MallMapLoaderData {
|
|
22
|
+
apiVersion: MallApiVersion;
|
|
23
|
+
mapData: MallMapData | null;
|
|
24
|
+
}
|
|
25
|
+
export type MallMetadataResponse = {
|
|
26
|
+
data: MallSummary[];
|
|
27
|
+
meta?: MallListResponse['meta'];
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=mall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mall.d.ts","sourceRoot":"","sources":["../../src/models/mall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD;iFACiF;AACjF,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAA;CAAE,CAAA;AAChF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CACjG,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAA;AACxC,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAA;AAC5C,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,cAAc,CAAA;IAC1B,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;CAC5B;AACD,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC9E,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MapParserService, defaultMapParserService } from './mapParserService.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DynamicDepthConfig, NodeLine, NodePoint } from '@wovvmap/contracts';
|
|
2
|
+
import type { FloorCameraViewStore, FloorImage } from '../adapters/index.js';
|
|
3
|
+
import type { Amenity, Category, SubCategory } from '../models/catalog.js';
|
|
4
|
+
import type { PreparedMapReader } from '../prepared/preparedMapReader.js';
|
|
5
|
+
/** Client render/catalog result from validated prepared data, with no private parser/indexer state.
|
|
6
|
+
* Hinglish: Ready buffers aur public indexes hain; raw source/graph processing server par hai. */
|
|
7
|
+
export interface ParsedMapResult {
|
|
8
|
+
version: string;
|
|
9
|
+
mallId: string;
|
|
10
|
+
mallName?: string;
|
|
11
|
+
nodes: NodePoint[];
|
|
12
|
+
lines: NodeLine[];
|
|
13
|
+
floors: FloorImage[];
|
|
14
|
+
indexer: PreparedMapReader;
|
|
15
|
+
categories?: Record<string, Category> | null;
|
|
16
|
+
subCategories?: Record<string, SubCategory> | null;
|
|
17
|
+
amenities?: Record<string, Amenity> | null;
|
|
18
|
+
viewState?: FloorCameraViewStore | null;
|
|
19
|
+
defaultFloor?: number;
|
|
20
|
+
defaultDist?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MapParserOptions {
|
|
23
|
+
/** Per-view local resource prefix; the canonical saved packet retains original public URLs.
|
|
24
|
+
* Hinglish: Sirf display URLs local hon; source/geometry ko copy ya mutate nahi karna. */
|
|
25
|
+
assetBaseUrl?: string;
|
|
26
|
+
assetSourceBaseUrl?: string | null;
|
|
27
|
+
depthConfig?: Partial<DynamicDepthConfig>;
|
|
28
|
+
brandEnvironment?: 'sit' | 'prod';
|
|
29
|
+
environment?: string;
|
|
30
|
+
mallId?: string;
|
|
31
|
+
sourceVersion?: 'v1' | 'v2';
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=mapParser.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapParser.types.d.ts","sourceRoot":"","sources":["../../src/parser/mapParser.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEtE;kGACkG;AAClG,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,OAAO,EAAE,iBAAiB,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAA;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI,CAAA;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC1C,SAAS,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAA;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AACD,MAAM,WAAW,gBAAgB;IAC/B;8FAC0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACzC,gBAAgB,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MapParserOptions, ParsedMapResult } from './mapParser.types.js';
|
|
2
|
+
/** Compatibility facade for reading prepared SDK API packets; raw source parsers live on the server.
|
|
3
|
+
* Hinglish: Naam existing integration ke liye wahi hai; V1/V2 parsing ya NodePoint building client par nahi hoti. */
|
|
4
|
+
export declare class MapParserService {
|
|
5
|
+
parse(data: unknown, options?: MapParserOptions): Promise<ParsedMapResult>;
|
|
6
|
+
}
|
|
7
|
+
export declare const defaultMapParserService: MapParserService;
|
|
8
|
+
//# sourceMappingURL=mapParserService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapParserService.d.ts","sourceRoot":"","sources":["../../src/parser/mapParserService.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAE1E;qHACqH;AACrH,qBAAa,gBAAgB;IACrB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CA8DjF;AACD,eAAO,MAAM,uBAAuB,kBAAyB,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DEFAULT_DYNAMIC_DEPTH_CONFIG, } from '@wovvmap/contracts';
|
|
2
|
+
import { createPreparedMapReader, PreparedMapReadError } from '../prepared/index.js';
|
|
3
|
+
/** Compatibility facade for reading prepared SDK API packets; raw source parsers live on the server.
|
|
4
|
+
* Hinglish: Naam existing integration ke liye wahi hai; V1/V2 parsing ya NodePoint building client par nahi hoti. */
|
|
5
|
+
export class MapParserService {
|
|
6
|
+
async parse(data, options) {
|
|
7
|
+
const wrapper = data && typeof data === 'object' ? data : undefined;
|
|
8
|
+
const packet = (wrapper?.data_json ?? data);
|
|
9
|
+
if (!packet ||
|
|
10
|
+
typeof packet !== 'object' ||
|
|
11
|
+
!packet.identity ||
|
|
12
|
+
typeof packet.identity !== 'object')
|
|
13
|
+
throw new PreparedMapReadError('INVALID_PREPARED_MAP');
|
|
14
|
+
const identity = packet.identity;
|
|
15
|
+
const depth = options?.depthConfig;
|
|
16
|
+
const expected = {
|
|
17
|
+
...identity,
|
|
18
|
+
mallId: options?.mallId ??
|
|
19
|
+
(typeof wrapper?.mall_id === 'string' ? wrapper.mall_id : identity.mallId),
|
|
20
|
+
environment: options?.environment ?? identity.environment,
|
|
21
|
+
sourceVersion: options?.sourceVersion ?? identity.sourceVersion,
|
|
22
|
+
brandEnvironment: options?.brandEnvironment ??
|
|
23
|
+
(options?.environment === 'sit' || options?.environment === 'prod'
|
|
24
|
+
? options.environment
|
|
25
|
+
: identity.brandEnvironment),
|
|
26
|
+
...(depth
|
|
27
|
+
? {
|
|
28
|
+
depthConfig: {
|
|
29
|
+
...depth,
|
|
30
|
+
floorBaseDepth: depth.floorBaseDepth ?? DEFAULT_DYNAMIC_DEPTH_CONFIG.floorBaseDepth,
|
|
31
|
+
defaultUnitDepth: depth.defaultUnitDepth ?? DEFAULT_DYNAMIC_DEPTH_CONFIG.defaultUnitDepth,
|
|
32
|
+
depthMultiplier: depth.depthMultiplier ?? DEFAULT_DYNAMIC_DEPTH_CONFIG.depthMultiplier,
|
|
33
|
+
modeDepths: depth.modeDepths ?? DEFAULT_DYNAMIC_DEPTH_CONFIG.modeDepths,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
: {}),
|
|
37
|
+
};
|
|
38
|
+
const reader = createPreparedMapReader(packet, expected, {
|
|
39
|
+
renderReady: true,
|
|
40
|
+
signal: options?.signal,
|
|
41
|
+
assetBaseUrl: options?.assetBaseUrl,
|
|
42
|
+
assetSourceBaseUrl: options?.assetSourceBaseUrl,
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
version: identity.sourceVersion,
|
|
46
|
+
mallId: identity.mallId,
|
|
47
|
+
...(typeof wrapper?.mall_name === 'string' ? { mallName: wrapper.mall_name } : {}),
|
|
48
|
+
nodes: reader.nodes,
|
|
49
|
+
lines: [],
|
|
50
|
+
floors: reader.preparedFloors.map((floor) => ({ ...floor })),
|
|
51
|
+
indexer: reader,
|
|
52
|
+
...reader.getContext(),
|
|
53
|
+
viewState: Object.fromEntries(reader.preparedFloors
|
|
54
|
+
.filter((floor) => floor.viewState !== null)
|
|
55
|
+
.map((floor) => [floor.index, floor.viewState])),
|
|
56
|
+
defaultFloor: reader.defaultFloor,
|
|
57
|
+
defaultDist: reader.defaultDist,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export const defaultMapParserService = new MapParserService();
|