@nextgis/ngw-connector 3.0.0-alpha.13 → 3.0.0-alpha.14

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/lib/index.d.ts CHANGED
@@ -3,12 +3,8 @@ import Cache from '@nextgis/cache';
3
3
  import { EventEmitter } from 'events';
4
4
  import { FeatureProperties, DeepPartial } from '@nextgis/utils';
5
5
  import { LegendSymbol } from '@nextgisweb/render/type/api';
6
- import { ResourceCls as ResourceCls$1, ResourceRead, CompositeRead } from '@nextgisweb/resource/type/api';
6
+ import { ResourceRead, CompositeRead } from '@nextgisweb/resource/type/api';
7
7
  import { GeoJsonObject, Geometry } from 'geojson';
8
- import { BasemapWebMapItemRead, BasemapWebMapRead } from '@nextgisweb/basemap/type/api';
9
- import { FeatureLayerRead } from '@nextgisweb/feature-layer/type/api';
10
- import { VectorLayerRead } from '@nextgisweb/vector-layer/type/api';
11
- import { WebMapRead } from '@nextgisweb/webmap/type/api';
12
8
 
13
9
  declare class LunkwillParam {
14
10
  static VALUES: (string | null)[];
@@ -594,7 +590,7 @@ interface Permission {
594
590
  propagate: boolean;
595
591
  }
596
592
  /** @deprecated use ResourceCls from '@nextgisweb/resource/type/api' instead */
597
- type ResourceCls = ResourceCls$1;
593
+ type ResourceCls = 'resource_group' | 'postgis_layer' | 'wmsserver_service' | 'basemap_layer' | 'postgis_connection' | 'webmap' | 'wfsserver_service' | 'vector_layer' | 'raster_layer' | 'mapserver_style' | 'qgis_vector_style' | 'qgis_raster_style' | 'raster_style' | 'file_bucket' | 'lookup_table' | 'wmsclient_layer' | 'wmsclient_connection' | 'formbuilder_form' | 'file_bucket' | 'svg_marker_library' | 'ogcfserver_service' | 'tmsclient_connection' | 'tileset' | 'collector_project' | 'demo_project' | 'trackers_group' | 'tracker' | 'terrain_provider' | 'model_3d' | 'tmsclient_layer';
598
594
  interface ResourceHierarchy {
599
595
  id: number;
600
596
  parent: {
@@ -602,7 +598,23 @@ interface ResourceHierarchy {
602
598
  };
603
599
  }
604
600
  /** @deprecated use ResourceRead from '@nextgisweb/resource/type/api' instead */
605
- type Resource = ResourceRead;
601
+ interface Resource {
602
+ cls: ResourceCls;
603
+ id: number;
604
+ parent: {
605
+ id: number;
606
+ };
607
+ owner_user: {
608
+ id: number;
609
+ };
610
+ permissions: Permission[];
611
+ keyname?: string | null;
612
+ display_name: string;
613
+ description?: string | null;
614
+ children: boolean;
615
+ interfaces: any[];
616
+ scopes: string[];
617
+ }
606
618
  interface BookmarkProperties {
607
619
  name: string;
608
620
  place: string;
@@ -619,7 +631,16 @@ interface NgwTimeFormat {
619
631
  }
620
632
  type NgwDateTimeFormat = NgwDateFormat & NgwTimeFormat;
621
633
  /** @deprecated use WebMapRead from '@nextgisweb/resource/type/api' instead */
622
- type WebmapResource = WebMapRead;
634
+ interface WebmapResource {
635
+ extent_left: number;
636
+ extent_right: number;
637
+ extent_bottom: number;
638
+ extent_top: number;
639
+ extent_constrained: boolean;
640
+ draw_order_enabled: boolean;
641
+ bookmark_resource: ResourceHierarchy;
642
+ root_item: TreeGroup;
643
+ }
623
644
  interface BasemapResource {
624
645
  url: string;
625
646
  /**
@@ -628,9 +649,17 @@ interface BasemapResource {
628
649
  qms: string;
629
650
  }
630
651
  /** @deprecated use BasemapWebMapItemRead from '@nextgisweb/resource/type/api' instead */
631
- type BasemapWebmapItem = BasemapWebMapItemRead;
652
+ interface BasemapWebmapItem {
653
+ resource_id: number;
654
+ display_name: string;
655
+ position?: number;
656
+ enabled?: boolean;
657
+ opacity?: number;
658
+ }
632
659
  /** @deprecated use BasemapWebMapRead from '@nextgisweb/resource/type/api' instead */
633
- type BasemapWebmap = BasemapWebMapRead;
660
+ interface BasemapWebmap {
661
+ basemaps: BasemapWebmapItem[];
662
+ }
634
663
  interface LookupTableResource {
635
664
  items: Record<string, string>;
636
665
  }
@@ -647,10 +676,17 @@ interface FeatureLayerField {
647
676
  typemod?: unknown;
648
677
  }
649
678
  /** @deprecated use FeatureLayerRead from '@nextgisweb/resource/type/api' instead */
650
- type FeatureResource = FeatureLayerRead;
679
+ interface FeatureResource {
680
+ fields: FeatureLayerField[];
681
+ }
651
682
  type GeometryType = 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON' | 'POINTZ' | 'LINESTRINGZ' | 'POLYGONZ' | 'MULTIPOINTZ' | 'MULTILINESTRINGZ' | 'MULTIPOLYGONZ';
652
683
  /** @deprecated use VectorLayerRead from '@nextgisweb/resource/type/api' instead */
653
- type VectorLayer = VectorLayerRead;
684
+ interface VectorLayer {
685
+ srs: {
686
+ id: number;
687
+ };
688
+ geometry_type: GeometryType;
689
+ }
654
690
  interface FileBucket {
655
691
  files: NgwFile[];
656
692
  tstamp?: any;
@@ -723,8 +759,28 @@ interface NgwFile {
723
759
  interface Resmeta {
724
760
  items: Record<string, any>;
725
761
  }
762
+ interface ResourceItemMain {
763
+ resource: Resource;
764
+ resmeta: Resmeta;
765
+ }
726
766
  /** @deprecated use CompositeRead from '@nextgisweb/resource/type/api' instead */
727
- type ResourceItem = CompositeRead;
767
+ interface ResourceItem extends ResourceItemMain {
768
+ [cls: string]: any;
769
+ webmap?: WebmapResource;
770
+ feature_layer?: FeatureResource;
771
+ vector_layer?: VectorLayer;
772
+ basemap_layer?: BasemapResource;
773
+ basemap_webmap?: BasemapWebmap;
774
+ lookup_table?: LookupTableResource;
775
+ file_bucket?: FileBucket;
776
+ wmsserver_service?: WmsServerService;
777
+ wmsclient_layer?: WmsClientLayer;
778
+ wmsclient_connection?: WmsClientConnection;
779
+ }
780
+ interface VectorLayerResourceItem extends ResourceItemMain {
781
+ vector_layer: VectorLayer;
782
+ feature_layer: FeatureResource;
783
+ }
728
784
 
729
785
  type ResourceStoreItemProperties = {
730
786
  [name: string]: any;
@@ -1329,4 +1385,4 @@ interface LayerLegend {
1329
1385
  setSymbolRender?: (symbolIndex: number, status: boolean) => void;
1330
1386
  }
1331
1387
 
1332
- export { type ApiRouteParams, type BaseRequestOptions, type BasemapResource, type BasemapWebmap, type BasemapWebmapItem, type BookmarkProperties, type CreatedResource, type Credentials, type DeleteRequestItemsResponseMap, type DeleteRequestOptions, type FeatureItem, type FeatureItemAttachment, type FeatureItemExtensions, type FeatureItemToNgw, type FeatureLayerCount, type FeatureLayerField, type FeatureLayersIdentify, type FeatureLayersIdentifyItems, type FeatureResource, type FileBucket, type FileMeta, type FileUploadResp, type GeometryType, type GetChildrenOfOptions, type GetRequestItemsResponseMap, type GetRequestOptions, type GetRouteParam, type IdOnly, type KeysWithMethodAndPath, type KeysWithMethods, type KeysWithPaths, type LayerFeature, type LayerLegend, type LoadingQueue, type LookupTableResource, type LunkwillData, type Method, type MethodAvailable, type MethodRequestOptions, type NgwConnectorOptions, type NgwDateFormat, type NgwDateTimeFormat, type NgwExceptions, type NgwExtent, type NgwFile, type NgwLayerIdentifyError, type NgwTimeFormat, type Params, type PatchRequestItemsResponseMap, type PatchRequestOptions, type Permission, type PostRequestItemsResponseMap, type PostRequestOptions, type PutRequestItemsResponseMap, type PutRequestOptions, type PyramidRoute, type PyramidSettings, type PyramidSettingsPyramid, type PyramidSettingsPyramidCompanyLogo, type RequestHeaders, type RequestItemAdditionalParams, type RequestItemKeys, type RequestItemsParams, type RequestItemsParamsMap, type RequestItemsResponseMap, type RequestMethod, type RequestMethods, type RequestOptions, type RequestOptionsBody, type RequestOptionsByMethod, type RequestOptionsJSON, type RequestTransformFunction, type Resmeta, type Resource, type ResourceCls, type ResourceDefinition, type ResourceHierarchy, type ResourceIdKeynameDef, type ResourceItem, type ResourceItemDatatype, type ResourceStoreItem, type ResourceStoreItemDefault, type ResourceStoreItemProperties, type ResponseType, type RouteBody, type RouteMethods, type RouteName, type RouteParameters, type RouteQuery, type RouteRequestOptions, type RouteResp, type RouteResults, type Router, type SrsItem, type ToReturn, type TreeGroup, type TreeItem, type TreeLayer, type UserInfo, type VectorFieldDatatype, type VectorLayer, type WebmapResource, type WmsClientConnection, type WmsClientLayer, type WmsServerService, type WmsServerServiceLayer, NgwConnectorExtended as default };
1388
+ export { type ApiRouteParams, type BaseRequestOptions, type BasemapResource, type BasemapWebmap, type BasemapWebmapItem, type BookmarkProperties, type CreatedResource, type Credentials, type DeleteRequestItemsResponseMap, type DeleteRequestOptions, type FeatureItem, type FeatureItemAttachment, type FeatureItemExtensions, type FeatureItemToNgw, type FeatureLayerCount, type FeatureLayerField, type FeatureLayersIdentify, type FeatureLayersIdentifyItems, type FeatureResource, type FileBucket, type FileMeta, type FileUploadResp, type GeometryType, type GetChildrenOfOptions, type GetRequestItemsResponseMap, type GetRequestOptions, type GetRouteParam, type IdOnly, type KeysWithMethodAndPath, type KeysWithMethods, type KeysWithPaths, type LayerFeature, type LayerLegend, type LoadingQueue, type LookupTableResource, type LunkwillData, type Method, type MethodAvailable, type MethodRequestOptions, type NgwConnectorOptions, type NgwDateFormat, type NgwDateTimeFormat, type NgwExceptions, type NgwExtent, type NgwFile, type NgwLayerIdentifyError, type NgwTimeFormat, type Params, type PatchRequestItemsResponseMap, type PatchRequestOptions, type Permission, type PostRequestItemsResponseMap, type PostRequestOptions, type PutRequestItemsResponseMap, type PutRequestOptions, type PyramidRoute, type PyramidSettings, type PyramidSettingsPyramid, type PyramidSettingsPyramidCompanyLogo, type RequestHeaders, type RequestItemAdditionalParams, type RequestItemKeys, type RequestItemsParams, type RequestItemsParamsMap, type RequestItemsResponseMap, type RequestMethod, type RequestMethods, type RequestOptions, type RequestOptionsBody, type RequestOptionsByMethod, type RequestOptionsJSON, type RequestTransformFunction, type Resmeta, type Resource, type ResourceCls, type ResourceDefinition, type ResourceHierarchy, type ResourceIdKeynameDef, type ResourceItem, type ResourceItemDatatype, type ResourceItemMain, type ResourceStoreItem, type ResourceStoreItemDefault, type ResourceStoreItemProperties, type ResponseType, type RouteBody, type RouteMethods, type RouteName, type RouteParameters, type RouteQuery, type RouteRequestOptions, type RouteResp, type RouteResults, type Router, type SrsItem, type ToReturn, type TreeGroup, type TreeItem, type TreeLayer, type UserInfo, type VectorFieldDatatype, type VectorLayer, type VectorLayerResourceItem, type WebmapResource, type WmsClientConnection, type WmsClientLayer, type WmsServerService, type WmsServerServiceLayer, NgwConnectorExtended as default };
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-connector; version: 3.0.0-alpha.13; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-connector; version: 3.0.0-alpha.14; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  var utils = require('@nextgis/utils');
@@ -70,7 +70,7 @@ async function apiRequest(opt) {
70
70
 
71
71
  var pkg = {
72
72
  name: "@nextgis/ngw-connector",
73
- version: "3.0.0-alpha.13",
73
+ version: "3.0.0-alpha.14",
74
74
  _priority: 12,
75
75
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
76
76
  main: "index.js",
@@ -411,7 +411,7 @@ function generateUrl(path, query) {
411
411
  return path + urlParams;
412
412
  }
413
413
  async function request(path, options, cacheEngine) {
414
- var _a;
414
+ var _a, _b;
415
415
  const defaults = {
416
416
  method: "GET",
417
417
  credentials: "same-origin",
@@ -431,6 +431,7 @@ async function request(path, options, cacheEngine) {
431
431
  ...defaults,
432
432
  ...options
433
433
  };
434
+ opt.method = (_a = opt.method) == null ? void 0 : _a.toUpperCase();
434
435
  if (withCredentials) {
435
436
  opt.credentials = "include";
436
437
  }
@@ -488,17 +489,23 @@ async function request(path, options, cacheEngine) {
488
489
  }
489
490
  return body;
490
491
  };
491
- if (cacheEngine && cache !== false && ((_a = opt.method) == null ? void 0 : _a.toUpperCase()) === "GET") {
492
- const props = cacheProps ? cacheProps : {
493
- ...utils.objectRemoveEmpty({
494
- withCredentials,
495
- responseType
496
- })
497
- };
498
- return cacheEngine.add(cacheName || url, makeRequest, {
499
- props,
500
- expirationTime: cache ? void 0 : 500
501
- });
492
+ if (cacheEngine) {
493
+ if (((_b = opt.method) == null ? void 0 : _b.toUpperCase()) === "GET") {
494
+ if (cache !== false) {
495
+ const props = cacheProps ? cacheProps : {
496
+ ...utils.objectRemoveEmpty({
497
+ withCredentials,
498
+ responseType
499
+ })
500
+ };
501
+ return cacheEngine.add(cacheName || url, makeRequest, {
502
+ props,
503
+ expirationTime: cache ? void 0 : 500
504
+ });
505
+ }
506
+ } else {
507
+ cacheEngine.clean();
508
+ }
502
509
  }
503
510
  return makeRequest();
504
511
  }