-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsys-oauth-client-resource.object.ts
More file actions
77 lines (68 loc) · 2.12 KB
/
Copy pathsys-oauth-client-resource.object.ts
File metadata and controls
77 lines (68 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { ObjectSchema, Field } from '@objectstack/spec/data';
/**
* sys_oauth_client_resource — Client ↔ protected-resource grant
*
* Backed by `@better-auth/oauth-provider`'s `oauthClientResource` model
* (better-auth ≥ 1.7). Join table allowing a registered client to request
* tokens for a registered resource (RFC 8707). A missing row means the
* client is not authorized for that audience.
*
* @namespace sys
*/
export const SysOauthClientResource = ObjectSchema.create({
name: 'sys_oauth_client_resource',
label: 'OAuth Client Resource',
pluralLabel: 'OAuth Client Resources',
icon: 'link',
isSystem: true,
managedBy: 'better-auth',
// ADR-0010 §3.7 — managed by better-auth; tenants may not edit schema,
// but may add overlay row-level config. Use `no-overlay` if you need to
// forbid sys_metadata overlays entirely.
protection: {
lock: 'full',
reason: 'Identity table managed by better-auth — see ADR-0010.',
docsUrl: 'https://docs.objectstack.ai/adr/0010-metadata-protection',
},
description: 'Grants allowing an OAuth client to request tokens for a protected resource',
highlightFields: ['client_id', 'resource_id'],
fields: {
id: Field.text({
label: 'ID',
required: true,
readonly: true,
}),
client_id: Field.text({
label: 'Client ID',
required: true,
description: 'Foreign key to sys_oauth_application.client_id',
}),
resource_id: Field.text({
label: 'Resource ID',
required: true,
maxLength: 1024,
description: 'Foreign key to sys_oauth_resource.identifier',
}),
metadata: Field.textarea({
label: 'Metadata',
required: false,
description: 'JSON object of additional grant metadata',
}),
created_at: Field.datetime({
label: 'Created At',
defaultValue: 'NOW()',
readonly: true,
}),
},
indexes: [
{ fields: ['client_id'] },
{ fields: ['resource_id'] },
],
enable: {
trackHistory: false,
searchable: false,
apiEnabled: false,
apiMethods: [],
},
});