@authhero/multi-tenancy 15.2.0 → 15.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/multi-tenancy.cjs +1 -1
  2. package/dist/multi-tenancy.mjs +2968 -1176
  3. package/dist/types/index.d.ts +5 -2
  4. package/dist/types/index.d.ts.map +1 -1
  5. package/dist/types/inheritance/legacy.d.ts.map +1 -1
  6. package/dist/types/inheritance/merge.d.ts +1 -0
  7. package/dist/types/inheritance/merge.d.ts.map +1 -1
  8. package/dist/types/inheritance/read.d.ts.map +1 -1
  9. package/dist/types/inheritance/report.d.ts +6 -2
  10. package/dist/types/inheritance/report.d.ts.map +1 -1
  11. package/dist/types/inheritance/types.d.ts +3 -1
  12. package/dist/types/inheritance/types.d.ts.map +1 -1
  13. package/dist/types/init.d.ts +84 -1
  14. package/dist/types/init.d.ts.map +1 -1
  15. package/dist/types/middleware/config-sync-mode.d.ts +39 -0
  16. package/dist/types/middleware/config-sync-mode.d.ts.map +1 -0
  17. package/dist/types/middleware/index.d.ts +3 -1
  18. package/dist/types/middleware/index.d.ts.map +1 -1
  19. package/dist/types/middleware/protect-synced.d.ts +1 -1
  20. package/dist/types/middleware/protect-synced.d.ts.map +1 -1
  21. package/dist/types/middleware/settings-inheritance.d.ts +20 -2
  22. package/dist/types/middleware/settings-inheritance.d.ts.map +1 -1
  23. package/dist/types/operations/detach.d.ts +85 -0
  24. package/dist/types/operations/detach.d.ts.map +1 -0
  25. package/dist/types/operations/enqueue.d.ts +8 -1
  26. package/dist/types/operations/enqueue.d.ts.map +1 -1
  27. package/dist/types/operations/index.d.ts +7 -1
  28. package/dist/types/operations/index.d.ts.map +1 -1
  29. package/dist/types/operations/recorder.d.ts +2 -0
  30. package/dist/types/operations/recorder.d.ts.map +1 -1
  31. package/dist/types/operations/sync-defaults.d.ts +58 -0
  32. package/dist/types/operations/sync-defaults.d.ts.map +1 -0
  33. package/dist/types/operations/tenant-members-request.d.ts +97 -0
  34. package/dist/types/operations/tenant-members-request.d.ts.map +1 -0
  35. package/dist/types/operations/types.d.ts +2 -0
  36. package/dist/types/operations/types.d.ts.map +1 -1
  37. package/dist/types/rollout/index.d.ts +2 -0
  38. package/dist/types/rollout/index.d.ts.map +1 -1
  39. package/dist/types/rollout/payload.d.ts +15 -0
  40. package/dist/types/rollout/payload.d.ts.map +1 -1
  41. package/dist/types/rollout/resolved-sync.d.ts +112 -0
  42. package/dist/types/rollout/resolved-sync.d.ts.map +1 -0
  43. package/dist/types/rollouts/advance.d.ts +44 -0
  44. package/dist/types/rollouts/advance.d.ts.map +1 -0
  45. package/dist/types/rollouts/config.d.ts +54 -0
  46. package/dist/types/rollouts/config.d.ts.map +1 -0
  47. package/dist/types/rollouts/controller.d.ts +29 -0
  48. package/dist/types/rollouts/controller.d.ts.map +1 -0
  49. package/dist/types/rollouts/enumerate.d.ts +25 -0
  50. package/dist/types/rollouts/enumerate.d.ts.map +1 -0
  51. package/dist/types/rollouts/hashes.d.ts +10 -0
  52. package/dist/types/rollouts/hashes.d.ts.map +1 -0
  53. package/dist/types/rollouts/index.d.ts +21 -0
  54. package/dist/types/rollouts/index.d.ts.map +1 -0
  55. package/dist/types/rollouts/plan.d.ts +29 -0
  56. package/dist/types/rollouts/plan.d.ts.map +1 -0
  57. package/dist/types/rollouts/reconcile.d.ts +38 -0
  58. package/dist/types/rollouts/reconcile.d.ts.map +1 -0
  59. package/dist/types/rollouts/status.d.ts +28 -0
  60. package/dist/types/rollouts/status.d.ts.map +1 -0
  61. package/dist/types/rollouts/trigger.d.ts +52 -0
  62. package/dist/types/rollouts/trigger.d.ts.map +1 -0
  63. package/dist/types/rollouts/types.d.ts +25 -0
  64. package/dist/types/rollouts/types.d.ts.map +1 -0
  65. package/dist/types/rollouts/verify.d.ts +50 -0
  66. package/dist/types/rollouts/verify.d.ts.map +1 -0
  67. package/dist/types/routes/tenants.d.ts.map +1 -1
  68. package/dist/types/types.d.ts +20 -0
  69. package/dist/types/types.d.ts.map +1 -1
  70. package/dist/types/utils/tenant-settings.d.ts +13 -0
  71. package/dist/types/utils/tenant-settings.d.ts.map +1 -0
  72. package/dist/types/utils/tenant-tree.d.ts +2 -1
  73. package/dist/types/utils/tenant-tree.d.ts.map +1 -1
  74. package/package.json +5 -5
