@happyvertical/smrt-cli 0.51.39 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -2
- package/README.md +22 -0
- package/agents/type-drift.md +16 -0
- package/dist/{ApiKey-BZmbOTnL-DEwZtcGA.js → ApiKey-BZmbOTnL-d61__hH4.js} +2 -2
- package/dist/ApiKeyCollection-Bfb_nw81-BVJ-i1Aw.js +2 -0
- package/dist/AuditLogCollection-B1YonCAP-bpq7rM2b.js +2 -0
- package/dist/{NostrIdentity-n70E0vck-DiBJPv76.js → NostrIdentity-n70E0vck-CmFPKTaE.js} +3 -3
- package/dist/NostrIdentityCollection-Ca74dkaL-C0rNgSy-.js +2 -0
- package/dist/{OidcIdentity-K8V4u0CR-B_ek3cPN.js → OidcIdentity-Cb1bxreM-L5LCgsel.js} +3 -3
- package/dist/OidcIdentityCollection-TV8VdK69-CUmZ-j4r.js +2 -0
- package/dist/ProfileAssetCollection-B9hacUJa-C53RAi1e.js +2 -0
- package/dist/{ProfileCollection-DTT4KNpQ-D1RNYfjm.js → ProfileCollection-DuJT7Mum-zuWR2h3v.js} +69 -31
- package/dist/ProfileLinkCollection-4uNURz32-Fmbnrmyr.js +2 -0
- package/dist/ProfileMetadataCollection-DQhbfEfa-D30yWyzB.js +2 -0
- package/dist/{ProfileMetafieldCollection-CMKhVi2I-mh3UgeZA.js → ProfileMetafieldCollection-CoBuM_5G-TNxSMsBJ.js} +1 -1
- package/dist/{ProfileRelationshipCollection-DUVgaIqf-CXHrAni4.js → ProfileRelationshipCollection-DUVgaIqf-CKcxS2xW.js} +1 -1
- package/dist/{ProfileRelationshipTermCollection-DtA9OM23-Cj4bLTpU.js → ProfileRelationshipTermCollection-DtA9OM23-h-4GhOFl.js} +1 -1
- package/dist/{ProfileRelationshipType-BRiRka6t-ICv2cawn.js → ProfileRelationshipType-BRiRka6t-BFgCVe6p.js} +1 -1
- package/dist/{ProfileRelationshipTypeCollection-BdXwd7Kf-CaYLxJmh.js → ProfileRelationshipTypeCollection-BdXwd7Kf-Djb3_k5Z.js} +1 -1
- package/dist/cli-generator.d.ts.map +1 -1
- package/dist/commands/db-diff.d.ts.map +1 -1
- package/dist/commands/db-history.d.ts.map +1 -1
- package/dist/commands/db-migrate-actions.d.ts +7 -0
- package/dist/commands/db-migrate-actions.d.ts.map +1 -1
- package/dist/commands/db-parity.d.ts +7 -0
- package/dist/commands/db-parity.d.ts.map +1 -1
- package/dist/commands/db-qualified-names.d.ts +39 -0
- package/dist/commands/db-qualified-names.d.ts.map +1 -0
- package/dist/commands/db-status.d.ts.map +1 -1
- package/dist/commands/gnode.d.ts.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/mcp-apps-packaging.d.ts +24 -0
- package/dist/commands/mcp-apps-packaging.d.ts.map +1 -0
- package/dist/commands/tenant-natural-keys.d.ts +58 -0
- package/dist/commands/tenant-natural-keys.d.ts.map +1 -0
- package/dist/commands/utilities.d.ts.map +1 -1
- package/dist/{commands-C2PjCUio.js → commands-e1tsvozP.js} +650 -22
- package/dist/{dist-B3npUhW6.js → dist-8C4XjDhz.js} +151 -6
- package/dist/{dist-C8sNOzr2.js → dist-CLA60jwS.js} +4 -4
- package/dist/dist-CksLvqnZ.js +1705 -0
- package/dist/dist-DtTkpUee.js +3937 -0
- package/dist/index.js +17 -11
- package/dist/{json-validator-oEN7eUI3.js → json-validator-BiAdsE1O.js} +4 -4
- package/dist/{oidcProvisioningPrimitives-0-3n3D6f-yUBRl2DC.js → oidcProvisioningPrimitives-D9OYu5-F-CJ6bTipi.js} +7 -7
- package/dist/resolveIdentity-B-PK6RwU-DxJFF8ad.js +2 -0
- package/package.json +16 -15
- package/dist/ApiKeyCollection-Bfb_nw81-D4pLjDGS.js +0 -2
- package/dist/AuditLogCollection-B1YonCAP-w1iOHW4A.js +0 -2
- package/dist/NostrIdentityCollection-Ca74dkaL-Ce-O_zQz.js +0 -2
- package/dist/OidcIdentityCollection-gnrLoF08-DJI-69Ow.js +0 -2
- package/dist/ProfileAssetCollection-CmbeSgDi-BpJ7XXsP.js +0 -2
- package/dist/ProfileMetadataCollection-DxX_BJKV-orYFlYii.js +0 -2
- package/dist/dist-DsMohSo_.js +0 -1487
- package/dist/dist-iMaSv6C_.js +0 -3712
- package/dist/resolveIdentity-BrJDCjYi-kdAssLr0.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ObjectRegistry, SmrtCollection, SmrtObject, applyPendingDecoratorRegistrations, crossPackageRef, field, registerCompatibleFieldDecorator, smrt } from "@happyvertical/smrt-core";
|
|
1
|
+
import { ObjectRegistry, SmrtCollection, SmrtObject, applyPendingDecoratorRegistrations, crossPackageRef, field, registerCompatibleFieldDecorator, smrt, toSnakeCase } from "@happyvertical/smrt-core";
|
|
2
2
|
import { createLogger } from "@happyvertical/logger";
|
|
3
3
|
import { getPackageConfig } from "@happyvertical/smrt-config";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -47,7 +47,8 @@ var TenantIsolationError = class extends Error {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
//#endregion
|
|
50
|
-
//#region ../tenancy/dist/chunks/testing-
|
|
50
|
+
//#region ../tenancy/dist/chunks/testing-eQsTNXj4.js
|
|
51
|
+
var logger$1 = createLogger({ level: "info" });
|
|
51
52
|
var DEFAULT_CONFIG = {
|
|
52
53
|
mode: "required",
|
|
53
54
|
field: "tenantId",
|
|
@@ -56,7 +57,35 @@ var DEFAULT_CONFIG = {
|
|
|
56
57
|
allowSuperAdminBypass: false
|
|
57
58
|
};
|
|
58
59
|
var tenantScopedClasses = /* @__PURE__ */ new Map();
|
|
60
|
+
var directSimpleRegistrations = /* @__PURE__ */ new Map();
|
|
61
|
+
var directQualifiedRegistrations = /* @__PURE__ */ new Map();
|
|
62
|
+
var directSimpleBindings = /* @__PURE__ */ new Map();
|
|
59
63
|
var unregisteredDecoratorRegistrations = /* @__PURE__ */ new Map();
|
|
64
|
+
var auditedSelectors = /* @__PURE__ */ new Set();
|
|
65
|
+
function isQualifiedClassName(className) {
|
|
66
|
+
return className.includes(":");
|
|
67
|
+
}
|
|
68
|
+
function isCurrentDirectSimpleBinding(binding) {
|
|
69
|
+
return ObjectRegistry.getClassByQualifiedName(binding.qualifiedName)?.constructor === binding.constructor;
|
|
70
|
+
}
|
|
71
|
+
function bindDirectSimpleRegistration(className) {
|
|
72
|
+
if (!directSimpleRegistrations.get(className) || directSimpleBindings.has(className)) return;
|
|
73
|
+
const matches = ObjectRegistry.findClassesByName(className);
|
|
74
|
+
if (matches.length !== 1 || !matches[0].qualifiedName) return;
|
|
75
|
+
directSimpleBindings.set(className, {
|
|
76
|
+
qualifiedName: matches[0].qualifiedName,
|
|
77
|
+
constructor: matches[0].constructor
|
|
78
|
+
});
|
|
79
|
+
warnOnRegistrationMismatch(className);
|
|
80
|
+
}
|
|
81
|
+
function getDirectSimpleRegistration(className) {
|
|
82
|
+
const config = directSimpleRegistrations.get(className);
|
|
83
|
+
if (!config) return void 0;
|
|
84
|
+
const binding = directSimpleBindings.get(className);
|
|
85
|
+
if (binding && !isCurrentDirectSimpleBinding(binding)) throw new Error(`Stale tenant-scoped class registration '${className}'; unregister and register it again for the current constructor.`);
|
|
86
|
+
if (ObjectRegistry.findClassesByName(className).length > 1) throw new Error(`Ambiguous tenant-scoped class registration '${className}'; register an explicit qualified class name instead.`);
|
|
87
|
+
return config;
|
|
88
|
+
}
|
|
60
89
|
function registerTenantScopedConstructor(target, config = {}) {
|
|
61
90
|
const resolved = {
|
|
62
91
|
...DEFAULT_CONFIG,
|
|
@@ -65,6 +94,122 @@ function registerTenantScopedConstructor(target, config = {}) {
|
|
|
65
94
|
unregisteredDecoratorRegistrations.set(target.name, resolved);
|
|
66
95
|
tenantScopedClasses.set(target.name, resolved);
|
|
67
96
|
}
|
|
97
|
+
function cloneConfig(config) {
|
|
98
|
+
return { ...config };
|
|
99
|
+
}
|
|
100
|
+
function getDirectTenantScopedConfig(className) {
|
|
101
|
+
ObjectRegistry.assertTenantScopedRegistrationValid(className);
|
|
102
|
+
const directQualified = directQualifiedRegistrations.get(className);
|
|
103
|
+
if (directQualified) {
|
|
104
|
+
if (!auditedSelectors.has(className)) warnOnRegistrationMismatch(className);
|
|
105
|
+
return cloneConfig(directQualified);
|
|
106
|
+
}
|
|
107
|
+
const registered = isQualifiedClassName(className) ? ObjectRegistry.getClassByQualifiedName(className) : ObjectRegistry.getClass(className);
|
|
108
|
+
if (registered) {
|
|
109
|
+
const simple = registered.name;
|
|
110
|
+
const bound = directSimpleBindings.get(simple);
|
|
111
|
+
if (bound) {
|
|
112
|
+
if (bound.qualifiedName === className && bound.constructor === registered.constructor) return cloneConfig(directSimpleRegistrations.get(simple));
|
|
113
|
+
if (!isCurrentDirectSimpleBinding(bound)) throw new Error(`Stale tenant-scoped class registration '${simple}'; unregister and register it again for the current constructor.`);
|
|
114
|
+
}
|
|
115
|
+
if (!bound && directSimpleRegistrations.has(simple)) {
|
|
116
|
+
if (ObjectRegistry.findClassesByName(simple).length > 1) throw new Error(`Ambiguous tenant-scoped class registration '${simple}'; register an explicit qualified class name instead.`);
|
|
117
|
+
bindDirectSimpleRegistration(simple);
|
|
118
|
+
const rebound = directSimpleBindings.get(simple);
|
|
119
|
+
if (rebound?.qualifiedName === className && rebound.constructor === registered.constructor) return cloneConfig(directSimpleRegistrations.get(simple));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!isQualifiedClassName(className)) {
|
|
123
|
+
const directSimple = getDirectSimpleRegistration(className);
|
|
124
|
+
if (directSimple) return cloneConfig(directSimple);
|
|
125
|
+
}
|
|
126
|
+
const coreConfig = ObjectRegistry.getTenantScopedConfig(className);
|
|
127
|
+
if (coreConfig) return {
|
|
128
|
+
mode: coreConfig.mode,
|
|
129
|
+
field: coreConfig.field,
|
|
130
|
+
autoFilter: coreConfig.autoFilter,
|
|
131
|
+
autoPopulate: coreConfig.autoPopulate,
|
|
132
|
+
allowSuperAdminBypass: coreConfig.allowSuperAdminBypass
|
|
133
|
+
};
|
|
134
|
+
if (!registered && !isQualifiedClassName(className)) {
|
|
135
|
+
const decoratorConfig = unregisteredDecoratorRegistrations.get(className);
|
|
136
|
+
if (decoratorConfig) return cloneConfig(decoratorConfig);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function getInheritedTenantScopedConfig(className) {
|
|
140
|
+
const chain = ObjectRegistry.getInheritanceChain(className);
|
|
141
|
+
for (let i = chain.length - 2; i >= 0; i--) {
|
|
142
|
+
const ancestor = chain[i];
|
|
143
|
+
const direct = getDirectTenantScopedConfig(ancestor);
|
|
144
|
+
if (direct) return direct;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function getTenantScopedConfig(className) {
|
|
148
|
+
const direct = getDirectTenantScopedConfig(className);
|
|
149
|
+
if (direct) return direct;
|
|
150
|
+
return getInheritedTenantScopedConfig(className);
|
|
151
|
+
}
|
|
152
|
+
ObjectRegistry.registerOwnershipColumnSource((qualifiedName) => {
|
|
153
|
+
const config = getTenantScopedConfig(qualifiedName);
|
|
154
|
+
return config ? [toSnakeCase(config.field)] : void 0;
|
|
155
|
+
});
|
|
156
|
+
function resolveSelectorClass(selector) {
|
|
157
|
+
if (isQualifiedClassName(selector)) return ObjectRegistry.getClassByQualifiedName(selector);
|
|
158
|
+
const bound = directSimpleBindings.get(selector);
|
|
159
|
+
if (bound) return ObjectRegistry.getClassByQualifiedName(bound.qualifiedName);
|
|
160
|
+
const matches = ObjectRegistry.findClassesByName(selector);
|
|
161
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
162
|
+
}
|
|
163
|
+
function auditSelector(selector, config) {
|
|
164
|
+
const registered = resolveSelectorClass(selector);
|
|
165
|
+
if (!registered) return [];
|
|
166
|
+
const className = registered.qualifiedName || registered.name;
|
|
167
|
+
const findings = [];
|
|
168
|
+
if (!registered.fields.has(config.field)) {
|
|
169
|
+
findings.push({
|
|
170
|
+
selector,
|
|
171
|
+
className,
|
|
172
|
+
kind: "missing_tenant_field",
|
|
173
|
+
severity: "error",
|
|
174
|
+
message: `${className} is registered tenant-scoped on field '${config.field}', but the model declares no such field. Tenant filtering and population target a column its manifest and schema do not have. Add the field (or declare \`@smrt({ tenantScoped })\`) and regenerate the manifest.`
|
|
175
|
+
});
|
|
176
|
+
return findings;
|
|
177
|
+
}
|
|
178
|
+
if (!ObjectRegistry.getTenantScopedConfig(className)) findings.push({
|
|
179
|
+
selector,
|
|
180
|
+
className,
|
|
181
|
+
kind: "undeclared_tenant_scope",
|
|
182
|
+
severity: "info",
|
|
183
|
+
message: `${className} is tenant-scoped only by runtime registration; its manifest declares no tenancy. Declare \`@smrt({ tenantScoped })\` so schema, generated surfaces and knowledge agree with the read policy.`
|
|
184
|
+
});
|
|
185
|
+
const tenantColumn = toSnakeCase(config.field);
|
|
186
|
+
const conflictColumns = ObjectRegistry.getConflictColumns(className);
|
|
187
|
+
if (!(conflictColumns.length === 1 && conflictColumns[0] === "id") && !conflictColumns.includes(tenantColumn)) findings.push({
|
|
188
|
+
selector,
|
|
189
|
+
className,
|
|
190
|
+
kind: "natural_key_not_tenant_scoped",
|
|
191
|
+
severity: "warning",
|
|
192
|
+
message: `${className} is registered tenant-scoped, but its natural key (${conflictColumns.join(", ")}) omits '${tenantColumn}', so it is unique across tenants: a second tenant cannot store a key another tenant already uses. A new object saved on such a key is refused (TENANT_ISOLATION_VIOLATION) when the row it collides with has a different '${tenantColumn}'; one whose slug was derived from its name moves to a free slug instead. Include '${tenantColumn}' in the conflict columns (or drop the explicit conflictColumns) and run \`smrt db:migrate\`.`
|
|
193
|
+
});
|
|
194
|
+
return findings;
|
|
195
|
+
}
|
|
196
|
+
function warnOnRegistrationMismatch(selector) {
|
|
197
|
+
if (auditedSelectors.has(selector)) return;
|
|
198
|
+
const config = directQualifiedRegistrations.get(selector) ?? directSimpleRegistrations.get(selector);
|
|
199
|
+
if (!config) return;
|
|
200
|
+
let findings;
|
|
201
|
+
try {
|
|
202
|
+
findings = auditSelector(selector, config);
|
|
203
|
+
} catch {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (!resolveSelectorClass(selector)) return;
|
|
207
|
+
auditedSelectors.add(selector);
|
|
208
|
+
for (const finding of findings) {
|
|
209
|
+
if (finding.severity === "info") continue;
|
|
210
|
+
logger$1.warn(`[smrt-tenancy] ${finding.message}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
68
213
|
var KEY = /* @__PURE__ */ Symbol.for("smrt:tenant-global-read-scope");
|
|
69
214
|
var root = globalThis;
|
|
70
215
|
root[KEY] ??= new AsyncLocalStorage();
|
|
@@ -92,7 +237,7 @@ async function queryWithGlobals(collection, tenantId, label) {
|
|
|
92
237
|
createLogger({ level: "info" });
|
|
93
238
|
//#endregion
|
|
94
239
|
//#region ../tenancy/dist/index.js
|
|
95
|
-
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-tenancy\",\"packageVersion\":\"0.
|
|
240
|
+
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-tenancy\",\"packageVersion\":\"0.53.0\",\"objects\":{\"@happyvertical/smrt-tenancy:BillingRelationship\":{\"name\":\"billingrelationship\",\"className\":\"BillingRelationship\",\"qualifiedName\":\"@happyvertical/smrt-tenancy:BillingRelationship\",\"collection\":\"billingrelationships\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts\",\"packageName\":\"@happyvertical/smrt-tenancy\",\"fields\":{\"childTenantId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-users:Tenant\",\"_meta\":{\"required\":true}},\"resellerTenantId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-users:Tenant\",\"_meta\":{\"required\":true}},\"billingOwnerMode\":{\"type\":\"text\",\"required\":false,\"default\":\"self\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_billing_relationships\",\"conflictColumns\":[\"child_tenant_id\"],\"api\":false,\"cli\":false,\"mcp\":false},\"extends\":\"SmrtObject\",\"exportName\":\"BillingRelationship\",\"collectionExportName\":\"BillingRelationshipCollection\",\"validationRules\":[{\"field\":\"childTenantId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"resellerTenantId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"}],\"schema\":{\"tableName\":\"_smrt_billing_relationships\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_billing_relationships\\\" (\\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 \\\"child_tenant_id\\\" UUID NOT NULL,\\n \\\"reseller_tenant_id\\\" UUID NOT NULL,\\n \\\"billing_owner_mode\\\" TEXT DEFAULT 'self'\\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\"},\"child_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"billing_owner_mode\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"self\"}},\"indexes\":[{\"name\":\"_smrt_billing_relationships_child_tenant_id_idx\",\"columns\":[\"child_tenant_id\"],\"unique\":true},{\"name\":\"_smrt_billing_relationships_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_billing_relationships_created_at_idx\",\"columns\":[\"created_at\"]},{\"name\":\"_smrt_billing_relationships_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]}],\"version\":\"4d7f410a\"},\"importPath\":\"@happyvertical/smrt-tenancy\"},\"@happyvertical/smrt-tenancy:BillingRelationshipCollection\":{\"name\":\"billingrelationshipcollection\",\"className\":\"BillingRelationshipCollection\",\"qualifiedName\":\"@happyvertical/smrt-tenancy:BillingRelationshipCollection\",\"collection\":\"billingrelationships\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts\",\"packageName\":\"@happyvertical/smrt-tenancy\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_billing_relationships\",\"api\":false,\"mcp\":false,\"cli\":false},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"BillingRelationship\",\"exportName\":\"BillingRelationshipCollection\",\"collectionExportName\":\"BillingRelationshipCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_billing_relationships\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_billing_relationships\\\" (\\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 \\\"child_tenant_id\\\" UUID NOT NULL,\\n \\\"reseller_tenant_id\\\" UUID NOT NULL,\\n \\\"billing_owner_mode\\\" TEXT DEFAULT 'self'\\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\"},\"child_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"billing_owner_mode\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"self\"}},\"indexes\":[{\"name\":\"_smrt_billing_relationships_child_tenant_id_idx\",\"columns\":[\"child_tenant_id\"],\"unique\":true},{\"name\":\"_smrt_billing_relationships_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_billing_relationships_created_at_idx\",\"columns\":[\"created_at\"]},{\"name\":\"_smrt_billing_relationships_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]}],\"version\":\"4d7f410a\"},\"importPath\":\"@happyvertical/smrt-tenancy\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\"]}"));
|
|
96
241
|
var __defProp$2 = Object.defineProperty;
|
|
97
242
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
98
243
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
@@ -199,7 +344,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
199
344
|
if (!no_symbols) __defProp$1(target, Symbol.toStringTag, { value: "Module" });
|
|
200
345
|
return target;
|
|
201
346
|
};
|
|
202
|
-
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-prompts\",\"packageVersion\":\"0.
|
|
347
|
+
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-prompts\",\"packageVersion\":\"0.53.0\",\"objects\":{\"@happyvertical/smrt-prompts:PromptOverrideCollection\":{\"name\":\"promptoverridecollection\",\"className\":\"PromptOverrideCollection\",\"qualifiedName\":\"@happyvertical/smrt-prompts:PromptOverrideCollection\",\"collection\":\"promptoverrides\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/prompts/src/collections/PromptOverrideCollection.ts\",\"packageName\":\"@happyvertical/smrt-prompts\",\"fields\":{},\"methods\":{\"getAppOverride\":{\"name\":\"getAppOverride\",\"async\":true,\"parameters\":[{\"name\":\"key\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\"]}],\"returnType\":\"Promise<PromptOverride | null>\",\"isStatic\":false,\"isPublic\":true},\"getTenantOverride\":{\"name\":\"getTenantOverride\",\"async\":true,\"parameters\":[{\"name\":\"key\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\"]}],\"returnType\":\"Promise<PromptOverride | null>\",\"isStatic\":false,\"isPublic\":true},\"getResolutionLayers\":{\"name\":\"getResolutionLayers\",\"async\":true,\"parameters\":[{\"name\":\"key\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":true,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\"]}],\"returnType\":\"Promise<object>\",\"isStatic\":false,\"isPublic\":true},\"getOverrideMapForKeys\":{\"name\":\"getOverrideMapForKeys\",\"async\":true,\"parameters\":[{\"name\":\"keys\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"scopeType\",\"type\":\"PromptOverrideScopeType\",\"optional\":false},{\"name\":\"scopeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Map<string, PromptOverride>>\",\"isStatic\":false,\"isPublic\":true},\"findByScope\":{\"name\":\"findByScope\",\"async\":true,\"parameters\":[{\"name\":\"key\",\"type\":\"string\",\"optional\":false},{\"name\":\"scopeType\",\"type\":\"PromptOverrideScopeType\",\"optional\":false},{\"name\":\"scopeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<PromptOverride | null>\",\"isStatic\":false,\"isPublic\":true},\"setTemplateOverride\":{\"name\":\"setTemplateOverride\",\"async\":true,\"parameters\":[{\"name\":\"key\",\"type\":\"string\",\"optional\":false},{\"name\":\"scopeType\",\"type\":\"PromptOverrideScopeType\",\"optional\":false},{\"name\":\"scopeId\",\"type\":\"string\",\"optional\":false},{\"name\":\"template\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]}],\"returnType\":\"Promise<PromptOverride>\",\"isStatic\":false,\"isPublic\":true},\"removeOverride\":{\"name\":\"removeOverride\",\"async\":true,\"parameters\":[{\"name\":\"key\",\"type\":\"string\",\"optional\":false},{\"name\":\"scopeType\",\"type\":\"PromptOverrideScopeType\",\"optional\":false},{\"name\":\"scopeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_prompt_overrides\",\"api\":false,\"mcp\":false,\"cli\":false},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PromptOverride\",\"exportName\":\"PromptOverrideCollection\",\"collectionExportName\":\"PromptOverrideCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_prompt_overrides\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_prompt_overrides\\\" (\\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 \\\"key\\\" TEXT NOT NULL DEFAULT '',\\n \\\"tenant_id\\\" UUID,\\n \\\"template\\\" TEXT,\\n \\\"profile\\\" TEXT,\\n \\\"model\\\" TEXT,\\n \\\"params\\\" TEXT\\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\"},\"key\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"tenant_id\":{\"type\":\"UUID\",\"notNull\":false,\"unique\":false},\"template\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"profile\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"model\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"params\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_prompt_overrides_key_context_idx\",\"columns\":[\"key\",\"context\"],\"unique\":true},{\"name\":\"_smrt_prompt_overrides_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_prompt_overrides_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"38f505e7\"},\"importPath\":\"@happyvertical/smrt-prompts\"},\"@happyvertical/smrt-prompts:PromptOverride\":{\"name\":\"promptoverride\",\"className\":\"PromptOverride\",\"qualifiedName\":\"@happyvertical/smrt-prompts:PromptOverride\",\"collection\":\"promptoverrides\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/prompts/src/models/PromptOverride.ts\",\"packageName\":\"@happyvertical/smrt-prompts\",\"fields\":{\"key\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true}},\"template\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"profile\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"model\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"params\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}}},\"methods\":{\"getParams\":{\"name\":\"getParams\",\"async\":false,\"parameters\":[],\"returnType\":\"PromptParams\",\"isStatic\":false,\"isPublic\":true},\"setParams\":{\"name\":\"setParams\",\"async\":false,\"parameters\":[{\"name\":\"params\",\"type\":\"PromptParams | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"PromptParams\"},{\"type\":\"null\"}]}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"toPromptLayer\":{\"name\":\"toPromptLayer\",\"async\":false,\"parameters\":[],\"returnType\":\"PromptLayer\",\"isStatic\":false,\"isPublic\":true},\"save\":{\"name\":\"save\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this>\",\"isStatic\":false,\"isPublic\":true},\"delete\":{\"name\":\"delete\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_prompt_overrides\",\"conflictColumns\":[\"key\",\"context\"],\"api\":false,\"cli\":false,\"mcp\":false},\"extends\":\"SmrtObject\",\"exportName\":\"PromptOverride\",\"collectionExportName\":\"PromptOverrideCollection\",\"validationRules\":[{\"field\":\"key\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"_smrt_prompt_overrides\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_prompt_overrides\\\" (\\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 \\\"key\\\" TEXT NOT NULL DEFAULT '',\\n \\\"tenant_id\\\" UUID,\\n \\\"template\\\" TEXT,\\n \\\"profile\\\" TEXT,\\n \\\"model\\\" TEXT,\\n \\\"params\\\" TEXT\\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\"},\"key\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"tenant_id\":{\"type\":\"UUID\",\"notNull\":false,\"unique\":false},\"template\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"profile\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"model\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"params\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_prompt_overrides_key_context_idx\",\"columns\":[\"key\",\"context\"],\"unique\":true},{\"name\":\"_smrt_prompt_overrides_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_prompt_overrides_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"38f505e7\"},\"importPath\":\"@happyvertical/smrt-prompts\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-tenancy\"]}"));
|
|
203
348
|
var PROMPT_CACHE_TTL_MS = 3e4;
|
|
204
349
|
var promptCache = /* @__PURE__ */ new Map();
|
|
205
350
|
var cacheGenerations = /* @__PURE__ */ new Map();
|
|
@@ -679,7 +824,7 @@ var PromptOverride = class extends SmrtObject {
|
|
|
679
824
|
};
|
|
680
825
|
__decorateClass([field({ required: true })], PromptOverride.prototype, "key", 2);
|
|
681
826
|
__decorateClass([field({
|
|
682
|
-
|
|
827
|
+
sqlType: "UUID",
|
|
683
828
|
nullable: true
|
|
684
829
|
})], PromptOverride.prototype, "tenantId", 2);
|
|
685
830
|
__decorateClass([field({
|
|
@@ -848,4 +993,4 @@ async function resolvePrompt(key, options = {}) {
|
|
|
848
993
|
};
|
|
849
994
|
}
|
|
850
995
|
//#endregion
|
|
851
|
-
export { queryGlobal as a,
|
|
996
|
+
export { queryGlobal as a, isSystemContext as c, tenantId as i, withSystemContext as l, resolvePrompt as n, queryWithGlobals as o, TenantScoped as r, getTenantId as s, definePrompt as t };
|
|
@@ -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-8C4XjDhz.js";
|
|
2
2
|
import { ObjectRegistry, SmrtCollection, SmrtHierarchical, SmrtObject, detectEngine, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
3
3
|
import { BackfillTracker } from "@happyvertical/smrt-core/migrations";
|
|
4
4
|
//#region ../ledgers/dist/chunks/Account-Dr4tA_Gn.js
|
|
@@ -88,7 +88,7 @@ var Account = class extends SmrtHierarchical {
|
|
|
88
88
|
*/
|
|
89
89
|
async getBalance(asOfDate) {
|
|
90
90
|
if (!this.id) return 0;
|
|
91
|
-
const { JournalEntryCollection } = await import("./dist-
|
|
91
|
+
const { JournalEntryCollection } = await import("./dist-CLA60jwS.js").then((n) => n.t);
|
|
92
92
|
return await (await JournalEntryCollection.create(this.options)).getAccountBalance(this.id, asOfDate);
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -96,7 +96,7 @@ var Account = class extends SmrtHierarchical {
|
|
|
96
96
|
*/
|
|
97
97
|
async createChild(options) {
|
|
98
98
|
if (!this.id) throw new Error("Account must be saved before creating children");
|
|
99
|
-
const { AccountCollection } = await import("./dist-
|
|
99
|
+
const { AccountCollection } = await import("./dist-CLA60jwS.js").then((n) => n.n);
|
|
100
100
|
const account = await (await AccountCollection.create(this.options)).create({
|
|
101
101
|
...options,
|
|
102
102
|
parentId: this.id,
|
|
@@ -138,7 +138,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
138
138
|
if (!no_symbols) __defProp$2(target, Symbol.toStringTag, { value: "Module" });
|
|
139
139
|
return target;
|
|
140
140
|
};
|
|
141
|
-
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-ledgers\",\"packageVersion\":\"0.51.39\",\"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\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"type\":{\"type\":\"text\",\"required\":false,\"default\":\"asset\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"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\",\"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\":\"\"},\"date\":{\"type\":\"datetime\",\"required\":false},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceModule\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceRef\":{\"type\":\"text\",\"required\":false},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"postedAt\":{\"type\":\"datetime\",\"required\":false},\"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\"},\"accountId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Account\"},\"debit\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"credit\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"exchangeRate\":{\"type\":\"decimal\",\"required\":false,\"default\":1},\"memo\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"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\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\"]}"));
|
|
141
|
+
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-ledgers\",\"packageVersion\":\"0.53.0\",\"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\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"type\":{\"type\":\"text\",\"required\":false,\"default\":\"asset\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"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\",\"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\":\"\"},\"date\":{\"type\":\"datetime\",\"required\":false},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceModule\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceRef\":{\"type\":\"text\",\"required\":false},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"postedAt\":{\"type\":\"datetime\",\"required\":false},\"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\"},\"accountId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Account\"},\"debit\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"credit\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"exchangeRate\":{\"type\":\"decimal\",\"required\":false,\"default\":1},\"memo\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"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\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\"]}"));
|
|
142
142
|
var smrtLedgersJournalSummarizePrompt = definePrompt({
|
|
143
143
|
key: "smrtLedgers.journal.summarize",
|
|
144
144
|
template: `Summarize this accounting journal entry:
|