@lssm/lib.contracts 1.42.9 → 1.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -0
  2. package/dist/app-config/contracts.d.ts +50 -50
  3. package/dist/app-config/docs/app-config.docblock.js +1 -1
  4. package/dist/app-config/events.d.ts +27 -27
  5. package/dist/app-config/lifecycle-contracts.d.ts +54 -54
  6. package/dist/contract-registry/schemas.d.ts +2 -2
  7. package/dist/docs/index.js +3 -1
  8. package/dist/docs/tech/contracts/openapi-import.docblock.d.ts +6 -0
  9. package/dist/docs/tech/contracts/openapi-import.docblock.js +65 -0
  10. package/dist/docs/tech/presentation-runtime.docblock.js +1 -1
  11. package/dist/docs/tech/schema/README.docblock.js +1 -1
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +2 -2
  14. package/dist/integrations/openbanking/contracts/accounts.d.ts +66 -66
  15. package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
  16. package/dist/integrations/openbanking/contracts/transactions.d.ts +48 -48
  17. package/dist/integrations/openbanking/models.d.ts +55 -55
  18. package/dist/integrations/operations.d.ts +102 -102
  19. package/dist/jsonschema.d.ts +2 -3
  20. package/dist/knowledge/operations.d.ts +66 -66
  21. package/dist/model-registry.d.ts +1 -1
  22. package/dist/model-registry.js +14 -3
  23. package/dist/onboarding-base.d.ts +29 -29
  24. package/dist/operations/operation.d.ts +7 -1
  25. package/dist/registry.d.ts +1 -0
  26. package/dist/registry.js +3 -0
  27. package/dist/schema-to-markdown.js +3 -0
  28. package/dist/server/contracts-adapter-input.js +36 -30
  29. package/dist/server/graphql-pothos.js +33 -26
  30. package/dist/server/mcp/createMcpServer.js +1 -2
  31. package/dist/server/mcp/mcpTypes.d.ts +0 -3
  32. package/dist/server/mcp/registerPresentations.d.ts +1 -1
  33. package/dist/server/mcp/registerPresentations.js +12 -61
  34. package/dist/{docs/tech/workflows → workflow}/overview.docblock.d.ts +1 -1
  35. package/dist/{docs/tech/workflows → workflow}/overview.docblock.js +2 -2
  36. package/dist/workspace-config/contractsrc-schema.d.ts +40 -5
  37. package/dist/workspace-config/contractsrc-schema.js +17 -4
  38. package/dist/workspace-config/index.d.ts +2 -2
  39. package/dist/workspace-config/index.js +2 -2
  40. package/dist/workspace-config/workspace-config.docblock.d.ts +6 -0
  41. package/dist/workspace-config/workspace-config.docblock.js +45 -0
  42. package/package.json +10 -7
@@ -1,7 +1,6 @@
1
+ import { isSchemaModel } from "@lssm/lib.schema";
2
+
1
3
  //#region src/server/contracts-adapter-input.ts
2
- function isSchemaModel(x) {
3
- return typeof x?.getPothosInput === "function" && typeof x?.getZod === "function";
4
- }
5
4
  function isFieldType(x) {
6
5
  return typeof x?.getPothos === "function";
7
6
  }
