@welldot/core 0.4.0-next.20261014.26249fd → 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 (48) hide show
  1. package/README.md +14 -4
  2. package/dist/index.cjs +51 -2
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +20 -1
  5. package/dist/index.d.ts +20 -1
  6. package/dist/index.js +50 -2
  7. package/dist/index.js.map +1 -1
  8. package/examples/README.md +83 -0
  9. package/examples/belem-pa-condominio-outorga.well +961 -0
  10. package/examples/belem-pa-monitoramento-posto.well +1141 -0
  11. package/examples/belem-pa-pirabas-abastecimento.well +1751 -0
  12. package/examples/belem-pa-poco-colmatado.well +496 -0
  13. package/examples/belem-pa-poco-raso-abandonado.well +388 -0
  14. package/examples/belem-pa-qualidade-agua-acida.well +895 -0
  15. package/examples/colatina-es-gnaisse-rural.well +1047 -0
  16. package/examples/coluna-mg-cristalino-abastecimento.well +1437 -0
  17. package/examples/estrela-doeste-sp-bauru-serra-geral.well +919 -0
  18. package/examples/extremoz-rn-barreiras-raso.well +623 -0
  19. package/examples/gastao-vidigal-sp-dados-inconsistentes.well +222 -0
  20. package/examples/index.json +452 -0
  21. package/examples/irece-ba-carste-bambui.well +861 -0
  22. package/examples/lagoa-santa-mg-carste-abastecimento.well +1087 -0
  23. package/examples/minas-novas-mg-cadastro-incompleto.well +157 -0
  24. package/examples/quixeramobim-ce-cristalino-salobro.well +989 -0
  25. package/examples/rinopolis-sp-estratigrafico-guarani.well +287 -0
  26. package/examples/santarem-pa-jorrante-alter-do-chao.well +554 -0
  27. package/examples/sao-gabriel-rs-cacimba.well +360 -0
  28. package/examples/sete-lagoas-mg-carste-industrial.well +410 -0
  29. package/examples/thumbs/belem-pa-condominio-outorga.svg +1 -0
  30. package/examples/thumbs/belem-pa-monitoramento-posto.svg +1 -0
  31. package/examples/thumbs/belem-pa-pirabas-abastecimento.svg +1 -0
  32. package/examples/thumbs/belem-pa-poco-colmatado.svg +1 -0
  33. package/examples/thumbs/belem-pa-poco-raso-abandonado.svg +1 -0
  34. package/examples/thumbs/belem-pa-qualidade-agua-acida.svg +1 -0
  35. package/examples/thumbs/colatina-es-gnaisse-rural.svg +1 -0
  36. package/examples/thumbs/coluna-mg-cristalino-abastecimento.svg +1 -0
  37. package/examples/thumbs/estrela-doeste-sp-bauru-serra-geral.svg +1 -0
  38. package/examples/thumbs/extremoz-rn-barreiras-raso.svg +1 -0
  39. package/examples/thumbs/gastao-vidigal-sp-dados-inconsistentes.svg +1 -0
  40. package/examples/thumbs/irece-ba-carste-bambui.svg +1 -0
  41. package/examples/thumbs/lagoa-santa-mg-carste-abastecimento.svg +1 -0
  42. package/examples/thumbs/minas-novas-mg-cadastro-incompleto.svg +1 -0
  43. package/examples/thumbs/quixeramobim-ce-cristalino-salobro.svg +1 -0
  44. package/examples/thumbs/rinopolis-sp-estratigrafico-guarani.svg +1 -0
  45. package/examples/thumbs/santarem-pa-jorrante-alter-do-chao.svg +1 -0
  46. package/examples/thumbs/sao-gabriel-rs-cacimba.svg +1 -0
  47. package/examples/thumbs/sete-lagoas-mg-carste-industrial.svg +1 -0
  48. package/package.json +5 -3
package/dist/index.d.cts CHANGED
@@ -15160,6 +15160,11 @@ declare function calculatedWellDepth(well: Well): number;
15160
15160
  * Serializes a {@link Well} object into a versioned JSON string suitable for
15161
15161
  * storage or transmission.
15162
15162
  *
15163
+ * Root members the spec does not define (`x-` fields and blocks, foreign
15164
+ * members) are written after the spec blocks, unchanged. Nested unknown
15165
+ * members travel inside their objects. Legacy v1 keys (`lat`, `lng`,
15166
+ * `elevation`, …) are never written.
15167
+ *
15163
15168
  * @param well - The well profile to serialize.
15164
15169
  * @returns A JSON string containing the versioned well payload.
15165
15170
  */
@@ -15173,6 +15178,16 @@ declare function serializeWell(well: Well): string;
15173
15178
  * @returns `true` if the well is considered empty, `false` otherwise.
15174
15179
  */
15175
15180
  declare function isWellEmpty(well: Well | null | undefined): boolean;
15181
+ /**
15182
+ * Returns `true` when the well holds any data at all: a profile (see
15183
+ * {@link isWellEmpty}) or any other filled root member — identification,
15184
+ * location, events, samples, permits, `x-` members, … A registry record
15185
+ * with no construction or geology is not empty by this measure, while
15186
+ * {@link isWellEmpty} (nothing to draw) still says it is.
15187
+ *
15188
+ * @param well - The well to check. `null` / `undefined` hold no data.
15189
+ */
15190
+ declare function hasWellData(well: Well | null | undefined): boolean;
15176
15191
  /**
15177
15192
  * Returns a copy of `well` with hidden sections and fields cleared: array
15178
15193
  * fields become `[]` and optional fields become `undefined`, so the result
@@ -15184,6 +15199,10 @@ declare function isWellEmpty(well: Well | null | undefined): boolean;
15184
15199
  * hidden. Hiding a record type does not rewrite references to it held by
15185
15200
  * visible records (e.g. a production entry's `meter_id`).
15186
15201
  *
15202
+ * Root members the spec does not define (`x-` fields and blocks) can hold
15203
+ * anything, so they are kept only when nothing is hidden. Unknown members
15204
+ * nested in a record follow that record.
15205
+ *
15187
15206
  * @param well - The well profile to redact.
15188
15207
  * @param visibility - Section and/or field visibility. A {@link SectionVisibility} works as-is.
15189
15208
  * @returns A new {@link Well} with hidden parts emptied.
@@ -15535,4 +15554,4 @@ declare function turbidityCodeForUnit(unit: string): 'turbidity' | 'turbidity_nt
15535
15554
  */
