@mailwoman/zoning 10.0.0 → 10.2.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.
Files changed (101) hide show
  1. package/README.md +169 -163
  2. package/lib/index.ts +103 -135
  3. package/lib/paths.ts +24 -0
  4. package/lib/ring-roles.ts +30 -71
  5. package/lib/rings.ts +2 -13
  6. package/lib/schema.ts +98 -139
  7. package/lib/vocabulary.ts +52 -130
  8. package/out/index.d.ts +81 -101
  9. package/out/index.d.ts.map +1 -1
  10. package/out/index.js +37 -96
  11. package/out/index.js.map +1 -1
  12. package/out/paths.d.ts +19 -0
  13. package/out/paths.d.ts.map +1 -0
  14. package/out/paths.js +21 -0
  15. package/out/paths.js.map +1 -0
  16. package/out/ring-roles.d.ts +16 -50
  17. package/out/ring-roles.d.ts.map +1 -1
  18. package/out/ring-roles.js +18 -51
  19. package/out/ring-roles.js.map +1 -1
  20. package/out/rings.d.ts +2 -13
  21. package/out/rings.d.ts.map +1 -1
  22. package/out/rings.js +2 -13
  23. package/out/rings.js.map +1 -1
  24. package/out/schema.d.ts +90 -132
  25. package/out/schema.d.ts.map +1 -1
  26. package/out/schema.js +17 -45
  27. package/out/schema.js.map +1 -1
  28. package/out/sdk/build-zoning.d.ts +58 -111
  29. package/out/sdk/build-zoning.d.ts.map +1 -1
  30. package/out/sdk/build-zoning.js +50 -139
  31. package/out/sdk/build-zoning.js.map +1 -1
  32. package/out/sdk/cells.d.ts +21 -62
  33. package/out/sdk/cells.d.ts.map +1 -1
  34. package/out/sdk/cells.js +15 -52
  35. package/out/sdk/cells.js.map +1 -1
  36. package/out/sdk/client.d.ts +23 -67
  37. package/out/sdk/client.d.ts.map +1 -1
  38. package/out/sdk/client.js +29 -77
  39. package/out/sdk/client.js.map +1 -1
  40. package/out/sdk/download.d.ts +7 -27
  41. package/out/sdk/download.d.ts.map +1 -1
  42. package/out/sdk/download.js +8 -28
  43. package/out/sdk/download.js.map +1 -1
  44. package/out/sdk/ingest/chunk.d.ts +19 -43
  45. package/out/sdk/ingest/chunk.d.ts.map +1 -1
  46. package/out/sdk/ingest/chunk.js +19 -52
  47. package/out/sdk/ingest/chunk.js.map +1 -1
  48. package/out/sdk/ingest/worker.d.ts +9 -0
  49. package/out/sdk/ingest/worker.d.ts.map +1 -0
  50. package/out/{scripts/ingest-chunk.js → sdk/ingest/worker.js} +8 -10
  51. package/out/sdk/ingest/worker.js.map +1 -0
  52. package/out/sdk/ingest.d.ts +152 -0
  53. package/out/sdk/ingest.d.ts.map +1 -0
  54. package/out/sdk/ingest.js +200 -0
  55. package/out/sdk/ingest.js.map +1 -0
  56. package/out/sdk/measure-resolutions.d.ts +7 -34
  57. package/out/sdk/measure-resolutions.d.ts.map +1 -1
  58. package/out/sdk/measure-resolutions.js +5 -23
  59. package/out/sdk/measure-resolutions.js.map +1 -1
  60. package/out/sdk/test-kit.d.ts +75 -0
  61. package/out/sdk/test-kit.d.ts.map +1 -0
  62. package/out/{test-kit.js → sdk/test-kit.js} +20 -43
  63. package/out/sdk/test-kit.js.map +1 -0
  64. package/out/sdk/verify.d.ts +79 -80
  65. package/out/sdk/verify.d.ts.map +1 -1
  66. package/out/sdk/verify.js +83 -70
  67. package/out/sdk/verify.js.map +1 -1
  68. package/out/vocabulary.d.ts +52 -120
  69. package/out/vocabulary.d.ts.map +1 -1
  70. package/out/vocabulary.js +47 -125
  71. package/out/vocabulary.js.map +1 -1
  72. package/package.json +38 -162
  73. package/{lib/sdk → sdk}/build-zoning.ts +102 -188
  74. package/{lib/sdk → sdk}/cells.ts +27 -66
  75. package/{lib/sdk → sdk}/client.ts +34 -82
  76. package/sdk/download.ts +58 -0
  77. package/{lib/sdk → sdk}/ingest/chunk.ts +36 -65
  78. package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +7 -9
  79. package/sdk/ingest.ts +354 -0
  80. package/sdk/measure-resolutions.ts +72 -0
  81. package/{lib → sdk}/test-kit.ts +21 -44
  82. package/sdk/verify.ts +367 -0
  83. package/lib/sdk/download.ts +0 -78
  84. package/lib/sdk/index.ts +0 -15
  85. package/lib/sdk/ingest/index.ts +0 -393
  86. package/lib/sdk/measure-resolutions.ts +0 -101
  87. package/lib/sdk/verify.ts +0 -357
  88. package/out/scripts/ingest-chunk.d.ts +0 -11
  89. package/out/scripts/ingest-chunk.d.ts.map +0 -1
  90. package/out/scripts/ingest-chunk.js.map +0 -1
  91. package/out/sdk/index.d.ts +0 -15
  92. package/out/sdk/index.d.ts.map +0 -1
  93. package/out/sdk/index.js +0 -15
  94. package/out/sdk/index.js.map +0 -1
  95. package/out/sdk/ingest/index.d.ts +0 -185
  96. package/out/sdk/ingest/index.d.ts.map +0 -1
  97. package/out/sdk/ingest/index.js +0 -232
  98. package/out/sdk/ingest/index.js.map +0 -1
  99. package/out/test-kit.d.ts +0 -96
  100. package/out/test-kit.d.ts.map +0 -1
  101. package/out/test-kit.js.map +0 -1
