@rebasepro/common 0.9.0 → 0.9.1-canary.09aaf62
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 +1 -1
- package/dist/collections/default-collections.d.ts +4 -0
- package/dist/data/buildRebaseData.d.ts +15 -2
- package/dist/index.es.js +696 -49
- package/dist/index.es.js.map +1 -1
- package/dist/util/auth-default-policies.d.ts +22 -0
- package/dist/util/identity.d.ts +83 -0
- package/dist/util/index.d.ts +3 -0
- package/dist/util/junction-policies.d.ts +108 -0
- package/dist/util/policy/evaluatePolicy.d.ts +8 -1
- package/dist/util/policy/index.d.ts +1 -0
- package/dist/util/policy/sqlToPolicy.d.ts +24 -14
- package/package.json +7 -8
- package/src/collections/default-collections.ts +2 -0
- package/src/data/buildRebaseData.ts +119 -24
- package/src/data/filter-dialect.ts +6 -0
- package/src/util/auth-default-policies.ts +152 -0
- package/src/util/identity.ts +166 -0
- package/src/util/index.ts +3 -0
- package/src/util/junction-policies.ts +353 -0
- package/src/util/policy/evaluatePolicy.ts +20 -4
- package/src/util/policy/index.ts +1 -0
- package/src/util/policy/policyToPostgres.ts +38 -12
- package/src/util/policy/sqlToPolicy.ts +190 -13
- package/dist/index.umd.js +0 -3311
- package/dist/index.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -91,5 +91,5 @@ const { data: filtered } = await data.products
|
|
|
91
91
|
|
|
92
92
|
- [`@rebasepro/types`](../types) — `DataDriver`, `RebaseData`, `CollectionAccessor`, `Snapshot`, `FindResponse`, etc.
|
|
93
93
|
- [`@rebasepro/utils`](../utils) — Low-level utilities (`toSnakeCase`, etc.)
|
|
94
|
-
- [`@rebasepro/
|
|
94
|
+
- [`@rebasepro/app`](../core) — Runtime layer that consumes `@rebasepro/common`
|
|
95
95
|
- [`@rebasepro/client`](../client) — HTTP client that re-exports and extends the `QueryBuilder`
|
|
@@ -56,6 +56,7 @@ export declare const defaultUsersCollection: import("@rebasepro/types").Postgres
|
|
|
56
56
|
readonly name: "Password Hash";
|
|
57
57
|
readonly type: "string";
|
|
58
58
|
readonly columnName: "password_hash";
|
|
59
|
+
readonly excludeFromApi: true;
|
|
59
60
|
readonly ui: {
|
|
60
61
|
readonly hideFromCollection: true;
|
|
61
62
|
readonly disabled: {
|
|
@@ -79,6 +80,7 @@ export declare const defaultUsersCollection: import("@rebasepro/types").Postgres
|
|
|
79
80
|
readonly name: "Email Verification Token";
|
|
80
81
|
readonly type: "string";
|
|
81
82
|
readonly columnName: "email_verification_token";
|
|
83
|
+
readonly excludeFromApi: true;
|
|
82
84
|
readonly ui: {
|
|
83
85
|
readonly hideFromCollection: true;
|
|
84
86
|
readonly disabled: {
|
|
@@ -183,6 +185,7 @@ export declare const defaultUsersCollection: import("@rebasepro/types").Postgres
|
|
|
183
185
|
readonly name: "Password Hash";
|
|
184
186
|
readonly type: "string";
|
|
185
187
|
readonly columnName: "password_hash";
|
|
188
|
+
readonly excludeFromApi: true;
|
|
186
189
|
readonly ui: {
|
|
187
190
|
readonly hideFromCollection: true;
|
|
188
191
|
readonly disabled: {
|
|
@@ -206,6 +209,7 @@ export declare const defaultUsersCollection: import("@rebasepro/types").Postgres
|
|
|
206
209
|
readonly name: "Email Verification Token";
|
|
207
210
|
readonly type: "string";
|
|
208
211
|
readonly columnName: "email_verification_token";
|
|
212
|
+
readonly excludeFromApi: true;
|
|
209
213
|
readonly ui: {
|
|
210
214
|
readonly hideFromCollection: true;
|
|
211
215
|
readonly disabled: {
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { DataDriver, RebaseData, RebaseSdkData } from "@rebasepro/types";
|
|
2
|
+
export interface EntityDataOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Look up a collection's config by slug, to derive row addresses from its
|
|
5
|
+
* primary keys.
|
|
6
|
+
*
|
|
7
|
+
* Called lazily rather than up front: the data layer is created by `Rebase`,
|
|
8
|
+
* which sits *above* the admin that owns the collections, so a resolver
|
|
9
|
+
* registered on mount would otherwise arrive too late to be seen.
|
|
10
|
+
*/
|
|
11
|
+
resolveCollection?: (slug: string) => {
|
|
12
|
+
properties?: Record<string, unknown>;
|
|
13
|
+
} | undefined;
|
|
14
|
+
}
|
|
2
15
|
/**
|
|
3
16
|
* Build a `RebaseData` object from a `DataDriver` using JavaScript Proxy.
|
|
4
17
|
*
|
|
@@ -11,7 +24,7 @@ import { DataDriver, RebaseData, RebaseSdkData } from "@rebasepro/types";
|
|
|
11
24
|
* await data.products.create({ name: "Camera", price: 299 });
|
|
12
25
|
* const { data: items } = await data.products.find({ where: { status: ["==", "published"] } });
|
|
13
26
|
*/
|
|
14
|
-
export declare function buildRebaseData(driver: DataDriver): RebaseData;
|
|
27
|
+
export declare function buildRebaseData(driver: DataDriver, options?: EntityDataOptions): RebaseData;
|
|
15
28
|
/**
|
|
16
29
|
* Wrap a flat {@link RebaseSdkData} into a Entity-shaped {@link RebaseData}.
|
|
17
30
|
*
|
|
@@ -21,7 +34,7 @@ export declare function buildRebaseData(driver: DataDriver): RebaseData;
|
|
|
21
34
|
* CMS `RebaseDataContext` — without it the admin renders rows with only their
|
|
22
35
|
* `id`.
|
|
23
36
|
*/
|
|
24
|
-
export declare function wrapAsEntityData(sdkData: RebaseSdkData): RebaseData;
|
|
37
|
+
export declare function wrapAsEntityData(sdkData: RebaseSdkData, options?: EntityDataOptions): RebaseData;
|
|
25
38
|
/**
|
|
26
39
|
* Wrap a Entity-shaped {@link RebaseData} into a flat {@link RebaseSdkData}.
|
|
27
40
|
*
|