@versatiles/versatiles-rs 3.7.0 → 3.8.0
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 +30 -7
- package/index.cjs +53 -52
- package/index.d.ts +21 -0
- package/index.js +54 -53
- package/package.json +27 -19
- package/vpl.d.ts +205 -0
- package/vpl.js +262 -0
package/README.md
CHANGED
|
@@ -366,6 +366,7 @@ See the [examples](./examples) directory for more usage examples:
|
|
|
366
366
|
- [probe.ts](./examples/probe.ts) - Container inspection
|
|
367
367
|
- [serve.ts](./examples/serve.ts) - HTTP tile server
|
|
368
368
|
- [read-tiles.ts](./examples/read-tiles.ts) - Reading tiles and coordinate conversion
|
|
369
|
+
- [vpl-pipeline.ts](./examples/vpl-pipeline.ts) - Building VPL pipelines programmatically
|
|
369
370
|
|
|
370
371
|
All examples use TypeScript and can be run with:
|
|
371
372
|
|
|
@@ -375,27 +376,49 @@ npx tsx examples/<filename>.ts
|
|
|
375
376
|
|
|
376
377
|
## Development
|
|
377
378
|
|
|
379
|
+
### Requirements
|
|
380
|
+
|
|
381
|
+
- Node.js >= 16
|
|
382
|
+
- Rust toolchain (for building from source)
|
|
383
|
+
|
|
384
|
+
### Build Process
|
|
385
|
+
|
|
386
|
+
The package has two outputs: a **native N-API module** (Rust compiled to a `.node` binary) and a **VPL TypeScript library** (generated from Rust operation metadata, then compiled to JS). The VPL generation step calls into the native module, so it must be built first.
|
|
387
|
+
|
|
388
|
+
```mermaid
|
|
389
|
+
flowchart TD
|
|
390
|
+
subgraph "1. Native Module"
|
|
391
|
+
RS[Rust source] -->|"npm run build:cjs"| CJS["index.cjs"]
|
|
392
|
+
RS -->|"npm run build:esm"| ESM["index.js<br/>index.d.ts"]
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
subgraph "2. VPL Library"
|
|
396
|
+
ESM -->|"npm run build:vpl"| VJS["vpl.js<br/>vpl.d.ts"]
|
|
397
|
+
end
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
| Step | Script | What it does |
|
|
401
|
+
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
402
|
+
| Build native CJS | `build:cjs` | Compiles Rust to a native `.node` binary and generates `index.cjs` |
|
|
403
|
+
| Build native ESM | `build:esm` | Generates `index.js` and `index.d.ts` (ESM wrapper + type declarations) |
|
|
404
|
+
| Generate VPL TS | `build:vpl` | Runs `scripts/generate-vpl.ts` which calls the native `generateVplTypescript()` function to produce `vpl.ts`, then compiles it with `tsc` to `vpl.js` + `vpl.d.ts` |
|
|
405
|
+
|
|
378
406
|
### Building from Source
|
|
379
407
|
|
|
380
408
|
```bash
|
|
381
409
|
# Install dependencies
|
|
382
410
|
npm install
|
|
383
411
|
|
|
384
|
-
# Build debug version
|
|
412
|
+
# Build debug version (native module + VPL)
|
|
385
413
|
npm run build:debug
|
|
386
414
|
|
|
387
|
-
# Build release version
|
|
415
|
+
# Build release version (native module + VPL)
|
|
388
416
|
npm run build
|
|
389
417
|
|
|
390
418
|
# Run tests
|
|
391
419
|
npm test
|
|
392
420
|
```
|
|
393
421
|
|
|
394
|
-
### Requirements
|
|
395
|
-
|
|
396
|
-
- Node.js >= 16
|
|
397
|
-
- Rust toolchain (for building from source)
|
|
398
|
-
|
|
399
422
|
## License
|
|
400
423
|
|
|
401
424
|
MIT License - see [LICENSE](../LICENSE) for details.
|
package/index.cjs
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@versatiles/versatiles-rs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '3.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
80
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '3.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
96
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '3.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
117
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '3.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
133
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '3.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
150
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '3.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
166
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@versatiles/versatiles-rs-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '3.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
185
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@versatiles/versatiles-rs-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '3.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
201
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@versatiles/versatiles-rs-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '3.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
217
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@versatiles/versatiles-rs-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '3.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
237
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '3.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
253
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '3.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
274
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '3.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
290
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '3.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
308
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '3.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
324
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '3.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
342
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '3.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
358
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '3.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
376
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '3.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
392
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '3.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
410
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '3.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
426
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '3.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
443
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '3.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
459
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '3.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
479
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@versatiles/versatiles-rs-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '3.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
495
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '3.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
511
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -582,3 +582,4 @@ module.exports.TileCoord = nativeBinding.TileCoord
|
|
|
582
582
|
module.exports.TileServer = nativeBinding.TileServer
|
|
583
583
|
module.exports.TileSource = nativeBinding.TileSource
|
|
584
584
|
module.exports.convert = nativeBinding.convert
|
|
585
|
+
module.exports.generateVplTypescript = nativeBinding.generateVplTypescript
|
package/index.d.ts
CHANGED
|
@@ -587,6 +587,19 @@ export declare class TileSource {
|
|
|
587
587
|
* The conversion will process the pipeline and write the output tiles to the target format.
|
|
588
588
|
*/
|
|
589
589
|
static fromVpl(vpl: string, dir?: string | undefined | null): Promise<TileSource>
|
|
590
|
+
/**
|
|
591
|
+
* Create a TileSource from a pipeline definition (JSON)
|
|
592
|
+
*
|
|
593
|
+
* Accepts a JSON string describing the pipeline steps and constructs the pipeline
|
|
594
|
+
* directly without going through VPL text format.
|
|
595
|
+
*
|
|
596
|
+
* # Arguments
|
|
597
|
+
*
|
|
598
|
+
* * `steps_json` - JSON string describing the pipeline steps
|
|
599
|
+
* * `dir` - Optional base directory for resolving relative file paths.
|
|
600
|
+
* Defaults to the current working directory if not specified.
|
|
601
|
+
*/
|
|
602
|
+
static fromPipeline(stepsJson: string, dir?: string | undefined | null): Promise<TileSource>
|
|
590
603
|
/**
|
|
591
604
|
* Convert this tile source to another format
|
|
592
605
|
*
|
|
@@ -940,6 +953,14 @@ export interface ConvertOptions {
|
|
|
940
953
|
swapXy?: boolean
|
|
941
954
|
}
|
|
942
955
|
|
|
956
|
+
/**
|
|
957
|
+
* Generate the VPL TypeScript builder source code from Rust operation metadata.
|
|
958
|
+
*
|
|
959
|
+
* Returns the complete TypeScript source as a string. Write it to a `.ts` file
|
|
960
|
+
* and compile with `tsc` to produce `.js` + `.d.ts`.
|
|
961
|
+
*/
|
|
962
|
+
export declare function generateVplTypescript(): string
|
|
963
|
+
|
|
943
964
|
/**
|
|
944
965
|
* Status or diagnostic message from an operation
|
|
945
966
|
*
|
package/index.js
CHANGED
|
@@ -81,8 +81,8 @@ function requireNative() {
|
|
|
81
81
|
try {
|
|
82
82
|
const binding = require('@versatiles/versatiles-rs-android-arm64')
|
|
83
83
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
|
|
84
|
-
if (bindingPackageVersion !== '3.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
84
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
86
|
}
|
|
87
87
|
return binding
|
|
88
88
|
} catch (e) {
|
|
@@ -97,8 +97,8 @@ function requireNative() {
|
|
|
97
97
|
try {
|
|
98
98
|
const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
|
|
99
99
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
|
|
100
|
-
if (bindingPackageVersion !== '3.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
100
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
102
|
}
|
|
103
103
|
return binding
|
|
104
104
|
} catch (e) {
|
|
@@ -118,8 +118,8 @@ function requireNative() {
|
|
|
118
118
|
try {
|
|
119
119
|
const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
|
|
120
120
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
|
|
121
|
-
if (bindingPackageVersion !== '3.
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
121
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
123
|
}
|
|
124
124
|
return binding
|
|
125
125
|
} catch (e) {
|
|
@@ -134,8 +134,8 @@ function requireNative() {
|
|
|
134
134
|
try {
|
|
135
135
|
const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
|
|
136
136
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
|
|
137
|
-
if (bindingPackageVersion !== '3.
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
137
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
138
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
139
|
}
|
|
140
140
|
return binding
|
|
141
141
|
} catch (e) {
|
|
@@ -151,8 +151,8 @@ function requireNative() {
|
|
|
151
151
|
try {
|
|
152
152
|
const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
|
|
153
153
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
|
|
154
|
-
if (bindingPackageVersion !== '3.
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
154
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
156
|
}
|
|
157
157
|
return binding
|
|
158
158
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
|
|
169
169
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '3.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
170
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -186,8 +186,8 @@ function requireNative() {
|
|
|
186
186
|
try {
|
|
187
187
|
const binding = require('@versatiles/versatiles-rs-darwin-universal')
|
|
188
188
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
|
|
189
|
-
if (bindingPackageVersion !== '3.
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
189
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
191
|
}
|
|
192
192
|
return binding
|
|
193
193
|
} catch (e) {
|
|
@@ -202,8 +202,8 @@ function requireNative() {
|
|
|
202
202
|
try {
|
|
203
203
|
const binding = require('@versatiles/versatiles-rs-darwin-x64')
|
|
204
204
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
|
|
205
|
-
if (bindingPackageVersion !== '3.
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
205
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
206
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
207
|
}
|
|
208
208
|
return binding
|
|
209
209
|
} catch (e) {
|
|
@@ -218,8 +218,8 @@ function requireNative() {
|
|
|
218
218
|
try {
|
|
219
219
|
const binding = require('@versatiles/versatiles-rs-darwin-arm64')
|
|
220
220
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
|
|
221
|
-
if (bindingPackageVersion !== '3.
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
221
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
222
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
223
|
}
|
|
224
224
|
return binding
|
|
225
225
|
} catch (e) {
|
|
@@ -238,8 +238,8 @@ function requireNative() {
|
|
|
238
238
|
try {
|
|
239
239
|
const binding = require('@versatiles/versatiles-rs-freebsd-x64')
|
|
240
240
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
|
|
241
|
-
if (bindingPackageVersion !== '3.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
241
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
243
|
}
|
|
244
244
|
return binding
|
|
245
245
|
} catch (e) {
|
|
@@ -254,8 +254,8 @@ function requireNative() {
|
|
|
254
254
|
try {
|
|
255
255
|
const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
|
|
256
256
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
|
|
257
|
-
if (bindingPackageVersion !== '3.
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
257
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
258
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
259
|
}
|
|
260
260
|
return binding
|
|
261
261
|
} catch (e) {
|
|
@@ -275,8 +275,8 @@ function requireNative() {
|
|
|
275
275
|
try {
|
|
276
276
|
const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
|
|
277
277
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
|
|
278
|
-
if (bindingPackageVersion !== '3.
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
278
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
280
|
}
|
|
281
281
|
return binding
|
|
282
282
|
} catch (e) {
|
|
@@ -291,8 +291,8 @@ function requireNative() {
|
|
|
291
291
|
try {
|
|
292
292
|
const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
|
|
293
293
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '3.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
294
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
296
|
}
|
|
297
297
|
return binding
|
|
298
298
|
} catch (e) {
|
|
@@ -309,8 +309,8 @@ function requireNative() {
|
|
|
309
309
|
try {
|
|
310
310
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
|
|
311
311
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
|
|
312
|
-
if (bindingPackageVersion !== '3.
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
312
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
314
|
}
|
|
315
315
|
return binding
|
|
316
316
|
} catch (e) {
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
|
|
327
327
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '3.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
328
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
330
|
}
|
|
331
331
|
return binding
|
|
332
332
|
} catch (e) {
|
|
@@ -343,8 +343,8 @@ function requireNative() {
|
|
|
343
343
|
try {
|
|
344
344
|
const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
|
|
345
345
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
|
|
346
|
-
if (bindingPackageVersion !== '3.
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
346
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
348
|
}
|
|
349
349
|
return binding
|
|
350
350
|
} catch (e) {
|
|
@@ -359,8 +359,8 @@ function requireNative() {
|
|
|
359
359
|
try {
|
|
360
360
|
const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
|
|
361
361
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '3.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
362
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
364
|
}
|
|
365
365
|
return binding
|
|
366
366
|
} catch (e) {
|
|
@@ -377,8 +377,8 @@ function requireNative() {
|
|
|
377
377
|
try {
|
|
378
378
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
|
|
379
379
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
|
|
380
|
-
if (bindingPackageVersion !== '3.
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
380
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
382
|
}
|
|
383
383
|
return binding
|
|
384
384
|
} catch (e) {
|
|
@@ -393,8 +393,8 @@ function requireNative() {
|
|
|
393
393
|
try {
|
|
394
394
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
|
|
395
395
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
|
|
396
|
-
if (bindingPackageVersion !== '3.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
396
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
398
|
}
|
|
399
399
|
return binding
|
|
400
400
|
} catch (e) {
|
|
@@ -411,8 +411,8 @@ function requireNative() {
|
|
|
411
411
|
try {
|
|
412
412
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
|
|
413
413
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
|
|
414
|
-
if (bindingPackageVersion !== '3.
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
414
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
416
|
}
|
|
417
417
|
return binding
|
|
418
418
|
} catch (e) {
|
|
@@ -427,8 +427,8 @@ function requireNative() {
|
|
|
427
427
|
try {
|
|
428
428
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
|
|
429
429
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '3.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
430
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
432
|
}
|
|
433
433
|
return binding
|
|
434
434
|
} catch (e) {
|
|
@@ -444,8 +444,8 @@ function requireNative() {
|
|
|
444
444
|
try {
|
|
445
445
|
const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
|
|
446
446
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
|
|
447
|
-
if (bindingPackageVersion !== '3.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
447
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
449
|
}
|
|
450
450
|
return binding
|
|
451
451
|
} catch (e) {
|
|
@@ -460,8 +460,8 @@ function requireNative() {
|
|
|
460
460
|
try {
|
|
461
461
|
const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
|
|
462
462
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
|
|
463
|
-
if (bindingPackageVersion !== '3.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
463
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
465
|
}
|
|
466
466
|
return binding
|
|
467
467
|
} catch (e) {
|
|
@@ -480,8 +480,8 @@ function requireNative() {
|
|
|
480
480
|
try {
|
|
481
481
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
|
|
482
482
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
|
|
483
|
-
if (bindingPackageVersion !== '3.
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
483
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
485
|
}
|
|
486
486
|
return binding
|
|
487
487
|
} catch (e) {
|
|
@@ -496,8 +496,8 @@ function requireNative() {
|
|
|
496
496
|
try {
|
|
497
497
|
const binding = require('@versatiles/versatiles-rs-openharmony-x64')
|
|
498
498
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
|
|
499
|
-
if (bindingPackageVersion !== '3.
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
499
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
501
|
}
|
|
502
502
|
return binding
|
|
503
503
|
} catch (e) {
|
|
@@ -512,8 +512,8 @@ function requireNative() {
|
|
|
512
512
|
try {
|
|
513
513
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm')
|
|
514
514
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
|
|
515
|
-
if (bindingPackageVersion !== '3.
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
515
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
516
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
517
|
}
|
|
518
518
|
return binding
|
|
519
519
|
} catch (e) {
|
|
@@ -579,10 +579,11 @@ if (!nativeBinding) {
|
|
|
579
579
|
throw new Error(`Failed to load native binding`)
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
const { Progress, SourceType, TileCoord, TileServer, TileSource, convert } = nativeBinding
|
|
582
|
+
const { Progress, SourceType, TileCoord, TileServer, TileSource, convert, generateVplTypescript } = nativeBinding
|
|
583
583
|
export { Progress }
|
|
584
584
|
export { SourceType }
|
|
585
585
|
export { TileCoord }
|
|
586
586
|
export { TileServer }
|
|
587
587
|
export { TileSource }
|
|
588
588
|
export { convert }
|
|
589
|
+
export { generateVplTypescript }
|
package/package.json
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/versatiles-rs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Node.js bindings for VersaTiles - convert, serve, and process map tiles",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"import": "./index.js",
|
|
12
|
+
"require": "./index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./vpl": {
|
|
15
|
+
"types": "./vpl.d.ts",
|
|
16
|
+
"import": "./vpl.js"
|
|
17
|
+
}
|
|
12
18
|
},
|
|
13
19
|
"files": [
|
|
14
20
|
"index.d.ts",
|
|
15
21
|
"index.js",
|
|
16
|
-
"index.cjs"
|
|
22
|
+
"index.cjs",
|
|
23
|
+
"vpl.d.ts",
|
|
24
|
+
"vpl.js"
|
|
17
25
|
],
|
|
18
26
|
"napi": {
|
|
19
27
|
"binaryName": "versatiles",
|
|
@@ -50,12 +58,13 @@
|
|
|
50
58
|
},
|
|
51
59
|
"scripts": {
|
|
52
60
|
"artifacts": "napi artifacts",
|
|
53
|
-
"build:debug": "npm run build:cjs:debug && npm run build:esm:debug",
|
|
54
61
|
"build:cjs:debug": "napi build --platform && mv index.js index.cjs",
|
|
55
|
-
"build:esm:debug": "napi build --platform --esm",
|
|
56
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
57
62
|
"build:cjs": "napi build --platform --release && mv index.js index.cjs",
|
|
63
|
+
"build:debug": "npm run build:cjs:debug && npm run build:esm:debug && npm run build:vpl",
|
|
64
|
+
"build:esm:debug": "napi build --platform --esm",
|
|
58
65
|
"build:esm": "napi build --platform --release --esm",
|
|
66
|
+
"build:vpl": "npx tsx scripts/generate-vpl.ts && tsc -p tsconfig.vpl.json",
|
|
67
|
+
"build": "npm run build:cjs && npm run build:esm && npm run build:vpl",
|
|
59
68
|
"check": "npm run build:debug && npm run typecheck && npm run lint && npm run test && npm run test:examples && npm run format:check",
|
|
60
69
|
"docs:clean": "rm -rf docs",
|
|
61
70
|
"docs:generate": "typedoc",
|
|
@@ -79,28 +88,27 @@
|
|
|
79
88
|
"devDependencies": {
|
|
80
89
|
"@eslint/js": "^10.0.1",
|
|
81
90
|
"@napi-rs/cli": "^3.5.1",
|
|
82
|
-
"@types/node": "^25.3.
|
|
91
|
+
"@types/node": "^25.3.3",
|
|
83
92
|
"@vitest/ui": "^4.0.18",
|
|
84
93
|
"chalk": "^5.6.2",
|
|
85
94
|
"eslint": "^10.0.2",
|
|
86
95
|
"eslint-config-prettier": "^10.1.8",
|
|
87
|
-
"npm-check-updates": "^19.
|
|
96
|
+
"npm-check-updates": "^19.6.3",
|
|
88
97
|
"prettier": "^3.8.1",
|
|
89
98
|
"tsx": "^4.21.0",
|
|
90
99
|
"typedoc": "^0.28.17",
|
|
91
|
-
"typedoc-plugin-markdown": "^4.10.0",
|
|
92
100
|
"typescript": "^5.9.3",
|
|
93
101
|
"typescript-eslint": "^8.56.1",
|
|
94
102
|
"vitest": "^4.0.18"
|
|
95
103
|
},
|
|
96
104
|
"optionalDependencies": {
|
|
97
|
-
"@versatiles/versatiles-rs-darwin-arm64": "3.
|
|
98
|
-
"@versatiles/versatiles-rs-darwin-x64": "3.
|
|
99
|
-
"@versatiles/versatiles-rs-linux-arm64-gnu": "3.
|
|
100
|
-
"@versatiles/versatiles-rs-linux-arm64-musl": "3.
|
|
101
|
-
"@versatiles/versatiles-rs-linux-x64-gnu": "3.
|
|
102
|
-
"@versatiles/versatiles-rs-linux-x64-musl": "3.
|
|
103
|
-
"@versatiles/versatiles-rs-win32-arm64-msvc": "3.
|
|
104
|
-
"@versatiles/versatiles-rs-win32-x64-msvc": "3.
|
|
105
|
+
"@versatiles/versatiles-rs-darwin-arm64": "3.8.0",
|
|
106
|
+
"@versatiles/versatiles-rs-darwin-x64": "3.8.0",
|
|
107
|
+
"@versatiles/versatiles-rs-linux-arm64-gnu": "3.8.0",
|
|
108
|
+
"@versatiles/versatiles-rs-linux-arm64-musl": "3.8.0",
|
|
109
|
+
"@versatiles/versatiles-rs-linux-x64-gnu": "3.8.0",
|
|
110
|
+
"@versatiles/versatiles-rs-linux-x64-musl": "3.8.0",
|
|
111
|
+
"@versatiles/versatiles-rs-win32-arm64-msvc": "3.8.0",
|
|
112
|
+
"@versatiles/versatiles-rs-win32-x64-msvc": "3.8.0"
|
|
105
113
|
}
|
|
106
114
|
}
|
package/vpl.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { TileSource } from './index.js';
|
|
2
|
+
export interface FromColorOptions {
|
|
3
|
+
/** Hex color in RGB or RGBA format (e.g., "FF5733" or "FF573380"). Defaults to "000000" (black). */
|
|
4
|
+
color?: string;
|
|
5
|
+
/** Tile size in pixels (256 or 512). Defaults to 512. */
|
|
6
|
+
size?: number;
|
|
7
|
+
/** Tile format: one of "avif", "jpg", "png", or "webp". Defaults to "png". */
|
|
8
|
+
format?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FromContainerOptions {
|
|
11
|
+
/** The filename of the tile container. This is relative to the path of the VPL file. For example: `filename="world.versatiles"`. */
|
|
12
|
+
filename: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FromDebugOptions {
|
|
15
|
+
/** Target tile format: one of `"mvt"` (default), `"avif"`, `"jpg"`, `"png"` or `"webp"` */
|
|
16
|
+
format?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FromStackedRasterOptions {
|
|
19
|
+
/** The tile format to use for the output tiles. Default: format of the first source. */
|
|
20
|
+
format?: string;
|
|
21
|
+
/** Whether to automatically overscale tiles when a source does not provide tiles at the requested zoom level. Default: `false`. */
|
|
22
|
+
autoOverscale?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface FromTileOptions {
|
|
25
|
+
/** The filename of the tile. Supported formats: png, jpg/jpeg, webp, avif, pbf/mvt. The format is automatically detected from the file extension. */
|
|
26
|
+
filename: string;
|
|
27
|
+
}
|
|
28
|
+
export interface FromTilejsonOptions {
|
|
29
|
+
/** The URL of the TileJSON endpoint. For example: `url="https://example.com/tiles.json"`. */
|
|
30
|
+
url: string;
|
|
31
|
+
/** Maximum number of retries per tile request (default: 3). */
|
|
32
|
+
maxRetries?: number;
|
|
33
|
+
/** Maximum number of concurrent tile requests (default: io_bound concurrency limit). */
|
|
34
|
+
maxConcurrentRequests?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface FilterOptions {
|
|
37
|
+
/** Bounding box in WGS84: [min lng, min lat, max lng, max lat]. */
|
|
38
|
+
bbox?: [number, number, number, number];
|
|
39
|
+
/** minimal zoom level */
|
|
40
|
+
levelMin?: number;
|
|
41
|
+
/** maximal zoom level */
|
|
42
|
+
levelMax?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface MetaUpdateOptions {
|
|
45
|
+
/** Attribution text. */
|
|
46
|
+
attribution?: string;
|
|
47
|
+
/** Geographic bounding box [west, south, east, north]. */
|
|
48
|
+
bounds?: [number, number, number, number];
|
|
49
|
+
/** Default center [longitude, latitude, zoom]. */
|
|
50
|
+
center?: [number, number, number];
|
|
51
|
+
/** Description text. */
|
|
52
|
+
description?: string;
|
|
53
|
+
/** Fill zoom level. */
|
|
54
|
+
fillzoom?: number;
|
|
55
|
+
/** Legend text. */
|
|
56
|
+
legend?: string;
|
|
57
|
+
/** Name text. */
|
|
58
|
+
name?: string;
|
|
59
|
+
/** Tile schema, allowed values: "rgb", "rgba", "dem/mapbox", "dem/terrarium", "dem/versatiles", "openmaptiles", "shortbread@1.0", "other", "unknown" */
|
|
60
|
+
schema?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface DemOverviewOptions {
|
|
63
|
+
/** Use this zoom level to build the overview. Defaults to the maximum zoom level of the source. */
|
|
64
|
+
level?: number;
|
|
65
|
+
/** Size of the tiles in pixels. Defaults to 512. */
|
|
66
|
+
tileSize?: number;
|
|
67
|
+
/** Override auto-detection of DEM encoding. Values: "mapbox", "terrarium". */
|
|
68
|
+
encoding?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface DemQuantizeOptions {
|
|
71
|
+
/** Minimum elevation resolution as fraction of tile ground size. E.g. 0.001 means for a 1000 m tile, keep 1 m resolution. Defaults to 0.001. */
|
|
72
|
+
resolutionRatio?: number;
|
|
73
|
+
/** Maximum allowed gradient change in degrees due to quantization. Defaults to 1.0. */
|
|
74
|
+
maxGradientError?: number;
|
|
75
|
+
/** Override auto-detection of DEM encoding. Values: "mapbox", "terrarium". */
|
|
76
|
+
encoding?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface RasterFlattenOptions {
|
|
79
|
+
/** background color to use for the flattened tiles, in RGB format. Defaults to white. */
|
|
80
|
+
color?: [number, number, number];
|
|
81
|
+
}
|
|
82
|
+
export interface RasterFormatOptions {
|
|
83
|
+
/** The desired tile format. Allowed values are: AVIF, JPG, PNG or WEBP. If not specified, the source format will be used. */
|
|
84
|
+
format?: string;
|
|
85
|
+
/** Quality level for the tile compression (only AVIF, JPG or WEBP), between 0 (worst) and 100 (lossless). To allow different quality levels for different zoom levels, this can also be a comma-separated list like this: "80,70,14:50,15:20", where the first value is the default quality, and the other values specify the quality for the specified zoom level (and higher). */
|
|
86
|
+
quality?: string;
|
|
87
|
+
/** Compression speed, between 0 (slowest) and 100 (fastest). */
|
|
88
|
+
speed?: number;
|
|
89
|
+
}
|
|
90
|
+
export interface RasterLevelsOptions {
|
|
91
|
+
/** Brightness adjustment, between -255 and 255. Defaults to 0.0 (no change). */
|
|
92
|
+
brightness?: number;
|
|
93
|
+
/** Contrast adjustment, between 0 and infinity. Defaults to 1.0 (no change). */
|
|
94
|
+
contrast?: number;
|
|
95
|
+
/** Gamma adjustment, between 0 and infinity. Defaults to 1.0 (no change). */
|
|
96
|
+
gamma?: number;
|
|
97
|
+
}
|
|
98
|
+
export interface RasterMaskOptions {
|
|
99
|
+
/** Path to GeoJSON file with Polygon or MultiPolygon geometry. */
|
|
100
|
+
geojson: string;
|
|
101
|
+
/** Buffer distance in meters. Positive values expand the mask, negative values shrink it. Default: 0 */
|
|
102
|
+
buffer?: number;
|
|
103
|
+
/** Edge blur distance in meters. Creates a soft transition at the mask edge. Default: 0 */
|
|
104
|
+
blur?: number;
|
|
105
|
+
/** Blur falloff function: "linear" or "cosine". Default: "linear" */
|
|
106
|
+
blurFunction?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface RasterOverscaleOptions {
|
|
109
|
+
/** The zoom level to use as the source for overscaling. Tiles at this level and below are passed through unchanged. Tiles above this level are generated by extracting and upscaling from this level. Defaults to the maximum zoom level of the source. */
|
|
110
|
+
levelBase?: number;
|
|
111
|
+
/** The maximum zoom level to support. Defaults to 30. Requests above this level will not return tiles. */
|
|
112
|
+
levelMax?: number;
|
|
113
|
+
/** Enable tile climbing when the expected source tile doesn't exist. When true, the operation will search parent tiles at lower zoom levels until it finds an existing tile, then extract and upscale from there. Defaults to false. */
|
|
114
|
+
enableClimbing?: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface RasterOverviewOptions {
|
|
117
|
+
/** use this zoom level to build the overview. Defaults to the maximum zoom level of the source. */
|
|
118
|
+
level?: number;
|
|
119
|
+
/** Size of the tiles in pixels. Defaults to 512. */
|
|
120
|
+
tileSize?: number;
|
|
121
|
+
}
|
|
122
|
+
export interface VectorFilterLayersOptions {
|
|
123
|
+
/** Comma‑separated list of layer names that should be removed from the tiles, e.g.: filter="pois,ocean". */
|
|
124
|
+
filter: string;
|
|
125
|
+
/** If set, inverts the filter logic (i.e., keeps only layers matching the filter). */
|
|
126
|
+
invert?: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface VectorFilterPropertiesOptions {
|
|
129
|
+
/** A regular expression pattern that should match property names to be removed from all features. The property names contain the layer name as a prefix, e.g., `layer_name/property_name`, so an expression like `regex="^layer_name/"` will match all properties of that layer or `regex="/name_.*$"` will match all properties starting with `name_` in all layers. */
|
|
130
|
+
regex: string;
|
|
131
|
+
/** If set, inverts the filter logic (i.e., keeps only properties matching the filter). */
|
|
132
|
+
invert?: boolean;
|
|
133
|
+
}
|
|
134
|
+
export interface VectorUpdatePropertiesOptions {
|
|
135
|
+
/** Path to the CSV/TSV data file: The file must have a header row. Each subsequent row will be matched to vector features using the ID fields. */
|
|
136
|
+
dataSourcePath: string;
|
|
137
|
+
/** Name of the vector layer to update: Only features in this layer will be modified. Other layers pass through unchanged. */
|
|
138
|
+
layerName: string;
|
|
139
|
+
/** Field name in the vector tiles that contains the feature ID: This field is used to match features with rows in the data source. */
|
|
140
|
+
idFieldTiles: string;
|
|
141
|
+
/** Column name in the data source that contains the matching ID: This column is used to look up data for each feature. */
|
|
142
|
+
idFieldData: string;
|
|
143
|
+
/** If `true`, replaces all existing properties with the data source values. If `false` (default), merges new properties with existing ones. */
|
|
144
|
+
replaceProperties?: boolean;
|
|
145
|
+
/** If `true`, removes features that don't have a matching row in the data source. If `false` (default), non-matching features are kept unchanged. */
|
|
146
|
+
removeNonMatching?: boolean;
|
|
147
|
+
/** If `true`, includes the ID field from the data source in the output properties. If `false` (default), the ID field is excluded from the merged properties. */
|
|
148
|
+
includeId?: boolean;
|
|
149
|
+
/** Field separator character for the data file: Default for `.csv` files is `,` (comma). Default for `.tsv` files is `\t` (tab, auto-detected) */
|
|
150
|
+
fieldSeparator?: string;
|
|
151
|
+
/** Decimal separator character for parsing numbers: Default is `.` (US/UK format). Use `,` (comma) e.g. for German/European number format like `1.234,56` */
|
|
152
|
+
decimalSeparator?: string;
|
|
153
|
+
}
|
|
154
|
+
export declare class VPL {
|
|
155
|
+
private steps;
|
|
156
|
+
private constructor();
|
|
157
|
+
/** Generates solid-color tiles of the specified size and format. */
|
|
158
|
+
static fromColor(options?: FromColorOptions): VPL;
|
|
159
|
+
/** Reads a tile container, such as a `*.versatiles`, `*.mbtiles`, `*.pmtiles` or `*.tar` file. */
|
|
160
|
+
static fromContainer(options: FromContainerOptions): VPL;
|
|
161
|
+
/** Generates debug tiles that display their coordinates as text. */
|
|
162
|
+
static fromDebug(options?: FromDebugOptions): VPL;
|
|
163
|
+
/** Merges multiple vector tile sources. */
|
|
164
|
+
static fromMergedVector(sources: VPL[]): VPL;
|
|
165
|
+
/** Overlays multiple raster tile sources on top of each other. */
|
|
166
|
+
static fromStackedRaster(sources: VPL[], options?: Omit<FromStackedRasterOptions, 'sources'>): VPL;
|
|
167
|
+
/** Overlays multiple tile sources, using the tile from the first source that provides it. */
|
|
168
|
+
static fromStacked(sources: VPL[]): VPL;
|
|
169
|
+
/** Reads a single tile file and uses it as a template for all tile requests. */
|
|
170
|
+
static fromTile(options: FromTileOptions): VPL;
|
|
171
|
+
/** Reads tiles from a remote tile server via a TileJSON endpoint. */
|
|
172
|
+
static fromTilejson(options: FromTilejsonOptions): VPL;
|
|
173
|
+
/** Filter tiles by bounding box and/or zoom levels. */
|
|
174
|
+
filter(options?: FilterOptions): VPL;
|
|
175
|
+
/** Update metadata, see also <https://github.com/mapbox/tilejson-spec/tree/master/3.0.0> */
|
|
176
|
+
metaUpdate(options?: MetaUpdateOptions): VPL;
|
|
177
|
+
/** Generate lower-zoom DEM overview tiles by averaging 24-bit elevation values. */
|
|
178
|
+
demOverview(options?: DemOverviewOptions): VPL;
|
|
179
|
+
/** Quantize DEM (elevation) raster tiles by zeroing unnecessary low bits. */
|
|
180
|
+
demQuantize(options?: DemQuantizeOptions): VPL;
|
|
181
|
+
/** Flattens (translucent) raster tiles onto a background */
|
|
182
|
+
rasterFlatten(options?: RasterFlattenOptions): VPL;
|
|
183
|
+
/** Convert raster tiles to a different image format and/or adjust quality/speed settings. */
|
|
184
|
+
rasterFormat(options?: RasterFormatOptions): VPL;
|
|
185
|
+
/** Adjust brightness, contrast and gamma of raster tiles. */
|
|
186
|
+
rasterLevels(options?: RasterLevelsOptions): VPL;
|
|
187
|
+
/** Apply a polygon mask from GeoJSON to raster tiles. */
|
|
188
|
+
rasterMask(options: RasterMaskOptions): VPL;
|
|
189
|
+
/** Raster overscale operation - generates tiles beyond the source's native resolution. */
|
|
190
|
+
rasterOverscale(options?: RasterOverscaleOptions): VPL;
|
|
191
|
+
/** Generate lower-zoom overview tiles by downscaling from a base zoom level. */
|
|
192
|
+
rasterOverview(options?: RasterOverviewOptions): VPL;
|
|
193
|
+
/** Filters vector tile layers based on a comma-separated list of layer names. */
|
|
194
|
+
vectorFilterLayers(options: VectorFilterLayersOptions): VPL;
|
|
195
|
+
/** Filters properties based on a regular expressions. */
|
|
196
|
+
vectorFilterProperties(options: VectorFilterPropertiesOptions): VPL;
|
|
197
|
+
/** Arguments for the `vector_update_properties` operation. */
|
|
198
|
+
vectorUpdateProperties(options: VectorUpdatePropertiesOptions): VPL;
|
|
199
|
+
/** Serialize this VPL pipeline to a string. */
|
|
200
|
+
toString(): string;
|
|
201
|
+
/** Convert this VPL pipeline to a JSON-serializable array of steps. */
|
|
202
|
+
toJSON(): object[];
|
|
203
|
+
/** Execute this VPL pipeline and return a TileSource. */
|
|
204
|
+
open(dir?: string): Promise<TileSource>;
|
|
205
|
+
}
|
package/vpl.js
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
2
|
+
// Generated from Rust VPL operation metadata
|
|
3
|
+
import { TileSource } from './index.js';
|
|
4
|
+
function serializeParam(key, value) {
|
|
5
|
+
if (typeof value === 'boolean') {
|
|
6
|
+
return `${key}=${value}`;
|
|
7
|
+
}
|
|
8
|
+
if (typeof value === 'number') {
|
|
9
|
+
return `${key}=${value}`;
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(value)) {
|
|
12
|
+
return `${key}=[${value.join(',')}]`;
|
|
13
|
+
}
|
|
14
|
+
const str = String(value);
|
|
15
|
+
if (/^[a-zA-Z0-9._-]+$/.test(str)) {
|
|
16
|
+
return `${key}=${str}`;
|
|
17
|
+
}
|
|
18
|
+
return `${key}="${str.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
19
|
+
}
|
|
20
|
+
export class VPL {
|
|
21
|
+
steps;
|
|
22
|
+
constructor(steps) {
|
|
23
|
+
this.steps = steps;
|
|
24
|
+
}
|
|
25
|
+
/** Generates solid-color tiles of the specified size and format. */
|
|
26
|
+
static fromColor(options) {
|
|
27
|
+
const params = {};
|
|
28
|
+
if (options?.color !== undefined)
|
|
29
|
+
params['color'] = options?.color;
|
|
30
|
+
if (options?.size !== undefined)
|
|
31
|
+
params['size'] = options?.size;
|
|
32
|
+
if (options?.format !== undefined)
|
|
33
|
+
params['format'] = options?.format;
|
|
34
|
+
return new VPL([{ name: 'from_color', params }]);
|
|
35
|
+
}
|
|
36
|
+
/** Reads a tile container, such as a `*.versatiles`, `*.mbtiles`, `*.pmtiles` or `*.tar` file. */
|
|
37
|
+
static fromContainer(options) {
|
|
38
|
+
const params = {};
|
|
39
|
+
params['filename'] = options.filename;
|
|
40
|
+
return new VPL([{ name: 'from_container', params }]);
|
|
41
|
+
}
|
|
42
|
+
/** Generates debug tiles that display their coordinates as text. */
|
|
43
|
+
static fromDebug(options) {
|
|
44
|
+
const params = {};
|
|
45
|
+
if (options?.format !== undefined)
|
|
46
|
+
params['format'] = options?.format;
|
|
47
|
+
return new VPL([{ name: 'from_debug', params }]);
|
|
48
|
+
}
|
|
49
|
+
/** Merges multiple vector tile sources. */
|
|
50
|
+
static fromMergedVector(sources) {
|
|
51
|
+
const params = {};
|
|
52
|
+
return new VPL([{ name: 'from_merged_vector', params, sources }]);
|
|
53
|
+
}
|
|
54
|
+
/** Overlays multiple raster tile sources on top of each other. */
|
|
55
|
+
static fromStackedRaster(sources, options) {
|
|
56
|
+
const params = {};
|
|
57
|
+
if (options?.format !== undefined)
|
|
58
|
+
params['format'] = options?.format;
|
|
59
|
+
if (options?.autoOverscale !== undefined)
|
|
60
|
+
params['auto_overscale'] = options?.autoOverscale;
|
|
61
|
+
return new VPL([{ name: 'from_stacked_raster', params, sources }]);
|
|
62
|
+
}
|
|
63
|
+
/** Overlays multiple tile sources, using the tile from the first source that provides it. */
|
|
64
|
+
static fromStacked(sources) {
|
|
65
|
+
const params = {};
|
|
66
|
+
return new VPL([{ name: 'from_stacked', params, sources }]);
|
|
67
|
+
}
|
|
68
|
+
/** Reads a single tile file and uses it as a template for all tile requests. */
|
|
69
|
+
static fromTile(options) {
|
|
70
|
+
const params = {};
|
|
71
|
+
params['filename'] = options.filename;
|
|
72
|
+
return new VPL([{ name: 'from_tile', params }]);
|
|
73
|
+
}
|
|
74
|
+
/** Reads tiles from a remote tile server via a TileJSON endpoint. */
|
|
75
|
+
static fromTilejson(options) {
|
|
76
|
+
const params = {};
|
|
77
|
+
params['url'] = options.url;
|
|
78
|
+
if (options.maxRetries !== undefined)
|
|
79
|
+
params['max_retries'] = options.maxRetries;
|
|
80
|
+
if (options.maxConcurrentRequests !== undefined)
|
|
81
|
+
params['max_concurrent_requests'] = options.maxConcurrentRequests;
|
|
82
|
+
return new VPL([{ name: 'from_tilejson', params }]);
|
|
83
|
+
}
|
|
84
|
+
/** Filter tiles by bounding box and/or zoom levels. */
|
|
85
|
+
filter(options) {
|
|
86
|
+
const params = {};
|
|
87
|
+
if (options?.bbox !== undefined)
|
|
88
|
+
params['bbox'] = options?.bbox;
|
|
89
|
+
if (options?.levelMin !== undefined)
|
|
90
|
+
params['level_min'] = options?.levelMin;
|
|
91
|
+
if (options?.levelMax !== undefined)
|
|
92
|
+
params['level_max'] = options?.levelMax;
|
|
93
|
+
return new VPL([...this.steps, { name: 'filter', params }]);
|
|
94
|
+
}
|
|
95
|
+
/** Update metadata, see also <https://github.com/mapbox/tilejson-spec/tree/master/3.0.0> */
|
|
96
|
+
metaUpdate(options) {
|
|
97
|
+
const params = {};
|
|
98
|
+
if (options?.attribution !== undefined)
|
|
99
|
+
params['attribution'] = options?.attribution;
|
|
100
|
+
if (options?.bounds !== undefined)
|
|
101
|
+
params['bounds'] = options?.bounds;
|
|
102
|
+
if (options?.center !== undefined)
|
|
103
|
+
params['center'] = options?.center;
|
|
104
|
+
if (options?.description !== undefined)
|
|
105
|
+
params['description'] = options?.description;
|
|
106
|
+
if (options?.fillzoom !== undefined)
|
|
107
|
+
params['fillzoom'] = options?.fillzoom;
|
|
108
|
+
if (options?.legend !== undefined)
|
|
109
|
+
params['legend'] = options?.legend;
|
|
110
|
+
if (options?.name !== undefined)
|
|
111
|
+
params['name'] = options?.name;
|
|
112
|
+
if (options?.schema !== undefined)
|
|
113
|
+
params['schema'] = options?.schema;
|
|
114
|
+
return new VPL([...this.steps, { name: 'meta_update', params }]);
|
|
115
|
+
}
|
|
116
|
+
/** Generate lower-zoom DEM overview tiles by averaging 24-bit elevation values. */
|
|
117
|
+
demOverview(options) {
|
|
118
|
+
const params = {};
|
|
119
|
+
if (options?.level !== undefined)
|
|
120
|
+
params['level'] = options?.level;
|
|
121
|
+
if (options?.tileSize !== undefined)
|
|
122
|
+
params['tile_size'] = options?.tileSize;
|
|
123
|
+
if (options?.encoding !== undefined)
|
|
124
|
+
params['encoding'] = options?.encoding;
|
|
125
|
+
return new VPL([...this.steps, { name: 'dem_overview', params }]);
|
|
126
|
+
}
|
|
127
|
+
/** Quantize DEM (elevation) raster tiles by zeroing unnecessary low bits. */
|
|
128
|
+
demQuantize(options) {
|
|
129
|
+
const params = {};
|
|
130
|
+
if (options?.resolutionRatio !== undefined)
|
|
131
|
+
params['resolution_ratio'] = options?.resolutionRatio;
|
|
132
|
+
if (options?.maxGradientError !== undefined)
|
|
133
|
+
params['max_gradient_error'] = options?.maxGradientError;
|
|
134
|
+
if (options?.encoding !== undefined)
|
|
135
|
+
params['encoding'] = options?.encoding;
|
|
136
|
+
return new VPL([...this.steps, { name: 'dem_quantize', params }]);
|
|
137
|
+
}
|
|
138
|
+
/** Flattens (translucent) raster tiles onto a background */
|
|
139
|
+
rasterFlatten(options) {
|
|
140
|
+
const params = {};
|
|
141
|
+
if (options?.color !== undefined)
|
|
142
|
+
params['color'] = options?.color;
|
|
143
|
+
return new VPL([...this.steps, { name: 'raster_flatten', params }]);
|
|
144
|
+
}
|
|
145
|
+
/** Convert raster tiles to a different image format and/or adjust quality/speed settings. */
|
|
146
|
+
rasterFormat(options) {
|
|
147
|
+
const params = {};
|
|
148
|
+
if (options?.format !== undefined)
|
|
149
|
+
params['format'] = options?.format;
|
|
150
|
+
if (options?.quality !== undefined)
|
|
151
|
+
params['quality'] = options?.quality;
|
|
152
|
+
if (options?.speed !== undefined)
|
|
153
|
+
params['speed'] = options?.speed;
|
|
154
|
+
return new VPL([...this.steps, { name: 'raster_format', params }]);
|
|
155
|
+
}
|
|
156
|
+
/** Adjust brightness, contrast and gamma of raster tiles. */
|
|
157
|
+
rasterLevels(options) {
|
|
158
|
+
const params = {};
|
|
159
|
+
if (options?.brightness !== undefined)
|
|
160
|
+
params['brightness'] = options?.brightness;
|
|
161
|
+
if (options?.contrast !== undefined)
|
|
162
|
+
params['contrast'] = options?.contrast;
|
|
163
|
+
if (options?.gamma !== undefined)
|
|
164
|
+
params['gamma'] = options?.gamma;
|
|
165
|
+
return new VPL([...this.steps, { name: 'raster_levels', params }]);
|
|
166
|
+
}
|
|
167
|
+
/** Apply a polygon mask from GeoJSON to raster tiles. */
|
|
168
|
+
rasterMask(options) {
|
|
169
|
+
const params = {};
|
|
170
|
+
params['geojson'] = options.geojson;
|
|
171
|
+
if (options.buffer !== undefined)
|
|
172
|
+
params['buffer'] = options.buffer;
|
|
173
|
+
if (options.blur !== undefined)
|
|
174
|
+
params['blur'] = options.blur;
|
|
175
|
+
if (options.blurFunction !== undefined)
|
|
176
|
+
params['blur_function'] = options.blurFunction;
|
|
177
|
+
return new VPL([...this.steps, { name: 'raster_mask', params }]);
|
|
178
|
+
}
|
|
179
|
+
/** Raster overscale operation - generates tiles beyond the source's native resolution. */
|
|
180
|
+
rasterOverscale(options) {
|
|
181
|
+
const params = {};
|
|
182
|
+
if (options?.levelBase !== undefined)
|
|
183
|
+
params['level_base'] = options?.levelBase;
|
|
184
|
+
if (options?.levelMax !== undefined)
|
|
185
|
+
params['level_max'] = options?.levelMax;
|
|
186
|
+
if (options?.enableClimbing !== undefined)
|
|
187
|
+
params['enable_climbing'] = options?.enableClimbing;
|
|
188
|
+
return new VPL([...this.steps, { name: 'raster_overscale', params }]);
|
|
189
|
+
}
|
|
190
|
+
/** Generate lower-zoom overview tiles by downscaling from a base zoom level. */
|
|
191
|
+
rasterOverview(options) {
|
|
192
|
+
const params = {};
|
|
193
|
+
if (options?.level !== undefined)
|
|
194
|
+
params['level'] = options?.level;
|
|
195
|
+
if (options?.tileSize !== undefined)
|
|
196
|
+
params['tile_size'] = options?.tileSize;
|
|
197
|
+
return new VPL([...this.steps, { name: 'raster_overview', params }]);
|
|
198
|
+
}
|
|
199
|
+
/** Filters vector tile layers based on a comma-separated list of layer names. */
|
|
200
|
+
vectorFilterLayers(options) {
|
|
201
|
+
const params = {};
|
|
202
|
+
params['filter'] = options.filter;
|
|
203
|
+
if (options.invert !== undefined)
|
|
204
|
+
params['invert'] = options.invert;
|
|
205
|
+
return new VPL([...this.steps, { name: 'vector_filter_layers', params }]);
|
|
206
|
+
}
|
|
207
|
+
/** Filters properties based on a regular expressions. */
|
|
208
|
+
vectorFilterProperties(options) {
|
|
209
|
+
const params = {};
|
|
210
|
+
params['regex'] = options.regex;
|
|
211
|
+
if (options.invert !== undefined)
|
|
212
|
+
params['invert'] = options.invert;
|
|
213
|
+
return new VPL([...this.steps, { name: 'vector_filter_properties', params }]);
|
|
214
|
+
}
|
|
215
|
+
/** Arguments for the `vector_update_properties` operation. */
|
|
216
|
+
vectorUpdateProperties(options) {
|
|
217
|
+
const params = {};
|
|
218
|
+
params['data_source_path'] = options.dataSourcePath;
|
|
219
|
+
params['layer_name'] = options.layerName;
|
|
220
|
+
params['id_field_tiles'] = options.idFieldTiles;
|
|
221
|
+
params['id_field_data'] = options.idFieldData;
|
|
222
|
+
if (options.replaceProperties !== undefined)
|
|
223
|
+
params['replace_properties'] = options.replaceProperties;
|
|
224
|
+
if (options.removeNonMatching !== undefined)
|
|
225
|
+
params['remove_non_matching'] = options.removeNonMatching;
|
|
226
|
+
if (options.includeId !== undefined)
|
|
227
|
+
params['include_id'] = options.includeId;
|
|
228
|
+
if (options.fieldSeparator !== undefined)
|
|
229
|
+
params['field_separator'] = options.fieldSeparator;
|
|
230
|
+
if (options.decimalSeparator !== undefined)
|
|
231
|
+
params['decimal_separator'] = options.decimalSeparator;
|
|
232
|
+
return new VPL([...this.steps, { name: 'vector_update_properties', params }]);
|
|
233
|
+
}
|
|
234
|
+
/** Serialize this VPL pipeline to a string. */
|
|
235
|
+
toString() {
|
|
236
|
+
return this.steps.map(step => {
|
|
237
|
+
let result = step.name;
|
|
238
|
+
if (step.sources && step.sources.length > 0) {
|
|
239
|
+
const pipelines = step.sources.map(s => s.toString());
|
|
240
|
+
result += ' [ ' + pipelines.join(', ') + ' ]';
|
|
241
|
+
}
|
|
242
|
+
for (const [key, value] of Object.entries(step.params)) {
|
|
243
|
+
result += ' ' + serializeParam(key, value);
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}).join(' | ');
|
|
247
|
+
}
|
|
248
|
+
/** Convert this VPL pipeline to a JSON-serializable array of steps. */
|
|
249
|
+
toJSON() {
|
|
250
|
+
return this.steps.map(step => {
|
|
251
|
+
const obj = { name: step.name, params: step.params };
|
|
252
|
+
if (step.sources && step.sources.length > 0) {
|
|
253
|
+
obj.sources = step.sources.map(s => s.toJSON());
|
|
254
|
+
}
|
|
255
|
+
return obj;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/** Execute this VPL pipeline and return a TileSource. */
|
|
259
|
+
async open(dir) {
|
|
260
|
+
return TileSource.fromPipeline(JSON.stringify(this.toJSON()), dir);
|
|
261
|
+
}
|
|
262
|
+
}
|