package/out/sdk/cells.js CHANGED
@@ -3,53 +3,26 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The cell index, and the measurement the index resolution is chosen from.
7
- *
8
- * THE CLASSIFIER ITSELF LIVES IN `@mailwoman/spatial`, re-exported below so this package's call sites and
9
- * its `@mailwoman/zoning/sdk/cells` subpath keep reading the same. `classifyFeatureCells`, the per-PART
10
- * zero-cell guard and the allocator-avoiding shortcuts around it are properties of h3-js rather than of
11
- * this product — the layer contract's polygon-builder section states them as requirements on EVERY polygon
12
- * builder — and a second copy of the zero-cell guard is a second place for it to stop guarding.
13
- *
14
- * WHAT THIS LAYER ADDS IS THE NUMBER THE RESOLUTION IS ACTUALLY CHOSEN FROM, AND IT IS NOT THE `partial`
15
- * SHARE. The inherited size contract picks a resolution from the measured `partial` share, and for this
16
- * subject that statistic carries no signal: computed over all 85,330 Irish features, the median zoning
17
- * polygon is 4,497 m² against an average res-9 cell of 105,333 m², so 95.7% of them are smaller than a cell
18
- * and the `partial` share is near 100% at every candidate. Two numbers do carry signal —
19
- * CANDIDATES PER CELL, which is how much geometry a probe reads, and the POLYFILL-ONLY ZERO-CELL COUNT,
20
- * which is how many features a centre-in-polygon index would have dropped — so both are measured here and
21
- * the `partial` share is reported beside them rather than in place of them.
22
- *
23
- * THE ZERO-CELL COUNT IS A MEASUREMENT OF THE ALTERNATIVE, NOT OF THIS INDEX. `classifyFeatureCells` takes
24
- * overlapping containment and REFUSES a feature that reaches no cell, so this index's own zero-cell count is
25
- * zero by construction. What the column reports is what `polygonToCells` — the centre-in-polygon polyfill a
26
- * builder reaches for first — would have returned nothing for, and every one of those would have read
27
- * downstream as an absence of zoning.
6
+ * The cell classifier lives in `@mailwoman/spatial`, and this layer adds the candidates-per-cell and polyfill-only zero-cell measurements the resolution is chosen from.
28
7
  */
29
8
  import { compactAcrossResolutions, shortCellToInt, } from "@mailwoman/spatial";
30
9
  import { polygonToCells } from "h3-js";
31
10
  /**
32
- * Would a CENTRE-IN-POLYGON polyfill return nothing for this feature?
33
- *
34
- * The measurement that forced this layer's index to take cell-touches-polygon: at resolution 9 `polygonToCells` returns
35
- * an empty set for the great majority of Irish zoning polygons, because no cell centre falls inside them. A builder
36
- * indexing only the polyfill output would drop every one of them silently.
11
+ * Whether a center-in-polygon polyfill would return no cell for this feature,
12
+ * the measurement that forced the index to take cell-touches-polygon.
37
13
  */
38
14
  export function polyfillFindsNothing(polygons, resolution) {
39
15
  for (const rings of polygons) {
40
- // `isGeoJSON = true`: the rings are already `[lon, lat]`, which is the order the ingest emits.
16
+ // `isGeoJSON = true`: the rings are already `[lon, lat]`.
41
17
  if (polygonToCells(rings, resolution, true).length)
42
18
  return false;
43
19
  }
44
20
  return true;
45
21
  }
46
22
  /**
47
- * Accumulate one resolution's cell index over a stream of features.
48
- *
49
- * The whole set is held as short-cell STRINGS rather than the integers the tables store, because `compactCells` is an
50
- * h3-js function over full indexes and round-tripping at every step would cost more than the strings do. The candidate
51
- * counter is keyed by the 48-bit INTEGER instead: it is the larger of the two at every candidate resolution, and it is
52
- * never handed back to h3.
23
+ * Accumulate one resolution's cell index over a stream of features, holding
24
+ * whole cells as short-cell strings and the candidate counter by 48-bit integer
25
+ * because `compactCells` is an h3-js function over full indexes.
53
26
  */
