@happyvertical/smrt-cli 0.55.12 → 0.55.13
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.
- package/dist/{AuditLogCollection-WDHL-_AF-BszXtso4.js → AuditLogCollection-WDHL-_AF-_RXJ4g2q.js} +1 -1
- package/dist/{OidcIdentity-BUblgQLs-BKQM3V05.js → OidcIdentity-BUblgQLs-Us7ZUvnh.js} +2 -2
- package/dist/{OidcIdentityCollection-ClOyaHeF-Cl55iTxm.js → OidcIdentityCollection-ClOyaHeF-BmHrvh1o.js} +1 -1
- package/dist/{ProfileAssetCollection-CRMcjLJ--CEeWgEaI.js → ProfileAssetCollection-CRMcjLJ--M64P0MlJ.js} +3 -3
- package/dist/{ProfileCollection-C4INKh7Y-BwsTQNNn.js → ProfileCollection-C4INKh7Y-Xn37Xj2d.js} +17 -17
- package/dist/{ProfileLinkCollection-DFfZRsgv-Cc-IoY9N.js → ProfileLinkCollection-DFfZRsgv-DTXdjPMD.js} +2 -2
- package/dist/{ProfileMetadataCollection-BIYKy4Y3-Defebkba.js → ProfileMetadataCollection-BIYKy4Y3-C4NyBsA_.js} +1 -1
- package/dist/{ProfileMetafieldCollection-Buz7gzag-Dp1xGqhO.js → ProfileMetafieldCollection-Buz7gzag-BlJqn0f-.js} +1 -1
- package/dist/{ProfileRelationshipCollection-C4g_QLI4-BJkzyR5B.js → ProfileRelationshipCollection-C4g_QLI4-BoadAuj8.js} +1 -1
- package/dist/{ProfileTypeCollection-B7kwi1mU-DMXAvisH.js → ProfileTypeCollection-B7kwi1mU-BaT2OYDR.js} +2 -2
- package/dist/{commands-D72vE9ew.js → commands-CZtXU3Is.js} +2 -2
- package/dist/{dist-ZcbytynG.js → dist-6XMOPmAQ.js} +4 -4
- package/dist/{dist-ByGzc20I.js → dist-BCW7OSeu.js} +112 -93
- package/dist/dist-BLSv-O7X.js +21 -0
- package/dist/{dist-BBhTd0bD.js → dist-D56nENIY.js} +3 -3
- package/dist/{dist-BP9F7quh.js → dist-lltZIBRI.js} +28 -9
- package/dist/index.js +11 -11
- package/dist/{oidcProvisioningPrimitives-DNP9EZlU-CUqct6Rk.js → oidcProvisioningPrimitives-DNP9EZlU-B6S-rGtq.js} +3 -3
- package/dist/{resolveIdentity-CkyqvctR-Zz28PljF.js → resolveIdentity-CkyqvctR-BoHG4Xos.js} +14 -14
- package/package.json +15 -15
- package/dist/dist-C75AUvCx.js +0 -21
package/dist/{AuditLogCollection-WDHL-_AF-BszXtso4.js → AuditLogCollection-WDHL-_AF-_RXJ4g2q.js}
RENAMED
|
@@ -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-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-D56nENIY.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-
|
|
45
|
+
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-BmHrvh1o.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-
|
|
68
|
+
const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-CkyqvctR-BoHG4Xos.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-
|
|
3
|
+
import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-Us7ZUvnh.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-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-D56nENIY.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-
|
|
4
|
+
import { a as getOwnedAssetsFromCollection, o as removeOwnedAssetFromCollection, t as addOwnedAssetFromCollection } from "./dist-lltZIBRI.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-
|
|
87
|
+
const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-Xn37Xj2d.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;
|
package/dist/{ProfileCollection-C4INKh7Y-BwsTQNNn.js → ProfileCollection-C4INKh7Y-Xn37Xj2d.js}
RENAMED
|
@@ -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-
|
|
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-D56nENIY.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-
|
|
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-lltZIBRI.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-
|
|
438
|
+
const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-BaT2OYDR.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-
|
|
462
|
-
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-
|
|
461
|
+
const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-BlJqn0f-.js").then((n) => n.r).then((n) => n.n);
|
|
462
|
+
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-C4NyBsA_.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-
|
|
495
|
+
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-C4NyBsA_.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-
|
|
513
|
-
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-
|
|
512
|
+
const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-BlJqn0f-.js").then((n) => n.r).then((n) => n.n);
|
|
513
|
+
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-C4NyBsA_.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-
|
|
538
|
+
const { ProfileLinkCollection } = await import("./ProfileLinkCollection-DFfZRsgv-DTXdjPMD.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--
|
|
555
|
+
const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CRMcjLJ--M64P0MlJ.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-
|
|
587
|
+
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-BoadAuj8.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-
|
|
612
|
+
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-BoadAuj8.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-
|
|
657
|
+
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-BoadAuj8.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-
|
|
781
|
+
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-BmHrvh1o.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-
|
|
794
|
+
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-BmHrvh1o.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-
|
|
823
|
+
const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-_RXJ4g2q.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-
|
|
833
|
+
const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-_RXJ4g2q.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-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-D56nENIY.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-
|
|
206
|
+
const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-Xn37Xj2d.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-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-D56nENIY.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-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-D56nENIY.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-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-D56nENIY.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-
|
|
2
|
+
import { l as isSystemContext, s as withTenantGlobalRead } from "./dist-D56nENIY.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
|
-
import { s as ProfileType } from "./ProfileCollection-C4INKh7Y-
|
|
4
|
+
import { s as ProfileType } from "./ProfileCollection-C4INKh7Y-Xn37Xj2d.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({
|
|
@@ -7888,7 +7888,7 @@ var dbMaterializeTenantHierarchyCommand = {
|
|
|
7888
7888
|
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).");
|
|
7889
7889
|
const dbType = config.database.type || "sqlite";
|
|
7890
7890
|
const { getDatabase } = await import("@happyvertical/sql");
|
|
7891
|
-
const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-
|
|
7891
|
+
const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-BCW7OSeu.js");
|
|
7892
7892
|
db = await getDatabase({
|
|
7893
7893
|
type: dbType,
|
|
7894
7894
|
url: config.database.url
|
|
@@ -8097,7 +8097,7 @@ var dbMigrateLedgerAccountsCommand = {
|
|
|
8097
8097
|
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.");
|
|
8098
8098
|
await autoDiscoverAndLoad();
|
|
8099
8099
|
const { getDatabase } = await import("@happyvertical/sql");
|
|
8100
|
-
const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-
|
|
8100
|
+
const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-6XMOPmAQ.js");
|
|
8101
8101
|
db = await getDatabase({
|
|
8102
8102
|
type: dbType,
|
|
8103
8103
|
url: config.database.url
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as queryGlobal, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt } from "./dist-
|
|
1
|
+
import { a as queryGlobal, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt } from "./dist-D56nENIY.js";
|
|
2
2
|
import { ObjectRegistry, SmrtCollection, SmrtHierarchical, SmrtObject, detectEngine, field, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
3
3
|
import { BackfillTracker } from "@happyvertical/smrt-core/migrations";
|
|
4
4
|
//#region ../ledgers/dist/chunks/Account-b0RgfbjM.js
|
|
@@ -80,7 +80,7 @@ var Account = class extends SmrtHierarchical {
|
|
|
80
80
|
*/
|
|
81
81
|
async getBalance(asOfDate) {
|
|
82
82
|
if (!this.id) return 0;
|
|
83
|
-
const { JournalEntryCollection } = await import("./dist-
|
|
83
|
+
const { JournalEntryCollection } = await import("./dist-6XMOPmAQ.js").then((n) => n.t);
|
|
84
84
|
return await (await JournalEntryCollection.create(this.options)).getAccountBalance(this.id, asOfDate);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -88,7 +88,7 @@ var Account = class extends SmrtHierarchical {
|
|
|
88
88
|
*/
|
|
89
89
|
async createChild(options) {
|
|
90
90
|
if (!this.id) throw new Error("Account must be saved before creating children");
|
|
91
|
-
const { AccountCollection } = await import("./dist-
|
|
91
|
+
const { AccountCollection } = await import("./dist-6XMOPmAQ.js").then((n) => n.n);
|
|
92
92
|
const account = await (await AccountCollection.create(this.options)).create({
|
|
93
93
|
...options,
|
|
94
94
|
parentId: this.id,
|
|
@@ -136,7 +136,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
136
136
|
if (!no_symbols) __defProp$2(target, Symbol.toStringTag, { value: "Module" });
|
|
137
137
|
return target;
|
|
138
138
|
};
|
|
139
|
-
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-ledgers","packageVersion":"0.55.12","objects":{"@happyvertical/smrt-ledgers:AccountCollection":{"name":"accountcollection","className":"AccountCollection","qualifiedName":"@happyvertical/smrt-ledgers:AccountCollection","collection":"accounts","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Accounts.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false}],"returnType":"Promise<Account | null>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"type","type":"AccountType","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findTopLevel":{"name":"findTopLevel","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findChildren":{"name":"findChildren","async":true,"parameters":[{"name":"parentId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"getTree":{"name":"getTree","async":true,"parameters":[],"returnType":"Promise<AccountTree>","isStatic":false,"isPublic":true},"getOrCreateByNumber":{"name":"getOrCreateByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["string","AccountType","string | null"]}],"returnType":"Promise<Account>","isStatic":false,"isPublic":true},"groupByType":{"name":"groupByType","async":true,"parameters":[],"returnType":"Promise<Record<AccountType, Account[]>>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"ledger_accounts"},"extends":"SmrtCollection","extendsTypeArg":"Account","exportName":"AccountCollection","collectionExportName":"AccountCollectionCollection","schema":{"tableName":"ledger_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"ledger_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"parent_id\\" UUID,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"description\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'asset',\\n \\"active\\" BOOLEAN DEFAULT TRUE,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"asset"},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"ledger_accounts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"ledger_accounts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"ledger_accounts_parent_id_idx","columns":["parent_id"]}],"version":"49630dae"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalEntryCollection":{"name":"journalentrycollection","className":"JournalEntryCollection","qualifiedName":"@happyvertical/smrt-ledgers:JournalEntryCollection","collection":"journalentries","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/JournalEntries.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByJournal":{"name":"findByJournal","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findByAccount":{"name":"findByAccount","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"getAccountBalance":{"name":"getAccountBalance","async":true,"parameters":[{"name":"accountId","type":"string","optional":false},{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTrialBalance":{"name":"getTrialBalance","async":true,"parameters":[{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<TrialBalanceRow[]>","isStatic":false,"isPublic":true},"getTotalsForDateRange":{"name":"getTotalsForDateRange","async":true,"parameters":[{"name":"start","type":"Date","optional":false},{"name":"end","type":"Date","optional":false}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"findByAccounts":{"name":"findByAccounts","async":true,"parameters":[{"name":"accountIds","type":"string[]","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"getAccountLedger":{"name":"getAccountLedger","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<Array<object>>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"JournalEntry","exportName":"JournalEntryCollection","collectionExportName":"JournalEntryCollectionCollection","schema":{"tableName":"journal_entries","ddl":"CREATE TABLE IF NOT EXISTS \\"journal_entries\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"journal_id\\" UUID,\\n \\"account_id\\" UUID,\\n \\"debit\\" REAL DEFAULT 0,\\n \\"credit\\" REAL DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"exchange_rate\\" REAL DEFAULT 1,\\n \\"memo\\" TEXT DEFAULT '',\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"journal_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"journals","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"debit":{"type":"REAL","notNull":false,"unique":false,"default":0},"credit":{"type":"REAL","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"exchange_rate":{"type":"REAL","notNull":false,"unique":false,"default":1},"memo":{"type":"TEXT","notNull":false,"unique":false,"default":""},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journal_entries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journal_entries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"journal_entries_journal_id_idx","columns":["journal_id"]},{"name":"journal_entries_account_id_idx","columns":["account_id"]}],"version":"93cdc848"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalCollection":{"name":"journalcollection","className":"JournalCollection","qualifiedName":"@happyvertical/smrt-ledgers:JournalCollection","collection":"journals","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Journals.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false}],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"start","type":"Date","optional":false},{"name":"end","type":"Date","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceModule","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"JournalStatus","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findPosted":{"name":"findPosted","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"createWithEntries":{"name":"createWithEntries","async":true,"parameters":[{"name":"data","type":"CreateJournalData","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"post":{"name":"post","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"void":{"name":"void","async":true,"parameters":[{"name":"journalId","type":"string","optional":false},{"name":"reason","type":"string","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"findBySourceRef":{"name":"findBySourceRef","async":true,"parameters":[{"name":"sourceRef","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByMonth":{"name":"findByMonth","async":true,"parameters":[{"name":"year","type":"number","optional":false},{"name":"month","type":"number","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Journal","exportName":"JournalCollection","collectionExportName":"JournalCollectionCollection","schema":{"tableName":"journals","ddl":"CREATE TABLE IF NOT EXISTS \\"journals\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"date\\" TIMESTAMP,\\n \\"description\\" TEXT DEFAULT '',\\n \\"source_module\\" TEXT DEFAULT '',\\n \\"source_ref\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'draft',\\n \\"posted_at\\" TIMESTAMP,\\n \\"voided_at\\" TIMESTAMP,\\n \\"void_reason\\" TEXT,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"date":{"type":"TIMESTAMP","notNull":false,"unique":false},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_module":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_ref":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"draft"},"posted_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"voided_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"void_reason":{"type":"TEXT","notNull":false,"unique":false},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journals_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journals_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"4b51d204"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:Account":{"name":"account","className":"Account","qualifiedName":"@happyvertical/smrt-ledgers:Account","collection":"accounts","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Account.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"parentId":{"type":"foreignKey","required":false,"related":"Account","_meta":{"nullable":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"number":{"type":"text","required":false,"default":"","description":"The account number in your chart of accounts.","_meta":{"description":"The account number in your chart of accounts."}},"name":{"type":"text","required":false,"default":"","description":"What the account is called.","_meta":{"description":"What the account is called."}},"description":{"type":"text","required":false,"default":"","description":"What the account is used for.","_meta":{"description":"What the account is used for."}},"type":{"type":"text","required":false,"default":"asset","description":"asset, liability, equity, revenue or expense.","_meta":{"description":"asset, liability, equity, revenue or expense."},"enum":["asset","liability","equity","revenue","expense"]},"active":{"type":"boolean","required":false,"default":true,"description":"Whether the account is in use; deactivate it instead of deleting it.","_meta":{"description":"Whether the account is in use; deactivate it instead of deleting it."}},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"getParent":{"name":"getParent","async":true,"parameters":[],"returnType":"Promise<this | null>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getAncestors":{"name":"getAncestors","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[],"returnType":"Promise<HierarchyView<this>>","isStatic":false,"isPublic":true},"moveTo":{"name":"moveTo","async":true,"parameters":[{"name":"newParent","type":"this | string | null","optional":false,"unionBranches":[{"type":"this"},{"type":"string"},{"type":"null"}]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"isTopLevel":{"name":"isTopLevel","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isDebitNormal":{"name":"isDebitNormal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCreditNormal":{"name":"isCreditNormal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getFullPath":{"name":"getFullPath","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true},"toTreeNode":{"name":"toTreeNode","async":true,"parameters":[],"returnType":"Promise<AccountTreeNode>","isStatic":false,"isPublic":true},"getBalance":{"name":"getBalance","async":true,"parameters":[{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"createChild":{"name":"createChild","async":true,"parameters":[{"name":"options","type":"Omit<AccountOptions, 'parentId' | 'type'>","optional":false}],"returnType":"Promise<Account>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"ledger_accounts","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtHierarchical","exportName":"Account","collectionExportName":"AccountCollection","displayLabelField":"name","schema":{"tableName":"ledger_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"ledger_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"parent_id\\" UUID,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"description\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'asset',\\n \\"active\\" BOOLEAN DEFAULT TRUE,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"asset"},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"ledger_accounts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"ledger_accounts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"ledger_accounts_parent_id_idx","columns":["parent_id"]}],"version":"49630dae"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:Journal":{"name":"journal","className":"Journal","qualifiedName":"@happyvertical/smrt-ledgers:Journal","collection":"journals","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Journal.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"number":{"type":"text","required":false,"default":"","description":"The journal's reference number.","_meta":{"description":"The journal's reference number."}},"date":{"type":"datetime","required":false,"description":"The date of the transaction.","_meta":{"description":"The date of the transaction."}},"description":{"type":"text","required":false,"default":"","description":"What the transaction was.","_meta":{"description":"What the transaction was."}},"sourceModule":{"type":"text","required":false,"default":""},"sourceRef":{"type":"text","required":false},"status":{"type":"text","required":false,"default":"draft","description":"draft until final, then posted, or voided.","_meta":{"description":"draft until final, then posted, or voided."},"enum":["draft","posted","voided"]},"postedAt":{"type":"datetime","required":false,"description":"When it was posted.","_meta":{"description":"When it was posted."}},"voidedAt":{"type":"datetime","required":false},"voidReason":{"type":"text","required":false},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPosted":{"name":"isPosted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isVoided":{"name":"isVoided","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isEditable":{"name":"isEditable","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getEntries":{"name":"getEntries","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getTotalDebits":{"name":"getTotalDebits","async":true,"parameters":[],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTotalCredits":{"name":"getTotalCredits","async":true,"parameters":[],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"isBalanced":{"name":"isBalanced","async":true,"parameters":[],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true},"addEntry":{"name":"addEntry","async":true,"parameters":[{"name":"data","type":"JournalEntryData","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"post":{"name":"post","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"void":{"name":"void","async":true,"parameters":[{"name":"reason","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"summarize":{"name":"summarize","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Journal","collectionExportName":"JournalCollection","schema":{"tableName":"journals","ddl":"CREATE TABLE IF NOT EXISTS \\"journals\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"date\\" TIMESTAMP,\\n \\"description\\" TEXT DEFAULT '',\\n \\"source_module\\" TEXT DEFAULT '',\\n \\"source_ref\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'draft',\\n \\"posted_at\\" TIMESTAMP,\\n \\"voided_at\\" TIMESTAMP,\\n \\"void_reason\\" TEXT,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"date":{"type":"TIMESTAMP","notNull":false,"unique":false},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_module":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_ref":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"draft"},"posted_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"voided_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"void_reason":{"type":"TEXT","notNull":false,"unique":false},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journals_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journals_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"4b51d204"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalEntry":{"name":"journalentry","className":"JournalEntry","qualifiedName":"@happyvertical/smrt-ledgers:JournalEntry","collection":"journalentries","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/JournalEntry.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"journalId":{"type":"foreignKey","required":false,"related":"Journal","description":"The journal this entry belongs to.","_meta":{"description":"The journal this entry belongs to."}},"accountId":{"type":"foreignKey","required":false,"related":"Account","description":"The account this entry changes.","_meta":{"description":"The account this entry changes."}},"debit":{"type":"decimal","required":false,"default":0,"description":"The amount debited. Zero on a credit entry.","_meta":{"description":"The amount debited. Zero on a credit entry."}},"credit":{"type":"decimal","required":false,"default":0,"description":"The amount credited. Zero on a debit entry.","_meta":{"description":"The amount credited. Zero on a debit entry."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"exchangeRate":{"type":"decimal","required":false,"default":1},"memo":{"type":"text","required":false,"default":"","description":"A note on this entry.","_meta":{"description":"A note on this entry."}},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"isDebit":{"name":"isDebit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCredit":{"name":"isCredit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getAmount":{"name":"getAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getBaseAmount":{"name":"getBaseAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getJournal":{"name":"getJournal","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getAccount":{"name":"getAccount","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getDescription":{"name":"getDescription","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"JournalEntry","collectionExportName":"JournalEntryCollection","schema":{"tableName":"journal_entries","ddl":"CREATE TABLE IF NOT EXISTS \\"journal_entries\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"journal_id\\" UUID,\\n \\"account_id\\" UUID,\\n \\"debit\\" REAL DEFAULT 0,\\n \\"credit\\" REAL DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"exchange_rate\\" REAL DEFAULT 1,\\n \\"memo\\" TEXT DEFAULT '',\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"journal_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"journals","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"debit":{"type":"REAL","notNull":false,"unique":false,"default":0},"credit":{"type":"REAL","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"exchange_rate":{"type":"REAL","notNull":false,"unique":false,"default":1},"memo":{"type":"TEXT","notNull":false,"unique":false,"default":""},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journal_entries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journal_entries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"journal_entries_journal_id_idx","columns":["journal_id"]},{"name":"journal_entries_account_id_idx","columns":["account_id"]}],"version":"93cdc848"},"importPath":"@happyvertical/smrt-ledgers"}},"moduleType":"smrt","recipes":[{"id":"ledgers.bookkeeping","className":"BookkeepingRecipe","label":"Bookkeeping","summary":"Keep your books: a chart of accounts and double-entry journals.","synonyms":["accounting","ledger","general ledger","journals","chart of accounts"],"models":["@happyvertical/smrt-ledgers:Account","@happyvertical/smrt-ledgers:Journal","@happyvertical/smrt-ledgers:JournalEntry"],"nav":[{"label":"Accounts","model":"@happyvertical/smrt-ledgers:Account","icon":"bank","description":"The accounts your books are kept in, like sales, rent and bank."},{"label":"Journals","model":"@happyvertical/smrt-ledgers:Journal","icon":"book","description":"The entries behind your accounts, so every dollar has a trail."}],"requires":[],"section":{"id":"accounting","label":"Accounting","icon":"bank","description":"Your books: accounts, journals and balances."},"options":{"@happyvertical/smrt-ledgers:Account":{"fields":{"metadata":{"visibility":"hidden"},"parentId":{"visibility":"hidden"}}},"@happyvertical/smrt-ledgers:Journal":{"fields":{"sourceModule":{"visibility":"hidden"},"sourceRef":{"visibility":"hidden"},"voidedAt":{"visibility":"hidden"},"voidReason":{"visibility":"hidden"},"metadata":{"visibility":"hidden"}}},"@happyvertical/smrt-ledgers:JournalEntry":{"fields":{"exchangeRate":{"visibility":"hidden"},"metadata":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nBookkeeping keeps your accounts. You list the accounts you use (your chart of\\naccounts) and record each transaction as a journal whose entries debit and\\ncredit those accounts.\\n\\n## Tasks\\n\\n### Set up your accounts\\n\\n1. Create a new account.\\n2. Give it a **{field:number}** and a **{field:name}**.\\n3. Choose its **{field:type}**: asset, liability, equity, revenue or expense.\\n\\n### Record a transaction\\n\\n1. Create a new journal and add a **{field:description}**.\\n2. Add entries: pick the account on each and enter a **{field:debit}** or a\\n **{field:credit}**. They must add up to the same total.\\n3. Set the journal's **{field:status}** to posted when it is final. A posted\\n journal is voided, not edited.\\n","fieldRefs":["credit","debit","description","name","number","status","type"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: core migrations (node:os, node:crypto); and its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-prompts","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624","#3626"],"reason":"core migrations (node:os, node:crypto)","via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
139
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-ledgers","packageVersion":"0.55.13","objects":{"@happyvertical/smrt-ledgers:AccountCollection":{"name":"accountcollection","className":"AccountCollection","qualifiedName":"@happyvertical/smrt-ledgers:AccountCollection","collection":"accounts","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Accounts.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false}],"returnType":"Promise<Account | null>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"type","type":"AccountType","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findTopLevel":{"name":"findTopLevel","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findChildren":{"name":"findChildren","async":true,"parameters":[{"name":"parentId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"getTree":{"name":"getTree","async":true,"parameters":[],"returnType":"Promise<AccountTree>","isStatic":false,"isPublic":true},"getOrCreateByNumber":{"name":"getOrCreateByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["string","AccountType","string | null"]}],"returnType":"Promise<Account>","isStatic":false,"isPublic":true},"groupByType":{"name":"groupByType","async":true,"parameters":[],"returnType":"Promise<Record<AccountType, Account[]>>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"ledger_accounts"},"extends":"SmrtCollection","extendsTypeArg":"Account","exportName":"AccountCollection","collectionExportName":"AccountCollectionCollection","schema":{"tableName":"ledger_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"ledger_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"parent_id\\" UUID,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"description\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'asset',\\n \\"active\\" BOOLEAN DEFAULT TRUE,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"asset"},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"ledger_accounts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"ledger_accounts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"ledger_accounts_parent_id_idx","columns":["parent_id"]}],"version":"49630dae"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalEntryCollection":{"name":"journalentrycollection","className":"JournalEntryCollection","qualifiedName":"@happyvertical/smrt-ledgers:JournalEntryCollection","collection":"journalentries","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/JournalEntries.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByJournal":{"name":"findByJournal","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findByAccount":{"name":"findByAccount","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"getAccountBalance":{"name":"getAccountBalance","async":true,"parameters":[{"name":"accountId","type":"string","optional":false},{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTrialBalance":{"name":"getTrialBalance","async":true,"parameters":[{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<TrialBalanceRow[]>","isStatic":false,"isPublic":true},"getTotalsForDateRange":{"name":"getTotalsForDateRange","async":true,"parameters":[{"name":"start","type":"Date","optional":false},{"name":"end","type":"Date","optional":false}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"findByAccounts":{"name":"findByAccounts","async":true,"parameters":[{"name":"accountIds","type":"string[]","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"getAccountLedger":{"name":"getAccountLedger","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<Array<object>>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"JournalEntry","exportName":"JournalEntryCollection","collectionExportName":"JournalEntryCollectionCollection","schema":{"tableName":"journal_entries","ddl":"CREATE TABLE IF NOT EXISTS \\"journal_entries\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"journal_id\\" UUID,\\n \\"account_id\\" UUID,\\n \\"debit\\" REAL DEFAULT 0,\\n \\"credit\\" REAL DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"exchange_rate\\" REAL DEFAULT 1,\\n \\"memo\\" TEXT DEFAULT '',\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"journal_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"journals","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"debit":{"type":"REAL","notNull":false,"unique":false,"default":0},"credit":{"type":"REAL","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"exchange_rate":{"type":"REAL","notNull":false,"unique":false,"default":1},"memo":{"type":"TEXT","notNull":false,"unique":false,"default":""},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journal_entries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journal_entries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"journal_entries_journal_id_idx","columns":["journal_id"]},{"name":"journal_entries_account_id_idx","columns":["account_id"]}],"version":"93cdc848"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalCollection":{"name":"journalcollection","className":"JournalCollection","qualifiedName":"@happyvertical/smrt-ledgers:JournalCollection","collection":"journals","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Journals.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false}],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"start","type":"Date","optional":false},{"name":"end","type":"Date","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceModule","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"JournalStatus","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findPosted":{"name":"findPosted","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"createWithEntries":{"name":"createWithEntries","async":true,"parameters":[{"name":"data","type":"CreateJournalData","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"post":{"name":"post","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"void":{"name":"void","async":true,"parameters":[{"name":"journalId","type":"string","optional":false},{"name":"reason","type":"string","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"findBySourceRef":{"name":"findBySourceRef","async":true,"parameters":[{"name":"sourceRef","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByMonth":{"name":"findByMonth","async":true,"parameters":[{"name":"year","type":"number","optional":false},{"name":"month","type":"number","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Journal","exportName":"JournalCollection","collectionExportName":"JournalCollectionCollection","schema":{"tableName":"journals","ddl":"CREATE TABLE IF NOT EXISTS \\"journals\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"date\\" TIMESTAMP,\\n \\"description\\" TEXT DEFAULT '',\\n \\"source_module\\" TEXT DEFAULT '',\\n \\"source_ref\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'draft',\\n \\"posted_at\\" TIMESTAMP,\\n \\"voided_at\\" TIMESTAMP,\\n \\"void_reason\\" TEXT,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"date":{"type":"TIMESTAMP","notNull":false,"unique":false},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_module":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_ref":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"draft"},"posted_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"voided_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"void_reason":{"type":"TEXT","notNull":false,"unique":false},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journals_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journals_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"4b51d204"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:Account":{"name":"account","className":"Account","qualifiedName":"@happyvertical/smrt-ledgers:Account","collection":"accounts","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Account.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"parentId":{"type":"foreignKey","required":false,"related":"Account","_meta":{"nullable":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"number":{"type":"text","required":false,"default":"","description":"The account number in your chart of accounts.","_meta":{"description":"The account number in your chart of accounts."}},"name":{"type":"text","required":false,"default":"","description":"What the account is called.","_meta":{"description":"What the account is called."}},"description":{"type":"text","required":false,"default":"","description":"What the account is used for.","_meta":{"description":"What the account is used for."}},"type":{"type":"text","required":false,"default":"asset","description":"asset, liability, equity, revenue or expense.","_meta":{"description":"asset, liability, equity, revenue or expense."},"enum":["asset","liability","equity","revenue","expense"]},"active":{"type":"boolean","required":false,"default":true,"description":"Whether the account is in use; deactivate it instead of deleting it.","_meta":{"description":"Whether the account is in use; deactivate it instead of deleting it."}},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"getParent":{"name":"getParent","async":true,"parameters":[],"returnType":"Promise<this | null>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getAncestors":{"name":"getAncestors","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[],"returnType":"Promise<HierarchyView<this>>","isStatic":false,"isPublic":true},"moveTo":{"name":"moveTo","async":true,"parameters":[{"name":"newParent","type":"this | string | null","optional":false,"unionBranches":[{"type":"this"},{"type":"string"},{"type":"null"}]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"isTopLevel":{"name":"isTopLevel","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isDebitNormal":{"name":"isDebitNormal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCreditNormal":{"name":"isCreditNormal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getFullPath":{"name":"getFullPath","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true},"toTreeNode":{"name":"toTreeNode","async":true,"parameters":[],"returnType":"Promise<AccountTreeNode>","isStatic":false,"isPublic":true},"getBalance":{"name":"getBalance","async":true,"parameters":[{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"createChild":{"name":"createChild","async":true,"parameters":[{"name":"options","type":"Omit<AccountOptions, 'parentId' | 'type'>","optional":false}],"returnType":"Promise<Account>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"ledger_accounts","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtHierarchical","exportName":"Account","collectionExportName":"AccountCollection","displayLabelField":"name","schema":{"tableName":"ledger_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"ledger_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"parent_id\\" UUID,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"description\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'asset',\\n \\"active\\" BOOLEAN DEFAULT TRUE,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"asset"},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"ledger_accounts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"ledger_accounts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"ledger_accounts_parent_id_idx","columns":["parent_id"]}],"version":"49630dae"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:Journal":{"name":"journal","className":"Journal","qualifiedName":"@happyvertical/smrt-ledgers:Journal","collection":"journals","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Journal.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"number":{"type":"text","required":false,"default":"","description":"The journal's reference number.","_meta":{"description":"The journal's reference number."}},"date":{"type":"datetime","required":false,"description":"The date of the transaction.","_meta":{"description":"The date of the transaction."}},"description":{"type":"text","required":false,"default":"","description":"What the transaction was.","_meta":{"description":"What the transaction was."}},"sourceModule":{"type":"text","required":false,"default":""},"sourceRef":{"type":"text","required":false},"status":{"type":"text","required":false,"default":"draft","description":"draft until final, then posted, or voided.","_meta":{"description":"draft until final, then posted, or voided."},"enum":["draft","posted","voided"]},"postedAt":{"type":"datetime","required":false,"description":"When it was posted.","_meta":{"description":"When it was posted."}},"voidedAt":{"type":"datetime","required":false},"voidReason":{"type":"text","required":false},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPosted":{"name":"isPosted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isVoided":{"name":"isVoided","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isEditable":{"name":"isEditable","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getEntries":{"name":"getEntries","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getTotalDebits":{"name":"getTotalDebits","async":true,"parameters":[],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTotalCredits":{"name":"getTotalCredits","async":true,"parameters":[],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"isBalanced":{"name":"isBalanced","async":true,"parameters":[],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true},"addEntry":{"name":"addEntry","async":true,"parameters":[{"name":"data","type":"JournalEntryData","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"post":{"name":"post","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"void":{"name":"void","async":true,"parameters":[{"name":"reason","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"summarize":{"name":"summarize","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Journal","collectionExportName":"JournalCollection","schema":{"tableName":"journals","ddl":"CREATE TABLE IF NOT EXISTS \\"journals\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"date\\" TIMESTAMP,\\n \\"description\\" TEXT DEFAULT '',\\n \\"source_module\\" TEXT DEFAULT '',\\n \\"source_ref\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'draft',\\n \\"posted_at\\" TIMESTAMP,\\n \\"voided_at\\" TIMESTAMP,\\n \\"void_reason\\" TEXT,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"date":{"type":"TIMESTAMP","notNull":false,"unique":false},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_module":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_ref":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"draft"},"posted_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"voided_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"void_reason":{"type":"TEXT","notNull":false,"unique":false},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journals_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journals_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"4b51d204"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalEntry":{"name":"journalentry","className":"JournalEntry","qualifiedName":"@happyvertical/smrt-ledgers:JournalEntry","collection":"journalentries","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/JournalEntry.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"journalId":{"type":"foreignKey","required":false,"related":"Journal","description":"The journal this entry belongs to.","_meta":{"description":"The journal this entry belongs to."}},"accountId":{"type":"foreignKey","required":false,"related":"Account","description":"The account this entry changes.","_meta":{"description":"The account this entry changes."}},"debit":{"type":"decimal","required":false,"default":0,"description":"The amount debited. Zero on a credit entry.","_meta":{"description":"The amount debited. Zero on a credit entry."}},"credit":{"type":"decimal","required":false,"default":0,"description":"The amount credited. Zero on a debit entry.","_meta":{"description":"The amount credited. Zero on a debit entry."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"exchangeRate":{"type":"decimal","required":false,"default":1},"memo":{"type":"text","required":false,"default":"","description":"A note on this entry.","_meta":{"description":"A note on this entry."}},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"isDebit":{"name":"isDebit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCredit":{"name":"isCredit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getAmount":{"name":"getAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getBaseAmount":{"name":"getBaseAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getJournal":{"name":"getJournal","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getAccount":{"name":"getAccount","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getDescription":{"name":"getDescription","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"JournalEntry","collectionExportName":"JournalEntryCollection","schema":{"tableName":"journal_entries","ddl":"CREATE TABLE IF NOT EXISTS \\"journal_entries\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"journal_id\\" UUID,\\n \\"account_id\\" UUID,\\n \\"debit\\" REAL DEFAULT 0,\\n \\"credit\\" REAL DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"exchange_rate\\" REAL DEFAULT 1,\\n \\"memo\\" TEXT DEFAULT '',\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"journal_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"journals","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"debit":{"type":"REAL","notNull":false,"unique":false,"default":0},"credit":{"type":"REAL","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"exchange_rate":{"type":"REAL","notNull":false,"unique":false,"default":1},"memo":{"type":"TEXT","notNull":false,"unique":false,"default":""},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journal_entries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journal_entries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"journal_entries_journal_id_idx","columns":["journal_id"]},{"name":"journal_entries_account_id_idx","columns":["account_id"]}],"version":"93cdc848"},"importPath":"@happyvertical/smrt-ledgers"}},"moduleType":"smrt","recipes":[{"id":"ledgers.bookkeeping","className":"BookkeepingRecipe","label":"Bookkeeping","summary":"Keep your books: a chart of accounts and double-entry journals.","synonyms":["accounting","ledger","general ledger","journals","chart of accounts"],"models":["@happyvertical/smrt-ledgers:Account","@happyvertical/smrt-ledgers:Journal","@happyvertical/smrt-ledgers:JournalEntry"],"nav":[{"label":"Accounts","model":"@happyvertical/smrt-ledgers:Account","icon":"bank","description":"The accounts your books are kept in, like sales, rent and bank."},{"label":"Journals","model":"@happyvertical/smrt-ledgers:Journal","icon":"book","description":"The entries behind your accounts, so every dollar has a trail."}],"requires":[],"section":{"id":"accounting","label":"Accounting","icon":"bank","description":"Your books: accounts, journals and balances."},"options":{"@happyvertical/smrt-ledgers:Account":{"fields":{"metadata":{"visibility":"hidden"},"parentId":{"visibility":"hidden"}}},"@happyvertical/smrt-ledgers:Journal":{"fields":{"sourceModule":{"visibility":"hidden"},"sourceRef":{"visibility":"hidden"},"voidedAt":{"visibility":"hidden"},"voidReason":{"visibility":"hidden"},"metadata":{"visibility":"hidden"}}},"@happyvertical/smrt-ledgers:JournalEntry":{"fields":{"exchangeRate":{"visibility":"hidden"},"metadata":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nBookkeeping keeps your accounts. You list the accounts you use (your chart of\\naccounts) and record each transaction as a journal whose entries debit and\\ncredit those accounts.\\n\\n## Tasks\\n\\n### Set up your accounts\\n\\n1. Create a new account.\\n2. Give it a **{field:number}** and a **{field:name}**.\\n3. Choose its **{field:type}**: asset, liability, equity, revenue or expense.\\n\\n### Record a transaction\\n\\n1. Create a new journal and add a **{field:description}**.\\n2. Add entries: pick the account on each and enter a **{field:debit}** or a\\n **{field:credit}**. They must add up to the same total.\\n3. Set the journal's **{field:status}** to posted when it is final. A posted\\n journal is voided, not edited.\\n","fieldRefs":["credit","debit","description","name","number","status","type"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: core migrations (node:os, node:crypto); and its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-prompts","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624","#3626"],"reason":"core migrations (node:os, node:crypto)","via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
140
140
|
var smrtLedgersJournalSummarizePrompt = definePrompt({
|
|
141
141
|
key: "smrtLedgers.journal.summarize",
|
|
142
142
|
template: `Summarize this accounting journal entry:
|