@happyvertical/smrt-cli 0.56.0 → 0.56.2

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 (31) hide show
  1. package/AGENTS.md +1 -0
  2. package/agents/commerce-money-migration.md +48 -0
  3. package/dist/{AuditLogCollection-WDHL-_AF-CkvpDxHr.js → AuditLogCollection-WDHL-_AF-PMKF1FIA.js} +1 -1
  4. package/dist/{OidcIdentity-BUblgQLs-YtH5nThx.js → OidcIdentity-BUblgQLs-C2jGl4xb.js} +2 -2
  5. package/dist/{OidcIdentityCollection-ClOyaHeF-BEJzIJvn.js → OidcIdentityCollection-ClOyaHeF-CRqOi6OR.js} +1 -1
  6. package/dist/{ProfileAssetCollection-CRMcjLJ--BC39Pto3.js → ProfileAssetCollection-CRMcjLJ--D0B9tdFm.js} +3 -3
  7. package/dist/{ProfileCollection-C4INKh7Y-BrYAadzx.js → ProfileCollection-C4INKh7Y-EfdCjHJy.js} +17 -17
  8. package/dist/{ProfileLinkCollection-DFfZRsgv-BeQfJWyp.js → ProfileLinkCollection-DFfZRsgv-Do3CZRe8.js} +2 -2
  9. package/dist/{ProfileMetadataCollection-BIYKy4Y3-CYNYvpjL.js → ProfileMetadataCollection-BIYKy4Y3-D_5z9xC7.js} +1 -1
  10. package/dist/{ProfileMetafieldCollection-Buz7gzag-CDVhxkl2.js → ProfileMetafieldCollection-Buz7gzag-BBp96ZxU.js} +1 -1
  11. package/dist/{ProfileRelationshipCollection-C4g_QLI4-CfYX480m.js → ProfileRelationshipCollection-C4g_QLI4-DdNSbq9T.js} +1 -1
  12. package/dist/{ProfileTypeCollection-B7kwi1mU-N9uAc-TX.js → ProfileTypeCollection-B7kwi1mU-7uzgnnJA.js} +2 -2
  13. package/dist/cli-generator.d.ts.map +1 -1
  14. package/dist/commands/db-commerce-money.d.ts +5 -0
  15. package/dist/commands/db-commerce-money.d.ts.map +1 -0
  16. package/dist/commands/utilities.d.ts.map +1 -1
  17. package/dist/{commands-Cy855fCa.js → commands-DQMwpnIx.js} +227 -4
  18. package/dist/{dist-ZDJ5sk8l.js → dist-Clv0HeDN.js} +107 -6
  19. package/dist/dist-D1ZvOIhb.js +21 -0
  20. package/dist/dist-D8ESE6vP.js +4687 -0
  21. package/dist/{dist-CwyZ2lTm.js → dist-DHxqJOJ1.js} +26 -9
  22. package/dist/{dist-ymeU2H9O.js → dist-UCD6F1L5.js} +51 -4
  23. package/dist/index.js +12 -12
  24. package/dist/loaders/consumer-package.d.ts +5 -0
  25. package/dist/loaders/consumer-package.d.ts.map +1 -0
  26. package/dist/{oidcProvisioningPrimitives-DNP9EZlU-BskcN5Bx.js → oidcProvisioningPrimitives-DNP9EZlU-B_amql6n.js} +3 -3
  27. package/dist/{resolveIdentity-CkyqvctR-DoaK_1AO.js → resolveIdentity-CkyqvctR-DvYT2fSs.js} +14 -14
  28. package/dist/{server-C69K3w-t.js → server-D2wRPnk0.js} +1 -1
  29. package/package.json +15 -15
  30. package/dist/dist-BhK8eCtX.js +0 -4620
  31. package/dist/dist-C-ac3hKp.js +0 -21
package/AGENTS.md CHANGED
@@ -19,6 +19,7 @@ smrt db:migrate-uuid # Convert schema-declared UUID text columns after d
19
19
  smrt db:migrate-int8
20
20
  smrt db:migrate-null-equal-indexes # ../core/agents/null-equal-indexes.md
21
21
  smrt db:migrate-ledger-accounts [--dry-run] # Move pre-#3098 ledger rows out of `accounts` (smrt-ledgers README)
22
+ smrt db:{preflight,migrate,rollback}-commerce-money # agents/commerce-money-migration.md
22
23
  smrt db:migrate-qualified-names [--dry-run] # Opt-in old→current name backfill; doctor --db counts (../core/agents/model-moves.md)
23
24
  smrt db:materialize-tenant-hierarchy [--dry-run] # smrt-users tenant hierarchy_path backfill (#3036)
24
25
  smrt db:drop-framework-base-tables # One-time drop of the five #2644-orphaned framework-base tables
