@happyvertical/smrt-cli 0.51.39 → 0.52.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 (48) hide show
  1. package/AGENTS.md +6 -2
  2. package/README.md +21 -0
  3. package/agents/type-drift.md +16 -0
  4. package/dist/{ApiKey-BZmbOTnL-DEwZtcGA.js → ApiKey-BZmbOTnL-CMUo3WLf.js} +2 -2
  5. package/dist/ApiKeyCollection-Bfb_nw81-C3Xz7MUq.js +2 -0
  6. package/dist/AuditLogCollection-B1YonCAP-DmmboC_X.js +2 -0
  7. package/dist/{NostrIdentity-n70E0vck-DiBJPv76.js → NostrIdentity-n70E0vck-BD7uutxz.js} +3 -3
  8. package/dist/NostrIdentityCollection-Ca74dkaL--KYlM_ou.js +2 -0
  9. package/dist/{OidcIdentity-K8V4u0CR-B_ek3cPN.js → OidcIdentity-Cb1bxreM-DY0aRLu-.js} +3 -3
  10. package/dist/OidcIdentityCollection-TV8VdK69-DPeFJt3R.js +2 -0
  11. package/dist/ProfileAssetCollection-B9hacUJa-6R8lwjti.js +2 -0
  12. package/dist/{ProfileCollection-DTT4KNpQ-D1RNYfjm.js → ProfileCollection-DuJT7Mum-D_ScbSMu.js} +69 -31
  13. package/dist/ProfileLinkCollection-4uNURz32-lMKBjaik.js +2 -0
  14. package/dist/ProfileMetadataCollection-DQhbfEfa-B1QlmBkX.js +2 -0
  15. package/dist/{ProfileMetafieldCollection-CMKhVi2I-mh3UgeZA.js → ProfileMetafieldCollection-CoBuM_5G-BDwo4x3z.js} +1 -1
  16. package/dist/{ProfileRelationshipCollection-DUVgaIqf-CXHrAni4.js → ProfileRelationshipCollection-DUVgaIqf-BRrBeg1Q.js} +1 -1
  17. package/dist/{ProfileRelationshipTermCollection-DtA9OM23-Cj4bLTpU.js → ProfileRelationshipTermCollection-DtA9OM23-D4WMfN9a.js} +1 -1
  18. package/dist/{ProfileRelationshipType-BRiRka6t-ICv2cawn.js → ProfileRelationshipType-BRiRka6t-B32A4UFT.js} +1 -1
  19. package/dist/{ProfileRelationshipTypeCollection-BdXwd7Kf-CaYLxJmh.js → ProfileRelationshipTypeCollection-BdXwd7Kf-BqQa8Awc.js} +1 -1
  20. package/dist/commands/db-diff.d.ts.map +1 -1
  21. package/dist/commands/db-history.d.ts.map +1 -1
  22. package/dist/commands/db-migrate-actions.d.ts +7 -0
  23. package/dist/commands/db-migrate-actions.d.ts.map +1 -1
  24. package/dist/commands/db-parity.d.ts +7 -0
  25. package/dist/commands/db-parity.d.ts.map +1 -1
  26. package/dist/commands/db-status.d.ts.map +1 -1
  27. package/dist/commands/tenant-natural-keys.d.ts +58 -0
  28. package/dist/commands/tenant-natural-keys.d.ts.map +1 -0
  29. package/dist/commands/utilities.d.ts.map +1 -1
  30. package/dist/{commands-C2PjCUio.js → commands-BvcMfEoO.js} +165 -18
  31. package/dist/{dist-B3npUhW6.js → dist-BTxdRxKP.js} +151 -6
  32. package/dist/{dist-C8sNOzr2.js → dist-Dm4q4uB4.js} +4 -4
  33. package/dist/dist-qJw7ALwV.js +1701 -0
  34. package/dist/dist-vJJL0WMc.js +3937 -0
  35. package/dist/index.js +9 -9
  36. package/dist/{json-validator-oEN7eUI3.js → json-validator-BiAdsE1O.js} +4 -4
  37. package/dist/{oidcProvisioningPrimitives-0-3n3D6f-yUBRl2DC.js → oidcProvisioningPrimitives-D9OYu5-F-D9DQdiwS.js} +7 -7
  38. package/dist/resolveIdentity-B-PK6RwU-Dvqeq9-I.js +2 -0
  39. package/package.json +14 -14
  40. package/dist/ApiKeyCollection-Bfb_nw81-D4pLjDGS.js +0 -2
  41. package/dist/AuditLogCollection-B1YonCAP-w1iOHW4A.js +0 -2
  42. package/dist/NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js +0 -2
  43. package/dist/OidcIdentityCollection-gnrLoF08-DJI-69Ow.js +0 -2
  44. package/dist/ProfileAssetCollection-CmbeSgDi-BpJ7XXsP.js +0 -2
  45. package/dist/ProfileMetadataCollection-DxX_BJKV-orYFlYii.js +0 -2
  46. package/dist/dist-DsMohSo_.js +0 -1487
  47. package/dist/dist-iMaSv6C_.js +0 -3712
  48. package/dist/resolveIdentity-BrJDCjYi-kdAssLr0.js +0 -2