@@ -0,0 +1,28 @@
1
+ import type { RolloutDeps } from "./types";
2
+ export type ConfigSyncStatusDeps = Pick<RolloutDeps, "adapters" | "controlPlaneTenantId" | "resolveControlPlane" | "maxDepth">;
3
+ export interface ConfigSyncStatus {
4
+ tenant_id: string;
5
+ parent_tenant_id: string | null;
6
+ config_sync: "inherit-on-read" | "synced" | "detached";
7
+ config_sync_hash: string | null;
8
+ config_synced_at: string | null;
9
+ /** The hash a sync would store now; null for a tenant that is not synced. */
10
+ expected_hash: string | null;
11
+ /** A synced tenant whose stored hash differs from `expected_hash`. */
12
+ drifted: boolean;
13
+ /** Ancestors the config resolves from, nearest first. */
14
+ chain: string[];
15
+ /**
16
+ * Which ancestor published each inherited row, keyed by the id the row has
17
+ * in this tenant (`con_sy...`, singletons by `emailProvider`, `branding` and
18
+ * `promptSettings`). Platform rows are left out: a child never sees them.
19
+ */
20
+ inherited: Record<string, string>;
21
+ }
22
+ /**
23
+ * Sync status of one tenant, for the admin UI: the stored and expected hash,
24
+ * whether they differ, and where its inherited rows come from. Content and
25
+ * secrets never leave this function, only ids and tenant names.
26
+ */
27
+ export declare function getConfigSyncStatus(deps: ConfigSyncStatusDeps, tenantId: string): Promise<ConfigSyncStatus | null>;
28
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/rollouts/status.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,WAAW,EACX,UAAU,GAAG,sBAAsB,GAAG,qBAAqB,GAAG,UAAU,CACzE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAAC;IACvD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,6EAA6E;IAC7E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAmFlC"}
@@ -0,0 +1,52 @@
1
+ import type { Rollout } from "authhero";
2
+ import type { ConfigEntity } from "../inheritance/types";
3
+ import type { RolloutDeps } from "./types";
4
+ /** The entities whose writes can change what descendants should hold. */
5
+ export type PublishableEntity = ConfigEntity | "hookCode";
6
+ /**
7
+ * Whether a written row is something a parent publishes. A row counts when it
8
+ * is shared or platform scoped, which for rows nobody has annotated follows
9
+ * what read-time inheritance does today (system resource servers and actions,
10
+ * inheritable hooks, connections and the email provider). Hook code always
11
+ * counts, since it cannot be told from the code of an unpublished hook.
12
+ */
13
+ export declare function isPublishedRow(entity: PublishableEntity, row: unknown): boolean;
14
+ /**
15
+ * Records that `originTenantId` published a change (the write trigger). Writes
16
+ * are coalesced through the rollout row itself: if a write-triggered rollout
17
+ * for this origin is still waiting out its debounce it is touched (its
18
+ * `updated_at` moves), otherwise one is created. The tick plans it once writes
19
+ * have been quiet for `debounce_ms`. Cheap, durable, and safe to call from a
20
+ * request: nothing is rolled out here.
21
+ */
22
+ export declare function requestRollout(deps: RolloutDeps, originTenantId: string, initiatedBy?: string): Promise<Rollout>;
23
+ /** The entity hooks that turn a published write into a rollout request. */
24
+ export interface RolloutWriteHooks {
25
+ actions: EntityWriteHooks;
26
+ hooks: EntityWriteHooks;
27
+ hookCode: EntityWriteHooks;
28
+ connections: EntityWriteHooks;
29
+ resourceServers: EntityWriteHooks;
30
+ }
31
+ interface EntityWriteHooks {
32
+ afterCreate: (ctx: {
33
+ tenantId: string;
34
+ }, entity: unknown) => Promise<void>;
35
+ afterUpdate: (ctx: {
36
+ tenantId: string;
37
+ }, id: string, entity: unknown) => Promise<void>;
38
+ afterDelete: (ctx: {
39
+ tenantId: string;
40
+ }, id: string) => Promise<void>;
41
+ }
42
+ /**
43
+ * Entity hooks for the write trigger (design 4.3, trigger 1). After a published
44
+ * row is created, updated or deleted, `requestRollout` records the change; a
45
+ * burst of writes becomes one rollout. A failure here never fails the write:
46
+ * the drift reconcile finds whatever a lost request would have rolled out.
47
+ */
48
+ export declare function createRolloutWriteHooks(deps: RolloutDeps, options?: {
49
+ logger?: Pick<Console, "warn">;
50
+ }): RolloutWriteHooks;
51
+ export {};
52
+ //# sourceMappingURL=trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../src/rollouts/trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,yEAAyE;AACzE,MAAM,MAAM,iBAAiB,GACzB,YAAY,GAEZ,UAAU,CAAC;AAEf;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,OAAO,GACX,OAAO,CAOT;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,WAAW,EACjB,cAAc,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAiClB;AAED,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,eAAe,EAAE,gBAAgB,CAAC;CACnC;AAED,UAAU,gBAAgB;IACxB,WAAW,EAAE,CAAC,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,WAAW,EAAE,CACX,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,EACzB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,WAAW,EAAE,CAAC,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAuBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;CAAO,GAC/C,iBAAiB,CAgCnB"}
@@ -0,0 +1,25 @@
1
+ import type { DataAdapters } from "authhero";
2
+ import type { ControlPlaneResolver } from "../middleware";
3
+ import type { TenantOperationExecutor } from "../operations";
4
+ /** Everything the rollout functions need, wired once by the host. */
5
+ export interface RolloutDeps {
6
+ /**
7
+ * Control-plane adapters: tenants, tenant operations and events, rollouts and
8
+ * logs. Must be the layer that returns secrets as stored (ciphertext).
9
+ */
10
+ adapters: DataAdapters;
11
+ /**
12
+ * Starts the per-tenant `sync-defaults` operations: the inline executor, or
13
+ * the Cloudflare Workflows executor.
14
+ */
15
+ executor: TenantOperationExecutor;
16
+ /** The control plane, parent of tenants that have no `parent_tenant_id`. */
17
+ controlPlaneTenantId: string;
18
+ /** Per-tenant override of the implicit parent, as for `initMultiTenant`. */
19
+ resolveControlPlane?: ControlPlaneResolver;
20
+ /** Longest parent chain, see `resolveTenantChain`. */
21
+ maxDepth?: number;
22
+ /** Clock override for tests. */
23
+ now?: () => number;
24
+ }
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/rollouts/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,QAAQ,EAAE,uBAAuB,CAAC;IAClC,4EAA4E;IAC5E,oBAAoB,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAC3C,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB"}
@@ -0,0 +1,50 @@
1
+ import type { SyncConfigFn } from "../operations/sync-defaults";
2
+ import type { ConfigSyncStatusDeps } from "./status";
3
+ export interface ConfigSyncDifference {
4
+ entity: string;
5
+ key: string;
6
+ /**
7
+ * `missing`: the tenant lacks a row it should have. `extra`: it has a row it
8
+ * should not. `changed`: the row differs, `fields` names the fields. `stale`:
9
+ * a synced copy the parents no longer publish.
10
+ */
11
+ kind: "missing" | "extra" | "changed" | "stale";
12
+ fields?: string[];
13
+ }
14
+ export interface ConfigSyncVerification {
15
+ tenant_id: string;
16
+ config_sync: "inherit-on-read" | "synced" | "detached";
17
+ /**
18
+ * How it was checked. `read-time`: what read-time inheritance gives against
19
+ * what the parent chain resolves to. `sync-dry-run`: the tenant's own rows
20
+ * against what a sync would write, which is how a synced tenant, including
21
+ * one with its own database, is checked. `not-applicable`: a detached tenant
22
+ * has no parent to compare with.
23
+ */
24
+ method: "read-time" | "sync-dry-run" | "not-applicable";
25
+ /** True when there is no difference and no error: the hard pass criterion. */
26
+ ok: boolean;
27
+ /** Ids and field names only, never content or secrets. */
28
+ differences: ConfigSyncDifference[];
29
+ errors: string[];
30
+ }
31
+ export interface VerifyConfigSyncDeps extends ConfigSyncStatusDeps {
32
+ /**
33
+ * Runs a sync as a dry run, which is the read-only check of a synced tenant.
34
+ * A tenant with its own database needs the dispatch transport, as for
35
+ * `sync-defaults`.
36
+ */
37
+ syncConfig: SyncConfigFn;
38
+ }
39
+ /**
40
+ * Compares one tenant's config with what its parents publish, on demand and
41
+ * read-only (no write, no log). The pass criterion is `ok`: an empty
42
+ * `differences` and no `errors`. Returns null for an unknown tenant.
43
+ *
44
+ * A tenant that inherits on read is compared the way shadow mode does, without
45
+ * the rows only the sync model copies (`expected`). A synced tenant is checked
46
+ * with a sync dry run, which sees the tenant's own rows: a copy someone deleted
47
+ * or edited shows up here although the stored hash still matches.
48
+ */
49
+ export declare function verifyTenantConfig(deps: VerifyConfigSyncDeps, tenantId: string): Promise<ConfigSyncVerification | null>;
50
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/rollouts/verify.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAAC;IACvD;;;;;;OAMG;IACH,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,gBAAgB,CAAC;IACxD,8EAA8E;IAC9E,EAAE,EAAE,OAAO,CAAC;IACZ,0DAA0D;IAC1D,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE;;;;OAIG;IACH,UAAU,EAAE,YAAY,CAAC;CAC1B;AAiCD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CA8DxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../../../src/routes/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAWhE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AA0ClB;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB;cAGZ,oBAAoB;eACnB,qBAAqB;YAujBnC"}
1
+ {"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../../../src/routes/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAYhE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AA2DlB;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB;cAGZ,oBAAoB;eACnB,qBAAqB;YA8xBnC"}
@@ -1,6 +1,8 @@
1
1
  import { CreateTenantParams, DataAdapters, Tenant } from "authhero";
