@lssm/lib.contracts 1.41.0 → 1.42.1

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 (663) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -4
  3. package/dist/_virtual/rolldown_runtime.js +37 -1
  4. package/dist/app-config/app-config.feature.d.ts +11 -0
  5. package/dist/app-config/app-config.feature.js +54 -1
  6. package/dist/app-config/branding.d.ts +55 -0
  7. package/dist/app-config/contracts.d.ts +245 -0
  8. package/dist/app-config/contracts.js +395 -1
  9. package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
  10. package/dist/app-config/docs/app-config.docblock.js +21 -220
  11. package/dist/app-config/events.d.ts +122 -0
  12. package/dist/app-config/events.js +174 -1
  13. package/dist/app-config/index.d.ts +9 -0
  14. package/dist/app-config/index.js +8 -1
  15. package/dist/app-config/lifecycle-contracts.d.ts +273 -0
  16. package/dist/app-config/lifecycle-contracts.js +440 -1
  17. package/dist/app-config/lifecycle.d.ts +27 -0
  18. package/dist/app-config/runtime.d.ts +117 -0
  19. package/dist/app-config/runtime.js +617 -1
  20. package/dist/app-config/spec.d.ts +172 -0
  21. package/dist/app-config/spec.js +36 -1
  22. package/dist/app-config/validation.d.ts +49 -0
  23. package/dist/app-config/validation.js +538 -1
  24. package/dist/capabilities/capabilities.d.ts +48 -0
  25. package/dist/capabilities/capabilities.js +50 -0
  26. package/dist/capabilities/docs/capabilities.docblock.d.ts +6 -0
  27. package/dist/capabilities/docs/capabilities.docblock.js +21 -1
  28. package/dist/capabilities/index.d.ts +3 -0
  29. package/dist/capabilities/index.js +4 -0
  30. package/dist/capabilities/openbanking.d.ts +10 -0
  31. package/dist/capabilities/openbanking.js +92 -1
  32. package/dist/client/index.d.ts +6 -0
  33. package/dist/client/index.js +9 -1
  34. package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
  35. package/dist/client/react/drivers/rn-reusables.js +21 -1
  36. package/dist/client/react/drivers/shadcn.d.ts +12 -0
  37. package/dist/client/react/drivers/shadcn.js +11 -1
  38. package/dist/client/react/feature-render.d.ts +21 -0
  39. package/dist/client/react/feature-render.js +44 -1
  40. package/dist/client/react/form-render.d.ts +92 -0
  41. package/dist/client/react/form-render.js +298 -1
  42. package/dist/client/react/index.d.ts +5 -0
  43. package/dist/client/react/index.js +8 -1
  44. package/dist/contract-registry/index.d.ts +3 -0
  45. package/dist/contract-registry/index.js +3 -1
  46. package/dist/contract-registry/schemas.d.ts +124 -0
  47. package/dist/contract-registry/schemas.js +61 -1
  48. package/dist/contract-registry/types.d.ts +46 -0
  49. package/dist/data-views/data-views.d.ts +138 -0
  50. package/dist/data-views/data-views.js +58 -0
  51. package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
  52. package/dist/data-views/docs/data-views.docblock.js +21 -1
  53. package/dist/data-views/index.d.ts +4 -0
  54. package/dist/data-views/index.js +5 -0
  55. package/dist/data-views/query-generator.d.ts +40 -0
  56. package/dist/data-views/query-generator.js +48 -1
  57. package/dist/data-views/runtime.d.ts +27 -0
  58. package/dist/data-views/runtime.js +39 -1
  59. package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
  60. package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -350
  61. package/dist/docs/index.d.ts +6 -0
  62. package/dist/docs/index.js +27 -1
  63. package/dist/docs/meta.docs.d.ts +6 -0
  64. package/dist/docs/meta.docs.js +18 -2
  65. package/dist/docs/presentations.d.ts +33 -0
  66. package/dist/docs/presentations.js +64 -1
  67. package/dist/docs/registry.d.ts +23 -0
  68. package/dist/docs/registry.js +51 -1
  69. package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
  70. package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +25 -2
  71. package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
  72. package/dist/docs/tech/contracts/README.docblock.js +21 -1
  73. package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +6 -0
  74. package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -1
  75. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +6 -0
  76. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -180
  77. package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
  78. package/dist/docs/tech/contracts/migrations.docblock.js +21 -1
  79. package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
  80. package/dist/docs/tech/contracts/openapi-export.docblock.js +25 -5
  81. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.d.ts +6 -0
  82. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +19 -60
  83. package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
  84. package/dist/docs/tech/contracts/overlays.docblock.js +21 -68
  85. package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
  86. package/dist/docs/tech/contracts/tests.docblock.js +21 -132
  87. package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
  88. package/dist/docs/tech/contracts/themes.docblock.js +21 -1
  89. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.d.ts +6 -0
  90. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +21 -106
  91. package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
  92. package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -213
  93. package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
  94. package/dist/docs/tech/llm/llm-integration.docblock.js +76 -7
  95. package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
  96. package/dist/docs/tech/mcp-endpoints.docblock.js +38 -1
  97. package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
  98. package/dist/docs/tech/presentation-runtime.docblock.js +17 -1
  99. package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
  100. package/dist/docs/tech/schema/README.docblock.js +21 -262
  101. package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
  102. package/dist/docs/tech/studio/learning-events.docblock.js +49 -1
  103. package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
  104. package/dist/docs/tech/studio/learning-journeys.docblock.js +25 -2
  105. package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
  106. package/dist/docs/tech/studio/platform-admin-panel.docblock.js +24 -2
  107. package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
  108. package/dist/docs/tech/studio/project-access-teams.docblock.js +26 -16
  109. package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
  110. package/dist/docs/tech/studio/project-routing.docblock.js +68 -1
  111. package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
  112. package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +23 -2
  113. package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
  114. package/dist/docs/tech/studio/team-invitations.docblock.js +41 -36
  115. package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
  116. package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -1
  117. package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
  118. package/dist/docs/tech/studio/workspaces.docblock.js +24 -2
  119. package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
  120. package/dist/docs/tech/telemetry-ingest.docblock.js +37 -3
  121. package/dist/docs/tech/templates/runtime.docblock.d.ts +6 -0
  122. package/dist/docs/tech/templates/runtime.docblock.js +21 -1
  123. package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
  124. package/dist/docs/tech/vscode-extension.docblock.js +37 -3
  125. package/dist/docs/tech/workflows/overview.docblock.d.ts +6 -0
  126. package/dist/docs/tech/workflows/overview.docblock.js +21 -1
  127. package/dist/docs/tech-contracts.docs.d.ts +6 -0
  128. package/dist/docs/tech-contracts.docs.js +27 -7
  129. package/dist/docs/types.d.ts +41 -0
  130. package/dist/events.d.ts +47 -0
  131. package/dist/events.js +19 -1
  132. package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
  133. package/dist/experiments/docs/experiments.docblock.js +21 -128
  134. package/dist/experiments/evaluator.d.ts +37 -0
  135. package/dist/experiments/evaluator.js +101 -1
  136. package/dist/experiments/spec-resolver.d.ts +17 -0
  137. package/dist/experiments/spec.d.ts +82 -0
  138. package/dist/experiments/spec.js +33 -1
  139. package/dist/features.d.ts +104 -0
  140. package/dist/features.js +91 -1
  141. package/dist/forms/docs/forms.docblock.d.ts +6 -0
  142. package/dist/forms/docs/forms.docblock.js +21 -1
  143. package/dist/forms/forms.d.ts +266 -0
  144. package/dist/forms/forms.js +146 -0
  145. package/dist/forms/index.d.ts +2 -0
  146. package/dist/forms/index.js +3 -0
  147. package/dist/index.d.ts +142 -0
  148. package/dist/index.js +119 -1
  149. package/dist/install.d.ts +77 -0
  150. package/dist/install.js +40 -1
  151. package/dist/integrations/binding.d.ts +17 -0
  152. package/dist/integrations/connection.d.ts +51 -0
  153. package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
  154. package/dist/integrations/docs/integrations.docblock.js +94 -1
  155. package/dist/integrations/health.d.ts +21 -0
  156. package/dist/integrations/health.js +69 -1
  157. package/dist/integrations/index.d.ts +34 -0
  158. package/dist/integrations/index.js +23 -1
  159. package/dist/integrations/integrations.feature.d.ts +11 -0
  160. package/dist/integrations/integrations.feature.js +60 -0
  161. package/dist/integrations/openbanking/contracts/accounts.d.ts +289 -0
  162. package/dist/integrations/openbanking/contracts/accounts.js +236 -1
  163. package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
  164. package/dist/integrations/openbanking/contracts/balances.js +166 -1
  165. package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
  166. package/dist/integrations/openbanking/contracts/index.js +12 -1
  167. package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
  168. package/dist/integrations/openbanking/contracts/transactions.js +217 -1
  169. package/dist/integrations/openbanking/guards.d.ts +12 -0
  170. package/dist/integrations/openbanking/guards.js +33 -1
  171. package/dist/integrations/openbanking/models.d.ts +228 -0
  172. package/dist/integrations/openbanking/models.js +240 -1
  173. package/dist/integrations/openbanking/openbanking.feature.d.ts +11 -0
  174. package/dist/integrations/openbanking/openbanking.feature.js +69 -1
  175. package/dist/integrations/openbanking/telemetry.d.ts +15 -0
  176. package/dist/integrations/openbanking/telemetry.js +39 -1
  177. package/dist/integrations/operations.d.ts +437 -0
  178. package/dist/integrations/operations.js +392 -0
  179. package/dist/integrations/providers/calendar.d.ts +78 -0
  180. package/dist/integrations/providers/elevenlabs.d.ts +7 -0
  181. package/dist/integrations/providers/elevenlabs.js +55 -1
  182. package/dist/integrations/providers/email.d.ts +86 -0
  183. package/dist/integrations/providers/embedding.d.ts +24 -0
  184. package/dist/integrations/providers/gcs-storage.d.ts +7 -0
  185. package/dist/integrations/providers/gcs-storage.js +78 -1
  186. package/dist/integrations/providers/gmail.d.ts +7 -0
  187. package/dist/integrations/providers/gmail.js +90 -1
  188. package/dist/integrations/providers/google-calendar.d.ts +7 -0
  189. package/dist/integrations/providers/google-calendar.js +69 -1
  190. package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
  191. package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -1
  192. package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
  193. package/dist/integrations/providers/impls/gcs-storage.js +88 -1
  194. package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
  195. package/dist/integrations/providers/impls/gmail-inbound.js +200 -1
  196. package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
  197. package/dist/integrations/providers/impls/gmail-outbound.js +104 -5
  198. package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
  199. package/dist/integrations/providers/impls/google-calendar.js +154 -1
  200. package/dist/integrations/providers/impls/index.d.ts +15 -0
  201. package/dist/integrations/providers/impls/index.js +16 -1
  202. package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
  203. package/dist/integrations/providers/impls/mistral-embedding.js +41 -1
  204. package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
  205. package/dist/integrations/providers/impls/mistral-llm.js +247 -1
  206. package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
  207. package/dist/integrations/providers/impls/postmark-email.js +55 -1
  208. package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
  209. package/dist/integrations/providers/impls/powens-client.js +171 -1
  210. package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
  211. package/dist/integrations/providers/impls/powens-openbanking.js +218 -1
  212. package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
  213. package/dist/integrations/providers/impls/provider-factory.js +145 -1
  214. package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
  215. package/dist/integrations/providers/impls/qdrant-vector.js +69 -1
  216. package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
  217. package/dist/integrations/providers/impls/stripe-payments.js +202 -1
  218. package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
  219. package/dist/integrations/providers/impls/twilio-sms.js +58 -1
  220. package/dist/integrations/providers/index.d.ts +22 -0
  221. package/dist/integrations/providers/index.js +13 -1
  222. package/dist/integrations/providers/llm.d.ts +82 -0
  223. package/dist/integrations/providers/mistral.d.ts +7 -0
  224. package/dist/integrations/providers/mistral.js +71 -1
  225. package/dist/integrations/providers/openbanking.d.ts +128 -0
  226. package/dist/integrations/providers/payments.d.ts +109 -0
  227. package/dist/integrations/providers/postmark.d.ts +7 -0
  228. package/dist/integrations/providers/postmark.js +71 -1
  229. package/dist/integrations/providers/powens.d.ts +7 -0
  230. package/dist/integrations/providers/powens.js +119 -1
  231. package/dist/integrations/providers/qdrant.d.ts +7 -0
  232. package/dist/integrations/providers/qdrant.js +76 -1
  233. package/dist/integrations/providers/registry.d.ts +11 -0
  234. package/dist/integrations/providers/registry.js +34 -1
  235. package/dist/integrations/providers/sms.d.ts +34 -0
  236. package/dist/integrations/providers/storage.d.ts +60 -0
  237. package/dist/integrations/providers/stripe.d.ts +7 -0
  238. package/dist/integrations/providers/stripe.js +86 -1
  239. package/dist/integrations/providers/twilio-sms.d.ts +7 -0
  240. package/dist/integrations/providers/twilio-sms.js +64 -1
  241. package/dist/integrations/providers/vector-store.d.ts +43 -0
  242. package/dist/integrations/providers/voice.d.ts +34 -0
  243. package/dist/integrations/runtime.d.ts +99 -0
  244. package/dist/integrations/runtime.js +186 -1
  245. package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
  246. package/dist/integrations/secrets/aws-secret-manager.js +231 -1
  247. package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
  248. package/dist/integrations/secrets/env-secret-provider.js +81 -1
  249. package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
  250. package/dist/integrations/secrets/gcp-secret-manager.js +229 -1
  251. package/dist/integrations/secrets/index.d.ts +7 -0
  252. package/dist/integrations/secrets/index.js +8 -1
  253. package/dist/integrations/secrets/manager.d.ts +47 -0
  254. package/dist/integrations/secrets/manager.js +103 -1
  255. package/dist/integrations/secrets/provider.d.ts +52 -0
  256. package/dist/integrations/secrets/provider.js +58 -1
  257. package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
  258. package/dist/integrations/secrets/scaleway-secret-manager.js +247 -1
  259. package/dist/integrations/secrets-types.d.ts +17 -0
  260. package/dist/integrations/spec.d.ts +75 -0
  261. package/dist/integrations/spec.js +39 -1
  262. package/dist/jobs/define-job.d.ts +18 -0
  263. package/dist/jobs/define-job.js +16 -1
  264. package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
  265. package/dist/jobs/gcp-cloud-tasks.js +53 -1
  266. package/dist/jobs/gcp-pubsub.d.ts +25 -0
  267. package/dist/jobs/gcp-pubsub.js +39 -1
  268. package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
  269. package/dist/jobs/handlers/gmail-sync-handler.js +9 -1
  270. package/dist/jobs/handlers/index.d.ts +9 -0
  271. package/dist/jobs/handlers/index.js +12 -1
  272. package/dist/jobs/handlers/ping-handler.d.ts +10 -0
  273. package/dist/jobs/handlers/ping-handler.js +15 -1
  274. package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
  275. package/dist/jobs/handlers/storage-document-handler.js +14 -1
  276. package/dist/jobs/index.d.ts +3 -0
  277. package/dist/jobs/index.js +4 -1
  278. package/dist/jobs/memory-queue.d.ts +18 -0
  279. package/dist/jobs/memory-queue.js +71 -1
  280. package/dist/jobs/queue.d.ts +131 -0
  281. package/dist/jobs/queue.js +33 -1
  282. package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
  283. package/dist/jobs/scaleway-sqs-queue.js +153 -1
  284. package/dist/jsonschema.d.ts +28 -0
  285. package/dist/jsonschema.js +32 -1
  286. package/dist/knowledge/binding.d.ts +25 -0
  287. package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
  288. package/dist/knowledge/docs/knowledge.docblock.js +21 -138
  289. package/dist/knowledge/index.d.ts +11 -0
  290. package/dist/knowledge/index.js +10 -1
  291. package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
  292. package/dist/knowledge/ingestion/document-processor.js +54 -1
  293. package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
  294. package/dist/knowledge/ingestion/embedding-service.js +25 -1
  295. package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
  296. package/dist/knowledge/ingestion/gmail-adapter.js +50 -5
  297. package/dist/knowledge/ingestion/index.d.ts +6 -0
  298. package/dist/knowledge/ingestion/index.js +7 -1
  299. package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
  300. package/dist/knowledge/ingestion/storage-adapter.js +26 -1
  301. package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
  302. package/dist/knowledge/ingestion/vector-indexer.js +32 -1
  303. package/dist/knowledge/knowledge.feature.d.ts +11 -0
  304. package/dist/knowledge/knowledge.feature.js +61 -0
  305. package/dist/knowledge/operations.d.ts +318 -0
  306. package/dist/knowledge/operations.js +321 -0
  307. package/dist/knowledge/query/index.d.ts +2 -0
  308. package/dist/knowledge/query/index.js +3 -1
  309. package/dist/knowledge/query/service.d.ts +29 -0
  310. package/dist/knowledge/query/service.js +64 -2
  311. package/dist/knowledge/runtime.d.ts +32 -0
  312. package/dist/knowledge/runtime.js +49 -1
  313. package/dist/knowledge/source.d.ts +32 -0
  314. package/dist/knowledge/spaces/email-threads.d.ts +7 -0
  315. package/dist/knowledge/spaces/email-threads.js +37 -1
  316. package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
  317. package/dist/knowledge/spaces/financial-docs.js +37 -1
  318. package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
  319. package/dist/knowledge/spaces/financial-overview.js +41 -1
  320. package/dist/knowledge/spaces/index.d.ts +7 -0
  321. package/dist/knowledge/spaces/index.js +8 -1
  322. package/dist/knowledge/spaces/product-canon.d.ts +7 -0
  323. package/dist/knowledge/spaces/product-canon.js +37 -1
  324. package/dist/knowledge/spaces/support-faq.d.ts +7 -0
  325. package/dist/knowledge/spaces/support-faq.js +40 -1
  326. package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
  327. package/dist/knowledge/spaces/uploaded-docs.js +37 -1
  328. package/dist/knowledge/spec.d.ts +48 -0
  329. package/dist/knowledge/spec.js +39 -1
  330. package/dist/llm/exporters.d.ts +69 -0
  331. package/dist/llm/exporters.js +542 -8
  332. package/dist/llm/index.d.ts +4 -0
  333. package/dist/llm/index.js +4 -1
  334. package/dist/llm/prompts.d.ts +52 -0
  335. package/dist/llm/prompts.js +246 -56
  336. package/dist/llm/types.d.ts +214 -0
  337. package/dist/markdown.d.ts +22 -0
  338. package/dist/markdown.js +119 -3
  339. package/dist/migrations.d.ts +52 -0
  340. package/dist/migrations.js +33 -1
  341. package/dist/onboarding-base.d.ts +138 -0
  342. package/dist/onboarding-base.js +195 -1
  343. package/dist/openapi.d.ts +31 -0
  344. package/dist/openapi.js +75 -1
  345. package/dist/operations/index.d.ts +3 -0
  346. package/dist/operations/index.js +4 -0
  347. package/dist/operations/operation.d.ts +180 -0
  348. package/dist/operations/operation.js +35 -0
  349. package/dist/operations/registry.d.ts +103 -0
  350. package/dist/operations/registry.js +252 -0
  351. package/dist/ownership.d.ts +84 -0
  352. package/dist/ownership.js +38 -1
  353. package/dist/policy/docs/policy.docblock.d.ts +6 -0
  354. package/dist/policy/docs/policy.docblock.js +21 -1
  355. package/dist/policy/engine.d.ts +40 -0
  356. package/dist/policy/engine.js +223 -1
  357. package/dist/policy/index.d.ts +5 -0
  358. package/dist/policy/index.js +5 -0
  359. package/dist/policy/opa-adapter.d.ts +45 -0
  360. package/dist/policy/opa-adapter.js +71 -1
  361. package/dist/policy/registry.d.ts +9 -0
  362. package/dist/policy/registry.js +11 -0
  363. package/dist/policy/spec.d.ts +103 -0
  364. package/dist/policy/spec.js +0 -1
  365. package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
  366. package/dist/presentations/docs/presentations-conventions.docblock.js +20 -7
  367. package/dist/presentations/index.d.ts +4 -0
  368. package/dist/presentations/index.js +5 -0
  369. package/dist/presentations/presentations.d.ts +50 -0
  370. package/dist/presentations/presentations.js +7 -0
  371. package/dist/presentations/registry.d.ts +10 -0
  372. package/dist/presentations/registry.js +12 -0
  373. package/dist/presentations/transform-engine.d.ts +66 -0
  374. package/dist/presentations/transform-engine.js +282 -0
  375. package/dist/prompt.d.ts +60 -0
  376. package/dist/prompt.js +10 -1
  377. package/dist/promptRegistry.d.ts +15 -0
  378. package/dist/promptRegistry.js +34 -1
  379. package/dist/regenerator/adapters.d.ts +19 -0
  380. package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
  381. package/dist/regenerator/docs/regenerator.docblock.js +21 -184
  382. package/dist/regenerator/executor.d.ts +70 -0
  383. package/dist/regenerator/executor.js +86 -1
  384. package/dist/regenerator/index.d.ts +7 -0
  385. package/dist/regenerator/index.js +6 -1
  386. package/dist/regenerator/service.d.ts +33 -0
  387. package/dist/regenerator/service.js +92 -1
  388. package/dist/regenerator/sinks.d.ts +26 -0
  389. package/dist/regenerator/sinks.js +32 -1
  390. package/dist/regenerator/types.d.ts +107 -0
  391. package/dist/regenerator/utils.d.ts +9 -0
  392. package/dist/regenerator/utils.js +51 -1
  393. package/dist/registry-utils.d.ts +106 -0
  394. package/dist/registry-utils.js +122 -0
  395. package/dist/registry.d.ts +30 -0
  396. package/dist/registry.js +58 -1
  397. package/dist/resources.d.ts +64 -0
  398. package/dist/resources.js +50 -1
  399. package/dist/schema-to-markdown.d.ts +54 -0
  400. package/dist/schema-to-markdown.js +214 -10
  401. package/dist/server/contracts-adapter-hydration.d.ts +15 -0
  402. package/dist/server/contracts-adapter-hydration.js +41 -0
  403. package/dist/server/contracts-adapter-input.d.ts +9 -0
  404. package/dist/server/contracts-adapter-input.js +77 -0
  405. package/dist/server/graphql-pothos.d.ts +31 -0
  406. package/dist/server/graphql-pothos.js +127 -1
  407. package/dist/server/index.d.ts +9 -0
  408. package/dist/server/index.js +10 -1
  409. package/dist/server/mcp/createMcpServer.d.ts +15 -0
  410. package/dist/server/mcp/createMcpServer.js +28 -1
  411. package/dist/server/mcp/mcpTypes.d.ts +30 -0
  412. package/dist/server/mcp/registerPresentations.d.ts +7 -0
  413. package/dist/server/mcp/registerPresentations.js +112 -1
  414. package/dist/server/mcp/registerPrompts.d.ts +8 -0
  415. package/dist/server/mcp/registerPrompts.js +36 -2
  416. package/dist/server/mcp/registerResources.d.ts +8 -0
  417. package/dist/server/mcp/registerResources.js +35 -1
  418. package/dist/server/mcp/registerTools.d.ts +8 -0
  419. package/dist/server/mcp/registerTools.js +22 -1
  420. package/dist/server/provider-mcp.d.ts +2 -0
  421. package/dist/server/provider-mcp.js +3 -1
  422. package/dist/server/rest-elysia.d.ts +40 -0
  423. package/dist/server/rest-elysia.js +20 -1
  424. package/dist/server/rest-express.d.ts +16 -0
  425. package/dist/server/rest-express.js +36 -1
  426. package/dist/server/rest-generic.d.ts +32 -0
  427. package/dist/server/rest-generic.js +124 -1
  428. package/dist/server/rest-next-app.d.ts +35 -0
  429. package/dist/server/rest-next-app.js +38 -1
  430. package/dist/server/rest-next-mcp.d.ts +11 -0
  431. package/dist/server/rest-next-mcp.js +45 -1
  432. package/dist/server/rest-next-pages.d.ts +9 -0
  433. package/dist/server/rest-next-pages.js +22 -1
  434. package/dist/telemetry/anomaly.d.ts +27 -0
  435. package/dist/telemetry/anomaly.js +48 -1
  436. package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
  437. package/dist/telemetry/docs/telemetry.docblock.js +21 -139
  438. package/dist/telemetry/index.d.ts +4 -0
  439. package/dist/telemetry/index.js +5 -1
  440. package/dist/telemetry/spec.d.ts +91 -0
  441. package/dist/telemetry/spec.js +69 -1
  442. package/dist/telemetry/tracker.d.ts +51 -0
  443. package/dist/telemetry/tracker.js +76 -1
  444. package/dist/tests/index.d.ts +3 -0
  445. package/dist/tests/index.js +4 -1
  446. package/dist/tests/runner.d.ts +43 -0
  447. package/dist/tests/runner.js +150 -1
  448. package/dist/tests/spec.d.ts +89 -0
  449. package/dist/tests/spec.js +33 -1
  450. package/dist/themes.d.ts +53 -0
  451. package/dist/themes.js +39 -1
  452. package/dist/translations/catalog.d.ts +28 -0
  453. package/dist/translations/tenant.d.ts +15 -0
  454. package/dist/types.d.ts +92 -0
  455. package/dist/workflow/adapters/db-adapter.d.ts +46 -0
  456. package/dist/workflow/adapters/db-adapter.js +83 -1
  457. package/dist/workflow/adapters/file-adapter.d.ts +14 -0
  458. package/dist/workflow/adapters/file-adapter.js +11 -1
  459. package/dist/workflow/adapters/index.d.ts +4 -0
  460. package/dist/workflow/adapters/index.js +5 -1
  461. package/dist/workflow/adapters/memory-store.d.ts +18 -0
  462. package/dist/workflow/adapters/memory-store.js +58 -1
  463. package/dist/workflow/expression.d.ts +9 -0
  464. package/dist/workflow/expression.js +99 -1
  465. package/dist/workflow/index.d.ts +10 -0
  466. package/dist/workflow/index.js +9 -1
  467. package/dist/workflow/runner.d.ts +74 -0
  468. package/dist/workflow/runner.js +337 -1
  469. package/dist/workflow/sla-monitor.d.ts +20 -0
  470. package/dist/workflow/sla-monitor.js +47 -1
  471. package/dist/workflow/spec.d.ts +105 -0
  472. package/dist/workflow/spec.js +55 -1
  473. package/dist/workflow/state.d.ts +35 -0
  474. package/dist/workflow/validation.d.ts +29 -0
  475. package/dist/workflow/validation.js +176 -1
  476. package/dist/workspace-config/contractsrc-schema.d.ts +786 -0
  477. package/dist/workspace-config/contractsrc-schema.js +247 -0
  478. package/dist/workspace-config/index.d.ts +2 -0
  479. package/dist/workspace-config/index.js +3 -0
  480. package/package.json +287 -266
  481. package/dist/capabilities.js +0 -1
  482. package/dist/contracts-adapter-hydration.js +0 -1
  483. package/dist/contracts-adapter-input.js +0 -1
  484. package/dist/data-views.js +0 -1
  485. package/dist/docs/PUBLISHING.docblock.js +0 -76
  486. package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -383
  487. package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -68
  488. package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -140
  489. package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -86
  490. package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -1
  491. package/dist/forms.js +0 -1
  492. package/dist/integrations/contracts.js +0 -1
  493. package/dist/knowledge/contracts.js +0 -1
  494. package/dist/node_modules/@pothos/plugin-complexity/esm/calculate-complexity.js +0 -1
  495. package/dist/node_modules/@pothos/plugin-complexity/esm/defaults.js +0 -1
  496. package/dist/node_modules/@pothos/plugin-complexity/esm/index.js +0 -1
  497. package/dist/node_modules/@pothos/plugin-complexity/esm/types.js +0 -1
  498. package/dist/node_modules/@pothos/plugin-complexity/esm/util.js +0 -1
  499. package/dist/node_modules/@pothos/plugin-complexity/esm/validator.js +0 -1
  500. package/dist/node_modules/@pothos/plugin-dataloader/esm/field-builder.js +0 -1
  501. package/dist/node_modules/@pothos/plugin-dataloader/esm/index.js +0 -1
  502. package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/index.js +0 -1
  503. package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/interface.js +0 -1
  504. package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/node.js +0 -1
  505. package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/object.js +0 -1
  506. package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/union.js +0 -1
  507. package/dist/node_modules/@pothos/plugin-dataloader/esm/schema-builder.js +0 -1
  508. package/dist/node_modules/@pothos/plugin-dataloader/esm/util.js +0 -1
  509. package/dist/node_modules/@pothos/plugin-prisma/esm/connection-helpers.js +0 -1
  510. package/dist/node_modules/@pothos/plugin-prisma/esm/field-builder.js +0 -1
  511. package/dist/node_modules/@pothos/plugin-prisma/esm/index.js +0 -1
  512. package/dist/node_modules/@pothos/plugin-prisma/esm/interface-ref.js +0 -1
  513. package/dist/node_modules/@pothos/plugin-prisma/esm/model-loader.js +0 -1
  514. package/dist/node_modules/@pothos/plugin-prisma/esm/node-ref.js +0 -1
  515. package/dist/node_modules/@pothos/plugin-prisma/esm/object-ref.js +0 -1
  516. package/dist/node_modules/@pothos/plugin-prisma/esm/prisma-field-builder.js +0 -1
  517. package/dist/node_modules/@pothos/plugin-prisma/esm/schema-builder.js +0 -1
  518. package/dist/node_modules/@pothos/plugin-prisma/esm/util/cursors.js +0 -1
  519. package/dist/node_modules/@pothos/plugin-prisma/esm/util/datamodel.js +0 -1
  520. package/dist/node_modules/@pothos/plugin-prisma/esm/util/deep-equal.js +0 -1
  521. package/dist/node_modules/@pothos/plugin-prisma/esm/util/description.js +0 -1
  522. package/dist/node_modules/@pothos/plugin-prisma/esm/util/get-client.js +0 -1
  523. package/dist/node_modules/@pothos/plugin-prisma/esm/util/loader-map.js +0 -1
  524. package/dist/node_modules/@pothos/plugin-prisma/esm/util/map-query.js +0 -1
  525. package/dist/node_modules/@pothos/plugin-prisma/esm/util/relation-map.js +0 -1
  526. package/dist/node_modules/@pothos/plugin-prisma/esm/util/selections.js +0 -1
  527. package/dist/node_modules/@pothos/plugin-prisma/esm/util/usage.js +0 -1
  528. package/dist/node_modules/@pothos/plugin-tracing/esm/index.js +0 -1
  529. package/dist/node_modules/@pothos/plugin-tracing/esm/util.js +0 -1
  530. package/dist/node_modules/dataloader/index.js +0 -7
  531. package/dist/node_modules/graphql/error/GraphQLError.js +0 -5
  532. package/dist/node_modules/graphql/error/index.js +0 -1
  533. package/dist/node_modules/graphql/error/locatedError.js +0 -1
  534. package/dist/node_modules/graphql/error/syntaxError.js +0 -1
  535. package/dist/node_modules/graphql/execution/collectFields.js +0 -1
  536. package/dist/node_modules/graphql/execution/execute.js +0 -1
  537. package/dist/node_modules/graphql/execution/index.js +0 -1
  538. package/dist/node_modules/graphql/execution/mapAsyncIterator.js +0 -1
  539. package/dist/node_modules/graphql/execution/subscribe.js +0 -1
  540. package/dist/node_modules/graphql/execution/values.js +0 -1
  541. package/dist/node_modules/graphql/graphql.js +0 -1
  542. package/dist/node_modules/graphql/index.js +0 -1
  543. package/dist/node_modules/graphql/jsutils/Path.js +0 -1
  544. package/dist/node_modules/graphql/jsutils/devAssert.js +0 -1
  545. package/dist/node_modules/graphql/jsutils/didYouMean.js +0 -1
  546. package/dist/node_modules/graphql/jsutils/groupBy.js +0 -1
  547. package/dist/node_modules/graphql/jsutils/identityFunc.js +0 -1
  548. package/dist/node_modules/graphql/jsutils/inspect.js +0 -1
  549. package/dist/node_modules/graphql/jsutils/instanceOf.js +0 -12
  550. package/dist/node_modules/graphql/jsutils/invariant.js +0 -1
  551. package/dist/node_modules/graphql/jsutils/isAsyncIterable.js +0 -1
  552. package/dist/node_modules/graphql/jsutils/isIterableObject.js +0 -1
  553. package/dist/node_modules/graphql/jsutils/isObjectLike.js +0 -1
  554. package/dist/node_modules/graphql/jsutils/isPromise.js +0 -1
  555. package/dist/node_modules/graphql/jsutils/keyMap.js +0 -1
  556. package/dist/node_modules/graphql/jsutils/keyValMap.js +0 -1
  557. package/dist/node_modules/graphql/jsutils/mapValue.js +0 -1
  558. package/dist/node_modules/graphql/jsutils/memoize3.js +0 -1
  559. package/dist/node_modules/graphql/jsutils/naturalCompare.js +0 -1
  560. package/dist/node_modules/graphql/jsutils/printPathArray.js +0 -1
  561. package/dist/node_modules/graphql/jsutils/promiseForObject.js +0 -1
  562. package/dist/node_modules/graphql/jsutils/promiseReduce.js +0 -1
  563. package/dist/node_modules/graphql/jsutils/suggestionList.js +0 -1
  564. package/dist/node_modules/graphql/jsutils/toError.js +0 -1
  565. package/dist/node_modules/graphql/jsutils/toObjMap.js +0 -1
  566. package/dist/node_modules/graphql/language/ast.js +0 -1
  567. package/dist/node_modules/graphql/language/blockString.js +0 -3
  568. package/dist/node_modules/graphql/language/characterClasses.js +0 -1
  569. package/dist/node_modules/graphql/language/directiveLocation.js +0 -1
  570. package/dist/node_modules/graphql/language/index.js +0 -1
  571. package/dist/node_modules/graphql/language/kinds.js +0 -1
  572. package/dist/node_modules/graphql/language/lexer.js +0 -3
  573. package/dist/node_modules/graphql/language/location.js +0 -1
  574. package/dist/node_modules/graphql/language/parser.js +0 -1
  575. package/dist/node_modules/graphql/language/predicates.js +0 -1
  576. package/dist/node_modules/graphql/language/printLocation.js +0 -2
  577. package/dist/node_modules/graphql/language/printString.js +0 -1
  578. package/dist/node_modules/graphql/language/printer.js +0 -34
  579. package/dist/node_modules/graphql/language/schemaCoordinateLexer.js +0 -1
  580. package/dist/node_modules/graphql/language/source.js +0 -1
  581. package/dist/node_modules/graphql/language/tokenKind.js +0 -1
  582. package/dist/node_modules/graphql/language/visitor.js +0 -1
  583. package/dist/node_modules/graphql/type/assertName.js +0 -1
  584. package/dist/node_modules/graphql/type/definition.js +0 -1
  585. package/dist/node_modules/graphql/type/directives.js +0 -1
  586. package/dist/node_modules/graphql/type/index.js +0 -1
  587. package/dist/node_modules/graphql/type/introspection.js +0 -3
  588. package/dist/node_modules/graphql/type/scalars.js +0 -1
  589. package/dist/node_modules/graphql/type/schema.js +0 -1
  590. package/dist/node_modules/graphql/type/validate.js +0 -3
  591. package/dist/node_modules/graphql/utilities/TypeInfo.js +0 -1
  592. package/dist/node_modules/graphql/utilities/assertValidName.js +0 -1
  593. package/dist/node_modules/graphql/utilities/astFromValue.js +0 -1
  594. package/dist/node_modules/graphql/utilities/buildASTSchema.js +0 -1
  595. package/dist/node_modules/graphql/utilities/buildClientSchema.js +0 -1
  596. package/dist/node_modules/graphql/utilities/coerceInputValue.js +0 -1
  597. package/dist/node_modules/graphql/utilities/concatAST.js +0 -1
  598. package/dist/node_modules/graphql/utilities/extendSchema.js +0 -1
  599. package/dist/node_modules/graphql/utilities/findBreakingChanges.js +0 -1
  600. package/dist/node_modules/graphql/utilities/getIntrospectionQuery.js +0 -107
  601. package/dist/node_modules/graphql/utilities/getOperationAST.js +0 -1
  602. package/dist/node_modules/graphql/utilities/getOperationRootType.js +0 -1
  603. package/dist/node_modules/graphql/utilities/index.js +0 -1
  604. package/dist/node_modules/graphql/utilities/introspectionFromSchema.js +0 -1
  605. package/dist/node_modules/graphql/utilities/lexicographicSortSchema.js +0 -1
  606. package/dist/node_modules/graphql/utilities/printSchema.js +0 -13
  607. package/dist/node_modules/graphql/utilities/resolveSchemaCoordinate.js +0 -1
  608. package/dist/node_modules/graphql/utilities/separateOperations.js +0 -1
  609. package/dist/node_modules/graphql/utilities/sortValueNode.js +0 -1
  610. package/dist/node_modules/graphql/utilities/stripIgnoredCharacters.js +0 -1
  611. package/dist/node_modules/graphql/utilities/typeComparators.js +0 -1
  612. package/dist/node_modules/graphql/utilities/typeFromAST.js +0 -1
  613. package/dist/node_modules/graphql/utilities/valueFromAST.js +0 -1
  614. package/dist/node_modules/graphql/utilities/valueFromASTUntyped.js +0 -1
  615. package/dist/node_modules/graphql/validation/ValidationContext.js +0 -1
  616. package/dist/node_modules/graphql/validation/index.js +0 -1
  617. package/dist/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +0 -1
  618. package/dist/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +0 -1
  619. package/dist/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +0 -1
  620. package/dist/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +0 -1
  621. package/dist/node_modules/graphql/validation/rules/KnownDirectivesRule.js +0 -1
  622. package/dist/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +0 -1
  623. package/dist/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +0 -1
  624. package/dist/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +0 -1
  625. package/dist/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +0 -1
  626. package/dist/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.js +0 -1
  627. package/dist/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +0 -1
  628. package/dist/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +0 -1
  629. package/dist/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +0 -1
  630. package/dist/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +0 -1
  631. package/dist/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +0 -1
  632. package/dist/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +0 -1
  633. package/dist/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +0 -1
  634. package/dist/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +0 -1
  635. package/dist/node_modules/graphql/validation/rules/ScalarLeafsRule.js +0 -1
  636. package/dist/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +0 -1
  637. package/dist/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js +0 -1
  638. package/dist/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +0 -1
  639. package/dist/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +0 -1
  640. package/dist/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +0 -1
  641. package/dist/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +0 -1
  642. package/dist/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +0 -1
  643. package/dist/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +0 -1
  644. package/dist/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +0 -1
  645. package/dist/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +0 -1
  646. package/dist/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +0 -1
  647. package/dist/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +0 -1
  648. package/dist/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +0 -1
  649. package/dist/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +0 -1
  650. package/dist/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +0 -1
  651. package/dist/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +0 -1
  652. package/dist/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +0 -1
  653. package/dist/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +0 -1
  654. package/dist/node_modules/graphql/validation/specifiedRules.js +0 -1
  655. package/dist/node_modules/graphql/validation/validate.js +0 -5
  656. package/dist/node_modules/graphql/version.js +0 -1
  657. package/dist/openbanking/docs/openbanking.docblock.js +0 -109
  658. package/dist/presentations.backcompat.js +0 -1
  659. package/dist/presentations.js +0 -1
  660. package/dist/presentations.v2.js +0 -7
  661. package/dist/spec.js +0 -1
  662. package/dist/types/all.js +0 -0
  663. /package/dist/{node_modules/@pothos/plugin-prisma/esm/types.js → integrations/secrets-types.js} +0 -0
