@authhero/multi-tenancy 14.13.0 → 14.14.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.
@@ -1,30 +1,30 @@
1
- var Y = Object.defineProperty;
2
- var Z = (e, t, n) => t in e ? Y(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var M = (e, t, n) => Z(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { Hono as x } from "hono";
5
- import { MANAGEMENT_API_SCOPES as ee, MANAGEMENT_API_AUDIENCE as Q, fetchAll as z, auth0QuerySchema as te, tenantSchema as N, tenantInsertSchema as ne, connectionSchema as re, connectionOptionsSchema as se, init as ae } from "authhero";
6
- import { OpenAPIHono as oe, createRoute as O, z as S } from "@hono/zod-openapi";
7
- function ie(e) {
1
+ var Z = Object.defineProperty;
2
+ var x = (e, t, n) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var q = (e, t, n) => x(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { Hono as ee } from "hono";
5
+ import { MANAGEMENT_API_SCOPES as te, MANAGEMENT_API_AUDIENCE as V, fetchAll as M, auth0QuerySchema as ne, tenantSchema as B, tenantInsertSchema as re, connectionSchema as ae, connectionOptionsSchema as se, init as oe } from "authhero";
6
+ import { OpenAPIHono as ie, createRoute as j, z } from "@hono/zod-openapi";
7
+ function ce(e) {
8
8
  const { controlPlaneTenantId: t, requireOrganizationMatch: n = !0 } = e;
9
9
  return {
10
- async onTenantAccessValidation(r, s) {
11
- if (s === t)
10
+ async onTenantAccessValidation(r, a) {
11
+ if (a === t)
12
12
  return !0;
13
13
  if (n) {
14
- const a = r.var.org_name, o = r.var.organization_id, i = a || o;
15
- return i ? i.toLowerCase() === s.toLowerCase() : !1;
14
+ const s = r.var.org_name, o = r.var.organization_id, i = s || o;
15
+ return i ? i.toLowerCase() === a.toLowerCase() : !1;
16
16
  }
17
17
  return !0;
18
18
  }
19
19
  };
20
20
  }
21
- function ce(e, t, n, r) {
21
+ function le(e, t, n, r) {
22
22
  if (t === n)
23
23
  return !0;
24
- const s = r || e;
25
- return s ? s.toLowerCase() === t.toLowerCase() : !1;
24
+ const a = r || e;
25
+ return a ? a.toLowerCase() === t.toLowerCase() : !1;
26
26
  }
27
- function le(e) {
27
+ function ue(e) {
28
28
  return {
29
29
  async resolveDataAdapters(t) {
30
30
  try {
@@ -39,23 +39,23 @@ function le(e) {
39
39
  }
40
40
  };
41
41
  }
42
- function ue(e) {
42
+ function de(e) {
43
43
  return `urn:authhero:tenant:${e.toLowerCase()}`;
44
44
  }
45
- function de(e) {
45
+ function J(e) {
46
46
  return {
47
47
  async beforeCreate(t, n) {
48
48
  return !n.audience && n.id ? {
49
49
  ...n,
50
- audience: ue(n.id)
50
+ audience: de(n.id)
51
51
  } : n;
52
52
  },
53
53
  async afterCreate(t, n) {
54
- const { accessControl: r, databaseIsolation: s } = e;
55
- r && t.ctx && await fe(t, n, r), s != null && s.onProvision && await s.onProvision(n.id);
54
+ const { accessControl: r, databaseIsolation: a } = e;
55
+ r && t.ctx && await fe(t, n, r), a != null && a.onProvision && await a.onProvision(n.id);
56
56
  },
57
57
  async beforeDelete(t, n) {
58
- const { accessControl: r, databaseIsolation: s } = e;
58
+ const { accessControl: r, databaseIsolation: a } = e;
59
59
  if (r)
60
60
  try {
61
61
  const o = (await t.adapters.organizations.list(
@@ -65,19 +65,19 @@ function de(e) {
65
65
  r.controlPlaneTenantId,
66
66
  o.id
67
67
  );
68
- } catch (a) {
68
+ } catch (s) {
69
69
  console.warn(
70
70
  `Failed to remove organization for tenant ${n}:`,
71
- a
71
+ s
72
72
  );
73
73
  }
74
- if (s != null && s.onDeprovision)
74
+ if (a != null && a.onDeprovision)
75
75
  try {
76
- await s.onDeprovision(n);
77
- } catch (a) {
76
+ await a.onDeprovision(n);
77
+ } catch (s) {
78
78
  console.warn(
79
79
  `Failed to deprovision database for tenant ${n}:`,
80
- a
80
+ s
81
81
  );
82
82
  }
83
83
  }
@@ -86,8 +86,8 @@ function de(e) {
86
86
  async function fe(e, t, n) {
87
87
  const {
88
88
  controlPlaneTenantId: r,
89
- defaultPermissions: s,
90
- defaultRoles: a,
89
+ defaultPermissions: a,
90
+ defaultRoles: s,
91
91
  issuer: o,
92
92
  adminRoleName: i = "Tenant Admin",
93
93
  adminRoleDescription: u = "Full access to all tenant management operations",
@@ -130,10 +130,10 @@ async function fe(e, t, n) {
130
130
  );
131
131
  }
132
132
  }
133
- a && a.length > 0 && console.log(
134
- `Would assign roles ${a.join(", ")} to organization ${l.id}`
135
- ), s && s.length > 0 && console.log(
136
- `Would grant permissions ${s.join(", ")} to organization ${l.id}`
133
+ s && s.length > 0 && console.log(
134
+ `Would assign roles ${s.join(", ")} to organization ${l.id}`
135
+ ), a && a.length > 0 && console.log(
136
+ `Would grant permissions ${a.join(", ")} to organization ${l.id}`
137
137
  );
138
138
  }
139
139
  async function me(e, t, n) {
@@ -144,10 +144,10 @@ async function me(e, t, n) {
144
144
  ""
145
145
  // Empty string for global roles
146
146
  );
147
- for (const s of r)
147
+ for (const a of r)
148
148
  if ((await e.adapters.rolePermissions.list(
149
149
  t,
150
- s.id,
150
+ a.id,
151
151
  { per_page: 1e3 }
152
152
  )).some(
153
153
  (i) => i.permission_name === "admin:organizations"
@@ -156,13 +156,13 @@ async function me(e, t, n) {
156
156
  return !1;
157
157
  }
158
158
  async function ge(e, t, n, r) {
159
- const a = (await e.adapters.roles.list(t, {})).roles.find((c) => c.name === n);
160
- if (a)
161
- return a.id;
159
+ const s = (await e.adapters.roles.list(t, {})).roles.find((c) => c.name === n);
160
+ if (s)
161
+ return s.id;
162
162
  const o = await e.adapters.roles.create(t, {
163
163
  name: n,
164
164
  description: r
165
- }), i = Q, u = ee.map((c) => ({
165
+ }), i = V, u = te.map((c) => ({
166
166
  role_id: o.id,
167
167
  resource_server_identifier: i,
168
168
  permission_name: c.value
@@ -173,8 +173,8 @@ async function ge(e, t, n, r) {
173
173
  u
174
174
  ), o.id;
175
175
  }
176
- function H(e, t, n = () => !0) {
177
- const { controlPlaneTenantId: r, getChildTenantIds: s, getAdapters: a } = e, o = /* @__PURE__ */ new Map();
176
+ function G(e, t, n = () => !0) {
177
+ const { controlPlaneTenantId: r, getChildTenantIds: a, getAdapters: s } = e, o = /* @__PURE__ */ new Map();
178
178
  async function i(l, g, d) {
179
179
  return (await t(l).list(g, {
180
180
  q: `name:${d}`,
@@ -182,19 +182,19 @@ function H(e, t, n = () => !0) {
182
182
  }))[0] ?? null;
183
183
  }
184
184
  async function u(l) {
185
- const g = await s(), d = t(await a(r));
185
+ const g = await a(), d = t(await s(r));
186
186
  await Promise.all(
187
187
  g.map(async (f) => {
188
188
  try {
189
- const m = await a(f), w = t(m), p = {
189
+ const m = await s(f), w = t(m), h = {
190
190
  ...d.transform(l),
191
191
  is_system: !0
192
- }, y = await i(m, f, l.name), _ = y ? w.getId(y) : void 0;
193
- if (y && _) {
194
- const T = w.preserveOnUpdate ? w.preserveOnUpdate(y, p) : p;
195
- await w.update(f, _, T);
192
+ }, _ = await i(m, f, l.name), P = _ ? w.getId(_) : void 0;
193
+ if (_ && P) {
194
+ const b = w.preserveOnUpdate ? w.preserveOnUpdate(_, h) : h;
195
+ await w.update(f, P, b);
196
196
  } else
197
- await w.create(f, p);
197
+ await w.create(f, h);
198
198
  } catch (m) {
199
199
  console.error(
200
200
  `Failed to sync ${d.listKey} "${l.name}" to tenant "${f}":`,
@@ -205,12 +205,12 @@ function H(e, t, n = () => !0) {
205
205
  );
206
206
  }
207
207
  async function c(l) {
208
- const g = await s();
208
+ const g = await a();
209
209
  await Promise.all(
210
210
  g.map(async (d) => {
211
211
  try {
212
- const f = await a(d), m = t(f), w = await i(f, d, l), h = w ? m.getId(w) : void 0;
213
- w && h && await m.remove(d, h);
212
+ const f = await s(d), m = t(f), w = await i(f, d, l), C = w ? m.getId(w) : void 0;
213
+ w && C && await m.remove(d, C);
214
214
  } catch (f) {
215
215
  console.error(
216
216
  `Failed to delete entity "${l}" from tenant "${d}":`,
@@ -239,13 +239,13 @@ function H(e, t, n = () => !0) {
239
239
  }
240
240
  };
241
241
  }
242
- function B(e, t, n = () => !0) {
243
- const { controlPlaneTenantId: r, getControlPlaneAdapters: s, getAdapters: a } = e;
242
+ function U(e, t, n = () => !0) {
243
+ const { controlPlaneTenantId: r, getControlPlaneAdapters: a, getAdapters: s } = e;
244
244
  return {
245
245
  async afterCreate(o, i) {
246
246
  if (i.id !== r)
247
247
  try {
248
- const u = await s(), c = await a(i.id), l = t(u), g = t(c), d = await z(
248
+ const u = await a(), c = await s(i.id), l = t(u), g = t(c), d = await M(
249
249
  (f) => l.listPaginated(r, f),
250
250
  l.listKey,
251
251
  { cursorField: "id", pageSize: 100 }
@@ -275,7 +275,7 @@ function B(e, t, n = () => !0) {
275
275
  }
276
276
  };
277
277
  }
278
- const G = (e) => ({
278
+ const L = (e) => ({
279
279
  list: async (t, n) => (await e.resourceServers.list(t, n)).resource_servers,
280
280
  listPaginated: (t, n) => e.resourceServers.list(t, n),
281
281
  get: (t, n) => e.resourceServers.get(t, n),
@@ -293,7 +293,7 @@ const G = (e) => ({
293
293
  token_lifetime: t.token_lifetime,
294
294
  token_lifetime_for_web: t.token_lifetime_for_web
295
295
  })
296
- }), U = (e) => ({
296
+ }), H = (e) => ({
297
297
  list: async (t, n) => (await e.roles.list(t, n)).roles,
298
298
  listPaginated: (t, n) => e.roles.list(t, n),
299
299
  get: (t, n) => e.roles.get(t, n),
@@ -308,92 +308,92 @@ const G = (e) => ({
308
308
  description: t.description
309
309
  })
310
310
  });
311
- function L(e) {
311
+ function W(e) {
312
312
  var t;
313
313
  return ((t = e.metadata) == null ? void 0 : t.sync) !== !1;
314
314
  }
315
315
  function we(e) {
316
- const { sync: t = {}, filters: n = {} } = e, r = t.resourceServers ?? !0, s = t.roles ?? !0, a = (m) => L(m) ? n.resourceServers ? n.resourceServers(m) : !0 : !1, o = (m) => L(m) ? n.roles ? n.roles(m) : !0 : !1, i = r ? H(
316
+ const { sync: t = {}, filters: n = {} } = e, r = t.resourceServers ?? !0, a = t.roles ?? !0, s = (m) => W(m) ? n.resourceServers ? n.resourceServers(m) : !0 : !1, o = (m) => W(m) ? n.roles ? n.roles(m) : !0 : !1, i = r ? G(
317
317
  e,
318
- G,
319
- a
320
- ) : void 0, u = s ? H(e, U, o) : void 0, c = r ? B(
318
+ L,
319
+ s
320
+ ) : void 0, u = a ? G(e, H, o) : void 0, c = r ? U(
321
321
  e,
322
- G,
323
- a
324
- ) : void 0, l = s ? B(
322
+ L,
323
+ s
324
+ ) : void 0, l = a ? U(
325
325
  e,
326
- U,
326
+ H,
327
327
  o
328
- ) : void 0, g = s ? {
328
+ ) : void 0, g = a ? {
329
329
  async afterCreate(m, w) {
330
- var h;
330
+ var C;
331
331
  if (w.id !== e.controlPlaneTenantId) {
332
- await ((h = l == null ? void 0 : l.afterCreate) == null ? void 0 : h.call(l, m, w));
332
+ await ((C = l == null ? void 0 : l.afterCreate) == null ? void 0 : C.call(l, m, w));
333
333
  try {
334
- const p = await e.getControlPlaneAdapters(), y = await e.getAdapters(w.id), _ = await z(
335
- (C) => p.roles.list(
334
+ const h = await e.getControlPlaneAdapters(), _ = await e.getAdapters(w.id), P = await M(
335
+ (p) => h.roles.list(
336
336
  e.controlPlaneTenantId,
337
- C
337
+ p
338
338
  ),
339
339
  "roles",
340
340
  { cursorField: "id", pageSize: 100 }
341
- ), T = /* @__PURE__ */ new Map();
342
- for (const C of _.filter(
343
- (v) => {
344
- var P;
345
- return ((P = n.roles) == null ? void 0 : P.call(n, v)) ?? !0;
341
+ ), b = /* @__PURE__ */ new Map();
342
+ for (const p of P.filter(
343
+ (T) => {
344
+ var y;
345
+ return ((y = n.roles) == null ? void 0 : y.call(n, T)) ?? !0;
346
346
  }
347
347
  )) {
348
- const v = await d(
349
- y,
348
+ const T = await d(
349
+ _,
350
350
  w.id,
351
- C.name
351
+ p.name
352
352
  );
353
- v && T.set(C.name, v.id);
353
+ T && b.set(p.name, T.id);
354
354
  }
355
- for (const C of _.filter(
356
- (v) => {
357
- var P;
358
- return ((P = n.roles) == null ? void 0 : P.call(n, v)) ?? !0;
355
+ for (const p of P.filter(
356
+ (T) => {
357
+ var y;
358
+ return ((y = n.roles) == null ? void 0 : y.call(n, T)) ?? !0;
359
359
  }
360
360
  )) {
361
- const v = T.get(C.name);
362
- if (v)
361
+ const T = b.get(p.name);
362
+ if (T)
363
363
  try {
364
- const P = await p.rolePermissions.list(
364
+ const y = await h.rolePermissions.list(
365
365
  e.controlPlaneTenantId,
366
- C.id,
366
+ p.id,
367
367
  {}
368
368
  );
369
- P.length > 0 && await y.rolePermissions.assign(
369
+ y.length > 0 && await _.rolePermissions.assign(
370
370
  w.id,
371
- v,
372
- P.map((A) => ({
373
- role_id: v,
374
- resource_server_identifier: A.resource_server_identifier,
375
- permission_name: A.permission_name
371
+ T,
372
+ y.map((R) => ({
373
+ role_id: T,
374
+ resource_server_identifier: R.resource_server_identifier,
375
+ permission_name: R.permission_name
376
376
  }))
377
377
  );
378
- } catch (P) {
378
+ } catch (y) {
379
379
  console.error(
380
- `Failed to sync permissions for role "${C.name}" to tenant "${w.id}":`,
381
- P
380
+ `Failed to sync permissions for role "${p.name}" to tenant "${w.id}":`,
381
+ y
382
382
  );
383
383
  }
384
384
  }
385
- } catch (p) {
385
+ } catch (h) {
386
386
  console.error(
387
387
  `Failed to sync role permissions to tenant "${w.id}":`,
388
- p
388
+ h
389
389
  );
390
390
  }
391
391
  }
392
392
  }
393
393
  } : void 0;
394
- async function d(m, w, h) {
394
+ async function d(m, w, C) {
395
395
  return (await m.roles.list(w, {
396
- q: `name:${h}`,
396
+ q: `name:${C}`,
397
397
  per_page: 1
398
398
  })).roles[0] ?? null;
399
399
  }
@@ -404,28 +404,28 @@ function we(e) {
404
404
  },
405
405
  tenantHooks: {
406
406
  async afterCreate(m, w) {
407
- const h = [
407
+ const C = [
408
408
  c == null ? void 0 : c.afterCreate,
409
409
  (g == null ? void 0 : g.afterCreate) ?? (l == null ? void 0 : l.afterCreate)
410
- ], p = [];
411
- for (const y of h)
412
- if (y)
410
+ ], h = [];
411
+ for (const _ of C)
412
+ if (_)
413
413
  try {
414
- await y(m, w);
415
- } catch (_) {
416
- p.push(_ instanceof Error ? _ : new Error(String(_)));
414
+ await _(m, w);
415
+ } catch (P) {
416
+ h.push(P instanceof Error ? P : new Error(String(P)));
417
417
  }
418
- if (p.length === 1) throw p[0];
419
- if (p.length > 1)
418
+ if (h.length === 1) throw h[0];
419
+ if (h.length > 1)
420
420
  throw new AggregateError(
421
- p,
422
- p.map((y) => y.message).join("; ")
421
+ h,
422
+ h.map((_) => _.message).join("; ")
423
423
  );
424
424
  }
425
425
  }
426
426
  };
427
427
  }
428
- var b = class extends Error {
428
+ var S = class extends Error {
429
429
  /**
430
430
  * Creates an instance of `HTTPException`.
431
431
  * @param status - HTTP status code for the exception. Defaults to 500.
@@ -433,8 +433,8 @@ var b = class extends Error {
433
433
  */
434
434
  constructor(t = 500, n) {
435
435
  super(n == null ? void 0 : n.message, { cause: n == null ? void 0 : n.cause });
436
- M(this, "res");
437
- M(this, "status");
436
+ q(this, "res");
437
+ q(this, "status");
438
438
  this.res = n == null ? void 0 : n.res, this.status = t;
439
439
  }
440
440
  /**
@@ -451,15 +451,15 @@ var b = class extends Error {
451
451
  });
452
452
  }
453
453
  };
454
- function q(e, t) {
455
- const n = new oe();
454
+ function k(e, t) {
455
+ const n = new ie();
456
456
  return n.openapi(
457
- O({
457
+ j({
458
458
  tags: ["tenants"],
459
459
  method: "get",
460
460
  path: "/",
461
461
  request: {
462
- query: te
462
+ query: ne
463
463
  },
464
464
  security: [
465
465
  {
@@ -470,11 +470,11 @@ function q(e, t) {
470
470
  200: {
471
471
  content: {
472
472
  "application/json": {
473
- schema: S.object({
474
- tenants: S.array(N),
475
- start: S.number().optional(),
476
- limit: S.number().optional(),
477
- length: S.number().optional()
473
+ schema: z.object({
474
+ tenants: z.array(B),
475
+ start: z.number().optional(),
476
+ limit: z.number().optional(),
477
+ length: z.number().optional()
478
478
  })
479
479
  }
480
480
  },
@@ -483,75 +483,75 @@ function q(e, t) {
483
483
  }
484
484
  }),
485
485
  async (r) => {
486
- var m, w, h, p, y, _;
487
- const s = r.req.valid("query"), { page: a, per_page: o, include_totals: i, q: u } = s, c = r.var.user, l = (c == null ? void 0 : c.permissions) || [];
486
+ var m, w, C, h, _, P;
487
+ const a = r.req.valid("query"), { page: s, per_page: o, include_totals: i, q: u } = a, c = r.var.user, l = (c == null ? void 0 : c.permissions) || [];
488
488
  if (l.includes("auth:read") || l.includes("admin:organizations")) {
489
- const T = await r.env.data.tenants.list({
490
- page: a,
489
+ const b = await r.env.data.tenants.list({
490
+ page: s,
491
491
  per_page: o,
492
492
  include_totals: i,
493
493
  q: u
494
494
  });
495
495
  return i ? r.json({
496
- tenants: T.tenants,
497
- start: ((m = T.totals) == null ? void 0 : m.start) ?? 0,
498
- limit: ((w = T.totals) == null ? void 0 : w.limit) ?? o,
499
- length: T.tenants.length
500
- }) : r.json({ tenants: T.tenants });
496
+ tenants: b.tenants,
497
+ start: ((m = b.totals) == null ? void 0 : m.start) ?? 0,
498
+ limit: ((w = b.totals) == null ? void 0 : w.limit) ?? o,
499
+ length: b.tenants.length
500
+ }) : r.json({ tenants: b.tenants });
501
501
  }
502
- const d = ((h = e.accessControl) == null ? void 0 : h.controlPlaneTenantId) ?? ((p = r.env.data.multiTenancyConfig) == null ? void 0 : p.controlPlaneTenantId);
502
+ const d = ((C = e.accessControl) == null ? void 0 : C.controlPlaneTenantId) ?? ((h = r.env.data.multiTenancyConfig) == null ? void 0 : h.controlPlaneTenantId);
503
503
  if (d && (c != null && c.sub)) {
504
- const C = (await z(
505
- ($) => r.env.data.userOrganizations.listUserOrganizations(
504
+ const p = (await M(
505
+ (I) => r.env.data.userOrganizations.listUserOrganizations(
506
506
  d,
507
507
  c.sub,
508
- $
508
+ I
509
509
  ),
510
510
  "organizations"
511
- )).map(($) => $.name);
512
- if (C.length === 0)
511
+ )).map((I) => I.name);
512
+ if (p.length === 0)
513
513
  return i ? r.json({
514
514
  tenants: [],
515
515
  start: 0,
516
516
  limit: o ?? 50,
517
517
  length: 0
518
518
  }) : r.json({ tenants: [] });
519
- const v = C.length, P = a ?? 0, A = o ?? 50, R = P * A, I = C.slice(R, R + A);
520
- if (I.length === 0)
519
+ const T = p.length, y = s ?? 0, R = o ?? 50, F = y * R, D = p.slice(F, F + R);
520
+ if (D.length === 0)
521
521
  return i ? r.json({
522
522
  tenants: [],
523
- start: R,
524
- limit: A,
525
- length: v
523
+ start: F,
524
+ limit: R,
525
+ length: T
526
526
  }) : r.json({ tenants: [] });
527
- const k = I.map(($) => `id:${$}`).join(" OR "), X = u ? `(${k}) AND (${u})` : k, E = await r.env.data.tenants.list({
528
- q: X,
529
- per_page: A,
527
+ const A = D.map((I) => `id:${I}`).join(" OR "), v = u ? `(${A}) AND (${u})` : A, $ = await r.env.data.tenants.list({
528
+ q: v,
529
+ per_page: R,
530
530
  include_totals: !1
531
531
  // We calculate totals from accessibleTenantIds
532
532
  });
533
533
  return i ? r.json({
534
- tenants: E.tenants,
535
- start: R,
536
- limit: A,
537
- length: v
538
- }) : r.json({ tenants: E.tenants });
534
+ tenants: $.tenants,
535
+ start: F,
536
+ limit: R,
537
+ length: T
538
+ }) : r.json({ tenants: $.tenants });
539
539
  }
540
540
  const f = await r.env.data.tenants.list({
541
- page: a,
541
+ page: s,
542
542
  per_page: o,
543
543
  include_totals: i,
544
544
  q: u
545
545
  });
546
546
  return i ? r.json({
547
547
  tenants: f.tenants,
548
- start: ((y = f.totals) == null ? void 0 : y.start) ?? 0,
549
- limit: ((_ = f.totals) == null ? void 0 : _.limit) ?? o,
548
+ start: ((_ = f.totals) == null ? void 0 : _.start) ?? 0,
549
+ limit: ((P = f.totals) == null ? void 0 : P.limit) ?? o,
550
550
  length: f.tenants.length
551
551
  }) : r.json({ tenants: f.tenants });
552
552
  }
553
553
  ), n.openapi(
554
- O({
554
+ j({
555
555
  tags: ["tenants"],
556
556
  method: "post",
557
557
  path: "/",
@@ -559,7 +559,7 @@ function q(e, t) {
559
559
  body: {
560
560
  content: {
561
561
  "application/json": {
562
- schema: ne
562
+ schema: re
563
563
  }
564
564
  }
565
565
  }
@@ -573,7 +573,7 @@ function q(e, t) {
573
573
  201: {
574
574
  content: {
575
575
  "application/json": {
576
- schema: N
576
+ schema: B
577
577
  }
578
578
  },
579
579
  description: "Tenant created"
@@ -588,28 +588,28 @@ function q(e, t) {
588
588
  }),
589
589
  async (r) => {
590
590
  var u, c;
591
- const s = r.var.user;
592
- if (!(s != null && s.sub))
593
- throw new b(401, {
591
+ const a = r.var.user;
592
+ if (!(a != null && a.sub))
593
+ throw new S(401, {
594
594
  message: "Authentication required to create tenants"
595
595
  });
596
- let a = r.req.valid("json");
596
+ let s = r.req.valid("json");
597
597
  const o = {
598
598
  adapters: r.env.data,
599
599
  ctx: r
600
600
  };
601
- (u = t.tenants) != null && u.beforeCreate && (a = await t.tenants.beforeCreate(o, a));
602
- const i = await r.env.data.tenants.create(a);
601
+ (u = t.tenants) != null && u.beforeCreate && (s = await t.tenants.beforeCreate(o, s));
602
+ const i = await r.env.data.tenants.create(s);
603
603
  return (c = t.tenants) != null && c.afterCreate && await t.tenants.afterCreate(o, i), r.json(i, 201);
604
604
  }
605
605
  ), n.openapi(
606
- O({
606
+ j({
607
607
  tags: ["tenants"],
608
608
  method: "delete",
609
609
  path: "/{id}",
610
610
  request: {
611
- params: S.object({
612
- id: S.string()
611
+ params: z.object({
612
+ id: z.string()
613
613
  })
614
614
  },
615
615
  security: [
@@ -631,38 +631,38 @@ function q(e, t) {
631
631
  }),
632
632
  async (r) => {
633
633
  var u, c, l, g;
634
- const { id: s } = r.req.valid("param"), a = ((u = e.accessControl) == null ? void 0 : u.controlPlaneTenantId) ?? ((c = r.env.data.multiTenancyConfig) == null ? void 0 : c.controlPlaneTenantId);
635
- if (a) {
634
+ const { id: a } = r.req.valid("param"), s = ((u = e.accessControl) == null ? void 0 : u.controlPlaneTenantId) ?? ((c = r.env.data.multiTenancyConfig) == null ? void 0 : c.controlPlaneTenantId);
635
+ if (s) {
636
636
  const d = r.var.user;
637
637
  if (!(d != null && d.sub))
638
- throw new b(401, {
638
+ throw new S(401, {
639
639
  message: "Authentication required"
640
640
  });
641
- if (s === a)
642
- throw new b(403, {
641
+ if (a === s)
642
+ throw new S(403, {
643
643
  message: "Cannot delete the control plane"
644
644
  });
645
- if (!(await z(
645
+ if (!(await M(
646
646
  (w) => r.env.data.userOrganizations.listUserOrganizations(
647
- a,
647
+ s,
648
648
  d.sub,
649
649
  w
650
650
  ),
651
651
  "organizations"
652
- )).some((w) => w.name === s))
653
- throw new b(403, {
652
+ )).some((w) => w.name === a))
653
+ throw new S(403, {
654
654
  message: "Access denied to this tenant"
655
655
  });
656
656
  }
657
- if (!await r.env.data.tenants.get(s))
658
- throw new b(404, {
657
+ if (!await r.env.data.tenants.get(a))
658
+ throw new S(404, {
659
659
  message: "Tenant not found"
660
660
  });
661
661
  const i = {
662
662
  adapters: r.env.data,
663
663
  ctx: r
664
664
  };
665
- return (l = t.tenants) != null && l.beforeDelete && await t.tenants.beforeDelete(i, s), await r.env.data.tenants.remove(s), (g = t.tenants) != null && g.afterDelete && await t.tenants.afterDelete(i, s), r.body(null, 204);
665
+ return (l = t.tenants) != null && l.beforeDelete && await t.tenants.beforeDelete(i, a), await r.env.data.tenants.remove(a), (g = t.tenants) != null && g.afterDelete && await t.tenants.afterDelete(i, a), r.body(null, 204);
666
666
  }
667
667
  ), n;
668
668
  }
@@ -676,9 +676,9 @@ function pe(e) {
676
676
  { pattern: /\/api\/v2\/connections\/([^/]+)$/, type: "connection" }
677
677
  ];
678
678
  for (const { pattern: n, type: r } of t) {
679
- const s = e.match(n);
680
- if (s && s[1])
681
- return { type: r, id: s[1] };
679
+ const a = e.match(n);
680
+ if (a && a[1])
681
+ return { type: r, id: a[1] };
682
682
  }
683
683
  return null;
684
684
  }
@@ -722,19 +722,19 @@ function ve() {
722
722
  if (!r)
723
723
  return t();
724
724
  if (await ye(e.env.data, r, n))
725
- throw new b(403, {
725
+ throw new S(403, {
726
726
  message: `This ${he(n.type)} is a system resource and cannot be modified. Make changes in the control plane instead.`
727
727
  });
728
728
  return t();
729
729
  };
730
730
  }
731
- function D(e, t) {
731
+ function E(e, t) {
732
732
  const n = t.find(
733
- (s) => s.strategy === e.strategy
733
+ (a) => a.strategy === e.strategy
734
734
  );
735
735
  if (!(n != null && n.options))
736
736
  return e;
737
- const r = re.passthrough().parse({
737
+ const r = ae.passthrough().parse({
738
738
  ...n,
739
739
  ...e
740
740
  });
@@ -743,7 +743,7 @@ function D(e, t) {
743
743
  ...e.options
744
744
  }), r;
745
745
  }
746
- function F(e, t) {
746
+ function O(e, t) {
747
747
  const n = [...t || [], ...e || []];
748
748
  return [...new Set(n)];
749
749
  }
@@ -759,7 +759,7 @@ function _e(e, t) {
759
759
  n.set(r.value, r);
760
760
  return Array.from(n.values());
761
761
  }
762
- function W(e, t) {
762
+ function K(e, t) {
763
763
  return t ? {
764
764
  ...e,
765
765
  scopes: _e(
@@ -768,25 +768,25 @@ function W(e, t) {
768
768
  )
769
769
  } : e;
770
770
  }
771
- function K(e, t) {
771
+ function Q(e, t) {
772
772
  return t ? {
773
773
  ...e,
774
- callbacks: F(e.callbacks, t.callbacks),
775
- web_origins: F(
774
+ callbacks: O(e.callbacks, t.callbacks),
775
+ web_origins: O(
776
776
  e.web_origins,
777
777
  t.web_origins
778
778
  ),
779
- allowed_logout_urls: F(
779
+ allowed_logout_urls: O(
780
780
  e.allowed_logout_urls,
781
781
  t.allowed_logout_urls
782
782
  ),
783
- allowed_origins: F(
783
+ allowed_origins: O(
784
784
  e.allowed_origins,
785
785
  t.allowed_origins
786
786
  )
787
787
  } : e;
788
788
  }
789
- function Te(e, t) {
789
+ function Ce(e, t) {
790
790
  const { controlPlaneTenantId: n, controlPlaneClientId: r } = t;
791
791
  return {
792
792
  ...e,
@@ -797,25 +797,25 @@ function Te(e, t) {
797
797
  },
798
798
  connections: {
799
799
  ...e.connections,
800
- get: async (s, a) => {
800
+ get: async (a, s) => {
801
801
  const o = await e.connections.get(
802
- s,
803
- a
802
+ a,
803
+ s
804
804
  );
805
- if (!o || !n || s === n)
805
+ if (!o || !n || a === n)
806
806
  return o;
807
807
  const i = await e.connections.list(n);
808
- return D(
808
+ return E(
809
809
  o,
810
810
  i.connections || []
811
811
  );
812
812
  },
813
- list: async (s, a) => {
814
- const o = await e.connections.list(s, a);
815
- if (!n || s === n)
813
+ list: async (a, s) => {
814
+ const o = await e.connections.list(a, s);
815
+ if (!n || a === n)
816
816
  return o;
817
817
  const i = await e.connections.list(n), u = o.connections.map(
818
- (c) => D(
818
+ (c) => E(
819
819
  c,
820
820
  i.connections || []
821
821
  )
@@ -828,16 +828,16 @@ function Te(e, t) {
828
828
  },
829
829
  clientConnections: {
830
830
  ...e.clientConnections,
831
- listByClient: async (s, a) => {
831
+ listByClient: async (a, s) => {
832
832
  let o = await e.clientConnections.listByClient(
833
- s,
834
- a
833
+ a,
834
+ s
835
835
  );
836
- if (o.length === 0 && (o = (await e.connections.list(s)).connections || []), !n || s === n)
836
+ if (o.length === 0 && (o = (await e.connections.list(a)).connections || []), !n || a === n)
837
837
  return o;
838
838
  const i = await e.connections.list(n);
839
839
  return o.map(
840
- (u) => D(
840
+ (u) => E(
841
841
  u,
842
842
  i.connections || []
843
843
  )
@@ -846,70 +846,70 @@ function Te(e, t) {
846
846
  },
847
847
  clients: {
848
848
  ...e.clients,
849
- get: async (s, a) => {
850
- const o = await e.clients.get(s, a);
849
+ get: async (a, s) => {
850
+ const o = await e.clients.get(a, s);
851
851
  if (!o)
852
852
  return null;
853
- if (!n || !r || s === n && a === r)
853
+ if (!n || !r || a === n && s === r)
854
854
  return o;
855
855
  const i = await e.clients.get(
856
856
  n,
857
857
  r
858
858
  );
859
- return K(o, i);
859
+ return Q(o, i);
860
860
  },
861
- getByClientId: async (s) => {
862
- const a = await e.clients.getByClientId(s);
863
- if (!a)
861
+ getByClientId: async (a) => {
862
+ const s = await e.clients.getByClientId(a);
863
+ if (!s)
864
864
  return null;
865
- if (!n || !r || a.tenant_id === n && a.client_id === r)
866
- return a;
865
+ if (!n || !r || s.tenant_id === n && s.client_id === r)
866
+ return s;
867
867
  const o = await e.clients.get(
868
868
  n,
869
869
  r
870
870
  );
871
871
  return {
872
- ...K(a, o),
873
- tenant_id: a.tenant_id
872
+ ...Q(s, o),
873
+ tenant_id: s.tenant_id
874
874
  };
875
875
  }
876
876
  },
877
877
  emailProviders: {
878
878
  ...e.emailProviders,
879
- get: async (s) => {
880
- const a = await e.emailProviders.get(s);
881
- return a || (!n || s === n ? null : e.emailProviders.get(n));
879
+ get: async (a) => {
880
+ const s = await e.emailProviders.get(a);
881
+ return s || (!n || a === n ? null : e.emailProviders.get(n));
882
882
  }
883
883
  },
884
884
  resourceServers: {
885
885
  ...e.resourceServers,
886
- get: async (s, a) => {
886
+ get: async (a, s) => {
887
887
  const o = await e.resourceServers.get(
888
- s,
889
- a
888
+ a,
889
+ s
890
890
  );
891
- if (!o || !n || s === n)
891
+ if (!o || !n || a === n)
892
892
  return o;
893
893
  const u = (await e.resourceServers.list(
894
894
  n,
895
895
  { q: `identifier:${o.identifier}`, per_page: 1 }
896
896
  )).resource_servers[0] ?? null;
897
- return W(
897
+ return K(
898
898
  o,
899
899
  u
900
900
  );
901
901
  },
902
- list: async (s, a) => {
902
+ list: async (a, s) => {
903
903
  const o = await e.resourceServers.list(
904
- s,
905
- a
904
+ a,
905
+ s
906
906
  );
907
- if (!n || s === n)
907
+ if (!n || a === n)
908
908
  return o;
909
909
  const i = await e.resourceServers.list(n), u = new Map(
910
910
  i.resource_servers.map((l) => [l.identifier, l])
911
911
  ), c = o.resource_servers.map(
912
- (l) => W(
912
+ (l) => K(
913
913
  l,
914
914
  u.get(l.identifier) ?? null
915
915
  )
@@ -925,10 +925,10 @@ function Te(e, t) {
925
925
  // - branding: Fall back to control plane branding/themes
926
926
  };
927
927
  }
928
- function V(e, t) {
929
- return Te(e, t);
928
+ function X(e, t) {
929
+ return Ce(e, t);
930
930
  }
931
- function Ce(e) {
931
+ function Te(e) {
932
932
  return async (t, n) => {
933
933
  const r = t.var.user;
934
934
  return (r == null ? void 0 : r.tenant_id) === e && r.org_name && t.set("tenant_id", r.org_name), n();
@@ -938,44 +938,44 @@ function Pe(e) {
938
938
  return async (t, n) => {
939
939
  if (!e.accessControl)
940
940
  return n();
941
- const { controlPlaneTenantId: r } = e.accessControl, s = t.var.org_name, a = t.var.organization_id, o = s || a;
941
+ const { controlPlaneTenantId: r } = e.accessControl, a = t.var.org_name, s = t.var.organization_id, o = a || s;
942
942
  let i = t.var.tenant_id;
943
- const u = t.var.user, l = (u != null && u.aud ? Array.isArray(u.aud) ? u.aud : [u.aud] : []).includes(Q);
943
+ const u = t.var.user, l = (u != null && u.aud ? Array.isArray(u.aud) ? u.aud : [u.aud] : []).includes(V);
944
944
  if (!i && o && l && (t.set("tenant_id", o), i = o), !i)
945
- throw new b(400, {
945
+ throw new S(400, {
946
946
  message: "Tenant ID not found in request"
947
947
  });
948
- if (!ce(
949
- a,
948
+ if (!le(
949
+ s,
950
950
  i,
951
951
  r,
952
- s
952
+ a
953
953
  ))
954
- throw new b(403, {
954
+ throw new S(403, {
955
955
  message: `Access denied to tenant ${i}`
956
956
  });
957
957
  return n();
958
958
  };
959
959
  }
960
- function Ae(e) {
960
+ function be(e) {
961
961
  return async (t, n) => {
962
962
  if (!e.subdomainRouting)
963
963
  return n();
964
964
  const {
965
965
  baseDomain: r,
966
- reservedSubdomains: s = [],
967
- resolveSubdomain: a
966
+ reservedSubdomains: a = [],
967
+ resolveSubdomain: s
968
968
  } = e.subdomainRouting, o = t.req.header("host") || "";
969
969
  let i = null;
970
970
  if (o.endsWith(r)) {
971
971
  const c = o.slice(0, -(r.length + 1));
972
972
  c && !c.includes(".") && (i = c);
973
973
  }
974
- if (i && s.includes(i) && (i = null), !i)
974
+ if (i && a.includes(i) && (i = null), !i)
975
975
  return e.accessControl && t.set("tenant_id", e.accessControl.controlPlaneTenantId), n();
976
976
  let u = null;
977
- if (a)
978
- u = await a(i);
977
+ if (s)
978
+ u = await s(i);
979
979
  else if (e.subdomainRouting.useOrganizations !== !1 && e.accessControl)
980
980
  try {
981
981
  const c = await t.env.data.organizations.get(
@@ -986,41 +986,41 @@ function Ae(e) {
986
986
  } catch {
987
987
  }
988
988
  if (!u)
989
- throw new b(404, {
989
+ throw new S(404, {
990
990
  message: `Tenant not found for subdomain: ${i}`
991
991
  });
992
992
  return t.set("tenant_id", u), n();
993
993
  };
994
994
  }
995
- function be(e) {
995
+ function Ae(e) {
996
996
  return async (t, n) => {
997
997
  if (!e.databaseIsolation)
998
998
  return n();
999
999
  const r = t.var.tenant_id;
1000
1000
  if (!r)
1001
- throw new b(400, {
1001
+ throw new S(400, {
1002
1002
  message: "Tenant ID not found in request"
1003
1003
  });
1004
1004
  try {
1005
- const s = await e.databaseIsolation.getAdapters(r);
1006
- t.env.data = s;
1007
- } catch (s) {
1005
+ const a = await e.databaseIsolation.getAdapters(r);
1006
+ t.env.data = a;
1007
+ } catch (a) {
1008
1008
  throw console.error(
1009
1009
  `Failed to resolve database for tenant ${r}:`,
1010
- s
1011
- ), new b(500, {
1010
+ a
1011
+ ), new S(500, {
1012
1012
  message: "Failed to resolve tenant database"
1013
1013
  });
1014
1014
  }
1015
1015
  return n();
1016
1016
  };
1017
1017
  }
1018
- function J(e) {
1019
- const t = Ae(e), n = Pe(e), r = be(e);
1020
- return async (s, a) => (await t(s, async () => {
1021
- }), await n(s, async () => {
1022
- }), await r(s, async () => {
1023
- }), a());
1018
+ function Y(e) {
1019
+ const t = be(e), n = Pe(e), r = Ae(e);
1020
+ return async (a, s) => (await t(a, async () => {
1021
+ }), await n(a, async () => {
1022
+ }), await r(a, async () => {
1023
+ }), s());
1024
1024
  }
1025
1025
  function Fe(e) {
1026
1026
  const {
@@ -1028,9 +1028,9 @@ function Fe(e) {
1028
1028
  controlPlane: n,
1029
1029
  controlPlane: {
1030
1030
  tenantId: r = "control_plane",
1031
- clientId: s
1031
+ clientId: a
1032
1032
  } = {},
1033
- sync: a = { resourceServers: !0, roles: !0 },
1033
+ sync: s = { resourceServers: !0, roles: !0 },
1034
1034
  defaultPermissions: o = ["tenant:admin"],
1035
1035
  requireOrganizationMatch: i = !1,
1036
1036
  managementApiExtensions: u = [],
@@ -1040,39 +1040,45 @@ function Fe(e) {
1040
1040
  ...d
1041
1041
  } = e;
1042
1042
  let f = t, m = t;
1043
- n && (f = V(t, {
1043
+ n && (f = X(t, {
1044
1044
  controlPlaneTenantId: r,
1045
- controlPlaneClientId: s
1045
+ controlPlaneClientId: a
1046
1046
  }), m = {
1047
1047
  ...t,
1048
1048
  multiTenancyConfig: {
1049
1049
  controlPlaneTenantId: r,
1050
- controlPlaneClientId: s
1050
+ controlPlaneClientId: a
1051
1051
  }
1052
1052
  });
1053
- const w = a !== !1, h = w ? {
1054
- resourceServers: a.resourceServers ?? !0,
1055
- roles: a.roles ?? !0
1056
- } : { resourceServers: !1, roles: !1 }, _ = {
1053
+ const w = s !== !1, C = w ? {
1054
+ resourceServers: s.resourceServers ?? !0,
1055
+ roles: s.roles ?? !0
1056
+ } : { resourceServers: !1, roles: !1 }, P = {
1057
1057
  controlPlaneTenantId: r,
1058
- getChildTenantIds: l ?? (async () => (await z(
1059
- (I) => f.tenants.list(I),
1058
+ getChildTenantIds: l ?? (async () => (await M(
1059
+ (v) => f.tenants.list(v),
1060
1060
  "tenants",
1061
1061
  { cursorField: "id", pageSize: 100 }
1062
- )).filter((I) => I.id !== r).map((I) => I.id)),
1062
+ )).filter((v) => v.id !== r).map((v) => v.id)),
1063
1063
  getAdapters: g ?? (async () => f),
1064
1064
  getControlPlaneAdapters: async () => f,
1065
- sync: h
1066
- }, { entityHooks: T, tenantHooks: C } = we(_), v = {
1065
+ sync: C
1066
+ }, { entityHooks: b, tenantHooks: p } = we(P), T = {
1067
1067
  resourceServers: [
1068
- T.resourceServers,
1068
+ b.resourceServers,
1069
1069
  ...(c == null ? void 0 : c.resourceServers) ?? []
1070
1070
  ],
1071
- roles: [T.roles, ...(c == null ? void 0 : c.roles) ?? []],
1071
+ roles: [b.roles, ...(c == null ? void 0 : c.roles) ?? []],
1072
1072
  connections: (c == null ? void 0 : c.connections) ?? [],
1073
1073
  tenants: (c == null ? void 0 : c.tenants) ?? [],
1074
1074
  rolePermissions: (c == null ? void 0 : c.rolePermissions) ?? []
1075
- }, P = q(
1075
+ }, y = J({
1076
+ accessControl: {
1077
+ controlPlaneTenantId: r,
1078
+ requireOrganizationMatch: i,
1079
+ defaultPermissions: o
1080
+ }
1081
+ }), F = k(
1076
1082
  {
1077
1083
  accessControl: {
1078
1084
  controlPlaneTenantId: r,
@@ -1080,35 +1086,47 @@ function Fe(e) {
1080
1086
  defaultPermissions: o
1081
1087
  }
1082
1088
  },
1083
- { tenants: C }
1084
- ), { app: A } = ae({
1089
+ { tenants: {
1090
+ async beforeCreate(A, v) {
1091
+ return y.beforeCreate && (v = await y.beforeCreate(A, v)), p.beforeCreate && (v = await p.beforeCreate(A, v)), v;
1092
+ },
1093
+ async afterCreate(A, v) {
1094
+ var $, I;
1095
+ await (($ = y.afterCreate) == null ? void 0 : $.call(y, A, v)), await ((I = p.afterCreate) == null ? void 0 : I.call(p, A, v));
1096
+ },
1097
+ async beforeDelete(A, v) {
1098
+ var $, I;
1099
+ await (($ = y.beforeDelete) == null ? void 0 : $.call(y, A, v)), await ((I = p.beforeDelete) == null ? void 0 : I.call(p, A, v));
1100
+ }
1101
+ } }
1102
+ ), { app: D } = oe({
1085
1103
  dataAdapter: f,
1086
1104
  managementDataAdapter: m,
1087
1105
  ...d,
1088
- entityHooks: v,
1106
+ entityHooks: T,
1089
1107
  managementApiExtensions: [
1090
1108
  ...u,
1091
- { path: "/tenants", router: P }
1109
+ { path: "/tenants", router: F }
1092
1110
  ]
1093
1111
  });
1094
- return A.use(
1112
+ return D.use(
1095
1113
  "/api/v2/*",
1096
- Ce(r)
1097
- ), w && A.use("/api/v2/*", ve()), { app: A, controlPlaneTenantId: r };
1114
+ Te(r)
1115
+ ), w && D.use("/api/v2/*", ve()), { app: D, controlPlaneTenantId: r };
1098
1116
  }
1099
- function Me(e) {
1100
- const t = j(e);
1117
+ function De(e) {
1118
+ const t = N(e);
1101
1119
  return {
1102
1120
  name: "multi-tenancy",
1103
1121
  // Apply multi-tenancy middleware for subdomain routing, database resolution, etc.
1104
- middleware: J(e),
1122
+ middleware: Y(e),
1105
1123
  // Provide lifecycle hooks
1106
1124
  hooks: t,
1107
1125
  // Mount tenant management routes
1108
1126
  routes: [
1109
1127
  {
1110
1128
  path: "/management",
1111
- handler: q(e, t)
1129
+ handler: k(e, t)
1112
1130
  }
1113
1131
  ],
1114
1132
  // Called when plugin is registered
@@ -1121,8 +1139,8 @@ function Me(e) {
1121
1139
  }
1122
1140
  };
1123
1141
  }
1124
- function j(e) {
1125
- const t = e.accessControl ? ie(e.accessControl) : {}, n = e.databaseIsolation ? le(e.databaseIsolation) : {}, r = de(e);
1142
+ function N(e) {
1143
+ const t = e.accessControl ? ce(e.accessControl) : {}, n = e.databaseIsolation ? ue(e.databaseIsolation) : {}, r = J(e);
1126
1144
  return {
1127
1145
  ...t,
1128
1146
  ...n,
@@ -1130,13 +1148,13 @@ function j(e) {
1130
1148
  };
1131
1149
  }
1132
1150
  function Ie(e) {
1133
- const t = new x(), n = j(e);
1134
- return t.route("/tenants", q(e, n)), t;
1151
+ const t = new ee(), n = N(e);
1152
+ return t.route("/tenants", k(e, n)), t;
1135
1153
  }
1136
- function Oe(e) {
1154
+ function Me(e) {
1137
1155
  return {
1138
- hooks: j(e),
1139
- middleware: J(e),
1156
+ hooks: N(e),
1157
+ middleware: Y(e),
1140
1158
  app: Ie(e),
1141
1159
  config: e,
1142
1160
  /**
@@ -1149,7 +1167,7 @@ function Oe(e) {
1149
1167
  */
1150
1168
  wrapAdapters: (t, n) => {
1151
1169
  var r;
1152
- return V(t, {
1170
+ return X(t, {
1153
1171
  controlPlaneTenantId: (r = e.accessControl) == null ? void 0 : r.controlPlaneTenantId,
1154
1172
  controlPlaneClientId: n == null ? void 0 : n.controlPlaneClientId
1155
1173
  });
@@ -1157,23 +1175,23 @@ function Oe(e) {
1157
1175
  };
1158
1176
  }
1159
1177
  export {
1160
- ie as createAccessControlHooks,
1178
+ ce as createAccessControlHooks,
1161
1179
  Pe as createAccessControlMiddleware,
1162
- Ce as createControlPlaneTenantMiddleware,
1163
- le as createDatabaseHooks,
1164
- be as createDatabaseMiddleware,
1180
+ Te as createControlPlaneTenantMiddleware,
1181
+ ue as createDatabaseHooks,
1182
+ Ae as createDatabaseMiddleware,
1165
1183
  Ie as createMultiTenancy,
1166
- j as createMultiTenancyHooks,
1167
- J as createMultiTenancyMiddleware,
1168
- Me as createMultiTenancyPlugin,
1184
+ N as createMultiTenancyHooks,
1185
+ Y as createMultiTenancyMiddleware,
1186
+ De as createMultiTenancyPlugin,
1169
1187
  ve as createProtectSyncedMiddleware,
1170
- de as createProvisioningHooks,
1171
- Te as createRuntimeFallbackAdapter,
1172
- Ae as createSubdomainMiddleware,
1188
+ J as createProvisioningHooks,
1189
+ Ce as createRuntimeFallbackAdapter,
1190
+ be as createSubdomainMiddleware,
1173
1191
  we as createSyncHooks,
1174
- q as createTenantsOpenAPIRouter,
1192
+ k as createTenantsOpenAPIRouter,
1175
1193
  Fe as initMultiTenant,
1176
- Oe as setupMultiTenancy,
1177
- ce as validateTenantAccess,
1178
- V as withRuntimeFallback
1194
+ Me as setupMultiTenancy,
1195
+ le as validateTenantAccess,
1196
+ X as withRuntimeFallback
1179
1197
  };