2
2
  import { Context } from "hono";
3
3
  import type { StepReporter } from "./operations/types";
4
+ import type { ConfigSyncStatus } from "./rollouts/status";
5
+ import type { ConfigSyncVerification } from "./rollouts/verify";
4
6
  /**
5
7
  * Bindings type from authhero core - simplified version for this package
6
8
  */
@@ -207,6 +209,24 @@ export interface MultiTenancyConfig {
207
209
  * Subdomain-based tenant routing configuration.
208
210
  */
209
211
  subdomainRouting?: SubdomainRoutingConfig;
212
+ /**
213
+ * Reads a tenant's config sync status for `GET /tenants/{id}/config-sync`.
214
+ * Supplied by `initMultiTenant`; the route is not mounted without it.
215
+ */
216
+ configSyncStatus?: (tenantId: string) => Promise<ConfigSyncStatus | null>;
217
+ /**
218
+ * Compares a tenant's config with what its parents publish, for
219
+ * `GET /tenants/{id}/config-sync/verify`. Supplied by `initMultiTenant`; the
220
+ * route is not mounted without it.
221
+ */
222
+ verifyConfigSync?: (tenantId: string) => Promise<ConfigSyncVerification | null>;
223
+ /**
224
+ * Called after a tenant is created or its `config_sync` mode is changed, so
225
+ * the sync mode the runtime remembers for it is dropped. Other isolates still
226
+ * take up to the resolver's TTL (`configSyncCacheTtlMs`, 10 s by default) to
227
+ * notice. Supplied by `initMultiTenant`.
228
+ */
229
+ onConfigSyncChange?: (tenantId: string) => void;
210
230
  }
