@nextgis/ngw-connector 3.0.0-alpha.8 → 3.0.1

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
@@ -46,6 +46,38 @@ We recommend linking to a specific version number `/ngw-connector@[version]`
46
46
  npm install @nextgis/ngw-connector
47
47
  ```
48
48
 
49
+ ## TypeScript Support
50
+
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:
56
+
57
+ ```bash
58
+ npx @nextgis/ngw-types-loader
59
+ ```
60
+
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:
64
+
65
+ ```bash
66
+ npx @nextgis/ngw-types-loader https://your-custom-ngw-url.com
67
+ ```
68
+
69
+ After running the tool, ensure that your `tsconfig.json` includes the downloaded file:
70
+
71
+ ```json
72
+ {
73
+ "include": [
74
+ "./nextgisweb.d.ts"
75
+ ]
76
+ }
77
+ ```
78
+
79
+ For more details, refer to the [NGW Types Loader](https://www.npmjs.com/package/@nextgis/ngw-types-loader).
80
+
49
81
  ## Usage
50
82
 
51
83
  ```javascript
@@ -56,22 +88,25 @@ const ngwConnector = new NgwConnector({
56
88
  // auth: {login, password}
57
89
  });
58
90
 
59
- ngwConnector.get('resource.item', null, { id: 485 }).then((data) => {
60
- console.log(data);
61
- });
91
+ ngwConnector
92
+ .route('resource.item', { id: 485 })
93
+ .get()
94
+ .then((data) => {
95
+ console.log(data);
96
+ });
62
97
 
63
- ngwConnector.post('resource.collection', { data: [RESOURCE JSON] });
64
- ngwConnector.patch(
65
- 'feature_layer.feature.collection',
66
- { data: [ITEMS JSON] },
67
- {
68
- id,
98
+ ngwConnector.route('resource.collection').patch({ json: RESOURCE });
99
+ ngwConnector.route('feature_layer.feature.collection', { id }).patch({
100
+ json: ITEMS,
101
+ query: {
69
102
  srs: 4326,
70
103
  geom_format: 'geojson',
71
- }
72
- );
73
- ngwConnector.put('feature_layer.feature.item', { data: [ITEM JSON] }, { id, fid })
74
- ngwConnector.delete('feature_layer.feature.item', null, { id, fid })
104
+ },
105
+ });
106
+ ngwConnector
107
+ .route('feature_layer.feature.item', { id, fid })
108
+ .put({ json: ITEM });
109
+ ngwConnector.route('feature_layer.feature.item', { id, fid }).delete();
75
110
 
76
111
  // Shortcuts methods to find resources
77
112
  ngwConnector.getResource(2011); // by id
@@ -93,131 +128,7 @@ ngwConnector.get(request_name, request_options, arguments);
93
128
 
