@happyvertical/smrt-subscriptions 0.53.0 → 0.53.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { ObjectRegistry, SmrtCollection, SmrtObject, crossPackageRef, field, for
2
2
  import { TenantIsolationError, TenantScoped, getTenantId, isSuperAdminBypass, isSystemContext, tenantId, withSystemContext } from "@happyvertical/smrt-tenancy";
3
3
  import { preflightMinorUnitsRescale, rescaleMoneyColumnsToMinorUnits } from "@happyvertical/smrt-core/migrations";
4
4
  //#region src/__smrt-register__.ts
5
- ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-subscriptions\",\"packageVersion\":\"0.53.0\",\"objects\":{\"@happyvertical/smrt-subscriptions:SubscriptionPlanCollection\":{\"name\":\"subscriptionplancollection\",\"className\":\"SubscriptionPlanCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SubscriptionPlanCollection\",\"collection\":\"subscriptionplans\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/SubscriptionPlanCollection.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{\"findByPlanKey\":{\"name\":\"findByPlanKey\",\"async\":true,\"parameters\":[{\"name\":\"planKey\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<SubscriptionPlan | null>\",\"isStatic\":false,\"isPublic\":true},\"findActive\":{\"name\":\"findActive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<SubscriptionPlan[]>\",\"isStatic\":false,\"isPublic\":true},\"findByStripePriceId\":{\"name\":\"findByStripePriceId\",\"async\":true,\"parameters\":[{\"name\":\"stripePriceId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<SubscriptionPlan | null>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_subscription_plans\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"SubscriptionPlan\",\"exportName\":\"SubscriptionPlanCollection\",\"collectionExportName\":\"SubscriptionPlanCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_subscription_plans\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_subscription_plans\\\" (\\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 \\\"plan_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"status\\\" TEXT DEFAULT 'active',\\n \\\"sort_order\\\" INTEGER DEFAULT 0,\\n \\\"price_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"billing_interval\\\" TEXT DEFAULT 'month',\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_product_id\\\" TEXT DEFAULT '',\\n \\\"stripe_price_id\\\" TEXT DEFAULT '',\\n \\\"features\\\" TEXT DEFAULT '[]',\\n \\\"thresholds\\\" TEXT DEFAULT '[]',\\n \\\"metadata\\\" TEXT 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},\"plan_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"price_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"billing_interval\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_product_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_price_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"features\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"thresholds\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_subscription_plans_plan_key_idx\",\"columns\":[\"plan_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_subscription_plans_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_subscription_plans_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"65765fd0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantSubscriptionCollection\":{\"name\":\"tenantsubscriptioncollection\",\"className\":\"TenantSubscriptionCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantSubscriptionCollection\",\"collection\":\"tenantsubscriptions\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantSubscriptionCollection.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantSubscription[]>\",\"isStatic\":false,\"isPublic\":true},\"findCurrentForTenant\":{\"name\":\"findCurrentForTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"now\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<TenantSubscription | null>\",\"isStatic\":false,\"isPublic\":true},\"findCurrentForSubscriber\":{\"name\":\"findCurrentForSubscriber\",\"async\":true,\"parameters\":[{\"name\":\"subscriber\",\"type\":\"Subscriber\",\"optional\":false},{\"name\":\"now\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<TenantSubscription | null>\",\"isStatic\":false,\"isPublic\":true},\"findByStripeSubscriptionId\":{\"name\":\"findByStripeSubscriptionId\",\"async\":true,\"parameters\":[{\"name\":\"stripeSubscriptionId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantSubscription | null>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_subscriptions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"TenantSubscription\",\"exportName\":\"TenantSubscriptionCollection\",\"collectionExportName\":\"TenantSubscriptionCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_tenant_subscriptions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_subscriptions\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"plan_id\\\" UUID,\\n \\\"status\\\" TEXT DEFAULT 'incomplete',\\n \\\"started_at\\\" TIMESTAMP,\\n \\\"current_period_start\\\" TIMESTAMP,\\n \\\"current_period_end\\\" TIMESTAMP,\\n \\\"trial_ends_at\\\" TIMESTAMP,\\n \\\"cancel_at_period_end\\\" BOOLEAN DEFAULT FALSE,\\n \\\"canceled_at\\\" TIMESTAMP,\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_customer_id\\\" TEXT DEFAULT '',\\n \\\"stripe_subscription_id\\\" TEXT DEFAULT '',\\n \\\"stripe_checkout_session_id\\\" TEXT DEFAULT '',\\n \\\"metadata\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"plan_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_subscription_plans\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"incomplete\"},\"started_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"trial_ends_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"cancel_at_period_end\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"canceled_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_customer_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_subscription_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_checkout_session_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_tenant_subscriptions_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_tenant_subscriptions_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_tenant_subscriptions_plan_id_idx\",\"columns\":[\"plan_id\"]}],\"version\":\"ac93fb43\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantUsageMetricCollection\":{\"name\":\"tenantusagemetriccollection\",\"className\":\"TenantUsageMetricCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantUsageMetricCollection\",\"collection\":\"tenantusagemetrics\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantUsageMetricCollection.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{\"recordUsage\":{\"name\":\"recordUsage\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"RecordUsageOptions\",\"optional\":false}],\"returnType\":\"Promise<TenantUsageMetric>\",\"isStatic\":false,\"isPublic\":true},\"findByTenantAndMetric\":{\"name\":\"findByTenantAndMetric\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"metricKey\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantUsageMetric[]>\",\"isStatic\":false,\"isPublic\":true},\"summarizeUsage\":{\"name\":\"summarizeUsage\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"SummarizeUsageOptions\",\"optional\":false}],\"returnType\":\"Promise<UsageSummary>\",\"isStatic\":false,\"isPublic\":true},\"summarizeUsageBatch\":{\"name\":\"summarizeUsageBatch\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"SummarizeUsageBatchOptions\",\"optional\":false}],\"returnType\":\"Promise<UsageSummary[]>\",\"isStatic\":false,\"isPublic\":true},\"summarizeTenantAiUsage\":{\"name\":\"summarizeTenantAiUsage\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"SummarizeAiUsageOptions\",\"optional\":false}],\"returnType\":\"Promise<AiUsageSummary>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_usage_metrics\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"TenantUsageMetric\",\"exportName\":\"TenantUsageMetricCollection\",\"collectionExportName\":\"TenantUsageMetricCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_tenant_usage_metrics\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_usage_metrics\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"window_start\\\" TIMESTAMP,\\n \\\"window_end\\\" TIMESTAMP,\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"dimensions\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"window_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"window_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"dimensions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_usage_metrics_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_tenant_usage_metrics_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"b799c746\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:SubscriptionPlan\":{\"name\":\"subscriptionplan\",\"className\":\"SubscriptionPlan\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SubscriptionPlan\",\"collection\":\"subscriptionplans\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/SubscriptionPlan.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"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}}},\"planKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"active\"},\"sortOrder\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"priceAmount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"billingInterval\":{\"type\":\"text\",\"required\":false,\"default\":\"month\"},\"externalProvider\":{\"type\":\"text\",\"required\":false,\"default\":\"stripe\"},\"stripeProductId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"stripePriceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"features\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"},\"thresholds\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getFeatureGrants\":{\"name\":\"getFeatureGrants\",\"async\":false,\"parameters\":[],\"returnType\":\"PlanFeatureGrant[]\",\"isStatic\":false,\"isPublic\":true},\"setFeatureGrants\":{\"name\":\"setFeatureGrants\",\"async\":false,\"parameters\":[{\"name\":\"grants\",\"type\":\"Array<string | PlanFeatureGrant>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getFeatureKeys\":{\"name\":\"getFeatureKeys\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"getThresholds\":{\"name\":\"getThresholds\",\"async\":false,\"parameters\":[],\"returnType\":\"PlanThreshold[]\",\"isStatic\":false,\"isPublic\":true},\"setThresholds\":{\"name\":\"setThresholds\",\"async\":false,\"parameters\":[{\"name\":\"thresholds\",\"type\":\"PlanThreshold[]\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"JsonObject\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"metadata\",\"type\":\"JsonObject\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_subscription_plans\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"plan_key\"],\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"SubscriptionPlan\",\"collectionExportName\":\"SubscriptionPlanCollection\",\"schema\":{\"tableName\":\"_smrt_subscription_plans\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_subscription_plans\\\" (\\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 \\\"plan_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"status\\\" TEXT DEFAULT 'active',\\n \\\"sort_order\\\" INTEGER DEFAULT 0,\\n \\\"price_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"billing_interval\\\" TEXT DEFAULT 'month',\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_product_id\\\" TEXT DEFAULT '',\\n \\\"stripe_price_id\\\" TEXT DEFAULT '',\\n \\\"features\\\" TEXT DEFAULT '[]',\\n \\\"thresholds\\\" TEXT DEFAULT '[]',\\n \\\"metadata\\\" TEXT 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},\"plan_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"price_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"billing_interval\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_product_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_price_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"features\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"thresholds\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_subscription_plans_plan_key_idx\",\"columns\":[\"plan_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_subscription_plans_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_subscription_plans_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"65765fd0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantSubscription\":{\"name\":\"tenantsubscription\",\"className\":\"TenantSubscription\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantSubscription\",\"collection\":\"tenantsubscriptions\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/TenantSubscription.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"planId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"SubscriptionPlan\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"incomplete\"},\"startedAt\":{\"type\":\"datetime\",\"required\":false},\"currentPeriodStart\":{\"type\":\"datetime\",\"required\":false},\"currentPeriodEnd\":{\"type\":\"datetime\",\"required\":false},\"trialEndsAt\":{\"type\":\"datetime\",\"required\":false},\"cancelAtPeriodEnd\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"canceledAt\":{\"type\":\"datetime\",\"required\":false},\"externalProvider\":{\"type\":\"text\",\"required\":false,\"default\":\"stripe\"},\"stripeCustomerId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"stripeSubscriptionId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"stripeCheckoutSessionId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"}},\"methods\":{\"isEntitled\":{\"name\":\"isEntitled\",\"async\":false,\"parameters\":[{\"name\":\"now\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getSubscriber\":{\"name\":\"getSubscriber\",\"async\":false,\"parameters\":[],\"returnType\":\"Subscriber | null\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"JsonObject\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"metadata\",\"type\":\"JsonObject\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_subscriptions\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"TenantSubscription\",\"collectionExportName\":\"TenantSubscriptionCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_tenant_subscriptions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_subscriptions\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"plan_id\\\" UUID,\\n \\\"status\\\" TEXT DEFAULT 'incomplete',\\n \\\"started_at\\\" TIMESTAMP,\\n \\\"current_period_start\\\" TIMESTAMP,\\n \\\"current_period_end\\\" TIMESTAMP,\\n \\\"trial_ends_at\\\" TIMESTAMP,\\n \\\"cancel_at_period_end\\\" BOOLEAN DEFAULT FALSE,\\n \\\"canceled_at\\\" TIMESTAMP,\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_customer_id\\\" TEXT DEFAULT '',\\n \\\"stripe_subscription_id\\\" TEXT DEFAULT '',\\n \\\"stripe_checkout_session_id\\\" TEXT DEFAULT '',\\n \\\"metadata\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"plan_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_subscription_plans\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"incomplete\"},\"started_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"trial_ends_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"cancel_at_period_end\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"canceled_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_customer_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_subscription_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_checkout_session_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_tenant_subscriptions_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_tenant_subscriptions_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_tenant_subscriptions_plan_id_idx\",\"columns\":[\"plan_id\"]}],\"version\":\"ac93fb43\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantUsageMetric\":{\"name\":\"tenantusagemetric\",\"className\":\"TenantUsageMetric\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantUsageMetric\",\"collection\":\"tenantusagemetrics\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/TenantUsageMetric.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"quantity\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"windowStart\":{\"type\":\"datetime\",\"required\":false},\"windowEnd\":{\"type\":\"datetime\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefType\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"provider\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"dimensions\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"}},\"methods\":{\"getSubscriber\":{\"name\":\"getSubscriber\",\"async\":false,\"parameters\":[],\"returnType\":\"Subscriber | null\",\"isStatic\":false,\"isPublic\":true},\"getDimensions\":{\"name\":\"getDimensions\",\"async\":false,\"parameters\":[],\"returnType\":\"JsonObject\",\"isStatic\":false,\"isPublic\":true},\"setDimensions\":{\"name\":\"setDimensions\",\"async\":false,\"parameters\":[{\"name\":\"dimensions\",\"type\":\"JsonObject\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_usage_metrics\",\"api\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"include\":[\"list\",\"get\",\"create\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"TenantUsageMetric\",\"collectionExportName\":\"TenantUsageMetricCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_tenant_usage_metrics\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_usage_metrics\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"window_start\\\" TIMESTAMP,\\n \\\"window_end\\\" TIMESTAMP,\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"dimensions\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"window_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"window_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"dimensions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_usage_metrics_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_tenant_usage_metrics_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"b799c746\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PricingRule\":{\"name\":\"pricingrule\",\"className\":\"PricingRule\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PricingRule\",\"collection\":\"pricingrules\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"ruleKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"strategy\":{\"type\":\"text\",\"required\":false,\"default\":\"fixed_unit\"},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"effectiveFrom\":{\"type\":\"datetime\",\"required\":false},\"effectiveTo\":{\"type\":\"datetime\",\"required\":false},\"priority\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"terms\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"priceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"}},\"methods\":{\"getTerms\":{\"name\":\"getTerms\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setTerms\":{\"name\":\"setTerms\",\"async\":false,\"parameters\":[{\"name\":\"value\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_pricing_rules\",\"api\":true,\"cli\":true,\"mcp\":true,\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"PricingRule\",\"collectionExportName\":\"PricingRuleCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_pricing_rules\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_pricing_rules\\\" (\\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 NOT NULL,\\n \\\"rule_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"strategy\\\" TEXT DEFAULT 'fixed_unit',\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"effective_from\\\" TIMESTAMP,\\n \\\"effective_to\\\" TIMESTAMP,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"terms\\\" TEXT DEFAULT '{}',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"price_book_id\\\" UUID\\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\":true,\"unique\":false},\"rule_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"strategy\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"fixed_unit\"},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"effective_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"effective_to\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"terms\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}}},\"indexes\":[{\"name\":\"_smrt_pricing_rules_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_pricing_rules_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_pricing_rules_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"65ce9b3f\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:ClientCharge\":{\"name\":\"clientcharge\",\"className\":\"ClientCharge\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:ClientCharge\",\"collection\":\"clientcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"usageEventId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"TenantUsageMetric\"},\"usageTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefType\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"provider\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"quantity\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"pricingRuleId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PricingRule\"},\"priceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"pricingSnapshot\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"approvedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getPricingSnapshot\":{\"name\":\"getPricingSnapshot\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_client_charges\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"usage_event_id\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ClientCharge\",\"collectionExportName\":\"ClientChargeCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_client_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_client_charges\\\" (\\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 NOT NULL,\\n \\\"usage_event_id\\\" UUID,\\n \\\"usage_tenant_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"usage_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_client_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_client_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_client_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_client_charges_usage_tenant_id_idx\",\"columns\":[\"usage_tenant_id\"]},{\"name\":\"_smrt_client_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]},{\"name\":\"_smrt_client_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"e542be95\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:BillingAdjustment\":{\"name\":\"billingadjustment\",\"className\":\"BillingAdjustment\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:BillingAdjustment\",\"collection\":\"billingadjustments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"clientChargeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ClientCharge\"},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"source\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"createdBy\":{\"type\":\"text\",\"required\":false,\"default\":\"\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_billing_adjustments\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"BillingAdjustment\",\"collectionExportName\":\"BillingAdjustmentCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_billing_adjustments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_billing_adjustments\\\" (\\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 NOT NULL,\\n \\\"client_charge_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"created_by\\\" TEXT 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\":true,\"unique\":false},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"created_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_billing_adjustments_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_billing_adjustments_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_billing_adjustments_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]}],\"version\":\"cded0b52\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:SpendingPolicy\":{\"name\":\"spendingpolicy\",\"className\":\"SpendingPolicy\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SpendingPolicy\",\"collection\":\"spendingpolicies\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"period\":{\"type\":\"text\",\"required\":false,\"default\":\"month\"},\"rollingSeconds\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"limitAmount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"behavior\":{\"type\":\"text\",\"required\":false,\"default\":\"observe\"},\"priority\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"basis\":{\"type\":\"text\",\"required\":false,\"default\":\"billed\"},\"setByTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"},\"balanceFrom\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_spending_policies\",\"conflictColumns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\",\"project_id\",\"service_key\",\"metric_key\",\"period\",\"name\"],\"api\":true,\"cli\":true,\"mcp\":true,\"hooks\":{\"beforeDelete\":\"assertDelegationAuthority\"},\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"SpendingPolicy\",\"collectionExportName\":\"SpendingPolicyCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_spending_policies\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_spending_policies\\\" (\\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 NOT NULL,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"subscriber_kind\\\" TEXT DEFAULT '',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"period\\\" TEXT DEFAULT 'month',\\n \\\"rolling_seconds\\\" INTEGER DEFAULT 0,\\n \\\"limit_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"behavior\\\" TEXT DEFAULT 'observe',\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"basis\\\" TEXT DEFAULT 'billed',\\n \\\"set_by_tenant_id\\\" UUID,\\n \\\"balance_from\\\" TIMESTAMP\\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\":true,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"period\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"rolling_seconds\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"limit_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"behavior\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"observe\"},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"basis\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"billed\"},\"set_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"balance_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_spending_policies_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\",\"project_id\",\"service_key\",\"metric_key\",\"period\",\"name\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_spending_policies_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_spending_policies_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_spending_policies_set_by_tenant_id_idx\",\"columns\":[\"set_by_tenant_id\"]}],\"version\":\"c4ac2f49\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PricingRuleCollection\":{\"name\":\"pricingrulecollection\",\"className\":\"PricingRuleCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PricingRuleCollection\",\"collection\":\"pricingrules\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_pricing_rules\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PricingRule\",\"exportName\":\"PricingRuleCollection\",\"collectionExportName\":\"PricingRuleCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_pricing_rules\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_pricing_rules\\\" (\\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 NOT NULL,\\n \\\"rule_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"strategy\\\" TEXT DEFAULT 'fixed_unit',\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"effective_from\\\" TIMESTAMP,\\n \\\"effective_to\\\" TIMESTAMP,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"terms\\\" TEXT DEFAULT '{}',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"price_book_id\\\" UUID\\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\":true,\"unique\":false},\"rule_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"strategy\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"fixed_unit\"},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"effective_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"effective_to\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"terms\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}}},\"indexes\":[{\"name\":\"_smrt_pricing_rules_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_pricing_rules_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_pricing_rules_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"65ce9b3f\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:ClientChargeCollection\":{\"name\":\"clientchargecollection\",\"className\":\"ClientChargeCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:ClientChargeCollection\",\"collection\":\"clientcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_client_charges\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ClientCharge\",\"exportName\":\"ClientChargeCollection\",\"collectionExportName\":\"ClientChargeCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_client_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_client_charges\\\" (\\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 NOT NULL,\\n \\\"usage_event_id\\\" UUID,\\n \\\"usage_tenant_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"usage_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_client_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_client_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_client_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_client_charges_usage_tenant_id_idx\",\"columns\":[\"usage_tenant_id\"]},{\"name\":\"_smrt_client_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]},{\"name\":\"_smrt_client_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"e542be95\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:BillingAdjustmentCollection\":{\"name\":\"billingadjustmentcollection\",\"className\":\"BillingAdjustmentCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:BillingAdjustmentCollection\",\"collection\":\"billingadjustments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_billing_adjustments\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"BillingAdjustment\",\"exportName\":\"BillingAdjustmentCollection\",\"collectionExportName\":\"BillingAdjustmentCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_billing_adjustments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_billing_adjustments\\\" (\\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 NOT NULL,\\n \\\"client_charge_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"created_by\\\" TEXT 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\":true,\"unique\":false},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"created_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_billing_adjustments_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_billing_adjustments_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_billing_adjustments_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]}],\"version\":\"cded0b52\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:SpendingPolicyCollection\":{\"name\":\"spendingpolicycollection\",\"className\":\"SpendingPolicyCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SpendingPolicyCollection\",\"collection\":\"spendingpolicies\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_spending_policies\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"SpendingPolicy\",\"exportName\":\"SpendingPolicyCollection\",\"collectionExportName\":\"SpendingPolicyCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_spending_policies\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_spending_policies\\\" (\\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 NOT NULL,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"subscriber_kind\\\" TEXT DEFAULT '',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"period\\\" TEXT DEFAULT 'month',\\n \\\"rolling_seconds\\\" INTEGER DEFAULT 0,\\n \\\"limit_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"behavior\\\" TEXT DEFAULT 'observe',\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"basis\\\" TEXT DEFAULT 'billed',\\n \\\"set_by_tenant_id\\\" UUID,\\n \\\"balance_from\\\" TIMESTAMP\\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\":true,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"period\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"rolling_seconds\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"limit_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"behavior\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"observe\"},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"basis\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"billed\"},\"set_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"balance_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_spending_policies_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\",\"project_id\",\"service_key\",\"metric_key\",\"period\",\"name\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_spending_policies_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_spending_policies_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_spending_policies_set_by_tenant_id_idx\",\"columns\":[\"set_by_tenant_id\"]}],\"version\":\"c4ac2f49\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBook\":{\"name\":\"pricebook\",\"className\":\"PriceBook\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBook\",\"collection\":\"pricebooks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"bookKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"kind\":{\"type\":\"text\",\"required\":false,\"default\":\"retail\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_books\",\"conflictColumns\":[\"tenant_id\",\"book_key\"],\"api\":false,\"cli\":false,\"mcp\":false,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"PriceBook\",\"collectionExportName\":\"PriceBookCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_price_books\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_books\\\" (\\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 NOT NULL,\\n \\\"book_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"kind\\\" TEXT DEFAULT 'retail',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE\\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\":true,\"unique\":false},\"book_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"retail\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true}},\"indexes\":[{\"name\":\"_smrt_price_books_tenant_id_book_key_idx\",\"columns\":[\"tenant_id\",\"book_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_price_books_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_books_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"c7e5f5e0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBookAssignment\":{\"name\":\"pricebookassignment\",\"className\":\"PriceBookAssignment\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBookAssignment\",\"collection\":\"pricebookassignments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"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}},\"wholesalePriceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"wholesaleCurrency\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"retailPriceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"retailCurrency\":{\"type\":\"text\",\"required\":false,\"default\":\"\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_book_assignments\",\"conflictColumns\":[\"child_tenant_id\"],\"api\":false,\"cli\":false,\"mcp\":false},\"extends\":\"SmrtObject\",\"exportName\":\"PriceBookAssignment\",\"collectionExportName\":\"PriceBookAssignmentCollection\",\"validationRules\":[{\"field\":\"childTenantId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"resellerTenantId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"}],\"schema\":{\"tableName\":\"_smrt_price_book_assignments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_book_assignments\\\" (\\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 \\\"wholesale_price_book_id\\\" UUID,\\n \\\"wholesale_currency\\\" TEXT DEFAULT '',\\n \\\"retail_price_book_id\\\" UUID,\\n \\\"retail_currency\\\" TEXT 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\"},\"child_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"wholesale_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"wholesale_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"retail_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"retail_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_price_book_assignments_child_tenant_id_idx\",\"columns\":[\"child_tenant_id\"],\"unique\":true},{\"name\":\"_smrt_price_book_assignments_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_book_assignments_created_at_idx\",\"columns\":[\"created_at\"]},{\"name\":\"_smrt_price_book_assignments_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_price_book_assignments_wholesale_price_book_id_idx\",\"columns\":[\"wholesale_price_book_id\"]},{\"name\":\"_smrt_price_book_assignments_retail_price_book_id_idx\",\"columns\":[\"retail_price_book_id\"]}],\"version\":\"f24f020e\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:RetailCharge\":{\"name\":\"retailcharge\",\"className\":\"RetailCharge\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:RetailCharge\",\"collection\":\"retailcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"resellerTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"},\"usageEventId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"TenantUsageMetric\"},\"clientChargeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ClientCharge\"},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefType\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"provider\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"quantity\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"priceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"pricingRuleId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PricingRule\"},\"pricingSnapshot\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"approvedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getPricingSnapshot\":{\"name\":\"getPricingSnapshot\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_retail_charges\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"usage_event_id\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"RetailCharge\",\"collectionExportName\":\"RetailChargeCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_retail_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_retail_charges\\\" (\\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 NOT NULL,\\n \\\"reseller_tenant_id\\\" UUID,\\n \\\"usage_event_id\\\" UUID,\\n \\\"client_charge_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_retail_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_retail_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_retail_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_retail_charges_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_retail_charges_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]},{\"name\":\"_smrt_retail_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]},{\"name\":\"_smrt_retail_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]}],\"version\":\"1c1ae3c8\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:CreditGrant\":{\"name\":\"creditgrant\",\"className\":\"CreditGrant\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:CreditGrant\",\"collection\":\"creditgrants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"spendingPolicyId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"SpendingPolicy\"},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"source\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"grantedByTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_credit_grants\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"hooks\":{\"beforeDelete\":\"refuseDelete\"},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"CreditGrant\",\"collectionExportName\":\"CreditGrantCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_credit_grants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_credit_grants\\\" (\\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 NOT NULL,\\n \\\"spending_policy_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"granted_by_tenant_id\\\" UUID\\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\":true,\"unique\":false},\"spending_policy_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_spending_policies\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"granted_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_credit_grants_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_credit_grants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_credit_grants_spending_policy_id_idx\",\"columns\":[\"spending_policy_id\"]},{\"name\":\"_smrt_credit_grants_granted_by_tenant_id_idx\",\"columns\":[\"granted_by_tenant_id\"]}],\"version\":\"602c4e02\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBookCollection\":{\"name\":\"pricebookcollection\",\"className\":\"PriceBookCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBookCollection\",\"collection\":\"pricebooks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_books\",\"api\":false,\"mcp\":false,\"cli\":false},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PriceBook\",\"exportName\":\"PriceBookCollection\",\"collectionExportName\":\"PriceBookCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_price_books\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_books\\\" (\\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 NOT NULL,\\n \\\"book_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"kind\\\" TEXT DEFAULT 'retail',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE\\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\":true,\"unique\":false},\"book_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"retail\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true}},\"indexes\":[{\"name\":\"_smrt_price_books_tenant_id_book_key_idx\",\"columns\":[\"tenant_id\",\"book_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_price_books_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_books_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"c7e5f5e0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBookAssignmentCollection\":{\"name\":\"pricebookassignmentcollection\",\"className\":\"PriceBookAssignmentCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBookAssignmentCollection\",\"collection\":\"pricebookassignments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_book_assignments\",\"api\":false,\"mcp\":false,\"cli\":false},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PriceBookAssignment\",\"exportName\":\"PriceBookAssignmentCollection\",\"collectionExportName\":\"PriceBookAssignmentCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_price_book_assignments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_book_assignments\\\" (\\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 \\\"wholesale_price_book_id\\\" UUID,\\n \\\"wholesale_currency\\\" TEXT DEFAULT '',\\n \\\"retail_price_book_id\\\" UUID,\\n \\\"retail_currency\\\" TEXT 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\"},\"child_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"wholesale_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"wholesale_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"retail_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"retail_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_price_book_assignments_child_tenant_id_idx\",\"columns\":[\"child_tenant_id\"],\"unique\":true},{\"name\":\"_smrt_price_book_assignments_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_book_assignments_created_at_idx\",\"columns\":[\"created_at\"]},{\"name\":\"_smrt_price_book_assignments_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_price_book_assignments_wholesale_price_book_id_idx\",\"columns\":[\"wholesale_price_book_id\"]},{\"name\":\"_smrt_price_book_assignments_retail_price_book_id_idx\",\"columns\":[\"retail_price_book_id\"]}],\"version\":\"f24f020e\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:RetailChargeCollection\":{\"name\":\"retailchargecollection\",\"className\":\"RetailChargeCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:RetailChargeCollection\",\"collection\":\"retailcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_retail_charges\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"RetailCharge\",\"exportName\":\"RetailChargeCollection\",\"collectionExportName\":\"RetailChargeCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_retail_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_retail_charges\\\" (\\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 NOT NULL,\\n \\\"reseller_tenant_id\\\" UUID,\\n \\\"usage_event_id\\\" UUID,\\n \\\"client_charge_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_retail_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_retail_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_retail_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_retail_charges_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_retail_charges_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]},{\"name\":\"_smrt_retail_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]},{\"name\":\"_smrt_retail_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]}],\"version\":\"1c1ae3c8\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:CreditGrantCollection\":{\"name\":\"creditgrantcollection\",\"className\":\"CreditGrantCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:CreditGrantCollection\",\"collection\":\"creditgrants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_credit_grants\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"CreditGrant\",\"exportName\":\"CreditGrantCollection\",\"collectionExportName\":\"CreditGrantCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_credit_grants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_credit_grants\\\" (\\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 NOT NULL,\\n \\\"spending_policy_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"granted_by_tenant_id\\\" UUID\\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\":true,\"unique\":false},\"spending_policy_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_spending_policies\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"granted_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_credit_grants_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_credit_grants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_credit_grants_spending_policy_id_idx\",\"columns\":[\"spending_policy_id\"]},{\"name\":\"_smrt_credit_grants_granted_by_tenant_id_idx\",\"columns\":[\"granted_by_tenant_id\"]}],\"version\":\"602c4e02\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-tenancy\"]}"));
5
+ ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-subscriptions\",\"packageVersion\":\"0.53.2\",\"objects\":{\"@happyvertical/smrt-subscriptions:SubscriptionPlanCollection\":{\"name\":\"subscriptionplancollection\",\"className\":\"SubscriptionPlanCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SubscriptionPlanCollection\",\"collection\":\"subscriptionplans\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/SubscriptionPlanCollection.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{\"findByPlanKey\":{\"name\":\"findByPlanKey\",\"async\":true,\"parameters\":[{\"name\":\"planKey\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<SubscriptionPlan | null>\",\"isStatic\":false,\"isPublic\":true},\"findActive\":{\"name\":\"findActive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<SubscriptionPlan[]>\",\"isStatic\":false,\"isPublic\":true},\"findByStripePriceId\":{\"name\":\"findByStripePriceId\",\"async\":true,\"parameters\":[{\"name\":\"stripePriceId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<SubscriptionPlan | null>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_subscription_plans\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"SubscriptionPlan\",\"exportName\":\"SubscriptionPlanCollection\",\"collectionExportName\":\"SubscriptionPlanCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_subscription_plans\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_subscription_plans\\\" (\\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 \\\"plan_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"status\\\" TEXT DEFAULT 'active',\\n \\\"sort_order\\\" INTEGER DEFAULT 0,\\n \\\"price_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"billing_interval\\\" TEXT DEFAULT 'month',\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_product_id\\\" TEXT DEFAULT '',\\n \\\"stripe_price_id\\\" TEXT DEFAULT '',\\n \\\"features\\\" TEXT DEFAULT '[]',\\n \\\"thresholds\\\" TEXT DEFAULT '[]',\\n \\\"metadata\\\" TEXT 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},\"plan_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"price_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"billing_interval\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_product_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_price_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"features\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"thresholds\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_subscription_plans_plan_key_idx\",\"columns\":[\"plan_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_subscription_plans_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_subscription_plans_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"65765fd0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantSubscriptionCollection\":{\"name\":\"tenantsubscriptioncollection\",\"className\":\"TenantSubscriptionCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantSubscriptionCollection\",\"collection\":\"tenantsubscriptions\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantSubscriptionCollection.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantSubscription[]>\",\"isStatic\":false,\"isPublic\":true},\"findCurrentForTenant\":{\"name\":\"findCurrentForTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"now\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<TenantSubscription | null>\",\"isStatic\":false,\"isPublic\":true},\"findCurrentForSubscriber\":{\"name\":\"findCurrentForSubscriber\",\"async\":true,\"parameters\":[{\"name\":\"subscriber\",\"type\":\"Subscriber\",\"optional\":false},{\"name\":\"now\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<TenantSubscription | null>\",\"isStatic\":false,\"isPublic\":true},\"findByStripeSubscriptionId\":{\"name\":\"findByStripeSubscriptionId\",\"async\":true,\"parameters\":[{\"name\":\"stripeSubscriptionId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantSubscription | null>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_subscriptions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"TenantSubscription\",\"exportName\":\"TenantSubscriptionCollection\",\"collectionExportName\":\"TenantSubscriptionCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_tenant_subscriptions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_subscriptions\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"plan_id\\\" UUID,\\n \\\"status\\\" TEXT DEFAULT 'incomplete',\\n \\\"started_at\\\" TIMESTAMP,\\n \\\"current_period_start\\\" TIMESTAMP,\\n \\\"current_period_end\\\" TIMESTAMP,\\n \\\"trial_ends_at\\\" TIMESTAMP,\\n \\\"cancel_at_period_end\\\" BOOLEAN DEFAULT FALSE,\\n \\\"canceled_at\\\" TIMESTAMP,\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_customer_id\\\" TEXT DEFAULT '',\\n \\\"stripe_subscription_id\\\" TEXT DEFAULT '',\\n \\\"stripe_checkout_session_id\\\" TEXT DEFAULT '',\\n \\\"metadata\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"plan_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_subscription_plans\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"incomplete\"},\"started_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"trial_ends_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"cancel_at_period_end\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"canceled_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_customer_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_subscription_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_checkout_session_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_tenant_subscriptions_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_tenant_subscriptions_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_tenant_subscriptions_plan_id_idx\",\"columns\":[\"plan_id\"]}],\"version\":\"ac93fb43\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantUsageMetricCollection\":{\"name\":\"tenantusagemetriccollection\",\"className\":\"TenantUsageMetricCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantUsageMetricCollection\",\"collection\":\"tenantusagemetrics\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantUsageMetricCollection.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{\"recordUsage\":{\"name\":\"recordUsage\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"RecordUsageOptions\",\"optional\":false}],\"returnType\":\"Promise<TenantUsageMetric>\",\"isStatic\":false,\"isPublic\":true},\"findByTenantAndMetric\":{\"name\":\"findByTenantAndMetric\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"metricKey\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantUsageMetric[]>\",\"isStatic\":false,\"isPublic\":true},\"summarizeUsage\":{\"name\":\"summarizeUsage\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"SummarizeUsageOptions\",\"optional\":false}],\"returnType\":\"Promise<UsageSummary>\",\"isStatic\":false,\"isPublic\":true},\"summarizeUsageBatch\":{\"name\":\"summarizeUsageBatch\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"SummarizeUsageBatchOptions\",\"optional\":false}],\"returnType\":\"Promise<UsageSummary[]>\",\"isStatic\":false,\"isPublic\":true},\"summarizeTenantAiUsage\":{\"name\":\"summarizeTenantAiUsage\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"SummarizeAiUsageOptions\",\"optional\":false}],\"returnType\":\"Promise<AiUsageSummary>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_usage_metrics\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"TenantUsageMetric\",\"exportName\":\"TenantUsageMetricCollection\",\"collectionExportName\":\"TenantUsageMetricCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_tenant_usage_metrics\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_usage_metrics\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"window_start\\\" TIMESTAMP,\\n \\\"window_end\\\" TIMESTAMP,\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"dimensions\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"window_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"window_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"dimensions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_usage_metrics_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_tenant_usage_metrics_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"b799c746\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:SubscriptionPlan\":{\"name\":\"subscriptionplan\",\"className\":\"SubscriptionPlan\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SubscriptionPlan\",\"collection\":\"subscriptionplans\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/SubscriptionPlan.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"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}}},\"planKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"active\"},\"sortOrder\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"priceAmount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"billingInterval\":{\"type\":\"text\",\"required\":false,\"default\":\"month\"},\"externalProvider\":{\"type\":\"text\",\"required\":false,\"default\":\"stripe\"},\"stripeProductId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"stripePriceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"features\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"},\"thresholds\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getFeatureGrants\":{\"name\":\"getFeatureGrants\",\"async\":false,\"parameters\":[],\"returnType\":\"PlanFeatureGrant[]\",\"isStatic\":false,\"isPublic\":true},\"setFeatureGrants\":{\"name\":\"setFeatureGrants\",\"async\":false,\"parameters\":[{\"name\":\"grants\",\"type\":\"Array<string | PlanFeatureGrant>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getFeatureKeys\":{\"name\":\"getFeatureKeys\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"getThresholds\":{\"name\":\"getThresholds\",\"async\":false,\"parameters\":[],\"returnType\":\"PlanThreshold[]\",\"isStatic\":false,\"isPublic\":true},\"setThresholds\":{\"name\":\"setThresholds\",\"async\":false,\"parameters\":[{\"name\":\"thresholds\",\"type\":\"PlanThreshold[]\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"JsonObject\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"metadata\",\"type\":\"JsonObject\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_subscription_plans\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"plan_key\"],\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"SubscriptionPlan\",\"collectionExportName\":\"SubscriptionPlanCollection\",\"schema\":{\"tableName\":\"_smrt_subscription_plans\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_subscription_plans\\\" (\\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 \\\"plan_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"status\\\" TEXT DEFAULT 'active',\\n \\\"sort_order\\\" INTEGER DEFAULT 0,\\n \\\"price_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"billing_interval\\\" TEXT DEFAULT 'month',\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_product_id\\\" TEXT DEFAULT '',\\n \\\"stripe_price_id\\\" TEXT DEFAULT '',\\n \\\"features\\\" TEXT DEFAULT '[]',\\n \\\"thresholds\\\" TEXT DEFAULT '[]',\\n \\\"metadata\\\" TEXT 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},\"plan_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"price_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"billing_interval\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_product_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_price_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"features\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"thresholds\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_subscription_plans_plan_key_idx\",\"columns\":[\"plan_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_subscription_plans_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_subscription_plans_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"65765fd0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantSubscription\":{\"name\":\"tenantsubscription\",\"className\":\"TenantSubscription\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantSubscription\",\"collection\":\"tenantsubscriptions\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/TenantSubscription.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"planId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"SubscriptionPlan\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"incomplete\"},\"startedAt\":{\"type\":\"datetime\",\"required\":false},\"currentPeriodStart\":{\"type\":\"datetime\",\"required\":false},\"currentPeriodEnd\":{\"type\":\"datetime\",\"required\":false},\"trialEndsAt\":{\"type\":\"datetime\",\"required\":false},\"cancelAtPeriodEnd\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"canceledAt\":{\"type\":\"datetime\",\"required\":false},\"externalProvider\":{\"type\":\"text\",\"required\":false,\"default\":\"stripe\"},\"stripeCustomerId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"stripeSubscriptionId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"stripeCheckoutSessionId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"}},\"methods\":{\"isEntitled\":{\"name\":\"isEntitled\",\"async\":false,\"parameters\":[{\"name\":\"now\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getSubscriber\":{\"name\":\"getSubscriber\",\"async\":false,\"parameters\":[],\"returnType\":\"Subscriber | null\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"JsonObject\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"metadata\",\"type\":\"JsonObject\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_subscriptions\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"TenantSubscription\",\"collectionExportName\":\"TenantSubscriptionCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_tenant_subscriptions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_subscriptions\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"plan_id\\\" UUID,\\n \\\"status\\\" TEXT DEFAULT 'incomplete',\\n \\\"started_at\\\" TIMESTAMP,\\n \\\"current_period_start\\\" TIMESTAMP,\\n \\\"current_period_end\\\" TIMESTAMP,\\n \\\"trial_ends_at\\\" TIMESTAMP,\\n \\\"cancel_at_period_end\\\" BOOLEAN DEFAULT FALSE,\\n \\\"canceled_at\\\" TIMESTAMP,\\n \\\"external_provider\\\" TEXT DEFAULT 'stripe',\\n \\\"stripe_customer_id\\\" TEXT DEFAULT '',\\n \\\"stripe_subscription_id\\\" TEXT DEFAULT '',\\n \\\"stripe_checkout_session_id\\\" TEXT DEFAULT '',\\n \\\"metadata\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"plan_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_subscription_plans\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"incomplete\"},\"started_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"current_period_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"trial_ends_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"cancel_at_period_end\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"canceled_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"external_provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"stripe\"},\"stripe_customer_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_subscription_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"stripe_checkout_session_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_tenant_subscriptions_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_tenant_subscriptions_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_tenant_subscriptions_plan_id_idx\",\"columns\":[\"plan_id\"]}],\"version\":\"ac93fb43\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:TenantUsageMetric\":{\"name\":\"tenantusagemetric\",\"className\":\"TenantUsageMetric\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:TenantUsageMetric\",\"collection\":\"tenantusagemetrics\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/TenantUsageMetric.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"quantity\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"windowStart\":{\"type\":\"datetime\",\"required\":false},\"windowEnd\":{\"type\":\"datetime\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefType\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"provider\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"dimensions\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"}},\"methods\":{\"getSubscriber\":{\"name\":\"getSubscriber\",\"async\":false,\"parameters\":[],\"returnType\":\"Subscriber | null\",\"isStatic\":false,\"isPublic\":true},\"getDimensions\":{\"name\":\"getDimensions\",\"async\":false,\"parameters\":[],\"returnType\":\"JsonObject\",\"isStatic\":false,\"isPublic\":true},\"setDimensions\":{\"name\":\"setDimensions\",\"async\":false,\"parameters\":[{\"name\":\"dimensions\",\"type\":\"JsonObject\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_tenant_usage_metrics\",\"api\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"include\":[\"list\",\"get\",\"create\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"TenantUsageMetric\",\"collectionExportName\":\"TenantUsageMetricCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_tenant_usage_metrics\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_tenant_usage_metrics\\\" (\\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 NOT NULL,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"window_start\\\" TIMESTAMP,\\n \\\"window_end\\\" TIMESTAMP,\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"dimensions\\\" TEXT 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\":true,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"window_start\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"window_end\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"dimensions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"}},\"indexes\":[{\"name\":\"_smrt_tenant_usage_metrics_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_tenant_usage_metrics_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"b799c746\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PricingRule\":{\"name\":\"pricingrule\",\"className\":\"PricingRule\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PricingRule\",\"collection\":\"pricingrules\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"ruleKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"strategy\":{\"type\":\"text\",\"required\":false,\"default\":\"fixed_unit\"},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"effectiveFrom\":{\"type\":\"datetime\",\"required\":false},\"effectiveTo\":{\"type\":\"datetime\",\"required\":false},\"priority\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"terms\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"priceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"}},\"methods\":{\"getTerms\":{\"name\":\"getTerms\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setTerms\":{\"name\":\"setTerms\",\"async\":false,\"parameters\":[{\"name\":\"value\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_pricing_rules\",\"api\":true,\"cli\":true,\"mcp\":true,\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"PricingRule\",\"collectionExportName\":\"PricingRuleCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_pricing_rules\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_pricing_rules\\\" (\\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 NOT NULL,\\n \\\"rule_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"strategy\\\" TEXT DEFAULT 'fixed_unit',\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"effective_from\\\" TIMESTAMP,\\n \\\"effective_to\\\" TIMESTAMP,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"terms\\\" TEXT DEFAULT '{}',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"price_book_id\\\" UUID\\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\":true,\"unique\":false},\"rule_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"strategy\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"fixed_unit\"},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"effective_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"effective_to\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"terms\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}}},\"indexes\":[{\"name\":\"_smrt_pricing_rules_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_pricing_rules_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_pricing_rules_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"65ce9b3f\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:ClientCharge\":{\"name\":\"clientcharge\",\"className\":\"ClientCharge\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:ClientCharge\",\"collection\":\"clientcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"usageEventId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"TenantUsageMetric\"},\"usageTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefType\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"provider\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"quantity\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"pricingRuleId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PricingRule\"},\"priceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"pricingSnapshot\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"approvedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getPricingSnapshot\":{\"name\":\"getPricingSnapshot\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_client_charges\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"usage_event_id\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ClientCharge\",\"collectionExportName\":\"ClientChargeCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_client_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_client_charges\\\" (\\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 NOT NULL,\\n \\\"usage_event_id\\\" UUID,\\n \\\"usage_tenant_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"usage_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_client_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_client_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_client_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_client_charges_usage_tenant_id_idx\",\"columns\":[\"usage_tenant_id\"]},{\"name\":\"_smrt_client_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]},{\"name\":\"_smrt_client_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"e542be95\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:BillingAdjustment\":{\"name\":\"billingadjustment\",\"className\":\"BillingAdjustment\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:BillingAdjustment\",\"collection\":\"billingadjustments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"clientChargeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ClientCharge\"},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"source\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"createdBy\":{\"type\":\"text\",\"required\":false,\"default\":\"\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_billing_adjustments\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"BillingAdjustment\",\"collectionExportName\":\"BillingAdjustmentCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_billing_adjustments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_billing_adjustments\\\" (\\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 NOT NULL,\\n \\\"client_charge_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"created_by\\\" TEXT 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\":true,\"unique\":false},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"created_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_billing_adjustments_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_billing_adjustments_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_billing_adjustments_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]}],\"version\":\"cded0b52\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:SpendingPolicy\":{\"name\":\"spendingpolicy\",\"className\":\"SpendingPolicy\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SpendingPolicy\",\"collection\":\"spendingpolicies\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"period\":{\"type\":\"text\",\"required\":false,\"default\":\"month\"},\"rollingSeconds\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"limitAmount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"behavior\":{\"type\":\"text\",\"required\":false,\"default\":\"observe\"},\"priority\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"basis\":{\"type\":\"text\",\"required\":false,\"default\":\"billed\"},\"setByTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"},\"balanceFrom\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_spending_policies\",\"conflictColumns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\",\"project_id\",\"service_key\",\"metric_key\",\"period\",\"name\"],\"api\":true,\"cli\":true,\"mcp\":true,\"hooks\":{\"beforeDelete\":\"assertDelegationAuthority\"},\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"SpendingPolicy\",\"collectionExportName\":\"SpendingPolicyCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_spending_policies\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_spending_policies\\\" (\\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 NOT NULL,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"subscriber_kind\\\" TEXT DEFAULT '',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"period\\\" TEXT DEFAULT 'month',\\n \\\"rolling_seconds\\\" INTEGER DEFAULT 0,\\n \\\"limit_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"behavior\\\" TEXT DEFAULT 'observe',\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"basis\\\" TEXT DEFAULT 'billed',\\n \\\"set_by_tenant_id\\\" UUID,\\n \\\"balance_from\\\" TIMESTAMP\\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\":true,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"period\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"rolling_seconds\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"limit_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"behavior\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"observe\"},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"basis\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"billed\"},\"set_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"balance_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_spending_policies_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\",\"project_id\",\"service_key\",\"metric_key\",\"period\",\"name\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_spending_policies_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_spending_policies_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_spending_policies_set_by_tenant_id_idx\",\"columns\":[\"set_by_tenant_id\"]}],\"version\":\"c4ac2f49\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PricingRuleCollection\":{\"name\":\"pricingrulecollection\",\"className\":\"PricingRuleCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PricingRuleCollection\",\"collection\":\"pricingrules\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_pricing_rules\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PricingRule\",\"exportName\":\"PricingRuleCollection\",\"collectionExportName\":\"PricingRuleCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_pricing_rules\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_pricing_rules\\\" (\\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 NOT NULL,\\n \\\"rule_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"strategy\\\" TEXT DEFAULT 'fixed_unit',\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"effective_from\\\" TIMESTAMP,\\n \\\"effective_to\\\" TIMESTAMP,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"terms\\\" TEXT DEFAULT '{}',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"price_book_id\\\" UUID\\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\":true,\"unique\":false},\"rule_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"strategy\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"fixed_unit\"},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"effective_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"effective_to\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"terms\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}}},\"indexes\":[{\"name\":\"_smrt_pricing_rules_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_pricing_rules_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_pricing_rules_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"65ce9b3f\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:ClientChargeCollection\":{\"name\":\"clientchargecollection\",\"className\":\"ClientChargeCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:ClientChargeCollection\",\"collection\":\"clientcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_client_charges\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ClientCharge\",\"exportName\":\"ClientChargeCollection\",\"collectionExportName\":\"ClientChargeCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_client_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_client_charges\\\" (\\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 NOT NULL,\\n \\\"usage_event_id\\\" UUID,\\n \\\"usage_tenant_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"usage_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_client_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_client_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_client_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_client_charges_usage_tenant_id_idx\",\"columns\":[\"usage_tenant_id\"]},{\"name\":\"_smrt_client_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]},{\"name\":\"_smrt_client_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]}],\"version\":\"e542be95\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:BillingAdjustmentCollection\":{\"name\":\"billingadjustmentcollection\",\"className\":\"BillingAdjustmentCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:BillingAdjustmentCollection\",\"collection\":\"billingadjustments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_billing_adjustments\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"BillingAdjustment\",\"exportName\":\"BillingAdjustmentCollection\",\"collectionExportName\":\"BillingAdjustmentCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_billing_adjustments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_billing_adjustments\\\" (\\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 NOT NULL,\\n \\\"client_charge_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"created_by\\\" TEXT 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\":true,\"unique\":false},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"created_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_billing_adjustments_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_billing_adjustments_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_billing_adjustments_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]}],\"version\":\"cded0b52\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:SpendingPolicyCollection\":{\"name\":\"spendingpolicycollection\",\"className\":\"SpendingPolicyCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:SpendingPolicyCollection\",\"collection\":\"spendingpolicies\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_spending_policies\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"SpendingPolicy\",\"exportName\":\"SpendingPolicyCollection\",\"collectionExportName\":\"SpendingPolicyCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_spending_policies\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_spending_policies\\\" (\\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 NOT NULL,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"subscriber_kind\\\" TEXT DEFAULT '',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"period\\\" TEXT DEFAULT 'month',\\n \\\"rolling_seconds\\\" INTEGER DEFAULT 0,\\n \\\"limit_amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"behavior\\\" TEXT DEFAULT 'observe',\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"basis\\\" TEXT DEFAULT 'billed',\\n \\\"set_by_tenant_id\\\" UUID,\\n \\\"balance_from\\\" TIMESTAMP\\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\":true,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"period\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"month\"},\"rolling_seconds\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"limit_amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"behavior\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"observe\"},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"basis\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"billed\"},\"set_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"balance_from\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_spending_policies_tenant_id_subscriber_kind_idx\",\"columns\":[\"tenant_id\",\"subscriber_kind\",\"subscriber_external_id\",\"project_id\",\"service_key\",\"metric_key\",\"period\",\"name\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_spending_policies_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_spending_policies_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_spending_policies_set_by_tenant_id_idx\",\"columns\":[\"set_by_tenant_id\"]}],\"version\":\"c4ac2f49\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBook\":{\"name\":\"pricebook\",\"className\":\"PriceBook\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBook\",\"collection\":\"pricebooks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"bookKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"kind\":{\"type\":\"text\",\"required\":false,\"default\":\"retail\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_books\",\"conflictColumns\":[\"tenant_id\",\"book_key\"],\"api\":false,\"cli\":false,\"mcp\":false,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"PriceBook\",\"collectionExportName\":\"PriceBookCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_price_books\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_books\\\" (\\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 NOT NULL,\\n \\\"book_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"kind\\\" TEXT DEFAULT 'retail',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE\\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\":true,\"unique\":false},\"book_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"retail\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true}},\"indexes\":[{\"name\":\"_smrt_price_books_tenant_id_book_key_idx\",\"columns\":[\"tenant_id\",\"book_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_price_books_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_books_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"c7e5f5e0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBookAssignment\":{\"name\":\"pricebookassignment\",\"className\":\"PriceBookAssignment\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBookAssignment\",\"collection\":\"pricebookassignments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"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}},\"wholesalePriceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"wholesaleCurrency\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"retailPriceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"retailCurrency\":{\"type\":\"text\",\"required\":false,\"default\":\"\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_book_assignments\",\"conflictColumns\":[\"child_tenant_id\"],\"api\":false,\"cli\":false,\"mcp\":false},\"extends\":\"SmrtObject\",\"exportName\":\"PriceBookAssignment\",\"collectionExportName\":\"PriceBookAssignmentCollection\",\"validationRules\":[{\"field\":\"childTenantId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"resellerTenantId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"}],\"schema\":{\"tableName\":\"_smrt_price_book_assignments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_book_assignments\\\" (\\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 \\\"wholesale_price_book_id\\\" UUID,\\n \\\"wholesale_currency\\\" TEXT DEFAULT '',\\n \\\"retail_price_book_id\\\" UUID,\\n \\\"retail_currency\\\" TEXT 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\"},\"child_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"wholesale_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"wholesale_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"retail_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"retail_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_price_book_assignments_child_tenant_id_idx\",\"columns\":[\"child_tenant_id\"],\"unique\":true},{\"name\":\"_smrt_price_book_assignments_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_book_assignments_created_at_idx\",\"columns\":[\"created_at\"]},{\"name\":\"_smrt_price_book_assignments_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_price_book_assignments_wholesale_price_book_id_idx\",\"columns\":[\"wholesale_price_book_id\"]},{\"name\":\"_smrt_price_book_assignments_retail_price_book_id_idx\",\"columns\":[\"retail_price_book_id\"]}],\"version\":\"f24f020e\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:RetailCharge\":{\"name\":\"retailcharge\",\"className\":\"RetailCharge\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:RetailCharge\",\"collection\":\"retailcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"resellerTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"},\"usageEventId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"TenantUsageMetric\"},\"clientChargeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ClientCharge\"},\"subscriberKind\":{\"type\":\"text\",\"required\":false,\"default\":\"tenant\"},\"subscriberExternalId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"projectId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefType\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"workRefId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"provider\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"serviceKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metricKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"quantity\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"priceBookId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PriceBook\"},\"pricingRuleId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"PricingRule\"},\"pricingSnapshot\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"approvedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getPricingSnapshot\":{\"name\":\"getPricingSnapshot\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"_smrt_retail_charges\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"usage_event_id\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"RetailCharge\",\"collectionExportName\":\"RetailChargeCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_retail_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_retail_charges\\\" (\\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 NOT NULL,\\n \\\"reseller_tenant_id\\\" UUID,\\n \\\"usage_event_id\\\" UUID,\\n \\\"client_charge_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_retail_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_retail_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_retail_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_retail_charges_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_retail_charges_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]},{\"name\":\"_smrt_retail_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]},{\"name\":\"_smrt_retail_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]}],\"version\":\"1c1ae3c8\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:CreditGrant\":{\"name\":\"creditgrant\",\"className\":\"CreditGrant\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:CreditGrant\",\"collection\":\"creditgrants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"spendingPolicyId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"SpendingPolicy\"},\"amount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"source\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"grantedByTenantId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:Tenant\"}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_credit_grants\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"hooks\":{\"beforeDelete\":\"refuseDelete\"},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"CreditGrant\",\"collectionExportName\":\"CreditGrantCollection\",\"validationRules\":[],\"schema\":{\"tableName\":\"_smrt_credit_grants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_credit_grants\\\" (\\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 NOT NULL,\\n \\\"spending_policy_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"granted_by_tenant_id\\\" UUID\\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\":true,\"unique\":false},\"spending_policy_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_spending_policies\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"granted_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_credit_grants_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_credit_grants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_credit_grants_spending_policy_id_idx\",\"columns\":[\"spending_policy_id\"]},{\"name\":\"_smrt_credit_grants_granted_by_tenant_id_idx\",\"columns\":[\"granted_by_tenant_id\"]}],\"version\":\"602c4e02\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBookCollection\":{\"name\":\"pricebookcollection\",\"className\":\"PriceBookCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBookCollection\",\"collection\":\"pricebooks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_books\",\"api\":false,\"mcp\":false,\"cli\":false},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PriceBook\",\"exportName\":\"PriceBookCollection\",\"collectionExportName\":\"PriceBookCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_price_books\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_books\\\" (\\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 NOT NULL,\\n \\\"book_key\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"kind\\\" TEXT DEFAULT 'retail',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE\\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\":true,\"unique\":false},\"book_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"retail\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true}},\"indexes\":[{\"name\":\"_smrt_price_books_tenant_id_book_key_idx\",\"columns\":[\"tenant_id\",\"book_key\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_price_books_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_books_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"c7e5f5e0\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:PriceBookAssignmentCollection\":{\"name\":\"pricebookassignmentcollection\",\"className\":\"PriceBookAssignmentCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:PriceBookAssignmentCollection\",\"collection\":\"pricebookassignments\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_price_book_assignments\",\"api\":false,\"mcp\":false,\"cli\":false},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"PriceBookAssignment\",\"exportName\":\"PriceBookAssignmentCollection\",\"collectionExportName\":\"PriceBookAssignmentCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_price_book_assignments\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_price_book_assignments\\\" (\\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 \\\"wholesale_price_book_id\\\" UUID,\\n \\\"wholesale_currency\\\" TEXT DEFAULT '',\\n \\\"retail_price_book_id\\\" UUID,\\n \\\"retail_currency\\\" TEXT 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\"},\"child_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"wholesale_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"wholesale_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"retail_price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"retail_currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"_smrt_price_book_assignments_child_tenant_id_idx\",\"columns\":[\"child_tenant_id\"],\"unique\":true},{\"name\":\"_smrt_price_book_assignments_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_price_book_assignments_created_at_idx\",\"columns\":[\"created_at\"]},{\"name\":\"_smrt_price_book_assignments_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_price_book_assignments_wholesale_price_book_id_idx\",\"columns\":[\"wholesale_price_book_id\"]},{\"name\":\"_smrt_price_book_assignments_retail_price_book_id_idx\",\"columns\":[\"retail_price_book_id\"]}],\"version\":\"f24f020e\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:RetailChargeCollection\":{\"name\":\"retailchargecollection\",\"className\":\"RetailChargeCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:RetailChargeCollection\",\"collection\":\"retailcharges\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_retail_charges\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"RetailCharge\",\"exportName\":\"RetailChargeCollection\",\"collectionExportName\":\"RetailChargeCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_retail_charges\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_retail_charges\\\" (\\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 NOT NULL,\\n \\\"reseller_tenant_id\\\" UUID,\\n \\\"usage_event_id\\\" UUID,\\n \\\"client_charge_id\\\" UUID,\\n \\\"subscriber_kind\\\" TEXT DEFAULT 'tenant',\\n \\\"subscriber_external_id\\\" TEXT DEFAULT '',\\n \\\"project_id\\\" TEXT DEFAULT '',\\n \\\"work_ref_type\\\" TEXT DEFAULT '',\\n \\\"work_ref_id\\\" TEXT DEFAULT '',\\n \\\"provider\\\" TEXT DEFAULT '',\\n \\\"service_key\\\" TEXT DEFAULT '',\\n \\\"metric_key\\\" TEXT DEFAULT '',\\n \\\"quantity\\\" REAL DEFAULT 0,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"price_book_id\\\" UUID,\\n \\\"pricing_rule_id\\\" UUID,\\n \\\"pricing_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"approved_at\\\" TIMESTAMP\\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\":true,\"unique\":false},\"reseller_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"usage_event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_tenant_usage_metrics\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"client_charge_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_client_charges\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"subscriber_kind\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"tenant\"},\"subscriber_external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"project_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"work_ref_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"provider\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"service_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metric_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"quantity\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"price_book_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_price_books\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_rule_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_pricing_rules\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"pricing_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"approved_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_retail_charges_usage_event_id_idx\",\"columns\":[\"usage_event_id\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"_smrt_retail_charges_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"_smrt_retail_charges_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_retail_charges_reseller_tenant_id_idx\",\"columns\":[\"reseller_tenant_id\"]},{\"name\":\"_smrt_retail_charges_client_charge_id_idx\",\"columns\":[\"client_charge_id\"]},{\"name\":\"_smrt_retail_charges_price_book_id_idx\",\"columns\":[\"price_book_id\"]},{\"name\":\"_smrt_retail_charges_pricing_rule_id_idx\",\"columns\":[\"pricing_rule_id\"]}],\"version\":\"1c1ae3c8\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"},\"@happyvertical/smrt-subscriptions:CreditGrantCollection\":{\"name\":\"creditgrantcollection\",\"className\":\"CreditGrantCollection\",\"qualifiedName\":\"@happyvertical/smrt-subscriptions:CreditGrantCollection\",\"collection\":\"creditgrants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts\",\"packageName\":\"@happyvertical/smrt-subscriptions\",\"fields\":{},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"_smrt_credit_grants\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"CreditGrant\",\"exportName\":\"CreditGrantCollection\",\"collectionExportName\":\"CreditGrantCollectionCollection\",\"schema\":{\"tableName\":\"_smrt_credit_grants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"_smrt_credit_grants\\\" (\\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 NOT NULL,\\n \\\"spending_policy_id\\\" UUID,\\n \\\"amount\\\" INTEGER DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"reason\\\" TEXT DEFAULT '',\\n \\\"source\\\" TEXT DEFAULT '',\\n \\\"source_id\\\" TEXT DEFAULT '',\\n \\\"granted_by_tenant_id\\\" UUID\\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\":true,\"unique\":false},\"spending_policy_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"_smrt_spending_policies\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"amount\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"granted_by_tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"_smrt_credit_grants_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"_smrt_credit_grants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"_smrt_credit_grants_spending_policy_id_idx\",\"columns\":[\"spending_policy_id\"]},{\"name\":\"_smrt_credit_grants_granted_by_tenant_id_idx\",\"columns\":[\"granted_by_tenant_id\"]}],\"version\":\"602c4e02\"},\"importPath\":\"@happyvertical/smrt-subscriptions\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-tenancy\"]}"));
6
6
  //#endregion
