@thunderid/node 1.4.0 → 1.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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import fetch, { Headers, Request, Response } from "cross-fetch";
2
- import { BackchannelLogoutConstants, InvalidLogoutTokenError, ThunderIDAuthException, ThunderIDJavaScriptClient, getFlows, getUserTypes, getUsers, getVendorPrefix, logger, resolveResourceEndpoint, updateMeCredentials } from "@thunderid/javascript";
2
+ import { BackchannelLogoutConstants, InvalidLogoutTokenError, ThunderIDAPIError, ThunderIDAuthException, ThunderIDJavaScriptClient, ThunderIDRuntimeError, addGroupMembers, addRoleAssignments, applyGatewayConfiguration, createAction, createAgent, createAgentType, createApplication, createApplicationSharingPolicy, createConfigurationVersion, createConnection, createDesignTheme, createFlow, createGateway, createGatewaySecret, createGatewayVariable, createGroup, createLayout, createNotificationTemplate, createOrganizationUnit, createResource, createResourceServer, createRole, createSecret, createUser, createUserByPath, createUserSharingPolicy, createVariable, deleteAction, deleteAgent, deleteAgentType, deleteApplication, deleteApplicationSharingPolicy, deleteConnection, deleteDesignTheme, deleteFlow, deleteGateway, deleteGatewaySecret, deleteGatewayVariable, deleteGroup, deleteImportedConfiguration, deleteLayout, deleteNotificationTemplate, deleteOrganizationUnit, deleteOrganizationUnitByPath, deleteResource, deleteResourceServer, deleteRole, deleteSecret, deleteTranslation, deleteTranslations, deleteUser, deleteUserSharingPolicy, deleteVariable, exportConfiguration, getAction, getActions, getAgent, getAgentGroups, getAgentRoles, getAgentType, getAgentTypes, getAgents, getApplication, getApplicationOverlayRules, getApplicationSharingPolicies, getApplicationSharingPolicy, getApplications, getConfigurationVersion, getConfigurationVersions, getConnection, getConnectionUsages, getConnections, getConnectionsMeta, getDesignTheme, getDesignThemeUsages, getDesignThemes, getFlow, getFlowUsages, getFlowVersion, getFlowVersions, getFlows, getGateway, getGatewayAppliedConfiguration, getGatewayAppliedVersion, getGatewayConfigurationDiff, getGatewaySecret, getGatewaySecrets, getGatewayVariable, getGatewayVariables, getGateways, getGroup, getGroupMembers, getGroups, getLanguages, getLayout, getLayoutUsages, getLayouts, getNotificationTemplate, getNotificationTemplates, getOrganizationUnit, getOrganizationUnitByPath, getOrganizationUnitChildren, getOrganizationUnitGroups, getOrganizationUnitRoles, getOrganizationUnitUsers, getOrganizationUnits, getResource, getResourceServer, getResourceServers, getResources, getRole, getRoleAssignments, getRoles, getSecret, getSecrets, getServerConfig, getServerConfigs, getUser, getUserGroups, getUserOverlayRules, getUserSharingPolicies, getUserSharingPolicy, getUserTypes, getUsers, getUsersByPath, getVariable, getVariables, getVendorPrefix, importConfiguration, logger, previewCimdDocument, regenerateClientSecret, regenerateFlowSecret, removeGroupMembers, removeRoleAssignments, resolveDesign, resolveResourceEndpoint, resolveTranslation, resolveTranslations, restoreFlowVersion, revertGatewayConfiguration, setTranslation, setTranslations, suspendAgent, suspendApplication, suspendUser, unlockAgent, unlockUser, unsuspendAgent, unsuspendApplication, unsuspendUser, updateAction, updateAgent, updateAgentType, updateApplication, updateApplicationSharingPolicy, updateConnection, updateDesignTheme, updateFlow, updateGateway, updateGatewaySecret, updateGatewayVariable, updateGroup, updateLayout, updateMeCredentials, updateNotificationTemplate, updateOrganizationUnit, updateOrganizationUnitByPath, updateResource, updateResourceServer, updateRole, updateSecret, updateServerConfig, updateUser, updateUserSharingPolicy, updateVariable } from "@thunderid/javascript";
3
3
  import cache from "memory-cache";
4
4
  import base64url from "base64url";
5
5
  import sha256 from "fast-sha256";
@@ -28,6 +28,919 @@ var MemoryCacheStore = class {
28
28
  };
29
29
  var MemoryCacheStore_default = MemoryCacheStore;
30
30
 