@@ -21,13 +20,16 @@ function createInputTypeBuilder(builder) {
21
20
  const enumTypeCache = /* @__PURE__ */ new Set();
22
21
  function registerEnumsForModel(model) {
23
22
  const entries = Object.entries(model.config.fields);
24
- for (const [, field] of entries) if (isSchemaModel(field.type)) registerEnumsForModel(field.type);
25
- else if (isEnumType(field.type)) {
26
- const enumObj = field.type;
27
- const name = enumObj.getName?.() ?? enumObj.getPothos().name;
28
- if (!enumTypeCache.has(name)) {
29
- builder.enumType(name, { values: enumObj.getEnumValues() });
30
- enumTypeCache.add(name);
23
+ for (const [, field] of entries) {
24
+ const fieldType = field.type;
25
+ if (isSchemaModel(fieldType)) registerEnumsForModel(fieldType);
26
+ else if (isEnumType(field.type)) {
27
+ const enumObj = field.type;
28
+ const name = enumObj.getName?.() ?? enumObj.getPothos().name;
29
+ if (!enumTypeCache.has(name)) {
30
+ builder.enumType(name, { values: enumObj.getEnumValues() });
31
+ enumTypeCache.add(name);
32
+ }
31
33
  }
32
34
  }
33
35
  }
@@ -39,26 +41,29 @@ function createInputTypeBuilder(builder) {
39
41
  const created = builder.inputType(model.getPothosInput(), { fields: (t) => {
40
42
  const entries = Object.entries(model.config.fields);
41
43
  const acc = {};
42
- for (const [key, field] of entries) if (isSchemaModel(field.type)) {
43
- const nested = ensureInputTypeForModel(field.type);
44
- const typeRef = field.isArray ? [nested] : nested;
45
- acc[key] = t.field({
46
- type: typeRef,
47
- required: !field.isOptional
48
- });
49
- } else if (isFieldType(field.type)) {
50
- const typeName$1 = mapScalarName(String(field.type.getPothos().name));
51
- const typeRef = field.isArray ? [typeName$1] : typeName$1;
52
- acc[key] = t.field({
53
- type: typeRef,
54
- required: !field.isOptional
55
- });
56
- } else {
57
- const typeRef = field.isArray ? ["JSON"] : "JSON";
58
- acc[key] = t.field({
59
- type: typeRef,
60
- required: !field.isOptional
61
- });
44
+ for (const [key, field] of entries) {
45
+ const fieldType = field.type;
46
+ if (isSchemaModel(fieldType)) {
47
+ const nested = ensureInputTypeForModel(fieldType);
48
+ const typeRef = field.isArray ? [nested] : nested;
49
+ acc[key] = t.field({
50
+ type: typeRef,
51
+ required: !field.isOptional
52
+ });
53
+ } else if (isFieldType(field.type)) {
54
+ const typeName$1 = mapScalarName(String(field.type.getPothos().name));
55
+ const typeRef = field.isArray ? [typeName$1] : typeName$1;
56
+ acc[key] = t.field({
57
+ type: typeRef,
58
+ required: !field.isOptional
59
+ });
60
+ } else {
61
+ const typeRef = field.isArray ? ["JSON"] : "JSON";
62
+ acc[key] = t.field({
63
+ type: typeRef,
64
+ required: !field.isOptional
65
+ });
66
+ }
62
67
  }
63
68
  return acc;
64
69
  } });
@@ -67,6 +72,7 @@ function createInputTypeBuilder(builder) {
67
72
  }
68
73
  function buildInputFieldArgs(model) {
69
74
  if (!model) return null;
75
+ if (!isSchemaModel(model)) return null;
70
76
  if (!model.config?.fields || Object.keys(model.config.fields).length === 0) return null;
71
77
  return ensureInputTypeForModel(model);
72
78
  }
@@ -1,6 +1,7 @@
1
1
  import { defaultGqlField } from "../jsonschema.js";
2
2
  import { createInputTypeBuilder } from "./contracts-adapter-input.js";
3
3
  import { hydrateResourceIfNeeded, parseReturns } from "./contracts-adapter-hydration.js";
4
+ import { isSchemaModel } from "@lssm/lib.schema";
4
5
  import "@pothos/plugin-prisma";
5
6
  import "@pothos/plugin-complexity";
6
7
  import "@pothos/plugin-relay";
@@ -32,41 +33,47 @@ function registerContractsOnBuilder(builder, reg, resources) {
32
33
  const out = spec.io.output;
33
34
  if (out && "getZod" in out && typeof out.getZod === "function") {
34
35
  const model = out;
35
- const typeName = model.config?.name ?? "UnknownOutput";
36
- if (!outputTypeCache.has(typeName)) outputTypeCache.set(typeName, model);
36
+ const typeName = isSchemaModel(model) ? model.config?.name : "UnknownOutput";
37
+ if (typeName && !outputTypeCache.has(typeName)) outputTypeCache.set(typeName, model);
37
38
  }
38
39
  }
39
- for (const [typeName, model] of outputTypeCache.entries()) builder.objectType(typeName, { fields: (t) => {
40
- const entries = Object.entries(model.config.fields);
41
- const acc = {};
42
- for (const [key, field] of entries) {
43
- const fieldType = field.type;
44
- let gqlType = "JSON";
45
- if (fieldType && typeof fieldType.getPothos === "function") {
46
- gqlType = fieldType.getPothos().name || "JSON";
47
- if (gqlType === "String_unsecure") gqlType = "String";
48
- if (gqlType === "Int_unsecure") gqlType = "Int";
49
- if (gqlType === "Float_unsecure") gqlType = "Float";
50
- if (gqlType === "Boolean_unsecure") gqlType = "Boolean";
51
- if (gqlType === "ID_unsecure") gqlType = "ID";
40
+ for (const [typeName, model] of outputTypeCache.entries()) {
41
+ if (!isSchemaModel(model)) continue;
42
+ builder.objectType(typeName, { fields: (t) => {
43
+ const entries = Object.entries(model.config.fields);
44
+ const acc = {};
45
+ for (const [key, field] of entries) {
46
+ const fieldType = field.type;
47
+ let gqlType = "JSON";
48
+ if (fieldType && typeof fieldType.getPothos === "function") {
49
+ gqlType = fieldType.getPothos().name || "JSON";
50
+ if (gqlType === "String_unsecure") gqlType = "String";
51
+ if (gqlType === "Int_unsecure") gqlType = "Int";
52
+ if (gqlType === "Float_unsecure") gqlType = "Float";
53
+ if (gqlType === "Boolean_unsecure") gqlType = "Boolean";
54
+ if (gqlType === "ID_unsecure") gqlType = "ID";
55
+ }
56
+ const typeRef = field.isArray ? [gqlType] : gqlType;
57
+ acc[key] = t.field({
58
+ type: typeRef,
59
+ nullable: field.isOptional,
60
+ resolve: (parent) => parent[key]
61
+ });
52
62
  }
53
- const typeRef = field.isArray ? [gqlType] : gqlType;
54
- acc[key] = t.field({
55
- type: typeRef,
56
- nullable: field.isOptional,
57
- resolve: (parent) => parent[key]
58
- });
59
- }
60
- return acc;
61
- } });
63
+ return acc;
64
+ } });
65
+ }
62
66
  function resolveGraphQLTypeName(contractSpec) {
63
67
  const returnsName = contractSpec.transport?.gql?.returns;
64
68
  if (returnsName) return returnsName;
65
69
  const out = contractSpec.io.output ?? {};
66
70
  if (out && "kind" in out && out.kind === "resource_ref" && "graphQLType" in out && out.graphQLType) return String(out.graphQLType);
67
71
  if (out && "getZod" in out && typeof out.getZod === "function") {
68
- const typeName = out.config?.name;
69
- if (typeName && outputTypeCache.has(typeName)) return typeName;
72
+ const model = out;
73
+ if (isSchemaModel(model)) {
74
+ const typeName = model.config?.name;
75
+ if (typeName && outputTypeCache.has(typeName)) return typeName;
76
+ }
70
77
  }
71
78
  return "JSON";
72
79
  }
@@ -17,8 +17,7 @@ function createMcpServer(server, ops, resources, prompts, ctxFactories) {
17
17
  });
18
18
  registerMcpPresentations(server, {
19
19
  logger: ctxFactories.logger,
20
- presentations: ctxFactories.presentations,
21
- presentationsV2: ctxFactories.presentationsV2
20
+ presentations: ctxFactories.presentations
22
21
  });
23
22
  registerMcpPrompts(server, prompts, { promptCtx: ctxFactories.promptCtx });
24
23
  return server;
@@ -1,4 +1,3 @@
1
- import { PresentationSpec } from "../../presentations/presentations.js";
2
1
  import { HandlerCtx } from "../../types.js";
3
2
  import { PresentationRegistry } from "../../presentations/registry.js";
4
3
  import "../../presentations/index.js";
@@ -23,8 +22,6 @@ interface McpCtxFactories {
23
22
  };
24
23
  /** Optional registry for presentations */
25
24
  presentations?: PresentationRegistry;
26
- /** Optional list of presentation specs */
27
- presentationsV2?: PresentationSpec[];
28
25
  }
29
26
  //#endregion
30
27
  export { McpCtxFactories };
@@ -2,6 +2,6 @@ import { McpCtxFactories } from "./mcpTypes.js";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
 
4
4
  //#region src/server/mcp/registerPresentations.d.ts
5
- declare function registerMcpPresentations(server: McpServer, ctx: Pick<McpCtxFactories, 'logger' | 'presentations' | 'presentationsV2'>): void;
5
+ declare function registerMcpPresentations(server: McpServer, ctx: Pick<McpCtxFactories, 'logger' | 'presentations'>): void;
6
6
  //#endregion
7
7
  export { registerMcpPresentations };
@@ -7,25 +7,24 @@ function isEngineRenderOutput(x) {
7
7
  return "body" in x && typeof x.body === "string";
8
8
  }
9
9
  function registerMcpPresentations(server, ctx) {
10
- const __presentations = ctx.presentations;
11
- const __presentationsV2 = ctx.presentationsV2;
10
+ if (!ctx.presentations?.count()) return;
12
11
  const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
13
- if (__presentations) for (const p of __presentations.list()) {
14
- const baseKey = `presentation.${p.meta.key.replace(/\./g, "_")}.v${p.meta.version}`;
15
- const baseUri = `presentation://${p.meta.key}/v${p.meta.version}`;
12
+ for (const presentationSpec of ctx.presentations.list()) {
13
+ const baseKey = `presentation.${presentationSpec.meta.key.replace(/\./g, "_")}.v${presentationSpec.meta.version}`;
14
+ const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
16
15
  ctx.logger.info(`Registering presentation ${baseUri} for ${baseKey}`);
17
16
  server.registerResource(baseKey, baseUri, {
18
- title: `${p.meta.key} v${p.meta.version}`,
19
- description: p.meta.description ?? "Presentation",
17
+ title: `${presentationSpec.meta.key} v${presentationSpec.meta.version}`,
18
+ description: presentationSpec.meta.description ?? "Presentation",
20
19
  mimeType: "application/json"
21
20
  }, async () => {
22
21
  return { contents: [{
23
22
  uri: baseUri,
24
23
  mimeType: "application/json",
25
24
  text: JSON.stringify({
26
- meta: p.meta,
27
- source: p.source,
28
- targets: p.targets
25
+ meta: presentationSpec.meta,
26
+ source: presentationSpec.source,
27
+ targets: presentationSpec.targets
29
28
  }, null, 2)
30
29
  }] };
31
30
  });
@@ -46,58 +45,10 @@ function registerMcpPresentations(server, ctx) {
46
45
  const key = `${baseKey}${v.ext}`;
47
46
  const uri = `${baseUri}${v.ext}`;
48
47
  server.registerResource(key, uri, {
49
- title: `${p.meta.key} v${p.meta.version} (${v.ext})`,
50
- description: `${p.meta.description ?? "Presentation"} (${v.ext})`
48
+ title: `${presentationSpec.meta.key} v${presentationSpec.meta.version} (${v.ext})`,
49
+ description: `${presentationSpec.meta.description ?? "Presentation"} (${v.ext})`
51
50
  }, async () => {
52
- const out = await engine.render(v.target, p);
53
- return { contents: [{
54
- uri,
55
- mimeType: isEngineRenderOutput(out) && out.mimeType ? out.mimeType : v.target === "markdown" ? "text/markdown" : v.target,
56
- text: isEngineRenderOutput(out) && typeof out.body === "string" ? out.body : String(out)
57
- }] };
58
- });
59
- }
60
- }
61
- if (__presentationsV2 && __presentationsV2.length) for (const d of __presentationsV2) {
62
- const baseKey = `presentation.${d.meta.key.replace(/\./g, "_")}.v${d.meta.version}`;
63
- const baseUri = `presentation://${d.meta.key}/v${d.meta.version}`;
64
- ctx.logger.info(`Registering presentation descriptor ${baseUri} for ${baseKey}`);
65
- server.registerResource(baseKey, baseUri, {
66
- title: `${d.meta.key} v${d.meta.version}`,
67
- description: d.meta.description ?? "Presentation",
68
- mimeType: "application/json"
69
- }, async () => {
70
- return { contents: [{
71
- uri: baseUri,
72
- mimeType: "application/json",
73
- text: JSON.stringify({
74
- meta: d.meta,
75
- source: d.source,
76
- targets: d.targets
77
- }, null, 2)
78
- }] };
79
- });
80
- for (const v of [
81
- {
82
- ext: ".md",
83
- target: "markdown"
84
- },
85
- {
86
- ext: ".json",
87
- target: "application/json"
88
- },
89
- {
90
- ext: ".xml",
91
- target: "application/xml"
92
- }
93
- ]) {
94
- const key = `${baseKey}${v.ext}`;
95
- const uri = `${baseUri}${v.ext}`;
96
- server.registerResource(key, uri, {
97
- title: `${d.meta.key} v${d.meta.version} (${v.ext})`,
98
- description: `${d.meta.description ?? "Presentation"} (${v.ext})`
99
- }, async () => {
100
- const out = await engine.render(v.target, d);
51
+ const out = await engine.render(v.target, presentationSpec);
101
52
  return { contents: [{
102
53
  uri,
103
54
  mimeType: isEngineRenderOutput(out) && out.mimeType ? out.mimeType : v.target === "markdown" ? "text/markdown" : v.target,
@@ -1,6 +1,6 @@
1
1
  import { DocBlock } from "@lssm/lib.contracts/docs";
2
2
 
3
- //#region src/docs/tech/workflows/overview.docblock.d.ts
3
+ //#region src/workflow/overview.docblock.d.ts
4
4
  declare const tech_workflows_overview_DocBlocks: DocBlock[];
5
5
  //#endregion
6
6
  export { tech_workflows_overview_DocBlocks };
@@ -1,6 +1,6 @@
1
- import { registerDocBlocks } from "../../registry.js";
1
+ import { registerDocBlocks } from "../docs/registry.js";
2
2
 
3
- //#region src/docs/tech/workflows/overview.docblock.ts
3
+ //#region src/workflow/overview.docblock.ts
4
4
  const tech_workflows_overview_DocBlocks = [{
5
5
  id: "docs.tech.workflows.overview",
6
6
  title: "WorkflowSpec Overview",
@@ -2,6 +2,16 @@ import * as z$1 from "zod";
2
2
 
3
3
  //#region src/workspace-config/contractsrc-schema.d.ts
4
4
 
5
+ /**
6
+ * Schema output format for code generation.
7
+ * Controls how imported/generated schemas are written.
8
+ */
9
+ declare const SchemaFormatSchema: z$1.ZodEnum<{
10
+ contractspec: "contractspec";
11
+ zod: "zod";
12
+ "json-schema": "json-schema";
13
+ graphql: "graphql";
14
+ }>;
5
15
  /**
6
16
  * OpenAPI source configuration for import/sync/validate operations.
7
17
  */
@@ -19,10 +29,10 @@ declare const OpenApiSourceConfigSchema: z$1.ZodObject<{
19
29
  include: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
20
30
  prefix: z$1.ZodOptional<z$1.ZodString>;
21
31
  defaultStability: z$1.ZodOptional<z$1.ZodEnum<{
32
+ deprecated: "deprecated";
22
33
  experimental: "experimental";
23
34
  beta: "beta";
24
35
  stable: "stable";
25
- deprecated: "deprecated";
26
36
  }>>;
27
37
  defaultAuth: z$1.ZodOptional<z$1.ZodEnum<{
28
38
  user: "user";
@@ -30,6 +40,12 @@ declare const OpenApiSourceConfigSchema: z$1.ZodObject<{
30
40
  admin: "admin";
31
41
  }>>;
32
42
  defaultOwners: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
43
+ schemaFormat: z$1.ZodDefault<z$1.ZodEnum<{
44
+ contractspec: "contractspec";
45
+ zod: "zod";
46
+ "json-schema": "json-schema";
47
+ graphql: "graphql";
48
+ }>>;
33
49
  }, z$1.core.$strip>;
34
50
  declare const OpenApiExportConfigSchema: z$1.ZodObject<{
35
51
  outputPath: z$1.ZodDefault<z$1.ZodString>;
@@ -63,10 +79,10 @@ declare const OpenApiConfigSchema: z$1.ZodObject<{
63
79
  include: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
64
80
  prefix: z$1.ZodOptional<z$1.ZodString>;
65
81
  defaultStability: z$1.ZodOptional<z$1.ZodEnum<{
82
+ deprecated: "deprecated";
66
83
  experimental: "experimental";
67
84
  beta: "beta";
68
85
  stable: "stable";
69
- deprecated: "deprecated";
70
86
  }>>;
71
87
  defaultAuth: z$1.ZodOptional<z$1.ZodEnum<{
72
88
  user: "user";
@@ -74,6 +90,12 @@ declare const OpenApiConfigSchema: z$1.ZodObject<{
74
90
  admin: "admin";
75
91
  }>>;
76
92
  defaultOwners: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
93
+ schemaFormat: z$1.ZodDefault<z$1.ZodEnum<{
94
+ contractspec: "contractspec";
95
+ zod: "zod";
96
+ "json-schema": "json-schema";
97
+ graphql: "graphql";
98
+ }>>;
77
99
  }, z$1.core.$strip>>>;
78
100
  export: z$1.ZodOptional<z$1.ZodObject<{
79
101
  outputPath: z$1.ZodDefault<z$1.ZodString>;
@@ -486,9 +508,9 @@ declare const ContractsrcSchema: z$1.ZodObject<{
486
508
  }>>;
487
509
  aiModel: z$1.ZodOptional<z$1.ZodString>;
488
510
  agentMode: z$1.ZodDefault<z$1.ZodEnum<{
489
- simple: "simple";
490
511
  cursor: "cursor";
491
512
  "claude-code": "claude-code";
513
+ simple: "simple";
492
514
  "openai-codex": "openai-codex";
493
515
  }>>;
494
516
  customEndpoint: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodURL>>;
@@ -561,10 +583,10 @@ declare const ContractsrcSchema: z$1.ZodObject<{
561
583
  include: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
562
584
  prefix: z$1.ZodOptional<z$1.ZodString>;
563
585
  defaultStability: z$1.ZodOptional<z$1.ZodEnum<{
586
+ deprecated: "deprecated";
564
587
  experimental: "experimental";
565
588
  beta: "beta";
566
589
  stable: "stable";
567
- deprecated: "deprecated";
568
590
  }>>;
569
591
  defaultAuth: z$1.ZodOptional<z$1.ZodEnum<{
570
592
  user: "user";
@@ -572,6 +594,12 @@ declare const ContractsrcSchema: z$1.ZodObject<{
572
594
  admin: "admin";
573
595
  }>>;
574
596
  defaultOwners: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
597
+ schemaFormat: z$1.ZodDefault<z$1.ZodEnum<{
598
+ contractspec: "contractspec";
599
+ zod: "zod";
600
+ "json-schema": "json-schema";
601
+ graphql: "graphql";
602
+ }>>;
575
603
  }, z$1.core.$strip>>>;
576
604
  export: z$1.ZodOptional<z$1.ZodObject<{
577
605
  outputPath: z$1.ZodDefault<z$1.ZodString>;
@@ -760,6 +788,12 @@ declare const ContractsrcSchema: z$1.ZodObject<{
760
788
  }>>;
761
789
  }, z$1.core.$strip>>>;
762
790
  }, z$1.core.$strip>>;
791
+ schemaFormat: z$1.ZodDefault<z$1.ZodEnum<{
792
+ contractspec: "contractspec";
793
+ zod: "zod";
794
+ "json-schema": "json-schema";
795
+ graphql: "graphql";
796
+ }>>;
763
797
  }, z$1.core.$strip>;
764
798
  type OpenApiSourceConfig = z$1.infer<typeof OpenApiSourceConfigSchema>;
765
799
  type OpenApiExportConfig = z$1.infer<typeof OpenApiExportConfigSchema>;
@@ -778,9 +812,10 @@ type RuleSeverity = z$1.infer<typeof RuleSeveritySchema>;
778
812
  type SpecKind = z$1.infer<typeof SpecKindSchema>;
779
813
  type LintRules = z$1.infer<typeof LintRulesSchema>;
780
814
  type RulesConfig = z$1.infer<typeof RulesConfigSchema>;
815
+ type SchemaFormat = z$1.infer<typeof SchemaFormatSchema>;
781
816
  /**
782
817
  * Default configuration values.
783
818
  */
784
819
  declare const DEFAULT_CONTRACTSRC: ContractsrcConfig;
785
820
  //#endregion
786
- export { CheckRunConfig, CheckRunConfigSchema, CiConfig, CiConfigSchema, ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, ExternalWorkspace, ExternalWorkspaceSchema, FolderConventions, FolderConventionsSchema, GroupingRule, GroupingRuleSchema, GroupingStrategy, GroupingStrategySchema, ImpactConfig, ImpactConfigSchema, LintRules, LintRulesSchema, MetaRepoConfig, MetaRepoConfigSchema, OpenApiConfig, OpenApiConfigSchema, OpenApiExportConfig, OpenApiExportConfigSchema, OpenApiSourceConfig, OpenApiSourceConfigSchema, PrCommentConfig, PrCommentConfigSchema, RuleSeverity, RuleSeveritySchema, RulesConfig, RulesConfigSchema, SpecKind, SpecKindSchema };
821
+ export { CheckRunConfig, CheckRunConfigSchema, CiConfig, CiConfigSchema, ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, ExternalWorkspace, ExternalWorkspaceSchema, FolderConventions, FolderConventionsSchema, GroupingRule, GroupingRuleSchema, GroupingStrategy, GroupingStrategySchema, ImpactConfig, ImpactConfigSchema, LintRules, LintRulesSchema, MetaRepoConfig, MetaRepoConfigSchema, OpenApiConfig, OpenApiConfigSchema, OpenApiExportConfig, OpenApiExportConfigSchema, OpenApiSourceConfig, OpenApiSourceConfigSchema, PrCommentConfig, PrCommentConfigSchema, RuleSeverity, RuleSeveritySchema, RulesConfig, RulesConfigSchema, SchemaFormat, SchemaFormatSchema, SpecKind, SpecKindSchema };
@@ -8,6 +8,16 @@ import * as z$1 from "zod";
8
8
  * and are shared across CLI tools and libraries.
9
9
  */
10
10
  /**
11
+ * Schema output format for code generation.
12
+ * Controls how imported/generated schemas are written.
13
+ */
14
+ const SchemaFormatSchema = z$1.enum([
15
+ "contractspec",
16
+ "zod",
17
+ "json-schema",
18
+ "graphql"
19
+ ]);
20
+ /**
11
21
  * OpenAPI source configuration for import/sync/validate operations.
12
22
  */
13
23
  const OpenApiSourceConfigSchema = z$1.object({
@@ -34,7 +44,8 @@ const OpenApiSourceConfigSchema = z$1.object({
34
44
  "user",
35
45
  "admin"
36
46
  ]).optional(),
37
- defaultOwners: z$1.array(z$1.string()).optional()
47
+ defaultOwners: z$1.array(z$1.string()).optional(),
48
+ schemaFormat: SchemaFormatSchema.default("contractspec")
38
49
  });
39
50
  const OpenApiExportConfigSchema = z$1.object({
40
51
  outputPath: z$1.string().default("./openapi.json"),
@@ -222,7 +233,8 @@ const ContractsrcSchema = z$1.object({
222
233
  openapi: OpenApiConfigSchema.optional(),
223
234
  ci: CiConfigSchema.optional(),
224
235
  metaRepo: MetaRepoConfigSchema.optional(),
225
- rules: RulesConfigSchema.optional()
236
+ rules: RulesConfigSchema.optional(),
237
+ schemaFormat: SchemaFormatSchema.default("contractspec")
226
238
  });
227
239
  /**
228
240
  * Default configuration values.
@@ -240,8 +252,9 @@ const DEFAULT_CONTRACTSRC = {
240
252
  groupByFeature: true
241
253
  },
242
254
  defaultOwners: [],
243
- defaultTags: []
255
+ defaultTags: [],
256
+ schemaFormat: "contractspec"
244
257
  };
245
258
 
246
259
  //#endregion
247
- export { CheckRunConfigSchema, CiConfigSchema, ContractsrcSchema, DEFAULT_CONTRACTSRC, ExternalWorkspaceSchema, FolderConventionsSchema, GroupingRuleSchema, GroupingStrategySchema, ImpactConfigSchema, LintRulesSchema, MetaRepoConfigSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, PrCommentConfigSchema, RuleSeveritySchema, RulesConfigSchema, SpecKindSchema };
260
+ export { CheckRunConfigSchema, CiConfigSchema, ContractsrcSchema, DEFAULT_CONTRACTSRC, ExternalWorkspaceSchema, FolderConventionsSchema, GroupingRuleSchema, GroupingStrategySchema, ImpactConfigSchema, LintRulesSchema, MetaRepoConfigSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, PrCommentConfigSchema, RuleSeveritySchema, RulesConfigSchema, SchemaFormatSchema, SpecKindSchema };
@@ -1,2 +1,2 @@
1
- import { ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventions, FolderConventionsSchema, OpenApiConfig, OpenApiConfigSchema, OpenApiExportConfig, OpenApiExportConfigSchema, OpenApiSourceConfig, OpenApiSourceConfigSchema } from "./contractsrc-schema.js";
2
- export { type ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, type FolderConventions, FolderConventionsSchema, type OpenApiConfig, OpenApiConfigSchema, type OpenApiExportConfig, OpenApiExportConfigSchema, type OpenApiSourceConfig, OpenApiSourceConfigSchema };
1
+ import { ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventions, FolderConventionsSchema, OpenApiConfig, OpenApiConfigSchema, OpenApiExportConfig, OpenApiExportConfigSchema, OpenApiSourceConfig, OpenApiSourceConfigSchema, SchemaFormat, SchemaFormatSchema } from "./contractsrc-schema.js";
2
+ export { type ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, type FolderConventions, FolderConventionsSchema, type OpenApiConfig, OpenApiConfigSchema, type OpenApiExportConfig, OpenApiExportConfigSchema, type OpenApiSourceConfig, OpenApiSourceConfigSchema, type SchemaFormat, SchemaFormatSchema };
@@ -1,3 +1,3 @@
1
- import { ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventionsSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema } from "./contractsrc-schema.js";
1
+ import { ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventionsSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, SchemaFormatSchema } from "./contractsrc-schema.js";
2
2
 
3
- export { ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventionsSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema };
3
+ export { ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventionsSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, SchemaFormatSchema };
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "@lssm/lib.contracts/docs";
2
+
3
+ //#region src/workspace-config/workspace-config.docblock.d.ts
4
+ declare const tech_workspace_config_DocBlocks: DocBlock[];
5
+ //#endregion
6
+ export { tech_workspace_config_DocBlocks };
@@ -0,0 +1,45 @@
1
+ import { registerDocBlocks } from "../docs/registry.js";
2
+
3
+ //#region src/workspace-config/workspace-config.docblock.ts
4
+ const tech_workspace_config_DocBlocks = [{
5
+ id: "docs.tech.contracts.workspace-config",
6
+ title: "Workspace Configuration (.contractsrc)",
7
+ summary: "Configuration-as-code conventions for ContractSpec workspaces (`.contractsrc.json`).",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/contracts/workspace-config",
11
+ tags: [
12
+ "tech",
13
+ "contracts",
14
+ "config"
15
+ ],
16
+ body: `## Workspace Configuration (.contractsrc)
17
+
18
+ ContractSpec uses a hierarchical configuration system anchored by \`.contractsrc.json\` files. Configuration loader supports standard rc-file discovery (cosmiconfig).
19
+
20
+ ### Schema Formats
21
+
22
+ The \`schemaFormat\` option controls the output format of schema generation commands (like \`contractspec openapi import\`).
23
+
24
+ Supported formats:
25
+ - \`contractspec\` (default): Generates standard \`defineSchemaModel\` code.
26
+ - \`zod\`: Generates raw Zod schemas using \`z.object({...})\`.
27
+ - \`json-schema\`: Generates JSON Schema definitions.
28
+ - \`graphql\`: Generates GraphQL SDL type definitions.
29
+
30
+ ### Config Interface
31
+
32
+ \`\`\`ts
33
+ export interface ContractsrcConfig {
34
+ // ... existing fields ...
35
+ schemaFormat?: 'contractspec' | 'zod' | 'json-schema' | 'graphql';
36
+ }
37
+ \`\`\`
38
+
39
+ Defined in \`@lssm/lib.contracts/workspace-config\`.
40
+ `
41
+ }];
42
+ registerDocBlocks(tech_workspace_config_DocBlocks);
43
+
44
+ //#endregion
45
+ export { tech_workspace_config_DocBlocks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.contracts",
3
- "version": "1.42.9",
3
+ "version": "1.43.0",
4
4
  "scripts": {
5
5
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
6
6
  "publish:pkg:canary": "bun publish:pkg --tag canary",
@@ -16,8 +16,8 @@
16
16
  "test": "bun run"
17
17
  },
18
18
  "devDependencies": {
19
- "@lssm/tool.tsdown": "1.42.9",
20
- "@lssm/tool.typescript": "1.42.9",
19
+ "@lssm/tool.tsdown": "1.43.0",
20
+ "@lssm/tool.typescript": "1.43.0",
21
21
  "@types/express": "^5.0.3",
22
22
  "@types/turndown": "^5.0.6",
23
23
  "tsdown": "^0.18.3",
@@ -35,8 +35,8 @@
35
35
  "@elevenlabs/elevenlabs-js": "^2.27.0",
36
36
  "@google-cloud/secret-manager": "^6.1.1",
37
37
  "@google-cloud/storage": "^7.18.0",
38
- "@lssm/lib.logger": "1.42.9",
39
- "@lssm/lib.schema": "1.42.9",
38
+ "@lssm/lib.logger": "1.43.0",
39
+ "@lssm/lib.schema": "1.43.0",
40
40
  "@mistralai/mistralai": "^1.11.0",
41
41
  "@modelcontextprotocol/sdk": "^1.24.3",
42
42
  "@qdrant/js-client-rest": "^1.16.2",
@@ -112,6 +112,7 @@
112
112
  "./docs/tech/contracts/graphql-typed-outputs.docblock": "./dist/docs/tech/contracts/graphql-typed-outputs.docblock.js",
113
113
  "./docs/tech/contracts/migrations.docblock": "./dist/docs/tech/contracts/migrations.docblock.js",
114
114
  "./docs/tech/contracts/openapi-export.docblock": "./dist/docs/tech/contracts/openapi-export.docblock.js",
115
+ "./docs/tech/contracts/openapi-import.docblock": "./dist/docs/tech/contracts/openapi-import.docblock.js",
115
116
  "./docs/tech/contracts/ops-to-presentation-linking.docblock": "./dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js",
116
117
  "./docs/tech/contracts/overlays.docblock": "./dist/docs/tech/contracts/overlays.docblock.js",
117
118
  "./docs/tech/contracts/README.docblock": "./dist/docs/tech/contracts/README.docblock.js",
@@ -135,7 +136,6 @@
135
136
  "./docs/tech/telemetry-ingest.docblock": "./dist/docs/tech/telemetry-ingest.docblock.js",
136
137
  "./docs/tech/templates/runtime.docblock": "./dist/docs/tech/templates/runtime.docblock.js",
137
138
  "./docs/tech/vscode-extension.docblock": "./dist/docs/tech/vscode-extension.docblock.js",
138
- "./docs/tech/workflows/overview.docblock": "./dist/docs/tech/workflows/overview.docblock.js",
139
139
  "./docs/types": "./dist/docs/types.js",
140
140
  "./events": "./dist/events.js",
141
141
  "./experiments/docs/experiments.docblock": "./dist/experiments/docs/experiments.docblock.js",
@@ -317,6 +317,7 @@
317
317
  "./workflow/adapters/file-adapter": "./dist/workflow/adapters/file-adapter.js",
318
318
  "./workflow/adapters/memory-store": "./dist/workflow/adapters/memory-store.js",
319
319
  "./workflow/expression": "./dist/workflow/expression.js",
320
+ "./workflow/overview.docblock": "./dist/workflow/overview.docblock.js",
320
321
  "./workflow/runner": "./dist/workflow/runner.js",
321
322
  "./workflow/sla-monitor": "./dist/workflow/sla-monitor.js",
322
323
  "./workflow/spec": "./dist/workflow/spec.js",
@@ -324,6 +325,7 @@
324
325
  "./workflow/validation": "./dist/workflow/validation.js",
325
326
  "./workspace-config": "./dist/workspace-config/index.js",
326
327
  "./workspace-config/contractsrc-schema": "./dist/workspace-config/contractsrc-schema.js",
328
+ "./workspace-config/workspace-config.docblock": "./dist/workspace-config/workspace-config.docblock.js",
327
329
  "./*": "./*"
328
330
  },
329
331
  "publishConfig": {
@@ -584,5 +586,6 @@
584
586
  "type": "git",
585
587
  "url": "https://github.com/lssm-tech/contractspec.git",
586
588
  "directory": "packages/libs/contracts"
587
- }
589
+ },
590
+ "homepage": "https://contractspec.io"
588
591
  }