@happyvertical/smrt-fields 0.57.20 → 0.57.21

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
@@ -5,7 +5,7 @@ import { assertOperationPermission } from "@happyvertical/smrt-users";
5
5
  import { TenantIsolationError, assertTenantReadAllowed, getCurrentTenant, isSuperAdminBypass, tenantId } from "@happyvertical/smrt-tenancy";
6
6
  import { importWorkspaceModule } from "@happyvertical/smrt-core/utils/import-workspace-module";
7
7
  //#region src/__smrt-register__.ts
8
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-fields","packageVersion":"0.57.20","objects":{"@happyvertical/smrt-fields:FieldUsageLearningAgent":{"name":"fieldusagelearningagent","className":"FieldUsageLearningAgent","qualifiedName":"@happyvertical/smrt-fields:FieldUsageLearningAgent","collection":"fieldusagelearningagents","description":"The registered schedule target for the #2051 learning loop (see the module doc for why it is NOT an smrt-agents Agent subclass).","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/usage-learning.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"runUsageMaintenance":{"name":"runUsageMaintenance","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true}],"returnType":"Promise<FieldUsageMaintenanceSummary>","isStatic":false,"isPublic":true},"runSuggestionGeneration":{"name":"runSuggestionGeneration","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true}],"returnType":"Promise<FieldUsageSuggestionRunSummary>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_usage_learning_agents","api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldUsageLearningAgent","collectionExportName":"FieldUsageLearningAgentCollection","schema":{"tableName":"_smrt_field_usage_learning_agents","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_learning_agents\\" (\\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);","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"}},"indexes":[{"name":"_smrt_field_usage_learning_agents_slug_context_idx","columns":["slug","context"],"unique":true},{"name":"_smrt_field_usage_learning_agents_created_at_idx","columns":["created_at"]}],"version":"183ee1d8"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicyCollection":{"name":"fieldpolicycollection","className":"FieldPolicyCollection","qualifiedName":"@happyvertical/smrt-fields:FieldPolicyCollection","collection":"fieldpolicies","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldPolicyCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"policyAudit":{"name":"policyAudit","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string[]","boolean"]}],"returnType":"Promise<FieldPolicyAuditSnapshot>","isStatic":false,"isPublic":true},"getAppRows":{"name":"getAppRows","async":true,"parameters":[{"name":"objectRef","type":"string","optional":false}],"returnType":"Promise<Map<string, FieldPolicy>>","isStatic":false,"isPublic":true},"getTenantRows":{"name":"getTenantRows","async":true,"parameters":[{"name":"objectRef","type":"string","optional":false},{"name":"tenantIds","type":"string[]","optional":false}],"returnType":"Promise<Map<string, Map<string, FieldPolicy>>>","isStatic":false,"isPublic":true},"getUserRows":{"name":"getUserRows","async":true,"parameters":[{"name":"objectRef","type":"string","optional":false},{"name":"userId","type":"string","optional":false}],"returnType":"Promise<Map<string, FieldPolicy>>","isStatic":false,"isPublic":true},"resolveBatch":{"name":"resolveBatch","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string[]"]}],"returnType":"Promise<FieldPolicyBatchResult>","isStatic":false,"isPublic":true},"getEditorState":{"name":"getEditorState","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<FieldPolicyEditorStateResult>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["object_ref","field_name","scope_type","scope_key"],"api":{"include":["create","update","delete","resolveBatch","getEditorState","policyAudit"],"principalContext":true,"routes":{"resolveBatch":{"scope":"collection","method":"POST","path":"resolve"},"getEditorState":{"scope":"collection","method":"POST","path":"editor-state"},"policyAudit":{"scope":"collection","method":"POST","path":"policy-audit"}}},"cli":false,"mcp":false,"tableName":"_smrt_field_policies"},"extends":"SmrtCollection","extendsTypeArg":"FieldPolicy","exportName":"FieldPolicyCollection","collectionExportName":"FieldPolicyCollectionCollection","schema":{"tableName":"_smrt_field_policies","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"scope_type\\" TEXT NOT NULL DEFAULT 'app',\\n \\"tenant_id\\" UUID,\\n \\"user_id\\" UUID,\\n \\"scope_key\\" TEXT NOT NULL,\\n \\"default_value\\" TEXT,\\n \\"visibility\\" TEXT,\\n \\"help\\" TEXT,\\n \\"label\\" TEXT,\\n \\"display_order\\" INTEGER,\\n \\"locked\\" BOOLEAN,\\n \\"updated_by\\" 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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"scope_type":{"type":"TEXT","notNull":true,"unique":false,"default":"app"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"scope_key":{"type":"TEXT","notNull":true,"unique":false},"default_value":{"type":"TEXT","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false},"help":{"type":"TEXT","notNull":false,"unique":false},"label":{"type":"TEXT","notNull":false,"unique":false},"display_order":{"type":"INTEGER","notNull":false,"unique":false},"locked":{"type":"BOOLEAN","notNull":false,"unique":false},"updated_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policies_object_ref_field_name_idx","columns":["object_ref","field_name","scope_type","scope_key"],"unique":true},{"name":"_smrt_field_policies_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policies_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policies_user_id_idx","columns":["user_id"]},{"name":"_smrt_field_policies_updated_by_idx","columns":["updated_by"]}],"version":"34b355cc"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicySuggestionCollection":{"name":"fieldpolicysuggestioncollection","className":"FieldPolicySuggestionCollection","qualifiedName":"@happyvertical/smrt-fields:FieldPolicySuggestionCollection","collection":"fieldpolicysuggestions","description":"Collection surface for FieldPolicySuggestion plus the three manage-gated actions the gear badge / control-panel queue consume (#2051; UI integration is #2050-follow-up territory \u2014 this is the minimal\u2026","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldPolicySuggestionCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"pendingSuggestions":{"name":"pendingSuggestions","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string[]"]}],"returnType":"Promise<PendingFieldPolicySuggestionsResult>","isStatic":false,"isPublic":true},"acceptSuggestion":{"name":"acceptSuggestion","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<AcceptFieldPolicySuggestionResult>","isStatic":false,"isPublic":true},"dismissSuggestion":{"name":"dismissSuggestion","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string","number"]}],"returnType":"Promise<DismissFieldPolicySuggestionResult>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["object_ref","field_name","tenant_id","kind","active_key"],"api":{"include":["pendingSuggestions","acceptSuggestion","dismissSuggestion"],"principalContext":true,"routes":{"pendingSuggestions":{"scope":"collection","method":"POST","path":"pending"},"acceptSuggestion":{"scope":"collection","method":"POST","path":"accept"},"dismissSuggestion":{"scope":"collection","method":"POST","path":"dismiss"}}},"cli":false,"mcp":false,"tableName":"_smrt_field_policy_suggestions"},"extends":"SmrtCollection","extendsTypeArg":"FieldPolicySuggestion","exportName":"FieldPolicySuggestionCollection","collectionExportName":"FieldPolicySuggestionCollectionCollection","schema":{"tableName":"_smrt_field_policy_suggestions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_policy_suggestions\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'promote',\\n \\"proposed_value\\" TEXT,\\n \\"evidence\\" TEXT,\\n \\"status\\" TEXT NOT NULL DEFAULT 'pending',\\n \\"active_key\\" TEXT NOT NULL,\\n \\"cooldown_until\\" TIMESTAMP,\\n \\"decided_by\\" UUID,\\n \\"decided_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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"promote"},"proposed_value":{"type":"TEXT","notNull":false,"unique":false},"evidence":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"pending"},"active_key":{"type":"TEXT","notNull":true,"unique":false},"cooldown_until":{"type":"TIMESTAMP","notNull":false,"unique":false},"decided_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"decided_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policy_suggestions_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","kind","active_key"],"unique":true},{"name":"_smrt_field_policy_suggestions_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policy_suggestions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policy_suggestions_decided_by_idx","columns":["decided_by"]}],"version":"1bc8c6e5"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageCounterCollection":{"name":"fieldusagecountercollection","className":"FieldUsageCounterCollection","qualifiedName":"@happyvertical/smrt-fields:FieldUsageCounterCollection","collection":"fieldusagecounters","description":"Collection surface for FieldUsageCounter plus the batched usage ingestion action (#2051).","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldUsageCounterCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"reportUsage":{"name":"reportUsage","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["FieldUsageReportEntry[]"]}],"returnType":"Promise<FieldUsageReportResult>","isStatic":false,"isPublic":true},"listWindow":{"name":"listWindow","async":true,"parameters":[{"name":"options","type":"object","optional":false,"memberTypes":["string","string | null"]}],"returnType":"Promise<FieldUsageCounter[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["object_ref","field_name","tenant_id","period"],"api":{"include":["reportUsage"],"principalContext":true,"routes":{"reportUsage":{"scope":"collection","method":"POST","path":"report"}}},"cli":false,"mcp":false,"tableName":"_smrt_field_usage_counters"},"extends":"SmrtCollection","extendsTypeArg":"FieldUsageCounter","exportName":"FieldUsageCounterCollection","collectionExportName":"FieldUsageCounterCollectionCollection","schema":{"tableName":"_smrt_field_usage_counters","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_counters\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"period\\" TEXT NOT NULL DEFAULT '',\\n \\"submission_count\\" INTEGER,\\n \\"set_count\\" INTEGER,\\n \\"distinct_user_count\\" INTEGER,\\n \\"distinct_user_ids\\" TEXT,\\n \\"distinct_users_overflowed\\" BOOLEAN,\\n \\"value_histogram\\" TEXT,\\n \\"value_histogram_overflowed\\" BOOLEAN\\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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""},"submission_count":{"type":"INTEGER","notNull":false,"unique":false},"set_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_ids":{"type":"TEXT","notNull":false,"unique":false},"distinct_users_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false},"value_histogram":{"type":"TEXT","notNull":false,"unique":false},"value_histogram_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_usage_counters_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","period"],"unique":true},{"name":"_smrt_field_usage_counters_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_counters_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"46fcebc6"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageReportReceiptCollection":{"name":"fieldusagereportreceiptcollection","className":"FieldUsageReportReceiptCollection","qualifiedName":"@happyvertical/smrt-fields:FieldUsageReportReceiptCollection","collection":"fieldusagereportreceipts","description":"Internal only \u2014 this table has no generated surface.","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldUsageCounterCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"claim":{"name":"claim","async":true,"parameters":[{"name":"options","type":"object","optional":false,"memberTypes":["string"]}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["tenant_id","user_id","object_ref","field_name","period"],"api":false,"cli":false,"mcp":false,"tableName":"_smrt_field_usage_report_receipts"},"extends":"SmrtCollection","extendsTypeArg":"FieldUsageReportReceipt","exportName":"FieldUsageReportReceiptCollection","collectionExportName":"FieldUsageReportReceiptCollectionCollection","schema":{"tableName":"_smrt_field_usage_report_receipts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_report_receipts\\" (\\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 \\"user_id\\" UUID,\\n \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"period\\" TEXT NOT NULL 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},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""}},"indexes":[{"name":"_smrt_field_usage_report_receipts_tenant_id_user_id_idx","columns":["tenant_id","user_id","object_ref","field_name","period"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_field_usage_report_receipts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_report_receipts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_usage_report_receipts_user_id_idx","columns":["user_id"]}],"version":"c3119047"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicy":{"name":"fieldpolicy","className":"FieldPolicy","qualifiedName":"@happyvertical/smrt-fields:FieldPolicy","collection":"fieldpolicies","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldPolicy.ts","packageName":"@happyvertical/smrt-fields","fields":{"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"scopeType":{"type":"text","required":true,"default":"app","_meta":{"required":true},"enum":["app","tenant","user"]},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true}}},"userId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User","_meta":{"nullable":true}},"scopeKey":{"type":"text","required":true,"_meta":{"required":true}},"defaultValue":{"type":"text","required":false,"description":"The value a new record starts with for this field.","_meta":{"nullable":true,"description":"The value a new record starts with for this field."}},"visibility":{"type":"text","required":false,"description":"Whether the field is always shown, tucked under advanced, or hidden.","_meta":{"nullable":true,"description":"Whether the field is always shown, tucked under advanced, or hidden."},"enum":["basic","advanced","hidden"]},"help":{"type":"text","required":false,"description":"The hint shown beside the field on the form.","_meta":{"nullable":true,"description":"The hint shown beside the field on the form."}},"label":{"type":"text","required":false,"description":"The name people see for the field on forms.","_meta":{"nullable":true,"description":"The name people see for the field on forms."}},"displayOrder":{"type":"integer","required":false,"description":"Where the field appears on the form; lower numbers come first.","_meta":{"nullable":true,"description":"Where the field appears on the form; lower numbers come first."}},"locked":{"type":"boolean","required":false,"description":"Stops individual people from changing this field for themselves.","_meta":{"nullable":true,"description":"Stops individual people from changing this field for themselves."}},"updatedBy":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User","_meta":{"nullable":true}}},"methods":{"getDefaultValue":{"name":"getDefaultValue","async":false,"parameters":[],"returnType":"unknown","isStatic":false,"isPublic":true},"setDefaultValue":{"name":"setDefaultValue","async":false,"parameters":[{"name":"value","type":"unknown","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_policies","conflictColumns":["object_ref","field_name","scope_type","scope_key"],"api":{"include":["create","update","delete"],"principalContext":true},"cli":{"include":["create","update","delete"],"exclude":["getDefaultValue","setDefaultValue"]},"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldPolicy","collectionExportName":"FieldPolicyCollection","displayLabelField":"label","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"scopeType","rule":"required","fieldType":"text"},{"field":"scopeKey","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_policies","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"scope_type\\" TEXT NOT NULL DEFAULT 'app',\\n \\"tenant_id\\" UUID,\\n \\"user_id\\" UUID,\\n \\"scope_key\\" TEXT NOT NULL,\\n \\"default_value\\" TEXT,\\n \\"visibility\\" TEXT,\\n \\"help\\" TEXT,\\n \\"label\\" TEXT,\\n \\"display_order\\" INTEGER,\\n \\"locked\\" BOOLEAN,\\n \\"updated_by\\" 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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"scope_type":{"type":"TEXT","notNull":true,"unique":false,"default":"app"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"scope_key":{"type":"TEXT","notNull":true,"unique":false},"default_value":{"type":"TEXT","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false},"help":{"type":"TEXT","notNull":false,"unique":false},"label":{"type":"TEXT","notNull":false,"unique":false},"display_order":{"type":"INTEGER","notNull":false,"unique":false},"locked":{"type":"BOOLEAN","notNull":false,"unique":false},"updated_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policies_object_ref_field_name_idx","columns":["object_ref","field_name","scope_type","scope_key"],"unique":true},{"name":"_smrt_field_policies_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policies_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policies_user_id_idx","columns":["user_id"]},{"name":"_smrt_field_policies_updated_by_idx","columns":["updated_by"]}],"version":"34b355cc"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicySuggestion":{"name":"fieldpolicysuggestion","className":"FieldPolicySuggestion","qualifiedName":"@happyvertical/smrt-fields:FieldPolicySuggestion","collection":"fieldpolicysuggestions","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldPolicySuggestion.ts","packageName":"@happyvertical/smrt-fields","fields":{"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false}}},"kind":{"type":"text","required":true,"default":"promote","_meta":{"required":true},"enum":["promote","default"]},"proposedValue":{"type":"text","required":false,"_meta":{"nullable":true}},"evidence":{"type":"text","required":false,"_meta":{}},"status":{"type":"text","required":true,"default":"pending","_meta":{"required":true},"enum":["pending","accepted","dismissed"]},"activeKey":{"type":"text","required":true,"_meta":{"required":true}},"cooldownUntil":{"type":"datetime","required":false,"_meta":{"nullable":true}},"decidedBy":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User","_meta":{"nullable":true}},"decidedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}}},"methods":{"getEvidence":{"name":"getEvidence","async":false,"parameters":[],"returnType":"Record<string, unknown>","isStatic":false,"isPublic":true},"setEvidence":{"name":"setEvidence","async":false,"parameters":[{"name":"evidence","type":"Record<string, unknown>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getProposedValue":{"name":"getProposedValue","async":false,"parameters":[],"returnType":"unknown","isStatic":false,"isPublic":true},"toSuggestionData":{"name":"toSuggestionData","async":false,"parameters":[],"returnType":"FieldPolicySuggestionData","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_policy_suggestions","conflictColumns":["object_ref","field_name","tenant_id","kind","active_key"],"api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldPolicySuggestion","collectionExportName":"FieldPolicySuggestionCollection","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"kind","rule":"required","fieldType":"text"},{"field":"status","rule":"required","fieldType":"text"},{"field":"activeKey","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_policy_suggestions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_policy_suggestions\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'promote',\\n \\"proposed_value\\" TEXT,\\n \\"evidence\\" TEXT,\\n \\"status\\" TEXT NOT NULL DEFAULT 'pending',\\n \\"active_key\\" TEXT NOT NULL,\\n \\"cooldown_until\\" TIMESTAMP,\\n \\"decided_by\\" UUID,\\n \\"decided_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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"promote"},"proposed_value":{"type":"TEXT","notNull":false,"unique":false},"evidence":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"pending"},"active_key":{"type":"TEXT","notNull":true,"unique":false},"cooldown_until":{"type":"TIMESTAMP","notNull":false,"unique":false},"decided_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"decided_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policy_suggestions_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","kind","active_key"],"unique":true},{"name":"_smrt_field_policy_suggestions_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policy_suggestions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policy_suggestions_decided_by_idx","columns":["decided_by"]}],"version":"1bc8c6e5"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageCounter":{"name":"fieldusagecounter","className":"FieldUsageCounter","qualifiedName":"@happyvertical/smrt-fields:FieldUsageCounter","collection":"fieldusagecounters","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldUsageCounter.ts","packageName":"@happyvertical/smrt-fields","fields":{"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false}}},"period":{"type":"text","required":true,"default":"","_meta":{"required":true}},"submissionCount":{"type":"integer","required":false,"_meta":{}},"setCount":{"type":"integer","required":false,"_meta":{}},"distinctUserCount":{"type":"integer","required":false,"_meta":{}},"distinctUserIds":{"type":"text","required":false,"_meta":{}},"distinctUsersOverflowed":{"type":"boolean","required":false,"_meta":{}},"valueHistogram":{"type":"text","required":false,"_meta":{"nullable":true}},"valueHistogramOverflowed":{"type":"boolean","required":false,"_meta":{}}},"methods":{"getDistinctUserIds":{"name":"getDistinctUserIds","async":false,"parameters":[],"returnType":"string[]","isStatic":false,"isPublic":true},"addDistinctUser":{"name":"addDistinctUser","async":false,"parameters":[{"name":"userId","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getValueHistogram":{"name":"getValueHistogram","async":false,"parameters":[],"returnType":"Record<string, number>","isStatic":false,"isPublic":true},"recordHistogramSample":{"name":"recordHistogramSample","async":false,"parameters":[{"name":"key","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"isLegacyBucket":{"name":"isLegacyBucket","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_usage_counters","conflictColumns":["object_ref","field_name","tenant_id","period"],"api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldUsageCounter","collectionExportName":"FieldUsageCounterCollection","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"period","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_usage_counters","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_counters\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"period\\" TEXT NOT NULL DEFAULT '',\\n \\"submission_count\\" INTEGER,\\n \\"set_count\\" INTEGER,\\n \\"distinct_user_count\\" INTEGER,\\n \\"distinct_user_ids\\" TEXT,\\n \\"distinct_users_overflowed\\" BOOLEAN,\\n \\"value_histogram\\" TEXT,\\n \\"value_histogram_overflowed\\" BOOLEAN\\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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""},"submission_count":{"type":"INTEGER","notNull":false,"unique":false},"set_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_ids":{"type":"TEXT","notNull":false,"unique":false},"distinct_users_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false},"value_histogram":{"type":"TEXT","notNull":false,"unique":false},"value_histogram_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_usage_counters_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","period"],"unique":true},{"name":"_smrt_field_usage_counters_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_counters_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"46fcebc6"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageReportReceipt":{"name":"fieldusagereportreceipt","className":"FieldUsageReportReceipt","qualifiedName":"@happyvertical/smrt-fields:FieldUsageReportReceipt","collection":"fieldusagereportreceipts","description":"Durable daily receipt for one member's contribution to one field.","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldUsageReportReceipt.ts","packageName":"@happyvertical/smrt-fields","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false}}},"userId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User"},"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"period":{"type":"text","required":true,"default":"","_meta":{"required":true}}},"methods":{},"decoratorConfig":{"tableName":"_smrt_field_usage_report_receipts","conflictColumns":["tenant_id","user_id","object_ref","field_name","period"],"api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldUsageReportReceipt","collectionExportName":"FieldUsageReportReceiptCollection","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"period","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_usage_report_receipts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_report_receipts\\" (\\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 \\"user_id\\" UUID,\\n \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"period\\" TEXT NOT NULL 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},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""}},"indexes":[{"name":"_smrt_field_usage_report_receipts_tenant_id_user_id_idx","columns":["tenant_id","user_id","object_ref","field_name","period"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_field_usage_report_receipts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_report_receipts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_usage_report_receipts_user_id_idx","columns":["user_id"]}],"version":"c3119047"},"importPath":"@happyvertical/smrt-fields"}},"moduleType":"smrt","recipes":[{"id":"fields.form-customization","className":"FormCustomizationRecipe","label":"Form customization","summary":"Choose what your forms ask for: defaults, labels, hints and which fields are shown.","synonyms":["form defaults","field defaults","customize forms","hide fields","field visibility","field labels"],"models":["@happyvertical/smrt-fields:FieldPolicy","@happyvertical/smrt-fields:FieldPolicySuggestion","@happyvertical/smrt-fields:FieldUsageCounter","@happyvertical/smrt-fields:FieldUsageReportReceipt"],"nav":[],"requires":[],"help":{"markdown":"## Overview\\n\\nForm customization lets you decide what the forms in your app ask for. For any\\nfield you can change the name people see, the hint beside it, the value a new\\nrecord starts with, where it sits on the form, and whether it is always shown,\\ntucked under \\"advanced\\", or hidden. You can also lock a field so that people\\ncannot change it for themselves.\\n\\nChanges layer. The app starts with sensible settings, your organization can\\nchange them for everyone in it, and each person can then adjust their own view\\nunless you locked the field. Resetting a field removes your change and brings\\nback whatever sits underneath.\\n\\n## Tasks\\n\\n### Change what a field is called\\n\\n1. Open **Form defaults** from your settings and find the form you want.\\n2. Choose the field and type a new **{field:label}**.\\n3. Save. The new name appears on the form.\\n\\n### Give people a hint\\n\\n1. Choose the field in **Form defaults**.\\n2. Write the **{field:help}**, one short sentence that says what to enter.\\n3. Save. The hint now shows beside the field.\\n\\n### Pre-fill a value\\n\\n1. Choose the field in **Form defaults**.\\n2. Enter the **{field:defaultValue}** a new record should start with.\\n3. Save. People can still type over it unless the field is locked.\\n\\n### Tidy a long form\\n\\n1. Choose a field that most people never need.\\n2. Set its **{field:visibility}** to advanced to tuck it away, or to hidden to\\n remove it.\\n3. Save. A field that must always be filled in stays shown unless it also has a\\n default value.\\n\\n### Put fields in a better order\\n\\n1. Choose a field.\\n2. Set its **{field:displayOrder}**. Lower numbers come first.\\n3. Save, then check the form.\\n\\n### Keep everyone on the same setting\\n\\n1. Choose the field in **Form defaults**.\\n2. Turn on **{field:locked}**.\\n3. Save. People can no longer change that field for themselves.\\n\\n### Undo a change\\n\\nChoose **Reset** on a field to remove your change. Settings from the layers\\nbelow, such as the app's own, come back. Resetting asks you to confirm first.\\n\\n### Review suggestions\\n\\nWhen enough people fill in the same value, or keep opening the same advanced\\nfield, the app suggests a change. Open the suggestions list in **Form defaults**\\nand accept or dismiss each one. Nothing changes until you accept.\\n","fieldRefs":["defaultValue","displayOrder","help","label","locked","visibility"]},"surfaces":[{"kind":"settings-panel","export":"@happyvertical/smrt-fields/svelte#FieldPolicyControlPanel","label":"Form defaults"}],"runtime":"server","demo":{"mode":"server","reasons":["The recipe declares runtime \\"server\\".","Needs a server because its package does not build for a browser: imports core utils/import-workspace-module (node:url, node:fs, node:path); and its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3617, #3618, #3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy","@happyvertical/smrt-users"],"browser":{"status":"server-only","issues":["#3617","#3618","#3624","#3626"],"reason":"imports core utils/import-workspace-module (node:url, node:fs, node:path)","via":["@happyvertical/smrt-profiles","@happyvertical/smrt-tenancy","@happyvertical/smrt-users"]},"stampsConstructors":true}`));
8
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-fields","packageVersion":"0.57.21","objects":{"@happyvertical/smrt-fields:FieldUsageLearningAgent":{"name":"fieldusagelearningagent","className":"FieldUsageLearningAgent","qualifiedName":"@happyvertical/smrt-fields:FieldUsageLearningAgent","collection":"fieldusagelearningagents","description":"The registered schedule target for the #2051 learning loop (see the module doc for why it is NOT an smrt-agents Agent subclass).","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/usage-learning.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"runUsageMaintenance":{"name":"runUsageMaintenance","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true}],"returnType":"Promise<FieldUsageMaintenanceSummary>","isStatic":false,"isPublic":true},"runSuggestionGeneration":{"name":"runSuggestionGeneration","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true}],"returnType":"Promise<FieldUsageSuggestionRunSummary>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_usage_learning_agents","api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldUsageLearningAgent","collectionExportName":"FieldUsageLearningAgentCollection","schema":{"tableName":"_smrt_field_usage_learning_agents","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_learning_agents\\" (\\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);","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"}},"indexes":[{"name":"_smrt_field_usage_learning_agents_slug_context_idx","columns":["slug","context"],"unique":true},{"name":"_smrt_field_usage_learning_agents_created_at_idx","columns":["created_at"]}],"version":"183ee1d8"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicyCollection":{"name":"fieldpolicycollection","className":"FieldPolicyCollection","qualifiedName":"@happyvertical/smrt-fields:FieldPolicyCollection","collection":"fieldpolicies","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldPolicyCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"policyAudit":{"name":"policyAudit","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string[]","boolean"]}],"returnType":"Promise<FieldPolicyAuditSnapshot>","isStatic":false,"isPublic":true},"getAppRows":{"name":"getAppRows","async":true,"parameters":[{"name":"objectRef","type":"string","optional":false}],"returnType":"Promise<Map<string, FieldPolicy>>","isStatic":false,"isPublic":true},"getTenantRows":{"name":"getTenantRows","async":true,"parameters":[{"name":"objectRef","type":"string","optional":false},{"name":"tenantIds","type":"string[]","optional":false}],"returnType":"Promise<Map<string, Map<string, FieldPolicy>>>","isStatic":false,"isPublic":true},"getUserRows":{"name":"getUserRows","async":true,"parameters":[{"name":"objectRef","type":"string","optional":false},{"name":"userId","type":"string","optional":false}],"returnType":"Promise<Map<string, FieldPolicy>>","isStatic":false,"isPublic":true},"resolveBatch":{"name":"resolveBatch","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string[]"]}],"returnType":"Promise<FieldPolicyBatchResult>","isStatic":false,"isPublic":true},"getEditorState":{"name":"getEditorState","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<FieldPolicyEditorStateResult>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["object_ref","field_name","scope_type","scope_key"],"api":{"include":["create","update","delete","resolveBatch","getEditorState","policyAudit"],"principalContext":true,"routes":{"resolveBatch":{"scope":"collection","method":"POST","path":"resolve"},"getEditorState":{"scope":"collection","method":"POST","path":"editor-state"},"policyAudit":{"scope":"collection","method":"POST","path":"policy-audit"}}},"cli":false,"mcp":false,"tableName":"_smrt_field_policies"},"extends":"SmrtCollection","extendsTypeArg":"FieldPolicy","exportName":"FieldPolicyCollection","collectionExportName":"FieldPolicyCollectionCollection","schema":{"tableName":"_smrt_field_policies","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"scope_type\\" TEXT NOT NULL DEFAULT 'app',\\n \\"tenant_id\\" UUID,\\n \\"user_id\\" UUID,\\n \\"scope_key\\" TEXT NOT NULL,\\n \\"default_value\\" TEXT,\\n \\"visibility\\" TEXT,\\n \\"help\\" TEXT,\\n \\"label\\" TEXT,\\n \\"display_order\\" INTEGER,\\n \\"locked\\" BOOLEAN,\\n \\"updated_by\\" 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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"scope_type":{"type":"TEXT","notNull":true,"unique":false,"default":"app"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"scope_key":{"type":"TEXT","notNull":true,"unique":false},"default_value":{"type":"TEXT","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false},"help":{"type":"TEXT","notNull":false,"unique":false},"label":{"type":"TEXT","notNull":false,"unique":false},"display_order":{"type":"INTEGER","notNull":false,"unique":false},"locked":{"type":"BOOLEAN","notNull":false,"unique":false},"updated_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policies_object_ref_field_name_idx","columns":["object_ref","field_name","scope_type","scope_key"],"unique":true},{"name":"_smrt_field_policies_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policies_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policies_user_id_idx","columns":["user_id"]},{"name":"_smrt_field_policies_updated_by_idx","columns":["updated_by"]}],"version":"34b355cc"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicySuggestionCollection":{"name":"fieldpolicysuggestioncollection","className":"FieldPolicySuggestionCollection","qualifiedName":"@happyvertical/smrt-fields:FieldPolicySuggestionCollection","collection":"fieldpolicysuggestions","description":"Collection surface for FieldPolicySuggestion plus the three manage-gated actions the gear badge / control-panel queue consume (#2051; UI integration is #2050-follow-up territory \u2014 this is the minimal\u2026","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldPolicySuggestionCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"pendingSuggestions":{"name":"pendingSuggestions","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string[]"]}],"returnType":"Promise<PendingFieldPolicySuggestionsResult>","isStatic":false,"isPublic":true},"acceptSuggestion":{"name":"acceptSuggestion","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<AcceptFieldPolicySuggestionResult>","isStatic":false,"isPublic":true},"dismissSuggestion":{"name":"dismissSuggestion","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["string","number"]}],"returnType":"Promise<DismissFieldPolicySuggestionResult>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["object_ref","field_name","tenant_id","kind","active_key"],"api":{"include":["pendingSuggestions","acceptSuggestion","dismissSuggestion"],"principalContext":true,"routes":{"pendingSuggestions":{"scope":"collection","method":"POST","path":"pending"},"acceptSuggestion":{"scope":"collection","method":"POST","path":"accept"},"dismissSuggestion":{"scope":"collection","method":"POST","path":"dismiss"}}},"cli":false,"mcp":false,"tableName":"_smrt_field_policy_suggestions"},"extends":"SmrtCollection","extendsTypeArg":"FieldPolicySuggestion","exportName":"FieldPolicySuggestionCollection","collectionExportName":"FieldPolicySuggestionCollectionCollection","schema":{"tableName":"_smrt_field_policy_suggestions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_policy_suggestions\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'promote',\\n \\"proposed_value\\" TEXT,\\n \\"evidence\\" TEXT,\\n \\"status\\" TEXT NOT NULL DEFAULT 'pending',\\n \\"active_key\\" TEXT NOT NULL,\\n \\"cooldown_until\\" TIMESTAMP,\\n \\"decided_by\\" UUID,\\n \\"decided_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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"promote"},"proposed_value":{"type":"TEXT","notNull":false,"unique":false},"evidence":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"pending"},"active_key":{"type":"TEXT","notNull":true,"unique":false},"cooldown_until":{"type":"TIMESTAMP","notNull":false,"unique":false},"decided_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"decided_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policy_suggestions_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","kind","active_key"],"unique":true},{"name":"_smrt_field_policy_suggestions_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policy_suggestions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policy_suggestions_decided_by_idx","columns":["decided_by"]}],"version":"1bc8c6e5"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageCounterCollection":{"name":"fieldusagecountercollection","className":"FieldUsageCounterCollection","qualifiedName":"@happyvertical/smrt-fields:FieldUsageCounterCollection","collection":"fieldusagecounters","description":"Collection surface for FieldUsageCounter plus the batched usage ingestion action (#2051).","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldUsageCounterCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"reportUsage":{"name":"reportUsage","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["FieldUsageReportEntry[]"]}],"returnType":"Promise<FieldUsageReportResult>","isStatic":false,"isPublic":true},"listWindow":{"name":"listWindow","async":true,"parameters":[{"name":"options","type":"object","optional":false,"memberTypes":["string","string | null"]}],"returnType":"Promise<FieldUsageCounter[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["object_ref","field_name","tenant_id","period"],"api":{"include":["reportUsage"],"principalContext":true,"routes":{"reportUsage":{"scope":"collection","method":"POST","path":"report"}}},"cli":false,"mcp":false,"tableName":"_smrt_field_usage_counters"},"extends":"SmrtCollection","extendsTypeArg":"FieldUsageCounter","exportName":"FieldUsageCounterCollection","collectionExportName":"FieldUsageCounterCollectionCollection","schema":{"tableName":"_smrt_field_usage_counters","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_counters\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"period\\" TEXT NOT NULL DEFAULT '',\\n \\"submission_count\\" INTEGER,\\n \\"set_count\\" INTEGER,\\n \\"distinct_user_count\\" INTEGER,\\n \\"distinct_user_ids\\" TEXT,\\n \\"distinct_users_overflowed\\" BOOLEAN,\\n \\"value_histogram\\" TEXT,\\n \\"value_histogram_overflowed\\" BOOLEAN\\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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""},"submission_count":{"type":"INTEGER","notNull":false,"unique":false},"set_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_ids":{"type":"TEXT","notNull":false,"unique":false},"distinct_users_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false},"value_histogram":{"type":"TEXT","notNull":false,"unique":false},"value_histogram_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_usage_counters_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","period"],"unique":true},{"name":"_smrt_field_usage_counters_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_counters_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"46fcebc6"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageReportReceiptCollection":{"name":"fieldusagereportreceiptcollection","className":"FieldUsageReportReceiptCollection","qualifiedName":"@happyvertical/smrt-fields:FieldUsageReportReceiptCollection","collection":"fieldusagereportreceipts","description":"Internal only \u2014 this table has no generated surface.","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/collections/FieldUsageCounterCollection.ts","packageName":"@happyvertical/smrt-fields","fields":{},"methods":{"claim":{"name":"claim","async":true,"parameters":[{"name":"options","type":"object","optional":false,"memberTypes":["string"]}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["tenant_id","user_id","object_ref","field_name","period"],"api":false,"cli":false,"mcp":false,"tableName":"_smrt_field_usage_report_receipts"},"extends":"SmrtCollection","extendsTypeArg":"FieldUsageReportReceipt","exportName":"FieldUsageReportReceiptCollection","collectionExportName":"FieldUsageReportReceiptCollectionCollection","schema":{"tableName":"_smrt_field_usage_report_receipts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_report_receipts\\" (\\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 \\"user_id\\" UUID,\\n \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"period\\" TEXT NOT NULL 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},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""}},"indexes":[{"name":"_smrt_field_usage_report_receipts_tenant_id_user_id_idx","columns":["tenant_id","user_id","object_ref","field_name","period"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_field_usage_report_receipts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_report_receipts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_usage_report_receipts_user_id_idx","columns":["user_id"]}],"version":"c3119047"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicy":{"name":"fieldpolicy","className":"FieldPolicy","qualifiedName":"@happyvertical/smrt-fields:FieldPolicy","collection":"fieldpolicies","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldPolicy.ts","packageName":"@happyvertical/smrt-fields","fields":{"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"scopeType":{"type":"text","required":true,"default":"app","_meta":{"required":true},"enum":["app","tenant","user"]},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true}}},"userId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User","_meta":{"nullable":true}},"scopeKey":{"type":"text","required":true,"_meta":{"required":true}},"defaultValue":{"type":"text","required":false,"description":"The value a new record starts with for this field.","_meta":{"nullable":true,"description":"The value a new record starts with for this field."}},"visibility":{"type":"text","required":false,"description":"Whether the field is always shown, tucked under advanced, or hidden.","_meta":{"nullable":true,"description":"Whether the field is always shown, tucked under advanced, or hidden."},"enum":["basic","advanced","hidden"]},"help":{"type":"text","required":false,"description":"The hint shown beside the field on the form.","_meta":{"nullable":true,"description":"The hint shown beside the field on the form."}},"label":{"type":"text","required":false,"description":"The name people see for the field on forms.","_meta":{"nullable":true,"description":"The name people see for the field on forms."}},"displayOrder":{"type":"integer","required":false,"description":"Where the field appears on the form; lower numbers come first.","_meta":{"nullable":true,"description":"Where the field appears on the form; lower numbers come first."}},"locked":{"type":"boolean","required":false,"description":"Stops individual people from changing this field for themselves.","_meta":{"nullable":true,"description":"Stops individual people from changing this field for themselves."}},"updatedBy":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User","_meta":{"nullable":true}}},"methods":{"getDefaultValue":{"name":"getDefaultValue","async":false,"parameters":[],"returnType":"unknown","isStatic":false,"isPublic":true},"setDefaultValue":{"name":"setDefaultValue","async":false,"parameters":[{"name":"value","type":"unknown","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_policies","conflictColumns":["object_ref","field_name","scope_type","scope_key"],"api":{"include":["create","update","delete"],"principalContext":true},"cli":{"include":["create","update","delete"],"exclude":["getDefaultValue","setDefaultValue"]},"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldPolicy","collectionExportName":"FieldPolicyCollection","displayLabelField":"label","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"scopeType","rule":"required","fieldType":"text"},{"field":"scopeKey","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_policies","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"scope_type\\" TEXT NOT NULL DEFAULT 'app',\\n \\"tenant_id\\" UUID,\\n \\"user_id\\" UUID,\\n \\"scope_key\\" TEXT NOT NULL,\\n \\"default_value\\" TEXT,\\n \\"visibility\\" TEXT,\\n \\"help\\" TEXT,\\n \\"label\\" TEXT,\\n \\"display_order\\" INTEGER,\\n \\"locked\\" BOOLEAN,\\n \\"updated_by\\" 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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"scope_type":{"type":"TEXT","notNull":true,"unique":false,"default":"app"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"scope_key":{"type":"TEXT","notNull":true,"unique":false},"default_value":{"type":"TEXT","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false},"help":{"type":"TEXT","notNull":false,"unique":false},"label":{"type":"TEXT","notNull":false,"unique":false},"display_order":{"type":"INTEGER","notNull":false,"unique":false},"locked":{"type":"BOOLEAN","notNull":false,"unique":false},"updated_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policies_object_ref_field_name_idx","columns":["object_ref","field_name","scope_type","scope_key"],"unique":true},{"name":"_smrt_field_policies_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policies_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policies_user_id_idx","columns":["user_id"]},{"name":"_smrt_field_policies_updated_by_idx","columns":["updated_by"]}],"version":"34b355cc"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldPolicySuggestion":{"name":"fieldpolicysuggestion","className":"FieldPolicySuggestion","qualifiedName":"@happyvertical/smrt-fields:FieldPolicySuggestion","collection":"fieldpolicysuggestions","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldPolicySuggestion.ts","packageName":"@happyvertical/smrt-fields","fields":{"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false}}},"kind":{"type":"text","required":true,"default":"promote","_meta":{"required":true},"enum":["promote","default"]},"proposedValue":{"type":"text","required":false,"_meta":{"nullable":true}},"evidence":{"type":"text","required":false,"_meta":{}},"status":{"type":"text","required":true,"default":"pending","_meta":{"required":true},"enum":["pending","accepted","dismissed"]},"activeKey":{"type":"text","required":true,"_meta":{"required":true}},"cooldownUntil":{"type":"datetime","required":false,"_meta":{"nullable":true}},"decidedBy":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User","_meta":{"nullable":true}},"decidedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}}},"methods":{"getEvidence":{"name":"getEvidence","async":false,"parameters":[],"returnType":"Record<string, unknown>","isStatic":false,"isPublic":true},"setEvidence":{"name":"setEvidence","async":false,"parameters":[{"name":"evidence","type":"Record<string, unknown>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getProposedValue":{"name":"getProposedValue","async":false,"parameters":[],"returnType":"unknown","isStatic":false,"isPublic":true},"toSuggestionData":{"name":"toSuggestionData","async":false,"parameters":[],"returnType":"FieldPolicySuggestionData","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_policy_suggestions","conflictColumns":["object_ref","field_name","tenant_id","kind","active_key"],"api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldPolicySuggestion","collectionExportName":"FieldPolicySuggestionCollection","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"kind","rule":"required","fieldType":"text"},{"field":"status","rule":"required","fieldType":"text"},{"field":"activeKey","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_policy_suggestions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_policy_suggestions\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'promote',\\n \\"proposed_value\\" TEXT,\\n \\"evidence\\" TEXT,\\n \\"status\\" TEXT NOT NULL DEFAULT 'pending',\\n \\"active_key\\" TEXT NOT NULL,\\n \\"cooldown_until\\" TIMESTAMP,\\n \\"decided_by\\" UUID,\\n \\"decided_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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"promote"},"proposed_value":{"type":"TEXT","notNull":false,"unique":false},"evidence":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"pending"},"active_key":{"type":"TEXT","notNull":true,"unique":false},"cooldown_until":{"type":"TIMESTAMP","notNull":false,"unique":false},"decided_by":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"decided_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_policy_suggestions_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","kind","active_key"],"unique":true},{"name":"_smrt_field_policy_suggestions_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_policy_suggestions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_policy_suggestions_decided_by_idx","columns":["decided_by"]}],"version":"1bc8c6e5"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageCounter":{"name":"fieldusagecounter","className":"FieldUsageCounter","qualifiedName":"@happyvertical/smrt-fields:FieldUsageCounter","collection":"fieldusagecounters","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldUsageCounter.ts","packageName":"@happyvertical/smrt-fields","fields":{"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false}}},"period":{"type":"text","required":true,"default":"","_meta":{"required":true}},"submissionCount":{"type":"integer","required":false,"_meta":{}},"setCount":{"type":"integer","required":false,"_meta":{}},"distinctUserCount":{"type":"integer","required":false,"_meta":{}},"distinctUserIds":{"type":"text","required":false,"_meta":{}},"distinctUsersOverflowed":{"type":"boolean","required":false,"_meta":{}},"valueHistogram":{"type":"text","required":false,"_meta":{"nullable":true}},"valueHistogramOverflowed":{"type":"boolean","required":false,"_meta":{}}},"methods":{"getDistinctUserIds":{"name":"getDistinctUserIds","async":false,"parameters":[],"returnType":"string[]","isStatic":false,"isPublic":true},"addDistinctUser":{"name":"addDistinctUser","async":false,"parameters":[{"name":"userId","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getValueHistogram":{"name":"getValueHistogram","async":false,"parameters":[],"returnType":"Record<string, number>","isStatic":false,"isPublic":true},"recordHistogramSample":{"name":"recordHistogramSample","async":false,"parameters":[{"name":"key","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"isLegacyBucket":{"name":"isLegacyBucket","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_field_usage_counters","conflictColumns":["object_ref","field_name","tenant_id","period"],"api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldUsageCounter","collectionExportName":"FieldUsageCounterCollection","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"period","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_usage_counters","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_counters\\" (\\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 \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"period\\" TEXT NOT NULL DEFAULT '',\\n \\"submission_count\\" INTEGER,\\n \\"set_count\\" INTEGER,\\n \\"distinct_user_count\\" INTEGER,\\n \\"distinct_user_ids\\" TEXT,\\n \\"distinct_users_overflowed\\" BOOLEAN,\\n \\"value_histogram\\" TEXT,\\n \\"value_histogram_overflowed\\" BOOLEAN\\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"},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""},"submission_count":{"type":"INTEGER","notNull":false,"unique":false},"set_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_count":{"type":"INTEGER","notNull":false,"unique":false},"distinct_user_ids":{"type":"TEXT","notNull":false,"unique":false},"distinct_users_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false},"value_histogram":{"type":"TEXT","notNull":false,"unique":false},"value_histogram_overflowed":{"type":"BOOLEAN","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_field_usage_counters_object_ref_field_name_idx","columns":["object_ref","field_name","tenant_id","period"],"unique":true},{"name":"_smrt_field_usage_counters_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_counters_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"46fcebc6"},"importPath":"@happyvertical/smrt-fields"},"@happyvertical/smrt-fields:FieldUsageReportReceipt":{"name":"fieldusagereportreceipt","className":"FieldUsageReportReceipt","qualifiedName":"@happyvertical/smrt-fields:FieldUsageReportReceipt","collection":"fieldusagereportreceipts","description":"Durable daily receipt for one member's contribution to one field.","filePath":"/home/runner/work/smrt/smrt/packages/fields/src/models/FieldUsageReportReceipt.ts","packageName":"@happyvertical/smrt-fields","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false}}},"userId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-users:User"},"objectRef":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fieldName":{"type":"text","required":true,"default":"","_meta":{"required":true}},"period":{"type":"text","required":true,"default":"","_meta":{"required":true}}},"methods":{},"decoratorConfig":{"tableName":"_smrt_field_usage_report_receipts","conflictColumns":["tenant_id","user_id","object_ref","field_name","period"],"api":{"include":[]},"cli":false,"mcp":{"include":[]}},"extends":"SmrtObject","exportName":"FieldUsageReportReceipt","collectionExportName":"FieldUsageReportReceiptCollection","validationRules":[{"field":"objectRef","rule":"required","fieldType":"text"},{"field":"fieldName","rule":"required","fieldType":"text"},{"field":"period","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_field_usage_report_receipts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_field_usage_report_receipts\\" (\\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 \\"user_id\\" UUID,\\n \\"object_ref\\" TEXT NOT NULL DEFAULT '',\\n \\"field_name\\" TEXT NOT NULL DEFAULT '',\\n \\"period\\" TEXT NOT NULL 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},"user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"object_ref":{"type":"TEXT","notNull":true,"unique":false,"default":""},"field_name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"period":{"type":"TEXT","notNull":true,"unique":false,"default":""}},"indexes":[{"name":"_smrt_field_usage_report_receipts_tenant_id_user_id_idx","columns":["tenant_id","user_id","object_ref","field_name","period"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_field_usage_report_receipts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_field_usage_report_receipts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_field_usage_report_receipts_user_id_idx","columns":["user_id"]}],"version":"c3119047"},"importPath":"@happyvertical/smrt-fields"}},"moduleType":"smrt","recipes":[{"id":"fields.form-customization","className":"FormCustomizationRecipe","label":"Form customization","summary":"Choose what your forms ask for: defaults, labels, hints and which fields are shown.","synonyms":["form defaults","field defaults","customize forms","hide fields","field visibility","field labels"],"models":["@happyvertical/smrt-fields:FieldPolicy","@happyvertical/smrt-fields:FieldPolicySuggestion","@happyvertical/smrt-fields:FieldUsageCounter","@happyvertical/smrt-fields:FieldUsageReportReceipt"],"nav":[],"requires":[],"help":{"markdown":"## Overview\\n\\nForm customization lets you decide what the forms in your app ask for. For any\\nfield you can change the name people see, the hint beside it, the value a new\\nrecord starts with, where it sits on the form, and whether it is always shown,\\ntucked under \\"advanced\\", or hidden. You can also lock a field so that people\\ncannot change it for themselves.\\n\\nChanges layer. The app starts with sensible settings, your organization can\\nchange them for everyone in it, and each person can then adjust their own view\\nunless you locked the field. Resetting a field removes your change and brings\\nback whatever sits underneath.\\n\\n## Tasks\\n\\n### Change what a field is called\\n\\n1. Open **Form defaults** from your settings and find the form you want.\\n2. Choose the field and type a new **{field:label}**.\\n3. Save. The new name appears on the form.\\n\\n### Give people a hint\\n\\n1. Choose the field in **Form defaults**.\\n2. Write the **{field:help}**, one short sentence that says what to enter.\\n3. Save. The hint now shows beside the field.\\n\\n### Pre-fill a value\\n\\n1. Choose the field in **Form defaults**.\\n2. Enter the **{field:defaultValue}** a new record should start with.\\n3. Save. People can still type over it unless the field is locked.\\n\\n### Tidy a long form\\n\\n1. Choose a field that most people never need.\\n2. Set its **{field:visibility}** to advanced to tuck it away, or to hidden to\\n remove it.\\n3. Save. A field that must always be filled in stays shown unless it also has a\\n default value.\\n\\n### Put fields in a better order\\n\\n1. Choose a field.\\n2. Set its **{field:displayOrder}**. Lower numbers come first.\\n3. Save, then check the form.\\n\\n### Keep everyone on the same setting\\n\\n1. Choose the field in **Form defaults**.\\n2. Turn on **{field:locked}**.\\n3. Save. People can no longer change that field for themselves.\\n\\n### Undo a change\\n\\nChoose **Reset** on a field to remove your change. Settings from the layers\\nbelow, such as the app's own, come back. Resetting asks you to confirm first.\\n\\n### Review suggestions\\n\\nWhen enough people fill in the same value, or keep opening the same advanced\\nfield, the app suggests a change. Open the suggestions list in **Form defaults**\\nand accept or dismiss each one. Nothing changes until you accept.\\n","fieldRefs":["defaultValue","displayOrder","help","label","locked","visibility"]},"surfaces":[{"kind":"settings-panel","export":"@happyvertical/smrt-fields/svelte#FieldPolicyControlPanel","label":"Form defaults"}],"runtime":"server","demo":{"mode":"server","reasons":["The recipe declares runtime \\"server\\".","Needs a server because its package does not build for a browser: imports core utils/import-workspace-module (node:url, node:fs, node:path); and its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3617, #3618, #3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy","@happyvertical/smrt-users"],"browser":{"status":"server-only","issues":["#3617","#3618","#3624","#3626"],"reason":"imports core utils/import-workspace-module (node:url, node:fs, node:path)","via":["@happyvertical/smrt-profiles","@happyvertical/smrt-tenancy","@happyvertical/smrt-users"]},"stampsConstructors":true}`));
9
9
  //#endregion
10
10
  //#region src/deterministic-id.ts
11
11
  async function deterministicFieldsUuid(parts) {