@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217060834 → 0.0.0-canary-20251217072406

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 (269) hide show
  1. package/dist/_virtual/rolldown_runtime.js +22 -1
  2. package/dist/adapters/ai.js +82 -1
  3. package/dist/adapters/factory.js +36 -1
  4. package/dist/adapters/fs.js +118 -1
  5. package/dist/adapters/git.js +54 -1
  6. package/dist/adapters/index.js +7 -1
  7. package/dist/adapters/logger.js +80 -1
  8. package/dist/adapters/watcher.js +69 -1
  9. package/dist/adapters/workspace.js +190 -2
  10. package/dist/ai/agents/claude-code-agent.js +146 -9
  11. package/dist/ai/agents/cursor-agent.js +286 -17
  12. package/dist/ai/agents/index.js +5 -1
  13. package/dist/ai/agents/openai-codex-agent.js +140 -8
  14. package/dist/ai/agents/orchestrator.js +142 -1
  15. package/dist/ai/agents/simple-agent.js +80 -4
  16. package/dist/ai/client.js +162 -1
  17. package/dist/ai/index.js +27 -1
  18. package/dist/ai/prompts/code-generation.js +55 -13
  19. package/dist/ai/prompts/index.js +12 -1
  20. package/dist/ai/prompts/spec-creation.js +61 -20
  21. package/dist/ai/providers.js +40 -1
  22. package/dist/formatters/index.js +18 -1
  23. package/dist/formatters/json.js +71 -1
  24. package/dist/formatters/sarif.js +163 -1
  25. package/dist/formatters/text.js +208 -2
  26. package/dist/index.d.ts +0 -3
  27. package/dist/index.js +81 -1
  28. package/dist/libs/ai-providers/dist/factory.js +154 -0
  29. package/dist/libs/ai-providers/dist/index.js +4 -0
  30. package/dist/libs/ai-providers/dist/legacy.js +72 -0
  31. package/dist/libs/ai-providers/dist/models.js +287 -0
  32. package/dist/libs/ai-providers/dist/validation.js +1 -0
  33. package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -0
  34. package/dist/libs/contracts/dist/client/index.js +5 -0
  35. package/dist/libs/contracts/dist/client/react/feature-render.js +2 -0
  36. package/dist/libs/contracts/dist/client/react/form-render.js +4 -0
  37. package/dist/libs/contracts/dist/client/react/index.js +4 -0
  38. package/dist/libs/contracts/dist/contract-registry/index.js +1 -0
  39. package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -0
  40. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -0
  41. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -0
  42. package/dist/libs/contracts/dist/docs/index.js +29 -0
  43. package/dist/libs/contracts/dist/docs/presentations.js +71 -0
  44. package/dist/libs/contracts/dist/docs/registry.js +44 -0
  45. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -0
  46. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -0
  47. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -0
  48. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -0
  49. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -0
  50. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +80 -0
  51. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +57 -0
  52. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -0
  53. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +357 -0
  54. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -0
  55. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -0
  56. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -0
  57. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -0
  58. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +79 -0
  59. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +84 -0
  60. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +45 -0
  61. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -0
  62. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +40 -0
  63. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +69 -0
  64. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -0
  65. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +62 -0
  66. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +155 -0
  67. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -0
  68. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +101 -0
  69. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -0
  70. package/dist/libs/contracts/dist/events.js +8 -0
  71. package/dist/libs/contracts/dist/experiments/evaluator.js +1 -0
  72. package/dist/libs/contracts/dist/index.js +72 -0
  73. package/dist/libs/contracts/dist/install.js +2 -0
  74. package/dist/libs/contracts/dist/integrations/contracts.js +377 -0
  75. package/dist/libs/contracts/dist/integrations/index.js +18 -0
  76. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -0
  77. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -0
  78. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -0
  79. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -0
  80. package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -0
  81. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -0
  82. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -0
  83. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -0
  84. package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -0
  85. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -0
  86. package/dist/libs/contracts/dist/integrations/providers/index.js +11 -0
  87. package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -0
  88. package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -0
  89. package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -0
  90. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -0
  91. package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -0
  92. package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -0
  93. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -0
  94. package/dist/libs/contracts/dist/jsonschema.js +24 -0
  95. package/dist/libs/contracts/dist/knowledge/contracts.js +306 -0
  96. package/dist/libs/contracts/dist/knowledge/index.js +7 -0
  97. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -0
  98. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -0
  99. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -0
  100. package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -0
  101. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -0
  102. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -0
  103. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -0
  104. package/dist/libs/contracts/dist/llm/exporters.js +352 -0
  105. package/dist/libs/contracts/dist/llm/index.js +2 -0
  106. package/dist/libs/contracts/dist/llm/prompts.js +211 -0
  107. package/dist/libs/contracts/dist/onboarding-base.js +196 -0
  108. package/dist/libs/contracts/dist/openapi.js +75 -0
  109. package/dist/libs/contracts/dist/ownership.js +21 -0
  110. package/dist/libs/contracts/dist/presentations.js +1 -0
  111. package/dist/libs/contracts/dist/presentations.v2.js +11 -0
  112. package/dist/libs/contracts/dist/prompt.js +1 -0
  113. package/dist/libs/contracts/dist/promptRegistry.js +1 -0
  114. package/dist/libs/contracts/dist/regenerator/index.js +2 -0
  115. package/dist/libs/contracts/dist/regenerator/service.js +92 -0
  116. package/dist/libs/contracts/dist/regenerator/utils.js +51 -0
  117. package/dist/libs/contracts/dist/registry.js +208 -0
  118. package/dist/libs/contracts/dist/resources.js +1 -0
  119. package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -0
  120. package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -0
  121. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -0
  122. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +34 -0
  123. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -0
  124. package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -0
  125. package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -0
  126. package/dist/libs/contracts/dist/schema/dist/index.js +6 -0
  127. package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -0
  128. package/dist/libs/contracts/dist/server/index.js +8 -0
  129. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -0
  130. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -0
  131. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -0
  132. package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -0
  133. package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -0
  134. package/dist/libs/contracts/dist/server/provider-mcp.js +1 -0
  135. package/dist/libs/contracts/dist/server/rest-elysia.js +1 -0
  136. package/dist/libs/contracts/dist/server/rest-express.js +1 -0
  137. package/dist/libs/contracts/dist/server/rest-generic.js +1 -0
  138. package/dist/libs/contracts/dist/server/rest-next-app.js +1 -0
  139. package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -0
  140. package/dist/libs/contracts/dist/spec.js +35 -0
  141. package/dist/libs/contracts/dist/telemetry/index.js +1 -0
  142. package/dist/libs/contracts/dist/telemetry/tracker.js +1 -0
  143. package/dist/libs/contracts/dist/tests/index.js +1 -0
  144. package/dist/libs/contracts/dist/tests/runner.js +150 -0
  145. package/dist/libs/contracts/dist/workflow/index.js +1 -0
  146. package/dist/libs/contracts/dist/workflow/runner.js +1 -0
  147. package/dist/libs/contracts-transformers/dist/common/utils.js +47 -0
  148. package/dist/libs/contracts-transformers/dist/openapi/exporter.js +1 -0
  149. package/dist/libs/contracts-transformers/dist/openapi/importer.js +255 -0
  150. package/dist/libs/contracts-transformers/dist/openapi/index.js +4 -0
  151. package/dist/libs/contracts-transformers/dist/openapi/parser.js +231 -0
  152. package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +201 -0
  153. package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +137 -0
  154. package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +101 -0
  155. package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +84 -0
  156. package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +30 -0
  157. package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +96 -0
  158. package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +151 -0
  159. package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +344 -0
  160. package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +122 -0
  161. package/dist/modules/contractspec-workspace/dist/templates/app-config.js +105 -0
  162. package/dist/modules/contractspec-workspace/dist/templates/data-view.js +68 -0
  163. package/dist/modules/contractspec-workspace/dist/templates/event.js +38 -0
  164. package/dist/modules/contractspec-workspace/dist/templates/experiment.js +87 -0
  165. package/dist/modules/contractspec-workspace/dist/templates/handler.js +95 -0
  166. package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +104 -0
  167. package/dist/modules/contractspec-workspace/dist/templates/integration.js +62 -0
  168. package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +68 -0
  169. package/dist/modules/contractspec-workspace/dist/templates/migration.js +60 -0
  170. package/dist/modules/contractspec-workspace/dist/templates/operation.js +100 -0
  171. package/dist/modules/contractspec-workspace/dist/templates/presentation.js +78 -0
  172. package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +89 -0
  173. package/dist/modules/contractspec-workspace/dist/templates/utils.js +38 -0
  174. package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +48 -0
  175. package/dist/modules/contractspec-workspace/dist/templates/workflow.js +67 -0
  176. package/dist/modules/contractspec-workspace/dist/types/generation-types.js +20 -0
  177. package/dist/services/agent-guide/adapters/claude-code.js +144 -3
  178. package/dist/services/agent-guide/adapters/cursor-cli.js +135 -3
  179. package/dist/services/agent-guide/adapters/generic-mcp.js +159 -3
  180. package/dist/services/agent-guide/adapters/index.js +30 -1
  181. package/dist/services/agent-guide/agent-guide-service.js +148 -1
  182. package/dist/services/agent-guide/index.js +5 -1
  183. package/dist/services/build.js +140 -1
  184. package/dist/services/ci-check/ci-check-service.js +393 -1
  185. package/dist/services/ci-check/index.js +2 -1
  186. package/dist/services/ci-check/types.js +28 -1
  187. package/dist/services/clean.js +71 -1
  188. package/dist/services/config.js +76 -1
  189. package/dist/services/deps.js +62 -1
  190. package/dist/services/diff.js +33 -1
  191. package/dist/services/doctor/checks/ai.js +118 -2
  192. package/dist/services/doctor/checks/cli.js +146 -1
  193. package/dist/services/doctor/checks/config.js +170 -1
  194. package/dist/services/doctor/checks/deps.js +180 -1
  195. package/dist/services/doctor/checks/index.js +6 -1
  196. package/dist/services/doctor/checks/mcp.js +144 -1
  197. package/dist/services/doctor/checks/workspace.js +243 -1
  198. package/dist/services/doctor/doctor-service.js +115 -2
  199. package/dist/services/doctor/index.js +2 -1
  200. package/dist/services/doctor/types.js +26 -1
  201. package/dist/services/implementation/discovery.js +143 -2
  202. package/dist/services/implementation/index.js +2 -1
  203. package/dist/services/implementation/resolver.js +223 -1
  204. package/dist/services/index.js +53 -1
  205. package/dist/services/integrity-diagram.js +274 -6
  206. package/dist/services/integrity.js +272 -1
  207. package/dist/services/list.js +35 -1
  208. package/dist/services/openapi/export-service.js +51 -2
  209. package/dist/services/openapi/import-service.js +75 -1
  210. package/dist/services/openapi/index.js +4 -1
  211. package/dist/services/openapi/sync-service.js +121 -1
  212. package/dist/services/openapi/validate-service.js +130 -1
  213. package/dist/services/regenerator.js +23 -1
  214. package/dist/services/registry.js +73 -1
  215. package/dist/services/setup/config-generators.js +113 -26
  216. package/dist/services/setup/file-merger.js +60 -2
  217. package/dist/services/setup/index.js +4 -1
  218. package/dist/services/setup/setup-service.js +95 -1
  219. package/dist/services/setup/targets/agents-md.js +46 -1
  220. package/dist/services/setup/targets/cli-config.js +59 -1
  221. package/dist/services/setup/targets/cursor-rules.js +47 -1
  222. package/dist/services/setup/targets/mcp-claude.js +59 -1
  223. package/dist/services/setup/targets/mcp-cursor.js +58 -1
  224. package/dist/services/setup/targets/vscode-settings.js +62 -1
  225. package/dist/services/setup/types.js +26 -1
  226. package/dist/services/sync.js +62 -1
  227. package/dist/services/test.js +30 -1
  228. package/dist/services/validate-implementation.js +69 -1
  229. package/dist/services/validate.js +47 -1
  230. package/dist/services/verification-cache/adapters/filesystem.js +121 -1
  231. package/dist/services/verification-cache/adapters/in-memory.js +45 -1
  232. package/dist/services/verification-cache/adapters/index.js +3 -1
  233. package/dist/services/verification-cache/adapters/workspace-state.js +90 -1
  234. package/dist/services/verification-cache/cache-service.js +255 -1
  235. package/dist/services/verification-cache/index.js +6 -1
  236. package/dist/services/verification-cache/types.js +15 -1
  237. package/dist/services/verify/ai-verifier.js +336 -9
  238. package/dist/services/verify/behavior-verifier.js +185 -1
  239. package/dist/services/verify/index.js +4 -1
  240. package/dist/services/verify/structure-verifier.js +195 -2
  241. package/dist/services/verify/verify-service.js +203 -3
  242. package/dist/services/watch.js +31 -1
  243. package/dist/services/workspace-info.js +102 -2
  244. package/dist/templates/app-config.template.js +101 -28
  245. package/dist/templates/data-view.template.js +42 -27
  246. package/dist/templates/event.template.js +29 -14
  247. package/dist/templates/experiment.template.js +77 -51
  248. package/dist/templates/handler.template.js +53 -17
  249. package/dist/templates/index.js +36 -1
  250. package/dist/templates/integration.template.js +134 -50
  251. package/dist/templates/knowledge.template.js +62 -21
  252. package/dist/templates/migration.template.js +50 -26
  253. package/dist/templates/operation.template.js +44 -28
  254. package/dist/templates/presentation.template.js +46 -20
  255. package/dist/templates/telemetry.template.js +74 -53
  256. package/dist/templates/workflow-runner.template.js +12 -6
  257. package/dist/templates/workflow.template.js +51 -24
  258. package/package.json +13 -9
  259. package/dist/adapters/index.d.ts +0 -7
  260. package/dist/ports/index.d.ts +0 -5
  261. package/dist/services/agent-guide/index.d.ts +0 -6
  262. package/dist/services/ci-check/index.d.ts +0 -2
  263. package/dist/services/doctor/index.d.ts +0 -2
  264. package/dist/services/implementation/index.d.ts +0 -3
  265. package/dist/services/index.d.ts +0 -56
  266. package/dist/services/openapi/index.d.ts +0 -5
  267. package/dist/services/verification-cache/adapters/index.d.ts +0 -3
  268. package/dist/services/verification-cache/index.d.ts +0 -6
  269. package/dist/services/verify/index.d.ts +0 -5