15536
15555
  declare function expandedToStandardUncertainty(expanded: number, coverageFactor?: number): number;
15537
15556
 
15538
- export { AQUIFER_ANALYSIS_METHODS, type AirliftEvent, AirliftEventSchema, type AquiferAnalysis, type AquiferAnalysisMethod, AquiferAnalysisSchema, type Attachment, type AttachmentDocumentType, AttachmentSchema, BLANK_SAMPLE_TYPES, BR_GM_MS_888_2021, type BoreHole, BoreHoleSchema, CEMENT_PAD_TYPES, CENTRALIZER_TYPES, CONDITION_CATEGORIES, CONSTRUCTION_MATERIALS, type Cave, CaveSchema, type CementPad, CementPadSchema, type CementPadType, type Centralizer, CentralizerSchema, type CentralizerType, type ConcentrationUnits, type ConditionCategory, type ConditionFulfillment, ConditionFulfillmentSchema, type ConstantRateEvent, ConstantRateEventSchema, type ConstructionMaterial, type Constructive, DOCUMENT_TYPES, DOCUMENT_TYPE_SUGGESTIONS, DRILLING_METHODS, type DiameterUnits, type DmsCoordinate, type DocumentTypeContext, type DrillingMethod, ESTIMATION_METHODS, EU_2020_2184, type EstimatedVolume, EstimatedVolumeSchema, type EstimationMethod, FGDC_TEXTURES_OPTIONS, FILTRATION_LOCATION_VALUES, FRACTION_VALUES, type Filtration, FiltrationSchema, type FlowUnits, type Fracture, FractureSchema, type Geologic, HISTORY_LOG_CATEGORIES, HISTORY_LOG_SEVERITIES, HYDRODYNAMIC_EVENT_TYPES, type HistoryLogCategory, type HistoryLogEntry, HistoryLogEntrySchema, type HistoryLogSeverity, type HoleFill, HoleFillSchema, type HydrodynamicEvent, type HydrodynamicEventBase, HydrodynamicEventBaseSchema, HydrodynamicEventSchema, type Laboratory, LaboratorySchema, type LanguageText, type LanguageTextInput, type LengthUnits, type LevelReading, LevelReadingSchema, type Limit, type LimitBasis, type LimitSet, type Lithology, LithologySchema, type Location, type LocationProperties, LocationPropertiesSchema, LocationSchema, MAINTENANCE_TYPES, MEASURED_IN_VALUES, MEASUREMENT_LOCATIONS, MEASUREMENT_METHODS, METER_TYPES, type MaintenanceType, type MeasurementMethod, type Meter, type MeterReading, MeterReadingSchema, MeterSchema, type MeterType, type MonthlyGrant, MonthlyGrantSchema, NEPHELOMETRIC_TURBIDITY_CODES, NUMERIC_QUALIFIERS, type OpenVocab, type OperatingRegime, OperatingRegimeSchema, PARAMETER_GROUPS, PARAMETER_GROUP_VALUES, PARENT_SAMPLE_TYPES, PERMIT_ADMINISTRATIVE_STATUSES, PERMIT_ADMINISTRATIVE_STATUS_VALUES, PERMIT_HISTORY_TYPES, PERMIT_TYPES, POWER_SOURCES, PRODUCTION_ENTRY_TYPES, PUMP_TYPES, type Parameter, type ParameterDefinition, type ParameterForm, type ParameterGroup, ParameterSchema, type ParameterUnit, type Permit, type PermitAdministrativeStatus, PermitAdministrativeStatusSchema, type PermitCondition, PermitConditionSchema, type PermitHistoryEntry, PermitHistoryEntrySchema, type PermitHistoryType, PermitSchema, type PermitType, type PowerSource, type PowerUnits, type ProductionEntry, type ProductionEntryBase, ProductionEntryBaseSchema, ProductionEntrySchema, type Well as Profile, type PumpElectrical, PumpElectricalSchema, type PumpInstallation, PumpInstallationSchema, type PumpType, type PumpingStep, PumpingStepSchema, type Purge, type PurgeReading, PurgeReadingSchema, PurgeSchema, QUALIFIER_VALUES, READING_SOURCES, RESULT_FRACTIONS, RESULT_QUALIFIERS, type ReadingSource, type RecoveryOnlyEvent, RecoveryOnlyEventSchema, type RecoveryPhase, RecoveryPhaseSchema, type Reduction, ReductionSchema, type ResultQualifier, ResultQualifierSchema, type ResultValidation, ResultValidationSchema, SAMPLE_TYPES, SAMPLING_DEVICES, SAMPLING_METHODS, SAMPLING_POINT_TYPES, SCREEN_SLOT_TYPES, SECTION_KEYS, type SampleType, type SamplingDevice, type SamplingMethod, type SamplingPoint, SamplingPointSchema, type SamplingPointType, type ScreenSlotType, type SectionKey, type SectionVisibility, type SpotMeasurementEvent, SpotMeasurementEventSchema, type StepDrawdownEvent, StepDrawdownEventSchema, type SurfaceCase, SurfaceCaseSchema, type Texture, type TextureCode, type TextureOption, TextureSchema, type TimeResolution, TimeResolutionSchema, type Units, type UnitsTypes, VALIDATION_STATUSES, VALIDATION_STATUS_VALUES, VISIBILITY_LEAF_KEYS, VISIBILITY_TREE, VOLUME_LIMIT_PERIODS, type VisibilityFieldKey, type VisibilityKey, type VocabEntry, type VolumeLimit, VolumeLimitSchema, type VolumeUnits, WATER_QUALITY_LIMIT_SETS, WATER_QUALITY_PARAMETERS, WATER_QUALITY_UNITS, WATER_QUALITY_VOCABULARY_VERSION, WATER_USES, WELL_PURPOSES, WELL_STATUSES, WELL_STATUS_VALUES, WELL_TYPES, WHO_GDWQ_2022, type WaterQualityResult, WaterQualityResultSchema, type WaterSample, WaterSampleSchema, type WaterUse, type Well, type WellCase, WellCaseSchema, type WellId, WellIdSchema, type WellPurpose, WellSchema, type WellScreen, WellScreenSchema, type WellStatus, WellStatusSchema, type WellType, type WellVisibility, calculatedWellDepth, checkIfProfileIsEmpty, concentrationFromCanonical, concentrationToCanonical, convertProfileFromJSON, cubicFeetToCubicMeters, cubicMeterPerHourToLitersPerSecond, cubicMeterPerHourToUsGallonsPerMinute, cubicMetersToCubicFeet, cubicMetersToLiters, cubicMetersToUsGallons, cvToKilowatts, decimalDegreesToDms, deserializeWell, dmsToDecimalDegrees, expandedToStandardUncertainty, feetToMeters, flowFromCanonical, flowToCanonical, formatVocabList, getLimitSet, getParameterDefinition, getParameterLabel, getVocabEntry, getVocabLabel, hoursToMinutes, hpToKilowatts, inchesToMm, isKnownParameter, isVocabValue, isWellEmpty, kilopascalToPsi, kilowattsToCv, kilowattsToHp, litersPerSecondToCubicMeterPerHour, litersToCubicMeters, metersToFeet, milliSiemensPerCmToMicroSiemensPerCm, milliSiemensPerMeterToMicroSiemensPerCm, minutesToHours, mmToInches, mmToSlotNumber, normalizeColorUnit, parameterKey, parseWell, powerFromCanonical, powerToCanonical, profileToWell, psiToKilopascal, redactWell, resolveLanguageText, serializeWell, slotNumberToMm, squareMeterPerDayToSquareMeterPerSecond, squareMeterPerSecondToSquareMeterPerDay, turbidityCodeForUnit, usGallonsPerMinuteToCubicMeterPerHour, usGallonsToCubicMeters, vocabValues, volumeFromCanonical, volumeToCanonical };
15557
+ export { AQUIFER_ANALYSIS_METHODS, type AirliftEvent, AirliftEventSchema, type AquiferAnalysis, type AquiferAnalysisMethod, AquiferAnalysisSchema, type Attachment, type AttachmentDocumentType, AttachmentSchema, BLANK_SAMPLE_TYPES, BR_GM_MS_888_2021, type BoreHole, BoreHoleSchema, CEMENT_PAD_TYPES, CENTRALIZER_TYPES, CONDITION_CATEGORIES, CONSTRUCTION_MATERIALS, type Cave, CaveSchema, type CementPad, CementPadSchema, type CementPadType, type Centralizer, CentralizerSchema, type CentralizerType, type ConcentrationUnits, type ConditionCategory, type ConditionFulfillment, ConditionFulfillmentSchema, type ConstantRateEvent, ConstantRateEventSchema, type ConstructionMaterial, type Constructive, DOCUMENT_TYPES, DOCUMENT_TYPE_SUGGESTIONS, DRILLING_METHODS, type DiameterUnits, type DmsCoordinate, type DocumentTypeContext, type DrillingMethod, ESTIMATION_METHODS, EU_2020_2184, type EstimatedVolume, EstimatedVolumeSchema, type EstimationMethod, FGDC_TEXTURES_OPTIONS, FILTRATION_LOCATION_VALUES, FRACTION_VALUES, type Filtration, FiltrationSchema, type FlowUnits, type Fracture, FractureSchema, type Geologic, HISTORY_LOG_CATEGORIES, HISTORY_LOG_SEVERITIES, HYDRODYNAMIC_EVENT_TYPES, type HistoryLogCategory, type HistoryLogEntry, HistoryLogEntrySchema, type HistoryLogSeverity, type HoleFill, HoleFillSchema, type HydrodynamicEvent, type HydrodynamicEventBase, HydrodynamicEventBaseSchema, HydrodynamicEventSchema, type Laboratory, LaboratorySchema, type LanguageText, type LanguageTextInput, type LengthUnits, type LevelReading, LevelReadingSchema, type Limit, type LimitBasis, type LimitSet, type Lithology, LithologySchema, type Location, type LocationProperties, LocationPropertiesSchema, LocationSchema, MAINTENANCE_TYPES, MEASURED_IN_VALUES, MEASUREMENT_LOCATIONS, MEASUREMENT_METHODS, METER_TYPES, type MaintenanceType, type MeasurementMethod, type Meter, type MeterReading, MeterReadingSchema, MeterSchema, type MeterType, type MonthlyGrant, MonthlyGrantSchema, NEPHELOMETRIC_TURBIDITY_CODES, NUMERIC_QUALIFIERS, type OpenVocab, type OperatingRegime, OperatingRegimeSchema, PARAMETER_GROUPS, PARAMETER_GROUP_VALUES, PARENT_SAMPLE_TYPES, PERMIT_ADMINISTRATIVE_STATUSES, PERMIT_ADMINISTRATIVE_STATUS_VALUES, PERMIT_HISTORY_TYPES, PERMIT_TYPES, POWER_SOURCES, PRODUCTION_ENTRY_TYPES, PUMP_TYPES, type Parameter, type ParameterDefinition, type ParameterForm, type ParameterGroup, ParameterSchema, type ParameterUnit, type Permit, type PermitAdministrativeStatus, PermitAdministrativeStatusSchema, type PermitCondition, PermitConditionSchema, type PermitHistoryEntry, PermitHistoryEntrySchema, type PermitHistoryType, PermitSchema, type PermitType, type PowerSource, type PowerUnits, type ProductionEntry, type ProductionEntryBase, ProductionEntryBaseSchema, ProductionEntrySchema, type Well as Profile, type PumpElectrical, PumpElectricalSchema, type PumpInstallation, PumpInstallationSchema, type PumpType, type PumpingStep, PumpingStepSchema, type Purge, type PurgeReading, PurgeReadingSchema, PurgeSchema, QUALIFIER_VALUES, READING_SOURCES, RESULT_FRACTIONS, RESULT_QUALIFIERS, type ReadingSource, type RecoveryOnlyEvent, RecoveryOnlyEventSchema, type RecoveryPhase, RecoveryPhaseSchema, type Reduction, ReductionSchema, type ResultQualifier, ResultQualifierSchema, type ResultValidation, ResultValidationSchema, SAMPLE_TYPES, SAMPLING_DEVICES, SAMPLING_METHODS, SAMPLING_POINT_TYPES, SCREEN_SLOT_TYPES, SECTION_KEYS, type SampleType, type SamplingDevice, type SamplingMethod, type SamplingPoint, SamplingPointSchema, type SamplingPointType, type ScreenSlotType, type SectionKey, type SectionVisibility, type SpotMeasurementEvent, SpotMeasurementEventSchema, type StepDrawdownEvent, StepDrawdownEventSchema, type SurfaceCase, SurfaceCaseSchema, type Texture, type TextureCode, type TextureOption, TextureSchema, type TimeResolution, TimeResolutionSchema, type Units, type UnitsTypes, VALIDATION_STATUSES, VALIDATION_STATUS_VALUES, VISIBILITY_LEAF_KEYS, VISIBILITY_TREE, VOLUME_LIMIT_PERIODS, type VisibilityFieldKey, type VisibilityKey, type VocabEntry, type VolumeLimit, VolumeLimitSchema, type VolumeUnits, WATER_QUALITY_LIMIT_SETS, WATER_QUALITY_PARAMETERS, WATER_QUALITY_UNITS, WATER_QUALITY_VOCABULARY_VERSION, WATER_USES, WELL_PURPOSES, WELL_STATUSES, WELL_STATUS_VALUES, WELL_TYPES, WHO_GDWQ_2022, type WaterQualityResult, WaterQualityResultSchema, type WaterSample, WaterSampleSchema, type WaterUse, type Well, type WellCase, WellCaseSchema, type WellId, WellIdSchema, type WellPurpose, WellSchema, type WellScreen, WellScreenSchema, type WellStatus, WellStatusSchema, type WellType, type WellVisibility, calculatedWellDepth, checkIfProfileIsEmpty, concentrationFromCanonical, concentrationToCanonical, convertProfileFromJSON, cubicFeetToCubicMeters, cubicMeterPerHourToLitersPerSecond, cubicMeterPerHourToUsGallonsPerMinute, cubicMetersToCubicFeet, cubicMetersToLiters, cubicMetersToUsGallons, cvToKilowatts, decimalDegreesToDms, deserializeWell, dmsToDecimalDegrees, expandedToStandardUncertainty, feetToMeters, flowFromCanonical, flowToCanonical, formatVocabList, getLimitSet, getParameterDefinition, getParameterLabel, getVocabEntry, getVocabLabel, hasWellData, hoursToMinutes, hpToKilowatts, inchesToMm, isKnownParameter, isVocabValue, isWellEmpty, kilopascalToPsi, kilowattsToCv, kilowattsToHp, litersPerSecondToCubicMeterPerHour, litersToCubicMeters, metersToFeet, milliSiemensPerCmToMicroSiemensPerCm, milliSiemensPerMeterToMicroSiemensPerCm, minutesToHours, mmToInches, mmToSlotNumber, normalizeColorUnit, parameterKey, parseWell, powerFromCanonical, powerToCanonical, profileToWell, psiToKilopascal, redactWell, resolveLanguageText, serializeWell, slotNumberToMm, squareMeterPerDayToSquareMeterPerSecond, squareMeterPerSecondToSquareMeterPerDay, turbidityCodeForUnit, usGallonsPerMinuteToCubicMeterPerHour, usGallonsToCubicMeters, vocabValues, volumeFromCanonical, volumeToCanonical };
package/dist/index.d.ts CHANGED
@@ -15160,6 +15160,11 @@ declare function calculatedWellDepth(well: Well): number;
15160
15160
  * Serializes a {@link Well} object into a versioned JSON string suitable for