@@ -1,10 +1,214 @@
1
- function e(e,i,a={}){let{format:o=`auto`,title:s,description:c,maxDepth:l=2}=a,u=[];s&&u.push(`# ${s}`,``),c&&u.push(`> ${c}`,``);let d=o===`auto`?Array.isArray(i)?`table`:`detail`:o;return d===`table`&&Array.isArray(i)?u.push(t(e,i,a)):d===`list`&&Array.isArray(i)?u.push(n(e,i,a)):!Array.isArray(i)&&typeof i==`object`&&i?u.push(r(e,i,{...a,maxDepth:l})):u.push(`**Data:** ${String(i)}`,``),u.join(`
2
- `)}function t(e,t,n={}){let{maxItems:r=100,includeFields:i,excludeFields:c=[]}=n,l=a(e,i,c);if(l.length===0||t.length===0)return`_No data available_
3
- `;let u=t.slice(0,r),d=[],f=l.map(e=>e.label);d.push(`| ${f.join(` | `)} |`),d.push(`| ${f.map(()=>`---`).join(` | `)} |`);for(let e of u){let t=l.map(t=>s(o(e,t.name)));d.push(`| ${t.join(` | `)} |`)}return t.length>r&&d.push(``,`_Showing ${r} of ${t.length} items_`),d.push(``),d.join(`
4
- `)}function n(e,t,n={}){let{maxItems:r=50,summaryFields:i,includeFields:c,excludeFields:l=[]}=n,u=a(e,c,l),d=i?u.filter(e=>i.includes(e.name)):u.slice(0,3);if(d.length===0||t.length===0)return`_No data available_
5
- `;let f=t.slice(0,r),p=[];for(let e of f){let t=s(o(e,d[0]?.name??`id`)),n=d.slice(1).map(t=>`${t.label}: ${s(o(e,t.name))}`).join(` · `),r=n?`- **${t}** (${n})`:`- **${t}**`;p.push(r)}return t.length>r&&p.push(``,`_Showing ${r} of ${t.length} items_`),p.push(``),p.join(`
6
- `)}function r(e,t,n={}){let{includeFields:r,excludeFields:i=[],maxDepth:s=2}=n;if(typeof t!=`object`||!t)return`_No data available_
7
- `;let l=a(e,r,i);if(l.length===0)return`_No fields to display_
8
- `;let u=[];for(let e of l){let n=c(o(t,e.name),s,0);u.push(`**${e.label}:** ${n}`)}return u.push(``),u.join(`
9
- `)}function i(e,t,n={}){let{numericFields:r=[],countByField:i}=n,a=[];a.push(`**Total Items:** ${t.length}`);for(let e of r){let n=t.map(t=>o(t,e)).filter(e=>typeof e==`number`);if(n.length>0){let t=n.reduce((e,t)=>e+t,0),r=t/n.length,i=Math.min(...n),o=Math.max(...n);a.push(`**${l(e)}:** Sum: ${u(t)}, Avg: ${u(r)}, Min: ${u(i)}, Max: ${u(o)}`)}}if(i){let e={};for(let n of t){let t=String(o(n,i)??`Unknown`);e[t]=(e[t]??0)+1}a.push(``,`**By ${l(i)}:**`);for(let[t,n]of Object.entries(e))a.push(`- ${t}: ${n}`)}return a.push(``),a.join(`
10
- `)}function a(e,t,n=[]){let r=e.config.fields;return Object.keys(r).filter(e=>!(n.includes(e)||t&&!t.includes(e))).map(e=>{let t=r[e],n=!!(t?.type&&typeof t.type==`object`&&`config`in t.type&&typeof t.type.config?.fields==`object`);return{name:e,label:l(e),isOptional:t?.isOptional??!1,isArray:t?.isArray===!0,isNested:n}})}function o(e,t){if(typeof e!=`object`||!e)return;let n=e;if(t.includes(`.`)){let e=t.split(`.`),r=n;for(let t of e){if(typeof r!=`object`||!r)return;r=r[t]}return r}return n[t]}function s(e){if(e==null)return`-`;if(typeof e==`boolean`)return e?`✓`:`✗`;if(typeof e==`number`)return u(e);if(e instanceof Date)return d(e);if(typeof e==`string`&&f(e))return d(new Date(e));if(Array.isArray(e))return`[${e.length} items]`;if(typeof e==`object`)return`[Object]`;let t=String(e);return t.length>50?`${t.slice(0,47)}...`:t.replace(/\|/g,`\\|`)}function c(e,t,n){return e==null?`_none_`:typeof e==`boolean`?e?`Yes`:`No`:typeof e==`number`?u(e):e instanceof Date?d(e):typeof e==`string`&&f(e)?d(new Date(e)):Array.isArray(e)?e.length===0?`_empty list_`:n>=t?`[${e.length} items]`:e.length<=5&&e.every(e=>typeof e!=`object`)?e.map(e=>s(e)).join(`, `):`[${e.length} items]`:typeof e==`object`?n>=t?`[Object]`:`{${Object.keys(e).length} fields}`:String(e)}function l(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/_/g,` `).replace(/^\w/,e=>e.toUpperCase())}function u(e){return Math.abs(e)>=1e3?new Intl.NumberFormat(`en-US`,{maximumFractionDigits:2}).format(e):Number.isInteger(e)?String(e):e.toFixed(2)}function d(e){return e.toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function f(e){if(!/^\d{4}-\d{2}-\d{2}/.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())}export{e as schemaToMarkdown,r as schemaToMarkdownDetail,n as schemaToMarkdownList,i as schemaToMarkdownSummary,t as schemaToMarkdownTable};
1
+ //#region src/schema-to-markdown.ts
2
+ /**
3
+ * Generate markdown from a SchemaModel and data.
4
+ * Automatically detects array vs object data and formats accordingly.
5
+ */
6
+ function schemaToMarkdown(schema, data, options = {}) {
7
+ const { format = "auto", title, description, maxDepth = 2 } = options;
8
+ const lines = [];
9
+ if (title) lines.push(`# ${title}`, "");
10
+ if (description) lines.push(`> ${description}`, "");
11
+ const effectiveFormat = format === "auto" ? Array.isArray(data) ? "table" : "detail" : format;
12
+ if (effectiveFormat === "table" && Array.isArray(data)) lines.push(schemaToMarkdownTable(schema, data, options));
13
+ else if (effectiveFormat === "list" && Array.isArray(data)) lines.push(schemaToMarkdownList(schema, data, options));
14
+ else if (!Array.isArray(data) && data !== null && typeof data === "object") lines.push(schemaToMarkdownDetail(schema, data, {
15
+ ...options,
16
+ maxDepth
17
+ }));
18
+ else lines.push(`**Data:** ${String(data)}`, "");
19
+ return lines.join("\n");
20
+ }
21
+ /**
22
+ * Generate a markdown table from array data using schema fields as columns.
23
+ */
24
+ function schemaToMarkdownTable(schema, items, options = {}) {
25
+ const { maxItems = 100, includeFields, excludeFields = [] } = options;
26
+ const fields = getFieldMeta(schema, includeFields, excludeFields);
27
+ if (fields.length === 0 || items.length === 0) return "_No data available_\n";
28
+ const limitedItems = items.slice(0, maxItems);
29
+ const lines = [];
30
+ const headers = fields.map((f) => f.label);
31
+ lines.push(`| ${headers.join(" | ")} |`);
32
+ lines.push(`| ${headers.map(() => "---").join(" | ")} |`);
33
+ for (const item of limitedItems) {
34
+ const row = fields.map((f) => formatCellValue(getFieldValue(item, f.name)));
35
+ lines.push(`| ${row.join(" | ")} |`);
36
+ }
37
+ if (items.length > maxItems) lines.push("", `_Showing ${maxItems} of ${items.length} items_`);
38
+ lines.push("");
39
+ return lines.join("\n");
40
+ }
41
+ /**
42
+ * Generate a markdown list from array data.
43
+ * Uses summaryFields to create concise list items.
44
+ */
45
+ function schemaToMarkdownList(schema, items, options = {}) {
46
+ const { maxItems = 50, summaryFields, includeFields, excludeFields = [] } = options;
47
+ const fields = getFieldMeta(schema, includeFields, excludeFields);
48
+ const displayFields = summaryFields ? fields.filter((f) => summaryFields.includes(f.name)) : fields.slice(0, 3);
49
+ if (displayFields.length === 0 || items.length === 0) return "_No data available_\n";
50
+ const limitedItems = items.slice(0, maxItems);
51
+ const lines = [];
52
+ for (const item of limitedItems) {
53
+ const primaryValue = formatCellValue(getFieldValue(item, displayFields[0]?.name ?? "id"));
54
+ const secondaryValues = displayFields.slice(1).map((f) => `${f.label}: ${formatCellValue(getFieldValue(item, f.name))}`).join(" · ");
55
+ const itemLine = secondaryValues ? `- **${primaryValue}** (${secondaryValues})` : `- **${primaryValue}**`;
56
+ lines.push(itemLine);
57
+ }
58
+ if (items.length > maxItems) lines.push("", `_Showing ${maxItems} of ${items.length} items_`);
59
+ lines.push("");
60
+ return lines.join("\n");
61
+ }
62
+ /**
63
+ * Generate a markdown detail view (key-value pairs) from object data.
64
+ */
65
+ function schemaToMarkdownDetail(schema, item, options = {}) {
66
+ const { includeFields, excludeFields = [], maxDepth = 2 } = options;
67
+ if (item === null || typeof item !== "object") return "_No data available_\n";
68
+ const fields = getFieldMeta(schema, includeFields, excludeFields);
69
+ if (fields.length === 0) return "_No fields to display_\n";
70
+ const lines = [];
71
+ for (const field of fields) {
72
+ const formattedValue = formatDetailValue(getFieldValue(item, field.name), maxDepth, 0);
73
+ lines.push(`**${field.label}:** ${formattedValue}`);
74
+ }
75
+ lines.push("");
76
+ return lines.join("\n");
77
+ }
78
+ /**
79
+ * Generate markdown summary statistics for numeric fields in array data.
80
+ */
81
+ function schemaToMarkdownSummary(items, options = {}) {
82
+ const { numericFields = [], countByField } = options;
83
+ const lines = [];
84
+ lines.push(`**Total Items:** ${items.length}`);
85
+ for (const fieldName of numericFields) {
86
+ const values = items.map((item) => getFieldValue(item, fieldName)).filter((v) => typeof v === "number");
87
+ if (values.length > 0) {
88
+ const sum = values.reduce((a, b) => a + b, 0);
89
+ const avg = sum / values.length;
90
+ const min = Math.min(...values);
91
+ const max = Math.max(...values);
92
+ lines.push(`**${formatFieldName(fieldName)}:** Sum: ${formatNumber(sum)}, Avg: ${formatNumber(avg)}, Min: ${formatNumber(min)}, Max: ${formatNumber(max)}`);
93
+ }
94
+ }
95
+ if (countByField) {
96
+ const counts = {};
97
+ for (const item of items) {
98
+ const value = String(getFieldValue(item, countByField) ?? "Unknown");
99
+ counts[value] = (counts[value] ?? 0) + 1;
100
+ }
101
+ lines.push("", `**By ${formatFieldName(countByField)}:**`);
102
+ for (const [value, count] of Object.entries(counts)) lines.push(`- ${value}: ${count}`);
103
+ }
104
+ lines.push("");
105
+ return lines.join("\n");
106
+ }
107
+ /**
108
+ * Get field metadata from schema, applying include/exclude filters
109
+ */
110
+ function getFieldMeta(schema, includeFields, excludeFields = []) {
111
+ const schemaFields = schema.config.fields;
112
+ return Object.keys(schemaFields).filter((name) => {
113
+ if (excludeFields.includes(name)) return false;
114
+ if (includeFields && !includeFields.includes(name)) return false;
115
+ return true;
116
+ }).map((name) => {
117
+ const fieldConfig = schemaFields[name];
118
+ const isNested = Boolean(fieldConfig?.type && typeof fieldConfig.type === "object" && "config" in fieldConfig.type && typeof fieldConfig.type.config?.fields === "object");
119
+ return {
120
+ name,
121
+ label: formatFieldName(name),
122
+ isOptional: fieldConfig?.isOptional ?? false,
123
+ isArray: fieldConfig?.isArray === true,
124
+ isNested
125
+ };
126
+ });
127
+ }
128
+ /**
129
+ * Get value from object by field name (supports nested paths)
130
+ */
131
+ function getFieldValue(item, fieldName) {
132
+ if (item === null || typeof item !== "object") return void 0;
133
+ const obj = item;
134
+ if (fieldName.includes(".")) {
135
+ const parts = fieldName.split(".");
136
+ let current = obj;
137
+ for (const part of parts) {
138
+ if (current === null || typeof current !== "object") return void 0;
139
+ current = current[part];
140
+ }
141
+ return current;
142
+ }
143
+ return obj[fieldName];
144
+ }
145
+ /**
146
+ * Format a value for table cell display
147
+ */
148
+ function formatCellValue(value) {
149
+ if (value === null || value === void 0) return "-";
150
+ if (typeof value === "boolean") return value ? "✓" : "✗";
151
+ if (typeof value === "number") return formatNumber(value);
152
+ if (value instanceof Date) return formatDate(value);
153
+ if (typeof value === "string" && isISODate(value)) return formatDate(new Date(value));
154
+ if (Array.isArray(value)) return `[${value.length} items]`;
155
+ if (typeof value === "object") return "[Object]";
156
+ const str = String(value);
157
+ return str.length > 50 ? `${str.slice(0, 47)}...` : str.replace(/\|/g, "\\|");
158
+ }
159
+ /**
160
+ * Format a value for detail view (allows more space)
161
+ */
162
+ function formatDetailValue(value, maxDepth, currentDepth) {
163
+ if (value === null || value === void 0) return "_none_";
164
+ if (typeof value === "boolean") return value ? "Yes" : "No";
165
+ if (typeof value === "number") return formatNumber(value);
166
+ if (value instanceof Date) return formatDate(value);
167
+ if (typeof value === "string" && isISODate(value)) return formatDate(new Date(value));
168
+ if (Array.isArray(value)) {
169
+ if (value.length === 0) return "_empty list_";
170
+ if (currentDepth >= maxDepth) return `[${value.length} items]`;
171
+ if (value.length <= 5 && value.every((v) => typeof v !== "object")) return value.map((v) => formatCellValue(v)).join(", ");
172
+ return `[${value.length} items]`;
173
+ }
174
+ if (typeof value === "object") {
175
+ if (currentDepth >= maxDepth) return "[Object]";
176
+ return `{${Object.keys(value).length} fields}`;
177
+ }
178
+ return String(value);
179
+ }
180
+ /**
181
+ * Format field name to human-readable label
182
+ */
183
+ function formatFieldName(name) {
184
+ return name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").replace(/^\w/, (c) => c.toUpperCase());
185
+ }
186
+ /**
187
+ * Format number with locale-aware formatting
188
+ */
189
+ function formatNumber(value) {
190
+ if (Math.abs(value) >= 1e3) return new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(value);
191
+ if (Number.isInteger(value)) return String(value);
192
+ return value.toFixed(2);
193
+ }
194
+ /**
195
+ * Format date to readable string
196
+ */
197
+ function formatDate(date) {
198
+ return date.toLocaleDateString("en-US", {
199
+ year: "numeric",
200
+ month: "short",
201
+ day: "numeric"
202
+ });
203
+ }
204
+ /**
205
+ * Check if string is ISO date format
206
+ */
207
+ function isISODate(str) {
208
+ if (!/^\d{4}-\d{2}-\d{2}/.test(str)) return false;
209
+ const date = new Date(str);
210
+ return !isNaN(date.getTime());
211
+ }
212
+
213
+ //#endregion
214
+ export { schemaToMarkdown, schemaToMarkdownDetail, schemaToMarkdownList, schemaToMarkdownSummary, schemaToMarkdownTable };
@@ -0,0 +1,15 @@
1
+ import { ResourceRegistry } from "../resources.js";
2
+
3
+ //#region src/server/contracts-adapter-hydration.d.ts
4
+ interface ReturnsDecl {
5
+ isList: boolean;
6
+ inner: string;
7
+ }
8
+ declare function parseReturns(returnsLike: string): ReturnsDecl;
9
+ declare function hydrateResourceIfNeeded(resources: ResourceRegistry | undefined, result: unknown, opts: {
10
+ template?: string;
11
+ varName?: string;
12
+ returns: ReturnsDecl;
13
+ }): Promise<unknown>;
14
+ //#endregion
15
+ export { ReturnsDecl, hydrateResourceIfNeeded, parseReturns };
@@ -0,0 +1,41 @@
1
+ //#region src/server/contracts-adapter-hydration.ts
2
+ function parseReturns(returnsLike) {
3
+ if (!returnsLike) return {
4
+ isList: false,
5
+ inner: "JSON"
6
+ };
7
+ const trimmed = String(returnsLike).trim();
8
+ if (trimmed.startsWith("[") && trimmed.endsWith("]")) return {
9
+ isList: true,
10
+ inner: trimmed.slice(1, -1).trim()
11
+ };
12
+ return {
13
+ isList: false,
14
+ inner: trimmed
15
+ };
16
+ }
17
+ async function hydrateResourceIfNeeded(resources, result, opts) {
18
+ if (!resources || !opts.template) return result;
19
+ const varName = opts.varName ?? "id";
20
+ const hydrateOne = async (item) => {
21
+ if (item && typeof item === "object" && varName in item) {
22
+ const key = String(item[varName]);
23
+ const uri = (opts.template ?? "").replace("{id}", key);
24
+ const match = resources.match(uri);
25
+ if (match) {
26
+ const resolved = await match.tmpl.resolve(match.params, {});
27
+ try {
28
+ return JSON.parse(String(resolved.data || "null"));
29
+ } catch {
30
+ return resolved.data;
31
+ }
32
+ }
33
+ }
34
+ return item;
35
+ };
36
+ if (opts.returns.isList && Array.isArray(result)) return await Promise.all(result.map((x) => hydrateOne(x)));
37
+ return await hydrateOne(result);
38
+ }
39
+
40
+ //#endregion
41
+ export { hydrateResourceIfNeeded, parseReturns };
@@ -0,0 +1,9 @@
1
+ import { AnySchemaModel } from "@lssm/lib.schema";
2
+ import { SchemaTypes } from "@pothos/core";
3
+
4
+ //#region src/server/contracts-adapter-input.d.ts
5
+ declare function createInputTypeBuilder<T extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<T>): {
6
+ buildInputFieldArgs: (model: AnySchemaModel | null) => null;
7
+ };
8
+ //#endregion
9
+ export { createInputTypeBuilder };
@@ -0,0 +1,77 @@
1
+ //#region src/server/contracts-adapter-input.ts
2
+ function isSchemaModel(x) {
3
+ return typeof x?.getPothosInput === "function" && typeof x?.getZod === "function";
4
+ }
5
+ function isFieldType(x) {
6
+ return typeof x?.getPothos === "function";
7
+ }
8
+ function isEnumType(x) {
9
+ return typeof x?.getEnumValues === "function" && typeof x?.getPothos === "function";
10
+ }
11
+ function mapScalarName(name) {
12
+ if (name === "Boolean_unsecure") return "Boolean";
13
+ if (name === "ID_unsecure") return "ID";
14
+ if (name === "String_unsecure") return "String";
15
+ if (name === "Int_unsecure") return "Int";
16
+ if (name === "Float_unsecure") return "Float";
17
+ return name;
18
+ }
19
+ function createInputTypeBuilder(builder) {
20
+ const inputTypeCache = /* @__PURE__ */ new Map();
21
+ const enumTypeCache = /* @__PURE__ */ new Set();
22
+ function registerEnumsForModel(model) {
23
+ const entries = Object.entries(model.config.fields);
24
+ for (const [, field] of entries) if (isSchemaModel(field.type)) registerEnumsForModel(field.type);
25
+ else if (isEnumType(field.type)) {
26
+ const enumObj = field.type;
27
+ const name = enumObj.getName?.() ?? enumObj.getPothos().name;
28
+ if (!enumTypeCache.has(name)) {
29
+ builder.enumType(name, { values: enumObj.getEnumValues() });
30
+ enumTypeCache.add(name);
31
+ }
32
+ }
33
+ }
34
+ function ensureInputTypeForModel(model) {
35
+ const typeName = String(model.config?.name ?? "Input");
36
+ const cached = inputTypeCache.get(typeName);
37
+ if (cached) return cached;
38
+ registerEnumsForModel(model);
39
+ const created = builder.inputType(model.getPothosInput(), { fields: (t) => {
40
+ const entries = Object.entries(model.config.fields);
41
+ const acc = {};
42
+ for (const [key, field] of entries) if (isSchemaModel(field.type)) {
43
+ const nested = ensureInputTypeForModel(field.type);
44
+ const typeRef = field.isArray ? [nested] : nested;
45
+ acc[key] = t.field({
46
+ type: typeRef,
47
+ required: !field.isOptional
48
+ });
49
+ } else if (isFieldType(field.type)) {
50
+ const typeName$1 = mapScalarName(String(field.type.getPothos().name));
51
+ const typeRef = field.isArray ? [typeName$1] : typeName$1;
52
+ acc[key] = t.field({
53
+ type: typeRef,
54
+ required: !field.isOptional
55
+ });
56
+ } else {
57
+ const typeRef = field.isArray ? ["JSON"] : "JSON";
58
+ acc[key] = t.field({
59
+ type: typeRef,
60
+ required: !field.isOptional
61
+ });
62
+ }
63
+ return acc;
64
+ } });
65
+ inputTypeCache.set(typeName, created);
66
+ return created;
67
+ }
68
+ function buildInputFieldArgs(model) {
69
+ if (!model) return null;
70
+ if (!model.config?.fields || Object.keys(model.config.fields).length === 0) return null;
71
+ return ensureInputTypeForModel(model);
72
+ }
73
+ return { buildInputFieldArgs };
74
+ }
75
+
76
+ //#endregion
77
+ export { createInputTypeBuilder };
@@ -0,0 +1,31 @@
1
+ import { ResourceRegistry } from "../resources.js";
2
+ import { OperationSpecRegistry } from "../operations/registry.js";
3
+ import "@pothos/plugin-prisma";
4
+ import "@pothos/plugin-complexity";
5
+ import "@pothos/plugin-relay";
6
+ import "@pothos/plugin-dataloader";
7
+ import "@pothos/plugin-tracing";
8
+ import { SchemaTypes } from "@pothos/core";
9
+
10
+ //#region src/server/graphql-pothos.d.ts
11
+
12
+ /**
13
+ * Registers all ContractSpecs from a OperationSpecRegistry onto a Pothos SchemaBuilder.
14
+ *
15
+ * This adapter:
16
+ * 1. Discovers output types from specs and registers them as Pothos object types.
17
+ * 2. Maps `ContractSpec` (OperationSpec) inputs to Pothos input types.
18
+ * 3. Mounts `query` specs as `Query` fields and `command` specs as `Mutation` fields.
19
+ * 4. Wraps the resolver to:
20
+ * - Enforce auth policies (basic check).
21
+ * - Build a `HandlerCtx`.
22
+ * - Execute via `OperationSpecRegistry`.
23
+ * - Hydrate resource references if applicable.
24
+ *
25
+ * @param builder - The Pothos SchemaBuilder instance.
26
+ * @param reg - The OperationSpecRegistry containing operations.
27
+ * @param resources - (Optional) ResourceRegistry for hydrating resource references.
28
+ */
29
+ declare function registerContractsOnBuilder<T extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<T>, reg: OperationSpecRegistry, resources?: ResourceRegistry): void;
30
+ //#endregion
31
+ export { registerContractsOnBuilder };
@@ -1 +1,127 @@
1
- import{hydrateResourceIfNeeded as e,parseReturns as t}from"../contracts-adapter-hydration.js";import{createInputTypeBuilder as n}from"../contracts-adapter-input.js";import{defaultGqlField as r}from"../jsonschema.js";import"../node_modules/@pothos/plugin-prisma/esm/index.js";import"../node_modules/@pothos/plugin-complexity/esm/index.js";import"../node_modules/@pothos/plugin-dataloader/esm/index.js";import"../node_modules/@pothos/plugin-tracing/esm/index.js";import"@pothos/plugin-relay";function i(i,a,o){let{buildInputFieldArgs:s}=n(i),c=new Map;for(let e of a.listSpecs()){let t=e.io.output;if(t&&`getZod`in t&&typeof t.getZod==`function`){let e=t,n=e.config?.name??`UnknownOutput`;c.has(n)||c.set(n,e)}}for(let[e,t]of c.entries())i.objectType(e,{fields:e=>{let n=Object.entries(t.config.fields),r={};for(let[t,i]of n){let n=i.type,a=`JSON`;n&&typeof n.getPothos==`function`&&(a=n.getPothos().name||`JSON`,a===`String_unsecure`&&(a=`String`),a===`Int_unsecure`&&(a=`Int`),a===`Float_unsecure`&&(a=`Float`),a===`Boolean_unsecure`&&(a=`Boolean`),a===`ID_unsecure`&&(a=`ID`));let o=i.isArray?[a]:a;r[t]=e.field({type:o,nullable:i.isOptional,resolve:e=>e[t]})}return r}});function l(e){let t=e.transport?.gql?.returns;if(t)return t;let n=e.io.output??{};if(n&&`kind`in n&&n.kind===`resource_ref`&&`graphQLType`in n&&n.graphQLType)return String(n.graphQLType);if(n&&`getZod`in n&&typeof n.getZod==`function`){let e=n.config?.name;if(e&&c.has(e))return e}return`JSON`}for(let n of a.listSpecs()){let c=n.transport?.gql?.field??r(n.meta.name,n.meta.version);n.transport?.gql?.returns;let u=n.transport?.gql?.byIdField??`id`,d=n.transport?.gql?.resource,f=n.meta.kind===`query`,p=l(n),m=n.transport?.gql?.returns,h=t(m??p),g=async(t,r,i)=>{if(n.policy.auth!==`anonymous`&&!i.user)throw Error(`Unauthorized`);let s={traceId:i.logger?.getTraceId?.()??void 0,userId:i.user?.id??null,organizationId:i.session?.activeOrganizationId??null,actor:i.user?`user`:`anonymous`,channel:`web`,eventPublisher:i.eventPublisher},c=n.io.input?.getZod().parse(r.input??{}),l=await a.execute(n.meta.name,n.meta.version,c,s),f=n.io.output;if(o&&(d||f?.kind===`resource_ref`)){let t=u??f?.varName??`id`,n=await e(o,l,{template:d??f?.uriTemplate,varName:t,returns:h});if(n!==l)return n}return p?h.inner===`Boolean`&&!h.isList?!!(l?.ok??l):l:n.io.output.getZod().parse(l)},_=e=>{let t=s(n.io.input);return e.field({type:h.isList?[h.inner]:h.inner,complexity:()=>10,resolve:g,args:t?{input:e.arg({type:t,required:!0})}:void 0})};f?i.queryField(c,_):i.mutationField(c,_)}}export{i as registerContractsOnBuilder};
1
+ import { defaultGqlField } from "../jsonschema.js";
2
+ import { createInputTypeBuilder } from "./contracts-adapter-input.js";
3
+ import { hydrateResourceIfNeeded, parseReturns } from "./contracts-adapter-hydration.js";
4
+ import "@pothos/plugin-prisma";
5
+ import "@pothos/plugin-complexity";
6
+ import "@pothos/plugin-relay";
7
+ import "@pothos/plugin-dataloader";
8
+ import "@pothos/plugin-tracing";
9
+
10
+ //#region src/server/graphql-pothos.ts
11
+ /**
12
+ * Registers all ContractSpecs from a OperationSpecRegistry onto a Pothos SchemaBuilder.
13
+ *
14
+ * This adapter:
15
+ * 1. Discovers output types from specs and registers them as Pothos object types.
16
+ * 2. Maps `ContractSpec` (OperationSpec) inputs to Pothos input types.
17
+ * 3. Mounts `query` specs as `Query` fields and `command` specs as `Mutation` fields.
18
+ * 4. Wraps the resolver to:
19
+ * - Enforce auth policies (basic check).
20
+ * - Build a `HandlerCtx`.
21
+ * - Execute via `OperationSpecRegistry`.
22
+ * - Hydrate resource references if applicable.
23
+ *
24
+ * @param builder - The Pothos SchemaBuilder instance.
25
+ * @param reg - The OperationSpecRegistry containing operations.
26
+ * @param resources - (Optional) ResourceRegistry for hydrating resource references.
27
+ */
28
+ function registerContractsOnBuilder(builder, reg, resources) {
29
+ const { buildInputFieldArgs } = createInputTypeBuilder(builder);
30
+ const outputTypeCache = /* @__PURE__ */ new Map();
31
+ for (const spec of reg.listSpecs()) {
32
+ const out = spec.io.output;
33
+ if (out && "getZod" in out && typeof out.getZod === "function") {
34
+ const model = out;
35
+ const typeName = model.config?.name ?? "UnknownOutput";
36
+ if (!outputTypeCache.has(typeName)) outputTypeCache.set(typeName, model);
37
+ }
38
+ }
39
+ for (const [typeName, model] of outputTypeCache.entries()) builder.objectType(typeName, { fields: (t) => {
40
+ const entries = Object.entries(model.config.fields);
41
+ const acc = {};
42
+ for (const [key, field] of entries) {
43
+ const fieldType = field.type;
44
+ let gqlType = "JSON";
45
+ if (fieldType && typeof fieldType.getPothos === "function") {
46
+ gqlType = fieldType.getPothos().name || "JSON";
47
+ if (gqlType === "String_unsecure") gqlType = "String";
48
+ if (gqlType === "Int_unsecure") gqlType = "Int";
49
+ if (gqlType === "Float_unsecure") gqlType = "Float";
50
+ if (gqlType === "Boolean_unsecure") gqlType = "Boolean";
51
+ if (gqlType === "ID_unsecure") gqlType = "ID";
52
+ }
53
+ const typeRef = field.isArray ? [gqlType] : gqlType;
54
+ acc[key] = t.field({
55
+ type: typeRef,
56
+ nullable: field.isOptional,
57
+ resolve: (parent) => parent[key]
58
+ });
59
+ }
60
+ return acc;
61
+ } });
62
+ function resolveGraphQLTypeName(contractSpec) {
63
+ const returnsName = contractSpec.transport?.gql?.returns;
64
+ if (returnsName) return returnsName;
65
+ const out = contractSpec.io.output ?? {};
66
+ if (out && "kind" in out && out.kind === "resource_ref" && "graphQLType" in out && out.graphQLType) return String(out.graphQLType);
67
+ if (out && "getZod" in out && typeof out.getZod === "function") {
68
+ const typeName = out.config?.name;
69
+ if (typeName && outputTypeCache.has(typeName)) return typeName;
70
+ }
71
+ return "JSON";
72
+ }
73
+ for (const spec of reg.listSpecs()) {
74
+ const fieldName = spec.transport?.gql?.field ?? defaultGqlField(spec.meta.key, spec.meta.version);
75
+ const byIdField = spec.transport?.gql?.byIdField ?? "id";
76
+ const returnsResource = spec.transport?.gql?.resource;
77
+ const isQuery = spec.meta.kind === "query";
78
+ const graphQLTypeName = resolveGraphQLTypeName(spec);
79
+ const returnsDecl = spec.transport?.gql?.returns;
80
+ const parsed = parseReturns(returnsDecl ?? graphQLTypeName);
81
+ const resolveFieldFn = async (_root, args, ctx) => {
82
+ if (spec.policy.auth !== "anonymous" && !ctx.user) throw new Error("Unauthorized");
83
+ const handlerCtx = {
84
+ traceId: ctx.logger?.getTraceId?.() ?? void 0,
85
+ userId: ctx.user?.id ?? null,
86
+ organizationId: ctx.session?.activeOrganizationId ?? null,
87
+ actor: ctx.user ? "user" : "anonymous",
88
+ channel: "web",
89
+ eventPublisher: ctx.eventPublisher
90
+ };
91
+ const parsedInput = spec.io.input?.getZod().parse(args.input ?? {});
92
+ const result = await reg.execute(spec.meta.key, spec.meta.version, parsedInput, handlerCtx);
93
+ const out = spec.io.output;
94
+ if (resources && (returnsResource || out?.kind === "resource_ref")) {
95
+ const varName = byIdField ?? out?.varName ?? "id";
96
+ const hydrated = await hydrateResourceIfNeeded(resources, result, {
97
+ template: returnsResource ?? out?.uriTemplate,
98
+ varName,
99
+ returns: parsed
100
+ });
101
+ if (hydrated !== result) return hydrated;
102
+ }
103
+ if (graphQLTypeName) {
104
+ if (parsed.inner === "Boolean" && !parsed.isList) return Boolean(result?.ok ?? result);
105
+ return result;
106
+ }
107
+ return spec.io.output.getZod().parse(result);
108
+ };
109
+ const fieldSettingsFn = (t) => {
110
+ const inputType = buildInputFieldArgs(spec.io.input);
111
+ return t.field({
112
+ type: parsed.isList ? [parsed.inner] : parsed.inner,
113
+ complexity: () => 10,
114
+ resolve: resolveFieldFn,
115
+ args: inputType ? { input: t.arg({
116
+ type: inputType,
117
+ required: true
118
+ }) } : void 0
119
+ });
120
+ };
121
+ if (isQuery) builder.queryField(fieldName, fieldSettingsFn);
122
+ else builder.mutationField(fieldName, fieldSettingsFn);
123
+ }
124
+ }
125
+
126
+ //#endregion
127
+ export { registerContractsOnBuilder };
@@ -0,0 +1,9 @@
1
+ import { registerContractsOnBuilder } from "./graphql-pothos.js";
2
+ import { createMcpServer } from "./mcp/createMcpServer.js";
3
+ import "./provider-mcp.js";
4
+ import { RestOptions, createFetchHandler } from "./rest-generic.js";
5
+ import { elysiaPlugin } from "./rest-elysia.js";
6
+ import { expressRouter } from "./rest-express.js";
7
+ import { makeNextAppHandler } from "./rest-next-app.js";
8
+ import { makeNextPagesHandler } from "./rest-next-pages.js";
9
+ export { RestOptions, createFetchHandler, createMcpServer, elysiaPlugin, expressRouter, makeNextAppHandler, makeNextPagesHandler, registerContractsOnBuilder };
@@ -1 +1,10 @@
1
- import{registerContractsOnBuilder as e}from"./graphql-pothos.js";import{createMcpServer as t}from"./mcp/createMcpServer.js";import"./provider-mcp.js";import{createFetchHandler as n}from"./rest-generic.js";import{elysiaPlugin as r}from"./rest-elysia.js";import{expressRouter as i}from"./rest-express.js";import{makeNextAppHandler as a}from"./rest-next-app.js";import{makeNextPagesHandler as o}from"./rest-next-pages.js";export{n as createFetchHandler,t as createMcpServer,r as elysiaPlugin,i as expressRouter,a as makeNextAppHandler,o as makeNextPagesHandler,e as registerContractsOnBuilder};
1
+ import { registerContractsOnBuilder } from "./graphql-pothos.js";
2
+ import { createMcpServer } from "./mcp/createMcpServer.js";
3
+ import "./provider-mcp.js";
4
+ import { createFetchHandler } from "./rest-generic.js";
5
+ import { elysiaPlugin } from "./rest-elysia.js";
6
+ import { expressRouter } from "./rest-express.js";
7
+ import { makeNextAppHandler } from "./rest-next-app.js";
8
+ import { makeNextPagesHandler } from "./rest-next-pages.js";
9
+
10
+ export { createFetchHandler, createMcpServer, elysiaPlugin, expressRouter, makeNextAppHandler, makeNextPagesHandler, registerContractsOnBuilder };
@@ -0,0 +1,15 @@
1
+ import { ResourceRegistry } from "../../resources.js";
2
+ import { OperationSpecRegistry } from "../../operations/registry.js";
3
+ import { PromptRegistry } from "../../promptRegistry.js";
4
+ import { McpCtxFactories } from "./mcpTypes.js";
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+
7
+ //#region src/server/mcp/createMcpServer.d.ts
8
+
9
+ /**
10
+ * Creates a unified Model Context Protocol (MCP) server exposing operations, resources, prompts,
11
+ * and (optionally) presentations.\n+ *
12
+ * ContractSpec exposes:\n+ * - Tools: `command` operations from `OperationSpecRegistry`.\n+ * - Resources: templates from `ResourceRegistry`.\n+ * - Prompts: templates from `PromptRegistry`.\n+ * - Presentations: V1 registry and/or V2 descriptors as read-only resources.\n+ */
13
+ declare function createMcpServer(server: McpServer, ops: OperationSpecRegistry, resources: ResourceRegistry, prompts: PromptRegistry, ctxFactories: McpCtxFactories): McpServer;
14
+ //#endregion
15
+ export { createMcpServer };
@@ -1 +1,28 @@
1
- import{registerMcpTools as e}from"./registerTools.js";import{registerMcpResources as t}from"./registerResources.js";import{registerMcpPrompts as n}from"./registerPrompts.js";import{registerMcpPresentations as r}from"./registerPresentations.js";function i(i,a,o,s,c){return c.logger.info(`Creating MCP server`),e(i,a,{toolCtx:c.toolCtx}),t(i,o,{logger:c.logger,resourceCtx:c.resourceCtx}),r(i,{logger:c.logger,presentations:c.presentations,presentationsV2:c.presentationsV2}),n(i,s,{promptCtx:c.promptCtx}),i}export{i as createMcpServer};
1
+ import { registerMcpTools } from "./registerTools.js";
2
+ import { registerMcpResources } from "./registerResources.js";
3
+ import { registerMcpPrompts } from "./registerPrompts.js";
4
+ import { registerMcpPresentations } from "./registerPresentations.js";
5
+
6
+ //#region src/server/mcp/createMcpServer.ts
7
+ /**
8
+ * Creates a unified Model Context Protocol (MCP) server exposing operations, resources, prompts,
9
+ * and (optionally) presentations.\n+ *
10
+ * ContractSpec exposes:\n+ * - Tools: `command` operations from `OperationSpecRegistry`.\n+ * - Resources: templates from `ResourceRegistry`.\n+ * - Prompts: templates from `PromptRegistry`.\n+ * - Presentations: V1 registry and/or V2 descriptors as read-only resources.\n+ */
11
+ function createMcpServer(server, ops, resources, prompts, ctxFactories) {
12
+ ctxFactories.logger.info("Creating MCP server");
13
+ registerMcpTools(server, ops, { toolCtx: ctxFactories.toolCtx });
14
+ registerMcpResources(server, resources, {
15
+ logger: ctxFactories.logger,
16
+ resourceCtx: ctxFactories.resourceCtx
17
+ });
18
+ registerMcpPresentations(server, {
19
+ logger: ctxFactories.logger,
20
+ presentations: ctxFactories.presentations,
21
+ presentationsV2: ctxFactories.presentationsV2
22
+ });
23
+ registerMcpPrompts(server, prompts, { promptCtx: ctxFactories.promptCtx });
24
+ return server;
25
+ }
26
+
27
+ //#endregion
28
+ export { createMcpServer };
@@ -0,0 +1,30 @@
1
+ import { PresentationSpec } from "../../presentations/presentations.js";
2
+ import { HandlerCtx } from "../../types.js";
3
+ import { PresentationRegistry } from "../../presentations/registry.js";
4
+ import "../../presentations/index.js";
5
+ import { Logger } from "@lssm/lib.logger";
6
+
7
+ //#region src/server/mcp/mcpTypes.d.ts
8
+ interface McpCtxFactories {
9
+ logger: Logger;
10
+ /** Factory for tool execution context (e.g., system actor) */
11
+ toolCtx: () => HandlerCtx;
12
+ /** Factory for prompt rendering context */
13
+ promptCtx: () => {
14
+ userId?: string | null;
15
+ orgId?: string | null;
16
+ locale?: string;
17
+ };
18
+ /** Factory for resource resolution context */
19
+ resourceCtx: () => {
20
+ userId?: string | null;
21
+ orgId?: string | null;
22
+ locale?: string;
23
+ };
24
+ /** Optional registry for presentations */
25
+ presentations?: PresentationRegistry;
26
+ /** Optional list of presentation specs */
27
+ presentationsV2?: PresentationSpec[];
28
+ }
29
+ //#endregion
30
+ export { McpCtxFactories };
@@ -0,0 +1,7 @@
1
+ import { McpCtxFactories } from "./mcpTypes.js";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+
4
+ //#region src/server/mcp/registerPresentations.d.ts
5
+ declare function registerMcpPresentations(server: McpServer, ctx: Pick<McpCtxFactories, 'logger' | 'presentations' | 'presentationsV2'>): void;
6
+ //#endregion
7
+ export { registerMcpPresentations };