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