deere-sdk 1.0.10 → 2.1.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.
- package/CHANGELOG.md +223 -0
- package/README.md +130 -20
- package/dist/api/aemp.d.ts +4 -0
- package/dist/api/aemp.d.ts.map +1 -1
- package/dist/api/aemp.js +5 -1
- package/dist/api/aemp.js.map +1 -1
- package/dist/api/assets.d.ts +4 -0
- package/dist/api/assets.d.ts.map +1 -1
- package/dist/api/assets.js +13 -9
- package/dist/api/assets.js.map +1 -1
- package/dist/api/boundaries.d.ts +4 -0
- package/dist/api/boundaries.d.ts.map +1 -1
- package/dist/api/boundaries.js +12 -8
- package/dist/api/boundaries.js.map +1 -1
- package/dist/api/clients.d.ts +4 -0
- package/dist/api/clients.d.ts.map +1 -1
- package/dist/api/clients.js +12 -8
- package/dist/api/clients.js.map +1 -1
- package/dist/api/connection-management.d.ts +4 -0
- package/dist/api/connection-management.d.ts.map +1 -1
- package/dist/api/connection-management.js +8 -4
- package/dist/api/connection-management.js.map +1 -1
- package/dist/api/crop-types.d.ts +4 -0
- package/dist/api/crop-types.d.ts.map +1 -1
- package/dist/api/crop-types.js +9 -5
- package/dist/api/crop-types.js.map +1 -1
- package/dist/api/equipment-measurement.d.ts +4 -0
- package/dist/api/equipment-measurement.d.ts.map +1 -1
- package/dist/api/equipment-measurement.js +5 -1
- package/dist/api/equipment-measurement.js.map +1 -1
- package/dist/api/equipment.d.ts +4 -0
- package/dist/api/equipment.d.ts.map +1 -1
- package/dist/api/equipment.js +20 -16
- package/dist/api/equipment.js.map +1 -1
- package/dist/api/farms.d.ts +4 -0
- package/dist/api/farms.d.ts.map +1 -1
- package/dist/api/farms.js +12 -8
- package/dist/api/farms.js.map +1 -1
- package/dist/api/field-operations-api.d.ts +4 -0
- package/dist/api/field-operations-api.d.ts.map +1 -1
- package/dist/api/field-operations-api.js +8 -4
- package/dist/api/field-operations-api.js.map +1 -1
- package/dist/api/fields.d.ts +4 -0
- package/dist/api/fields.d.ts.map +1 -1
- package/dist/api/fields.js +12 -8
- package/dist/api/fields.js.map +1 -1
- package/dist/api/files.d.ts +4 -0
- package/dist/api/files.d.ts.map +1 -1
- package/dist/api/files.js +10 -6
- package/dist/api/files.js.map +1 -1
- package/dist/api/flags.d.ts +4 -0
- package/dist/api/flags.d.ts.map +1 -1
- package/dist/api/flags.js +11 -7
- package/dist/api/flags.js.map +1 -1
- package/dist/api/guidance-lines.d.ts +4 -0
- package/dist/api/guidance-lines.d.ts.map +1 -1
- package/dist/api/guidance-lines.js +9 -5
- package/dist/api/guidance-lines.js.map +1 -1
- package/dist/api/harvest-id.d.ts +4 -0
- package/dist/api/harvest-id.d.ts.map +1 -1
- package/dist/api/harvest-id.js +7 -3
- package/dist/api/harvest-id.js.map +1 -1
- package/dist/api/machine-alerts.d.ts +4 -0
- package/dist/api/machine-alerts.d.ts.map +1 -1
- package/dist/api/machine-alerts.js +6 -2
- package/dist/api/machine-alerts.js.map +1 -1
- package/dist/api/machine-device-state-reports.d.ts +4 -0
- package/dist/api/machine-device-state-reports.d.ts.map +1 -1
- package/dist/api/machine-device-state-reports.js +5 -1
- package/dist/api/machine-device-state-reports.js.map +1 -1
- package/dist/api/machine-engine-hours.d.ts +4 -0
- package/dist/api/machine-engine-hours.d.ts.map +1 -1
- package/dist/api/machine-engine-hours.js +6 -2
- package/dist/api/machine-engine-hours.js.map +1 -1
- package/dist/api/machine-hours-of-operation.d.ts +4 -0
- package/dist/api/machine-hours-of-operation.d.ts.map +1 -1
- package/dist/api/machine-hours-of-operation.js +6 -2
- package/dist/api/machine-hours-of-operation.js.map +1 -1
- package/dist/api/machine-locations.d.ts +4 -0
- package/dist/api/machine-locations.d.ts.map +1 -1
- package/dist/api/machine-locations.js +5 -1
- package/dist/api/machine-locations.js.map +1 -1
- package/dist/api/map-layers.d.ts +4 -0
- package/dist/api/map-layers.d.ts.map +1 -1
- package/dist/api/map-layers.js +9 -5
- package/dist/api/map-layers.js.map +1 -1
- package/dist/api/notifications.d.ts +4 -0
- package/dist/api/notifications.d.ts.map +1 -1
- package/dist/api/notifications.js +9 -5
- package/dist/api/notifications.js.map +1 -1
- package/dist/api/operators.d.ts +4 -0
- package/dist/api/operators.d.ts.map +1 -1
- package/dist/api/operators.js +11 -7
- package/dist/api/operators.js.map +1 -1
- package/dist/api/organizations.d.ts +4 -0
- package/dist/api/organizations.d.ts.map +1 -1
- package/dist/api/organizations.js +9 -5
- package/dist/api/organizations.js.map +1 -1
- package/dist/api/partnerships.d.ts +4 -0
- package/dist/api/partnerships.d.ts.map +1 -1
- package/dist/api/partnerships.js +11 -7
- package/dist/api/partnerships.js.map +1 -1
- package/dist/api/products.d.ts +4 -0
- package/dist/api/products.d.ts.map +1 -1
- package/dist/api/products.js +14 -10
- package/dist/api/products.js.map +1 -1
- package/dist/api/users.d.ts +4 -0
- package/dist/api/users.d.ts.map +1 -1
- package/dist/api/users.js +5 -1
- package/dist/api/users.js.map +1 -1
- package/dist/api/webhook.d.ts +4 -0
- package/dist/api/webhook.d.ts.map +1 -1
- package/dist/api/webhook.js +9 -5
- package/dist/api/webhook.js.map +1 -1
- package/dist/api-servers.generated.d.ts +72 -0
- package/dist/api-servers.generated.d.ts.map +1 -0
- package/dist/api-servers.generated.js +344 -0
- package/dist/api-servers.generated.js.map +1 -0
- package/dist/client.d.ts +95 -47
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +196 -105
- package/dist/client.js.map +1 -1
- package/dist/deere.d.ts +14 -0
- package/dist/deere.d.ts.map +1 -1
- package/dist/deere.js +20 -0
- package/dist/deere.js.map +1 -1
- package/dist/environment-resolver.d.ts +40 -0
- package/dist/environment-resolver.d.ts.map +1 -0
- package/dist/environment-resolver.js +79 -0
- package/dist/environment-resolver.js.map +1 -0
- package/dist/errors.d.ts +36 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -0
- package/dist/hateoas-map.d.ts +9 -0
- package/dist/hateoas-map.d.ts.map +1 -1
- package/dist/hateoas-map.js +84 -37
- package/dist/hateoas-map.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/safe/field-operations.d.ts +73 -0
- package/dist/safe/field-operations.d.ts.map +1 -0
- package/dist/safe/field-operations.js +74 -0
- package/dist/safe/field-operations.js.map +1 -0
- package/dist/safe/index.d.ts +41 -0
- package/dist/safe/index.d.ts.map +1 -0
- package/dist/safe/index.js +47 -0
- package/dist/safe/index.js.map +1 -0
- package/dist/types/generated/field-operations-api.d.ts +17 -0
- package/dist/types/generated/field-operations-api.d.ts.map +1 -1
- package/dist/types/generated/index.d.ts +1 -1
- package/dist/types/generated/index.js +1 -1
- package/package.json +3 -2
- package/dist/api/field-operations.d.ts +0 -83
- package/dist/api/field-operations.d.ts.map +0 -1
- package/dist/api/field-operations.js +0 -134
- package/dist/api/field-operations.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,229 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.1.0] - 2026-04-14
|
|
9
|
+
|
|
10
|
+
**Minor, additive release.** Kills a footgun on `fieldOperations.listAll` by
|
|
11
|
+
introducing a "safe facade" layer (`deere.safe.*`) that forces query params
|
|
12
|
+
John Deere's API requires for a complete response but the raw SDK leaves
|
|
13
|
+
optional. Also adds a contract registry that lets future SDK patches encode
|
|
14
|
+
JD spec gaps in one place instead of across hand-written wrappers.
|
|
15
|
+
|
|
16
|
+
### Why
|
|
17
|
+
|
|
18
|
+
John Deere's API documents `embed` as an optional query param on
|
|
19
|
+
`GET /organizations/{orgId}/fields/{fieldId}/fieldOperations`, but silently
|
|
20
|
+
omits the `measurementTypes` array on every returned FieldOperation unless
|
|
21
|
+
the request passes `?embed=measurementTypes`. Downstream consumers that
|
|
22
|
+
forget the embed param get objects with zero values for yield, area,
|
|
23
|
+
moisture, application rate, and seeding population — and can't tell "missing
|
|
24
|
+
data" from "real zero" because JD's OpenAPI spec never documents the
|
|
25
|
+
invariant. FieldMCP shipped placeholder data to production three separate
|
|
26
|
+
times because of this exact bug. 2.1.0 makes "forget the embed param"
|
|
27
|
+
syntactically impossible.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **`deere.safe.fieldOperations.listAllWithMeasurements(orgId, fieldId, params?)`**
|
|
32
|
+
— returns `FieldOperationWithMeasurements[]` (non-optional `measurementTypes`
|
|
33
|
+
array). Forces `embed=measurementTypes` on the outgoing request, and verifies
|
|
34
|
+
every returned operation actually carries the array, throwing `DeereError`
|
|
35
|
+
with the operation id on any contract violation. Empty `measurementTypes: []`
|
|
36
|
+
is valid (the operation has no recorded measurements yet); `undefined` is not
|
|
37
|
+
and fails loudly.
|
|
38
|
+
- **`SafeFacades` class** on `deere.safe` — composition root for safe facades.
|
|
39
|
+
Adding a new safe wrapper means writing a file under `src/safe/` and adding
|
|
40
|
+
one field + one constructor init to `SafeFacades`. The codegen at
|
|
41
|
+
`scripts/generate-sdk.ts` is deliberately kept dumb about what's inside
|
|
42
|
+
`SafeFacades` — it only emits the wire-up, never the contents.
|
|
43
|
+
- **`FieldOperationWithMeasurements`** type — re-exported from the main entry
|
|
44
|
+
for consumers who need to reference the narrowed shape directly.
|
|
45
|
+
- **`scripts/embed-contracts.yaml`** — new registry encoding JD's undocumented
|
|
46
|
+
invariants as a list of OpenAPI schema-patch operations. Consumed at codegen
|
|
47
|
+
time by `scripts/fix-specs.ts`'s `applyEmbedContracts()` transform before
|
|
48
|
+
`openapi-typescript` runs, so the generated types include the
|
|
49
|
+
previously-missing fields with JD's own declared schemas as `$ref` targets.
|
|
50
|
+
- **Generated type `ApplicationProductTotal`** and optional properties
|
|
51
|
+
`FieldOperation.measurementTypes: FieldOperationMeasurement[]` and
|
|
52
|
+
`FieldOperationMeasurementInFullRelease.applicationProductTotals:
|
|
53
|
+
ApplicationProductTotal[]` — produced by the registry patcher and visible to
|
|
54
|
+
both safe-path and raw-path callers.
|
|
55
|
+
|
|
56
|
+
### Migration
|
|
57
|
+
|
|
58
|
+
Replace raw `listAll` calls that read measurement data with the safe variant:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// Before — silently returns FieldOperation objects without measurementTypes
|
|
62
|
+
// unless you remember to pass embed, and the type system doesn't warn you.
|
|
63
|
+
const ops = await deere.fieldOperations.listAll(orgId, fieldId);
|
|
64
|
+
const yield_ = ops[0].measurementTypes; // ← undefined, silent data loss
|
|
65
|
+
|
|
66
|
+
// After — always populated, type-guaranteed, throws clearly on drift
|
|
67
|
+
const ops = await deere.safe.fieldOperations.listAllWithMeasurements(
|
|
68
|
+
orgId,
|
|
69
|
+
fieldId
|
|
70
|
+
);
|
|
71
|
+
const yield_ = ops[0].measurementTypes[0]?.averageYield?.value; // typed, narrowed
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Raw `deere.fieldOperations.listAll` still exists and still works — it's the
|
|
75
|
+
right tool for metadata-only callers (calendar UIs, operation listings that
|
|
76
|
+
don't consume measurement data). The raw return type now carries
|
|
77
|
+
`measurementTypes?: FieldOperationMeasurement[]` as an optional field, so
|
|
78
|
+
raw-path consumers can read it when they pass the embed param themselves,
|
|
79
|
+
but with a compile-time nudge that it might be absent.
|
|
80
|
+
|
|
81
|
+
### Unchanged
|
|
82
|
+
|
|
83
|
+
- `FieldOperationsApi.listAll` signature, behavior, and existing query param
|
|
84
|
+
semantics. No breaking changes.
|
|
85
|
+
- All other generated API classes.
|
|
86
|
+
- Error hierarchy, HATEOAS mode, URL resolution, retry policy.
|
|
87
|
+
- `openapi-typescript` version, generator script structure (aside from the
|
|
88
|
+
three literal-string insertions in `generateMainClass()` that wire up
|
|
89
|
+
`SafeFacades` — see `scripts/generate-sdk.ts` and the `// DO NOT REORDER`
|
|
90
|
+
comment it emits into the generated `deere.ts`).
|
|
91
|
+
|
|
92
|
+
## [2.0.0] - 2026-04-13
|
|
93
|
+
|
|
94
|
+
**Major release.** URL resolution is now fully spec-driven. This release fixes
|
|
95
|
+
a latent bug where `deere.equipment.*` and `deere.equipmentMeasurement.*`
|
|
96
|
+
calls 404'd on every environment because the client prepended a platform
|
|
97
|
+
baseUrl to specs that declared a different host. Along the way it replaces
|
|
98
|
+
the v1 friendly environment names with the raw JD subdomain names that the
|
|
99
|
+
specs actually declare, refactors every `DeereClient` HTTP method to take a
|
|
100
|
+
spec name as its first argument, and adds a Bearer-token hostname allowlist
|
|
101
|
+
to `fetchUrl` so tokens can't leak to third-party URLs.
|
|
102
|
+
|
|
103
|
+
### Breaking changes
|
|
104
|
+
|
|
105
|
+
#### 1. Environment names changed
|
|
106
|
+
|
|
107
|
+
v2 uses the raw subdomain names that JD's specs declare in their
|
|
108
|
+
`servers.variables.environment.enum` blocks. Constructor throws immediately
|
|
109
|
+
on v1 names with a migration hint pointing at the v2 replacement.
|
|
110
|
+
|
|
111
|
+
| v1.x | v2.0 |
|
|
112
|
+
|---------------|---------------|
|
|
113
|
+
| `production` | `api` |
|
|
114
|
+
| `sandbox` | `sandboxapi` |
|
|
115
|
+
| `partner` | `partnerapi` |
|
|
116
|
+
| `cert` | `apicert` |
|
|
117
|
+
| `qa` | `apiqa.tal` |
|
|
118
|
+
|
|
119
|
+
Four new environments are also exposed: `partnerapicert`, `partnerapiqa`,
|
|
120
|
+
`sandboxapiqa`, `apidev.tal`. These come directly from templated specs'
|
|
121
|
+
declared enums and will auto-update as JD adds regions.
|
|
122
|
+
|
|
123
|
+
#### 2. `DeereClient` method signatures now require a spec name
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
// v1
|
|
127
|
+
await client.get('/organizations');
|
|
128
|
+
|
|
129
|
+
// v2
|
|
130
|
+
await client.get('organizations', '/organizations');
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The first argument is a `SpecName` — the name of the OpenAPI spec that owns
|
|
134
|
+
the path. Generated API classes (`deere.organizations.list()` etc.) pass the
|
|
135
|
+
spec name internally, so code using the generated accessors needs **no
|
|
136
|
+
changes**. Only direct `client.get/post/put/patch/delete/paginate/getAll`
|
|
137
|
+
callers must migrate.
|
|
138
|
+
|
|
139
|
+
#### 3. Absolute URLs use `fetchUrl()`
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
// v1 — auto-detected from URL shape
|
|
143
|
+
await client.get('https://equipmentapi.deere.com/isg/equipment');
|
|
144
|
+
|
|
145
|
+
// v2 — explicit escape hatch
|
|
146
|
+
await client.fetchUrl('GET', 'https://equipmentapi.deere.com/isg/equipment');
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`fetchUrl` is the one entry point for absolute-URL requests. It attaches the
|
|
150
|
+
Bearer token ONLY to `*.deere.com` hosts; third-party URLs get no
|
|
151
|
+
`Authorization` header to prevent token leakage.
|
|
152
|
+
|
|
153
|
+
#### 4. `config.baseUrl` removed
|
|
154
|
+
|
|
155
|
+
Per-client base URL no longer exists; each spec declares its own. For
|
|
156
|
+
mocking in tests, inject a custom `fetch` implementation instead.
|
|
157
|
+
|
|
158
|
+
#### 5. `DeereClient.warmLinkCache` now takes a spec name
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
// v1
|
|
162
|
+
await client.warmLinkCache(['/organizations']);
|
|
163
|
+
|
|
164
|
+
// v2
|
|
165
|
+
await client.warmLinkCache('organizations', ['/organizations']);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### 6. Default environment changed from `'sandbox'` to `'sandboxapi'`
|
|
169
|
+
|
|
170
|
+
Behaviorally identical (both pointed at the sandbox host) — just the string
|
|
171
|
+
value changed to match the v2 naming.
|
|
172
|
+
|
|
173
|
+
### Fixed
|
|
174
|
+
|
|
175
|
+
- **`EquipmentApi` and `EquipmentMeasurementApi` now route correctly.** Every
|
|
176
|
+
call in v1 404'd because the client prepended the platform baseUrl
|
|
177
|
+
(`https://api.deere.com/platform`) to specs whose actual host is
|
|
178
|
+
`https://equipmentapi.deere.com/isg`. v2 reads each spec's `servers` block
|
|
179
|
+
at build time via `scripts/generate-api-servers.ts` and routes requests
|
|
180
|
+
to the right host per-spec, per-environment.
|
|
181
|
+
- **Trust-boundary safety for equipment-measurement.** `equipment-measurement.yaml`
|
|
182
|
+
declares three static hosts (`-qual`, `-cert`, bare prod). v1 silently
|
|
183
|
+
routed every environment to whatever host the client's scalar `baseUrl`
|
|
184
|
+
pointed at, so sandbox users could nuke prod data. v2 maps each
|
|
185
|
+
environment to a tier via JD's own `x-deere-proxy-info` metadata and
|
|
186
|
+
throws `UnsupportedEnvironmentError` for environments without a matching
|
|
187
|
+
tier (`sandboxapi` and `apidev.tal`) before any HTTP call.
|
|
188
|
+
- **`fetchUrl` Bearer token hostname allowlist.** v1's
|
|
189
|
+
`client.get(absoluteUrl)` attached the Bearer token to any URL, risking
|
|
190
|
+
leakage via HATEOAS nextPage links or paste-and-fetch bugs. v2's `fetchUrl`
|
|
191
|
+
only attaches the token to `*.deere.com` hosts.
|
|
192
|
+
- **`ENVIRONMENT_URLS` duplication eliminated.** The URL table used to live
|
|
193
|
+
in both `src/client.ts` and `scripts/generate-sdk.ts`. v2 has one source
|
|
194
|
+
of truth: the generated `src/api-servers.generated.ts`.
|
|
195
|
+
- **Platform-disguised specs normalized at build time.** Six specs
|
|
196
|
+
(`files.yaml`, `flags.yaml`, `organizations.yaml`, `machine-alerts.yaml`,
|
|
197
|
+
`machine-locations.yaml`, `partnerships.yaml`) hardcoded platform URLs
|
|
198
|
+
without using the `{environment}` template. `scripts/fix-specs.ts` now
|
|
199
|
+
rewrites them to the templated form with the global env enum union, so
|
|
200
|
+
sandbox users don't regress.
|
|
201
|
+
- **HATEOAS cross-spec parent resolution.** `HATEOAS_MAP` entries now record
|
|
202
|
+
`parentSpec` — which spec owns the parent resource — so a child in
|
|
203
|
+
`equipment.yaml` whose parent `/organizations/{orgId}` lives in
|
|
204
|
+
`organizations.yaml` fetches the parent via the platform host, not the
|
|
205
|
+
equipment host.
|
|
206
|
+
|
|
207
|
+
### Added
|
|
208
|
+
|
|
209
|
+
- `SpecName` type exported from `deere-sdk` — the literal union of all 28
|
|
210
|
+
spec names. Useful for generic wrappers over the SDK.
|
|
211
|
+
- `NoServerConfigError` and `UnsupportedEnvironmentError` classes — both
|
|
212
|
+
extend `DeereError`. Thrown from the runtime URL resolver before any HTTP
|
|
213
|
+
call when a spec is unavailable or an env isn't supported for a spec.
|
|
214
|
+
- `client.fetchUrl(method, url, body?, options?)` — public escape hatch for
|
|
215
|
+
absolute-URL requests.
|
|
216
|
+
- `scripts/generate-api-servers.ts` build step that reads all
|
|
217
|
+
`specs/fixed/*.yaml` and emits `src/api-servers.generated.ts` as the
|
|
218
|
+
single source of truth for URL resolution. Runs as part of `pnpm generate`.
|
|
219
|
+
|
|
220
|
+
### Internal
|
|
221
|
+
|
|
222
|
+
- Error hierarchy (`DeereError`, `RateLimitError`, `AuthError`, `HateoasError`)
|
|
223
|
+
moved from `src/client.ts` to new `src/errors.ts` to avoid a circular
|
|
224
|
+
import with the environment resolver. `src/client.ts` re-exports them for
|
|
225
|
+
backward compatibility.
|
|
226
|
+
- `yamlFiles.sort()` added to both `fix-specs.ts` and `generate-sdk.ts` main
|
|
227
|
+
loops for deterministic generator output across CI runners.
|
|
228
|
+
- Removed orphan `src/api/field-operations.ts` (dead code, never referenced
|
|
229
|
+
from `src/api/index.ts`).
|
|
230
|
+
|
|
8
231
|
## [1.0.10] - 2026-03-26
|
|
9
232
|
|
|
10
233
|
### Added
|
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/images/hero.png" alt="deere-sdk">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
<h1 align="center">deere-sdk</h1>
|
|
2
6
|
|
|
3
7
|
<p align="center">
|
|
@@ -59,7 +63,7 @@ import {Deere} from 'deere-sdk';
|
|
|
59
63
|
|
|
60
64
|
const deere = new Deere({
|
|
61
65
|
accessToken: 'your-oauth-access-token',
|
|
62
|
-
environment: '
|
|
66
|
+
environment: 'sandboxapi', // or 'api' for production
|
|
63
67
|
});
|
|
64
68
|
|
|
65
69
|
// List all organizations
|
|
@@ -98,13 +102,48 @@ This SDK requires an OAuth 2.0 access token from John Deere:
|
|
|
98
102
|
<details>
|
|
99
103
|
<summary><strong>Environments</strong></summary>
|
|
100
104
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
105
|
+
v2.0.0 uses raw John Deere subdomain names as environment values. Pass the subdomain (without `.deere.com`) as `environment`. Default: `sandboxapi`.
|
|
106
|
+
|
|
107
|
+
| Environment | URL | Use Case |
|
|
108
|
+
|------------------|----------------------------|----------------------------------|
|
|
109
|
+
| `api` | api.deere.com | Live production |
|
|
110
|
+
| `sandboxapi` | sandboxapi.deere.com | Development (default) |
|
|
111
|
+
| `partnerapi` | partnerapi.deere.com | Partner production |
|
|
112
|
+
| `apicert` | apicert.deere.com | Production certification |
|
|
113
|
+
| `partnerapicert` | partnerapicert.deere.com | Partner certification |
|
|
114
|
+
| `apiqa.tal` | apiqa.tal.deere.com | QA tier |
|
|
115
|
+
| `partnerapiqa` | partnerapiqa.deere.com | Partner QA |
|
|
116
|
+
| `sandboxapiqa` | sandboxapiqa.deere.com | Sandbox QA |
|
|
117
|
+
| `apidev.tal` | apidev.tal.deere.com | Internal dev tier (rarely used) |
|
|
118
|
+
|
|
119
|
+
Not every spec has servers for every environment. If you pick an environment a given spec doesn't ship (e.g., a production-only spec on `sandboxapi`), the constructor throws `UnsupportedEnvironmentError` with the valid values for that spec.
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary><strong>Migrating from v1</strong></summary>
|
|
125
|
+
|
|
126
|
+
v1 accepted friendly environment names. v2.0.0 replaces them with the raw John Deere subdomain names so URL routing comes directly from each spec's OpenAPI `servers` block — no more hardcoded hostname maps.
|
|
127
|
+
|
|
128
|
+
Passing a v1 name to the v2 constructor throws immediately with a migration hint:
|
|
129
|
+
|
|
130
|
+
| v1 (pre-2.0.0) | v2.0.0+ |
|
|
131
|
+
|----------------|----------------|
|
|
132
|
+
| `production` | `api` |
|
|
133
|
+
| `sandbox` | `sandboxapi` |
|
|
134
|
+
| `partner` | `partnerapi` |
|
|
135
|
+
| `cert` | `apicert` |
|
|
136
|
+
| `qa` | `apiqa.tal` |
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// v1
|
|
140
|
+
const deere = new Deere({ accessToken, environment: 'sandbox' });
|
|
141
|
+
|
|
142
|
+
// v2.0.0
|
|
143
|
+
const deere = new Deere({ accessToken, environment: 'sandboxapi' });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The SDK now uses separate host subdomains per spec family (e.g., `equipmentapi.deere.com` for machine telemetry, `api.deere.com` for organizations) on the production tier. v1 silently routed everything through `api.deere.com`, which worked for most flows but mis-routed some machine-data endpoints. v2 routes each call to the exact host the spec declares.
|
|
108
147
|
|
|
109
148
|
</details>
|
|
110
149
|
|
|
@@ -290,14 +329,26 @@ const models = await deere.equipment.listEquipmentmodels({equipmentModelName: '9
|
|
|
290
329
|
<summary><strong>Field Operations</strong></summary>
|
|
291
330
|
|
|
292
331
|
```typescript
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
//
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
332
|
+
// Prefer the safe facade when you need measurement data (yield, area,
|
|
333
|
+
// moisture, application rate, seeding population). It forces
|
|
334
|
+
// ?embed=measurementTypes on the request and guarantees the returned
|
|
335
|
+
// operations carry a measurementTypes array, throwing a clear error if
|
|
336
|
+
// JD's wire format ever drifts from the documented contract.
|
|
337
|
+
const ops = await deere.safe.fieldOperations.listAllWithMeasurements(
|
|
338
|
+
'org-id',
|
|
339
|
+
'field-id'
|
|
340
|
+
);
|
|
341
|
+
const yieldValue = ops[0].measurementTypes[0]?.averageYield?.value;
|
|
342
|
+
|
|
343
|
+
// Filter by type and season — filters forward through to the safe wrapper too.
|
|
344
|
+
const harvests = await deere.safe.fieldOperations.listAllWithMeasurements(
|
|
345
|
+
'org-id',
|
|
346
|
+
'field-id',
|
|
347
|
+
{ cropSeason: '2026', fieldOperationType: 'harvest' }
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
// Raw API (no forcing) — use when you only need metadata, not measurements.
|
|
351
|
+
const metaOnly = await deere.fieldOperations.list('org-id', 'field-id');
|
|
301
352
|
|
|
302
353
|
// Get operation details
|
|
303
354
|
const op = await deere.fieldOperations.get('operation-id');
|
|
@@ -309,6 +360,17 @@ const shapefile = await deere.fieldOperations.getFieldops('operation-id', {
|
|
|
309
360
|
});
|
|
310
361
|
```
|
|
311
362
|
|
|
363
|
+
**Why `deere.safe.*`?** John Deere's API silently omits the `measurementTypes`
|
|
364
|
+
array on `fieldOperations.listAll` responses unless the request passes
|
|
365
|
+
`?embed=measurementTypes`, and their OpenAPI spec doesn't document that
|
|
366
|
+
invariant. Consumers that forget the embed param get objects with zero values
|
|
367
|
+
for yield, area, moisture, and rate — and can't tell "missing data" from "real
|
|
368
|
+
zero." The safe facade makes that footgun syntactically impossible: you can't
|
|
369
|
+
call `listAllWithMeasurements` without the embed param because the wrapper
|
|
370
|
+
adds it for you, and the returned type guarantees `measurementTypes` is
|
|
371
|
+
present. See `src/safe/` and `scripts/embed-contracts.yaml` for the spec-patch
|
|
372
|
+
machinery that makes the narrowed type honest at the type level.
|
|
373
|
+
|
|
312
374
|
</details>
|
|
313
375
|
|
|
314
376
|
<details>
|
|
@@ -452,7 +514,7 @@ import {DeereClient} from 'deere-sdk';
|
|
|
452
514
|
|
|
453
515
|
const client = new DeereClient({
|
|
454
516
|
accessToken: 'your-token',
|
|
455
|
-
environment: '
|
|
517
|
+
environment: 'sandboxapi',
|
|
456
518
|
timeout: 30000, // Request timeout in ms (default: 30000)
|
|
457
519
|
maxRetries: 3, // Retry attempts (default: 3, set to 0 to disable)
|
|
458
520
|
});
|
|
@@ -470,6 +532,25 @@ for await (const items of client.paginate('/large/collection')) {
|
|
|
470
532
|
}
|
|
471
533
|
```
|
|
472
534
|
|
|
535
|
+
### fetchUrl — Bearer token hostname guard
|
|
536
|
+
|
|
537
|
+
`DeereClient` exposes `fetchUrl(method, url, body?, options?)` and `followLink(url)` for calling absolute URLs (e.g., HAL `next` page links, externally-discovered URLs). Both **suppress the OAuth Bearer token** on any URL whose hostname is not a trusted `*.deere.com` origin. This prevents accidental token leakage if a HATEOAS response, user-supplied URL, or link cache ever includes a third-party host.
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
// Bearer token attached (trusted host)
|
|
541
|
+
await client.fetchUrl('GET', 'https://api.deere.com/platform/organizations');
|
|
542
|
+
|
|
543
|
+
// Bearer token SUPPRESSED (untrusted host) — request still goes out, just without Authorization
|
|
544
|
+
await client.fetchUrl('GET', 'https://example.com/some-webhook');
|
|
545
|
+
|
|
546
|
+
// You can opt in explicitly by passing your own Authorization header:
|
|
547
|
+
await client.fetchUrl('GET', 'https://example.com/api', undefined, {
|
|
548
|
+
headers: { Authorization: 'Bearer some-other-token' },
|
|
549
|
+
});
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
Enable `hateoasDebug: true` to see a `console.warn` whenever a token is suppressed, so you can audit where your HATEOAS graph is pointing.
|
|
553
|
+
|
|
473
554
|
---
|
|
474
555
|
|
|
475
556
|
## HATEOAS Mode
|
|
@@ -479,7 +560,7 @@ John Deere requires applications to demonstrate [HATEOAS](https://en.wikipedia.o
|
|
|
479
560
|
```typescript
|
|
480
561
|
const deere = new Deere({
|
|
481
562
|
accessToken: 'your-token',
|
|
482
|
-
environment: '
|
|
563
|
+
environment: 'sandboxapi',
|
|
483
564
|
hateoas: true, // Enable HATEOAS link traversal
|
|
484
565
|
hateoasDebug: true, // Optional: log resolution details
|
|
485
566
|
});
|
|
@@ -499,7 +580,7 @@ import {Deere} from 'deere-sdk';
|
|
|
499
580
|
// 1. Create client with HATEOAS enabled
|
|
500
581
|
const deere = new Deere({
|
|
501
582
|
accessToken: 'your-oauth-token',
|
|
502
|
-
environment: '
|
|
583
|
+
environment: 'sandboxapi',
|
|
503
584
|
hateoas: true,
|
|
504
585
|
hateoasDebug: true, // See link resolution in console
|
|
505
586
|
});
|
|
@@ -573,8 +654,23 @@ const deere = new Deere({
|
|
|
573
654
|
|
|
574
655
|
### Error Types
|
|
575
656
|
|
|
657
|
+
| Error | When it's thrown | Retried? |
|
|
658
|
+
|-------------------------------|-------------------------------------------------------------------|----------|
|
|
659
|
+
| `DeereError` | Base class. Any HTTP error from John Deere (400/404/422/5xx). | Only 5xx |
|
|
660
|
+
| `RateLimitError` | HTTP 429. Only reaches your catch after all retries are exhausted. | Yes |
|
|
661
|
+
| `AuthError` | HTTP 401/403. Refresh your OAuth token. | No |
|
|
662
|
+
| `HateoasError` | HATEOAS link resolution fails (parent fetch errored or no matching link). | No |
|
|
663
|
+
| `UnsupportedEnvironmentError` | Constructor threw because `environment` doesn't match the spec's `servers` block. | N/A (thrown at construction) |
|
|
664
|
+
| `NoServerConfigError` | Constructor threw because a spec has no `servers` block at all. | N/A |
|
|
665
|
+
|
|
576
666
|
```typescript
|
|
577
|
-
import {
|
|
667
|
+
import {
|
|
668
|
+
DeereError,
|
|
669
|
+
RateLimitError,
|
|
670
|
+
AuthError,
|
|
671
|
+
HateoasError,
|
|
672
|
+
UnsupportedEnvironmentError,
|
|
673
|
+
} from 'deere-sdk';
|
|
578
674
|
|
|
579
675
|
try {
|
|
580
676
|
const fields = await deere.fields.listAll('org-id');
|
|
@@ -585,6 +681,12 @@ try {
|
|
|
585
681
|
} else if (error instanceof AuthError) {
|
|
586
682
|
// Never retried - refresh your token
|
|
587
683
|
console.log('Token expired - refresh required');
|
|
684
|
+
} else if (error instanceof HateoasError) {
|
|
685
|
+
// HATEOAS link resolution failed (only when hateoas: true)
|
|
686
|
+
console.log(`Link resolution failed on ${error.path}: ${error.message}`);
|
|
687
|
+
} else if (error instanceof UnsupportedEnvironmentError) {
|
|
688
|
+
// Spec doesn't ship this environment — try another from its valid list
|
|
689
|
+
console.log(error.message);
|
|
588
690
|
} else if (error instanceof DeereError) {
|
|
589
691
|
console.log(`API error: ${error.status} ${error.message}`);
|
|
590
692
|
}
|
|
@@ -691,6 +793,14 @@ git push --follow-tags
|
|
|
691
793
|
|
|
692
794
|
CI sees the tag → creates GitHub Release → publishes to npm.
|
|
693
795
|
|
|
796
|
+
**Gotcha:** GitHub sometimes does not fire the `push` event for a tag pushed via `git push --follow-tags`, so `release.yml` never auto-triggers. If you don't see a "Create Release" run within a minute of pushing the tag, dispatch it manually:
|
|
797
|
+
|
|
798
|
+
```bash
|
|
799
|
+
gh workflow run release.yml --ref vX.Y.Z
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
`release.yml` also accepts `workflow_dispatch`, so this produces an identical run against the tag's commit.
|
|
803
|
+
|
|
694
804
|
---
|
|
695
805
|
|
|
696
806
|
## Disclaimer
|
package/dist/api/aemp.d.ts
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
import type { DeereClient, RequestOptions } from '../client.js';
|
|
8
8
|
export declare class AempApi {
|
|
9
9
|
private readonly client;
|
|
10
|
+
/** The OpenAPI spec this class is generated from. Used by DeereClient to
|
|
11
|
+
* resolve request URLs via API_SERVERS. Typed against SpecName so typos
|
|
12
|
+
* are caught at compile time. */
|
|
13
|
+
private readonly spec;
|
|
10
14
|
constructor(client: DeereClient);
|
|
11
15
|
/**
|
|
12
16
|
* Get Fleet List
|
package/dist/api/aemp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aemp.d.ts","sourceRoot":"","sources":["../../src/api/aemp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"aemp.d.ts","sourceRoot":"","sources":["../../src/api/aemp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhE,qBAAa,OAAO;IAMN,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC;;qCAEiC;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;gBAEZ,MAAM,EAAE,WAAW;IAEhD;;;;;;;;;;OAUG;IACG,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;CAI1E;AAGD,YAAY,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/api/aemp.js
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export class AempApi {
|
|
8
8
|
client;
|
|
9
|
+
/** The OpenAPI spec this class is generated from. Used by DeereClient to
|
|
10
|
+
* resolve request URLs via API_SERVERS. Typed against SpecName so typos
|
|
11
|
+
* are caught at compile time. */
|
|
12
|
+
spec = 'aemp';
|
|
9
13
|
constructor(client) {
|
|
10
14
|
this.client = client;
|
|
11
15
|
}
|
|
@@ -22,7 +26,7 @@ export class AempApi {
|
|
|
22
26
|
*/
|
|
23
27
|
async get(pageNumber, options) {
|
|
24
28
|
const path = `/Fleet/${pageNumber}`;
|
|
25
|
-
return this.client.get(path, options);
|
|
29
|
+
return this.client.get(this.spec, path, options);
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
//# sourceMappingURL=aemp.js.map
|
package/dist/api/aemp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aemp.js","sourceRoot":"","sources":["../../src/api/aemp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"aemp.js","sourceRoot":"","sources":["../../src/api/aemp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,OAAO,OAAO;IAMW;IAL7B;;qCAEiC;IAChB,IAAI,GAAa,MAAM,CAAC;IAEzC,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;;;;OAUG;IACH,KAAK,CAAC,GAAG,CAAC,UAAkB,EAAE,OAAwB;QACpD,MAAM,IAAI,GAAG,UAAU,UAAU,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/api/assets.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ import type { DeereClient, PaginatedResponse, RequestOptions } from '../client.j
|
|
|
8
8
|
import type { components } from '../types/generated/assets.js';
|
|
9
9
|
export declare class AssetsApi {
|
|
10
10
|
private readonly client;
|
|
11
|
+
/** The OpenAPI spec this class is generated from. Used by DeereClient to
|
|
12
|
+
* resolve request URLs via API_SERVERS. Typed against SpecName so typos
|
|
13
|
+
* are caught at compile time. */
|
|
14
|
+
private readonly spec;
|
|
11
15
|
constructor(client: DeereClient);
|
|
12
16
|
/**
|
|
13
17
|
* Get all assets
|
package/dist/api/assets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/api/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/api/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,qBAAa,SAA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AAO,CAAC,IAAI,CAAC;IAKtE;;;;;;OAMG;IACG,aAAa,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EACnF,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;IAepE;;;;;;;;OAQG;IACG,eAAe,CACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,EAC/C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC;IAKhB;;;;OAIG;IACG,eAAe,CACnB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;CAQxE;AAGD,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/api/assets.js
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export class AssetsApi {
|
|
8
8
|
client;
|
|
9
|
+
/** The OpenAPI spec this class is generated from. Used by DeereClient to
|
|
10
|
+
* resolve request URLs via API_SERVERS. Typed against SpecName so typos
|
|
11
|
+
* are caught at compile time. */
|
|
12
|
+
spec = 'assets';
|
|
9
13
|
constructor(client) {
|
|
10
14
|
this.client = client;
|
|
11
15
|
}
|
|
@@ -20,7 +24,7 @@ export class AssetsApi {
|
|
|
20
24
|
query.set('embed', String(params.embed));
|
|
21
25
|
const queryString = query.toString();
|
|
22
26
|
const path = `/organizations/${orgId}/assets${queryString ? `?${queryString}` : ''}`;
|
|
23
|
-
return this.client.get(path, options);
|
|
27
|
+
return this.client.get(this.spec, path, options);
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* Get all items (follows pagination automatically)
|
|
@@ -32,7 +36,7 @@ export class AssetsApi {
|
|
|
32
36
|
query.set('embed', String(params.embed));
|
|
33
37
|
const queryString = query.toString();
|
|
34
38
|
const path = `/organizations/${orgId}/assets${queryString ? `?${queryString}` : ''}`;
|
|
35
|
-
return this.client.getAll(path, options);
|
|
39
|
+
return this.client.getAll(this.spec, path, options);
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Create a new asset
|
|
@@ -41,7 +45,7 @@ export class AssetsApi {
|
|
|
41
45
|
*/
|
|
42
46
|
async create(orgId, data, options) {
|
|
43
47
|
const path = `/organizations/${orgId}/assets`;
|
|
44
|
-
await this.client.post(path, data, options);
|
|
48
|
+
await this.client.post(this.spec, path, data, options);
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Get a specific asset
|
|
@@ -54,7 +58,7 @@ export class AssetsApi {
|
|
|
54
58
|
query.set('embed', String(params.embed));
|
|
55
59
|
const queryString = query.toString();
|
|
56
60
|
const path = `/assets/${assetId}${queryString ? `?${queryString}` : ''}`;
|
|
57
|
-
return this.client.get(path, options);
|
|
61
|
+
return this.client.get(this.spec, path, options);
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* Update an asset
|
|
@@ -63,7 +67,7 @@ export class AssetsApi {
|
|
|
63
67
|
*/
|
|
64
68
|
async update(assetId, data, options) {
|
|
65
69
|
const path = `/assets/${assetId}`;
|
|
66
|
-
await this.client.put(path, data, options);
|
|
70
|
+
await this.client.put(this.spec, path, data, options);
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
73
|
* Delete an Asset
|
|
@@ -72,7 +76,7 @@ export class AssetsApi {
|
|
|
72
76
|
*/
|
|
73
77
|
async delete(assetId, options) {
|
|
74
78
|
const path = `/assets/${assetId}`;
|
|
75
|
-
await this.client.delete(path, options);
|
|
79
|
+
await this.client.delete(this.spec, path, options);
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Get all locations for an asset
|
|
@@ -93,7 +97,7 @@ export class AssetsApi {
|
|
|
93
97
|
query.set('pageKey', String(params.pageKey));
|
|
94
98
|
const queryString = query.toString();
|
|
95
99
|
const path = `/assets/${assetId}/locations${queryString ? `?${queryString}` : ''}`;
|
|
96
|
-
return this.client.get(path, options);
|
|
100
|
+
return this.client.get(this.spec, path, options);
|
|
97
101
|
}
|
|
98
102
|
/**
|
|
99
103
|
* Create new asset location
|
|
@@ -106,7 +110,7 @@ export class AssetsApi {
|
|
|
106
110
|
*/
|
|
107
111
|
async createLocations(assetId, data, options) {
|
|
108
112
|
const path = `/assets/${assetId}/locations`;
|
|
109
|
-
await this.client.post(path, data, options);
|
|
113
|
+
await this.client.post(this.spec, path, data, options);
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* Get Asset Catalog List
|
|
@@ -115,7 +119,7 @@ export class AssetsApi {
|
|
|
115
119
|
*/
|
|
116
120
|
async getAssetcatalog(options) {
|
|
117
121
|
const path = `/assetCatalog`;
|
|
118
|
-
return this.client.get(path, options);
|
|
122
|
+
return this.client.get(this.spec, path, options);
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
//# sourceMappingURL=assets.js.map
|
package/dist/api/assets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/api/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/api/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,OAAO,SAAS;IAMS;IAL7B;;qCAEiC;IAChB,IAAI,GAAa,QAAQ,CAAC;IAE3C,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;OAIG;IACH,KAAK,CA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,IAAI,EACJ,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
|
package/dist/api/boundaries.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ import type { DeereClient, PaginatedResponse, RequestOptions } from '../client.j
|
|
|
8
8
|
import type { components } from '../types/generated/boundaries.js';
|
|
9
9
|
export declare class BoundariesApi {
|
|
10
10
|
private readonly client;
|
|
11
|
+
/** The OpenAPI spec this class is generated from. Used by DeereClient to
|
|
12
|
+
* resolve request URLs via API_SERVERS. Typed against SpecName so typos
|
|
13
|
+
* are caught at compile time. */
|
|
14
|
+
private readonly spec;
|
|
11
15
|
constructor(client: DeereClient);
|
|
12
16
|
/**
|
|
13
17
|
* View Boundaries in an Org
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../../src/api/boundaries.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../../src/api/boundaries.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,qBAAa,aAAa;IAMZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC;;qCAEiC;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;gBAElB,MAAM,EAAE,WAAW;IAEhD;;;;;;OAMG;IACG,IAAI,CACR,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,EAClD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;IAYrE;;;OAGG;IACG,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