15161
15161
  * storage or transmission.
15162
15162
  *
15163
+ * Root members the spec does not define (`x-` fields and blocks, foreign
15164
+ * members) are written after the spec blocks, unchanged. Nested unknown
15165
+ * members travel inside their objects. Legacy v1 keys (`lat`, `lng`,
15166
+ * `elevation`, …) are never written.
15167
+ *
15163
15168
  * @param well - The well profile to serialize.
15164
15169
  * @returns A JSON string containing the versioned well payload.
15165
15170
  */
@@ -15173,6 +15178,16 @@ declare function serializeWell(well: Well): string;
15173
15178
  * @returns `true` if the well is considered empty, `false` otherwise.
15174
15179
  */
15175
15180
  declare function isWellEmpty(well: Well | null | undefined): boolean;
15181
+ /**
15182
+ * Returns `true` when the well holds any data at all: a profile (see
15183
+ * {@link isWellEmpty}) or any other filled root member — identification,
15184
+ * location, events, samples, permits, `x-` members, … A registry record
15185
+ * with no construction or geology is not empty by this measure, while
15186
+ * {@link isWellEmpty} (nothing to draw) still says it is.
15187
+ *
15188
+ * @param well - The well to check. `null` / `undefined` hold no data.
15189
+ */
15190
+ declare function hasWellData(well: Well | null | undefined): boolean;
15176
15191
  /**
15177
15192
  * Returns a copy of `well` with hidden sections and fields cleared: array
15178
15193
  * fields become `[]` and optional fields become `undefined`, so the result
@@ -15184,6 +15199,10 @@ declare function isWellEmpty(well: Well | null | undefined): boolean;
15184
15199
  * hidden. Hiding a record type does not rewrite references to it held by
15185
15200
  * visible records (e.g. a production entry's `meter_id`).
15186
15201
  *
15202
+ * Root members the spec does not define (`x-` fields and blocks) can hold
15203
+ * anything, so they are kept only when nothing is hidden. Unknown members
15204
+ * nested in a record follow that record.
15205
+ *
15187
15206
  * @param well - The well profile to redact.
15188
15207
  * @param visibility - Section and/or field visibility. A {@link SectionVisibility} works as-is.
15189
15208
  * @returns A new {@link Well} with hidden parts emptied.
@@ -15535,4 +15554,4 @@ declare function turbidityCodeForUnit(unit: string): 'turbidity' | 'turbidity_nt
15535
15554
  */