package/AGENTS.md CHANGED
@@ -8,7 +8,7 @@ CLI with lazy-loaded commands, manifest discovery, and class introspection.
8
8
  smrt introspect # Discover SMRT objects in project
9
9
  smrt doctor # Umbrella diagnostics; can verify a generation snapshot
10
10
  smrt doctor --db # Add the live-schema parity section (see below)
11
- smrt db:status # Pending schema changes + failed migration classification
11
+ smrt db:status # Pending schema changes + failed migration classification (+ tenant natural-key findings: a missing tenant-led unique exits 1, a surviving legacy global unique warns until `db:migrate --drop-legacy-natural-key`: src/commands/tenant-natural-keys.ts)
12
12
  smrt db:status --parity # Same, plus live-schema parity (see below)
13
13
  smrt db:orphans # agents/db-orphans.md
14
14
  smrt db:migrate # agents/type-drift.md
@@ -73,7 +73,11 @@ back instead of holding the locks it already took against every writer.
73
73
  `--postgres-safe` selects **concurrent-index mode**: non-index DDL still commits
74
74
  in one transaction, then each index statement runs
75
75
  `CREATE INDEX CONCURRENTLY` / `DROP INDEX CONCURRENTLY` on one pinned session
76
- after that commit. This is the mode for large index rollouts.
76
+ after that commit. This is the mode for large index rollouts. A same-name
77
+ UNIQUE recreate runs build-then-swap (temporary name, drop, `ALTER INDEX …
78
+ RENAME`; `swapUniqueIndexRecreates()`), so the table never lacks a unique index.
79
+ A `VALIDATE CONSTRAINT` (new or replaced foreign key) and the statements after
80
+ it in the same migration also run outside the transaction, in order.
77
81
 
78
82
  - **Concurrent mode is not atomic.** Committed column/table changes survive a
79
83
  later index failure; unfinished index migrations are recorded `failed`, and
