@nextgis/ngw-connector 1.8.0 → 1.9.2

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
@@ -83,7 +83,138 @@ ngwConnector.getResources({ cls: 'vector_layer', parent__id: 0 }); // find resou
83
83
  ngwConnector.getResource({ display_name: 'My layer', parent__id: 0 }); // get first
84
84
  ```
85
85
 
86
- Check out the [API Documentation](https://github.com/nextgis/nextgis_frontend/blob/master/markdown/ngw-connector.md)
86
+ Check out the [API Documentation](https://code-api.nextgis.com/modules/ngw_connector.html)
87
+
88
+ ## NGW API
89
+
90
+ [NextGIS Web API Doc](http://docs.nextgis.ru/docs_ngweb_dev/doc/developer/toc.html)
91
+
92
+ ```javascript
93
+ ngwConnector.get(request_name, request_options, arguments);
94
+ ```
95
+
96
+ [request_options](https://code-api.nextgis.com/interfaces/ngw_connector.RequestOptions.html)
97
+
98
+ | request name | url | arguments |
99
+ | - | - | - |
100
+ | auth.current_user | /api/component/auth/current_user | |
101
+ | auth.group.collection | /api/component/auth/group/ | |
102
+ | auth.group.create | /auth/group/create | |
103
+ | auth.group.delete | /auth/group/{0}/delete | id |
104
+ | auth.group.edit | /auth/group/{0}/edit | id |
105
+ | auth.group.item | /api/component/auth/group/{0} | id |
106
+ | auth.login_cookies | /api/component/auth/login | |
107
+ | auth.logout_cookies | /api/component/auth/logout | |
108
+ | auth.profile | /api/component/auth/profile | |
109
+ | auth.register | /api/component/auth/register | |
110
+ | auth.user.collection | /api/component/auth/user/ | |
111
+ | auth.user.create | /auth/user/create | |
112
+ | auth.user.delete | /auth/user/{0}/delete | id |
113
+ | auth.user.edit | /auth/user/{0}/edit | id |
114
+ | auth.user.item | /api/component/auth/user/{0} | id |
115
+ | collector.resource.read | /collector/resource/{0}/read | id |
116
+ | collector.resource.users | /collector/resource/{0}/users | id |
117
+ | collector.settings | /api/component/collector/settings | |
118
+ | collector.settings.users | /collector/user | |
119
+ | collector.user | /collector/user/{0} | user_id |
120
+ | feature_attachment.collection | /api/resource/{0}/feature/{1}/attachment/ | id,fid |
121
+ | feature_attachment.download | /api/resource/{0}/feature/{1}/attachment/{2}/download | id,fid,aid |
122
+ | feature_attachment.image | /api/resource/{0}/feature/{1}/attachment/{2}/image | id,fid,aid |
123
+ | feature_attachment.item | /api/resource/{0}/feature/{1}/attachment/{2} | id,fid,aid |
124
+ | feature_layer.feature.browse | /resource/{0}/feature/ | id |
125
+ | feature_layer.feature.collection | /api/resource/{0}/feature/ | id |
126
+ | feature_layer.feature.count | /api/resource/{0}/feature_count | id |
127
+ | feature_layer.feature.item | /api/resource/{0}/feature/{1} | id,fid |
128
+ | feature_layer.feature.item_extent | /api/resource/{0}/feature/{1}/extent | id,fid |
129
+ | feature_layer.feature.show | /resource/{0}/feature/{1} | id,feature_id |
130
+ | feature_layer.feature.update | /resource/{0}/feature/{1}/update | id,feature_id |
131
+ | feature_layer.field | /resource/{0}/field/ | id |
132
+ | feature_layer.geojson | /api/resource/{0}/geojson | id |
133
+ | feature_layer.identify | /api/feature_layer/identify | |
134
+ | feature_layer.mvt | /api/component/feature_layer/mvt | |
135
+ | feature_layer.store | /api/resource/{0}/store/ | id |
136
+ | feature_layer.store.item | /resource/{0}/store/{1} | id,feature_id |
137
+ | file_upload.collection | /api/component/file_upload/ | |
138
+ | file_upload.item | /api/component/file_upload/{0} | id |
139
+ | file_upload.upload | /api/component/file_upload/upload | |
140
+ | formbuilder.formbuilder_form_ngfp | /api/resource/{0}/ngfp | id |
141
+ | layer.extent | /api/resource/{0}/extent | id |
142
+ | postgis.connection.inspect | /api/resource/{0}/inspect/ | id |
143
+ | postgis.connection.inspect.table | /api/resource/{0}/inspect/{1}/ | id,table_name |
144
+ | pyramid.company_logo | /api/component/pyramid/company_logo | |
145
+ | pyramid.control_panel | /control-panel | |
146
+ | pyramid.control_panel.sysinfo | /control-panel/sysinfo | |
147
+ | pyramid.cors | /api/component/pyramid/cors | |
148
+ | pyramid.custom_css | /api/component/pyramid/custom_css | |
149
+ | pyramid.estimate_storage | /api/component/pyramid/estimate_storage | |
150
+ | pyramid.healthcheck | /api/component/pyramid/healthcheck | |
151
+ | pyramid.home_path | /api/component/pyramid/home_path | |
152
+ | pyramid.kind_of_data | /api/component/pyramid/kind_of_data | |
153
+ | pyramid.locdata | /api/component/pyramid/locdata/{0}/{1} | component,locale |
154
+ | pyramid.logo | /api/component/pyramid/logo | |
155
+ | pyramid.pkg_version | /api/component/pyramid/pkg_version | |
156
+ | pyramid.route | /api/component/pyramid/route | |
157
+ | pyramid.settings | /api/component/pyramid/settings | |
158
+ | pyramid.statistics | /api/component/pyramid/statistics | |
159
+ | pyramid.storage | /api/component/pyramid/storage | |
160
+ | pyramid.system_name | /api/component/pyramid/system_name | |
161
+ | qgis.style_qml | /api/resource/{0}/qml | id |
162
+ | render.image | /api/component/render/image | |
163
+ | render.legend | /api/resource/{0}/legend | id |
164
+ | render.tile | /api/component/render/tile | |
165
+ | render.tile_cache.seed_status | /api/resource/{0}/tile_cache/seed_status | id |
166
+ | resource.collection | /api/resource/ | |
167
+ | resource.create | /resource/{0}/create | id |
168
+ | resource.delete | /resource/{0}/delete | id |
169
+ | resource.export | /api/resource/{0}/export | id |
170
+ | resource.file_download | /api/resource/{0}/file/{1} | id,name |
171
+ | resource.item | /api/resource/{0} | id |
172
+ | resource.json | /resource/{0}/json | id |
173
+ | resource.permission | /api/resource/{0}/permission | id |
174
+ | resource.permission.explain | /api/resource/{0}/permission/explain | id |
175
+ | resource.preview | /api/resource/{0}/preview.png | id |
176
+ | resource.quota | /api/resource/quota | |
177
+ | resource.resource_export | /api/component/resource/resource_export | |
178
+ | resource.schema | /resource/schema | |
179
+ | resource.search | /api/resource/search/ | |
180
+ | resource.show | /resource/{0} | id |
181
+ | resource.tree | /resource/{0}/tree | id |
182
+ | resource.update | /resource/{0}/update | id |
183
+ | resource.volume | /api/resource/{0}/volume | id |
184
+ | resource.widget | /resource/widget | |
185
+ | spatial_ref_sys.collection | /api/component/spatial_ref_sys/ | |
186
+ | spatial_ref_sys.convert | /api/component/spatial_ref_sys/convert | |
187
+ | spatial_ref_sys.geom_area | /api/component/spatial_ref_sys/{0}/geom_area | id |
188
+ | spatial_ref_sys.geom_length | /api/component/spatial_ref_sys/{0}/geom_length | id |
189
+ | spatial_ref_sys.geom_transform | /api/component/spatial_ref_sys/{0}/geom_transform | id |
190
+ | spatial_ref_sys.get | /api/component/spatial_ref_sys/{0} | id |
191
+ | srs.create | /srs/create | |
192
+ | srs.delete | /srs/{0}/delete | id |
193
+ | srs.edit | /srs/{0}/edit | id |
194
+ | tmsclient.connection.layers | /api/component/tmsclient/{0}/layers/ | id |
195
+ | tracker.export_to_gpx | /tracker/gpx | |
196
+ | tracker.get.stops | /tracker/stops | |
197
+ | tracker.get_amd_static_url | /tracker/amd/static/url/ | |
198
+ | tracker.get_device_types | /tracker/device_types | |
199
+ | tracker.get_full_tracks | /tracker/tracks/full | |
200
+ | tracker.get_last_activity_tracker | /tracker/activity/last | |
201
+ | tracker.get_short_tracks | /tracker/tracks/short | |
202
+ | tracker.get_tracker_last_points | /tracker/last/points | |
203
+ | tracker.get_tracker_lines | /tracker/lines | |
204
+ | tracker.get_tracker_points | /tracker/points | |
205
+ | tracker.get_trackers | /tracker/trackers/tree | |
206
+ | tracker.receive_packet | /tracker/{0}/receive | unique_id |
207
+ | tracker.reports | /tracker/reports/ | |
208
+ | tracker.reports.build | /tracker/report/build/ | |
209
+ | tracker.settings | /api/component/tracker/settings | |
210
+ | vector_layer.dataset | /api/component/vector_layer/dataset | |
211
+ | webmap.annotation.collection | /api/resource/{0}/annotation/ | id |
212
+ | webmap.annotation.item | /api/resource/{0}/annotation/{1} | id,annotation_id |
213
+ | webmap.display | /resource/{0}/display | id |
214
+ | webmap.display.tiny | /resource/{0}/display/tiny | id |
215
+ | webmap.settings | /api/component/webmap/settings | |
216
+ | wfsserver.wfs | /api/resource/{0}/wfs | id |
217
+ | wmsserver.wms | /api/resource/{0}/wms | id |
87
218
 
88
219
  ## Commercial support
89
220
 
package/lib/index.d.ts CHANGED
@@ -303,11 +303,11 @@ declare class NgwConnector {
303
303
  /**
304
304
  * {@inheritDoc ResourcesControl.getOne}
305
305
  */
306
- getResource(resource: ResourceDefinition): CancelablePromise<ResourceItem | undefined>;
306
+ getResource(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem | undefined>;
307
307
  /**
308
308
  * {@inheritDoc ResourcesControl.getOneOrFail}
309
309
  */
310
- getResourceOrFail(resource: ResourceDefinition): CancelablePromise<ResourceItem>;
310
+ getResourceOrFail(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem>;
311
311
  /**
312
312
  * @deprecated - use {@link NgwConnector.getResource}
313
313
  */
@@ -323,23 +323,23 @@ declare class NgwConnector {
323
323
  /**
324
324
  * {@inheritDoc ResourcesControl.getId}
325
325
  */
326
- getResourceId(resource: ResourceDefinition): CancelablePromise<number | undefined>;
326
+ getResourceId(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<number | undefined>;
327
327
  /**
328
328
  * {@inheritDoc ResourcesControl.getIdOrFail}
329
329
  */
330
- getResourceIdOrFail(resource: ResourceDefinition): CancelablePromise<number>;
330
+ getResourceIdOrFail(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<number>;
331
331
  /**
332
332
  * {@inheritDoc ResourcesControl.getMany}
333
333
  */
334
- getResourcesBy(resource: DeepPartial<Resource>): CancelablePromise<ResourceItem[]>;
334
+ getResourcesBy(resource: DeepPartial<Resource>, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem[]>;
335
335
  /**
336
336
  * {@inheritDoc ResourcesControl.getParent}
337
337
  */
338
- getResourceParent(resource: ResourceDefinition): CancelablePromise<ResourceItem | undefined>;
338
+ getResourceParent(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem | undefined>;
339
339
  /**
340
340
  * {@inheritDoc ResourcesControl.getChildrenOf}
341
341
  */
342
- getResourceChildren(resource: ResourceDefinition): CancelablePromise<ResourceItem[]>;
342
+ getResourceChildren(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem[]>;
343
343
  /**
344
344
  * {@inheritDoc ResourcesControl.update}
345
345
  */
@@ -702,7 +702,7 @@ export declare interface Resource {
702
702
  scopes: string[];
703
703
  }
704
704
 
705
- export declare type ResourceCls = 'vector_layer' | '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' | 'terrain_provider' | 'model_3d' | 'tmsclient_layer';
705
+ export declare 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' | 'terrain_provider' | 'model_3d' | 'tmsclient_layer';
706
706
 
707
707
  export declare type ResourceDefinition = ResourceIdKeynameDef | DeepPartial<Resource>;
708
708
 
@@ -758,7 +758,7 @@ declare class ResourcesControl {
758
758
  * Fetching resource would be cached to speed up next call
759
759
  */
760
760
  getOne(resource: ResourceDefinition, requestOptions?: RequestOptions): CancelablePromise<ResourceItem | undefined>;
761
- getOneOrFail(resource: ResourceDefinition): CancelablePromise<ResourceItem>;
761
+ getOneOrFail(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem>;
762
762
  /**
763
763
  * A fast way to retrieve resource ID for any resource definition.
764
764
  * @param resource - Any available resource definition
@@ -769,7 +769,7 @@ declare class ResourcesControl {
769
769
  * then this method will come in handy to facilitate the extraction of the identifier
770
770
  * if the resource is specified through a keyname or other parameters.
771
771
  */
772
- getId(resource: ResourceDefinition): CancelablePromise<number | undefined>;
772
+ getId(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<number | undefined>;
773
773
  /**
774
774
  * A fast way to retrieve resource ID for any resource definition.
775
775
  * @param resource - Any available resource definition
@@ -778,10 +778,10 @@ declare class ResourcesControl {
778
778
  * Similar with {@link NgwConnector.getResourceId | getResourceId} but rise error if resource is not exist.
779
779
  * To not make one more checks if the resource is definitely exists
780
780
  */
781
- getIdOrFail(resource: ResourceDefinition): CancelablePromise<number>;
781
+ getIdOrFail(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<number>;
782
782
  getMany(resource: DeepPartial<Resource>, requestOptions?: RequestOptions): CancelablePromise<ResourceItem[]>;
783
- getParent(resource: ResourceDefinition): CancelablePromise<ResourceItem | undefined>;
784
- getChildrenOf(resource: ResourceDefinition): CancelablePromise<ResourceItem[]>;
783
+ getParent(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem | undefined>;
784
+ getChildrenOf(resource: ResourceDefinition, requestOptions?: Pick<RequestOptions, 'cache'>): CancelablePromise<ResourceItem[]>;
785
785
  update(resource: ResourceDefinition, data: DeepPartial<ResourceItem>): CancelablePromise<ResourceItem | undefined>;
786
786
  /**
787
787
  * Fast way to delete resource from NGW and clean cache.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-connector; version: 1.8.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-connector; version: 1.9.2; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  var events = require('events');
@@ -6,7 +6,7 @@ var CancelablePromise = require('@nextgis/cancelable-promise');
6
6
  var utils = require('@nextgis/utils');
7
7
  var Cache = require('@nextgis/cache');
8
8
 
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
10
10
 
11
11
  var CancelablePromise__default = /*#__PURE__*/_interopDefaultLegacy(CancelablePromise);
12
12
  var Cache__default = /*#__PURE__*/_interopDefaultLegacy(Cache);
@@ -238,8 +238,8 @@ class ResourcesControl {
238
238
  };
239
239
  return cache.add('resource', makeRequest, { resource });
240
240
  }
241
- getOneOrFail(resource) {
242
- return this.getOne(resource).then((res) => {
241
+ getOneOrFail(resource, requestOptions) {
242
+ return this.getOne(resource, requestOptions).then((res) => {
243
243
  if (res) {
244
244
  return res;
245
245
  }
@@ -256,12 +256,12 @@ class ResourcesControl {
256
256
  * then this method will come in handy to facilitate the extraction of the identifier
257
257
  * if the resource is specified through a keyname or other parameters.
258
258
  */
259
- getId(resource) {
259
+ getId(resource, requestOptions) {
260
260
  if (typeof resource === 'number') {
261
261
  return CancelablePromise__default.resolve(resource);
262
262
  }
263
263
  else if (typeof resource === 'string' || isObject(resource)) {
264
- return this.getOne(resource).then((res) => {
264
+ return this.getOne(resource, requestOptions).then((res) => {
265
265
  if (res) {
266
266
  return res.resource.id;
267
267
  }
@@ -277,8 +277,8 @@ class ResourcesControl {
277
277
  * Similar with {@link NgwConnector.getResourceId | getResourceId} but rise error if resource is not exist.
278
278
  * To not make one more checks if the resource is definitely exists
279
279
  */
280
- getIdOrFail(resource) {
281
- return this.getId(resource).then((resp) => {
280
+ getIdOrFail(resource, requestOptions) {
281
+ return this.getId(resource, requestOptions).then((resp) => {
282
282
  if (resp === undefined) {
283
283
  throw new Error();
284
284
  }
@@ -314,18 +314,18 @@ class ResourcesControl {
314
314
  return items;
315
315
  });
316
316
  }
317
- getParent(resource) {
318
- return this.connector.getResource(resource).then((child) => {
317
+ getParent(resource, requestOptions) {
318
+ return this.getOne(resource, requestOptions).then((child) => {
319
319
  if (child) {
320
- return this.connector.getResource(child.resource.parent.id);
320
+ return this.getOne(child.resource.parent.id, requestOptions);
321
321
  }
322
322
  return CancelablePromise__default.resolve(undefined);
323
323
  });
324
324
  }
325
- getChildrenOf(resource) {
325
+ getChildrenOf(resource, requestOptions) {
326
326
  return this.getId(resource).then((parent) => {
327
327
  return this.connector
328
- .get('resource.collection', { cache: true }, {
328
+ .get('resource.collection', { cache: true, ...requestOptions }, {
329
329
  parent,
330
330
  })
331
331
  .then((items) => {
@@ -732,14 +732,14 @@ class NgwConnector$1 {
732
732
  /**
733
733
  * {@inheritDoc ResourcesControl.getOne}
734
734
  */
735
- getResource(resource) {
736
- return this.resources.getOne(resource);
735
+ getResource(resource, requestOptions) {
736
+ return this.resources.getOne(resource, requestOptions);
737
737
  }
738
738
  /**
739
739
  * {@inheritDoc ResourcesControl.getOneOrFail}
740
740
  */
741
- getResourceOrFail(resource) {
742
- return this.resources.getOneOrFail(resource);
741
+ getResourceOrFail(resource, requestOptions) {
742
+ return this.resources.getOneOrFail(resource, requestOptions);
743
743
  }
744
744
  /**
745
745
  * @deprecated - use {@link NgwConnector.getResource}
@@ -762,32 +762,32 @@ class NgwConnector$1 {
762
762
  /**
763
763
  * {@inheritDoc ResourcesControl.getId}
764
764
  */
765
- getResourceId(resource) {
766
- return this.resources.getId(resource);
765
+ getResourceId(resource, requestOptions) {
766
+ return this.resources.getId(resource, requestOptions);
767
767
  }
768
768
  /**
769
769
  * {@inheritDoc ResourcesControl.getIdOrFail}
770
770
  */
771
- getResourceIdOrFail(resource) {
772
- return this.resources.getIdOrFail(resource);
771
+ getResourceIdOrFail(resource, requestOptions) {
772
+ return this.resources.getIdOrFail(resource, requestOptions);
773
773
  }
774
774
  /**
775
775
  * {@inheritDoc ResourcesControl.getMany}
776
776
  */
777
- getResourcesBy(resource) {
778
- return this.resources.getMany(resource);
777
+ getResourcesBy(resource, requestOptions) {
778
+ return this.resources.getMany(resource, requestOptions);
779
779
  }
780
780
  /**
781
781
  * {@inheritDoc ResourcesControl.getParent}
782
782
  */
783
- getResourceParent(resource) {
784
- return this.resources.getParent(resource);
783
+ getResourceParent(resource, requestOptions) {
784
+ return this.resources.getParent(resource, requestOptions);
785
785
  }
786
786
  /**
787
787
  * {@inheritDoc ResourcesControl.getChildrenOf}
788
788
  */
789
- getResourceChildren(resource) {
790
- return this.resources.getChildrenOf(resource);
789
+ getResourceChildren(resource, requestOptions) {
790
+ return this.resources.getChildrenOf(resource, requestOptions);
791
791
  }
792
792
  /**
793
793
  * {@inheritDoc ResourcesControl.update}