@superrouteca/smap 1.2.1 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.2 — 2026-10-29
4
+
5
+ - Plan editor: opening a distance snapshot sends the plan's points (every job location and vehicle start and end), so
6
+ the legs between them are measured ahead and edits are answered faster. Nothing to change in your code; servers
7
+ that do not read the points work as before.
8
+
3
9
  ## 1.2.1 — 2026-10-28
4
10
 
5
11
  - Pins: the number and the count badge are drawn into each pin at every zoom, so where pins overlap the upper pin
package/README.md CHANGED
@@ -450,8 +450,8 @@ editor.destroy();
450
450
  fast path may appear or go). `state().path` and the `change` event's `path` say where the last answer came from
451
451
  (`'fast'` or `'standard'`); `fastPath: false` keeps every call on the standard path. The snapshot works on both
452
452
  paths with the same id.
453
- - **Distance snapshot**: the editor opens one (`POST /v1/plan/matrix`) and names it in every call, so legs measured
454
- once are not measured again. When an answer says the snapshot expired (`X-Plan-Matrix: expired`, or a `410`), it
453
+ - **Distance snapshot**: the editor opens one (`POST /v1/plan/matrix`, with the plan's points so the legs between
454
+ them can be measured ahead) and names it in every call, so legs measured once are not measured again. When an answer says the snapshot expired (`X-Plan-Matrix: expired`, or a `410`), it
455
455
  opens a new one and carries on; a snapshot that cannot be opened never stops an edit. `destroy()` closes it.
456
456
  - **Calls in flight**: a newer edit cancels the call before it. An edit you can see the outcome of (a move, an order,
457
457
  a removal) is drawn at once and priced when the answer arrives; `pending` in the `change` event says it is not
package/dist/SOURCE.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
- "sdkVersion": "1.2.1",
2
+ "sdkVersion": "1.2.2",
3
3
  "engine": "maplibre-gl 6.16.0",