15536
15555
  declare function expandedToStandardUncertainty(expanded: number, coverageFactor?: number): number;
15537
15556
 
15538
- export { AQUIFER_ANALYSIS_METHODS, type AirliftEvent, AirliftEventSchema, type AquiferAnalysis, type AquiferAnalysisMethod, AquiferAnalysisSchema, type Attachment, type AttachmentDocumentType, AttachmentSchema, BLANK_SAMPLE_TYPES, BR_GM_MS_888_2021, type BoreHole, BoreHoleSchema, CEMENT_PAD_TYPES, CENTRALIZER_TYPES, CONDITION_CATEGORIES, CONSTRUCTION_MATERIALS, type Cave, CaveSchema, type CementPad, CementPadSchema, type CementPadType, type Centralizer, CentralizerSchema, type CentralizerType, type ConcentrationUnits, type ConditionCategory, type ConditionFulfillment, ConditionFulfillmentSchema, type ConstantRateEvent, ConstantRateEventSchema, type ConstructionMaterial, type Constructive, DOCUMENT_TYPES, DOCUMENT_TYPE_SUGGESTIONS, DRILLING_METHODS, type DiameterUnits, type DmsCoordinate, type DocumentTypeContext, type DrillingMethod, ESTIMATION_METHODS, EU_2020_2184, type EstimatedVolume, EstimatedVolumeSchema, type EstimationMethod, FGDC_TEXTURES_OPTIONS, FILTRATION_LOCATION_VALUES, FRACTION_VALUES, type Filtration, FiltrationSchema, type FlowUnits, type Fracture, FractureSchema, type Geologic, HISTORY_LOG_CATEGORIES, HISTORY_LOG_SEVERITIES, HYDRODYNAMIC_EVENT_TYPES, type HistoryLogCategory, type HistoryLogEntry, HistoryLogEntrySchema, type HistoryLogSeverity, type HoleFill, HoleFillSchema, type HydrodynamicEvent, type HydrodynamicEventBase, HydrodynamicEventBaseSchema, HydrodynamicEventSchema, type Laboratory, LaboratorySchema, type LanguageText, type LanguageTextInput, type LengthUnits, type LevelReading, LevelReadingSchema, type Limit, type LimitBasis, type LimitSet, type Lithology, LithologySchema, type Location, type LocationProperties, LocationPropertiesSchema, LocationSchema, MAINTENANCE_TYPES, MEASURED_IN_VALUES, MEASUREMENT_LOCATIONS, MEASUREMENT_METHODS, METER_TYPES, type MaintenanceType, type MeasurementMethod, type Meter, type MeterReading, MeterReadingSchema, MeterSchema, type MeterType, type MonthlyGrant, MonthlyGrantSchema, NEPHELOMETRIC_TURBIDITY_CODES, NUMERIC_QUALIFIERS, type OpenVocab, type OperatingRegime, OperatingRegimeSchema, PARAMETER_GROUPS, PARAMETER_GROUP_VALUES, PARENT_SAMPLE_TYPES, PERMIT_ADMINISTRATIVE_STATUSES, PERMIT_ADMINISTRATIVE_STATUS_VALUES, PERMIT_HISTORY_TYPES, PERMIT_TYPES, POWER_SOURCES, PRODUCTION_ENTRY_TYPES, PUMP_TYPES, type Parameter, type ParameterDefinition, type ParameterForm, type ParameterGroup, ParameterSchema, type ParameterUnit, type Permit, type PermitAdministrativeStatus, PermitAdministrativeStatusSchema, type PermitCondition, PermitConditionSchema, type PermitHistoryEntry, PermitHistoryEntrySchema, type PermitHistoryType, PermitSchema, type PermitType, type PowerSource, type PowerUnits, type ProductionEntry, type ProductionEntryBase, ProductionEntryBaseSchema, ProductionEntrySchema, type Well as Profile, type PumpElectrical, PumpElectricalSchema, type PumpInstallation, PumpInstallationSchema, type PumpType, type PumpingStep, PumpingStepSchema, type Purge, type PurgeReading, PurgeReadingSchema, PurgeSchema, QUALIFIER_VALUES, READING_SOURCES, RESULT_FRACTIONS, RESULT_QUALIFIERS, type ReadingSource, type RecoveryOnlyEvent, RecoveryOnlyEventSchema, type RecoveryPhase, RecoveryPhaseSchema, type Reduction, ReductionSchema, type ResultQualifier, ResultQualifierSchema, type ResultValidation, ResultValidationSchema, SAMPLE_TYPES, SAMPLING_DEVICES, SAMPLING_METHODS, SAMPLING_POINT_TYPES, SCREEN_SLOT_TYPES, SECTION_KEYS, type SampleType, type SamplingDevice, type SamplingMethod, type SamplingPoint, SamplingPointSchema, type SamplingPointType, type ScreenSlotType, type SectionKey, type SectionVisibility, type SpotMeasurementEvent, SpotMeasurementEventSchema, type StepDrawdownEvent, StepDrawdownEventSchema, type SurfaceCase, SurfaceCaseSchema, type Texture, type TextureCode, type TextureOption, TextureSchema, type TimeResolution, TimeResolutionSchema, type Units, type UnitsTypes, VALIDATION_STATUSES, VALIDATION_STATUS_VALUES, VISIBILITY_LEAF_KEYS, VISIBILITY_TREE, VOLUME_LIMIT_PERIODS, type VisibilityFieldKey, type VisibilityKey, type VocabEntry, type VolumeLimit, VolumeLimitSchema, type VolumeUnits, WATER_QUALITY_LIMIT_SETS, WATER_QUALITY_PARAMETERS, WATER_QUALITY_UNITS, WATER_QUALITY_VOCABULARY_VERSION, WATER_USES, WELL_PURPOSES, WELL_STATUSES, WELL_STATUS_VALUES, WELL_TYPES, WHO_GDWQ_2022, type WaterQualityResult, WaterQualityResultSchema, type WaterSample, WaterSampleSchema, type WaterUse, type Well, type WellCase, WellCaseSchema, type WellId, WellIdSchema, type WellPurpose, WellSchema, type WellScreen, WellScreenSchema, type WellStatus, WellStatusSchema, type WellType, type WellVisibility, calculatedWellDepth, checkIfProfileIsEmpty, concentrationFromCanonical, concentrationToCanonical, convertProfileFromJSON, cubicFeetToCubicMeters, cubicMeterPerHourToLitersPerSecond, cubicMeterPerHourToUsGallonsPerMinute, cubicMetersToCubicFeet, cubicMetersToLiters, cubicMetersToUsGallons, cvToKilowatts, decimalDegreesToDms, deserializeWell, dmsToDecimalDegrees, expandedToStandardUncertainty, feetToMeters, flowFromCanonical, flowToCanonical, formatVocabList, getLimitSet, getParameterDefinition, getParameterLabel, getVocabEntry, getVocabLabel, hoursToMinutes, hpToKilowatts, inchesToMm, isKnownParameter, isVocabValue, isWellEmpty, kilopascalToPsi, kilowattsToCv, kilowattsToHp, litersPerSecondToCubicMeterPerHour, litersToCubicMeters, metersToFeet, milliSiemensPerCmToMicroSiemensPerCm, milliSiemensPerMeterToMicroSiemensPerCm, minutesToHours, mmToInches, mmToSlotNumber, normalizeColorUnit, parameterKey, parseWell, powerFromCanonical, powerToCanonical, profileToWell, psiToKilopascal, redactWell, resolveLanguageText, serializeWell, slotNumberToMm, squareMeterPerDayToSquareMeterPerSecond, squareMeterPerSecondToSquareMeterPerDay, turbidityCodeForUnit, usGallonsPerMinuteToCubicMeterPerHour, usGallonsToCubicMeters, vocabValues, volumeFromCanonical, volumeToCanonical };
15557
+ export { AQUIFER_ANALYSIS_METHODS, type AirliftEvent, AirliftEventSchema, type AquiferAnalysis, type AquiferAnalysisMethod, AquiferAnalysisSchema, type Attachment, type AttachmentDocumentType, AttachmentSchema, BLANK_SAMPLE_TYPES, BR_GM_MS_888_2021, type BoreHole, BoreHoleSchema, CEMENT_PAD_TYPES, CENTRALIZER_TYPES, CONDITION_CATEGORIES, CONSTRUCTION_MATERIALS, type Cave, CaveSchema, type CementPad, CementPadSchema, type CementPadType, type Centralizer, CentralizerSchema, type CentralizerType, type ConcentrationUnits, type ConditionCategory, type ConditionFulfillment, ConditionFulfillmentSchema, type ConstantRateEvent, ConstantRateEventSchema, type ConstructionMaterial, type Constructive, DOCUMENT_TYPES, DOCUMENT_TYPE_SUGGESTIONS, DRILLING_METHODS, type DiameterUnits, type DmsCoordinate, type DocumentTypeContext, type DrillingMethod, ESTIMATION_METHODS, EU_2020_2184, type EstimatedVolume, EstimatedVolumeSchema, type EstimationMethod, FGDC_TEXTURES_OPTIONS, FILTRATION_LOCATION_VALUES, FRACTION_VALUES, type Filtration, FiltrationSchema, type FlowUnits, type Fracture, FractureSchema, type Geologic, HISTORY_LOG_CATEGORIES, HISTORY_LOG_SEVERITIES, HYDRODYNAMIC_EVENT_TYPES, type HistoryLogCategory, type HistoryLogEntry, HistoryLogEntrySchema, type HistoryLogSeverity, type HoleFill, HoleFillSchema, type HydrodynamicEvent, type HydrodynamicEventBase, HydrodynamicEventBaseSchema, HydrodynamicEventSchema, type Laboratory, LaboratorySchema, type LanguageText, type LanguageTextInput, type LengthUnits, type LevelReading, LevelReadingSchema, type Limit, type LimitBasis, type LimitSet, type Lithology, LithologySchema, type Location, type LocationProperties, LocationPropertiesSchema, LocationSchema, MAINTENANCE_TYPES, MEASURED_IN_VALUES, MEASUREMENT_LOCATIONS, MEASUREMENT_METHODS, METER_TYPES, type MaintenanceType, type MeasurementMethod, type Meter, type MeterReading, MeterReadingSchema, MeterSchema, type MeterType, type MonthlyGrant, MonthlyGrantSchema, NEPHELOMETRIC_TURBIDITY_CODES, NUMERIC_QUALIFIERS, type OpenVocab, type OperatingRegime, OperatingRegimeSchema, PARAMETER_GROUPS, PARAMETER_GROUP_VALUES, PARENT_SAMPLE_TYPES, PERMIT_ADMINISTRATIVE_STATUSES, PERMIT_ADMINISTRATIVE_STATUS_VALUES, PERMIT_HISTORY_TYPES, PERMIT_TYPES, POWER_SOURCES, PRODUCTION_ENTRY_TYPES, PUMP_TYPES, type Parameter, type ParameterDefinition, type ParameterForm, type ParameterGroup, ParameterSchema, type ParameterUnit, type Permit, type PermitAdministrativeStatus, PermitAdministrativeStatusSchema, type PermitCondition, PermitConditionSchema, type PermitHistoryEntry, PermitHistoryEntrySchema, type PermitHistoryType, PermitSchema, type PermitType, type PowerSource, type PowerUnits, type ProductionEntry, type ProductionEntryBase, ProductionEntryBaseSchema, ProductionEntrySchema, type Well as Profile, type PumpElectrical, PumpElectricalSchema, type PumpInstallation, PumpInstallationSchema, type PumpType, type PumpingStep, PumpingStepSchema, type Purge, type PurgeReading, PurgeReadingSchema, PurgeSchema, QUALIFIER_VALUES, READING_SOURCES, RESULT_FRACTIONS, RESULT_QUALIFIERS, type ReadingSource, type RecoveryOnlyEvent, RecoveryOnlyEventSchema, type RecoveryPhase, RecoveryPhaseSchema, type Reduction, ReductionSchema, type ResultQualifier, ResultQualifierSchema, type ResultValidation, ResultValidationSchema, SAMPLE_TYPES, SAMPLING_DEVICES, SAMPLING_METHODS, SAMPLING_POINT_TYPES, SCREEN_SLOT_TYPES, SECTION_KEYS, type SampleType, type SamplingDevice, type SamplingMethod, type SamplingPoint, SamplingPointSchema, type SamplingPointType, type ScreenSlotType, type SectionKey, type SectionVisibility, type SpotMeasurementEvent, SpotMeasurementEventSchema, type StepDrawdownEvent, StepDrawdownEventSchema, type SurfaceCase, SurfaceCaseSchema, type Texture, type TextureCode, type TextureOption, TextureSchema, type TimeResolution, TimeResolutionSchema, type Units, type UnitsTypes, VALIDATION_STATUSES, VALIDATION_STATUS_VALUES, VISIBILITY_LEAF_KEYS, VISIBILITY_TREE, VOLUME_LIMIT_PERIODS, type VisibilityFieldKey, type VisibilityKey, type VocabEntry, type VolumeLimit, VolumeLimitSchema, type VolumeUnits, WATER_QUALITY_LIMIT_SETS, WATER_QUALITY_PARAMETERS, WATER_QUALITY_UNITS, WATER_QUALITY_VOCABULARY_VERSION, WATER_USES, WELL_PURPOSES, WELL_STATUSES, WELL_STATUS_VALUES, WELL_TYPES, WHO_GDWQ_2022, type WaterQualityResult, WaterQualityResultSchema, type WaterSample, WaterSampleSchema, type WaterUse, type Well, type WellCase, WellCaseSchema, type WellId, WellIdSchema, type WellPurpose, WellSchema, type WellScreen, WellScreenSchema, type WellStatus, WellStatusSchema, type WellType, type WellVisibility, calculatedWellDepth, checkIfProfileIsEmpty, concentrationFromCanonical, concentrationToCanonical, convertProfileFromJSON, cubicFeetToCubicMeters, cubicMeterPerHourToLitersPerSecond, cubicMeterPerHourToUsGallonsPerMinute, cubicMetersToCubicFeet, cubicMetersToLiters, cubicMetersToUsGallons, cvToKilowatts, decimalDegreesToDms, deserializeWell, dmsToDecimalDegrees, expandedToStandardUncertainty, feetToMeters, flowFromCanonical, flowToCanonical, formatVocabList, getLimitSet, getParameterDefinition, getParameterLabel, getVocabEntry, getVocabLabel, hasWellData, hoursToMinutes, hpToKilowatts, inchesToMm, isKnownParameter, isVocabValue, isWellEmpty, kilopascalToPsi, kilowattsToCv, kilowattsToHp, litersPerSecondToCubicMeterPerHour, litersToCubicMeters, metersToFeet, milliSiemensPerCmToMicroSiemensPerCm, milliSiemensPerMeterToMicroSiemensPerCm, minutesToHours, mmToInches, mmToSlotNumber, normalizeColorUnit, parameterKey, parseWell, powerFromCanonical, powerToCanonical, profileToWell, psiToKilopascal, redactWell, resolveLanguageText, serializeWell, slotNumberToMm, squareMeterPerDayToSquareMeterPerSecond, squareMeterPerSecondToSquareMeterPerDay, turbidityCodeForUnit, usGallonsPerMinuteToCubicMeterPerHour, usGallonsToCubicMeters, vocabValues, volumeFromCanonical, volumeToCanonical };
package/dist/index.js CHANGED
@@ -7,6 +7,16 @@ var mergeWell = createDefu((obj, key, value) => {
7
7
  return true;
8
8
  }
9
9
  });
