@mailwoman/soil 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 (117) hide show
  1. package/README.md +118 -116
  2. package/lib/index.ts +88 -113
  3. package/lib/paths.ts +24 -0
  4. package/lib/schema.ts +189 -134
  5. package/lib/vocabulary.ts +40 -107
  6. package/out/index.d.ts +59 -77
  7. package/out/index.d.ts.map +1 -1
  8. package/out/index.js +38 -79
  9. package/out/index.js.map +1 -1
  10. package/out/paths.d.ts +19 -0
  11. package/out/paths.d.ts.map +1 -0
  12. package/out/paths.js +21 -0
  13. package/out/paths.js.map +1 -0
  14. package/out/schema.d.ts +183 -132
  15. package/out/schema.d.ts.map +1 -1
  16. package/out/schema.js +32 -32
  17. package/out/schema.js.map +1 -1
  18. package/out/sdk/acquire.d.ts +15 -24
  19. package/out/sdk/acquire.d.ts.map +1 -1
  20. package/out/sdk/acquire.js +6 -21
  21. package/out/sdk/acquire.js.map +1 -1
  22. package/out/sdk/build-soil.d.ts +67 -70
  23. package/out/sdk/build-soil.d.ts.map +1 -1
  24. package/out/sdk/build-soil.js +67 -97
  25. package/out/sdk/build-soil.js.map +1 -1
  26. package/out/sdk/cell-tiers.d.ts +7 -19
  27. package/out/sdk/cell-tiers.d.ts.map +1 -1
  28. package/out/sdk/cell-tiers.js +21 -40
  29. package/out/sdk/cell-tiers.js.map +1 -1
  30. package/out/sdk/cells.d.ts +15 -41
  31. package/out/sdk/cells.d.ts.map +1 -1
  32. package/out/sdk/cells.js +11 -38
  33. package/out/sdk/cells.js.map +1 -1
  34. package/out/sdk/client.d.ts +24 -49
  35. package/out/sdk/client.d.ts.map +1 -1
  36. package/out/sdk/client.js +20 -64
  37. package/out/sdk/client.js.map +1 -1
  38. package/out/sdk/download.d.ts +24 -47
  39. package/out/sdk/download.d.ts.map +1 -1
  40. package/out/sdk/download.js +15 -55
  41. package/out/sdk/download.js.map +1 -1
  42. package/out/sdk/ingest/chunk.d.ts +29 -25
  43. package/out/sdk/ingest/chunk.d.ts.map +1 -1
  44. package/out/sdk/ingest/chunk.js +18 -16
  45. package/out/sdk/ingest/chunk.js.map +1 -1
  46. package/out/sdk/ingest/worker.d.ts +9 -0
  47. package/out/sdk/ingest/worker.d.ts.map +1 -0
  48. package/out/{scripts/ingest-chunk.js → sdk/ingest/worker.js} +15 -14
  49. package/out/sdk/ingest/worker.js.map +1 -0
  50. package/out/sdk/ingest.d.ts +122 -0
  51. package/out/sdk/ingest.d.ts.map +1 -0
  52. package/out/sdk/ingest.js +127 -0
  53. package/out/sdk/ingest.js.map +1 -0
  54. package/out/sdk/measure-resolutions.d.ts +6 -17
  55. package/out/sdk/measure-resolutions.d.ts.map +1 -1
  56. package/out/sdk/measure-resolutions.js +4 -16
  57. package/out/sdk/measure-resolutions.js.map +1 -1
  58. package/out/sdk/reduce.d.ts +33 -59
  59. package/out/sdk/reduce.d.ts.map +1 -1
  60. package/out/sdk/reduce.js +48 -79
  61. package/out/sdk/reduce.js.map +1 -1
  62. package/out/sdk/survey-area.d.ts +16 -48
  63. package/out/sdk/survey-area.d.ts.map +1 -1
  64. package/out/sdk/survey-area.js +35 -79
  65. package/out/sdk/survey-area.js.map +1 -1
  66. package/out/sdk/tabular.d.ts +32 -31
  67. package/out/sdk/tabular.d.ts.map +1 -1
  68. package/out/sdk/tabular.js +57 -49
  69. package/out/sdk/tabular.js.map +1 -1
  70. package/out/sdk/test-kit.d.ts +57 -0
  71. package/out/sdk/test-kit.d.ts.map +1 -0
  72. package/out/{test-kit.js → sdk/test-kit.js} +18 -39
  73. package/out/sdk/test-kit.js.map +1 -0
  74. package/out/sdk/verify.d.ts +17 -53
  75. package/out/sdk/verify.d.ts.map +1 -1
  76. package/out/sdk/verify.js +27 -85
  77. package/out/sdk/verify.js.map +1 -1
  78. package/out/vocabulary.d.ts +37 -103
  79. package/out/vocabulary.d.ts.map +1 -1
  80. package/out/vocabulary.js +34 -107
  81. package/out/vocabulary.js.map +1 -1
  82. package/package.json +37 -191
  83. package/{lib/sdk → sdk}/acquire.ts +18 -28
  84. package/{lib/sdk → sdk}/build-soil.ts +116 -130
  85. package/{lib/sdk → sdk}/cell-tiers.ts +22 -41
  86. package/{lib/sdk → sdk}/cells.ts +17 -43
  87. package/sdk/client.ts +147 -0
  88. package/sdk/download.ts +131 -0
  89. package/{lib/sdk → sdk}/ingest/chunk.ts +35 -27
  90. package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +14 -13
  91. package/sdk/ingest.ts +255 -0
  92. package/{lib/sdk → sdk}/measure-resolutions.ts +6 -17
  93. package/sdk/reduce.ts +344 -0
  94. package/{lib/sdk → sdk}/survey-area.ts +49 -88
  95. package/{lib/sdk → sdk}/tabular.ts +61 -52
  96. package/{lib → sdk}/test-kit.ts +19 -41
  97. package/sdk/verify.ts +313 -0
  98. package/lib/sdk/client.ts +0 -184
  99. package/lib/sdk/download.ts +0 -161
  100. package/lib/sdk/index.ts +0 -20
  101. package/lib/sdk/ingest/index.ts +0 -278
  102. package/lib/sdk/reduce.ts +0 -375
  103. package/lib/sdk/verify.ts +0 -369
  104. package/out/scripts/ingest-chunk.d.ts +0 -11
  105. package/out/scripts/ingest-chunk.d.ts.map +0 -1
  106. package/out/scripts/ingest-chunk.js.map +0 -1
  107. package/out/sdk/index.d.ts +0 -20
  108. package/out/sdk/index.d.ts.map +0 -1
  109. package/out/sdk/index.js +0 -20
  110. package/out/sdk/index.js.map +0 -1
  111. package/out/sdk/ingest/index.d.ts +0 -132
  112. package/out/sdk/ingest/index.d.ts.map +0 -1
  113. package/out/sdk/ingest/index.js +0 -170
  114. package/out/sdk/ingest/index.js.map +0 -1
  115. package/out/test-kit.d.ts +0 -79
  116. package/out/test-kit.d.ts.map +0 -1
  117. package/out/test-kit.js.map +0 -1
