/** * @opendpp/csv — OpenDPP CSV → passport reference mapper * * Maps a parsed CSV row to the PUBLIC passport-create shape that the OpenDPP API * accepts (`POST /api/v1/passports` and `/passports/bulk`): `{ productId, operatorId?, * facilityId?, metadata }`. Pure, parser-agnostic, zero runtime dependencies — you bring * your own RFC-4180 parser (papaparse, csv-parse, …) and hand the rows in. * * This is a fresh reference implementation derived from the documented public CSV * templates + the public ingest contract — NOT a lift of the hosted node's internals. * The package only produces JSON you could POST yourself; the hosted node remains the * single source of ESPR validation, GS1 check-digit enforcement, operator binding, * eIDAS sealing, and the `vcReady` / `warnings` signals returned at ingest. * * DATA INTEGRITY (load-bearing): a blank cell yields an ABSENT metadata field — never a * fabricated default — so the server's ESPR validation rejects an incomplete row rather * than the importer inventing regulated data. * * Copyright (c) Opendpp UAB. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * "OpenDPP" is a trademark of Opendpp UAB; the Apache-2.0 license grants no rights to the marks. */ export { BATTERY_UNIT_STATUSES, BATTERY_UNIT_TEMPLATE_COLUMNS, BATTERY_UNIT_COLUMNS_IGNORED_ON_IMPORT, isBatteryUnitStatus, csvCell, tryMapCsvRowToBatteryUnit, batteryUnitCsvTemplate, batteryUnitCsvTemplateHeader, isIsoDateString, isEmptyBatteryUnitRow, mapCsvRowToBatteryUnit, mapCsvRowsToBatteryUnits, type BatteryUnitStatus, type BatteryUnitCsvRow, type BatteryUnitCsvMapping, type BatteryUnitCsvRowResult, } from "./battery-units.js"; /** One parsed CSV row: a map of column header → cell value (an absent/blank cell is `undefined`). */ export type PassportCsvRow = Record; /** * The public passport-create payload accepted by `POST /api/v1/passports` (single) and each row of * `POST /api/v1/passports/bulk`. `metadata` is the per-category ESPR object; the hosted node validates * it (and is authoritative). `operatorId` may be omitted only when the workspace has exactly one bound * economic operator; `facilityId` links a manufacturing Facility and is what makes the result `vcReady`. */ export interface PassportCreateInput { productId: string; operatorId?: string; facilityId?: string; metadata: Record; } /** The nine ESPR product categories OpenDPP recognises. */ export declare const ESPR_CATEGORIES: readonly ["textiles", "batteries", "construction", "electronics", "chemicals", "cosmetics", "toys", "iron-steel", "aluminium"]; export type EsprCategory = (typeof ESPR_CATEGORIES)[number]; /** Type guard for a known ESPR category slug. */ export declare function isEsprCategory(value: string | undefined): value is EsprCategory; /** A single column in a downloadable CSV template. `required` is a best-effort hint — the live * per-category JSON Schema (`GET /api/v1/schemas/{category}`) is authoritative for the full rule set. */ export interface CsvColumn { name: string; required: boolean; description: string; } /** The canonical column set for one category's CSV template. */ export interface PassportCsvTemplate { category: EsprCategory; columns: CsvColumn[]; } /** * Maps one parsed CSV row to a public passport-create payload. Throws if the row has no `productId`. * Reads optional top-level `operatorId` / `facilityId` columns; everything else becomes per-category * `metadata`. Does NOT inject a default operator and does NOT validate — pass the result to the public * API and let the hosted node be authoritative. */ export declare function mapCsvRowToPassport(row: PassportCsvRow): PassportCreateInput; /** * Maps an array of parsed CSV rows to public passport-create payloads, ready for `POST * /api/v1/passports/bulk`. Wholly-empty rows (every cell blank) are skipped; a non-empty row missing * `productId` throws. No per-line error reporting or duplicate-key handling — that productized UX stays * in the hosted portal; here you get a clean, deterministic mapping. */ export declare function mapCsvRowsToPassports(rows: PassportCsvRow[]): PassportCreateInput[]; /** * Returns the canonical CSV column set for a category — the shared columns plus that category's own * columns. `required` flags are a best-effort hint; the live per-category JSON Schema served at * `GET /api/v1/schemas/{category}` is the authoritative rule set. */ export declare function passportCsvTemplate(category: EsprCategory): PassportCsvTemplate; /** Returns the comma-joined CSV header row for a category's template. */ export declare function passportCsvTemplateHeader(category: EsprCategory): string;