@contractspec/module.examples 1.45.1 → 1.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/index.js +1 -2
  2. package/dist/registry.d.ts +2 -2
  3. package/dist/registry.js +2 -3
  4. package/dist/registry.js.map +1 -1
  5. package/package.json +38 -37
  6. package/dist/libs/contracts/dist/_virtual/rolldown_runtime.js +0 -6
  7. package/dist/libs/contracts/dist/_virtual/rolldown_runtime.js.map +0 -1
  8. package/dist/libs/contracts/dist/app-config/spec.js +0 -1
  9. package/dist/libs/contracts/dist/capabilities/capabilities.js +0 -1
  10. package/dist/libs/contracts/dist/capabilities/index.js +0 -2
  11. package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -89
  12. package/dist/libs/contracts/dist/capabilities/openbanking.js.map +0 -1
  13. package/dist/libs/contracts/dist/client/index.js +0 -5
  14. package/dist/libs/contracts/dist/client/react/feature-render.js +0 -3
  15. package/dist/libs/contracts/dist/client/react/form-render.js +0 -6
  16. package/dist/libs/contracts/dist/client/react/index.js +0 -4
  17. package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
  18. package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -61
  19. package/dist/libs/contracts/dist/contract-registry/schemas.js.map +0 -1
  20. package/dist/libs/contracts/dist/data-views/index.js +0 -1
  21. package/dist/libs/contracts/dist/data-views/registry.js +0 -1
  22. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -17
  23. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js.map +0 -1
  24. package/dist/libs/contracts/dist/docs/index.js +0 -27
  25. package/dist/libs/contracts/dist/docs/meta.docs.js +0 -30
  26. package/dist/libs/contracts/dist/docs/meta.docs.js.map +0 -1
  27. package/dist/libs/contracts/dist/docs/presentations.js +0 -57
  28. package/dist/libs/contracts/dist/docs/presentations.js.map +0 -1
  29. package/dist/libs/contracts/dist/docs/registry.js +0 -45
  30. package/dist/libs/contracts/dist/docs/registry.js.map +0 -1
  31. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -81
  32. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js.map +0 -1
  33. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -58
  34. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js.map +0 -1
  35. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-import.docblock.js +0 -65
  36. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-import.docblock.js.map +0 -1
  37. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -17
  38. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js.map +0 -1
  39. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -358
  40. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js.map +0 -1
  41. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -38
  42. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js.map +0 -1
  43. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -17
  44. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js.map +0 -1
  45. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -21
  46. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js.map +0 -1
  47. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -49
  48. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js.map +0 -1
  49. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -80
  50. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js.map +0 -1
  51. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -85
  52. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js.map +0 -1
  53. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -46
  54. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js.map +0 -1
  55. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -68
  56. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js.map +0 -1
  57. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -41
  58. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js.map +0 -1
  59. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -70
  60. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js.map +0 -1
  61. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -48
  62. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js.map +0 -1
  63. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -63
  64. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js.map +0 -1
  65. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -156
  66. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js.map +0 -1
  67. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -21
  68. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js.map +0 -1
  69. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -102
  70. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js.map +0 -1
  71. package/dist/libs/contracts/dist/docs/tech-contracts.docs.js +0 -97
  72. package/dist/libs/contracts/dist/docs/tech-contracts.docs.js.map +0 -1
  73. package/dist/libs/contracts/dist/events.js +0 -2
  74. package/dist/libs/contracts/dist/examples/index.js +0 -3
  75. package/dist/libs/contracts/dist/examples/registry.js +0 -145
  76. package/dist/libs/contracts/dist/examples/registry.js.map +0 -1
  77. package/dist/libs/contracts/dist/examples/schema.js +0 -102
  78. package/dist/libs/contracts/dist/examples/schema.js.map +0 -1
  79. package/dist/libs/contracts/dist/examples/validation.js +0 -1
  80. package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
  81. package/dist/libs/contracts/dist/experiments/spec.js +0 -1
  82. package/dist/libs/contracts/dist/features/index.js +0 -1
  83. package/dist/libs/contracts/dist/features/registry.js +0 -7
  84. package/dist/libs/contracts/dist/features/registry.js.map +0 -1
  85. package/dist/libs/contracts/dist/forms/forms.js +0 -2
  86. package/dist/libs/contracts/dist/forms/index.js +0 -1
  87. package/dist/libs/contracts/dist/index.js +0 -109
  88. package/dist/libs/contracts/dist/index.js.map +0 -1
  89. package/dist/libs/contracts/dist/install.js +0 -2
  90. package/dist/libs/contracts/dist/integrations/index.js +0 -19
  91. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -230
  92. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js.map +0 -1
  93. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -161
  94. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js.map +0 -1
  95. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  96. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -212
  97. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js.map +0 -1
  98. package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -243
  99. package/dist/libs/contracts/dist/integrations/openbanking/models.js.map +0 -1
  100. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -14
  101. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js.map +0 -1
  102. package/dist/libs/contracts/dist/integrations/operations.js +0 -384
  103. package/dist/libs/contracts/dist/integrations/operations.js.map +0 -1
  104. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  105. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js.map +0 -1
  106. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  107. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js.map +0 -1
  108. package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
  109. package/dist/libs/contracts/dist/integrations/providers/gmail.js.map +0 -1
  110. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
  111. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js.map +0 -1
  112. package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
  113. package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
  114. package/dist/libs/contracts/dist/integrations/providers/mistral.js.map +0 -1
  115. package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
  116. package/dist/libs/contracts/dist/integrations/providers/postmark.js.map +0 -1
  117. package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
  118. package/dist/libs/contracts/dist/integrations/providers/powens.js.map +0 -1
  119. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
  120. package/dist/libs/contracts/dist/integrations/providers/qdrant.js.map +0 -1
  121. package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -11
  122. package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
  123. package/dist/libs/contracts/dist/integrations/providers/stripe.js.map +0 -1
  124. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  125. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js.map +0 -1
  126. package/dist/libs/contracts/dist/integrations/spec.js +0 -1
  127. package/dist/libs/contracts/dist/jsonschema.js +0 -1
  128. package/dist/libs/contracts/dist/knowledge/index.js +0 -8
  129. package/dist/libs/contracts/dist/knowledge/operations.js +0 -313
  130. package/dist/libs/contracts/dist/knowledge/operations.js.map +0 -1
  131. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  132. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js.map +0 -1
  133. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  134. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js.map +0 -1
  135. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  136. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js.map +0 -1
  137. package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
  138. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  139. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js.map +0 -1
  140. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  141. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js.map +0 -1
  142. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  143. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js.map +0 -1
  144. package/dist/libs/contracts/dist/knowledge/spec.js +0 -1
  145. package/dist/libs/contracts/dist/llm/exporters.js +0 -21
  146. package/dist/libs/contracts/dist/llm/exporters.js.map +0 -1
  147. package/dist/libs/contracts/dist/llm/index.js +0 -2
  148. package/dist/libs/contracts/dist/llm/prompts.js +0 -1
  149. package/dist/libs/contracts/dist/migrations.js +0 -1
  150. package/dist/libs/contracts/dist/model-registry.js +0 -1
  151. package/dist/libs/contracts/dist/onboarding-base.js +0 -198
  152. package/dist/libs/contracts/dist/onboarding-base.js.map +0 -1
  153. package/dist/libs/contracts/dist/openapi.js +0 -2
  154. package/dist/libs/contracts/dist/operations/index.js +0 -2
  155. package/dist/libs/contracts/dist/operations/operation.js +0 -35
  156. package/dist/libs/contracts/dist/operations/operation.js.map +0 -1
  157. package/dist/libs/contracts/dist/operations/registry.js +0 -2
  158. package/dist/libs/contracts/dist/ownership.js +0 -22
  159. package/dist/libs/contracts/dist/ownership.js.map +0 -1
  160. package/dist/libs/contracts/dist/policy/engine.js +0 -1
  161. package/dist/libs/contracts/dist/policy/index.js +0 -2
  162. package/dist/libs/contracts/dist/policy/registry.js +0 -1
  163. package/dist/libs/contracts/dist/presentations/index.js +0 -2
  164. package/dist/libs/contracts/dist/presentations/registry.js +0 -1
  165. package/dist/libs/contracts/dist/presentations/transform-engine.js +0 -13
  166. package/dist/libs/contracts/dist/presentations/transform-engine.js.map +0 -1
  167. package/dist/libs/contracts/dist/prompt.js +0 -1
  168. package/dist/libs/contracts/dist/promptRegistry.js +0 -2
  169. package/dist/libs/contracts/dist/regenerator/index.js +0 -1
  170. package/dist/libs/contracts/dist/regenerator/service.js +0 -5
  171. package/dist/libs/contracts/dist/regenerator/service.js.map +0 -1
  172. package/dist/libs/contracts/dist/registry-utils.js +0 -71
  173. package/dist/libs/contracts/dist/registry-utils.js.map +0 -1
  174. package/dist/libs/contracts/dist/registry.js +0 -8
  175. package/dist/libs/contracts/dist/registry.js.map +0 -1
  176. package/dist/libs/contracts/dist/resources.js +0 -1
  177. package/dist/libs/contracts/dist/schema-to-markdown.js +0 -1
  178. package/dist/libs/contracts/dist/server/contracts-adapter-input.js +0 -1
  179. package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -8
  180. package/dist/libs/contracts/dist/server/index.js +0 -8
  181. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
  182. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
  183. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
  184. package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
  185. package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
  186. package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
  187. package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
  188. package/dist/libs/contracts/dist/server/rest-express.js +0 -1
  189. package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
  190. package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
  191. package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
  192. package/dist/libs/contracts/dist/telemetry/index.js +0 -2
  193. package/dist/libs/contracts/dist/telemetry/spec.js +0 -2
  194. package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
  195. package/dist/libs/contracts/dist/tests/index.js +0 -2
  196. package/dist/libs/contracts/dist/tests/runner.js +0 -2
  197. package/dist/libs/contracts/dist/tests/spec.js +0 -1
  198. package/dist/libs/contracts/dist/themes.js +0 -1
  199. package/dist/libs/contracts/dist/workflow/index.js +0 -2
  200. package/dist/libs/contracts/dist/workflow/overview.docblock.js +0 -21
  201. package/dist/libs/contracts/dist/workflow/overview.docblock.js.map +0 -1
  202. package/dist/libs/contracts/dist/workflow/runner.js +0 -1
  203. package/dist/libs/contracts/dist/workflow/spec.js +0 -1
  204. package/dist/libs/contracts/dist/workspace-config/contractsrc-schema.js +0 -263
  205. package/dist/libs/contracts/dist/workspace-config/contractsrc-schema.js.map +0 -1
  206. package/dist/libs/contracts/dist/workspace-config/index.js +0 -1
  207. package/dist/libs/contracts/dist/workspace-config/workspace-config.docblock.js +0 -45
  208. package/dist/libs/contracts/dist/workspace-config/workspace-config.docblock.js.map +0 -1
  209. package/dist/libs/schema/dist/EnumType.js +0 -2
  210. package/dist/libs/schema/dist/FieldType.js +0 -50
  211. package/dist/libs/schema/dist/FieldType.js.map +0 -1
  212. package/dist/libs/schema/dist/GraphQLSchemaType.js +0 -1
  213. package/dist/libs/schema/dist/JsonSchemaType.js +0 -1
  214. package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -237
  215. package/dist/libs/schema/dist/ScalarTypeEnum.js.map +0 -1
  216. package/dist/libs/schema/dist/SchemaModel.js +0 -35
  217. package/dist/libs/schema/dist/SchemaModel.js.map +0 -1
  218. package/dist/libs/schema/dist/ZodSchemaType.js +0 -1
  219. package/dist/libs/schema/dist/entity/defineEntity.js +0 -1
  220. package/dist/libs/schema/dist/entity/index.js +0 -2
  221. package/dist/libs/schema/dist/entity/types.js +0 -1
  222. package/dist/libs/schema/dist/index.js +0 -9
