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