@keboola/api-fixtures 22.0.0 → 27.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.
- package/AGENTS.md +13 -7
- package/CHANGELOG.md +287 -0
- package/dist/index.cjs +954 -374
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1498 -746
- package/dist/index.d.ts +1498 -746
- package/dist/index.js +939 -372
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/AGENTS.md
CHANGED
|
@@ -11,6 +11,10 @@ becomes a TypeScript compile error.
|
|
|
11
11
|
|
|
12
12
|
Current slices:
|
|
13
13
|
|
|
14
|
+
- `storage.bootstrap` — `getStackInfo()`, `verifyStorageToken()`, `getDevBranches()`, the three
|
|
15
|
+
responses a client's ready gate needs before it is usable. Reach for it in any test that builds a
|
|
16
|
+
real client over MSW. `getStackInfo()` announces every service by default, which is what keeps a
|
|
17
|
+
test's service clients from being dummies that throw `ServiceUnavailableError`.
|
|
14
18
|
- `storage.tables` — `getTable()`, `listTables()`, `tableFixtures`
|
|
15
19
|
- `apps.apps` / `apps.deployments` / `apps.runs` — the sandboxes-service `/v2` App Deployments
|
|
16
20
|
surface. The three compose into one coherent app (an app's `production` names a deployment in
|
|
@@ -19,11 +23,11 @@ Current slices:
|
|
|
19
23
|
|
|
20
24
|
## When to use fixtures vs MSW vs real API
|
|
21
25
|
|
|
22
|
-
| Need
|
|
23
|
-
|
|
|
24
|
-
| Unit / component tests, pure rendering
|
|
25
|
-
|
|
|
26
|
-
| Full end-to-end or contract validation
|
|
26
|
+
| Need | Reach for |
|
|
27
|
+
| -------------------------------------------- | ---------------------------------------------- |
|
|
28
|
+
| Unit / component tests, pure rendering | **This package** — zero network, deterministic |
|
|
29
|
+
| Anything exercising a client or a query hook | **MSW handlers, bodies from this package** |
|
|
30
|
+
| Full end-to-end or contract validation | Real API (see `@keboola/e2e-testing`) |
|
|
27
31
|
|
|
28
32
|
## Adding a new endpoint slice
|
|
29
33
|
|
|
@@ -34,9 +38,11 @@ Current slices:
|
|
|
34
38
|
yourself; `unknown` is acceptable only when it propagates from the contract type (e.g.
|
|
35
39
|
`TableDetail['attributes']` is `unknown[]`). Prefer `T['prop']` aliases or contextual
|
|
36
40
|
typing via `satisfies T` over re-asserting the upstream type.
|
|
37
|
-
4.
|
|
41
|
+
4. When the slice has distinct variants worth naming (a fresh vs. a large table, a failed vs. a
|
|
42
|
+
running job), export them as a `<resource>Fixtures` object using
|
|
38
43
|
`satisfies Record<'<key1>' | '<key2>' | …, T>` so missing or renamed keys become a
|
|
39
|
-
compile-time error.
|
|
44
|
+
compile-time error. A slice whose factories each return one canonical shape needs no such
|
|
45
|
+
object — it would only alias their defaults.
|
|
40
46
|
5. Re-export everything from `src/index.ts`.
|
|
41
47
|
6. Add a vitest smoke test in `<resource>.test.ts` that verifies shape + assigns to the
|
|
42
48
|
typed variable (compile-time contract check).
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# @keboola/api-fixtures
|
|
2
|
+
|
|
3
|
+
## 27.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add a `storage.bootstrap` fixture slice — the three responses a client's ready gate needs before
|
|
8
|
+
it is usable (`GET /v2/storage`, `/v2/storage/tokens/verify`, `/v2/storage/dev-branches`).
|
|
9
|
+
|
|
10
|
+
`getStackInfo()`, `verifyStorageToken()` and `getDevBranches()` are typed by
|
|
11
|
+
`@keboola/api-client/storage/types`, so a field the backend adds arrives with `pnpm gen:types`
|
|
12
|
+
rather than being transcribed into every MSW test that bootstraps a client. `getStackInfo()`
|
|
13
|
+
announces every service by default, which is what keeps a test's queue / data-science / vault
|
|
14
|
+
client from being a dummy that throws `ServiceUnavailableError`; pass `services` to narrow it.
|
|
15
|
+
|
|
16
|
+
`@keboola/api-client` gains a runtime `ServiceId` const in `@keboola/api-client/constants`, with
|
|
17
|
+
the `ServiceId` type now derived from it. Announcing every service is exhaustive by construction:
|
|
18
|
+
a service added to the client flows into the fixture without an edit.
|
|
19
|
+
|
|
20
|
+
`@keboola/api-client-react`'s test fixtures now come from the slice; its published output is unchanged.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- The fixtures-vs-MSW decision table routed everything but "integration tests" away from MSW, which
|
|
25
|
+
read as "unit and component tests never intercept requests". A test whose subject is a client or a
|
|
26
|
+
query hook has to, or it asserts its own mock — so that row now names clients and query hooks, and
|
|
27
|
+
says bodies come from this package where a slice exists and `satisfies` the generated type where one
|
|
28
|
+
does not.
|
|
29
|
+
|
|
30
|
+
`AGENTS.md` ships in the tarball, so this is a republish rather than a repo-only doc edit.
|
|
31
|
+
|
|
32
|
+
- Updated dependencies:
|
|
33
|
+
- @keboola/api-client@32.0.0
|
|
34
|
+
|
|
35
|
+
## 26.0.0
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies:
|
|
40
|
+
- @keboola/api-client@31.0.0
|
|
41
|
+
|
|
42
|
+
## 25.0.0
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- The published tarball now carries a `CHANGELOG.md`, so a consumer can read what changed in a release — breaking changes included — without leaving their `node_modules`.
|
|
47
|
+
|
|
48
|
+
It could not simply be added to `files`. This repo is private, so every reference `@changesets/changelog-github` emits is a dead link for anyone reading from npm: PR links, commit SHAs, author handles, and the Linear and cross-repo links that changeset prose carries. Across the publishable packages that came to 490 PR links, 863 commit links, 490 author credits and 102 dependency-bump blocks.
|
|
49
|
+
|
|
50
|
+
The published file is generated, not maintained. `scripts/public-changelog.mjs` removes those links ahead of the publish and leaves the prose. An identifier the author typed themselves stays as text — `UT-4009`, `connection#8040` — because it is part of the sentence and, without its URL, resolves to nothing outside Keboola. The repo-side `CHANGELOG.md` keeps every link, because that is how a release gets traced internally. It is rewritten only for the moment the tarballs are packed, then restored — which the release also depends on: `changesets/action` reads each changelog back off disk _after_ the publish command returns, to build that version's GitHub Release body, so without the restore the internal releases would carry the public text. A reference the rules do not cover fails the publish rather than shipping.
|
|
51
|
+
|
|
52
|
+
One incidental fix: a hex colour written as `#222529` in changeset prose had been autolinked into a link to issue 222529. Unwrapping restores the colour, so the published notes read as the author wrote them.
|
|
53
|
+
|
|
54
|
+
- Updated dependencies:
|
|
55
|
+
- @keboola/api-client@30.0.0
|
|
56
|
+
|
|
57
|
+
## 24.0.1
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Build with tsdown (rolldown) instead of the now-unmaintained tsup. Output layout, exports map, and shipped declarations are unchanged (attw-verified per package); chunk byte sizes shift slightly with rolldown's codegen, and `@keboola/design`'s size budgets are trued up to the new measurements (largest delta: the main bundle cap moves 320→330 KB). `@keboola/design` builds with `platform: 'browser'`, so bundled CJS deps (react-dropzone, react-day-picker) resolve to their ESM builds instead of a UMD `main` that would drag a Node-only runtime require into browser loads.
|
|
62
|
+
|
|
63
|
+
## 24.0.0
|
|
64
|
+
|
|
65
|
+
### Minor Changes
|
|
66
|
+
|
|
67
|
+
- New **Developer Portal** support for `apps-api.keboola.com` — the backend behind `components.keboola.com`. Paths and types are generated from the published spec (`https://apps-api.keboola.com/docs/openapi.yaml`, now registered in `redocly.yaml`), so `pnpm gen:types` refreshes them like every other client.
|
|
68
|
+
|
|
69
|
+
Two layers, matching the rest of the package:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
// The client plus the session that keeps it authenticated. Start here.
|
|
73
|
+
import { createDeveloperPortalSdk } from "@keboola/api-client/sdk/developerPortal";
|
|
74
|
+
// The pure client: one method per endpoint, no state. Enough for every `security: []` operation.
|
|
75
|
+
import { createDeveloperPortalClient } from "@keboola/api-client/developerPortal";
|
|
76
|
+
import type { App, Vendor } from "@keboola/api-client/developerPortal/types";
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Covers all 58 spec operations across four namespaces — `auth`, `vendors`, `apps`, `admin` — flat inside each, named `get*` / `create*` / `update*` / `delete*` with the noun on the method (`apps.getPublishedApps`, `admin.approveVendor`), matching `management` and `storage`. `createDeveloperPortalSdk` returns `{ api, session }` the way `createKeboola` does, and for the same reason — the credential is stateful. It stays separate from `createKeboola` because apps-api is its own identity domain (its own Cognito pool, its own token trio), so it is absent from `createServiceClients.ts` and never appears on the `api` proxy.
|
|
80
|
+
|
|
81
|
+
Three properties worth knowing:
|
|
82
|
+
- `Authorization` carries the **raw token with no `Bearer` prefix** — the spec's security schemes are `type: apiKey`, so `createBearerAuthMiddleware` is not reusable and the SDK ships its own.
|
|
83
|
+
- **Two fetch clients.** The authenticated one stamps the id token; the other carries no auth and backs the operations the spec marks `security: []`, plus the four calls that supply their own `Authorization`: `GET /auth/token` (refresh token), `POST /auth/logout` (access token), and `POST /auth/mfa` + `POST /auth/mfa/confirm` (id token, alongside an access token in the body). Those four take the token as an argument, and the SDK binds them from the session, so `api.auth.logout()` needs nothing from the caller.
|
|
84
|
+
- **The spec is the source of truth.** `types.ts` derives every shape from the generated schema, with no hand-written overlay. Two vendor shapes fall out of that: `GET /vendors` returns `isTrusted` as the raw MySQL tinyint (`VendorListItem`), every other vendor endpoint converts it to a boolean (`Vendor`). Outgoing payloads are no longer validated at runtime — the generated request types replace the zod schemas, which is how every other client in the package works.
|
|
85
|
+
|
|
86
|
+
`@keboola/api-fixtures` gains `fixtures.developerPortal` — apps across every publishing state, vendors including a pending `_v`-prefixed one, users, service accounts, and an app change log. Each is `satisfies`-checked against the generated types, so a fixture cannot carry a field the API does not return.
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies:
|
|
91
|
+
- @keboola/api-client@29.0.0
|
|
92
|
+
|
|
93
|
+
## 23.0.0
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Updated dependencies:
|
|
98
|
+
- @keboola/api-client@28.0.0
|
|
99
|
+
|
|
100
|
+
## 22.0.0
|
|
101
|
+
|
|
102
|
+
### Minor Changes
|
|
103
|
+
|
|
104
|
+
- Add an `apps` slice covering the sandboxes-service `/v2` App Deployments surface: `getApp` / `listApps` / `appFixtures`, `getDeployment` / `listDeployments` / `deploymentFixtures`, and `getAppRun` / `listAppRuns` / `runFixtures`, also reachable as `fixtures.apps.*`.
|
|
105
|
+
|
|
106
|
+
The three sub-slices compose into one coherent app rather than standing alone: the app's `production` pointer names a deployment that `listDeployments()` returns, and every non-legacy run names a deployment that exists. `apps.test.ts` enforces that join, because a drifting id there is invisible in a component test and surfaces as an empty timeline.
|
|
107
|
+
|
|
108
|
+
The named fixtures are the states the `/v2` model makes distinguishable, several of which cannot be told apart from a single field:
|
|
109
|
+
- `appFixtures.promoting` — a blue/green promotion in flight. `state` stays `RUNNING` and the rollout is visible only as `production.desiredId !== production.actualId`, so a consumer reading `state` alone will miss it.
|
|
110
|
+
- `appFixtures.legacyV1Serving` — transcribed verbatim from canary: an app created and started through `/v1` that was serving real traffic at the moment it was read, which `/v2` reports as `NOT_DEPLOYED` with an all-null `production` because it was never adopted into the deployments model. It is the counterexample to deriving "is this app serving" from `state`.
|
|
111
|
+
- `appFixtures.sleeping` vs `appFixtures.suspended` — both stopped, but only the first wakes on the next request.
|
|
112
|
+
- `deploymentFixtures.buildFailed` vs `runFailed` — no artifact was ever produced versus an artifact that crashes on every run. Different problems with different fixes, and the first is not reachable on the platform today (every deployment is `PREBUILT`); it exists because the headline-status table in the spec treats it as a contract.
|
|
113
|
+
- `runFixtures.failed` — a classified failure with `startedAt: null`. A run can be attributed a cause on either side of its container ever executing, so `failureReason` is the field to branch on, not `startedAt`.
|
|
114
|
+
|
|
115
|
+
Every fixture is typed against `@keboola/api-client/apps/types`, and `apps.test-d.ts` pins the factories to exactly the generated types. The `/v2` spec is flagged experimental upstream, so that assertion is the alarm for a shape that moves.
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies:
|
|
120
|
+
- @keboola/api-client@27.0.0
|
|
121
|
+
|
|
122
|
+
## 21.0.0
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- These packages now ship their `AGENTS.md` usage contract to npm, so external
|
|
127
|
+
consumers (and their AI agents) can read it at
|
|
128
|
+
`node_modules/@keboola/<name>/AGENTS.md`, version-pinned to the release they
|
|
129
|
+
actually installed.
|
|
130
|
+
|
|
131
|
+
Previously only `@keboola/design` published its `AGENTS.md`; every other package
|
|
132
|
+
omitted it from `files`, so instructions that point agents at that path — such as
|
|
133
|
+
`apps/boilerplate/AGENTS.md` — silently resolved to nothing outside the monorepo.
|
|
134
|
+
No code or type changes.
|
|
135
|
+
|
|
136
|
+
- Updated dependencies:
|
|
137
|
+
- @keboola/api-client@26.0.0
|
|
138
|
+
|
|
139
|
+
## 20.0.0
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies:
|
|
144
|
+
- @keboola/api-client@25.0.0
|
|
145
|
+
|
|
146
|
+
## 19.0.0
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies:
|
|
151
|
+
- @keboola/api-client@24.0.0
|
|
152
|
+
|
|
153
|
+
## 18.0.0
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- Updated dependencies:
|
|
158
|
+
- @keboola/api-client@23.0.0
|
|
159
|
+
|
|
160
|
+
## 17.0.0
|
|
161
|
+
|
|
162
|
+
### Patch Changes
|
|
163
|
+
|
|
164
|
+
- Updated dependencies:
|
|
165
|
+
- @keboola/api-client@22.0.0
|
|
166
|
+
|
|
167
|
+
## 16.0.0
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies:
|
|
172
|
+
- @keboola/api-client@21.0.0
|
|
173
|
+
|
|
174
|
+
## 15.0.0
|
|
175
|
+
|
|
176
|
+
### Patch Changes
|
|
177
|
+
|
|
178
|
+
- Updated dependencies:
|
|
179
|
+
- @keboola/api-client@20.0.0
|
|
180
|
+
|
|
181
|
+
## 14.0.0
|
|
182
|
+
|
|
183
|
+
### Patch Changes
|
|
184
|
+
|
|
185
|
+
- Updated dependencies:
|
|
186
|
+
- @keboola/api-client@19.0.0
|
|
187
|
+
|
|
188
|
+
## 13.0.0
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- Updated dependencies:
|
|
193
|
+
- @keboola/api-client@18.0.0
|
|
194
|
+
|
|
195
|
+
## 12.0.0
|
|
196
|
+
|
|
197
|
+
### Patch Changes
|
|
198
|
+
|
|
199
|
+
- Updated dependencies:
|
|
200
|
+
- @keboola/api-client@17.0.0
|
|
201
|
+
|
|
202
|
+
## 11.0.0
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- Updated dependencies:
|
|
207
|
+
- @keboola/api-client@16.0.0
|
|
208
|
+
|
|
209
|
+
## 10.0.0
|
|
210
|
+
|
|
211
|
+
### Patch Changes
|
|
212
|
+
|
|
213
|
+
- Updated dependencies:
|
|
214
|
+
- @keboola/api-client@15.0.0
|
|
215
|
+
|
|
216
|
+
## 9.0.0
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- Updated dependencies:
|
|
221
|
+
- @keboola/api-client@14.0.0
|
|
222
|
+
|
|
223
|
+
## 8.0.0
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- Updated dependencies:
|
|
228
|
+
- @keboola/api-client@13.0.0
|
|
229
|
+
|
|
230
|
+
## 7.0.0
|
|
231
|
+
|
|
232
|
+
### Patch Changes
|
|
233
|
+
|
|
234
|
+
- Updated dependencies:
|
|
235
|
+
- @keboola/api-client@12.0.0
|
|
236
|
+
|
|
237
|
+
## 6.0.0
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- Updated dependencies:
|
|
242
|
+
- @keboola/api-client@11.0.0
|
|
243
|
+
|
|
244
|
+
## 5.0.1
|
|
245
|
+
|
|
246
|
+
### Patch Changes
|
|
247
|
+
|
|
248
|
+
- Add `expectTypeOf` type tests binding the exported storage-tables fixtures (`getTable`, `listTables`, `tableFixtures`) to the generated `TableDetail` type from `@keboola/api-client`, and enable Vitest `typecheck` so the assertions are evaluated by `vitest run`. The `getTable`/`listTables` assertions lock the exported API surface to the generated type; the `tableFixtures.*` assertions additionally catch structural drift in the fixture bodies (their narrow inferred literal shapes must stay assignable to `TableDetail`). Contract drift now fails the test suite, not just `tsc`.
|
|
249
|
+
|
|
250
|
+
## 5.0.0
|
|
251
|
+
|
|
252
|
+
### Patch Changes
|
|
253
|
+
|
|
254
|
+
- Updated dependencies:
|
|
255
|
+
- @keboola/api-client@10.0.0
|
|
256
|
+
|
|
257
|
+
## 4.0.0
|
|
258
|
+
|
|
259
|
+
### Patch Changes
|
|
260
|
+
|
|
261
|
+
- Updated dependencies:
|
|
262
|
+
- @keboola/api-client@9.0.0
|
|
263
|
+
|
|
264
|
+
## 3.0.0
|
|
265
|
+
|
|
266
|
+
### Patch Changes
|
|
267
|
+
|
|
268
|
+
- Updated dependencies:
|
|
269
|
+
- @keboola/api-client@8.0.0
|
|
270
|
+
|
|
271
|
+
## 2.0.0
|
|
272
|
+
|
|
273
|
+
### Patch Changes
|
|
274
|
+
|
|
275
|
+
- Updated dependencies:
|
|
276
|
+
- @keboola/api-client@7.0.0
|
|
277
|
+
|
|
278
|
+
## 1.0.0
|
|
279
|
+
|
|
280
|
+
### Minor Changes
|
|
281
|
+
|
|
282
|
+
- Publish `@keboola/api-fixtures` to npm (previously workspace-internal). Ships compiled `dist` output (ESM + CJS + type declarations) and declares `@keboola/api-client` as a peer dependency so the re-exported endpoint types resolve in external consumers.
|
|
283
|
+
|
|
284
|
+
### Patch Changes
|
|
285
|
+
|
|
286
|
+
- Updated dependencies:
|
|
287
|
+
- @keboola/api-client@6.0.0
|