identityscope 0.0.0-stage → 0.28.4

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 (333) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +916 -2
  3. package/SECURITY.md +56 -0
  4. package/dist/core/audit-readiness.d.ts +158 -0
  5. package/dist/core/audit-readiness.js +357 -0
  6. package/dist/core/audit-readiness.js.map +1 -0
  7. package/dist/core/certs.d.ts +68 -0
  8. package/dist/core/certs.js +132 -0
  9. package/dist/core/certs.js.map +1 -0
  10. package/dist/core/checks.d.ts +133 -0
  11. package/dist/core/checks.js +512 -0
  12. package/dist/core/checks.js.map +1 -0
  13. package/dist/core/cloud-rules.d.ts +20 -0
  14. package/dist/core/cloud-rules.js +44 -0
  15. package/dist/core/cloud-rules.js.map +1 -0
  16. package/dist/core/compare.d.ts +45 -0
  17. package/dist/core/compare.js +372 -0
  18. package/dist/core/compare.js.map +1 -0
  19. package/dist/core/conditions.d.ts +10 -0
  20. package/dist/core/conditions.js +201 -0
  21. package/dist/core/conditions.js.map +1 -0
  22. package/dist/core/credentials.d.ts +71 -0
  23. package/dist/core/credentials.js +211 -0
  24. package/dist/core/credentials.js.map +1 -0
  25. package/dist/core/datasets.d.ts +53 -0
  26. package/dist/core/datasets.js +596 -0
  27. package/dist/core/datasets.js.map +1 -0
  28. package/dist/core/definition.d.ts +32 -0
  29. package/dist/core/definition.js +301 -0
  30. package/dist/core/definition.js.map +1 -0
  31. package/dist/core/discover.d.ts +32 -0
  32. package/dist/core/discover.js +105 -0
  33. package/dist/core/discover.js.map +1 -0
  34. package/dist/core/engine.d.ts +18 -0
  35. package/dist/core/engine.js +290 -0
  36. package/dist/core/engine.js.map +1 -0
  37. package/dist/core/fields.d.ts +16 -0
  38. package/dist/core/fields.js +132 -0
  39. package/dist/core/fields.js.map +1 -0
  40. package/dist/core/governance-trail.d.ts +211 -0
  41. package/dist/core/governance-trail.js +557 -0
  42. package/dist/core/governance-trail.js.map +1 -0
  43. package/dist/core/http-transport.d.ts +66 -0
  44. package/dist/core/http-transport.js +247 -0
  45. package/dist/core/http-transport.js.map +1 -0
  46. package/dist/core/index.d.ts +13 -0
  47. package/dist/core/index.js +16 -0
  48. package/dist/core/index.js.map +1 -0
  49. package/dist/core/insights.d.ts +176 -0
  50. package/dist/core/insights.js +417 -0
  51. package/dist/core/insights.js.map +1 -0
  52. package/dist/core/joiner-evidence.d.ts +98 -0
  53. package/dist/core/joiner-evidence.js +254 -0
  54. package/dist/core/joiner-evidence.js.map +1 -0
  55. package/dist/core/lab/credential-map.d.ts +50 -0
  56. package/dist/core/lab/credential-map.js +163 -0
  57. package/dist/core/lab/credential-map.js.map +1 -0
  58. package/dist/core/lab/javadate.d.ts +7 -0
  59. package/dist/core/lab/javadate.js +307 -0
  60. package/dist/core/lab/javadate.js.map +1 -0
  61. package/dist/core/lab/jsonpath.d.ts +11 -0
  62. package/dist/core/lab/jsonpath.js +273 -0
  63. package/dist/core/lab/jsonpath.js.map +1 -0
  64. package/dist/core/lab/policy-preview.d.ts +43 -0
  65. package/dist/core/lab/policy-preview.js +78 -0
  66. package/dist/core/lab/policy-preview.js.map +1 -0
  67. package/dist/core/lab/rfc5646.d.ts +2 -0
  68. package/dist/core/lab/rfc5646.js +421 -0
  69. package/dist/core/lab/rfc5646.js.map +1 -0
  70. package/dist/core/lab/transform-impact.d.ts +63 -0
  71. package/dist/core/lab/transform-impact.js +138 -0
  72. package/dist/core/lab/transform-impact.js.map +1 -0
  73. package/dist/core/lab/transform-people.d.ts +61 -0
  74. package/dist/core/lab/transform-people.js +132 -0
  75. package/dist/core/lab/transform-people.js.map +1 -0
  76. package/dist/core/lab/transforms.d.ts +79 -0
  77. package/dist/core/lab/transforms.js +738 -0
  78. package/dist/core/lab/transforms.js.map +1 -0
  79. package/dist/core/lab/velocity.d.ts +33 -0
  80. package/dist/core/lab/velocity.js +874 -0
  81. package/dist/core/lab/velocity.js.map +1 -0
  82. package/dist/core/lab/workflow-health.d.ts +80 -0
  83. package/dist/core/lab/workflow-health.js +234 -0
  84. package/dist/core/lab/workflow-health.js.map +1 -0
  85. package/dist/core/lab/workflows.d.ts +87 -0
  86. package/dist/core/lab/workflows.js +568 -0
  87. package/dist/core/lab/workflows.js.map +1 -0
  88. package/dist/core/lifecycle-gaps.d.ts +192 -0
  89. package/dist/core/lifecycle-gaps.js +389 -0
  90. package/dist/core/lifecycle-gaps.js.map +1 -0
  91. package/dist/core/logs.d.ts +145 -0
  92. package/dist/core/logs.js +342 -0
  93. package/dist/core/logs.js.map +1 -0
  94. package/dist/core/lookup.d.ts +129 -0
  95. package/dist/core/lookup.js +289 -0
  96. package/dist/core/lookup.js.map +1 -0
  97. package/dist/core/model-insights.d.ts +247 -0
  98. package/dist/core/model-insights.js +474 -0
  99. package/dist/core/model-insights.js.map +1 -0
  100. package/dist/core/narrow.d.ts +23 -0
  101. package/dist/core/narrow.js +137 -0
  102. package/dist/core/narrow.js.map +1 -0
  103. package/dist/core/nerm.d.ts +154 -0
  104. package/dist/core/nerm.js +397 -0
  105. package/dist/core/nerm.js.map +1 -0
  106. package/dist/core/operations-watch.d.ts +232 -0
  107. package/dist/core/operations-watch.js +491 -0
  108. package/dist/core/operations-watch.js.map +1 -0
  109. package/dist/core/output/csv.d.ts +6 -0
  110. package/dist/core/output/csv.js +22 -0
  111. package/dist/core/output/csv.js.map +1 -0
  112. package/dist/core/output/html.d.ts +11 -0
  113. package/dist/core/output/html.js +66 -0
  114. package/dist/core/output/html.js.map +1 -0
  115. package/dist/core/output/xlsx.d.ts +3 -0
  116. package/dist/core/output/xlsx.js +130 -0
  117. package/dist/core/output/xlsx.js.map +1 -0
  118. package/dist/core/output/zip.d.ts +16 -0
  119. package/dist/core/output/zip.js +106 -0
  120. package/dist/core/output/zip.js.map +1 -0
  121. package/dist/core/ownership.d.ts +39 -0
  122. package/dist/core/ownership.js +100 -0
  123. package/dist/core/ownership.js.map +1 -0
  124. package/dist/core/patterns.d.ts +11 -0
  125. package/dist/core/patterns.js +31 -0
  126. package/dist/core/patterns.js.map +1 -0
  127. package/dist/core/preview.d.ts +96 -0
  128. package/dist/core/preview.js +173 -0
  129. package/dist/core/preview.js.map +1 -0
  130. package/dist/core/roles.d.ts +125 -0
  131. package/dist/core/roles.js +420 -0
  132. package/dist/core/roles.js.map +1 -0
  133. package/dist/core/tenant.d.ts +67 -0
  134. package/dist/core/tenant.js +194 -0
  135. package/dist/core/tenant.js.map +1 -0
  136. package/dist/core/threat-signals.d.ts +112 -0
  137. package/dist/core/threat-signals.js +250 -0
  138. package/dist/core/threat-signals.js.map +1 -0
  139. package/dist/core/threat-watch.d.ts +144 -0
  140. package/dist/core/threat-watch.js +282 -0
  141. package/dist/core/threat-watch.js.map +1 -0
  142. package/dist/core/transport.d.ts +82 -0
  143. package/dist/core/transport.js +312 -0
  144. package/dist/core/transport.js.map +1 -0
  145. package/dist/core/types.d.ts +137 -0
  146. package/dist/core/types.js +10 -0
  147. package/dist/core/types.js.map +1 -0
  148. package/dist/core/warnings.d.ts +236 -0
  149. package/dist/core/warnings.js +504 -0
  150. package/dist/core/warnings.js.map +1 -0
  151. package/dist/demo/tenant.d.ts +1572 -0
  152. package/dist/demo/tenant.js +1023 -0
  153. package/dist/demo/tenant.js.map +1 -0
  154. package/dist/node/attribute-history.d.ts +22 -0
  155. package/dist/node/attribute-history.js +86 -0
  156. package/dist/node/attribute-history.js.map +1 -0
  157. package/dist/node/changes.d.ts +20 -0
  158. package/dist/node/changes.js +78 -0
  159. package/dist/node/changes.js.map +1 -0
  160. package/dist/node/cli.d.ts +2 -0
  161. package/dist/node/cli.js +291 -0
  162. package/dist/node/cli.js.map +1 -0
  163. package/dist/node/config.d.ts +72 -0
  164. package/dist/node/config.js +203 -0
  165. package/dist/node/config.js.map +1 -0
  166. package/dist/node/credentials.d.ts +13 -0
  167. package/dist/node/credentials.js +24 -0
  168. package/dist/node/credentials.js.map +1 -0
  169. package/dist/node/delivery.d.ts +10 -0
  170. package/dist/node/delivery.js +105 -0
  171. package/dist/node/delivery.js.map +1 -0
  172. package/dist/node/doctor.d.ts +2 -0
  173. package/dist/node/doctor.js +151 -0
  174. package/dist/node/doctor.js.map +1 -0
  175. package/dist/node/drift.d.ts +31 -0
  176. package/dist/node/drift.js +56 -0
  177. package/dist/node/drift.js.map +1 -0
  178. package/dist/node/evidence.d.ts +42 -0
  179. package/dist/node/evidence.js +129 -0
  180. package/dist/node/evidence.js.map +1 -0
  181. package/dist/node/exceptions.d.ts +30 -0
  182. package/dist/node/exceptions.js +83 -0
  183. package/dist/node/exceptions.js.map +1 -0
  184. package/dist/node/history.d.ts +35 -0
  185. package/dist/node/history.js +74 -0
  186. package/dist/node/history.js.map +1 -0
  187. package/dist/node/index.d.ts +7 -0
  188. package/dist/node/index.js +8 -0
  189. package/dist/node/index.js.map +1 -0
  190. package/dist/node/keep.d.ts +9 -0
  191. package/dist/node/keep.js +39 -0
  192. package/dist/node/keep.js.map +1 -0
  193. package/dist/node/loader.d.ts +7 -0
  194. package/dist/node/loader.js +35 -0
  195. package/dist/node/loader.js.map +1 -0
  196. package/dist/node/log-files.d.ts +16 -0
  197. package/dist/node/log-files.js +93 -0
  198. package/dist/node/log-files.js.map +1 -0
  199. package/dist/node/monthly.d.ts +41 -0
  200. package/dist/node/monthly.js +108 -0
  201. package/dist/node/monthly.js.map +1 -0
  202. package/dist/node/oauth-login.d.ts +45 -0
  203. package/dist/node/oauth-login.js +121 -0
  204. package/dist/node/oauth-login.js.map +1 -0
  205. package/dist/node/packs.d.ts +32 -0
  206. package/dist/node/packs.js +43 -0
  207. package/dist/node/packs.js.map +1 -0
  208. package/dist/node/privileged-seen.d.ts +11 -0
  209. package/dist/node/privileged-seen.js +41 -0
  210. package/dist/node/privileged-seen.js.map +1 -0
  211. package/dist/node/recipients.d.ts +17 -0
  212. package/dist/node/recipients.js +51 -0
  213. package/dist/node/recipients.js.map +1 -0
  214. package/dist/node/runner.d.ts +51 -0
  215. package/dist/node/runner.js +298 -0
  216. package/dist/node/runner.js.map +1 -0
  217. package/dist/node/runtime.d.ts +12 -0
  218. package/dist/node/runtime.js +13 -0
  219. package/dist/node/runtime.js.map +1 -0
  220. package/dist/node/schedules.d.ts +87 -0
  221. package/dist/node/schedules.js +141 -0
  222. package/dist/node/schedules.js.map +1 -0
  223. package/dist/node/secrets.d.ts +37 -0
  224. package/dist/node/secrets.js +219 -0
  225. package/dist/node/secrets.js.map +1 -0
  226. package/dist/node/support.d.ts +14 -0
  227. package/dist/node/support.js +133 -0
  228. package/dist/node/support.js.map +1 -0
  229. package/dist/node/tenants.d.ts +93 -0
  230. package/dist/node/tenants.js +255 -0
  231. package/dist/node/tenants.js.map +1 -0
  232. package/dist/node/ui-page.d.ts +1 -0
  233. package/dist/node/ui-page.js +3 -0
  234. package/dist/node/ui-page.js.map +1 -0
  235. package/dist/node/ui-server.d.ts +48 -0
  236. package/dist/node/ui-server.js +2665 -0
  237. package/dist/node/ui-server.js.map +1 -0
  238. package/dist/node/write.d.ts +9 -0
  239. package/dist/node/write.js +53 -0
  240. package/dist/node/write.js.map +1 -0
  241. package/dist/reports/builtin.generated.d.ts +1 -0
  242. package/dist/reports/builtin.generated.js +49 -0
  243. package/dist/reports/builtin.generated.js.map +1 -0
  244. package/dist/reports/library.d.ts +6 -0
  245. package/dist/reports/library.js +18 -0
  246. package/dist/reports/library.js.map +1 -0
  247. package/launcher/IdentityScope.cmd +11 -0
  248. package/package.json +69 -4
  249. package/reports/access-profile-members.yaml +29 -0
  250. package/reports/access-profile-membership-counts.yaml +17 -0
  251. package/reports/access-profiles-without-owner.yaml +16 -0
  252. package/reports/access-request-audit-trail.yaml +36 -0
  253. package/reports/accounts-by-source.yaml +19 -0
  254. package/reports/active-identities-without-manager.yaml +22 -0
  255. package/reports/aggregation-failures.yaml +29 -0
  256. package/reports/aggregation-history.yaml +27 -0
  257. package/reports/all-sources.yaml +16 -0
  258. package/reports/application-accounts.yaml +32 -0
  259. package/reports/application-entitlements.yaml +31 -0
  260. package/reports/campaign-progress.yaml +23 -0
  261. package/reports/certification-decisions.yaml +31 -0
  262. package/reports/direct-reports-per-manager.yaml +20 -0
  263. package/reports/disabled-accounts-of-active-people.yaml +33 -0
  264. package/reports/duplicate-emails.yaml +16 -0
  265. package/reports/entitlement-holders.yaml +35 -0
  266. package/reports/entitlements-held-by-inactive-identities.yaml +31 -0
  267. package/reports/entitlements-without-owner.yaml +28 -0
  268. package/reports/identities-by-lifecycle-state.yaml +15 -0
  269. package/reports/identities-missing-key-attributes.yaml +27 -0
  270. package/reports/identities-with-processing-errors.yaml +19 -0
  271. package/reports/identity-attribute-mappings.yaml +27 -0
  272. package/reports/machine-accounts.yaml +28 -0
  273. package/reports/managers-and-direct-reports.yaml +23 -0
  274. package/reports/most-access.yaml +18 -0
  275. package/reports/new-identities.yaml +24 -0
  276. package/reports/old-passwords.yaml +35 -0
  277. package/reports/pending-reviews-by-reviewer.yaml +20 -0
  278. package/reports/person-access.yaml +31 -0
  279. package/reports/privileged-access.yaml +29 -0
  280. package/reports/provisioning-error-causes.yaml +27 -0
  281. package/reports/provisioning-errors.yaml +32 -0
  282. package/reports/provisioning-failures.yaml +28 -0
  283. package/reports/recent-access-requests.yaml +22 -0
  284. package/reports/recent-activity.yaml +32 -0
  285. package/reports/recent-leavers.yaml +34 -0
  286. package/reports/role-members.yaml +29 -0
  287. package/reports/role-membership-counts.yaml +18 -0
  288. package/reports/roles-without-owner.yaml +17 -0
  289. package/reports/sources-needing-attention.yaml +23 -0
  290. package/reports/stuck-access-requests.yaml +29 -0
  291. package/reports/team-access.yaml +30 -0
  292. package/reports/terminated-users-with-active-accounts.yaml +46 -0
  293. package/reports/uncorrelated-accounts.yaml +38 -0
  294. package/ui/js/00-setup.js +6 -0
  295. package/ui/js/01-small-helpers.js +143 -0
  296. package/ui/js/02-connection.js +150 -0
  297. package/ui/js/03-health-check.js +17 -0
  298. package/ui/js/04-library.js +135 -0
  299. package/ui/js/05-pickers.js +163 -0
  300. package/ui/js/06-report-view.js +157 -0
  301. package/ui/js/07-fields.js +85 -0
  302. package/ui/js/08-designer.js +360 -0
  303. package/ui/js/09-yaml.js +22 -0
  304. package/ui/js/10-instant-check.js +171 -0
  305. package/ui/js/11-lookup.js +161 -0
  306. package/ui/js/12-tenant.js +115 -0
  307. package/ui/js/13-source-configuration-and-diagnostics.js +64 -0
  308. package/ui/js/14-certifications.js +68 -0
  309. package/ui/js/15-monthly-report.js +24 -0
  310. package/ui/js/16-ownership.js +39 -0
  311. package/ui/js/17-compare-tenants.js +102 -0
  312. package/ui/js/18-audit.js +181 -0
  313. package/ui/js/19-insights.js +108 -0
  314. package/ui/js/20-role-mining.js +35 -0
  315. package/ui/js/21-share-reports.js +45 -0
  316. package/ui/js/22-partner-overview-all-customer-tenants.js +228 -0
  317. package/ui/js/23-in-app-guidance.js +217 -0
  318. package/ui/js/24-role-tools.js +220 -0
  319. package/ui/js/25-schedules.js +264 -0
  320. package/ui/js/26-start.js +7 -0
  321. package/ui/js/27-warnings.js +224 -0
  322. package/ui/js/28-audit-readiness.js +99 -0
  323. package/ui/js/29-lifecycle.js +182 -0
  324. package/ui/js/30-labs.js +265 -0
  325. package/ui/js/31-build.js +203 -0
  326. package/ui/js/32-lab-examples.js +148 -0
  327. package/ui/js/33-finder.js +89 -0
  328. package/ui/js/34-governance.js +129 -0
  329. package/ui/js/35-watch.js +266 -0
  330. package/ui/js/36-model.js +247 -0
  331. package/ui/js/37-logs-and-watch.js +224 -0
  332. package/ui/shell.html +112 -0
  333. package/ui/style.css +350 -0
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Where each transform is used, before you change it: identity profile
3
+ * mappings, other transforms (followed through chains of references) and
4
+ * source provisioning policies, with how many people each identity profile
5
+ * covers. Also lists transforms nothing uses. Read-only.
6
+ */
7
+ import { pageList } from '../transport.js';
8
+ import { readMappings, readTransforms } from './transform-people.js';
9
+ /** Names (or ids) of the transforms a definition refers to with "reference". */
10
+ export function referencesIn(def, out = new Set()) {
11
+ if (Array.isArray(def)) {
12
+ for (const x of def)
13
+ referencesIn(x, out);
14
+ }
15
+ else if (def && typeof def === 'object') {
16
+ const o = def;
17
+ if (o['type'] === 'reference') {
18
+ const id = o['attributes']?.['id'];
19
+ if (typeof id === 'string')
20
+ out.add(id);
21
+ }
22
+ for (const v of Object.values(o))
23
+ referencesIn(v, out);
24
+ }
25
+ return out;
26
+ }
27
+ /** Every use of each transform, following chains. Pure: for tests and for the server. */
28
+ export function impactFrom(transforms, definitions, people) {
29
+ const all = [
30
+ ...transforms.map((t) => ({ kind: 'Transform', where: String(t['name'] ?? t['id']), def: { type: t['type'], attributes: t['attributes'] } })),
31
+ ...definitions,
32
+ ];
33
+ const refs = all.map((d) => referencesIn(d.def));
34
+ const keyOf = (t) => [String(t['name'] ?? ''), String(t['id'] ?? '')].filter(Boolean);
35
+ const out = [];
36
+ for (const t of transforms) {
37
+ const name = String(t['name'] ?? t['id']);
38
+ // Breadth first: names that lead to this transform, each with the chain that got there.
39
+ const chains = new Map(keyOf(t).map((k) => [k, []]));
40
+ const uses = [];
41
+ const seen = new Set();
42
+ let frontier = [...chains.keys()];
43
+ for (let depth = 0; frontier.length && depth < 20; depth++) {
44
+ const next = [];
45
+ all.forEach((d, i) => {
46
+ if (seen.has(i) || (d.kind === 'Transform' && d.where === name))
47
+ return;
48
+ const hit = frontier.find((k) => refs[i].has(k));
49
+ if (hit === undefined)
50
+ return;
51
+ seen.add(i);
52
+ const via = chains.get(hit);
53
+ uses.push({ kind: d.kind, where: d.where, detail: d.detail, via, profileId: d.profileId, sourceId: d.sourceId });
54
+ if (d.kind === 'Transform') {
55
+ const user = transforms.find((x) => String(x['name'] ?? x['id']) === d.where);
56
+ for (const k of user ? keyOf(user) : [d.where]) {
57
+ if (!chains.has(k)) {
58
+ chains.set(k, [d.where, ...via]);
59
+ next.push(k);
60
+ }
61
+ }
62
+ }
63
+ });
64
+ frontier = next;
65
+ }
66
+ const profileIds = [...new Set(uses.filter((u) => u.profileId).map((u) => u.profileId))];
67
+ const counts = profileIds.map((id) => people.get(id));
68
+ out.push({
69
+ name,
70
+ id: String(t['id'] ?? ''),
71
+ type: String(t['type'] ?? ''),
72
+ uses: uses.sort((a, b) => a.via.length - b.via.length || a.kind.localeCompare(b.kind) || a.where.localeCompare(b.where)),
73
+ direct: uses.filter((u) => !u.via.length).length,
74
+ people: counts.some((c) => c === null || c === undefined) ? null : counts.reduce((s, c) => s + (c ?? 0), 0),
75
+ });
76
+ }
77
+ out.sort((a, b) => a.name.localeCompare(b.name));
78
+ return { transforms: out, unused: out.filter((x) => !x.uses.length).map((x) => x.name) };
79
+ }
80
+ export async function readPolicies(t, sourceId) {
81
+ const r = await t.request({ method: 'GET', path: `/sources/v1/${encodeURIComponent(sourceId)}/provisioning-policies` });
82
+ return Array.isArray(r.data) ? r.data : [];
83
+ }
84
+ async function peopleIn(t, profileId) {
85
+ try {
86
+ const r = await t.request({ method: 'POST', path: '/search/v1', query: { limit: 1, count: true }, body: { indices: ['identities'], query: { query: `identityProfile.id:"${profileId}"` }, includeNested: false } });
87
+ const n = Number(r.headers['x-total-count']);
88
+ return Number.isFinite(n) ? n : null;
89
+ }
90
+ catch {
91
+ return null;
92
+ }
93
+ }
94
+ export async function transformImpact(t, onProgress) {
95
+ const notes = [];
96
+ onProgress?.('Reading transforms and identity profiles...');
97
+ const [transforms, mappings] = await Promise.all([readTransforms(t), readMappings(t)]);
98
+ const defs = mappings.map((m) => ({ kind: 'Identity profile', where: m.profile, detail: m.attribute, def: m.transformDefinition, profileId: m.profileId }));
99
+ const sources = [];
100
+ for await (const s of pageList(t, '/sources/v1', {}))
101
+ sources.push(s);
102
+ let policiesRead = 0;
103
+ let refused = 0;
104
+ for (const [i, s] of sources.entries()) {
105
+ onProgress?.(`Reading provisioning policies... ${i + 1} of ${sources.length} sources`);
106
+ const id = String(s['id'] ?? '');
107
+ if (!/^[A-Za-z0-9-]+$/.test(id))
108
+ continue;
109
+ let policies;
110
+ try {
111
+ policies = await readPolicies(t, id);
112
+ }
113
+ catch (e) {
114
+ refused++;
115
+ if (e.status !== 403 && e.status !== 404)
116
+ throw e;
117
+ continue;
118
+ }
119
+ policiesRead += policies.length;
120
+ for (const p of policies) {
121
+ for (const f of p.fields ?? []) {
122
+ if (f.transform)
123
+ defs.push({ kind: 'Provisioning policy', where: `${s['name']} (${p.usageType ?? p.name ?? 'policy'})`, detail: f.name, def: f.transform, sourceId: id });
124
+ }
125
+ }
126
+ }
127
+ if (refused)
128
+ notes.push(`The provisioning policies of ${refused} source${refused === 1 ? '' : 's'} could not be read (no permission), so uses there are not shown.`);
129
+ onProgress?.('Counting people per identity profile...');
130
+ const profileIds = [...new Map(mappings.map((m) => [m.profileId, m.profile])).entries()];
131
+ const people = new Map();
132
+ for (const [id] of profileIds)
133
+ people.set(id, await peopleIn(t, id));
134
+ const r = impactFrom(transforms, defs, people);
135
+ notes.push('Rules run code that IdentityScope cannot read, so anything a rule does is not included.');
136
+ return { ...r, profiles: profileIds.map(([id, name]) => ({ id, name, people: people.get(id) ?? null })), policiesRead, notes };
137
+ }
138
+ //# sourceMappingURL=transform-impact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-impact.js","sourceRoot":"","sources":["../../../src/core/lab/transform-impact.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAkB,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAyCrE,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,MAAM,IAAI,GAAG,EAAU;IAChE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,IAAI,GAAG;YAAE,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;SAAM,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1C,M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C,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACrE,MAAM,CAAC,GAAG,UAAU,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/C,KAAK,CAAC,IAAI,CAAC,yFAAyF,CAAC,CAAC;IACtG,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AACjI,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Runs a transform on real people, offline: reads a sample of identities and
3
+ * their accounts (read-only), evaluates the transform locally for each, and
4
+ * compares with the value ISC has now. With a transform taken from an identity
5
+ * profile mapping, that comparison shows how faithful the offline engine is
6
+ * ("matches ISC for 498 of 500 people").
7
+ */
8
+ import { type Transport } from '../transport.js';
9
+ import { type EvalResult, type LabAccount, type LabInput, type Value } from './transforms.js';
10
+ export interface Mapping {
11
+ profileId: string;
12
+ profile: string;
13
+ attribute: string;
14
+ transformDefinition: Record<string, unknown>;
15
+ /** Short description: "reference Department Lookup ← Workday.DEPT". */
16
+ summary: string;
17
+ }
18
+ /** The transform engine's input for one person from ISC search: identity attributes and accounts. */
19
+ export declare function identityInput(p: Record<string, unknown>, accounts: LabAccount[]): LabInput;
20
+ /** Reads the accounts of up to 50 people per request, with their attributes. */
21
+ export declare function accountsOf(t: Transport, ids: string[], onProgress?: (m: string) => void): Promise<Map<string, LabAccount[]>>;
22
+ export declare function readTransforms(t: Transport): Promise<Record<string, unknown>[]>;
23
+ export declare function readMappings(t: Transport): Promise<Mapping[]>;
24
+ export interface PersonResult {
25
+ person: string;
26
+ id: string;
27
+ current: Value | undefined;
28
+ result: Value;
29
+ status: EvalResult['status'];
30
+ error?: string;
31
+ same: boolean | null;
32
+ }
33
+ export interface PeopleRun {
34
+ people: number;
35
+ rows: PersonResult[];
36
+ summary: {
37
+ same: number;
38
+ different: number;
39
+ empty: number;
40
+ errors: number;
41
+ iscOnly: number;
42
+ random: number;
43
+ };
44
+ distinct: {
45
+ value: string;
46
+ people: number;
47
+ }[];
48
+ assumptions: string[];
49
+ attribute?: string;
50
+ notes: string[];
51
+ }
52
+ export declare function runOnPeople(t: Transport, o: {
53
+ transform: Record<string, unknown>;
54
+ transforms: Record<string, unknown>[];
55
+ attribute?: string;
56
+ implicit?: Record<string, unknown>;
57
+ query?: string;
58
+ count?: number;
59
+ now?: Date;
60
+ onProgress?: (m: string) => void;
61
+ }): Promise<PeopleRun>;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Runs a transform on real people, offline: reads a sample of identities and
3
+ * their accounts (read-only), evaluates the transform locally for each, and
4
+ * compares with the value ISC has now. With a transform taken from an identity
5
+ * profile mapping, that comparison shows how faithful the offline engine is
6
+ * ("matches ISC for 498 of 500 people").
7
+ */
8
+ import { pageList, pageSearch } from '../transport.js';
9
+ import { TransformEngine } from './transforms.js';
10
+ /** The transform engine's input for one person from ISC search: identity attributes and accounts. */
11
+ export function identityInput(p, accounts) {
12
+ const attrs = (p['attributes'] ?? {});
13
+ return { identity: { uid: p['name'], email: p['email'], displayName: p['displayName'], ...attrs }, accounts };
14
+ }
15
+ /** Reads the accounts of up to 50 people per request, with their attributes. */
16
+ export async function accountsOf(t, ids, onProgress) {
17
+ const accounts = new Map();
18
+ for (let i = 0; i < ids.length; i += 50) {
19
+ const chunk = ids.slice(i, i + 50);
20
+ const filters = `identityId in (${chunk.map((x) => JSON.stringify(x)).join(',')})`;
21
+ for await (const a of pageList(t, '/accounts/v1', { filters })) {
22
+ const id = String(a['identityId'] ?? a['identity']?.['id'] ?? '');
23
+ if (!chunk.includes(id))
24
+ continue;
25
+ const list = accounts.get(id) ?? [];
26
+ list.push({ source: String(a['sourceName'] ?? a['source']?.['name'] ?? ''), sourceId: String(a['sourceId'] ?? a['source']?.['id'] ?? ''), nativeIdentity: a['nativeIdentity'], name: a['name'], created: a['created'], attributes: (a['attributes'] ?? {}) });
27
+ accounts.set(id, list);
28
+ }
29
+ onProgress?.(`Reading accounts... ${Math.min(i + 50, ids.length)} of ${ids.length} people`);
30
+ }
31
+ return accounts;
32
+ }
33
+ export async function readTransforms(t) {
34
+ const out = [];
35
+ for await (const x of pageList(t, '/transforms/v1', {}))
36
+ out.push(x);
37
+ return out;
38
+ }
39
+ export async function readMappings(t) {
40
+ const out = [];
41
+ for await (const p of pageList(t, '/identity-profiles/v1', {})) {
42
+ const cfg = (p['identityAttributeConfig'] ?? {});
43
+ for (const m of cfg.attributeTransforms ?? []) {
44
+ if (!m.identityAttributeName || !m.transformDefinition)
45
+ continue;
46
+ out.push({ profileId: String(p['id']), profile: String(p['name'] ?? p['id']), attribute: m.identityAttributeName, transformDefinition: m.transformDefinition, summary: summarize(m.transformDefinition) });
47
+ }
48
+ }
49
+ return out;
50
+ }
51
+ function summarize(d) {
52
+ const a = (d['attributes'] ?? {});
53
+ const src = (x) => `${x['sourceName'] ?? x['applicationName'] ?? '?'}.${x['attributeName'] ?? '?'}`;
54
+ if (d['type'] === 'accountAttribute')
55
+ return `account attribute ${src(a)}`;
56
+ if (d['type'] === 'reference') {
57
+ const inp = a['input'];
58
+ return `transform "${a['id']}"${inp && inp['type'] === 'accountAttribute' ? ` on ${src((inp['attributes'] ?? {}))}` : ''}`;
59
+ }
60
+ if (d['type'] === 'rule')
61
+ return `rule "${a['name']}"`;
62
+ return String(d['type']);
63
+ }
64
+ const empty = (v) => v === null || v === undefined || v === '' || (Array.isArray(v) && v.length === 0);
65
+ const norm = (v) => (empty(v) ? '' : Array.isArray(v) ? v.map(String).join('|') : String(v));
66
+ export async function runOnPeople(t, o) {
67
+ const count = Math.min(Math.max(o.count ?? 200, 1), 2000);
68
+ const notes = [];
69
+ o.onProgress?.('Reading people...');
70
+ const people = [];
71
+ for await (const d of pageSearch(t, ['identities'], o.query?.trim() || '*', { includeNested: false, max: count, fields: ['id', 'name', 'displayName', 'email', 'attributes', 'manager'] })) {
72
+ people.push(d);
73
+ if (people.length >= count)
74
+ break;
75
+ }
76
+ o.onProgress?.(`Reading the accounts of ${people.length} people...`);
77
+ const accounts = new Map();
78
+ for (let i = 0; i < people.length; i += 50) {
79
+ const ids = people.slice(i, i + 50).map((p) => String(p['id']));
80
+ const filters = `identityId in (${ids.map((x) => JSON.stringify(x)).join(',')})`;
81
+ for await (const a of pageList(t, '/accounts/v1', { filters })) {
82
+ const id = String(a['identityId'] ?? a['identity']?.['id'] ?? '');
83
+ if (!ids.includes(id))
84
+ continue;
85
+ const list = accounts.get(id) ?? [];
86
+ list.push({ source: String(a['sourceName'] ?? a['source']?.['name'] ?? ''), sourceId: String(a['sourceId'] ?? a['source']?.['id'] ?? ''), nativeIdentity: a['nativeIdentity'], name: a['name'], created: a['created'], attributes: (a['attributes'] ?? {}) });
87
+ accounts.set(id, list);
88
+ }
89
+ o.onProgress?.(`Reading accounts... ${Math.min(i + 50, people.length)} of ${people.length} people`);
90
+ }
91
+ const engine = TransformEngine.fromList(o.transforms, o.now);
92
+ const rows = [];
93
+ const assumptions = new Set();
94
+ o.onProgress?.('Evaluating...');
95
+ for (const p of people) {
96
+ const id = String(p['id']);
97
+ const attrs = (p['attributes'] ?? {});
98
+ const input = identityInput(p, accounts.get(id) ?? []);
99
+ if (o.implicit) {
100
+ const imp = engine.run(o.implicit, input);
101
+ input.implicit = imp.value;
102
+ }
103
+ const r = engine.run(o.transform, input);
104
+ r.assumptions.forEach((x) => assumptions.add(x));
105
+ const current = o.attribute ? (attrs[o.attribute] ?? p[o.attribute]) : undefined;
106
+ const comparable = o.attribute && (r.status === 'ok');
107
+ rows.push({ person: String(p['displayName'] ?? p['name'] ?? id), id, current, result: r.value, status: r.status, error: r.error, same: comparable ? norm(r.value) === norm(current) : null });
108
+ }
109
+ const dist = new Map();
110
+ for (const r of rows)
111
+ if (r.status === 'ok' || r.status === 'random')
112
+ dist.set(norm(r.result) || '(empty)', (dist.get(norm(r.result) || '(empty)') ?? 0) + 1);
113
+ if (o.attribute && people.length && people.every((p) => (p['attributes'] ?? {})[o.attribute] === undefined && p[o.attribute] === undefined))
114
+ notes.push(`No one in the sample has the identity attribute "${o.attribute}" in search; check its system name.`);
115
+ return {
116
+ people: rows.length,
117
+ rows: rows.sort((a, b) => Number(a.same === true) - Number(b.same === true) || a.person.localeCompare(b.person)),
118
+ summary: {
119
+ same: rows.filter((r) => r.same === true).length,
120
+ different: rows.filter((r) => r.same === false).length,
121
+ empty: rows.filter((r) => r.status === 'ok' && empty(r.result)).length,
122
+ errors: rows.filter((r) => r.status === 'error').length,
123
+ iscOnly: rows.filter((r) => r.status === 'isc-only').length,
124
+ random: rows.filter((r) => r.status === 'random').length,
125
+ },
126
+ distinct: [...dist.entries()].map(([value, n]) => ({ value, people: n })).sort((a, b) => b.people - a.people).slice(0, 50),
127
+ assumptions: [...assumptions],
128
+ attribute: o.attribute,
129
+ notes,
130
+ };
131
+ }
132
+ //# sourceMappingURL=transform-people.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-people.js","sourceRoot":"","sources":["../../../src/core/lab/transform-people.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,eAAe,EAA+D,MAAM,iBAAiB,CAAC;AAW/G,qGAAqG;AACrG,MAAM,UAAU,aAAa,CAAC,CAA0B,EAAE,QAAsB;IAC9E,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAA4B,CAAC;IACjE,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC,C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EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;YACtE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM;YACvD,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,MAAM;YAC3D,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM;SACzD;QACD,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC1H,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC;QAC7B,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,79 @@
1
+ export type Value = string | number | boolean | null | Value[];
2
+ export interface LabAccount {
3
+ source: string;
4
+ sourceId?: string;
5
+ /** Account ID (nativeIdentity) and name, for accountFilter. */
6
+ nativeIdentity?: string;
7
+ name?: string;
8
+ created?: string;
9
+ attributes: Record<string, unknown>;
10
+ }
11
+ export interface LabInput {
12
+ /** Identity attributes (system names, e.g. firstname, lastname, email, uid). */
13
+ identity?: Record<string, unknown>;
14
+ /** The person's accounts with their attributes. */
15
+ accounts?: LabAccount[];
16
+ /** The manager's identity attributes, for getReferenceIdentityAttribute with uid "manager". */
17
+ manager?: Record<string, unknown>;
18
+ /** Other people by uid, for getReferenceIdentityAttribute. */
19
+ people?: Record<string, Record<string, unknown>>;
20
+ /** Implicit input: the source attribute value mapped in the identity profile. */
21
+ implicit?: unknown;
22
+ /** Previous value of the attribute ($oldValue). */
23
+ oldValue?: unknown;
24
+ }
25
+ export interface TraceStep {
26
+ depth: number;
27
+ type: string;
28
+ name?: string;
29
+ input?: Value;
30
+ output?: Value;
31
+ note?: string;
32
+ error?: string;
33
+ }
34
+ export interface EvalResult {
35
+ value: Value;
36
+ /** 'ok' | 'error' (ISC would fail too) | 'isc-only' (cannot be evaluated offline) | 'random' (differs every run) */
37
+ status: 'ok' | 'error' | 'isc-only' | 'random';
38
+ error?: string;
39
+ trace: TraceStep[];
40
+ /** Assumptions the engine made where SailPoint's documentation does not say. */
41
+ assumptions: string[];
42
+ }
43
+ export declare class TransformError extends Error {
44
+ constructor(msg: string);
45
+ }
46
+ type Def = {
47
+ type?: string;
48
+ name?: string;
49
+ id?: string;
50
+ attributes?: Record<string, unknown>;
51
+ };
52
+ export declare class TransformEngine {
53
+ private transforms;
54
+ private now;
55
+ private trace;
56
+ private assumptions;
57
+ private random;
58
+ private depth;
59
+ constructor(transforms: Map<string, Def>, now?: Date);
60
+ static fromList(list: Def[], now?: Date): TransformEngine;
61
+ run(def: unknown, input?: LabInput): EvalResult;
62
+ private evalAny;
63
+ private velocityCtx;
64
+ private render;
65
+ /** The transform's input: explicit attributes.input if set, else the implicit input. */
66
+ private inputOf;
67
+ /** Dynamic variables: attributes that are not reserved names, evaluated first. */
68
+ private variables;
69
+ private evalDef;
70
+ private apply;
71
+ private utility;
72
+ private accountAttribute;
73
+ }
74
+ export declare function dateMath(start: Date, expr: string, roundUp: boolean): Date;
75
+ /** sailpoint.object.Filter subset: (a == "x"), (a != "x"), a.startsWith("x"), a.containsAll({"x"}), &&, ||, !. */
76
+ export declare function matchFilter(expr: string, attrs: Record<string, unknown>): boolean;
77
+ /** nameNormalizer, following the documented rules. */
78
+ export declare function normalizeName(v: string): string;
79
+ export {};