31
+ //#endregion
32
+ //#region src/utils/createManagementClient.ts
33
+ /**
34
+ * Rejects a missing or blank resource identifier before any request is made. The core API functions
35
+ * reject a blank string, but an `undefined` identifier would otherwise address the whole collection,
36
+ * which for a delete or update is never what the caller meant. Uses the same code the core raises.
37
+ */
38
+ const requireId = (id, operation) => {
39
+ if (typeof id !== "string" || id.trim() === "") throw new ThunderIDAPIError("A resource identifier is required.", `${operation}-ValidationError-002`, "node", 400, "The provided resource identifier is empty.");
40
+ return id;
41
+ };
42
+ /**
43
+ * Builds the server-side management client for one session.
44
+ *
45
+ * Each operation resolves its request config through `resolve` at call time, so the access token is
46
+ * read fresh for every request and never held by the returned object.
47
+ *
48
+ * @param resolve - Supplies the base URL, collection URL, and `Authorization` header for a request.
49
+ * @returns The session-bound management operations.
50
+ */
51
+ const createManagementClient = (resolve) => {
52
+ const config = async (key, { fetcher, signal, url } = {}) => ({
53
+ ...fetcher ? { fetcher } : {},
54
+ ...signal ? { signal } : {},
55
+ ...await resolve(key, url)
56
+ });
57
+ return {
58
+ agentTypes: {
59
+ create: async (payload, options) => createAgentType({
60
+ payload,
61
+ ...await config("agentTypes", options)
62
+ }),
63
+ delete: async (agentTypeId, options) => deleteAgentType({
64
+ agentTypeId: requireId(agentTypeId, "deleteAgentType"),
65
+ ...await config("agentTypes", options)
66
+ }),
67
+ get: async (agentTypeId, options) => getAgentType({
68
+ agentTypeId: requireId(agentTypeId, "getAgentType"),
69
+ ...await config("agentTypes", options)
70
+ }),
71
+ list: async ({ limit, offset,...options } = {}) => getAgentTypes({
72
+ limit,
73
+ offset,
74
+ ...await config("agentTypes", options)
75
+ }),
76
+ update: async (agentTypeId, payload, options) => updateAgentType({
77
+ agentTypeId: requireId(agentTypeId, "updateAgentType"),
78
+ payload,
79
+ ...await config("agentTypes", options)
80
+ })
81
+ },
82
+ agents: {
83
+ create: async (payload, options) => createAgent({
84
+ payload,
85
+ ...await config("agents", options)
86
+ }),
87
+ delete: async (agentId, options) => deleteAgent({
88
+ agentId: requireId(agentId, "deleteAgent"),
89
+ ...await config("agents", options)
90
+ }),
91
+ get: async (agentId, options) => getAgent({
92
+ agentId: requireId(agentId, "getAgent"),
93
+ ...await config("agents", options)
94
+ }),
95
+ list: async ({ filter, limit, offset,...options } = {}) => getAgents({
96
+ filter,
97
+ limit,
98
+ offset,
99
+ ...await config("agents", options)
100
+ }),
101
+ listGroups: async (agentId, { limit, offset,...options } = {}) => getAgentGroups({
102
+ agentId: requireId(agentId, "getAgentGroups"),
103
+ limit,
104
+ offset,
105
+ ...await config("agents", options)
106
+ }),
107
+ listRoles: async (agentId, { limit, offset,...options } = {}) => getAgentRoles({
108
+ agentId: requireId(agentId, "getAgentRoles"),
109
+ limit,
110
+ offset,
111
+ ...await config("agents", options)
112
+ }),
113
+ suspend: async (agentId, { operatorNote,...options } = {}) => suspendAgent({
114
+ agentId: requireId(agentId, "suspendAgent"),
115
+ operatorNote,
116
+ ...await config("agents", options)
117
+ }),
118
+ unlock: async (agentId, { operatorNote,...options } = {}) => unlockAgent({
119
+ agentId: requireId(agentId, "unlockAgent"),
120
+ operatorNote,
121
+ ...await config("agents", options)
122
+ }),
123
+ unsuspend: async (agentId, { operatorNote,...options } = {}) => unsuspendAgent({
124
+ agentId: requireId(agentId, "unsuspendAgent"),
125
+ operatorNote,
126
+ ...await config("agents", options)
127
+ }),
128
+ update: async (agentId, payload, options) => updateAgent({
129
+ agentId: requireId(agentId, "updateAgent"),
130
+ payload,
131
+ ...await config("agents", options)
132
+ })
133
+ },
134
+ applications: {
135
+ create: async (payload, options) => createApplication({
136
+ payload,
137
+ ...await config("applications", options)
138
+ }),
139
+ createSharingPolicy: async (applicationId, payload, options) => createApplicationSharingPolicy({
140
+ applicationId: requireId(applicationId, "createApplicationSharingPolicy"),
141
+ payload,
142
+ ...await config("applications", options)
143
+ }),
144
+ delete: async (applicationId, { administrationMode,...options } = {}) => deleteApplication({
145
+ administrationMode,
146
+ applicationId: requireId(applicationId, "deleteApplication"),
147
+ ...await config("applications", options)
148
+ }),
149
+ deleteSharingPolicy: async (applicationId, policyId, options) => deleteApplicationSharingPolicy({
150
+ applicationId: requireId(applicationId, "deleteApplicationSharingPolicy"),
151
+ policyId: requireId(policyId, "deleteApplicationSharingPolicy"),
152
+ ...await config("applications", options)
153
+ }),
154
+ get: async (applicationId, options) => getApplication({
155
+ applicationId: requireId(applicationId, "getApplication"),
156
+ ...await config("applications", options)
157
+ }),
158
+ getOverlayRules: async (applicationId, ouId, options) => getApplicationOverlayRules({
159
+ applicationId: requireId(applicationId, "getApplicationOverlayRules"),
160
+ ouId: requireId(ouId, "getApplicationOverlayRules"),
161
+ ...await config("applications", options)
162
+ }),
163
+ getSharingPolicy: async (applicationId, policyId, options) => getApplicationSharingPolicy({
164
+ applicationId: requireId(applicationId, "getApplicationSharingPolicy"),
165
+ policyId: requireId(policyId, "getApplicationSharingPolicy"),
166
+ ...await config("applications", options)
167
+ }),
168
+ list: async ({ limit, offset,...options } = {}) => getApplications({
169
+ limit,
170
+ offset,
171
+ ...await config("applications", options)
172
+ }),
173
+ listSharingPolicies: async (applicationId, { limit, offset,...options } = {}) => getApplicationSharingPolicies({
174
+ applicationId: requireId(applicationId, "getApplicationSharingPolicies"),
175
+ limit,
176
+ offset,
177
+ ...await config("applications", options)
178
+ }),
179
+ previewCimdDocument: async (clientId, options) => previewCimdDocument({
180
+ clientId: requireId(clientId, "previewCimdDocument"),
181
+ ...await config("applications", options)
182
+ }),
183
+ regenerateClientSecret: async (applicationId, { administrationMode,...options } = {}) => regenerateClientSecret({
184
+ administrationMode,
185
+ applicationId: requireId(applicationId, "regenerateClientSecret"),
186
+ ...await config("applications", options)
187
+ }),
188
+ regenerateFlowSecret: async (applicationId, options) => regenerateFlowSecret({
189
+ applicationId: requireId(applicationId, "regenerateFlowSecret"),
190
+ ...await config("applications", options)
191
+ }),
192
+ suspend: async (applicationId, { operatorNote,...options } = {}) => suspendApplication({
193
+ applicationId: requireId(applicationId, "suspendApplication"),
194
+ operatorNote,
195
+ ...await config("applications", options)
196
+ }),
197
+ unsuspend: async (applicationId, { operatorNote,...options } = {}) => unsuspendApplication({
198
+ applicationId: requireId(applicationId, "unsuspendApplication"),
199
+ operatorNote,
200
+ ...await config("applications", options)
201
+ }),
202
+ update: async (applicationId, payload, options) => updateApplication({
203
+ applicationId: requireId(applicationId, "updateApplication"),
204
+ payload,
205
+ ...await config("applications", options)
206
+ }),
207
+ updateSharingPolicy: async (applicationId, policyId, payload, options) => updateApplicationSharingPolicy({
208
+ applicationId: requireId(applicationId, "updateApplicationSharingPolicy"),
209
+ payload,
210
+ policyId: requireId(policyId, "updateApplicationSharingPolicy"),
211
+ ...await config("applications", options)
212
+ })
213
+ },
214
+ configuration: {
215
+ captureVersion: async (payload, options) => createConfigurationVersion({
216
+ payload,
217
+ ...await config("configurationVersions", options)
218
+ }),
219
+ deleteImported: async (payload, options) => deleteImportedConfiguration({
220
+ payload,
221
+ ...await config("import", options)
222
+ }),
223
+ export: async (payload, options) => exportConfiguration({
224
+ payload,
225
+ ...await config("export", options)
226
+ }),
227
+ getVersion: async (version$1, options) => getConfigurationVersion({
228
+ version: requireId(version$1, "getConfigurationVersion"),
229
+ ...await config("configurationVersions", options)
230
+ }),
231
+ import: async (payload, options) => importConfiguration({
232
+ payload,
233
+ ...await config("import", options)
234
+ }),
235
+ listVersions: async (options) => getConfigurationVersions(await config("configurationVersions", options))
236
+ },
237
+ connections: {
238
+ create: async (type, payload, options) => createConnection({
239
+ payload,
240
+ type: requireId(type, "createConnection"),
241
+ ...await config("connections", options)
242
+ }),
243
+ delete: async (type, connectionId, options) => deleteConnection({
244
+ connectionId: requireId(connectionId, "deleteConnection"),
245
+ type: requireId(type, "deleteConnection"),
246
+ ...await config("connections", options)
247
+ }),
248
+ get: async (type, connectionId, options) => getConnection({
249
+ connectionId: requireId(connectionId, "getConnection"),
250
+ type: requireId(type, "getConnection"),
251
+ ...await config("connections", options)
252
+ }),
253
+ getMeta: async ({ vendor,...options } = {}) => getConnectionsMeta({
254
+ vendor,
255
+ ...await config("connections", options)
256
+ }),
257
+ list: async ({ category, limit, offset,...options } = {}) => getConnections({
258
+ category,
259
+ limit,
260
+ offset,
261
+ ...await config("connections", options)
262
+ }),
263
+ listByType: async (type, options) => getConnections({
264
+ type: requireId(type, "getConnections"),
265
+ ...await config("connections", options)
266
+ }),
267
+ listUsages: async (type, connectionId, options) => getConnectionUsages({
268
+ connectionId: requireId(connectionId, "getConnectionUsages"),
269
+ type: requireId(type, "getConnectionUsages"),
270
+ ...await config("connections", options)
271
+ }),
272
+ update: async (type, connectionId, payload, options) => updateConnection({
273
+ connectionId: requireId(connectionId, "updateConnection"),
274
+ payload,
275
+ type: requireId(type, "updateConnection"),
276
+ ...await config("connections", options)
277
+ })
278
+ },
279
+ design: {
280
+ createLayout: async (payload, options) => createLayout({
281
+ payload,
282
+ ...await config("design", options)
283
+ }),
284
+ createTheme: async (payload, options) => createDesignTheme({
285
+ payload,
286
+ ...await config("design", options)
287
+ }),
288
+ deleteLayout: async (layoutId, options) => deleteLayout({
289
+ layoutId: requireId(layoutId, "deleteLayout"),
290
+ ...await config("design", options)
291
+ }),
292
+ deleteTheme: async (themeId, options) => deleteDesignTheme({
293
+ themeId: requireId(themeId, "deleteDesignTheme"),
294
+ ...await config("design", options)
295
+ }),
296
+ getLayout: async (layoutId, options) => getLayout({
297
+ layoutId: requireId(layoutId, "getLayout"),
298
+ ...await config("design", options)
299
+ }),
300
+ getTheme: async (themeId, options) => getDesignTheme({
301
+ themeId: requireId(themeId, "getDesignTheme"),
302
+ ...await config("design", options)
303
+ }),
304
+ listLayoutUsages: async (layoutId, { limit, offset,...options } = {}) => getLayoutUsages({
305
+ layoutId: requireId(layoutId, "getLayoutUsages"),
306
+ limit,
307
+ offset,
308
+ ...await config("design", options)
309
+ }),
310
+ listLayouts: async ({ limit, offset,...options } = {}) => getLayouts({
311
+ limit,
312
+ offset,
313
+ ...await config("design", options)
314
+ }),
315
+ listThemeUsages: async (themeId, { limit, offset,...options } = {}) => getDesignThemeUsages({
316
+ limit,
317
+ offset,
318
+ themeId: requireId(themeId, "getDesignThemeUsages"),
319
+ ...await config("design", options)
320
+ }),
321
+ listThemes: async ({ limit, offset,...options } = {}) => getDesignThemes({
322
+ limit,
323
+ offset,
324
+ ...await config("design", options)
325
+ }),
326
+ resolve: async (type, id, options) => resolveDesign({
327
+ id: requireId(id, "resolveDesign"),
328
+ type,
329
+ ...await config("design", options)
330
+ }),
331
+ updateLayout: async (layoutId, payload, options) => updateLayout({
332
+ layoutId: requireId(layoutId, "updateLayout"),
333
+ payload,
334
+ ...await config("design", options)
335
+ }),
336
+ updateTheme: async (themeId, payload, options) => updateDesignTheme({
337
+ payload,
338
+ themeId: requireId(themeId, "updateDesignTheme"),
339
+ ...await config("design", options)
340
+ })
341
+ },
342
+ flows: {
343
+ create: async (payload, options) => createFlow({
344
+ payload,
345
+ ...await config("flows", options)
346
+ }),
347
+ delete: async (flowId, options) => deleteFlow({
348
+ flowId: requireId(flowId, "deleteFlow"),
349
+ ...await config("flows", options)
350
+ }),
351
+ get: async (flowId, options) => getFlow({
352
+ flowId: requireId(flowId, "getFlow"),
353
+ ...await config("flows", options)
354
+ }),
355
+ getVersion: async (flowId, version$1, options) => getFlowVersion({
356
+ flowId: requireId(flowId, "getFlowVersion"),
357
+ version: version$1,
358
+ ...await config("flows", options)
359
+ }),
360
+ list: async ({ flowType, limit, offset,...options } = {}) => getFlows({
361
+ flowType,
362
+ limit,
363
+ offset,
364
+ ...await config("flows", options)
365
+ }),
366
+ listUsages: async (flowId, options) => getFlowUsages({
367
+ flowId: requireId(flowId, "getFlowUsages"),
368
+ ...await config("flows", options)
369
+ }),
370
+ listVersions: async (flowId, options) => getFlowVersions({
371
+ flowId: requireId(flowId, "getFlowVersions"),
372
+ ...await config("flows", options)
373
+ }),
374
+ restoreVersion: async (flowId, version$1, options) => restoreFlowVersion({
375
+ flowId: requireId(flowId, "restoreFlowVersion"),
376
+ version: version$1,
377
+ ...await config("flows", options)
378
+ }),
379
+ update: async (flowId, payload, options) => updateFlow({
380
+ flowId: requireId(flowId, "updateFlow"),
381
+ payload,
382
+ ...await config("flows", options)
383
+ })
384
+ },
385
+ gateways: {
386
+ applyConfiguration: async (gatewayId, payload, options) => applyGatewayConfiguration({
387
+ gatewayId: requireId(gatewayId, "applyGatewayConfiguration"),
388
+ payload,
389
+ ...await config("gateways", options)
390
+ }),
391
+ create: async (payload, options) => createGateway({
392
+ payload,
393
+ ...await config("gateways", options)
394
+ }),
395
+ createSecret: async (gatewayId, payload, options) => createGatewaySecret({
396
+ gatewayId: requireId(gatewayId, "createGatewaySecret"),
397
+ payload,
398
+ ...await config("gateways", options)
399
+ }),
400
+ createVariable: async (gatewayId, payload, options) => createGatewayVariable({
401
+ gatewayId: requireId(gatewayId, "createGatewayVariable"),
402
+ payload,
403
+ ...await config("gateways", options)
404
+ }),
405
+ delete: async (gatewayId, options) => deleteGateway({
406
+ gatewayId: requireId(gatewayId, "deleteGateway"),
407
+ ...await config("gateways", options)
408
+ }),
409
+ deleteSecret: async (gatewayId, name, options) => deleteGatewaySecret({
410
+ gatewayId: requireId(gatewayId, "deleteGatewaySecret"),
411
+ name: requireId(name, "deleteGatewaySecret"),
412
+ ...await config("gateways", options)
413
+ }),
414
+ deleteVariable: async (gatewayId, name, options) => deleteGatewayVariable({
415
+ gatewayId: requireId(gatewayId, "deleteGatewayVariable"),
416
+ name: requireId(name, "deleteGatewayVariable"),
417
+ ...await config("gateways", options)
418
+ }),
419
+ get: async (gatewayId, options) => getGateway({
420
+ gatewayId: requireId(gatewayId, "getGateway"),
421
+ ...await config("gateways", options)
422
+ }),
423
+ getAppliedConfiguration: async (gatewayId, options) => getGatewayAppliedConfiguration({
424
+ gatewayId: requireId(gatewayId, "getGatewayAppliedConfiguration"),
425
+ ...await config("gateways", options)
426
+ }),
427
+ getAppliedVersion: async (gatewayId, options) => getGatewayAppliedVersion({
428
+ gatewayId: requireId(gatewayId, "getGatewayAppliedVersion"),
429
+ ...await config("gateways", options)
430
+ }),
431
+ getConfigurationDiff: async (gatewayId, { version: version$1,...options } = {}) => getGatewayConfigurationDiff({
432
+ gatewayId: requireId(gatewayId, "getGatewayConfigurationDiff"),
433
+ version: version$1,
434
+ ...await config("gateways", options)
435
+ }),
436
+ getSecret: async (gatewayId, name, options) => getGatewaySecret({
437
+ gatewayId: requireId(gatewayId, "getGatewaySecret"),
438
+ name: requireId(name, "getGatewaySecret"),
439
+ ...await config("gateways", options)
440
+ }),
441
+ getVariable: async (gatewayId, name, options) => getGatewayVariable({
442
+ gatewayId: requireId(gatewayId, "getGatewayVariable"),
443
+ name: requireId(name, "getGatewayVariable"),
444
+ ...await config("gateways", options)
445
+ }),
446
+ list: async (options) => getGateways(await config("gateways", options)),
447
+ listSecrets: async (gatewayId, { filter, limit, names, offset,...options } = {}) => getGatewaySecrets({
448
+ filter,
449
+ gatewayId: requireId(gatewayId, "getGatewaySecrets"),
450
+ limit,
451
+ names,
452
+ offset,
453
+ ...await config("gateways", options)
454
+ }),
455
+ listVariables: async (gatewayId, { filter, limit, names, offset,...options } = {}) => getGatewayVariables({
456
+ filter,
457
+ gatewayId: requireId(gatewayId, "getGatewayVariables"),
458
+ limit,
459
+ names,
460
+ offset,
461
+ ...await config("gateways", options)
462
+ }),
463
+ revertConfiguration: async (gatewayId, payload, options) => revertGatewayConfiguration({
464
+ gatewayId: requireId(gatewayId, "revertGatewayConfiguration"),
465
+ payload,
466
+ ...await config("gateways", options)
467
+ }),
468
+ update: async (gatewayId, payload, options) => updateGateway({
469
+ gatewayId: requireId(gatewayId, "updateGateway"),
470
+ payload,
471
+ ...await config("gateways", options)
472
+ }),
473
+ updateSecret: async (gatewayId, name, payload, options) => updateGatewaySecret({
474
+ gatewayId: requireId(gatewayId, "updateGatewaySecret"),
475
+ name: requireId(name, "updateGatewaySecret"),
476
+ payload,
477
+ ...await config("gateways", options)
478
+ }),
479
+ updateVariable: async (gatewayId, name, payload, options) => updateGatewayVariable({
480
+ gatewayId: requireId(gatewayId, "updateGatewayVariable"),
481
+ name: requireId(name, "updateGatewayVariable"),
482
+ payload,
483
+ ...await config("gateways", options)
484
+ })
485
+ },
486
+ groups: {
487
+ addMembers: async (groupId, members, options) => addGroupMembers({
488
+ groupId: requireId(groupId, "addGroupMembers"),
489
+ members,
490
+ ...await config("groups", options)
491
+ }),
492
+ create: async (payload, options) => createGroup({
493
+ payload,
494
+ ...await config("groups", options)
495
+ }),
496
+ delete: async (groupId, options) => deleteGroup({
497
+ groupId: requireId(groupId, "deleteGroup"),
498
+ ...await config("groups", options)
499
+ }),
500
+ get: async (groupId, options) => getGroup({
501
+ groupId: requireId(groupId, "getGroup"),
502
+ ...await config("groups", options)
503
+ }),
504
+ list: async ({ limit, offset,...options } = {}) => getGroups({
505
+ limit,
506
+ offset,
507
+ ...await config("groups", options)
508
+ }),
509
+ listMembers: async (groupId, { limit, offset,...options } = {}) => getGroupMembers({
510
+ groupId: requireId(groupId, "getGroupMembers"),
511
+ limit,
512
+ offset,
513
+ ...await config("groups", options)
514
+ }),
515
+ removeMembers: async (groupId, members, options) => removeGroupMembers({
516
+ groupId: requireId(groupId, "removeGroupMembers"),
517
+ members,
518
+ ...await config("groups", options)
519
+ }),
520
+ update: async (groupId, payload, options) => updateGroup({
521
+ groupId: requireId(groupId, "updateGroup"),
522
+ payload,
523
+ ...await config("groups", options)
524
+ })
525
+ },
526
+ i18n: {
527
+ deleteTranslation: async (language, namespace, key, options) => deleteTranslation({
528
+ key,
529
+ language,
530
+ namespace,
531
+ ...await config("i18n", options)
532
+ }),
533
+ deleteTranslations: async (language, options) => deleteTranslations({
534
+ language: requireId(language, "deleteTranslations"),
535
+ ...await config("i18n", options)
536
+ }),
537
+ listLanguages: async (options) => getLanguages(await config("i18n", options)),
538
+ resolveTranslation: async (language, namespace, key, options) => resolveTranslation({
539
+ key,
540
+ language,
541
+ namespace,
542
+ ...await config("i18n", options)
543
+ }),
544
+ resolveTranslations: async (language, { namespace,...options } = {}) => resolveTranslations({
545
+ language,
546
+ namespace,
547
+ ...await config("i18n", options)
548
+ }),
549
+ setTranslation: async (language, namespace, key, payload, options) => setTranslation({
550
+ key,
551
+ language,
552
+ namespace,
553
+ payload,
554
+ ...await config("i18n", options)
555
+ }),
556
+ setTranslations: async (language, payload, options) => setTranslations({
557
+ language,
558
+ payload,
559
+ ...await config("i18n", options)
560
+ })
561
+ },
562
+ notificationTemplates: {
563
+ create: async (channel, payload, options) => createNotificationTemplate({
564
+ channel: requireId(channel, "createNotificationTemplate"),
565
+ payload,
566
+ ...await config("notificationTemplates", options)
567
+ }),
568
+ delete: async (channel, templateId, options) => deleteNotificationTemplate({
569
+ channel: requireId(channel, "deleteNotificationTemplate"),
570
+ templateId: requireId(templateId, "deleteNotificationTemplate"),
571
+ ...await config("notificationTemplates", options)
572
+ }),
573
+ get: async (channel, templateId, options) => getNotificationTemplate({
574
+ channel: requireId(channel, "getNotificationTemplate"),
575
+ templateId: requireId(templateId, "getNotificationTemplate"),
576
+ ...await config("notificationTemplates", options)
577
+ }),
578
+ list: async (channel, { limit, offset,...options } = {}) => getNotificationTemplates({
579
+ channel: requireId(channel, "getNotificationTemplates"),
580
+ limit,
581
+ offset,
582
+ ...await config("notificationTemplates", options)
583
+ }),
584
+ update: async (channel, templateId, payload, options) => updateNotificationTemplate({
585
+ channel: requireId(channel, "updateNotificationTemplate"),
586
+ payload,
587
+ templateId: requireId(templateId, "updateNotificationTemplate"),
588
+ ...await config("notificationTemplates", options)
589
+ })
590
+ },
591
+ organizationUnits: {
592
+ create: async (payload, options) => createOrganizationUnit({
593
+ payload,
594
+ ...await config("organizationUnits", options)
595
+ }),
596
+ delete: async (ouId, options) => deleteOrganizationUnit({
597
+ ouId: requireId(ouId, "deleteOrganizationUnit"),
598
+ ...await config("organizationUnits", options)
599
+ }),
600
+ deleteByPath: async (path, options) => deleteOrganizationUnitByPath({
601
+ path,
602
+ ...await config("organizationUnits", options)
603
+ }),
604
+ get: async (ouId, options) => getOrganizationUnit({
605
+ ouId: requireId(ouId, "getOrganizationUnit"),
606
+ ...await config("organizationUnits", options)
607
+ }),
608
+ getByPath: async (path, options) => getOrganizationUnitByPath({
609
+ path,
610
+ ...await config("organizationUnits", options)
611
+ }),
612
+ list: async ({ filter, limit, offset,...options } = {}) => getOrganizationUnits({
613
+ filter,
614
+ limit,
615
+ offset,
616
+ ...await config("organizationUnits", options)
617
+ }),
618
+ listChildren: async (unit, { filter, limit, offset,...options } = {}) => getOrganizationUnitChildren({
619
+ filter,
620
+ limit,
621
+ offset,
622
+ ouId: unit?.ouId,
623
+ path: unit?.path,
624
+ ...await config("organizationUnits", options)
625
+ }),
626
+ listGroups: async (unit, { limit, offset,...options } = {}) => getOrganizationUnitGroups({
627
+ ...unit,
628
+ limit,
629
+ offset,
630
+ ...await config("organizationUnits", options)
631
+ }),
632
+ listRoles: async (unit, { limit, offset,...options } = {}) => getOrganizationUnitRoles({
633
+ ...unit,
634
+ limit,
635
+ offset,
636
+ ...await config("organizationUnits", options)
637
+ }),
638
+ listUsers: async (unit, { limit, offset,...options } = {}) => getOrganizationUnitUsers({
639
+ ...unit,
640
+ limit,
641
+ offset,
642
+ ...await config("organizationUnits", options)
643
+ }),
644
+ update: async (ouId, payload, options) => updateOrganizationUnit({
645
+ ouId: requireId(ouId, "updateOrganizationUnit"),
646
+ payload,
647
+ ...await config("organizationUnits", options)
648
+ }),
649
+ updateByPath: async (path, payload, options) => updateOrganizationUnitByPath({
650
+ path,
651
+ payload,
652
+ ...await config("organizationUnits", options)
653
+ })
654
+ },
655
+ resourceServers: {
656
+ create: async (payload, options) => createResourceServer({
657
+ payload,
658
+ ...await config("resourceServers", options)
659
+ }),
660
+ createAction: async (resourceServerId, payload, { resourceId,...options } = {}) => createAction({
661
+ payload,
662
+ resourceId,
663
+ resourceServerId: requireId(resourceServerId, "createAction"),
664
+ ...await config("resourceServers", options)
665
+ }),
666
+ createResource: async (resourceServerId, payload, options) => createResource({
667
+ payload,
668
+ resourceServerId: requireId(resourceServerId, "createResource"),
669
+ ...await config("resourceServers", options)
670
+ }),
671
+ delete: async (resourceServerId, options) => deleteResourceServer({
672
+ resourceServerId: requireId(resourceServerId, "deleteResourceServer"),
673
+ ...await config("resourceServers", options)
674
+ }),
675
+ deleteAction: async (resourceServerId, actionId, { administrationMode, resourceId,...options } = {}) => deleteAction({
676
+ actionId: requireId(actionId, "deleteAction"),
677
+ administrationMode,
678
+ resourceId,
679
+ resourceServerId: requireId(resourceServerId, "deleteAction"),
680
+ ...await config("resourceServers", options)
681
+ }),
682
+ deleteResource: async (resourceServerId, resourceId, options) => deleteResource({
683
+ resourceId: requireId(resourceId, "deleteResource"),
684
+ resourceServerId: requireId(resourceServerId, "deleteResource"),
685
+ ...await config("resourceServers", options)
686
+ }),
687
+ get: async (resourceServerId, options) => getResourceServer({
688
+ resourceServerId: requireId(resourceServerId, "getResourceServer"),
689
+ ...await config("resourceServers", options)
690
+ }),
691
+ getAction: async (resourceServerId, actionId, { resourceId,...options } = {}) => getAction({
692
+ actionId: requireId(actionId, "getAction"),
693
+ resourceId,
694
+ resourceServerId: requireId(resourceServerId, "getAction"),
695
+ ...await config("resourceServers", options)
696
+ }),
697
+ getResource: async (resourceServerId, resourceId, options) => getResource({
698
+ resourceId: requireId(resourceId, "getResource"),
699
+ resourceServerId: requireId(resourceServerId, "getResource"),
700
+ ...await config("resourceServers", options)
701
+ }),
702
+ list: async ({ limit, offset,...options } = {}) => getResourceServers({
703
+ limit,
704
+ offset,
705
+ ...await config("resourceServers", options)
706
+ }),
707
+ listActions: async (resourceServerId, { kind, limit, offset, resourceId,...options } = {}) => getActions({
708
+ kind,
709
+ limit,
710
+ offset,
711
+ resourceId,
712
+ resourceServerId: requireId(resourceServerId, "getActions"),
713
+ ...await config("resourceServers", options)
714
+ }),
715
+ listResources: async (resourceServerId, { limit, offset, parentId,...options } = {}) => getResources({
716
+ limit,
717
+ offset,
718
+ parentId,
719
+ resourceServerId: requireId(resourceServerId, "getResources"),
720
+ ...await config("resourceServers", options)
721
+ }),
722
+ update: async (resourceServerId, payload, options) => updateResourceServer({
723
+ payload,
724
+ resourceServerId: requireId(resourceServerId, "updateResourceServer"),
725
+ ...await config("resourceServers", options)
726
+ }),
727
+ updateAction: async (resourceServerId, actionId, payload, { resourceId,...options } = {}) => updateAction({
728
+ actionId: requireId(actionId, "updateAction"),
729
+ payload,
730
+ resourceId,
731
+ resourceServerId: requireId(resourceServerId, "updateAction"),
732
+ ...await config("resourceServers", options)
733
+ }),
734
+ updateResource: async (resourceServerId, resourceId, payload, options) => updateResource({
735
+ payload,
736
+ resourceId: requireId(resourceId, "updateResource"),
737
+ resourceServerId: requireId(resourceServerId, "updateResource"),
738
+ ...await config("resourceServers", options)
739
+ })
740
+ },
741
+ roles: {
742
+ addAssignments: async (roleId, assignments, options) => addRoleAssignments({
743
+ assignments,
744
+ roleId: requireId(roleId, "addRoleAssignments"),
745
+ ...await config("roles", options)
746
+ }),
747
+ create: async (payload, options) => createRole({
748
+ payload,
749
+ ...await config("roles", options)
750
+ }),
751
+ delete: async (roleId, options) => deleteRole({
752
+ roleId: requireId(roleId, "deleteRole"),
753
+ ...await config("roles", options)
754
+ }),
755
+ get: async (roleId, options) => getRole({
756
+ roleId: requireId(roleId, "getRole"),
757
+ ...await config("roles", options)
758
+ }),
759
+ list: async ({ limit, offset,...options } = {}) => getRoles({
760
+ limit,
761
+ offset,
762
+ ...await config("roles", options)
763
+ }),
764
+ listAssignments: async (roleId, { limit, offset, type,...options } = {}) => getRoleAssignments({
765
+ limit,
766
+ offset,
767
+ roleId: requireId(roleId, "getRoleAssignments"),
768
+ type,
769
+ ...await config("roles", options)
770
+ }),
771
+ removeAssignments: async (roleId, assignments, options) => removeRoleAssignments({
772
+ assignments,
773
+ roleId: requireId(roleId, "removeRoleAssignments"),
774
+ ...await config("roles", options)
775
+ }),
776
+ update: async (roleId, payload, options) => updateRole({
777
+ payload,
778
+ roleId: requireId(roleId, "updateRole"),
779
+ ...await config("roles", options)
780
+ })
781
+ },
782
+ secrets: {
783
+ create: async (payload, options) => createSecret({
784
+ payload,
785
+ ...await config("secrets", options)
786
+ }),
787
+ delete: async (name, options) => deleteSecret({
788
+ name: requireId(name, "deleteSecret"),
789
+ ...await config("secrets", options)
790
+ }),
791
+ get: async (name, options) => getSecret({
792
+ name: requireId(name, "getSecret"),
793
+ ...await config("secrets", options)
794
+ }),
795
+ list: async ({ filter, limit, names, offset,...options } = {}) => getSecrets({
796
+ filter,
797
+ limit,
798
+ names,
799
+ offset,
800
+ ...await config("secrets", options)
801
+ }),
802
+ update: async (name, payload, options) => updateSecret({
803
+ name: requireId(name, "updateSecret"),
804
+ payload,
805
+ ...await config("secrets", options)
806
+ })
807
+ },
808
+ serverConfig: {
809
+ get: async (name, options) => getServerConfig({
810
+ name: requireId(name, "getServerConfig"),
811
+ ...await config("serverConfig", options)
812
+ }),
813
+ list: async (options) => getServerConfigs(await config("serverConfig", options)),
814
+ update: async (name, payload, options) => updateServerConfig({
815
+ name: requireId(name, "updateServerConfig"),
816
+ payload,
817
+ ...await config("serverConfig", options)
818
+ })
819
+ },
820
+ userTypes: { list: async ({ limit, offset,...options } = {}) => getUserTypes({
821
+ limit,
822
+ offset,
823
+ ...await config("userTypes", options)
824
+ }) },
825
+ users: {
826
+ create: async (payload, options) => createUser({
827
+ payload,
828
+ ...await config("users", options)
829
+ }),
830
+ createByPath: async (path, payload, options) => createUserByPath({
831
+ path,
832
+ payload,
833
+ ...await config("users", options)
834
+ }),
835
+ createSharingPolicy: async (userId, payload, options) => createUserSharingPolicy({
836
+ payload,
837
+ userId: requireId(userId, "createUserSharingPolicy"),
838
+ ...await config("users", options)
839
+ }),
840
+ delete: async (userId, options) => deleteUser({
841
+ userId: requireId(userId, "deleteUser"),
842
+ ...await config("users", options)
843
+ }),
844
+ deleteSharingPolicy: async (userId, policyId, options) => deleteUserSharingPolicy({
845
+ policyId: requireId(policyId, "deleteUserSharingPolicy"),
846
+ userId: requireId(userId, "deleteUserSharingPolicy"),
847
+ ...await config("users", options)
848
+ }),
849
+ get: async (userId, options) => getUser({
850
+ userId: requireId(userId, "getUser"),
851
+ ...await config("users", options)
852
+ }),
853
+ getOverlayRules: async (userId, ouId, options) => getUserOverlayRules({
854
+ ouId: requireId(ouId, "getUserOverlayRules"),
855
+ userId: requireId(userId, "getUserOverlayRules"),
856
+ ...await config("users", options)
857
+ }),
858
+ getSharingPolicy: async (userId, policyId, options) => getUserSharingPolicy({
859
+ policyId: requireId(policyId, "getUserSharingPolicy"),
860
+ userId: requireId(userId, "getUserSharingPolicy"),
861
+ ...await config("users", options)
862
+ }),
863
+ list: async ({ filter, limit, offset,...options } = {}) => getUsers({
864
+ filter,
865
+ limit,
866
+ offset,
867
+ ...await config("users", options)
868
+ }),
869
+ listByPath: async (path, { limit, offset,...options } = {}) => getUsersByPath({
870
+ limit,
871
+ offset,
872
+ path,
873
+ ...await config("users", options)
874
+ }),
875
+ listGroups: async (userId, { limit, offset,...options } = {}) => getUserGroups({
876
+ limit,
877
+ offset,
878
+ userId: requireId(userId, "getUserGroups"),
879
+ ...await config("users", options)
880
+ }),
881
+ listSharingPolicies: async (userId, { limit, offset,...options } = {}) => getUserSharingPolicies({
882
+ limit,
883
+ offset,
884
+ userId: requireId(userId, "getUserSharingPolicies"),
885
+ ...await config("users", options)
886
+ }),
887
+ suspend: async (userId, { operatorNote,...options } = {}) => suspendUser({
888
+ operatorNote,
889
+ userId: requireId(userId, "suspendUser"),
890
+ ...await config("users", options)
891
+ }),
892
+ unlock: async (userId, { operatorNote,...options } = {}) => unlockUser({
893
+ operatorNote,
894
+ userId: requireId(userId, "unlockUser"),
895
+ ...await config("users", options)
896
+ }),
897
+ unsuspend: async (userId, { operatorNote,...options } = {}) => unsuspendUser({
898
+ operatorNote,
899
+ userId: requireId(userId, "unsuspendUser"),
900
+ ...await config("users", options)
901
+ }),
902
+ update: async (userId, payload, options) => updateUser({
903
+ payload,
904
+ userId: requireId(userId, "updateUser"),
905
+ ...await config("users", options)
906
+ }),
907
+ updateSharingPolicy: async (userId, policyId, payload, options) => updateUserSharingPolicy({
908
+ payload,
909
+ policyId: requireId(policyId, "updateUserSharingPolicy"),
910
+ userId: requireId(userId, "updateUserSharingPolicy"),
911
+ ...await config("users", options)
912
+ })
913
+ },
914
+ variables: {
915
+ create: async (payload, options) => createVariable({
916
+ payload,
917
+ ...await config("variables", options)
918
+ }),
919
+ delete: async (name, options) => deleteVariable({
920
+ name: requireId(name, "deleteVariable"),
921
+ ...await config("variables", options)
922
+ }),
923
+ get: async (name, options) => getVariable({
924
+ name: requireId(name, "getVariable"),
925
+ ...await config("variables", options)
926
+ }),
927
+ list: async ({ filter, limit, names, offset,...options } = {}) => getVariables({
928
+ filter,
929
+ limit,
930
+ names,
931
+ offset,
932
+ ...await config("variables", options)
933
+ }),
934
+ update: async (name, payload, options) => updateVariable({
935
+ name: requireId(name, "updateVariable"),
936
+ payload,
937
+ ...await config("variables", options)
938
+ })
939
+ }
940
+ };
941
+ };
942
+ var createManagementClient_default = createManagementClient;
943
+
31
944
  //#endregion
32
945
  //#region src/utils/NodeCryptoUtils.ts
33
946
  /**
@@ -407,6 +1320,49 @@ var ThunderIDNodeClient = class extends ThunderIDJavaScriptClient {
407
1320
  };
408
1321
  }
409
1322
  /**
1323
+ * Returns the management operations (users, groups, roles, agents, and their sub-resources) bound
1324
+ * to the session identified by `sessionId`.
1325
+ *
1326
+ * Every request is authorized with that session's access token, read at the time of each call; the
1327
+ * token is never copied onto the returned object or exposed to the caller. Whether a call succeeds
1328
+ * is the server's decision: the token needs the permissions the server requires for that resource.
1329
+ *
1330
+ * The collection URL comes from, in order: the `url` passed to the call, then `endpoints.<resource>`
1331
+ * in the configuration, then `{baseUrl}/{collection}`.
1332
+ *
1333
+ * @param sessionId - The session whose access token authorizes the requests.
1334
+ * @returns The session-bound management client.
1335
+ * @throws {ThunderIDRuntimeError} `NODE-MANAGEMENT-RC-NF01`, from an operation, when the session
1336
+ * has no access token. Raised before any request is sent.
1337
+ * @throws {ThunderIDAPIError} From an operation, when the server rejects the request. HTTP 403 and
1338
+ * 404 surface as `<operation>-ForbiddenError-001` and `<operation>-NotFoundError-001`.
1339
+ *
1340
+ * @example
1341
+ * ```typescript
1342
+ * const admin = client.management(sessionId);
1343
+ * const {users, totalResults} = await admin.users.list({limit: 20});
1344
+ * await admin.groups.addMembers(groupId, [{id: users[0].id, type: 'user'}]);
1345
+ * ```
1346
+ */
1347
+ management(sessionId) {
1348
+ return createManagementClient_default((key, explicitUrl) => this.sessionManagementRequestConfig(key, sessionId, explicitUrl));
1349
+ }
1350
+ /**
1351
+ * The URL inputs and bearer token for a management request made through {@link management}. Unlike
1352
+ * {@link managementRequestConfig}, a session without an access token is refused here rather than
1353
+ * sent to the server with an empty credential.
1354
+ */
1355
+ async sessionManagementRequestConfig(key, sessionId, explicitUrl) {
1356
+ const configData = await this.getStorageManager().getConfigData();
1357
+ const accessToken = await this.getAccessToken(sessionId);
1358
+ if (!accessToken) throw new ThunderIDRuntimeError("No access token is available for the session. Sign in before calling a management operation.", "NODE-MANAGEMENT-RC-NF01", "node");
1359
+ return {
1360
+ baseUrl: configData?.baseUrl,
1361
+ headers: { Authorization: `Bearer ${accessToken}` },
1362
+ url: resolveResourceEndpoint(key, configData, explicitUrl)
1363
+ };
1364
+ }
1365
+ /**
410
1366
  * Retrieves one page of the user directory on behalf of the session identified by `userId`.
411
1367
  *
412
1368
  * Makes a single request and does not follow `links`. The access token stays on the server.
@@ -685,6 +1641,79 @@ var LoggedOutSessions_default = LoggedOutSessions;
685
1641
  const generateSessionId = () => (/* @__PURE__ */ new Date()).getTime().toString(36) + Math.random().toString(36).substring(2);
