@elevasis/ui 2.41.0 → 2.42.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/api/index.js +4 -6
- package/dist/app/index.css +384 -0
- package/dist/app/index.d.ts +5 -1
- package/dist/app/index.js +17 -26
- package/dist/auth/index.css +659 -0
- package/dist/auth/index.js +19 -5
- package/dist/charts/index.css +533 -0
- package/dist/charts/index.js +18 -14
- package/dist/{chunk-JAN2ZXN5.js → chunk-3MTAHV5M.js} +28535 -18021
- package/dist/{chunk-73EWE2EW.js → chunk-EDVZ3AHA.js} +1 -1
- package/dist/chunk-GMXGDO3I.js +244 -0
- package/dist/{chunk-CXY7FMUM.js → chunk-GUKY77FJ.js} +50 -4
- package/dist/{chunk-TE4P6OSJ.js → chunk-MA7YCY7C.js} +1 -1
- package/dist/{chunk-5JYKCULK.js → chunk-NZ2F5RQ4.js} +44 -2
- package/dist/{chunk-WF7CONXF.js → chunk-OJJK27GC.js} +658 -6
- package/dist/chunk-YEGMSADG.js +1781 -0
- package/dist/components/chat/index.js +1 -2
- package/dist/components/index.css +149 -149
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +13 -36
- package/dist/components/navigation/index.css +659 -0
- package/dist/components/navigation/index.js +25 -3
- package/dist/features/auth/index.js +14 -37
- package/dist/features/clients/index.css +149 -149
- package/dist/features/clients/index.js +13 -36
- package/dist/features/crm/index.js +13 -36
- package/dist/features/dashboard/index.d.ts +5 -1
- package/dist/features/dashboard/index.js +13 -36
- package/dist/features/delivery/index.js +13 -36
- package/dist/features/knowledge/index.css +659 -0
- package/dist/features/knowledge/index.js +25 -247
- package/dist/features/lead-gen/index.d.ts +5 -1
- package/dist/features/lead-gen/index.js +13 -36
- package/dist/features/monitoring/index.js +13 -36
- package/dist/features/monitoring/requests/index.js +19 -149
- package/dist/features/operations/index.d.ts +5 -1
- package/dist/features/operations/index.js +13 -36
- package/dist/features/seo/index.js +1 -4
- package/dist/features/settings/index.js +13 -36
- package/dist/hooks/access/index.css +659 -0
- package/dist/hooks/access/index.js +19 -4
- package/dist/hooks/delivery/index.js +13 -36
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +13 -36
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +5 -1
- package/dist/hooks/published.d.ts +5 -1
- package/dist/hooks/published.js +13 -36
- package/dist/index.d.ts +5 -1
- package/dist/index.js +14 -37
- package/dist/initialization/index.js +1 -1
- package/dist/knowledge/index.css +659 -0
- package/dist/knowledge/index.d.ts +5 -1
- package/dist/knowledge/index.js +25 -15
- package/dist/layout/index.css +659 -0
- package/dist/layout/index.js +24 -9
- package/dist/organization/index.js +13 -36
- package/dist/provider/index.css +384 -0
- package/dist/provider/index.d.ts +5 -1
- package/dist/provider/index.js +18 -21
- package/dist/provider/published.css +533 -0
- package/dist/provider/published.d.ts +5 -1
- package/dist/provider/published.js +18 -16
- package/dist/test-utils/index.js +4 -6
- package/dist/theme/index.js +2 -5
- package/dist/theme/presets/index.js +1 -2
- package/dist/types/index.d.ts +5 -1
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/index.js +1 -3
- package/package.json +3 -3
- package/dist/chunk-3KMDHCAR.js +0 -52
- package/dist/chunk-4DRI3G36.js +0 -1016
- package/dist/chunk-56O7QQE7.js +0 -356
- package/dist/chunk-5EYJ2GIN.js +0 -122
- package/dist/chunk-66U7JOWV.js +0 -425
- package/dist/chunk-6D4LCJ52.js +0 -10
- package/dist/chunk-6ROXVZ3L.js +0 -9
- package/dist/chunk-A2XN6PR2.js +0 -111
- package/dist/chunk-B2DZLPDL.js +0 -39
- package/dist/chunk-CLDCYJQT.js +0 -1
- package/dist/chunk-CTJBPF3Z.js +0 -734
- package/dist/chunk-DT3QYZVU.js +0 -23
- package/dist/chunk-FIMGOWOT.js +0 -3644
- package/dist/chunk-IIMU5YAJ.js +0 -53
- package/dist/chunk-JHVEA5NE.js +0 -133
- package/dist/chunk-L7GXUSCV.js +0 -215
- package/dist/chunk-NYBEU5TE.js +0 -118
- package/dist/chunk-QVQMOQXB.js +0 -1240
- package/dist/chunk-RH5VWWSC.js +0 -624
- package/dist/chunk-RXH4D6TY.js +0 -801
- package/dist/chunk-S4R2ZQS7.js +0 -2131
- package/dist/chunk-TYRUKGGD.js +0 -46
- package/dist/chunk-VAAU2Z3S.js +0 -85
- package/dist/chunk-WLOQ4IBG.js +0 -654
- package/dist/chunk-X4WBGKJQ.js +0 -138
- package/dist/chunk-YPWN2WQ3.js +0 -340
package/dist/chunk-56O7QQE7.js
DELETED
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
import { InitializationContext } from './chunk-6DO4PE3O.js';
|
|
2
|
-
import { useOptionalElevasisSystems, DEFAULT_ORGANIZATION_MODEL } from './chunk-FIMGOWOT.js';
|
|
3
|
-
import { OrganizationContext } from './chunk-DD3CCMCZ.js';
|
|
4
|
-
import { STALE_TIME_DEFAULT } from './chunk-6ROXVZ3L.js';
|
|
5
|
-
import { listAllSystems, getSystem } from './chunk-RH5VWWSC.js';
|
|
6
|
-
import { ElevasisServiceContext } from './chunk-2FTX4WO2.js';
|
|
7
|
-
import { useContext, useMemo } from 'react';
|
|
8
|
-
import { useQuery } from '@tanstack/react-query';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
|
|
11
|
-
// ../core/src/auth/multi-tenancy/permissions.ts
|
|
12
|
-
var PERMISSIONS = {
|
|
13
|
-
ORG_READ: "org.read",
|
|
14
|
-
ORG_MANAGE: "org.manage",
|
|
15
|
-
ORG_DELETE: "org.delete",
|
|
16
|
-
MEMBERS_MANAGE: "members.manage",
|
|
17
|
-
ROLES_MANAGE: "roles.manage",
|
|
18
|
-
SECRETS_MANAGE: "secrets.manage",
|
|
19
|
-
OPERATIONS_READ: "operations.read",
|
|
20
|
-
OPERATIONS_MANAGE: "operations.manage",
|
|
21
|
-
SALES_LEAD_GEN_MANAGE: "sales.lead-gen.manage",
|
|
22
|
-
ACQUISITION_MANAGE: "acquisition.manage",
|
|
23
|
-
PROJECTS_MANAGE: "projects.manage",
|
|
24
|
-
CLIENTS_MANAGE: "clients.manage"
|
|
25
|
-
};
|
|
26
|
-
var PERMISSION_CATALOG = [
|
|
27
|
-
{
|
|
28
|
-
key: "org.read",
|
|
29
|
-
description: "Read organization profile and listings",
|
|
30
|
-
isOrgGrantable: true
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
key: "org.manage",
|
|
34
|
-
description: "Update organization settings",
|
|
35
|
-
isOrgGrantable: false
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
key: "org.delete",
|
|
39
|
-
description: "Delete the organization (owner-only)",
|
|
40
|
-
isOrgGrantable: false
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
key: "members.manage",
|
|
44
|
-
description: "Invite, remove, and reassign roles for members",
|
|
45
|
-
isOrgGrantable: false
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
key: "roles.manage",
|
|
49
|
-
description: "Grant or revoke privileged system roles (owner, admin) within the organization",
|
|
50
|
-
isOrgGrantable: false
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: "secrets.manage",
|
|
54
|
-
description: "Create, update, and delete API keys and credentials",
|
|
55
|
-
isOrgGrantable: false
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
key: "operations.read",
|
|
59
|
-
description: "View executions, sessions, schedules, and command queue",
|
|
60
|
-
isOrgGrantable: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: "operations.manage",
|
|
64
|
-
description: "Run and modify executions, sessions, schedules, queue",
|
|
65
|
-
isOrgGrantable: true
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
key: "sales.lead-gen.manage",
|
|
69
|
-
description: "Operate Lead Gen lists and list-builder workflows",
|
|
70
|
-
isOrgGrantable: true
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
key: "acquisition.manage",
|
|
74
|
-
description: "Create, update, and delete acquisition records (acq_companies, acq_contacts, acq_deals, acq_lists*, acq_content*, acquisition storage files)",
|
|
75
|
-
isOrgGrantable: false
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
key: "projects.manage",
|
|
79
|
-
description: "Create, update, and delete project records (prj_projects, prj_milestones, prj_tasks, prj_notes)",
|
|
80
|
-
isOrgGrantable: false
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
key: "clients.manage",
|
|
84
|
-
description: "Create, update, and delete client hub records (clients, clt_* satellites)",
|
|
85
|
-
isOrgGrantable: false
|
|
86
|
-
}
|
|
87
|
-
];
|
|
88
|
-
new Set(PERMISSION_CATALOG.map((p) => p.key));
|
|
89
|
-
var DEFAULT_ACCESS_ACTION = "view";
|
|
90
|
-
var PLATFORM_ADMIN_ACCESS_KEY = "platform.admin";
|
|
91
|
-
var PLATFORM_ADMIN_ACCESS_KEY_SHORTHAND = "platformAdmin";
|
|
92
|
-
var AccessActionSchema = z.enum(["view", "manage"]);
|
|
93
|
-
var AccessKeyObjectSchema = z.object({
|
|
94
|
-
systemPath: z.string().trim().min(1),
|
|
95
|
-
action: AccessActionSchema.default(DEFAULT_ACCESS_ACTION)
|
|
96
|
-
}).strict();
|
|
97
|
-
var AccessKeyInputSchema = z.union([z.string().trim().min(1), AccessKeyObjectSchema]);
|
|
98
|
-
var NormalizedAccessKeySchema = AccessKeyObjectSchema;
|
|
99
|
-
var DIAGNOSTIC_VIEW_ACCESS_KEYS = [
|
|
100
|
-
"diagnostic.operations.overview",
|
|
101
|
-
"diagnostic.operations.recent-executions",
|
|
102
|
-
"diagnostic.monitoring.execution-logs",
|
|
103
|
-
"diagnostic.monitoring.notifications"
|
|
104
|
-
];
|
|
105
|
-
var AccessKeys = {
|
|
106
|
-
platformAdmin: { systemPath: PLATFORM_ADMIN_ACCESS_KEY, action: DEFAULT_ACCESS_ACTION },
|
|
107
|
-
organizationManage: { systemPath: "permission.org", action: "manage" },
|
|
108
|
-
membersManage: { systemPath: "permission.members", action: "manage" },
|
|
109
|
-
rolesManage: { systemPath: "permission.roles", action: "manage" },
|
|
110
|
-
secretsManage: { systemPath: "permission.secrets", action: "manage" },
|
|
111
|
-
operationsRead: { systemPath: "permission.operations", action: DEFAULT_ACCESS_ACTION },
|
|
112
|
-
operationsManage: { systemPath: "permission.operations", action: "manage" },
|
|
113
|
-
leadGenManage: { systemPath: "sales.lead-gen", action: "manage" },
|
|
114
|
-
acquisitionManage: { systemPath: "permission.acquisition", action: "manage" },
|
|
115
|
-
projectsManage: { systemPath: "permission.projects", action: "manage" },
|
|
116
|
-
clientsManage: { systemPath: "permission.clients", action: "manage" },
|
|
117
|
-
operationsOverview: { systemPath: "diagnostic.operations.overview", action: DEFAULT_ACCESS_ACTION },
|
|
118
|
-
operationsRecentExecutions: { systemPath: "diagnostic.operations.recent-executions", action: DEFAULT_ACCESS_ACTION },
|
|
119
|
-
monitoringExecutionLogs: { systemPath: "diagnostic.monitoring.execution-logs", action: DEFAULT_ACCESS_ACTION },
|
|
120
|
-
monitoringNotifications: { systemPath: "diagnostic.monitoring.notifications", action: DEFAULT_ACCESS_ACTION }
|
|
121
|
-
};
|
|
122
|
-
var PERMISSION_ACCESS_KEY_DEFINITIONS = [
|
|
123
|
-
{ key: AccessKeys.organizationManage, rolePermission: PERMISSIONS.ORG_MANAGE },
|
|
124
|
-
{ key: AccessKeys.membersManage, rolePermission: PERMISSIONS.MEMBERS_MANAGE },
|
|
125
|
-
{ key: AccessKeys.rolesManage, rolePermission: PERMISSIONS.ROLES_MANAGE },
|
|
126
|
-
{ key: AccessKeys.secretsManage, rolePermission: PERMISSIONS.SECRETS_MANAGE },
|
|
127
|
-
{ key: AccessKeys.operationsRead, rolePermission: PERMISSIONS.OPERATIONS_READ },
|
|
128
|
-
{ key: AccessKeys.operationsManage, rolePermission: PERMISSIONS.OPERATIONS_MANAGE },
|
|
129
|
-
{ key: AccessKeys.acquisitionManage, rolePermission: PERMISSIONS.ACQUISITION_MANAGE },
|
|
130
|
-
{ key: AccessKeys.projectsManage, rolePermission: PERMISSIONS.PROJECTS_MANAGE },
|
|
131
|
-
{ key: AccessKeys.clientsManage, rolePermission: PERMISSIONS.CLIENTS_MANAGE }
|
|
132
|
-
];
|
|
133
|
-
function normalizeAccessKey(input) {
|
|
134
|
-
const parsed = AccessKeyInputSchema.parse(input);
|
|
135
|
-
const normalized = typeof parsed === "string" ? {
|
|
136
|
-
systemPath: parsed === PLATFORM_ADMIN_ACCESS_KEY_SHORTHAND ? PLATFORM_ADMIN_ACCESS_KEY : parsed,
|
|
137
|
-
action: DEFAULT_ACCESS_ACTION
|
|
138
|
-
} : parsed;
|
|
139
|
-
return NormalizedAccessKeySchema.parse(normalized);
|
|
140
|
-
}
|
|
141
|
-
function rolePermissionForAccessKey(key) {
|
|
142
|
-
if (key.action === DEFAULT_ACCESS_ACTION) return void 0;
|
|
143
|
-
return `${key.systemPath}.${key.action}`;
|
|
144
|
-
}
|
|
145
|
-
function groupCatalogEntries(entries) {
|
|
146
|
-
const grouped = /* @__PURE__ */ new Map();
|
|
147
|
-
for (const entry of entries) {
|
|
148
|
-
const existing = grouped.get(entry.key.systemPath) ?? [];
|
|
149
|
-
existing.push(entry);
|
|
150
|
-
grouped.set(entry.key.systemPath, existing);
|
|
151
|
-
}
|
|
152
|
-
return grouped;
|
|
153
|
-
}
|
|
154
|
-
function buildCatalogEntry(systemPath, action, source) {
|
|
155
|
-
const key = normalizeAccessKey({ systemPath, action });
|
|
156
|
-
return {
|
|
157
|
-
key,
|
|
158
|
-
source,
|
|
159
|
-
rolePermission: rolePermissionForAccessKey(key)
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function deriveAccessKeyCatalog(organizationModel, options = {}) {
|
|
163
|
-
const { diagnosticKeys = DIAGNOSTIC_VIEW_ACCESS_KEYS, includeManageActions = true } = options;
|
|
164
|
-
const entries = [
|
|
165
|
-
buildCatalogEntry(PLATFORM_ADMIN_ACCESS_KEY, DEFAULT_ACCESS_ACTION, "platform")
|
|
166
|
-
];
|
|
167
|
-
for (const { path } of listAllSystems(organizationModel)) {
|
|
168
|
-
entries.push(buildCatalogEntry(path, DEFAULT_ACCESS_ACTION, "om-system"));
|
|
169
|
-
if (includeManageActions) {
|
|
170
|
-
entries.push(buildCatalogEntry(path, "manage", "om-system"));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
for (const { key, rolePermission } of PERMISSION_ACCESS_KEY_DEFINITIONS) {
|
|
174
|
-
entries.push({
|
|
175
|
-
key,
|
|
176
|
-
source: "permission",
|
|
177
|
-
rolePermission
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
for (const systemPath of diagnosticKeys) {
|
|
181
|
-
entries.push(buildCatalogEntry(systemPath, DEFAULT_ACCESS_ACTION, "diagnostic"));
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
bySystemPath: groupCatalogEntries(entries),
|
|
185
|
-
entries
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function findAccessCatalogEntry(catalog, key) {
|
|
189
|
-
return catalog.bySystemPath.get(key.systemPath)?.find((entry) => entry.key.action === key.action);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// ../core/src/auth/access-model.ts
|
|
193
|
-
var ALLOWED = { allowed: true, restrictedBy: null, reason: "allowed" };
|
|
194
|
-
var PLATFORM_ADMIN_BYPASS = {
|
|
195
|
-
allowed: true,
|
|
196
|
-
restrictedBy: null,
|
|
197
|
-
reason: "platform-admin-bypass"
|
|
198
|
-
};
|
|
199
|
-
function deny(restrictedBy, reason) {
|
|
200
|
-
return { allowed: false, restrictedBy, reason };
|
|
201
|
-
}
|
|
202
|
-
function isPlatformAdmin(profile) {
|
|
203
|
-
return profile?.isPlatformAdmin === true || profile?.is_platform_admin === true;
|
|
204
|
-
}
|
|
205
|
-
function diagnosticAllowlistHas(allowlist, systemPath) {
|
|
206
|
-
if (allowlist === void 0) return false;
|
|
207
|
-
return "has" in allowlist ? allowlist.has(systemPath) : allowlist.includes(systemPath);
|
|
208
|
-
}
|
|
209
|
-
function lifecycleAllowsAccess(lifecycle, ctx) {
|
|
210
|
-
if (lifecycle === "active") return true;
|
|
211
|
-
if (lifecycle === "beta") return ctx.betaAccessEnabled === true || ctx.isDevelopment === true;
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
function getPermissionSource(ctx) {
|
|
215
|
-
return ctx.permissions ?? ctx.membership?.effectivePermissions;
|
|
216
|
-
}
|
|
217
|
-
function hasRequiredPermission(key, rolePermission, ctx) {
|
|
218
|
-
const permissionSource = getPermissionSource(ctx);
|
|
219
|
-
if (permissionSource === void 0 || permissionSource === null) return true;
|
|
220
|
-
const requiredPermission = rolePermission ?? `${key.systemPath}.${key.action}`;
|
|
221
|
-
return permissionSource.includes(requiredPermission);
|
|
222
|
-
}
|
|
223
|
-
function hasExplicitRequiredPermission(rolePermission, ctx) {
|
|
224
|
-
const permissionSource = getPermissionSource(ctx);
|
|
225
|
-
return rolePermission !== void 0 && permissionSource !== void 0 && permissionSource !== null ? permissionSource.includes(rolePermission) : false;
|
|
226
|
-
}
|
|
227
|
-
function checkAccess(input, ctx) {
|
|
228
|
-
if (isPlatformAdmin(ctx.profile)) return PLATFORM_ADMIN_BYPASS;
|
|
229
|
-
const parsed = (() => {
|
|
230
|
-
try {
|
|
231
|
-
return normalizeAccessKey(input);
|
|
232
|
-
} catch {
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
})();
|
|
236
|
-
if (parsed === null) return deny("catalog", "invalid-access-key");
|
|
237
|
-
const catalog = ctx.accessCatalog ?? deriveAccessKeyCatalog(ctx.organizationModel);
|
|
238
|
-
const catalogEntry = findAccessCatalogEntry(catalog, parsed);
|
|
239
|
-
if (catalogEntry === void 0) return deny("catalog", "unknown-access-key");
|
|
240
|
-
const membership = ctx.membership;
|
|
241
|
-
if (membership === void 0 || membership === null) return deny("membership", "missing-membership");
|
|
242
|
-
if (membership.organizationId !== ctx.organizationId) return deny("membership", "organization-mismatch");
|
|
243
|
-
if (parsed.systemPath === PLATFORM_ADMIN_ACCESS_KEY) {
|
|
244
|
-
return deny("role-permission", "role-permission-denied");
|
|
245
|
-
}
|
|
246
|
-
if (catalogEntry.source === "diagnostic") {
|
|
247
|
-
if (!diagnosticAllowlistHas(ctx.diagnosticAllowlist, parsed.systemPath)) {
|
|
248
|
-
return deny("diagnostic-allowlist", "diagnostic-key-not-allowed");
|
|
249
|
-
}
|
|
250
|
-
if (parsed.action !== DEFAULT_ACCESS_ACTION && !hasRequiredPermission(parsed, catalogEntry.rolePermission, ctx)) {
|
|
251
|
-
return deny("role-permission", "role-permission-denied");
|
|
252
|
-
}
|
|
253
|
-
return ALLOWED;
|
|
254
|
-
}
|
|
255
|
-
if (catalogEntry.source === "permission") {
|
|
256
|
-
if (!hasExplicitRequiredPermission(catalogEntry.rolePermission, ctx)) {
|
|
257
|
-
return deny("role-permission", "role-permission-denied");
|
|
258
|
-
}
|
|
259
|
-
return ALLOWED;
|
|
260
|
-
}
|
|
261
|
-
const system = getSystem(ctx.organizationModel, parsed.systemPath);
|
|
262
|
-
if (system === void 0 || !lifecycleAllowsAccess(system.lifecycle, ctx)) {
|
|
263
|
-
return deny("system-lifecycle", "system-not-active");
|
|
264
|
-
}
|
|
265
|
-
if (parsed.action !== DEFAULT_ACCESS_ACTION && !hasRequiredPermission(parsed, catalogEntry.rolePermission, ctx)) {
|
|
266
|
-
return deny("role-permission", "role-permission-denied");
|
|
267
|
-
}
|
|
268
|
-
return ALLOWED;
|
|
269
|
-
}
|
|
270
|
-
function createAccessModel(organizationModel) {
|
|
271
|
-
const catalog = deriveAccessKeyCatalog(organizationModel);
|
|
272
|
-
return {
|
|
273
|
-
catalog,
|
|
274
|
-
checkAccess: (key, ctx) => checkAccess(key, { ...ctx, organizationModel, accessCatalog: catalog })
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// src/hooks/access/useAccess.ts
|
|
279
|
-
var MISSING_CONTEXT_ANSWER = {
|
|
280
|
-
allowed: false,
|
|
281
|
-
restrictedBy: "membership",
|
|
282
|
-
reason: "missing-membership"
|
|
283
|
-
};
|
|
284
|
-
function readStringArray(value) {
|
|
285
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : void 0;
|
|
286
|
-
}
|
|
287
|
-
function membershipPermissions(membership) {
|
|
288
|
-
if (!membership || typeof membership !== "object") return void 0;
|
|
289
|
-
const record = membership;
|
|
290
|
-
return readStringArray(record.effectivePermissions) ?? readStringArray(record.effective_permissions);
|
|
291
|
-
}
|
|
292
|
-
function resolveOrganizationId(organization) {
|
|
293
|
-
const membership = organization?.currentMembership;
|
|
294
|
-
return organization?.currentSupabaseOrganizationId ?? membership?.organizationId ?? membership?.organization?.id ?? null;
|
|
295
|
-
}
|
|
296
|
-
function toAccessMembership(membership, organizationId, permissions) {
|
|
297
|
-
if (!membership || !organizationId) return null;
|
|
298
|
-
return {
|
|
299
|
-
id: membership.id,
|
|
300
|
-
organizationId: membership.organizationId ?? organizationId,
|
|
301
|
-
role: membership.role?.slug ?? null,
|
|
302
|
-
effectivePermissions: permissions
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
function useAccess(key) {
|
|
306
|
-
const initialization = useContext(InitializationContext);
|
|
307
|
-
const organization = useContext(OrganizationContext);
|
|
308
|
-
const services = useContext(ElevasisServiceContext);
|
|
309
|
-
const systems = useOptionalElevasisSystems();
|
|
310
|
-
const profile = initialization?.profile ?? null;
|
|
311
|
-
const isPlatformAdmin2 = profile?.is_platform_admin === true;
|
|
312
|
-
const organizationId = resolveOrganizationId(organization);
|
|
313
|
-
const membership = organization?.currentMembership ?? null;
|
|
314
|
-
const organizationModel = systems?.organizationModel ?? DEFAULT_ORGANIZATION_MODEL;
|
|
315
|
-
const permissionsFromMembership = useMemo(() => membershipPermissions(membership), [membership]);
|
|
316
|
-
const shouldFetchPermissions = Boolean(services?.isReady && organizationId && !isPlatformAdmin2);
|
|
317
|
-
const permissionsQuery = useQuery({
|
|
318
|
-
// eslint-disable-next-line @tanstack/query/exhaustive-deps -- services.apiRequest is a stable context fn, not cache-relevant; query is keyed by organizationId
|
|
319
|
-
queryKey: ["access-permissions", organizationId],
|
|
320
|
-
queryFn: () => services.apiRequest(`/memberships/my-permissions/${organizationId}`),
|
|
321
|
-
enabled: shouldFetchPermissions,
|
|
322
|
-
staleTime: STALE_TIME_DEFAULT
|
|
323
|
-
});
|
|
324
|
-
const permissions = useMemo(
|
|
325
|
-
() => isPlatformAdmin2 ? Object.values(PERMISSIONS) : permissionsQuery.data?.permissions ?? permissionsFromMembership ?? [],
|
|
326
|
-
[isPlatformAdmin2, permissionsFromMembership, permissionsQuery.data?.permissions]
|
|
327
|
-
);
|
|
328
|
-
const accessMembership = useMemo(
|
|
329
|
-
() => toAccessMembership(membership, organizationId, permissions),
|
|
330
|
-
[membership, organizationId, permissions]
|
|
331
|
-
);
|
|
332
|
-
const accessModel = useMemo(() => createAccessModel(organizationModel), [organizationModel]);
|
|
333
|
-
const answer = useMemo(() => {
|
|
334
|
-
if (!organizationId && !isPlatformAdmin2) return MISSING_CONTEXT_ANSWER;
|
|
335
|
-
return accessModel.checkAccess(key, {
|
|
336
|
-
organizationId: organizationId ?? "",
|
|
337
|
-
organizationModel,
|
|
338
|
-
membership: accessMembership,
|
|
339
|
-
profile,
|
|
340
|
-
permissions,
|
|
341
|
-
diagnosticAllowlist: DIAGNOSTIC_VIEW_ACCESS_KEYS,
|
|
342
|
-
isDevelopment: import.meta.env?.DEV ?? false
|
|
343
|
-
});
|
|
344
|
-
}, [accessMembership, accessModel, isPlatformAdmin2, key, organizationId, organizationModel, permissions, profile]);
|
|
345
|
-
const providerReady = initialization?.organizationReady ?? Boolean(organizationId && accessMembership && systems?.organizationModel);
|
|
346
|
-
const permissionsReady = !shouldFetchPermissions || !permissionsQuery.isPending;
|
|
347
|
-
const isReady = isPlatformAdmin2 ? initialization?.userReady ?? true : providerReady && permissionsReady;
|
|
348
|
-
return {
|
|
349
|
-
...answer,
|
|
350
|
-
isReady,
|
|
351
|
-
isPlatformAdmin: isPlatformAdmin2,
|
|
352
|
-
permissions
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
export { AccessKeys, useAccess };
|
package/dist/chunk-5EYJ2GIN.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
// src/features/operations/organization-graph/types.ts
|
|
2
|
-
var ORGANIZATION_GRAPH_NODE_KIND_ORDER = [
|
|
3
|
-
"organization",
|
|
4
|
-
"system",
|
|
5
|
-
"role",
|
|
6
|
-
"action",
|
|
7
|
-
"entity",
|
|
8
|
-
"event",
|
|
9
|
-
"policy",
|
|
10
|
-
"stage",
|
|
11
|
-
"resource",
|
|
12
|
-
"knowledge",
|
|
13
|
-
"customer-segment",
|
|
14
|
-
"offering",
|
|
15
|
-
"goal",
|
|
16
|
-
"surface",
|
|
17
|
-
"navigation-group",
|
|
18
|
-
"ontology"
|
|
19
|
-
];
|
|
20
|
-
var ORGANIZATION_GRAPH_NODE_KIND_LABELS = {
|
|
21
|
-
organization: "Organization",
|
|
22
|
-
system: "System",
|
|
23
|
-
role: "Role",
|
|
24
|
-
action: "Action",
|
|
25
|
-
entity: "Entity",
|
|
26
|
-
event: "Event",
|
|
27
|
-
policy: "Policy",
|
|
28
|
-
stage: "Stage",
|
|
29
|
-
resource: "Resource",
|
|
30
|
-
knowledge: "Knowledge",
|
|
31
|
-
"customer-segment": "Customer segment",
|
|
32
|
-
offering: "Offering",
|
|
33
|
-
goal: "Goal",
|
|
34
|
-
surface: "Surface",
|
|
35
|
-
"navigation-group": "Navigation group",
|
|
36
|
-
ontology: "Ontology"
|
|
37
|
-
};
|
|
38
|
-
var ORGANIZATION_GRAPH_NODE_KIND_DETAIL_LABELS = {
|
|
39
|
-
organization: "Organization root",
|
|
40
|
-
system: "System",
|
|
41
|
-
role: "Role",
|
|
42
|
-
action: "Action",
|
|
43
|
-
entity: "Entity",
|
|
44
|
-
event: "Event",
|
|
45
|
-
policy: "Policy",
|
|
46
|
-
stage: "Stage",
|
|
47
|
-
resource: "Resource",
|
|
48
|
-
knowledge: "Knowledge",
|
|
49
|
-
"customer-segment": "Customer segment",
|
|
50
|
-
offering: "Offering",
|
|
51
|
-
goal: "Goal",
|
|
52
|
-
surface: "Surface",
|
|
53
|
-
"navigation-group": "Navigation group",
|
|
54
|
-
ontology: "Ontology record"
|
|
55
|
-
};
|
|
56
|
-
var ORGANIZATION_GRAPH_NODE_KIND_MEANINGS = {
|
|
57
|
-
organization: "The root of the shared organization model and the parent for every derived node.",
|
|
58
|
-
system: "A canonical Organization Model system for ownership, routing, and governance.",
|
|
59
|
-
role: "An Organization Model role that owns responsibilities and may govern systems.",
|
|
60
|
-
action: "A reusable action that can be attached to a system.",
|
|
61
|
-
entity: "A modeled business object or stateful data domain owned by the organization model.",
|
|
62
|
-
event: "A derived domain or runtime event emitted by entities, resources, or actions.",
|
|
63
|
-
policy: "A governance rule that applies to targets and may trigger effects across the graph.",
|
|
64
|
-
stage: "A lifecycle stage that records progress for an entity through a build pipeline.",
|
|
65
|
-
resource: "A concrete command-view or mapped resource that bridges execution topology into the model.",
|
|
66
|
-
knowledge: "An operational knowledge node that documents a process, strategy, or runbook in the org model.",
|
|
67
|
-
"customer-segment": "A defined segment of customers or prospects that the organization targets or serves.",
|
|
68
|
-
offering: "A product, service, or value proposition the organization delivers to customer segments.",
|
|
69
|
-
goal: "A strategic or operational objective that guides priorities and measures progress.",
|
|
70
|
-
surface: "A navigation surface (page or view) that is exposed through the platform shell.",
|
|
71
|
-
"navigation-group": "A logical grouping of navigation surfaces within the platform shell.",
|
|
72
|
-
ontology: "A compiled ontology record such as an object, action, catalog, value type, surface, or resource binding."
|
|
73
|
-
};
|
|
74
|
-
var ORGANIZATION_GRAPH_EDGE_KIND_LABELS = {
|
|
75
|
-
contains: "Containment",
|
|
76
|
-
references: "Reference",
|
|
77
|
-
maps_to: "Mapping",
|
|
78
|
-
uses: "Uses",
|
|
79
|
-
governs: "Governs",
|
|
80
|
-
links: "Links",
|
|
81
|
-
affects: "Affects",
|
|
82
|
-
emits: "Emits",
|
|
83
|
-
originates_from: "Originates from",
|
|
84
|
-
triggers: "Triggers",
|
|
85
|
-
approval: "Approval",
|
|
86
|
-
applies_to: "Applies to",
|
|
87
|
-
effects: "Effects",
|
|
88
|
-
actions: "Actions",
|
|
89
|
-
reads: "Reads",
|
|
90
|
-
writes: "Writes",
|
|
91
|
-
uses_catalog: "Uses catalog"
|
|
92
|
-
};
|
|
93
|
-
var ORGANIZATION_GRAPH_EDGE_KIND_MEANINGS = {
|
|
94
|
-
contains: "A hierarchy or ownership link inside the shared graph.",
|
|
95
|
-
references: "A semantic association or dependency between two graph nodes.",
|
|
96
|
-
maps_to: "An action is aligned to a concrete resource.",
|
|
97
|
-
uses: "A graph node depends on another node, resource, entity, or integration.",
|
|
98
|
-
governs: "A knowledge node, role, or policy provides authoritative guidance for another node.",
|
|
99
|
-
links: "Two modeled nodes are associated without stronger ownership or execution semantics.",
|
|
100
|
-
affects: "The source can influence the behavior, state, or outcome of the target.",
|
|
101
|
-
emits: "The source produces an event that can be inspected or traversed.",
|
|
102
|
-
originates_from: "The source is derived from or owned by the target origin.",
|
|
103
|
-
triggers: "The source can start or activate the target.",
|
|
104
|
-
approval: "The source requests or participates in an approval path.",
|
|
105
|
-
applies_to: "A policy or rule targets the node it applies to.",
|
|
106
|
-
effects: "A policy or event produces the target effect.",
|
|
107
|
-
actions: "The source is bound to the target ontology action contract.",
|
|
108
|
-
reads: "The source reads data described by the target ontology record.",
|
|
109
|
-
writes: "The source writes data described by the target ontology record.",
|
|
110
|
-
uses_catalog: "The source uses the target ontology catalog."
|
|
111
|
-
};
|
|
112
|
-
var DEFAULT_ORGANIZATION_GRAPH_FILTERS = {
|
|
113
|
-
search: "",
|
|
114
|
-
nodeKinds: [],
|
|
115
|
-
topologyPresence: "all",
|
|
116
|
-
environmentStatus: "all",
|
|
117
|
-
resourceTypes: [],
|
|
118
|
-
showIntegrations: true,
|
|
119
|
-
domainFilters: {}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export { DEFAULT_ORGANIZATION_GRAPH_FILTERS, ORGANIZATION_GRAPH_EDGE_KIND_LABELS, ORGANIZATION_GRAPH_EDGE_KIND_MEANINGS, ORGANIZATION_GRAPH_NODE_KIND_DETAIL_LABELS, ORGANIZATION_GRAPH_NODE_KIND_LABELS, ORGANIZATION_GRAPH_NODE_KIND_MEANINGS, ORGANIZATION_GRAPH_NODE_KIND_ORDER };
|