@@ -2,56 +2,32 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * Acquire one survey area's published archive — 13 to 41 MB streamed to disk and unzipped.
7
- *
8
- * THE TRANSFER ITSELF LIVES IN `@mailwoman/core/utils`, and `streamToDisk` carries why a file transfer of
9
- * this size keeps raw `fetch` instead of going through `APIClient`, plus the `.part`-rename rule. What is
10
- * soil's, and stays here, is the URL shape, the cache key, and the two facts below that the shared
11
- * transfer is told rather than assumes: the progress stride and what a 400 means. The METADATA reads
12
- * around this one do go through `APIClient` — see `client.ts`.
13
- *
14
- * FRESHNESS IS `sacatalog.saverest`, NEVER A LENGTH PROBE, AND THE HOST LEAVES NO CHOICE. It answers `HEAD`
15
- * with HTTP 405 (`allow: GET`) and IGNORES `Range`: a request with `Range: bytes=0-0` returned HTTP 200 and
16
- * transferred the whole 27,598,377 bytes in 7.23 s. So "check the size first" starts a real download. The
17
- * cache is keyed on the version date the tabular service reports instead, and a vintage already on disk is
18
- * never re-fetched. The `Range` behaviour is PATH-SPECIFIC rather than host-wide — `/DataAvailability/`
19
- * does answer 206 — so a client must probe per path rather than conclude from one.
20
- *
21
- * THE FILENAME EMBEDS THE VERSION DATE AND A WRONG ONE IS AN HTTP 400. Not a 404: asking for a date the
22
- * host does not hold reads as a malformed request rather than a missing file, which is why the date comes
23
- * from the catalogue rather than from a guess. The square brackets must be sent literally, so the URL is
24
- * built with them percent-encoded.
25
- *
26
- * TWO CACHE VARIANTS EXIST AND THE BARE ONE IS WANTED. `wss_SSA_IA153_[2025-09-09].zip` is 25,474,922 bytes;
27
- * `wss_SSA_IA153_soildb_IA_2003_[2025-09-09].zip` is 27,598,377 and differs only by an EMPTY Microsoft Access
28
- * template container for a workflow this program does not use. Confirmed on a second area (`IA015`:
29
- * 38,981,269 against 41,104,724 bytes) and on a third that ships no template at all (`TX299`, 13,455,641
30
- * bytes, 97 files, no `.mdb`).
31
5
  */
6
+ import { PathBuilder, type PathBuilderLike } from "path-ts";
32
7
  /**
33
- * The download service's survey-area cache. Documented at `https://websoilsurvey.sc.egov.usda.gov/DSD/Download/help`,
34
- * which lists `GET /{CacheName}/{FileName}`.
8
+ * Points to the Web Soil Survey download cache that serves survey-area archives.
35
9
  */
36
10
  export declare const WSS_SSA_CACHE_URL = "https://websoilsurvey.sc.egov.usda.gov/DSD/Download/Cache/SSA";
37
11
  /**
38
- * The archive URL for one survey area at one version date.
39
- *
40
- * The brackets are percent-encoded rather than sent raw: they are not valid in a URL path, and a client that sends them
41
- * literally depends on the fetcher tolerating them.
12
+ * Returns the archive URL for one survey area at one version date, with the brackets
13
+ * around the date percent-encoded because they are not valid in a URL path.
42
14
  */
