mahal_map 1.7.2 → 1.7.3

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/index.d.mts CHANGED
@@ -202,6 +202,13 @@ interface ISearchResponse {
202
202
  number: string;
203
203
  } | [];
204
204
  }
205
+ interface ICheckJSApiParam {
206
+ token: string;
207
+ }
208
+ interface ICheckJSApiResponse {
209
+ success: boolean;
210
+ message: string;
211
+ }
205
212
 
206
213
  interface IResponse<T> {
207
214
  success: boolean;
@@ -244,6 +251,22 @@ declare class MahalMap {
244
251
  private static getVectorStyle;
245
252
  private static getMapToken;
246
253
  private static getMaps3DCtor;
254
+ /**
255
+ * Проверяет подписку JSApi перед созданием карты. Нужна только для legacy-движка
256
+ * (mtile.gram.tj): у engine: "3d" (GramMaps, navi.gram.tj) доступ контролирует сама
257
+ * платформа по ?key=, отдельная проверка там не применяется и пропускается.
258
+ *
259
+ * Fail-open: блокирует создание карты только при явном ответе сервиса success:false.
260
+ * Сетевая ошибка (сервис недоступен, CORS, таймаут) карту не роняет — иначе падение
261
+ * geocode.mahal.tj гасит карты у всех клиентов.
262
+ */
263
+ private static ensureJSApiSubscription;
264
+ /**
265
+ * Асинхронный аналог create(): для engine: "legacy" сначала дожидается проверки подписки
266
+ * JSApi и, если её нет, не создаёт карту вообще (MapLibre-инстанс не строится).
267
+ * Для engine: "3d" — тот же create() без проверки.
268
+ */
269
+ static createAsync(options: IMahalMapOptions, maplibreObject?: MapLibreApi, maps3dCtor?: Maps3DCtor): Promise<MahalMap>;
247
270
  static create(options: IMahalMapOptions, maplibreObject?: MapLibreApi, maps3dCtor?: Maps3DCtor): MahalMap;
248
271
  static onReady(container: string, callback: (map: Map) => void): void;
249
272
  static getInstance(container: string): MahalMap;
@@ -312,16 +335,20 @@ declare const getApiKey: () => string;
312
335
  declare function Router(param: number[][], typeData: string, token: string): Promise<IRoute[]>;
313
336
 
314
337
  declare function Search(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
338
+ declare function SearchPoi(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
315
339
  declare function SearchByLocation(params: ISearchByLocationParam): Promise<ISearchResponse>;
340
+ declare function CheckJSApi(token: string): Promise<ICheckJSApiResponse>;
316
341
 
342
+ declare const index$2_CheckJSApi: typeof CheckJSApi;
317
343
  declare const index$2_Router: typeof Router;
318
344
  declare const index$2_Search: typeof Search;
319
345
  declare const index$2_SearchByLocation: typeof SearchByLocation;
346
+ declare const index$2_SearchPoi: typeof SearchPoi;
320
347
  declare const index$2_clearKey: typeof clearKey;
321
348
  declare const index$2_getApiKey: typeof getApiKey;
322
349
  declare const index$2_saveKey: typeof saveKey;
323
350
  declare namespace index$2 {
324
- export { index$2_Router as Router, index$2_Search as Search, index$2_SearchByLocation as SearchByLocation, index$2_clearKey as clearKey, index$2_getApiKey as getApiKey, index$2_saveKey as saveKey };
351
+ export { index$2_CheckJSApi as CheckJSApi, index$2_Router as Router, index$2_Search as Search, index$2_SearchByLocation as SearchByLocation, index$2_SearchPoi as SearchPoi, index$2_clearKey as clearKey, index$2_getApiKey as getApiKey, index$2_saveKey as saveKey };
325
352
  }
326
353
 
327
354
  declare class MahalMapDefaultMarker {
@@ -566,4 +593,4 @@ declare namespace index {
566
593
  export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
567
594
  }
568
595
 
569
- export { type IAdditionalParamType, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DObjectsLightOptions, type IMaps3DTrafficOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type Maps3DCtor, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
596
+ export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DObjectsLightOptions, type IMaps3DTrafficOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type Maps3DCtor, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
package/dist/index.d.ts CHANGED
@@ -202,6 +202,13 @@ interface ISearchResponse {
202
202
  number: string;
203
203
  } | [];
204
204
  }
205
+ interface ICheckJSApiParam {
206
+ token: string;
207
+ }
208
+ interface ICheckJSApiResponse {
209
+ success: boolean;
210
+ message: string;
211
+ }
205
212
 
206
213
  interface IResponse<T> {
207
214
  success: boolean;
@@ -244,6 +251,22 @@ declare class MahalMap {
244
251
  private static getVectorStyle;
245
252
  private static getMapToken;
246
253
  private static getMaps3DCtor;
254
+ /**
255
+ * Проверяет подписку JSApi перед созданием карты. Нужна только для legacy-движка
256
+ * (mtile.gram.tj): у engine: "3d" (GramMaps, navi.gram.tj) доступ контролирует сама
257
+ * платформа по ?key=, отдельная проверка там не применяется и пропускается.
258
+ *
259
+ * Fail-open: блокирует создание карты только при явном ответе сервиса success:false.
260
+ * Сетевая ошибка (сервис недоступен, CORS, таймаут) карту не роняет — иначе падение
261
+ * geocode.mahal.tj гасит карты у всех клиентов.
262
+ */
263
+ private static ensureJSApiSubscription;
264
+ /**
265
+ * Асинхронный аналог create(): для engine: "legacy" сначала дожидается проверки подписки
266
+ * JSApi и, если её нет, не создаёт карту вообще (MapLibre-инстанс не строится).
267
+ * Для engine: "3d" — тот же create() без проверки.
268
+ */
269
+ static createAsync(options: IMahalMapOptions, maplibreObject?: MapLibreApi, maps3dCtor?: Maps3DCtor): Promise<MahalMap>;
247
270
  static create(options: IMahalMapOptions, maplibreObject?: MapLibreApi, maps3dCtor?: Maps3DCtor): MahalMap;
248
271
  static onReady(container: string, callback: (map: Map) => void): void;
249
272
  static getInstance(container: string): MahalMap;
@@ -312,16 +335,20 @@ declare const getApiKey: () => string;
312
335
  declare function Router(param: number[][], typeData: string, token: string): Promise<IRoute[]>;
313
336
 
314
337
  declare function Search(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
338
+ declare function SearchPoi(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
315
339
  declare function SearchByLocation(params: ISearchByLocationParam): Promise<ISearchResponse>;
340
+ declare function CheckJSApi(token: string): Promise<ICheckJSApiResponse>;
316
341
 
342
+ declare const index$2_CheckJSApi: typeof CheckJSApi;
317
343
  declare const index$2_Router: typeof Router;
318
344
  declare const index$2_Search: typeof Search;
319
345
  declare const index$2_SearchByLocation: typeof SearchByLocation;
346
+ declare const index$2_SearchPoi: typeof SearchPoi;
320
347
  declare const index$2_clearKey: typeof clearKey;
321
348
  declare const index$2_getApiKey: typeof getApiKey;
322
349
  declare const index$2_saveKey: typeof saveKey;
323
350
  declare namespace index$2 {
324
- export { index$2_Router as Router, index$2_Search as Search, index$2_SearchByLocation as SearchByLocation, index$2_clearKey as clearKey, index$2_getApiKey as getApiKey, index$2_saveKey as saveKey };
351
+ export { index$2_CheckJSApi as CheckJSApi, index$2_Router as Router, index$2_Search as Search, index$2_SearchByLocation as SearchByLocation, index$2_SearchPoi as SearchPoi, index$2_clearKey as clearKey, index$2_getApiKey as getApiKey, index$2_saveKey as saveKey };
325
352
  }
326
353
 
327
354
  declare class MahalMapDefaultMarker {
@@ -566,4 +593,4 @@ declare namespace index {
566
593
  export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
567
594
  }
568
595
 
569
- export { type IAdditionalParamType, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DObjectsLightOptions, type IMaps3DTrafficOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type Maps3DCtor, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
596
+ export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DObjectsLightOptions, type IMaps3DTrafficOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type Maps3DCtor, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };