ldap-rest 0.4.7 → 0.6.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.
Files changed (67) hide show
  1. package/bin/sync-james.mjs +6 -2
  2. package/dist/bin/index.js +1 -1
  3. package/dist/config/args.js +1 -1
  4. package/dist/lib/auth/base.js +1 -1
  5. package/dist/lib/ldapSchema.js +1 -0
  6. package/dist/lib/utils.js +1 -1
  7. package/dist/plugins/auth/authzPerRoute.js +1 -1
  8. package/dist/plugins/auth/rateLimit.js +1 -1
  9. package/dist/plugins/ldap/groups.js +1 -1
  10. package/dist/plugins/ldap/organizations.js +1 -1
  11. package/dist/plugins/ldap/raw.js +1 -0
  12. package/dist/plugins/twake/appAccountsApi.js +1 -1
  13. package/dist/plugins/twake/appAccountsConsistency.js +1 -1
  14. package/dist/src/bin/index.d.ts +112 -0
  15. package/dist/src/browser/ldap-browser/LdapBrowser.d.ts +52 -0
  16. package/dist/src/browser/ldap-browser/api/RawApiClient.d.ts +64 -0
  17. package/dist/src/browser/ldap-browser/components/EntryTree.d.ts +75 -0
  18. package/dist/src/browser/ldap-browser/components/EntryView.d.ts +56 -0
  19. package/dist/src/browser/ldap-browser/index.d.ts +9 -0
  20. package/dist/src/browser/ldap-browser/schema.d.ts +62 -0
  21. package/dist/src/browser/ldap-browser/types.d.ts +96 -0
  22. package/dist/src/config/args.d.ts +7 -0
  23. package/dist/src/lib/auth/base.d.ts +82 -1
  24. package/dist/src/lib/ldapSchema.d.ts +159 -0
  25. package/dist/src/lib/utils.d.ts +4 -0
  26. package/dist/src/plugins/ldap/raw.d.ts +251 -0
  27. package/dist/src/plugins/twake/appAccountsConsistency.d.ts +40 -2
  28. package/docs/client-development/browser/libraries.md +142 -1
  29. package/docs/usage/configuration.md +40 -5
  30. package/docs/usage/plugins/README.md +10 -9
  31. package/docs/usage/plugins/auth/README.md +57 -0
  32. package/docs/usage/plugins/auth/rate-limit.md +9 -0
  33. package/docs/usage/plugins/integrations/app-accounts.md +35 -2
  34. package/docs/usage/plugins/ldap/README.md +12 -0
  35. package/docs/usage/plugins/ldap/raw.md +226 -0
  36. package/examples/web/README.md +18 -0
  37. package/examples/web/ldap-browser.html +94 -0
  38. package/package.json +37 -1
  39. package/static/browser/ldap-browser/LdapBrowser.js +199 -0
  40. package/static/browser/ldap-browser/LdapBrowser.js.map +1 -0
  41. package/static/browser/ldap-browser/api/RawApiClient.js +103 -0
  42. package/static/browser/ldap-browser/api/RawApiClient.js.map +1 -0
  43. package/static/browser/ldap-browser/components/EntryTree.js +235 -0
  44. package/static/browser/ldap-browser/components/EntryTree.js.map +1 -0
  45. package/static/browser/ldap-browser/components/EntryView.js +183 -0
  46. package/static/browser/ldap-browser/components/EntryView.js.map +1 -0
  47. package/static/browser/ldap-browser/index.js +4 -0
  48. package/static/browser/ldap-browser/index.js.map +1 -0
  49. package/static/browser/ldap-browser/schema.js +135 -0
  50. package/static/browser/ldap-browser/schema.js.map +1 -0
  51. package/static/browser/ldap-browser/types.js +2 -0
  52. package/static/browser/ldap-browser/types.js.map +1 -0
  53. package/static/browser/ldap-browser.css +2 -0
  54. package/static/browser/ldap-browser.css.map +1 -0
  55. package/static/browser/ldap-browser.esm.js +915 -0
  56. package/static/browser/ldap-browser.esm.js.map +1 -0
  57. package/static/browser/ldap-browser.js +925 -0
  58. package/static/browser/ldap-browser.js.map +1 -0
  59. package/static/browser/ldap-browser.min.js +2 -0
  60. package/static/browser/ldap-browser.min.js.map +1 -0
  61. package/static/browser/ldap-unit-editor/components/UnitTree.js +0 -1
  62. package/static/browser/ldap-unit-editor/components/UnitTree.js.map +1 -1
  63. package/static/browser/ldap-unit-editor.esm.js +0 -1
  64. package/static/browser/ldap-unit-editor.esm.js.map +1 -1
  65. package/static/browser/ldap-unit-editor.js +0 -1
  66. package/static/browser/ldap-unit-editor.js.map +1 -1
  67. package/static/browser/ldap-unit-editor.min.js.map +1 -1