94
129
  [request_options](https://code-api.nextgis.com/interfaces/ngw_connector.RequestOptions.html)
95
130
 
96
- <details>
97
- <summary>API request names</summary>
98
-
99
- | request name | url | arguments |
100
- | --------------------------------- | ----------------------------------------------------- | ---------------- |
101
- | auth.current_user | /api/component/auth/current_user | |
102
- | auth.group.collection | /api/component/auth/group/ | |
103
- | auth.group.create | /auth/group/create | |
104
- | auth.group.delete | /auth/group/{0}/delete | id |
105
- | auth.group.edit | /auth/group/{0}/edit | id |
106
- | auth.group.item | /api/component/auth/group/{0} | id |
107
- | auth.login_cookies | /api/component/auth/login | |
108
- | auth.logout_cookies | /api/component/auth/logout | |
109
- | auth.profile | /api/component/auth/profile | |
110
- | auth.register | /api/component/auth/register | |
111
- | auth.user.collection | /api/component/auth/user/ | |
112
- | auth.user.create | /auth/user/create | |
113
- | auth.user.delete | /auth/user/{0}/delete | id |
114
- | auth.user.edit | /auth/user/{0}/edit | id |
115
- | auth.user.item | /api/component/auth/user/{0} | id |
116
- | collector.resource.read | /collector/resource/{0}/read | id |
117
- | collector.resource.users | /collector/resource/{0}/users | id |
118
- | collector.settings | /api/component/collector/settings | |
119
- | collector.settings.users | /collector/user | |
120
- | collector.user | /collector/user/{0} | user_id |
121
- | feature_attachment.collection | /api/resource/{0}/feature/{1}/attachment/ | id,fid |
122
- | feature_attachment.download | /api/resource/{0}/feature/{1}/attachment/{2}/download | id,fid,aid |
123
- | feature_attachment.image | /api/resource/{0}/feature/{1}/attachment/{2}/image | id,fid,aid |
124
- | feature_attachment.item | /api/resource/{0}/feature/{1}/attachment/{2} | id,fid,aid |
125
- | feature_layer.feature.browse | /resource/{0}/feature/ | id |
126
- | feature_layer.feature.collection | /api/resource/{0}/feature/ | id |
127
- | feature_layer.feature.count | /api/resource/{0}/feature_count | id |
128
- | feature_layer.feature.item | /api/resource/{0}/feature/{1} | id,fid |
129
- | feature_layer.feature.item_extent | /api/resource/{0}/feature/{1}/extent | id,fid |
130
- | feature_layer.feature.show | /resource/{0}/feature/{1} | id,feature_id |
131
- | feature_layer.feature.update | /resource/{0}/feature/{1}/update | id,feature_id |
132
- | feature_layer.field | /resource/{0}/field/ | id |
133
- | feature_layer.geojson | /api/resource/{0}/geojson | id |
134
- | feature_layer.identify | /api/feature_layer/identify | |
135
- | feature_layer.mvt | /api/component/feature_layer/mvt | |
136
- | feature_layer.store | /api/resource/{0}/store/ | id |
137
- | feature_layer.store.item | /resource/{0}/store/{1} | id,feature_id |
138
- | file_upload.collection | /api/component/file_upload/ | |
139
- | file_upload.item | /api/component/file_upload/{0} | id |
140
- | file_upload.upload | /api/component/file_upload/upload | |
141
- | formbuilder.formbuilder_form_ngfp | /api/resource/{0}/ngfp | id |
142
- | layer.extent | /api/resource/{0}/extent | id |
143
- | postgis.connection.inspect | /api/resource/{0}/inspect/ | id |
144
- | postgis.connection.inspect.table | /api/resource/{0}/inspect/{1}/ | id,table_name |
145
- | pyramid.company_logo | /api/component/pyramid/company_logo | |
146
- | pyramid.control_panel | /control-panel | |
147
- | pyramid.control_panel.sysinfo | /control-panel/sysinfo | |
148
- | pyramid.cors | /api/component/pyramid/cors | |
149
- | pyramid.custom_css | /api/component/pyramid/custom_css | |
150
- | pyramid.estimate_storage | /api/component/pyramid/estimate_storage | |
151
- | pyramid.healthcheck | /api/component/pyramid/healthcheck | |
152
- | pyramid.home_path | /api/component/pyramid/home_path | |
153
- | pyramid.kind_of_data | /api/component/pyramid/kind_of_data | |
154
- | pyramid.locdata | /api/component/pyramid/locdata/{0}/{1} | component,locale |
155
- | pyramid.logo | /api/component/pyramid/logo | |
156
- | pyramid.pkg_version | /api/component/pyramid/pkg_version | |
157
- | pyramid.route | /api/component/pyramid/route | |
158
- | pyramid.settings | /api/component/pyramid/settings | |
159
- | pyramid.statistics | /api/component/pyramid/statistics | |
160
- | pyramid.storage | /api/component/pyramid/storage | |
161
- | pyramid.system_name | /api/component/pyramid/system_name | |
162
- | qgis.style_qml | /api/resource/{0}/qml | id |
163
- | render.image | /api/component/render/image | |
164
- | render.legend | /api/resource/{0}/legend | id |
165
- | render.tile | /api/component/render/tile | |
166
- | render.tile_cache.seed_status | /api/resource/{0}/tile_cache/seed_status | id |
167
- | resource.collection | /api/resource/ | |
168
- | resource.create | /resource/{0}/create | id |
169
- | resource.delete | /resource/{0}/delete | id |
170
- | resource.export | /api/resource/{0}/export | id |
171
- | resource.file_download | /api/resource/{0}/file/{1} | id,name |
172
- | resource.item | /api/resource/{0} | id |
173
- | resource.json | /resource/{0}/json | id |
174
- | resource.permission | /api/resource/{0}/permission | id |
175
- | resource.permission.explain | /api/resource/{0}/permission/explain | id |
176
- | resource.preview | /api/resource/{0}/preview.png | id |
177
- | resource.quota | /api/resource/quota | |
178
- | resource.resource_export | /api/component/resource/resource_export | |
179
- | resource.schema | /resource/schema | |
180
- | resource.search | /api/resource/search/ | |
181
- | resource.show | /resource/{0} | id |
182
- | resource.tree | /resource/{0}/tree | id |
183
- | resource.update | /resource/{0}/update | id |
184
- | resource.volume | /api/resource/{0}/volume | id |
185
- | resource.widget | /resource/widget | |
186
- | spatial_ref_sys.collection | /api/component/spatial_ref_sys/ | |
187
- | spatial_ref_sys.convert | /api/component/spatial_ref_sys/convert | |
188
- | spatial_ref_sys.geom_area | /api/component/spatial_ref_sys/{0}/geom_area | id |
189
- | spatial_ref_sys.geom_length | /api/component/spatial_ref_sys/{0}/geom_length | id |
190
- | spatial_ref_sys.geom_transform | /api/component/spatial_ref_sys/{0}/geom_transform | id |
191
- | spatial_ref_sys.get | /api/component/spatial_ref_sys/{0} | id |
192
- | srs.create | /srs/create | |
193
- | srs.delete | /srs/{0}/delete | id |
194
- | srs.edit | /srs/{0}/edit | id |
195
- | tmsclient.connection.layers | /api/component/tmsclient/{0}/layers/ | id |
196
- | tracker.export_to_gpx | /tracker/gpx | |
197
- | tracker.get.stops | /tracker/stops | |
198
- | tracker.get_amd_static_url | /tracker/amd/static/url/ | |
199
- | tracker.get_device_types | /tracker/device_types | |
200
- | tracker.get_full_tracks | /tracker/tracks/full | |
201
- | tracker.get_last_activity_tracker | /tracker/activity/last | |
202
- | tracker.get_short_tracks | /tracker/tracks/short | |
203
- | tracker.get_tracker_last_points | /tracker/last/points | |
204
- | tracker.get_tracker_lines | /tracker/lines | |
205
- | tracker.get_tracker_points | /tracker/points | |
206
- | tracker.get_trackers | /tracker/trackers/tree | |
207
- | tracker.receive_packet | /tracker/{0}/receive | unique_id |
208
- | tracker.reports | /tracker/reports/ | |
209
- | tracker.reports.build | /tracker/report/build/ | |
210
- | tracker.settings | /api/component/tracker/settings | |
211
- | vector_layer.dataset | /api/component/vector_layer/dataset | |
212
- | webmap.annotation.collection | /api/resource/{0}/annotation/ | id |
213
- | webmap.annotation.item | /api/resource/{0}/annotation/{1} | id,annotation_id |
214
- | webmap.display | /resource/{0}/display | id |
215
- | webmap.display.tiny | /resource/{0}/display/tiny | id |
216
- | webmap.settings | /api/component/webmap/settings | |
217
- | wfsserver.wfs | /api/resource/{0}/wfs | id |
218
- | wmsserver.wms | /api/resource/{0}/wms | id |
219
-
220
- </details>
131
+ [API request names](https://demo.nextgis.com/doc/api)
221
132
 
222
133
  ## Commercial support
223
134