oilpriceapi 0.6.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 (80) hide show
  1. package/README.md +418 -123
  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 +116 -5
  30. package/dist/client.js +169 -47
  31. package/dist/errors.d.ts +6 -0
  32. package/dist/errors.js +25 -16
  33. package/dist/index.d.ts +45 -6
  34. package/dist/index.js +40 -3
  35. package/dist/resources/alerts.d.ts +52 -15
  36. package/dist/resources/alerts.js +121 -109
  37. package/dist/resources/analytics.d.ts +325 -0
  38. package/dist/resources/analytics.js +222 -0
  39. package/dist/resources/bunker-fuels.d.ts +270 -0
  40. package/dist/resources/bunker-fuels.js +192 -0
  41. package/dist/resources/commodities.d.ts +148 -0
  42. package/dist/resources/commodities.js +111 -0
  43. package/dist/resources/data-quality.d.ts +229 -0
  44. package/dist/resources/data-quality.js +140 -0
  45. package/dist/resources/data-sources.d.ts +365 -0
  46. package/dist/resources/data-sources.js +293 -0
  47. package/dist/resources/diesel.d.ts +1 -1
  48. package/dist/resources/diesel.js +9 -38
  49. package/dist/resources/drilling.d.ts +403 -0
  50. package/dist/resources/drilling.js +265 -0
  51. package/dist/resources/ei/drilling-productivity.d.ts +173 -0
  52. package/dist/resources/ei/drilling-productivity.js +104 -0
  53. package/dist/resources/ei/forecasts.d.ts +177 -0
  54. package/dist/resources/ei/forecasts.js +102 -0
  55. package/dist/resources/ei/frac-focus.d.ts +212 -0
  56. package/dist/resources/ei/frac-focus.js +151 -0
  57. package/dist/resources/ei/index.d.ts +140 -0
  58. package/dist/resources/ei/index.js +88 -0
  59. package/dist/resources/ei/oil-inventories.d.ts +155 -0
  60. package/dist/resources/ei/oil-inventories.js +93 -0
  61. package/dist/resources/ei/opec-production.d.ts +146 -0
  62. package/dist/resources/ei/opec-production.js +93 -0
  63. package/dist/resources/ei/rig-counts.d.ts +131 -0
  64. package/dist/resources/ei/rig-counts.js +89 -0
  65. package/dist/resources/ei/well-permits.d.ts +178 -0
  66. package/dist/resources/ei/well-permits.js +120 -0
  67. package/dist/resources/forecasts.d.ts +200 -0
  68. package/dist/resources/forecasts.js +158 -0
  69. package/dist/resources/futures.d.ts +322 -0
  70. package/dist/resources/futures.js +229 -0
  71. package/dist/resources/rig-counts.d.ts +221 -0
  72. package/dist/resources/rig-counts.js +157 -0
  73. package/dist/resources/storage.d.ts +182 -0
  74. package/dist/resources/storage.js +162 -0
  75. package/dist/resources/webhooks.d.ts +326 -0
  76. package/dist/resources/webhooks.js +290 -0
  77. package/dist/types.d.ts +79 -8
  78. package/dist/version.d.ts +1 -1
  79. package/dist/version.js +2 -2
  80. package/package.json +17 -8
