@objectstack/platform-objects 6.5.1 → 6.7.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.
@@ -421,6 +421,30 @@ var SysAccount = ObjectSchema.create({
421
421
  description: "OAuth and authentication provider accounts",
422
422
  titleFormat: "{provider_id} - {account_id}",
423
423
  compactLayout: ["provider_id", "user_id", "account_id"],
424
+ // Custom actions — sysadmins routinely need to revoke a user's OAuth
425
+ // link (e.g. when an SSO provider is decommissioned or the user
426
+ // requests it). Better-auth exposes `/unlink-account { providerId,
427
+ // accountId }` for this. The form is locked to the row's values so
428
+ // it acts as a one-click confirmation rather than a free-form edit.
429
+ actions: [
430
+ {
431
+ name: "unlink_account",
432
+ label: "Unlink Account",
433
+ icon: "unlink",
434
+ variant: "danger",
435
+ mode: "delete",
436
+ locations: ["list_item", "record_header"],
437
+ type: "api",
438
+ target: "/api/v1/auth/unlink-account",
439
+ confirmText: "Unlink this identity link? The user will no longer be able to sign in with this provider until they re-link it from their account settings.",
440
+ successMessage: "Identity link removed",
441
+ refreshAfter: true,
442
+ params: [
443
+ { name: "providerId", field: "provider_id", defaultFromRow: true, required: true },
444
+ { name: "accountId", field: "account_id", defaultFromRow: true, required: true }
445
+ ]
446
+ }
447
+ ],
424
448
  listViews: {
425
449
  mine: {
426
450
  type: "grid",
@@ -1975,6 +1999,96 @@ var SysOauthApplication = ObjectSchema.create({
1975
1999
  displayNameField: "name",
1976
2000
  titleFormat: "{name}",
1977
2001
  compactLayout: ["name", "client_id", "type", "disabled"],
2002
+ // Custom actions — all OAuth-application mutations are routed through
2003
+ // better-auth's `@better-auth/oauth-provider` endpoints (and a thin
2004
+ // ObjectStack-added auth route for the enable/disable toggle) rather
2005
+ // than the generic data layer, so server-side validation, secret
2006
+ // hashing, and audit hooks all run. The generic `delete` API method
2007
+ // is intentionally dropped from `apiMethods` below so the only delete
2008
+ // path is the better-auth wrapper.
2009
+ //
2010
+ // Upstream gap (better-auth 1.6.11): the stock `/admin/oauth2/update-client`
2011
+ // endpoint's Zod body schema does NOT accept the `disabled` flag, even
2012
+ // though the column exists and the runtime honours it. We bridge the
2013
+ // gap with `POST /api/v1/auth/admin/oauth2/toggle-disabled`, registered
2014
+ // by plugin-auth, which writes through better-auth's own adapter under
2015
+ // the auth namespace (no generic data-layer bypass). When upstream
2016
+ // ships `disabled` support, retarget the enable/disable actions and
2017
+ // delete the bridge route.
2018
+ actions: [
2019
+ {
2020
+ name: "disable_oauth_application",
2021
+ label: "Disable OAuth Application",
2022
+ icon: "pause-circle",
2023
+ variant: "secondary",
2024
+ mode: "custom",
2025
+ locations: ["list_item", "record_header"],
2026
+ type: "api",
2027
+ method: "POST",
2028
+ target: "/api/v1/auth/admin/oauth2/toggle-disabled",
2029
+ confirmText: "Disable this OAuth application? Active access/refresh tokens issued to it will continue to be rejected at the token, authorize, and introspect endpoints. Existing integrations will stop working immediately.",
2030
+ successMessage: "OAuth application disabled",
2031
+ refreshAfter: true,
2032
+ visible: "!record.disabled",
2033
+ bodyExtra: { disabled: true },
2034
+ params: [
2035
+ { name: "client_id", field: "client_id", defaultFromRow: true, required: true }
2036
+ ]
2037
+ },
2038
+ {
2039
+ name: "enable_oauth_application",
2040
+ label: "Enable OAuth Application",
2041
+ icon: "play-circle",
2042
+ variant: "primary",
2043
+ mode: "custom",
2044
+ locations: ["list_item", "record_header"],
2045
+ type: "api",
2046
+ method: "POST",
2047
+ target: "/api/v1/auth/admin/oauth2/toggle-disabled",
2048
+ confirmText: "Re-enable this OAuth application? Token issuance, authorization, and introspection will resume immediately.",
2049
+ successMessage: "OAuth application enabled",
2050
+ refreshAfter: true,
2051
+ visible: "record.disabled",
2052
+ bodyExtra: { disabled: false },
2053
+ params: [
2054
+ { name: "client_id", field: "client_id", defaultFromRow: true, required: true }
2055
+ ]
2056
+ },
2057
+ {
2058
+ name: "rotate_client_secret",
2059
+ label: "Rotate Client Secret",
2060
+ icon: "refresh-cw",
2061
+ variant: "secondary",
2062
+ mode: "custom",
2063
+ locations: ["list_item", "record_header"],
2064
+ type: "api",
2065
+ method: "POST",
2066
+ target: "/api/v1/auth/oauth2/client/rotate-secret",
2067
+ confirmText: "Rotate this OAuth client's secret? The previous secret will stop working immediately and any integrations using it will break until they are updated with the new secret. The new secret is shown only once.",
2068
+ successMessage: "Client secret rotated \u2014 copy the new value from the response now.",
2069
+ refreshAfter: true,
2070
+ params: [
2071
+ { name: "client_id", field: "client_id", defaultFromRow: true, required: true }
2072
+ ]
2073
+ },
2074
+ {
2075
+ name: "delete_oauth_application",
2076
+ label: "Delete OAuth Application",
2077
+ icon: "trash-2",
2078
+ variant: "danger",
2079
+ mode: "delete",
2080
+ locations: ["list_item", "record_header"],
2081
+ type: "api",
2082
+ method: "POST",
2083
+ target: "/api/v1/auth/oauth2/delete-client",
2084
+ confirmText: "Permanently delete this OAuth application? All issued tokens and consents will be invalidated and integrations using this client_id will stop working immediately. This cannot be undone.",
2085
+ successMessage: "OAuth application deleted",
2086
+ refreshAfter: true,
2087
+ params: [
2088
+ { name: "client_id", field: "client_id", defaultFromRow: true, required: true }
2089
+ ]
2090
+ }
2091
+ ],
1978
2092
  listViews: {
1979
2093
  active: {
1980
2094
  type: "grid",
@@ -2206,7 +2320,12 @@ var SysOauthApplication = ObjectSchema.create({
2206
2320
  trackHistory: true,
2207
2321
  searchable: true,
2208
2322
  apiEnabled: true,
2209
- apiMethods: ["get", "list", "delete"],
2323
+ // All mutations (create/update/delete) must go through better-auth's
2324
+ // oauth-provider endpoints under /api/v1/auth/{admin/,}oauth2/* — the
2325
+ // generic data layer is read-only for this object so sysadmins cannot
2326
+ // bypass server-side OAuth validation. The Delete row action above is
2327
+ // wired to /api/v1/auth/oauth2/delete-client.
2328
+ apiMethods: ["get", "list"],
2210
2329
  trash: false,
2211
2330
  mru: false
2212
2331
  }