@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
package/README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @wovvmap/map-data
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Framework-independent SDK API client, prepared-map reader and catalog read services. Version 1.1.1.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
React / React Native / Web SDK
|
|
7
|
+
-> MallController -> MallService -> SdkApiAdapter
|
|
8
|
+
-> YOUR SDK API
|
|
9
|
+
-> private source adapter -> parser/builder/indexer + CPU shape preparation
|
|
10
|
+
<- public summaries / PreparedMapData
|
|
11
|
+
-> shared reader/catalog -> renderer buffer upload
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The public package has no V1/V2 CMS adapter, canonical NodePoint builder/indexer or CPU polygon
|
|
15
|
+
extrusion implementation. These live in the private `apps/sdk-api` application. Source versions
|
|
16
|
+
still select `v1` or `v2` on the server; method/event names remain unchanged.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createMallController, defaultMapParserService } from '@wovvmap/map-data'
|
|
20
|
+
|
|
21
|
+
const controller = createMallController({
|
|
22
|
+
baseUrl: 'https://your-sdk-api.example',
|
|
23
|
+
version: 'v2',
|
|
24
|
+
environment: 'prod',
|
|
25
|
+
})
|
|
26
|
+
const malls = await controller.getActiveMalls()
|
|
27
|
+
const document = await controller.getMallMapData('your-mall-id')
|
|
28
|
+
const prepared = await defaultMapParserService.parse(document)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`baseUrl` is the SDK API origin, never the upstream CMS origin. Development defaults to
|
|
32
|
+
`http://localhost:5180`; deployed consumers must configure their own SDK API address. Native
|
|
33
|
+
emulators/devices need an address reachable from the device, not the browser host's loopback.
|
|
34
|
+
|
|
35
|
+
`MapParserService` keeps its integration name but now validates/reads prepared packets. It rejects
|
|
36
|
+
raw source input. Existing raw parser/adapter/indexer exports and custom source parser/indexer
|
|
37
|
+
injection are retired in this pre-publication migration. `loadMall` accepts the SDK API's prepared
|
|
38
|
+
packet or its familiar `data_json` wrapper. `fetchAndLoadMall` uses the same thin controller path.
|
|
39
|
+
|
|
40
|
+
`createPreparedMapReader(json, expectedIdentity, { renderReady: true, signal })` validates/freeze-owns
|
|
41
|
+
one decoded packet and hydrates lookup sets in the same node visit. The data-only intermediate
|
|
42
|
+
reader remains available without `renderReady`. Catalog/search use prepared memberships; they do
|
|
43
|
+
not repeat source normalization or classification. Renderer placement records contain no source
|
|
44
|
+
polygons, brand environment mapping or navigation adjacency. Public UI stores/events use
|
|
45
|
+
`PublicNodeData`, not those placement records.
|
|
46
|
+
|
|
47
|
+
The existing revision cache also separates environment/version/origin and preparation options.
|
|
48
|
+
Configured `mallDataEndpoint` and request-level `endpoint` select the SDK API path prefix. Request
|
|
49
|
+
overrides stay scoped to that call. The Web/React/Native viewer uses the resolved request version,
|
|
50
|
+
environment and preparation options for both fetching and packet validation. Undefined optional
|
|
51
|
+
depth inputs keep server defaults; explicit zero remains zero. Stalled HTTP error bodies retain the
|
|
52
|
+
same timeout/cancellation guarantees as successful response bodies.
|
|
53
|
+
A prepared packet with `validUntil` is regenerated after its next existing offer date transition,
|
|
54
|
+
even if source `updatedAt` has not changed. This is cache freshness, not licensing or offline access.
|
|
55
|
+
The shared preparation revision is `2`: older cached packets refresh once so existing clients receive
|
|
56
|
+
public weekly hours and category/subcategory names without manually clearing their cache. The JSON
|
|
57
|
+
format remains `1` and package versions remain `1.1.1`; missing optional store metadata stays valid.
|
|
58
|
+
|
|
59
|
+
Own SDK API URLs, public metadata, image/font URLs and delivered rendering buffers are inspectable.
|
|
60
|
+
Only code/configuration kept on the private server is protected from npm distribution. Durable
|
|
61
|
+
PWA/Native offline preparation, production gateway/CMS permissions and deployment are separate work.
|
|
62
|
+
|
|
63
|
+
Hinglish: Package wahi rahega, lekin raw parser, builder aur shape algorithm server par hain. SDK apni
|
|
64
|
+
API se ready data leta hai. Apni API Network mein dikhegi; CMS query/token aur original algorithm
|
|
65
|
+
client bundle mein nahi aane chahiye. Same public reader dono platforms use karte hain; extra store,
|
|
66
|
+
per-frame network, floor watcher ya repeated raw NodePoint loop nahi hai.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MallApiAdapter } from './types.js';
|
|
2
|
+
export { SdkApiAdapter } from './sdkApiAdapter.js';
|
|
3
|
+
export { DEFAULT_BASE_URL, DEFAULT_MALL_ENVIRONMENT, DEFAULT_V1_ENDPOINT, DEFAULT_V2_ENDPOINT, } from './types.js';
|
|
4
|
+
export type { MallApiAdapter, MallApiRequestOptions, MallDataInfo } from './types.js';
|
|
5
|
+
export type { FloorImage, FloorViewState, FloorCameraViewStore, DeviceViewState, CameraState, ControlState, } from '../models/floor.js';
|
|
6
|
+
/** Source versions select server preparation, not client-side CMS adapters.
|
|
7
|
+
* Hinglish: V1/V2 request server tak jaati hai; public package mein source query code nahi hai. */
|
|
8
|
+
export declare const ADAPTERS: Record<string, MallApiAdapter>;
|
|
9
|
+
export declare const DEFAULT_ADAPTER = "v1";
|
|
10
|
+
export declare function getAdapter(version?: string): MallApiAdapter;
|
|
11
|
+
export declare function registerAdapter(adapter: MallApiAdapter): void;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,SAAS,CAAA;AAChB,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClF,YAAY,EACV,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,iBAAiB,CAAA;AAExB;mGACmG;AACnG,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAGnD,CAAA;AACD,eAAO,MAAM,eAAe,OAAO,CAAA;AACnC,wBAAgB,UAAU,CAAC,OAAO,SAAkB,GAAG,cAAc,CAEpE;AACD,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAE7D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SdkApiAdapter } from './sdkApiAdapter.js';
|
|
2
|
+
export { SdkApiAdapter } from './sdkApiAdapter.js';
|
|
3
|
+
export { DEFAULT_BASE_URL, DEFAULT_MALL_ENVIRONMENT, DEFAULT_V1_ENDPOINT, DEFAULT_V2_ENDPOINT, } from './types.js';
|
|
4
|
+
/** Source versions select server preparation, not client-side CMS adapters.
|
|
5
|
+
* Hinglish: V1/V2 request server tak jaati hai; public package mein source query code nahi hai. */
|
|
6
|
+
export const ADAPTERS = {
|
|
7
|
+
v1: new SdkApiAdapter('v1'),
|
|
8
|
+
v2: new SdkApiAdapter('v2'),
|
|
9
|
+
};
|
|
10
|
+
export const DEFAULT_ADAPTER = 'v1';
|
|
11
|
+
export function getAdapter(version = DEFAULT_ADAPTER) {
|
|
12
|
+
return ADAPTERS[version] ?? ADAPTERS.v1;
|
|
13
|
+
}
|
|
14
|
+
export function registerAdapter(adapter) {
|
|
15
|
+
ADAPTERS[adapter.version] = adapter;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MallApiAdapter, MallApiRequestOptions } from './types.js';
|
|
2
|
+
import type { HttpClient } from '../transport/httpClient.types.js';
|
|
3
|
+
import type { MallListResponse } from '../models/mall.js';
|
|
4
|
+
/** Thin SDK API adapter shared by browser, Native JS and WebView. No upstream CMS query mapping.
|
|
5
|
+
* Hinglish: SDK apni API se ready data leta hai; CMS URL aur parser client mein nahi hain. */
|
|
6
|
+
export declare class SdkApiAdapter implements MallApiAdapter {
|
|
7
|
+
readonly version: 'v1' | 'v2';
|
|
8
|
+
private readonly config;
|
|
9
|
+
readonly defaultEndpoint = "/api/sdk/v1";
|
|
10
|
+
constructor(version: 'v1' | 'v2', config?: {
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
environment?: string;
|
|
13
|
+
httpClient?: HttpClient;
|
|
14
|
+
});
|
|
15
|
+
fetchActiveMalls(options?: MallApiRequestOptions): Promise<MallListResponse>;
|
|
16
|
+
fetchMallMetadata(mallId: string, options?: MallApiRequestOptions): Promise<MallListResponse>;
|
|
17
|
+
fetchMallData(mallId: string, options?: MallApiRequestOptions): Promise<MallListResponse>;
|
|
18
|
+
private read;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=sdkApiAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdkApiAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/sdkApiAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD;8FAC8F;AAC9F,qBAAa,aAAc,YAAW,cAAc;IAGhD,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,QAAQ,CAAC,eAAe,iBAAgB;gBAE7B,OAAO,EAAE,IAAI,GAAG,IAAI,EACZ,MAAM,GAAE;QACvB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,UAAU,CAAC,EAAE,UAAU,CAAA;KACnB;IAGR,gBAAgB,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAG5E,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAG7F,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAGzF,OAAO,CAAC,IAAI;CAsBb"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DEFAULT_BASE_URL, DEFAULT_MALL_ENVIRONMENT } from './types.js';
|
|
2
|
+
import { FetchHttpClient } from '../transport/fetchHttpClient.js';
|
|
3
|
+
/** Thin SDK API adapter shared by browser, Native JS and WebView. No upstream CMS query mapping.
|
|
4
|
+
* Hinglish: SDK apni API se ready data leta hai; CMS URL aur parser client mein nahi hain. */
|
|
5
|
+
export class SdkApiAdapter {
|
|
6
|
+
version;
|
|
7
|
+
config;
|
|
8
|
+
defaultEndpoint = '/api/sdk/v1';
|
|
9
|
+
constructor(version, config = {}) {
|
|
10
|
+
this.version = version;
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
fetchActiveMalls(options) {
|
|
14
|
+
return this.read('/malls', options);
|
|
15
|
+
}
|
|
16
|
+
fetchMallMetadata(mallId, options) {
|
|
17
|
+
return this.read(`/maps/${encodeURIComponent(mallId)}/metadata`, options);
|
|
18
|
+
}
|
|
19
|
+
fetchMallData(mallId, options) {
|
|
20
|
+
return this.read(`/maps/${encodeURIComponent(mallId)}/prepared`, options, true);
|
|
21
|
+
}
|
|
22
|
+
read(path, options, prepared = false) {
|
|
23
|
+
const endpoint = (options?.endpoint ?? this.defaultEndpoint).replace(/\/+$/, '');
|
|
24
|
+
const url = new URL(`${endpoint}${path}`, options?.baseUrl ?? this.config.baseUrl ?? DEFAULT_BASE_URL);
|
|
25
|
+
url.searchParams.set('version', this.version);
|
|
26
|
+
url.searchParams.set('environment', options?.environment ?? this.config.environment ?? DEFAULT_MALL_ENVIRONMENT);
|
|
27
|
+
if (prepared && options?.preparation)
|
|
28
|
+
url.searchParams.set('preparation', JSON.stringify(options.preparation));
|
|
29
|
+
return (this.config.httpClient ?? new FetchHttpClient()).getJson(url.toString(), { signal: options?.signal });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { MapPreparationOptions } from '@wovvmap/contracts';
|
|
2
|
+
import type { MallListResponse, MallMetadataResponse } from '../models/mall.js';
|
|
3
|
+
/** Default backend API base URL / Default Strapi base URL */
|
|
4
|
+
export declare const DEFAULT_BASE_URL = "http://localhost:5180";
|
|
5
|
+
/** Default target environment / Default backend environment */
|
|
6
|
+
export declare const DEFAULT_MALL_ENVIRONMENT = "prod";
|
|
7
|
+
/** Default V1 mall data endpoint path / Default V1 endpoint */
|
|
8
|
+
export declare const DEFAULT_V1_ENDPOINT = "/api/sdk/v1";
|
|
9
|
+
/** Default V2 mall data endpoint path / Default V2 endpoint */
|
|
10
|
+
export declare const DEFAULT_V2_ENDPOINT = "/api/sdk/v1";
|
|
11
|
+
/**
|
|
12
|
+
* Basic mall metadata fields returned by Strapi and used for identification/cache freshness.
|
|
13
|
+
* Hinglish: Mall ki basic pehchan aur cache freshness check karne ke liye lightweight fields.
|
|
14
|
+
*/
|
|
15
|
+
export interface MallDataInfo {
|
|
16
|
+
/** Document identifier in Strapi v4/v5 */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Strapi document ID if available */
|
|
19
|
+
documentId?: string;
|
|
20
|
+
/** Human readable mall name / Mall ka naam */
|
|
21
|
+
mall_name: string;
|
|
22
|
+
/** Unique mall identifier / Mall ki unique ID */
|
|
23
|
+
mall_id: string;
|
|
24
|
+
/** Whether the mall map is active / Mall map active hai ya nahi */
|
|
25
|
+
is_active: boolean;
|
|
26
|
+
/** Last update timestamp for revision comparison / Cache freshness compare karne ke liye timestamp */
|
|
27
|
+
updatedAt?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Options for configuring individual requests to the SDK API.
|
|
31
|
+
* Any provided value overrides the adapter or service defaults.
|
|
32
|
+
*
|
|
33
|
+
* Hinglish: Request ke optional parameters. Jo pass karenge wo defaults ko override kar dega.
|
|
34
|
+
*/
|
|
35
|
+
export interface MallApiRequestOptions {
|
|
36
|
+
preparation?: MapPreparationOptions;
|
|
37
|
+
/** Request-scoped adapter version; does not mutate a shared controller.
|
|
38
|
+
* Hinglish: Sirf is request ka version hai; dusre consumers ka controller nahi badalta. */
|
|
39
|
+
version?: 'v1' | 'v2';
|
|
40
|
+
/** Overrides base URL for this request / Request-level base URL override */
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
/** Overrides endpoint path for this request / Request-level endpoint override */
|
|
43
|
+
endpoint?: string;
|
|
44
|
+
/** Overrides target environment ('sit' | 'prod' | 'select') / Request-level environment override */
|
|
45
|
+
environment?: string;
|
|
46
|
+
/** Cancellation signal / Request cancel karne ke liye AbortSignal */
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Adapter interface for interacting with Strapi mall endpoints.
|
|
51
|
+
* Implementations exist for Strapi V1 and Strapi V2.
|
|
52
|
+
* baseUrl, endpoint, and environment have built-in defaults and can be overridden via options.
|
|
53
|
+
*
|
|
54
|
+
* Hinglish: SDK API se baat karne ka contract. Default baseUrl aur endpoint pre-configured hote hain,
|
|
55
|
+
* isliye har call me baseUrl pass karne ki zarurat nahi hoti; options me pass karke override kiya ja sakta hai.
|
|
56
|
+
*/
|
|
57
|
+
export interface MallApiAdapter {
|
|
58
|
+
/**
|
|
59
|
+
* Unique identifier for the adapter version (e.g., "v1", "v2", "v3").
|
|
60
|
+
* Hinglish: Adapter ka version identifier (jaise 'v1', 'v2', 'v3').
|
|
61
|
+
*/
|
|
62
|
+
readonly version: string;
|
|
63
|
+
/**
|
|
64
|
+
* Default endpoint path associated with this adapter (e.g., "/api/mall-datas").
|
|
65
|
+
* Hinglish: Is adapter ke sath associated default endpoint path.
|
|
66
|
+
*/
|
|
67
|
+
readonly defaultEndpoint?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Fetches the list of active malls using default or overridden parameters.
|
|
70
|
+
* Hinglish: Active malls ki list fetch karta hai.
|
|
71
|
+
*/
|
|
72
|
+
fetchActiveMalls(options?: MallApiRequestOptions): Promise<MallListResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Fetches lightweight metadata for a specific mall (used for cache freshness comparison).
|
|
75
|
+
* Hinglish: Mall ka halka metadata fetch karta hai (updatedAt check karne ke liye).
|
|
76
|
+
*/
|
|
77
|
+
fetchMallMetadata(mallId: string, options?: MallApiRequestOptions): Promise<MallMetadataResponse | MallListResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Fetches the full data payload for a specific mall including data_json.
|
|
80
|
+
* Hinglish: Mall ka pura map data (data_json ke sath) fetch karta hai.
|
|
81
|
+
*/
|
|
82
|
+
fetchMallData(mallId: string, options?: MallApiRequestOptions): Promise<MallListResponse>;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE5E;;;OAGG;IACH,iBAAiB,CACf,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,GAAG,gBAAgB,CAAC,CAAA;IAEnD;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC1F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Default backend API base URL / Default Strapi base URL */
|
|
2
|
+
export const DEFAULT_BASE_URL = 'http://localhost:5180';
|
|
3
|
+
/** Default target environment / Default backend environment */
|
|
4
|
+
export const DEFAULT_MALL_ENVIRONMENT = 'prod';
|
|
5
|
+
/** Default V1 mall data endpoint path / Default V1 endpoint */
|
|
6
|
+
export const DEFAULT_V1_ENDPOINT = '/api/sdk/v1';
|
|
7
|
+
/** Default V2 mall data endpoint path / Default V2 endpoint */
|
|
8
|
+
export const DEFAULT_V2_ENDPOINT = '/api/sdk/v1';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MallMapData } from '../models/mall.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cache storage port for storing and retrieving loaded mall map data.
|
|
4
|
+
* Can be implemented by in-memory stores, localStorage, AsyncStorage, or custom caches.
|
|
5
|
+
*
|
|
6
|
+
* Hinglish: Mall map data ko store aur retrieve karne ka cache interface.
|
|
7
|
+
* Memory, browser localStorage, ya React Native AsyncStorage se implement ho sakta hai.
|
|
8
|
+
*/
|
|
9
|
+
export interface MallMapCache {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves cached mall map data by key.
|
|
12
|
+
* Returns null if missing or expired.
|
|
13
|
+
* Hinglish: Key ke dwara cached map data fetch karta hai; na milne par null return karta hai.
|
|
14
|
+
*/
|
|
15
|
+
get(key: string): MallMapData | null | Promise<MallMapData | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Saves mall map data into cache.
|
|
18
|
+
* Hinglish: Map data ko di gayi key ke saath cache me store karta hai.
|
|
19
|
+
*/
|
|
20
|
+
set(key: string, data: MallMapData): void | Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Deletes a specific cached entry by key.
|
|
23
|
+
* Hinglish: Particular key ka cached data delete karta hai.
|
|
24
|
+
*/
|
|
25
|
+
delete(key: string): void | Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Clears all cached mall map data.
|
|
28
|
+
* Hinglish: Saara cached map data clear kar deta hai.
|
|
29
|
+
*/
|
|
30
|
+
clear(): void | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=mallMapCache.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mallMapCache.types.d.ts","sourceRoot":"","sources":["../../src/cache/mallMapCache.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAElE;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzD;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzC;;;OAGG;IACH,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { MallMapData } from '../models/mall.js';
|
|
2
|
+
import type { MallMapCache } from './mallMapCache.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Standard in-memory cache implementation of MallMapCache.
|
|
5
|
+
* Keeps collections private and registers geometry reuse without traversing the raw node collection.
|
|
6
|
+
*
|
|
7
|
+
* Hinglish: Runtime Map private rehta hai; cache set par raw nodes ka extra pass nahi hota.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MemoryMallMapCache implements MallMapCache {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves data from memory map.
|
|
13
|
+
* Hinglish: Memory store se data return karta hai.
|
|
14
|
+
*/
|
|
15
|
+
get(key: string): MallMapData | null;
|
|
16
|
+
/**
|
|
17
|
+
* Saves a shallow cache envelope; geometry isolation is resolved lazily during node parsing.
|
|
18
|
+
* Hinglish: Shallow cache envelope save karo; geometry isolation existing node parse me resolve hogi.
|
|
19
|
+
*/
|
|
20
|
+
set(key: string, data: MallMapData): void;
|
|
21
|
+
/**
|
|
22
|
+
* Deletes one key from memory.
|
|
23
|
+
* Hinglish: Single key ko memory se delete karta hai.
|
|
24
|
+
*/
|
|
25
|
+
delete(key: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Clears all cached items.
|
|
28
|
+
* Hinglish: Saara cache reset/clear karta hai.
|
|
29
|
+
*/
|
|
30
|
+
clear(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Number of items currently in cache.
|
|
33
|
+
* Hinglish: Currently cached items ki sankhya.
|
|
34
|
+
*/
|
|
35
|
+
get size(): number;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=memoryMallMapCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryMallMapCache.d.ts","sourceRoot":"","sources":["../../src/cache/memoryMallMapCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,YAAY;;IAGrD;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAIpC;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI;IAIzC;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard in-memory cache implementation of MallMapCache.
|
|
3
|
+
* Keeps collections private and registers geometry reuse without traversing the raw node collection.
|
|
4
|
+
*
|
|
5
|
+
* Hinglish: Runtime Map private rehta hai; cache set par raw nodes ka extra pass nahi hota.
|
|
6
|
+
*/
|
|
7
|
+
export class MemoryMallMapCache {
|
|
8
|
+
#storage = new Map();
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves data from memory map.
|
|
11
|
+
* Hinglish: Memory store se data return karta hai.
|
|
12
|
+
*/
|
|
13
|
+
get(key) {
|
|
14
|
+
return this.#storage.get(key) ?? null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Saves a shallow cache envelope; geometry isolation is resolved lazily during node parsing.
|
|
18
|
+
* Hinglish: Shallow cache envelope save karo; geometry isolation existing node parse me resolve hogi.
|
|
19
|
+
*/
|
|
20
|
+
set(key, data) {
|
|
21
|
+
this.#storage.set(key, { ...data });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deletes one key from memory.
|
|
25
|
+
* Hinglish: Single key ko memory se delete karta hai.
|
|
26
|
+
*/
|
|
27
|
+
delete(key) {
|
|
28
|
+
this.#storage.delete(key);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Clears all cached items.
|
|
32
|
+
* Hinglish: Saara cache reset/clear karta hai.
|
|
33
|
+
*/
|
|
34
|
+
clear() {
|
|
35
|
+
this.#storage.clear();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Number of items currently in cache.
|
|
39
|
+
* Hinglish: Currently cached items ki sankhya.
|
|
40
|
+
*/
|
|
41
|
+
get size() {
|
|
42
|
+
return this.#storage.size;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PublicNodeData } from '@wovvmap/contracts';
|
|
2
|
+
import type { IndexerContextSnapshot } from '../indexer/nodeDataIndexer.types.js';
|
|
3
|
+
/** Only the reads used by CatalogReader; no raw NodePoint, parser or writable indexer lifecycle.
|
|
4
|
+
* Hinglish: Legacy indexer aur prepared reader wahi catalog chalate hain; raw node/reset access nahi chahiye. */
|
|
5
|
+
export interface CatalogIndexReadPort {
|
|
6
|
+
getContext(options?: {
|
|
7
|
+
includeMemberships?: boolean;
|
|
8
|
+
}): IndexerContextSnapshot;
|
|
9
|
+
getPublicNodeByKey(key: string): Readonly<PublicNodeData> | undefined;
|
|
10
|
+
/** Cheap metadata read keeps legacy offer/floor queries from eagerly creating public projections.
|
|
11
|
+
* Hinglish: Floor/offer count ke liye poora public projection banana zaroori nahi hai. */
|
|
12
|
+
getNodeByKey(key: string): Readonly<Pick<PublicNodeData, 'key' | 'floorIndex' | 'offers'>> | undefined;
|
|
13
|
+
getNodesByFloor(floorIndex: number): readonly {
|
|
14
|
+
readonly key: string;
|
|
15
|
+
}[];
|
|
16
|
+
getStoreNodeKeys(): readonly string[];
|
|
17
|
+
getNodeKeysByCategory(code: string | number): readonly string[];
|
|
18
|
+
getNodeKeysBySubCategory(code: string | number): readonly string[];
|
|
19
|
+
getSubCategoryCodesByCategory(code: string | number): readonly string[];
|
|
20
|
+
getNodeKeysByAmenity(id: string | number): readonly string[];
|
|
21
|
+
getAmenityFloors(id: string | number): readonly number[];
|
|
22
|
+
hasAmenityOnFloor(id: string | number, floorIndex: number): boolean;
|
|
23
|
+
getGroupNodeKeys(groupId: string): readonly string[];
|
|
24
|
+
getGroupIdByNodeKey(nodeKey: string): string | undefined;
|
|
25
|
+
getOfferNodeKeysByCategory(code: string | number): readonly string[];
|
|
26
|
+
getOfferNodeKeysBySubCategory(code: string | number): readonly string[];
|
|
27
|
+
getAllOfferNodeKeys(): readonly string[];
|
|
28
|
+
isIndexedStoreKey(nodeKey: string): boolean;
|
|
29
|
+
hasNodeInCategory(code: string | number, nodeKey: string): boolean;
|
|
30
|
+
hasNodeInSubCategory(code: string | number, nodeKey: string): boolean;
|
|
31
|
+
hasSubCategoryInCategory(code: string | number, subCode: string | number): boolean;
|
|
32
|
+
hasNodeInAmenity(id: string | number, nodeKey: string): boolean;
|
|
33
|
+
hasActiveOfferOnNode(nodeKey: string): boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=catalogIndexReadPort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogIndexReadPort.d.ts","sourceRoot":"","sources":["../../src/catalog/catalogIndexReadPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAE9E;iHACiH;AACjH,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,sBAAsB,CAAA;IAC9E,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IACrE;8FAC0F;IAC1F,YAAY,CACV,GAAG,EAAE,MAAM,GACV,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,G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