@@ -0,0 +1,265 @@
1
+ /**
2
+ * Drilling Intelligence Resource
3
+ *
4
+ * Access US onshore drilling activity data including rig counts, well permits,
5
+ * frac spreads, DUC wells, completions, and production trends by basin.
6
+ */
7
+ import { ValidationError } from "../errors.js";
8
+ /**
9
+ * Drilling Intelligence Resource
10
+ *
11
+ * Access US onshore drilling activity data from EIA and Baker Hughes.
12
+ * Includes rig counts, well permits, frac spreads, DUC wells, completions,
13
+ * and basin-level breakdowns.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { OilPriceAPI } from 'oilpriceapi';
18
+ *
19
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
20
+ *
21
+ * // Get latest drilling intelligence
22
+ * const latest = await client.drilling.latest();
23
+ * console.log(`Active rigs: ${latest.total_rigs}`);
24
+ *
25
+ * // Get drilling trends
26
+ * const trends = await client.drilling.trends();
27
+ * trends.forEach(trend => {
28
+ * console.log(`${trend.date}: ${trend.metric} = ${trend.value}`);
29
+ * });
30
+ *
31
+ * // Get basin-specific data
32
+ * const permian = await client.drilling.basin('Permian');
33
+ * console.log(`Permian rigs: ${permian.active_rigs}`);
34
+ * ```
35
+ */
36
+ export class DrillingIntelligenceResource {
37
+ constructor(client) {
38
+ this.client = client;
39
+ }
40
+ /**
41
+ * List all drilling intelligence records
42
+ *
43
+ * Returns all available drilling intelligence data points.
44
+ *
45
+ * @returns Array of drilling intelligence data
46
+ *
47
+ * @throws {OilPriceAPIError} If API request fails
48
+ * @throws {AuthenticationError} If API key is invalid
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const data = await client.drilling.list();
53
+ * console.log(`${data.length} records found`);
54
+ * ```
55
+ */
56
+ async list() {
57
+ const response = await this.client["request"]("/v1/drilling-intelligence", {});
58
+ return Array.isArray(response) ? response : response.data;
59
+ }
60
+ /**
61
+ * Get latest drilling intelligence summary
62
+ *
63
+ * Returns the most recent snapshot of drilling activity metrics.
64
+ *
65
+ * @returns Latest drilling intelligence data
66
+ *
67
+ * @throws {OilPriceAPIError} If API request fails
68
+ * @throws {AuthenticationError} If API key is invalid
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const latest = await client.drilling.latest();
73
+ * console.log(`Total active rigs: ${latest.total_rigs}`);
74
+ * console.log(`Frac spreads: ${latest.total_frac_spreads}`);
75
+ * console.log(`As of: ${latest.as_of_date}`);
76
+ * ```
77
+ */
78
+ async latest() {
79
+ return this.client["request"]("/v1/drilling-intelligence/latest", {});
80
+ }
81
+ /**
82
+ * Get drilling intelligence summary
83
+ *
84
+ * Returns aggregated summary of drilling metrics by type.
85
+ *
86
+ * @returns Array of drilling summaries by metric
87
+ *
88
+ * @throws {OilPriceAPIError} If API request fails
89
+ * @throws {AuthenticationError} If API key is invalid
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const summary = await client.drilling.summary();
94
+ * summary.forEach(metric => {
95
+ * console.log(`${metric.metric}: ${metric.total}`);
96
+ * if (metric.change_percent) {
97
+ * console.log(` Change: ${metric.change_percent}%`);
98
+ * }
99
+ * });
100
+ * ```
101
+ */
102
+ async summary() {
103
+ const response = await this.client["request"]("/v1/drilling-intelligence/summary", {});
104
+ return Array.isArray(response) ? response : response.summary;
105
+ }
106
+ /**
107
+ * Get drilling activity trends
108
+ *
109
+ * Returns time series data showing trends in drilling metrics.
110
+ *
111
+ * @returns Array of drilling trend data points
112
+ *
113
+ * @throws {OilPriceAPIError} If API request fails
114
+ * @throws {AuthenticationError} If API key is invalid
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const trends = await client.drilling.trends();
119
+ * trends.forEach(point => {
120
+ * console.log(`${point.date}: ${point.metric} = ${point.value} (${point.trend})`);
121
+ * });
122
+ * ```
123
+ */
124
+ async trends() {
125
+ const response = await this.client["request"]("/v1/drilling-intelligence/trends", {});
126
+ return Array.isArray(response) ? response : response.trends;
127
+ }
128
+ /**
129
+ * Get frac spread data
130
+ *
131
+ * Returns active frac spread counts by basin.
132
+ *
133
+ * @returns Array of frac spread data by basin
134
+ *
135
+ * @throws {OilPriceAPIError} If API request fails
136
+ * @throws {AuthenticationError} If API key is invalid
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * const fracSpreads = await client.drilling.fracSpreads();
141
+ * fracSpreads.forEach(spread => {
142
+ * console.log(`${spread.basin}: ${spread.active_spreads} spreads`);
143
+ * });
144
+ * ```
145
+ */
146
+ async fracSpreads() {
147
+ const response = await this.client["request"]("/v1/drilling-intelligence/frac-spreads", {});
148
+ return Array.isArray(response) ? response : response.data;
149
+ }
150
+ /**
151
+ * Get well permit data
152
+ *
153
+ * Returns well permits issued by state and basin.
154
+ *
155
+ * @returns Array of well permit data
156
+ *
157
+ * @throws {OilPriceAPIError} If API request fails
158
+ * @throws {AuthenticationError} If API key is invalid
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const permits = await client.drilling.wellPermits();
163
+ * permits.forEach(permit => {
164
+ * console.log(`${permit.state}: ${permit.permits} permits`);
165
+ * });
166
+ * ```
167
+ */
168
+ async wellPermits() {
169
+ const response = await this.client["request"]("/v1/drilling-intelligence/well-permits", {});
170
+ return Array.isArray(response) ? response : response.data;
171
+ }
172
+ /**
173
+ * Get DUC well data
174
+ *
175
+ * Returns drilled but uncompleted (DUC) well counts by basin.
176
+ *
177
+ * @returns Array of DUC well data
178
+ *
179
+ * @throws {OilPriceAPIError} If API request fails
180
+ * @throws {AuthenticationError} If API key is invalid
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const ducWells = await client.drilling.ducWells();
185
+ * ducWells.forEach(duc => {
186
+ * console.log(`${duc.basin}: ${duc.duc_count} DUC wells`);
187
+ * });
188
+ * ```
189
+ */
190
+ async ducWells() {
191
+ const response = await this.client["request"]("/v1/drilling-intelligence/duc-wells", {});
192
+ return Array.isArray(response) ? response : response.data;
193
+ }
194
+ /**
195
+ * Get well completion data
196
+ *
197
+ * Returns well completion counts by basin.
198
+ *
199
+ * @returns Array of completion data
200
+ *
201
+ * @throws {OilPriceAPIError} If API request fails
202
+ * @throws {AuthenticationError} If API key is invalid
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * const completions = await client.drilling.completions();
207
+ * completions.forEach(comp => {
208
+ * console.log(`${comp.basin}: ${comp.completions} completions`);
209
+ * });
210
+ * ```
211
+ */
212
+ async completions() {
213
+ const response = await this.client["request"]("/v1/drilling-intelligence/completions", {});
214
+ return Array.isArray(response) ? response : response.data;
215
+ }
216
+ /**
217
+ * Get wells drilled data
218
+ *
219
+ * Returns wells drilled counts by basin.
220
+ *
221
+ * @returns Array of wells drilled data
222
+ *
223
+ * @throws {OilPriceAPIError} If API request fails
224
+ * @throws {AuthenticationError} If API key is invalid
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const drilled = await client.drilling.wellsDrilled();
229
+ * drilled.forEach(data => {
230
+ * console.log(`${data.basin}: ${data.wells_drilled} wells drilled`);
231
+ * });
232
+ * ```
233
+ */
234
+ async wellsDrilled() {
235
+ const response = await this.client["request"]("/v1/drilling-intelligence/wells-drilled", {});
236
+ return Array.isArray(response) ? response : response.data;
237
+ }
238
+ /**
239
+ * Get basin-specific drilling intelligence
240
+ *
241
+ * Returns comprehensive drilling data for a specific basin.
242
+ *
243
+ * @param name - Basin name (e.g., "Permian", "Eagle Ford", "Bakken")
244
+ * @returns Basin drilling intelligence data
245
+ *
246
+ * @throws {NotFoundError} If basin not found
247
+ * @throws {OilPriceAPIError} If API request fails
248
+ * @throws {AuthenticationError} If API key is invalid
249
+ *
250
+ * @example
251
+ * ```typescript
252
+ * const permian = await client.drilling.basin('Permian');
253
+ * console.log(`Permian Basin as of ${permian.as_of_date}:`);
254
+ * console.log(` Active rigs: ${permian.active_rigs}`);
255
+ * console.log(` Frac spreads: ${permian.frac_spreads}`);
256
+ * console.log(` DUC wells: ${permian.duc_wells}`);
257
+ * ```
258
+ */
259
+ async basin(name) {
260
+ if (!name || typeof name !== "string") {
261
+ throw new ValidationError("Basin name must be a non-empty string");
262
+ }
263
+ return this.client["request"](`/v1/drilling-intelligence/basin/${name}`, {});
264
+ }
265
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Energy Intelligence - Drilling Productivity Resource
3
+ *
4
+ * Access EIA Drilling Productivity Report data including new well production,
5
+ * legacy decline rates, and DUC well inventories by basin.
6
+ */
7
+ import type { OilPriceAPI } from "../../client.js";
8
+ /**
9
+ * Drilling productivity record
10
+ */
11
+ export interface DrillingProductivityRecord {
12
+ /** Record ID */
13
+ id: string;
14
+ /** Basin name */
15
+ basin?: string;
16
+ /** New well oil production per rig (barrels/day) */
17
+ new_well_oil_production?: number;
18
+ /** New well gas production per rig (mcf/day) */
19
+ new_well_gas_production?: number;
20
+ /** Legacy production change (oil) */
21
+ legacy_oil_change?: number;
22
+ /** Legacy production change (gas) */
23
+ legacy_gas_change?: number;
24
+ /** DUC well count */
25
+ duc_count?: number;
26
+ /** Report date */
27
+ date: string;
28
+ /** Month */
29
+ month?: string;
30
+ /** ISO timestamp */
31
+ timestamp: string;
32
+ /** Additional metadata */
33
+ metadata?: Record<string, unknown>;
34
+ }
35
+ /**
36
+ * Drilling productivity summary
37
+ */
38
+ export interface DrillingProductivitySummary {
39
+ /** Total new well oil production */
40
+ total_new_well_oil?: number;
41
+ /** Total new well gas production */
42
+ total_new_well_gas?: number;
43
+ /** Total DUC wells */
44
+ total_duc_wells?: number;
45
+ /** As of date */
46
+ as_of_date: string;
47
+ }
48
+ /**
49
+ * DUC well data
50
+ */
51
+ export interface DUCWellInventory {
52
+ /** Basin name */
53
+ basin: string;
54
+ /** DUC well count */
55
+ duc_count: number;
56
+ /** Change from previous month */
57
+ change?: number;
58
+ /** Date */
59
+ date: string;
60
+ }
61
+ /**
62
+ * Productivity by basin
63
+ */
64
+ export interface ProductivityByBasin {
65
+ /** Basin name */
66
+ basin: string;
67
+ /** New well oil production */
68
+ new_well_oil_production?: number;
69
+ /** New well gas production */
70
+ new_well_gas_production?: number;
71
+ /** DUC count */
72
+ duc_count?: number;
73
+ /** Date */
74
+ date: string;
75
+ }
76
+ /**
77
+ * Historical productivity data point
78
+ */
79
+ export interface HistoricalProductivity {
80
+ /** Date */
81
+ date: string;
82
+ /** New well oil production */
83
+ new_well_oil_production?: number;
84
+ /** New well gas production */
85
+ new_well_gas_production?: number;
86
+ /** DUC count */
87
+ duc_count?: number;
88
+ }
89
+ /**
90
+ * Productivity trend data
91
+ */
92
+ export interface ProductivityTrend {
93
+ /** Basin name */
94
+ basin: string;
95
+ /** Trend direction */
96
+ trend: "up" | "down" | "flat";
97
+ /** Change percentage */
98
+ change_percent?: number;
99
+ /** Metric type */
100
+ metric: string;
101
+ }
102
+ /**
103
+ * EI Drilling Productivity Resource
104
+ *
105
+ * Access EIA Drilling Productivity Report data for major US basins.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
110
+ *
111
+ * // Get latest productivity data
112
+ * const latest = await client.ei.drillingProductivity.latest();
113
+ * console.log(`Basin: ${latest.basin}`);
114
+ * console.log(`New well oil: ${latest.new_well_oil_production} bpd/rig`);
115
+ *
116
+ * // Get DUC wells
117
+ * const duc = await client.ei.drillingProductivity.ducWells();
118
+ * duc.forEach(d => console.log(`${d.basin}: ${d.duc_count} DUC wells`));
119
+ * ```
120
+ */
121
+ export declare class EIDrillingProductivityResource {
122
+ private client;
123
+ constructor(client: OilPriceAPI);
124
+ /**
125
+ * List all drilling productivity records
126
+ *
127
+ * @returns Array of productivity records
128
+ */
129
+ list(): Promise<DrillingProductivityRecord[]>;
130
+ /**
131
+ * Get a specific productivity record
132
+ *
133
+ * @param id - Record ID
134
+ * @returns Productivity record
135
+ */
136
+ get(id: string): Promise<DrillingProductivityRecord>;
137
+ /**
138
+ * Get latest drilling productivity data
139
+ *
140
+ * @returns Latest productivity record
141
+ */
142
+ latest(): Promise<DrillingProductivityRecord>;
143
+ /**
144
+ * Get drilling productivity summary
145
+ *
146
+ * @returns Productivity summary across all basins
147
+ */
148
+ summary(): Promise<DrillingProductivitySummary>;
149
+ /**
150
+ * Get DUC well inventories
151
+ *
152
+ * @returns Array of DUC well counts by basin
153
+ */
154
+ ducWells(): Promise<DUCWellInventory[]>;
155
+ /**
156
+ * Get productivity by basin
157
+ *
158
+ * @returns Array of productivity data by basin
159
+ */
160
+ byBasin(): Promise<ProductivityByBasin[]>;
161
+ /**
162
+ * Get historical productivity data
163
+ *
164
+ * @returns Array of historical productivity metrics
165
+ */
166
+ historical(): Promise<HistoricalProductivity[]>;
167
+ /**
168
+ * Get productivity trends
169
+ *
170
+ * @returns Array of productivity trends by basin
171
+ */
172
+ trends(): Promise<ProductivityTrend[]>;
173
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Energy Intelligence - Drilling Productivity Resource
3
+ *
4
+ * Access EIA Drilling Productivity Report data including new well production,
5
+ * legacy decline rates, and DUC well inventories by basin.
6
+ */
7
+ import { ValidationError } from "../../errors.js";
8
+ /**
9
+ * EI Drilling Productivity Resource
10
+ *
11
+ * Access EIA Drilling Productivity Report data for major US basins.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const client = new OilPriceAPI({ apiKey: 'your_key' });
16
+ *
17
+ * // Get latest productivity data
18
+ * const latest = await client.ei.drillingProductivity.latest();
19
+ * console.log(`Basin: ${latest.basin}`);
20
+ * console.log(`New well oil: ${latest.new_well_oil_production} bpd/rig`);
21
+ *
22
+ * // Get DUC wells
23
+ * const duc = await client.ei.drillingProductivity.ducWells();
24
+ * duc.forEach(d => console.log(`${d.basin}: ${d.duc_count} DUC wells`));
25
+ * ```
26
+ */
27
+ export class EIDrillingProductivityResource {
28
+ constructor(client) {
29
+ this.client = client;
30
+ }
31
+ /**
32
+ * List all drilling productivity records
33
+ *
34
+ * @returns Array of productivity records
35
+ */
36
+ async list() {
37
+ const response = await this.client["request"]("/v1/ei/drilling_productivities", {});
38
+ return Array.isArray(response) ? response : response.data;
39
+ }
40
+ /**
41
+ * Get a specific productivity record
42
+ *
43
+ * @param id - Record ID
44
+ * @returns Productivity record
45
+ */
46
+ async get(id) {
47
+ if (!id || typeof id !== "string") {
48
+ throw new ValidationError("Record ID must be a non-empty string");
49
+ }
50
+ return this.client["request"](`/v1/ei/drilling_productivities/${id}`, {});
51
+ }
52
+ /**
53
+ * Get latest drilling productivity data
54
+ *
55
+ * @returns Latest productivity record
56
+ */
57
+ async latest() {
58
+ return this.client["request"]("/v1/ei/drilling_productivities/latest", {});
59
+ }
60
+ /**
61
+ * Get drilling productivity summary
62
+ *
63
+ * @returns Productivity summary across all basins
64
+ */
65
+ async summary() {
66
+ return this.client["request"]("/v1/ei/drilling_productivities/summary", {});
67
+ }
68
+ /**
69
+ * Get DUC well inventories
70
+ *
71
+ * @returns Array of DUC well counts by basin
72
+ */
73
+ async ducWells() {
74
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/duc_wells", {});
75
+ return Array.isArray(response) ? response : response.data;
76
+ }
77
+ /**
78
+ * Get productivity by basin
79
+ *
80
+ * @returns Array of productivity data by basin
81
+ */
82
+ async byBasin() {
83
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/by_basin", {});
84
+ return Array.isArray(response) ? response : response.data;
85
+ }
86
+ /**
87
+ * Get historical productivity data
88
+ *
89
+ * @returns Array of historical productivity metrics
90
+ */
91
+ async historical() {
92
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/historical", {});
93
+ return Array.isArray(response) ? response : response.data;
94
+ }
95
+ /**
96
+ * Get productivity trends
97
+ *
98
+ * @returns Array of productivity trends by basin
99
+ */
100
+ async trends() {
101
+ const response = await this.client["request"]("/v1/ei/drilling_productivities/trends", {});
102
+ return Array.isArray(response) ? response : response.data;
103
+ }
104
+ }