micro-contracts 0.16.3 → 0.17.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 (183) hide show
  1. package/cli-contract.yaml +0 -32
  2. package/dist/micro-contracts.bundle.mjs +4682 -0
  3. package/dist/micro-contracts.bundle.mjs.map +7 -0
  4. package/docs/cli-reference.md +0 -28
  5. package/package.json +20 -23
  6. package/dist/agents/context-builder.d.ts +0 -5
  7. package/dist/agents/context-builder.d.ts.map +0 -1
  8. package/dist/agents/context-builder.js +0 -239
  9. package/dist/agents/context-builder.js.map +0 -1
  10. package/dist/agents/formatter.d.ts +0 -9
  11. package/dist/agents/formatter.d.ts.map +0 -1
  12. package/dist/agents/formatter.js +0 -124
  13. package/dist/agents/formatter.js.map +0 -1
  14. package/dist/agents/index.d.ts +0 -5
  15. package/dist/agents/index.d.ts.map +0 -1
  16. package/dist/agents/index.js +0 -3
  17. package/dist/agents/index.js.map +0 -1
  18. package/dist/agents/orchestrator.d.ts +0 -5
  19. package/dist/agents/orchestrator.d.ts.map +0 -1
  20. package/dist/agents/orchestrator.js +0 -105
  21. package/dist/agents/orchestrator.js.map +0 -1
  22. package/dist/agents/types.d.ts +0 -21
  23. package/dist/agents/types.d.ts.map +0 -1
  24. package/dist/agents/types.js +0 -2
  25. package/dist/agents/types.js.map +0 -1
  26. package/dist/cli/templates.d.ts +0 -22
  27. package/dist/cli/templates.d.ts.map +0 -1
  28. package/dist/cli/templates.js +0 -445
  29. package/dist/cli/templates.js.map +0 -1
  30. package/dist/cli.d.ts +0 -3
  31. package/dist/cli.d.ts.map +0 -1
  32. package/dist/cli.js +0 -1142
  33. package/dist/cli.js.map +0 -1
  34. package/dist/commands/audit-guardrails.d.ts +0 -13
  35. package/dist/commands/audit-guardrails.d.ts.map +0 -1
  36. package/dist/commands/audit-guardrails.js +0 -32
  37. package/dist/commands/audit-guardrails.js.map +0 -1
  38. package/dist/commands/audit-openapi.d.ts +0 -13
  39. package/dist/commands/audit-openapi.d.ts.map +0 -1
  40. package/dist/commands/audit-openapi.js +0 -32
  41. package/dist/commands/audit-openapi.js.map +0 -1
  42. package/dist/commands/propose-overlays.d.ts +0 -13
  43. package/dist/commands/propose-overlays.d.ts.map +0 -1
  44. package/dist/commands/propose-overlays.js +0 -32
  45. package/dist/commands/propose-overlays.js.map +0 -1
  46. package/dist/commands/review-published.d.ts +0 -13
  47. package/dist/commands/review-published.d.ts.map +0 -1
  48. package/dist/commands/review-published.js +0 -32
  49. package/dist/commands/review-published.js.map +0 -1
  50. package/dist/generated/commands.d.ts +0 -2
  51. package/dist/generated/commands.d.ts.map +0 -1
  52. package/dist/generated/commands.js +0 -2
  53. package/dist/generated/commands.js.map +0 -1
  54. package/dist/generated/dsl/agents.d.ts +0 -34
  55. package/dist/generated/dsl/agents.d.ts.map +0 -1
  56. package/dist/generated/dsl/agents.js +0 -98
  57. package/dist/generated/dsl/agents.js.map +0 -1
  58. package/dist/generated/dsl/handoffs.d.ts +0 -457
  59. package/dist/generated/dsl/handoffs.d.ts.map +0 -1
  60. package/dist/generated/dsl/handoffs.js +0 -205
  61. package/dist/generated/dsl/handoffs.js.map +0 -1
  62. package/dist/generated/dsl/index.d.ts +0 -13
  63. package/dist/generated/dsl/index.d.ts.map +0 -1
  64. package/dist/generated/dsl/index.js +0 -10
  65. package/dist/generated/dsl/index.js.map +0 -1
  66. package/dist/generated/dsl/tasks.d.ts +0 -26
  67. package/dist/generated/dsl/tasks.d.ts.map +0 -1
  68. package/dist/generated/dsl/tasks.js +0 -133
  69. package/dist/generated/dsl/tasks.js.map +0 -1
  70. package/dist/generated/dsl/workflows.d.ts +0 -34
  71. package/dist/generated/dsl/workflows.d.ts.map +0 -1
  72. package/dist/generated/dsl/workflows.js +0 -84
  73. package/dist/generated/dsl/workflows.js.map +0 -1
  74. package/dist/generated/index.d.ts +0 -7
  75. package/dist/generated/index.d.ts.map +0 -1
  76. package/dist/generated/index.js +0 -7
  77. package/dist/generated/index.js.map +0 -1
  78. package/dist/generated/policy-runtime.d.ts +0 -114
  79. package/dist/generated/policy-runtime.d.ts.map +0 -1
  80. package/dist/generated/policy-runtime.js +0 -195
  81. package/dist/generated/policy-runtime.js.map +0 -1
  82. package/dist/generated/policy.d.ts +0 -619
  83. package/dist/generated/policy.d.ts.map +0 -1
  84. package/dist/generated/policy.js +0 -802
  85. package/dist/generated/policy.js.map +0 -1
  86. package/dist/generated/program.d.ts +0 -112
  87. package/dist/generated/program.d.ts.map +0 -1
  88. package/dist/generated/program.js +0 -266
  89. package/dist/generated/program.js.map +0 -1
  90. package/dist/generated/schemas.d.ts +0 -778
  91. package/dist/generated/schemas.d.ts.map +0 -1
  92. package/dist/generated/schemas.js +0 -1005
  93. package/dist/generated/schemas.js.map +0 -1
  94. package/dist/generated/types.d.ts +0 -395
  95. package/dist/generated/types.d.ts.map +0 -1
  96. package/dist/generated/types.js +0 -3
  97. package/dist/generated/types.js.map +0 -1
  98. package/dist/generator/dependencyGenerator.d.ts +0 -43
  99. package/dist/generator/dependencyGenerator.d.ts.map +0 -1
  100. package/dist/generator/dependencyGenerator.js +0 -159
  101. package/dist/generator/dependencyGenerator.js.map +0 -1
  102. package/dist/generator/index.d.ts +0 -39
  103. package/dist/generator/index.d.ts.map +0 -1
  104. package/dist/generator/index.js +0 -720
  105. package/dist/generator/index.js.map +0 -1
  106. package/dist/generator/inputHash.d.ts +0 -23
  107. package/dist/generator/inputHash.d.ts.map +0 -1
  108. package/dist/generator/inputHash.js +0 -145
  109. package/dist/generator/inputHash.js.map +0 -1
  110. package/dist/generator/linter.d.ts +0 -26
  111. package/dist/generator/linter.d.ts.map +0 -1
  112. package/dist/generator/linter.js +0 -352
  113. package/dist/generator/linter.js.map +0 -1
  114. package/dist/generator/overlayProcessor.d.ts +0 -90
  115. package/dist/generator/overlayProcessor.d.ts.map +0 -1
  116. package/dist/generator/overlayProcessor.js +0 -541
  117. package/dist/generator/overlayProcessor.js.map +0 -1
  118. package/dist/generator/schemaGenerator.d.ts +0 -10
  119. package/dist/generator/schemaGenerator.d.ts.map +0 -1
  120. package/dist/generator/schemaGenerator.js +0 -299
  121. package/dist/generator/schemaGenerator.js.map +0 -1
  122. package/dist/generator/serviceGenerator.d.ts +0 -41
  123. package/dist/generator/serviceGenerator.d.ts.map +0 -1
  124. package/dist/generator/serviceGenerator.js +0 -296
  125. package/dist/generator/serviceGenerator.js.map +0 -1
  126. package/dist/generator/templateProcessor.d.ts +0 -245
  127. package/dist/generator/templateProcessor.d.ts.map +0 -1
  128. package/dist/generator/templateProcessor.js +0 -821
  129. package/dist/generator/templateProcessor.js.map +0 -1
  130. package/dist/generator/typeGenerator.d.ts +0 -9
  131. package/dist/generator/typeGenerator.d.ts.map +0 -1
  132. package/dist/generator/typeGenerator.js +0 -424
  133. package/dist/generator/typeGenerator.js.map +0 -1
  134. package/dist/generator/typeGenerator.test.d.ts +0 -2
  135. package/dist/generator/typeGenerator.test.d.ts.map +0 -1
  136. package/dist/generator/typeGenerator.test.js +0 -122
  137. package/dist/generator/typeGenerator.test.js.map +0 -1
  138. package/dist/guardrails/allowlist.d.ts +0 -45
  139. package/dist/guardrails/allowlist.d.ts.map +0 -1
  140. package/dist/guardrails/allowlist.js +0 -261
  141. package/dist/guardrails/allowlist.js.map +0 -1
  142. package/dist/guardrails/config.d.ts +0 -40
  143. package/dist/guardrails/config.d.ts.map +0 -1
  144. package/dist/guardrails/config.js +0 -174
  145. package/dist/guardrails/config.js.map +0 -1
  146. package/dist/guardrails/docs.d.ts +0 -24
  147. package/dist/guardrails/docs.d.ts.map +0 -1
  148. package/dist/guardrails/docs.js +0 -138
  149. package/dist/guardrails/docs.js.map +0 -1
  150. package/dist/guardrails/drift.d.ts +0 -23
  151. package/dist/guardrails/drift.d.ts.map +0 -1
  152. package/dist/guardrails/drift.js +0 -127
  153. package/dist/guardrails/drift.js.map +0 -1
  154. package/dist/guardrails/index.d.ts +0 -19
  155. package/dist/guardrails/index.d.ts.map +0 -1
  156. package/dist/guardrails/index.js +0 -23
  157. package/dist/guardrails/index.js.map +0 -1
  158. package/dist/guardrails/lint.d.ts +0 -20
  159. package/dist/guardrails/lint.d.ts.map +0 -1
  160. package/dist/guardrails/lint.js +0 -274
  161. package/dist/guardrails/lint.js.map +0 -1
  162. package/dist/guardrails/manifest.d.ts +0 -63
  163. package/dist/guardrails/manifest.d.ts.map +0 -1
  164. package/dist/guardrails/manifest.js +0 -299
  165. package/dist/guardrails/manifest.js.map +0 -1
  166. package/dist/guardrails/runner.d.ts +0 -43
  167. package/dist/guardrails/runner.d.ts.map +0 -1
  168. package/dist/guardrails/runner.js +0 -365
  169. package/dist/guardrails/runner.js.map +0 -1
  170. package/dist/guardrails/typecheck.d.ts +0 -15
  171. package/dist/guardrails/typecheck.d.ts.map +0 -1
  172. package/dist/guardrails/typecheck.js +0 -104
  173. package/dist/guardrails/typecheck.js.map +0 -1
  174. package/dist/guardrails/types.d.ts +0 -202
  175. package/dist/guardrails/types.d.ts.map +0 -1
  176. package/dist/guardrails/types.js +0 -8
  177. package/dist/guardrails/types.js.map +0 -1
  178. package/dist/index.d.ts.map +0 -1
  179. package/dist/index.js.map +0 -1
  180. package/dist/types.d.ts +0 -583
  181. package/dist/types.d.ts.map +0 -1
  182. package/dist/types.js +0 -305
  183. package/dist/types.js.map +0 -1
