@contractspec/lib.contracts 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (528) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/dist/_virtual/rolldown_runtime.js +37 -0
  4. package/dist/app-config/app-config.feature.d.ts +12 -0
  5. package/dist/app-config/app-config.feature.js +54 -0
  6. package/dist/app-config/branding.d.ts +55 -0
  7. package/dist/app-config/branding.js +0 -0
  8. package/dist/app-config/contracts.d.ts +245 -0
  9. package/dist/app-config/contracts.js +395 -0
  10. package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
  11. package/dist/app-config/docs/app-config.docblock.js +21 -0
  12. package/dist/app-config/events.d.ts +122 -0
  13. package/dist/app-config/events.js +174 -0
  14. package/dist/app-config/index.d.ts +9 -0
  15. package/dist/app-config/index.js +8 -0
  16. package/dist/app-config/lifecycle-contracts.d.ts +273 -0
  17. package/dist/app-config/lifecycle-contracts.js +440 -0
  18. package/dist/app-config/lifecycle.d.ts +27 -0
  19. package/dist/app-config/lifecycle.js +0 -0
  20. package/dist/app-config/runtime.d.ts +120 -0
  21. package/dist/app-config/runtime.js +617 -0
  22. package/dist/app-config/spec.d.ts +173 -0
  23. package/dist/app-config/spec.js +36 -0
  24. package/dist/app-config/validation.d.ts +49 -0
  25. package/dist/app-config/validation.js +538 -0
  26. package/dist/capabilities/capabilities.d.ts +48 -0
  27. package/dist/capabilities/capabilities.js +50 -0
  28. package/dist/capabilities/docs/capabilities.docblock.d.ts +6 -0
  29. package/dist/capabilities/docs/capabilities.docblock.js +21 -0
  30. package/dist/capabilities/index.d.ts +3 -0
  31. package/dist/capabilities/index.js +4 -0
  32. package/dist/capabilities/openbanking.d.ts +10 -0
  33. package/dist/capabilities/openbanking.js +92 -0
  34. package/dist/client/index.d.ts +6 -0
  35. package/dist/client/index.js +9 -0
  36. package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
  37. package/dist/client/react/drivers/rn-reusables.js +21 -0
  38. package/dist/client/react/drivers/shadcn.d.ts +12 -0
  39. package/dist/client/react/drivers/shadcn.js +11 -0
  40. package/dist/client/react/feature-render.d.ts +23 -0
  41. package/dist/client/react/feature-render.js +44 -0
  42. package/dist/client/react/form-render.d.ts +92 -0
  43. package/dist/client/react/form-render.js +298 -0
  44. package/dist/client/react/index.d.ts +5 -0
  45. package/dist/client/react/index.js +8 -0
  46. package/dist/contract-registry/index.d.ts +3 -0
  47. package/dist/contract-registry/index.js +3 -0
  48. package/dist/contract-registry/schemas.d.ts +124 -0
  49. package/dist/contract-registry/schemas.js +61 -0
  50. package/dist/contract-registry/types.d.ts +46 -0
  51. package/dist/contract-registry/types.js +0 -0
  52. package/dist/data-views/data-views.d.ts +5 -0
  53. package/dist/data-views/data-views.js +4 -0
  54. package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
  55. package/dist/data-views/docs/data-views.docblock.js +21 -0
  56. package/dist/data-views/index.d.ts +4 -0
  57. package/dist/data-views/index.js +4 -0
  58. package/dist/data-views/query-generator.d.ts +40 -0
  59. package/dist/data-views/query-generator.js +48 -0
  60. package/dist/data-views/registry.d.ts +51 -0
  61. package/dist/data-views/registry.js +82 -0
  62. package/dist/data-views/runtime.d.ts +28 -0
  63. package/dist/data-views/runtime.js +39 -0
  64. package/dist/data-views/spec.d.ts +32 -0
  65. package/dist/data-views/spec.js +10 -0
  66. package/dist/data-views/types.d.ts +157 -0
  67. package/dist/data-views/types.js +0 -0
  68. package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
  69. package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -0
  70. package/dist/docs/index.d.ts +6 -0
  71. package/dist/docs/index.js +29 -0
  72. package/dist/docs/meta.docs.d.ts +6 -0
  73. package/dist/docs/meta.docs.js +29 -0
  74. package/dist/docs/presentations.d.ts +33 -0
  75. package/dist/docs/presentations.js +64 -0
  76. package/dist/docs/registry.d.ts +23 -0
  77. package/dist/docs/registry.js +51 -0
  78. package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
  79. package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +81 -0
  80. package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
  81. package/dist/docs/tech/contracts/README.docblock.js +21 -0
  82. package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +6 -0
  83. package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -0
  84. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +6 -0
  85. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -0
  86. package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
  87. package/dist/docs/tech/contracts/migrations.docblock.js +21 -0
  88. package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
  89. package/dist/docs/tech/contracts/openapi-export.docblock.js +58 -0
  90. package/dist/docs/tech/contracts/openapi-import.docblock.d.ts +6 -0
  91. package/dist/docs/tech/contracts/openapi-import.docblock.js +65 -0
  92. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.d.ts +6 -0
  93. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +21 -0
  94. package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
  95. package/dist/docs/tech/contracts/overlays.docblock.js +21 -0
  96. package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
  97. package/dist/docs/tech/contracts/tests.docblock.js +21 -0
  98. package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
  99. package/dist/docs/tech/contracts/themes.docblock.js +21 -0
  100. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.d.ts +6 -0
  101. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +21 -0
  102. package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
  103. package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -0
  104. package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
  105. package/dist/docs/tech/llm/llm-integration.docblock.js +358 -0
  106. package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
  107. package/dist/docs/tech/mcp-endpoints.docblock.js +38 -0
  108. package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
  109. package/dist/docs/tech/presentation-runtime.docblock.js +17 -0
  110. package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
  111. package/dist/docs/tech/schema/README.docblock.js +21 -0
  112. package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
  113. package/dist/docs/tech/studio/learning-events.docblock.js +49 -0
  114. package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
  115. package/dist/docs/tech/studio/learning-journeys.docblock.js +80 -0
  116. package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
  117. package/dist/docs/tech/studio/platform-admin-panel.docblock.js +85 -0
  118. package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
  119. package/dist/docs/tech/studio/project-access-teams.docblock.js +46 -0
  120. package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
  121. package/dist/docs/tech/studio/project-routing.docblock.js +68 -0
  122. package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
  123. package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +41 -0
  124. package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
  125. package/dist/docs/tech/studio/team-invitations.docblock.js +70 -0
  126. package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
  127. package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -0
  128. package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
  129. package/dist/docs/tech/studio/workspaces.docblock.js +63 -0
  130. package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
  131. package/dist/docs/tech/telemetry-ingest.docblock.js +156 -0
  132. package/dist/docs/tech/templates/runtime.docblock.d.ts +6 -0
  133. package/dist/docs/tech/templates/runtime.docblock.js +21 -0
  134. package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
  135. package/dist/docs/tech/vscode-extension.docblock.js +102 -0
  136. package/dist/docs/tech-contracts.docs.d.ts +6 -0
  137. package/dist/docs/tech-contracts.docs.js +96 -0
  138. package/dist/docs/types.d.ts +41 -0
  139. package/dist/docs/types.js +0 -0
  140. package/dist/events.d.ts +47 -0
  141. package/dist/events.js +19 -0
  142. package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
  143. package/dist/experiments/docs/experiments.docblock.js +21 -0
  144. package/dist/experiments/evaluator.d.ts +37 -0
  145. package/dist/experiments/evaluator.js +101 -0
  146. package/dist/experiments/spec-resolver.d.ts +17 -0
  147. package/dist/experiments/spec-resolver.js +0 -0
  148. package/dist/experiments/spec.d.ts +82 -0
  149. package/dist/experiments/spec.js +33 -0
  150. package/dist/features/index.d.ts +5 -0
  151. package/dist/features/index.js +5 -0
  152. package/dist/features/install.d.ts +22 -0
  153. package/dist/features/install.js +36 -0
  154. package/dist/features/registry.d.ts +26 -0
  155. package/dist/features/registry.js +49 -0
  156. package/dist/features/types.d.ts +88 -0
  157. package/dist/features/types.js +0 -0
  158. package/dist/features/validation.d.ts +8 -0
  159. package/dist/features/validation.js +14 -0
  160. package/dist/forms/docs/forms.docblock.d.ts +6 -0
  161. package/dist/forms/docs/forms.docblock.js +21 -0
  162. package/dist/forms/forms.d.ts +266 -0
  163. package/dist/forms/forms.js +146 -0
  164. package/dist/forms/index.d.ts +2 -0
  165. package/dist/forms/index.js +3 -0
  166. package/dist/index.d.ts +147 -0
  167. package/dist/index.js +121 -0
  168. package/dist/install.d.ts +77 -0
  169. package/dist/install.js +40 -0
  170. package/dist/integrations/binding.d.ts +17 -0
  171. package/dist/integrations/binding.js +0 -0
  172. package/dist/integrations/connection.d.ts +51 -0
  173. package/dist/integrations/connection.js +0 -0
  174. package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
  175. package/dist/integrations/docs/integrations.docblock.js +94 -0
  176. package/dist/integrations/health.d.ts +21 -0
  177. package/dist/integrations/health.js +69 -0
  178. package/dist/integrations/index.d.ts +34 -0
  179. package/dist/integrations/index.js +23 -0
  180. package/dist/integrations/integrations.feature.d.ts +12 -0
  181. package/dist/integrations/integrations.feature.js +60 -0
  182. package/dist/integrations/openbanking/contracts/accounts.d.ts +289 -0
  183. package/dist/integrations/openbanking/contracts/accounts.js +236 -0
  184. package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
  185. package/dist/integrations/openbanking/contracts/balances.js +166 -0
  186. package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
  187. package/dist/integrations/openbanking/contracts/index.js +12 -0
  188. package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
  189. package/dist/integrations/openbanking/contracts/transactions.js +217 -0
  190. package/dist/integrations/openbanking/guards.d.ts +12 -0
  191. package/dist/integrations/openbanking/guards.js +33 -0
  192. package/dist/integrations/openbanking/models.d.ts +228 -0
  193. package/dist/integrations/openbanking/models.js +240 -0
  194. package/dist/integrations/openbanking/openbanking.feature.d.ts +12 -0
  195. package/dist/integrations/openbanking/openbanking.feature.js +69 -0
  196. package/dist/integrations/openbanking/telemetry.d.ts +15 -0
  197. package/dist/integrations/openbanking/telemetry.js +39 -0
  198. package/dist/integrations/operations.d.ts +437 -0
  199. package/dist/integrations/operations.js +392 -0
  200. package/dist/integrations/providers/calendar.d.ts +78 -0
  201. package/dist/integrations/providers/calendar.js +0 -0
  202. package/dist/integrations/providers/elevenlabs.d.ts +7 -0
  203. package/dist/integrations/providers/elevenlabs.js +55 -0
  204. package/dist/integrations/providers/email.d.ts +86 -0
  205. package/dist/integrations/providers/email.js +0 -0
  206. package/dist/integrations/providers/embedding.d.ts +24 -0
  207. package/dist/integrations/providers/embedding.js +0 -0
  208. package/dist/integrations/providers/gcs-storage.d.ts +7 -0
  209. package/dist/integrations/providers/gcs-storage.js +78 -0
  210. package/dist/integrations/providers/gmail.d.ts +7 -0
  211. package/dist/integrations/providers/gmail.js +90 -0
  212. package/dist/integrations/providers/google-calendar.d.ts +7 -0
  213. package/dist/integrations/providers/google-calendar.js +69 -0
  214. package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
  215. package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -0
  216. package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
  217. package/dist/integrations/providers/impls/gcs-storage.js +88 -0
  218. package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
  219. package/dist/integrations/providers/impls/gmail-inbound.js +200 -0
  220. package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
  221. package/dist/integrations/providers/impls/gmail-outbound.js +105 -0
  222. package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
  223. package/dist/integrations/providers/impls/google-calendar.js +154 -0
  224. package/dist/integrations/providers/impls/index.d.ts +15 -0
  225. package/dist/integrations/providers/impls/index.js +16 -0
  226. package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
  227. package/dist/integrations/providers/impls/mistral-embedding.js +41 -0
  228. package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
  229. package/dist/integrations/providers/impls/mistral-llm.js +247 -0
  230. package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
  231. package/dist/integrations/providers/impls/postmark-email.js +55 -0
  232. package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
  233. package/dist/integrations/providers/impls/powens-client.js +171 -0
  234. package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
  235. package/dist/integrations/providers/impls/powens-openbanking.js +218 -0
  236. package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
  237. package/dist/integrations/providers/impls/provider-factory.js +145 -0
  238. package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
  239. package/dist/integrations/providers/impls/qdrant-vector.js +69 -0
  240. package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
  241. package/dist/integrations/providers/impls/stripe-payments.js +202 -0
  242. package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
  243. package/dist/integrations/providers/impls/twilio-sms.js +58 -0
  244. package/dist/integrations/providers/index.d.ts +22 -0
  245. package/dist/integrations/providers/index.js +13 -0
  246. package/dist/integrations/providers/llm.d.ts +82 -0
  247. package/dist/integrations/providers/llm.js +0 -0
  248. package/dist/integrations/providers/mistral.d.ts +7 -0
  249. package/dist/integrations/providers/mistral.js +71 -0
  250. package/dist/integrations/providers/openbanking.d.ts +128 -0
  251. package/dist/integrations/providers/openbanking.js +0 -0
  252. package/dist/integrations/providers/payments.d.ts +109 -0
  253. package/dist/integrations/providers/payments.js +0 -0
  254. package/dist/integrations/providers/postmark.d.ts +7 -0
  255. package/dist/integrations/providers/postmark.js +71 -0
  256. package/dist/integrations/providers/powens.d.ts +7 -0
  257. package/dist/integrations/providers/powens.js +119 -0
  258. package/dist/integrations/providers/qdrant.d.ts +7 -0
  259. package/dist/integrations/providers/qdrant.js +76 -0
  260. package/dist/integrations/providers/registry.d.ts +11 -0
  261. package/dist/integrations/providers/registry.js +34 -0
  262. package/dist/integrations/providers/sms.d.ts +34 -0
  263. package/dist/integrations/providers/sms.js +0 -0
  264. package/dist/integrations/providers/storage.d.ts +60 -0
  265. package/dist/integrations/providers/storage.js +0 -0
  266. package/dist/integrations/providers/stripe.d.ts +7 -0
  267. package/dist/integrations/providers/stripe.js +86 -0
  268. package/dist/integrations/providers/twilio-sms.d.ts +7 -0
  269. package/dist/integrations/providers/twilio-sms.js +64 -0
  270. package/dist/integrations/providers/vector-store.d.ts +43 -0
  271. package/dist/integrations/providers/vector-store.js +0 -0
  272. package/dist/integrations/providers/voice.d.ts +34 -0
  273. package/dist/integrations/providers/voice.js +0 -0
  274. package/dist/integrations/runtime.d.ts +99 -0
  275. package/dist/integrations/runtime.js +186 -0
  276. package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
  277. package/dist/integrations/secrets/aws-secret-manager.js +231 -0
  278. package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
  279. package/dist/integrations/secrets/env-secret-provider.js +81 -0
  280. package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
  281. package/dist/integrations/secrets/gcp-secret-manager.js +229 -0
  282. package/dist/integrations/secrets/index.d.ts +7 -0
  283. package/dist/integrations/secrets/index.js +8 -0
  284. package/dist/integrations/secrets/manager.d.ts +47 -0
  285. package/dist/integrations/secrets/manager.js +103 -0
  286. package/dist/integrations/secrets/provider.d.ts +52 -0
  287. package/dist/integrations/secrets/provider.js +58 -0
  288. package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
  289. package/dist/integrations/secrets/scaleway-secret-manager.js +247 -0
  290. package/dist/integrations/secrets-types.d.ts +17 -0
  291. package/dist/integrations/secrets-types.js +0 -0
  292. package/dist/integrations/spec.d.ts +75 -0
  293. package/dist/integrations/spec.js +39 -0
  294. package/dist/jobs/define-job.d.ts +18 -0
  295. package/dist/jobs/define-job.js +16 -0
  296. package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
  297. package/dist/jobs/gcp-cloud-tasks.js +53 -0
  298. package/dist/jobs/gcp-pubsub.d.ts +25 -0
  299. package/dist/jobs/gcp-pubsub.js +39 -0
  300. package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
  301. package/dist/jobs/handlers/gmail-sync-handler.js +9 -0
  302. package/dist/jobs/handlers/index.d.ts +9 -0
  303. package/dist/jobs/handlers/index.js +12 -0
  304. package/dist/jobs/handlers/ping-handler.d.ts +10 -0
  305. package/dist/jobs/handlers/ping-handler.js +15 -0
  306. package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
  307. package/dist/jobs/handlers/storage-document-handler.js +14 -0
  308. package/dist/jobs/index.d.ts +3 -0
  309. package/dist/jobs/index.js +4 -0
  310. package/dist/jobs/memory-queue.d.ts +18 -0
  311. package/dist/jobs/memory-queue.js +71 -0
  312. package/dist/jobs/queue.d.ts +131 -0
  313. package/dist/jobs/queue.js +33 -0
  314. package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
  315. package/dist/jobs/scaleway-sqs-queue.js +153 -0
  316. package/dist/jsonschema.d.ts +27 -0
  317. package/dist/jsonschema.js +32 -0
  318. package/dist/knowledge/binding.d.ts +25 -0
  319. package/dist/knowledge/binding.js +0 -0
  320. package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
  321. package/dist/knowledge/docs/knowledge.docblock.js +21 -0
  322. package/dist/knowledge/index.d.ts +11 -0
  323. package/dist/knowledge/index.js +10 -0
  324. package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
  325. package/dist/knowledge/ingestion/document-processor.js +54 -0
  326. package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
  327. package/dist/knowledge/ingestion/embedding-service.js +25 -0
  328. package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
  329. package/dist/knowledge/ingestion/gmail-adapter.js +51 -0
  330. package/dist/knowledge/ingestion/index.d.ts +6 -0
  331. package/dist/knowledge/ingestion/index.js +7 -0
  332. package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
  333. package/dist/knowledge/ingestion/storage-adapter.js +26 -0
  334. package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
  335. package/dist/knowledge/ingestion/vector-indexer.js +32 -0
  336. package/dist/knowledge/knowledge.feature.d.ts +12 -0
  337. package/dist/knowledge/knowledge.feature.js +61 -0
  338. package/dist/knowledge/operations.d.ts +318 -0
  339. package/dist/knowledge/operations.js +321 -0
  340. package/dist/knowledge/query/index.d.ts +2 -0
  341. package/dist/knowledge/query/index.js +3 -0
  342. package/dist/knowledge/query/service.d.ts +29 -0
  343. package/dist/knowledge/query/service.js +65 -0
  344. package/dist/knowledge/runtime.d.ts +32 -0
  345. package/dist/knowledge/runtime.js +49 -0
  346. package/dist/knowledge/source.d.ts +32 -0
  347. package/dist/knowledge/source.js +0 -0
  348. package/dist/knowledge/spaces/email-threads.d.ts +7 -0
  349. package/dist/knowledge/spaces/email-threads.js +37 -0
  350. package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
  351. package/dist/knowledge/spaces/financial-docs.js +37 -0
  352. package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
  353. package/dist/knowledge/spaces/financial-overview.js +41 -0
  354. package/dist/knowledge/spaces/index.d.ts +7 -0
  355. package/dist/knowledge/spaces/index.js +8 -0
  356. package/dist/knowledge/spaces/product-canon.d.ts +7 -0
  357. package/dist/knowledge/spaces/product-canon.js +37 -0
  358. package/dist/knowledge/spaces/support-faq.d.ts +7 -0
  359. package/dist/knowledge/spaces/support-faq.js +40 -0
  360. package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
  361. package/dist/knowledge/spaces/uploaded-docs.js +37 -0
  362. package/dist/knowledge/spec.d.ts +48 -0
  363. package/dist/knowledge/spec.js +39 -0
  364. package/dist/llm/exporters.d.ts +70 -0
  365. package/dist/llm/exporters.js +542 -0
  366. package/dist/llm/index.d.ts +4 -0
  367. package/dist/llm/index.js +4 -0
  368. package/dist/llm/prompts.d.ts +52 -0
  369. package/dist/llm/prompts.js +410 -0
  370. package/dist/llm/types.d.ts +215 -0
  371. package/dist/llm/types.js +0 -0
  372. package/dist/markdown.d.ts +22 -0
  373. package/dist/markdown.js +119 -0
  374. package/dist/migrations.d.ts +52 -0
  375. package/dist/migrations.js +33 -0
  376. package/dist/model-registry.d.ts +13 -0
  377. package/dist/model-registry.js +33 -0
  378. package/dist/onboarding-base.d.ts +138 -0
  379. package/dist/onboarding-base.js +195 -0
  380. package/dist/openapi.d.ts +31 -0
  381. package/dist/openapi.js +75 -0
  382. package/dist/operations/index.d.ts +3 -0
  383. package/dist/operations/index.js +4 -0
  384. package/dist/operations/operation.d.ts +186 -0
  385. package/dist/operations/operation.js +35 -0
  386. package/dist/operations/registry.d.ts +103 -0
  387. package/dist/operations/registry.js +252 -0
  388. package/dist/ownership.d.ts +84 -0
  389. package/dist/ownership.js +38 -0
  390. package/dist/policy/docs/policy.docblock.d.ts +6 -0
  391. package/dist/policy/docs/policy.docblock.js +21 -0
  392. package/dist/policy/engine.d.ts +40 -0
  393. package/dist/policy/engine.js +223 -0
  394. package/dist/policy/index.d.ts +5 -0
  395. package/dist/policy/index.js +5 -0
  396. package/dist/policy/opa-adapter.d.ts +45 -0
  397. package/dist/policy/opa-adapter.js +71 -0
  398. package/dist/policy/registry.d.ts +9 -0
  399. package/dist/policy/registry.js +11 -0
  400. package/dist/policy/spec.d.ts +103 -0
  401. package/dist/policy/spec.js +0 -0
  402. package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
  403. package/dist/presentations/docs/presentations-conventions.docblock.js +21 -0
  404. package/dist/presentations/index.d.ts +4 -0
  405. package/dist/presentations/index.js +5 -0
  406. package/dist/presentations/presentations.d.ts +50 -0
  407. package/dist/presentations/presentations.js +7 -0
  408. package/dist/presentations/registry.d.ts +10 -0
  409. package/dist/presentations/registry.js +12 -0
  410. package/dist/presentations/transform-engine.d.ts +66 -0
  411. package/dist/presentations/transform-engine.js +282 -0
  412. package/dist/prompt.d.ts +60 -0
  413. package/dist/prompt.js +10 -0
  414. package/dist/promptRegistry.d.ts +15 -0
  415. package/dist/promptRegistry.js +34 -0
  416. package/dist/regenerator/adapters.d.ts +19 -0
  417. package/dist/regenerator/adapters.js +0 -0
  418. package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
  419. package/dist/regenerator/docs/regenerator.docblock.js +21 -0
  420. package/dist/regenerator/executor.d.ts +70 -0
  421. package/dist/regenerator/executor.js +86 -0
  422. package/dist/regenerator/index.d.ts +7 -0
  423. package/dist/regenerator/index.js +6 -0
  424. package/dist/regenerator/service.d.ts +33 -0
  425. package/dist/regenerator/service.js +93 -0
  426. package/dist/regenerator/sinks.d.ts +26 -0
  427. package/dist/regenerator/sinks.js +32 -0
  428. package/dist/regenerator/types.d.ts +107 -0
  429. package/dist/regenerator/types.js +0 -0
  430. package/dist/regenerator/utils.d.ts +9 -0
  431. package/dist/regenerator/utils.js +51 -0
  432. package/dist/registry-utils.d.ts +106 -0
  433. package/dist/registry-utils.js +122 -0
  434. package/dist/registry.d.ts +31 -0
  435. package/dist/registry.js +61 -0
  436. package/dist/resources.d.ts +64 -0
  437. package/dist/resources.js +50 -0
  438. package/dist/schema-to-markdown.d.ts +54 -0
  439. package/dist/schema-to-markdown.js +217 -0
  440. package/dist/server/contracts-adapter-hydration.d.ts +15 -0
  441. package/dist/server/contracts-adapter-hydration.js +41 -0
  442. package/dist/server/contracts-adapter-input.d.ts +9 -0
  443. package/dist/server/contracts-adapter-input.js +83 -0
  444. package/dist/server/graphql-pothos.d.ts +31 -0
  445. package/dist/server/graphql-pothos.js +134 -0
  446. package/dist/server/index.d.ts +9 -0
  447. package/dist/server/index.js +10 -0
  448. package/dist/server/mcp/createMcpServer.d.ts +15 -0
  449. package/dist/server/mcp/createMcpServer.js +27 -0
  450. package/dist/server/mcp/mcpTypes.d.ts +27 -0
  451. package/dist/server/mcp/mcpTypes.js +0 -0
  452. package/dist/server/mcp/registerPresentations.d.ts +7 -0
  453. package/dist/server/mcp/registerPresentations.js +63 -0
  454. package/dist/server/mcp/registerPrompts.d.ts +8 -0
  455. package/dist/server/mcp/registerPrompts.js +37 -0
  456. package/dist/server/mcp/registerResources.d.ts +8 -0
  457. package/dist/server/mcp/registerResources.js +35 -0
  458. package/dist/server/mcp/registerTools.d.ts +8 -0
  459. package/dist/server/mcp/registerTools.js +22 -0
  460. package/dist/server/provider-mcp.d.ts +2 -0
  461. package/dist/server/provider-mcp.js +3 -0
  462. package/dist/server/rest-elysia.d.ts +40 -0
  463. package/dist/server/rest-elysia.js +20 -0
  464. package/dist/server/rest-express.d.ts +16 -0
  465. package/dist/server/rest-express.js +36 -0
  466. package/dist/server/rest-generic.d.ts +32 -0
  467. package/dist/server/rest-generic.js +124 -0
  468. package/dist/server/rest-next-app.d.ts +35 -0
  469. package/dist/server/rest-next-app.js +38 -0
  470. package/dist/server/rest-next-mcp.d.ts +11 -0
  471. package/dist/server/rest-next-mcp.js +45 -0
  472. package/dist/server/rest-next-pages.d.ts +9 -0
  473. package/dist/server/rest-next-pages.js +22 -0
  474. package/dist/telemetry/anomaly.d.ts +27 -0
  475. package/dist/telemetry/anomaly.js +48 -0
  476. package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
  477. package/dist/telemetry/docs/telemetry.docblock.js +21 -0
  478. package/dist/telemetry/index.d.ts +4 -0
  479. package/dist/telemetry/index.js +5 -0
  480. package/dist/telemetry/spec.d.ts +91 -0
  481. package/dist/telemetry/spec.js +69 -0
  482. package/dist/telemetry/tracker.d.ts +51 -0
  483. package/dist/telemetry/tracker.js +76 -0
  484. package/dist/tests/index.d.ts +3 -0
  485. package/dist/tests/index.js +4 -0
  486. package/dist/tests/runner.d.ts +43 -0
  487. package/dist/tests/runner.js +150 -0
  488. package/dist/tests/spec.d.ts +81 -0
  489. package/dist/tests/spec.js +33 -0
  490. package/dist/themes.d.ts +53 -0
  491. package/dist/themes.js +39 -0
  492. package/dist/translations/catalog.d.ts +28 -0
  493. package/dist/translations/catalog.js +0 -0
  494. package/dist/translations/tenant.d.ts +15 -0
  495. package/dist/translations/tenant.js +0 -0
  496. package/dist/types.d.ts +92 -0
  497. package/dist/types.js +0 -0
  498. package/dist/workflow/adapters/db-adapter.d.ts +46 -0
  499. package/dist/workflow/adapters/db-adapter.js +83 -0
  500. package/dist/workflow/adapters/file-adapter.d.ts +14 -0
  501. package/dist/workflow/adapters/file-adapter.js +11 -0
  502. package/dist/workflow/adapters/index.d.ts +4 -0
  503. package/dist/workflow/adapters/index.js +5 -0
  504. package/dist/workflow/adapters/memory-store.d.ts +18 -0
  505. package/dist/workflow/adapters/memory-store.js +58 -0
  506. package/dist/workflow/expression.d.ts +9 -0
  507. package/dist/workflow/expression.js +99 -0
  508. package/dist/workflow/index.d.ts +10 -0
  509. package/dist/workflow/index.js +9 -0
  510. package/dist/workflow/overview.docblock.d.ts +6 -0
  511. package/dist/workflow/overview.docblock.js +21 -0
  512. package/dist/workflow/runner.d.ts +75 -0
  513. package/dist/workflow/runner.js +337 -0
  514. package/dist/workflow/sla-monitor.d.ts +20 -0
  515. package/dist/workflow/sla-monitor.js +47 -0
  516. package/dist/workflow/spec.d.ts +106 -0
  517. package/dist/workflow/spec.js +55 -0
  518. package/dist/workflow/state.d.ts +35 -0
  519. package/dist/workflow/state.js +0 -0
  520. package/dist/workflow/validation.d.ts +29 -0
  521. package/dist/workflow/validation.js +176 -0
  522. package/dist/workspace-config/contractsrc-schema.d.ts +862 -0
  523. package/dist/workspace-config/contractsrc-schema.js +281 -0
  524. package/dist/workspace-config/index.d.ts +2 -0
  525. package/dist/workspace-config/index.js +3 -0
  526. package/dist/workspace-config/workspace-config.docblock.d.ts +6 -0
  527. package/dist/workspace-config/workspace-config.docblock.js +45 -0
  528. package/package.json +598 -0