686
1642
  var generateSessionId_default = generateSessionId;
687
1643
 
1644
+ //#endregion
1645
+ //#region src/utils/managementCollections.ts
1646
+ /**
1647
+ * The management collections a browser may reach through a server-side management relay, keyed by
1648
+ * their `endpoints` override key, with the path each one has under `baseUrl`.
1649
+ */
1650
+ const MANAGEMENT_COLLECTIONS = {
1651
+ agentTypes: "agent-types",
1652
+ agents: "agents",
1653
+ applications: "applications",
1654
+ configurationVersions: "configuration-versions",
1655
+ connections: "connections",
1656
+ design: "design",
1657
+ export: "export",
1658
+ flows: "flows",
1659
+ gateways: "gateways",
1660
+ groups: "groups",
1661
+ i18n: "i18n",
1662
+ import: "import",
1663
+ notificationTemplates: "notification-templates",
1664
+ organizationUnits: "organization-units",
1665
+ resourceServers: "resource-servers",
1666
+ roles: "roles",
1667
+ secrets: "secrets",
1668
+ serverConfig: "server-config",
1669
+ userTypes: "user-types",
1670
+ users: "users",
1671
+ variables: "variables"
1672
+ };
1673
+ const MANAGEMENT_COLLECTION_KEYS = Object.keys(MANAGEMENT_COLLECTIONS);
1674
+ /**
1675
+ * The collection URLs a management request may target for this configuration: each collection's
1676
+ * `endpoints` override, or `{baseUrl}/{path}` and the organization-scoped `{baseUrl}/o/{path}`.
1677
+ */
1678
+ const getManagementCollectionUrls = (config) => {
1679
+ const urls = [];
1680
+ const baseUrl = config?.baseUrl?.replace(/\/+$/, "");
1681
+ MANAGEMENT_COLLECTION_KEYS.forEach((key) => {
1682
+ const override = resolveResourceEndpoint(key, config);
1683
+ (override ? [override] : baseUrl ? [`${baseUrl}/${MANAGEMENT_COLLECTIONS[key]}`, `${baseUrl}/o/${MANAGEMENT_COLLECTIONS[key]}`] : []).forEach((candidate) => {
1684
+ try {
1685
+ urls.push(new URL(candidate.replace(/\/+$/, "")));
1686
+ } catch {}
1687
+ });
1688
+ });
1689
+ return urls;
1690
+ };
1691
+ /**
1692
+ * Whether `target` addresses one of the management collections, or a resource or sub-resource under
1693
+ * one. The comparison runs on the parsed URL, so dot segments are resolved before it, and an
1694
+ * encoded slash, backslash or dot, which an upstream could decode into a different path, is refused.
1695
+ *
1696
+ * @param target - The absolute URL the browser asked for.
1697
+ * @param collections - The allowed collection URLs, from {@link getManagementCollectionUrls}.
1698
+ * @returns The parsed URL when it is allowed, otherwise `undefined`.
1699
+ */
1700
+ const matchManagementUrl = (target, collections) => {
1701
+ if (typeof target !== "string" || target.length > 4096) return;
1702
+ let url;
1703
+ try {
1704
+ url = new URL(target);
1705
+ } catch {
1706
+ return;
1707
+ }
1708
+ if (url.protocol !== "https:" && url.protocol !== "http:" || url.username || url.password || url.hash) return;
1709
+ if (/%(2e|2f|5c)/i.test(url.pathname)) return;
1710
+ return collections.some((collection) => {
1711
+ if (collection.origin !== url.origin) return false;
1712
+ const base = collection.pathname.replace(/\/+$/, "");
1713
+ return url.pathname === base || url.pathname.startsWith(`${base}/`);
1714
+ }) ? url : void 0;
1715
+ };
1716
+
688
1717
  //#endregion