@@ -1,10 +0,0 @@
1
- /**
2
- * JSON Schema generator from OpenAPI schemas
3
- * Generates Fastify-compatible JSON Schema objects
4
- */
5
- import type { OpenAPISpec } from '../types.js';
6
- /**
7
- * Generate JSON Schema TypeScript file from OpenAPI spec
8
- */
9
- export declare function generateSchemas(spec: OpenAPISpec): string;
10
- //# sourceMappingURL=schemaGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaGenerator.d.ts","sourceRoot":"","sources":["../../src/generator/schemaGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,aAAa,CAAC;AAsBrB;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA6DzD"}
@@ -1,299 +0,0 @@
1
- /**
2
- * JSON Schema generator from OpenAPI schemas
3
- * Generates Fastify-compatible JSON Schema objects
4
- */
5
- import { isReference, getRefName } from '../types.js';
6
- /**
7
- * Get a valid TypeScript identifier from service and method
8
- * e.g., "User" + "getSchema" -> "User_getSchema"
9
- */
10
- function getOperationTypeBase(operation) {
11
- const service = operation['x-micro-contracts-service'];
12
- const method = operation['x-micro-contracts-method'];
13
- if (service && method) {
14
- return `${service}_${method}`;
15
- }
16
- if (operation.operationId) {
17
- return operation.operationId.replace(/[^a-zA-Z0-9]/g, '_');
18
- }
19
- return 'Unknown';
20
- }
21
- /**
22
- * Generate JSON Schema TypeScript file from OpenAPI spec
23
- */
24
- export function generateSchemas(spec) {
25
- const lines = [];
26
- lines.push('/**');
27
- lines.push(' * Auto-generated JSON Schemas from OpenAPI specification');
28
- lines.push(` * Generated from: ${spec.info.title} v${spec.info.version}`);
29
- lines.push(' * DO NOT EDIT MANUALLY');
30
- lines.push(' */');
31
- lines.push('');
32
- // Generate schemas from components/schemas
33
- if (spec.components?.schemas) {
34
- for (const [name, schema] of Object.entries(spec.components.schemas)) {
35
- lines.push(generateSchemaExport(name, schema, spec));
36
- lines.push('');
37
- }
38
- }
39
- // Generate query/path parameter schemas from paths
40
- const paramSchemas = generateParameterSchemas(spec);
41
- if (paramSchemas) {
42
- lines.push('// Parameter schemas');
43
- lines.push(paramSchemas);
44
- }
45
- // Export all schema names for registration
46
- lines.push('');
47
- lines.push('// All schemas for registration');
48
- lines.push('export const allSchemas = [');
49
- if (spec.components?.schemas) {
50
- for (const name of Object.keys(spec.components.schemas)) {
51
- lines.push(` ${name},`);
52
- }
53
- }
54
- // Add parameter schemas
55
- for (const [, pathItem] of Object.entries(spec.paths)) {
56
- for (const method of ['get', 'post', 'put', 'patch', 'delete']) {
57
- const operation = pathItem[method];
58
- if (!operation)
59
- continue;
60
- const typeBase = getOperationTypeBase(operation);
61
- // Combine query and path params into a single Params schema
62
- const queryParams = (operation.parameters || []).filter((p) => !isReference(p) && p.in === 'query');
63
- const pathParams = (operation.parameters || []).filter((p) => !isReference(p) && p.in === 'path');
64
- const allParams = [...pathParams, ...queryParams];
65
- if (allParams.length > 0) {
66
- lines.push(` ${typeBase}Params,`);
67
- }
68
- }
69
- }
70
- lines.push('] as const;');
71
- return lines.join('\n');
72
- }
73
- /**
74
- * Generate a single schema export
75
- */
76
- function generateSchemaExport(name, schema, spec) {
77
- const jsonSchema = convertToJsonSchema(name, schema, spec);
78
- const schemaStr = JSON.stringify(jsonSchema, null, 2)
79
- .split('\n')
80
- .map((line, i) => i === 0 ? line : ' ' + line)
81
- .join('\n');
82
- return `export const ${name} = ${schemaStr} as const;`;
83
- }
84
- /**
85
- * Convert OpenAPI schema to JSON Schema with $id
86
- */
87
- function convertToJsonSchema(name, schema, spec) {
88
- if (isReference(schema)) {
89
- return { $ref: `${getRefName(schema.$ref)}#` };
90
- }
91
- const result = {
92
- $id: name,
93
- };
94
- // Handle allOf, oneOf, anyOf
95
- if (schema.allOf) {
96
- result.allOf = schema.allOf.map(s => convertSchemaValue(s, spec));
97
- return result;
98
- }
99
- if (schema.oneOf) {
100
- result.oneOf = schema.oneOf.map(s => convertSchemaValue(s, spec));
101
- return result;
102
- }
103
- if (schema.anyOf) {
104
- result.anyOf = schema.anyOf.map(s => convertSchemaValue(s, spec));
105
- return result;
106
- }
107
- // Copy basic properties
108
- if (schema.type)
109
- result.type = schema.type;
110
- if (schema.description)
111
- result.description = schema.description;
112
- if (schema.enum)
113
- result.enum = schema.enum;
114
- if (schema.format)
115
- result.format = schema.format;
116
- if (schema.default !== undefined)
117
- result.default = schema.default;
118
- if (schema.nullable)
119
- result.nullable = schema.nullable;
120
- // Number constraints
121
- if (schema.minimum !== undefined)
122
- result.minimum = schema.minimum;
123
- if (schema.maximum !== undefined)
124
- result.maximum = schema.maximum;
125
- // String constraints
126
- if (schema.minLength !== undefined)
127
- result.minLength = schema.minLength;
128
- if (schema.maxLength !== undefined)
129
- result.maxLength = schema.maxLength;
130
- if (schema.pattern)
131
- result.pattern = schema.pattern;
132
- // Array constraints
133
- if (schema.minItems !== undefined)
134
- result.minItems = schema.minItems;
135
- if (schema.maxItems !== undefined)
136
- result.maxItems = schema.maxItems;
137
- if (schema.items) {
138
- result.items = convertSchemaValue(schema.items, spec);
139
- }
140
- // Object properties
141
- if (schema.properties) {
142
- result.properties = {};
143
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
144
- result.properties[propName] =
145
- convertSchemaValue(propSchema, spec);
146
- }
147
- }
148
- if (schema.required && schema.required.length > 0) {
149
- result.required = schema.required;
150
- }
151
- if (schema.additionalProperties !== undefined) {
152
- if (typeof schema.additionalProperties === 'boolean') {
153
- result.additionalProperties = schema.additionalProperties;
154
- }
155
- else {
156
- result.additionalProperties = convertSchemaValue(schema.additionalProperties, spec);
157
- }
158
- }
159
- return result;
160
- }
161
- /**
162
- * Convert schema value (without $id)
163
- */
164
- function convertSchemaValue(schema, spec) {
165
- if (isReference(schema)) {
166
- return { $ref: `${getRefName(schema.$ref)}#` };
167
- }
168
- const result = {};
169
- // Handle allOf, oneOf, anyOf
170
- if (schema.allOf) {
171
- result.allOf = schema.allOf.map(s => convertSchemaValue(s, spec));
172
- return result;
173
- }
174
- if (schema.oneOf) {
175
- result.oneOf = schema.oneOf.map(s => convertSchemaValue(s, spec));
176
- return result;
177
- }
178
- if (schema.anyOf) {
179
- result.anyOf = schema.anyOf.map(s => convertSchemaValue(s, spec));
180
- return result;
181
- }
182
- // Copy basic properties
183
- if (schema.type)
184
- result.type = schema.type;
185
- if (schema.description)
186
- result.description = schema.description;
187
- if (schema.enum)
188
- result.enum = schema.enum;
189
- if (schema.format)
190
- result.format = schema.format;
191
- if (schema.default !== undefined)
192
- result.default = schema.default;
193
- if (schema.nullable)
194
- result.nullable = schema.nullable;
195
- // Number constraints
196
- if (schema.minimum !== undefined)
197
- result.minimum = schema.minimum;
198
- if (schema.maximum !== undefined)
199
- result.maximum = schema.maximum;
200
- // String constraints
201
- if (schema.minLength !== undefined)
202
- result.minLength = schema.minLength;
203
- if (schema.maxLength !== undefined)
204
- result.maxLength = schema.maxLength;
205
- if (schema.pattern)
206
- result.pattern = schema.pattern;
207
- // Array constraints
208
- if (schema.minItems !== undefined)
209
- result.minItems = schema.minItems;
210
- if (schema.maxItems !== undefined)
211
- result.maxItems = schema.maxItems;
212
- if (schema.items) {
213
- result.items = convertSchemaValue(schema.items, spec);
214
- }
215
- // Object properties
216
- if (schema.properties) {
217
- result.properties = {};
218
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
219
- result.properties[propName] =
220
- convertSchemaValue(propSchema, spec);
221
- }
222
- }
223
- if (schema.required && schema.required.length > 0) {
224
- result.required = schema.required;
225
- }
226
- if (schema.additionalProperties !== undefined) {
227
- if (typeof schema.additionalProperties === 'boolean') {
228
- result.additionalProperties = schema.additionalProperties;
229
- }
230
- else {
231
- result.additionalProperties = convertSchemaValue(schema.additionalProperties, spec);
232
- }
233
- }
234
- return result;
235
- }
236
- /**
237
- * Generate parameter schemas from paths
238
- */
239
- function generateParameterSchemas(spec) {
240
- const lines = [];
241
- const generatedSchemas = new Set();
242
- for (const [, pathItem] of Object.entries(spec.paths)) {
243
- for (const method of ['get', 'post', 'put', 'patch', 'delete']) {
244
- const operation = pathItem[method];
245
- if (!operation)
246
- continue;
247
- const typeBase = getOperationTypeBase(operation);
248
- // Generate combined params schema (path + query params)
249
- const queryParams = (operation.parameters || []).filter((p) => !isReference(p) && p.in === 'query');
250
- const pathParams = (operation.parameters || []).filter((p) => !isReference(p) && p.in === 'path');
251
- const allParams = [...pathParams, ...queryParams];
252
- if (allParams.length > 0) {
253
- const schemaName = `${typeBase}Params`;
254
- if (!generatedSchemas.has(schemaName)) {
255
- generatedSchemas.add(schemaName);
256
- lines.push(generateParamsSchema(schemaName, allParams, spec));
257
- lines.push('');
258
- }
259
- }
260
- }
261
- }
262
- return lines.join('\n');
263
- }
264
- /**
265
- * Generate parameter schema
266
- */
267
- function generateParamsSchema(name, params, spec) {
268
- const schema = {
269
- $id: name,
270
- type: 'object',
271
- properties: {},
272
- required: [],
273
- };
274
- for (const param of params) {
275
- if (param.schema) {
276
- schema.properties[param.name] =
277
- convertSchemaValue(param.schema, spec);
278
- }
279
- else {
280
- schema.properties[param.name] = { type: 'string' };
281
- }
282
- if (param.required) {
283
- schema.required.push(param.name);
284
- }
285
- }
286
- // Remove empty required array
287
- if (schema.required.length === 0) {
288
- delete schema.required;
289
- }
290
- const schemaStr = JSON.stringify(schema, null, 2)
291
- .split('\n')
292
- .map((line, i) => i === 0 ? line : ' ' + line)
293
- .join('\n');
294
- return `export const ${name} = ${schemaStr} as const;`;
295
- }
296
- function capitalize(str) {
297
- return str.charAt(0).toUpperCase() + str.slice(1);
298
- }
299
- //# sourceMappingURL=schemaGenerator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaGenerator.js","sourceRoot":"","sources":["../../src/generator/schemaGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,SAAS,oBAAoB,CAAC,SAA0B;IACtD,MAAM,OAAO,GAAG,SAAS,CAAC,2BAA2B,CAAuB,CAAC;IAC7E,MAAM,MAAM,GAAG,SAAS,CAAC,0BAA0B,CAAuB,CAAC;IAE3E,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;QACtB,OAAO,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAiB;IA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AK,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,UAAsC,CAAC,KAAK,CAAC,IAAI,CAAC;gBACxD,kBAAkB,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACL,MAAM,CAAC,UAAsC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAClF,CAAC;QAED,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,CAAC,QAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,8BAA8B;IAC9B,IAAK,MAAM,CAAC,QAAqB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SAC9C,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,gBAAgB,IAAI,MAAM,SAAS,YAAY,CAAC;AACzD,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -1,41 +0,0 @@
1
- /**
2
- * Service interface generator from OpenAPI specification
3
- *
4
- * Generates TypeScript interfaces grouped by x-micro-contracts-service extension.
5
- * Supports custom Handlebars templates for service interface generation.
6
- */
7
- import type { OpenAPISpec, ParameterObject } from '../types.js';
8
- export interface ServiceGeneratorOptions {
9
- /** Only include public endpoints (x-public: true) */
10
- publicOnly?: boolean;
11
- /** Path to custom Handlebars template for service interface generation */
12
- serviceTemplate?: string;
13
- }
14
- /**
15
- * Context passed to custom service interface templates (per-service)
16
- */
17
- export interface ServiceTemplateContext {
18
- serviceName: string;
19
- interfaceName: string;
20
- methods: ServiceMethodTemplateContext[];
21
- imports: string[];
22
- spec: OpenAPISpec;
23
- }
24
- export interface ServiceMethodTemplateContext {
25
- name: string;
26
- inputType: string;
27
- returnType: string;
28
- returnTypeStr: string;
29
- httpMethod: string;
30
- path: string;
31
- isPublished: boolean;
32
- parameters: ParameterObject[];
33
- requestBodySchema?: string;
34
- extensions: Record<string, unknown>;
35
- }
36
- /**
37
- * Generate service interface files
38
- * Returns a map of service name to generated content
39
- */
40
- export declare function generateServiceInterfaces(spec: OpenAPISpec, options?: ServiceGeneratorOptions): Map<string, string>;
41
- //# sourceMappingURL=serviceGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceGenerator.d.ts","sourceRoot":"","sources":["../../src/generator/serviceGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,WAAW,EAEX,eAAe,EAGhB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE,uBAA4B,GACpC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBrB"}
@@ -1,296 +0,0 @@
1
- /**
2
- * Service interface generator from OpenAPI specification
3
- *
4
- * Generates TypeScript interfaces grouped by x-micro-contracts-service extension.
5
- * Supports custom Handlebars templates for service interface generation.
6
- */
7
- import fs from 'fs';
8
- import Handlebars from 'handlebars';
9
- import { isReference, getRefName } from '../types.js';
10
- /**
11
- * Generate service interface files
12
- * Returns a map of service name to generated content
13
- */
14
- export function generateServiceInterfaces(spec, options = {}) {
15
- const { publicOnly = false, serviceTemplate } = options;
16
- const services = extractServiceInfo(spec, publicOnly);
17
- const result = new Map();
18
- const compiledTemplate = serviceTemplate
19
- ? compileServiceTemplate(serviceTemplate)
20
- : null;
21
- for (const service of services) {
22
- const content = compiledTemplate
23
- ? generateServiceInterfaceFromTemplate(compiledTemplate, service, spec)
24
- : generateServiceInterface(service, spec);
25
- result.set(service.name, content);
26
- }
27
- // Generate index.ts
28
- const indexContent = generateServicesIndex(services);
29
- result.set('index', indexContent);
30
- return result;
31
- }
32
- /**
33
- * Load and compile a custom service template
34
- */
35
- function compileServiceTemplate(templatePath) {
36
- if (!fs.existsSync(templatePath)) {
37
- throw new Error(`Service template not found: ${templatePath}`);
38
- }
39
- const content = fs.readFileSync(templatePath, 'utf-8');
40
- return Handlebars.compile(content, { noEscape: true });
41
- }
42
- /**
43
- * Extract service information from OpenAPI spec
44
- */
45
- function extractServiceInfo(spec, publicOnly) {
46
- const servicesMap = new Map();
47
- for (const [path, pathItem] of Object.entries(spec.paths)) {
48
- for (const method of ['get', 'post', 'put', 'patch', 'delete']) {
49
- const operation = pathItem[method];
50
- if (!operation)
51
- continue;
52
- // Canonical extension names only
53
- const service = operation['x-micro-contracts-service'];
54
- const serviceMethod = operation['x-micro-contracts-method'];
55
- const isPublished = operation['x-micro-contracts-published'] === true;
56
- if (!service || !serviceMethod)
57
- continue;
58
- if (publicOnly && !isPublished)
59
- continue;
60
- const methodInfo = extractMethodInfo(path, method, operation, spec);
61
- if (!methodInfo)
62
- continue;
63
- if (!servicesMap.has(service)) {
64
- servicesMap.set(service, []);
65
- }
66
- servicesMap.get(service).push(methodInfo);
67
- }
68
- }
69
- return Array.from(servicesMap.entries())
70
- .map(([name, methods]) => ({ name, methods }))
71
- .sort((a, b) => a.name.localeCompare(b.name));
72
- }
73
- /**
74
- * Extract method information from operation
75
- */
76
- function extractMethodInfo(path, httpMethod, operation, spec) {
77
- // Canonical extension names only
78
- const serviceName = operation['x-micro-contracts-service'];
79
- const serviceMethod = operation['x-micro-contracts-method'];
80
- if (!serviceMethod)
81
- return null;
82
- const operationId = operation.operationId || serviceMethod;
83
- // Use service + _ + method for type names (clearer separation)
84
- const typeNameBase = serviceName && serviceMethod
85
- ? `${serviceName}_${serviceMethod}`
86
- : operationId.replace(/[^a-zA-Z0-9]/g, '_');
87
- const isPublished = operation['x-micro-contracts-published'] === true;
88
- // Get request body type
89
- let requestType;
90
- if (operation.requestBody) {
91
- const reqBody = isReference(operation.requestBody)
92
- ? spec.components?.requestBodies?.[getRefName(operation.requestBody.$ref)]
93
- : operation.requestBody;
94
- if (reqBody) {
95
- const content = reqBody.content?.['application/json'];
96
- if (content?.schema) {
97
- requestType = isReference(content.schema)
98
- ? getRefName(content.schema.$ref)
99
- : undefined;
100
- }
101
- }
102
- }
103
- // Get response type
104
- let responseType;
105
- const successResponse = operation.responses['200'] || operation.responses['201'];
106
- if (successResponse) {
107
- const resp = isReference(successResponse)
108
- ? spec.components?.responses?.[getRefName(successResponse.$ref)]
109
- : successResponse;
110
- if (resp?.content?.['application/json']?.schema) {
111
- const schema = resp.content['application/json'].schema;
112
- responseType = isReference(schema) ? getRefName(schema.$ref) : undefined;
113
- }
114
- }
115
- // Check for 204 (void response)
116
- if (operation.responses['204'] && !responseType) {
117
- responseType = 'void';
118
- }
119
- // Get all params (path + query combined)
120
- const allParams = (operation.parameters || []).filter((p) => !isReference(p));
121
- const queryParams = allParams.filter(p => p.in === 'query');
122
- const pathParams = allParams.filter(p => p.in === 'path');
123
- const hasParams = queryParams.length > 0 || pathParams.length > 0;
124
- const paramsType = hasParams ? `${typeNameBase}Params` : undefined;
125
- // Request body schema name
126
- let requestBodySchema;
127
- if (operation.requestBody) {
128
- const reqBody = isReference(operation.requestBody)
129
- ? spec.components?.requestBodies?.[getRefName(operation.requestBody.$ref)]
130
- : operation.requestBody;
131
- if (reqBody?.content?.['application/json']?.schema) {
132
- const schema = reqBody.content['application/json'].schema;
133
- requestBodySchema = isReference(schema) ? getRefName(schema.$ref) : undefined;
134
- }
135
- }
136
- // Collect all x-* extensions from the operation
137
- const extensions = {};
138
- for (const [key, value] of Object.entries(operation)) {
139
- if (key.startsWith('x-')) {
140
- extensions[key] = value;
141
- }
142
- }
143
- return {
144
- name: serviceMethod,
145
- operationId,
146
- httpMethod,
147
- path,
148
- isPublished,
149
- requestType,
150
- responseType,
151
- paramsType,
152
- parameters: allParams,
153
- requestBodySchema,
154
- extensions,
155
- };
156
- }
157
- /**
158
- * Generate service interface content
159
- */
160
- function generateServiceInterface(service, spec) {
161
- const lines = [];
162
- lines.push('/**');
163
- lines.push(` * ${service.name} Service API Interface`);
164
- lines.push(' * Auto-generated from OpenAPI specification');
165
- lines.push(' * DO NOT EDIT MANUALLY');
166
- lines.push(' */');
167
- lines.push('');
168
- // Collect all types needed
169
- const types = new Set();
170
- for (const method of service.methods) {
171
- // Always use Input type (even for parameterless operations)
172
- const inputTypeName = `${service.name}_${method.name}Input`;
173
- types.add(inputTypeName);
174
- if (method.responseType && method.responseType !== 'void')
175
- types.add(method.responseType);
176
- }
177
- // Generate imports
178
- if (types.size > 0) {
179
- const typeList = Array.from(types).sort().join(',\n ');
180
- lines.push('import type {');
181
- lines.push(` ${typeList},`);
182
- lines.push("} from '../schemas/types.js';");
183
- lines.push('');
184
- }
185
- // Generate interface
186
- lines.push(`export interface ${service.name}ServiceApi {`);
187
- for (const method of service.methods) {
188
- // JSDoc comment
189
- lines.push(' /**');
190
- lines.push(` * ${method.httpMethod.toUpperCase()} ${method.path}`);
191
- if (!method.isPublished) {
192
- lines.push(' * @internal Not included in public contract');
193
- }
194
- lines.push(' */');
195
- // Method signature with single Input parameter (always present)
196
- const inputTypeName = `${service.name}_${method.name}Input`;
197
- const returnType = method.responseType || 'void';
198
- const returnTypeStr = returnType === 'void' ? 'Promise<void>' : `Promise<${returnType}>`;
199
- lines.push(` ${method.name}(input: ${inputTypeName}): ${returnTypeStr};`);
200
- lines.push('');
201
- }
202
- lines.push('}');
203
- return lines.join('\n');
204
- }
205
- /**
206
- * Generate service interface content using a custom Handlebars template
207
- */
208
- function generateServiceInterfaceFromTemplate(template, service, spec) {
209
- const imports = collectImportsForService(service);
210
- const methods = service.methods.map(method => {
211
- const inputType = `${service.name}_${method.name}Input`;
212
- const returnType = method.responseType || 'void';
213
- const returnTypeStr = returnType === 'void' ? 'Promise<void>' : `Promise<${returnType}>`;
214
- return {
215
- name: method.name,
216
- inputType,
217
- returnType,
218
- returnTypeStr,
219
- httpMethod: method.httpMethod.toUpperCase(),
220
- path: method.path,
221
- isPublished: method.isPublished,
222
- parameters: method.parameters,
223
- requestBodySchema: method.requestBodySchema,
224
- extensions: method.extensions,
225
- };
226
- });
227
- const context = {
228
- serviceName: service.name,
229
- interfaceName: `${service.name}ServiceApi`,
230
- methods,
231
- imports,
232
- spec,
233
- };
234
- return template(context);
235
- }
236
- /**
237
- * Collect import type names needed for a service
238
- */
239
- function collectImportsForService(service) {
240
- const types = new Set();
241
- for (const method of service.methods) {
242
- types.add(`${service.name}_${method.name}Input`);
243
- if (method.responseType && method.responseType !== 'void') {
244
- types.add(method.responseType);
245
- }
246
- }
247
- return Array.from(types).sort();
248
- }
249
- /**
250
- * Generate services index.ts
251
- */
252
- function generateServicesIndex(services) {
253
- const lines = [];
254
- lines.push('/**');
255
- lines.push(' * Service API Interfaces');
256
- lines.push(' * Auto-generated from OpenAPI specification');
257
- lines.push(' * DO NOT EDIT MANUALLY');
258
- lines.push(' */');
259
- lines.push('');
260
- // Import service APIs for use in ServiceRegistry
261
- for (const service of services) {
262
- lines.push(`import type { ${service.name}ServiceApi } from './${service.name}ServiceApi.js';`);
263
- }
264
- lines.push('');
265
- // Re-export individual service APIs
266
- for (const service of services) {
267
- lines.push(`export type { ${service.name}ServiceApi };`);
268
- }
269
- // Generate ServiceRegistry interface for DI Container
270
- lines.push('');
271
- lines.push('/**');
272
- lines.push(' * Service Registry for Dependency Injection');
273
- lines.push(' * Use this interface for DI container type definitions');
274
- lines.push(' */');
275
- lines.push('export interface ServiceRegistry {');
276
- for (const service of services) {
277
- const propertyName = serviceNameToProperty(service.name);
278
- lines.push(` ${propertyName}: ${service.name}ServiceApi;`);
279
- }
280
- lines.push('}');
281
- return lines.join('\n');
282
- }
283
- /**
284
- * Convert service name to property name
285
- * e.g., "Account" -> "account", "ExtensionInstance" -> "extensionInstance"
286
- */
287
- function serviceNameToProperty(serviceName) {
288
- // Remove "Service" suffix if present
289
- const baseName = serviceName.replace(/Service$/, '');
290
- // Convert to camelCase (first letter lowercase)
291
- return baseName.charAt(0).toLowerCase() + baseName.slice(1);
292
- }
293
- function capitalize(str) {
294
- return str.charAt(0).toUpperCase() + str.slice(1);
295
- }
296
- //# sourceMappingURL=serviceGenerator.js.map