@@ -0,0 +1,49 @@
1
+ import "zod";
2
+ import { GraphQLScalarType } from "graphql";
3
+
4
+ //#region ../../libs/contracts/dist/schema/dist/FieldType.js
5
+ /**
6
+ * GraphQL scalar wrapper that carries zod and JSON Schema metadata.
7
+ *
8
+ * TInternal is the runtime representation; TExternal is the GraphQL output.
9
+ */
10
+ var FieldType = class extends GraphQLScalarType {
11
+ zodSchema;
12
+ jsonSchemaDef;
13
+ constructor(config) {
14
+ super(config);
15
+ this.zodSchema = config.zod;
16
+ this.jsonSchemaDef = config.jsonSchema;
17
+ }
18
+ /** Return the attached zod schema for validation. */
19
+ getZod() {
20
+ return this.zodSchema;
21
+ }
22
+ /** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */
23
+ getPothos() {
24
+ return this;
25
+ }
26
+ /** Return the JSON Schema (evaluates factory if provided). */
27
+ getJson() {
28
+ return typeof this.jsonSchemaDef === "function" ? this.jsonSchemaDef() : this.jsonSchemaDef;
29
+ }
30
+ getJsonSchemaDef() {
31
+ return this.jsonSchemaDef;
32
+ }
33
+ getJsonSchema() {
34
+ const deepResolve = (v) => {
35
+ const value = typeof v === "function" ? v() : v;
36
+ if (Array.isArray(value)) return value.map((item) => deepResolve(item));
37
+ if (value && typeof value === "object") {
38
+ const obj = {};
39
+ for (const [k, val] of Object.entries(value)) obj[k] = deepResolve(val);
40
+ return obj;
41
+ }
42
+ return value;
43
+ };
44
+ return deepResolve(this.getJson());
45
+ }
46
+ };
47
+
48
+ //#endregion
49
+ export { FieldType };
@@ -0,0 +1,236 @@
1
+ import { FieldType } from "./FieldType.js";
2
+ import * as z$1 from "zod";
3
+ import { Kind } from "graphql";
4
+
5
+ //#region ../../libs/contracts/dist/schema/dist/ScalarTypeEnum.js
6
+ const localeRegex = /^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/;
7
+ const timezoneRegex = /^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/;
8
+ const phoneRegex = /^[+]?\d[\d\s().-]{3,}$/;
9
+ const currencyRegex = /^[A-Z]{3}$/;
10
+ const countryRegex = /^[A-Z]{2}$/;
11
+ const latMin = -90;
12
+ const latMax = 90;
13
+ const lonMin = -180;
14
+ const lonMax = 180;
15
+ /**
16
+ * Factory functions for common scalar FieldTypes with zod/GraphQL/JSON Schema.
17
+ */
18
+ const ScalarTypeEnum = {
19
+ String_unsecure: () => new FieldType({
20
+ name: "String_unsecure",
21
+ description: "Unvalidated string scalar",
22
+ zod: z$1.string(),
23
+ parseValue: (v) => z$1.string().parse(v),
24
+ serialize: (v) => String(v),
25
+ parseLiteral: (ast) => {
26
+ if (ast.kind !== Kind.STRING) throw new TypeError("Invalid literal");
27
+ return ast.value;
28
+ },
29
+ jsonSchema: { type: "string" }
30
+ }),
31
+ Int_unsecure: () => new FieldType({
32
+ name: "Int_unsecure",
33
+ description: "Unvalidated integer scalar",
34
+ zod: z$1.number().int(),
35
+ parseValue: (v) => {
36
+ const num = typeof v === "number" ? v : Number(v);
37
+ return z$1.number().int().parse(num);
38
+ },
39
+ serialize: (v) => Math.trunc(typeof v === "number" ? v : Number(v)),
40
+ parseLiteral: (ast) => {
41
+ if (ast.kind !== Kind.INT) throw new TypeError("Invalid literal");
42
+ return Number(ast.value);
43
+ },
44
+ jsonSchema: { type: "integer" }
45
+ }),
46
+ Float_unsecure: () => new FieldType({
47
+ name: "Float_unsecure",
48
+ description: "Unvalidated float scalar",
49
+ zod: z$1.number(),
50
+ parseValue: (v) => {
51
+ const num = typeof v === "number" ? v : Number(v);
52
+ return z$1.number().parse(num);
53
+ },
54
+ serialize: (v) => Number(v),
55
+ parseLiteral: (ast) => {
56
+ if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT) throw new TypeError("Invalid literal");
57
+ return Number(ast.value);
58
+ },
59
+ jsonSchema: { type: "number" }
60
+ }),
61
+ Boolean: () => new FieldType({
62
+ name: "Boolean",
63
+ description: "Unvalidated boolean scalar",
64
+ zod: z$1.boolean(),
65
+ parseValue: (v) => z$1.coerce.boolean().parse(v),
66
+ serialize: (v) => Boolean(v),
67
+ parseLiteral: (ast) => {
68
+ if (ast.kind !== Kind.BOOLEAN) throw new TypeError("Invalid literal");
69
+ return ast.value;
70
+ },
71
+ jsonSchema: { type: "boolean" }
72
+ }),
73
+ ID: () => new FieldType({
74
+ name: "ID",
75
+ description: "Unvalidated id scalar",
76
+ zod: z$1.string(),
77
+ parseValue: (v) => z$1.string().parse(v),
78
+ serialize: (v) => String(v),
79
+ parseLiteral: (ast) => {
80
+ if (ast.kind !== Kind.STRING) throw new TypeError("Invalid literal");
81
+ return ast.value;
82
+ },
83
+ jsonSchema: { type: "string" }
84
+ }),
85
+ JSON: () => new FieldType({
86
+ name: "JSON",
87
+ zod: z$1.any(),
88
+ parseValue: (v) => v,
89
+ serialize: (v) => v,
90
+ jsonSchema: {}
91
+ }),
92
+ JSONObject: () => new FieldType({
93
+ name: "JSONObject",
94
+ zod: z$1.record(z$1.string(), z$1.any()),
95
+ parseValue: (v) => z$1.record(z$1.string(), z$1.any()).parse(v),
96
+ serialize: (v) => v ?? {},
97
+ jsonSchema: { type: "object" }
98
+ }),
99
+ Date: () => new FieldType({
100
+ name: "Date",
101
+ zod: z$1.date(),
102
+ parseValue: (v) => v instanceof Date ? v : new Date(String(v)),
103
+ serialize: (v) => v instanceof Date ? v.toISOString().split("T")[0] : String(v),
104
+ jsonSchema: {
105
+ type: "string",
106
+ format: "date"
107
+ }
108
+ }),
109
+ DateTime: () => new FieldType({
110
+ name: "DateTime",
111
+ zod: z$1.date(),
112
+ parseValue: (v) => v instanceof Date ? v : new Date(String(v)),
113
+ serialize: (v) => {
114
+ return v instanceof Date ? v.toISOString() : String(v);
115
+ },
116
+ jsonSchema: {
117
+ type: "string",
118
+ format: "date-time"
119
+ }
120
+ }),
121
+ Time: () => new FieldType({
122
+ name: "Time",
123
+ zod: z$1.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),
124
+ parseValue: (v) => z$1.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(v),
125
+ serialize: (v) => String(v),
126
+ jsonSchema: {
127
+ type: "string",
128
+ pattern: "^\\d{2}:\\d{2}(:\\d{2})?$"
129
+ }
130
+ }),
131
+ EmailAddress: () => new FieldType({
132
+ name: "EmailAddress",
133
+ zod: z$1.string().email(),
134
+ parseValue: (v) => z$1.string().email().parse(v),
135
+ serialize: (v) => String(v),
136
+ jsonSchema: {
137
+ type: "string",
138
+ format: "email"
139
+ }
140
+ }),
141
+ URL: () => new FieldType({
142
+ name: "URL",
143
+ zod: z$1.string().url(),
144
+ parseValue: (v) => z$1.string().url().parse(v),
145
+ serialize: (v) => String(v),
146
+ jsonSchema: {
147
+ type: "string",
148
+ format: "uri"
149
+ }
150
+ }),
151
+ PhoneNumber: () => new FieldType({
152
+ name: "PhoneNumber",
153
+ zod: z$1.string().regex(phoneRegex),
154
+ parseValue: (v) => z$1.string().regex(phoneRegex).parse(v),
155
+ serialize: (v) => String(v),
156
+ jsonSchema: {
157
+ type: "string",
158
+ pattern: phoneRegex.source
159
+ }
160
+ }),
161
+ NonEmptyString: () => new FieldType({
162
+ name: "NonEmptyString",
163
+ zod: z$1.string().min(1),
164
+ parseValue: (v) => z$1.string().min(1).parse(v),
165
+ serialize: (v) => String(v),
166
+ jsonSchema: {
167
+ type: "string",
168
+ minLength: 1
169
+ }
170
+ }),
171
+ Locale: () => new FieldType({
172
+ name: "Locale",
173
+ zod: z$1.string().regex(localeRegex),
174
+ parseValue: (v) => z$1.string().regex(localeRegex).parse(v),
175
+ serialize: (v) => String(v),
176
+ jsonSchema: {
177
+ type: "string",
178
+ pattern: localeRegex.source
179
+ }
180
+ }),
181
+ TimeZone: () => new FieldType({
182
+ name: "TimeZone",
183
+ zod: z$1.string().regex(timezoneRegex),
184
+ parseValue: (v) => z$1.string().regex(timezoneRegex).parse(v),
185
+ serialize: (v) => String(v),
186
+ jsonSchema: {
187
+ type: "string",
188
+ pattern: timezoneRegex.source
189
+ }
190
+ }),
191
+ Latitude: () => new FieldType({
192
+ name: "Latitude",
193
+ zod: z$1.number().min(latMin).max(latMax),
194
+ parseValue: (v) => z$1.coerce.number().min(latMin).max(latMax).parse(v),
195
+ serialize: (v) => Number(v),
196
+ jsonSchema: {
197
+ type: "number",
198
+ minimum: latMin,
199
+ maximum: latMax
200
+ }
201
+ }),
202
+ Longitude: () => new FieldType({
203
+ name: "Longitude",
204
+ zod: z$1.number().min(lonMin).max(lonMax),
205
+ parseValue: (v) => z$1.coerce.number().min(lonMin).max(lonMax).parse(v),
206
+ serialize: (v) => Number(v),
207
+ jsonSchema: {
208
+ type: "number",
209
+ minimum: lonMin,
210
+ maximum: lonMax
211
+ }
212
+ }),
213
+ Currency: () => new FieldType({
214
+ name: "Currency",
215
+ zod: z$1.string().regex(currencyRegex),
216
+ parseValue: (v) => z$1.string().regex(currencyRegex).parse(v),
217
+ serialize: (v) => String(v),
218
+ jsonSchema: {
219
+ type: "string",
220
+ pattern: currencyRegex.source
221
+ }
222
+ }),
223
+ CountryCode: () => new FieldType({
224
+ name: "CountryCode",
225
+ zod: z$1.string().regex(countryRegex),
226
+ parseValue: (v) => z$1.string().regex(countryRegex).parse(v),
227
+ serialize: (v) => String(v),
228
+ jsonSchema: {
229
+ type: "string",
230
+ pattern: countryRegex.source
231
+ }
232
+ })
233
+ };
234
+
235
+ //#endregion
236
+ export { ScalarTypeEnum };
@@ -0,0 +1,34 @@
1
+ import "./EnumType.js";
2
+ import "./FieldType.js";
3
+ import * as z$1 from "zod";
4
+
5
+ //#region ../../libs/contracts/dist/schema/dist/SchemaModel.js
6
+ /**
7
+ * Named object model built from FieldType/EnumType/SchemaModel fields.
8
+ * Provides zod and GraphQL input helpers, and supports arrays/optional fields.
9
+ */
10
+ var SchemaModel = class {
11
+ constructor(config) {
12
+ this.config = config;
13
+ }
14
+ /**
15
+ * Build a typed ZodObject from the model fields, preserving each field's
16
+ * Zod schema and optionality at the type level when possible.
17
+ */
18
+ getZod() {
19
+ const shape = Object.entries(this.config.fields).reduce((acc, [key, def]) => {
20
+ const base = def.type.getZod();
21
+ const withArray = def.isArray ? z$1.array(base) : base;
22
+ acc[key] = def.isOptional ? withArray.optional() : withArray;
23
+ return acc;
24
+ }, {});
25
+ return z$1.object(shape);
26
+ }
27
+ /** Input object name for GraphQL builder adapters. */
28
+ getPothosInput() {
29
+ return this.config.name;
30
+ }
31
+ };
32
+
33
+ //#endregion
34
+ export { SchemaModel };
@@ -0,0 +1,2 @@
1
+ import "./defineEntity.js";
2
+ import "./types.js";
@@ -0,0 +1 @@
1
+ import "zod";
@@ -0,0 +1,6 @@
1
+ import "./EnumType.js";
2
+ import "./FieldType.js";
3
+ import "./SchemaModel.js";
4
+ import "./ScalarTypeEnum.js";
5
+ import "./entity/defineEntity.js";
6
+ import "./entity/index.js";
@@ -0,0 +1,6 @@
1
+ import "../jsonschema.js";
2
+ import "@pothos/plugin-prisma";
3
+ import "@pothos/plugin-complexity";
4
+ import "@pothos/plugin-relay";
5
+ import "@pothos/plugin-dataloader";
6
+ import "@pothos/plugin-tracing";
@@ -0,0 +1,8 @@
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";
@@ -0,0 +1,4 @@
1
+ import "./registerTools.js";
2
+ import "./registerResources.js";
3
+ import "./registerPrompts.js";
4
+ import "./registerPresentations.js";
@@ -0,0 +1,2 @@
1
+ import "../../presentations.v2.js";
2
+ import "../../presentations.js";
@@ -0,0 +1 @@
1
+ import z from "zod";
@@ -0,0 +1,2 @@
1
+ import "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import "node:buffer";
@@ -0,0 +1 @@
1
+ import "../../jsonschema.js";
@@ -0,0 +1 @@
1
+ import "./mcp/createMcpServer.js";
@@ -0,0 +1 @@
1
+ import "./rest-generic.js";
@@ -0,0 +1 @@
1
+ import "./rest-generic.js";
@@ -0,0 +1 @@
1
+ import "../jsonschema.js";
@@ -0,0 +1 @@
1
+ import "./rest-generic.js";
@@ -0,0 +1 @@
1
+ import "./rest-generic.js";
@@ -0,0 +1,35 @@
1
+ //#region ../../libs/contracts/dist/spec.js
2
+ const isEmitDeclRef = (e) => "ref" in e;
3
+ /**
4
+ * Helper to define a Command (write operation).
5
+ * Sets `kind: 'command'` and defaults `idempotent: false`.
6
+ */
7
+ const defineCommand = (spec) => ({
8
+ ...spec,
9
+ meta: {
10
+ ...spec.meta,
11
+ kind: "command"
12
+ },
13
+ policy: {
14
+ ...spec.policy,
15
+ idempotent: spec.policy?.["policy"]?.idempotent ?? false
16
+ }
17
+ });
18
+ /**
19
+ * Helper to define a Query (read-only operation).
20
+ * Sets `kind: 'query'` and forces `idempotent: true`.
21
+ */
22
+ const defineQuery = (spec) => ({
23
+ ...spec,
24
+ meta: {
25
+ ...spec.meta,
26
+ kind: "query"
27
+ },
28
+ policy: {
29
+ ...spec.policy,
30
+ idempotent: true
31
+ }
32
+ });
33
+
34
+ //#endregion
35
+ export { defineCommand, defineQuery, isEmitDeclRef };
@@ -0,0 +1 @@
1
+ import "./tracker.js";
@@ -0,0 +1 @@
1
+ import "crypto";
@@ -0,0 +1 @@
1
+ import { TestRunner } from "./runner.js";
@@ -0,0 +1,150 @@
1
+ import "../index.js";
2
+ import { deepStrictEqual } from "node:assert";
3
+
4
+ //#region ../../libs/contracts/dist/tests/runner.js
5
+ var TestRunner = class {
6
+ constructor(config) {
7
+ this.config = config;
8
+ }
9
+ async run(spec) {
10
+ const scenarios = [];
11
+ let passed = 0;
12
+ let failed = 0;
13
+ for (const scenario of spec.scenarios) {
14
+ await this.config.beforeEach?.(scenario);
15
+ const result = await this.runScenario(spec, scenario);
16
+ scenarios.push(result);
17
+ if (result.status === "passed") passed += 1;
18
+ else failed += 1;
19
+ await this.config.afterEach?.(scenario, result);
20
+ }
21
+ return {
22
+ spec,
23
+ scenarios,
24
+ passed,
25
+ failed
26
+ };
27
+ }
28
+ async runScenario(spec, scenario) {
29
+ const assertionResults = [];
30
+ try {
31
+ const context = await this.createContext();
32
+ const fixtures = [...spec.fixtures ?? [], ...scenario.given ?? []];
33
+ const events = [];
34
+ for (const fixture of fixtures) await this.executeOperation(fixture, context, events);
35
+ const actionResult = await this.executeOperation(scenario.when, context, events);
36
+ const assertions = scenario.then ?? [];
37
+ for (const assertion of assertions) {
38
+ const assertionResult = this.evaluateAssertion(assertion, actionResult, events);
39
+ assertionResults.push(assertionResult);
40
+ }
41
+ return {
42
+ scenario,
43
+ status: assertionResults.some((assertion) => assertion.status === "failed") ? "failed" : "passed",
44
+ assertionResults
45
+ };
46
+ } catch (error) {
47
+ return {
48
+ scenario,
49
+ status: "failed",
50
+ error,
51
+ assertionResults
52
+ };
53
+ }
54
+ }
55
+ async createContext() {
56
+ return { ...await this.config.createContext?.() ?? {} };
57
+ }
58
+ async executeOperation(action, baseCtx, recordedEvents) {
59
+ const ctx = {
60
+ ...baseCtx,
61
+ eventPublisher: async (event) => {
62
+ recordedEvents.push({
63
+ name: event.name,
64
+ version: event.version,
65
+ payload: event.payload
66
+ });
67
+ await baseCtx.eventPublisher?.(event);
68
+ }
69
+ };
70
+ try {
71
+ return {
72
+ output: await this.config.registry.execute(action.operation.name, action.operation.version, action.input ?? null, ctx),
73
+ events: recordedEvents
74
+ };
75
+ } catch (error) {
76
+ return {
77
+ error,
78
+ events: recordedEvents
79
+ };
80
+ }
81
+ }
82
+ evaluateAssertion(assertion, result, events) {
83
+ switch (assertion.type) {
84
+ case "expectOutput": return this.evaluateOutputAssertion(assertion, result);
85
+ case "expectError": return this.evaluateErrorAssertion(assertion, result);
86
+ case "expectEvents": return this.evaluateEventsAssertion(assertion, events);
87
+ default: return {
88
+ assertion,
89
+ status: "failed",
90
+ message: `Unknown assertion type ${assertion.type}`
91
+ };
92
+ }
93
+ }
94
+ evaluateOutputAssertion(assertion, result) {
95
+ if (result.error) return {
96
+ assertion,
97
+ status: "failed",
98
+ message: `Expected output but operation threw error: ${result.error.message}`
99
+ };
100
+ try {
101
+ deepStrictEqual(result.output, assertion.match);
102
+ return {
103
+ assertion,
104
+ status: "passed"
105
+ };
106
+ } catch (error) {
107
+ return {
108
+ assertion,
109
+ status: "failed",
110
+ message: error instanceof Error ? error.message : "Output assertion failed"
111
+ };
112
+ }
113
+ }
114
+ evaluateErrorAssertion(assertion, result) {
115
+ if (!result.error) return {
116
+ assertion,
117
+ status: "failed",
118
+ message: "Expected an error but operation completed successfully"
119
+ };
120
+ if (assertion.messageIncludes && !result.error.message.includes(assertion.messageIncludes)) return {
121
+ assertion,
122
+ status: "failed",
123
+ message: `Error message "${result.error.message}" did not include expected substring "${assertion.messageIncludes}"`
124
+ };
125
+ return {
126
+ assertion,
127
+ status: "passed"
128
+ };
129
+ }
130
+ evaluateEventsAssertion(assertion, events) {
131
+ const failures = [];
132
+ for (const expected of assertion.events) {
133
+ const count = events.filter((event) => event.name === expected.name && event.version === expected.version).length;
134
+ if (typeof expected.min === "number" && count < expected.min || typeof expected.max === "number" && count > expected.max) failures.push(`Event ${expected.name}.v${expected.version} occurred ${count} times (expected ${expected.min ?? 0} - ${expected.max ?? "∞"})`);
135
+ else if (typeof expected.min === "undefined" && typeof expected.max === "undefined" && count === 0) failures.push(`Event ${expected.name}.v${expected.version} did not occur`);
136
+ }
137
+ if (failures.length > 0) return {
138
+ assertion,
139
+ status: "failed",
140
+ message: failures.join("; ")
141
+ };
142
+ return {
143
+ assertion,
144
+ status: "passed"
145
+ };
146
+ }
147
+ };
148
+
149
+ //#endregion
150
+ export { TestRunner };
@@ -0,0 +1 @@
1
+ import "./runner.js";
@@ -0,0 +1 @@
1
+ import "node:crypto";
@@ -0,0 +1,47 @@
1
+ //#region ../../libs/contracts-transformers/dist/common/utils.js
2
+ /**
3
+ * Common utilities for contract transformations.
4
+ */
5
+ /**
6
+ * Convert a string to PascalCase.
7
+ */
8
+ function toPascalCase(str) {
9
+ return str.replace(/[-_./\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^./, (c) => c.toUpperCase());
10
+ }
11
+ /**
12
+ * Convert a string to camelCase.
13
+ */
14
+ function toCamelCase(str) {
15
+ const pascal = toPascalCase(str);
16
+ return pascal.charAt(0).toLowerCase() + pascal.slice(1);
17
+ }
18
+ /**
19
+ * Convert a string to kebab-case.
20
+ */
21
+ function toKebabCase(str) {
22
+ return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_./]+/g, "-").toLowerCase();
23
+ }
24
+ /**
25
+ * Sanitize a string to be a valid TypeScript identifier.
26
+ */
27
+ function toValidIdentifier(str) {
28
+ let result = str.replace(/[^a-zA-Z0-9_$]/g, "_");
29
+ if (/^[0-9]/.test(result)) result = "_" + result;
30
+ return result;
31
+ }
32
+ /**
33
+ * Generate a ContractSpec name from an operation identifier.
34
+ */
35
+ function toSpecName(operationId, prefix) {
36
+ const name = toCamelCase(operationId);
37
+ return prefix ? `${prefix}.${name}` : name;
38
+ }
39
+ /**
40
+ * Generate a file name from a spec name.
41
+ */
42
+ function toFileName(specName) {
43
+ return toKebabCase(specName.replace(/\./g, "-")) + ".ts";
44
+ }
45
+
46
+ //#endregion
47
+ export { toCamelCase, toFileName, toPascalCase, toSpecName, toValidIdentifier };