@basemaps/server 7.15.0 → 7.16.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.
@@ -135302,9 +135302,9 @@ var ulid3 = __toESM(require_index_umd(), 1);
135302
135302
  var CliInfo = {
135303
135303
  // Detect unlinked packages looks for this string since its a package name, slightly work around it
135304
135304
  package: "@basemaps/cli",
135305
- version: "v7.14.0-9-ga2fa0faa",
135306
- hash: "a2fa0faa57e5591a50900fd469dbb9637b7d9c8e",
135307
- buildId: "13911363896-1"
135305
+ version: "v7.15.1-10-g25fa7659",
135306
+ hash: "25fa7659b84a40205ceacda8b2ca5f48e1dc6f7b",
135307
+ buildId: "14319632927-1"
135308
135308
  };
135309
135309
  var CliDate = (/* @__PURE__ */ new Date()).toISOString();
135310
135310
  var CliId = ulid3.ulid();
@@ -136013,9 +136013,9 @@ var Router = class {
136013
136013
  };
136014
136014
 
136015
136015
  // ../../node_modules/@linzjs/lambda/build/src/function.js
136016
- var version2 = "v7.14.0-9-ga2fa0faa";
136017
- var hash = "a2fa0faa57e5591a50900fd469dbb9637b7d9c8e";
136018
- var buildId = "13911363896-1";
136016
+ var version2 = "v7.15.1-10-g25fa7659";
136017
+ var hash = "25fa7659b84a40205ceacda8b2ca5f48e1dc6f7b";
136018
+ var buildId = "14319632927-1";
136019
136019
  var versionInfo = { version: version2, hash, buildId };