7
7
  //#region src/utils.ts
8
8
  var THRESHOLD_WINDOWS = [
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-subscriptions",
5
- "packageVersion": "0.53.0",
5
+ "packageVersion": "0.53.2",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection": {
8
8
  "name": "subscriptionplancollection",
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-subscriptions",
6
- "packageVersion": "0.53.0",
6
+ "packageVersion": "0.53.2",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "e59b07106b10f91b27742effc93cc2c9e836e8b7737d4d016b3f3ee4548fc089",
11
- "packageJson": "1f675aa4b952e7237ad5a1e08af1bb1334fa39456c54e51685c7467c0c204a9f",
10
+ "manifest": "579933aaa0def2beb025b7b0f7daf72f85ceaf08b651c37de6376106a0bed2b8",
11
+ "packageJson": "2fdce0f398d93c1a28fdc72669afb33721f3205937f38aa1cc5aaa843a022a58",
12
12
  "agents": "89ab9b5f7047d2f7f316a4bbbb1eef225f3fa8e85f21cb9a699ec3ce18bdb9cd"
13
13
  },
14
14
  "exports": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-subscriptions",
3
- "version": "0.53.0",
3
+ "version": "0.53.2",
4
4
  "description": "Tenant subscriptions, entitlement resolution, usage thresholds, and subscription UI for SMRT",
