oilpriceapi 0.7.0 → 0.8.2

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 (60) hide show
  1. package/README.md +43 -11
  2. package/dist/cjs/client.js +490 -0
  3. package/dist/cjs/errors.js +80 -0
  4. package/dist/cjs/index.js +82 -0
  5. package/dist/cjs/package.json +1 -0
  6. package/dist/cjs/resources/alerts.js +387 -0
  7. package/dist/cjs/resources/analytics.js +226 -0
  8. package/dist/cjs/resources/bunker-fuels.js +196 -0
  9. package/dist/cjs/resources/commodities.js +115 -0
  10. package/dist/cjs/resources/data-quality.js +144 -0
  11. package/dist/cjs/resources/data-sources.js +297 -0
  12. package/dist/cjs/resources/diesel.js +119 -0
  13. package/dist/cjs/resources/drilling.js +269 -0
  14. package/dist/cjs/resources/ei/drilling-productivity.js +108 -0
  15. package/dist/cjs/resources/ei/forecasts.js +106 -0
  16. package/dist/cjs/resources/ei/frac-focus.js +155 -0
  17. package/dist/cjs/resources/ei/index.js +98 -0
  18. package/dist/cjs/resources/ei/oil-inventories.js +97 -0
  19. package/dist/cjs/resources/ei/opec-production.js +97 -0
  20. package/dist/cjs/resources/ei/rig-counts.js +93 -0
  21. package/dist/cjs/resources/ei/well-permits.js +124 -0
  22. package/dist/cjs/resources/forecasts.js +162 -0
  23. package/dist/cjs/resources/futures.js +233 -0
  24. package/dist/cjs/resources/rig-counts.js +161 -0
  25. package/dist/cjs/resources/storage.js +166 -0
  26. package/dist/cjs/resources/webhooks.js +294 -0
  27. package/dist/cjs/types.js +2 -0
  28. package/dist/cjs/version.js +24 -0
  29. package/dist/client.d.ts +33 -2
  30. package/dist/client.js +70 -14
  31. package/dist/errors.d.ts +6 -0
  32. package/dist/errors.js +25 -16
  33. package/dist/index.d.ts +16 -2
  34. package/dist/index.js +24 -1
  35. package/dist/resources/alerts.js +31 -77
  36. package/dist/resources/analytics.js +8 -7
  37. package/dist/resources/bunker-fuels.js +5 -4
  38. package/dist/resources/commodities.js +2 -1
  39. package/dist/resources/data-quality.js +2 -1
  40. package/dist/resources/data-sources.js +21 -77
  41. package/dist/resources/diesel.d.ts +1 -1
  42. package/dist/resources/diesel.js +9 -38
  43. package/dist/resources/drilling.js +2 -1
  44. package/dist/resources/ei/drilling-productivity.js +2 -1
  45. package/dist/resources/ei/forecasts.js +2 -1
  46. package/dist/resources/ei/frac-focus.js +4 -3
  47. package/dist/resources/ei/index.js +2 -1
  48. package/dist/resources/ei/oil-inventories.js +2 -1
  49. package/dist/resources/ei/opec-production.js +2 -1
  50. package/dist/resources/ei/rig-counts.js +2 -1
  51. package/dist/resources/ei/well-permits.js +2 -1
  52. package/dist/resources/forecasts.js +2 -1
  53. package/dist/resources/futures.js +9 -8
  54. package/dist/resources/storage.js +2 -1
  55. package/dist/resources/webhooks.d.ts +36 -0
  56. package/dist/resources/webhooks.js +60 -67
  57. package/dist/types.d.ts +2 -1
  58. package/dist/version.d.ts +1 -1
  59. package/dist/version.js +2 -2
  60. package/package.json +15 -6
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ /**
3
+ * Energy Intelligence - Drilling Productivity Resource
4
+ *
5
+ * Access EIA Drilling Productivity Report data including new well production,
6
+ * legacy decline rates, and DUC well inventories by basin.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EIDrillingProductivityResource = void 0;
10
+ const errors_js_1 = require("../../errors.js");
11
+ /**
12
+ * EI Drilling Productivity Resource
13
+ *
14
+ * Access EIA Drilling Productivity Report data for major US basins.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
19
+ *
20
+ * // Get latest productivity data
21
+ * const latest = await client.ei.drillingProductivity.latest();
22
+ * console.log(`Basin: ${latest.basin}`);
23
+ * console.log(`New well oil: ${latest.new_well_oil_production} bpd/rig`);
24
+ *
25
+ * // Get DUC wells
26
+ * const duc = await client.ei.drillingProductivity.ducWells();
27
+ * duc.forEach(d => console.log(`${d.basin}: ${d.duc_count} DUC wells`));
28
+ * ```
29
+ */
30
+ class EIDrillingProductivityResource {
31
+ constructor(client) {
32
+ this.client = client;
33
+ }
34
+ /**
35
+ * List all drilling productivity records
36
+ *
37
+ * @returns Array of productivity records
38
+ */
39
+ async list() {
40
+ const response = await this.client["request"]("/v1/ei/drilling_productivities", {});
41
+ return Array.isArray(response) ? response : response.data;
42
+ }
43
+ /**
44
+ * Get a specific productivity record
45
+ *
46
+ * @param id - Record ID
47
+ * @returns Productivity record
48
+ */
49
+ async get(id) {
50
+ if (!id || typeof id !== "string") {
51
+ throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
52
+ }
53
+ return this.client["request"](`/v1/ei/drilling_productivities/${id}`, {});
54
+ }
55
+ /**
56
+ * Get latest drilling productivity data
57
+ *
58
+ * @returns Latest productivity record
59
+ */
60
+ async latest() {
61
+ return this.client["request"]("/v1/ei/drilling_productivities/latest", {});
62
+ }
63
+ /**
64
+ * Get drilling productivity summary
65
+ *
66
+ * @returns Productivity summary across all basins
67
+ */
68
+ async summary() {
69
+ return this.client["request"]("/v1/ei/drilling_productivities/summary", {});
70
+ }
71
+ /**
72
+ * Get DUC well inventories
73
+ *
74
+ * @returns Array of DUC well counts by basin
75
+ */
76
+ async ducWells() {
77
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/duc_wells", {});
78
+ return Array.isArray(response) ? response : response.data;
79
+ }
80
+ /**
81
+ * Get productivity by basin
82
+ *
83
+ * @returns Array of productivity data by basin
84
+ */
85
+ async byBasin() {
86
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/by_basin", {});
87
+ return Array.isArray(response) ? response : response.data;
88
+ }
89
+ /**
90
+ * Get historical productivity data
91
+ *
92
+ * @returns Array of historical productivity metrics
93
+ */
94
+ async historical() {
95
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/historical", {});
96
+ return Array.isArray(response) ? response : response.data;
97
+ }
98
+ /**
99
+ * Get productivity trends
100
+ *
101
+ * @returns Array of productivity trends by basin
102
+ */
103
+ async trends() {
104
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/trends", {});
105
+ return Array.isArray(response) ? response : response.data;
106
+ }
107
+ }
108
+ exports.EIDrillingProductivityResource = EIDrillingProductivityResource;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * Energy Intelligence - Forecasts Resource
4
+ *
5
+ * Access EIA and IEA price and production forecasts with historical accuracy metrics.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EIForecastsResource = void 0;
9
+ const errors_js_1 = require("../../errors.js");
10
+ /**
11
+ * EI Forecasts Resource
12
+ *
13
+ * Access EIA and IEA price and production forecasts.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
18
+ *
19
+ * // Get latest forecasts
20
+ * const latest = await client.ei.forecasts.latest();
21
+ * console.log(`Latest forecast: ${latest.forecast_value} ${latest.unit}`);
22
+ *
23
+ * // Get price forecasts
24
+ * const prices = await client.ei.forecasts.prices();
25
+ * prices.forEach(p => console.log(`${p.commodity}: $${p.forecast_price} (${p.source})`));
26
+ * ```
27
+ */
28
+ class EIForecastsResource {
29
+ constructor(client) {
30
+ this.client = client;
31
+ }
32
+ /**
33
+ * List all forecast records
34
+ *
35
+ * @returns Array of forecast records
36
+ */
37
+ async list() {
38
+ const response = await this.client["request"]("/v1/ei/forecasts", {});
39
+ return Array.isArray(response) ? response : response.data;
40
+ }
41
+ /**
42
+ * Get a specific forecast record
43
+ *
44
+ * @param id - Record ID
45
+ * @returns Forecast record
46
+ */
47
+ async get(id) {
48
+ if (!id || typeof id !== "string") {
49
+ throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
50
+ }
51
+ return this.client["request"](`/v1/ei/forecasts/${id}`, {});
52
+ }
53
+ /**
54
+ * Get latest forecast data
55
+ *
56
+ * @returns Latest forecast record
57
+ */
58
+ async latest() {
59
+ return this.client["request"]("/v1/ei/forecasts/latest", {});
60
+ }
61
+ /**
62
+ * Get forecast summary
63
+ *
64
+ * @returns Forecast summary statistics
65
+ */
66
+ async summary() {
67
+ return this.client["request"]("/v1/ei/forecasts/summary", {});
68
+ }
69
+ /**
70
+ * Get price forecasts
71
+ *
72
+ * @returns Array of price forecasts
73
+ */
74
+ async prices() {
75
+ const response = await this.client["request"]("/v1/ei/forecasts/prices", {});
76
+ return Array.isArray(response) ? response : response.data;
77
+ }
78
+ /**
79
+ * Get production forecasts
80
+ *
81
+ * @returns Array of production forecasts
82
+ */
83
+ async production() {
84
+ const response = await this.client["request"]("/v1/ei/forecasts/production", {});
85
+ return Array.isArray(response) ? response : response.data;
86
+ }
87
+ /**
88
+ * Get historical forecast data
89
+ *
90
+ * @returns Array of historical forecasts with accuracy
91
+ */
92
+ async historical() {
93
+ const response = await this.client["request"]("/v1/ei/forecasts/historical", {});
94
+ return Array.isArray(response) ? response : response.data;
95
+ }
96
+ /**
97
+ * Compare forecasts from different sources
98
+ *
99
+ * @returns Array of forecast comparisons
100
+ */
101
+ async compare() {
102
+ const response = await this.client["request"]("/v1/ei/forecasts/compare", {});
103
+ return Array.isArray(response) ? response : response.data;
104
+ }
105
+ }
106
+ exports.EIForecastsResource = EIForecastsResource;
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ /**
3
+ * Energy Intelligence - FracFocus Resource
4
+ *
5
+ * Access hydraulic fracturing disclosure data including chemicals, operators,
6
+ * and well-level information from the FracFocus registry.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EIFracFocusResource = void 0;
10
+ const errors_js_1 = require("../../errors.js");
11
+ /**
12
+ * EI FracFocus Resource
13
+ *
14
+ * Access hydraulic fracturing disclosure data from the FracFocus registry.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
19
+ *
20
+ * // Get latest disclosure
21
+ * const latest = await client.ei.fracFocus.latest();
22
+ * console.log(`Well: ${latest.well_name} (API: ${latest.api_number})`);
23
+ *
24
+ * // Get disclosures by state
25
+ * const states = await client.ei.fracFocus.byState();
26
+ * states.forEach(s => console.log(`${s.state}: ${s.disclosure_count} disclosures`));
27
+ *
28
+ * // Get chemicals for a specific well
29
+ * const chemicals = await client.ei.fracFocus.chemicals('42-123-12345');
30
+ * chemicals.forEach(c => console.log(`${c.chemical_name}: ${c.concentration_percent}%`));
31
+ *
32
+ * // Search disclosures
33
+ * const results = await client.ei.fracFocus.search({
34
+ * state: 'Texas',
35
+ * operator: 'EOG Resources'
36
+ * });
37
+ * ```
38
+ */
39
+ class EIFracFocusResource {
40
+ constructor(client) {
41
+ this.client = client;
42
+ }
43
+ /**
44
+ * List all FracFocus disclosure records
45
+ *
46
+ * @returns Array of disclosure records
47
+ */
48
+ async list() {
49
+ const response = await this.client["request"]("/v1/ei/frac-focus", {});
50
+ return Array.isArray(response) ? response : response.data;
51
+ }
52
+ /**
53
+ * Get a specific FracFocus disclosure record
54
+ *
55
+ * @param id - Record ID
56
+ * @returns Disclosure record
57
+ */
58
+ async get(id) {
59
+ if (!id || typeof id !== "string") {
60
+ throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
61
+ }
62
+ return this.client["request"](`/v1/ei/frac-focus/${id}`, {});
63
+ }
64
+ /**
65
+ * Get latest FracFocus disclosure
66
+ *
67
+ * @returns Latest disclosure record
68
+ */
69
+ async latest() {
70
+ return this.client["request"]("/v1/ei/frac-focus/latest", {});
71
+ }
72
+ /**
73
+ * Get FracFocus summary
74
+ *
75
+ * @returns Disclosure summary statistics
76
+ */
77
+ async summary() {
78
+ return this.client["request"]("/v1/ei/frac-focus/summary", {});
79
+ }
80
+ /**
81
+ * Get disclosures by state
82
+ *
83
+ * @returns Array of disclosures grouped by state
84
+ */
85
+ async byState() {
86
+ const response = await this.client["request"]("/v1/ei/frac-focus/by-state", {});
87
+ return Array.isArray(response) ? response : response.data;
88
+ }
89
+ /**
90
+ * Get disclosures by operator
91
+ *
92
+ * @returns Array of disclosures grouped by operator
93
+ */
94
+ async byOperator() {
95
+ const response = await this.client["request"]("/v1/ei/frac-focus/by-operator", {});
96
+ return Array.isArray(response) ? response : response.data;
97
+ }
98
+ /**
99
+ * Get chemical usage statistics
100
+ *
101
+ * @returns Array of chemicals used in fracturing
102
+ */
103
+ async byChemical() {
104
+ const response = await this.client["request"]("/v1/ei/frac-focus/by-chemical", {});
105
+ return Array.isArray(response) ? response : response.data;
106
+ }
107
+ /**
108
+ * Search FracFocus disclosures
109
+ *
110
+ * @param query - Search query parameters
111
+ * @returns Array of matching disclosure records
112
+ */
113
+ async search(query) {
114
+ const params = {};
115
+ if (query.state)
116
+ params.state = query.state;
117
+ if (query.operator)
118
+ params.operator = query.operator;
119
+ if (query.chemical)
120
+ params.chemical = query.chemical;
121
+ if (query.start_date)
122
+ params.start_date = query.start_date;
123
+ if (query.end_date)
124
+ params.end_date = query.end_date;
125
+ const response = await this.client["request"]("/v1/ei/frac-focus/search", params);
126
+ return Array.isArray(response) ? response : response.data;
127
+ }
128
+ /**
129
+ * Get chemicals used in a specific well
130
+ *
131
+ * @param id - Disclosure record ID
132
+ * @returns Array of chemicals used in the well
133
+ */
134
+ async chemicals(id) {
135
+ if (!id || typeof id !== "string") {
136
+ throw new errors_js_1.ValidationError("Disclosure ID must be a non-empty string");
137
+ }
138
+ const response = await this.client["request"](`/v1/ei/frac-focus/${id}/chemicals`, {});
139
+ return Array.isArray(response) ? response : response.chemicals;
140
+ }
141
+ /**
142
+ * Get FracFocus disclosures for a specific well by API number
143
+ *
144
+ * @param apiNumber - API well number (e.g., "42-123-12345")
145
+ * @returns Array of disclosure records for the well
146
+ */
147
+ async forWell(apiNumber) {
148
+ if (!apiNumber || typeof apiNumber !== "string") {
149
+ throw new errors_js_1.ValidationError("API number must be a non-empty string");
150
+ }
151
+ const response = await this.client["request"](`/v1/ei/frac-focus/for-well/${apiNumber}`, {});
152
+ return Array.isArray(response) ? response : response.data;
153
+ }
154
+ }
155
+ exports.EIFracFocusResource = EIFracFocusResource;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * Energy Intelligence Resource
4
+ *
5
+ * Comprehensive energy market intelligence including rig counts, inventories,
6
+ * OPEC production, drilling productivity, forecasts, well permits, and FracFocus data.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EIFracFocusResource = exports.EIWellPermitsResource = exports.EIForecastsResource = exports.EIDrillingProductivityResource = exports.EIOPECProductionResource = exports.EIOilInventoriesResource = exports.EIRigCountsResource = exports.EnergyIntelligenceResource = void 0;
10
+ const rig_counts_js_1 = require("./rig-counts.js");
11
+ Object.defineProperty(exports, "EIRigCountsResource", { enumerable: true, get: function () { return rig_counts_js_1.EIRigCountsResource; } });
12
+ const oil_inventories_js_1 = require("./oil-inventories.js");
13
+ Object.defineProperty(exports, "EIOilInventoriesResource", { enumerable: true, get: function () { return oil_inventories_js_1.EIOilInventoriesResource; } });
14
+ const opec_production_js_1 = require("./opec-production.js");
15
+ Object.defineProperty(exports, "EIOPECProductionResource", { enumerable: true, get: function () { return opec_production_js_1.EIOPECProductionResource; } });
16
+ const drilling_productivity_js_1 = require("./drilling-productivity.js");
17
+ Object.defineProperty(exports, "EIDrillingProductivityResource", { enumerable: true, get: function () { return drilling_productivity_js_1.EIDrillingProductivityResource; } });
18
+ const forecasts_js_1 = require("./forecasts.js");
19
+ Object.defineProperty(exports, "EIForecastsResource", { enumerable: true, get: function () { return forecasts_js_1.EIForecastsResource; } });
20
+ const well_permits_js_1 = require("./well-permits.js");
21
+ Object.defineProperty(exports, "EIWellPermitsResource", { enumerable: true, get: function () { return well_permits_js_1.EIWellPermitsResource; } });
22
+ const frac_focus_js_1 = require("./frac-focus.js");
23
+ Object.defineProperty(exports, "EIFracFocusResource", { enumerable: true, get: function () { return frac_focus_js_1.EIFracFocusResource; } });
24
+ const errors_js_1 = require("../../errors.js");
25
+ /**
26
+ * Energy Intelligence Resource
27
+ *
28
+ * Access comprehensive energy market intelligence from EIA, Baker Hughes,
29
+ * FracFocus, and other authoritative sources.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { OilPriceAPI } from 'oilpriceapi';
34
+ *
35
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
36
+ *
37
+ * // Rig counts
38
+ * const rigCounts = await client.ei.rigCounts.latest();
39
+ * console.log(`Total rigs: ${rigCounts.total_rigs}`);
40
+ *
41
+ * // Oil inventories
42
+ * const inventories = await client.ei.oilInventories.latest();
43
+ * console.log(`Crude stocks: ${inventories.level} ${inventories.unit}`);
44
+ *
45
+ * // OPEC production
46
+ * const opec = await client.ei.opecProduction.total();
47
+ * console.log(`OPEC production: ${opec.total_production_bpd} bpd`);
48
+ *
49
+ * // Well timeline
50
+ * const timeline = await client.ei.wellTimeline('42-123-12345');
51
+ * timeline.events.forEach(e => {
52
+ * console.log(`${e.date}: ${e.event_type}`);
53
+ * });
54
+ * ```
55
+ */
56
+ class EnergyIntelligenceResource {
57
+ constructor(client) {
58
+ this.client = client;
59
+ this.rigCounts = new rig_counts_js_1.EIRigCountsResource(client);
60
+ this.oilInventories = new oil_inventories_js_1.EIOilInventoriesResource(client);
61
+ this.opecProduction = new opec_production_js_1.EIOPECProductionResource(client);
62
+ this.drillingProductivity = new drilling_productivity_js_1.EIDrillingProductivityResource(client);
63
+ this.forecasts = new forecasts_js_1.EIForecastsResource(client);
64
+ this.wellPermits = new well_permits_js_1.EIWellPermitsResource(client);
65
+ this.fracFocus = new frac_focus_js_1.EIFracFocusResource(client);
66
+ }
67
+ /**
68
+ * Get well timeline by API number
69
+ *
70
+ * Returns chronological timeline of events for a specific well including
71
+ * permits, drilling, completion, production, and FracFocus disclosures.
72
+ *
73
+ * @param apiNumber - API well number (e.g., "42-123-12345")
74
+ * @returns Well timeline with events
75
+ *
76
+ * @throws {NotFoundError} If well not found
77
+ * @throws {OilPriceAPIError} If API request fails
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const timeline = await client.ei.wellTimeline('42-123-12345');
82
+ * console.log(`Well: ${timeline.well_name}`);
83
+ * console.log(`Operator: ${timeline.operator}`);
84
+ * console.log(`Events: ${timeline.events.length}`);
85
+ *
86
+ * timeline.events.forEach(event => {
87
+ * console.log(`${event.date}: ${event.event_type} - ${event.description}`);
88
+ * });
89
+ * ```
90
+ */
91
+ async wellTimeline(apiNumber) {
92
+ if (!apiNumber || typeof apiNumber !== "string") {
93
+ throw new errors_js_1.ValidationError("API number must be a non-empty string");
94
+ }
95
+ return this.client["request"](`/v1/ei/wells/${apiNumber}/timeline`, {});
96
+ }
97
+ }
98
+ exports.EnergyIntelligenceResource = EnergyIntelligenceResource;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ /**
3
+ * Energy Intelligence - Oil Inventories Resource
4
+ *
5
+ * Access EIA crude oil inventory data including total US stocks, Cushing levels,
6
+ * and regional breakdowns.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EIOilInventoriesResource = void 0;
10
+ const errors_js_1 = require("../../errors.js");
11
+ /**
12
+ * EI Oil Inventories Resource
13
+ *
14
+ * Access EIA crude oil and petroleum product inventory data.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
19
+ *
20
+ * // Get latest inventories
21
+ * const latest = await client.ei.oilInventories.latest();
22
+ * console.log(`Total crude: ${latest.level} ${latest.unit}`);
23
+ *
24
+ * // Get Cushing stocks
25
+ * const cushing = await client.ei.oilInventories.cushing();
26
+ * console.log(`Cushing: ${cushing.level} ${cushing.unit}`);
27
+ * ```
28
+ */
29
+ class EIOilInventoriesResource {
30
+ constructor(client) {
31
+ this.client = client;
32
+ }
33
+ /**
34
+ * List all oil inventory records
35
+ *
36
+ * @returns Array of inventory records
37
+ */
38
+ async list() {
39
+ const response = await this.client["request"]("/v1/ei/oil_inventories", {});
40
+ return Array.isArray(response) ? response : response.data;
41
+ }
42
+ /**
43
+ * Get a specific inventory record
44
+ *
45
+ * @param id - Record ID
46
+ * @returns Inventory record
47
+ */
48
+ async get(id) {
49
+ if (!id || typeof id !== "string") {
50
+ throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
51
+ }
52
+ return this.client["request"](`/v1/ei/oil_inventories/${id}`, {});
53
+ }
54
+ /**
55
+ * Get latest oil inventory data
56
+ *
57
+ * @returns Latest inventory record
58
+ */
59
+ async latest() {
60
+ return this.client["request"]("/v1/ei/oil_inventories/latest", {});
61
+ }
62
+ /**
63
+ * Get inventory summary
64
+ *
65
+ * @returns Inventory summary across all products
66
+ */
67
+ async summary() {
68
+ return this.client["request"]("/v1/ei/oil_inventories/summary", {});
69
+ }
70
+ /**
71
+ * Get inventories by product type
72
+ *
73
+ * @returns Array of inventories by product
74
+ */
75
+ async byProduct() {
76
+ const response = await this.client["request"]("/v1/ei/oil_inventories/by_product", {});
77
+ return Array.isArray(response) ? response : response.data;
78
+ }
79
+ /**
80
+ * Get historical inventory data
81
+ *
82
+ * @returns Array of historical inventory levels
83
+ */
84
+ async historical() {
85
+ const response = await this.client["request"]("/v1/ei/oil_inventories/historical", {});
86
+ return Array.isArray(response) ? response : response.data;
87
+ }
88
+ /**
89
+ * Get Cushing, OK inventory data
90
+ *
91
+ * @returns Cushing inventory data
92
+ */
93
+ async cushing() {
94
+ return this.client["request"]("/v1/ei/oil_inventories/cushing", {});
95
+ }
96
+ }
97
+ exports.EIOilInventoriesResource = EIOilInventoriesResource;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ /**
3
+ * Energy Intelligence - OPEC Production Resource
4
+ *
5
+ * Access OPEC crude oil production data by country with historical trends.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EIOPECProductionResource = void 0;
9
+ const errors_js_1 = require("../../errors.js");
10
+ /**
11
+ * EI OPEC Production Resource
12
+ *
13
+ * Access OPEC crude oil production data and analytics.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
18
+ *
19
+ * // Get total OPEC production
20
+ * const total = await client.ei.opecProduction.total();
21
+ * console.log(`Total OPEC: ${total.total_production_bpd} bpd`);
22
+ *
23
+ * // Get top producers
24
+ * const top = await client.ei.opecProduction.topProducers();
25
+ * top.forEach(p => console.log(`${p.rank}. ${p.country}: ${p.production_bpd} bpd`));
26
+ * ```
27
+ */
28
+ class EIOPECProductionResource {
29
+ constructor(client) {
30
+ this.client = client;
31
+ }
32
+ /**
33
+ * List all OPEC production records
34
+ *
35
+ * @returns Array of production records
36
+ */
37
+ async list() {
38
+ const response = await this.client["request"]("/v1/ei/opec_productions", {});
39
+ return Array.isArray(response) ? response : response.data;
40
+ }
41
+ /**
42
+ * Get a specific production record
43
+ *
44
+ * @param id - Record ID
45
+ * @returns Production record
46
+ */
47
+ async get(id) {
48
+ if (!id || typeof id !== "string") {
49
+ throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
50
+ }
51
+ return this.client["request"](`/v1/ei/opec_productions/${id}`, {});
52
+ }
53
+ /**
54
+ * Get latest OPEC production data
55
+ *
56
+ * @returns Latest production record
57
+ */
58
+ async latest() {
59
+ return this.client["request"]("/v1/ei/opec_productions/latest", {});
60
+ }
61
+ /**
62
+ * Get total OPEC production
63
+ *
64
+ * @returns Total OPEC production summary
65
+ */
66
+ async total() {
67
+ return this.client["request"]("/v1/ei/opec_productions/total", {});
68
+ }
69
+ /**
70
+ * Get production by country
71
+ *
72
+ * @returns Array of production by country
73
+ */
74
+ async byCountry() {
75
+ const response = await this.client["request"]("/v1/ei/opec_productions/by_country", {});
76
+ return Array.isArray(response) ? response : response.data;
77
+ }
78
+ /**
79
+ * Get historical production data
80
+ *
81
+ * @returns Array of historical production levels
82
+ */
83
+ async historical() {
84
+ const response = await this.client["request"]("/v1/ei/opec_productions/historical", {});
85
+ return Array.isArray(response) ? response : response.data;
86
+ }
87
+ /**
88
+ * Get top OPEC producers
89
+ *
90
+ * @returns Array of top producing countries
91
+ */
92
+ async topProducers() {
93
+ const response = await this.client["request"]("/v1/ei/opec_productions/top_producers", {});
94
+ return Array.isArray(response) ? response : response.data;
95
+ }
96
+ }
97
+ exports.EIOPECProductionResource = EIOPECProductionResource;