@welldot/core 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/validators/well.validators.ts","../src/utils/well.utils.ts"],"sourcesContent":["// Types\nexport type {\n BoreHole,\n Cave,\n CementPad,\n Constructive,\n Fracture,\n Geologic,\n HoleFill,\n Lithology,\n Reduction,\n SurfaceCase,\n Well,\n WellCase,\n WellScreen,\n} from './types/well.types';\n\nexport type {\n DiameterUnits,\n LengthUnits,\n Units,\n UnitsTypes,\n} from './types/units.types';\n\n// Validators\nexport {\n BoreHoleSchema,\n CaveSchema,\n CementPadSchema,\n FractureSchema,\n HoleFillSchema,\n LithologySchema,\n ReductionSchema,\n SurfaceCaseSchema,\n WellCaseSchema,\n WellSchema,\n WellScreenSchema,\n parseWell,\n} from './validators/well.validators';\n\n// Format utilities (serialise/deserialise .well format only)\nexport {\n checkIfProfileIsEmpty,\n convertProfileFromJSON,\n profileToWell,\n} from './utils/well.utils';\n\n// Backward-compat alias for app migration\nexport type { Well as Profile } from './types/well.types';\n","import { z } from 'zod';\nimport type { Well } from '../types/well.types';\n\nexport const BoreHoleSchema = z.object({\n from: z.number(),\n to: z.number(),\n diameter: z.number(),\n drilling_method: z.string().optional(),\n});\n\nexport const WellCaseSchema = z.object({\n from: z.number(),\n to: z.number(),\n type: z.string(),\n diameter: z.number(),\n});\n\nexport const ReductionSchema = z.object({\n from: z.number(),\n to: z.number(),\n diam_from: z.number(),\n diam_to: z.number(),\n type: z.string(),\n});\n\nexport const WellScreenSchema = z.object({\n from: z.number(),\n to: z.number(),\n type: z.string(),\n diameter: z.number(),\n screen_slot_mm: z.number(),\n});\n\nexport const HoleFillSchema = z.object({\n from: z.number(),\n to: z.number(),\n type: z.enum(['gravel_pack', 'seal']),\n diameter: z.number(),\n description: z.string(),\n});\n\nexport const SurfaceCaseSchema = z.object({\n from: z.number(),\n to: z.number(),\n diameter: z.number(),\n});\n\nexport const CementPadSchema = z.object({\n type: z.string(),\n width: z.number(),\n thickness: z.number(),\n length: z.number(),\n});\n\nexport const LithologySchema = z.object({\n from: z.number(),\n to: z.number(),\n description: z.string(),\n color: z.string(),\n fgdc_texture: z.string(),\n geologic_unit: z.string(),\n aquifer_unit: z.string(),\n});\n\nexport const FractureSchema = z.object({\n depth: z.number(),\n water_intake: z.boolean(),\n description: z.string(),\n swarm: z.boolean(),\n azimuth: z.number(),\n dip: z.number(),\n});\n\nexport const CaveSchema = z.object({\n from: z.number(),\n to: z.number(),\n water_intake: z.boolean(),\n description: z.string(),\n});\n\nexport const WellSchema = z.object({\n well_type: z.string().optional(),\n name: z.string().optional(),\n well_driller: z.string().optional(),\n construction_date: z.string().optional(),\n lat: z.number().optional(),\n lng: z.number().optional(),\n elevation: z.number().optional(),\n obs: z.string().optional(),\n bore_hole: z.array(BoreHoleSchema),\n well_case: z.array(WellCaseSchema),\n reduction: z.array(ReductionSchema),\n well_screen: z.array(WellScreenSchema),\n surface_case: z.array(SurfaceCaseSchema),\n hole_fill: z.array(HoleFillSchema),\n cement_pad: CementPadSchema,\n lithology: z.array(LithologySchema),\n fractures: z.array(FractureSchema),\n caves: z.array(CaveSchema),\n});\n\nexport function parseWell(json: string): Well {\n const raw = JSON.parse(json);\n return WellSchema.parse(raw) as Well;\n}\n","import { Constructive, Geologic, Lithology, Well } from '../types/well.types';\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\ntype RawJSON = Record<string, unknown>;\n\n// ─── Constants ───────────────────────────────────────────────────────────────\n\nconst WELL_FORMAT_VERSION = 1;\nconst INCHES_TO_MM = 25.4;\n\nconst EMPTY_WELL: Well = {\n bore_hole: [],\n well_case: [],\n reduction: [],\n well_screen: [],\n surface_case: [],\n hole_fill: [],\n cement_pad: { type: '', width: 0, thickness: 0, length: 0 },\n lithology: [],\n fractures: [],\n caves: [],\n};\n\n// ─── Internal helpers ────────────────────────────────────────────────────────\n\nfunction createEmptyWell(): Well {\n return JSON.parse(JSON.stringify(EMPTY_WELL)) as Well;\n}\n\nfunction normalizeLithology(items: RawJSON[]): Lithology[] {\n return items.map(item => ({ aquifer_unit: '', ...item })) as Lithology[];\n}\n\nfunction decodeV1Well(raw: RawJSON): Well {\n return {\n ...createEmptyWell(),\n ...(raw.well_type !== undefined && { well_type: raw.well_type as string }),\n ...(raw.name !== undefined && { name: raw.name as string }),\n ...(raw.well_driller !== undefined && {\n well_driller: raw.well_driller as string,\n }),\n ...(raw.construction_date !== undefined && {\n construction_date: raw.construction_date as string,\n }),\n ...(raw.lat !== undefined && { lat: raw.lat as number }),\n ...(raw.lng !== undefined && { lng: raw.lng as number }),\n ...(raw.elevation !== undefined && { elevation: raw.elevation as number }),\n ...(raw.obs !== undefined && { obs: raw.obs as string }),\n bore_hole: (raw.bore_hole as Well['bore_hole']) ?? [],\n well_case: (raw.well_case as Well['well_case']) ?? [],\n reduction: (raw.reduction as Well['reduction']) ?? [],\n well_screen: (raw.well_screen as Well['well_screen']) ?? [],\n surface_case: (raw.surface_case as Well['surface_case']) ?? [],\n hole_fill: (raw.hole_fill as Well['hole_fill']) ?? [],\n ...(raw.cement_pad\n ? { cement_pad: raw.cement_pad as Well['cement_pad'] }\n : {}),\n lithology: normalizeLithology((raw.lithology as RawJSON[]) ?? []),\n fractures: (raw.fractures as Well['fractures']) ?? [],\n caves: (raw.caves as Well['caves']) ?? [],\n };\n}\n\nfunction convertLegacyDiameters(\n items: (RawJSON & { diam_pol?: number })[],\n): RawJSON[] {\n if (!items?.length) return items ?? [];\n if (!items.some(item => item.diam_pol !== undefined)) return items;\n\n return items.map(({ diam_pol, ...rest }) => ({\n ...rest,\n diameter: (diam_pol || 0) * INCHES_TO_MM,\n }));\n}\n\n// \"bole_hole\" is a typo present in older saved profiles; kept for compatibility\nfunction normalizeConstructive(src: RawJSON): Partial<Constructive> {\n const boreHoleData = (src.bole_hole ?? src.bore_hole ?? []) as (RawJSON & {\n diam_pol?: number;\n })[];\n\n return {\n bore_hole: convertLegacyDiameters(boreHoleData) as Well['bore_hole'],\n hole_fill: convertLegacyDiameters(\n (src.hole_fill ?? []) as (RawJSON & { diam_pol?: number })[],\n ) as Well['hole_fill'],\n surface_case: convertLegacyDiameters(\n (src.surface_case ?? []) as (RawJSON & { diam_pol?: number })[],\n ) as Well['surface_case'],\n well_case: convertLegacyDiameters(\n (src.well_case ?? []) as (RawJSON & { diam_pol?: number })[],\n ) as Well['well_case'],\n well_screen: convertLegacyDiameters(\n (src.well_screen ?? []) as (RawJSON & { diam_pol?: number })[],\n ) as Well['well_screen'],\n reduction: (src.reduction ?? []) as Well['reduction'],\n ...(src.cement_pad\n ? { cement_pad: src.cement_pad as Well['cement_pad'] }\n : {}),\n };\n}\n\nfunction normalizeGeologic(raw: RawJSON): Geologic {\n const lithologySource = (raw.lithology ?? raw.geologic ?? []) as RawJSON[];\n\n return {\n lithology: normalizeLithology(lithologySource),\n fractures: (raw.fractures ?? []) as Well['fractures'],\n caves: (raw.caves ?? []) as Well['caves'],\n };\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Serializes a {@link Well} object into a versioned JSON string suitable for\n * storage or transmission.\n *\n * @param well - The well profile to serialize.\n * @returns A JSON string containing the versioned well payload.\n */\nexport function serializeWell(well: Well): string {\n const payload: Record<string, unknown> = {\n version: WELL_FORMAT_VERSION,\n ...(well.well_type !== undefined && { well_type: well.well_type }),\n ...(well.name !== undefined && { name: well.name }),\n ...(well.well_driller !== undefined && { well_driller: well.well_driller }),\n ...(well.construction_date !== undefined && {\n construction_date: well.construction_date,\n }),\n ...(well.lat !== undefined && { lat: well.lat }),\n ...(well.lng !== undefined && { lng: well.lng }),\n ...(well.elevation !== undefined && { elevation: well.elevation }),\n ...(well.obs !== undefined && { obs: well.obs }),\n bore_hole: well.bore_hole,\n well_case: well.well_case,\n reduction: well.reduction,\n well_screen: well.well_screen,\n surface_case: well.surface_case,\n hole_fill: well.hole_fill,\n ...(well.cement_pad && { cement_pad: well.cement_pad }),\n lithology: well.lithology,\n fractures: well.fractures,\n caves: well.caves,\n };\n\n return JSON.stringify(payload);\n}\n\n/**\n * Returns `true` when the well has no meaningful data — all constructive and\n * geologic arrays are empty and no legacy nested structure is present.\n *\n * @param well - The well profile to check. Accepts `null` / `undefined`\n * (both treated as empty).\n * @returns `true` if the well is considered empty, `false` otherwise.\n */\nexport function isWellEmpty(well: Well | null | undefined): boolean {\n if (!well) return true;\n\n const raw = well as RawJSON;\n if (raw.constructive || raw.geologic) return false;\n\n return (\n well.lithology?.length === 0 &&\n well.fractures?.length === 0 &&\n well.caves?.length === 0 &&\n well.bore_hole?.length === 0 &&\n well.hole_fill?.length === 0 &&\n well.well_case?.length === 0 &&\n well.well_screen?.length === 0\n );\n}\n\n/**\n * Parses a JSON string produced by {@link serializeWell} (or older legacy\n * formats) and returns a normalized {@link Well} object.\n *\n * Handles:\n * - Versioned format (v1)\n * - Legacy format with `constructive` / `geologic` sub-objects\n * - Legacy `diam_pol` inch diameters → `diameter` mm conversion\n * - Typo `bole_hole` → `bore_hole` compatibility\n *\n * @param jsonString - Raw JSON string to parse.\n * @returns A normalized {@link Well}, or `null` if the parsed data is empty.\n * @throws {Error} If `jsonString` is not valid JSON.\n * @throws {Error} If the `version` field is present but not supported.\n */\nexport function deserializeWell(jsonString: string): Well | null {\n let raw: RawJSON;\n try {\n raw = JSON.parse(jsonString) as RawJSON;\n } catch {\n throw new Error('Invalid profile format');\n }\n\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {\n throw new Error('Invalid profile format');\n }\n\n if (typeof raw.version === 'number') {\n if (raw.version !== 1)\n throw new Error(`Unsupported .well format version: ${raw.version}`);\n return decodeV1Well(raw);\n }\n\n if (isWellEmpty(raw as unknown as Well)) return null;\n\n const constructiveSource = (raw.constructive ?? raw) as RawJSON;\n\n const metadata: Partial<Well> = {\n ...(raw.well_type !== undefined && { well_type: raw.well_type as string }),\n ...(raw.name !== undefined && { name: raw.name as string }),\n ...(raw.well_driller !== undefined && {\n well_driller: raw.well_driller as string,\n }),\n ...(raw.construction_date !== undefined && {\n construction_date: raw.construction_date as string,\n }),\n ...(raw.lat !== undefined && { lat: raw.lat as number }),\n ...(raw.lng !== undefined && { lng: raw.lng as number }),\n ...(raw.elevation !== undefined && { elevation: raw.elevation as number }),\n ...(raw.obs !== undefined && { obs: raw.obs as string }),\n };\n\n return {\n ...createEmptyWell(),\n ...metadata,\n ...normalizeConstructive(constructiveSource),\n ...normalizeGeologic(raw),\n };\n}\n\n// ─── Backward-compat aliases ─────────────────────────────────────────────────\n\n/** @deprecated Use {@link serializeWell} */\nexport const profileToWell = serializeWell;\n/** @deprecated Use {@link isWellEmpty} */\nexport const checkIfProfileIsEmpty = isWellEmpty;\n/** @deprecated Use {@link deserializeWell} */\nexport const convertProfileFromJSON = deserializeWell;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAGX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,MAAM,aAAE,OAAO;AAAA,EACf,IAAI,aAAE,OAAO;AAAA,EACb,UAAU,aAAE,OAAO;AAAA,EACnB,iBAAiB,aAAE,OAAO,EAAE,SAAS;AACvC,CAAC;AAEM,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,MAAM,aAAE,OAAO;AAAA,EACf,IAAI,aAAE,OAAO;AAAA,EACb,MAAM,aAAE,OAAO;AAAA,EACf,UAAU,aAAE,OAAO;AACrB,CAAC;AAEM,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACtC,MAAM,aAAE,OAAO;AAAA,EACf,IAAI,aAAE,OAAO;AAAA,EACb,WAAW,aAAE,OAAO;AAAA,EACpB,SAAS,aAAE,OAAO;AAAA,EAClB,MAAM,aAAE,OAAO;AACjB,CAAC;AAEM,IAAM,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