54
27
  export class ZoningCellIndex {
55
28
  resolution;
@@ -64,9 +37,6 @@ export class ZoningCellIndex {
64
37
  constructor(resolution) {
65
38
  this.resolution = resolution;
66
39
  }
67
- /**
68
- * Fold one feature's classification in.
69
- */
70
40
  add(cells) {
71
41
  this.#features++;
72
42
  if (cells.resolution !== this.resolution) {
@@ -84,9 +54,6 @@ export class ZoningCellIndex {
84
54
  this.#count(cell);
85
55
  }
86
56
  }
87
- /**
88
- * Record that a centre-in-polygon polyfill found nothing for one feature.
89
- */
90
57
  addPolyfillProbe(foundNothing) {
91
58
  this.#measuredPolyfill = true;
92
59
  if (foundNothing) {
@@ -96,10 +63,8 @@ export class ZoningCellIndex {
96
63
  /**
97
64
  * The measurement.
98
65
  *
99
- * The compacted count is an approximation of what the build stores and is reported as one: the build compacts each
100
- * FEATURE's whole set, while this compacts the union of them. The union can only compact at least as far, so this is
101
- * a lower bound on the stored row count — the direction a size estimate should err in — and the build's own receipt
102
- * reports the real number.
66
+ * Its compacted count is a lower bound on stored rows.
67
+ * The compaction uses the feature union rather than each feature.
103
68
  */
104
69
  finish() {
105
70
  const compacted = compactAcrossResolutions(this.#whole).length;
@@ -134,13 +99,14 @@ export class ZoningCellIndex {
134
99
  storedCellRows: compacted + partial,
135
100
  candidatesPerCell: {
136
101
  mean: touched ? total / touched : 0,
137
- // Nearest-rank p90 over the candidate counts, which is the shape `@mailwoman/core/stats` uses.
102
+ // Nearest-rank p90 over candidate counts.
103
+ // This matches `@mailwoman/core/stats`.
138
104
  p90: counts.length ? counts[Math.min(counts.length - 1, Math.ceil(0.9 * counts.length) - 1)] : 0,
139
105
  max,
140
106
  },
141
107
  multiCandidateCells: multi,
142
108
  multiCandidateShare: touched ? multi / touched : 0,
143
- ...(this.#measuredPolyfill ? { polyfillZeroCellFeatures: this.#polyfillZeroCell } : {}),
109
+ polyfillZeroCellFeatures: this.#measuredPolyfill ? this.#polyfillZeroCell : null,
144
110
  coarsenedFeatures: this.#coarsened,
145
111
  zeroCellFeatures: this.#zeroCell,
146
112
  };
@@ -151,18 +117,15 @@ export class ZoningCellIndex {
151
117
  }
152
118
  }
153
119
  /**
154
- * The measurement as markdown table ROWS — what a build receipt carries, one line per element so a caller printing them
155
- * never has to split a joined string back apart.
156
- *
157
- * THE ZERO-CELL COLUMN IS FIRST AFTER THE COUNTS, because it is the column the resolution is chosen on and the one a
158
- * reader most needs to see is not zero for the alternative index.
120
+ * The measurement as markdown table rows, one line per element, with the zero-cell column first
121
+ * after the counts because it is the column the resolution is chosen on.
159
122
  */
160
123
  export function formatResolutionRows(measurements) {
161
124
  return [
162
125
  "| res | features | polyfill-only zero-cell | stored cell rows | touched cells | candidates/cell mean | p90 | max | cells >1 candidate | partial share | coarsened |",
163
126
  "| --- | -------- | ----------------------- | ---------------- | ------------- | -------------------- | --- | --- | ------------------ | ------------- | --------- |",
164
127
  ...measurements.map((measurement) => `| ${measurement.resolution} | ${measurement.features.toLocaleString()} | ` +
165
- `${measurement.polyfillZeroCellFeatures === undefined
128
+ `${measurement.polyfillZeroCellFeatures === null
166
129
  ? "not measured"
167
130
  : `${measurement.polyfillZeroCellFeatures.toLocaleString()} (${((measurement.polyfillZeroCellFeatures / Math.max(1, measurement.features)) *
168
131
  100).toFixed(1)}%)`} | ` +
@@ -1 +1 @@
1
- {"version":3,"file":"cells.js","sourceRoot":"","sources":["../../lib/sdk/cells.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACN,wBAAwB,EACxB,cAAc,GAId,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B,EAAE,UAAk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,CAAA;AACF,CAAC"}
@@ -3,62 +3,35 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The Department's ArcGIS item, its feature service and the Hub download job, read through
7
- * {@linkcode APIClient}.
8
- *
9
- * THESE ARE API REQUESTS AND THEY GO THROUGH `APIClient`. Small bodies, repeated calls, a third-party
10
- * host — the pacing, bounded retry, response caching and `ResourceError` mapping are exactly what they
11
- * need. The 247 MB bulk export is NOT one of them: it is a file transfer, it streams to disk on raw
12
- * `fetch`, and `download.ts` says so in place.
13
- *
14
- * FOUR MEASURED CLIENT BEHAVIORS ARE ENCODED HERE RATHER THAN WRITTEN DOWN SOMEWHERE ELSE.
15
- *
16
- * 1. THE HUB DOWNLOAD JOB ANSWERS WITH A `resultUrl` THAT 302s. `…/api/download/v1/items/<id>/geojson?
17
- * redirect=false&layers=0` returns `{"status":"Completed","resultUrl":…}` in 249 bytes; the result URL
18
- * itself redirects, so the transfer needs `redirect: "follow"`. A client that took the first response as
19
- * the file writes a redirect page to disk and reports a successful download.
20
- * 2. THE BULK EXPORT IS EPSG:2157 UNDER A `crs` MEMBER RFC 7946 REMOVED. The file's own header carries
21
- * `"crs":{"type":"name","properties":{"name":"EPSG:2157"}}` and its coordinates are Irish Transverse
22
- * Mercator metres. A strict RFC 7946 reader ignores the member and places Ireland at latitude 735,435;
23
- * GDAL honours it, which is why `sdk/ingest.ts` reads the archive through ogr2ogr and asserts the
24
- * reprojected result lands inside the Department's own declared extent.
25
- * 3. THE PUBLISHER'S OWN AREA STATISTIC IS NOT IN THE ARCHIVE. `Shape__Area` is a service field and the
26
- * GeoJSON export drops it, so the area cross-check has to come from {@linkcode readShapeAreaSum} — which
27
- * makes it a genuine two-path check rather than the archive agreeing with itself. Measured:
28
- * 5,444,492,956.40 m² over 85,330 features.
29
- * 4. `GZT_LINK` POINTS AT A HOST WITH NO DNS RECORD. All 85,330 rows link their generic type's definition to
30
- * `viewer.myplan.ie`, which has no A or AAAA record, and three candidate replacements on the live host
31
- * answer HTTP 404. So `zoning_vocabulary.definition_url` cannot be populated from it and is left NULL
32
- * rather than filled with a plausible one.
6
+ * The Department's ArcGIS item, its feature service and the Hub download job, read through {@linkcode APIClient}; the bulk export streams to disk on raw `fetch` instead.
33
7
  */
34
8
  import { APIClient, type APIClientConfig } from "@mailwoman/core/api";
35
9
  import { type CreatePacedCachedClientOptions } from "@mailwoman/core/api/paced-client";
36
10
  /**
37
- * The ArcGIS Online sharing API, where the item's licence and attribution fields are readable.
11
+ * The ArcGIS Online sharing API.
12
+ *
13
+ * The item's license and attribution fields are available there.
38
14
  */
39
15
  export declare const ARCGIS_ITEM_API_BASE_URL = "https://www.arcgis.com/sharing/rest/content/items";
40
16
  /**
41
- * The Hub download API, which is how the whole layer is exported in one file.
17
+ * The Hub download API exports the whole layer as one file.
42
18
  */
43
19
  export declare const HUB_DOWNLOAD_API_BASE_URL = "https://hub.arcgis.com/api/download/v1/items";
44
20
  /**
45
- * Minimum spacing between requests to the Department's hosts, in milliseconds.
46
- *
47
- * The Department publishes no rate limit for this service, so this is courtesy pacing rather than a published ceiling —
48
- * stated as such rather than dressed up as a measured limit. Two requests a second is far below anything a hosted
49
- * ArcGIS feature service is provisioned for and costs a build nothing: the acquisition path makes single-digit numbers
50
- * of calls and the verification a few dozen.
21
+ * Minimum spacing between requests to the Department's hosts, courtesy pacing
22
+ * because the Department publishes no rate limit for this service.
51
23
  */
52
24
  export declare const GZT_MIN_REQUEST_INTERVAL_MS = 500;
53
25
  export type CreateZoningClientOptions = CreatePacedCachedClientOptions;
54
26
  /**
55
- * What the item says about the product.
27
+ * What the item reports about the product.
56
28
  */
57
29
  export interface ZoningItemRecord {
58
30
  itemID: string;
59
31
  title: string;
60
32
  /**
61
- * The item's `modified` timestamp as an ISO date — the product vintage, and the freshness signal.
33
+ * The item's `modified` timestamp as an ISO date.
34
+ * It records product vintage and signals freshness.
62
35
  */
63
36
  modifiedDate: string;
64
37
  /**
@@ -66,8 +39,8 @@ export interface ZoningItemRecord {
66
39
  */
67
40
  accessInformation: string;
68
41
  /**
69
- * `licenseInfo`, verbatim, with its markup stripped. Read rather than trusted from the constant, so a change in the
70
- * terms is visible at build time.
42
+ * `licenseInfo`, verbatim with its markup stripped, read rather than trusted from
43
+ * the constant so a change in the terms is visible at build time.
71
44
  */
72
45
  licenseInfo: string;
73
46
  /**
@@ -80,17 +53,13 @@ export interface ZoningItemRecord {
80
53
  */
81
54
  export declare class GZTClient extends APIClient<APIClientConfig> {
82
55
  /**
83
- * The item record: its vintage, its credit line, its licence text and its declared extent.
56
+ * The item record: its vintage, its credit line, its license text and its declared extent.
84
57
  *
85
58
  * @throws {Error} When the item is missing, or declares no extent.
86
59
  */
87
60
  readItemRecord(): Promise<ZoningItemRecord>;
88
61
  /**
89
- * The feature count the service reports, and the EPSG code it declares.
90
- *
91
- * The SECOND path in the build's agreement check: the same authority, a different distribution channel. An archive
92
- * whose feature count disagrees with the live service is not a file this build should be writing into a sealed
93
- * artifact.
62
+ * The feature count and EPSG code the service reports, the second path in the build's agreement check.
94
63
  */
95
64
  readServiceIdentity(): Promise<{
96
65
  featureCount: number;
@@ -98,29 +67,21 @@ export declare class GZTClient extends APIClient<APIClientConfig> {
98
67
  maxRecordCount: number;
99
68
  }>;
100
69
  /**
101
- * The sum of the Department's own `Shape__Area` column, in square metres.
70
+ * The sum of the Department's `Shape__Area` column in square meters.
102
71
  *
103
- * THE ONE NUMBER THAT SETTLES THE HOLE QUESTION, and it has to come from the service because the bulk export drops
104
- * the column. Read with the holes the rings total 5,444.5 km²; read without them, 5,666.6 km². The difference is 4.1%
105
- * of area and, far more importantly, a ray cast that answers "inside" for every location a plan carved out.
72
+ * The service must provide this value because the bulk export omits the column.
106
73
  */
107
74
  readShapeAreaSum(): Promise<number>;
108
75
  /**
109
- * Ask the Hub for a bulk GeoJSON export and return the URL it answers with.
110
- *
111
- * `redirect=false` asks for the job record rather than a redirect, so this call reads a small JSON body. The URL it
112
- * returns is the one that 302s — see {@link downloadZoningExport}.
76
+ * Ask the Hub for a bulk GeoJSON export and return the result URL, a 302 that the caller has to follow.
113
77
  *
114
- * @throws {Error} When the job is not `Completed`, or names no result URL. A partial job that answered with a status
115
- * and no URL would otherwise present as an empty download.
78
+ * @throws {Error} When the job is not `Completed`, or names no result URL.
79
+ * A partial job that answered with a status and no URL would otherwise present as an empty download.
116
80
  */
117
81
  readExportURL(): Promise<string>;
118
82
  /**
119
- * The features the service publishes near a point — the verification's second path.
120
- *
121
- * `outSR=4326` on the query path, because the service answers in Irish Transverse Mercator otherwise and the
122
- * comparison is against coordinates this package reprojected itself. The service answers a bounding box rather than a
123
- * point, so the containment decision is made against the returned rings by the caller.
83
+ * The features the service publishes near a point, queried with `outSR=4326`
84
+ * because it answers in Irish Transverse Mercator otherwise.
124
85
  */
125
86
  readFeaturesNear(latitude: number, longitude: number, halfWidthDegrees: number): Promise<Array<{
126
87
  properties?: Record<string, unknown>;
@@ -131,13 +92,8 @@ export declare class GZTClient extends APIClient<APIClientConfig> {
131
92
  }>>;
132
93
  }
133
94
  /**
134
- * Refuse an attribution the published item no longer matches.
135
- *
136
- * READ AT BUILD TIME RATHER THAN TRUSTED FROM THE CONSTANT. The constant is what the artifact is stamped with offline;
137
- * this is the live value it is reconciled with when the network is available. The check is on the DEPARTMENT'S CREDIT
138
- * LINE and on the Tailte Éireann clause separately, because they are two different statements and the second is the one
139
- * that holds this layer at `build-local`: an item that dropped it would be a licence change worth hearing about, and an
140
- * item that dropped only the credit line would be a different one.
95
+ * Refuse an attribution the published item no longer matches, checking the Department's
96
+ * credit line and the Tailte Éireann clause separately.
141
97
  *
142
98
  * @throws {Error} When either half of {@link GZT_ATTRIBUTION} is no longer in the item's own fields.
143
99
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../lib/sdk/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,SAA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c,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAgDvD;IAED;;OAEG;IACU,mBAAmB,IAAI,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CA6B1G;IAED;;;;OAIG;IACU,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAwB/C;IAED;;;;;OAKG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAkB5C;IAED;;;OAGG;IACU,gBAAgB,CAC5B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,GACtB,OAAO,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC,CA2B7G;CACD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,GAAG,aAAa,CAAC,GAAG,IAAI,CAcpH;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,yBAA8B,GAAG,SAAS,CAWlF"}
package/out/sdk/client.js CHANGED
@@ -3,63 +3,32 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The Department's ArcGIS item, its feature service and the Hub download job, read through
7
- * {@linkcode APIClient}.
8
- *
9
- * THESE ARE API REQUESTS AND THEY GO THROUGH `APIClient`. Small bodies, repeated calls, a third-party
10
- * host — the pacing, bounded retry, response caching and `ResourceError` mapping are exactly what they
11
- * need. The 247 MB bulk export is NOT one of them: it is a file transfer, it streams to disk on raw
12
- * `fetch`, and `download.ts` says so in place.
13
- *
14
- * FOUR MEASURED CLIENT BEHAVIORS ARE ENCODED HERE RATHER THAN WRITTEN DOWN SOMEWHERE ELSE.
15
- *
16
- * 1. THE HUB DOWNLOAD JOB ANSWERS WITH A `resultUrl` THAT 302s. `…/api/download/v1/items/<id>/geojson?
17
- * redirect=false&layers=0` returns `{"status":"Completed","resultUrl":…}` in 249 bytes; the result URL
18
- * itself redirects, so the transfer needs `redirect: "follow"`. A client that took the first response as
19
- * the file writes a redirect page to disk and reports a successful download.
20
- * 2. THE BULK EXPORT IS EPSG:2157 UNDER A `crs` MEMBER RFC 7946 REMOVED. The file's own header carries
21
- * `"crs":{"type":"name","properties":{"name":"EPSG:2157"}}` and its coordinates are Irish Transverse
22
- * Mercator metres. A strict RFC 7946 reader ignores the member and places Ireland at latitude 735,435;
23
- * GDAL honours it, which is why `sdk/ingest.ts` reads the archive through ogr2ogr and asserts the
24
- * reprojected result lands inside the Department's own declared extent.
25
- * 3. THE PUBLISHER'S OWN AREA STATISTIC IS NOT IN THE ARCHIVE. `Shape__Area` is a service field and the
26
- * GeoJSON export drops it, so the area cross-check has to come from {@linkcode readShapeAreaSum} — which
27
- * makes it a genuine two-path check rather than the archive agreeing with itself. Measured:
28
- * 5,444,492,956.40 m² over 85,330 features.
29
- * 4. `GZT_LINK` POINTS AT A HOST WITH NO DNS RECORD. All 85,330 rows link their generic type's definition to
30
- * `viewer.myplan.ie`, which has no A or AAAA record, and three candidate replacements on the live host
31
- * answer HTTP 404. So `zoning_vocabulary.definition_url` cannot be populated from it and is left NULL
32
- * rather than filled with a plausible one.
6
+ * The Department's ArcGIS item, its feature service and the Hub download job, read through {@linkcode APIClient}; the bulk export streams to disk on raw `fetch` instead.
33
7
  */
34
8
  import { APIClient, assertNoArcGISError } from "@mailwoman/core/api";
35
9
  import { createPacedCachedClient } from "@mailwoman/core/api/paced-client";
36
10
  import { htmlToText } from "@mailwoman/core/html/text";
11
+ import { stringifyJSON } from "@mailwoman/core/json";
37
12
  import { isoDate } from "@mailwoman/core/utils";
38
13
  import { GZT_ATTRIBUTION, GZT_ITEM_ID, GZT_SERVICE_URL, GZT_SOURCE_EPSG } from "#vocabulary";
39
- // Re-exported so a caller branching on this client's failures needs exactly one import.
40
14
  /**
41
- * The ArcGIS Online sharing API, where the item's licence and attribution fields are readable.
15
+ * The ArcGIS Online sharing API.
16
+ *
17
+ * The item's license and attribution fields are available there.
42
18
  */
43
19
  export const ARCGIS_ITEM_API_BASE_URL = "https://www.arcgis.com/sharing/rest/content/items";
44
20
  /**
45
- * The Hub download API, which is how the whole layer is exported in one file.
21
+ * The Hub download API exports the whole layer as one file.
46
22
  */
47
23
  export const HUB_DOWNLOAD_API_BASE_URL = "https://hub.arcgis.com/api/download/v1/items";
48
24
  /**
49
- * Minimum spacing between requests to the Department's hosts, in milliseconds.
50
- *
51
- * The Department publishes no rate limit for this service, so this is courtesy pacing rather than a published ceiling —
52
- * stated as such rather than dressed up as a measured limit. Two requests a second is far below anything a hosted
53
- * ArcGIS feature service is provisioned for and costs a build nothing: the acquisition path makes single-digit numbers
54
- * of calls and the verification a few dozen.
25
+ * Minimum spacing between requests to the Department's hosts, courtesy pacing
26
+ * because the Department publishes no rate limit for this service.
55
27
  */
56
28
  export const GZT_MIN_REQUEST_INTERVAL_MS = 500;
57
29
  /**
58
- * How long a cached metadata response stays fresh.
59
- *
60
- * Six hours, chosen against the product's own cadence rather than a wall-clock intuition. The Department publishes no
61
- * maintenance-frequency statement at all; what is observable is that the item's `modified` date and the data's latest
62
- * `UPLOAD_DATE` move a handful of times a year, so a shorter TTL buys nothing.
30
+ * How long a cached metadata response stays fresh, six hours because the item's `modified` date
31
+ * and the data's latest `UPLOAD_DATE` move only a handful of times a year.
63
32
  */
64
33
  const GZT_CACHE_TTL_MS = 6 * 60 * 60 * 1000;
65
34
  /**
@@ -71,7 +40,7 @@ const BBOX_ORDINATES = 4;
71
40
  */
72
41
  export class GZTClient extends APIClient {
73
42
  /**
74
- * The item record: its vintage, its credit line, its licence text and its declared extent.
43
+ * The item record: its vintage, its credit line, its license text and its declared extent.
75
44
  *
76
45
  * @throws {Error} When the item is missing, or declares no extent.
77
46
  */
@@ -83,7 +52,7 @@ export class GZTClient extends APIClient {
83
52
  });
84
53
  assertNoArcGISError(data, "zoning client");
85
54
  if (data.id !== GZT_ITEM_ID) {
86
- throw new Error(`zoning client: the item endpoint answered for ${JSON.stringify(data.id)}, expected ${GZT_ITEM_ID}`);
55
+ throw new Error(`zoning client: the item endpoint answered for ${stringifyJSON(data.id)}, expected ${GZT_ITEM_ID}`);
87
56
  }
88
57
  if (typeof data.modified !== "number") {
89
58
  throw new TypeError("zoning client: the item carries no `modified` timestamp — the product vintage cannot be read, and guessing it would stamp an artifact with a version that means nothing");
@@ -94,7 +63,7 @@ export class GZTClient extends APIClient {
94
63
  }
95
64
  const bbox = [extent[0][0], extent[0][1], extent[1][0], extent[1][1]];
96
65
  if (bbox.some((ordinate) => !Number.isFinite(ordinate)) || bbox.length !== BBOX_ORDINATES) {
97
- throw new TypeError(`zoning client: the item's extent is not a 2D bounding box (${JSON.stringify(extent)})`);
66
+ throw new TypeError(`zoning client: the item's extent is not a 2D bounding box (${stringifyJSON(extent)})`);
98
67
  }
99
68
  return {
100
69
  itemID: data.id,
@@ -106,11 +75,7 @@ export class GZTClient extends APIClient {
106
75
  };
107
76
  }
108
77
  /**
109
- * The feature count the service reports, and the EPSG code it declares.
110
- *
111
- * The SECOND path in the build's agreement check: the same authority, a different distribution channel. An archive
112
- * whose feature count disagrees with the live service is not a file this build should be writing into a sealed
113
- * artifact.
78
+ * The feature count and EPSG code the service reports, the second path in the build's agreement check.
114
79
  */
115
80
  async readServiceIdentity() {
116
81
  const { data } = await this.fetch({ method: "GET", url: GZT_SERVICE_URL, params: { f: "json" } });
@@ -131,11 +96,9 @@ export class GZTClient extends APIClient {
131
96
  return { featureCount: counted.count, epsg, maxRecordCount: data.maxRecordCount ?? 0 };
132
97
  }
133
98
  /**
134
- * The sum of the Department's own `Shape__Area` column, in square metres.
99
+ * The sum of the Department's `Shape__Area` column in square meters.
135
100
  *
136
- * THE ONE NUMBER THAT SETTLES THE HOLE QUESTION, and it has to come from the service because the bulk export drops
137
- * the column. Read with the holes the rings total 5,444.5 km²; read without them, 5,666.6 km². The difference is 4.1%
138
- * of area and, far more importantly, a ray cast that answers "inside" for every location a plan carved out.
101
+ * The service must provide this value because the bulk export omits the column.
139
102
  */
140
103
  async readShapeAreaSum() {
141
104
  const { data } = await this.fetch({
@@ -143,7 +106,7 @@ export class GZTClient extends APIClient {
143
106
  url: `${GZT_SERVICE_URL}/query`,
144
107
  params: {
145
108
  where: "1=1",
146
- outStatistics: JSON.stringify([
109
+ outStatistics: stringifyJSON([
147
110
  { statisticType: "sum", onStatisticField: "Shape__Area", outStatisticFieldName: "area_sum" },
148
111
  ]),
149
112
  f: "json",
@@ -157,13 +120,10 @@ export class GZTClient extends APIClient {
157
120
  return sum;
158
121
  }
159
122
  /**
160
- * Ask the Hub for a bulk GeoJSON export and return the URL it answers with.
161
- *
162
- * `redirect=false` asks for the job record rather than a redirect, so this call reads a small JSON body. The URL it
163
- * returns is the one that 302s — see {@link downloadZoningExport}.
123
+ * Ask the Hub for a bulk GeoJSON export and return the result URL, a 302 that the caller has to follow.
164
124
  *
165
- * @throws {Error} When the job is not `Completed`, or names no result URL. A partial job that answered with a status
166
- * and no URL would otherwise present as an empty download.
125
+ * @throws {Error} When the job is not `Completed`, or names no result URL.
126
+ * A partial job that answered with a status and no URL would otherwise present as an empty download.
167
127
  */
168
128
  async readExportURL() {
169
129
  const { data } = await this.fetch({
@@ -173,23 +133,20 @@ export class GZTClient extends APIClient {
173
133
  });
174
134
  assertNoArcGISError(data, "zoning client");
175
135
  if (data.status !== "Completed" || !data.resultUrl) {
176
- throw new Error(`zoning client: the Hub download job answered status ${JSON.stringify(data.status)} with ${data.resultUrl ? "a" : "no"} result URL${data.message ? ` (${data.message})` : ""}`);
136
+ throw new Error(`zoning client: the Hub download job answered status ${stringifyJSON(data.status)} with ${data.resultUrl ? "a" : "no"} result URL${data.message ? ` (${data.message})` : ""}`);
177
137
  }
178
138
  return data.resultUrl;
179
139
  }
180
140
  /**
181
- * The features the service publishes near a point — the verification's second path.
182
- *
183
- * `outSR=4326` on the query path, because the service answers in Irish Transverse Mercator otherwise and the
184
- * comparison is against coordinates this package reprojected itself. The service answers a bounding box rather than a
185
- * point, so the containment decision is made against the returned rings by the caller.
141
+ * The features the service publishes near a point, queried with `outSR=4326`
142
+ * because it answers in Irish Transverse Mercator otherwise.
186
143
  */
187
144
  async readFeaturesNear(latitude, longitude, halfWidthDegrees) {
188
145
  const { data } = await this.fetch({
189
146
  method: "GET",
190
147
  url: `${GZT_SERVICE_URL}/query`,
191
148
  params: {
192
- geometry: JSON.stringify({
149
+ geometry: stringifyJSON({
193
150
  xmin: longitude - halfWidthDegrees,
194
151
  ymin: latitude - halfWidthDegrees,
195
152
  xmax: longitude + halfWidthDegrees,
@@ -210,24 +167,19 @@ export class GZTClient extends APIClient {
210
167
  }
211
168
  }
212
169
  /**
213
- * Refuse an attribution the published item no longer matches.
214
- *
215
- * READ AT BUILD TIME RATHER THAN TRUSTED FROM THE CONSTANT. The constant is what the artifact is stamped with offline;
216
- * this is the live value it is reconciled with when the network is available. The check is on the DEPARTMENT'S CREDIT
217
- * LINE and on the Tailte Éireann clause separately, because they are two different statements and the second is the one
218
- * that holds this layer at `build-local`: an item that dropped it would be a licence change worth hearing about, and an
219
- * item that dropped only the credit line would be a different one.
170
+ * Refuse an attribution the published item no longer matches, checking the Department's
171
+ * credit line and the Tailte Éireann clause separately.
220
172
  *
221
173
  * @throws {Error} When either half of {@link GZT_ATTRIBUTION} is no longer in the item's own fields.
222
174
  */
223
175
  export function assertAttributionUnchanged(record) {
224
176
  if (!GZT_ATTRIBUTION.includes(record.accessInformation.trim()) || !record.accessInformation.trim()) {
225
- throw new Error(`zoning client: the item's accessInformation reads ${JSON.stringify(record.accessInformation)}, and this build ships ` +
226
- `${JSON.stringify(GZT_ATTRIBUTION)} — the credit line is what a re-user has to publish, so a change in it is a change in the terms`);
177
+ throw new Error(`zoning client: the item's accessInformation reads ${stringifyJSON(record.accessInformation)}, and this build ships ` +
178
+ `${stringifyJSON(GZT_ATTRIBUTION)} — the credit line is what a re-user has to publish, so a change in it is a change in the terms`);
227
179
  }
228
180
  if (!record.licenseInfo.includes("Tailte Éireann")) {
229
181
  throw new Error("zoning client: the item's licenseInfo no longer names Tailte Éireann as a licensor. That clause is the reason " +
230
- "this layer is built locally rather than shipped, so its disappearance is a licence change to read rather than absorb");
182
+ "this layer is built locally rather than shipped, so its disappearance is a license change to read rather than absorb");
231
183
  }
232
184
  }
233
185
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../lib/sdk/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,SAAS,EAAwB,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,uBAAuB,EAAuC,MAAM,kCAAkC,CAAA;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE5F,wFAAwF;AAExF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mDAAmD,CAAA;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,8CAA8C,CAAA;AAEvF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AA6B3C;;GAEG;AACH,MAAM,cAAc,GAAG,CAAC,CAAA;AAExB;;GAEG;AACH,MAAM,OAAO,S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,CACd,gHAAgH;YAC/G,sHAAsH,CACvH,CAAA;IACF,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAO,GAA8B,EAAE;IACtE,OAAO,uBAAuB,CAC7B,SAAS,EACT;QACC,WAAW,EAAE,KAAK;QAClB,oBAAoB,EAAE,2BAA2B;QACjD,UAAU,EAAE,gBAAgB;QAC5B,cAAc,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC;KAC3C,EACD,OAAO,CACP,CAAA;AACF,CAAC"}
@@ -3,49 +3,29 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Acquire the Department's bulk GeoJSON export — a 247,452,342-byte file streamed to disk.
7
- *
8
- * THIS IS A FILE TRANSFER, NOT AN API REQUEST, AND IT KEEPS RAW `fetch` ON PURPOSE. The repo's rule sends
9
- * HTTP clients through `@mailwoman/core/api`'s `APIClient`, and the rule draws its line at what that class
10
- * is for: pacing, bounded retry, response caching and error mapping over small bodies and repeated calls.
11
- * None of it applies here. Caching a 247 MB body through a JSON-validating disk cache would write a second,
12
- * unreadable copy of a file already on disk; there is nothing to pace, because this runs once per product
13
- * vintage; and axios buffers any non-stream response type in memory. `packages/osm/lib/sdk/fetch.ts`,
14
- * `packages/tiger/lib/sdk/download.ts`, `packages/flood/lib/sdk/download.ts` and `packages/coastal/lib/sdk/download.ts`
15
- * are the existing transfers that say the same thing in the same place. The JOB that produces this URL, and
16
- * every other metadata read around it, DO go through `APIClient` — see `client.ts`.
17
- *
18
- * THE RESULT URL REDIRECTS AND THE FETCH MUST FOLLOW IT. The Hub download job answers
19
- * `{"status":"Completed","resultUrl":…}`; the result URL itself 302s to the generated file. Node's `fetch`
20
- * follows redirects by default, and the option is passed explicitly anyway — a transfer that stopped at the
21
- * redirect would write a short body to disk and report a successful download.
22
- *
23
- * FRESHNESS IS THE ITEM'S OWN MODIFIED DATE, NEVER A LENGTH PROBE. The cache is keyed on the vintage the
24
- * item declares, so a re-run against the same vintage never re-transfers and a new vintage never overwrites
25
- * the old one in place.
6
+ * Acquire the Department's bulk GeoJSON export with raw `fetch` rather than `APIClient`, following the result URL's redirect and keying the cache on the item's own modified date.
26
7
  */
8
+ import { type PathBuilderLike } from "path-ts";
27
9
  /**
28
10
  * The file name one vintage's export is kept under.
29
11
  */
30
12
  export declare const GZT_EXPORT_FILE = "gzt-current-plan.geojson";
31
13
  export interface DownloadZoningExportOptions {
32
14
  /**
33
- * The Hub job's `resultUrl`, read rather than assembled — it carries a generated file id with no relationship to the
34
- * item id, so a hard-coded URL survives a republish by pointing at a file that is no longer the product.
15
+ * The Hub job's `resultUrl`, read rather than assembled because it includes a
16
+ * generated file id that a hard-coded URL would outlive.
35
17
  */
36
18
  url: string;
37
19
  /**
38
20
  * The product vintage the cache is keyed on.
39
21
  */
40
22
  vintage: string;
41
- cacheRoot: string;
23
+ cacheRoot: PathBuilderLike;
42
24
  onProgress?: (message: string) => void;
43
25
  }
44
26
  /**
45
- * Download the bulk export for one product vintage, returning the path of the GeoJSON file.
46
- *
47
- * Downloads to a `.part` file and renames only on a clean finish, so an interrupted transfer never presents as a
48
- * complete export — the same discipline the database build uses, for the same reason.
27
+ * Download the bulk export for one product vintage and return the path of the GeoJSON file, renaming a
28
+ * `.part` file only on a clean finish so an interrupted transfer never presents as a complete export.
49
29
  */
50
30
  export declare function downloadZoningExport(options: DownloadZoningExportOptions): Promise<string>;
51
31
  //# sourceMappingURL=download.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../lib/sdk/download.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAOH;;GAEG;AACH,eAAO,MAAM,eAAe,6BAA6B,CAAA;AAEzD,MAAM,WAAW,2BAA2B;IAC3C;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBhG"}
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../sdk/download.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,6BAA6B,CAAA;AAEzD,MAAM,WAAW,2BAA2B;IAC3C;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,eAAe,CAAA;IAC1B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBhG"}