211
231
  /**
212
232
  * Context passed to tenant entity hooks.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources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AAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -0,0 +1,13 @@
1
+ import { TenantsDataAdapter } from "@authhero/adapter-interfaces";
2
+ /**
3
+ * The computed fields the settings routes add to the tenant (not persisted):
4
+ * `is_control_plane`, and `has_children`, true when another tenant inherits
5
+ * from it. Every other tenant sits below the control plane (a tenant without a
6
+ * parent inherits from it), so the control plane has children as soon as it is
7
+ * not alone; any other tenant needs a tenant that names it as its parent.
8
+ */
9
+ export declare function computedTenantFields(tenants: TenantsDataAdapter, tenantId: string, controlPlaneTenantId: string | undefined): Promise<{
10
+ is_control_plane: boolean;
11
+ has_children: boolean;
12
+ }>;
13
+ //# sourceMappingURL=tenant-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-settings.d.ts","sourceRoot":"","sources":["../../../src/utils/tenant-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,GAAG,SAAS,GACvC,OAAO,CAAC;IAAE,gBAAgB,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAAC,CAc/D"}
@@ -12,7 +12,8 @@ export declare const DEFAULT_MAX_TENANT_DEPTH = 2;
12
12
  * longer than `maxDepth`.
13
13
  *
