@cratestack/refine 0.17.1 → 0.18.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 (2) hide show
  1. package/README.md +15 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@ provider does.
22
22
 
23
23
  A `DataProvider` needs four things per resource — the generated API object itself, the model's
24
24
  primary-key field name, whether it declares `@@paged`, and whether/where it declares `@version`.
25
- None of them has a *runtime* discovery path: the generated client carries no `$meta` object and no
25
+ None of them has a _runtime_ discovery path: the generated client carries no `$meta` object and no
26
26
  introspection endpoint, nothing beyond what its TypeScript **types** already encode at compile time
27
27
  (confirmed against the real generated `client.ts`/`models.ts` this package's own tests drive — see
28
28
  [tests/](./tests)). So the provider itself has to be a hand-written runtime function; there is
@@ -135,16 +135,16 @@ Applies to both providers. refine's `CrudFilters` (`{ field, operator, value }`)
135
135
  just in different container shapes on the wire. Same operator set the generated client's shared
136
136
  filter types (`EqualityFilter`/`ComparableFilter`/`StringFilter`) expose:
137
137
 
138
- | refine operator | cratestack query key |
139
- | --- | --- |
140
- | `eq` | `field` (no suffix) |
141
- | `ne` | `field__ne` |
142
- | `in` | `field__in` (comma-separated) |
138
+ | refine operator | cratestack query key |
139
+ | --------------------------- | ---------------------------------------- |
140
+ | `eq` | `field` (no suffix) |
141
+ | `ne` | `field__ne` |
142
+ | `in` | `field__in` (comma-separated) |
143
143
  | `lt` / `lte` / `gt` / `gte` | `field__lt` / `__lte` / `__gt` / `__gte` |
144
- | `contains` | `field__contains` |
145
- | `startswith` | `field__startsWith` |
146
- | `null` | `field__isNull=true` |
147
- | `nnull` | `field__isNull=false` |
144
+ | `contains` | `field__contains` |
145
+ | `startswith` | `field__startsWith` |
146
+ | `null` | `field__isNull=true` |
147
+ | `nnull` | `field__isNull=false` |
148
148
 
149
149
  **Every other refine operator throws** — `endswith`, `between`, `nin`, `containss`, refine's
150
150
  `or`/`and` filter groups, and anything else not in the table above. Dropping an unsupported filter
@@ -170,14 +170,14 @@ Applies to both providers. refine assumes every record has `id: BaseKey`. crates
170
170
  (`primaryKey` in the resource config above). Every returned record gets a synthetic `id` field
171
171
  alongside its real primary key so refine's row-selection machinery has something to key off;
172
172
  writes (`get`/`update`/`deleteOne`) receive that same value back and pass it straight through as
173
- the real primary key — no translation needed, since the *value space* is identical. The one place
173
+ the real primary key — no translation needed, since the _value space_ is identical. The one place
174
174
  this bites: a `<Create>` form's fields must use the schema's real primary-key field name (e.g.
175
175
  `sku`), not `id` — a create payload has no record yet to synthesize an `id` from.
176
176
 
177
177
  ## Optimistic locking (`@version` / `If-Match`)
178
178
 
179
179
  **The single most important correctness point in this package, and it holds on both transports.**
180
- A `@version` model requires `If-Match` on both update *and* delete (cratestack#493/#519/#538) —
180
+ A `@version` model requires `If-Match` on both update _and_ delete (cratestack#493/#519/#538) —
181
181
  missing or stale `If-Match` returns `412 Precondition Failed` and leaves the row untouched, whether
182
182
  the request went out as an RPC unary call or a REST `PATCH`/`DELETE` (see
183
183
  [RPC transport](#rpc-transport) for why the RPC dispatch path enforces this identically to REST).
@@ -192,7 +192,7 @@ this" message instead of a generic one.
192
192
  Pass `meta: { ifMatch: <version> }` to `update`/`deleteOne` to override the cache explicitly (e.g.
193
193
  optimistic-lock-aware bulk workflows). Calling `update`/`deleteOne` on a `@version` resource with no
194
194
  known version and no override throws rather than silently omitting `If-Match` — omitting it doesn't
195
- fail on the wire the way a *stale* value does, so this package refuses to make that mistake for you.
195
+ fail on the wire the way a _stale_ value does, so this package refuses to make that mistake for you.
196
196
 
197
197
  ## Errors
198
198
 
@@ -204,7 +204,7 @@ list methods and the four single-record methods disagreed, and which one you hit
204
204
  screen the user was on).
205
205
 
206
206
  Conversion **annotates the thrown value in place** rather than replacing it. If your transport
207
- throws a typed error, the value your `onError` handler receives *is* that error:
207
+ throws a typed error, the value your `onError` handler receives _is_ that error:
208
208
 
209
209
  ```ts
210
210
  class DeviceNotEnrolledError extends Error {}
@@ -273,7 +273,7 @@ await dataProvider.custom!({
273
273
  **A known, pre-existing gap this package inherits rather than causes:** route suppression
274
274
  (cratestack#514) isn't implemented, so a policy-denied `create`/`update`/`delete` still generates a
275
275
  working-looking client method — `config.api.create` being present only proves the model declares
276
- *some* `@@allow("create", ...)`, not that the current caller satisfies it. A refine `<Create>`
276
+ _some_ `@@allow("create", ...)`, not that the current caller satisfies it. A refine `<Create>`
277
277
  button wired to such a resource renders and then `403`s on submit for a caller who can't actually
278
278
  create one. Until #514 ships, gate that in refine's own `resources` config
279
279
  (`create: false`/`edit: false`/`delete: false`) per caller role, not on this package's method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratestack/refine",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "A refine.dev DataProvider over CrateStack's generated TypeScript client (REST or RPC) — the safe end-user admin-UI surface that goes through the generated API (policy, validation, @version concurrency, audit), unlike cratestack-studio's direct-to-database sysadmin access.",
5
5
  "license": "MIT",
6
6
  "repository": {