43
15
  export declare function surveyAreaArchiveURL(areaSymbol: string, versionDate: string): string;
16
+ /**
17
+ * Configures {@link downloadSurveyArea}, which caches the archive and its
18
+ * extracted tree under `cacheRoot/<versionDate>`.
19
+ */
44
20
  export interface DownloadSurveyAreaOptions {
45
21
  areaSymbol: string;
46
22
  /**
47
- * The version date from `sacatalog.saverest`, as `YYYY-MM-DD`.
23
+ * The survey area's version date from `sacatalog.saverest`, formatted as `YYYY-MM-DD`.
48
24
  */
49
25
  versionDate: string;
50
26
  /**
51
- * Where vintages are kept. Each version date gets its own directory, so a new refresh never overwrites the old one in
52
- * place and a re-run against the same vintage never re-transfers.
27
+ * The cache directory, where each version date gets its own subdirectory so a new
28
+ * vintage never overwrites an old one and a repeat run downloads no file.
53
29
  */
54
- cacheRoot: string;
30
+ cacheRoot: PathBuilderLike;
55
31
  onProgress?: (message: string) => void;
56
32
  }
57
33
  /**
@@ -61,24 +37,25 @@ export interface SurveyAreaArchive {
61
37
  areaSymbol: string;
62
38
  versionDate: string;
63
39
  /**
64
- * The extracted `<areasymbol>/` directory, holding `spatial/` and `tabular/`.
40
+ * The extracted `<areasymbol>/` directory.
41
+ * It contains `spatial/` and `tabular/`.
65
42
  */
66
- root: string;
67
- spatialDirectory: string;
68
- tabularDirectory: string;
43
+ root: PathBuilder;
44
+ spatialDirectory: PathBuilder;
45
+ tabularDirectory: PathBuilder;
69
46
  /**
70
- * The archive as transferred. Kept so a re-run costs nothing and so the bytes are re-checkable.
47
+ * The downloaded ZIP archive, kept so a repeat run skips the transfer and the bytes can be rechecked.
71
48
  */
72
- archivePath: string;
49
+ archivePath: PathBuilder;
73
50
  }
74
51
  /**
75
- * Download and unzip one survey area, returning where its pieces landed.
52
+ * Downloads and unzips one survey area into the cache, skipping completed steps.
53
+ * Returns the paths to its files.
76
54
  *
77
- * Downloads to a `.part` file and renames only on a clean finish, so an interrupted transfer never presents as a
78
- * complete archive — the same discipline the database build uses, for the same reason.
55
+ * The download goes through a `.part` file so an interrupted transfer never looks like a complete archive.
79
56
  *
80
- * @throws {Error} When the host answers anything but 200, or when the extracted tree does not hold the two directories
81
- * every survey area publishes.
57
+ * @throws {Error} When the host answers anything but 200, or when the extracted
58
+ * tree lacks the `spatial` or `tabular` directory.
82
59
  */
83
60
  export declare function downloadSurveyArea(options: DownloadSurveyAreaOptions): Promise<SurveyAreaArchive>;
84
61
  //# sourceMappingURL=download.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../lib/sdk/download.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAQH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,kEAAkE,CAAA;AAEhG;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,MAAM,WAAW,yBAAyB;IACzC,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC;AAcD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqDvG"}
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../sdk/download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,iBAAiB,kEAAkE,CAAA;AAEhG;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC;AAMD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAA;IACjB,gBAAgB,EAAE,WAAW,CAAA;IAC7B,gBAAgB,EAAE,WAAW,CAAA;IAE7B;;OAEG;IACH,WAAW,EAAE,WAAW,CAAA;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmDvG"}
@@ -2,75 +2,38 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * Acquire one survey area's published archive — 13 to 41 MB streamed to disk and unzipped.
7
- *
8
- * THE TRANSFER ITSELF LIVES IN `@mailwoman/core/utils`, and `streamToDisk` carries why a file transfer of
9
- * this size keeps raw `fetch` instead of going through `APIClient`, plus the `.part`-rename rule. What is
10
- * soil's, and stays here, is the URL shape, the cache key, and the two facts below that the shared
11
- * transfer is told rather than assumes: the progress stride and what a 400 means. The METADATA reads
12
- * around this one do go through `APIClient` — see `client.ts`.
13
- *
14
- * FRESHNESS IS `sacatalog.saverest`, NEVER A LENGTH PROBE, AND THE HOST LEAVES NO CHOICE. It answers `HEAD`
15
- * with HTTP 405 (`allow: GET`) and IGNORES `Range`: a request with `Range: bytes=0-0` returned HTTP 200 and
16
- * transferred the whole 27,598,377 bytes in 7.23 s. So "check the size first" starts a real download. The
17
- * cache is keyed on the version date the tabular service reports instead, and a vintage already on disk is
18
- * never re-fetched. The `Range` behaviour is PATH-SPECIFIC rather than host-wide — `/DataAvailability/`
19
- * does answer 206 — so a client must probe per path rather than conclude from one.
20
- *
21
- * THE FILENAME EMBEDS THE VERSION DATE AND A WRONG ONE IS AN HTTP 400. Not a 404: asking for a date the
22
- * host does not hold reads as a malformed request rather than a missing file, which is why the date comes
23
- * from the catalogue rather than from a guess. The square brackets must be sent literally, so the URL is
24
- * built with them percent-encoded.
25
- *
26
- * TWO CACHE VARIANTS EXIST AND THE BARE ONE IS WANTED. `wss_SSA_IA153_[2025-09-09].zip` is 25,474,922 bytes;
27
- * `wss_SSA_IA153_soildb_IA_2003_[2025-09-09].zip` is 27,598,377 and differs only by an EMPTY Microsoft Access
28
- * template container for a workflow this program does not use. Confirmed on a second area (`IA015`:
29
- * 38,981,269 against 41,104,724 bytes) and on a third that ships no template at all (`TX299`, 13,455,641
30
- * bytes, 97 files, no `.mdb`).
31
5
  */