14
14
  * Pure with respect to storage: ancestors are read through `getTenant`.
15
- * Nothing reads the parent yet; this only keeps the stored tree valid.
15
+ * The parent decides which config a tenant inherits (see `resolveTenantChain`);
16
+ * this keeps the stored tree valid.
16
17
  */
17
18
  export declare function validateTenantParent(params: {
18
19
  tenantId: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"tenant-tree.d.ts","sourceRoot":"","sources":["../../../src/utils/tenant-tree.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,SAAS,EAAE,CACT,EAAE,EAAE,MAAM,KACP,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACtE;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEhB"}
1
+ {"version":3,"file":"tenant-tree.d.ts","sourceRoot":"","sources":["../../../src/utils/tenant-tree.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,SAAS,EAAE,CACT,EAAE,EAAE,MAAM,KACP,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACtE;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEhB"}
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/sesamyab/authhero"
13
13
  },
14
- "version": "15.2.0",
14
+ "version": "15.4.0",
15
15
  "description": "Multi-tenancy support for AuthHero with organization-based access control and per-tenant database isolation",
16
16
  "files": [
17
17
  "dist"
@@ -36,9 +36,9 @@
36
36
  "typescript": "^5.6.0",
37
37
  "vite": "^8.0.14",
38
38
  "vitest": "^4.1.7",
39
- "@authhero/adapter-interfaces": "4.22.0",
40
- "@authhero/kysely-adapter": "12.16.0",
41
- "authhero": "9.25.0"
39
+ "@authhero/adapter-interfaces": "4.24.0",
40
+ "@authhero/kysely-adapter": "12.18.0",
41
+ "authhero": "9.27.0"
42
42
  },
43
43
  "dependencies": {
44
44
  "zod": "^4.4.3"
@@ -46,7 +46,7 @@
46
46
  "peerDependencies": {
47
47
  "@authhero/adapter-interfaces": "^14.0.0",
48
48
  "@hono/zod-openapi": "^1.4.0",
49
- "authhero": "^3.0.0",
49
+ "authhero": "^9.27.0",
50
50
  "hono": "^4.7.0"
51
51
  },
52
52
  "license": "AGPL-3.0-only",