@90soft/parse-server-kit 2.8.2 → 2.10.1

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 (60) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/CLAUDE.md +698 -674
  3. package/README.md +27 -0
  4. package/dist/config.d.ts +68 -0
  5. package/dist/config.d.ts.map +1 -0
  6. package/dist/config.js +35 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/database/indexes.d.ts.map +1 -1
  9. package/dist/database/indexes.js +14 -1
  10. package/dist/database/indexes.js.map +1 -1
  11. package/dist/decorators/cloudDecorator.d.ts.map +1 -1
  12. package/dist/decorators/cloudDecorator.js +58 -15
  13. package/dist/decorators/cloudDecorator.js.map +1 -1
  14. package/dist/decorators/cloudRegistry.d.ts +13 -0
  15. package/dist/decorators/cloudRegistry.d.ts.map +1 -1
  16. package/dist/decorators/cloudRegistry.js +23 -1
  17. package/dist/decorators/cloudRegistry.js.map +1 -1
  18. package/dist/decorators/parseDecorators.d.ts +1 -1
  19. package/dist/decorators/parseDecorators.d.ts.map +1 -1
  20. package/dist/decorators/parseDecorators.js +131 -4
  21. package/dist/decorators/parseDecorators.js.map +1 -1
  22. package/dist/decorators/triggerDecorator.d.ts +14 -0
  23. package/dist/decorators/triggerDecorator.d.ts.map +1 -1
  24. package/dist/decorators/triggerDecorator.js +31 -2
  25. package/dist/decorators/triggerDecorator.js.map +1 -1
  26. package/dist/decorators/triggerRegistry.d.ts +8 -0
  27. package/dist/decorators/triggerRegistry.d.ts.map +1 -1
  28. package/dist/decorators/triggerRegistry.js +18 -0
  29. package/dist/decorators/triggerRegistry.js.map +1 -1
  30. package/dist/decorators/types/cloudTypes.d.ts +22 -0
  31. package/dist/decorators/types/cloudTypes.d.ts.map +1 -1
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +7 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/middleware/middleware.d.ts.map +1 -1
  37. package/dist/middleware/middleware.js +66 -5
  38. package/dist/middleware/middleware.js.map +1 -1
  39. package/dist/models/BaseModel.d.ts.map +1 -1
  40. package/dist/models/BaseModel.js +5 -2
  41. package/dist/models/BaseModel.js.map +1 -1
  42. package/dist/swagger/index.d.ts.map +1 -1
  43. package/dist/swagger/index.js +17 -4
  44. package/dist/swagger/index.js.map +1 -1
  45. package/dist/swagger/swaggerRegistry.d.ts +11 -0
  46. package/dist/swagger/swaggerRegistry.d.ts.map +1 -1
  47. package/dist/swagger/swaggerRegistry.js +18 -1
  48. package/dist/swagger/swaggerRegistry.js.map +1 -1
  49. package/dist/utils/dynamicImport.d.ts.map +1 -1
  50. package/dist/utils/dynamicImport.js +33 -11
  51. package/dist/utils/dynamicImport.js.map +1 -1
  52. package/dist/utils/helper.d.ts +5 -1
  53. package/dist/utils/helper.d.ts.map +1 -1
  54. package/dist/utils/helper.js +25 -2
  55. package/dist/utils/helper.js.map +1 -1
  56. package/dist/utils/roleCache.d.ts +60 -0
  57. package/dist/utils/roleCache.d.ts.map +1 -0
  58. package/dist/utils/roleCache.js +112 -0
  59. package/dist/utils/roleCache.js.map +1 -0
  60. package/package.json +3 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,99 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@90soft/parse-server-kit`.
4
+
5
+ > The public continuation of this library is published as **`parse-server-kit`**,
6
+ > starting at 3.0.0. Same source; the two are not interchangeable at matching
7
+ > version numbers.
8
+
9
+ ---
10
+
11
+ ## [2.10.1]
12
+
13
+ Twelve fixes found by a full read of the source, each verified against a running
14
+ server rather than by inspection. Two change behaviour; both are noted.
15
+
16
+ Checked against SMC before shipping: it uses neither `requiresAuth` nor
17
+ `rateLimit`, and has no intermediate model base classes — so nothing here
18
+ changes how it behaves.
19
+
20
+ ### Fixed
21
+
22
+ - **Field and trigger metadata leaked across an inheritance tree.**
23
+ `Reflect.getMetadata` walks the prototype chain, so a subclass with no
24
+ metadata of its own was handed the *parent's* object — which was then mutated
25
+ in place. Every class in the tree ended up sharing one record:
26
+
27
+ ```ts
28
+ class Auditable extends BaseModel { @ParseField() declare createdBy }
29
+ class Product extends Auditable { @ParseField() declare name }
30
+ class Order extends Auditable { @ParseField() declare total }
31
+ // Product gained `total`, Order gained `name`, Auditable gained both
32
+ ```
33
+
34
+ The result was wrong schemas, `fromParams` converting fields the model does
35
+ not have, `validateObject` demanding foreign required fields, and
36
+ `applyAllIndexes` indexing columns that do not exist — none of it reported.
37
+
38
+ Both `parse:fields` and `parse:pendingTriggers` now copy on first write.
39
+ **Identical for a class extending `BaseModel` directly**, which carries no
40
+ field metadata — so the common case is unchanged.
41
+
42
+ - **`requiresAuth` enforced nothing.** It was read only by the OpenAPI renderer,
43
+ so an endpoint declaring it was reachable with no session *while the docs drew
44
+ a padlock on it*. It is now checked in the handler wrapper before the body
45
+ runs; a call carrying the master key still passes.
46
+ **Behaviour change** — endpoints that were accidentally open are now closed.
47
+
48
+ - **`rateLimit` could be skipped entirely.** It was applied only in
49
+ `validateEntityRoutes`, which returns early for anything that is not a
50
+ registered entity prefix — so asking for `/functions/{name}` directly bypassed
51
+ it. `restrictRoutes` now applies it on that path too. **Behaviour change.**
52
+
53
+ The declared `methods` deliberately do **not** follow. `/functions/{name}` is
54
+ Parse's own protocol endpoint and every SDK's `Parse.Cloud.run` POSTs to it,
55
+ so enforcing them there would make any GET-declared function unreachable from
56
+ a Parse client.
57
+
58
+ - **Declaring a field `unique` dropped compound indexes containing it.** The
59
+ conflict check matched any non-unique index *containing* the field, so
60
+ `unique: true` on `status` alongside a compound index on
61
+ `['status', 'createdAt']` dropped the compound one on every boot. An index
62
+ created outside this library was dropped for good.
63
+
64
+ - **The master key was compared with `===`**, which short-circuits on the first
65
+ differing character and leaks the key a character at a time under timing
66
+ analysis. Now `crypto.timingSafeEqual`.
67
+
68
+ - **`restrictRoutes` matched `/functions` by prefix**, so `/functionsX` passed.
69
+ Now an exact segment match.
70
+
71
+ - **Malformed JSON mentioning a master key both answered 400 and threw**,
72
+ leaving Express reporting "Cannot set headers after they are sent" on top of
73
+ the real error. It throws only; body-parser answers 400. *The response body
74
+ for that narrow case is body-parser's rather than this library's.*
75
+
76
+ - **`readCachedRoles` returned the cache's own array.** A caller sorting or
77
+ filtering it in place rewrote what every later permission check saw.
78
+
79
+ - **`fromParams` wrote `className` into the caller's `req.params`.** It works on
80
+ a copy, so a retried transaction no longer sees an input the first attempt
81
+ altered.
82
+
83
+ - **`validateFunctionRoutes` 404'd everything** unless mounted at
84
+ `{mountPath}/functions`, because it read the path segment blindly. It now
85
+ works at either mount point.
86
+
87
+ ### Added
88
+
89
+ - `test/inheritance.test.ts` — pins the metadata fix, including the sibling-leak
90
+ case and version fields across inheritance.
91
+
92
+ ---
93
+
94
+ ## [2.10.0]
95
+
96
+ - Decorator order between `@CloudFunction` and `@Transactional` no longer
97
+ matters; the registry re-reads the method when it registers it.
98
+ - `@ParseField` properties are repaired when a class field shadows the prototype
99
+ accessor, so `title!: string` no longer silently drops writes.