@rebasepro/common 0.21.0 → 0.21.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.
- package/README.md +8 -12
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,17 +9,17 @@ pnpm add @rebasepro/common
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
ESM-only: `"type": "module"` with no CommonJS build, so it is loaded with
|
|
12
|
-
`import`.
|
|
13
|
-
`require(esm)
|
|
12
|
+
`import`. It needs Node `>=22.22.0` (its `engines` floor), where `require()`
|
|
13
|
+
of it resolves too: Node has supported `require(esm)` since 22.12.
|
|
14
14
|
|
|
15
15
|
## What This Package Does
|
|
16
16
|
|
|
17
17
|
`@rebasepro/common` is the lowest-level shared logic layer in the Rebase frontend stack. It provides:
|
|
18
18
|
|
|
19
|
-
- **Collection utilities** — collection registry, default collection definitions, path resolution
|
|
19
|
+
- **Collection utilities** — collection registry, default collection definitions, path resolution
|
|
20
20
|
- **Data driver adapter** — `buildRebaseData()` bridges any `DataDriver` implementation into a `RebaseData` proxy with typed collection accessors
|
|
21
21
|
- **Query builder** — fluent `QueryBuilder` class plus `or()`, `and()`, `cond()` helpers for composing complex queries
|
|
22
|
-
- **
|
|
22
|
+
- **Entity/property utilities** — entity resolution, enum helpers, permission checks, reference/relation helpers, storage path utils, callback utilities
|
|
23
23
|
|
|
24
24
|
This package has no React dependency — it's pure TypeScript and can be used in both client and server contexts.
|
|
25
25
|
|
|
@@ -48,20 +48,16 @@ This package has no React dependency — it's pure TypeScript and can be used in
|
|
|
48
48
|
|---|---|
|
|
49
49
|
| `collections` | Collection config helpers |
|
|
50
50
|
| `common` | General-purpose utilities |
|
|
51
|
-
| `
|
|
51
|
+
| `entities` | Entity value resolution |
|
|
52
52
|
| `enums` | Enum type helpers |
|
|
53
53
|
| `paths` | Path parsing and manipulation |
|
|
54
54
|
| `resolutions` | Property and collection resolution |
|
|
55
55
|
| `permissions` | Permission evaluation |
|
|
56
|
-
| `references` | Reference property helpers |
|
|
57
56
|
| `relations` | Relation property helpers |
|
|
58
|
-
| `navigation_from_path` | Build navigation tree from a path |
|
|
59
|
-
| `parent_references_from_path` | Extract parent references |
|
|
60
57
|
| `builders` | Collection/property builder utilities |
|
|
61
58
|
| `storage` | Storage path utilities |
|
|
62
59
|
| `callbacks` | Callback composition utilities |
|
|
63
60
|
| `conditions` | Conditional logic helpers |
|
|
64
|
-
| `navigation_utils` | Navigation tree utilities |
|
|
65
61
|
|
|
66
62
|
## Quick Start
|
|
67
63
|
|
|
@@ -73,7 +69,7 @@ const data = buildRebaseData(myDriver);
|
|
|
73
69
|
|
|
74
70
|
// Access collections by name (camelCase auto-converts to snake_case)
|
|
75
71
|
const { data: products } = await data.products.find({ limit: 10 });
|
|
76
|
-
const
|
|
72
|
+
const entity = await data.products.findById("abc-123");
|
|
77
73
|
|
|
78
74
|
// Fluent query builder
|
|
79
75
|
const { data: results } = await data.products
|
|
@@ -93,7 +89,7 @@ const { data: filtered } = await data.products
|
|
|
93
89
|
|
|
94
90
|
## Related Packages
|
|
95
91
|
|
|
96
|
-
- [`@rebasepro/types`](../types) — `DataDriver`, `RebaseData`, `CollectionAccessor`, `
|
|
92
|
+
- [`@rebasepro/types`](../types) — `DataDriver`, `RebaseData`, `CollectionAccessor`, `Entity`, `FindResponse`, etc.
|
|
97
93
|
- [`@rebasepro/utils`](../utils) — Low-level utilities (`toSnakeCase`, etc.)
|
|
98
|
-
- [`@rebasepro/app`](../
|
|
94
|
+
- [`@rebasepro/app`](../app) — Runtime layer that consumes `@rebasepro/common`
|
|
99
95
|
- [`@rebasepro/client`](../client) — HTTP client that re-exports and extends the `QueryBuilder`
|
package/dist/index.es.js
CHANGED
|
@@ -2198,6 +2198,7 @@ function checkOperation(collection, authContext, entity, targetOperation, option
|
|
|
2198
2198
|
const ctx = {
|
|
2199
2199
|
uid: authContext.user?.uid,
|
|
2200
2200
|
roles: authContext.user?.roles ?? [],
|
|
2201
|
+
isAnonymous: authContext.user?.isAnonymous === true,
|
|
2201
2202
|
entity
|
|
2202
2203
|
};
|
|
2203
2204
|
let grantedByPermissive = false;
|
|
@@ -6265,8 +6266,7 @@ function createDriverAccessor(driver, slug, getPks = () => [], toViewModel) {
|
|
|
6265
6266
|
async delete(id) {
|
|
6266
6267
|
return driver.delete({ row: {
|
|
6267
6268
|
id,
|
|
6268
|
-
path: slug
|
|
6269
|
-
values: {}
|
|
6269
|
+
path: slug
|
|
6270
6270
|
} });
|
|
6271
6271
|
},
|
|
6272
6272
|
updateMany: driver.updateMany ? async (updates) => {
|