@objectstack/platform-objects 6.9.0 → 7.0.0

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 (51) hide show
  1. package/dist/apps/index.d.mts +30 -1
  2. package/dist/apps/index.d.ts +30 -1
  3. package/dist/apps/index.js +994 -37
  4. package/dist/apps/index.js.map +1 -1
  5. package/dist/apps/index.mjs +994 -38
  6. package/dist/apps/index.mjs.map +1 -1
  7. package/dist/audit/index.d.mts +192 -16
  8. package/dist/audit/index.d.ts +192 -16
  9. package/dist/identity/index.d.mts +840 -22
  10. package/dist/identity/index.d.ts +840 -22
  11. package/dist/identity/index.js +384 -8
  12. package/dist/identity/index.js.map +1 -1
  13. package/dist/identity/index.mjs +384 -8
  14. package/dist/identity/index.mjs.map +1 -1
  15. package/dist/index.d.mts +4 -1
  16. package/dist/index.d.ts +4 -1
  17. package/dist/index.js +6815 -104
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +6810 -105
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/integration/index.d.mts +12 -1
  22. package/dist/integration/index.d.ts +12 -1
  23. package/dist/metadata/index.d.mts +24 -2
  24. package/dist/metadata/index.d.ts +24 -2
  25. package/dist/metadata-translations/index.d.mts +20 -0
  26. package/dist/metadata-translations/index.d.ts +20 -0
  27. package/dist/metadata-translations/index.js +4777 -0
  28. package/dist/metadata-translations/index.js.map +1 -0
  29. package/dist/metadata-translations/index.mjs +4775 -0
  30. package/dist/metadata-translations/index.mjs.map +1 -0
  31. package/dist/pages/index.d.mts +68 -0
  32. package/dist/pages/index.d.ts +68 -0
  33. package/dist/pages/index.js +371 -0
  34. package/dist/pages/index.js.map +1 -0
  35. package/dist/pages/index.mjs +368 -0
  36. package/dist/pages/index.mjs.map +1 -0
  37. package/dist/plugin.d.mts +35 -0
  38. package/dist/plugin.d.ts +35 -0
  39. package/dist/plugin.js +17566 -0
  40. package/dist/plugin.js.map +1 -0
  41. package/dist/plugin.mjs +17563 -0
  42. package/dist/plugin.mjs.map +1 -0
  43. package/dist/security/index.d.mts +785 -183
  44. package/dist/security/index.d.ts +785 -183
  45. package/dist/security/index.js +188 -1
  46. package/dist/security/index.js.map +1 -1
  47. package/dist/security/index.mjs +188 -1
  48. package/dist/security/index.mjs.map +1 -1
  49. package/dist/system/index.d.mts +36 -3
  50. package/dist/system/index.d.ts +36 -3
  51. package/package.json +17 -2
@@ -342,6 +342,24 @@ var SysPermissionSet = data.ObjectSchema.create({
342
342
  description: "JSON-serialized field-level read/write permissions",
343
343
  group: "Permissions"
344
344
  }),
345
+ system_permissions: data.Field.textarea({
346
+ label: "System Permissions",
347
+ required: false,
348
+ description: 'JSON-serialized array of system capability names (e.g. ["setup.access","studio.access","manage_users"])',
349
+ group: "Permissions"
350
+ }),
351
+ row_level_security: data.Field.textarea({
352
+ label: "Row-Level Security",
353
+ required: false,
354
+ description: "JSON-serialized array of row-level security policies (USING/CHECK clauses)",
355
+ group: "Permissions"
356
+ }),
357
+ tab_permissions: data.Field.textarea({
358
+ label: "Tab Permissions",
359
+ required: false,
360
+ description: "JSON-serialized map of app tab visibility (visible | hidden | default_on | default_off)",
361
+ group: "Permissions"
362
+ }),
345
363
  // ── Status ───────────────────────────────────────────────────