@@ -0,0 +1,48 @@
1
+ # Commerce money migration commands
2
+
3
+ Run the normal schema migration before these data commands. The Commerce data
4
+ migration never creates tables or columns at runtime.
5
+
6
+ 1. Generate review artifacts without changing the database:
7
+
8
+ ```sh
9
+ smrt db:preflight-commerce-money \
10
+ --tenant-id <tenant-id> \
11
+ --json-path ./commerce-money.json \
12
+ --csv-path ./commerce-money.csv
13
+ ```
14
+
15
+ Omit `--tenant-id` only for a system-wide read-only report. The two output
16
+ paths are optional, but must be supplied together. Review every reason code,
17
+ repair `UNRECONCILED` documents before continuing, and assign the required
18
+ fallback tax accounts.
19
+
20
+ 2. Migrate one tenant after review:
21
+
22
+ ```sh
23
+ smrt db:migrate-commerce-money --tenant-id <tenant-id>
24
+ ```
25
+
26
+ The command prints its migration owner UUID before it claims the tenant.
27
+ Preserve that value. If the process is interrupted, repeat the command with
28
+ `--migration-id <uuid>`; a different owner is refused. Add
29
+ `--accept-draft-changes` only after approving the draft deltas from preflight.
30
+
31
+ 3. Roll back during the supported rollback window:
32
+
33
+ ```sh
34
+ smrt db:rollback-commerce-money \
35
+ --tenant-id <tenant-id> \
36
+ --migration-id <uuid>
37
+ ```
38
+
39
+ Rollback restores the durable pre-images only when every current document
40
+ still matches its recorded post-image. Any later document, line, payment,
41
+ credit, or accounting-sync change blocks the whole rollback before a restore.
42
+
43
+ All commands use the configured database and redact credentials from failures.
44
+ The migrate and rollback commands share the same tenant runtime barrier as
45
+ Commerce reads and writes; do not alter the tenant marker directly.
46
+
47
+ The data invariants and header-identity exception are documented in
48
+ `@happyvertical/smrt-commerce/agents/line-amount-migration.md`.
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as tenantId, r as TenantScoped } from "./dist-CwyZ2lTm.js";
2
+ import { i as tenantId, r as TenantScoped } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { SmrtCollection, SmrtObject, field, foreignKey, smrt } from "@happyvertical/smrt-core";
5
5
  //#region ../profiles/dist/chunks/AuditLogCollection-WDHL-_AF.js