4
4
  "files": {
5
- "smap.js": "bbce8821ec3564f5fc7498b0e7973636e98650e956d94a51a2dbd2259b71b89b",
5
+ "smap.js": "b5c9dae63b6999dbc28ec9ae76a828e1cfd061a6c2acb157f631e75786c26367",
6
6
  "smap.css": "9bc4b14821de97da199e6af4f18541eeaf53a2ae91e5831e7224f57fe6b77660",
7
- "smap-client.js": "5c769f3f9e4e82d3e7c25bfbd8b91f85f106161f65328fe6eaf19eab6561e897",
7
+ "smap-client.js": "169f1b6efc7241404be51e21e40238b20098b471f7d560809a7a4cfde5116f5a",
8
8
  "smap-client.d.ts": "5f0df11bf60c5a9ced34522a284de81260c27871678ab772f16da9ccf6883f58",
9
- "smap.mjs": "8edb30186a60969440415b75f6b14b04eea317dc83637dc49e1757ded0c9b0de",
10
- "smap.cjs": "5bfc4ff01ed19e861ffde2b908f5509c774912fe4d305c6f8269cb4d9f7eeb69",
11
- "smap-client.cjs": "13a379343810b63bdaa060499d63844e133d28c00649811dcfe107b5dfbabb53",
12
- "smap-client.mjs": "58f6aa8cb2cec09569606b088247b0e7803cdf225d5ceb733ae3115572a36241",
9
+ "smap.mjs": "9f2e3dc715d33b647475d6082a39843a5f5acf683d45f2a8373c0e5a361c4092",
10
+ "smap.cjs": "6e51c2b7df527b09a77cc551d4d7c8c06a7f884333d920c7c2009029cea41890",
11
+ "smap-client.cjs": "0328f85f3313d55b3a120b123dea5a1f319fceaa42b3321ff9122c6b15ed31bf",
12
+ "smap-client.mjs": "b649b0ff23677164ccca36122ddc244689d6dfbd8cb69604ce245304c13b06cd",
13
13
  "smap-client.d.cts": "e0fe4eb54cd66b831116082f42bd2f7de260f9f12a2741f4004f8cf10c252116",
14
14
  "smap-client.d.mts": "96830d316ddb33b4ff8edb8b6f810337479636114f75c4170d95038ffda74103",
15
15
  "vendor-licenses.txt": "ee5fc05a0677eaf69601d2c7db0d9ecd6cc27c3abc1d0733bc9ed34707cf8ef2"
@@ -1,5 +1,5 @@
1
1
  /* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
2
- /*! sMap JS client 1.2.1 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
2
+ /*! sMap JS client 1.2.2 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
3
3
  /*
4
4
  * Runs wherever `fetch` exists: browsers, Node.js 18+, workers; elsewhere (mini programs, older runtimes) pass your
5
5
  * own `fetch`. UMD: `window.SMapClient`, `require('smap-client')`, or an AMD module.
@@ -19,7 +19,7 @@
19
19
  }(typeof self !== 'undefined' ? self : this, function () {
20
20
  'use strict';
21
21
 
22
- var VERSION = '1.2.1';
22
+ var VERSION = '1.2.2';
23
23
  var NODE_TTL = 3600 * 1000; // the measured order
24
24
  var KNOWN_TTL = 30 * 86400 * 1000; // the last node list received, used when none can be read
25
25
 
@@ -1,4 +1,4 @@
1
- /*! sMap JS client 1.2.1 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
1
+ /*! sMap JS client 1.2.2 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
2
2
  /*
3
3
  * Runs wherever `fetch` exists: browsers, Node.js 18+, workers; elsewhere (mini programs, older runtimes) pass your
4
4
  * own `fetch`. UMD: `window.SMapClient`, `require('smap-client')`, or an AMD module.
@@ -18,7 +18,7 @@
18
18
  }(typeof self !== 'undefined' ? self : this, function () {
19
19
  'use strict';
20
20
 
21
- var VERSION = '1.2.1';
21
+ var VERSION = '1.2.2';
22
22
  var NODE_TTL = 3600 * 1000; // the measured order
23
23
  var KNOWN_TTL = 30 * 86400 * 1000; // the last node list received, used when none can be read
24
24
 
@@ -1,7 +1,7 @@
1
1
  /* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
2
2
  var smapClientModule = { exports: {} };
3
3
  (function (module, exports, define) {
4
- /*! sMap JS client 1.2.1 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
4
+ /*! sMap JS client 1.2.2 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
5
5
  /*
6
6
  * Runs wherever `fetch` exists: browsers, Node.js 18+, workers; elsewhere (mini programs, older runtimes) pass your
7
7
  * own `fetch`. UMD: `window.SMapClient`, `require('smap-client')`, or an AMD module.
@@ -21,7 +21,7 @@ var smapClientModule = { exports: {} };
21
21
  }(typeof self !== 'undefined' ? self : this, function () {
22
22
  'use strict';
23
23
 
24
- var VERSION = '1.2.1';
24
+ var VERSION = '1.2.2';
25
25
  var NODE_TTL = 3600 * 1000; // the measured order
26
26
  var KNOWN_TTL = 30 * 86400 * 1000; // the last node list received, used when none can be read
27
27
 
package/dist/smap.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
2
2
  'use strict';
3
- /*! sMap Web SDK 1.2.1. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
3
+ /*! sMap Web SDK 1.2.2. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
4
4
 
5
5
  var smapCore = null;
6
6
  function smapCreateEngine() {
@@ -30757,6 +30757,9 @@ function smapCreatePlan() {
30757
30757
  var body = {};
30758
30758
  if (this._context.region) { body.region = this._context.region; }
30759
30759
  if (this._context.profile) { body.profile = this._context.profile; }
30760
+ // The plan's points, so the server can measure their legs into the snapshot ahead of the edits (E24).
30761
+ var points = this._points();
30762
+ if (points.length) { body.points = points; }
30760
30763
  this._openingKey = key;
30761
30764
  var opening = this._transport.send('POST', PATHS.matrix, body).then(function (res) {
30762
30765
  var id = res.data && res.data.matrix;
@@ -30781,6 +30784,27 @@ function smapCreatePlan() {
30781
30784
  return opening;
30782
30785
  };
30783
30786
 
30787
+ // The plan's points as a snapshot opening sends them: every job location, then every vehicle's start and end, exactly
30788
+ // as the plan holds them (the numbers the plan calls send, since legs are matched exactly), each sent once, first seen
30789
+ // first.
30790
+ PlanEditor.prototype._points = function () {
30791
+ var entry = this._history[this._at];
30792
+ var out = [];
30793
+ var seen = {};
30794
+ function add(v) {
30795
+ var ll = lngLat(v);
30796
+ if (!ll || !isFinite(ll[0]) || !isFinite(ll[1])) { return; }
30797
+ var p = { lat: ll[1], lng: ll[0] };
30798
+ var k = p.lat + ',' + p.lng;
30799
+ if (seen[k]) { return; }
30800
+ seen[k] = true;
30801
+ out.push(p);
30802
+ }
30803
+ ((entry && entry.jobs) || []).forEach(function (j) { add(j && j.location); });
30804
+ (this._vehicles || []).forEach(function (v) { if (v) { add(v.start); add(v.end); } });
30805
+ return out;
30806
+ };
30807
+
30784
30808
  // ------------------------------------------------------------------ texts (14 languages)
30785
30809
 
30786
30810
  var TEXT_KEYS = ['editor', 'busy', 'undo', 'redo', 'refine', 'total', 'distance', 'drivingTime', 'stops', 'violations',
@@ -31590,7 +31614,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
31590
31614
  })(typeof self !== 'undefined' ? self : this, function (engine, interop, canvasLib, plan) {
31591
31615
  'use strict';
31592
31616
 
31593
- var VERSION = '1.2.1';
31617
+ var VERSION = '1.2.2';
31594
31618
  var FLAVORS = ['light', 'white', 'grayscale', 'dark', 'black'];
31595
31619
  var BASEMAP_SOURCE = 'basemap';
31596
31620
  var BUILDINGS_LAYER = 'smap-buildings-3d';
@@ -35773,7 +35797,7 @@ function SMapMap(options) {
35773
35797
  SMapMap.prototype = core.Map.prototype;
35774
35798
  return new core.Map(options);
35775
35799
  }
35776
- var smapVersion = "1.2.1";
35800
+ var smapVersion = "1.2.2";
35777
35801
  var smapStyles = ['light', 'white', 'grayscale', 'dark', 'black'];
35778
35802
  /** The bundled rendering engine, for anything the SDK does not wrap (loaded on the first call). */
35779
35803
  function smapGetEngine() { return smapLoad().engine; }
package/dist/smap.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! sMap Web SDK 1.2.1. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
1
+ /*! sMap Web SDK 1.2.2. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
2
2
  (function () {
3
3
  function smapCreateEngine() {
4
4
  var SMAP_BASE_URL = (typeof document !== 'undefined' && document.baseURI) || (typeof location !== 'undefined' && location.href) || 'about:blank';
@@ -30754,6 +30754,9 @@ function smapCreatePlan() {
30754
30754
  var body = {};
30755
30755
  if (this._context.region) { body.region = this._context.region; }
30756
30756
  if (this._context.profile) { body.profile = this._context.profile; }
30757
+ // The plan's points, so the server can measure their legs into the snapshot ahead of the edits (E24).
30758
+ var points = this._points();
30759
+ if (points.length) { body.points = points; }
30757
30760
  this._openingKey = key;
30758
30761
  var opening = this._transport.send('POST', PATHS.matrix, body).then(function (res) {
30759
30762
  var id = res.data && res.data.matrix;
@@ -30778,6 +30781,27 @@ function smapCreatePlan() {
30778
30781
  return opening;
30779
30782
  };
30780
30783
 
30784
+ // The plan's points as a snapshot opening sends them: every job location, then every vehicle's start and end, exactly
30785
+ // as the plan holds them (the numbers the plan calls send, since legs are matched exactly), each sent once, first seen
30786
+ // first.
30787
+ PlanEditor.prototype._points = function () {
30788
+ var entry = this._history[this._at];
30789
+ var out = [];
30790
+ var seen = {};
30791
+ function add(v) {
30792
+ var ll = lngLat(v);
30793
+ if (!ll || !isFinite(ll[0]) || !isFinite(ll[1])) { return; }
30794
+ var p = { lat: ll[1], lng: ll[0] };
30795
+ var k = p.lat + ',' + p.lng;
30796
+ if (seen[k]) { return; }
30797
+ seen[k] = true;
30798
+ out.push(p);
30799
+ }
30800
+ ((entry && entry.jobs) || []).forEach(function (j) { add(j && j.location); });
30801
+ (this._vehicles || []).forEach(function (v) { if (v) { add(v.start); add(v.end); } });
30802
+ return out;
30803
+ };
30804
+
30781
30805
  // ------------------------------------------------------------------ texts (14 languages)
30782
30806
 
30783
30807
  var TEXT_KEYS = ['editor', 'busy', 'undo', 'redo', 'refine', 'total', 'distance', 'drivingTime', 'stops', 'violations',
@@ -31587,7 +31611,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
31587
31611
  })(typeof self !== 'undefined' ? self : this, function (engine, interop, canvasLib, plan) {
31588
31612
  'use strict';
31589
31613
 
31590
- var VERSION = '1.2.1';
31614
+ var VERSION = '1.2.2';
31591
31615
  var FLAVORS = ['light', 'white', 'grayscale', 'dark', 'black'];
31592
31616
  var BASEMAP_SOURCE = 'basemap';
31593
31617
  var BUILDINGS_LAYER = 'smap-buildings-3d';
package/dist/smap.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
2
- /*! sMap Web SDK 1.2.1. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
2
+ /*! sMap Web SDK 1.2.2. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
3
3
 
4
4
  var smapCore = null;
5
5
  function smapCreateEngine() {
@@ -30756,6 +30756,9 @@ function smapCreatePlan() {
30756
30756
  var body = {};
30757
30757
  if (this._context.region) { body.region = this._context.region; }
30758
30758
  if (this._context.profile) { body.profile = this._context.profile; }
30759
+ // The plan's points, so the server can measure their legs into the snapshot ahead of the edits (E24).
30760
+ var points = this._points();
30761
+ if (points.length) { body.points = points; }
30759
30762
  this._openingKey = key;
30760
30763
  var opening = this._transport.send('POST', PATHS.matrix, body).then(function (res) {
30761
30764
  var id = res.data && res.data.matrix;
@@ -30780,6 +30783,27 @@ function smapCreatePlan() {
30780
30783
  return opening;
30781
30784
  };
30782
30785
 
30786
+ // The plan's points as a snapshot opening sends them: every job location, then every vehicle's start and end, exactly
30787
+ // as the plan holds them (the numbers the plan calls send, since legs are matched exactly), each sent once, first seen
30788
+ // first.
30789
+ PlanEditor.prototype._points = function () {
30790
+ var entry = this._history[this._at];
30791
+ var out = [];
30792
+ var seen = {};
30793
+ function add(v) {
30794
+ var ll = lngLat(v);
30795
+ if (!ll || !isFinite(ll[0]) || !isFinite(ll[1])) { return; }
30796
+ var p = { lat: ll[1], lng: ll[0] };
30797
+ var k = p.lat + ',' + p.lng;
30798
+ if (seen[k]) { return; }
30799
+ seen[k] = true;
30800
+ out.push(p);
30801
+ }
30802
+ ((entry && entry.jobs) || []).forEach(function (j) { add(j && j.location); });
30803
+ (this._vehicles || []).forEach(function (v) { if (v) { add(v.start); add(v.end); } });
30804
+ return out;
30805
+ };
30806
+
30783
30807
  // ------------------------------------------------------------------ texts (14 languages)
30784
30808
 
30785
30809
  var TEXT_KEYS = ['editor', 'busy', 'undo', 'redo', 'refine', 'total', 'distance', 'drivingTime', 'stops', 'violations',
@@ -31589,7 +31613,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
31589
31613
  })(typeof self !== 'undefined' ? self : this, function (engine, interop, canvasLib, plan) {
31590
31614
  'use strict';
31591
31615
 
31592
- var VERSION = '1.2.1';
31616
+ var VERSION = '1.2.2';
31593
31617
  var FLAVORS = ['light', 'white', 'grayscale', 'dark', 'black'];
31594
31618
  var BASEMAP_SOURCE = 'basemap';
31595
31619
  var BUILDINGS_LAYER = 'smap-buildings-3d';
@@ -35772,7 +35796,7 @@ function SMapMap(options) {
35772
35796
  SMapMap.prototype = core.Map.prototype;
35773
35797
  return new core.Map(options);
35774
35798
  }
35775
- var smapVersion = "1.2.1";
35799
+ var smapVersion = "1.2.2";
35776
35800
  var smapStyles = ['light', 'white', 'grayscale', 'dark', 'black'];
35777
35801
  /** The bundled rendering engine, for anything the SDK does not wrap (loaded on the first call). */
35778
35802
  function smapGetEngine() { return smapLoad().engine; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superrouteca/smap",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "sMap for the web: maps from Superroute's sMap service, the Web SDK (map view) and the JS client (tokens, nearest node, styles, tiles).",
5
5
  "license": "MIT",
6
6
  "author": "Goodneo Solutions",