346
364
  active: data.Field.boolean({
347
365
  label: "Active",
@@ -1061,7 +1079,176 @@ var defaultPermissionSets = [
1061
1079
  modifyAllRecords: true
1062
1080
  }
1063
1081
  },
1064
- systemPermissions: ["manage_users", "manage_metadata", "setup.access", "studio.access"]
1082
+ systemPermissions: [
1083
+ "manage_users",
1084
+ "manage_metadata",
1085
+ "manage_platform_settings",
1086
+ "setup.access",
1087
+ "studio.access"
1088
+ ]
1089
+ }),
1090
+ // ── Organization Administrator ──────────────────────────────────────
1091
+ //
1092
+ // Third tier between platform admin (`admin_full_access`) and rank-and-file
1093
+ // member. Lives at the *organization* scope: full CRUD on business
1094
+ // objects within their org (governed by `tenant_isolation` RLS), plus
1095
+ // `setup.access` so the Setup app shell is reachable.
1096
+ //
1097
+ // **Deliberately withheld** vs `admin_full_access`:
1098
+ // - `studio.access` — schema-design surfaces are platform-level (a
1099
+ // tenant cannot mutate the shared metadata) and Studio is hidden.
1100
+ // - `manage_metadata` — same reasoning.
1101
+ // - `manage_platform_settings` — global settings manifests
1102
+ // (mail / storage / AI / knowledge) and platform-only Setup pages
1103
+ // (sharing rules, audit logs, OAuth apps, JWKS, …) require this
1104
+ // and are hidden / 403'd for org admins. Tenant-scoped manifests
1105
+ // (`branding`, `feature_flags`) keep using `setup.access` so org
1106
+ // admins CAN configure their own org's branding.
1107
+ //
1108
+ // **Anti-escalation**: writes to the global RBAC tables
1109
+ // (`sys_role`, `sys_permission_set`, `sys_role_permission_set`,
1110
+ // `sys_user_permission_set`, `sys_user_role`) are denied. Allowing
1111
+ // them would let an org admin bind `admin_full_access` (which has no
1112
+ // RLS) to themselves and break out of tenant isolation. Reads are
1113
+ // permitted so the Roles / Permission Sets nav entries still render.
1114
+ //
1115
+ // Auto-granted to every `sys_member` whose role contains `owner` or
1116
+ // `admin` by `plugin-security/src/auto-org-admin-grant.ts`.
1117
+ security.PermissionSetSchema.parse({
1118
+ name: "organization_admin",
1119
+ label: "Organization Administrator",
1120
+ isProfile: true,
1121
+ objects: {
1122
+ "*": {
1123
+ allowRead: true,
1124
+ allowCreate: true,
1125
+ allowEdit: true,
1126
+ allowDelete: true,
1127
+ viewAllRecords: true,
1128
+ modifyAllRecords: true
1129
+ },
1130
+ // Identity tables — go through better-auth endpoints (invite,
1131
+ // accept, remove-member, transfer, …) rather than raw CRUD.
1132
+ ...denyWritesOnManagedObjects(),
1133
+ // RBAC tables — read-only to prevent privilege escalation.
1134
+ sys_role: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
1135
+ sys_permission_set: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
1136
+ sys_role_permission_set: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
1137
+ sys_user_permission_set: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
1138
+ sys_user_role: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false }
1139
+ },
1140
+ systemPermissions: ["manage_org_users", "setup.access"],
1141
+ rowLevelSecurity: [
1142
+ {
1143
+ name: "tenant_isolation",
1144
+ object: "*",
1145
+ operation: "all",
1146
+ using: "organization_id = current_user.organization_id"
1147
+ },
1148
+ // ── better-auth system tables that lack `organization_id` and would
1149
+ // otherwise be denied by the wildcard policy. Same self-only
1150
+ // carve-outs as `member_default` — an org admin does not get to
1151
+ // inspect cross-tenant identity rows.
1152
+ {
1153
+ name: "sys_organization_self",
1154
+ object: "sys_organization",
1155
+ operation: "all",
1156
+ using: "id = current_user.organization_id"
1157
+ },
1158
+ {
1159
+ name: "sys_user_self",
1160
+ object: "sys_user",
1161
+ operation: "select",
1162
+ using: "id = current_user.id"
1163
+ },
1164
+ {
1165
+ name: "sys_user_org_members",
1166
+ object: "sys_user",
1167
+ operation: "select",
1168
+ using: "id IN (current_user.org_user_ids)"
1169
+ },
1170
+ {
1171
+ name: "sys_session_self",
1172
+ object: "sys_session",
1173
+ operation: "all",
1174
+ using: "user_id = current_user.id"
1175
+ },
1176
+ {
1177
+ name: "sys_account_self",
1178
+ object: "sys_account",
1179
+ operation: "select",
1180
+ using: "user_id = current_user.id"
1181
+ },
1182
+ {
1183
+ name: "sys_team_member_self",
1184
+ object: "sys_team_member",
1185
+ operation: "select",
1186
+ using: "user_id = current_user.id"
1187
+ },
1188
+ {
1189
+ name: "sys_two_factor_self",
1190
+ object: "sys_two_factor",
1191
+ operation: "all",
1192
+ using: "user_id = current_user.id"
1193
+ },
1194
+ {
1195
+ name: "sys_user_preference_self",
1196
+ object: "sys_user_preference",
1197
+ operation: "all",
1198
+ using: "user_id = current_user.id"
1199
+ },
1200
+ {
1201
+ name: "sys_api_key_self",
1202
+ object: "sys_api_key",
1203
+ operation: "all",
1204
+ using: "user_id = current_user.id"
1205
+ },
1206
+ {
1207
+ name: "sys_device_code_self",
1208
+ object: "sys_device_code",
1209
+ operation: "all",
1210
+ using: "user_id = current_user.id"
1211
+ },
1212
+ {
1213
+ name: "sys_oauth_access_token_self",
1214
+ object: "sys_oauth_access_token",
1215
+ operation: "select",
1216
+ using: "user_id = current_user.id"
1217
+ },
1218
+ {
1219
+ name: "sys_oauth_refresh_token_self",
1220
+ object: "sys_oauth_refresh_token",
1221
+ operation: "select",
1222
+ using: "user_id = current_user.id"
1223
+ },
1224
+ {
1225
+ name: "sys_oauth_consent_self",
1226
+ object: "sys_oauth_consent",
1227
+ operation: "all",
1228
+ using: "user_id = current_user.id"
1229
+ },
1230
+ // Org-scoped visibility for organization-owned identity-adjacent
1231
+ // tables. Org admins may inspect their own org's invitations and
1232
+ // memberships (read; writes still flow through better-auth).
1233
+ {
1234
+ name: "sys_member_org",
1235
+ object: "sys_member",
1236
+ operation: "select",
1237
+ using: "organization_id = current_user.organization_id"
1238
+ },
1239
+ {
1240
+ name: "sys_invitation_org",
1241
+ object: "sys_invitation",
1242
+ operation: "select",
1243
+ using: "organization_id = current_user.organization_id"
1244
+ },
1245
+ {
1246
+ name: "sys_team_org",
1247
+ object: "sys_team",
1248
+ operation: "select",
1249
+ using: "organization_id = current_user.organization_id"
1250
+ }
1251
+ ]
1065
1252
  }),
1066
1253
  security.PermissionSetSchema.parse({
1067
1254
  name: "member_default",