@nextgis/ngw-connector 4.0.0-alpha.2 → 4.0.0-alpha.6

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 CHANGED
@@ -4,6 +4,15 @@
4
4
 
5
5
  A lightweight HTTP client optimized for use with [NextGIS Web](http://docs.nextgis.com/docs_ngweb_dev/doc/developer/toc.html) API.
6
6
 
7
+ > [!IMPORTANT]
8
+ > The typed `NgwConnector.route()` API requires declarations generated for your NextGIS Web deployment. Install `@nextgis/ngw-types-loader` and run it before using `route()`. The declarations depend on the components and extensions installed on that server.
9
+ >
10
+ > ```bash
11
+ > npx @nextgis/ngw-types-loader https://your-ngw-server.com
12
+ > ```
13
+ >
14
+ > See the [NGW Types Loader documentation](https://github.com/nextgis/nextgis_frontend/tree/master/packages/ngw-types-loader#readme) for detailed instructions.
15
+
7
16
  Make sure CORS is registered in the [NextGIS Web settings](https://docs.nextgis.com/docs_ngcom/source/CORS.html) to be able to send requests.
8
17
 
9
18
  ## Installation
@@ -48,34 +57,26 @@ npm install @nextgis/ngw-connector
48
57
 
49
58
  ## TypeScript Support
50
59
 
51
- If you plan to use this library in a TypeScript project, it's recommended to install TypeScript declaration files for NextGIS Web by using the `@nextgis/ngw-types-loader` tool.
52
-
53
- ### Installing NGW Types
54
-
55
- Run the following command to download the latest TypeScript declaration files:
60
+ `NgwConnector.route()` uses declarations generated by NextGIS Web itself. Install the loader as a development dependency:
56
61
 
57
62
  ```bash
58
- npx @nextgis/ngw-types-loader
63
+ npm install --save-dev @nextgis/ngw-types-loader
59
64
  ```
60
65
 
61
- This will download the declaration file from the default NextGIS Web instance (`https://demo.nextgis.com`) and update your `tsconfig.json` to include it.
62
-
63
- If you are using a custom NextGIS Web deployment, you can specify the URL:
66
+ Then generate types from the NextGIS Web deployment your application connects to:
64
67
 
65
68
  ```bash
66
- npx @nextgis/ngw-types-loader https://your-custom-ngw-url.com
69
+ npx @nextgis/ngw-types-loader https://your-ngw-server.com
67
70
  ```
68
71
 
69
- After running the tool, ensure that your `tsconfig.json` includes the downloaded file:
72
+ If the URL is omitted, the loader uses `https://demo.nextgis.com`:
70
73
 
71
- ```json
72
- {
73
- "include": [
74
- "./nextgisweb.d.ts"
75
- ]
76
- }
74
+ ```bash
75
+ npx @nextgis/ngw-types-loader
77
76
  ```
78
77
 
78
+ The declarations are installed as resolvable packages under `node_modules/@nextgisweb`; no `tsconfig.json` changes are required. Run the loader again after changing the NextGIS Web version, components, or extensions.
79
+
79
80
  For more details, refer to the [NGW Types Loader](https://www.npmjs.com/package/@nextgis/ngw-types-loader).
80
81
 
81
82
  ## Usage
package/lib/index.d.ts CHANGED
@@ -1,120 +1,12 @@
1
- import { Routes } from '@nextgisweb/pyramid/type/route';
2
- import { CompositeRead, ResourceRead } from '@nextgisweb/resource/type/api';
3
1
  import Cache from '@nextgis/cache';
4
2
  import { EventEmitter } from 'events';
5
3
  import { FeatureProperties, DeepPartial } from '@nextgis/utils';
6
4
  import { LegendSymbol } from '@nextgisweb/render/type/api';
7
- import { GeoJsonObject, Geometry } from 'geojson';
5
+ import { CompositeRead, SearchResponse, ResourceRead } from '@nextgisweb/resource/type/api';
6
+ import { Geometry, GeoJsonObject } from 'geojson';
7
+ import { Routes } from '@nextgisweb/pyramid/type/route';
8
8
  import { LegendSymbolsEnum } from '@nextgisweb/webmap/type/api';
9
9
 
10
- declare class LunkwillParam {
11
- static VALUES: (string | null)[];
12
- private value;
13
- constructor();
14
- update(value: string | null, cond?: boolean): void;
15
- suggest(cond?: boolean): void;
16
- require(cond?: boolean): void;
17
- toHeaders(headers: Record<string, string>): void;
18
- }
19
-
20
- type RouteParameters = {
21
- [K in keyof Routes]: Routes[K]['pathArr'] | [Routes[K]['pathObj']];
22
- };
23
- type RouteName = keyof Routes;
24
- type GetRouteParam<R extends RouteName> = (RouteParameters[R] & [
25
- object
26
- ])[0];
27
- type RequestMethod = keyof RouteMethods<RouteName>;
28
- type Method = RequestMethod | Uppercase<RequestMethod>;
29
- type CompositeFor<K extends keyof CompositeRead> = CompositeRead & Required<Pick<CompositeRead, K>>;
30
- type ResponseType = 'blob' | 'json';
31
- interface RouteRequestOptions<RT extends ResponseType = 'json', ReturnUrl extends boolean = false, Q = any, B = string | null | boolean | Record<string, any> | any[]> extends Omit<RequestInit, 'cache'> {
32
- headers?: Record<string, string>;
33
- cache?: boolean;
34
- query?: Q;
35
- json?: B;
36
- /** Has lower priority than the json */
37
- body?: string;
38
- /**
39
- * The type of data that the server will respond with.
40
- * Can be either 'json' or 'blob'.
41
- */
42
- responseType?: RT;
43
- /**
44
- * @deprecated use {@link RequestInit.credential}
45
- * Indicates whether to include credentials such as cookies, authentication headers,
46
- * or TLS client certificates in cross-site Access-Control requests.
47
- */
48
- withCredentials?: boolean;
49
- /**
50
- * Name to use for caching the request.
51
- */
52
- cacheName?: string;
53
- /**
54
- * Properties to override default cache behavior.
55
- */
56
- cacheProps?: Record<string, unknown>;
57
- lunkwill?: LunkwillParam;
58
- lunkwillReturnUrl?: ReturnUrl;
59
- }
60
- interface GetRequestOptions<Q = any, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> extends Omit<RouteRequestOptions<RT, ReturnUrl, Q>, 'json' | 'body'> {
61
- method?: 'GET';
62
- }
63
- interface RequestOptionsJSON<Q = any, B = string | null | boolean | Record<string, any> | any[], RT extends ResponseType = 'json', M extends Method = Method> extends Omit<RouteRequestOptions<RT, false, Q, B>, 'json' | 'body'> {
64
- json: B;
65
- method?: M;
66
- }
67
- interface RequestOptionsBody<Q = any, RT extends ResponseType = 'json', M extends Method = Method> extends Omit<RouteRequestOptions<RT, false, Q>, 'json' | 'body'> {
68
- body: string;
69
- method?: M;
70
- }
71
- type PutRequestOptions<Q = any, B = any, RT extends ResponseType = 'json'> = RequestOptionsJSON<Q, B, RT, 'PUT'> | RequestOptionsBody<Q, RT, 'PUT'>;
72
- type PostRequestOptions<Q = any, B = any, RT extends ResponseType = 'json'> = RequestOptionsJSON<Q, B, RT, 'POST'> | RequestOptionsBody<Q, RT, 'POST'>;
73
- type PatchRequestOptions<Q = any, B = any, RT extends ResponseType = 'json'> = RequestOptionsJSON<Q, B, RT, 'PATCH'> | RequestOptionsBody<Q, RT, 'PATCH'>;
74
- type DeleteRequestOptions<Q = any, RT extends ResponseType = 'json'> = RouteRequestOptions<RT, false, Q>;
75
- interface MethodRequestOptions<Q = any, B = any, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> {
76
- get: GetRequestOptions<Q, RT, ReturnUrl>;
77
- post: PostRequestOptions<Q, B, RT>;
78
- put: PutRequestOptions<Q, B, RT>;
79
- patch: PatchRequestOptions<Q, RT>;
80
- delete: DeleteRequestOptions<Q, RT>;
81
- }
82
- type RequestOptionsByMethod<M extends RequestMethod, Q = any, B = any, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> = M extends keyof MethodRequestOptions ? MethodRequestOptions<Q, B, RT, ReturnUrl>[M] : never;
83
- type ApiRouteParams = Record<string, string>;
84
- interface LunkwillData {
85
- status?: string;
86
- delay_ms?: number;
87
- }
88
- type RouteResp<N extends RouteName, M extends RequestMethod> = N extends keyof Routes ? M extends keyof Routes[N] ? 'response' extends keyof Routes[N][M] ? Routes[N][M]['response'] : never : never : never;
89
- type RouteQuery<N extends RouteName, M extends RequestMethod> = N extends keyof Routes ? M extends keyof Routes[N] ? 'query' extends keyof Routes[N][M] ? Routes[N][M]['query'] : any : never : never;
90
- type RouteBody<N extends RouteName, M extends RequestMethod> = N extends keyof Routes ? M extends keyof Routes[N] ? 'body' extends keyof Routes[N][M] ? Routes[N][M]['body'] : any : never : never;
91
- type ToReturn<T = unknown, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> = ReturnUrl extends true ? string : RT extends 'blob' ? Blob : T;
92
- type HasRequiredKeys<T> = {
93
- [P in keyof T]-?: object extends Pick<T, P> ? never : P;
94
- }[keyof T] extends never ? false : true;
95
- interface RouteMethods<N extends RouteName> {
96
- url: HasRequiredKeys<RouteQuery<N, 'get'>> extends true ? (options: Pick<RequestOptionsByMethod<'get', RouteQuery<N, 'get'>>, 'query'>) => Promise<string> : (options?: Pick<RequestOptionsByMethod<'get', RouteQuery<N, 'get'>>, 'query'>) => Promise<string>;
97
- get: HasRequiredKeys<RouteQuery<N, 'get'>> extends true ? <T = RouteResp<N, 'get'>, RT extends ResponseType = 'json', B extends boolean = false>(options: RequestOptionsByMethod<'get', RouteQuery<N, 'get'>, any, RT, B>) => Promise<ToReturn<T, RT, B>> : <T = RouteResp<N, 'get'>, B extends boolean = false, RT extends ResponseType = 'json'>(options?: RequestOptionsByMethod<'get', RouteQuery<N, 'get'>, any, RT, B>) => Promise<ToReturn<T, RT, B>>;
98
- post: <T = RouteResp<N, 'post'>, RT extends ResponseType = 'json'>(options: RequestOptionsByMethod<'post', RouteQuery<N, 'post'>, RouteBody<N, 'post'>, RT>) => Promise<ToReturn<T, RT>>;
99
- put: <T = RouteResp<N, 'put'>, RT extends ResponseType = 'json'>(options: RequestOptionsByMethod<'put', RouteQuery<N, 'put'>, RouteBody<N, 'put'>, RT>) => Promise<ToReturn<T, RT>>;
100
- patch: <T = RouteResp<N, 'patch'>, RT extends ResponseType = 'json'>(options: RequestOptionsByMethod<'patch', RouteQuery<N, 'patch'>, RouteBody<N, 'patch'>, RT>) => Promise<ToReturn<T, RT>>;
101
- delete: HasRequiredKeys<RouteQuery<N, 'delete'>> extends true ? <T = RouteResp<N, 'delete'>>(options: RequestOptionsByMethod<'delete', RouteQuery<N, 'delete'>>) => Promise<ToReturn<T>> : <T = RouteResp<N, 'delete'>>(options?: RequestOptionsByMethod<'delete', RouteQuery<N, 'delete'>>) => Promise<ToReturn<T>>;
102
- }
103
- type MethodAvailable<N extends RouteName, M extends RequestMethod> = M extends 'url' ? RouteMethods<N>['url'] : M extends keyof Routes[N] ? RouteMethods<N>[M] : never;
104
- type RouteResults<N extends RouteName> = {
105
- [M in keyof RouteMethods<any>]: MethodAvailable<N, M>;
106
- };
107
- type KeysWithMethods<Methods extends RequestMethod[]> = {
108
- [K in keyof Routes]: Methods extends (keyof Routes[K])[] ? K : never;
109
- }[keyof Routes];
110
- type PathKeys = any;
111
- type KeysWithPaths<P extends PathKeys> = {
112
- [K in keyof Routes]: P extends Array<keyof Routes[K]['pathObj']> ? K : never;
113
- }[keyof Routes];
114
- type KeysWithMethodAndPath<M extends RequestMethod[], P extends PathKeys> = {
115
- [K in keyof Routes]: K extends KeysWithMethods<M> ? K extends KeysWithPaths<P> ? K : never : never;
116
- }[keyof Routes];
117
-
118
10
  declare class AbortError extends Error {
119
11
  constructor(message?: string);
120
12
  }
@@ -665,7 +557,7 @@ interface BasemapWebmap {
665
557
  interface LookupTableResource {
666
558
  items: Record<string, string>;
667
559
  }
668
- type VectorFieldDatatype = 'STRING' | 'REAL' | 'DATE' | 'TIME' | 'DATETIME' | 'BIGINT' | 'INTEGER' | 'BOOLEAN';
560
+ type VectorFieldDatatype = 'STRING' | 'REAL' | 'DATE' | 'TIME' | 'DATETIME' | 'BIGINT' | 'INTEGER' | 'BOOLEAN' | 'JSON';
669
561
  /** @deprecated - use {@link VectorFieldDatatype} instead */
670
562
  type ResourceItemDatatype = VectorFieldDatatype;
671
563
  interface FeatureLayerField {
@@ -681,7 +573,7 @@ interface FeatureLayerField {
681
573
  interface FeatureResource {
682
574
  fields: FeatureLayerField[];
683
575
  }
684
- type GeometryType = 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON' | 'POINTZ' | 'LINESTRINGZ' | 'POLYGONZ' | 'MULTIPOINTZ' | 'MULTILINESTRINGZ' | 'MULTIPOLYGONZ';
576
+ type GeometryType = 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON' | 'POINTZ' | 'LINESTRINGZ' | 'POLYGONZ' | 'MULTIPOINTZ' | 'MULTILINESTRINGZ' | 'MULTIPOLYGONZ' | 'NONE';
685
577
  /** @deprecated use VectorLayerRead from '@nextgisweb/resource/type/api' instead */
686
578
  interface VectorLayer {
687
579
  srs: {
@@ -857,7 +749,7 @@ interface GetRequestItemsResponseMap extends RequestItemKeys {
857
749
  'pyramid.route': PyramidRoute;
858
750
  'pyramid.settings': PyramidSettings;
859
751
  'resource.item': CompositeRead;
860
- 'resource.search': CompositeRead[];
752
+ 'resource.search': CompositeRead[] | SearchResponse;
861
753
  'resource.child': any;
862
754
  'resource.collection': CompositeRead[];
863
755
  'file_upload.upload': FileUploadResp;
@@ -1131,6 +1023,114 @@ declare namespace errors {
1131
1023
  };
1132
1024
  }
1133
1025
 
1026
+ declare class LunkwillParam {
1027
+ static VALUES: (string | null)[];
1028
+ private value;
1029
+ constructor();
1030
+ update(value: string | null, cond?: boolean): void;
1031
+ suggest(cond?: boolean): void;
1032
+ require(cond?: boolean): void;
1033
+ toHeaders(headers: Record<string, string>): void;
1034
+ }
1035
+
1036
+ type RouteParameters = {
1037
+ [K in keyof Routes]: Routes[K]['pathArr'] | [Routes[K]['pathObj']];
1038
+ };
1039
+ type RouteName = keyof Routes;
1040
+ type GetRouteParam<R extends RouteName> = (RouteParameters[R] & [
1041
+ object
1042
+ ])[0];
1043
+ type RequestMethod = keyof RouteMethods<RouteName>;
1044
+ type Method = RequestMethod | Uppercase<RequestMethod>;
1045
+ type CompositeFor<K extends keyof CompositeRead> = CompositeRead & Required<Pick<CompositeRead, K>>;
1046
+ type ResponseType = 'blob' | 'json';
1047
+ interface RouteRequestOptions<RT extends ResponseType = 'json', ReturnUrl extends boolean = false, Q = any, B = string | null | boolean | Record<string, any> | any[]> extends Omit<RequestInit, 'cache'> {
1048
+ headers?: Record<string, string>;
1049
+ cache?: boolean;
1050
+ query?: Q;
1051
+ json?: B;
1052
+ /** Has lower priority than the json */
1053
+ body?: string;
1054
+ /**
1055
+ * The type of data that the server will respond with.
1056
+ * Can be either 'json' or 'blob'.
1057
+ */
1058
+ responseType?: RT;
1059
+ /**
1060
+ * @deprecated use {@link RequestInit.credential}
1061
+ * Indicates whether to include credentials such as cookies, authentication headers,
1062
+ * or TLS client certificates in cross-site Access-Control requests.
1063
+ */
1064
+ withCredentials?: boolean;
1065
+ /**
1066
+ * Name to use for caching the request.
1067
+ */
1068
+ cacheName?: string;
1069
+ /**
1070
+ * Properties to override default cache behavior.
1071
+ */
1072
+ cacheProps?: Record<string, unknown>;
1073
+ lunkwill?: LunkwillParam;
1074
+ lunkwillReturnUrl?: ReturnUrl;
1075
+ }
1076
+ interface GetRequestOptions<Q = any, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> extends Omit<RouteRequestOptions<RT, ReturnUrl, Q>, 'json' | 'body'> {
1077
+ method?: 'GET';
1078
+ }
1079
+ interface RequestOptionsJSON<Q = any, B = string | null | boolean | Record<string, any> | any[], RT extends ResponseType = 'json', M extends Method = Method> extends Omit<RouteRequestOptions<RT, false, Q, B>, 'json' | 'body'> {
1080
+ json: B;
1081
+ method?: M;
1082
+ }
1083
+ interface RequestOptionsBody<Q = any, RT extends ResponseType = 'json', M extends Method = Method> extends Omit<RouteRequestOptions<RT, false, Q>, 'json' | 'body'> {
1084
+ body: string;
1085
+ method?: M;
1086
+ }
1087
+ type PutRequestOptions<Q = any, B = any, RT extends ResponseType = 'json'> = RequestOptionsJSON<Q, B, RT, 'PUT'> | RequestOptionsBody<Q, RT, 'PUT'>;
1088
+ type PostRequestOptions<Q = any, B = any, RT extends ResponseType = 'json'> = RequestOptionsJSON<Q, B, RT, 'POST'> | RequestOptionsBody<Q, RT, 'POST'>;
1089
+ type PatchRequestOptions<Q = any, B = any, RT extends ResponseType = 'json'> = RequestOptionsJSON<Q, B, RT, 'PATCH'> | RequestOptionsBody<Q, RT, 'PATCH'>;
1090
+ type DeleteRequestOptions<Q = any, RT extends ResponseType = 'json'> = RouteRequestOptions<RT, false, Q>;
1091
+ interface MethodRequestOptions<Q = any, B = any, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> {
1092
+ get: GetRequestOptions<Q, RT, ReturnUrl>;
1093
+ post: PostRequestOptions<Q, B, RT>;
1094
+ put: PutRequestOptions<Q, B, RT>;
1095
+ patch: PatchRequestOptions<Q, RT>;
1096
+ delete: DeleteRequestOptions<Q, RT>;
1097
+ }
1098
+ type RequestOptionsByMethod<M extends RequestMethod, Q = any, B = any, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> = M extends keyof MethodRequestOptions ? MethodRequestOptions<Q, B, RT, ReturnUrl>[M] : never;
1099
+ type ApiRouteParams = Record<string, string>;
1100
+ interface LunkwillData {
1101
+ status?: string;
1102
+ delay_ms?: number;
1103
+ }
1104
+ type RouteResp<N extends RouteName, M extends RequestMethod> = N extends keyof Routes ? M extends keyof Routes[N] ? 'response' extends keyof Routes[N][M] ? Routes[N][M]['response'] : never : never : never;
1105
+ type RouteQuery<N extends RouteName, M extends RequestMethod> = N extends keyof Routes ? M extends keyof Routes[N] ? 'query' extends keyof Routes[N][M] ? Routes[N][M]['query'] : any : never : never;
1106
+ type RouteBody<N extends RouteName, M extends RequestMethod> = N extends keyof Routes ? M extends keyof Routes[N] ? 'body' extends keyof Routes[N][M] ? Routes[N][M]['body'] : any : never : never;
1107
+ type ToReturn<T = unknown, RT extends ResponseType = 'json', ReturnUrl extends boolean = false> = ReturnUrl extends true ? string : RT extends 'blob' ? Blob : T;
1108
+ type HasRequiredKeys<T> = {
1109
+ [P in keyof T]-?: object extends Pick<T, P> ? never : P;
1110
+ }[keyof T] extends never ? false : true;
1111
+ interface RouteMethods<N extends RouteName> {
1112
+ url: HasRequiredKeys<RouteQuery<N, 'get'>> extends true ? (options: Pick<RequestOptionsByMethod<'get', RouteQuery<N, 'get'>>, 'query'>) => Promise<string> : (options?: Pick<RequestOptionsByMethod<'get', RouteQuery<N, 'get'>>, 'query'>) => Promise<string>;
1113
+ get: HasRequiredKeys<RouteQuery<N, 'get'>> extends true ? <T = RouteResp<N, 'get'>, RT extends ResponseType = 'json', B extends boolean = false>(options: RequestOptionsByMethod<'get', RouteQuery<N, 'get'>, any, RT, B>) => Promise<ToReturn<T, RT, B>> : <T = RouteResp<N, 'get'>, B extends boolean = false, RT extends ResponseType = 'json'>(options?: RequestOptionsByMethod<'get', RouteQuery<N, 'get'>, any, RT, B>) => Promise<ToReturn<T, RT, B>>;
1114
+ post: <T = RouteResp<N, 'post'>, RT extends ResponseType = 'json'>(options: RequestOptionsByMethod<'post', RouteQuery<N, 'post'>, RouteBody<N, 'post'>, RT>) => Promise<ToReturn<T, RT>>;
1115
+ put: <T = RouteResp<N, 'put'>, RT extends ResponseType = 'json'>(options: RequestOptionsByMethod<'put', RouteQuery<N, 'put'>, RouteBody<N, 'put'>, RT>) => Promise<ToReturn<T, RT>>;
1116
+ patch: <T = RouteResp<N, 'patch'>, RT extends ResponseType = 'json'>(options: RequestOptionsByMethod<'patch', RouteQuery<N, 'patch'>, RouteBody<N, 'patch'>, RT>) => Promise<ToReturn<T, RT>>;
1117
+ delete: HasRequiredKeys<RouteQuery<N, 'delete'>> extends true ? <T = RouteResp<N, 'delete'>>(options: RequestOptionsByMethod<'delete', RouteQuery<N, 'delete'>>) => Promise<ToReturn<T>> : <T = RouteResp<N, 'delete'>>(options?: RequestOptionsByMethod<'delete', RouteQuery<N, 'delete'>>) => Promise<ToReturn<T>>;
1118
+ }
1119
+ type MethodAvailable<N extends RouteName, M extends RequestMethod> = M extends 'url' ? RouteMethods<N>['url'] : M extends keyof Routes[N] ? RouteMethods<N>[M] : never;
1120
+ type RouteResults<N extends RouteName> = {
1121
+ [M in keyof RouteMethods<any>]: MethodAvailable<N, M>;
1122
+ };
1123
+ type KeysWithMethods<Methods extends RequestMethod[]> = {
1124
+ [K in keyof Routes]: Methods extends (keyof Routes[K])[] ? K : never;
1125
+ }[keyof Routes];
1126
+ type PathKeys = any;
1127
+ type KeysWithPaths<P extends PathKeys> = {
1128
+ [K in keyof Routes]: P extends Array<keyof Routes[K]['pathObj']> ? K : never;
1129
+ }[keyof Routes];
1130
+ type KeysWithMethodAndPath<M extends RequestMethod[], P extends PathKeys> = {
1131
+ [K in keyof Routes]: K extends KeysWithMethods<M> ? K extends KeysWithPaths<P> ? K : never : never;
1132
+ }[keyof Routes];
1133
+
1134
1134
  declare class NgwConnector {
1135
1135
  options: NgwConnectorOptions;
1136
1136
  static errors: typeof errors;
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-connector; version: 4.0.0-alpha.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-connector; version: 4.0.0-alpha.6; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  var utils = require('@nextgis/utils');
@@ -69,7 +69,7 @@ async function apiRequest(opt) {
69
69
  }
70
70
 
71
71
  var pkg = {
72
- version: "4.0.0-alpha.2"};
72
+ version: "4.0.0-alpha.6"};
73
73
 
74
74
  class AbortError extends Error {
75
75
  constructor(message = "AbortError") {
@@ -692,7 +692,7 @@ let ID = 0;
692
692
  let REQUEST_ID = 0;
693
693
  class NgwConnector {
694
694
  constructor(options) {
695
- this.options = options;
695
+ __publicField$2(this, "options", options);
696
696
  __publicField$2(this, "id", ID++);
697
697
  __publicField$2(this, "emitter", new events.EventEmitter());
698
698
  __publicField$2(this, "user");
@@ -1116,14 +1116,15 @@ class ResourcesControl {
1116
1116
  ...query
1117
1117
  }
1118
1118
  }).then((resources) => {
1119
- if ((requestOptions == null ? void 0 : requestOptions.cache) && resources) {
1120
- for (const x of resources) {
1119
+ const items2 = Array.isArray(resources) ? resources : resources.items;
1120
+ if (requestOptions == null ? void 0 : requestOptions.cache) {
1121
+ for (const x of items2) {
1121
1122
  this.cache.add("resource.item", Promise.resolve(x), {
1122
1123
  id: x.resource.id
1123
1124
  });
1124
1125
  }
1125
1126
  }
1126
- return resources;
1127
+ return items2;
1127
1128
  });
1128
1129
  }
1129
1130
  return items;