10
+ var isPlainObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
11
+ var mergeParsed = createDefu((obj, key, value) => {
12
+ if (Array.isArray(value)) {
13
+ const raw = obj[key];
14
+ obj[key] = Array.isArray(raw) && raw.length === value.length ? value.map(
15
+ (item, i) => isPlainObject(item) && isPlainObject(raw[i]) ? mergeParsed(item, raw[i]) : item
16
+ ) : value;
17
+ return true;
18
+ }
19
+ });
10
20
  var RFC3339_WITH_OFFSET = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
11
21
  var rfc3339 = () => z.string().regex(RFC3339_WITH_OFFSET, "datetime must be RFC 3339 with UTC offset");
12
22
  var CALENDAR_DATE = /^\d{4}-\d{2}-\d{2}$/;
@@ -638,7 +648,7 @@ function parseWell(json) {
638
648
  }
639
649
  if (version === 1) {
640
650
  const normalized = normalizeV1Fields(raw);
641
- return mergeWell(
651
+ return mergeParsed(
642
652
  WellSchema.parse(normalized),
643
653
  normalized
644
654
  );
@@ -648,12 +658,20 @@ function parseWell(json) {
648
658
  } else {
649
659
  raw.version = 2;
650
660
  }
651
- return mergeWell(WellSchema.parse(raw), raw);
661
+ return mergeParsed(WellSchema.parse(raw), raw);
652
662
  }
653
663
 
654
664
  // src/utils/well.utils.ts
655
665
  var WELL_FORMAT_VERSION = 2;
656
666
  var INCHES_TO_MM = 25.4;
667
+ var LEGACY_ROOT_KEYS = /* @__PURE__ */ new Set([
668
+ "lat",
669
+ "lng",
670
+ "elevation",
671
+ "bole_hole",
672
+ "constructive",
673
+ "geologic"
674
+ ]);
657
675
  var SECTION_KEYS = [
658
676
  "general",
659
677
  "constructive",
@@ -898,6 +916,11 @@ function normalizeGeologic(raw) {
898
916
  caves: raw.caves ?? []
899
917
  };
900
918
  }
919
+ function unknownRootKeys(well) {
920
+ return Object.keys(well).filter(
921
+ (key) => !(key in WellSchema.shape) && !LEGACY_ROOT_KEYS.has(key)
922
+ );
923
+ }
901
924
  function serializeWell(well) {
902
925
  const payload = {
903
926
  version: WELL_FORMAT_VERSION,
@@ -950,6 +973,10 @@ function serializeWell(well) {
950
973
  water_samples: well.water_samples
951
974
  }
952
975
  };
976
+ for (const key of unknownRootKeys(well)) {
977
+ const value = well[key];
978
+ if (value !== void 0) payload[key] = value;
979
+ }
953
980
  return JSON.stringify(payload);
954
981
  }
955
982
  function isWellEmpty(well) {
@@ -958,6 +985,22 @@ function isWellEmpty(well) {
958
985
  if (raw.constructive || raw.geologic) return false;
959
986
  return well.lithology?.length === 0 && well.fractures?.length === 0 && well.caves?.length === 0 && well.bore_hole?.length === 0 && well.hole_fill?.length === 0 && well.well_case?.length === 0 && well.well_screen?.length === 0;
960
987
  }
988
+ function isFilled(value) {
989
+ if (value === void 0 || value === null) return false;
990
+ if (typeof value === "string") return value.trim() !== "";
991
+ if (typeof value === "number") return value !== 0;
992
+ if (Array.isArray(value)) return value.length > 0;
993
+ if (typeof value === "object") return Object.values(value).some(isFilled);
994
+ return true;
995
+ }
996
+ var NON_DATA_ROOT_KEYS = /* @__PURE__ */ new Set(["version", "$schema", "@context"]);
997
+ function hasWellData(well) {
998
+ if (!well) return false;
999
+ if (!isWellEmpty(well)) return true;
1000
+ return Object.entries(well).some(
1001
+ ([key, value]) => !NON_DATA_ROOT_KEYS.has(key) && isFilled(value)
1002
+ );
1003
+ }
961
1004
  function redactWell(well, visibility) {
962
1005
  const v = visibility;
963
1006
  const redacted = { ...well };
@@ -1001,6 +1044,10 @@ function redactWell(well, visibility) {
1001
1044
  if (hidden("production")) delete redacted.production;
1002
1045
  if (hidden("permits")) delete redacted.permits;
1003
1046
  if (hidden("water_quality")) delete redacted.water_samples;
1047
+ if (Object.values(v).some((shown) => shown === false)) {
1048
+ for (const key of unknownRootKeys(redacted))
1049
+ delete redacted[key];
1050
+ }
1004
1051
  return redacted;
1005
1052
  }
1006
1053
  function deserializeWell(jsonString) {
@@ -3190,6 +3237,7 @@ export {
3190
3237
  getParameterLabel,
3191
3238
  getVocabEntry,
3192
3239
  getVocabLabel,
3240
+ hasWellData,
3193
3241
  hoursToMinutes,
3194
3242
  hpToKilowatts,
3195
3243
  inchesToMm,