689
1718
  //#region src/utils/getSessionCookieOptions.ts
690
1719
  const getSessionCookieOptions = (options) => ({
@@ -704,4 +1733,4 @@ if (!globalThis.fetch) {
704
1733
  }
705
1734
 
706
1735
  //#endregion
707
- export { CookieChunking_default as CookieChunking, CookieConfig_default as CookieConfig, InMemoryLogoutRecordStore, LoggedOutSessions_default as LoggedOutSessions, MemoryCacheStore_default as MemoryCacheStore, NodeCryptoUtils_default as NodeCryptoUtils, SessionIndex_default as SessionIndex, SessionUtils_default as SessionUtils, ThunderIDNodeClient_default as ThunderIDNodeClient, generateSessionId_default as generateSessionId, getSessionCookieOptions_default as getSessionCookieOptions };
1736
+ export { CookieChunking_default as CookieChunking, CookieConfig_default as CookieConfig, InMemoryLogoutRecordStore, LoggedOutSessions_default as LoggedOutSessions, MANAGEMENT_COLLECTIONS, MANAGEMENT_COLLECTION_KEYS, MemoryCacheStore_default as MemoryCacheStore, NodeCryptoUtils_default as NodeCryptoUtils, SessionIndex_default as SessionIndex, SessionUtils_default as SessionUtils, ThunderIDNodeClient_default as ThunderIDNodeClient, createManagementClient_default as createManagementClient, generateSessionId_default as generateSessionId, getManagementCollectionUrls, getSessionCookieOptions_default as getSessionCookieOptions, matchManagementUrl };