@@ -1 +0,0 @@
1
- {"version":3,"file":"exporters.js","names":[],"sources":["../../../../../../../libs/contracts/dist/llm/exporters.js"],"sourcesContent":["import { jsonSchemaForSpec } from \"../jsonschema.js\";\nimport { isEmitDeclRef } from \"../operations/operation.js\";\nimport \"../operations/index.js\";\n\n//#region src/llm/exporters.ts\nconst DEFAULT_SPEC_OPTIONS = {\n\tformat: \"full\",\n\tincludeSchemas: true,\n\tincludeScenarios: true,\n\tincludeExamples: true,\n\tincludePolicy: true,\n\tincludeSideEffects: true\n};\nconst DEFAULT_FEATURE_OPTIONS = {\n\t...DEFAULT_SPEC_OPTIONS,\n\tincludeRelatedSpecs: true,\n\tincludeRelatedEvents: true,\n\tincludeRelatedPresentations: true\n};\n/**\n* Export a single spec to context-focused markdown.\n* Includes: goal, context, description, acceptance scenarios.\n* Best for: Understanding what the spec does, providing context to LLMs.\n*/\nfunction operationSpecToContextMarkdown(spec) {\n\tconst m = spec.meta;\n\tconst lines = [];\n\tlines.push(`# ${m.key} (v${m.version})`);\n\tlines.push(\"\");\n\tlines.push(`> ${m.description}`);\n\tlines.push(\"\");\n\tlines.push(`**Type:** ${m.kind} | **Stability:** ${m.stability}`);\n\tlines.push(\"\");\n\tlines.push(\"## Goal\");\n\tlines.push(\"\");\n\tlines.push(m.goal);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(m.context);\n\tlines.push(\"\");\n\tif (spec.acceptance?.scenarios?.length) {\n\t\tlines.push(\"## Acceptance Criteria\");\n\t\tlines.push(\"\");\n\t\tfor (const s of spec.acceptance.scenarios) {\n\t\t\tlines.push(`### ${s.key}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Given:**\");\n\t\t\tfor (const g of s.given) lines.push(`- ${g}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**When:**\");\n\t\t\tfor (const w of s.when) lines.push(`- ${w}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Then:**\");\n\t\t\tfor (const t of s.then) lines.push(`- ${t}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a single spec to full markdown with all details.\n* Includes: all fields, I/O schemas, policy, events, examples.\n* Best for: Complete documentation, implementation reference.\n*/\nfunction operationSpecToFullMarkdown(spec, options = {}) {\n\tconst opts = {\n\t\t...DEFAULT_SPEC_OPTIONS,\n\t\t...options\n\t};\n\tconst m = spec.meta;\n\tconst lines = [];\n\tlines.push(`# ${m.key}.v${m.version}`);\n\tlines.push(\"\");\n\tlines.push(`> ${m.description}`);\n\tlines.push(\"\");\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(\"| Field | Value |\");\n\tlines.push(\"|-------|-------|\");\n\tlines.push(`| Kind | ${m.kind} |`);\n\tlines.push(`| Stability | ${m.stability} |`);\n\tlines.push(`| Owners | ${m.owners.join(\", \")} |`);\n\tlines.push(`| Tags | ${m.tags.join(\", \")} |`);\n\tlines.push(\"\");\n\tlines.push(\"## Goal\");\n\tlines.push(\"\");\n\tlines.push(m.goal);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(m.context);\n\tlines.push(\"\");\n\tif (opts.includeSchemas) {\n\t\tlines.push(\"## Input/Output\");\n\t\tlines.push(\"\");\n\t\tif (spec.io.input) {\n\t\t\tlines.push(\"### Input Schema\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"```json\");\n\t\t\ttry {\n\t\t\t\tconst schema = jsonSchemaForSpec(spec);\n\t\t\t\tlines.push(JSON.stringify(schema.input ?? {}, null, 2));\n\t\t\t} catch {\n\t\t\t\tlines.push(\"// Schema generation not available\");\n\t\t\t}\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tlines.push(\"### Output Schema\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"```json\");\n\t\ttry {\n\t\t\tconst schema = jsonSchemaForSpec(spec);\n\t\t\tlines.push(JSON.stringify(schema.output ?? {}, null, 2));\n\t\t} catch {\n\t\t\tlines.push(\"// Schema generation not available\");\n\t\t}\n\t\tlines.push(\"```\");\n\t\tlines.push(\"\");\n\t\tif (spec.io.errors && Object.keys(spec.io.errors).length) {\n\t\t\tlines.push(\"### Error Codes\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"| Code | HTTP | Description | When |\");\n\t\t\tlines.push(\"|------|------|-------------|------|\");\n\t\t\tfor (const [code, err] of Object.entries(spec.io.errors)) lines.push(`| \\`${code}\\` | ${err.http ?? 400} | ${err.description} | ${err.when} |`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includePolicy) {\n\t\tlines.push(\"## Policy\");\n\t\tlines.push(\"\");\n\t\tlines.push(`- **Auth Required:** ${spec.policy.auth}`);\n\t\tlines.push(`- **Idempotent:** ${spec.policy.idempotent ?? m.kind === \"query\"}`);\n\t\tif (spec.policy.rateLimit) lines.push(`- **Rate Limit:** ${spec.policy.rateLimit.rpm} rpm per ${spec.policy.rateLimit.key}`);\n\t\tif (spec.policy.flags?.length) lines.push(`- **Feature Flags:** ${spec.policy.flags.join(\", \")}`);\n\t\tif (spec.policy.pii?.length) lines.push(`- **PII Fields:** ${spec.policy.pii.join(\", \")}`);\n\t\tif (spec.policy.escalate) lines.push(`- **Escalation:** ${spec.policy.escalate}`);\n\t\tlines.push(\"\");\n\t}\n\tif (opts.includeSideEffects && spec.sideEffects) {\n\t\tif (spec.sideEffects.emits?.length) {\n\t\t\tlines.push(\"## Events Emitted\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const e of spec.sideEffects.emits) if (isEmitDeclRef(e)) lines.push(`- \\`${e.ref.key}.v${e.ref.version}\\` — ${e.when}`);\n\t\t\telse lines.push(`- \\`${e.key}.v${e.version}\\` — ${e.when}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tif (spec.sideEffects.analytics?.length) {\n\t\t\tlines.push(\"## Analytics Events\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const a of spec.sideEffects.analytics) lines.push(`- ${a}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includeScenarios && spec.acceptance?.scenarios?.length) {\n\t\tlines.push(\"## Acceptance Scenarios\");\n\t\tlines.push(\"\");\n\t\tfor (const s of spec.acceptance.scenarios) {\n\t\t\tlines.push(`### ${s.key}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Given:**\");\n\t\t\tfor (const g of s.given) lines.push(`- ${g}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**When:**\");\n\t\t\tfor (const w of s.when) lines.push(`- ${w}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Then:**\");\n\t\t\tfor (const t of s.then) lines.push(`- ${t}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includeExamples && spec.acceptance?.examples?.length) {\n\t\tlines.push(\"## Examples\");\n\t\tlines.push(\"\");\n\t\tfor (const ex of spec.acceptance.examples) {\n\t\t\tlines.push(`### ${ex.key}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Input:**\");\n\t\t\tlines.push(\"```json\");\n\t\t\tlines.push(JSON.stringify(ex.input, null, 2));\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Output:**\");\n\t\t\tlines.push(\"```json\");\n\t\t\tlines.push(JSON.stringify(ex.output, null, 2));\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (spec.transport) {\n\t\tlines.push(\"## Transport Configuration\");\n\t\tlines.push(\"\");\n\t\tif (spec.transport.rest) lines.push(`- **REST:** ${spec.transport.rest.method ?? \"POST\"} ${spec.transport.rest.path ?? \"auto\"}`);\n\t\tif (spec.transport.gql) lines.push(`- **GraphQL:** ${spec.transport.gql.field ?? \"auto\"}`);\n\t\tif (spec.transport.mcp) lines.push(`- **MCP Tool:** ${spec.transport.mcp.toolName ?? \"auto\"}`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a single spec as an actionable agent prompt.\n* Includes: instructions, full spec, expected output format.\n* Best for: Directly feeding to coding agents for implementation.\n*/\nfunction operationSpecToAgentPrompt(spec, options) {\n\tconst taskType = options?.taskType ?? \"implement\";\n\tconst m = spec.meta;\n\tconst lines = [];\n\tconst taskVerb = {\n\t\timplement: \"Implement\",\n\t\ttest: \"Write tests for\",\n\t\trefactor: \"Refactor\",\n\t\treview: \"Review\"\n\t}[taskType];\n\tlines.push(`# Task: ${taskVerb} ${m.key}.v${m.version}`);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(`You are working on a ContractSpec-driven codebase. This spec defines a ${m.kind} operation.`);\n\tlines.push(\"\");\n\tlines.push(`**Goal:** ${m.goal}`);\n\tlines.push(\"\");\n\tlines.push(`**Background:** ${m.context}`);\n\tlines.push(\"\");\n\tlines.push(\"## Specification\");\n\tlines.push(\"\");\n\tlines.push(operationSpecToFullMarkdown(spec));\n\tlines.push(\"\");\n\tlines.push(\"## Instructions\");\n\tlines.push(\"\");\n\tif (taskType === \"implement\") {\n\t\tlines.push(\"Implement this specification following these requirements:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. **Type Safety**: Use TypeScript with strict typing. No `any` types.\");\n\t\tlines.push(\"2. **Input Validation**: Validate input against the schema before processing.\");\n\t\tlines.push(\"3. **Error Handling**: Implement all error cases defined in the spec.\");\n\t\tlines.push(\"4. **Events**: Emit events as specified in sideEffects.emits.\");\n\t\tlines.push(\"5. **Policy**: Respect auth, rate limits, and feature flags.\");\n\t\tlines.push(\"6. **Idempotency**: \" + (spec.policy.idempotent ? \"This operation MUST be idempotent.\" : \"This operation may have side effects.\"));\n\t\tlines.push(\"\");\n\t\tif (spec.policy.pii?.length) {\n\t\t\tlines.push(\"**PII Handling**: The following fields contain PII and must be handled carefully:\");\n\t\t\tfor (const field of spec.policy.pii) lines.push(`- ${field}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t} else if (taskType === \"test\") {\n\t\tlines.push(\"Write comprehensive tests for this specification:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Test all acceptance scenarios defined in the spec.\");\n\t\tlines.push(\"2. Test all error cases with appropriate assertions.\");\n\t\tlines.push(\"3. Test edge cases and boundary conditions.\");\n\t\tlines.push(\"4. Verify events are emitted correctly.\");\n\t\tlines.push(\"5. Use descriptive test names following the pattern: \\\"should [behavior] when [condition]\\\"\");\n\t\tlines.push(\"\");\n\t} else if (taskType === \"refactor\") {\n\t\tlines.push(\"Refactor this implementation while preserving all behavior:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Maintain compliance with the specification.\");\n\t\tlines.push(\"2. Improve code clarity and maintainability.\");\n\t\tlines.push(\"3. Reduce complexity where possible.\");\n\t\tlines.push(\"4. Ensure all existing tests still pass.\");\n\t\tlines.push(\"\");\n\t} else if (taskType === \"review\") {\n\t\tlines.push(\"Review this implementation against the specification:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Verify input/output types match the schema.\");\n\t\tlines.push(\"2. Check all error cases are handled.\");\n\t\tlines.push(\"3. Verify events are emitted as specified.\");\n\t\tlines.push(\"4. Check policy compliance (auth, rate limits).\");\n\t\tlines.push(\"5. Report any deviations from the spec.\");\n\t\tlines.push(\"\");\n\t}\n\tif (options?.existingCode) {\n\t\tlines.push(\"## Existing Code\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"```typescript\");\n\t\tlines.push(options.existingCode);\n\t\tlines.push(\"```\");\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Expected Output\");\n\tlines.push(\"\");\n\tif (taskType === \"implement\" || taskType === \"refactor\") {\n\t\tlines.push(\"Provide a complete TypeScript implementation. Include:\");\n\t\tlines.push(\"- Type definitions for input/output\");\n\t\tlines.push(\"- Handler function with proper error handling\");\n\t\tlines.push(\"- JSDoc comments explaining the implementation\");\n\t} else if (taskType === \"test\") lines.push(\"Provide a complete test file using the testing framework available (prefer Vitest).\");\n\telse if (taskType === \"review\") {\n\t\tlines.push(\"Provide a structured review with:\");\n\t\tlines.push(\"- Compliance status (pass/fail for each requirement)\");\n\t\tlines.push(\"- Issues found with severity (error/warning/info)\");\n\t\tlines.push(\"- Suggestions for improvement\");\n\t}\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a feature module to markdown.\n* Includes all related specs, events, and presentations.\n*/\nfunction featureToMarkdown(feature, deps, options = {}) {\n\tconst opts = {\n\t\t...DEFAULT_FEATURE_OPTIONS,\n\t\t...options\n\t};\n\tconst m = feature.meta;\n\tconst lines = [];\n\tlines.push(`# Feature: ${m.title ?? m.key}`);\n\tlines.push(\"\");\n\tif (m.description) {\n\t\tlines.push(`> ${m.description}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Overview\");\n\tlines.push(\"\");\n\tlines.push(`- **Key:** \\`${m.key}\\``);\n\tlines.push(`- **Stability:** ${m.stability}`);\n\tlines.push(`- **Owners:** ${m.owners.join(\", \")}`);\n\tif (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(\", \")}`);\n\tlines.push(\"\");\n\tif (feature.operations?.length) {\n\t\tlines.push(\"## Operations\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version | Type |\");\n\t\tlines.push(\"|------|---------|------|\");\n\t\tfor (const op of feature.operations) {\n\t\t\tconst kind = (deps?.specs?.get(op.key, op.version))?.meta.kind ?? \"unknown\";\n\t\t\tlines.push(`| ${op.key} | v${op.version} | ${kind} |`);\n\t\t}\n\t\tlines.push(\"\");\n\t\tif (opts.includeRelatedSpecs && deps?.specs) {\n\t\t\tlines.push(\"### Operation Details\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const op of feature.operations) {\n\t\t\t\tconst spec = deps.specs.get(op.key, op.version);\n\t\t\t\tif (spec) {\n\t\t\t\t\tlines.push(`---`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\tlines.push(operationSpecToFullMarkdown(spec, opts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (feature.events?.length) {\n\t\tlines.push(\"## Events\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version |\");\n\t\tlines.push(\"|------|---------|\");\n\t\tfor (const evt of feature.events) lines.push(`| ${evt.key} | v${evt.version} |`);\n\t\tlines.push(\"\");\n\t}\n\tif (feature.presentations?.length) {\n\t\tlines.push(\"## Presentations\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version |\");\n\t\tlines.push(\"|------|---------|\");\n\t\tfor (const pres of feature.presentations) lines.push(`| ${pres.key} | v${pres.version} |`);\n\t\tlines.push(\"\");\n\t\tif (opts.includeRelatedPresentations && deps?.presentations) {\n\t\t\tlines.push(\"### Presentation Details\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const pres of feature.presentations) {\n\t\t\t\tconst p = deps.presentations.get(pres.key, pres.version);\n\t\t\t\tif (p) {\n\t\t\t\t\tlines.push(`#### ${pres.key}.v${pres.version}`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\tlines.push(`- **Type:** ${p.source.type}`);\n\t\t\t\t\tif (p.source.type === \"component\") lines.push(`- **Component:** ${p.source.componentKey}`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (feature.capabilities) {\n\t\tif (feature.capabilities.provides?.length) {\n\t\t\tlines.push(\"## Capabilities Provided\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const cap of feature.capabilities.provides) lines.push(`- \\`${cap.key}.v${cap.version}\\``);\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tif (feature.capabilities.requires?.length) {\n\t\t\tlines.push(\"## Capabilities Required\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const cap of feature.capabilities.requires) lines.push(`- \\`${cap.key}\\`${cap.version ? `.v${cap.version}` : \"\"} (${cap.optional ? \"optional\" : \"required\"})`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a presentation descriptor to markdown.\n*/\nfunction presentationToMarkdown(presentation) {\n\tconst m = presentation.meta;\n\tconst lines = [];\n\tlines.push(`# Presentation: ${m.key}.v${m.version}`);\n\tlines.push(\"\");\n\tif (m.description) {\n\t\tlines.push(`> ${m.description}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **Name:** ${m.key}`);\n\tlines.push(`- **Version:** ${m.version}`);\n\tif (m.stability) lines.push(`- **Stability:** ${m.stability}`);\n\tif (m.owners?.length) lines.push(`- **Owners:** ${m.owners.join(\", \")}`);\n\tif (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(\", \")}`);\n\tlines.push(\"\");\n\tlines.push(\"## Source\");\n\tlines.push(\"\");\n\tlines.push(`- **Type:** ${presentation.source.type}`);\n\tif (presentation.source.type === \"component\") {\n\t\tlines.push(`- **Framework:** ${presentation.source.framework}`);\n\t\tlines.push(`- **Component Key:** ${presentation.source.componentKey}`);\n\t}\n\tlines.push(\"\");\n\tlines.push(\"## Supported Targets\");\n\tlines.push(\"\");\n\tfor (const target of presentation.targets) lines.push(`- ${target}`);\n\tlines.push(\"\");\n\tif (presentation.policy) {\n\t\tlines.push(\"## Policy\");\n\t\tlines.push(\"\");\n\t\tif (presentation.policy.flags?.length) lines.push(`- **Feature Flags:** ${presentation.policy.flags.join(\", \")}`);\n\t\tif (presentation.policy.pii?.length) lines.push(`- **PII Fields:** ${presentation.policy.pii.join(\", \")}`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export an event spec to markdown.\n*/\nfunction eventToMarkdown(event) {\n\tconst lines = [];\n\tlines.push(`# Event: ${event.meta.key}.v${event.meta.version}`);\n\tlines.push(\"\");\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **Name:** ${event.meta.key}`);\n\tlines.push(`- **Version:** ${event.meta.version}`);\n\tif (event.meta.description) lines.push(`- **Description:** ${event.meta.description}`);\n\tlines.push(\"\");\n\tlines.push(\"## Payload Schema\");\n\tlines.push(\"\");\n\tlines.push(\"```json\");\n\ttry {\n\t\tconst zodSchema = event.payload.getZod();\n\t\tif (\"shape\" in zodSchema && zodSchema.shape) {\n\t\t\tconst shape = zodSchema.shape;\n\t\t\tconst fields = Object.keys(shape);\n\t\t\tlines.push(JSON.stringify({ fields }, null, 2));\n\t\t} else lines.push(\"// Payload schema available at runtime\");\n\t} catch {\n\t\tlines.push(\"// Schema details available at runtime\");\n\t}\n\tlines.push(\"```\");\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a DocBlock to markdown (already markdown, but formatted consistently).\n*/\nfunction docBlockToMarkdown(doc) {\n\tconst lines = [];\n\tlines.push(`# ${doc.title}`);\n\tlines.push(\"\");\n\tif (doc.summary) {\n\t\tlines.push(`> ${doc.summary}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **ID:** ${doc.id}`);\n\tlines.push(`- **Kind:** ${doc.kind ?? \"reference\"}`);\n\tlines.push(`- **Visibility:** ${doc.visibility ?? \"public\"}`);\n\tif (doc.tags?.length) lines.push(`- **Tags:** ${doc.tags.join(\", \")}`);\n\tif (doc.owners?.length) lines.push(`- **Owners:** ${doc.owners.join(\", \")}`);\n\tif (doc.domain) lines.push(`- **Domain:** ${doc.domain}`);\n\tlines.push(\"\");\n\tlines.push(\"## Content\");\n\tlines.push(\"\");\n\tlines.push(doc.body);\n\tlines.push(\"\");\n\tif (doc.links?.length) {\n\t\tlines.push(\"## Related Links\");\n\t\tlines.push(\"\");\n\t\tfor (const link of doc.links) lines.push(`- [${link.label}](${link.href})`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a spec with a specific format.\n* Convenience function that wraps the format-specific functions.\n*/\nfunction exportSpec(spec, options = {}) {\n\tconst format = options.format ?? \"full\";\n\tlet markdown;\n\tswitch (format) {\n\t\tcase \"context\":\n\t\t\tmarkdown = operationSpecToContextMarkdown(spec);\n\t\t\tbreak;\n\t\tcase \"prompt\":\n\t\t\tmarkdown = operationSpecToAgentPrompt(spec);\n\t\t\tbreak;\n\t\tcase \"full\":\n\t\tdefault:\n\t\t\tmarkdown = operationSpecToFullMarkdown(spec, options);\n\t\t\tbreak;\n\t}\n\treturn {\n\t\tspec,\n\t\tmarkdown,\n\t\tformat,\n\t\tmeta: {\n\t\t\tspecName: spec.meta.key,\n\t\t\tspecVersion: spec.meta.version,\n\t\t\texportedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\twordCount: markdown.split(/\\s+/).length\n\t\t}\n\t};\n}\n/**\n* Export a feature with a specific format.\n*/\nfunction exportFeature(feature, deps, options = {}) {\n\tconst format = options.format ?? \"full\";\n\treturn {\n\t\tfeature,\n\t\tmarkdown: featureToMarkdown(feature, deps, options),\n\t\tformat,\n\t\tincludedSpecs: feature.operations?.map((o) => `${o.key}.v${o.version}`) ?? [],\n\t\tincludedEvents: feature.events?.map((e) => `${e.key}.v${e.version}`) ?? [],\n\t\tincludedPresentations: feature.presentations?.map((p) => `${p.key}.v${p.version}`) ?? []\n\t};\n}\n\n//#endregion\nexport { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, operationSpecToAgentPrompt, operationSpecToContextMarkdown, operationSpecToFullMarkdown, presentationToMarkdown };"],"mappings":";;;;AAKA,MAAM,uBAAuB;CAC5B,QAAQ;CACR,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,eAAe;CACf,oBAAoB;CACpB;AACD,MAAM,0BAA0B;CAC/B,GAAG;CACH,qBAAqB;CACrB,sBAAsB;CACtB,6BAA6B;CAC7B"}
@@ -1,2 +0,0 @@
1
- import "./exporters.js";
2
- import "./prompts.js";
@@ -1 +0,0 @@
1
- import "./exporters.js";
@@ -1 +0,0 @@
1
- import { compareVersions } from "compare-versions";
@@ -1 +0,0 @@
1
- import "../../schema/dist/index.js";
@@ -1,198 +0,0 @@
1
- import { ScalarTypeEnum } from "../../schema/dist/ScalarTypeEnum.js";
2
- import { SchemaModel } from "../../schema/dist/SchemaModel.js";
3
- import "../../schema/dist/index.js";
4
- import { OwnersEnum, StabilityEnum } from "./ownership.js";
5
- import { defineCommand, defineQuery } from "./operations/operation.js";
6
- import "./operations/index.js";
7
-
8
- //#region ../../libs/contracts/dist/onboarding-base.js
9
- /**
10
- * Shared base contracts for onboarding flows across verticals.
11
- * These operations are reusable for any app that needs multi-step onboarding with draft persistence.
12
- */
13
- /** Save/update onboarding draft (auto-save during flow) */
14
- const SaveOnboardingDraftInput = new SchemaModel({
15
- name: "SaveOnboardingDraftInput",
16
- description: "Input for saving onboarding draft",
17
- fields: { data: {
18
- type: ScalarTypeEnum.JSON(),
19
- isOptional: false
20
- } }
21
- });
22
- const SaveOnboardingDraftOutput = new SchemaModel({
23
- name: "SaveOnboardingDraftOutput",
24
- description: "Output for saving onboarding draft",
25
- fields: {
26
- id: {
27
- type: ScalarTypeEnum.ID(),
28
- isOptional: false
29
- },
30
- organizationId: {
31
- type: ScalarTypeEnum.ID(),
32
- isOptional: false
33
- }
34
- }
35
- });
36
- const SaveOnboardingDraftBaseSpec = defineCommand({
37
- meta: {
38
- key: "base.onboarding.saveDraft",
39
- version: "1.0.0",
40
- stability: StabilityEnum.Beta,
41
- owners: [OwnersEnum.PlatformSigil],
42
- tags: ["onboarding", "draft"],
43
- description: "Save or update onboarding draft for active organization",
44
- goal: "Persist onboarding progress incrementally for resumption and safety",
45
- context: "Auto-saves every few seconds during onboarding; enables users to leave and resume"
46
- },
47
- io: {
48
- input: SaveOnboardingDraftInput,
49
- output: SaveOnboardingDraftOutput
50
- },
51
- policy: {
52
- auth: "user",
53
- escalate: null
54
- },
55
- transport: {
56
- gql: { field: "saveOnboardingDraft" },
57
- rest: { method: "POST" }
58
- }
59
- });
60
- /** Get current onboarding draft (on mount/restore) */
61
- const GetOnboardingDraftOutput = new SchemaModel({
62
- name: "GetOnboardingDraftOutput",
63
- description: "Onboarding draft payload",
64
- fields: {
65
- id: {
66
- type: ScalarTypeEnum.ID(),
67
- isOptional: true
68
- },
69
- organizationId: {
70
- type: ScalarTypeEnum.ID(),
71
- isOptional: true
72
- },
73
- data: {
74
- type: ScalarTypeEnum.JSON(),
75
- isOptional: true
76
- },
77
- createdAt: {
78
- type: ScalarTypeEnum.DateTime(),
79
- isOptional: true
80
- },
81
- updatedAt: {
82
- type: ScalarTypeEnum.DateTime(),
83
- isOptional: true
84
- }
85
- }
86
- });
87
- const GetOnboardingDraftBaseSpec = defineQuery({
88
- meta: {
89
- key: "base.onboarding.getDraft",
90
- version: "1.0.0",
91
- stability: StabilityEnum.Beta,
92
- owners: [OwnersEnum.PlatformSigil],
93
- tags: ["onboarding", "draft"],
94
- description: "Get onboarding draft for active organization",
95
- goal: "Retrieve saved onboarding progress",
96
- context: "Called on mount to restore in-progress onboarding"
97
- },
98
- io: {
99
- input: null,
100
- output: GetOnboardingDraftOutput
101
- },
102
- policy: {
103
- auth: "user",
104
- escalate: null
105
- },
106
- transport: {
107
- gql: { field: "getOnboardingDraft" },
108
- rest: { method: "GET" }
109
- }
110
- });
111
- /** Delete onboarding draft (cleanup after completion or cancel) */
112
- const DeleteOnboardingDraftOutput = new SchemaModel({
113
- name: "DeleteOnboardingDraftOutput",
114
- description: "Result of delete operation",
115
- fields: { ok: {
116
- type: ScalarTypeEnum.Boolean(),
117
- isOptional: false
118
- } }
119
- });
120
- const DeleteOnboardingDraftBaseSpec = defineCommand({
121
- meta: {
122
- key: "base.onboarding.deleteDraft",
123
- version: "1.0.0",
124
- stability: StabilityEnum.Beta,
125
- owners: [OwnersEnum.PlatformSigil],
126
- tags: ["onboarding", "draft"],
127
- description: "Delete onboarding draft for active organization",
128
- goal: "Clear draft after completion or if user wants to restart",
129
- context: "Called after successful onboarding or explicit user reset"
130
- },
131
- io: {
132
- input: null,
133
- output: DeleteOnboardingDraftOutput
134
- },
135
- policy: {
136
- auth: "user",
137
- escalate: null
138
- },
139
- transport: {
140
- gql: { field: "deleteOnboardingDraft" },
141
- rest: { method: "POST" }
142
- }
143
- });
144
- /** Complete onboarding (final submit, creates entities) */
145
- const CompleteOnboardingBaseInput = new SchemaModel({
146
- name: "CompleteOnboardingBaseInput",
147
- description: "Input for completing onboarding",
148
- fields: { data: {
149
- type: ScalarTypeEnum.JSON(),
150
- isOptional: false
151
- } }
152
- });
153
- const CompleteOnboardingBaseOutput = new SchemaModel({
154
- name: "CompleteOnboardingBaseOutput",
155
- description: "Result of onboarding completion",
156
- fields: {
157
- success: {
158
- type: ScalarTypeEnum.Boolean(),
159
- isOptional: false
160
- },
161
- userId: {
162
- type: ScalarTypeEnum.ID(),
163
- isOptional: true
164
- },
165
- organizationId: {
166
- type: ScalarTypeEnum.ID(),
167
- isOptional: true
168
- }
169
- }
170
- });
171
- const CompleteOnboardingBaseSpec = defineCommand({
172
- meta: {
173
- key: "base.onboarding.complete",
174
- version: "1.0.0",
175
- stability: StabilityEnum.Beta,
176
- owners: [OwnersEnum.PlatformSigil],
177
- tags: ["onboarding"],
178
- description: "Complete onboarding and finalize user/organization setup",
179
- goal: "Transition from draft to active profile",
180
- context: "Validates all required fields, creates/updates entities, marks onboarding complete"
181
- },
182
- io: {
183
- input: CompleteOnboardingBaseInput,
184
- output: CompleteOnboardingBaseOutput
185
- },
186
- policy: {
187
- auth: "user",
188
- escalate: null
189
- },
190
- transport: {
191
- gql: { field: "completeOnboarding" },
192
- rest: { method: "POST" }
193
- }
194
- });
195
-
196
- //#endregion
197
- export { CompleteOnboardingBaseInput, CompleteOnboardingBaseOutput, DeleteOnboardingDraftOutput, GetOnboardingDraftOutput, SaveOnboardingDraftInput, SaveOnboardingDraftOutput };
198
- //# sourceMappingURL=onboarding-base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"onboarding-base.js","names":[],"sources":["../../../../../../libs/contracts/dist/onboarding-base.js"],"sourcesContent":["import { OwnersEnum, StabilityEnum } from \"./ownership.js\";\nimport { defineCommand, defineQuery } from \"./operations/operation.js\";\nimport \"./operations/index.js\";\nimport { ScalarTypeEnum, SchemaModel } from \"@contractspec/lib.schema\";\n\n//#region src/onboarding-base.ts\n/**\n* Shared base contracts for onboarding flows across verticals.\n* These operations are reusable for any app that needs multi-step onboarding with draft persistence.\n*/\n/** Save/update onboarding draft (auto-save during flow) */\nconst SaveOnboardingDraftInput = new SchemaModel({\n\tname: \"SaveOnboardingDraftInput\",\n\tdescription: \"Input for saving onboarding draft\",\n\tfields: { data: {\n\t\ttype: ScalarTypeEnum.JSON(),\n\t\tisOptional: false\n\t} }\n});\nconst SaveOnboardingDraftOutput = new SchemaModel({\n\tname: \"SaveOnboardingDraftOutput\",\n\tdescription: \"Output for saving onboarding draft\",\n\tfields: {\n\t\tid: {\n\t\t\ttype: ScalarTypeEnum.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\torganizationId: {\n\t\t\ttype: ScalarTypeEnum.ID(),\n\t\t\tisOptional: false\n\t\t}\n\t}\n});\nconst SaveOnboardingDraftBaseSpec = defineCommand({\n\tmeta: {\n\t\tkey: \"base.onboarding.saveDraft\",\n\t\tversion: \"1.0.0\",\n\t\tstability: StabilityEnum.Beta,\n\t\towners: [OwnersEnum.PlatformSigil],\n\t\ttags: [\"onboarding\", \"draft\"],\n\t\tdescription: \"Save or update onboarding draft for active organization\",\n\t\tgoal: \"Persist onboarding progress incrementally for resumption and safety\",\n\t\tcontext: \"Auto-saves every few seconds during onboarding; enables users to leave and resume\"\n\t},\n\tio: {\n\t\tinput: SaveOnboardingDraftInput,\n\t\toutput: SaveOnboardingDraftOutput\n\t},\n\tpolicy: {\n\t\tauth: \"user\",\n\t\tescalate: null\n\t},\n\ttransport: {\n\t\tgql: { field: \"saveOnboardingDraft\" },\n\t\trest: { method: \"POST\" }\n\t}\n});\n/** Get current onboarding draft (on mount/restore) */\nconst GetOnboardingDraftOutput = new SchemaModel({\n\tname: \"GetOnboardingDraftOutput\",\n\tdescription: \"Onboarding draft payload\",\n\tfields: {\n\t\tid: {\n\t\t\ttype: ScalarTypeEnum.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\torganizationId: {\n\t\t\ttype: ScalarTypeEnum.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\tdata: {\n\t\t\ttype: ScalarTypeEnum.JSON(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcreatedAt: {\n\t\t\ttype: ScalarTypeEnum.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tupdatedAt: {\n\t\t\ttype: ScalarTypeEnum.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst GetOnboardingDraftBaseSpec = defineQuery({\n\tmeta: {\n\t\tkey: \"base.onboarding.getDraft\",\n\t\tversion: \"1.0.0\",\n\t\tstability: StabilityEnum.Beta,\n\t\towners: [OwnersEnum.PlatformSigil],\n\t\ttags: [\"onboarding\", \"draft\"],\n\t\tdescription: \"Get onboarding draft for active organization\",\n\t\tgoal: \"Retrieve saved onboarding progress\",\n\t\tcontext: \"Called on mount to restore in-progress onboarding\"\n\t},\n\tio: {\n\t\tinput: null,\n\t\toutput: GetOnboardingDraftOutput\n\t},\n\tpolicy: {\n\t\tauth: \"user\",\n\t\tescalate: null\n\t},\n\ttransport: {\n\t\tgql: { field: \"getOnboardingDraft\" },\n\t\trest: { method: \"GET\" }\n\t}\n});\n/** Delete onboarding draft (cleanup after completion or cancel) */\nconst DeleteOnboardingDraftOutput = new SchemaModel({\n\tname: \"DeleteOnboardingDraftOutput\",\n\tdescription: \"Result of delete operation\",\n\tfields: { ok: {\n\t\ttype: ScalarTypeEnum.Boolean(),\n\t\tisOptional: false\n\t} }\n});\nconst DeleteOnboardingDraftBaseSpec = defineCommand({\n\tmeta: {\n\t\tkey: \"base.onboarding.deleteDraft\",\n\t\tversion: \"1.0.0\",\n\t\tstability: StabilityEnum.Beta,\n\t\towners: [OwnersEnum.PlatformSigil],\n\t\ttags: [\"onboarding\", \"draft\"],\n\t\tdescription: \"Delete onboarding draft for active organization\",\n\t\tgoal: \"Clear draft after completion or if user wants to restart\",\n\t\tcontext: \"Called after successful onboarding or explicit user reset\"\n\t},\n\tio: {\n\t\tinput: null,\n\t\toutput: DeleteOnboardingDraftOutput\n\t},\n\tpolicy: {\n\t\tauth: \"user\",\n\t\tescalate: null\n\t},\n\ttransport: {\n\t\tgql: { field: \"deleteOnboardingDraft\" },\n\t\trest: { method: \"POST\" }\n\t}\n});\n/** Complete onboarding (final submit, creates entities) */\nconst CompleteOnboardingBaseInput = new SchemaModel({\n\tname: \"CompleteOnboardingBaseInput\",\n\tdescription: \"Input for completing onboarding\",\n\tfields: { data: {\n\t\ttype: ScalarTypeEnum.JSON(),\n\t\tisOptional: false\n\t} }\n});\nconst CompleteOnboardingBaseOutput = new SchemaModel({\n\tname: \"CompleteOnboardingBaseOutput\",\n\tdescription: \"Result of onboarding completion\",\n\tfields: {\n\t\tsuccess: {\n\t\t\ttype: ScalarTypeEnum.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\tuserId: {\n\t\t\ttype: ScalarTypeEnum.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\torganizationId: {\n\t\t\ttype: ScalarTypeEnum.ID(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CompleteOnboardingBaseSpec = defineCommand({\n\tmeta: {\n\t\tkey: \"base.onboarding.complete\",\n\t\tversion: \"1.0.0\",\n\t\tstability: StabilityEnum.Beta,\n\t\towners: [OwnersEnum.PlatformSigil],\n\t\ttags: [\"onboarding\"],\n\t\tdescription: \"Complete onboarding and finalize user/organization setup\",\n\t\tgoal: \"Transition from draft to active profile\",\n\t\tcontext: \"Validates all required fields, creates/updates entities, marks onboarding complete\"\n\t},\n\tio: {\n\t\tinput: CompleteOnboardingBaseInput,\n\t\toutput: CompleteOnboardingBaseOutput\n\t},\n\tpolicy: {\n\t\tauth: \"user\",\n\t\tescalate: null\n\t},\n\ttransport: {\n\t\tgql: { field: \"completeOnboarding\" },\n\t\trest: { method: \"POST\" }\n\t}\n});\n\n//#endregion\nexport { CompleteOnboardingBaseInput, CompleteOnboardingBaseOutput, CompleteOnboardingBaseSpec, DeleteOnboardingDraftBaseSpec, DeleteOnboardingDraftOutput, GetOnboardingDraftBaseSpec, GetOnboardingDraftOutput, SaveOnboardingDraftBaseSpec, SaveOnboardingDraftInput, SaveOnboardingDraftOutput };"],"mappings":";;;;;;;;;;;;;AAWA,MAAM,2BAA2B,IAAI,YAAY;CAChD,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,MAAM;EACf,MAAM,eAAe,MAAM;EAC3B,YAAY;EACZ,EAAE;CACH,CAAC;AACF,MAAM,4BAA4B,IAAI,YAAY;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACP,IAAI;GACH,MAAM,eAAe,IAAI;GACzB,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,eAAe,IAAI;GACzB,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,8BAA8B,cAAc;CACjD,MAAM;EACL,KAAK;EACL,SAAS;EACT,WAAW,cAAc;EACzB,QAAQ,CAAC,WAAW,cAAc;EAClC,MAAM,CAAC,cAAc,QAAQ;EAC7B,aAAa;EACb,MAAM;EACN,SAAS;EACT;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU;EACV;CACD,WAAW;EACV,KAAK,EAAE,OAAO,uBAAuB;EACrC,MAAM,EAAE,QAAQ,QAAQ;EACxB;CACD,CAAC;;AAEF,MAAM,2BAA2B,IAAI,YAAY;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACP,IAAI;GACH,MAAM,eAAe,IAAI;GACzB,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,eAAe,IAAI;GACzB,YAAY;GACZ;EACD,MAAM;GACL,MAAM,eAAe,MAAM;GAC3B,YAAY;GACZ;EACD,WAAW;GACV,MAAM,eAAe,UAAU;GAC/B,YAAY;GACZ;EACD,WAAW;GACV,MAAM,eAAe,UAAU;GAC/B,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,6BAA6B,YAAY;CAC9C,MAAM;EACL,KAAK;EACL,SAAS;EACT,WAAW,cAAc;EACzB,QAAQ,CAAC,WAAW,cAAc;EAClC,MAAM,CAAC,cAAc,QAAQ;EAC7B,aAAa;EACb,MAAM;EACN,SAAS;EACT;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU;EACV;CACD,WAAW;EACV,KAAK,EAAE,OAAO,sBAAsB;EACpC,MAAM,EAAE,QAAQ,OAAO;EACvB;CACD,CAAC;;AAEF,MAAM,8BAA8B,IAAI,YAAY;CACnD,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,IAAI;EACb,MAAM,eAAe,SAAS;EAC9B,YAAY;EACZ,EAAE;CACH,CAAC;AACF,MAAM,gCAAgC,cAAc;CACnD,MAAM;EACL,KAAK;EACL,SAAS;EACT,WAAW,cAAc;EACzB,QAAQ,CAAC,WAAW,cAAc;EAClC,MAAM,CAAC,cAAc,QAAQ;EAC7B,aAAa;EACb,MAAM;EACN,SAAS;EACT;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU;EACV;CACD,WAAW;EACV,KAAK,EAAE,OAAO,yBAAyB;EACvC,MAAM,EAAE,QAAQ,QAAQ;EACxB;CACD,CAAC;;AAEF,MAAM,8BAA8B,IAAI,YAAY;CACnD,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,MAAM;EACf,MAAM,eAAe,MAAM;EAC3B,YAAY;EACZ,EAAE;CACH,CAAC;AACF,MAAM,+BAA+B,IAAI,YAAY;CACpD,MAAM;CACN,aAAa;CACb,QAAQ;EACP,SAAS;GACR,MAAM,eAAe,SAAS;GAC9B,YAAY;GACZ;EACD,QAAQ;GACP,MAAM,eAAe,IAAI;GACzB,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,eAAe,IAAI;GACzB,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,6BAA6B,cAAc;CAChD,MAAM;EACL,KAAK;EACL,SAAS;EACT,WAAW,cAAc;EACzB,QAAQ,CAAC,WAAW,cAAc;EAClC,MAAM,CAAC,aAAa;EACpB,aAAa;EACb,MAAM;EACN,SAAS;EACT;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU;EACV;CACD,WAAW;EACV,KAAK,EAAE,OAAO,sBAAsB;EACpC,MAAM,EAAE,QAAQ,QAAQ;EACxB;CACD,CAAC"}
@@ -1,2 +0,0 @@
1
- import "./jsonschema.js";
2
- import { compareVersions } from "compare-versions";
@@ -1,2 +0,0 @@
1
- import { defineCommand, defineQuery } from "./operation.js";
2
- import "./registry.js";
@@ -1,35 +0,0 @@
1
- //#region ../../libs/contracts/dist/operations/operation.js
2
- /**
3
- * Helper to define a Command (write operation).
4
- * Sets `kind: 'command'` and defaults `idempotent: false`.
5
- */
6
- const defineCommand = (spec) => ({
7
- ...spec,
8
- meta: {
9
- ...spec.meta,
10
- kind: "command"
11
- },
12
- policy: {
13
- ...spec.policy,
14
- idempotent: spec.policy?.["policy"]?.idempotent ?? false
15
- }
16
- });
17
- /**
18
- * Helper to define a Query (read-only operation).
19
- * Sets `kind: 'query'` and forces `idempotent: true`.
20
- */
21
- const defineQuery = (spec) => ({
22
- ...spec,
23
- meta: {
24
- ...spec.meta,
25
- kind: "query"
26
- },
27
- policy: {
28
- ...spec.policy,
29
- idempotent: true
30
- }
31
- });
32
-
33
- //#endregion
34
- export { defineCommand, defineQuery };
35
- //# sourceMappingURL=operation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operation.js","names":[],"sources":["../../../../../../../libs/contracts/dist/operations/operation.js"],"sourcesContent":["//#region src/operations/operation.ts\nconst isEmitDeclRef = (e) => \"ref\" in e;\n/**\n* Helper to define a Command (write operation).\n* Sets `kind: 'command'` and defaults `idempotent: false`.\n*/\nconst defineCommand = (spec) => ({\n\t...spec,\n\tmeta: {\n\t\t...spec.meta,\n\t\tkind: \"command\"\n\t},\n\tpolicy: {\n\t\t...spec.policy,\n\t\tidempotent: spec.policy?.[\"policy\"]?.idempotent ?? false\n\t}\n});\n/**\n* Helper to define a Query (read-only operation).\n* Sets `kind: 'query'` and forces `idempotent: true`.\n*/\nconst defineQuery = (spec) => ({\n\t...spec,\n\tmeta: {\n\t\t...spec.meta,\n\t\tkind: \"query\"\n\t},\n\tpolicy: {\n\t\t...spec.policy,\n\t\tidempotent: true\n\t}\n});\n\n//#endregion\nexport { defineCommand, defineQuery, isEmitDeclRef };"],"mappings":";;;;;AAMA,MAAM,iBAAiB,UAAU;CAChC,GAAG;CACH,MAAM;EACL,GAAG,KAAK;EACR,MAAM;EACN;CACD,QAAQ;EACP,GAAG,KAAK;EACR,YAAY,KAAK,SAAS,WAAW,cAAc;EACnD;CACD;;;;;AAKD,MAAM,eAAe,UAAU;CAC9B,GAAG;CACH,MAAM;EACL,GAAG,KAAK;EACR,MAAM;EACN;CACD,QAAQ;EACP,GAAG,KAAK;EACR,YAAY;EACZ;CACD"}
@@ -1,2 +0,0 @@
1
- import "../registry.js";
2
- import "../events.js";
@@ -1,22 +0,0 @@
1
- //#region ../../libs/contracts/dist/ownership.js
2
- const StabilityEnum = {
3
- Idea: "idea",
4
- InCreation: "in_creation",
5
- Experimental: "experimental",
6
- Beta: "beta",
7
- Stable: "stable",
8
- Deprecated: "deprecated"
9
- };
10
- const OwnersEnum = {
11
- PlatformCore: "platform.core",
12
- PlatformSigil: "platform.sigil",
13
- PlatformMarketplace: "platform.marketplace",
14
- PlatformMessaging: "platform.messaging",
15
- PlatformContent: "platform.content",
16
- PlatformFeatureFlags: "platform.featureflags",
17
- PlatformFinance: "platform.finance"
18
- };
19
-
20
- //#endregion
21
- export { OwnersEnum, StabilityEnum };
22
- //# sourceMappingURL=ownership.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ownership.js","names":[],"sources":["../../../../../../libs/contracts/dist/ownership.js"],"sourcesContent":["//#region src/ownership.ts\nconst StabilityEnum = {\n\tIdea: \"idea\",\n\tInCreation: \"in_creation\",\n\tExperimental: \"experimental\",\n\tBeta: \"beta\",\n\tStable: \"stable\",\n\tDeprecated: \"deprecated\"\n};\nconst OwnersEnum = {\n\tPlatformCore: \"platform.core\",\n\tPlatformSigil: \"platform.sigil\",\n\tPlatformMarketplace: \"platform.marketplace\",\n\tPlatformMessaging: \"platform.messaging\",\n\tPlatformContent: \"platform.content\",\n\tPlatformFeatureFlags: \"platform.featureflags\",\n\tPlatformFinance: \"platform.finance\"\n};\nconst Owners = OwnersEnum;\nconst TagsEnum = {\n\tSpots: \"spots\",\n\tCollectivity: \"collectivity\",\n\tMarketplace: \"marketplace\",\n\tSellers: \"sellers\",\n\tAuth: \"auth\",\n\tLogin: \"login\",\n\tSignup: \"signup\",\n\tGuide: \"guide\",\n\tDocs: \"docs\",\n\tI18n: \"i18n\",\n\tIncident: \"incident\",\n\tAutomation: \"automation\",\n\tHygiene: \"hygiene\"\n};\nconst Tags = TagsEnum;\n\n//#endregion\nexport { Owners, OwnersEnum, StabilityEnum, Tags, TagsEnum };"],"mappings":";AACA,MAAM,gBAAgB;CACrB,MAAM;CACN,YAAY;CACZ,cAAc;CACd,MAAM;CACN,QAAQ;CACR,YAAY;CACZ;AACD,MAAM,aAAa;CAClB,cAAc;CACd,eAAe;CACf,qBAAqB;CACrB,mBAAmB;CACnB,iBAAiB;CACjB,sBAAsB;CACtB,iBAAiB;CACjB"}
@@ -1 +0,0 @@
1
- import "./registry.js";
@@ -1,2 +0,0 @@
1
- import "./registry.js";
2
- import "./engine.js";
@@ -1 +0,0 @@
1
- import "../registry.js";
@@ -1,2 +0,0 @@
1
- import "./transform-engine.js";
2
- import "./registry.js";
@@ -1 +0,0 @@
1
- import "../registry.js";
@@ -1,13 +0,0 @@
1
- import "../schema-to-markdown.js";
2
- import "react";
3
- import TurndownService from "turndown";
4
-
5
- //#region ../../libs/contracts/dist/presentations/transform-engine.js
6
- /**
7
- * Pluggable transform engine that renders descriptors to various targets
8
- * and runs validators (e.g., basic metadata checks, PII redaction policies).
9
- */
10
- const turndown = new TurndownService();
11
-
12
- //#endregion
13
- //# sourceMappingURL=transform-engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-engine.js","names":[],"sources":["../../../../../../../libs/contracts/dist/presentations/transform-engine.js"],"sourcesContent":["import { schemaToMarkdown } from \"../schema-to-markdown.js\";\nimport React from \"react\";\nimport TurndownService from \"turndown\";\n\n//#region src/presentations/transform-engine.ts\n/**\n* Pluggable transform engine that renders descriptors to various targets\n* and runs validators (e.g., basic metadata checks, PII redaction policies).\n*/\nconst turndown = new TurndownService();\nfunction renderTextNode(node) {\n\tconst text = node.text ?? \"\";\n\tif (!node.marks || node.marks.length === 0) return text;\n\treturn node.marks.reduce((acc, mark) => {\n\t\tswitch (mark.type) {\n\t\t\tcase \"bold\": return `**${acc}**`;\n\t\t\tcase \"italic\": return `*${acc}*`;\n\t\t\tcase \"underline\": return `__${acc}__`;\n\t\t\tcase \"strike\": return `~~${acc}~~`;\n\t\t\tcase \"code\": return `\\`${acc}\\``;\n\t\t\tcase \"link\": {\n\t\t\t\tconst href = mark.attrs?.href ?? \"\";\n\t\t\t\treturn href ? `[${acc}](${href})` : acc;\n\t\t\t}\n\t\t\tdefault: return acc;\n\t\t}\n\t}, text);\n}\nfunction renderInline(nodes) {\n\tif (!nodes?.length) return \"\";\n\treturn nodes.map((child) => renderNode(child)).join(\"\");\n}\nfunction renderList(nodes, ordered = false) {\n\tif (!nodes?.length) return \"\";\n\tlet counter = 1;\n\treturn nodes.map((item) => {\n\t\tconst body = renderInline(item.content ?? []);\n\t\tif (!body) return \"\";\n\t\treturn `${ordered ? `${counter++}. ` : \"- \"}${body}`;\n\t}).filter(Boolean).join(\"\\n\");\n}\nfunction renderNode(node) {\n\tswitch (node.type) {\n\t\tcase \"doc\": return renderInline(node.content);\n\t\tcase \"paragraph\": {\n\t\t\tconst text = renderInline(node.content);\n\t\t\treturn text.trim().length ? text : \"\";\n\t\t}\n\t\tcase \"heading\": {\n\t\t\tconst levelAttr = node.attrs?.level;\n\t\t\tconst levelVal = typeof levelAttr === \"number\" ? levelAttr : 1;\n\t\t\tconst level = Math.min(Math.max(levelVal, 1), 6);\n\t\t\treturn `${\"#\".repeat(level)} ${renderInline(node.content)}`.trim();\n\t\t}\n\t\tcase \"bullet_list\": return renderList(node.content, false);\n\t\tcase \"ordered_list\": return renderList(node.content, true);\n\t\tcase \"list_item\": return renderInline(node.content);\n\t\tcase \"blockquote\": return renderInline(node.content).split(\"\\n\").map((line) => `> ${line}`).join(\"\\n\");\n\t\tcase \"code_block\": {\n\t\t\tconst body = renderInline(node.content);\n\t\t\treturn body ? `\\`\\`\\`\\n${body}\\n\\`\\`\\`` : \"\";\n\t\t}\n\t\tcase \"horizontal_rule\": return \"---\";\n\t\tcase \"hard_break\": return \"\\n\";\n\t\tcase \"text\": return renderTextNode(node);\n\t\tdefault:\n\t\t\tif (node.text) return renderTextNode(node);\n\t\t\treturn \"\";\n\t}\n}\nfunction blockNoteToMarkdown(docJson) {\n\tif (typeof docJson === \"string\") return docJson;\n\tif (docJson && typeof docJson === \"object\" && \"html\" in docJson) {\n\t\tconst html = String(docJson.html);\n\t\treturn turndown.turndown(html);\n\t}\n\tconst root = docJson;\n\tif (root?.type === \"doc\" || root?.content) return (root.content ?? []).map((n) => renderNode(n)).filter(Boolean).join(\"\\n\\n\").trim();\n\ttry {\n\t\treturn JSON.stringify(docJson, null, 2);\n\t} catch {\n\t\treturn String(docJson);\n\t}\n}\nvar TransformEngine = class {\n\trenderers = /* @__PURE__ */ new Map();\n\tvalidators = [];\n\tregister(renderer) {\n\t\tconst arr = this.renderers.get(renderer.target) ?? [];\n\t\tarr.push(renderer);\n\t\tthis.renderers.set(renderer.target, arr);\n\t\treturn this;\n\t}\n\t/**\n\t* Register a renderer that will be tried BEFORE existing renderers for the same target.\n\t* Useful for custom renderers that should take priority over default ones.\n\t*/\n\tprependRegister(renderer) {\n\t\tconst arr = this.renderers.get(renderer.target) ?? [];\n\t\tarr.unshift(renderer);\n\t\tthis.renderers.set(renderer.target, arr);\n\t\treturn this;\n\t}\n\taddValidator(v) {\n\t\tthis.validators.push(v);\n\t\treturn this;\n\t}\n\tasync render(target, desc, ctx) {\n\t\tif (!desc.targets.includes(target)) throw new Error(`Target ${target} not declared for ${desc.meta.key}.v${desc.meta.version}`);\n\t\tfor (const v of this.validators) await v.validate(desc, target, ctx);\n\t\tconst arr = this.renderers.get(target) ?? [];\n\t\tfor (const r of arr) try {\n\t\t\treturn await r.render(desc, ctx);\n\t\t} catch (_e) {}\n\t\tthrow new Error(`No renderer available for ${target}`);\n\t}\n};\n/** Create a TransformEngine instance with default markdown/json/xml renderers. */\nfunction createDefaultTransformEngine() {\n\tconst engine = new TransformEngine();\n\tconst applyPii = (desc, obj) => {\n\t\tconst clone = JSON.parse(JSON.stringify(obj));\n\t\tconst paths = desc.policy?.pii ?? [];\n\t\tconst setAtPath = (root, path) => {\n\t\t\tconst segs = path.replace(/^\\//, \"\").replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\").filter(Boolean);\n\t\t\tlet cur = root;\n\t\t\tfor (let i = 0; i < segs.length - 1; i++) {\n\t\t\t\tconst k = segs[i];\n\t\t\t\tif (!k) continue;\n\t\t\t\tif (cur && typeof cur === \"object\" && k in cur) cur = cur[k];\n\t\t\t\telse return;\n\t\t\t}\n\t\t\tconst last = segs[segs.length - 1];\n\t\t\tif (cur && typeof cur === \"object\" && last && last in cur) cur[last] = \"[REDACTED]\";\n\t\t};\n\t\tfor (const p of paths) setAtPath(clone, p);\n\t\treturn clone;\n\t};\n\tengine.register({\n\t\ttarget: \"markdown\",\n\t\tasync render(desc, ctx) {\n\t\t\tlet data = ctx?.data;\n\t\t\tif (!data && ctx?.fetchData) data = await ctx.fetchData();\n\t\t\tif (desc.source.type === \"component\" && desc.source.props && data !== void 0) {\n\t\t\t\tconst isArray = Array.isArray(data);\n\t\t\t\tconst isSimpleObject = !isArray && typeof data === \"object\" && data !== null && !Object.values(data).some((v) => Array.isArray(v) || typeof v === \"object\" && v !== null);\n\t\t\t\tif (isArray || isSimpleObject) return {\n\t\t\t\t\tmimeType: \"text/markdown\",\n\t\t\t\t\tbody: schemaToMarkdown(desc.source.props, data, {\n\t\t\t\t\t\ttitle: desc.meta.description ?? desc.meta.key,\n\t\t\t\t\t\tdescription: `${desc.meta.key} v${desc.meta.version}`\n\t\t\t\t\t})\n\t\t\t\t};\n\t\t\t\tthrow new Error(`Complex data structure for ${desc.meta.key} - expecting custom renderer`);\n\t\t\t}\n\t\t\tif (desc.source.type === \"blocknotejs\") {\n\t\t\t\tconst redacted = applyPii(desc, { text: blockNoteToMarkdown(desc.source.docJson) });\n\t\t\t\treturn {\n\t\t\t\t\tmimeType: \"text/markdown\",\n\t\t\t\t\tbody: String(redacted.text)\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (desc.source.type === \"component\" && data !== void 0) throw new Error(`No schema (source.props) available for ${desc.meta.key} - expecting custom renderer`);\n\t\t\tif (desc.source.type === \"component\") return {\n\t\t\t\tmimeType: \"text/markdown\",\n\t\t\t\tbody: `${`# ${desc.meta.key} v${desc.meta.version}`}${desc.meta.description ? `\\n\\n${desc.meta.description}` : \"\"}${desc.meta.tags && desc.meta.tags.length ? `\\n\\nTags: ${desc.meta.tags.join(\", \")}` : \"\"}${desc.meta.owners && desc.meta.owners.length ? `\\n\\nOwners: ${desc.meta.owners.join(\", \")}` : \"\"}${`\\n\\nComponent: \\`${desc.source.componentKey}\\``}${desc.policy?.pii?.length ? `\\n\\nRedacted paths: ${desc.policy.pii.map((p) => `\\`${p}\\``).join(\", \")}` : \"\"}`\n\t\t\t};\n\t\t\tthrow new Error(\"unsupported\");\n\t\t}\n\t});\n\tengine.register({\n\t\ttarget: \"application/json\",\n\t\tasync render(desc) {\n\t\t\tconst payload = applyPii(desc, {\n\t\t\t\tmeta: desc.meta,\n\t\t\t\tsource: desc.source\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tmimeType: \"application/json\",\n\t\t\t\tbody: JSON.stringify(payload, null, 2)\n\t\t\t};\n\t\t}\n\t});\n\tengine.register({\n\t\ttarget: \"application/xml\",\n\t\tasync render(desc) {\n\t\t\tconst json = applyPii(desc, {\n\t\t\t\tmeta: desc.meta,\n\t\t\t\tsource: desc.source\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tmimeType: \"application/xml\",\n\t\t\t\tbody: `<presentation name=\"${desc.meta.key}\" version=\"${desc.meta.version}\"><json>${encodeURIComponent(JSON.stringify(json))}</json></presentation>`\n\t\t\t};\n\t\t}\n\t});\n\treturn engine;\n}\n/** Register a default React target renderer that returns a serializable descriptor. */\nfunction registerDefaultReactRenderer(engine) {\n\tengine.register({\n\t\ttarget: \"react\",\n\t\tasync render(desc) {\n\t\t\tif (desc.source.type === \"component\") {\n\t\t\t\tconst props = desc.source.props ? desc.source.props.getZod().safeParse({}).success ? {} : void 0 : void 0;\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"react_component\",\n\t\t\t\t\tcomponentKey: desc.source.componentKey,\n\t\t\t\t\tprops\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tkind: \"blocknotejs\",\n\t\t\t\tdocJson: desc.source.docJson,\n\t\t\t\tblockConfig: desc.source.blockConfig\n\t\t\t};\n\t\t}\n\t});\n\treturn engine;\n}\n/**\n* Add basic validators (e.g., meta.description presence) to the engine.\n*/\nfunction registerBasicValidation(engine) {\n\tengine.addValidator({ validate(desc) {\n\t\tif (!desc.meta.description || desc.meta.description.length < 3) throw new Error(`Presentation ${desc.meta.key}.v${desc.meta.version} missing meta.description`);\n\t} });\n\treturn engine;\n}\n/**\n* Register a React-to-markdown renderer that renders React components to HTML\n* and converts them to markdown using turndown.\n* This renderer takes priority over the default metadata-only renderer.\n*/\nfunction registerReactToMarkdownRenderer(engine, componentMap) {\n\tconst turndownService = new TurndownService({\n\t\theadingStyle: \"atx\",\n\t\tcodeBlockStyle: \"fenced\",\n\t\tbulletListMarker: \"-\"\n\t});\n\tturndownService.addRule(\"link\", {\n\t\tfilter: \"a\",\n\t\treplacement: (content, node) => {\n\t\t\tconst href = node.href;\n\t\t\tif (href && content) return `[${content}](${href})`;\n\t\t\treturn content || \"\";\n\t\t}\n\t});\n\tengine.prependRegister({\n\t\ttarget: \"markdown\",\n\t\tasync render(desc, _ctx) {\n\t\t\tif (desc.source.type !== \"component\") throw new Error(\"React-to-markdown renderer only handles component presentations\");\n\t\t\tconst { renderToStaticMarkup } = await import(\"react-dom/server\");\n\t\t\tconst Component = componentMap[desc.source.componentKey];\n\t\t\tif (!Component) throw new Error(`Component ${desc.source.componentKey} not found in componentMap`);\n\t\t\tlet html;\n\t\t\ttry {\n\t\t\t\thtml = renderToStaticMarkup(React.createElement(Component, desc.source.props ? {} : void 0));\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to render component ${desc.source.componentKey}: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t\t}\n\t\t\tlet markdown;\n\t\t\ttry {\n\t\t\t\tmarkdown = turndownService.turndown(html);\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to convert HTML to markdown: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t\t}\n\t\t\tif (desc.policy?.pii && desc.policy.pii.length > 0) return {\n\t\t\t\tmimeType: \"text/markdown\",\n\t\t\t\tbody: markdown.replace(/\\[REDACTED\\]/g, \"[REDACTED]\")\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tmimeType: \"text/markdown\",\n\t\t\t\tbody: markdown\n\t\t\t};\n\t\t}\n\t});\n\treturn engine;\n}\n\n//#endregion\nexport { TransformEngine, createDefaultTransformEngine, registerBasicValidation, registerDefaultReactRenderer, registerReactToMarkdownRenderer };"],"mappings":";;;;;;;;;AASA,MAAM,WAAW,IAAI,iBAAiB"}
@@ -1 +0,0 @@
1
- import "zod";
@@ -1,2 +0,0 @@
1
- import { compareVersions } from "compare-versions";
2
- import "zod";
@@ -1 +0,0 @@
1
- import "./service.js";
@@ -1,5 +0,0 @@
1
- //#region ../../libs/contracts/dist/regenerator/service.js
2
- const DEFAULT_BATCH_DURATION = 5 * 6e4;
3
-
4
- //#endregion
5
- //# sourceMappingURL=service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.js","names":[],"sources":["../../../../../../../libs/contracts/dist/regenerator/service.js"],"sourcesContent":["import { behaviorToEnvelope, errorToEnvelope, telemetryToEnvelope } from \"./utils.js\";\n\n//#region src/regenerator/service.ts\n/** Cross-platform delay that works in browser and Node.js */\nconst delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\nconst DEFAULT_POLL_INTERVAL = 6e4;\nconst DEFAULT_BATCH_DURATION = 5 * 6e4;\nvar RegeneratorService = class {\n\tcontexts;\n\tlastPoll = /* @__PURE__ */ new Map();\n\ttimer;\n\trunning = false;\n\tpollInterval;\n\tbatchDuration;\n\tclock;\n\tconstructor(options) {\n\t\tthis.options = options;\n\t\tthis.contexts = new Map(options.contexts.map((ctx) => [ctx.id, ctx]));\n\t\tthis.pollInterval = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL;\n\t\tthis.batchDuration = options.batchDurationMs ?? DEFAULT_BATCH_DURATION;\n\t\tthis.clock = options.clock ?? (() => /* @__PURE__ */ new Date());\n\t\tif (this.options.rules.length === 0) throw new Error(\"RegeneratorService requires at least one rule\");\n\t}\n\tstart() {\n\t\tif (this.running) return;\n\t\tthis.running = true;\n\t\tthis.tick();\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.tick();\n\t\t}, this.pollInterval);\n\t}\n\tstop() {\n\t\tif (!this.running) return;\n\t\tthis.running = false;\n\t\tif (this.timer) {\n\t\t\tclearInterval(this.timer);\n\t\t\tthis.timer = void 0;\n\t\t}\n\t}\n\tasync runOnce() {\n\t\tawait this.tick();\n\t}\n\tasync tick() {\n\t\tconst now = this.clock();\n\t\tconst sinceDefault = new Date(now.getTime() - this.batchDuration);\n\t\tfor (const context of this.contexts.values()) {\n\t\t\tconst last = this.lastPoll.get(context.id) ?? sinceDefault;\n\t\t\tawait this.evaluateContext(context, last, now);\n\t\t\tthis.lastPoll.set(context.id, now);\n\t\t}\n\t}\n\tasync evaluateContext(context, since, until) {\n\t\tconst signals = await this.collectSignals(context, since, until);\n\t\tif (signals.length === 0) return;\n\t\tfor (const rule of this.options.rules) {\n\t\t\tlet proposals = [];\n\t\t\ttry {\n\t\t\t\tproposals = await rule.evaluate(context, signals);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`[regenerator] rule ${rule.id} failed`, error instanceof Error ? error : new Error(String(error)));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tawait this.flushProposals(context, proposals);\n\t\t}\n\t}\n\tasync collectSignals(context, since, until) {\n\t\tconst envelopes = [];\n\t\tconst { adapters } = this.options;\n\t\tif (adapters.telemetry) {\n\t\t\tconst telemetrySignals = await adapters.telemetry.pollTelemetry(context, since, until);\n\t\t\tenvelopes.push(...telemetrySignals.map((signal) => telemetryToEnvelope(context.id, signal, this.clock)));\n\t\t}\n\t\tif (adapters.errors) {\n\t\t\tconst errorSignals = await adapters.errors.pollErrors(context, since, until);\n\t\t\tenvelopes.push(...errorSignals.map((signal) => errorToEnvelope(context.id, signal, this.clock)));\n\t\t}\n\t\tif (adapters.behavior) {\n\t\t\tconst behaviorSignals = await adapters.behavior.pollBehavior(context, since, until);\n\t\t\tenvelopes.push(...behaviorSignals.map((signal) => behaviorToEnvelope(context.id, signal, this.clock)));\n\t\t}\n\t\treturn envelopes;\n\t}\n\tasync flushProposals(context, proposals) {\n\t\tfor (const proposal of proposals) {\n\t\t\tif (proposal.signalIds.length === 0) continue;\n\t\t\tawait this.options.sink.submit(context, proposal);\n\t\t\tif (proposals.length > 10) await delay(0);\n\t\t}\n\t}\n};\n\n//#endregion\nexport { RegeneratorService };"],"mappings":";AAMA,MAAM,yBAAyB,IAAI"}
@@ -1,71 +0,0 @@
1
- import { __esmMin } from "./_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../libs/contracts/dist/registry-utils.js
4
- /**
5
- * Filter items by criteria.
6
- * All criteria are combined with AND logic.
7
- */
8
- function filterBy(items, filter) {
9
- return items.filter((item) => {
10
- if (filter.tags?.length) {
11
- if (!filter.tags.some((tag) => item.meta.tags?.includes(tag))) return false;
12
- }
13
- if (filter.owners?.length) {
14
- if (!filter.owners.some((owner) => item.meta.owners?.includes(owner))) return false;
15
- }
16
- if (filter.stability?.length) {
17
- if (!filter.stability.includes(item.meta.stability ?? "stable")) return false;
18
- }
19
- if (filter.domain) {
20
- if (GroupingStrategies.byDomain(item) !== filter.domain) return false;
21
- }
22
- if (filter.keyPattern) {
23
- const name = item.meta.key ?? item.meta.key ?? "";
24
- const pattern = filter.keyPattern.replace(/\*/g, ".*").replace(/\?/g, ".");
25
- if (!new RegExp(`^${pattern}$`, "i").test(name)) return false;
26
- }
27
- return true;
28
- });
29
- }
30
- /**
31
- * Group items by key function.
32
- */
33
- function groupBy(items, keyFn) {
34
- const groups = /* @__PURE__ */ new Map();
35
- for (const item of items) {
36
- const key = keyFn(item);
37
- const existing = groups.get(key);
38
- if (existing) existing.push(item);
39
- else groups.set(key, [item]);
40
- }
41
- return groups;
42
- }
43
- /**
44
- * Get unique tags from a collection of items.
45
- */
46
- function getUniqueTags(items) {
47
- const tags = /* @__PURE__ */ new Set();
48
- for (const item of items) for (const tag of item.meta.tags ?? []) tags.add(tag);
49
- return Array.from(tags).sort();
50
- }
51
- var GroupingStrategies;
52
- var init_registry_utils = __esmMin(() => {
53
- GroupingStrategies = {
54
- byTag: (item) => item.meta.tags?.[0] ?? "untagged",
55
- byAllTags: (item) => item.meta.tags?.length ? item.meta.tags : ["untagged"],
56
- byOwner: (item) => item.meta.owners?.[0] ?? "unowned",
57
- byDomain: (item) => {
58
- return (item.meta.key ?? item.meta.key ?? "").split(".")[0] ?? "default";
59
- },
60
- byStability: (item) => item.meta.stability ?? "stable",
61
- byUrlPath: (level) => (item) => {
62
- if (!item.path) return "root";
63
- return item.path.split("/").filter(Boolean).slice(0, level).join("/") || "root";
64
- }
65
- };
66
- });
67
- init_registry_utils();
68
-
69
- //#endregion
70
- export { GroupingStrategies, filterBy, getUniqueTags, groupBy, init_registry_utils };
71
- //# sourceMappingURL=registry-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry-utils.js","names":[],"sources":["../../../../../../libs/contracts/dist/registry-utils.js"],"sourcesContent":["import { __esmMin, __exportAll } from \"./_virtual/rolldown_runtime.js\";\n\n//#region src/registry-utils.ts\nvar registry_utils_exports = /* @__PURE__ */ __exportAll({\n\tGroupingStrategies: () => GroupingStrategies,\n\tfilterBy: () => filterBy,\n\tgetUniqueDomains: () => getUniqueDomains,\n\tgetUniqueOwners: () => getUniqueOwners,\n\tgetUniqueTags: () => getUniqueTags,\n\tgroupBy: () => groupBy,\n\tgroupByMultiple: () => groupByMultiple,\n\tgroupByToArray: () => groupByToArray\n});\n/**\n* Filter items by criteria.\n* All criteria are combined with AND logic.\n*/\nfunction filterBy(items, filter) {\n\treturn items.filter((item) => {\n\t\tif (filter.tags?.length) {\n\t\t\tif (!filter.tags.some((tag) => item.meta.tags?.includes(tag))) return false;\n\t\t}\n\t\tif (filter.owners?.length) {\n\t\t\tif (!filter.owners.some((owner) => item.meta.owners?.includes(owner))) return false;\n\t\t}\n\t\tif (filter.stability?.length) {\n\t\t\tif (!filter.stability.includes(item.meta.stability ?? \"stable\")) return false;\n\t\t}\n\t\tif (filter.domain) {\n\t\t\tif (GroupingStrategies.byDomain(item) !== filter.domain) return false;\n\t\t}\n\t\tif (filter.keyPattern) {\n\t\t\tconst name = item.meta.key ?? item.meta.key ?? \"\";\n\t\t\tconst pattern = filter.keyPattern.replace(/\\*/g, \".*\").replace(/\\?/g, \".\");\n\t\t\tif (!new RegExp(`^${pattern}$`, \"i\").test(name)) return false;\n\t\t}\n\t\treturn true;\n\t});\n}\n/**\n* Group items by key function.\n*/\nfunction groupBy(items, keyFn) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const item of items) {\n\t\tconst key = keyFn(item);\n\t\tconst existing = groups.get(key);\n\t\tif (existing) existing.push(item);\n\t\telse groups.set(key, [item]);\n\t}\n\treturn groups;\n}\n/**\n* Group items by key function, returning array format.\n*/\nfunction groupByToArray(items, keyFn) {\n\tconst map = groupBy(items, keyFn);\n\treturn Array.from(map.entries()).map(([key, items$1]) => ({\n\t\tkey,\n\t\titems: items$1\n\t}));\n}\n/**\n* Group items where one item can belong to multiple groups.\n* Useful for byAllTags grouping.\n*/\nfunction groupByMultiple(items, keysFn) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const item of items) {\n\t\tconst keys = keysFn(item);\n\t\tfor (const key of keys) {\n\t\t\tconst existing = groups.get(key);\n\t\t\tif (existing) existing.push(item);\n\t\t\telse groups.set(key, [item]);\n\t\t}\n\t}\n\treturn groups;\n}\n/**\n* Get unique tags from a collection of items.\n*/\nfunction getUniqueTags(items) {\n\tconst tags = /* @__PURE__ */ new Set();\n\tfor (const item of items) for (const tag of item.meta.tags ?? []) tags.add(tag);\n\treturn Array.from(tags).sort();\n}\n/**\n* Get unique owners from a collection of items.\n*/\nfunction getUniqueOwners(items) {\n\tconst owners = /* @__PURE__ */ new Set();\n\tfor (const item of items) for (const owner of item.meta.owners ?? []) owners.add(owner);\n\treturn Array.from(owners).sort();\n}\n/**\n* Get unique domains from a collection of items.\n*/\nfunction getUniqueDomains(items) {\n\tconst domains = /* @__PURE__ */ new Set();\n\tfor (const item of items) domains.add(GroupingStrategies.byDomain(item));\n\treturn Array.from(domains).sort();\n}\nvar GroupingStrategies;\nvar init_registry_utils = __esmMin(() => {\n\tGroupingStrategies = {\n\t\tbyTag: (item) => item.meta.tags?.[0] ?? \"untagged\",\n\t\tbyAllTags: (item) => item.meta.tags?.length ? item.meta.tags : [\"untagged\"],\n\t\tbyOwner: (item) => item.meta.owners?.[0] ?? \"unowned\",\n\t\tbyDomain: (item) => {\n\t\t\treturn (item.meta.key ?? item.meta.key ?? \"\").split(\".\")[0] ?? \"default\";\n\t\t},\n\t\tbyStability: (item) => item.meta.stability ?? \"stable\",\n\t\tbyUrlPath: (level) => (item) => {\n\t\t\tif (!item.path) return \"root\";\n\t\t\treturn item.path.split(\"/\").filter(Boolean).slice(0, level).join(\"/\") || \"root\";\n\t\t}\n\t};\n});\n\n//#endregion\ninit_registry_utils();\nexport { GroupingStrategies, filterBy, getUniqueDomains, getUniqueOwners, getUniqueTags, groupBy, groupByMultiple, groupByToArray, init_registry_utils, registry_utils_exports };"],"mappings":";;;;;;;AAiBA,SAAS,SAAS,OAAO,QAAQ;AAChC,QAAO,MAAM,QAAQ,SAAS;AAC7B,MAAI,OAAO,MAAM,QAChB;OAAI,CAAC,OAAO,KAAK,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,IAAI,CAAC,CAAE,QAAO;;AAEvE,MAAI,OAAO,QAAQ,QAClB;OAAI,CAAC,OAAO,OAAO,MAAM,UAAU,KAAK,KAAK,QAAQ,SAAS,MAAM,CAAC,CAAE,QAAO;;AAE/E,MAAI,OAAO,WAAW,QACrB;OAAI,CAAC,OAAO,UAAU,SAAS,KAAK,KAAK,aAAa,SAAS,CAAE,QAAO;;AAEzE,MAAI,OAAO,QACV;OAAI,mBAAmB,SAAS,KAAK,KAAK,OAAO,OAAQ,QAAO;;AAEjE,MAAI,OAAO,YAAY;GACtB,MAAM,OAAO,KAAK,KAAK,OAAO,KAAK,KAAK,OAAO;GAC/C,MAAM,UAAU,OAAO,WAAW,QAAQ,OAAO,KAAK,CAAC,QAAQ,OAAO,IAAI;AAC1E,OAAI,CAAC,IAAI,OAAO,IAAI,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,CAAE,QAAO;;AAEzD,SAAO;GACN;;;;;AAKH,SAAS,QAAQ,OAAO,OAAO;CAC9B,MAAM,yBAAyB,IAAI,KAAK;AACxC,MAAK,MAAM,QAAQ,OAAO;EACzB,MAAM,MAAM,MAAM,KAAK;EACvB,MAAM,WAAW,OAAO,IAAI,IAAI;AAChC,MAAI,SAAU,UAAS,KAAK,KAAK;MAC5B,QAAO,IAAI,KAAK,CAAC,KAAK,CAAC;;AAE7B,QAAO;;;;;AA+BR,SAAS,cAAc,OAAO;CAC7B,MAAM,uBAAuB,IAAI,KAAK;AACtC,MAAK,MAAM,QAAQ,MAAO,MAAK,MAAM,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAE,MAAK,IAAI,IAAI;AAC/E,QAAO,MAAM,KAAK,KAAK,CAAC,MAAM;;AAkB/B,IAAI;AACJ,IAAI,sBAAsB,eAAe;AACxC,sBAAqB;EACpB,QAAQ,SAAS,KAAK,KAAK,OAAO,MAAM;EACxC,YAAY,SAAS,KAAK,KAAK,MAAM,SAAS,KAAK,KAAK,OAAO,CAAC,WAAW;EAC3E,UAAU,SAAS,KAAK,KAAK,SAAS,MAAM;EAC5C,WAAW,SAAS;AACnB,WAAQ,KAAK,KAAK,OAAO,KAAK,KAAK,OAAO,IAAI,MAAM,IAAI,CAAC,MAAM;;EAEhE,cAAc,SAAS,KAAK,KAAK,aAAa;EAC9C,YAAY,WAAW,SAAS;AAC/B,OAAI,CAAC,KAAK,KAAM,QAAO;AACvB,UAAO,KAAK,KAAK,MAAM,IAAI,CAAC,OAAO,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI;;EAE1E;EACA;AAGF,qBAAqB"}
@@ -1,8 +0,0 @@
1
- import { init_registry_utils } from "./registry-utils.js";
2
- import { compareVersions } from "compare-versions";
3
-
4
- //#region ../../libs/contracts/dist/registry.js
5
- init_registry_utils();
6
-
7
- //#endregion
8
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","names":[],"sources":["../../../../../../libs/contracts/dist/registry.js"],"sourcesContent":["import { filterBy, getUniqueTags, groupBy, init_registry_utils } from \"./registry-utils.js\";\nimport { compareVersions } from \"compare-versions\";\n\n//#region src/registry.ts\ninit_registry_utils();\nconst keyOfSpecContract = (spec) => `${spec.meta.key}.v${spec.meta.version}`;\n/** In-memory registry for PresentationSpec. */\nvar SpecContractRegistry = class {\n\titems = /* @__PURE__ */ new Map();\n\tconstructor(contractType, items) {\n\t\tthis.contractType = contractType;\n\t\tif (items) items.forEach((p) => this.register(p));\n\t}\n\tregister(p) {\n\t\tconst key = keyOfSpecContract(p);\n\t\tif (this.items.has(key)) throw new Error(`Duplicate contract \\`${this.contractType}\\` ${key}`);\n\t\tthis.items.set(key, p);\n\t\treturn this;\n\t}\n\tcount() {\n\t\treturn this.items.size;\n\t}\n\tlist() {\n\t\treturn [...this.items.values()];\n\t}\n\tget(key, version) {\n\t\tif (version != null) return this.items.get(`${key}.v${version}`);\n\t\tlet candidate;\n\t\tfor (const [k, p] of this.items.entries()) {\n\t\t\tif (!k.startsWith(`${key}.v`)) continue;\n\t\t\tif (!candidate || compareVersions(p.meta.version, candidate.meta.version) > 0) candidate = p;\n\t\t}\n\t\treturn candidate;\n\t}\n\thas(key, version) {\n\t\treturn !!this.get(key, version);\n\t}\n\t/** Filter presentations by criteria. */\n\tfilter(criteria) {\n\t\treturn filterBy(this.list(), criteria);\n\t}\n\t/** List presentations with specific tag. */\n\tlistByTag(tag) {\n\t\treturn this.list().filter((p) => p.meta.tags?.includes(tag));\n\t}\n\t/** List presentations by owner. */\n\tlistByOwner(owner) {\n\t\treturn this.list().filter((p) => p.meta.owners?.includes(owner));\n\t}\n\t/** Group presentations by key function. */\n\tgroupBy(keyFn) {\n\t\treturn groupBy(this.list(), keyFn);\n\t}\n\t/** Get unique tags from all presentations. */\n\tgetUniqueTags() {\n\t\treturn getUniqueTags(this.list());\n\t}\n};\n\n//#endregion\nexport { SpecContractRegistry, keyOfSpecContract };"],"mappings":";;;;AAIA,qBAAqB"}
@@ -1 +0,0 @@
1
- import "zod";
@@ -1 +0,0 @@
1
- import "../../schema/dist/index.js";
@@ -1 +0,0 @@
1
- import "../../../schema/dist/index.js";
@@ -1,8 +0,0 @@
1
- import "../../../schema/dist/index.js";
2
- import "../jsonschema.js";
3
- import "./contracts-adapter-input.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";
@@ -1,8 +0,0 @@
1
- import "./graphql-pothos.js";
2
- import "./mcp/createMcpServer.js";
3
- import "./rest-generic.js";
4
- import "./rest-elysia.js";
5
- import "./rest-express.js";
6
- import "./rest-next-app.js";
7
- import "./rest-next-pages.js";
8
- import "./provider-mcp.js";
@@ -1,4 +0,0 @@
1
- import "./registerTools.js";
2
- import "./registerResources.js";
3
- import "./registerPrompts.js";
4
- import "./registerPresentations.js";
@@ -1,2 +0,0 @@
1
- import "../../presentations/transform-engine.js";
2
- import "../../presentations/index.js";
@@ -1 +0,0 @@
1
- import z$1 from "zod";
@@ -1,2 +0,0 @@
1
- import "@modelcontextprotocol/sdk/server/mcp.js";
2
- import "node:buffer";
@@ -1 +0,0 @@
1
- import "../../jsonschema.js";
@@ -1 +0,0 @@
1
- import "./mcp/createMcpServer.js";
@@ -1 +0,0 @@
1
- import "./rest-generic.js";
@@ -1 +0,0 @@
1
- import "./rest-generic.js";