deere-sdk 1.0.9 → 2.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.
Files changed (143) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/README.md +68 -0
  3. package/dist/api/aemp.d.ts +4 -0
  4. package/dist/api/aemp.d.ts.map +1 -1
  5. package/dist/api/aemp.js +5 -1
  6. package/dist/api/aemp.js.map +1 -1
  7. package/dist/api/assets.d.ts +4 -0
  8. package/dist/api/assets.d.ts.map +1 -1
  9. package/dist/api/assets.js +13 -9
  10. package/dist/api/assets.js.map +1 -1
  11. package/dist/api/boundaries.d.ts +4 -0
  12. package/dist/api/boundaries.d.ts.map +1 -1
  13. package/dist/api/boundaries.js +12 -8
  14. package/dist/api/boundaries.js.map +1 -1
  15. package/dist/api/clients.d.ts +4 -0
  16. package/dist/api/clients.d.ts.map +1 -1
  17. package/dist/api/clients.js +12 -8
  18. package/dist/api/clients.js.map +1 -1
  19. package/dist/api/connection-management.d.ts +4 -0
  20. package/dist/api/connection-management.d.ts.map +1 -1
  21. package/dist/api/connection-management.js +8 -4
  22. package/dist/api/connection-management.js.map +1 -1
  23. package/dist/api/crop-types.d.ts +4 -0
  24. package/dist/api/crop-types.d.ts.map +1 -1
  25. package/dist/api/crop-types.js +9 -5
  26. package/dist/api/crop-types.js.map +1 -1
  27. package/dist/api/equipment-measurement.d.ts +4 -0
  28. package/dist/api/equipment-measurement.d.ts.map +1 -1
  29. package/dist/api/equipment-measurement.js +5 -1
  30. package/dist/api/equipment-measurement.js.map +1 -1
  31. package/dist/api/equipment.d.ts +4 -0
  32. package/dist/api/equipment.d.ts.map +1 -1
  33. package/dist/api/equipment.js +20 -16
  34. package/dist/api/equipment.js.map +1 -1
  35. package/dist/api/farms.d.ts +4 -0
  36. package/dist/api/farms.d.ts.map +1 -1
  37. package/dist/api/farms.js +12 -8
  38. package/dist/api/farms.js.map +1 -1
  39. package/dist/api/field-operations-api.d.ts +4 -0
  40. package/dist/api/field-operations-api.d.ts.map +1 -1
  41. package/dist/api/field-operations-api.js +8 -4
  42. package/dist/api/field-operations-api.js.map +1 -1
  43. package/dist/api/fields.d.ts +4 -0
  44. package/dist/api/fields.d.ts.map +1 -1
  45. package/dist/api/fields.js +12 -8
  46. package/dist/api/fields.js.map +1 -1
  47. package/dist/api/files.d.ts +4 -0
  48. package/dist/api/files.d.ts.map +1 -1
  49. package/dist/api/files.js +10 -6
  50. package/dist/api/files.js.map +1 -1
  51. package/dist/api/flags.d.ts +4 -0
  52. package/dist/api/flags.d.ts.map +1 -1
  53. package/dist/api/flags.js +11 -7
  54. package/dist/api/flags.js.map +1 -1
  55. package/dist/api/guidance-lines.d.ts +4 -0
  56. package/dist/api/guidance-lines.d.ts.map +1 -1
  57. package/dist/api/guidance-lines.js +9 -5
  58. package/dist/api/guidance-lines.js.map +1 -1
  59. package/dist/api/harvest-id.d.ts +4 -0
  60. package/dist/api/harvest-id.d.ts.map +1 -1
  61. package/dist/api/harvest-id.js +7 -3
  62. package/dist/api/harvest-id.js.map +1 -1
  63. package/dist/api/machine-alerts.d.ts +4 -0
  64. package/dist/api/machine-alerts.d.ts.map +1 -1
  65. package/dist/api/machine-alerts.js +6 -2
  66. package/dist/api/machine-alerts.js.map +1 -1
  67. package/dist/api/machine-device-state-reports.d.ts +4 -0
  68. package/dist/api/machine-device-state-reports.d.ts.map +1 -1
  69. package/dist/api/machine-device-state-reports.js +5 -1
  70. package/dist/api/machine-device-state-reports.js.map +1 -1
  71. package/dist/api/machine-engine-hours.d.ts +4 -0
  72. package/dist/api/machine-engine-hours.d.ts.map +1 -1
  73. package/dist/api/machine-engine-hours.js +6 -2
  74. package/dist/api/machine-engine-hours.js.map +1 -1
  75. package/dist/api/machine-hours-of-operation.d.ts +4 -0
  76. package/dist/api/machine-hours-of-operation.d.ts.map +1 -1
  77. package/dist/api/machine-hours-of-operation.js +6 -2
  78. package/dist/api/machine-hours-of-operation.js.map +1 -1
  79. package/dist/api/machine-locations.d.ts +4 -0
  80. package/dist/api/machine-locations.d.ts.map +1 -1
  81. package/dist/api/machine-locations.js +5 -1
  82. package/dist/api/machine-locations.js.map +1 -1
  83. package/dist/api/map-layers.d.ts +4 -0
  84. package/dist/api/map-layers.d.ts.map +1 -1
  85. package/dist/api/map-layers.js +9 -5
  86. package/dist/api/map-layers.js.map +1 -1
  87. package/dist/api/notifications.d.ts +4 -0
  88. package/dist/api/notifications.d.ts.map +1 -1
  89. package/dist/api/notifications.js +9 -5
  90. package/dist/api/notifications.js.map +1 -1
  91. package/dist/api/operators.d.ts +4 -0
  92. package/dist/api/operators.d.ts.map +1 -1
  93. package/dist/api/operators.js +11 -7
  94. package/dist/api/operators.js.map +1 -1
  95. package/dist/api/organizations.d.ts +4 -0
  96. package/dist/api/organizations.d.ts.map +1 -1
  97. package/dist/api/organizations.js +9 -5
  98. package/dist/api/organizations.js.map +1 -1
  99. package/dist/api/partnerships.d.ts +4 -0
  100. package/dist/api/partnerships.d.ts.map +1 -1
  101. package/dist/api/partnerships.js +11 -7
  102. package/dist/api/partnerships.js.map +1 -1
  103. package/dist/api/products.d.ts +4 -0
  104. package/dist/api/products.d.ts.map +1 -1
  105. package/dist/api/products.js +14 -10
  106. package/dist/api/products.js.map +1 -1
  107. package/dist/api/users.d.ts +4 -0
  108. package/dist/api/users.d.ts.map +1 -1
  109. package/dist/api/users.js +5 -1
  110. package/dist/api/users.js.map +1 -1
  111. package/dist/api/webhook.d.ts +4 -0
  112. package/dist/api/webhook.d.ts.map +1 -1
  113. package/dist/api/webhook.js +9 -5
  114. package/dist/api/webhook.js.map +1 -1
  115. package/dist/api-servers.generated.d.ts +72 -0
  116. package/dist/api-servers.generated.d.ts.map +1 -0
  117. package/dist/api-servers.generated.js +344 -0
  118. package/dist/api-servers.generated.js.map +1 -0
  119. package/dist/client.d.ts +122 -36
  120. package/dist/client.d.ts.map +1 -1
  121. package/dist/client.js +302 -71
  122. package/dist/client.js.map +1 -1
  123. package/dist/environment-resolver.d.ts +40 -0
  124. package/dist/environment-resolver.d.ts.map +1 -0
  125. package/dist/environment-resolver.js +79 -0
  126. package/dist/environment-resolver.js.map +1 -0
  127. package/dist/errors.d.ts +36 -0
  128. package/dist/errors.d.ts.map +1 -0
  129. package/dist/errors.js +54 -0
  130. package/dist/errors.js.map +1 -0
  131. package/dist/hateoas-map.d.ts +25 -0
  132. package/dist/hateoas-map.d.ts.map +1 -0
  133. package/dist/hateoas-map.js +176 -0
  134. package/dist/hateoas-map.js.map +1 -0
  135. package/dist/index.d.ts +1 -1
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +1 -1
  138. package/dist/index.js.map +1 -1
  139. package/package.json +4 -3
  140. package/dist/api/field-operations.d.ts +0 -83
  141. package/dist/api/field-operations.d.ts.map +0 -1
  142. package/dist/api/field-operations.js +0 -134
  143. package/dist/api/field-operations.js.map +0 -1