32
- import { tryStat } from "@mailwoman/core/fs/readers";
6
+ import { tryStat } from "@mailwoman/core/fs/readers/stat";
33
7
  import { makeDirectories } from "@mailwoman/core/fs/writers";
34
8
  import { runFile } from "@mailwoman/core/process";
35
9
  import { streamToDisk } from "@mailwoman/core/utils";
36
- import { join } from "path-ts";
10
+ import { PathBuilder } from "path-ts";
37
11
  /**
38
- * The download service's survey-area cache. Documented at `https://websoilsurvey.sc.egov.usda.gov/DSD/Download/help`,
39
- * which lists `GET /{CacheName}/{FileName}`.
12
+ * Points to the Web Soil Survey download cache that serves survey-area archives.
40
13
  */
41
14
  export const WSS_SSA_CACHE_URL = "https://websoilsurvey.sc.egov.usda.gov/DSD/Download/Cache/SSA";
42
15
  /**
43
- * The archive URL for one survey area at one version date.
44
- *
45
- * The brackets are percent-encoded rather than sent raw: they are not valid in a URL path, and a client that sends them
46
- * literally depends on the fetcher tolerating them.
16
+ * Returns the archive URL for one survey area at one version date, with the brackets
17
+ * around the date percent-encoded because they are not valid in a URL path.
47
18
  */
48
19
  export function surveyAreaArchiveURL(areaSymbol, versionDate) {
49
20
  return `${WSS_SSA_CACHE_URL}/wss_SSA_${areaSymbol}_%5B${versionDate}%5D.zip`;
50
21
  }
51
- /**
52
- * Bytes between progress reports. Smaller than the shared default because these archives are 13–41 MB, and the default
53
- * stride would leave the smallest of them reporting once.
54
- */
55
22
  const PROGRESS_STRIDE_BYTES = 8 * 1024 * 1024;
56
- /**
57
- * What this host answers for a version date it does not hold. NOT a 404: it reads as a malformed request rather than a
58
- * missing file, which is why the message below says so and why the date comes from the catalogue rather than a guess.
59
- */
60
23
  const UNKNOWN_VERSION_STATUS = 400;
61
24
  /**
62
- * Download and unzip one survey area, returning where its pieces landed.
25
+ * Downloads and unzips one survey area into the cache, skipping completed steps.
26
+ * Returns the paths to its files.
63
27
  *
64
- * Downloads to a `.part` file and renames only on a clean finish, so an interrupted transfer never presents as a
65
- * complete archive — the same discipline the database build uses, for the same reason.
28
+ * The download goes through a `.part` file so an interrupted transfer never looks like a complete archive.
66
29
  *
67
- * @throws {Error} When the host answers anything but 200, or when the extracted tree does not hold the two directories
68
- * every survey area publishes.
30
+ * @throws {Error} When the host answers anything but 200, or when the extracted
31
+ * tree lacks the `spatial` or `tabular` directory.
69
32
  */
70
33
  export async function downloadSurveyArea(options) {
71
- const vintageDirectory = join(options.cacheRoot, options.versionDate);
72
- const root = join(vintageDirectory, options.areaSymbol);
73
- const archivePath = join(vintageDirectory, `wss_SSA_${options.areaSymbol}.zip`);
34
+ const vintageDirectory = PathBuilder.from(options.cacheRoot)(options.versionDate);
35
+ const root = vintageDirectory(options.areaSymbol);
36
+ const archivePath = vintageDirectory(`wss_SSA_${options.areaSymbol}.zip`);
74
37
  if (!(await tryStat(root))) {
75
38
  await makeDirectories(vintageDirectory);
76
39
  if (await tryStat(archivePath)) {
@@ -85,21 +48,18 @@ export async function downloadSurveyArea(options) {
85
48
  describeStatus: (status) => status === UNKNOWN_VERSION_STATUS
86
49
  ? " — this host answers 400 rather than 404 for a version date it does not hold, so check the date against sacatalog.saverest"
87
50
  : undefined,
88
- // Every progress line names the area, because a full acquisition interleaves hundreds of them.
89
51
  ...(options.onProgress
90
52
  ? { onProgress: (message) => options.onProgress?.(`${options.areaSymbol}: ${message}`) }
91
53
  : {}),
92
54
  });
93
55
  }
94
- // The archive holds its files under an `<AREASYMBOL>/` root already, so it unzips into the vintage directory
95
- // rather than into a directory named for itself.
96
56
  await runFile("unzip", ["-o", "-q", archivePath, "-d", vintageDirectory]);
97
57
  }