136020
136020
  async function runFunction(req, fn) {
136021
136021
  if (!req.timer.timers.has("lambda"))
@@ -136350,14 +136350,20 @@ var SafeBuckets = /* @__PURE__ */ new Set([
136350
136350
  var SafeProtocols = /* @__PURE__ */ new Set([new URL("s3://foo").protocol, new URL("memory://foo.json").protocol]);
136351
136351
  var ConfigLoader = class {
136352
136352
  /** Exposed for testing */
136353
- static async getDefaultConfig() {
136353
+ static async getDefaultConfig(req) {
136354
136354
  const config = getDefaultConfig();
136355
- if (config.assets == null) {
136356
- const cb = await config.ConfigBundle.get(config.ConfigBundle.id("latest"));
136357
- if (cb)
136358
- config.assets = cb.assets;
136359
- }
136360
- return config;
136355
+ const cb = await config.ConfigBundle.get("cb_latest");
136356
+ if (cb == null)
136357
+ return config;
136358
+ req?.timer.start("config:load");
136359
+ return CachedConfig.get(Fsa.toUrl(cb.path)).then((cfg) => {
136360
+ req?.timer.end("config:load");
136361
+ if (cfg == null)
136362
+ throw new LambdaHttpResponse(500, "Unable to find latest configuration");
136363
+ if (cfg.assets == null)
136364
+ cfg.assets = cb.assets;
136365
+ return cfg;
136366
+ });
136361
136367
  }
136362
136368
  /** Lookup the config path from a request and return a standardized location */
136363
136369
  static extract(req) {
@@ -136672,6 +136678,8 @@ var Validate = {
136672
136678
  * Defaults to standard image format output if no outputs are defined on the tileset
136673
136679
  */
136674
136680
  pipeline(tileSet, tileType, pipeline2) {
136681
+ if (tileSet.outputs?.length === 1 && pipeline2 == null)
136682
+ pipeline2 = tileSet.outputs[0].name;
136675
136683
  if (pipeline2 != null && pipeline2 !== "rgba") {
136676
136684
  if (tileSet.outputs == null)
136677
136685
  throw new LambdaHttpResponse(404, "TileSet has no pipelines");
@@ -138423,7 +138431,7 @@ function cropResize(tiff, data, comp, mode) {
138423
138431
  const cropVal = comp.crop;
138424
138432
  if (cropVal == null)
138425
138433
  return data;
138426
- return applyCrop(tiff, data, cropVal);
138434
+ return applyCrop(data, cropVal);
138427
138435
  }
138428
138436
  if (data.channels !== 1)
138429
138437
  throw new Error("Unable to crop-resize more than one channel got:" + data.channels);
@@ -138459,14 +138467,14 @@ function cropResize(tiff, data, comp, mode) {
138459
138467
  throw new Error("Unable to use resize kernel: " + mode);
138460
138468
  }
138461
138469
  }
138462
- function applyCrop(_tiff, data, crop) {
138463
- const output = new Float32Array(crop.width * crop.height * data.channels);
138470
+ function applyCrop(data, crop) {
138471
+ const output = getOutputBuffer(data, { width: crop.width, height: crop.height });
138464
138472
  for (let y = 0; y < crop.height; y++) {
138465
138473
  const source = ((y + crop.y) * data.width + crop.x) * data.channels;
138466
138474
  const length = crop.width * data.channels;
138467
- output.set(data.pixels.subarray(source, source + length), y * crop.width);
138475
+ output.pixels.set(data.pixels.subarray(source, source + length), y * crop.width);
138468
138476
  }
138469
- return { pixels: output, width: crop.width, height: crop.height, channels: data.channels, depth: "float32" };
138477
+ return output;
138470
138478
  }
138471
138479
  function resizeNearest(data, comp, source, target) {
138472
138480
  const maxWidth = Math.min(comp.source.width, data.width) - 1;
@@ -138564,9 +138572,21 @@ function resizeBilinear(data, comp, source, target, noData) {
138564
138572
  return ret;
138565
138573
  }
138566
138574
 
138567
- // ../tiler-sharp/build/pipeline/pipeline.color.ramp.js
138575
+ // ../tiler-sharp/build/pipeline/colorize/color.ramp.js
138568
138576
  var ColorRamp = class {
138569
138577
  constructor(ramp) {
138578
+ Object.defineProperty(this, "min", {
138579
+ enumerable: true,
138580
+ configurable: true,
138581
+ writable: true,
138582
+ value: void 0
138583
+ });
138584
+ Object.defineProperty(this, "max", {
138585
+ enumerable: true,
138586
+ configurable: true,
138587
+ writable: true,
138588
+ value: void 0
138589
+ });
138570
138590
  Object.defineProperty(this, "ramps", {
138571
138591
  enumerable: true,
138572
138592
  configurable: true,
@@ -138579,38 +138599,89 @@ var ColorRamp = class {
138579
138599
  const numbers = parts.map(Number);
138580
138600
  this.ramps.push({ v: numbers[0], color: numbers.slice(1) });
138581
138601
  }
138602
+ this.min = this.ramps[0].v;
138603
+ this.max = this.ramps[this.ramps.length - 1].v;
138582
138604
  }
138583
- get(num) {
138584
- const first = this.ramps[0];
138585
- if (num <= first.v)
138586
- return first.color;
138605
+ set(val2, data, targetOffset) {
138606
+ if (val2 <= this.min) {
138607
+ const color = this.ramps[0].color;
138608
+ data[targetOffset] = color[0];
138609
+ data[targetOffset + 1] = color[1];
138610
+ data[targetOffset + 2] = color[2];
138611
+ data[targetOffset + 3] = color[3];
138612
+ return;
138613
+ } else if (val2 >= this.max) {
138614
+ const color = this.ramps[this.ramps.length - 1].color;
138615
+ data[targetOffset] = color[0];
138616
+ data[targetOffset + 1] = color[1];
138617
+ data[targetOffset + 2] = color[2];
138618
+ data[targetOffset + 3] = color[3];
138619
+ return;
138620
+ }
138587
138621
  for (let i = 0; i < this.ramps.length - 1; i++) {
138588
138622
  const ramp = this.ramps[i];
138589
- if (num < ramp.v)
138623
+ if (val2 < ramp.v)
138590
138624
  continue;
138591
- if (ramp.v === num)
138592
- return ramp.color;
138625
+ if (ramp.v === val2) {
138626
+ const color = ramp.color;
138627
+ data[targetOffset] = color[0];
138628
+ data[targetOffset + 1] = color[1];
138629
+ data[targetOffset + 2] = color[2];
138630
+ data[targetOffset + 3] = color[3];
138631
+ return;
138632
+ }
138593
138633
  const rampNext = this.ramps[i + 1];
138594
- if (num >= rampNext.v)
138634
+ if (val2 >= rampNext.v)
138595
138635
  continue;
138596
138636
  const range = rampNext.v - ramp.v;
138597
- const offset = num - ramp.v;
138637
+ const offset = val2 - ramp.v;
138598
138638
  const scale = offset / range;
138599
138639
  const r = Math.round((rampNext.color[0] - ramp.color[0]) * scale + ramp.color[0]);
138600
138640
  const g = Math.round((rampNext.color[1] - ramp.color[1]) * scale + ramp.color[1]);
138601
138641
  const b = Math.round((rampNext.color[2] - ramp.color[2]) * scale + ramp.color[2]);
138602
138642
  const a = Math.round((rampNext.color[3] - ramp.color[3]) * scale + ramp.color[3]);
138603
- return [r, g, b, a];
138643
+ data[targetOffset] = r;
138644
+ data[targetOffset + 1] = g;
138645
+ data[targetOffset + 2] = b;
138646
+ data[targetOffset + 3] = a;
138647
+ return;
138604
138648
  }
138605
- return this.ramps[this.ramps.length - 1].color;
138649
+ throw new Error("Ramp value assertion failure");
138650
+ }
138651
+ };
138652
+
138653
+ // ../tiler-sharp/build/pipeline/colorize/grey.scale.js
138654
+ var GreyScale = class {
138655
+ constructor(minVal, maxVal) {
138656
+ Object.defineProperty(this, "min", {
138657
+ enumerable: true,
138658
+ configurable: true,
138659
+ writable: true,
138660
+ value: void 0
138661
+ });
138662
+ Object.defineProperty(this, "max", {
138663
+ enumerable: true,
138664
+ configurable: true,
138665
+ writable: true,
138666
+ value: void 0
138667
+ });
138668
+ this.min = minVal;
138669
+ this.max = maxVal;
138670
+ }
138671
+ set(val2, data, targetOffset) {
138672
+ const scaledValue = (val2 - this.min) * 255 / (this.max - this.min);
138673
+ data[targetOffset] = scaledValue;
138674
+ data[targetOffset + 1] = scaledValue;
138675
+ data[targetOffset + 2] = scaledValue;
138676
+ data[targetOffset + 3] = 255;
138606
138677
  }
138607
138678
  };
138679
+
138680
+ // ../tiler-sharp/build/pipeline/pipeline.color.ramp.js
138608
138681
  var Ramps = {
138609
138682
  float32: new ColorRamp(DefaultColorRamp),
138610
- uint8: new ColorRamp(`0 0 0 0 255
138611
- 255 255 255 255 255`),
138612
- uint32: new ColorRamp(`0 0 0 0 255
138613
- ${2 ** 32 - 1} 255 255 255 255`)
138683
+ uint8: new GreyScale(0, 255),
138684
+ uint32: new GreyScale(0, 2 ** 32 - 1)
138614
138685
  };
138615
138686
  var PipelineColorRamp = {
138616
138687
  type: "color-ramp",
@@ -138632,11 +138703,7 @@ var PipelineColorRamp = {
138632
138703
  if (noData != null && px === noData)
138633
138704
  continue;
138634
138705
  const target = i * 4;
138635
- const color = ramp.get(px);
138636
- raw[target + 0] = color[0];
138637
- raw[target + 1] = color[1];
138638
- raw[target + 2] = color[2];
138639
- raw[target + 3] = color[3];
138706
+ ramp.set(px, raw, target);
138640
138707
  }
138641
138708
  return output;
138642
138709
  }
@@ -140359,17 +140426,17 @@ function versionGet() {
140359
140426
  * last git version tag
140360
140427
  * @example "v6.42.1"
140361
140428
  */
140362
- version: "v7.14.0-9-ga2fa0faa",
140429
+ version: "v7.15.1-10-g25fa7659",
140363
140430
  /**
140364
140431
  * Full git commit hash
140365
140432
  * @example "e4231b1ee62c276c8657c56677ced02681dfe5d6"
140366
140433
  */
140367
- hash: "a2fa0faa57e5591a50900fd469dbb9637b7d9c8e",
140434
+ hash: "25fa7659b84a40205ceacda8b2ca5f48e1dc6f7b",
140368
140435
  /**
140369
140436
  * The exact build that this release was run from
140370
140437
  * @example "1658821493-3"
140371
140438
  */
140372
- buildId: "13911363896-1"
140439
+ buildId: "14319632927-1"
140373
140440
  });
140374
140441
  return Promise.resolve(response);
140375
140442
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/server",
3
- "version": "7.15.0",
3
+ "version": "7.16.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/linz/basemaps.git",
@@ -52,17 +52,17 @@
52
52
  "sharp": "^0.33.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@basemaps/config": "^7.15.0",
56
- "@basemaps/config-loader": "^7.15.0",
57
- "@basemaps/geo": "^7.15.0",
58
- "@basemaps/lambda-tiler": "^7.15.0",
55
+ "@basemaps/config": "^7.16.0",
56
+ "@basemaps/config-loader": "^7.16.0",
57
+ "@basemaps/geo": "^7.16.0",
58
+ "@basemaps/lambda-tiler": "^7.16.0",
59
59
  "@basemaps/landing": "^6.39.0",
60
- "@basemaps/shared": "^7.15.0",
60
+ "@basemaps/shared": "^7.16.0",
61
61
  "@fastify/formbody": "^7.0.1",
62
62
  "@fastify/static": "^6.5.0",
63
63
  "cmd-ts": "^0.12.1",
64
64
  "fastify": "^4.9.2",
65
65
  "pretty-json-log": "^1.0.0"
66
66
  },
67
- "gitHead": "a2fa0faa57e5591a50900fd469dbb9637b7d9c8e"
67
+ "gitHead": "25fa7659b84a40205ceacda8b2ca5f48e1dc6f7b"
68
68
  }