package/README.md CHANGED
@@ -110,6 +110,27 @@ upgrades have no automatic down migration. `smrt db:diff
110
110
  queries and prints the read-only `_smrt_*` conversion plan without initializing
111
111
  the tracker or writing to the database.
112
112
 
113
+ Empty text blocks those conversions too: `''` (or whitespace) is not a
114
+ timestamp, JSON document, or integer. When the manifest and live columns are
115
+ both nullable, opt in to storing it as NULL:
116
+
117
+ ```bash
118
+ smrt db:diff --empty-text-as-null # preview; notes how many values become NULL
119
+ smrt db:migrate --empty-text-as-null
120
+ ```
121
+
122
+ It covers `text` -> `timestamptz`, `jsonb` and integer conversions. Any other
123
+ value that does not convert still blocks, and NOT NULL columns are never
124
+ changed. For `timestamptz` and `jsonb` the diff probes the column first: without
125
+ the flag the blocking advisory names the empty-text count. `text` -> integer is
126
+ not probed at diff time: the conversion is listed as executable (with the note
127
+ "empty-text value(s), if any, become NULL" under the flag), and a value that is
128
+ not an integer only fails when `db:migrate` applies it, rolling the batch back.
129
+ `db:status` and `db:history` take the same flag, so they assess the same
130
+ convergence. Separately, `--postgres-timestamp-legacy-timezone=UTC` converts a
131
+ legacy `text` timestamp with `NULLIF(…, '')` / `'null'` → NULL even without
132
+ `--empty-text-as-null` (a NOT NULL column still fails at ALTER time).
133
+
113
134
  ### Code Generation
114
135
 
115
136
  | Command | Description |
@@ -25,6 +25,22 @@ stays reserved for ambiguous naive wall-clock strings the probe does not
25
25
  accept. SQLite has no distinct storage for `text` vs `timestamptz`, so this
26
26
  stays advisory-only there.
27
27
 
28
+ ### Empty text (#3226)
29
+
30
+ The probe counts empty or whitespace-only text separately. When it is the
31
+ only obstacle and the manifest and live columns are both nullable,
32
+ `DiffOptions.emptyTextAsNull` (`--empty-text-as-null`) converts with
33
+ `USING (CASE WHEN btrim(col) = '' THEN NULL ELSE col END)::<type>` and the
34
+ change carries a `note`. The same opt-in applies to `jsonb` (after the
35
+ duplicate-key walk over the remaining values) and to `text` -> integer.
36
+ Without it, the timestamptz/jsonb advisory names the empty-text count and
37
+ prints the sample as `(empty)`. `text` -> integer has no diff-time probe: its
38
+ note says "if any", and a non-integer value fails only at apply time (the
39
+ preflight `RAISE`). The `--postgres-timestamp-legacy-timezone=UTC` path still
40
+ maps `''` and `'null'` to NULL without the opt-in (`differ.ts`
41
+ `generateTypeUpgradeSQL`). `db:status` / `db:history` accept
42
+ `--empty-text-as-null` too.
43
+
28
44
  ## text -> jsonb convergence and uuid visibility (#2772)
29
45
 
30
46
  A `text` column on a table smrt itself creates, backed by a manifest `JSON`
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-DiBJPv76.js";
2
+ import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-BD7uutxz.js";
3
3
  import { SmrtObject, field, foreignKey, smrt } from "@happyvertical/smrt-core";
4
4
  import { createHash, randomBytes } from "node:crypto";
5
5
  //#region ../profiles/dist/chunks/ApiKey-BZmbOTnL.js
@@ -127,7 +127,7 @@ var ApiKey = class extends SmrtObject {
127
127
  */
128
128
  static async verify(key, options = {}) {
129
129
  const keyHash = ApiKey.hashKey(key);
130
- const { ApiKeyCollection } = await import("./ApiKeyCollection-Bfb_nw81-D4pLjDGS.js").then((n) => n.n);
130
+ const { ApiKeyCollection } = await import("./ApiKeyCollection-Bfb_nw81-C3Xz7MUq.js").then((n) => n.n);
131
131
  const apiKey = await (await ApiKeyCollection.create(options)).findOne({ where: { keyHash } });
132
132
  if (!apiKey) return null;
133
133
  if (!apiKey.isValid()) return null;
@@ -0,0 +1,2 @@
1
+ import { L as ApiKeyCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { ApiKeyCollection_exports as n };
@@ -0,0 +1,2 @@
1
+ import { F as AuditLogCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { AuditLogCollection_exports as n };
@@ -4097,21 +4097,21 @@ var NostrIdentity = class extends SmrtObject {
4097
4097
  * Find identity by public key
4098
4098
  */
4099
4099
  static async findByPubkey(pubkey, options = {}) {
4100
- const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js").then((n) => n.n);
4100
+ const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL--KYlM_ou.js").then((n) => n.n);
4101
4101
  return await (await NostrIdentityCollection.create(options)).findOne({ where: { pubkey } });
4102
4102
  }
4103
4103
  /**
4104
4104
  * Find identity by email
4105
4105
  */
4106
4106
  static async findByEmail(email, options = {}) {
4107
- const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js").then((n) => n.n);
4107
+ const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL--KYlM_ou.js").then((n) => n.n);
4108
4108
  return await (await NostrIdentityCollection.create(options)).findOne({ where: { email: email.toLowerCase() } });
4109
4109
  }
4110
4110
  /**
4111
4111
  * Find identity by NIP-05 username
4112
4112
  */
4113
4113
  static async findByNip05(username, options = {}) {
4114
- const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js").then((n) => n.n);
4114
+ const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL--KYlM_ou.js").then((n) => n.n);
4115
4115
  return await (await NostrIdentityCollection.create(options)).findOne({ where: { nip05Username: username.toLowerCase() } });
4116
4116
  }
4117
4117
  /**
@@ -0,0 +1,2 @@
1
+ import { M as NostrIdentityCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { NostrIdentityCollection_exports as n };
@@ -1,5 +1,5 @@
1
1
  import { SmrtObject, field, foreignKey, smrt } from "@happyvertical/smrt-core";
2
- //#region ../profiles/dist/chunks/OidcIdentity-K8V4u0CR.js
2
+ //#region ../profiles/dist/chunks/OidcIdentity-Cb1bxreM.js
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __decorateClass = (decorators, target, key, kind) => {
@@ -35,7 +35,7 @@ var OidcIdentity = class extends SmrtObject {
35
35
  * Find identity by issuer and subject
36
36
  */
37
37
  static async findBySubject(issuer, subject, options = {}) {
38
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-gnrLoF08-DJI-69Ow.js").then((n) => n.r);
38
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-TV8VdK69-DPeFJt3R.js").then((n) => n.r);
39
39
  return await (await OidcIdentityCollection.create(options)).findBySubject(issuer, subject);
40
40
  }
41
41
  /** Build the collision-free natural key for one OIDC issuer subject. */
@@ -58,7 +58,7 @@ var OidcIdentity = class extends SmrtObject {
58
58
  static async findOrCreate(profile, oidcData, options = {}) {
59
59
  const profileId = profile.id;
60
60
  if (typeof profileId !== "string" || !profileId) throw new Error("OidcIdentity.findOrCreate() requires a saved Profile.");
61
- const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-BrJDCjYi-kdAssLr0.js").then((n) => n.i);
61
+ const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-B-PK6RwU-Dvqeq9-I.js").then((n) => n.i);
62
62
  const profileOptions = profile.options ?? {};
63
63
  return (await reuseExistingOidcIdentityForProfile(profileId, {
64
64
  email: oidcData.email,
@@ -0,0 +1,2 @@
1
+ import { A as OidcIdentityCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { OidcIdentityCollection_exports as r };
@@ -0,0 +1,2 @@
1
+ import { D as ProfileAssetCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { ProfileAssetCollection_exports as n };
@@ -1,11 +1,11 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as queryGlobal, c as withSystemContext, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt } from "./dist-B3npUhW6.js";
3
- import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-DiBJPv76.js";
4
- import { a as removeOwnedAssetFromCollection, i as getOwnedAssetsFromCollection, n as assertValidOwnedAssetRelationship, o as resolveOwnedAssetsById, r as assertValidOwnedAssetSortOrder, t as addOwnedAssetFromCollection } from "./dist-DsMohSo_.js";
2
+ import { a as queryGlobal, i as tenantId, l as withSystemContext, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, s as getTenantId, t as definePrompt } from "./dist-BTxdRxKP.js";
3
+ import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-BD7uutxz.js";
4
+ import { a as getOwnedAssetsFromCollection, i as assertValidOwnedAssetSortOrder, n as assertAssetLinkable, o as removeOwnedAssetFromCollection, r as assertValidOwnedAssetRelationship, s as resolveOwnedAssetsById, t as addOwnedAssetFromCollection } from "./dist-qJw7ALwV.js";
5
5
  import { RuntimeError, SmrtCollection, SmrtObject, ValidationError, field, foreignKey, isAbortedTransactionError, oneToMany, smrt } from "@happyvertical/smrt-core";
6
6
  import { BackfillTableUnavailableError, BackfillTracker } from "@happyvertical/smrt-core/migrations";
7
- //#region ../profiles/dist/chunks/ProfileCollection-DTT4KNpQ.js
8
- var ProfileCollection_DTT4KNpQ_exports = /* @__PURE__ */ __exportAll({
7
+ //#region ../profiles/dist/chunks/ProfileCollection-DuJT7Mum.js
8
+ var ProfileCollection_DuJT7Mum_exports = /* @__PURE__ */ __exportAll({
9
9
  _: () => smrtProfilesGenerateBioPrompt,
10
10
  a: () => Profile,
11
11
  d: () => isOidcProvisioningRaceConflict,
@@ -387,6 +387,7 @@ var Profile = class extends SmrtObject {
387
387
  emailKey = null;
388
388
  name = "";
389
389
  description;
390
+ isPublic = false;
390
391
  metadata = [];
391
392
  relationshipsFrom = [];
392
393
  relationshipsTo = [];
@@ -396,6 +397,7 @@ var Profile = class extends SmrtObject {
396
397
  if (options.email !== void 0) this.email = options.email;
397
398
  if (options.name) this.name = options.name;
398
399
  if (options.description !== void 0) this.description = options.description;
400
+ if (options.isPublic !== void 0) this.isPublic = options.isPublic;
399
401
  }
400
402
  /** Keep the durable identity key derived from the public email field. */
401
403
  async save() {
@@ -428,9 +430,9 @@ var Profile = class extends SmrtObject {
428
430
  * @param value - The value to set
429
431
  */
430
432
  async addMetadata(metafieldSlug, value) {
431
- const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-CMKhVi2I-mh3UgeZA.js").then((n) => n.n);
432
- const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-DxX_BJKV-orYFlYii.js").then((n) => n.n);
433
- const metafield = await (await ProfileMetafieldCollection.create(this.options)).getBySlug(metafieldSlug);
433
+ const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-CoBuM_5G-BDwo4x3z.js").then((n) => n.n);
434
+ const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-DQhbfEfa-B1QlmBkX.js").then((n) => n.n);
435
+ const metafield = await this.resolveMetafield(await ProfileMetafieldCollection.create(this.options), metafieldSlug);
434
436
  if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
435
437
  await metafield.validateValue(value);
436
438
  const metadataCollection = await ProfileMetadataCollection.create(this.options);
@@ -444,13 +446,15 @@ var Profile = class extends SmrtObject {
444
446
  if (existing.length > 0) {
445
447
  const metadata = existing[0];
446
448
  metadata.value = String(value);
449
+ if (!metadata.tenantId && this.tenantId) metadata.tenantId = this.tenantId;
447
450
  await metadata.save();
448
451
  } else {
449
452
  if (!this.id || !metafield.id) throw new Error("Profile.addMetadata requires a persisted profile and metafield (missing id)");
450
453
  await (await metadataCollection.create({
451
454
  profileId: this.id,
452
455
  metafieldId: metafield.id,
453
- value: String(value)
456
+ value: String(value),
457
+ ...this.tenantId ? { tenantId: this.tenantId } : {}
454
458
  })).save();
455
459
  }
456
460
  }
@@ -460,7 +464,7 @@ var Profile = class extends SmrtObject {
460
464
  * @returns Object with metafield slugs as keys
461
465
  */
462
466
  async getMetadata() {
463
- const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-DxX_BJKV-orYFlYii.js").then((n) => n.n);
467
+ const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-DQhbfEfa-B1QlmBkX.js").then((n) => n.n);
464
468
  return await (await ProfileMetadataCollection.create(this.options)).getMetadataObject(this.id);
465
469
  }
466
470
  /**
@@ -477,9 +481,9 @@ var Profile = class extends SmrtObject {
477
481
  * @param metafieldSlug - The slug of the metafield to remove
478
482
  */
479
483
  async removeMetadata(metafieldSlug) {
480
- const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-CMKhVi2I-mh3UgeZA.js").then((n) => n.n);
481
- const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-DxX_BJKV-orYFlYii.js").then((n) => n.n);
482
- const metafield = await (await ProfileMetafieldCollection.create(this.options)).getBySlug(metafieldSlug);
484
+ const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-CoBuM_5G-BDwo4x3z.js").then((n) => n.n);
485
+ const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-DQhbfEfa-B1QlmBkX.js").then((n) => n.n);
486
+ const metafield = await this.resolveMetafield(await ProfileMetafieldCollection.create(this.options), metafieldSlug);
483
487
  if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
484
488
  const existing = await (await ProfileMetadataCollection.create(this.options)).list({
485
489
  where: {
@@ -490,8 +494,37 @@ var Profile = class extends SmrtObject {
490
494
  });
491
495
  if (existing.length > 0) await existing[0].delete();
492
496
  }
497
+ /**
498
+ * The metafield a slug names for this profile: the profile tenant's own
499
+ * definition first, then a global (NULL-tenant) one. A profile never takes
500
+ * another tenant's definition, which a super-admin or system read would
501
+ * otherwise return. A tenant-less profile falls back to the active tenant
502
+ * context's own definition only (none under system context).
503
+ */
504
+ async resolveMetafield(metafields, slug) {
505
+ const candidates = await metafields.list({ where: { slug } });
506
+ const ownerTenantId = this.tenantId || getTenantId();
507
+ return candidates.find((candidate) => ownerTenantId && candidate.tenantId === ownerTenantId) ?? candidates.find((candidate) => !candidate.tenantId) ?? null;
508
+ }
509
+ async getProfileLinkCollection() {
510
+ const { ProfileLinkCollection } = await import("./ProfileLinkCollection-4uNURz32-lMKBjaik.js").then((n) => n.r);
511
+ return ProfileLinkCollection.create({ db: this.db });
512
+ }
513
+ /** This profile's web links in display order. */
514
+ async getLinks() {
515
+ if (!this.id) return [];
516
+ return (await this.getProfileLinkCollection()).listForProfile(this.id);
517
+ }
518
+ /**
519
+ * Replaces this profile's web links with `links`, in that order, in one
520
+ * transaction (see `ProfileLinkCollection.replaceForProfile`).
521
+ */
522
+ async setLinks(links) {
523
+ if (!this.id) throw new Error("Cannot set links on an unsaved profile");
524
+ return (await this.getProfileLinkCollection()).replaceForProfile(this.id, links);
525
+ }
493
526
  async getProfileAssetCollection() {
494
- const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CmbeSgDi-BpJ7XXsP.js").then((n) => n.n);
527
+ const { ProfileAssetCollection } = await import("./ProfileAssetCollection-B9hacUJa-6R8lwjti.js").then((n) => n.n);
495
528
  return ProfileAssetCollection.create({ db: this.db });
496
529
  }
497
530
  async getAssets(relationship) {
@@ -501,6 +534,7 @@ var Profile = class extends SmrtObject {
501
534
  }
502
535
  async addAsset(asset, relationship = "attachment", sortOrder = 0) {
503
536
  if (!this.id || !asset.id) throw new Error("Cannot associate unsaved profile or asset");
537
+ await assertAssetLinkable(this.db, asset.id, this.tenantId, "profile");
504
538
  assertValidOwnedAssetRelationship(relationship);
505
539
  assertValidOwnedAssetSortOrder(sortOrder);
506
540
  await (await this.getProfileAssetCollection()).attach(this.id, asset.id, {
@@ -521,9 +555,9 @@ var Profile = class extends SmrtObject {
521
555
  * @param contextProfile - Optional context profile for tertiary relationships
522
556
  */
523
557
  async addRelationship(toProfile, relationshipSlug, contextProfile) {
524
- const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-BdXwd7Kf-CaYLxJmh.js").then((n) => n.n);
525
- const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-DUVgaIqf-CXHrAni4.js").then((n) => n.n);
526
- const { ProfileRelationshipType } = await import("./ProfileRelationshipType-BRiRka6t-ICv2cawn.js").then((n) => n.n).then((n) => n.n);
558
+ const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-BdXwd7Kf-BqQa8Awc.js").then((n) => n.n);
559
+ const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-DUVgaIqf-BRrBeg1Q.js").then((n) => n.n);
560
+ const { ProfileRelationshipType } = await import("./ProfileRelationshipType-BRiRka6t-B32A4UFT.js").then((n) => n.n).then((n) => n.n);
527
561
  const relationshipType = await (await ProfileRelationshipTypeCollection.create(this.options)).getBySlug(relationshipSlug);
528
562
  if (!relationshipType) throw new Error(`Relationship type '${relationshipSlug}' not found`);
529
563
  const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
@@ -547,8 +581,8 @@ var Profile = class extends SmrtObject {
547
581
  * @returns Array of ProfileRelationship instances
548
582
  */
549
583
  async getRelationships(options) {
550
- const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-DUVgaIqf-CXHrAni4.js").then((n) => n.n);
551
- const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-BdXwd7Kf-CaYLxJmh.js").then((n) => n.n);
584
+ const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-DUVgaIqf-BRrBeg1Q.js").then((n) => n.n);
585
+ const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-BdXwd7Kf-BqQa8Awc.js").then((n) => n.n);
552
586
  const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
553
587
  const direction = options?.direction || "all";
554
588
  let typeId;
@@ -591,8 +625,8 @@ var Profile = class extends SmrtObject {
591
625
  * @param relationshipSlug - The type of relationship to remove
592
626
  */
593
627
  async removeRelationship(toProfile, relationshipSlug) {
594
- const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-BdXwd7Kf-CaYLxJmh.js").then((n) => n.n);
595
- const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-DUVgaIqf-CXHrAni4.js").then((n) => n.n);
628
+ const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-BdXwd7Kf-BqQa8Awc.js").then((n) => n.n);
629
+ const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-DUVgaIqf-BRrBeg1Q.js").then((n) => n.n);
596
630
  const relationshipType = await (await ProfileRelationshipTypeCollection.create(this.options)).getBySlug(relationshipSlug);
597
631
  if (!relationshipType) throw new Error(`Relationship type '${relationshipSlug}' not found`);
598
632
  const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
@@ -685,7 +719,7 @@ var Profile = class extends SmrtObject {
685
719
  * @returns Array of API keys
686
720
  */
687
721
  async getApiKeys() {
688
- const { ApiKeyCollection } = await import("./ApiKeyCollection-Bfb_nw81-D4pLjDGS.js").then((n) => n.n);
722
+ const { ApiKeyCollection } = await import("./ApiKeyCollection-Bfb_nw81-C3Xz7MUq.js").then((n) => n.n);
689
723
  return await (await ApiKeyCollection.create(this.options)).findByProfile(this.id);
690
724
  }
691
725
  /**
@@ -694,7 +728,7 @@ var Profile = class extends SmrtObject {
694
728
  * @returns Array of active API keys
695
729
  */
696
730
  async getActiveApiKeys() {
697
- const { ApiKeyCollection } = await import("./ApiKeyCollection-Bfb_nw81-D4pLjDGS.js").then((n) => n.n);
731
+ const { ApiKeyCollection } = await import("./ApiKeyCollection-Bfb_nw81-C3Xz7MUq.js").then((n) => n.n);
698
732
  return await (await ApiKeyCollection.create(this.options)).findActiveByProfile(this.id);
699
733
  }
700
734
  /**
@@ -704,7 +738,7 @@ var Profile = class extends SmrtObject {
704
738
  * @returns The generated key (plaintext) and ApiKey record
705
739
  */
706
740
  async generateApiKey(options) {
707
- const { ApiKey } = await import("./ApiKey-BZmbOTnL-DEwZtcGA.js").then((n) => n.n).then((n) => n.n);
741
+ const { ApiKey } = await import("./ApiKey-BZmbOTnL-CMUo3WLf.js").then((n) => n.n).then((n) => n.n);
708
742
  return await ApiKey.generate(this, {
709
743
  ...options,
710
744
  db: this.options?.db
@@ -716,7 +750,7 @@ var Profile = class extends SmrtObject {
716
750
  * @returns Array of OIDC identity records
717
751
  */
718
752
  async getOidcIdentities() {
719
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-gnrLoF08-DJI-69Ow.js").then((n) => n.r);
753
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-TV8VdK69-DPeFJt3R.js").then((n) => n.r);
720
754
  return await (await OidcIdentityCollection.create(this.options)).findByProfile(this.id);
721
755
  }
722
756
  /**
@@ -729,7 +763,7 @@ var Profile = class extends SmrtObject {
729
763
  * type, but refuses to create or rebind authority.
730
764
  */
731
765
  async linkOidcIdentity(oidcData) {
732
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-gnrLoF08-DJI-69Ow.js").then((n) => n.r);
766
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-TV8VdK69-DPeFJt3R.js").then((n) => n.r);
733
767
  return await (await OidcIdentityCollection.create(this.options)).linkToProfile(this, oidcData);
734
768
  }
735
769
  /**
@@ -738,7 +772,7 @@ var Profile = class extends SmrtObject {
738
772
  * @returns Array of Nostr identity records
739
773
  */
740
774
  async getNostrIdentities() {
741
- const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js").then((n) => n.n);
775
+ const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL--KYlM_ou.js").then((n) => n.n);
742
776
  return await (await NostrIdentityCollection.create(this.options)).findByProfile(this.id);
743
777
  }
744
778
  /**
@@ -748,7 +782,7 @@ var Profile = class extends SmrtObject {
748
782
  * @returns The linked Nostr identity record
749
783
  */
750
784
  async linkNostrIdentity(nostrData) {
751
- const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js").then((n) => n.n);
785
+ const { NostrIdentityCollection } = await import("./NostrIdentityCollection-Ca74dkaL--KYlM_ou.js").then((n) => n.n);
752
786
  return await (await NostrIdentityCollection.create(this.options)).linkToProfile(this, nostrData);
753
787
  }
754
788
  /**
@@ -758,7 +792,7 @@ var Profile = class extends SmrtObject {
758
792
  * @returns Array of audit log entries
759
793
  */
760
794
  async getAuditLogs(limit = 50) {
761
- const { AuditLogCollection } = await import("./AuditLogCollection-B1YonCAP-w1iOHW4A.js").then((n) => n.n);
795
+ const { AuditLogCollection } = await import("./AuditLogCollection-B1YonCAP-DmmboC_X.js").then((n) => n.n);
762
796
  return await (await AuditLogCollection.create(this.options)).getRecentActivity(this.id, limit);
763
797
  }
764
798
  /**
@@ -768,7 +802,7 @@ var Profile = class extends SmrtObject {
768
802
  * @returns The created audit log entry
769
803
  */
770
804
  async recordAction(options) {
771
- const { AuditLogCollection } = await import("./AuditLogCollection-B1YonCAP-w1iOHW4A.js").then((n) => n.n);
805
+ const { AuditLogCollection } = await import("./AuditLogCollection-B1YonCAP-DmmboC_X.js").then((n) => n.n);
772
806
  return await (await AuditLogCollection.create(this.options)).record({
773
807
  profile: this,
774
808
  ...options
@@ -784,6 +818,10 @@ __decorateClass([field({
784
818
  readonly: true
785
819
  })], Profile.prototype, "emailKey", 2);
786
820
  __decorateClass([field({ required: true })], Profile.prototype, "name", 2);
821
+ __decorateClass([field({
822
+ type: "boolean",
823
+ default: false
824
+ })], Profile.prototype, "isPublic", 2);
787
825
  __decorateClass([oneToMany("ProfileMetadata")], Profile.prototype, "metadata", 2);
788
826
  __decorateClass([oneToMany("ProfileRelationship", { foreignKey: "fromProfileId" })], Profile.prototype, "relationshipsFrom", 2);
789
827
  __decorateClass([oneToMany("ProfileRelationship", { foreignKey: "toProfileId" })], Profile.prototype, "relationshipsTo", 2);
@@ -1127,4 +1165,4 @@ function readRequiredString(row, key) {
1127
1165
  return value;
1128
1166
  }
1129
1167
  //#endregion
1130
- export { coordinateOidcProvisioning as a, saveOidcRaceArbiter as c, ProfileType as i, ProfileCollection as n, isOidcProvisioningRaceConflict as o, ProfileCollection_DTT4KNpQ_exports as r, normalizeIdentityEmail as s, Profile as t };
1168
+ export { coordinateOidcProvisioning as a, saveOidcRaceArbiter as c, ProfileType as i, ProfileCollection as n, isOidcProvisioningRaceConflict as o, ProfileCollection_DuJT7Mum_exports as r, normalizeIdentityEmail as s, Profile as t };
@@ -0,0 +1,2 @@
1
+ import { S as ProfileLinkCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { ProfileLinkCollection_exports as r };
@@ -0,0 +1,2 @@
1
+ import { v as ProfileMetadataCollection_exports } from "./dist-vJJL0WMc.js";
2
+ export { ProfileMetadataCollection_exports as n };
@@ -1,2 +1,2 @@
1
- import { h as ProfileMetafieldCollection_exports } from "./dist-iMaSv6C_.js";
1
+ import { h as ProfileMetafieldCollection_exports } from "./dist-vJJL0WMc.js";
2
2
  export { ProfileMetafieldCollection_exports as n };
@@ -1,2 +1,2 @@
1
- import { f as ProfileRelationshipCollection_exports } from "./dist-iMaSv6C_.js";
1
+ import { f as ProfileRelationshipCollection_exports } from "./dist-vJJL0WMc.js";
2
2
  export { ProfileRelationshipCollection_exports as n };
@@ -1,2 +1,2 @@
1
- import { l as ProfileRelationshipTermCollection_exports } from "./dist-iMaSv6C_.js";
1
+ import { l as ProfileRelationshipTermCollection_exports } from "./dist-vJJL0WMc.js";
2
2
  export { ProfileRelationshipTermCollection_exports as n };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-DiBJPv76.js";
2
+ import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-BD7uutxz.js";
3
3
  import { SmrtObject, field, smrt } from "@happyvertical/smrt-core";
4
4
  //#region ../profiles/dist/chunks/ProfileRelationshipType-BRiRka6t.js
5
5
  var ProfileRelationshipType_BRiRka6t_exports = /* @__PURE__ */ __exportAll({
@@ -1,2 +1,2 @@
1
- import { o as ProfileRelationshipTypeCollection_exports } from "./dist-iMaSv6C_.js";
1
+ import { o as ProfileRelationshipTypeCollection_exports } from "./dist-vJJL0WMc.js";
2
2
  export { ProfileRelationshipTypeCollection_exports as n };
@@ -1 +1 @@
1
- {"version":3,"file":"db-diff.d.ts","sourceRoot":"","sources":["../../src/commands/db-diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAkCtD,eAAO,MAAM,aAAa,EAAE,UAwb3B,CAAC"}
1
+ {"version":3,"file":"db-diff.d.ts","sourceRoot":"","sources":["../../src/commands/db-diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAoCtD,eAAO,MAAM,aAAa,EAAE,UA2d3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"db-history.d.ts","sourceRoot":"","sources":["../../src/commands/db-history.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA2DtD,eAAO,MAAM,gBAAgB,EAAE,UAgV9B,CAAC"}
1
+ {"version":3,"file":"db-history.d.ts","sourceRoot":"","sources":["../../src/commands/db-history.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA4DtD,eAAO,MAAM,gBAAgB,EAAE,UAwV9B,CAAC"}
@@ -71,6 +71,8 @@ export interface MigrationAction {
71
71
  sql?: string;
72
72
  sqlStatements?: string[];
73
73
  advisory?: SchemaChangeAdvisoryLike;
74
+ /** Operator-facing note carried from `SchemaChangeLike.note` (#3226). */
75
+ note?: string;
74
76
  /** Set on `add_foreign_key` / `drop_foreign_key` actions (#2748). */
75
77
  foreignKey?: ForeignKeyDefinitionLike;
76
78
  /** See `SchemaChangeLike.orphanBlocked` (#2748). */
@@ -117,6 +119,11 @@ export interface SchemaChangeLike {
117
119
  /** See `MigrationAction.phase` (#2608). */
118
120
  phase?: 'pre_foreign_key';
119
121
  advisory?: SchemaChangeAdvisoryLike;
122
+ /**
123
+ * Operator-facing note on an executable change (mirrors core's
124
+ * `SchemaChange.note`), e.g. empty text stored as NULL (#3226).
125
+ */
126
+ note?: string;
120
127
  sql?: string;
121
128
  sqlStatements?: string[];
122
129
  /** Set on `add_foreign_key` / `drop_foreign_key` changes (#2748). */
@@ -1 +1 @@
1
- {"version":3,"file":"db-migrate-actions.d.ts","sourceRoot":"","sources":["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,MAAM,CAAa,GAChD;IAAE,OAAO,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAiE/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,CAAC,SAAS;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,EACrC,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,CAAC,EAAE,CAUlD;AAMD,iEAAiE;AACjE,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,eAAe,EAAE,GACrC;IACD,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC,CA+BA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -45,6 +45,13 @@ export interface LiveSchemaParityOutcome {
45
45
  * duplicates rows.
46
46
  */
47
47
  export declare function collectRegistryConflictTargets(): Record<string, ConflictTargetInput[]>;
48
+ /**
49
+ * Matches core's collection classification, including a registered collection
50
+ * subclass whose immediate parent is another collection class. Unknown
51
+ * registrations stay included so a malformed registry cannot hide a real
52
+ * persistence target from a fail-closed parity check.
53
+ */
54
+ export declare function isCollectionRegistration(className: string): boolean;
48
55
  /**
49
56
  * Run the parity check against the configured database.
50
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"db-parity.d.ts","sourceRoot":"","sources":["../../src/commands/db-parity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,KA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AM,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE;YACX,MAAM,EAAE,MAAM,CAAC;YACf,eAAe,EAAE,MAAM,CAAC;YACxB,gBAAgB,EAAE,MAAM,CAAC;SAC1B,CAAC;QACF,QAAQ,CAAC,EAAE;YAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC,CAAC;CACJ,GAAG,WAAW,EAAE,CA0KhB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE;YAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC,CAAC;CACJ,GAAG,WAAW,EAAE,CAyBhB;AAED,eAAO,MAAM,eAAe,EAAE,UA6e7B,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Tenant natural-key detector for `db:status`.
3
+ *
4
+ * A tenant-owned table (declared tenant scope, or an undeclared `tenantId`
5
+ * field — `ObjectRegistry.getOwnershipTenantColumn()`) upserts on a
6
+ * tenant-led key such as `(tenant_id, slug, context)`. A live database created
7
+ * before that default can still carry the GLOBAL `(slug, context)` unique:
8
+ * then a second tenant's same-slug save collides with a row it cannot see.
9
+ * Before the save-time ownership guard, `ON CONFLICT … DO UPDATE` rewrote that
10
+ * row's `id` and `tenant_id` (the Anytown Ludis takeover); now the save is
11
+ * refused, and on engines that require an exact ON CONFLICT target the create
12
+ * fails until `smrt db:migrate` swaps the index.
13
+ *
14
+ * Rollout is expand, then contract: `smrt db:migrate` builds the tenant-led
15
+ * unique beside the global one (an `error` until it exists, so db:status exits
16
+ * 1), and the global one stays — reported as a `warning` — until
17
+ * `smrt db:migrate --drop-legacy-natural-key` once no old code is running.
18
+ * Explicit `@smrt({ conflictColumns })` that omit the tenant column are the
19
+ * author's declared contract and are not reported here (the tenancy
20
+ * package's `auditTenantScopedRegistrations()` flags runtime-registered ones).
21
+ */
22
+ /** Live index shape this detector reads (`getTableSchema().indexes`). */
23
+ type LiveIndexLike = {
24
+ name?: string;
25
+ columns?: string[];
26
+ unique?: boolean;
27
+ where?: string;
28
+ };
29
+ /** Live table shape this detector reads. */
30
+ export type LiveTableLike = {
31
+ indexes?: LiveIndexLike[];
32
+ } | null | undefined;
33
+ /**
34
+ * One tenant natural-key finding, shaped as a `db:status` precondition.
35
+ * `global_unique` is an `error` (db:status exits 1): the release that keys
36
+ * the table by tenant needs its migration, and a rollout must not miss it.
37
+ */
38
+ export interface TenantNaturalKeyFinding {
39
+ name: string;
40
+ status: 'warning' | 'error';
41
+ message: string;
42
+ recommendation: string;
43
+ details: {
44
+ className: string;
45
+ tableName: string;
46
+ conflictColumns: string[];
47
+ liveIndex?: string;
48
+ kind: 'global_unique' | 'legacy_global_unique' | 'missing_tenant_unique';
49
+ };
50
+ }
51
+ /**
52
+ * Compare every tenant-owned table's upsert target with its live unique
53
+ * indexes. Tables absent from `liveSchemas` (not created yet, or not
54
+ * introspected) are skipped — the schema diff reports those.
55
+ */
56
+ export declare function checkTenantNaturalKeyUniques(liveSchemas: ReadonlyMap<string, LiveTableLike>): TenantNaturalKeyFinding[];
57
+ export {};
58
+ //# sourceMappingURL=tenant-natural-keys.d.ts.map