@rebasepro/common 0.9.0 → 0.9.1-canary.0de22e0

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 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/core`](../core) — Runtime layer that consumes `@rebasepro/common`
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
  *