98
58
  else {
99
59
  options.onProgress?.(`${options.areaSymbol}: already extracted for ${options.versionDate}`);
100
60
  }
101
- const spatialDirectory = join(root, "spatial");
102
- const tabularDirectory = join(root, "tabular");
61
+ const spatialDirectory = root("spatial");
62
+ const tabularDirectory = root("tabular");
103
63
  for (const directory of [spatialDirectory, tabularDirectory]) {
104
64
  if (!(await tryStat(directory))) {
105
65
  throw new Error(`soil download: ${options.areaSymbol} extracted without a ${directory} directory — every survey area publishes both spatial/ and tabular/, so this archive is not the product`);
@@ -1 +1 @@
1
- {"version":3,"file":"download.js","sourceRoot":"","sources":["../../lib/sdk/download.ts"],"names":[],"mapp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CAAA;IAExC,KAAK,MAAM,SAAS,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,CAAC;QAC9D,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACd,kBAAkB,OAAO,CAAC,UAAU,wBAAwB,SAAS,yGAAyG,CAC9K,CAAA;QACF,CAAC;IACF,CAAC;IAED,OAAO;QACN,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,IAAI;QACJ,gBAAgB;QAChB,gBAAgB;QAChB,WAAW;KACX,CAAA;AACF,CAAC"}
@@ -3,28 +3,26 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The streaming pass — every delineation into `soil_map_unit_area` and into the build's touch table — as a
7
- * unit of work that can run over PART of one survey area.
6
+ * This streaming pass writes each delineation to `soil_map_unit_area` and the build's touch table.
7
+ * It can process part of one survey area as a unit of work.
8
8
  *
9
- * WHY THIS IS A CHUNK RATHER THAN A WHOLE FILE. h3's WASM heap cannot be reset from JavaScript, and it does
10
- * not survive an unbounded number of polyfill calls: over the flood layer's real product, runs died after
11
- * roughly 510,000 and 798,000 features on geometry that classifies in milliseconds in a fresh process. A
12
- * build that completes only when fragmentation happens to stay low is not a reproducible build, so the
13
- * classification is bounded by construction — {@linkcode buildSoilDatabase} runs one of these per range of
14
- * the shapefile's own FIDs, each in its own process, and each therefore against a heap that starts empty.
15
- * Iowa's 99 survey areas hold far more delineations together than any one of them does, which is why the
16
- * bound is per RANGE rather than per area.
9
+ * H3's wasm heap cannot be reset from JavaScript. It also cannot sustain unlimited polyfill calls.
10
+ * Two runs over the flood layer's real product stopped after roughly 510,000 and 798,000 features.
11
+ * The same geometries classify in milliseconds in a fresh process. A build that completes only when
12
+ * fragmentation stays low is not reproducible. {@linkcode buildSoilDatabase} bounds each process to a range
13
+ * of the shapefile's FIDs. Each range gets a separate process with a fresh heap. Iowa's 99 survey areas
14
+ * contain far more delineations together than each area contains by itself. The bound therefore applies per range.
17
15
  *
18
- * THE CHUNK OWNS NO ARTIFACT. It appends rows to a database the parent created and will seal, and returns
19
- * counts the parent adds up. Chunks run one at a time against that file, so there is no concurrent writer
20
- * and no locking to reason about.
16
+ * The chunk appends rows to a database created by the parent. The parent seals that database and adds up
17
+ * the counts returned by each chunk. Chunks run one at a time against the file, so only one writer uses it.
21
18
  */
22
19
  import type { DatabaseClient } from "@mailwoman/sqlite/client";
23
20
  import type { SoilDatabase } from "#schema";
24
- import type { SoilFeatureSource } from "#sdk/ingest/index";
21
+ import type { SoilFeatureSource } from "#sdk/ingest";
25
22
  /**
26
- * What one chunk produced. Every field is JSON-serializable, because a chunk normally reports across a process
27
- * boundary.
23
+ * What one chunk produced.
24
+ *
25
+ * Every field is JSON-serializable, because a chunk normally reports across a process boundary.
28
26
  */
29
27
  export interface SoilChunkResult {
30
28
  areaSymbol: string;
@@ -34,19 +32,22 @@ export interface SoilChunkResult {
34
32
  */
35
33
  coarsened: number;
36
34
  /**
37
- * `[coverageCell, delineationsReachingIt]` pairs — an array rather than a `Map` so it survives the process boundary.
35
+ * `[coverageCell, delineationsReachingIt]` pairs — an array rather than a `Map`
36
+ * so it survives the process boundary.
38
37
  */
39
38
  observedByCoverageCell: Array<[number, number]>;
40
39
  /**
41
- * The same, counting only delineations whose map unit HAS soil mapping behind it.
40
+ * The same, counting only delineations whose map unit has soil mapping behind it.
41
+ *
42
+ * Separate from the total because the coverage rule depends on this value.
43
+ * A cell reached only by `notcom` or access-denied polygons lies inside a published
44
+ * survey area and contains no digitized soil mapping.
42
45
  *
43
- * Separate from the total because the coverage rule turns on it: a coverage cell reached only by `NOTCOM` and
44
- * access-denied polygons is inside a published survey area and carries no digitized soil mapping, and the survey's
45
- * §3.2 gives it no row.
46
+ * Section 3.2 of the survey specification assigns no row to that cell.
46
47
  */
47
48
  mappedByCoverageCell: Array<[number, number]>;
48
49
  /**
49
- * Square metres: the encoded rings read WITH their holes, and read without.
50
+ * Square meters computed from the encoded rings, with holes and with every ring treated as exterior.
50
51
  */
51
52
  area: {
52
53
  nestedM2: number;
@@ -58,8 +59,10 @@ export interface IngestSoilChunkOptions {
58
59
  indexResolution: number;
59
60
  coverageResolution: number;
60
61
  /**
61
- * The map units with NO soil mapping behind them — `NOTCOM`, `NOTPUB`, access denied, or no readable component
62
- * weights. Passed in rather than joined here so the chunk stays a streaming pass over geometry.
62
+ * The map units with no soil mapping behind them — `notcom`, `notpub`,
63
+ * access denied, or no readable component weights.
64
+ *
65
+ * Passed in rather than joined here so the chunk stays a streaming pass over geometry.
63
66
  */
64
67
  noMappingMukeys: ReadonlySet<string>;
65
68
  onProgress?: (message: string) => void;
@@ -67,7 +70,8 @@ export interface IngestSoilChunkOptions {
67
70
  /**
68
71
  * Stream one chunk of one survey area into `database`.
69
72
  *
70
- * @throws {Error} On a delineation the classifier refuses — which includes the allocator's silent zero-cell answer.
73
+ * @throws {Error} On a delineation the classifier refuses — which includes the
74
+ * allocator's silent zero-cell answer.
71
75
  */
72
76
  export declare function ingestSoilChunk(database: DatabaseClient<SoilDatabase>, options: IngestSoilChunkOptions): Promise<SoilChunkResult>;
73
77
  //# sourceMappingURL=chunk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../lib/sdk/ingest/chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAa1D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,SAAS,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;;;;;OAQG;IACH,oBAAoB,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC7C;;OAEG;IACH,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAA;CACjD;AAED,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,iBAAiB,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B;;;;;OAKG;IACH,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACpC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACpC,QAAQ,EAAE,cAAc,CAAC,YAAY,CAAC,EACtC,OAAO,EAAE,sBAAsB,GAC7B,OAAO,CAAC,eAAe,CAAC,CA2F1B"}
@@ -3,28 +3,29 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The streaming pass — every delineation into `soil_map_unit_area` and into the build's touch table — as a
7
- * unit of work that can run over PART of one survey area.
6
+ * This streaming pass writes each delineation to `soil_map_unit_area` and the build's touch table.
7
+ * It can process part of one survey area as a unit of work.
8
8
  *
9
- * WHY THIS IS A CHUNK RATHER THAN A WHOLE FILE. h3's WASM heap cannot be reset from JavaScript, and it does
10
- * not survive an unbounded number of polyfill calls: over the flood layer's real product, runs died after
11
- * roughly 510,000 and 798,000 features on geometry that classifies in milliseconds in a fresh process. A
12
- * build that completes only when fragmentation happens to stay low is not a reproducible build, so the
13
- * classification is bounded by construction — {@linkcode buildSoilDatabase} runs one of these per range of
14
- * the shapefile's own FIDs, each in its own process, and each therefore against a heap that starts empty.
15
- * Iowa's 99 survey areas hold far more delineations together than any one of them does, which is why the
16
- * bound is per RANGE rather than per area.
9
+ * H3's wasm heap cannot be reset from JavaScript. It also cannot sustain unlimited polyfill calls.
10
+ * Two runs over the flood layer's real product stopped after roughly 510,000 and 798,000 features.
11
+ * The same geometries classify in milliseconds in a fresh process. A build that completes only when
12
+ * fragmentation stays low is not reproducible. {@linkcode buildSoilDatabase} bounds each process to a range
13
+ * of the shapefile's FIDs. Each range gets a separate process with a fresh heap. Iowa's 99 survey areas
14
+ * contain far more delineations together than each area contains by itself. The bound therefore applies per range.
17
15
  *
18
- * THE CHUNK OWNS NO ARTIFACT. It appends rows to a database the parent created and will seal, and returns
19
- * counts the parent adds up. Chunks run one at a time against that file, so there is no concurrent writer
20
- * and no locking to reason about.
16
+ * The chunk appends rows to a database created by the parent. The parent seals that database and adds up
17
+ * the counts returned by each chunk. Chunks run one at a time against the file, so only one writer uses it.
21
18
  */
22
19
  import { addCoverageCells, encodeRings, ringAreaReadings, ringsBoundingBox, shortCellToInt } from "@mailwoman/spatial";
23
20
  import { beginBatched } from "@mailwoman/sqlite/batched";
24
21
  import { classifyDelineationCells } from "#sdk/cells";
25
22
  /**
26
- * Rows per bulk-insert transaction. Chosen for the geometry table, whose rows carry a blob: a larger transaction grows
27
- * the write-ahead file without improving throughput.
23
+ * Rows per bulk-insert transaction.
24
+ *
25
+ * Chosen for the geometry table.
26
+ * Each row contains a blob.
27
+ *
28
+ * A larger transaction grows the write-ahead file without improving throughput.
28
29
  */
29
30
  const INSERT_TRANSACTION_ROWS = 5000;
30
31
  /**
@@ -34,7 +35,8 @@ const PROGRESS_STRIDE = 20_000;
34
35
  /**
35
36
  * Stream one chunk of one survey area into `database`.
36
37
  *
37
- * @throws {Error} On a delineation the classifier refuses — which includes the allocator's silent zero-cell answer.
38
+ * @throws {Error} On a delineation the classifier refuses — which includes the
39
+ * allocator's silent zero-cell answer.
38
40
  */
39
41
  export async function ingestSoilChunk(database, options) {
40
42
  const insertArea = database.prepare("INSERT INTO soil_map_unit_area (area_id, mukey, areasymbol, min_lat, min_lon, max_lat, max_lon, rings) " +
@@ -1 +1 @@
1
- {"version":3,"file":"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,sBAAsB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,sBAAsB,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;gBAE7F,IAAI,UAAU,EAAE,CAAC;oBAChB,oBAAoB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;gBAC1F,CAAC;YACF,CAAC;YAED,YAAY,EAAE,CAAA;YAEd,KAAK,CAAC,UAAU,EAAE,CAAA;YAElB,IAAI,YAAY,GAAG,eAAe,KAAK,CAAC,EAAE,CAAC;gBAC1C,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,6BAA6B,CAAC,CAAA;YACpF,CAAC;QACF,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,KAAK,CAAC,eAAe,EAAE,CAAA;QAEvB,MAAM,KAAK,CAAA;IACZ,CAAC;IAED,OAAO;QACN,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU;QACrC,YAAY;QACZ,SAAS;QACT,sBAAsB,EAAE,CAAC,GAAG,sBAAsB,CAAC;QACnD,oBAAoB,EAAE,CAAC,GAAG,oBAAoB,CAAC;QAC/C,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE;KAC9D,CAAA;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * One chunk of the soil ingest as its own process, spawned by `buildSoilDatabase` and never run by hand.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../sdk/ingest/worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -3,14 +3,12 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * One chunk of the soil ingest, as its own process — spawned by `buildSoilDatabase`, never run by hand.
7
- * The process boundary and the stdout contract live with `runIngestChunkScript`; what stays here is only
8
- * this product's flags and its feature-source constructor.
6
+ * One chunk of the soil ingest as its own process, spawned by `buildSoilDatabase` and never run by hand.
9
7
  */
10
8
  import { requiredArgument } from "@mailwoman/core/scripting/arguments";
11
9
  import { INGEST_CHUNK_FLAGS, runIngestChunkScript } from "@mailwoman/core/scripting/ingest-chunk-script";
10
+ import { createShapefileFeatureSource } from "#sdk/ingest";
12
11
  import { ingestSoilChunk } from "#sdk/ingest/chunk";
13
- import { createShapefileFeatureSource } from "#sdk/ingest/index";
14
12
  await runIngestChunkScript({
15
13
  context: "soil ingest-chunk",
16
14
  options: {
@@ -23,20 +21,23 @@ await runIngestChunkScript({
23
21
  },
24
22
  run: async (database, values, chunk) => ingestSoilChunk(database, {
25
23
  source: await createShapefileFeatureSource({
26
- shapefilePath: requiredArgument("soil ingest-chunk", "shapefile", values.shapefile),
27
- areaSymbol: requiredArgument("soil ingest-chunk", "area-symbol", values["area-symbol"]),
28
- fidFrom: Number(requiredArgument("soil ingest-chunk", "fid-from", values["fid-from"])),
29
- fidTo: Number(requiredArgument("soil ingest-chunk", "fid-to", values["fid-to"])),
30
- // A range's own count is not knowable up front — `ogrinfo` reports the layer's total and nothing narrower — so
31
- // the chunk asserts nothing about its size and the PARENT checks the per-area sum against the shapefile's.
24
+ shapefilePath: requiredArgument("soil ingest-chunk", "shapefile", values.shapefile ?? null),
25
+ areaSymbol: requiredArgument("soil ingest-chunk", "area-symbol", values["area-symbol"] ?? null),
26
+ fidFrom: Number(requiredArgument("soil ingest-chunk", "fid-from", values["fid-from"] ?? null)),
27
+ fidTo: Number(requiredArgument("soil ingest-chunk", "fid-to", values["fid-to"] ?? null)),
28
+ // A range's own count is not knowable up front — `ogrinfo` reports the layer's total
29
+ // and no narrower count — so the chunk makes no assertion about its size
30
+ // and the parent checks the per-area sum against the shapefile's.
32
31
  declaredFeatureCount: 0,
33
32
  }),
34
33
  indexResolution: chunk.indexResolution,
35
34
  coverageResolution: chunk.coverageResolution,
36
- // An empty string is an empty set, not "every map unit": a build where nothing lacks soil mapping passes one, and
37
- // `"".split(",")` yields one empty element that has to be dropped rather than joined against as a mukey.
38
- noMappingMukeys: new Set((values["no-mapping-mukeys"] ?? "").split(",").filter((mukey) => mukey.length > 0)),
35
+ // An empty string is an empty set rather than "every map unit": a build
36
+ // where every map unit has soil mapping passes one.
37
+ // `"".split(",")` yields one empty element that has to be dropped
38
+ // rather than joined against as a mukey.
39
+ noMappingMukeys: new Set((values["no-mapping-mukeys"] ?? "").split(",").filter((mukey) => mukey.length)),
39
40
  onProgress: chunk.onProgress,
40
41
  }),
41
42
  });
42
- //# sourceMappingURL=ingest-chunk.js.map
43
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../sdk/ingest/worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;AAIxG,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,oBAAoB,CAAC;IAC1B,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE;QACR,GAAG,kBAAkB;QACrB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC9B,QAAQ,EAAE,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Ellis, et al.
5
+ */
6
+ import { type MultiPolygonRings } from "@mailwoman/spatial";
7
+ import { PathBuilder, type PathBuilderLike } from "path-ts";
8
+ /**
9
+ * Returns the path of the shapefile that holds a survey area's map-unit polygons.
10
+ */
11
+ export declare function mapUnitShapefile(spatialDirectory: PathBuilderLike, areaSymbol: string): string;
12
+ /**
13
+ * Returns the path of the shapefile holding a survey area's outline.
14
+ *
15
+ * The build takes the footprint from this outline because unrated map units such as `notcom` lie inside it.
16
+ * A union of rated polygons would leave them out.
17
+ */
18
+ export declare function surveyAreaShapefile(spatialDirectory: PathBuilderLike, areaSymbol: string): PathBuilder;
19
+ /**
20
+ * One map-unit delineation, reprojected to WGS84.
21
+ */
22
+ export interface SoilDelineation {
23
+ /**
24
+ * The delineation's identifier, formed as `<areasymbol>:<fid>`.
25
+ */
26
+ areaID: string;
27
+ mukey: string;
28
+ areasymbol: string;
29
+ polygons: MultiPolygonRings;
30
+ }
31
+ /**
32
+ * The metadata that a shapefile declares, read before any feature.
33
+ */
34
+ export interface SoilSourceIdentity {
35
+ epsg: number;
36
+ featureCount: number;
37
+ layer: string;
38
+ /**
39
+ * The layer's declared extent as `[minLon, minLat, maxLon, maxLat]`.
40
+ */
41
+ bbox: readonly [number, number, number, number];
42
+ }
43
+ /**
44
+ * Options for reading one SSURGO map-unit shapefile.
45
+ */
46
+ export interface SoilIngestOptions {
47
+ shapefilePath: string;
48
+ /**
49
+ * The layer inside the shapefile.
50
+ *
51
+ * The ESRI driver reports that name.
52
+ *
53
+ * @defaultValue the file's base name.
54
+ */
55
+ layer?: string;
56
+ /**
57
+ * The EPSG code that the source must declare.
58
+ *
59
+ * @defaultValue the SSURGO source projection.
60
+ */
61
+ expectEPSG?: number;
62
+ /**
63
+ * The inclusive range of shapefile FIDs to read.
64
+ * A build can use it to read one chunk.
65
+ */
66
+ fidFrom?: number;
67
+ fidTo?: number;
68
+ /**
69
+ * The maximum number of features to read.
70
+ * Fixture and smoke runs use it.
71
+ */
72
+ limit?: number;
73
+ }
74
+ /**
75
+ * Reads the projection, feature count, layer name and extent that a shapefile declares.
76
+ *
77
+ * It throws when the shapefile declares a projection other than `expectEPSG`.
78
+ */
79
+ export declare function readSoilSourceIdentity(options: SoilIngestOptions): Promise<SoilSourceIdentity>;
80
+ /**
81
+ * Streams a shapefile's map-unit delineations reprojected to WGS84.
82
+ *
83
+ * It throws when a feature lacks geometry or `mukey`.
84
+ * It also throws when a vertex falls outside the declared extent.
85
+ *
86
+ * The extent check catches swapped coordinate axes that the projection check misses.
87
+ */
88
+ export declare function readSoilDelineations(options: SoilIngestOptions & {
89
+ bbox: readonly [number, number, number, number];
90
+ }): AsyncGenerator<SoilDelineation>;
91
+ /**
92
+ * Supplies a soil build with its delineations and the source's declared identity.
93
+ *
94
+ * The builder takes this instead of a path so that fixtures can run the database
95
+ * build without network access or GDAL.
96
+ */
97
+ export interface SoilFeatureSource {
98
+ areaSymbol: string;
99
+ /**
100
+ * The feature count that the source declares.
101
+ *
102
+ * The build throws when its streamed total differs from this count.
103
+ */
104
+ declaredFeatureCount: number;
105
+ layer: string;
106
+ epsg: number;
107
+ /**
108
+ * A description of where the delineations came from, such as the shapefile path.
109
+ */
110
+ origin: string;
111
+ delineations: () => AsyncIterable<SoilDelineation>;
112
+ }
113
+ /**
114
+ * Creates a {@link SoilFeatureSource} for one survey area's shapefile.
115
+ *
116
+ * It reads the shapefile's identity immediately and streams features when asked.
117
+ */
118
+ export declare function createShapefileFeatureSource(options: SoilIngestOptions & {
119
+ areaSymbol: string;
120
+ declaredFeatureCount?: number;
121
+ }): Promise<SoilFeatureSource>;
122
+ //# sourceMappingURL=ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../sdk/ingest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAiD,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAG1G,OAAO,EAAY,WAAW,EAAE,KAAK,eAAe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