package/dist/client.js CHANGED
@@ -2,44 +2,85 @@
2
2
  * John Deere API Client
3
3
  *
4
4
  * Unofficial TypeScript SDK for John Deere Operations Center API.
5
- * Provides typed access to all John Deere agricultural APIs.
5
+ *
6
+ * URL resolution flow (v2.0):
7
+ *
8
+ * User code
9
+ * │
10
+ * ▼
11
+ * deere.equipmentMeasurement.post(params)
12
+ * │
13
+ * ▼
14
+ * this.client.post('equipment-measurement', '/orgs/.../measurements', data, options)
15
+ * │
16
+ * ▼
17
+ * DeereClient.post()
18
+ * ├─ resolveRequestUrl(spec, path, this.environment)
19
+ * │ ├─ API_SERVERS[spec] lookup
20
+ * │ ├─ templated → urlTemplate.replace('{environment}', env)
21
+ * │ ├─ static → urlByEnvironment[env] (throws UnsupportedEnvironmentError if missing)
22
+ * │ └─ unavailable → throws NoServerConfigError
23
+ * └─ requestUrl('POST', url, body, options)
24
+ * └─ fetch(url, ...) with retry + timeout
25
+ *
26
+ * Absolute URLs bypass the resolver via fetchUrl() — used for HATEOAS next-page
27
+ * links and power-user escape hatches. fetchUrl attaches the Bearer token ONLY
28
+ * to *.deere.com hosts; third-party URLs get no Authorization header.
29
+ *
30
+ * URL data lives in src/api-servers.generated.ts, built from OpenAPI specs at
31
+ * build time by scripts/generate-api-servers.ts. Never hand-edit that file.
6
32
  */
