@objectstack/platform-objects 7.0.0 → 7.2.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 (43) hide show
  1. package/dist/apps/index.js +25 -29
  2. package/dist/apps/index.js.map +1 -1
  3. package/dist/apps/index.mjs +25 -29
  4. package/dist/apps/index.mjs.map +1 -1
  5. package/dist/audit/index.d.mts +192 -96
  6. package/dist/audit/index.d.ts +192 -96
  7. package/dist/identity/index.d.mts +244 -122
  8. package/dist/identity/index.d.ts +244 -122
  9. package/dist/identity/index.js +5 -2
  10. package/dist/identity/index.js.map +1 -1
  11. package/dist/identity/index.mjs +5 -2
  12. package/dist/identity/index.mjs.map +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +180 -31
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +180 -32
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/integration/index.d.mts +12 -6
  20. package/dist/integration/index.d.ts +12 -6
  21. package/dist/metadata/index.d.mts +3252 -13
  22. package/dist/metadata/index.d.ts +3252 -13
  23. package/dist/metadata/index.js +130 -0
  24. package/dist/metadata/index.js.map +1 -1
  25. package/dist/metadata/index.mjs +130 -1
  26. package/dist/metadata/index.mjs.map +1 -1
  27. package/dist/pages/index.d.mts +8 -3
  28. package/dist/pages/index.d.ts +8 -3
  29. package/dist/pages/index.js.map +1 -1
  30. package/dist/pages/index.mjs.map +1 -1
  31. package/dist/plugin.js +4 -8
  32. package/dist/plugin.js.map +1 -1
  33. package/dist/plugin.mjs +4 -8
  34. package/dist/plugin.mjs.map +1 -1
  35. package/dist/security/index.d.mts +84 -42
  36. package/dist/security/index.d.ts +84 -42
  37. package/dist/security/index.js +20 -0
  38. package/dist/security/index.js.map +1 -1
  39. package/dist/security/index.mjs +20 -0
  40. package/dist/security/index.mjs.map +1 -1
  41. package/dist/system/index.d.mts +36 -18
  42. package/dist/system/index.d.ts +36 -18
  43. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ export { SysAccount, SysApiKey, SysDepartment, SysDepartmentMember, SysDeviceCod
2
2
  export { SysPermissionSet, SysRecordShare, SysRole, SysRolePermissionSet, SysShareLink, SysSharingRule, SysUserPermissionSet, defaultPermissionSets } from './security/index.mjs';
3
3
  export { SysActivity, SysApprovalAction, SysApprovalProcess, SysApprovalRequest, SysAttachment, SysAuditLog, SysComment, SysEmail, SysEmailTemplate, SysJob, SysJobQueue, SysJobRun, SysNotification, SysPresence, SysReportSchedule, SysSavedReport } from './audit/index.mjs';
4
4
  export { SysWebhook } from './integration/index.mjs';
5
- export { SysMetadata, SysMetadataHistoryObject, SysMetadata as SysMetadataObject } from './metadata/index.mjs';
5
+ export { SysMetadata, SysMetadataAuditObject, SysMetadataHistoryObject, SysMetadata as SysMetadataObject } from './metadata/index.mjs';
6
6
  export { SysSecret, SysSetting, SysSettingAudit } from './system/index.mjs';
7
7
  export { ACCOUNT_APP, SETUP_APP, STUDIO_APP, SetupAppTranslations, SystemOverviewDashboard, en, esES, jaJP, zhCN } from './apps/index.mjs';
8
8
  export { SysOrganizationDetailPage, SysUserDetailPage } from './pages/index.mjs';
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { SysAccount, SysApiKey, SysDepartment, SysDepartmentMember, SysDeviceCod
2
2
  export { SysPermissionSet, SysRecordShare, SysRole, SysRolePermissionSet, SysShareLink, SysSharingRule, SysUserPermissionSet, defaultPermissionSets } from './security/index.js';
3
3
  export { SysActivity, SysApprovalAction, SysApprovalProcess, SysApprovalRequest, SysAttachment, SysAuditLog, SysComment, SysEmail, SysEmailTemplate, SysJob, SysJobQueue, SysJobRun, SysNotification, SysPresence, SysReportSchedule, SysSavedReport } from './audit/index.js';
4
4
  export { SysWebhook } from './integration/index.js';
5
- export { SysMetadata, SysMetadataHistoryObject, SysMetadata as SysMetadataObject } from './metadata/index.js';
5
+ export { SysMetadata, SysMetadataAuditObject, SysMetadataHistoryObject, SysMetadata as SysMetadataObject } from './metadata/index.js';
6
6
  export { SysSecret, SysSetting, SysSettingAudit } from './system/index.js';
7
7
  export { ACCOUNT_APP, SETUP_APP, STUDIO_APP, SetupAppTranslations, SystemOverviewDashboard, en, esES, jaJP, zhCN } from './apps/index.js';
8
8
  export { SysOrganizationDetailPage, SysUserDetailPage } from './pages/index.js';
package/dist/index.js CHANGED
@@ -12,6 +12,9 @@ var SysUser = data.ObjectSchema.create({
12
12
  icon: "user",
13
13
  isSystem: true,
14
14
  managedBy: "better-auth",
15
+ // ADR-0010 — identity table is managed by better-auth, schema must not drift.
16
+ _lock: "full",
17
+ _lockReason: "Identity table managed by better-auth \u2014 see ADR-0010.",
15
18
  description: "User accounts for authentication",
16
19
  displayNameField: "name",
17
20
  titleFormat: "{name}",
@@ -603,7 +606,7 @@ var SysAccount = data.ObjectSchema.create({
603
606
  mode: "create",
604
607
  locations: ["list_toolbar"],
605
608
  type: "url",
606
- target: "/api/v1/auth/sign-in/social?provider=${param.provider}&callbackURL=${ctx.origin}/apps/account/sys_account",
609
+ target: "/api/v1/auth/sign-in/social?provider=${param.provider}&callbackURL=${ctx.origin}/_console/apps/account/sys_account",
607
610
  params: [
608
611
  {
609
612
  name: "provider",
@@ -2397,7 +2400,7 @@ var SysOauthApplication = data.ObjectSchema.create({
2397
2400
  locations: ["list_toolbar"],
2398
2401
  type: "api",
2399
2402
  method: "POST",
2400
- target: "/api/v1/auth/oauth2/register",
2403
+ target: "/api/v1/auth/sys-oauth-application/register",
2401
2404
  refreshAfter: true,
2402
2405
  params: [
2403
2406
  { name: "name", label: "Application Name", type: "text", required: true },
@@ -4206,6 +4209,16 @@ var defaultPermissionSets = [
4206
4209
  operation: "all",
4207
4210
  using: "user_id = current_user.id"
4208
4211
  },
4212
+ // OAuth applications a user has registered themselves (self-service
4213
+ // developer flow exposed in the Account app's Developer section).
4214
+ // `sys_oauth_application` has no `organization_id` so the wildcard
4215
+ // `tenant_isolation` policy would otherwise deny every row.
4216
+ {
4217
+ name: "sys_oauth_application_self",
4218
+ object: "sys_oauth_application",
4219
+ operation: "all",
4220
+ using: "user_id = current_user.id"
4221
+ },
4209
4222
  // Org-scoped visibility for organization-owned identity-adjacent
4210
4223
  // tables. Org admins may inspect their own org's invitations and
4211
4224
  // memberships (read; writes still flow through better-auth).
@@ -4358,6 +4371,16 @@ var defaultPermissionSets = [
4358
4371
  object: "sys_oauth_consent",
4359
4372
  operation: "all",
4360
4373
  using: "user_id = current_user.id"
4374
+ },
4375
+ // OAuth applications a user has registered themselves (Account →
4376
+ // Developer → OAuth Applications). `sys_oauth_application` has no
4377
+ // `organization_id`, so without this carve-out the wildcard
4378
+ // `tenant_isolation` policy returns zero rows even for the owner.
4379
+ {
4380
+ name: "sys_oauth_application_self",
4381
+ object: "sys_oauth_application",
4382
+ operation: "all",
4383
+ using: "user_id = current_user.id"
4361
4384
  }
4362
4385
  ]
4363
4386
  }),
@@ -6904,6 +6927,135 @@ var SysMetadataHistoryObject = data.ObjectSchema.create({
6904
6927
  trash: false
6905
6928
  }
6906
6929
  });
6930
+ var SysMetadataAuditObject = data.ObjectSchema.create({
6931
+ name: "sys_metadata_audit",
6932
+ label: "Metadata Audit",
6933
+ pluralLabel: "Metadata Audit",
6934
+ icon: "shield-check",
6935
+ isSystem: true,
6936
+ managedBy: "append-only",
6937
+ description: "Append-only audit trail of metadata write decisions (ADR-0010).",
6938
+ fields: {
6939
+ /** Primary Key (UUID) */
6940
+ id: data.Field.text({
6941
+ label: "ID",
6942
+ required: true,
6943
+ readonly: true
6944
+ }),
6945
+ /** When the decision was made (ISO-8601 UTC). */
6946
+ occurred_at: data.Field.datetime({
6947
+ label: "Occurred At",
6948
+ required: true,
6949
+ readonly: true
6950
+ }),
6951
+ /** Acting principal (user id, system id, or 'system'). */
6952
+ actor: data.Field.text({
6953
+ label: "Actor",
6954
+ required: true,
6955
+ readonly: true,
6956
+ maxLength: 255,
6957
+ description: 'Acting principal \u2014 user id, system id, or "system".'
6958
+ }),
6959
+ /** Code path that produced the decision (e.g. `protocol.saveMetaItem`). */
6960
+ source: data.Field.text({
6961
+ label: "Source",
6962
+ required: false,
6963
+ readonly: true,
6964
+ maxLength: 128
6965
+ }),
6966
+ /** Metadata type (singular, e.g. `app`, `object`, `view`). */
6967
+ type: data.Field.text({
6968
+ label: "Metadata Type",
6969
+ required: true,
6970
+ readonly: true,
6971
+ searchable: true,
6972
+ maxLength: 100
6973
+ }),
6974
+ /** Item machine name. */
6975
+ name: data.Field.text({
6976
+ label: "Name",
6977
+ required: true,
6978
+ readonly: true,
6979
+ searchable: true,
6980
+ maxLength: 255
6981
+ }),
6982
+ /** Organization for multi-tenant filtering. NULL for env-wide writes. */
6983
+ organization_id: data.Field.lookup("sys_organization", {
6984
+ label: "Organization",
6985
+ required: false,
6986
+ readonly: true
6987
+ }),
6988
+ /** Operation kind. */
6989
+ operation: data.Field.select(["save", "publish", "rollback", "delete", "reset"], {
6990
+ label: "Operation",
6991
+ required: true,
6992
+ readonly: true
6993
+ }),
6994
+ /** Decision outcome — allowed, denied (refused), or forced (bypassed via override). */
6995
+ outcome: data.Field.select(["allowed", "denied", "forced"], {
6996
+ label: "Outcome",
6997
+ required: true,
6998
+ readonly: true
6999
+ }),
7000
+ /**
7001
+ * Machine-readable code for the decision:
7002
+ * - on `allowed`: `'ok'`
7003
+ * - on `denied`: `'not_overridable'` | `'not_creatable'` |
7004
+ * `'item_locked'` | `'invalid_metadata'` | `'destructive_change'` |
7005
+ * `'metadata_conflict'`
7006
+ * - on `forced`: `'lock_override'` (Phase 3)
7007
+ */
7008
+ code: data.Field.text({
7009
+ label: "Code",
7010
+ required: true,
7011
+ readonly: true,
7012
+ maxLength: 64
7013
+ }),
7014
+ /**
7015
+ * Lock state observed at the time of the decision (`none` if the
7016
+ * item carried no `_lock`). Captured even on `allowed` rows so
7017
+ * later compliance queries can see "what was the lock state when
7018
+ * this write succeeded".
7019
+ */
7020
+ lock_state: data.Field.select(["none", "no-overlay", "no-delete", "full"], {
7021
+ label: "Lock State",
7022
+ required: false,
7023
+ readonly: true
7024
+ }),
7025
+ /** True when the write succeeded by bypassing a lock (Phase 3). */
7026
+ lock_overridden: data.Field.boolean({
7027
+ label: "Lock Overridden",
7028
+ required: false,
7029
+ readonly: true
7030
+ }),
7031
+ /** Optional request correlation id for tracing. */
7032
+ request_id: data.Field.text({
7033
+ label: "Request ID",
7034
+ required: false,
7035
+ readonly: true,
7036
+ maxLength: 128
7037
+ }),
7038
+ /** Optional free-form context (e.g. brief diff summary). */
7039
+ note: data.Field.textarea({
7040
+ label: "Note",
7041
+ required: false,
7042
+ readonly: true
7043
+ })
7044
+ },
7045
+ indexes: [
7046
+ { fields: ["organization_id", "occurred_at"] },
7047
+ { fields: ["type", "name", "occurred_at"] },
7048
+ { fields: ["actor", "occurred_at"] },
7049
+ { fields: ["outcome"] }
7050
+ ],
7051
+ enable: {
7052
+ trackHistory: false,
7053
+ searchable: false,
7054
+ apiEnabled: true,
7055
+ apiMethods: ["get", "list"],
7056
+ trash: false
7057
+ }
7058
+ });
6907
7059
  var SysSetting = data.ObjectSchema.create({
6908
7060
  name: "sys_setting",
6909
7061
  label: "Setting",
@@ -7297,6 +7449,9 @@ var SETUP_APP = {
7297
7449
  icon: "settings",
7298
7450
  active: true,
7299
7451
  isDefault: false,
7452
+ // ADR-0010 — core admin UI must not be overlay-edited or deleted.
7453
+ _lock: "full",
7454
+ _lockReason: "Core admin UI shipped by @objectstack/platform-objects \u2014 see ADR-0010.",
7300
7455
  branding: {
7301
7456
  primaryColor: "#475569"
7302
7457
  // Slate-600 — neutral admin palette
@@ -7787,21 +7942,20 @@ var ACCOUNT_APP = {
7787
7942
  // manage their own 2FA / linked accounts / personal OAuth apps. RLS on
7788
7943
  // each object scopes rows to the caller.
7789
7944
  navigation: [
7790
- // Profile is the canonical landing — name, email, avatar, verification
7791
- // status. Uses `type: 'object' + recordId: '{current_user_id}'` so it
7792
- // resolves to the sys_user record page; the slotted SysUserDetailPage
7793
- // (kind: 'slotted', isDefault: true) tailors that page into a proper
7794
- // self-service profile (highlight chips, grouped detail sections, no
7795
- // Discussion thread) without losing the record-context features
7796
- // (related lists, header actions, RLS-aware edit).
7945
+ // Profile is the canonical landing — a hand-written React settings card
7946
+ // (Vercel/Linear style) registered in the Console SPA as
7947
+ // `account:profile_card`. The renderer reads the current user via
7948
+ // `useAuth()` and writes via `client.auth.updateUser`, so there is no
7949
+ // sys_user record context here this is intentional. The admin-facing
7950
+ // sys_user record page (see `pages/sys-user.page.ts`) stays focused on
7951
+ // record browsing (Identity/Audit fields, related lists, admin actions)
7952
+ // and is reached through Setup, never from the Account App.
7797
7953
  {
7798
7954
  id: "nav_account_profile",
7799
- type: "object",
7955
+ type: "component",
7800
7956
  label: "Profile",
7801
- objectName: "sys_user",
7802
- recordId: "{current_user_id}",
7803
- icon: "user-circle",
7804
- requiresObject: "sys_user"
7957
+ componentRef: "account:profile_card",
7958
+ icon: "user-circle"
7805
7959
  },
7806
7960
  // --- Inbox & work assigned to me -----------------------------------
7807
7961
  // Notifications, approvals waiting on me, and the orgs I belong to.
@@ -7905,16 +8059,14 @@ var ACCOUNT_APP = {
7905
8059
  requiresObject: "sys_oauth_application"
7906
8060
  }
7907
8061
  ]
7908
- },
7909
- {
7910
- id: "nav_account_preferences",
7911
- type: "object",
7912
- label: "Preferences",
7913
- objectName: "sys_user_preference",
7914
- viewName: "mine",
7915
- icon: "sliders-horizontal",
7916
- requiresObject: "sys_user_preference"
7917
8062
  }
8063
+ // Note: `sys_user_preference` is intentionally NOT exposed in the
8064
+ // Account App. It's an internal key-value store the UI uses for state
8065
+ // like `ui.recent`, `ui.favorites`, theme, sidebar collapse — not
8066
+ // a user-curatable settings surface. A future
8067
+ // `account:preferences_card` React component should provide the
8068
+ // curated theme / locale / timezone / notifications toggles when we
8069
+ // need them; until then there is no nav entry.
7918
8070
  ]
7919
8071
  };
7920
8072
  var SystemOverviewDashboard = ui.Dashboard.create({
@@ -11133,8 +11285,7 @@ var en = {
11133
11285
  nav_account_linked: { label: "Linked Accounts" },
11134
11286
  nav_account_sessions: { label: "Active Sessions" },
11135
11287
  nav_account_api_keys: { label: "API Keys" },
11136
- nav_account_oauth_apps: { label: "OAuth Applications" },
11137
- nav_account_preferences: { label: "Preferences" }
11288
+ nav_account_oauth_apps: { label: "OAuth Applications" }
11138
11289
  }
11139
11290
  },
11140
11291
  setup: {
@@ -14345,8 +14496,7 @@ var zhCN = {
14345
14496
  nav_account_linked: { label: "\u5DF2\u5173\u8054\u8D26\u6237" },
14346
14497
  nav_account_sessions: { label: "\u6D3B\u52A8\u4F1A\u8BDD" },
14347
14498
  nav_account_api_keys: { label: "API \u5BC6\u94A5" },
14348
- nav_account_oauth_apps: { label: "OAuth \u5E94\u7528" },
14349
- nav_account_preferences: { label: "\u504F\u597D\u8BBE\u7F6E" }
14499
+ nav_account_oauth_apps: { label: "OAuth \u5E94\u7528" }
14350
14500
  }
14351
14501
  },
14352
14502
  setup: {
@@ -17518,8 +17668,7 @@ var jaJP = {
17518
17668
  nav_account_linked: { label: "\u9023\u643A\u30A2\u30AB\u30A6\u30F3\u30C8" },
17519
17669
  nav_account_sessions: { label: "\u30A2\u30AF\u30C6\u30A3\u30D6\u30BB\u30C3\u30B7\u30E7\u30F3" },
17520
17670
  nav_account_api_keys: { label: "API \u30AD\u30FC" },
17521
- nav_account_oauth_apps: { label: "OAuth \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3" },
17522
- nav_account_preferences: { label: "\u74B0\u5883\u8A2D\u5B9A" }
17671
+ nav_account_oauth_apps: { label: "OAuth \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3" }
17523
17672
  }
17524
17673
  },
17525
17674
  setup: {
@@ -20691,8 +20840,7 @@ var esES = {
20691
20840
  nav_account_linked: { label: "Cuentas vinculadas" },
20692
20841
  nav_account_sessions: { label: "Sesiones activas" },
20693
20842
  nav_account_api_keys: { label: "Claves API" },
20694
- nav_account_oauth_apps: { label: "Aplicaciones OAuth" },
20695
- nav_account_preferences: { label: "Preferencias" }
20843
+ nav_account_oauth_apps: { label: "Aplicaciones OAuth" }
20696
20844
  }
20697
20845
  },
20698
20846
  setup: {
@@ -26016,6 +26164,7 @@ exports.SysJobRun = SysJobRun;
26016
26164
  exports.SysJwks = SysJwks;
26017
26165
  exports.SysMember = SysMember;
26018
26166
  exports.SysMetadata = SysMetadataObject;
26167
+ exports.SysMetadataAuditObject = SysMetadataAuditObject;
26019
26168
  exports.SysMetadataHistoryObject = SysMetadataHistoryObject;
26020
26169
  exports.SysMetadataObject = SysMetadataObject;
26021
26170
  exports.SysNotification = SysNotification;