@palmgrove/nefdb 1.0.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,8 @@
1
+ import type { EmissionFactor, FactorWithSource, MinimalFactor, QueryOptions } from "./types.js";
2
+ export declare function get(id: string, options?: QueryOptions): MinimalFactor | FactorWithSource | EmissionFactor | undefined;
3
+ export declare function query(filter: Partial<EmissionFactor> & {
4
+ source?: {
5
+ id?: string;
6
+ };
7
+ }, options?: QueryOptions): MinimalFactor[] | FactorWithSource[] | EmissionFactor[];
8
+ export declare function list(options?: QueryOptions): MinimalFactor[] | FactorWithSource[] | EmissionFactor[];
@@ -0,0 +1,5 @@
1
+ import type { SourceReference } from "../types.js";
2
+ export type { SourceReference };
3
+ export declare const sourcesById: Record<string, SourceReference>;
4
+ export declare const allSources: SourceReference[];
5
+ export declare function getSourceById(id: string): SourceReference | undefined;
@@ -0,0 +1,50 @@
1
+ export interface EmissionFactor {
2
+ id: string;
3
+ category: FactorCategory;
4
+ subcategory: string;
5
+ description: string;
6
+ value: number;
7
+ unit: FactorUnit;
8
+ gas: GasBreakdown | null;
9
+ gwp_basis: "AR5" | "AR6";
10
+ scope: 1 | 2 | "1_and_2";
11
+ data_year: number;
12
+ published_year: number;
13
+ country: "NG";
14
+ region?: string;
15
+ disco?: DisCo;
16
+ source: SourceReference;
17
+ additional_sources?: SourceReference[];
18
+ uncertainty_pct?: number;
19
+ confidence: "high" | "medium" | "low";
20
+ methodology_note: string;
21
+ nefdb_version: string;
22
+ deprecated?: boolean;
23
+ superseded_by?: string;
24
+ }
25
+ export interface SourceReference {
26
+ id: string;
27
+ title: string;
28
+ publisher: string;
29
+ year: number;
30
+ url?: string;
31
+ page?: string;
32
+ access_date?: string;
33
+ }
34
+ export interface GasBreakdown {
35
+ CO2: number;
36
+ CH4: number;
37
+ N2O: number;
38
+ }
39
+ export declare const FACTOR_CATEGORIES: readonly ["grid_electricity", "fuel_combustion", "transport", "aviation", "waste", "water"];
40
+ export type FactorCategory = (typeof FACTOR_CATEGORIES)[number];
41
+ export declare const FACTOR_UNITS: readonly ["kgCO2e_per_kWh", "kgCO2e_per_litre", "kgCO2e_per_kg", "kgCO2e_per_m3", "kgCO2e_per_tonne", "kgCO2e_per_km", "kgCO2e_per_passenger_km", "kgCO2e_per_person_year", "multiplier"];
42
+ export type FactorUnit = (typeof FACTOR_UNITS)[number];
43
+ export declare const DISCOS: readonly ["AEDC", "BEDC", "EKEDC", "EEDC", "IBEDC", "IEDC", "JEDC", "KDEDC", "KEDC", "PEDC", "YEDC"];
44
+ export type DisCo = (typeof DISCOS)[number];
45
+ export interface QueryOptions {
46
+ withSource?: boolean;
47
+ full?: boolean;
48
+ }
49
+ export type MinimalFactor = Pick<EmissionFactor, "id" | "value" | "unit">;
50
+ export type FactorWithSource = Pick<EmissionFactor, "id" | "value" | "unit" | "source">;
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@palmgrove/nefdb",
3
+ "version": "1.0.0",
4
+ "description": "Nigeria Emission Factor Database — the first open, versioned emission factor database for Nigerian operations",
5
+ "keywords": [
6
+ "nigeria",
7
+ "emission-factors",
8
+ "ghg",
9
+ "carbon",
10
+ "sustainability",
11
+ "esg",
12
+ "scope1",
13
+ "scope2"
14
+ ],
15
+ "homepage": "https://github.com/palmgrove/nefdb",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/palmgrove/nefdb.git"
19
+ },
20
+ "license": "CC-BY-SA-4.0",
21
+ "author": "Irenium Ltd <hello@palmgrove.ng>",
22
+ "type": "module",
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js",
30
+ "require": "./dist/index.cjs"
31
+ },
32
+ "./data/json": "./data/nefdb_v1.json",
33
+ "./data/csv": "./data/nefdb_v1.csv"
34
+ },
35
+ "files": [
36
+ "dist/",
37
+ "data/",
38
+ "README.md",
39
+ "METHODOLOGY.md",
40
+ "CHANGELOG.md",
41
+ "LICENSE"
42
+ ],
43
+ "scripts": {
44
+ "build": "bun build src/index.ts --outfile dist/index.js --format esm --target node && bun build src/index.ts --outfile dist/index.cjs --format cjs --target node && bun run build:types",
45
+ "build:csv": "bun run scripts/build_csv.ts",
46
+ "build:json": "bun run scripts/build_json.ts",
47
+ "build:types": "bun run scripts/build_types.ts",
48
+ "validate": "bun run scripts/validate.ts",
49
+ "test": "bun test",
50
+ "prepublishOnly": "bun run validate && bun run test && bun run build && bun run build:csv && bun run build:json"
51
+ },
52
+ "devDependencies": {
53
+ "@types/bun": "latest",
54
+ "typescript": "^5"
55
+ }
56
+ }