7
- export class DeereError extends Error {
8
- status;
9
- statusText;
10
- body;
11
- constructor(message, status, statusText, body) {
12
- super(message);
13
- this.status = status;
14
- this.statusText = statusText;
15
- this.body = body;
16
- this.name = 'DeereError';
17
- }
18
- }
19
- export class RateLimitError extends DeereError {
20
- retryAfter;
21
- constructor(message, status, statusText, retryAfter, body) {
22
- super(message, status, statusText, body);
23
- this.retryAfter = retryAfter;
24
- this.name = 'RateLimitError';
25
- }
26
- }
27
- export class AuthError extends DeereError {
28
- constructor(message, status, statusText, body) {
29
- super(message, status, statusText, body);
30
- this.name = 'AuthError';
31
- }
32
- }
33
- const ENVIRONMENT_URLS = {
34
- production: 'https://api.deere.com/platform',
35
- sandbox: 'https://sandboxapi.deere.com/platform',
36
- partner: 'https://partnerapi.deere.com/platform',
37
- cert: 'https://apicert.deere.com/platform',
38
- qa: 'https://apiqa.tal.deere.com/platform',
33
+ import { DEFAULT_ENVIRONMENT, KNOWN_ENVIRONMENTS, } from './api-servers.generated.js';
34
+ import { resolveRequestUrl } from './environment-resolver.js';
35
+ /**
36
+ * Legacy v1 environment names (kept for error-message migration hints only).
37
+ * v1 consumers passing 'production'/'sandbox'/etc. get a thrown error at
38
+ * construction time pointing them at the v2 raw subdomain name.
39
+ */
40
+ const V1_LEGACY_ENV_NAMES = {
41
+ production: 'api',
42
+ sandbox: 'sandboxapi',
43
+ partner: 'partnerapi',
44
+ cert: 'apicert',
45
+ qa: 'apiqa.tal',
39
46
  };
47
+ // Error classes live in ./errors.ts to avoid a circular import with
48
+ // environment-resolver.ts. Imported here for internal use (throws, instanceof
49
+ // checks) and re-exported for backward compatibility with any consumer that
50
+ // imports them from 'deere-sdk' main entry.
51
+ import { AuthError, DeereError, HateoasError, RateLimitError } from './errors.js';
52
+ export { AuthError, DeereError, HateoasError, RateLimitError };
40
53
  const DEERE_ACCEPT_HEADER = 'application/vnd.deere.axiom.v3+json';
54
+ /**
55
+ * Hostnames where fetchUrl() will attach the Bearer token. Any URL whose
56
+ * hostname does NOT match this pattern has Authorization suppressed to
57
+ * prevent accidental token leakage to third-party services.
58
+ *
59
+ * Matches: deere.com, api.deere.com, foo.bar.deere.com, etc.
60
+ * Does not match: untrusted.example, deere.com.untrusted.example, localhost.
61
+ */
62
+ const TRUSTED_HOSTS = /^([a-z0-9-]+\.)*deere\.com$/i;
41
63
  /** HTTP status codes that are safe to retry */
42
64
  const RETRYABLE_STATUS_CODES = new Set([429, 500, 502, 503, 504]);
65
+ import { HATEOAS_MAP } from './hateoas-map.js';
66
+ class LinkCache {
67
+ cache = new Map();
68
+ set(parentPath, links) {
69
+ this.cache.set(parentPath, links);
70
+ }
71
+ findRel(parentPath, rel) {
72
+ const links = this.cache.get(parentPath);
73
+ if (!links)
74
+ return undefined;
75
+ return links.find((l) => l.rel === rel)?.uri;
76
+ }
77
+ has(parentPath) {
78
+ return this.cache.has(parentPath);
79
+ }
80
+ clear() {
81
+ this.cache.clear();
82
+ }
83
+ }
43
84
  /**
44
85
  * John Deere API Client
45
86
  *
@@ -47,11 +88,12 @@ const RETRYABLE_STATUS_CODES = new Set([429, 500, 502, 503, 504]);
47
88
  * ```typescript
48
89
  * const client = new DeereClient({
49
90
  * accessToken: 'your-token',
50
- * environment: 'sandbox',
91
+ * environment: 'sandboxapi', // v2: raw JD subdomain, not 'sandbox'
51
92
  * maxRetries: 3, // Retries with exponential backoff (default: 3)
52
93
  * });
53
94
  *
54
- * const orgs = await client.get('/organizations');
95
+ * // v2: first arg is the spec name (generated classes do this for you)
96
+ * const orgs = await client.get('organizations', '/organizations');
55
97
  * ```
56
98
  *
57
99
  * @remarks
@@ -61,17 +103,22 @@ const RETRYABLE_STATUS_CODES = new Set([429, 500, 502, 503, 504]);
61
103
  * Set `maxRetries: 0` to disable automatic retries.
62
104
  */
63
105
  export class DeereClient {
64
- baseUrl;
106
+ environment;
65
107
  accessToken;
66
108
  fetchFn;
67
109
  defaultHeaders;
68
110
  timeout;
69
111
  retryConfig;
112
+ hateoas;
113
+ hateoasDebug;
114
+ linkCache = new LinkCache();
70
115
  constructor(config) {
71
116
  this.accessToken = config.accessToken;
72
- this.baseUrl = config.baseUrl ?? ENVIRONMENT_URLS[config.environment ?? 'sandbox'];
117
+ this.environment = this.validateEnvironment(config.environment);
73
118
  this.fetchFn = config.fetch ?? fetch;
74
119
  this.timeout = config.timeout ?? 30000;
120
+ this.hateoas = config.hateoas ?? false;
121
+ this.hateoasDebug = config.hateoasDebug ?? false;
75
122
  this.defaultHeaders = {
76
123
  Accept: DEERE_ACCEPT_HEADER,
77
124
  'Content-Type': DEERE_ACCEPT_HEADER,
@@ -84,71 +131,127 @@ export class DeereClient {
84
131
  };
85
132
  }
86
133
  /**
87
- * Make a GET request to the John Deere API
134
+ * Validates the environment string from config. Throws at construction
135
+ * time with a migration hint if the user passed a v1 friendly name or an
136
+ * unknown string — catches errors immediately instead of at first request.
88
137
  */
89
- async get(path, options) {
90
- return this.request('GET', path, undefined, options);
138
+ validateEnvironment(raw) {
139
+ const env = raw ?? DEFAULT_ENVIRONMENT;
140
+ if (KNOWN_ENVIRONMENTS.includes(env)) {
141
+ return env;
142
+ }
143
+ const v2Replacement = V1_LEGACY_ENV_NAMES[env];
144
+ const migrationHint = v2Replacement
145
+ ? `\n\nv2.0 replaced v1 friendly environment names with raw JD subdomains. ` +
146
+ `Use '${v2Replacement}' instead of '${env}'. See CHANGELOG.md for the full table.`
147
+ : '';
148
+ throw new Error(`Invalid environment '${env}'. Valid values: ${KNOWN_ENVIRONMENTS.join(', ')}.` +
149
+ migrationHint);
91
150
  }
92
151
  /**
93
- * Make a POST request to the John Deere API
152
+ * GET request, spec-aware. Generated API classes call this with their own
153
+ * `spec` as the first argument — consumers don't normally call it directly.
94
154
  */
95
- async post(path, body, options) {
96
- return this.request('POST', path, body, options);
155
+ async get(specName, path, options) {
156
+ return this.request(specName, 'GET', path, undefined, options);
97
157
  }
98
158
  /**
99
- * Make a PUT request to the John Deere API
159
+ * POST request, spec-aware.
100
160
  */
101
- async put(path, body, options) {
102
- return this.request('PUT', path, body, options);
161
+ async post(specName, path, body, options) {
162
+ return this.request(specName, 'POST', path, body, options);
103
163
  }
104
164
  /**
105
- * Make a DELETE request to the John Deere API
165
+ * PUT request, spec-aware.
106
166
  */
107
- async delete(path, options) {
108
- return this.request('DELETE', path, undefined, options);
167
+ async put(specName, path, body, options) {
168
+ return this.request(specName, 'PUT', path, body, options);
109
169
  }
110
170
  /**
111
- * Make a PATCH request to the John Deere API
171
+ * DELETE request, spec-aware.
112
172
  */
113
- async patch(path, body, options) {
114
- return this.request('PATCH', path, body, options);
173
+ async delete(specName, path, options) {
174
+ return this.request(specName, 'DELETE', path, undefined, options);
115
175
  }
116
176
  /**
117
- * Follow a HAL link from a response
177
+ * PATCH request, spec-aware.
178
+ */
179
+ async patch(specName, path, body, options) {
180
+ return this.request(specName, 'PATCH', path, body, options);
181
+ }
182
+ /**
183
+ * Fetch an absolute URL directly. Escape hatch for HATEOAS next-page links,
184
+ * HAL link traversal, and power users with pre-resolved URLs.
185
+ *
186
+ * **Security**: Attaches the Bearer token ONLY when the target hostname
187
+ * matches a trusted `*.deere.com` origin. Third-party URLs get NO
188
+ * Authorization header — prevents accidental token leakage to tracking or
189
+ * proxy services. If you need to send auth to a non-JD host, set
190
+ * `Authorization` explicitly via `options.headers`.
191
+ */
192
+ async fetchUrl(method, url, body, options) {
193
+ const { hostname } = new URL(url);
194
+ const isTrusted = TRUSTED_HOSTS.test(hostname);
195
+ if (!isTrusted && this.hateoasDebug) {
196
+ console.warn(`[deere-sdk] fetchUrl: '${hostname}' is not a trusted *.deere.com host. ` +
197
+ `Bearer token suppressed. Set Authorization manually via options.headers ` +
198
+ `if needed.`);
199
+ }
200
+ const internalOpts = {
201
+ ...options,
202
+ _noAuth: !isTrusted,
203
+ };
204
+ return this.requestUrl(method, url, body, internalOpts);
205
+ }
206
+ /**
207
+ * Follow a HAL link from a response. Accepts a Link object or a raw URL
208
+ * string. Delegates to fetchUrl() so the trusted-host check applies.
118
209
  */
119
210
  async followLink(link, options) {
120
211
  const uri = typeof link === 'string' ? link : link.uri;
121
- // If it's a full URL, use it directly; otherwise treat as path
122
- const url = uri.startsWith('http') ? uri : `${this.baseUrl}${uri}`;
123
- return this.requestUrl('GET', url, undefined, options);
212
+ return this.fetchUrl('GET', uri, undefined, options);
124
213
  }
125
214
  /**
126
- * Paginate through all results following nextPage links
215
+ * Paginate through all results following nextPage links. First page is
216
+ * resolved via the spec's URL config; subsequent pages use the absolute
217
+ * URLs returned by the API in `response.links`.
127
218
  */
128
- async *paginate(path, options) {
129
- let url = `${this.baseUrl}${path}`;
219
+ async *paginate(specName, path, options) {
220
+ // First page: resolve via the spec (templated or static lookup).
221
+ let url = this.hateoas
222
+ ? await this.resolveHateoasUrl(specName, path)
223
+ : resolveRequestUrl(specName, path, this.environment);
224
+ let isFirstPage = true;
130
225
  while (url) {
131
- const response = await this.requestUrl('GET', url, undefined, options);
226
+ // First page uses the normal auth path; subsequent nextPage URLs are
227
+ // absolute and routed through fetchUrl which applies the trusted-host
228
+ // check (they're always *.deere.com in practice).
229
+ const response = isFirstPage
230
+ ? await this.requestUrl('GET', url, undefined, options)
231
+ : await this.fetchUrl('GET', url, undefined, options);
132
232
  if (response.values && response.values.length > 0) {
133
233
  yield response.values;
134
234
  }
135
- // Find nextPage link
235
+ // Find nextPage link — always absolute in JD's HAL responses.
136
236
  const nextPageLink = response.links?.find((l) => l.rel === 'nextPage');
137
237
  url = nextPageLink?.uri;
238
+ isFirstPage = false;
138
239
  }
139
240
  }
140
241
  /**
141
- * Get all items from a paginated endpoint
242
+ * Get all items from a paginated endpoint, spec-aware.
142
243
  */
143
- async getAll(path, options) {
244
+ async getAll(specName, path, options) {
144
245
  const items = [];
145
- for await (const page of this.paginate(path, options)) {
246
+ for await (const page of this.paginate(specName, path, options)) {
146
247
  items.push(...page);
147
248
  }
148
249
  return items;
149
250
  }
150
- async request(method, path, body, options) {
151
- const url = path.startsWith('http') ? path : `${this.baseUrl}${path}`;
251
+ async request(specName, method, path, body, options) {
252
+ const url = this.hateoas
253
+ ? await this.resolveHateoasUrl(specName, path)
254
+ : resolveRequestUrl(specName, path, this.environment);
152
255
  return this.requestUrl(method, url, body, options);
153
256
  }
154
257
  async requestUrl(method, url, body, options) {
@@ -159,13 +262,25 @@ export class DeereClient {
159
262
  const controller = new AbortController();
160
263
  const timeoutId = setTimeout(() => controller.abort(), timeout);
161
264
  try {
265
+ // Build headers: defaultHeaders → auto Bearer → user overrides.
266
+ // The auto-Bearer is attached ONLY when the internal _noAuth flag
267
+ // is unset (fetchUrl suppresses for untrusted hosts) AND when the
268
+ // user hasn't explicitly set Authorization themselves (user opt-in
269
+ // wins over our default).
270
+ const userHeaders = options?.headers ?? {};
271
+ const headers = {
272
+ ...this.defaultHeaders,
273
+ };
274
+ if (!options?._noAuth &&
275
+ userHeaders.Authorization === undefined) {
276
+ headers.Authorization = `Bearer ${this.accessToken}`;
277
+ }
278
+ // Apply user headers LAST so they override both defaultHeaders and
279
+ // the auto-attached Bearer when explicitly set.
280
+ Object.assign(headers, userHeaders);
162
281
  const response = await this.fetchFn(url, {
163
282
  method,
164
- headers: {
165
- ...this.defaultHeaders,
166
- Authorization: `Bearer ${this.accessToken}`,
167
- ...options?.headers,
168
- },
283
+ headers,
169
284
  body: body ? JSON.stringify(body) : undefined,
170
285
  signal: options?.signal ?? controller.signal,
171
286
  });
@@ -236,6 +351,122 @@ export class DeereClient {
236
351
  // Should not reach here, but just in case
237
352
  throw lastError ?? new DeereError('Request failed after retries', 0, 'RetryExhausted');
238
353
  }
354
+ /**
355
+ * Clear the HATEOAS link cache. Useful for long-lived clients or testing.
356
+ */
357
+ clearLinkCache() {
358
+ this.linkCache.clear();
359
+ }
360
+ /**
361
+ * Pre-fetch parent resources to warm the HATEOAS link cache.
362
+ * Reduces latency for subsequent HATEOAS-resolved requests.
363
+ *
364
+ * @param specName - Spec that owns the paths (e.g. 'organizations')
365
+ * @param paths - Parent resource paths to pre-fetch (defaults to '/organizations')
366
+ */
367
+ async warmLinkCache(specName, paths = ['/organizations']) {
368
+ for (const path of paths) {
369
+ try {
370
+ const url = resolveRequestUrl(specName, path, this.environment);
371
+ const response = await this.requestUrl('GET', url);
372
+ if (response?.links) {
373
+ this.linkCache.set(path, response.links);
374
+ }
375
+ }
376
+ catch {
377
+ // Best-effort — skip paths that fail
378
+ }
379
+ }
380
+ }
381
+ /**
382
+ * Match a concrete path against the HATEOAS route map.
383
+ * Returns the concrete parent path, rel name, and optional parentSpec
384
+ * (which spec owns the parent resource — used for cross-spec HATEOAS).
385
+ * Returns null if no map entry matches.
386
+ */
387
+ matchHateoasPattern(concretePath) {
388
+ const concreteSegments = concretePath.split('/').filter(Boolean);
389
+ for (const [pattern, route] of Object.entries(HATEOAS_MAP)) {
390
+ const patternSegments = pattern.split('/').filter(Boolean);
391
+ if (concreteSegments.length !== patternSegments.length)
392
+ continue;
393
+ let matches = true;
394
+ for (let i = 0; i < patternSegments.length; i++) {
395
+ if (patternSegments[i].startsWith('{'))
396
+ continue; // wildcard
397
+ if (patternSegments[i] !== concreteSegments[i]) {
398
+ matches = false;
399
+ break;
400
+ }
401
+ }
402
+ if (matches) {
403
+ // Build the concrete parent path by substituting actual values
404
+ const parentSegments = route.parentPath.split('/').filter(Boolean);
405
+ const concreteParentParts = parentSegments.map((seg, i) => seg.startsWith('{') ? concreteSegments[i] : seg);
406
+ const concreteParentPath = `/${concreteParentParts.join('/')}`;
407
+ // parentSpec is optional on the route interface to allow gradual
408
+ // rollout — Phase 6 populates it. Falls back to the caller's spec
409
+ // when absent (same-spec HATEOAS, the common case).
410
+ const routeWithParentSpec = route;
411
+ return {
412
+ concreteParentPath,
413
+ rel: route.rel,
414
+ parentSpec: routeWithParentSpec.parentSpec,
415
+ };
416
+ }
417
+ }
418
+ return null;
419
+ }
420
+ /**
421
+ * Resolve a path via HATEOAS link traversal, spec-aware.
422
+ *
423
+ * Fetches the parent resource (via the parent's own spec host, not the
424
+ * child's — critical for cross-spec flows like equipment.yaml's org-scoped
425
+ * endpoints whose parent `/organizations/{orgId}` lives on the platform
426
+ * host, not equipmentapi.deere.com/isg).
427
+ *
428
+ * Throws HateoasError if resolution fails.
429
+ */
430
+ async resolveHateoasUrl(specName, path) {
431
+ // Strip query params for matching, reattach after
432
+ const [basePath, queryString] = path.split('?', 2);
433
+ const match = this.matchHateoasPattern(basePath);
434
+ if (!match) {
435
+ // No map entry — resolve directly via the caller's spec.
436
+ return resolveRequestUrl(specName, path, this.environment);
437
+ }
438
+ const { concreteParentPath, rel, parentSpec } = match;
439
+ // parentSpec is optional; fall back to the caller's spec if the HATEOAS
440
+ // map doesn't record which spec owns the parent (Phase 5 compat — Phase 6
441
+ // regenerates hateoas-map.ts with parentSpec populated).
442
+ const effectiveParentSpec = parentSpec ?? specName;
443
+ // Check cache
444
+ let discoveredUrl = this.linkCache.findRel(concreteParentPath, rel);
445
+ if (!discoveredUrl) {
446
+ // Cache miss — fetch parent resource via its OWN spec's host.
447
+ try {
448
+ const parentUrl = resolveRequestUrl(effectiveParentSpec, concreteParentPath, this.environment);
449
+ const parentResponse = await this.requestUrl('GET', parentUrl);
450
+ if (parentResponse?.links) {
451
+ this.linkCache.set(concreteParentPath, parentResponse.links);
452
+ discoveredUrl = this.linkCache.findRel(concreteParentPath, rel);
453
+ }
454
+ }
455
+ catch (error) {
456
+ throw new HateoasError(`HATEOAS resolution failed: could not fetch parent resource "${concreteParentPath}"`, path, error instanceof Error ? error : undefined);
457
+ }
458
+ }
459
+ if (!discoveredUrl) {
460
+ const cachedLinks = this.linkCache.has(concreteParentPath);
461
+ throw new HateoasError(`HATEOAS resolution failed: parent "${concreteParentPath}" has no link with rel "${rel}"${cachedLinks ? '' : ' (parent returned no links)'}`, path);
462
+ }
463
+ // Reattach query params
464
+ const resolvedUrl = queryString ? `${discoveredUrl}?${queryString}` : discoveredUrl;
465
+ if (this.hateoasDebug) {
466
+ console.log(`[HATEOAS] ${path} → parent: ${concreteParentPath}, rel: ${rel} → ${resolvedUrl}`);
467
+ }
468
+ return resolvedUrl;
469
+ }
239
470
  /**
240
471
  * Check if an error/status code is retryable
241
472
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmDH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGjB;IACA;IACA;IAJlB,YACE,OAAe,EACC,MAAc,EACd,UAAkB,EAClB,IAAc;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAU;QAG9B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,UAAU;IAK1B;IAJlB,YACE,OAAe,EACf,MAAc,EACd,UAAkB,EACF,UAAmB,EACnC,IAAc;QAEd,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAHzB,eAAU,GAAV,UAAU,CAAS;QAInC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,SAAU,SAAQ,UAAU;IACvC,YAAY,OAAe,EAAE,MAAc,EAAE,UAAkB,EAAE,IAAc;QAC7E,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,gBAAgB,GAAgC;IACpD,UAAU,EAAE,gCAAgC;IAC5C,OAAO,EAAE,uCAAuC;IAChD,OAAO,EAAE,uCAAuC;IAChD,IAAI,EAAE,oCAAoC;IAC1C,EAA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rl` to turn a (spec, path, environment) tuple into
6
+ * a full URL — or throw a clear, actionable error before any HTTP call.
7
+ *
8
+ * Design note: no heuristics, no silent fallbacks. If the spec's static map
9
+ * doesn't cover the current environment, we throw. Sandbox vs prod is a
10
+ * trust boundary — falling back silently could delete customer data.
11
+ */
12
+ import { type Environment, type SpecName } from './api-servers.generated.js';
13
+ import { DeereError } from './errors.js';
14
+ /**
15
+ * Thrown when a spec has no server configuration (missing/malformed
16
+ * servers block, or generator classified it as 'unavailable').
17
+ */
18
+ export declare class NoServerConfigError extends DeereError {
19
+ constructor(specName: string, reason?: string);
20
+ }
21
+ /**
22
+ * Thrown when a spec is available but does not support the requested
23
+ * environment. The error message lists supported envs + concrete alternatives.
24
+ */
25
+ export declare class UnsupportedEnvironmentError extends DeereError {
26
+ constructor(specName: string, environment: string, supported: readonly string[]);
27
+ }
28
+ /**
29
+ * Resolves a request URL for the given spec and environment.
30
+ *
31
+ * @param specName Name of the OpenAPI spec (e.g. 'equipment', 'organizations').
32
+ * @param path Relative path starting with '/' or '?' (generated code always emits this).
33
+ * @param environment Environment from the DeereClient config.
34
+ * @returns The full URL ready for `fetch`.
35
+ * @throws NoServerConfigError if the spec isn't in API_SERVERS or is unavailable.
36
+ * @throws UnsupportedEnvironmentError if the spec is static and the env isn't in its map.
37
+ * @throws Error if the path doesn't start with '/' or '?' (developer error guard).
38
+ */
39
+ export declare function resolveRequestUrl(specName: SpecName | string, path: string, environment: Environment): string;
40
+ //# sourceMappingURL=environment-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment-resolver.d.ts","sourceRoot":"","sources":["../src/environment-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAAuB,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAY9C;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,UAAU;gBAC7C,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE;CAchF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAC3B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,WAAW,GACvB,MAAM,CAmCR"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Runtime URL resolver for spec-aware requests.
3
+ *
4
+ * Pure, deterministic, and side-effect-free. Every DeereClient request goes
5
+ * through `resolveRequestUrl` to turn a (spec, path, environment) tuple into
6
+ * a full URL — or throw a clear, actionable error before any HTTP call.
7
+ *
8
+ * Design note: no heuristics, no silent fallbacks. If the spec's static map
9
+ * doesn't cover the current environment, we throw. Sandbox vs prod is a
10
+ * trust boundary — falling back silently could delete customer data.
11
+ */
12
+ import { API_SERVERS } from './api-servers.generated.js';
13
+ import { CLIENT_ERROR_STATUS, DeereError } from './errors.js';
14
+ /**
15
+ * Thrown when a spec has no server configuration (missing/malformed
16
+ * servers block, or generator classified it as 'unavailable').
17
+ */
18
+ export class NoServerConfigError extends DeereError {
19
+ constructor(specName, reason) {
20
+ super(`Spec '${specName}' has no server configuration.${reason
21
+ ? ` ${reason}`
22
+ : " Its OpenAPI file is missing a 'servers' block or has a malformed URL."}`, CLIENT_ERROR_STATUS, 'NoServerConfig');
23
+ this.name = 'NoServerConfigError';
24
+ }
25
+ }
26
+ /**
27
+ * Thrown when a spec is available but does not support the requested
28
+ * environment. The error message lists supported envs + concrete alternatives.
29
+ */
30
+ export class UnsupportedEnvironmentError extends DeereError {
31
+ constructor(specName, environment, supported) {
32
+ const supportedList = supported.length > 0 ? supported.join(', ') : '(none)';
33
+ super(`The '${specName}' API does not support environment '${environment}'.\n\n` +
34
+ `Supported environments for this spec: ${supportedList}.\n\n` +
35
+ `This usually means the underlying JD backend has a different tier ` +
36
+ `structure than the platform APIs (the ISG proxy uses qual/cert/prod ` +
37
+ `tiers, with no sandbox or dev tier). For testing, try environment ` +
38
+ `'apiqa.tal' (qual tier). For production, use 'api' (prod tier).`, CLIENT_ERROR_STATUS, 'UnsupportedEnvironment');
39
+ this.name = 'UnsupportedEnvironmentError';
40
+ }
41
+ }
42
+ /**
43
+ * Resolves a request URL for the given spec and environment.
44
+ *
45
+ * @param specName Name of the OpenAPI spec (e.g. 'equipment', 'organizations').
46
+ * @param path Relative path starting with '/' or '?' (generated code always emits this).
47
+ * @param environment Environment from the DeereClient config.
48
+ * @returns The full URL ready for `fetch`.
49
+ * @throws NoServerConfigError if the spec isn't in API_SERVERS or is unavailable.
50
+ * @throws UnsupportedEnvironmentError if the spec is static and the env isn't in its map.
51
+ * @throws Error if the path doesn't start with '/' or '?' (developer error guard).
52
+ */
53
+ export function resolveRequestUrl(specName, path, environment) {
54
+ // Defensive invariant: generated code always emits paths with a leading '/'.
55
+ // This guard catches manual callers passing `client.get('spec', 'relative')`
56
+ // by mistake, turning a silent 404 on `host+relative` into a clear error.
57
+ if (path && !path.startsWith('/') && !path.startsWith('?')) {
58
+ throw new Error(`Invalid path '${path}': must start with '/' (e.g., '/organizations') ` +
59
+ `or '?' for query-only paths.`);
60
+ }
61
+ const config = API_SERVERS[specName];
62
+ if (!config) {
63
+ throw new NoServerConfigError(specName);
64
+ }
65
+ if (config.kind === 'unavailable') {
66
+ throw new NoServerConfigError(specName, config.reason);
67
+ }
68
+ if (config.kind === 'templated') {
69
+ const baseUrl = config.urlTemplate.replace('{environment}', environment);
70
+ return `${baseUrl}${path}`;
71
+ }
72
+ // kind === 'static' — partial map, throw on unsupported env
73
+ const baseUrl = config.urlByEnvironment[environment];
74
+ if (!baseUrl) {
75
+ throw new UnsupportedEnvironmentError(specName, environment, Object.keys(config.urlByEnvironment));
76
+ }
77
+ return `${baseUrl}${path}`;
78
+ }
79
+ //# sourceMappingURL=environment-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment-resolver.js","sourceRoot":"","sources":["../src/environment-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAmC,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,QAAgB,EAAE,MAAe;QAC3C,KAAK,CACH,SAAS,QAAQ,iCACf,MAAM;YACJ,CAAC,CAAC,IAAI,MAAM,EAAE;YACd,CAAC,CAAC,wEACN,EAAE,EACF,mBAAmB,EACnB,gBAAgB,CACjB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,UAAU;IACzD,YAAY,QAAgB,EAAE,WAAmB,EAAE,SAA4B;QAC7E,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC7E,KAAK,CACH,QAAQ,QAAQ,uCAAuC,WAAW,QAAQ;YACxE,yCAAyC,aAAa,OAAO;YAC7D,oEAAoE;YACpE,sEAAsE;YACtE,oEAAoE;YACpE,iEAAiE,EACnE,mBAAmB,EACnB,wBAAwB,CACzB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAA2B,EAC3B,IAAY,EACZ,WAAwB;IAExB,6EAA6E;IAC7E,6EAA6E;IAC7E,0EAA0E;IAC1E,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC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