@@ -0,0 +1,22 @@
1
+ import { PresentationSpec } from "../presentations/presentations.js";
2
+ import { CapabilityRegistry } from "../capabilities/capabilities.js";
3
+ import "../capabilities/index.js";
4
+ import { OperationSpecRegistry } from "../operations/registry.js";
5
+ import { FeatureModuleSpec } from "./types.js";
6
+ import { FeatureRegistry } from "./registry.js";
7
+ import { PresentationRegistry } from "../presentations/registry.js";
8
+ import "../presentations/index.js";
9
+
10
+ //#region src/features/install.d.ts
11
+ /** Dependencies for installing a feature. */
12
+ interface InstallFeatureDeps {
13
+ features: FeatureRegistry;
14
+ ops?: OperationSpecRegistry;
15
+ presentations?: PresentationRegistry;
16
+ descriptors?: PresentationSpec[];
17
+ capabilities?: CapabilityRegistry;
18
+ }
19
+ /** Validate and register a feature against optional registries/descriptors. */
20
+ declare function installFeature(feature: FeatureModuleSpec, deps: InstallFeatureDeps): FeatureRegistry;
21
+ //#endregion
22
+ export { InstallFeatureDeps, installFeature };
@@ -0,0 +1,36 @@
1
+ //#region src/features/install.ts
2
+ /** Validate and register a feature against optional registries/descriptors. */
3
+ function installFeature(feature, deps) {
4
+ if (deps.ops && feature.operations) {
5
+ for (const o of feature.operations) if (!deps.ops.getSpec(o.key, o.version)) throw new Error(`installFeature: operation not found ${o.key}.v${o.version}`);
6
+ }
7
+ if (deps.presentations && feature.presentations) {
8
+ for (const p of feature.presentations) if (!deps.presentations.get(p.key, p.version)) throw new Error(`installFeature: presentation not found ${p.key}.v${p.version}`);
9
+ }
10
+ if (feature.presentationsTargets && deps.descriptors) for (const req of feature.presentationsTargets) {
11
+ const d = deps.descriptors.find((x) => x.meta.key === req.key && x.meta.version === req.version);
12
+ if (!d) throw new Error(`installFeature: V2 descriptor not found ${req.key}.v${req.version}`);
13
+ for (const t of req.targets) if (!d.targets.includes(t)) throw new Error(`installFeature: descriptor ${req.key}.v${req.version} missing target ${t}`);
14
+ }
15
+ if (feature.opToPresentation && feature.opToPresentation.length > 0) for (const link of feature.opToPresentation) {
16
+ if (deps.ops) {
17
+ if (!deps.ops.getSpec(link.op.key, link.op.version)) throw new Error(`installFeature: linked op not found ${link.op.key}.v${link.op.version}`);
18
+ }
19
+ if (deps.presentations) {
20
+ if (!deps.presentations.get(link.pres.key, link.pres.version)) throw new Error(`installFeature: linked presentation not found ${link.pres.key}.v${link.pres.version}`);
21
+ }
22
+ }
23
+ if (deps.capabilities && feature.capabilities?.provides) {
24
+ for (const cap of feature.capabilities.provides) if (!deps.capabilities.get(cap.key, cap.version)) throw new Error(`installFeature: capability not registered ${cap.key}.v${cap.version}`);
25
+ }
26
+ if (feature.capabilities?.requires?.length) {
27
+ if (!deps.capabilities) throw new Error(`installFeature: capability registry required to validate capability requirements for ${feature.meta.key}`);
28
+ const provided = feature.capabilities.provides ?? [];
29
+ for (const req of feature.capabilities.requires) if (!deps.capabilities.satisfies(req, provided)) throw new Error(`installFeature: capability requirement not satisfied ${req.key}${req.version ? `.v${req.version}` : ""}`);
30
+ }
31
+ deps.features.register(feature);
32
+ return deps.features;
33
+ }
34
+
35
+ //#endregion
36
+ export { installFeature };
@@ -0,0 +1,26 @@
1
+ import { GroupKeyFn, RegistryFilter } from "../registry-utils.js";
2
+ import { FeatureModuleSpec } from "./types.js";
3
+
4
+ //#region src/features/registry.d.ts
5
+ /** In-memory registry for FeatureModuleSpec. */
6
+ declare class FeatureRegistry {
7
+ private items;
8
+ /** Register a feature module. Throws when the key already exists. */
9
+ register(f: FeatureModuleSpec): this;
10
+ /** List all registered feature modules. */
11
+ list(): FeatureModuleSpec[];
12
+ /** Get a feature by its key (slug). */
13
+ get(key: string): FeatureModuleSpec | undefined;
14
+ /** Filter features by criteria. */
15
+ filter(criteria: RegistryFilter): FeatureModuleSpec[];
16
+ /** List features with specific tag. */
17
+ listByTag(tag: string): FeatureModuleSpec[];
18
+ /** List features by owner. */
19
+ listByOwner(owner: string): FeatureModuleSpec[];
20
+ /** Group features by key function. */
21
+ groupBy(keyFn: GroupKeyFn<FeatureModuleSpec>): Map<string, FeatureModuleSpec[]>;
22
+ /** Get unique tags from all features. */
23
+ getUniqueTags(): string[];
24
+ }
25
+ //#endregion
26
+ export { FeatureRegistry };
@@ -0,0 +1,49 @@
1
+ import { filterBy, getUniqueTags, groupBy, init_registry_utils } from "../registry-utils.js";
2
+
3
+ //#region src/features/registry.ts
4
+ init_registry_utils();
5
+ function keyOf(f) {
6
+ return f.meta.key;
7
+ }
8
+ /** In-memory registry for FeatureModuleSpec. */
9
+ var FeatureRegistry = class {
10
+ items = /* @__PURE__ */ new Map();
11
+ /** Register a feature module. Throws when the key already exists. */
12
+ register(f) {
13
+ const key = keyOf(f);
14
+ if (this.items.has(key)) throw new Error(`Duplicate feature ${key}`);
15
+ this.items.set(key, f);
16
+ return this;
17
+ }
18
+ /** List all registered feature modules. */
19
+ list() {
20
+ return [...this.items.values()];
21
+ }
22
+ /** Get a feature by its key (slug). */
23
+ get(key) {
24
+ return this.items.get(key);
25
+ }
26
+ /** Filter features by criteria. */
27
+ filter(criteria) {
28
+ return filterBy(this.list(), criteria);
29
+ }
30
+ /** List features with specific tag. */
31
+ listByTag(tag) {
32
+ return this.list().filter((f) => f.meta.tags?.includes(tag));
33
+ }
34
+ /** List features by owner. */
35
+ listByOwner(owner) {
36
+ return this.list().filter((f) => f.meta.owners?.includes(owner));
37
+ }
38
+ /** Group features by key function. */
39
+ groupBy(keyFn) {
40
+ return groupBy(this.list(), keyFn);
41
+ }
42
+ /** Get unique tags from all features. */
43
+ getUniqueTags() {
44
+ return getUniqueTags(this.list());
45
+ }
46
+ };
47
+
48
+ //#endregion
49
+ export { FeatureRegistry };
@@ -0,0 +1,88 @@
1
+ import { PresentationTarget } from "../presentations/presentations.js";
2
+ import { OwnerShipMeta } from "../ownership.js";
3
+ import { CapabilityRef, CapabilityRequirement } from "../capabilities/capabilities.js";
4
+ import "../capabilities/index.js";
5
+ import { ExperimentRef } from "../experiments/spec.js";
6
+ import { ImplementationRef } from "../operations/operation.js";
7
+ import "../operations/index.js";
8
+
9
+ //#region src/features/types.d.ts
10
+ /** Minimal metadata to identify and categorize a feature module. */
11
+ type FeatureModuleMeta = OwnerShipMeta;
12
+ interface OpRef {
13
+ /** Operation key (OperationSpec.meta.key). */
14
+ key: string;
15
+ /** Operation version (OperationSpec.meta.version). */
16
+ version: number;
17
+ }
18
+ interface EventRef {
19
+ /** Event key. */
20
+ key: string;
21
+ /** Event version. */
22
+ version: number;
23
+ }
24
+ interface PresentationRef {
25
+ /** Presentation key. */
26
+ key: string;
27
+ /** Presentation version. */
28
+ version: number;
29
+ }
30
+ /**
31
+ * Reference to a data view spec.
32
+ */
33
+ interface DataViewRef {
34
+ key: string;
35
+ version: number;
36
+ }
37
+ /**
38
+ * Reference to a form spec.
39
+ */
40
+ interface FormRef {
41
+ key: string;
42
+ version: number;
43
+ }
44
+ /** Group operations/events/presentations into an installable feature. */
45
+ interface FeatureModuleSpec {
46
+ meta: FeatureModuleMeta;
47
+ /** Contract operations included in this feature. */
48
+ operations?: OpRef[];
49
+ /** Events declared/emitted by this feature. */
50
+ events?: EventRef[];
51
+ /** Presentations associated to this feature. */
52
+ presentations?: PresentationRef[];
53
+ /** Experiments related to this feature. */
54
+ experiments?: ExperimentRef[];
55
+ /** Capability bindings exposed/required by this feature. */
56
+ capabilities?: {
57
+ provides?: CapabilityRef[];
58
+ requires?: CapabilityRequirement[];
59
+ };
60
+ /** Optional: link ops to presentations for traceability (e.g., ui for op) */
61
+ opToPresentation?: {
62
+ op: OpRef;
63
+ pres: PresentationRef;
64
+ }[];
65
+ /** Optional: declare per-presentation target requirements (V2 descriptors) */
66
+ presentationsTargets?: {
67
+ /** Presentation key. */
68
+ key: string;
69
+ /** Presentation version. */
70
+ version: number;
71
+ /** Required targets that must be supported by the descriptor. */
72
+ targets: PresentationTarget[];
73
+ }[];
74
+ /**
75
+ * Explicit implementation file mappings for the entire feature module.
76
+ * Used for tracking and verifying that this feature is correctly implemented.
77
+ */
78
+ implementations?: ImplementationRef[];
79
+ /** Data views associated with this feature. */
80
+ dataViews?: DataViewRef[];
81
+ /** Forms associated with this feature. */
82
+ forms?: FormRef[];
83
+ }
84
+ interface FeatureRef {
85
+ key: string;
86
+ }
87
+ //#endregion
88
+ export { DataViewRef, EventRef, FeatureModuleMeta, FeatureModuleSpec, FeatureRef, FormRef, OpRef, PresentationRef };
File without changes
@@ -0,0 +1,8 @@
1
+ import { PresentationSpec } from "../presentations/presentations.js";
2
+ import { FeatureModuleSpec } from "./types.js";
3
+
4
+ //#region src/features/validation.d.ts
5
+ /** Ensure declared target requirements exist on the provided descriptors. */
6
+ declare function validateFeatureTargetsV2(feature: FeatureModuleSpec, descriptors: PresentationSpec[]): boolean;
7
+ //#endregion
8
+ export { validateFeatureTargetsV2 };
@@ -0,0 +1,14 @@
1
+ //#region src/features/validation.ts
2
+ /** Ensure declared target requirements exist on the provided descriptors. */
3
+ function validateFeatureTargetsV2(feature, descriptors) {
4
+ if (!feature.presentationsTargets || feature.presentationsTargets.length === 0) return true;
5
+ for (const req of feature.presentationsTargets) {
6
+ const d = descriptors.find((x) => x.meta.key === req.key && x.meta.version === req.version);
7
+ if (!d) throw new Error(`V2 descriptor not found ${req.key}.v${req.version}`);
8
+ for (const t of req.targets) if (!d.targets.includes(t)) throw new Error(`Descriptor ${req.key}.v${req.version} missing target ${t}`);
9
+ }
10
+ return true;
11
+ }
12
+
13
+ //#endregion
14
+ export { validateFeatureTargetsV2 };
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/forms/docs/forms.docblock.d.ts
4
+ declare const tech_contracts_forms_DocBlocks: DocBlock[];
5
+ //#endregion
6
+ export { tech_contracts_forms_DocBlocks };
@@ -0,0 +1,21 @@
1
+ import { registerDocBlocks } from "../../docs/registry.js";
2
+
3
+ //#region src/forms/docs/forms.docblock.ts
4
+ const tech_contracts_forms_DocBlocks = [{
5
+ id: "docs.tech.contracts.forms",
6
+ title: "Contracts: FormSpec",
7
+ summary: "This document defines the canonical contracts for declarative forms.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/contracts/forms",
11
+ tags: [
12
+ "tech",
13
+ "contracts",
14
+ "forms"
15
+ ],
16
+ body: "# Contracts: FormSpec\n\nThis document defines the canonical contracts for declarative forms.\n\n## Overview\n\n- `FormSpec` (in `@contractspec/lib.contracts/forms`) declares:\n - `meta` (extends `OwnerShipMeta`) + `key`/`version` for stability.\n - `model` (`@contractspec/lib.schema` `SchemaModel`) as the single source of truth.\n - `fields` built from `FieldSpec` kinds: `text`, `textarea`, `select`, `checkbox`, `radio`, `switch`, `group`, `array`.\n - Optional `actions`, `policy.flags`, `constraints` and `renderHints`.\n- Relations DSL provides `visibleWhen`, `enabledWhen`, `requiredWhen` based on predicates.\n- `buildZodWithRelations(spec)` augments the base zod with conditional rules and constraints.\n- React adapter renders with React Hook Form + driver API for UI components (shadcn driver provided).\n\n## Driver API (UI-agnostic)\n\nHost apps supply a driver mapping slots → components:\n\n- Required: `Field`, `FieldLabel`, `FieldDescription`, `FieldError`, `Input`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `Button`.\n- Optional: `FieldGroup`, `FieldSet`, `FieldLegend` and input group helpers.\n\nUse `createFormRenderer({ driver })` to obtain a `render(spec)` function.\n\n## Arrays and Groups\n\n- `array` items are rendered with `useFieldArray`, honoring `min`/`max` and add/remove controls.\n- `group` composes nested fields and provides optional legend/description.\n\n## Feature Flags\n\n- Declare `policy.flags` on forms to signal gating. Gate usage at host boundary; avoid scattering flags across individual fields.\n\n## Example\n\nSee `packages/hcircle/apps/web-coliving/src/forms/bug-report.spec.ts` for a concrete form spec and `components/forms/BugReportFormDemo.tsx` for rendering with a minimal shadcn driver mapping.\n"
17
+ }];
18
+ registerDocBlocks(tech_contracts_forms_DocBlocks);
19
+
20
+ //#endregion
21
+ export { tech_contracts_forms_DocBlocks };
@@ -0,0 +1,266 @@
1
+ import { OwnerShipMeta } from "../ownership.js";
2
+ import { GroupKeyFn, RegistryFilter } from "../registry-utils.js";
3
+ import { AnySchemaModel, ZodSchemaModel } from "@contractspec/lib.schema";
4
+
5
+ //#region src/forms/forms.d.ts
6
+ type PredicateOp = 'equals' | 'notEquals' | 'in' | 'notIn' | 'gt' | 'gte' | 'lt' | 'lte' | 'truthy' | 'empty' | 'lengthGt' | 'lengthGte' | 'lengthLt' | 'lengthLte';
7
+ interface WhenClause {
8
+ /** Dot path in form values; arrays may use `$index` within array context. */
9
+ path: string;
10
+ op?: PredicateOp;
11
+ value?: unknown;
12
+ }
13
+ interface Predicate {
14
+ when?: WhenClause;
15
+ all?: Predicate[];
16
+ anyOf?: Predicate[];
17
+ not?: Predicate;
18
+ }
19
+ interface FormOption {
20
+ labelI18n: string;
21
+ value: string | number | boolean;
22
+ descriptionI18n?: string;
23
+ disabled?: boolean;
24
+ }
25
+ type OptionsSource = {
26
+ kind: 'static';
27
+ options: readonly FormOption[];
28
+ } | {
29
+ kind: 'resolver';
30
+ resolverKey: string;
31
+ /** Dot paths in form values to watch */
32
+ deps: string[];
33
+ args?: Record<string, unknown>;
34
+ };
35
+ interface BaseFieldSpec {
36
+ /** Field kind discriminator. */
37
+ kind: 'text' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'group' | 'array';
38
+ /** Field name (dot path relative to the form root or parent context). */
39
+ name?: string;
40
+ labelI18n?: string;
41
+ descriptionI18n?: string;
42
+ placeholderI18n?: string;
43
+ required?: boolean;
44
+ /** Conditional UI behavior */
45
+ visibleWhen?: Predicate;
46
+ enabledWhen?: Predicate;
47
+ requiredWhen?: Predicate;
48
+ /** UI hints */
49
+ uiKey?: string;
50
+ uiProps?: Record<string, unknown>;
51
+ wrapper?: {
52
+ orientation?: 'horizontal' | 'vertical';
53
+ };
54
+ /** HTML/Native autofill token (supports custom tokens) */
55
+ autoComplete?: string;
56
+ /** Keyboard/adaptation hints (web/native). Shape mirrors design-system KeyboardOptions but stays decoupled. */
57
+ keyboard?: {
58
+ kind?: string;
59
+ autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
60
+ autoComplete?: string;
61
+ autoCorrect?: boolean;
62
+ enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'search' | 'send';
63
+ };
64
+ /** Optional computed value hook, provided by host computations map */
65
+ computeFrom?: {
66
+ computeKey: string;
67
+ deps: string[];
68
+ mode?: 'change' | 'blur-xs' | 'submit';
69
+ readOnly?: boolean;
70
+ };
71
+ }
72
+ interface TextFieldSpec extends BaseFieldSpec {
73
+ kind: 'text';
74
+ name: string;
75
+ inputMode?: 'text' | 'email' | 'tel' | 'url' | 'numeric' | 'decimal' | 'search';
76
+ autoComplete?: string;
77
+ maxLength?: number;
78
+ minLength?: number;
79
+ }
80
+ interface TextareaFieldSpec extends BaseFieldSpec {
81
+ kind: 'textarea';
82
+ name: string;
83
+ rows?: number;
84
+ maxLength?: number;
85
+ minLength?: number;
86
+ }
87
+ interface SelectFieldSpec extends BaseFieldSpec {
88
+ kind: 'select';
89
+ name: string;
90
+ options: OptionsSource | readonly FormOption[];
91
+ }
92
+ interface CheckboxFieldSpec extends BaseFieldSpec {
93
+ kind: 'checkbox';
94
+ name: string;
95
+ }
96
+ interface RadioFieldSpec extends BaseFieldSpec {
97
+ kind: 'radio';
98
+ name: string;
99
+ options: OptionsSource | readonly FormOption[];
100
+ }
101
+ interface SwitchFieldSpec extends BaseFieldSpec {
102
+ kind: 'switch';
103
+ name: string;
104
+ }
105
+ interface GroupFieldSpec extends BaseFieldSpec {
106
+ kind: 'group';
107
+ /** Optional legend/label at group level */
108
+ labelI18n?: string;
109
+ fields: FieldSpec[];
110
+ }
111
+ interface ArrayFieldSpec extends BaseFieldSpec {
112
+ kind: 'array';
113
+ /** Root-level field that is an array in the model (e.g., "emails") */
114
+ name: string;
115
+ /** Child field spec for each item (e.g., address inside emails[i].address). */
116
+ of: Exclude<FieldSpec, ArrayFieldSpec | GroupFieldSpec>;
117
+ min?: number;
118
+ max?: number;
119
+ }
120
+ type FieldSpec = TextFieldSpec | TextareaFieldSpec | SelectFieldSpec | CheckboxFieldSpec | RadioFieldSpec | SwitchFieldSpec | GroupFieldSpec | ArrayFieldSpec;
121
+ interface FormAction {
122
+ key: string;
123
+ labelI18n: string;
124
+ op?: {
125
+ name: string;
126
+ version: number;
127
+ };
128
+ success?: {
129
+ navigateTo?: string;
130
+ toastI18n?: string;
131
+ };
132
+ }
133
+ interface ConstraintDecl {
134
+ key: string;
135
+ messageI18n: string;
136
+ paths: string[];
137
+ args?: Record<string, unknown>;
138
+ }
139
+ type FormValuesFor<M extends AnySchemaModel> = ZodSchemaModel<M>;
140
+ interface FormSpec<M extends AnySchemaModel = AnySchemaModel> {
141
+ meta: OwnerShipMeta;
142
+ /** Canonical form data shape */
143
+ model: M;
144
+ /** Flat list or tree using groups/arrays */
145
+ fields: FieldSpec[];
146
+ policy?: {
147
+ flags?: string[];
148
+ pii?: string[];
149
+ };
150
+ actions?: FormAction[];
151
+ renderHints?: {
152
+ ui: 'shadcn' | 'custom';
153
+ form: 'react-hook-form';
154
+ };
155
+ constraints?: ConstraintDecl[];
156
+ }
157
+ declare class FormRegistry {
158
+ private items;
159
+ register(spec: FormSpec): this;
160
+ list(): FormSpec[];
161
+ get(key: string, version?: number): FormSpec<AnySchemaModel> | undefined;
162
+ /** Filter forms by criteria. */
163
+ filter(criteria: RegistryFilter): FormSpec[];
164
+ /** List forms with specific tag. */
165
+ listByTag(tag: string): FormSpec[];
166
+ /** List forms by owner. */
167
+ listByOwner(owner: string): FormSpec[];
168
+ /** Group forms by key function. */
169
+ groupBy(keyFn: GroupKeyFn<FormSpec>): Map<string, FormSpec[]>;
170
+ /** Get unique tags from all forms. */
171
+ getUniqueTags(): string[];
172
+ }
173
+ declare function evalPredicate(values: unknown, pred?: Predicate): boolean;
174
+ type ConstraintHandler = (values: Record<string, unknown>, paths: string[], args?: Record<string, unknown>) => {
175
+ ok: true;
176
+ } | {
177
+ ok: false;
178
+ message?: string;
179
+ path?: string;
180
+ };
181
+ /**
182
+ * Wrap the base zod schema with relation-driven refinements (requiredWhen, array min/max)
183
+ * and optional custom constraints. Call this when wiring RHF resolver.
184
+ */
185
+ declare function buildZodWithRelations(spec: FormSpec, handlers?: Record<string, ConstraintHandler>): any;
186
+ interface AnyFieldLike {
187
+ kind: string;
188
+ name?: string;
189
+ fields?: readonly AnyFieldLike[];
190
+ of?: AnyFieldLike;
191
+ }
192
+ type TopLevelNames<F extends readonly AnyFieldLike[]> = F[number] extends {
193
+ name: infer N extends string;
194
+ } ? N : never;
195
+ type ArrayChildren<F extends readonly AnyFieldLike[]> = F[number] extends {
196
+ kind: 'array';
197
+ name: infer N extends string;
198
+ of: infer C;
199
+ } ? C extends {
200
+ name: infer CN extends string;
201
+ } ? `${N}.$index.${CN}` : never : never;
202
+ type GroupTopLevelNames<F extends readonly AnyFieldLike[]> = F[number] extends {
203
+ kind: 'group';
204
+ fields: infer G extends readonly AnyFieldLike[];
205
+ } ? TopLevelNames<G> : never;
206
+ type GroupArrayChildren<F extends readonly AnyFieldLike[]> = F[number] extends {
207
+ kind: 'group';
208
+ fields: infer G extends readonly AnyFieldLike[];
209
+ } ? ArrayChildren<G> : never;
210
+ type PathOfFields<F extends readonly AnyFieldLike[]> = TopLevelNames<F> | ArrayChildren<F> | GroupTopLevelNames<F> | GroupArrayChildren<F>;
211
+ interface TypedWhenClause<P extends string> {
212
+ path: P;
213
+ op?: PredicateOp;
214
+ value?: unknown;
215
+ }
216
+ interface TypedPredicate<P extends string> {
217
+ when?: TypedWhenClause<P>;
218
+ all?: TypedPredicate<P>[];
219
+ anyOf?: TypedPredicate<P>[];
220
+ not?: TypedPredicate<P>;
221
+ }
222
+ type TypedOptionsSource<P extends string> = {
223
+ kind: 'static';
224
+ options: readonly FormOption[];
225
+ } | {
226
+ kind: 'resolver';
227
+ resolverKey: string;
228
+ deps: P[];
229
+ args?: Record<string, unknown>;
230
+ };
231
+ type EnhanceFields<F extends readonly AnyFieldLike[], P extends string> = { [K in keyof F]: F[K] & {
232
+ visibleWhen?: TypedPredicate<P>;
233
+ enabledWhen?: TypedPredicate<P>;
234
+ requiredWhen?: TypedPredicate<P>;
235
+ } & (F[K] extends {
236
+ kind: 'select';
237
+ } ? {
238
+ options: TypedOptionsSource<P> | readonly FormOption[];
239
+ } : unknown) & (F[K] extends {
240
+ kind: 'radio';
241
+ } ? {
242
+ options: TypedOptionsSource<P> | readonly FormOption[];
243
+ } : unknown) & {
244
+ computeFrom?: {
245
+ computeKey: string;
246
+ deps: P[];
247
+ mode?: 'change' | 'blur-xs' | 'submit';
248
+ readOnly?: boolean;
249
+ };
250
+ } };
251
+ declare function defineFormSpec<M extends AnySchemaModel, F extends readonly AnyFieldLike[]>(spec: {
252
+ meta: FormSpec<M>['meta'];
253
+ model: M;
254
+ fields: EnhanceFields<F, PathOfFields<F>>;
255
+ policy?: FormSpec<M>['policy'];
256
+ actions?: FormSpec<M>['actions'];
257
+ renderHints?: FormSpec<M>['renderHints'];
258
+ constraints?: {
259
+ key: string;
260
+ messageI18n: string;
261
+ paths: PathOfFields<F>[];
262
+ args?: Record<string, unknown>;
263
+ }[];
264
+ }): FormSpec<M>;
265
+ //#endregion
266
+ export { ArrayFieldSpec, BaseFieldSpec, CheckboxFieldSpec, ConstraintDecl, ConstraintHandler, EnhanceFields, FieldSpec, FormAction, FormOption, FormRegistry, FormSpec, FormValuesFor, GroupFieldSpec, OptionsSource, Predicate, PredicateOp, RadioFieldSpec, SelectFieldSpec, SwitchFieldSpec, TextFieldSpec, TextareaFieldSpec, TypedOptionsSource, TypedPredicate, TypedWhenClause, WhenClause, buildZodWithRelations, defineFormSpec, evalPredicate };