5
5
  "type": "module",
6
6
  "smrtRawPrimitives": "strict",
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@happyvertical/smrt-core": "0.53.0",
30
- "@happyvertical/smrt-tenancy": "0.53.0",
31
- "@happyvertical/smrt-ui": "0.53.0",
29
+ "@happyvertical/smrt-core": "0.53.2",
30
+ "@happyvertical/smrt-tenancy": "0.53.2",
31
+ "@happyvertical/smrt-ui": "0.53.2",
32
32
  "@happyvertical/sql": "^0.98.0"
33
33
  },
34
34
  "peerDependencies": {
@@ -40,7 +40,7 @@
40
40
  }
41
41
  },
42
42
  "devDependencies": {
43
- "@happyvertical/smrt-vitest": "0.53.0",
43
+ "@happyvertical/smrt-vitest": "0.53.2",
44
44
  "@sveltejs/package": "^2.5.8",
45
45
  "@types/node": "24.13.6",
46
46
  "svelte": "^5.57.1",
@@ -68,7 +68,7 @@
68
68
  "directory": "packages/subscriptions"
69
69
  },
70
70
  "scripts": {
71
- "build": "vite build --mode library && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json",
71
+ "build": "vite build --mode library && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json && node ../../scripts/prune-svelte-package-artifacts.js dist",
72
72
  "build:watch": "vite build --mode library --watch",
73
73
  "check": "pnpm exec svelte-check --tsconfig ./tsconfig.svelte.json",
74
74
  "typecheck": "tsc --noEmit && node ../../scripts/svelte-check-a11y.mjs --tsconfig ./tsconfig.svelte.json",
@@ -1,94 +0,0 @@
1
- import { render } from 'svelte/server';
2
- import { describe, expect, it } from 'vitest';
3
- import { SubscriptionPlan } from '../models/SubscriptionPlan.js';
4
- import PlanPicker from './PlanPicker.svelte';
5
- import planPickerSource from './PlanPicker.svelte?raw';
6
- describe('PlanPicker', () => {
7
- it('keys serialized id-less plans by planKey', () => {
8
- const plans = [
9
- {
10
- planKey: 'starter',
11
- name: 'Starter',
12
- priceAmount: 0,
13
- currency: 'USD',
14
- billingInterval: 'month',
15
- },
16
- {
17
- planKey: 'pro',
18
- name: 'Pro',
19
- priceAmount: 10,
20
- currency: 'USD',
21
- billingInterval: 'month',
22
- },
23
- ];
24
- const { body } = render(PlanPicker, {
25
- props: { plans },
26
- });
27
- expect(body.match(/smrt-plan-picker__plan/g)).toHaveLength(2);
28
- expect(planPickerSource).toContain('{#each plans as plan (plan.planKey)}');
29
- });
30
- it('renders a minor-units price as major units', () => {
31
- // `priceAmount` is integer minor units (#2401), so 1999 is $19.99 — not
32
- // $1,999.00. Nothing asserted the rendered string before, which is exactly
33
- // how a unit change slips through a currency formatter unnoticed.
34
- const plans = [
35
- {
36
- planKey: 'pro',
37
- name: 'Pro',
38
- priceAmount: 1999,
39
- currency: 'USD',
40
- billingInterval: 'month',
41
- },
42
- ];
43
- const { body } = render(PlanPicker, { props: { plans } });
44
- expect(body).toContain('19.99');
45
- expect(body).not.toContain('1,999');
46
- });
47
- it('renders a zero-decimal currency without rescaling it', () => {
48
- // JPY has no minor unit, so ¥1999 must render as ¥1,999 rather than ¥19.99.
49
- const plans = [
50
- {
51
- planKey: 'jp',
52
- name: 'Japan',
53
- priceAmount: 1999,
54
- currency: 'JPY',
55
- billingInterval: 'month',
56
- },
57
- ];
58
- const { body } = render(PlanPicker, { props: { plans } });
59
- expect(body).toContain('1,999');
60
- });
61
- it('counts enabled features from the normal model serialization shape', () => {
62
- const plan = new SubscriptionPlan({
63
- planKey: 'pro',
64
- name: 'Pro',
65
- priceAmount: 10,
66
- currency: 'USD',
67
- billingInterval: 'month',
68
- features: JSON.stringify([
69
- 'smrt:chat',
70
- { featureKey: 'smrt:projects', enabled: true },
71
- { featureKey: 'smrt:disabled', enabled: false },
72
- ]),
73
- });
74
- const serialized = plan.toJSON();
75
- const { body } = render(PlanPicker, {
76
- props: { plans: [serialized] },
77
- });
78
- expect(body).toContain('2 features');
79
- });
80
- it('treats malformed serialized feature JSON as empty', () => {
81
- const plan = {
82
- planKey: 'broken',
83
- name: 'Broken',
84
- priceAmount: 0,
85
- currency: 'USD',
86
- billingInterval: 'month',
87
- features: '{bad json',
88
- };
89
- const { body } = render(PlanPicker, {
90
- props: { plans: [plan] },
91
- });
92
- expect(body).toContain('0 features');
93
- });
94
- });
@@ -1,34 +0,0 @@
1
- import { render } from 'svelte/server';
2
- import { describe, expect, it } from 'vitest';
3
- import SubscriptionSummary from './SubscriptionSummary.svelte';
4
- describe('SubscriptionSummary', () => {
5
- it('renders period dates with a deterministic locale and timezone', () => {
6
- const { body } = render(SubscriptionSummary, {
7
- props: {
8
- periodDisposition: 'renews',
9
- periodEnd: '2026-07-01T00:00:00Z',
10
- },
11
- });
12
- expect(body).toContain('Jul 1, 2026');
13
- });
14
- it('honours an explicit billing timezone', () => {
15
- const { body } = render(SubscriptionSummary, {
16
- props: {
17
- periodDisposition: 'ends',
18
- periodEnd: '2026-07-01T00:00:00Z',
19
- periodTimeZone: 'America/Edmonton',
20
- },
21
- });
22
- expect(body).toContain('Jun 30, 2026');
23
- });
24
- it('does not render an invalid billing date', () => {
25
- const { body } = render(SubscriptionSummary, {
26
- props: {
27
- periodDisposition: 'renews',
28
- periodEnd: 'not-a-date',
29
- },
30
- });
31
- expect(body).not.toContain('Invalid Date');
32
- expect(body).not.toContain('Period');
33
- });
34
- });