@@ -42,7 +42,7 @@ var OidcIdentity = class extends SmrtObject {
42
42
  * Find identity by issuer and subject
43
43
  */
44
44
  static async findBySubject(issuer, subject, options = {}) {
45
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-BEJzIJvn.js").then((n) => n.r).then((n) => n.r);
45
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CRqOi6OR.js").then((n) => n.r).then((n) => n.r);
46
46
  return await (await OidcIdentityCollection.create(options)).findBySubject(issuer, subject);
47
47
  }
48
48
  /** Build the collision-free natural key for one OIDC issuer subject. */
@@ -65,7 +65,7 @@ var OidcIdentity = class extends SmrtObject {
65
65
  static async findOrCreate(profile, oidcData, options = {}) {
66
66
  const profileId = profile.id;
67
67
  if (typeof profileId !== "string" || !profileId) throw new Error("OidcIdentity.findOrCreate() requires a saved Profile.");
68
- const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-CkyqvctR-DoaK_1AO.js").then((n) => n.i).then((n) => n.i);
68
+ const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-CkyqvctR-DvYT2fSs.js").then((n) => n.i).then((n) => n.i);
69
69
  const profileOptions = profile.options ?? {};
70
70
  return (await reuseExistingOidcIdentityForProfile(profileId, {
71
71
  email: oidcData.email,
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
3
- import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-YtH5nThx.js";
3
+ import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-C2jGl4xb.js";
4
4
  import { SmrtCollection } from "@happyvertical/smrt-core";
5
5
  //#region ../profiles/dist/chunks/OidcIdentityCollection-ClOyaHeF.js
6
6
  var OidcIdentityCollection_ClOyaHeF_exports = /* @__PURE__ */ __exportAll({
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as tenantId, r as TenantScoped } from "./dist-CwyZ2lTm.js";
2
+ import { i as tenantId, r as TenantScoped } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
- import { a as getOwnedAssetsFromCollection, o as removeOwnedAssetFromCollection, t as addOwnedAssetFromCollection } from "./dist-ZDJ5sk8l.js";
4
+ import { a as getOwnedAssetsFromCollection, o as removeOwnedAssetFromCollection, t as addOwnedAssetFromCollection } from "./dist-Clv0HeDN.js";
5
5
  import { SmrtJunction, SmrtObject, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
6
6
  //#region ../profiles/dist/chunks/ProfileAssetCollection-CRMcjLJ-.js
7
7
  var ProfileAssetCollection_CRMcjLJ__exports = /* @__PURE__ */ __exportAll({
@@ -84,7 +84,7 @@ var ProfileAssetCollection = class extends SmrtJunction {
84
84
  profileCollectionPromise = null;
85
85
  async getProfileCollection() {
86
86
  if (!this.profileCollectionPromise) {
87
- const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-BrYAadzx.js").then((n) => n.o).then((n) => n.r);
87
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-EfdCjHJy.js").then((n) => n.o).then((n) => n.r);
88
88
  this.profileCollectionPromise = ProfileCollection.create({ db: this.db });
89
89
  }
90
90
  return this.profileCollectionPromise;
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as queryGlobal, c as getTenantId, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt, u as withSystemContext } from "./dist-CwyZ2lTm.js";
2
+ import { a as queryGlobal, f as withSystemContext, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt, u as getTenantId } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.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-ZDJ5sk8l.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-Clv0HeDN.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
7
  //#region ../profiles/dist/chunks/ProfileCollection-C4INKh7Y.js
@@ -435,7 +435,7 @@ var Profile = class extends SmrtObject {
435
435
  async getTypeSlug() {
436
436
  const tenantId2 = this.tenantId || getTenantId();
437
437
  if (this.typeId && tenantId2) {
438
- const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-N9uAc-TX.js").then((n) => n.n).then((n) => n.n);
438
+ const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-7uzgnnJA.js").then((n) => n.n).then((n) => n.n);
439
439
  return (await (await ProfileTypeCollection.create(this.options)).getAvailableById(this.typeId, tenantId2))?.slug ?? "";
440
440
  }
441
441
  return (await this.loadRelated("typeId"))?.slug || "";
@@ -458,8 +458,8 @@ var Profile = class extends SmrtObject {
458
458
  * @param value - The value to set
459
459
  */
460
460
  async addMetadata(metafieldSlug, value) {
461
- const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-CDVhxkl2.js").then((n) => n.r).then((n) => n.n);
462
- const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-CYNYvpjL.js").then((n) => n.r).then((n) => n.n);
461
+ const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-BBp96ZxU.js").then((n) => n.r).then((n) => n.n);
462
+ const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-D_5z9xC7.js").then((n) => n.r).then((n) => n.n);
463
463
  const metafield = await this.resolveMetafield(await ProfileMetafieldCollection.create(this.options), metafieldSlug);
464
464
  if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
465
465
  await metafield.validateValue(value);
@@ -492,7 +492,7 @@ var Profile = class extends SmrtObject {
492
492
  * @returns Object with metafield slugs as keys
493
493
  */
494
494
  async getMetadata() {
495
- const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-CYNYvpjL.js").then((n) => n.r).then((n) => n.n);
495
+ const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-D_5z9xC7.js").then((n) => n.r).then((n) => n.n);
496
496
  return await (await ProfileMetadataCollection.create(this.options)).getMetadataObject(this.id);
497
497
  }
498
498
  /**
@@ -509,8 +509,8 @@ var Profile = class extends SmrtObject {
509
509
  * @param metafieldSlug - The slug of the metafield to remove
510
510
  */
511
511
  async removeMetadata(metafieldSlug) {
512
- const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-CDVhxkl2.js").then((n) => n.r).then((n) => n.n);
513
- const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-CYNYvpjL.js").then((n) => n.r).then((n) => n.n);
512
+ const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-BBp96ZxU.js").then((n) => n.r).then((n) => n.n);
513
+ const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-D_5z9xC7.js").then((n) => n.r).then((n) => n.n);
514
514
  const metafield = await this.resolveMetafield(await ProfileMetafieldCollection.create(this.options), metafieldSlug);
515
515
  if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
516
516
  const existing = await (await ProfileMetadataCollection.create(this.options)).list({
@@ -535,7 +535,7 @@ var Profile = class extends SmrtObject {
535
535
  return candidates.find((candidate) => ownerTenantId && candidate.tenantId === ownerTenantId) ?? candidates.find((candidate) => !candidate.tenantId) ?? null;
536
536
  }
537
537
  async getProfileLinkCollection() {
538
- const { ProfileLinkCollection } = await import("./ProfileLinkCollection-DFfZRsgv-BeQfJWyp.js").then((n) => n.i).then((n) => n.r);
538
+ const { ProfileLinkCollection } = await import("./ProfileLinkCollection-DFfZRsgv-Do3CZRe8.js").then((n) => n.i).then((n) => n.r);
539
539
  return ProfileLinkCollection.create({ db: this.db });
540
540
  }
541
541
  /** This profile's web links in display order. */
@@ -552,7 +552,7 @@ var Profile = class extends SmrtObject {
552
552
  return (await this.getProfileLinkCollection()).replaceForProfile(this.id, links);
553
553
  }
554
554
  async getProfileAssetCollection() {
555
- const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CRMcjLJ--BC39Pto3.js").then((n) => n.r).then((n) => n.n);
555
+ const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CRMcjLJ--D0B9tdFm.js").then((n) => n.r).then((n) => n.n);
556
556
  return ProfileAssetCollection.create({ db: this.db });
557
557
  }
558
558
  async getAssets(relationship) {
@@ -584,7 +584,7 @@ var Profile = class extends SmrtObject {
584
584
  */
585
585
  async addRelationship(toProfile, relationshipSlug, contextProfile) {
586
586
  const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js").then((n) => n.n).then((n) => n.n);
587
- const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-CfYX480m.js").then((n) => n.r).then((n) => n.n);
587
+ const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-DdNSbq9T.js").then((n) => n.r).then((n) => n.n);
588
588
  const { ProfileRelationshipType } = await import("./ProfileRelationshipType-U7IwF6Wf-DNavf24e.js").then((n) => n.n).then((n) => n.n);
589
589
  const relationshipType = await (await ProfileRelationshipTypeCollection.create(this.options)).getBySlug(relationshipSlug);
590
590
  if (!relationshipType) throw new Error(`Relationship type '${relationshipSlug}' not found`);
@@ -609,7 +609,7 @@ var Profile = class extends SmrtObject {
609
609
  * @returns Array of ProfileRelationship instances
610
610
  */
611
611
  async getRelationships(options) {
612
- const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-CfYX480m.js").then((n) => n.r).then((n) => n.n);
612
+ const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-DdNSbq9T.js").then((n) => n.r).then((n) => n.n);
613
613
  const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js").then((n) => n.n).then((n) => n.n);
614
614
  const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
615
615
  const direction = options?.direction || "all";
@@ -654,7 +654,7 @@ var Profile = class extends SmrtObject {
654
654
  */
655
655
  async removeRelationship(toProfile, relationshipSlug) {
656
656
  const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js").then((n) => n.n).then((n) => n.n);
657
- const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-CfYX480m.js").then((n) => n.r).then((n) => n.n);
657
+ const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-DdNSbq9T.js").then((n) => n.r).then((n) => n.n);
658
658
  const relationshipType = await (await ProfileRelationshipTypeCollection.create(this.options)).getBySlug(relationshipSlug);
659
659
  if (!relationshipType) throw new Error(`Relationship type '${relationshipSlug}' not found`);
660
660
  const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
@@ -778,7 +778,7 @@ var Profile = class extends SmrtObject {
778
778
  * @returns Array of OIDC identity records
779
779
  */
780
780
  async getOidcIdentities() {
781
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-BEJzIJvn.js").then((n) => n.r).then((n) => n.r);
781
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CRqOi6OR.js").then((n) => n.r).then((n) => n.r);
782
782
  return await (await OidcIdentityCollection.create(this.options)).findByProfile(this.id);
783
783
  }
784
784
  /**
@@ -791,7 +791,7 @@ var Profile = class extends SmrtObject {
791
791
  * type, but refuses to create or rebind authority.
792
792
  */
793
793
  async linkOidcIdentity(oidcData) {
794
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-BEJzIJvn.js").then((n) => n.r).then((n) => n.r);
794
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CRqOi6OR.js").then((n) => n.r).then((n) => n.r);
795
795
  return await (await OidcIdentityCollection.create(this.options)).linkToProfile(this, oidcData);
796
796
  }
797
797
  /**
@@ -820,7 +820,7 @@ var Profile = class extends SmrtObject {
820
820
  * @returns Array of audit log entries
821
821
  */
822
822
  async getAuditLogs(limit = 50) {
823
- const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-CkvpDxHr.js").then((n) => n.r).then((n) => n.n);
823
+ const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-PMKF1FIA.js").then((n) => n.r).then((n) => n.n);
824
824
  return await (await AuditLogCollection.create(this.options)).getRecentActivity(this.id, limit);
825
825
  }
826
826
  /**
@@ -830,7 +830,7 @@ var Profile = class extends SmrtObject {
830
830
  * @returns The created audit log entry
831
831
  */
832
832
  async recordAction(options) {
833
- const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-CkvpDxHr.js").then((n) => n.r).then((n) => n.n);
833
+ const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-PMKF1FIA.js").then((n) => n.r).then((n) => n.n);
834
834
  return await (await AuditLogCollection.create(this.options)).record({
835
835
  profile: this,
836
836
  ...options
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as tenantId, r as TenantScoped } from "./dist-CwyZ2lTm.js";
2
+ import { i as tenantId, r as TenantScoped } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { SmrtCollection, SmrtObject, field, foreignKey, isEmbeddedDatabase, smrt, withEmbeddedWriteTransaction } from "@happyvertical/smrt-core";
5
5
  //#region ../profiles/dist/chunks/ProfileLinkCollection-DFfZRsgv.js
@@ -203,7 +203,7 @@ var ProfileLinkCollection = class ProfileLinkCollection extends SmrtCollection {
203
203
  /** The profile's tenant; throws when the profile is not visible here. */
204
204
  async requireProfileTenant(profileId) {
205
205
  if (!profileId) throw new Error("A profile link needs a profile");
206
- const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-BrYAadzx.js").then((n) => n.o).then((n) => n.r);
206
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-EfdCjHJy.js").then((n) => n.o).then((n) => n.r);
207
207
  const profile = await (await ProfileCollection.create({ db: this.db })).get({ id: profileId });
208
208
  if (!profile) throw new Error(`Profile '${profileId}' not found`);
209
209
  return profile.tenantId ?? null;
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as tenantId, r as TenantScoped } from "./dist-CwyZ2lTm.js";
2
+ import { i as tenantId, r as TenantScoped } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { SmrtCollection, SmrtObject, field, foreignKey, smrt } from "@happyvertical/smrt-core";
5
5
  //#region ../profiles/dist/chunks/ProfileMetadataCollection-BIYKy4Y3.js
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as tenantId, r as TenantScoped } from "./dist-CwyZ2lTm.js";
2
+ import { i as tenantId, r as TenantScoped } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { SmrtCollection, SmrtObject, field, smrt } from "@happyvertical/smrt-core";
5
5
  //#region ../profiles/dist/chunks/ProfileMetafieldCollection-Buz7gzag.js
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as tenantId, r as TenantScoped } from "./dist-CwyZ2lTm.js";
2
+ import { i as tenantId, r as TenantScoped } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { SmrtCollection, SmrtObject, foreignKey, oneToMany, smrt } from "@happyvertical/smrt-core";
5
5
  //#region ../profiles/dist/chunks/ProfileRelationshipCollection-C4g_QLI4.js
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { l as isSystemContext, s as withTenantGlobalRead } from "./dist-CwyZ2lTm.js";
2
+ import { c as withTenantGlobalRead, d as isSystemContext } from "./dist-DHxqJOJ1.js";
3
3
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
- import { s as ProfileType } from "./ProfileCollection-C4INKh7Y-BrYAadzx.js";
4
+ import { s as ProfileType } from "./ProfileCollection-C4INKh7Y-EfdCjHJy.js";
5
5
  import { SmrtCollection } from "@happyvertical/smrt-core";
6
6
  //#region ../profiles/dist/chunks/ProfileTypeCollection-B7kwi1mU.js
7
7
  var ProfileTypeCollection_B7kwi1mU_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"cli-generator.d.ts","sourceRoot":"","sources":["../src/cli-generator.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAiBH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AA6H9B,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAA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M,EAA0B,GAC9C,OAAO,CAAC,IAAI,CAAC;IAsLhB;;OAEG;YACW,cAAc;IAoD5B;;OAEG;IACH,uBAAuB,IAAI,UAAU,EAAE;IAqLvC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA8HrD;;OAEG;IACH,OAAO,CAAC,eAAe;IAiBvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAiCrB;;OAEG;YACW,MAAM;IAcpB;;OAEG;YACW,OAAO;IAKrB;;OAEG;YACW,UAAU;IA4CxB;;OAEG;YACW,SAAS;IAiCvB;;OAEG;YACW,YAAY;IA8C1B;;OAEG;YACW,YAAY;IA6D1B;;OAEG;YACW,YAAY;IAyC1B;;OAEG;YACW,kBAAkB;IA8HhC;;;OAGG;YACW,qBAAqB;IAyOnC;;;OAGG;YACW,aAAa;IA+D3B;;OAEG;YACW,eAAe;IAiC7B;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAuBpB;;OAEG;IACH,OAAO,CAAC,YAAY;CAqBrB;AAGD,wBAAsB,IAAI,kBAuGzB"}
@@ -0,0 +1,5 @@
1
+ import type { CLICommand } from '../cli-generator.js';
2
+ export declare const dbPreflightCommerceMoneyCommand: CLICommand;
3
+ export declare const dbMigrateCommerceMoneyCommand: CLICommand;
4
+ export declare const dbRollbackCommerceMoneyCommand: CLICommand;
5
+ //# sourceMappingURL=db-commerce-money.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-commerce-money.d.ts","sourceRoot":"","sources":["../../src/commands/db-commerce-money.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA4JtD,eAAO,MAAM,+BAA+B,EAAE,UAgD7C,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,UAoD3C,CAAC;A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EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAgjGtD,CAAC"}
@@ -13,7 +13,7 @@ import { ObjectRegistry, SchemaComparer, checkLiveSchemaParity, collectForeignKe
13
13
  import { loadExternalManifestSync } from "@happyvertical/smrt-core/manifest";
14
14
  import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
15
15
  import { homedir, tmpdir } from "node:os";
16
- import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
16
+ import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
17
17
  import { extract } from "tar";
18
18
  import { access, cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
19
19
  import { createLogger } from "@happyvertical/logger";
@@ -7522,7 +7522,7 @@ var kitchenCommands = {
7522
7522
  }
7523
7523
  },
7524
7524
  handler: async (_args, options) => {
7525
- const { runKitchenMcp } = await import("./server-C69K3w-t.js");
7525
+ const { runKitchenMcp } = await import("./server-D2wRPnk0.js");
7526
7526
  await runKitchenMcp({
7527
7527
  uiSmoke: options["ui-smoke"],
7528
7528
  plannerUi: options["planner-ui"],
@@ -8061,6 +8061,226 @@ function scanProjectForUnlayeredResets(root, options = {}) {
8061
8061
  };
8062
8062
  }
8063
8063
  //#endregion
8064
+ //#region src/loaders/consumer-package.ts
8065
+ function importTarget(value) {
8066
+ if (typeof value === "string") return value;
8067
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
8068
+ const conditions = value;
8069
+ return importTarget(conditions.import) ?? importTarget(conditions.node) ?? importTarget(conditions.default);
8070
+ }
8071
+ /** Resolve a package entry from the invoking consumer project, not the CLI's install. */
8072
+ async function resolveConsumerPackageEntry(packageName, projectRoot = process.cwd()) {
8073
+ const searchRoots = [];
8074
+ let directory = resolve(projectRoot);
8075
+ for (;;) {
8076
+ searchRoots.push(join(directory, "node_modules"));
8077
+ const parent = dirname(directory);
8078
+ if (parent === directory) break;
8079
+ directory = parent;
8080
+ }
8081
+ for (const root of searchRoots) {
8082
+ const packageRoot = join(root, ...packageName.split("/"));
8083
+ try {
8084
+ const manifest = JSON.parse(await readFile(join(packageRoot, "package.json"), "utf8"));
8085
+ const exportsMap = manifest.exports && typeof manifest.exports === "object" ? manifest.exports : null;
8086
+ const entry = importTarget(exportsMap && "." in exportsMap ? exportsMap["."] : manifest.exports) ?? manifest.module ?? manifest.main ?? null;
8087
+ if (!entry) throw new Error(`Package ${packageName} has no importable root entry`);
8088
+ const resolved = resolve(packageRoot, entry);
8089
+ const withinPackage = relative(packageRoot, resolved);
8090
+ if (isAbsolute(withinPackage) || withinPackage === ".." || withinPackage.startsWith(`..${sep}`)) throw new Error(`Package ${packageName} root export escapes its package`);
8091
+ return resolved;
8092
+ } catch (error) {
8093
+ if (error.code === "ENOENT") continue;
8094
+ throw error;
8095
+ }
8096
+ }
8097
+ throw new Error(`Package '${packageName}' is not installed in ${projectRoot}. Install it in the project that invokes this command.`);
8098
+ }
8099
+ /** Import an optional command provider through the consumer's package graph. */
8100
+ async function importConsumerPackage(packageName, projectRoot = process.cwd()) {
8101
+ return import(
8102
+ /* @vite-ignore */
8103
+ pathToFileURL(await resolveConsumerPackageEntry(packageName, projectRoot)).href
8104
+ );
8105
+ }
8106
+ //#endregion
8107
+ //#region src/commands/db-commerce-money.ts
8108
+ var COMMERCE_PACKAGE = "@happyvertical/smrt-commerce";
8109
+ function loadCommerceMoneyModule() {
8110
+ return importConsumerPackage(COMMERCE_PACKAGE);
8111
+ }
8112
+ function requiredOption(value, name) {
8113
+ const normalized = value?.trim();
8114
+ if (!normalized) throw new Error(`--${name} is required`);
8115
+ return normalized;
8116
+ }
8117
+ function reportOutput(options) {
8118
+ const jsonPath = options["json-path"]?.trim();
8119
+ const csvPath = options["csv-path"]?.trim();
8120
+ if (Boolean(jsonPath) !== Boolean(csvPath)) throw new Error("--json-path and --csv-path must be supplied together");
8121
+ return jsonPath && csvPath ? {
8122
+ jsonPath,
8123
+ csvPath
8124
+ } : void 0;
8125
+ }
8126
+ function renderReport(report) {
8127
+ for (const tenant of report.tenants) {
8128
+ const reasons = Object.entries(tenant.reasonCounts).filter(([, count]) => Number(count) > 0).map(([reason, count]) => `${reason}=${count}`).join(", ");
8129
+ console.log(` ${tenant.tenantId}: ${tenant.documentCount} document(s), ${tenant.changingDraftCount} changing draft(s), ${tenant.issuedUnpostedFallbackTaxCount} issued/unposted fallback-tax document(s)${reasons ? `; ${reasons}` : ""}`);
8130
+ }
8131
+ for (const document of report.documents) {
8132
+ if (document.reasons.length === 0) continue;
8133
+ console.log(` ${document.tenantId}/${document.documentType}/${document.documentId}: ${document.reasons.join(", ")}`);
8134
+ }
8135
+ }
8136
+ function errorMessage(error) {
8137
+ const message = error instanceof Error ? error.message : String(error);
8138
+ const code = error && typeof error === "object" && "code" in error ? error.code : void 0;
8139
+ return `${typeof code === "string" && code ? `[${code}] ` : ""}${message}`;
8140
+ }
8141
+ async function configuredDatabase(command) {
8142
+ const { getPackageConfig } = await import("@happyvertical/smrt-config");
8143
+ const { DEFAULT_CLI_CONFIG } = await import("./config-CdJRSMRi.js").then((n) => n.n);
8144
+ const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
8145
+ if (!config.database?.url || config.database.url === ":memory:") throw new Error(`Database configuration required for ${command}. Configure database.url in smrt.config.ts (or DATABASE_URL).`);
8146
+ await autoDiscoverAndLoad();
8147
+ const { getDatabase } = await import("@happyvertical/sql");
8148
+ const dbType = config.database.type || "sqlite";
8149
+ return {
8150
+ db: await getDatabase({
8151
+ type: dbType,
8152
+ url: config.database.url
8153
+ }),
8154
+ dbType,
8155
+ dbUrl: config.database.url
8156
+ };
8157
+ }
8158
+ function commonOptions() {
8159
+ return { "tenant-id": {
8160
+ type: "string",
8161
+ description: "Authoritative tenant identifier."
8162
+ } };
8163
+ }
8164
+ var dbPreflightCommerceMoneyCommand = {
8165
+ name: "db:preflight-commerce-money",
8166
+ description: "Read and report legacy Commerce line amounts before activating the v2 money model. Never writes database state.",
8167
+ aliases: ["commerce-money:preflight"],
8168
+ args: [],
8169
+ options: {
8170
+ ...commonOptions(),
8171
+ "json-path": {
8172
+ type: "string",
8173
+ description: "Write the deterministic JSON report to this path."
8174
+ },
8175
+ "csv-path": {
8176
+ type: "string",
8177
+ description: "Write the deterministic CSV report to this path."
8178
+ }
8179
+ },
8180
+ handler: async (_args, options) => {
8181
+ let db;
8182
+ try {
8183
+ const out = reportOutput(options);
8184
+ const configured = await configuredDatabase("db:preflight-commerce-money");
8185
+ db = configured.db;
8186
+ const { preflightCommerceLineAmounts } = await loadCommerceMoneyModule();
8187
+ console.log("\n💰 Commerce money preflight\n");
8188
+ console.log(`✓ Connected to ${formatDatabaseDisplayUrl(configured.dbType, configured.dbUrl)}\n`);
8189
+ const tenantId = options["tenant-id"]?.trim() || void 0;
8190
+ const report = await preflightCommerceLineAmounts(db, {
8191
+ out,
8192
+ tenantId
8193
+ });
8194
+ renderReport(report);
8195
+ if (out) console.log(`\n✓ Wrote ${out.jsonPath} and ${out.csvPath}.`);
8196
+ console.log(`\nPreflight complete: ${report.documents.length} document(s) across ${report.tenants.length} tenant(s). No database changes made.\n`);
8197
+ } catch (error) {
8198
+ console.error(`\n❌ Commerce money preflight failed: ${redactDatabaseUrlsInText(errorMessage(error))}\n`);
8199
+ process.exitCode = 1;
8200
+ } finally {
8201
+ await closeDatabaseConnection(db);
8202
+ }
8203
+ }
8204
+ };
8205
+ var dbMigrateCommerceMoneyCommand = {
8206
+ name: "db:migrate-commerce-money",
8207
+ description: "Migrate one tenant to the Commerce v2 money model after reviewing preflight output.",
8208
+ aliases: ["commerce-money:migrate"],
8209
+ args: [],
8210
+ options: {
8211
+ ...commonOptions(),
8212
+ "accept-draft-changes": {
8213
+ type: "boolean",
8214
+ description: "Accept draft total changes identified by the preflight.",
8215
+ default: false
8216
+ },
8217
+ "migration-id": {
8218
+ type: "string",
8219
+ description: "Resume the active tenant migration with its owner identity."
8220
+ }
8221
+ },
8222
+ handler: async (_args, options) => {
8223
+ let db;
8224
+ try {
8225
+ const tenantId = requiredOption(options["tenant-id"], "tenant-id");
8226
+ const configured = await configuredDatabase("db:migrate-commerce-money");
8227
+ db = configured.db;
8228
+ const { migrateCommerceLineAmounts } = await loadCommerceMoneyModule();
8229
+ console.log("\n💰 Commerce money migration\n");
8230
+ console.log(`✓ Connected to ${formatDatabaseDisplayUrl(configured.dbType, configured.dbUrl)}\n`);
8231
+ const migrationId = options["migration-id"]?.trim() || randomUUID();
8232
+ console.log(`Migration owner: ${migrationId} (reuse with --migration-id after an interrupted attempt).\n`);
8233
+ const result = await migrateCommerceLineAmounts(db, {
8234
+ tenantId,
8235
+ acceptDraftChanges: options["accept-draft-changes"] === true,
8236
+ migrationId
8237
+ });
8238
+ renderReport(result.report);
8239
+ console.log(`\n✓ Tenant ${result.tenantId} activated v2 money model (migration ${result.migrationId}); migrated ${result.migrated}, resumed ${result.resumed}.\n`);
8240
+ } catch (error) {
8241
+ console.error(`\n❌ Commerce money migration failed: ${redactDatabaseUrlsInText(errorMessage(error))}\n`);
8242
+ process.exitCode = 1;
8243
+ } finally {
8244
+ await closeDatabaseConnection(db);
8245
+ }
8246
+ }
8247
+ };
8248
+ var dbRollbackCommerceMoneyCommand = {
8249
+ name: "db:rollback-commerce-money",
8250
+ description: "Restore one Commerce tenant from its durable v2 money migration journal.",
8251
+ aliases: ["commerce-money:rollback"],
8252
+ args: [],
8253
+ options: {
8254
+ ...commonOptions(),
8255
+ "migration-id": {
8256
+ type: "string",
8257
+ description: "Migration owner identity recorded during activation."
8258
+ }
8259
+ },
8260
+ handler: async (_args, options) => {
8261
+ let db;
8262
+ try {
8263
+ const tenantId = requiredOption(options["tenant-id"], "tenant-id");
8264
+ const migrationId = requiredOption(options["migration-id"], "migration-id");
8265
+ const configured = await configuredDatabase("db:rollback-commerce-money");
8266
+ db = configured.db;
8267
+ const { rollbackCommerceLineAmounts } = await loadCommerceMoneyModule();
8268
+ console.log("\n💰 Commerce money rollback\n");
8269
+ console.log(`✓ Connected to ${formatDatabaseDisplayUrl(configured.dbType, configured.dbUrl)}\n`);
8270
+ const result = await rollbackCommerceLineAmounts(db, {
8271
+ tenantId,
8272
+ migrationId
8273
+ });
8274
+ console.log(`\n✓ Tenant ${result.tenantId} migration ${result.migrationId} rolled back; restored ${result.restored}, already restored ${result.alreadyRestored}.\n`);
8275
+ } catch (error) {
8276
+ console.error(`\n❌ Commerce money rollback failed: ${redactDatabaseUrlsInText(errorMessage(error))}\n`);
8277
+ process.exitCode = 1;
8278
+ } finally {
8279
+ await closeDatabaseConnection(db);
8280
+ }
8281
+ }
8282
+ };
8283
+ //#endregion
8064
8284
  //#region src/commands/db-drop-framework-base-tables.ts
8065
8285
  /**
8066
8286
  * db:drop-framework-base-tables Command
@@ -8212,7 +8432,7 @@ var dbMaterializeTenantHierarchyCommand = {
8212
8432
  if (!config.database?.url || config.database.url === ":memory:") throw new Error("Database configuration required for db:materialize-tenant-hierarchy. Configure database.url in smrt.config.ts (or DATABASE_URL).");
8213
8433
  const dbType = config.database.type || "sqlite";
8214
8434
  const { getDatabase } = await import("@happyvertical/sql");
8215
- const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-BhK8eCtX.js");
8435
+ const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-D8ESE6vP.js");
8216
8436
  db = await getDatabase({
8217
8437
  type: dbType,
8218
8438
  url: config.database.url
@@ -8421,7 +8641,7 @@ var dbMigrateLedgerAccountsCommand = {
8421
8641
  if (dbType !== "postgres") throw new Error("db:migrate-ledger-accounts currently supports PostgreSQL only; no changes were made. See the smrt-ledgers README for SQLite.");
8422
8642
  await autoDiscoverAndLoad();
8423
8643
  const { getDatabase } = await import("@happyvertical/sql");
8424
- const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-ymeU2H9O.js");
8644
+ const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-UCD6F1L5.js");
8425
8645
  db = await getDatabase({
8426
8646
  type: dbType,
8427
8647
  url: config.database.url
@@ -12395,6 +12615,9 @@ export default testManifest;
12395
12615
  "db:migrate-null-equal-indexes": dbMigrateNullEqualIndexesCommand,
12396
12616
  "db:migrate-agent-schedule-slugs": dbMigrateAgentScheduleSlugsCommand,
12397
12617
  "db:migrate-ledger-accounts": dbMigrateLedgerAccountsCommand,
12618
+ "db:preflight-commerce-money": dbPreflightCommerceMoneyCommand,
12619
+ "db:migrate-commerce-money": dbMigrateCommerceMoneyCommand,
12620
+ "db:rollback-commerce-money": dbRollbackCommerceMoneyCommand,
12398
12621
  "db:migrate-qualified-names": dbMigrateQualifiedNamesCommand,
12399
12622
  "db:materialize-tenant-hierarchy": dbMaterializeTenantHierarchyCommand,
12400
12623
  "db:drop-framework-base-tables": dbDropFrameworkBaseTablesCommand,