@@ -0,0 +1,199 @@
1
+ import { escapeHtml } from '../shared/utils/dom.js';
2
+ import { RawApiClient } from './api/RawApiClient.js';
3
+ import { EntryTree } from './components/EntryTree.js';
4
+ import { EntryView } from './components/EntryView.js';
5
+ import { SchemaView } from './schema.js';
6
+
7
+ /**
8
+ * Low-level LDAP browser: a tree of the directory on the left, the raw
9
+ * content of the selected entry on the right, and a filter search on top.
10
+ *
11
+ * Read-only: it renders what the `core/ldap/raw` plugin serves.
12
+ *
13
+ * @module browser/ldap-browser/LdapBrowser
14
+ */
15
+ class LdapBrowser {
16
+ constructor(options) {
17
+ this.container = null;
18
+ this.tree = null;
19
+ this.entryView = null;
20
+ this.schema = null;
21
+ this.bases = [];
22
+ this.currentDn = null;
23
+ this.options = options;
24
+ this.api = new RawApiClient(options.apiBaseUrl || '', options.authToken);
25
+ }
26
+ /**
27
+ * Build the interface, load the schema and open the first base.
28
+ *
29
+ * @throws Error when the container does not exist or the API is unreachable
30
+ */
31
+ async init() {
32
+ const container = document.getElementById(this.options.containerId);
33
+ if (!container)
34
+ throw new Error(`Container element with id '${this.options.containerId}' not found`);
35
+ this.container = container;
36
+ this.bases = await this.api.getBases();
37
+ this.render();
38
+ // The schema only decorates the display: a directory that refuses it
39
+ // must not prevent browsing
40
+ try {
41
+ this.schema = new SchemaView(await this.api.getSchema());
42
+ }
43
+ catch (err) {
44
+ this.reportError(err);
45
+ }
46
+ const treeContainer = container.querySelector('.ldap-browser__tree');
47
+ const entryContainer = container.querySelector('.ldap-browser__entry');
48
+ if (!treeContainer || !entryContainer)
49
+ return;
50
+ this.entryView = new EntryView(entryContainer, this.schema);
51
+ this.entryView.renderEmpty();
52
+ this.tree = new EntryTree(treeContainer, this.api, dn => this.showEntry(dn), error => this.reportError(error));
53
+ await this.tree.init(this.bases);
54
+ this.bindToolbar();
55
+ const initial = this.options.initialDn || this.bases[0];
56
+ if (initial)
57
+ await this.tree.revealAndSelect(initial);
58
+ }
59
+ /** Release the listeners held by the tree */
60
+ destroy() {
61
+ this.tree?.destroy();
62
+ this.tree = null;
63
+ }
64
+ /**
65
+ * DN currently displayed.
66
+ *
67
+ * @returns selected DN, or null when none
68
+ */
69
+ getCurrentDn() {
70
+ return this.currentDn;
71
+ }
72
+ /** Draw the static layout */
73
+ render() {
74
+ if (!this.container)
75
+ return;
76
+ this.container.classList.add('ldap-browser-container');
77
+ this.container.innerHTML = `
78
+ <div class="ldap-browser">
79
+ <div class="ldap-browser__toolbar">
80
+ <input class="ldap-browser__filter" type="text"
81
+ placeholder="LDAP filter, e.g. (uid=alice)" />
82
+ <select class="ldap-browser__scope">
83
+ <option value="sub">sub</option>
84
+ <option value="one">one</option>
85
+ <option value="base">base</option>
86
+ </select>
87
+ <select class="ldap-browser__base">
88
+ ${this.bases
89
+ .map(base => `<option value="${escapeHtml(base)}">${escapeHtml(base)}</option>`)
90
+ .join('')}
91
+ </select>
92
+ <button class="ldap-browser__search" type="button">
93
+ <span class="material-icons">search</span> Search
94
+ </button>
95
+ <button class="ldap-browser__refresh" type="button" title="Reload">
96
+ <span class="material-icons">refresh</span>
97
+ </button>
98
+ </div>
99
+ <div class="ldap-browser__body">
100
+ <div class="ldap-browser__tree"></div>
101
+ <div class="ldap-browser__entry"></div>
102
+ </div>
103
+ <div class="ldap-browser__results" hidden></div>
104
+ </div>`;
105
+ }
106
+ /** Wire the search and refresh controls */
107
+ bindToolbar() {
108
+ const filter = this.container?.querySelector('.ldap-browser__filter');
109
+ const searchButton = this.container?.querySelector('.ldap-browser__search');
110
+ const refreshButton = this.container?.querySelector('.ldap-browser__refresh');
111
+ const results = this.container?.querySelector('.ldap-browser__results');
112
+ searchButton?.addEventListener('click', () => void this.runSearch());
113
+ filter?.addEventListener('keydown', event => {
114
+ if (event.key === 'Enter')
115
+ void this.runSearch();
116
+ });
117
+ refreshButton?.addEventListener('click', () => {
118
+ this.tree?.invalidate();
119
+ if (this.currentDn)
120
+ void this.showEntry(this.currentDn);
121
+ });
122
+ results?.addEventListener('click', event => {
123
+ const target = event.target.closest('[data-dn]');
124
+ if (target?.dataset.dn)
125
+ void this.tree?.revealAndSelect(target.dataset.dn);
126
+ });
127
+ }
128
+ /**
129
+ * Load an entry and display it.
130
+ *
131
+ * @param dn DN of the entry
132
+ */
133
+ async showEntry(dn) {
134
+ if (!this.entryView)
135
+ return;
136
+ this.currentDn = dn;
137
+ this.entryView.renderLoading();
138
+ try {
139
+ const entry = await this.api.getEntry(dn);
140
+ this.entryView.render(entry);
141
+ this.options.onEntrySelected?.(dn);
142
+ }
143
+ catch (err) {
144
+ this.entryView.renderError(err.message);
145
+ this.reportError(err);
146
+ }
147
+ }
148
+ /** Run the search typed in the toolbar and list the matching DNs */
149
+ async runSearch() {
150
+ const filter = this.container?.querySelector('.ldap-browser__filter')
151
+ ?.value || '';
152
+ const scope = this.container?.querySelector('.ldap-browser__scope')
153
+ ?.value || 'sub';
154
+ const base = this.container?.querySelector('.ldap-browser__base')
155
+ ?.value || this.bases[0];
156
+ const results = this.container?.querySelector('.ldap-browser__results');
157
+ if (!results)
158
+ return;
159
+ if (!filter.trim()) {
160
+ results.hidden = true;
161
+ results.innerHTML = '';
162
+ return;
163
+ }
164
+ results.hidden = false;
165
+ results.innerHTML = '<p>Searching…</p>';
166
+ try {
167
+ const found = await this.api.search({
168
+ base,
169
+ scope: scope,
170
+ filter,
171
+ attributes: ['dn'],
172
+ });
173
+ results.innerHTML = found.entries.length
174
+ ? `<p>${found.entries.length} result(s)${found.truncated ? ' (truncated)' : ''}</p>
175
+ <ul>${found.entries
176
+ .map(entry => `<li><a href="#" data-dn="${escapeHtml(entry.dn)}">${escapeHtml(entry.dn)}</a></li>`)
177
+ .join('')}</ul>`
178
+ : '<p>No result</p>';
179
+ }
180
+ catch (err) {
181
+ results.innerHTML = `<p class="ldap-browser__error">${escapeHtml(err.message)}</p>`;
182
+ this.reportError(err);
183
+ }
184
+ }
185
+ /**
186
+ * Forward an error to the host page, or log it when no handler was given.
187
+ *
188
+ * @param error error to report
189
+ */
190
+ reportError(error) {
191
+ if (this.options.onError)
192
+ this.options.onError(error);
193
+ else
194
+ console.error('[ldap-browser]', error);
195
+ }
196
+ }
197
+
198
+ export { LdapBrowser };
199
+ //# sourceMappingURL=LdapBrowser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LdapBrowser.js","sources":["../../../../src/browser/ldap-browser/LdapBrowser.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAOG;MAUU,WAAW,CAAA;AAUtB,IAAA,WAAA,CAAY,OAAuB,EAAA;QAP3B,IAAA,CAAA,SAAS,GAAuB,IAAI;QACpC,IAAA,CAAA,IAAI,GAAqB,IAAI;QAC7B,IAAA,CAAA,SAAS,GAAqB,IAAI;QAClC,IAAA,CAAA,MAAM,GAAsB,IAAI;QAChC,IAAA,CAAA,KAAK,GAAa,EAAE;QACpB,IAAA,CAAA,SAAS,GAAkB,IAAI;AAGrC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;AACtB,QAAA,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC;IAC1E;AAEA;;;;AAIG;AACH,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;AACnE,QAAA,IAAI,CAAC,SAAS;YACZ,MAAM,IAAI,KAAK,CACb,CAAA,2BAAA,EAA8B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAA,WAAA,CAAa,CACpE;AACH,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;QAE1B,IAAI,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;QACtC,IAAI,CAAC,MAAM,EAAE;;;AAIb,QAAA,IAAI;AACF,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QAC1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3
+ * @module browser/ldap-browser/api/RawApiClient
4
+ */
5
+ class RawApiClient {
6
+ constructor(baseUrl = '', authToken) {
7
+ this.baseUrl = baseUrl.replace(/\/$/, '');
8
+ this.authToken = authToken;
9
+ }
10
+ /**
11
+ * Issue a GET on the raw API and decode its JSON answer.
12
+ *
13
+ * @param path path below `/api/v1/ldap/raw`
14
+ * @returns decoded body
15
+ * @throws Error carrying the server message when the status is not 2xx
16
+ */
17
+ async get(path) {
18
+ const headers = { Accept: 'application/json' };
19
+ if (this.authToken)
20
+ headers.Authorization = `Bearer ${this.authToken}`;
21
+ const response = await fetch(`${this.baseUrl}/api/v1/ldap/raw${path}`, {
22
+ headers,
23
+ });
24
+ if (!response.ok) {
25
+ let message = response.statusText;
26
+ try {
27
+ const body = (await response.json());
28
+ if (body.error)
29
+ message = body.error;
30
+ }
31
+ catch {
32
+ // keep the status text
33
+ }
34
+ throw new Error(`${response.status}: ${message}`);
35
+ }
36
+ return (await response.json());
37
+ }
38
+ /**
39
+ * Subtrees the server exposes, used as roots of the tree.
40
+ *
41
+ * @returns list of base DNs
42
+ */
43
+ async getBases() {
44
+ const data = await this.get('/bases');
45
+ return data.bases;
46
+ }
47
+ /**
48
+ * Server capabilities.
49
+ *
50
+ * @returns root DSE
51
+ */
52
+ getRootDse() {
53
+ return this.get('/rootdse');
54
+ }
55
+ /**
56
+ * Directory schema.
57
+ *
58
+ * @returns object classes, attribute types, syntaxes and matching rules
59
+ */
60
+ getSchema() {
61
+ return this.get('/schema');
62
+ }
63
+ /**
64
+ * Read one entry.
65
+ *
66
+ * @param dn DN of the entry
67
+ * @returns the entry with all its attributes
68
+ */
69
+ getEntry(dn) {
70
+ return this.get(`/entry/${encodeURIComponent(dn)}`);
71
+ }
72
+ /**
73
+ * List the direct children of an entry.
74
+ *
75
+ * @param dn DN of the parent
76
+ * @param withChildrenFlag ask the server which children have children
77
+ * @returns children sorted by RDN, with the truncation flag
78
+ */
79
+ getChildren(dn, withChildrenFlag = true) {
80
+ return this.get(`/children/${encodeURIComponent(dn)}${withChildrenFlag ? '?children=1' : ''}`);
81
+ }
82
+ /**
83
+ * Run a search.
84
+ *
85
+ * @param params search base, scope, filter and limit
86
+ * @returns matching entries
87
+ */
88
+ search(params) {
89
+ const query = new URLSearchParams({ base: params.base });
90
+ if (params.scope)
91
+ query.set('scope', params.scope);
92
+ if (params.filter)
93
+ query.set('filter', params.filter);
94
+ if (params.attributes?.length)
95
+ query.set('attributes', params.attributes.join(','));
96
+ if (params.limit)
97
+ query.set('limit', String(params.limit));
98
+ return this.get(`/search?${query.toString()}`);
99
+ }
100
+ }
101
+
102
+ export { RawApiClient };
103
+ //# sourceMappingURL=RawApiClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RawApiClient.js","sources":["../../../../../src/browser/ldap-browser/api/RawApiClient.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;MASU,YAAY,CAAA;AAIvB,IAAA,WAAA,CAAY,OAAO,GAAG,EAAE,EAAE,SAAkB,EAAA;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AACzC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;IAC5B;AAEA;;;;;;AAMG;IACK,MAAM,GAAG,CAAI,IAAY,EAAA;AAC/B,QAAA,MAAM,OAAO,GAA2B,EAAE,MAAM,EAAE,kBAAkB,EAAE;QACtE,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,aAAa,GAAG,CAAA,OAAA,EAAU,IAAI,CAAC,SAAS,EAAE;AAEtE,QAAA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,CAAA,EAAG,IAAI,CAAC,OAAO,CAAA,gBAAA,EAAmB,IAAI,CAAA,CAAE,EAAE;YACrE,OAAO;AACR,SAAA,CAAC;AACF,QAAA,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AAChB,YAAA,IAAI,OAAO,GAAG,QAAQ,CAAC,U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AAC,KAAK;YAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM;YAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;AACrD,QAAA,IAAI,MAAM,CAAC,UAAU,EAAE,MAAM;AAC3B,YAAA,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,MAAM,CAAC,KAAK;AAAE,YAAA,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,GAAG,CAAkB,CAAA,QAAA,EAAW,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,CAAC;IACjE;AACD;;;;"}
@@ -0,0 +1,235 @@
1
+ import { DisposableComponent } from '../../shared/components/DisposableComponent.js';
2
+ import { escapeHtml } from '../../shared/utils/dom.js';
3
+
4
+ /**
5
+ * Lazy directory tree: one root per exposed base, children fetched on expand.
6
+ * @module browser/ldap-browser/components/EntryTree
7
+ */
8
+ /** Icon picked from the object classes of an entry */
9
+ function iconFor(objectClass) {
10
+ const classes = objectClass.map(c => c.toLowerCase());
11
+ if (classes.includes('organizationalunit') ||
12
+ classes.includes('organization'))
13
+ return 'folder';
14
+ if (classes.includes('groupofnames') ||
15
+ classes.includes('groupofuniquenames') ||
16
+ classes.includes('posixgroup'))
17
+ return 'group';
18
+ if (classes.includes('inetorgperson') ||
19
+ classes.includes('person') ||
20
+ classes.includes('organizationalperson'))
21
+ return 'person';
22
+ if (classes.includes('domain') || classes.includes('dcobject'))
23
+ return 'dns';
24
+ return 'article';
25
+ }
26
+ class EntryTree extends DisposableComponent {
27
+ constructor(container, api, onSelect, onError) {
28
+ super();
29
+ this.roots = [];
30
+ this.children = new Map();
31
+ this.expanded = new Set();
32
+ this.loading = new Set();
33
+ this.selectedDn = null;
34
+ this.container = container;
35
+ this.api = api;
36
+ this.onSelect = onSelect;
37
+ this.onError = onError;
38
+ this.addManagedEventListener(this.container, 'click', event => {
39
+ const target = event.target.closest('[data-dn]');
40
+ if (!target)
41
+ return;
42
+ const dn = target.dataset.dn;
43
+ if (target.classList.contains('ldap-browser-tree__toggle')) {
44
+ void this.toggle(dn);
45
+ }
46
+ else {
47
+ void this.select(dn);
48
+ }
49
+ });
50
+ }
51
+ /**
52
+ * Load the exposed bases and draw them as roots.
53
+ *
54
+ * @param bases base DNs to use as roots
55
+ */
56
+ async init(bases) {
57
+ this.roots = bases;
58
+ // Open the first root so the tree is never empty on arrival
59
+ if (bases.length > 0)
60
+ await this.expand(bases[0]);
61
+ this.render();
62
+ }
63
+ /**
64
+ * DN currently highlighted in the tree.
65
+ *
66
+ * @returns selected DN, or null
67
+ */
68
+ getSelectedDn() {
69
+ return this.selectedDn;
70
+ }
71
+ /**
72
+ * Highlight an entry and notify the parent component.
73
+ *
74
+ * @param dn DN to select
75
+ * @returns whatever the selection handler returns, so callers can await
76
+ * the entry actually being displayed
77
+ */
78
+ select(dn) {
79
+ this.selectedDn = dn;
80
+ this.render();
81
+ return this.onSelect(dn);
82
+ }
83
+ /**
84
+ * Expand the tree down to a DN, loading every level on the way, then
85
+ * select it. Used to follow a search result or a DN typed by the user.
86
+ *
87
+ * @param dn DN to reveal
88
+ */
89
+ async revealAndSelect(dn) {
90
+ const root = this.roots.find(base => dn.toLowerCase() === base.toLowerCase() ||
91
+ dn.toLowerCase().endsWith(`,${base.toLowerCase()}`));
92
+ if (root) {
93
+ // Walk down from the root, expanding each ancestor
94
+ const relative = dn
95
+ .substring(0, dn.length - root.length)
96
+ .replace(/,$/, '');
97
+ const rdns = relative ? splitDn(relative) : [];
98
+ let current = root;
99
+ await this.expand(current);
100
+ // Expand the ancestors only: the target itself stays closed
101
+ for (let i = rdns.length - 1; i >= 1; i--) {
102
+ current = `${rdns[i]},${current}`;
103
+ await this.expand(current);
104
+ }
105
+ }
106
+ await this.select(dn);
107
+ }
108
+ /**
109
+ * Drop cached children so the next expand hits the server again.
110
+ *
111
+ * @param dn DN whose children must be reloaded, or undefined for all
112
+ */
113
+ invalidate(dn) {
114
+ if (dn)
115
+ this.children.delete(dn);
116
+ else
117
+ this.children.clear();
118
+ }
119
+ /**
120
+ * Expand a node, fetching its children the first time.
121
+ *
122
+ * @param dn DN of the node
123
+ */
124
+ async expand(dn) {
125
+ this.expanded.add(dn);
126
+ if (this.children.has(dn))
127
+ return;
128
+ this.loading.add(dn);
129
+ this.render();
130
+ try {
131
+ this.children.set(dn, await this.api.getChildren(dn));
132
+ }
133
+ catch (err) {
134
+ this.expanded.delete(dn);
135
+ this.onError(err);
136
+ }
137
+ finally {
138
+ this.loading.delete(dn);
139
+ this.render();
140
+ }
141
+ }
142
+ /**
143
+ * Expand or collapse a node.
144
+ *
145
+ * @param dn DN of the node
146
+ */
147
+ async toggle(dn) {
148
+ if (this.expanded.has(dn)) {
149
+ this.expanded.delete(dn);
150
+ this.render();
151
+ return;
152
+ }
153
+ await this.expand(dn);
154
+ }
155
+ /** Redraw the whole tree */
156
+ render() {
157
+ if (this.isDestroyed)
158
+ return;
159
+ this.container.innerHTML = `<ul class="ldap-browser-tree">${this.roots
160
+ .map(root => this.renderNode(root, root, ['dcObject'], true))
161
+ .join('')}</ul>`;
162
+ }
163
+ /**
164
+ * Render one node and, when expanded, its children.
165
+ *
166
+ * @param dn DN of the node
167
+ * @param label text shown for the node
168
+ * @param objectClass object classes, used to pick the icon
169
+ * @param expandable whether the node may have children
170
+ * @returns HTML of the node
171
+ */
172
+ renderNode(dn, label, objectClass, expandable) {
173
+ const isExpanded = this.expanded.has(dn);
174
+ const isLoading = this.loading.has(dn);
175
+ const isSelected = this.selectedDn === dn;
176
+ const children = this.children.get(dn);
177
+ const toggle = expandable
178
+ ? `<span class="ldap-browser-tree__toggle material-icons" data-dn="${escapeHtml(dn)}">${isLoading
179
+ ? 'hourglass_empty'
180
+ : isExpanded
181
+ ? 'expand_more'
182
+ : 'chevron_right'}</span>`
183
+ : '<span class="ldap-browser-tree__toggle ldap-browser-tree__toggle--leaf"></span>';
184
+ const sub = isExpanded && children
185
+ ? `<ul>${children.children.length === 0
186
+ ? '<li class="ldap-browser-tree__empty">(no child)</li>'
187
+ : children.children
188
+ .map(child => this.renderNode(child.dn, child.rdn, child.objectClass, child.hasChildren))
189
+ .join('')}${children.truncated
190
+ ? `<li class="ldap-browser-tree__truncated" title="Raise --ldap-raw-max-results to see more">
191
+ first ${children.children.length} entries only — use the search to find the others
192
+ </li>`
193
+ : ''}</ul>`
194
+ : '';
195
+ return `<li>
196
+ <div class="ldap-browser-tree__node${isSelected ? ' ldap-browser-tree__node--selected' : ''}">
197
+ ${toggle}
198
+ <span class="ldap-browser-tree__label" data-dn="${escapeHtml(dn)}" title="${escapeHtml(dn)}">
199
+ <span class="material-icons">${iconFor(objectClass)}</span>
200
+ <span class="ldap-browser-tree__name">${escapeHtml(label)}</span>
201
+ </span>
202
+ </div>
203
+ ${sub}
204
+ </li>`;
205
+ }
206
+ }
207
+ /**
208
+ * Split a DN into its components, honouring `\,` escapes.
209
+ *
210
+ * @param dn DN to split
211
+ * @returns RDN components, outermost first
212
+ */
213
+ function splitDn(dn) {
214
+ const parts = [];
215
+ let current = '';
216
+ for (let i = 0; i < dn.length; i++) {
217
+ if (dn[i] === '\\' && i + 1 < dn.length) {
218
+ current += dn[i] + dn[i + 1];
219
+ i++;
220
+ }
221
+ else if (dn[i] === ',') {
222
+ parts.push(current.trim());
223
+ current = '';
224
+ }
225
+ else {
226
+ current += dn[i];
227
+ }
228
+ }
229
+ if (current.trim())
230
+ parts.push(current.trim());
231
+ return parts;
232
+ }
233
+
234
+ export { EntryTree };
235
+ //# sourceMappingURL=EntryTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntryTree.js","sources":["../../../../../src/browser/ldap-browser/components/EntryTree.ts"],"sourcesContent":[null],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