@htilabs/platform-common-models 0.21.0 → 0.23.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.
- package/dist/authz/index.cjs +539 -0
- package/dist/authz/index.cjs.map +1 -0
- package/dist/authz/index.d.cts +210 -0
- package/dist/authz/index.d.ts +210 -0
- package/dist/authz/index.js +507 -0
- package/dist/authz/index.js.map +1 -0
- package/dist/constants/index.d.cts +2 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/cvcs/index.cjs +936 -243
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +986 -254
- package/dist/cvcs/index.d.ts +986 -254
- package/dist/cvcs/index.js +936 -243
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +37 -10
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +42 -15
- package/dist/enums/index.d.ts +42 -15
- package/dist/enums/index.js +37 -10
- package/dist/enums/index.js.map +1 -1
- package/dist/{platform-auth-CvAYFVhK.d.cts → ic-DpKrdgQP.d.cts} +1 -78
- package/dist/{platform-auth-CvAYFVhK.d.ts → ic-DpKrdgQP.d.ts} +1 -78
- package/dist/index.cjs +1328 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1313 -253
- package/dist/index.js.map +1 -1
- package/dist/platform-auth-B49Ly57B.d.cts +78 -0
- package/dist/platform-auth-B49Ly57B.d.ts +78 -0
- package/dist/schemas/index.cjs +104 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +240 -1
- package/dist/schemas/index.d.ts +240 -1
- package/dist/schemas/index.js +95 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -1
- package/src/__sot__/README.md +3 -0
- package/src/__sot__/adminRoles.pin.json +122 -0
- package/src/__sot__/adminRoles.published.json +77 -0
- package/src/__sot__/coreFunctionFields.ts +137 -0
- package/src/__sot__/coreFunctions.pin.json +1659 -0
- package/src/__sot__/coreFunctions.published.json +233 -0
- package/src/__sot__/roleFields.ts +137 -0
- package/src/__sot__/userRoles.pin.json +174 -0
- package/src/__sot__/userRoles.published.json +103 -0
- package/src/__tests__/__snapshots__/cvc-sot.snap +6 -6
- package/src/__tests__/admin-roles-canon.test.ts +80 -0
- package/src/__tests__/authz-resolve.test.ts +712 -0
- package/src/__tests__/core-functions-canon.test.ts +358 -24
- package/src/__tests__/cvc-sot-snapshot.test.ts +17 -6
- package/src/__tests__/cvc-status-parser.test.ts +2 -2
- package/src/__tests__/cvc-structural.test.ts +3 -3
- package/src/__tests__/organization-program.test.ts +254 -0
- package/src/__tests__/role-vocab-gate.ts +279 -0
- package/src/__tests__/user-roles-canon.test.ts +104 -0
- package/src/authz/index.ts +9 -0
- package/src/authz/resolveEffectiveFunctions.ts +454 -0
- package/src/cvcs/adminRoles.v2.0.0.json +197 -0
- package/src/cvcs/{coreFunctions.v1.1.0.json → coreFunctions.v1.3.0.json} +646 -90
- package/src/cvcs/index.ts +3 -3
- package/src/cvcs/userRoles.v2.0.0.json +296 -0
- package/src/generated/coreFunctionsEvaluable.ts +101 -0
- package/src/generated/cvc-enums.ts +42 -15
- package/src/index.ts +4 -0
- package/src/schemas/index.ts +18 -0
- package/src/schemas/organization-program.ts +297 -0
- package/src/cvcs/adminRoles.v1.0.0.json +0 -153
- package/src/cvcs/userRoles.v1.0.0.json +0 -203
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
// src/constants/platform-auth.ts
|
|
2
|
+
var PERMISSION_STATE = {
|
|
3
|
+
/** Role can always perform this function (mandatory, cannot disable). */
|
|
4
|
+
ALWAYS: "ALWAYS",
|
|
5
|
+
/** Default On — user can opt off. */
|
|
6
|
+
PREF_YES: "PREF_YES",
|
|
7
|
+
/** Default Off — user can opt in. */
|
|
8
|
+
PREF_NO: "PREF_NO",
|
|
9
|
+
/** Role is explicitly barred from this function. */
|
|
10
|
+
NEVER: "NEVER"
|
|
11
|
+
};
|
|
12
|
+
var PERMISSION_STATE_VALUES = [
|
|
13
|
+
PERMISSION_STATE.ALWAYS,
|
|
14
|
+
PERMISSION_STATE.PREF_YES,
|
|
15
|
+
PERMISSION_STATE.PREF_NO,
|
|
16
|
+
PERMISSION_STATE.NEVER
|
|
17
|
+
];
|
|
18
|
+
var PERMISSION_STATE_LABELS = {
|
|
19
|
+
[PERMISSION_STATE.ALWAYS]: "Always",
|
|
20
|
+
[PERMISSION_STATE.PREF_YES]: "Default On",
|
|
21
|
+
[PERMISSION_STATE.PREF_NO]: "Default Off",
|
|
22
|
+
[PERMISSION_STATE.NEVER]: "Never"
|
|
23
|
+
};
|
|
24
|
+
var PERMISSION_STATE_DISPLAY = {
|
|
25
|
+
[PERMISSION_STATE.ALWAYS]: {
|
|
26
|
+
label: "Always",
|
|
27
|
+
color: "#2e7d32",
|
|
28
|
+
bgColor: "#e8f5e9",
|
|
29
|
+
icon: "\u{1F512}"
|
|
30
|
+
},
|
|
31
|
+
[PERMISSION_STATE.PREF_YES]: {
|
|
32
|
+
label: "Default On",
|
|
33
|
+
color: "#1565c0",
|
|
34
|
+
bgColor: "#e3f2fd",
|
|
35
|
+
icon: "\u{1F513}"
|
|
36
|
+
},
|
|
37
|
+
[PERMISSION_STATE.PREF_NO]: {
|
|
38
|
+
label: "Default Off",
|
|
39
|
+
color: "#e65100",
|
|
40
|
+
bgColor: "#fff3e0",
|
|
41
|
+
icon: "\u{1F513}"
|
|
42
|
+
},
|
|
43
|
+
[PERMISSION_STATE.NEVER]: {
|
|
44
|
+
label: "Never",
|
|
45
|
+
color: "#c62828",
|
|
46
|
+
bgColor: "#ffebee",
|
|
47
|
+
icon: "\u{1F512}"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var SHARE_VIEW = {
|
|
51
|
+
/** System metadata only (partial access). */
|
|
52
|
+
SYS_INFO: "sys_info",
|
|
53
|
+
/** Full case/record content. */
|
|
54
|
+
ALL: "all",
|
|
55
|
+
/** No data access. */
|
|
56
|
+
NONE: "none"
|
|
57
|
+
};
|
|
58
|
+
var SHARE_VIEW_VALUES = [
|
|
59
|
+
SHARE_VIEW.SYS_INFO,
|
|
60
|
+
SHARE_VIEW.ALL,
|
|
61
|
+
SHARE_VIEW.NONE
|
|
62
|
+
];
|
|
63
|
+
var SHARE_VIEW_LABELS = {
|
|
64
|
+
[SHARE_VIEW.SYS_INFO]: "System Info Only",
|
|
65
|
+
[SHARE_VIEW.ALL]: "Full Content",
|
|
66
|
+
[SHARE_VIEW.NONE]: "No Data Access"
|
|
67
|
+
};
|
|
68
|
+
var PLATFORM_TOOL = {
|
|
69
|
+
PAVE: "PAVE",
|
|
70
|
+
ECHO: "ECHO",
|
|
71
|
+
LEADS: "LEADS",
|
|
72
|
+
THREAD: "THREAD",
|
|
73
|
+
TRAIL: "TRAIL",
|
|
74
|
+
PLATFORM: "PLATFORM"
|
|
75
|
+
};
|
|
76
|
+
var PLATFORM_TOOL_VALUES = [
|
|
77
|
+
PLATFORM_TOOL.PAVE,
|
|
78
|
+
PLATFORM_TOOL.ECHO,
|
|
79
|
+
PLATFORM_TOOL.LEADS,
|
|
80
|
+
PLATFORM_TOOL.THREAD,
|
|
81
|
+
PLATFORM_TOOL.TRAIL,
|
|
82
|
+
PLATFORM_TOOL.PLATFORM
|
|
83
|
+
];
|
|
84
|
+
var PLATFORM_TOOL_LABELS = {
|
|
85
|
+
[PLATFORM_TOOL.PAVE]: "PAVE",
|
|
86
|
+
[PLATFORM_TOOL.ECHO]: "Echo",
|
|
87
|
+
[PLATFORM_TOOL.LEADS]: "LEADS",
|
|
88
|
+
[PLATFORM_TOOL.THREAD]: "Thread",
|
|
89
|
+
[PLATFORM_TOOL.TRAIL]: "Trail",
|
|
90
|
+
[PLATFORM_TOOL.PLATFORM]: "Platform"
|
|
91
|
+
};
|
|
92
|
+
var ROLE_LEVEL = {
|
|
93
|
+
/** User-facing roles (staff, volunteers, practitioners). */
|
|
94
|
+
OPERATIONAL: "operational",
|
|
95
|
+
/** Agency-level admin roles. */
|
|
96
|
+
AGENCY: "agency",
|
|
97
|
+
/** Team-level admin roles. */
|
|
98
|
+
TEAM: "team",
|
|
99
|
+
/** HTI-wide platform admin. */
|
|
100
|
+
PLATFORM: "platform",
|
|
101
|
+
/** External governance/oversight roles. */
|
|
102
|
+
OVERSIGHT: "oversight"
|
|
103
|
+
};
|
|
104
|
+
var ROLE_LEVEL_VALUES = [
|
|
105
|
+
ROLE_LEVEL.OPERATIONAL,
|
|
106
|
+
ROLE_LEVEL.AGENCY,
|
|
107
|
+
ROLE_LEVEL.TEAM,
|
|
108
|
+
ROLE_LEVEL.PLATFORM,
|
|
109
|
+
ROLE_LEVEL.OVERSIGHT
|
|
110
|
+
];
|
|
111
|
+
var ROLE_LEVEL_LABELS = {
|
|
112
|
+
[ROLE_LEVEL.OPERATIONAL]: "Operational",
|
|
113
|
+
[ROLE_LEVEL.AGENCY]: "Agency",
|
|
114
|
+
[ROLE_LEVEL.TEAM]: "Team",
|
|
115
|
+
[ROLE_LEVEL.PLATFORM]: "Platform",
|
|
116
|
+
[ROLE_LEVEL.OVERSIGHT]: "Oversight"
|
|
117
|
+
};
|
|
118
|
+
var FUNCTION_STATUS = {
|
|
119
|
+
NOT_STARTED: "Not started",
|
|
120
|
+
DEFINED_NEW: "Defined; new function",
|
|
121
|
+
DEFINED_EXISTING: "Defined; existing PAVE function",
|
|
122
|
+
FUNCTIONAL: "Functional on all apps",
|
|
123
|
+
FUTURE: "Future function (not v1)"
|
|
124
|
+
};
|
|
125
|
+
var FUNCTION_STATUS_VALUES = [
|
|
126
|
+
FUNCTION_STATUS.NOT_STARTED,
|
|
127
|
+
FUNCTION_STATUS.DEFINED_NEW,
|
|
128
|
+
FUNCTION_STATUS.DEFINED_EXISTING,
|
|
129
|
+
FUNCTION_STATUS.FUNCTIONAL,
|
|
130
|
+
FUNCTION_STATUS.FUTURE
|
|
131
|
+
];
|
|
132
|
+
var FUNCTION_STATUS_LABELS = {
|
|
133
|
+
[FUNCTION_STATUS.NOT_STARTED]: "Not Started",
|
|
134
|
+
[FUNCTION_STATUS.DEFINED_NEW]: "Defined (New)",
|
|
135
|
+
[FUNCTION_STATUS.DEFINED_EXISTING]: "Defined (Existing PAVE)",
|
|
136
|
+
[FUNCTION_STATUS.FUNCTIONAL]: "Functional",
|
|
137
|
+
[FUNCTION_STATUS.FUTURE]: "Future (Not v1)"
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// src/generated/cvc-enums.ts
|
|
141
|
+
var CoreFunctionsKeys = {
|
|
142
|
+
missingness_root: "133-000-000-000-000-000-000",
|
|
143
|
+
unknown: "133-000-000-000-000-000-001",
|
|
144
|
+
anonymous: "133-000-000-000-000-000-002",
|
|
145
|
+
data_not_collected: "133-000-000-000-000-000-003",
|
|
146
|
+
account_suspend: "133-001-000-000-000-000-000",
|
|
147
|
+
aggregate_data_query_generate: "133-002-000-000-000-000-000",
|
|
148
|
+
api_key_manage: "133-003-000-000-000-000-000",
|
|
149
|
+
assessments_conduct: "133-004-000-000-000-000-000",
|
|
150
|
+
audit_anomaly_review: "133-005-000-000-000-000-000",
|
|
151
|
+
audit_log_view_member: "133-006-000-000-000-000-000",
|
|
152
|
+
audit_log_view_team: "133-007-000-000-000-000-000",
|
|
153
|
+
auth_model_manage_platform: "133-008-000-000-000-000-000",
|
|
154
|
+
break_glass: "133-009-000-000-000-000-000",
|
|
155
|
+
case_assign_reassign: "133-010-000-000-000-000-000",
|
|
156
|
+
case_claim: "133-011-000-000-000-000-000",
|
|
157
|
+
case_collaborator_add: "133-012-000-000-000-000-000",
|
|
158
|
+
case_edit: "133-013-000-000-000-000-000",
|
|
159
|
+
case_needs_action_flag_manage: "133-014-000-000-000-000-000",
|
|
160
|
+
case_outcomes_edit: "133-015-000-000-000-000-000",
|
|
161
|
+
case_purge: "133-016-000-000-000-000-000",
|
|
162
|
+
case_reopen: "133-017-000-000-000-000-000",
|
|
163
|
+
case_side_panel_use: "133-018-000-000-000-000-000",
|
|
164
|
+
case_transfer_bulk: "133-019-000-000-000-000-000",
|
|
165
|
+
case_view: "133-020-000-000-000-000-000",
|
|
166
|
+
ci_periodic_review: "133-021-000-000-000-000-000",
|
|
167
|
+
ci_record_purge_or_retire: "133-022-000-000-000-000-000",
|
|
168
|
+
ci_record_validate: "133-023-000-000-000-000-000",
|
|
169
|
+
ci_to_evidence_export_authorize: "133-024-000-000-000-000-000",
|
|
170
|
+
dashboard_approve_shared: "133-025-000-000-000-000-000",
|
|
171
|
+
data_qa_workflow_run: "133-026-000-000-000-000-000",
|
|
172
|
+
deconfliction_alert_acknowledge: "133-027-000-000-000-000-000",
|
|
173
|
+
determination_perform: "133-028-000-000-000-000-000",
|
|
174
|
+
disclose_external: "133-029-000-000-000-000-000",
|
|
175
|
+
disclose_external_request: "133-030-000-000-000-000-000",
|
|
176
|
+
export_deidentified: "133-031-000-000-000-000-000",
|
|
177
|
+
export_disclosure_log_review: "133-032-000-000-000-000-000",
|
|
178
|
+
export_template_config_manage: "133-033-000-000-000-000-000",
|
|
179
|
+
gov_data_quality_review: "133-034-000-000-000-000-000",
|
|
180
|
+
idb_record_create: "133-035-000-000-000-000-000",
|
|
181
|
+
incident_response_remediate: "133-036-000-000-000-000-000",
|
|
182
|
+
investigation_create_claim: "133-037-000-000-000-000-000",
|
|
183
|
+
investigative_database_search: "133-038-000-000-000-000-000",
|
|
184
|
+
lead_create: "133-039-000-000-000-000-000",
|
|
185
|
+
lead_publish: "133-040-000-000-000-000-000",
|
|
186
|
+
magic_link_share_send: "133-041-000-000-000-000-000",
|
|
187
|
+
member_account_report_generate: "133-042-000-000-000-000-000",
|
|
188
|
+
member_onboarding_support: "133-043-000-000-000-000-000",
|
|
189
|
+
open_source_search: "133-044-000-000-000-000-000",
|
|
190
|
+
outbound_share_followup_review: "133-045-000-000-000-000-000",
|
|
191
|
+
person_association_update: "133-046-000-000-000-000-000",
|
|
192
|
+
platform_perm_modify: "133-047-000-000-000-000-000",
|
|
193
|
+
platform_policy_enforcement_manage: "133-048-000-000-000-000-000",
|
|
194
|
+
record_print: "133-049-000-000-000-000-000",
|
|
195
|
+
referral_receive_external: "133-050-000-000-000-000-000",
|
|
196
|
+
referral_receive_internal: "133-051-000-000-000-000-000",
|
|
197
|
+
referral_send_external: "133-052-000-000-000-000-000",
|
|
198
|
+
referral_send_internal: "133-053-000-000-000-000-000",
|
|
199
|
+
reporting_dashboard_config_manage: "133-054-000-000-000-000-000",
|
|
200
|
+
retention_compliance_review: "133-055-000-000-000-000-000",
|
|
201
|
+
roi_submit_manage: "133-056-000-000-000-000-000",
|
|
202
|
+
role_assign: "133-057-000-000-000-000-000",
|
|
203
|
+
roles_accounts_toggle: "133-058-000-000-000-000-000",
|
|
204
|
+
sandbox_environment_manage: "133-059-000-000-000-000-000",
|
|
205
|
+
screening_conduct: "133-060-000-000-000-000-000",
|
|
206
|
+
screening_view: "133-061-000-000-000-000-000",
|
|
207
|
+
security_restrict_apply: "133-062-000-000-000-000-000",
|
|
208
|
+
session_create: "133-063-000-000-000-000-000",
|
|
209
|
+
share_approve: "133-064-000-000-000-000-000",
|
|
210
|
+
share_config: "133-065-000-000-000-000-000",
|
|
211
|
+
share_rule_approve_cross_agency: "133-066-000-000-000-000-000",
|
|
212
|
+
share_vsp_to_le: "133-067-000-000-000-000-000",
|
|
213
|
+
support_ticket_triage: "133-068-000-000-000-000-000",
|
|
214
|
+
system_diagnostics_view: "133-069-000-000-000-000-000",
|
|
215
|
+
team_config_manage: "133-070-000-000-000-000-000",
|
|
216
|
+
team_membership_manage: "133-071-000-000-000-000-000",
|
|
217
|
+
team_workflow_config_manage: "133-072-000-000-000-000-000",
|
|
218
|
+
thread_share_accept: "133-073-000-000-000-000-000",
|
|
219
|
+
thread_share_send: "133-074-000-000-000-000-000",
|
|
220
|
+
training_content_upload: "133-075-000-000-000-000-000",
|
|
221
|
+
training_gate_manage: "133-076-000-000-000-000-000",
|
|
222
|
+
usr_manage: "133-077-000-000-000-000-000",
|
|
223
|
+
note_open_departed_author: "133-078-000-000-000-000-000",
|
|
224
|
+
agency_info_manage: "133-079-000-000-000-000-000",
|
|
225
|
+
srl_manage: "133-080-000-000-000-000-000",
|
|
226
|
+
mandatory_report_send: "133-081-000-000-000-000-000",
|
|
227
|
+
indicator_manual_add: "133-082-000-000-000-000-000",
|
|
228
|
+
message_send: "133-083-000-000-000-000-000",
|
|
229
|
+
workgroup_manage: "133-084-000-000-000-000-000",
|
|
230
|
+
message_moderate: "133-085-000-000-000-000-000",
|
|
231
|
+
announcement_publish: "133-086-000-000-000-000-000",
|
|
232
|
+
supervisee_thread_view: "133-087-000-000-000-000-000",
|
|
233
|
+
case_status_manage: "133-088-000-000-000-000-000",
|
|
234
|
+
enrollment_manage: "133-089-000-000-000-000-000",
|
|
235
|
+
exit_discharge_conduct: "133-090-000-000-000-000-000",
|
|
236
|
+
goals_plan_manage: "133-091-000-000-000-000-000",
|
|
237
|
+
lead_triage_manage: "133-092-000-000-000-000-000",
|
|
238
|
+
milestone_log: "133-093-000-000-000-000-000",
|
|
239
|
+
needs_priorities_conduct: "133-094-000-000-000-000-000",
|
|
240
|
+
profile_domain_edit: "133-095-000-000-000-000-000",
|
|
241
|
+
record_activity_view: "133-096-000-000-000-000-000",
|
|
242
|
+
service_log_manage: "133-097-000-000-000-000-000",
|
|
243
|
+
case_close: "133-098-000-000-000-000-000",
|
|
244
|
+
case_visibility_manage: "133-099-000-000-000-000-000",
|
|
245
|
+
person_merge_manage: "133-100-000-000-000-000-000",
|
|
246
|
+
investigation_session_run: "133-101-000-000-000-000-000",
|
|
247
|
+
lead_route_assign: "133-102-000-000-000-000-000",
|
|
248
|
+
onboarding_config_sign_off: "133-103-000-000-000-000-000",
|
|
249
|
+
hmis_export_generate: "133-104-000-000-000-000-000",
|
|
250
|
+
team_share_narrowing: "133-105-000-000-000-000-000",
|
|
251
|
+
viewing_config_manage: "133-106-000-000-000-000-000",
|
|
252
|
+
network_corpus_access: "133-107-000-000-000-000-000",
|
|
253
|
+
viewing_level_1_search: "133-108-000-000-000-000-000",
|
|
254
|
+
viewing_level_2_autocomplete: "133-109-000-000-000-000-000",
|
|
255
|
+
viewing_level_3_components: "133-110-000-000-000-000-000",
|
|
256
|
+
investigative_request_send: "133-111-000-000-000-000-000",
|
|
257
|
+
deconfliction_unmask: "133-112-000-000-000-000-000",
|
|
258
|
+
share_revoke: "133-113-000-000-000-000-000"
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// src/generated/coreFunctionsEvaluable.ts
|
|
262
|
+
var CORE_FUNCTIONS_EVALUABLE_KEYS = [
|
|
263
|
+
"agency_info_manage",
|
|
264
|
+
"announcement_publish",
|
|
265
|
+
"api_key_manage",
|
|
266
|
+
"assessments_conduct",
|
|
267
|
+
"auth_model_manage_platform",
|
|
268
|
+
"case_assign_reassign",
|
|
269
|
+
"case_claim",
|
|
270
|
+
"case_close",
|
|
271
|
+
"case_collaborator_add",
|
|
272
|
+
"case_edit",
|
|
273
|
+
"case_reopen",
|
|
274
|
+
"case_side_panel_use",
|
|
275
|
+
"case_status_manage",
|
|
276
|
+
"case_transfer_bulk",
|
|
277
|
+
"case_view",
|
|
278
|
+
"case_visibility_manage",
|
|
279
|
+
"ci_periodic_review",
|
|
280
|
+
"ci_record_purge_or_retire",
|
|
281
|
+
"ci_record_validate",
|
|
282
|
+
"ci_to_evidence_export_authorize",
|
|
283
|
+
"deconfliction_alert_acknowledge",
|
|
284
|
+
"deconfliction_unmask",
|
|
285
|
+
"determination_perform",
|
|
286
|
+
"disclose_external_request",
|
|
287
|
+
"enrollment_manage",
|
|
288
|
+
"exit_discharge_conduct",
|
|
289
|
+
"export_deidentified",
|
|
290
|
+
"goals_plan_manage",
|
|
291
|
+
"idb_record_create",
|
|
292
|
+
"indicator_manual_add",
|
|
293
|
+
"investigation_create_claim",
|
|
294
|
+
"investigation_session_run",
|
|
295
|
+
"investigative_database_search",
|
|
296
|
+
"investigative_request_send",
|
|
297
|
+
"lead_create",
|
|
298
|
+
"lead_publish",
|
|
299
|
+
"lead_route_assign",
|
|
300
|
+
"lead_triage_manage",
|
|
301
|
+
"magic_link_share_send",
|
|
302
|
+
"mandatory_report_send",
|
|
303
|
+
"member_account_report_generate",
|
|
304
|
+
"member_onboarding_support",
|
|
305
|
+
"message_moderate",
|
|
306
|
+
"message_send",
|
|
307
|
+
"milestone_log",
|
|
308
|
+
"needs_priorities_conduct",
|
|
309
|
+
"network_corpus_access",
|
|
310
|
+
"note_open_departed_author",
|
|
311
|
+
"onboarding_config_sign_off",
|
|
312
|
+
"open_source_search",
|
|
313
|
+
"person_association_update",
|
|
314
|
+
"person_merge_manage",
|
|
315
|
+
"platform_perm_modify",
|
|
316
|
+
"profile_domain_edit",
|
|
317
|
+
"record_activity_view",
|
|
318
|
+
"record_print",
|
|
319
|
+
"referral_receive_external",
|
|
320
|
+
"referral_receive_internal",
|
|
321
|
+
"referral_send_external",
|
|
322
|
+
"referral_send_internal",
|
|
323
|
+
"roi_submit_manage",
|
|
324
|
+
"role_assign",
|
|
325
|
+
"roles_accounts_toggle",
|
|
326
|
+
"sandbox_environment_manage",
|
|
327
|
+
"screening_conduct",
|
|
328
|
+
"screening_view",
|
|
329
|
+
"service_log_manage",
|
|
330
|
+
"session_create",
|
|
331
|
+
"share_config",
|
|
332
|
+
"share_revoke",
|
|
333
|
+
"share_rule_approve_cross_agency",
|
|
334
|
+
"share_vsp_to_le",
|
|
335
|
+
"srl_manage",
|
|
336
|
+
"supervisee_thread_view",
|
|
337
|
+
"support_ticket_triage",
|
|
338
|
+
"system_diagnostics_view",
|
|
339
|
+
"team_config_manage",
|
|
340
|
+
"team_membership_manage",
|
|
341
|
+
"team_share_narrowing",
|
|
342
|
+
"team_workflow_config_manage",
|
|
343
|
+
"training_gate_manage",
|
|
344
|
+
"usr_manage",
|
|
345
|
+
"viewing_config_manage",
|
|
346
|
+
"viewing_level_1_search",
|
|
347
|
+
"viewing_level_2_autocomplete",
|
|
348
|
+
"viewing_level_3_components"
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
// src/authz/resolveEffectiveFunctions.ts
|
|
352
|
+
var CANON_EVALUABLE = new Set(
|
|
353
|
+
CORE_FUNCTIONS_EVALUABLE_KEYS.filter((k) => Object.hasOwn(CoreFunctionsKeys, k))
|
|
354
|
+
);
|
|
355
|
+
function isCanonEvaluableFunction(code) {
|
|
356
|
+
return CANON_EVALUABLE.has(code);
|
|
357
|
+
}
|
|
358
|
+
var ABSENT = { kind: "absent" };
|
|
359
|
+
var MALFORMED = { kind: "malformed" };
|
|
360
|
+
function isPlainObject(v) {
|
|
361
|
+
if (v === null || typeof v !== "object") return false;
|
|
362
|
+
const proto = Object.getPrototypeOf(v);
|
|
363
|
+
return proto === Object.prototype || proto === null;
|
|
364
|
+
}
|
|
365
|
+
function readContainer(v) {
|
|
366
|
+
if (v === void 0 || v === null) return ABSENT;
|
|
367
|
+
return isPlainObject(v) ? { kind: "map", map: v } : MALFORMED;
|
|
368
|
+
}
|
|
369
|
+
function own(map, key) {
|
|
370
|
+
return Object.hasOwn(map, key) ? map[key] : void 0;
|
|
371
|
+
}
|
|
372
|
+
var STATES = new Set(Object.values(PERMISSION_STATE));
|
|
373
|
+
function readState(map, code) {
|
|
374
|
+
const v = own(map, code);
|
|
375
|
+
if (v === void 0 || v === null) return void 0;
|
|
376
|
+
return typeof v === "string" && STATES.has(v) ? v : "malformed";
|
|
377
|
+
}
|
|
378
|
+
function stringList(v) {
|
|
379
|
+
return Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
380
|
+
}
|
|
381
|
+
function teamValueRestricts(map, code) {
|
|
382
|
+
const gate = readState(map, code);
|
|
383
|
+
return gate !== void 0 && gate !== PERMISSION_STATE.PREF_YES && gate !== PERMISSION_STATE.ALWAYS;
|
|
384
|
+
}
|
|
385
|
+
function compileTeamGate(teamPolicy) {
|
|
386
|
+
const byRole = /* @__PURE__ */ new Map();
|
|
387
|
+
const malformedRoles = /* @__PURE__ */ new Set();
|
|
388
|
+
const policy = readContainer(teamPolicy);
|
|
389
|
+
if (policy.kind === "absent") {
|
|
390
|
+
return { restrictsAll: false, flat: void 0, byRole, malformedRoles };
|
|
391
|
+
}
|
|
392
|
+
if (policy.kind === "malformed") {
|
|
393
|
+
return { restrictsAll: true, flat: void 0, byRole, malformedRoles };
|
|
394
|
+
}
|
|
395
|
+
let restrictsAll = false;
|
|
396
|
+
const functions = readContainer(own(policy.map, "functions"));
|
|
397
|
+
if (functions.kind === "malformed") restrictsAll = true;
|
|
398
|
+
const roles = own(policy.map, "roles");
|
|
399
|
+
if (roles !== void 0 && roles !== null) {
|
|
400
|
+
if (!Array.isArray(roles)) restrictsAll = true;
|
|
401
|
+
else {
|
|
402
|
+
for (const entry of roles) {
|
|
403
|
+
const roleCode = isPlainObject(entry) ? own(entry, "roleCode") : void 0;
|
|
404
|
+
if (!isPlainObject(entry) || typeof roleCode !== "string") {
|
|
405
|
+
restrictsAll = true;
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const overrides = readContainer(own(entry, "overrides"));
|
|
409
|
+
if (overrides.kind === "malformed") malformedRoles.add(roleCode);
|
|
410
|
+
else if (overrides.kind === "map") {
|
|
411
|
+
const list = byRole.get(roleCode) ?? [];
|
|
412
|
+
list.push(overrides.map);
|
|
413
|
+
byRole.set(roleCode, list);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return {
|
|
419
|
+
restrictsAll,
|
|
420
|
+
flat: functions.kind === "map" ? functions.map : void 0,
|
|
421
|
+
byRole,
|
|
422
|
+
malformedRoles
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function teamRestricts(gate, roleCode, code) {
|
|
426
|
+
if (gate.restrictsAll || gate.malformedRoles.has(roleCode)) return true;
|
|
427
|
+
if (gate.flat !== void 0 && teamValueRestricts(gate.flat, code)) return true;
|
|
428
|
+
return (gate.byRole.get(roleCode) ?? []).some((m) => teamValueRestricts(m, code));
|
|
429
|
+
}
|
|
430
|
+
function resolveEffectiveFunctions(input) {
|
|
431
|
+
const raw = input;
|
|
432
|
+
if (!isPlainObject(raw)) return [];
|
|
433
|
+
const roleRows = own(raw, "roles");
|
|
434
|
+
const catalog = own(raw, "functions");
|
|
435
|
+
const assigned = own(raw, "assignedRoleCodes");
|
|
436
|
+
if (!Array.isArray(roleRows) || !Array.isArray(catalog) || !Array.isArray(assigned)) return [];
|
|
437
|
+
const rolesByCode = /* @__PURE__ */ new Map();
|
|
438
|
+
for (const r of roleRows) {
|
|
439
|
+
const code = isPlainObject(r) ? own(r, "code") : void 0;
|
|
440
|
+
if (isPlainObject(r) && typeof code === "string") rolesByCode.set(code, r);
|
|
441
|
+
}
|
|
442
|
+
const heldCodes = [...new Set(assigned)].filter(
|
|
443
|
+
(c) => typeof c === "string" && rolesByCode.has(c)
|
|
444
|
+
);
|
|
445
|
+
if (heldCodes.length === 0) return [];
|
|
446
|
+
const vocabulary = [];
|
|
447
|
+
for (const fn of catalog) {
|
|
448
|
+
if (!isPlainObject(fn)) continue;
|
|
449
|
+
const code = own(fn, "code");
|
|
450
|
+
const retired = own(fn, "retired");
|
|
451
|
+
if (typeof code !== "string" || !isCanonEvaluableFunction(code)) continue;
|
|
452
|
+
if (retired !== void 0 && retired !== false) continue;
|
|
453
|
+
vocabulary.push({ code, tools: stringList(own(fn, "tools")) });
|
|
454
|
+
}
|
|
455
|
+
const agencyAll = readContainer(input.agencyOverrides);
|
|
456
|
+
const team = compileTeamGate(input.teamPolicy);
|
|
457
|
+
const granted = /* @__PURE__ */ new Set();
|
|
458
|
+
for (const roleCode of heldCodes) {
|
|
459
|
+
const role = rolesByCode.get(roleCode);
|
|
460
|
+
const roleTools = new Set(stringList(own(role, "tools")));
|
|
461
|
+
const roleFunctions = readContainer(own(role, "functions"));
|
|
462
|
+
if (roleFunctions.kind === "malformed") continue;
|
|
463
|
+
const agency = agencyAll.kind === "map" ? readContainer(own(agencyAll.map, roleCode)) : agencyAll;
|
|
464
|
+
for (const fn of vocabulary) {
|
|
465
|
+
if (granted.has(fn.code)) continue;
|
|
466
|
+
const listed = roleFunctions.kind === "map" ? readState(roleFunctions.map, fn.code) : void 0;
|
|
467
|
+
const applies = fn.tools.some((t) => roleTools.has(t));
|
|
468
|
+
const tier1 = listed === "malformed" ? PERMISSION_STATE.NEVER : listed ?? (applies ? PERMISSION_STATE.PREF_NO : PERMISSION_STATE.NEVER);
|
|
469
|
+
let state = tier1;
|
|
470
|
+
if (tier1 !== PERMISSION_STATE.ALWAYS && tier1 !== PERMISSION_STATE.NEVER) {
|
|
471
|
+
const override = agency.kind === "malformed" ? "malformed" : agency.kind === "map" ? readState(agency.map, fn.code) : void 0;
|
|
472
|
+
if (override === "malformed") state = PERMISSION_STATE.NEVER;
|
|
473
|
+
else if (override !== void 0) state = override;
|
|
474
|
+
}
|
|
475
|
+
if (state !== PERMISSION_STATE.ALWAYS && state !== PERMISSION_STATE.PREF_YES) continue;
|
|
476
|
+
if (state !== PERMISSION_STATE.ALWAYS && teamRestricts(team, roleCode, fn.code)) continue;
|
|
477
|
+
granted.add(fn.code);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return [...granted].sort();
|
|
481
|
+
}
|
|
482
|
+
function selectActingTeamId(seatTeamIds, verifiedActingTeamId) {
|
|
483
|
+
if (verifiedActingTeamId) return verifiedActingTeamId;
|
|
484
|
+
return seatTeamIds[0] ?? null;
|
|
485
|
+
}
|
|
486
|
+
var VIEWING_LEVEL_FUNCTIONS = [
|
|
487
|
+
["viewing_level_3_components", 3],
|
|
488
|
+
["viewing_level_2_autocomplete", 2],
|
|
489
|
+
["viewing_level_1_search", 1]
|
|
490
|
+
];
|
|
491
|
+
function viewingLevelFromFunctions(effectiveFunctions, teamViewingLevel) {
|
|
492
|
+
const held = new Set(effectiveFunctions);
|
|
493
|
+
const roleLevel = VIEWING_LEVEL_FUNCTIONS.find(([code]) => held.has(code))?.[1] ?? 0;
|
|
494
|
+
return teamViewingLevel == null ? roleLevel : Math.min(roleLevel, teamViewingLevel);
|
|
495
|
+
}
|
|
496
|
+
function resolveEffectiveViewingLevel(input, teamViewingLevel) {
|
|
497
|
+
return viewingLevelFromFunctions(resolveEffectiveFunctions(input), teamViewingLevel);
|
|
498
|
+
}
|
|
499
|
+
export {
|
|
500
|
+
VIEWING_LEVEL_FUNCTIONS,
|
|
501
|
+
isCanonEvaluableFunction,
|
|
502
|
+
resolveEffectiveFunctions,
|
|
503
|
+
resolveEffectiveViewingLevel,
|
|
504
|
+
selectActingTeamId,
|
|
505
|
+
viewingLevelFromFunctions
|
|
506
|
+
};
|
|
507
|
+
//# sourceMappingURL=index.js.map
|