@rebasepro/common 0.2.4 → 0.2.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/common",
3
3
  "type": "module",
4
- "version": "0.2.4",
4
+ "version": "0.2.5",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -41,8 +41,8 @@
41
41
  "dependencies": {
42
42
  "fast-equals": "6.0.0",
43
43
  "json-logic-js": "^2.0.5",
44
- "@rebasepro/utils": "0.2.4",
45
- "@rebasepro/types": "0.2.4"
44
+ "@rebasepro/types": "0.2.5",
45
+ "@rebasepro/utils": "0.2.5"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@jest/globals": "^29.7.0",
@@ -1,14 +1,11 @@
1
- import { PostgresCollection } from "@rebasepro/types";
1
+ import type { PostgresCollection } from "@rebasepro/types";
2
2
 
3
3
  /**
4
- * Default users collection definition.
4
+ * Default users collection.
5
5
  *
6
- * Shared between the admin UI (for navigation/display) and the backend
7
- * (for schema generation). Both consumers prepend this to the developer's
8
- * collections array and rely on generic slug-based deduplication
9
- * (Map keyed by slug, last-write-wins) so that developer-defined
10
- * collections with the same slug override this default — no hardcoded
11
- * string checks required.
6
+ * Prepended to the developer's collections array by the admin and server.
7
+ * Slug-based dedup (Map keyed by slug, last-write-wins) lets developers
8
+ * override by defining their own collection with `slug: "users"`.
12
9
  */
13
10
  export const defaultUsersCollection: PostgresCollection = {
14
11
  name: "Users",
@@ -18,62 +15,92 @@ export const defaultUsersCollection: PostgresCollection = {
18
15
  schema: "rebase",
19
16
  icon: "Users",
20
17
  group: "Settings",
18
+ openEntityMode: "dialog",
19
+ disableDefaultActions: ["copy"],
20
+ sort: ["createdAt", "desc"],
21
21
  properties: {
22
22
  id: {
23
23
  name: "ID",
24
24
  type: "string",
25
- isId: "uuid"
25
+ isId: "uuid",
26
+ ui: { readOnly: true }
26
27
  },
27
28
  email: {
28
29
  name: "Email",
29
30
  type: "string",
30
31
  validation: { required: true, unique: true }
31
32
  },
32
- password_hash: {
33
- name: "Password Hash",
33
+ displayName: {
34
+ name: "Name",
34
35
  type: "string",
35
- ui: { hideFromCollection: true }
36
- },
37
- display_name: {
38
- name: "Display Name",
39
- type: "string"
36
+ columnName: "display_name",
37
+ validation: { required: true }
40
38
  },
41
- photo_url: {
39
+ photoURL: {
42
40
  name: "Photo URL",
43
- type: "string"
41
+ type: "string",
42
+ columnName: "photo_url",
43
+ url: "image"
44
+ },
45
+ roles: {
46
+ name: "Roles",
47
+ type: "array",
48
+ columnType: "text[]",
49
+ of: {
50
+ name: "Role",
51
+ type: "string",
52
+ enum: {
53
+ admin: "Admin",
54
+ editor: "Editor",
55
+ viewer: "Viewer"
56
+ }
57
+ }
58
+ },
59
+ passwordHash: {
60
+ name: "Password Hash",
61
+ type: "string",
62
+ columnName: "password_hash",
63
+ ui: { hideFromCollection: true, disabled: { hidden: true } }
44
64
  },
45
- email_verified: {
65
+ emailVerified: {
46
66
  name: "Email Verified",
47
67
  type: "boolean",
48
- defaultValue: false
68
+ columnName: "email_verified",
69
+ defaultValue: false,
70
+ ui: { hideFromCollection: true, disabled: { hidden: true } }
49
71
  },
50
- email_verification_token: {
72
+ emailVerificationToken: {
51
73
  name: "Email Verification Token",
52
74
  type: "string",
53
- ui: { hideFromCollection: true }
75
+ columnName: "email_verification_token",
76
+ ui: { hideFromCollection: true, disabled: { hidden: true } }
54
77
  },
55
- email_verification_sent_at: {
78
+ emailVerificationSentAt: {
56
79
  name: "Email Verification Sent At",
57
80
  type: "date",
58
- ui: { hideFromCollection: true }
81
+ columnName: "email_verification_sent_at",
82
+ ui: { hideFromCollection: true, disabled: { hidden: true } }
59
83
  },
60
84
  metadata: {
61
85
  name: "Metadata",
62
86
  type: "map",
63
87
  defaultValue: {},
64
- ui: { hideFromCollection: true }
88
+ ui: { hideFromCollection: true, disabled: { hidden: true } }
65
89
  },
66
- created_at: {
90
+ createdAt: {
67
91
  name: "Created At",
68
92
  type: "date",
69
- autoValue: "on_create",
70
- ui: { readOnly: true, hideFromCollection: true }
93
+ columnName: "created_at",
94
+ ui: { readOnly: true }
71
95
  },
72
- updated_at: {
96
+ updatedAt: {
73
97
  name: "Updated At",
74
98
  type: "date",
99
+ columnName: "updated_at",
75
100
  autoValue: "on_update",
76
- ui: { readOnly: true, hideFromCollection: true }
101
+ ui: { hideFromCollection: true, disabled: { hidden: true } }
77
102
  }
78
- }
103
+ },
104
+ listProperties: ["displayName", "email", "roles", "createdAt"],
105
+ propertiesOrder: ["id", "email", "displayName", "roles", "createdAt"]
79
106
  };
@@ -190,6 +190,12 @@ values: {} as Record<string, unknown> }
190
190
  });
191
191
  },
192
192
 
193
+ deleteAll: driver.deleteAll
194
+ ? async (): Promise<void> => {
195
+ return driver.deleteAll!(slug);
196
+ }
197
+ : undefined,
198
+
193
199
  count: driver.countEntities
194
200
  ? async (params?: FindParams): Promise<number> => {
195
201
  return driver.countEntities!({