@stonyx/orm 0.3.2-alpha.52 → 0.3.2-alpha.53
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/README.md +7 -0
- package/dist/orm-request.js +10 -0
- package/package.json +1 -1
- package/src/orm-request.ts +10 -0
package/README.md
CHANGED
|
@@ -568,6 +568,13 @@ sub-paths beneath the mount, as the `/archived` deny above does.
|
|
|
568
568
|
[#205](https://github.com/abofs/stonyx-orm/issues/205), alongside
|
|
569
569
|
[#203](https://github.com/abofs/stonyx-orm/issues/203), which is the other way
|
|
570
570
|
a create can land on an id nobody named.
|
|
571
|
+
- **`context.record` is `undefined` for an after-`create` hook when a string-id
|
|
572
|
+
model is given a numeric-looking id.** The post-create lookup uses the same id
|
|
573
|
+
coercion as every other surface, which resolves `'9107'` to the number `9107`,
|
|
574
|
+
while a model declaring `id = attr('string')` files the record under the string
|
|
575
|
+
key. The create itself succeeds and `context.response.data` is correct; only
|
|
576
|
+
the hook's view of the record is wrong, and it is wrong *silently*. Tracked as
|
|
577
|
+
[#209](https://github.com/abofs/stonyx-orm/issues/209).
|
|
571
578
|
- **A denied `POST` rolls back only a record it *inserted*.** The rollback
|
|
572
579
|
requires the store to have grown, because removing by id alone is a write
|
|
573
580
|
primitive keyed by a caller-supplied value. When `assignRecordId` lands a
|
package/dist/orm-request.js
CHANGED
|
@@ -135,6 +135,16 @@ function getBaseUrl(request) {
|
|
|
135
135
|
* every input reachable there, which is exactly what the two that DID diverge
|
|
136
136
|
* looked like until someone tried a hex id.
|
|
137
137
|
*
|
|
138
|
+
* SHARING IT IS NOT THE SAME AS IT BEING RIGHT EVERYWHERE. On a model declaring
|
|
139
|
+
* `id = attr('string')` a numeric-looking id is filed under the STRING key, so
|
|
140
|
+
* this coercion resolves `'9107'` to `9107` and the post-create lookup misses:
|
|
141
|
+
* `context.record` is `undefined` for an after-`create` hook. Inherited -- the
|
|
142
|
+
* inlined copy computed the same thing -- and NOT fixed here, because picking
|
|
143
|
+
* the right coercion needs the model's declared id type, which is the same
|
|
144
|
+
* structural information abofs/stonyx-orm#202 is about. Filed as
|
|
145
|
+
* abofs/stonyx-orm#209 and pinned by assertion 50, so closing it turns a test
|
|
146
|
+
* red rather than passing silently.
|
|
147
|
+
*
|
|
138
148
|
* `parseInt` and not `Number`, deliberately, and the anchor is NOT `getId`.
|
|
139
149
|
* It is `src/transforms.ts:7` -- `number: (value) => parseInt(value as string)`,
|
|
140
150
|
* also radix-less -- because that transform is what actually produces the store
|
package/package.json
CHANGED
package/src/orm-request.ts
CHANGED
|
@@ -171,6 +171,16 @@ function getBaseUrl(request: OrmRequest$): string {
|
|
|
171
171
|
* every input reachable there, which is exactly what the two that DID diverge
|
|
172
172
|
* looked like until someone tried a hex id.
|
|
173
173
|
*
|
|
174
|
+
* SHARING IT IS NOT THE SAME AS IT BEING RIGHT EVERYWHERE. On a model declaring
|
|
175
|
+
* `id = attr('string')` a numeric-looking id is filed under the STRING key, so
|
|
176
|
+
* this coercion resolves `'9107'` to `9107` and the post-create lookup misses:
|
|
177
|
+
* `context.record` is `undefined` for an after-`create` hook. Inherited -- the
|
|
178
|
+
* inlined copy computed the same thing -- and NOT fixed here, because picking
|
|
179
|
+
* the right coercion needs the model's declared id type, which is the same
|
|
180
|
+
* structural information abofs/stonyx-orm#202 is about. Filed as
|
|
181
|
+
* abofs/stonyx-orm#209 and pinned by assertion 50, so closing it turns a test
|
|
182
|
+
* red rather than passing silently.
|
|
183
|
+
*
|
|
174
184
|
* `parseInt` and not `Number`, deliberately, and the anchor is NOT `getId`.
|
|
175
185
|
* It is `src/transforms.ts:7` -- `number: (value) => parseInt(value as string)`,
|
|
176
186
|
* also radix-less -- because that transform is what actually produces the store
|