@bedrock-engineer/bro-xml-parser 0.2.0 → 0.4.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 (116) hide show
  1. package/README.md +21 -12
  2. package/dist/browser.d.ts +15 -5
  3. package/dist/browser.d.ts.map +1 -1
  4. package/dist/browser.js +7 -5
  5. package/dist/browser.js.map +1 -1
  6. package/dist/core/columns.d.ts +80 -0
  7. package/dist/core/columns.d.ts.map +1 -0
  8. package/dist/core/columns.js +100 -0
  9. package/dist/core/columns.js.map +1 -0
  10. package/dist/core/producer.d.ts +216 -0
  11. package/dist/core/producer.d.ts.map +1 -0
  12. package/dist/core/producer.js +85 -0
  13. package/dist/core/producer.js.map +1 -0
  14. package/dist/core/schema-parser.d.ts +41 -17
  15. package/dist/core/schema-parser.d.ts.map +1 -1
  16. package/dist/core/schema-parser.js +178 -73
  17. package/dist/core/schema-parser.js.map +1 -1
  18. package/dist/core/version-detector.d.ts +3 -1
  19. package/dist/core/version-detector.d.ts.map +1 -1
  20. package/dist/core/version-detector.js +37 -0
  21. package/dist/core/version-detector.js.map +1 -1
  22. package/dist/decoders/constants.d.ts +2 -0
  23. package/dist/decoders/constants.d.ts.map +1 -0
  24. package/dist/decoders/constants.js +2 -0
  25. package/dist/decoders/constants.js.map +1 -0
  26. package/dist/decoders/type-decoders.d.ts +38 -0
  27. package/dist/decoders/type-decoders.d.ts.map +1 -0
  28. package/dist/decoders/type-decoders.js +134 -0
  29. package/dist/decoders/type-decoders.js.map +1 -0
  30. package/dist/namespaces.d.ts.map +1 -1
  31. package/dist/namespaces.js +16 -0
  32. package/dist/namespaces.js.map +1 -1
  33. package/dist/node.d.ts +15 -5
  34. package/dist/node.d.ts.map +1 -1
  35. package/dist/node.js +7 -5
  36. package/dist/node.js.map +1 -1
  37. package/dist/parser.d.ts +69 -19
  38. package/dist/parser.d.ts.map +1 -1
  39. package/dist/parser.js +103 -29
  40. package/dist/parser.js.map +1 -1
  41. package/dist/producers.d.ts +36 -0
  42. package/dist/producers.d.ts.map +1 -0
  43. package/dist/producers.js +35 -0
  44. package/dist/producers.js.map +1 -0
  45. package/dist/resolvers/bhrg-resolvers.d.ts +3 -18
  46. package/dist/resolvers/bhrg-resolvers.d.ts.map +1 -1
  47. package/dist/resolvers/bhrg-resolvers.js +294 -41
  48. package/dist/resolvers/bhrg-resolvers.js.map +1 -1
  49. package/dist/resolvers/bore-resolver-utils.d.ts +21 -2
  50. package/dist/resolvers/bore-resolver-utils.d.ts.map +1 -1
  51. package/dist/resolvers/bore-resolver-utils.js +69 -22
  52. package/dist/resolvers/bore-resolver-utils.js.map +1 -1
  53. package/dist/resolvers/bore-resolvers.d.ts +34 -17
  54. package/dist/resolvers/bore-resolvers.d.ts.map +1 -1
  55. package/dist/resolvers/bore-resolvers.js +342 -175
  56. package/dist/resolvers/bore-resolvers.js.map +1 -1
  57. package/dist/resolvers/cpt-resolvers.d.ts +1 -8
  58. package/dist/resolvers/cpt-resolvers.d.ts.map +1 -1
  59. package/dist/resolvers/cpt-resolvers.js +2 -29
  60. package/dist/resolvers/cpt-resolvers.js.map +1 -1
  61. package/dist/resolvers/gld-resolvers.d.ts +30 -0
  62. package/dist/resolvers/gld-resolvers.d.ts.map +1 -0
  63. package/dist/resolvers/gld-resolvers.js +76 -0
  64. package/dist/resolvers/gld-resolvers.js.map +1 -0
  65. package/dist/resolvers/gmw-resolvers.d.ts +37 -0
  66. package/dist/resolvers/gmw-resolvers.d.ts.map +1 -0
  67. package/dist/resolvers/gmw-resolvers.js +101 -0
  68. package/dist/resolvers/gmw-resolvers.js.map +1 -0
  69. package/dist/resolvers/type-resolvers.d.ts +12 -4
  70. package/dist/resolvers/type-resolvers.d.ts.map +1 -1
  71. package/dist/resolvers/type-resolvers.js +12 -4
  72. package/dist/resolvers/type-resolvers.js.map +1 -1
  73. package/dist/resolvers.d.ts +5 -2
  74. package/dist/resolvers.d.ts.map +1 -1
  75. package/dist/resolvers.js +8 -2
  76. package/dist/resolvers.js.map +1 -1
  77. package/dist/schema-presets.d.ts +67 -16
  78. package/dist/schema-presets.d.ts.map +1 -1
  79. package/dist/schema-presets.js +51 -114
  80. package/dist/schema-presets.js.map +1 -1
  81. package/dist/schemas/bhrg-schema.d.ts +528 -9
  82. package/dist/schemas/bhrg-schema.d.ts.map +1 -1
  83. package/dist/schemas/bhrg-schema.js +330 -162
  84. package/dist/schemas/bhrg-schema.js.map +1 -1
  85. package/dist/schemas/bhrgt-analysis.d.ts +1057 -0
  86. package/dist/schemas/bhrgt-analysis.d.ts.map +1 -0
  87. package/dist/schemas/bhrgt-analysis.js +454 -0
  88. package/dist/schemas/bhrgt-analysis.js.map +1 -0
  89. package/dist/schemas/bore-schema.d.ts +773 -9
  90. package/dist/schemas/bore-schema.d.ts.map +1 -1
  91. package/dist/schemas/bore-schema.js +344 -257
  92. package/dist/schemas/bore-schema.js.map +1 -1
  93. package/dist/schemas/common-fields.d.ts +61 -0
  94. package/dist/schemas/common-fields.d.ts.map +1 -0
  95. package/dist/schemas/common-fields.js +82 -0
  96. package/dist/schemas/common-fields.js.map +1 -0
  97. package/dist/schemas/cpt-schema.d.ts +126 -9
  98. package/dist/schemas/cpt-schema.d.ts.map +1 -1
  99. package/dist/schemas/cpt-schema.js +182 -275
  100. package/dist/schemas/cpt-schema.js.map +1 -1
  101. package/dist/schemas/generated/gld.generated.d.ts +9 -0
  102. package/dist/schemas/generated/gld.generated.d.ts.map +1 -0
  103. package/dist/schemas/generated/gld.generated.js +19 -0
  104. package/dist/schemas/generated/gld.generated.js.map +1 -0
  105. package/dist/schemas/gld-schema.d.ts +92 -0
  106. package/dist/schemas/gld-schema.d.ts.map +1 -0
  107. package/dist/schemas/gld-schema.js +88 -0
  108. package/dist/schemas/gld-schema.js.map +1 -0
  109. package/dist/schemas/gmw-schema.d.ts +180 -0
  110. package/dist/schemas/gmw-schema.d.ts.map +1 -0
  111. package/dist/schemas/gmw-schema.js +131 -0
  112. package/dist/schemas/gmw-schema.js.map +1 -0
  113. package/dist/types/index.d.ts +51 -1005
  114. package/dist/types/index.d.ts.map +1 -1
  115. package/dist/types/index.js.map +1 -1
  116. package/package.json +3 -2
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Type decoder functions for converting XML values to JavaScript types
3
+ */
4
+ /**
5
+ * Parse float, handle null values and -999999 sentinel
6
+ */
7
+ export declare function parseFloat(value: string | null | undefined): number | null;
8
+ export declare function parseInt(value: string | null | undefined): number | null;
9
+ export declare function parseBoolean(value: string | null | undefined): boolean | null;
10
+ /**
11
+ * Normalize a BRO temporal value to a precision-preserving ISO 8601 string.
12
+ *
13
+ * BRO date/dateTime elements are a choice of full date (`YYYY-MM-DD`),
14
+ * year-month (`YYYY-MM`), year (`YYYY`), full `dateTime`, or a `voidReason`
15
+ * code (e.g. "onbekend") when the value is unknown. The exact lexical value is
16
+ * returned unchanged so no precision or timezone information is lost;
17
+ * `voidReason` codes and any unrecognized input yield `null`.
18
+ *
19
+ * Timezone handling (per BRO): `dateTime` values carry a mandatory offset, which
20
+ * for Dutch data is the seasonal `+01:00` (winter) / `+02:00` (summer) — never
21
+ * `Z`. BRO derives the calendar date from the *Dutch-local* time, so the
22
+ * intended date is simply the lexical `YYYY-MM-DD` prefix of the string. We keep
23
+ * the string verbatim precisely to avoid a UTC conversion silently shifting the
24
+ * date across midnight (BRO's own worked example of the pitfall). Consumers can
25
+ * build a `Date`/`Temporal` when needed, but beware: `new Date("YYYY-MM-DD")` on
26
+ * a date-only value is parsed as UTC midnight and can render as the previous day
27
+ * in negative-offset zones — treat date-only values as plain calendar dates.
28
+ * @see https://www.bro-productomgeving.nl/bpo/release-2.5_2024_Q4/informatie-voor-softwareleveranciers/het-afhandelen-van-tijdstippen
29
+ *
30
+ * Unlike the numeric decoders this does not warn on non-matching input,
31
+ * because `voidReason` is a legitimate and common value in archive data.
32
+ */
33
+ export declare function parseDate(value: string | null | undefined): string | null;
34
+ /**
35
+ * Parse quality class (handles "klasse2" or "2" format)
36
+ */
37
+ export declare function parseQualityClass(value: string | null): number | null;
38
+ //# sourceMappingURL=type-decoders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-decoders.d.ts","sourceRoot":"","sources":["../../src/decoders/type-decoders.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAmB1E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAiBxE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAgB7E;AAgBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAezE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAcrE"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Type decoder functions for converting XML values to JavaScript types
3
+ */
4
+ import { SENTINEL } from "./constants.js";
5
+ /**
6
+ * BRO uses two different missing-value conventions depending on the record
7
+ * type: CPT measurement CSVs use the -999999 sentinel, while the BHR-GT-BMA lab
8
+ * value tables (settlement/consolidation time-series) use the literal "NaN".
9
+ * The latter should resolve to null rather than being warned about as a parse
10
+ * error.
11
+ */
12
+ function isMissingNumber(value) {
13
+ return value.trim().toLowerCase() === "nan";
14
+ }
15
+ /**
16
+ * Parse float, handle null values and -999999 sentinel
17
+ */
18
+ export function parseFloat(value) {
19
+ // BRO encodes a missing numeric value as an empty string, the -999999
20
+ // sentinel, or the literal "NaN" (common in embedded measurement CSVs).
21
+ if (!value || value.trim() === "" || value === String(SENTINEL) || isMissingNumber(value)) {
22
+ return null;
23
+ }
24
+ try {
25
+ const num = Number.parseFloat(value);
26
+ if (isNaN(num)) {
27
+ console.warn(`Failed to parse float value: "${value}"`);
28
+ return null;
29
+ }
30
+ return num;
31
+ }
32
+ catch (error) {
33
+ const message = error instanceof Error ? error.message : String(error);
34
+ console.warn(`Failed to parse float value: "${value}" - ${message}`);
35
+ return null;
36
+ }
37
+ }
38
+ export function parseInt(value) {
39
+ if (!value || value.trim() === "" || value === String(SENTINEL) || isMissingNumber(value)) {
40
+ return null;
41
+ }
42
+ try {
43
+ const num = Number.parseInt(value, 10);
44
+ if (isNaN(num)) {
45
+ console.warn(`Failed to parse integer value: "${value}"`);
46
+ return null;
47
+ }
48
+ return num;
49
+ }
50
+ catch (error) {
51
+ const message = error instanceof Error ? error.message : String(error);
52
+ console.warn(`Failed to parse integer value: "${value}" - ${message}`);
53
+ return null;
54
+ }
55
+ }
56
+ export function parseBoolean(value) {
57
+ if (!value) {
58
+ return null;
59
+ }
60
+ const normalized = value.trim().toLowerCase();
61
+ if (normalized === "ja" || normalized === "true" || normalized === "1") {
62
+ return true;
63
+ }
64
+ if (normalized === "nee" || normalized === "false" || normalized === "0") {
65
+ return false;
66
+ }
67
+ return null;
68
+ }
69
+ /**
70
+ * BRO temporal lexical forms, ordered most-specific first.
71
+ * xs:dateTime YYYY-MM-DDThh:mm:ss(.sss)?(Z|±hh:mm)?
72
+ * xs:date YYYY-MM-DD
73
+ * yearMonth YYYY-MM
74
+ * year YYYY
75
+ */
76
+ const BRO_DATE_FORMATS = [
77
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/,
78
+ /^\d{4}-\d{2}-\d{2}$/,
79
+ /^\d{4}-\d{2}$/,
80
+ /^\d{4}$/,
81
+ ];
82
+ /**
83
+ * Normalize a BRO temporal value to a precision-preserving ISO 8601 string.
84
+ *
85
+ * BRO date/dateTime elements are a choice of full date (`YYYY-MM-DD`),
86
+ * year-month (`YYYY-MM`), year (`YYYY`), full `dateTime`, or a `voidReason`
87
+ * code (e.g. "onbekend") when the value is unknown. The exact lexical value is
88
+ * returned unchanged so no precision or timezone information is lost;
89
+ * `voidReason` codes and any unrecognized input yield `null`.
90
+ *
91
+ * Timezone handling (per BRO): `dateTime` values carry a mandatory offset, which
92
+ * for Dutch data is the seasonal `+01:00` (winter) / `+02:00` (summer) — never
93
+ * `Z`. BRO derives the calendar date from the *Dutch-local* time, so the
94
+ * intended date is simply the lexical `YYYY-MM-DD` prefix of the string. We keep
95
+ * the string verbatim precisely to avoid a UTC conversion silently shifting the
96
+ * date across midnight (BRO's own worked example of the pitfall). Consumers can
97
+ * build a `Date`/`Temporal` when needed, but beware: `new Date("YYYY-MM-DD")` on
98
+ * a date-only value is parsed as UTC midnight and can render as the previous day
99
+ * in negative-offset zones — treat date-only values as plain calendar dates.
100
+ * @see https://www.bro-productomgeving.nl/bpo/release-2.5_2024_Q4/informatie-voor-softwareleveranciers/het-afhandelen-van-tijdstippen
101
+ *
102
+ * Unlike the numeric decoders this does not warn on non-matching input,
103
+ * because `voidReason` is a legitimate and common value in archive data.
104
+ */
105
+ export function parseDate(value) {
106
+ if (!value) {
107
+ return null;
108
+ }
109
+ const trimmed = value.trim();
110
+ if (trimmed === "") {
111
+ return null;
112
+ }
113
+ if (BRO_DATE_FORMATS.some((format) => format.test(trimmed))) {
114
+ return trimmed;
115
+ }
116
+ return null;
117
+ }
118
+ /**
119
+ * Parse quality class (handles "klasse2" or "2" format)
120
+ */
121
+ export function parseQualityClass(value) {
122
+ if (!value) {
123
+ return null;
124
+ }
125
+ // Handle "klasse2" format
126
+ const regex = /klasse(\d+)/i;
127
+ const match = regex.exec(value);
128
+ if (match?.[1]) {
129
+ return Number.parseInt(match[1], 10);
130
+ }
131
+ // Handle plain number
132
+ return parseInt(value);
133
+ }
134
+ //# sourceMappingURL=type-decoders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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,CAAC,KAAgC;IACxD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,MAAM,KAAK,GAAG,cAAc,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,sBAAsB;IACtB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"namespaces.d.ts","sourceRoot":"","sources":["../src/namespaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAqB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,MAAM,CAe3C,CAAC"}
1
+ {"version":3,"file":"namespaces.d.ts","sourceRoot":"","sources":["../src/namespaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAiC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,MAAM,CAqB3C,CAAC"}
@@ -19,11 +19,21 @@ export const BRO_NAMESPACES = {
19
19
  // BHR-G namespaces (dsbhrg/3.1)
20
20
  dsbhrg: "http://www.broservices.nl/xsd/dsbhrg/3.1",
21
21
  bhrgcom: "http://www.broservices.nl/xsd/bhrgcommon/3.1",
22
+ // GMW namespaces (Grondwatermonitoringput, dsgmw/1.1)
23
+ dsgmw: "http://www.broservices.nl/xsd/dsgmw/1.1",
24
+ gmwcommon: "http://www.broservices.nl/xsd/gmwcommon/1.1",
25
+ // GLD namespaces (Grondwaterstandonderzoek, dsgld/1.0)
26
+ dsgld: "http://www.broservices.nl/xsd/dsgld/1.0",
27
+ gldcommon: "http://www.broservices.nl/xsd/gldcommon/1.0",
22
28
  // Common geospatial namespaces
23
29
  gml: "http://www.opengis.net/gml/3.2",
24
30
  swe: "http://www.opengis.net/swe/2.0",
25
31
  om: "http://www.opengis.net/om/2.0",
26
32
  sampling: "http://www.opengis.net/sampling/2.0",
33
+ // OGC WaterML 2.0 - GLD groundwater level time-series (docs use prefix "waterml";
34
+ // XPath binds by URI, so "wml2" here resolves those elements regardless).
35
+ wml2: "http://www.opengis.net/waterml/2.0",
36
+ xlink: "http://www.w3.org/1999/xlink",
27
37
  };
28
38
  /**
29
39
  * List of known BRO namespace prefixes
@@ -44,5 +54,11 @@ export const KNOWN_BRO_PREFIXES = [
44
54
  "bhrgtcom",
45
55
  "dsbhrg",
46
56
  "bhrgcom",
57
+ "dsgmw",
58
+ "gmwcommon",
59
+ "dsgld",
60
+ "gldcommon",
61
+ "wml2",
62
+ "xlink",
47
63
  ];
48
64
  //# sourceMappingURL=namespaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../src/namespaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,iBAAiB;IACjB,KAAK,EAAE,yCAAyC;IAChD,MAAM,EAAE,6CAA6C;IACrD,SAAS,EAAE,6CAA6C;IAExD,wCAAwC;IACxC,OAAO,EAAE,4CAA4C;IACrD,SAAS,EAAE,6CAA6C;IACxD,KAAK,EAAE,yCAAyC;IAChD,QAAQ,EAAE,+CAA+C;IAEzD,gCAAgC;IAChC,MAAM,EAAE,0CAA0C;IAClD,OAAO,EAAE,8CAA8C;IAEvD,+BAA+B;IAC/B,GAAG,EAAE,gCAAgC;IACrC,GAAG,EAAE,gCAAgC;IACrC,EAAE,EAAE,+BAA+B;IACnC,QAAQ,EAAE,qCAAqC;CAChD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA0B;IACvD,OAAO;IACP,QAAQ;IACR,WAAW;IACX,KAAK;IACL,KAAK;IACL,IAAI;IACJ,UAAU;IACV,OAAO;IACP,SAAS;IACT,WAAW;IACX,OAAO;IACP,UAAU;IACV,QAAQ;IACR,SAAS;CACD,CAAC"}
1
+ {"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../src/namespaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,iBAAiB;IACjB,KAAK,EAAE,yCAAyC;IAChD,MAAM,EAAE,6CAA6C;IACrD,SAAS,EAAE,6CAA6C;IAExD,wCAAwC;IACxC,OAAO,EAAE,4CAA4C;IACrD,SAAS,EAAE,6CAA6C;IACxD,KAAK,EAAE,yCAAyC;IAChD,QAAQ,EAAE,+CAA+C;IAEzD,gCAAgC;IAChC,MAAM,EAAE,0CAA0C;IAClD,OAAO,EAAE,8CAA8C;IAEvD,sDAAsD;IACtD,KAAK,EAAE,yCAAyC;IAChD,SAAS,EAAE,6CAA6C;IAExD,uDAAuD;IACvD,KAAK,EAAE,yCAAyC;IAChD,SAAS,EAAE,6CAA6C;IAExD,+BAA+B;IAC/B,GAAG,EAAE,gCAAgC;IACrC,GAAG,EAAE,gCAAgC;IACrC,EAAE,EAAE,+BAA+B;IACnC,QAAQ,EAAE,qCAAqC;IAC/C,kFAAkF;IAClF,0EAA0E;IAC1E,IAAI,EAAE,oCAAoC;IAC1C,KAAK,EAAE,8BAA8B;CACtC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA0B;IACvD,OAAO;IACP,QAAQ;IACR,WAAW;IACX,KAAK;IACL,KAAK;IACL,IAAI;IACJ,UAAU;IACV,OAAO;IACP,SAAS;IACT,WAAW;IACX,OAAO;IACP,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,WAAW;IACX,OAAO;IACP,WAAW;IACX,MAAM;IACN,OAAO;CACC,CAAC"}
package/dist/node.d.ts CHANGED
@@ -13,15 +13,25 @@
13
13
  */
14
14
  export { BROParser } from "./parser.js";
15
15
  export { NodeXMLAdapter as XMLAdapter } from "./adapters/node-adapter.js";
16
- export type { CPTData, CPTMeasurement, BHRGTData, BHRGTLayer, Grainshape, BHRGData, BHRGLayer, BROData, BROFileType, Location, ParseMeta, Schema, SchemaField, ResolverFunction, ResolverContext, Namespaces, BoreholeSampleAnalysis, InvestigatedInterval, ParticleSizeDistributionDetermination, ConsistencyLimitsDetermination, SettlementCharacteristicsDetermination, SaturatedPermeabilityDetermination, SaturatedPermeabilityAtSpecificDensity, ShearStressChangeDuringLoadingDetermination, SettlementDeterminationStep, ShearStressAtSpecificStrain, MaximumUndrainedShearStrengthDetermination, ShearStressChangeDuringHorizontalDeformationDetermination, ConsolidationStageAtHorizontalDeformation, ConsolidationStepAtHorizontalDeformation, ShearStageAtHorizontalDeformation, HorizontalDeformationDataPoint, HeightAtSpecificConsolidationTime, DissipationTest, DissipationMeasurement, QualityRegime, PlasticityAtSpecificWaterContent, HeightAtSpecificTime, MembraneCorrection, DrainageStripCorrection, SaturationStageAtLoading, SaturationStageAtCompression, SpecimenMadeForLoading, StressAtSpecificSettlement, VolumeChangeAtSpecificTime, ConsolidationStageAtLoading, LoadStage, RemovedLayer, RegistrationHistory, ReportHistory, IntermediateEvent, BoredInterval, SamplerDetails, SampledInterval, CompletedInterval, NotDescribedInterval, WaterContentDetermination, VolumetricMassDensityDetermination, OrganicMatterContentDetermination, CarbonateContentDetermination, VolumetricMassDensityOfSolidsDetermination, } from "./types/index.js";
16
+ export type { CPTData, CPTMeasurement, DissipationMeasurement, BHRGTData, BHRGData, GMWData, GLDData, BROData, BROFileType, Location, ParseMeta, Namespaces, QualityRegime, } from "./types/index.js";
17
+ export type { RegistrationHistory } from "./schemas/common-fields.js";
17
18
  export { BROParseError } from "./types/index.js";
18
19
  export { SUPPORTED_VERSIONS } from "./core/version-detector.js";
19
20
  export type { DataType } from "./core/version-detector.js";
20
- export { CPT_SCHEMA } from "./schemas/cpt-schema.js";
21
- export { BORE_SCHEMA } from "./schemas/bore-schema.js";
22
- export { BHRG_SCHEMA } from "./schemas/bhrg-schema.js";
21
+ export { CPT_PRODUCER } from "./schemas/cpt-schema.js";
22
+ export type { DissipationTest, RemovedLayer } from "./schemas/cpt-schema.js";
23
+ export { BORE_PRODUCER } from "./schemas/bore-schema.js";
24
+ export type { BHRGTLayer, BHRGTLayerBase, BHRGTSoilLayer, BHRGTRockLayer, RockDescription, RockWeatheringDegree, Grainshape, BoredInterval, SampledInterval, SamplerDetails, CoreRecovery, CompletedInterval, PostSedimentaryDiscontinuity, ExcavatedLayer, BoringVelocityMeasurement, NotDescribedInterval, FluidMudLayer, } from "./schemas/bore-schema.js";
25
+ export type { HeightAtSpecificTime, StressAtSpecificSettlement, VolumeChangeAtSpecificTime, ShearStressAtSpecificStrain, HorizontalDeformationDataPoint, BoreholeSampleAnalysis, InvestigatedInterval, WaterContentDetermination, VolumetricMassDensityDetermination, OrganicMatterContentDetermination, CarbonateContentDetermination, VolumetricMassDensityOfSolidsDetermination, MaximumUndrainedShearStrengthDetermination, ParticleSizeDistributionDetermination, ConsistencyLimitsDetermination, SettlementCharacteristicsDetermination, SettlementDeterminationStep, SaturationStageAtCompression, SaturatedPermeabilityDetermination, ShearStressChangeDuringLoadingDetermination, ConsolidationStepAtHorizontalDeformation, ShearStressChangeDuringHorizontalDeformationDetermination, PlasticityAtSpecificWaterContent, SaturatedPermeabilityAtSpecificDensity, SaturatedPermeabilityAtSpecificLoad, MembraneCorrection, DrainageStripCorrection, SpecimenMadeForLoading, SaturationStageAtLoading, ConsolidationStageAtLoading, LoadStage, ConsolidationStageAtHorizontalDeformation, ShearStageAtHorizontalDeformation, } from "./schemas/bhrgt-analysis.js";
26
+ export type { GLDObservation, GLDObservationPoint, GroundwaterMonitoringTubeRef, } from "./schemas/gld-schema.js";
27
+ export { BHRG_PRODUCER } from "./schemas/bhrg-schema.js";
28
+ export type { BHRGLayer, MunsellColour, SandFraction, SandConstituent, ShellFraction, ShellConstituent, GravelFraction, GravelConstituent, PeatFraction, PeatConstituent, Chunk, FractionDistribution, FineFractionDistributionOrganicSoil, FineFractionDistributionShellySoil, Mottle, ThinStratum, ReportHistory, IntermediateEvent, } from "./schemas/bhrg-schema.js";
29
+ export { GMW_PRODUCER } from "./schemas/gmw-schema.js";
30
+ export type { MonitoringTube, GeoOhmCable, Electrode, GMWIntermediateEvent, } from "./schemas/gmw-schema.js";
31
+ export { GLD_PRODUCER } from "./schemas/gld-schema.js";
23
32
  export { BRO_NAMESPACES, KNOWN_BRO_PREFIXES } from "./namespaces.js";
24
33
  export { BRO_SOIL_COLORS, getSoilColor, isValidSoilColor, getSoilColorNames } from "./colors.js";
25
- export * as resolvers from "./resolvers.js";
34
+ export * as producers from "./producers.js";
35
+ export type { Producer, NodeLens, Produced, ProducedFields } from "./core/producer.js";
26
36
  export * as presets from "./schema-presets.js";
27
37
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@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AAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGjG,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAG5C,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC"}
package/dist/node.js CHANGED
@@ -15,13 +15,15 @@ export { BROParser } from "./parser.js";
15
15
  export { NodeXMLAdapter as XMLAdapter } from "./adapters/node-adapter.js";
16
16
  export { BROParseError } from "./types/index.js";
17
17
  export { SUPPORTED_VERSIONS } from "./core/version-detector.js";
18
- export { CPT_SCHEMA } from "./schemas/cpt-schema.js";
19
- export { BORE_SCHEMA } from "./schemas/bore-schema.js";
20
- export { BHRG_SCHEMA } from "./schemas/bhrg-schema.js";
18
+ export { CPT_PRODUCER } from "./schemas/cpt-schema.js";
19
+ export { BORE_PRODUCER } from "./schemas/bore-schema.js";
20
+ export { BHRG_PRODUCER } from "./schemas/bhrg-schema.js";
21
+ export { GMW_PRODUCER } from "./schemas/gmw-schema.js";
22
+ export { GLD_PRODUCER } from "./schemas/gld-schema.js";
21
23
  export { BRO_NAMESPACES, KNOWN_BRO_PREFIXES } from "./namespaces.js";
22
24
  export { BRO_SOIL_COLORS, getSoilColor, isValidSoilColor, getSoilColorNames } from "./colors.js";
23
- // Export resolvers for custom schema definitions
24
- export * as resolvers from "./resolvers.js";
25
+ // The authoring surface for custom schemas (combinators + domain helpers).
26
+ export * as producers from "./producers.js";
25
27
  // Export schema presets for common use cases
26
28
  export * as presets from "./schema-presets.js";
27
29
  //# sourceMappingURL=node.js.map
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["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YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEjG,2EAA2E;AAC3E,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAK5C,6CAA6C;AAC7C,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC"}
package/dist/parser.d.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  * The adapter is provided at construction time, making testing and
6
6
  * environment-specific behavior explicit.
7
7
  */
8
- import type { XMLAdapter, Namespaces, CPTData, BHRGTData, BHRGData, BROData, ParseMeta, Schema, BROFileType } from "./types/index.js";
8
+ import type { XMLAdapter, Namespaces, CPTData, BHRGTData, BHRGData, GMWData, GLDData, BROData, ParseMeta, BROFileType } from "./types/index.js";
9
+ import type { Producer, ProducedFields, Presence } from "./core/producer.js";
9
10
  /**
10
11
  * Main BRO Parser class
11
12
  *
@@ -105,6 +106,55 @@ export declare class BROParser {
105
106
  * ```
106
107
  */
107
108
  parseBHRG(xmlText: string): BHRGData;
109
+ /**
110
+ * Parse GMW (groundwater monitoring well) data from BRO/XML string
111
+ *
112
+ * Extracts well metadata and its monitoring tubes following the IMBRO GMW
113
+ * schema (dsgmw/1.1). Works on the public dispatch document (`GMW_PPO`) as
114
+ * well as the `GMW_PO` / `GMW_O` variants, which share one leaf surface.
115
+ *
116
+ * @param xmlText - BRO/XML document as string
117
+ * @returns Parsed GMW data with metadata and monitoring tubes
118
+ * @throws {BROParseError} If parsing fails or required fields are missing
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const parser = new BROParser(new XMLAdapter());
123
+ * const gmw = parser.parseGMW(xmlString);
124
+ *
125
+ * console.log(gmw.broId); // "GMW000000048066"
126
+ * console.log(gmw.numberOfMonitoringTubes); // 1
127
+ * console.log(gmw.monitoringTubes[0].screenLength); // 1.0
128
+ * console.log(gmw.meta.schemaVersion); // "1.1"
129
+ * ```
130
+ */
131
+ parseGMW(xmlText: string): GMWData;
132
+ /**
133
+ * Parse GLD (groundwater level research) data from BRO/XML string
134
+ *
135
+ * Extracts the monitoring-point reference, monitoring-net membership and the
136
+ * groundwater level observation time-series following the IMBRO GLD schema
137
+ * (dsgld/1.0).
138
+ *
139
+ * Note: full GLD dispatch documents can be very large (years of time-series
140
+ * measurements). Consider requesting a bounded observation period from the BRO
141
+ * REST API before parsing.
142
+ *
143
+ * @param xmlText - BRO/XML document as string
144
+ * @returns Parsed GLD data with metadata and observation series
145
+ * @throws {BROParseError} If parsing fails or required fields are missing
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const parser = new BROParser(new XMLAdapter());
150
+ * const gld = parser.parseGLD(xmlString);
151
+ *
152
+ * console.log(gld.broId); // "GLD000000010000"
153
+ * console.log(gld.monitoringPoint?.broId); // "GMW000000020142"
154
+ * console.log(gld.observations[0].points.length); // 8760
155
+ * ```
156
+ */
157
+ parseGLD(xmlText: string): GLDData;
108
158
  /**
109
159
  * Parse any BRO XML document, auto-detecting the data type
110
160
  *
@@ -140,35 +190,35 @@ export declare class BROParser {
140
190
  * This allows you to extract only the fields you need, which can be
141
191
  * more efficient and gives you full control over the output structure.
142
192
  *
193
+ * Pass a bare map of field name → {@link Producer}, built from the `producers`
194
+ * authoring surface. The return type is inferred from the map: each field's
195
+ * type is its producer's output type, plus a `meta` block. Author the map as
196
+ * an inline literal (or with `satisfies Record<string, Producer<unknown>>`) so
197
+ * the field types are preserved for inference.
198
+ *
143
199
  * @param xmlText - BRO/XML document as string
144
- * @param schema - Custom schema defining fields to extract
200
+ * @param fields - Field name → producer map defining what to extract
145
201
  * @param dataType - The BRO data type (for version validation)
146
- * @returns Object with extracted fields matching your schema
202
+ * @returns Object with extracted fields matching your map, plus `meta`
147
203
  *
148
204
  * @example
149
205
  * ```typescript
150
- * import { BROParser, resolvers } from '@bedrock-engineer/bro-xml-parser';
206
+ * import { BROParser, producers as p } from '@bedrock-engineer/bro-xml-parser';
151
207
  *
152
208
  * const parser = new BROParser(new XMLAdapter());
153
209
  *
154
210
  * // Define only the fields you need
155
- * const mySchema = {
156
- * id: { xpath: 'brocom:broId' },
157
- * depth: {
158
- * xpath: './/cptcommon:finalDepth',
159
- * resolver: resolvers.parseFloat
160
- * },
161
- * location: {
162
- * xpath: './dscpt:deliveredLocation/cptcommon:location',
163
- * resolver: resolvers.parseGMLLocation
164
- * }
165
- * };
166
- *
167
- * const result = parser.parseCustom(xmlText, mySchema, 'CPT');
168
- * // { id: "CPT000000099543", depth: 25.5, location: { x: 155000, y: 463000, epsg: "EPSG:28992" } }
211
+ * const result = parser.parseCustom(xmlText, {
212
+ * id: p.text('brocom:broId'), // string | null
213
+ * depth: p.number_('./dscpt:conePenetrometerSurvey/cptcommon:trajectory/cptcommon:finalDepth'),
214
+ * location: p.gmlLocation('./dscpt:deliveredLocation/cptcommon:location'),
215
+ * }, 'CPT');
216
+ *
217
+ * result.depth; // number | null — inferred, no casts
218
+ * result.location; // Location | null
169
219
  * ```
170
220
  */
171
- parseCustom(xmlText: string, schema: Schema, dataType?: BROFileType): Record<string, unknown> & {
221
+ parseCustom<const F extends Record<string, Producer<unknown, Presence>>>(xmlText: string, fields: F, dataType?: BROFileType): ProducedFields<F> & {
172
222
  meta: ParseMeta;
173
223
  };
174
224
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,MAAM,CAAe;IAE7B;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IAKxD;;OAEG;IACH,OAAO,CAAC,UAAU;IAclB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAYlC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;IAYtC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ;IAYpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAYlC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAYlC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAwB/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,EACrE,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,EACT,QAAQ,CAAC,EAAE,WAAW,GACrB,cAAc,CAAC,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE;IA8B1C;;;OAGG;IACH,UAAU,IAAI,UAAU;CAGzB"}
package/dist/parser.js CHANGED
@@ -7,11 +7,14 @@
7
7
  */
8
8
  import { SchemaParser } from "./core/schema-parser.js";
9
9
  import { detectAndValidateVersion, getVersionInfo, } from "./core/version-detector.js";
10
- import { CPT_SCHEMA } from "./schemas/cpt-schema.js";
11
- import { BORE_SCHEMA } from "./schemas/bore-schema.js";
12
- import { BHRG_SCHEMA } from "./schemas/bhrg-schema.js";
10
+ import { CPT_PRODUCER } from "./schemas/cpt-schema.js";
11
+ import { BORE_PRODUCER } from "./schemas/bore-schema.js";
12
+ import { BHRG_PRODUCER } from "./schemas/bhrg-schema.js";
13
+ import { GMW_PRODUCER } from "./schemas/gmw-schema.js";
14
+ import { GLD_PRODUCER } from "./schemas/gld-schema.js";
13
15
  import { BRO_NAMESPACES } from "./namespaces.js";
14
16
  import { BROParseError } from "./types/index.js";
17
+ import { object_ } from "./core/producer.js";
15
18
  /**
16
19
  * Main BRO Parser class
17
20
  *
@@ -82,8 +85,9 @@ export class BROParser {
82
85
  const doc = this.adapter.parseXML(xmlText);
83
86
  const versionResult = detectAndValidateVersion(doc, "CPT");
84
87
  const meta = this.createMeta(versionResult);
85
- const data = this.parser.parse(doc, CPT_SCHEMA, "dispatchDocument");
86
- return { meta, ...data };
88
+ const { value, warnings } = this.parser.produce(doc, CPT_PRODUCER, "dispatchDocument");
89
+ meta.warnings.push(...warnings);
90
+ return { meta, ...value };
87
91
  }
88
92
  /**
89
93
  * Parse Bore (borehole) data from BRO/XML string
@@ -111,8 +115,9 @@ export class BROParser {
111
115
  const doc = this.adapter.parseXML(xmlText);
112
116
  const versionResult = detectAndValidateVersion(doc, "BHR-GT");
113
117
  const meta = this.createMeta(versionResult);
114
- const data = this.parser.parse(doc, BORE_SCHEMA, "dispatchDocument");
115
- return { meta, ...data };
118
+ const { value, warnings } = this.parser.produce(doc, BORE_PRODUCER, "dispatchDocument");
119
+ meta.warnings.push(...warnings);
120
+ return { meta, ...value };
116
121
  }
117
122
  /**
118
123
  * Parse BHR-G (Geological Borehole) data from BRO/XML string
@@ -140,8 +145,72 @@ export class BROParser {
140
145
  const doc = this.adapter.parseXML(xmlText);
141
146
  const versionResult = detectAndValidateVersion(doc, "BHR-G");
142
147
  const meta = this.createMeta(versionResult);
143
- const data = this.parser.parse(doc, BHRG_SCHEMA, "dispatchDocument");
144
- return { meta, ...data };
148
+ const { value, warnings } = this.parser.produce(doc, BHRG_PRODUCER, "dispatchDocument");
149
+ meta.warnings.push(...warnings);
150
+ return { meta, ...value };
151
+ }
152
+ /**
153
+ * Parse GMW (groundwater monitoring well) data from BRO/XML string
154
+ *
155
+ * Extracts well metadata and its monitoring tubes following the IMBRO GMW
156
+ * schema (dsgmw/1.1). Works on the public dispatch document (`GMW_PPO`) as
157
+ * well as the `GMW_PO` / `GMW_O` variants, which share one leaf surface.
158
+ *
159
+ * @param xmlText - BRO/XML document as string
160
+ * @returns Parsed GMW data with metadata and monitoring tubes
161
+ * @throws {BROParseError} If parsing fails or required fields are missing
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * const parser = new BROParser(new XMLAdapter());
166
+ * const gmw = parser.parseGMW(xmlString);
167
+ *
168
+ * console.log(gmw.broId); // "GMW000000048066"
169
+ * console.log(gmw.numberOfMonitoringTubes); // 1
170
+ * console.log(gmw.monitoringTubes[0].screenLength); // 1.0
171
+ * console.log(gmw.meta.schemaVersion); // "1.1"
172
+ * ```
173
+ */
174
+ parseGMW(xmlText) {
175
+ const doc = this.adapter.parseXML(xmlText);
176
+ const versionResult = detectAndValidateVersion(doc, "GMW");
177
+ const meta = this.createMeta(versionResult);
178
+ const { value, warnings } = this.parser.produce(doc, GMW_PRODUCER, "dispatchDocument");
179
+ meta.warnings.push(...warnings);
180
+ return { meta, ...value };
181
+ }
182
+ /**
183
+ * Parse GLD (groundwater level research) data from BRO/XML string
184
+ *
185
+ * Extracts the monitoring-point reference, monitoring-net membership and the
186
+ * groundwater level observation time-series following the IMBRO GLD schema
187
+ * (dsgld/1.0).
188
+ *
189
+ * Note: full GLD dispatch documents can be very large (years of time-series
190
+ * measurements). Consider requesting a bounded observation period from the BRO
191
+ * REST API before parsing.
192
+ *
193
+ * @param xmlText - BRO/XML document as string
194
+ * @returns Parsed GLD data with metadata and observation series
195
+ * @throws {BROParseError} If parsing fails or required fields are missing
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * const parser = new BROParser(new XMLAdapter());
200
+ * const gld = parser.parseGLD(xmlString);
201
+ *
202
+ * console.log(gld.broId); // "GLD000000010000"
203
+ * console.log(gld.monitoringPoint?.broId); // "GMW000000020142"
204
+ * console.log(gld.observations[0].points.length); // 8760
205
+ * ```
206
+ */
207
+ parseGLD(xmlText) {
208
+ const doc = this.adapter.parseXML(xmlText);
209
+ const versionResult = detectAndValidateVersion(doc, "GLD");
210
+ const meta = this.createMeta(versionResult);
211
+ const { value, warnings } = this.parser.produce(doc, GLD_PRODUCER, "dispatchDocument");
212
+ meta.warnings.push(...warnings);
213
+ return { meta, ...value };
145
214
  }
146
215
  /**
147
216
  * Parse any BRO XML document, auto-detecting the data type
@@ -186,6 +255,10 @@ export class BROParser {
186
255
  return this.parseBHRGT(xmlText);
187
256
  case "BHR-G":
188
257
  return this.parseBHRG(xmlText);
258
+ case "GMW":
259
+ return this.parseGMW(xmlText);
260
+ case "GLD":
261
+ return this.parseGLD(xmlText);
189
262
  }
190
263
  }
191
264
  /**
@@ -194,35 +267,35 @@ export class BROParser {
194
267
  * This allows you to extract only the fields you need, which can be
195
268
  * more efficient and gives you full control over the output structure.
196
269
  *
270
+ * Pass a bare map of field name → {@link Producer}, built from the `producers`
271
+ * authoring surface. The return type is inferred from the map: each field's
272
+ * type is its producer's output type, plus a `meta` block. Author the map as
273
+ * an inline literal (or with `satisfies Record<string, Producer<unknown>>`) so
274
+ * the field types are preserved for inference.
275
+ *
197
276
  * @param xmlText - BRO/XML document as string
198
- * @param schema - Custom schema defining fields to extract
277
+ * @param fields - Field name → producer map defining what to extract
199
278
  * @param dataType - The BRO data type (for version validation)
200
- * @returns Object with extracted fields matching your schema
279
+ * @returns Object with extracted fields matching your map, plus `meta`
201
280
  *
202
281
  * @example
203
282
  * ```typescript
204
- * import { BROParser, resolvers } from '@bedrock-engineer/bro-xml-parser';
283
+ * import { BROParser, producers as p } from '@bedrock-engineer/bro-xml-parser';
205
284
  *
206
285
  * const parser = new BROParser(new XMLAdapter());
207
286
  *
208
287
  * // Define only the fields you need
209
- * const mySchema = {
210
- * id: { xpath: 'brocom:broId' },
211
- * depth: {
212
- * xpath: './/cptcommon:finalDepth',
213
- * resolver: resolvers.parseFloat
214
- * },
215
- * location: {
216
- * xpath: './dscpt:deliveredLocation/cptcommon:location',
217
- * resolver: resolvers.parseGMLLocation
218
- * }
219
- * };
220
- *
221
- * const result = parser.parseCustom(xmlText, mySchema, 'CPT');
222
- * // { id: "CPT000000099543", depth: 25.5, location: { x: 155000, y: 463000, epsg: "EPSG:28992" } }
288
+ * const result = parser.parseCustom(xmlText, {
289
+ * id: p.text('brocom:broId'), // string | null
290
+ * depth: p.number_('./dscpt:conePenetrometerSurvey/cptcommon:trajectory/cptcommon:finalDepth'),
291
+ * location: p.gmlLocation('./dscpt:deliveredLocation/cptcommon:location'),
292
+ * }, 'CPT');
293
+ *
294
+ * result.depth; // number | null — inferred, no casts
295
+ * result.location; // Location | null
223
296
  * ```
224
297
  */
225
- parseCustom(xmlText, schema, dataType) {
298
+ parseCustom(xmlText, fields, dataType) {
226
299
  const doc = this.adapter.parseXML(xmlText);
227
300
  // Validate version if dataType is provided
228
301
  let meta;
@@ -246,8 +319,9 @@ export class BROParser {
246
319
  };
247
320
  }
248
321
  }
249
- const data = this.parser.parse(doc, schema, "dispatchDocument");
250
- return { meta, ...data };
322
+ const { value, warnings } = this.parser.produce(doc, object_({ fields }), "dispatchDocument");
323
+ meta.warnings.push(...warnings);
324
+ return { meta, ...value };
251
325
  }
252
326
  /**
253
327
  * Get the underlying XML adapter