@specverse/engines 6.33.1 → 6.35.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.
- package/dist/libs/instance-factories/communication/rabbitmq-events.yaml +11 -0
- package/dist/libs/instance-factories/controllers/fastify.yaml +11 -0
- package/dist/libs/instance-factories/managed/stripe-rest-sdk.yaml +78 -0
- package/dist/libs/instance-factories/managed/templates/stripe/stripe-client-generator.js +8 -0
- package/dist/libs/instance-factories/orms/prisma.yaml +11 -0
- package/dist/libs/instance-factories/services/templates/prisma/behavior-generator.js +4 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +246 -1
- package/dist/realize/index.js.map +1 -1
- package/dist/realize/library/loader.d.ts.map +1 -1
- package/dist/realize/library/loader.js +81 -1
- package/dist/realize/library/loader.js.map +1 -1
- package/dist/realize/per-action-emitter.d.ts +11 -33
- package/dist/realize/per-action-emitter.d.ts.map +1 -1
- package/dist/realize/per-action-emitter.js.map +1 -1
- package/dist/realize/per-action-llm-emit.d.ts.map +1 -1
- package/dist/realize/per-action-llm-emit.js +5 -1
- package/dist/realize/per-action-llm-emit.js.map +1 -1
- package/dist/realize/per-action-runner.d.ts +45 -0
- package/dist/realize/per-action-runner.d.ts.map +1 -1
- package/dist/realize/per-action-runner.js +132 -0
- package/dist/realize/per-action-runner.js.map +1 -1
- package/dist/realize/resolver/index.d.ts +157 -0
- package/dist/realize/resolver/index.d.ts.map +1 -0
- package/dist/realize/resolver/index.js +307 -0
- package/dist/realize/resolver/index.js.map +1 -0
- package/dist/realize/runtime-emitters/dispatcher.d.ts +176 -0
- package/dist/realize/runtime-emitters/dispatcher.d.ts.map +1 -0
- package/dist/realize/runtime-emitters/dispatcher.js +76 -0
- package/dist/realize/runtime-emitters/dispatcher.js.map +1 -0
- package/dist/realize/runtime-emitters/executable.d.ts +57 -0
- package/dist/realize/runtime-emitters/executable.d.ts.map +1 -0
- package/dist/realize/runtime-emitters/executable.js +316 -0
- package/dist/realize/runtime-emitters/executable.js.map +1 -0
- package/dist/realize/runtime-emitters/library.d.ts +52 -0
- package/dist/realize/runtime-emitters/library.d.ts.map +1 -0
- package/dist/realize/runtime-emitters/library.js +349 -0
- package/dist/realize/runtime-emitters/library.js.map +1 -0
- package/dist/realize/runtime-emitters/managed.d.ts +44 -0
- package/dist/realize/runtime-emitters/managed.d.ts.map +1 -0
- package/dist/realize/runtime-emitters/managed.js +283 -0
- package/dist/realize/runtime-emitters/managed.js.map +1 -0
- package/dist/realize/runtime-emitters/messaging.d.ts +77 -0
- package/dist/realize/runtime-emitters/messaging.d.ts.map +1 -0
- package/dist/realize/runtime-emitters/messaging.js +423 -0
- package/dist/realize/runtime-emitters/messaging.js.map +1 -0
- package/dist/realize/runtime-emitters/service.d.ts +42 -0
- package/dist/realize/runtime-emitters/service.d.ts.map +1 -0
- package/dist/realize/runtime-emitters/service.js +355 -0
- package/dist/realize/runtime-emitters/service.js.map +1 -0
- package/dist/realize/types/instance-factory.d.ts +1 -1
- package/dist/realize/types/instance-factory.d.ts.map +1 -1
- package/libs/instance-factories/communication/rabbitmq-events.yaml +11 -0
- package/libs/instance-factories/controllers/fastify.yaml +11 -0
- package/libs/instance-factories/managed/stripe-rest-sdk.yaml +78 -0
- package/libs/instance-factories/managed/templates/stripe/stripe-client-generator.ts +26 -0
- package/libs/instance-factories/orms/prisma.yaml +11 -0
- package/libs/instance-factories/services/templates/_shared/step-matching.ts +11 -29
- package/libs/instance-factories/services/templates/prisma/__tests__/behavior-generator.test.ts +85 -0
- package/libs/instance-factories/services/templates/prisma/behavior-generator.ts +21 -1
- package/package.json +2 -2
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service-runtime emitter — V2 Phase 3, Round 2.
|
|
3
|
+
*
|
|
4
|
+
* Handles `topology: 'service'` factories: providers that ship as
|
|
5
|
+
* network-attached services we deploy ourselves (REST / gRPC / MCP).
|
|
6
|
+
*
|
|
7
|
+
* For each `import:` entry the consumer declares, this emitter produces:
|
|
8
|
+
* clients/<provider-name>.ts — typed network client
|
|
9
|
+
* servers/<provider-name>-server.ts (cond.) — Fastify route scaffold
|
|
10
|
+
*
|
|
11
|
+
* The server-bind file is emitted only when `factory.v2metadata?.serverTemplate`
|
|
12
|
+
* is non-null and non-empty. Managed/external providers (we don't host them)
|
|
13
|
+
* leave it null; we-host providers populate it.
|
|
14
|
+
*
|
|
15
|
+
* Protocol dispatch (factory.v2metadata?.protocol):
|
|
16
|
+
* 'rest' (default) → fetch-based HTTP client; one POST per dotted op
|
|
17
|
+
* 'grpc' → gRPC stub init (Round 2: TODO scaffolding)
|
|
18
|
+
* 'mcp' → MCP client init (Round 2: TODO scaffolding)
|
|
19
|
+
*
|
|
20
|
+
* Endpoint env-var resolution:
|
|
21
|
+
* 1. factory.v2metadata?.config?.endpoint?.env if present
|
|
22
|
+
* 2. Convention <UPPERCASE_PROVIDER>_API_URL otherwise
|
|
23
|
+
*
|
|
24
|
+
* Deployment hint: realize emits a `deployments.<env>.instances.services.<provider>`
|
|
25
|
+
* entry with `config: { endpoint: { env: <ENV_NAME> } }` — mentioned in result.notes
|
|
26
|
+
* for the consumer's review. The actual instance emission is upstream of this
|
|
27
|
+
* emitter; here we just declare the convention.
|
|
28
|
+
*/
|
|
29
|
+
// ─── Naming helpers (shared shape with library.ts; intentionally duplicated
|
|
30
|
+
// rather than extracted to keep each emitter file self-contained for review) ─
|
|
31
|
+
function parseSelectEntry(entry) {
|
|
32
|
+
const dotIndex = entry.indexOf('.');
|
|
33
|
+
if (dotIndex === -1)
|
|
34
|
+
return { head: entry, tail: undefined };
|
|
35
|
+
return { head: entry.slice(0, dotIndex), tail: entry.slice(dotIndex + 1) };
|
|
36
|
+
}
|
|
37
|
+
function toWords(fromName) {
|
|
38
|
+
const normalised = fromName.replace(/^@/, '').replace(/\//g, '-');
|
|
39
|
+
return normalised
|
|
40
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
41
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
|
42
|
+
.trim()
|
|
43
|
+
.split(' ')
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.map((w) => w.toLowerCase());
|
|
46
|
+
}
|
|
47
|
+
function toClientName(fromName) {
|
|
48
|
+
const words = toWords(fromName);
|
|
49
|
+
if (words.length === 0)
|
|
50
|
+
return 'unknownClient';
|
|
51
|
+
return (words[0] +
|
|
52
|
+
words.slice(1).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(''));
|
|
53
|
+
}
|
|
54
|
+
function toInterfaceName(fromName) {
|
|
55
|
+
return toWords(fromName)
|
|
56
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
57
|
+
.join('');
|
|
58
|
+
}
|
|
59
|
+
function toFileName(fromName) {
|
|
60
|
+
return toWords(fromName).join('-');
|
|
61
|
+
}
|
|
62
|
+
function toEnvVarName(fromName, suffix = '_API_URL') {
|
|
63
|
+
return toWords(fromName).join('_').toUpperCase() + suffix;
|
|
64
|
+
}
|
|
65
|
+
function resolveProtocol(ctx) {
|
|
66
|
+
const p = ctx.factory.v2metadata?.protocol;
|
|
67
|
+
if (p === 'grpc' || p === 'mcp')
|
|
68
|
+
return p;
|
|
69
|
+
return 'rest';
|
|
70
|
+
}
|
|
71
|
+
function resolveEndpointEnv(ctx) {
|
|
72
|
+
const config = ctx.factory.v2metadata?.config;
|
|
73
|
+
return config?.endpoint?.env ?? toEnvVarName(ctx.importEntry.from, '_API_URL');
|
|
74
|
+
}
|
|
75
|
+
function resolveServerTemplate(ctx) {
|
|
76
|
+
return ctx.factory.v2metadata?.serverTemplate;
|
|
77
|
+
}
|
|
78
|
+
function shouldEmitServerBind(ctx) {
|
|
79
|
+
const t = resolveServerTemplate(ctx);
|
|
80
|
+
return typeof t === 'string' && t.length > 0;
|
|
81
|
+
}
|
|
82
|
+
// ─── REST client generator ────────────────────────────────────────────────────
|
|
83
|
+
function generateRestClient(ctx, clientName, interfaceName) {
|
|
84
|
+
const { importEntry } = ctx;
|
|
85
|
+
const selectEntries = importEntry.select ?? [];
|
|
86
|
+
const envVar = resolveEndpointEnv(ctx);
|
|
87
|
+
const lines = [];
|
|
88
|
+
lines.push('// FACTORY-EMITTED — DO NOT EDIT (R8)');
|
|
89
|
+
lines.push(`// Generated by service-runtime emitter — V2 Phase 3`);
|
|
90
|
+
lines.push(`// Provider: ${importEntry.from} (protocol: rest)`);
|
|
91
|
+
lines.push(`// Endpoint: process.env.${envVar} (required at runtime)`);
|
|
92
|
+
lines.push('');
|
|
93
|
+
// Interface
|
|
94
|
+
lines.push(`export type ${interfaceName}Client = {`);
|
|
95
|
+
const seenIface = new Set();
|
|
96
|
+
for (const entry of selectEntries) {
|
|
97
|
+
if (seenIface.has(entry))
|
|
98
|
+
continue;
|
|
99
|
+
seenIface.add(entry);
|
|
100
|
+
const { head, tail } = parseSelectEntry(entry);
|
|
101
|
+
if (tail === undefined) {
|
|
102
|
+
lines.push(` /** ${head} entity — passthrough HTTP slot. Round 3: substitute real type. */`);
|
|
103
|
+
lines.push(` ${head}(...args: unknown[]): Promise<unknown>;`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
lines.push(` /** ${head}.${tail} — POST /${head.toLowerCase()}/${tail}. Round 3: substitute real input/output types. */`);
|
|
107
|
+
lines.push(` ${tail}(input: unknown): Promise<unknown>;`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
lines.push('};');
|
|
111
|
+
lines.push('');
|
|
112
|
+
// Endpoint resolution helper
|
|
113
|
+
lines.push(`function resolveBaseUrl(): string {`);
|
|
114
|
+
lines.push(` const url = process.env.${envVar};`);
|
|
115
|
+
lines.push(` if (!url) throw new Error('${envVar} env var is not set; required for ${importEntry.from} client');`);
|
|
116
|
+
lines.push(` return url.replace(/\\/+$/, '');`);
|
|
117
|
+
lines.push(`}`);
|
|
118
|
+
lines.push('');
|
|
119
|
+
// POST helper
|
|
120
|
+
lines.push(`async function postJson(path: string, body: unknown): Promise<unknown> {`);
|
|
121
|
+
lines.push(` const baseUrl = resolveBaseUrl();`);
|
|
122
|
+
lines.push(` const r = await fetch(\`\${baseUrl}\${path}\`, {`);
|
|
123
|
+
lines.push(` method: 'POST',`);
|
|
124
|
+
lines.push(` headers: { 'Content-Type': 'application/json' },`);
|
|
125
|
+
lines.push(` body: JSON.stringify(body),`);
|
|
126
|
+
lines.push(` });`);
|
|
127
|
+
lines.push(` if (!r.ok) {`);
|
|
128
|
+
lines.push(` const errText = await r.text().catch(() => '<no body>');`);
|
|
129
|
+
lines.push(` throw new Error(\`\${path} failed: \${r.status} \${r.statusText} — \${errText}\`);`);
|
|
130
|
+
lines.push(` }`);
|
|
131
|
+
lines.push(` return r.json();`);
|
|
132
|
+
lines.push(`}`);
|
|
133
|
+
lines.push('');
|
|
134
|
+
// Constant
|
|
135
|
+
lines.push(`export const ${clientName}Client: ${interfaceName}Client = {`);
|
|
136
|
+
const seenConst = new Set();
|
|
137
|
+
for (const entry of selectEntries) {
|
|
138
|
+
if (seenConst.has(entry))
|
|
139
|
+
continue;
|
|
140
|
+
seenConst.add(entry);
|
|
141
|
+
const { head, tail } = parseSelectEntry(entry);
|
|
142
|
+
if (tail === undefined) {
|
|
143
|
+
lines.push(` ${head}(...args: unknown[]): Promise<unknown> {`);
|
|
144
|
+
lines.push(` return postJson('/${head.toLowerCase()}', args);`);
|
|
145
|
+
lines.push(` },`);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
lines.push(` ${tail}(input: unknown): Promise<unknown> {`);
|
|
149
|
+
lines.push(` return postJson('/${head.toLowerCase()}/${tail}', input);`);
|
|
150
|
+
lines.push(` },`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
lines.push('};');
|
|
154
|
+
lines.push('');
|
|
155
|
+
return lines.join('\n');
|
|
156
|
+
}
|
|
157
|
+
// ─── gRPC client generator (Round 2 stub) ─────────────────────────────────────
|
|
158
|
+
function generateGrpcClient(ctx, clientName, interfaceName) {
|
|
159
|
+
const { importEntry } = ctx;
|
|
160
|
+
const selectEntries = importEntry.select ?? [];
|
|
161
|
+
const lines = [];
|
|
162
|
+
lines.push('// FACTORY-EMITTED — DO NOT EDIT (R8)');
|
|
163
|
+
lines.push(`// Generated by service-runtime emitter — V2 Phase 3`);
|
|
164
|
+
lines.push(`// Provider: ${importEntry.from} (protocol: grpc)`);
|
|
165
|
+
lines.push(`// TODO (Round 3): wire actual gRPC stub from .proto descriptor.`);
|
|
166
|
+
lines.push(`// Until then methods throw at call-time. Interface compiles cleanly.`);
|
|
167
|
+
lines.push('');
|
|
168
|
+
lines.push(`export type ${interfaceName}Client = {`);
|
|
169
|
+
const seen = new Set();
|
|
170
|
+
for (const entry of selectEntries) {
|
|
171
|
+
if (seen.has(entry))
|
|
172
|
+
continue;
|
|
173
|
+
seen.add(entry);
|
|
174
|
+
const { tail } = parseSelectEntry(entry);
|
|
175
|
+
if (tail === undefined) {
|
|
176
|
+
lines.push(` ${entry}(...args: unknown[]): Promise<unknown>;`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
lines.push(` ${tail}(...args: unknown[]): Promise<unknown>;`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
lines.push('};');
|
|
183
|
+
lines.push('');
|
|
184
|
+
lines.push(`export const ${clientName}Client: ${interfaceName}Client = {`);
|
|
185
|
+
const seen2 = new Set();
|
|
186
|
+
for (const entry of selectEntries) {
|
|
187
|
+
if (seen2.has(entry))
|
|
188
|
+
continue;
|
|
189
|
+
seen2.add(entry);
|
|
190
|
+
const { tail } = parseSelectEntry(entry);
|
|
191
|
+
const methodName = tail ?? entry;
|
|
192
|
+
lines.push(` ${methodName}(..._args: unknown[]): Promise<unknown> {`);
|
|
193
|
+
lines.push(` throw new Error('gRPC stub for ${importEntry.from}.${methodName}: proto wiring is Round 3 TODO');`);
|
|
194
|
+
lines.push(` },`);
|
|
195
|
+
}
|
|
196
|
+
lines.push('};');
|
|
197
|
+
lines.push('');
|
|
198
|
+
return lines.join('\n');
|
|
199
|
+
}
|
|
200
|
+
// ─── MCP client generator (Round 2 stub) ──────────────────────────────────────
|
|
201
|
+
function generateMcpClient(ctx, clientName, interfaceName) {
|
|
202
|
+
const { importEntry } = ctx;
|
|
203
|
+
const selectEntries = importEntry.select ?? [];
|
|
204
|
+
const lines = [];
|
|
205
|
+
lines.push('// FACTORY-EMITTED — DO NOT EDIT (R8)');
|
|
206
|
+
lines.push(`// Generated by service-runtime emitter — V2 Phase 3`);
|
|
207
|
+
lines.push(`// Provider: ${importEntry.from} (protocol: mcp)`);
|
|
208
|
+
lines.push(`// TODO (Round 3): wire @modelcontextprotocol/sdk client + stdio transport.`);
|
|
209
|
+
lines.push(`// Until then methods throw at call-time. Interface compiles cleanly.`);
|
|
210
|
+
lines.push('');
|
|
211
|
+
lines.push(`export type ${interfaceName}Client = {`);
|
|
212
|
+
const seen = new Set();
|
|
213
|
+
for (const entry of selectEntries) {
|
|
214
|
+
if (seen.has(entry))
|
|
215
|
+
continue;
|
|
216
|
+
seen.add(entry);
|
|
217
|
+
const { tail } = parseSelectEntry(entry);
|
|
218
|
+
if (tail === undefined) {
|
|
219
|
+
lines.push(` ${entry}(...args: unknown[]): Promise<unknown>;`);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
lines.push(` ${tail}(...args: unknown[]): Promise<unknown>;`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
lines.push('};');
|
|
226
|
+
lines.push('');
|
|
227
|
+
lines.push(`export const ${clientName}Client: ${interfaceName}Client = {`);
|
|
228
|
+
const seen2 = new Set();
|
|
229
|
+
for (const entry of selectEntries) {
|
|
230
|
+
if (seen2.has(entry))
|
|
231
|
+
continue;
|
|
232
|
+
seen2.add(entry);
|
|
233
|
+
const { tail } = parseSelectEntry(entry);
|
|
234
|
+
const methodName = tail ?? entry;
|
|
235
|
+
lines.push(` ${methodName}(..._args: unknown[]): Promise<unknown> {`);
|
|
236
|
+
lines.push(` throw new Error('MCP stub for ${importEntry.from}.${methodName}: SDK wiring is Round 3 TODO');`);
|
|
237
|
+
lines.push(` },`);
|
|
238
|
+
}
|
|
239
|
+
lines.push('};');
|
|
240
|
+
lines.push('');
|
|
241
|
+
return lines.join('\n');
|
|
242
|
+
}
|
|
243
|
+
// ─── Server-bind generator (Fastify route scaffold) ───────────────────────────
|
|
244
|
+
function generateServerBind(ctx, interfaceName) {
|
|
245
|
+
const { importEntry } = ctx;
|
|
246
|
+
const selectEntries = importEntry.select ?? [];
|
|
247
|
+
const lines = [];
|
|
248
|
+
lines.push('// FACTORY-EMITTED — DO NOT EDIT (R8)');
|
|
249
|
+
lines.push(`// Server-bind scaffold for ${importEntry.from} — V2 Phase 3`);
|
|
250
|
+
lines.push(`// One Fastify route per dotted op. Route bodies throw a clear error;`);
|
|
251
|
+
lines.push(`// Round 3 wires the actual spec operations into each handler.`);
|
|
252
|
+
lines.push('');
|
|
253
|
+
lines.push(`import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';`);
|
|
254
|
+
lines.push('');
|
|
255
|
+
lines.push(`export function register${interfaceName}Routes(fastify: FastifyInstance): void {`);
|
|
256
|
+
const seen = new Set();
|
|
257
|
+
for (const entry of selectEntries) {
|
|
258
|
+
if (seen.has(entry))
|
|
259
|
+
continue;
|
|
260
|
+
seen.add(entry);
|
|
261
|
+
const { head, tail } = parseSelectEntry(entry);
|
|
262
|
+
const path = tail ? `/${head.toLowerCase()}/${tail}` : `/${head.toLowerCase()}`;
|
|
263
|
+
lines.push(` fastify.post('${path}', async (req: FastifyRequest, _reply: FastifyReply) => {`);
|
|
264
|
+
lines.push(` // TODO (Round 3): wire spec operation '${entry}' into this handler.`);
|
|
265
|
+
lines.push(` throw new Error('handler not implemented — Round 3 wires the spec operation in: ${entry}');`);
|
|
266
|
+
lines.push(` });`);
|
|
267
|
+
}
|
|
268
|
+
lines.push(`}`);
|
|
269
|
+
lines.push('');
|
|
270
|
+
return lines.join('\n');
|
|
271
|
+
}
|
|
272
|
+
// ─── Service emitter ──────────────────────────────────────────────────────────
|
|
273
|
+
/**
|
|
274
|
+
* Service-runtime emitter implementation.
|
|
275
|
+
*
|
|
276
|
+
* One call to `emit()` processes a single `import:` entry. Produces:
|
|
277
|
+
* - 1 client file under `clients/<provider-filename>.ts`
|
|
278
|
+
* - 1 server-bind file under `servers/<provider-filename>-server.ts` (only
|
|
279
|
+
* when factory.v2metadata.serverTemplate is non-null)
|
|
280
|
+
*/
|
|
281
|
+
export class ServiceRuntimeEmitter {
|
|
282
|
+
topology = 'service';
|
|
283
|
+
async emit(ctx) {
|
|
284
|
+
const { importEntry, factory } = ctx;
|
|
285
|
+
const selectEntries = importEntry.select ?? [];
|
|
286
|
+
const fileName = toFileName(importEntry.from);
|
|
287
|
+
const clientName = toClientName(importEntry.from);
|
|
288
|
+
const interfaceName = toInterfaceName(importEntry.from);
|
|
289
|
+
const protocol = resolveProtocol(ctx);
|
|
290
|
+
const envVar = resolveEndpointEnv(ctx);
|
|
291
|
+
// Generate client content based on protocol.
|
|
292
|
+
let clientContent;
|
|
293
|
+
if (protocol === 'grpc') {
|
|
294
|
+
clientContent = generateGrpcClient(ctx, clientName, interfaceName);
|
|
295
|
+
}
|
|
296
|
+
else if (protocol === 'mcp') {
|
|
297
|
+
clientContent = generateMcpClient(ctx, clientName, interfaceName);
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
clientContent = generateRestClient(ctx, clientName, interfaceName);
|
|
301
|
+
}
|
|
302
|
+
const files = [
|
|
303
|
+
{ path: `clients/${fileName}.ts`, content: clientContent },
|
|
304
|
+
];
|
|
305
|
+
// Conditional server-bind file.
|
|
306
|
+
if (shouldEmitServerBind(ctx)) {
|
|
307
|
+
const serverContent = generateServerBind(ctx, interfaceName);
|
|
308
|
+
files.push({ path: `servers/${fileName}-server.ts`, content: serverContent });
|
|
309
|
+
}
|
|
310
|
+
// Consumer-side import entry.
|
|
311
|
+
const consumerImport = {
|
|
312
|
+
from: `./clients/${fileName}`,
|
|
313
|
+
specifier: `${clientName}Client`,
|
|
314
|
+
};
|
|
315
|
+
const notes = [
|
|
316
|
+
`Deployment hint: deployments.<env>.instances.services.${clientName} with config: { endpoint: { env: '${envVar}' } } (factory: ${factory.name}, protocol: ${protocol}).`,
|
|
317
|
+
];
|
|
318
|
+
if (selectEntries.length === 0) {
|
|
319
|
+
notes.push(`Warning: import entry from '${importEntry.from}' has empty select: — no client members emitted.`);
|
|
320
|
+
}
|
|
321
|
+
if (protocol === 'grpc') {
|
|
322
|
+
notes.push(`TODO (Round 3): gRPC stub for ${importEntry.from} — proto wiring deferred. Methods throw at call-time.`);
|
|
323
|
+
}
|
|
324
|
+
else if (protocol === 'mcp') {
|
|
325
|
+
notes.push(`TODO (Round 3): MCP client for ${importEntry.from} — @modelcontextprotocol/sdk wiring deferred. Methods throw at call-time.`);
|
|
326
|
+
}
|
|
327
|
+
const reviewNotes = [];
|
|
328
|
+
if (protocol === 'grpc') {
|
|
329
|
+
reviewNotes.push(`gRPC stub for ${importEntry.from} — proto wiring deferred; methods throw at call-time.`);
|
|
330
|
+
}
|
|
331
|
+
else if (protocol === 'mcp') {
|
|
332
|
+
reviewNotes.push(`MCP client for ${importEntry.from} — @modelcontextprotocol/sdk wiring deferred; methods throw at call-time.`);
|
|
333
|
+
}
|
|
334
|
+
const deploymentSuggestion = {
|
|
335
|
+
provider: importEntry.from,
|
|
336
|
+
consumerComponent: ctx.consumerComponent?.name,
|
|
337
|
+
category: 'services',
|
|
338
|
+
key: clientName,
|
|
339
|
+
config: {
|
|
340
|
+
endpoint: { env: envVar },
|
|
341
|
+
protocol,
|
|
342
|
+
},
|
|
343
|
+
factory: factory.name,
|
|
344
|
+
topology: 'service',
|
|
345
|
+
...(reviewNotes.length > 0 ? { reviewNotes } : {}),
|
|
346
|
+
};
|
|
347
|
+
return {
|
|
348
|
+
files,
|
|
349
|
+
imports: [consumerImport],
|
|
350
|
+
notes,
|
|
351
|
+
deploymentSuggestion,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/realize/runtime-emitters/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAQH,6EAA6E;AAC7E,+EAA+E;AAE/E,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,QAAQ,KAAK,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7D,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED,SAAS,OAAO,CAAC,QAAgB;IAC/B,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClE,OAAO,UAAU;SACd,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,IAAI,EAAE;SACN,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,eAAe,CAAC;IAC/C,OAAO,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,IAAI,CACR,iCAAiC,WAAW,CAAC,IAAI,uDAAuD,CACzG,CAAC;QACJ,CAAC;aAAM,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CACR,kCAAkC,WAAW,CAAC,IAAI,2EAA2E,CAC9H,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YACxB,WAAW,CAAC,IAAI,CAAC,iBAAiB,WAAW,CAAC,IAAI,uDAAuD,CAAC,CAAC;QAC7G,CAAC;aAAM,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC9B,WAAW,CAAC,IAAI,CAAC,kBAAkB,WAAW,CAAC,IAAI,2EAA2E,CAAC,CAAC;QAClI,CAAC;QACD,MAAM,oBAAoB,GAAG;YAC3B,QAAQ,EAAE,WAAW,CAAC,IAAI;YAC1B,iBAAiB,EAAG,GAAG,CAAC,iBAAyB,EAAE,IAAI;YACvD,QAAQ,EAAE,UAAmB;YAC7B,GAAG,EAAE,UAAU;YACf,MAAM,EAAE;gBACN,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;gBACzB,QAAQ;aACT;YACD,OAAO,EAAE,OAAO,CAAC,IAAI;YACrB,QAAQ,EAAE,SAAkB;YAC5B,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnD,CAAC;QAEF,OAAO;YACL,KAAK;YACL,OAAO,EAAE,CAAC,cAAc,CAAC;YACzB,KAAK;YACL,oBAAoB;SACrB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* The canonical source is @specverse/types.
|
|
4
4
|
* This file exists for backward compatibility.
|
|
5
5
|
*/
|
|
6
|
-
export { type Dependency, type CodeTemplate, type TechnologyStack, type CompatibilityRequirements, type Capabilities, type Dependencies, type InstanceFactoryMetadata, type InstanceFactory, type InstanceFactoryReference, type CapabilityMapping, type InstanceMapping, type DefaultMappings, type DeploymentReference, type ResolvedImplementation, type FactoryValidationResult, type FactoryValidationResult as ValidationResult, type TemplateContext, type TemplateEngine, type LibrarySource, type LibraryConfig, } from '@specverse/types';
|
|
6
|
+
export { type Dependency, type CodeTemplate, type TechnologyStack, type CompatibilityRequirements, type Capabilities, type Dependencies, type InstanceFactoryMetadata, type InstanceFactory, type InstanceFactoryReference, type CapabilityMapping, type InstanceMapping, type DefaultMappings, type DeploymentReference, type ResolvedImplementation, type FactoryValidationResult, type FactoryValidationResult as ValidationResult, type TemplateContext, type TemplateEngine, type LibrarySource, type LibraryConfig, type FactoryTopology, type FactoryDeploymentCategory, type FactoryAuthentication, type FactoryV2Metadata, } from '@specverse/types';
|
|
7
7
|
//# sourceMappingURL=instance-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance-factory.d.ts","sourceRoot":"","sources":["../../../src/realize/types/instance-factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,IAAI,gBAAgB,EAChD,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"instance-factory.d.ts","sourceRoot":"","sources":["../../../src/realize/types/instance-factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,IAAI,gBAAgB,EAChD,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC"}
|
|
@@ -40,6 +40,17 @@ dependencies:
|
|
|
40
40
|
- name: "typescript"
|
|
41
41
|
version: "^5.2.0"
|
|
42
42
|
|
|
43
|
+
# V2 factory metadata — Component Dependencies V2 proposal Section 4
|
|
44
|
+
v2metadata:
|
|
45
|
+
topology: messaging # AMQP broker pub/sub; deploys as communications: instance
|
|
46
|
+
protocol: amqp # AMQP 0-9-1 (RabbitMQ)
|
|
47
|
+
authentication: { kind: bearer, mechanism: PLAIN } # RabbitMQ credential pair (user/password)
|
|
48
|
+
supportedTopologies: [messaging]
|
|
49
|
+
serverTemplate: templates/rabbitmq/connection-generator.ts # broker connection setup
|
|
50
|
+
clientTemplate: templates/rabbitmq/publisher-generator.ts # publisher client for producers
|
|
51
|
+
emitsDeploymentInstance: true # generates a communications: instance entry
|
|
52
|
+
deploymentCategory: communications # lands in communications: category
|
|
53
|
+
|
|
43
54
|
codeTemplates:
|
|
44
55
|
publisher:
|
|
45
56
|
engine: typescript
|
|
@@ -52,6 +52,17 @@ dependencies:
|
|
|
52
52
|
- name: "tsx"
|
|
53
53
|
version: "^4.0.0"
|
|
54
54
|
|
|
55
|
+
# V2 factory metadata — Component Dependencies V2 proposal Section 4
|
|
56
|
+
v2metadata:
|
|
57
|
+
topology: service # generates a Fastify HTTP server; deploys as services: instance
|
|
58
|
+
protocol: rest # HTTP/REST transport
|
|
59
|
+
authentication: { kind: bearer } # typical JWT bearer auth; overridable per deployment
|
|
60
|
+
supportedTopologies: [service]
|
|
61
|
+
serverTemplate: templates/fastify/server-generator.ts # server bind code (main.ts / server.ts)
|
|
62
|
+
clientTemplate: null # clients generated from TypeScript SDK factory (separate concern)
|
|
63
|
+
emitsDeploymentInstance: true # generates a services: instance entry in deployment
|
|
64
|
+
deploymentCategory: services # lands in services: category
|
|
65
|
+
|
|
55
66
|
codeTemplates:
|
|
56
67
|
routes:
|
|
57
68
|
engine: typescript
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: StripeRestSDK
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: infrastructure
|
|
4
|
+
description: "Stripe payments SDK adapter — wraps the Stripe Node.js SDK with a typed SpecVerse client for managed payment processing"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [stripe, payments, managed, rest, sdk, infrastructure]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: ">=6.33.0"
|
|
13
|
+
node: ">=18.0.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "managed.payments"
|
|
18
|
+
- "managed.payments.stripe"
|
|
19
|
+
requires: [] # external SaaS — no transitive SpecVerse deps
|
|
20
|
+
|
|
21
|
+
technology:
|
|
22
|
+
runtime: "node"
|
|
23
|
+
language: "typescript"
|
|
24
|
+
framework: "stripe-sdk"
|
|
25
|
+
version: "^14.0.0"
|
|
26
|
+
|
|
27
|
+
# V2 factory metadata — Component Dependencies V2 proposal Section 4
|
|
28
|
+
# Forward-looking stub: Round 2 realize emitters will consume these fields.
|
|
29
|
+
v2metadata:
|
|
30
|
+
topology: managed # external SaaS via SDK; deploys as infrastructure: instance
|
|
31
|
+
protocol: rest # Stripe API uses HTTPS/REST under the hood
|
|
32
|
+
sdk: "stripe" # npm package name: https://www.npmjs.com/package/stripe
|
|
33
|
+
authentication: { kind: api-key, envVar: STRIPE_SECRET_KEY } # Stripe uses API keys
|
|
34
|
+
supportedTopologies: [managed]
|
|
35
|
+
clientTemplate: templates/stripe/stripe-client-generator.ts # typed wrapper exposing Charge.create etc.
|
|
36
|
+
serverTemplate: null # external SaaS — no server bind code emitted
|
|
37
|
+
emitsDeploymentInstance: true # generates an infrastructure: instance entry in deployment
|
|
38
|
+
deploymentCategory: infrastructure # lands in infrastructure: category (external SaaS)
|
|
39
|
+
|
|
40
|
+
dependencies:
|
|
41
|
+
runtime:
|
|
42
|
+
- name: "stripe"
|
|
43
|
+
version: "^14.0.0"
|
|
44
|
+
|
|
45
|
+
dev:
|
|
46
|
+
- name: "@types/node"
|
|
47
|
+
version: "^20.8.0"
|
|
48
|
+
- name: "typescript"
|
|
49
|
+
version: "^5.2.0"
|
|
50
|
+
|
|
51
|
+
# Minimal stub: codeTemplates to be fleshed out in Round 2 (per-runtime emitters)
|
|
52
|
+
codeTemplates:
|
|
53
|
+
client:
|
|
54
|
+
engine: typescript
|
|
55
|
+
generator: "libs/instance-factories/managed/templates/stripe/stripe-client-generator.ts"
|
|
56
|
+
outputPattern: "{backendDir}/src/clients/StripeClient.ts"
|
|
57
|
+
|
|
58
|
+
configuration:
|
|
59
|
+
envVar: "STRIPE_SECRET_KEY"
|
|
60
|
+
apiVersion: "2024-06-20"
|
|
61
|
+
webhookSecret: null # optional: STRIPE_WEBHOOK_SECRET for signature verification
|
|
62
|
+
|
|
63
|
+
requirements:
|
|
64
|
+
dependencies:
|
|
65
|
+
npm:
|
|
66
|
+
dependencies:
|
|
67
|
+
"stripe": "^14.0.0"
|
|
68
|
+
environment:
|
|
69
|
+
- name: "STRIPE_SECRET_KEY"
|
|
70
|
+
description: "Stripe secret API key"
|
|
71
|
+
example: "sk_live_..."
|
|
72
|
+
required: true
|
|
73
|
+
category: "Payments"
|
|
74
|
+
- name: "STRIPE_WEBHOOK_SECRET"
|
|
75
|
+
description: "Stripe webhook signing secret (required only if handling webhooks)"
|
|
76
|
+
example: "whsec_..."
|
|
77
|
+
required: false
|
|
78
|
+
category: "Payments"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stripe REST SDK — Client Generator (Round 2 stub)
|
|
3
|
+
*
|
|
4
|
+
* FACTORY-EMITTED — DO NOT EDIT (R8)
|
|
5
|
+
*
|
|
6
|
+
* This template generator is a forward-looking stub for the V2 Round 2
|
|
7
|
+
* per-runtime emitter work. It will be fleshed out when the managed-runtime
|
|
8
|
+
* realize emitter is implemented (Phase 3 of the Component Dependencies V2 proposal).
|
|
9
|
+
*
|
|
10
|
+
* When complete, this generator will emit a typed StripeClient wrapper that:
|
|
11
|
+
* - Initialises the Stripe SDK with the API key from env (STRIPE_SECRET_KEY)
|
|
12
|
+
* - Exposes only the operations selected in the consumer's `import[].select:`
|
|
13
|
+
* - Uses the `(deps, input) → result` pure-function shape for testability
|
|
14
|
+
* - Matches the `clientTemplate` path declared in stripe-rest-sdk.yaml v2metadata
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { TemplateContext } from '@specverse/types';
|
|
18
|
+
|
|
19
|
+
export async function generate(_context: TemplateContext): Promise<string> {
|
|
20
|
+
// Round 2 stub — throws so realize reports an actionable error rather than silently emitting empty code
|
|
21
|
+
throw new Error(
|
|
22
|
+
'StripeRestSDK client generator is a V2 Round 2 stub. ' +
|
|
23
|
+
'The managed-runtime realize emitter is not yet implemented. ' +
|
|
24
|
+
'See Component Dependencies V2 proposal Phase 3.'
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -40,6 +40,17 @@ dependencies:
|
|
|
40
40
|
- name: "typescript"
|
|
41
41
|
version: "^5.2.0"
|
|
42
42
|
|
|
43
|
+
# V2 factory metadata — Component Dependencies V2 proposal Section 4
|
|
44
|
+
v2metadata:
|
|
45
|
+
topology: library # in-process ORM client; no deployment instance emitted
|
|
46
|
+
# protocol: omitted — not applicable for library topology
|
|
47
|
+
authentication: { kind: none } # auth is the DB connection string, not a protocol-level scheme
|
|
48
|
+
supportedTopologies: [library]
|
|
49
|
+
clientTemplate: null # client is the generated Prisma client itself
|
|
50
|
+
serverTemplate: null # no server component
|
|
51
|
+
emitsDeploymentInstance: false # library-shaped; consumer manages DB config via storage: instance
|
|
52
|
+
deploymentCategory: storage # informational: if a storage: instance existed, it would land here
|
|
53
|
+
|
|
43
54
|
codeTemplates:
|
|
44
55
|
schema:
|
|
45
56
|
engine: typescript
|
|
@@ -30,35 +30,17 @@ export function toVar(name: string): string {
|
|
|
30
30
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
name: string;
|
|
45
|
-
pattern: RegExp;
|
|
46
|
-
/** Emit inline code for this step. Return empty string to signal
|
|
47
|
-
* "regex matched but I can't safely emit" (caller falls through to AI). */
|
|
48
|
-
generateCall: (match: RegExpMatchArray, ctx: C) => string;
|
|
49
|
-
/** Optional helper-method body that some libraries (e.g. prisma's
|
|
50
|
-
* `check {condition}` convention) emit alongside the call site. */
|
|
51
|
-
generateMethod?: (match: RegExpMatchArray, ctx: C) => string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface MatchResult {
|
|
55
|
-
matched: boolean;
|
|
56
|
-
call: string;
|
|
57
|
-
helperMethod?: string;
|
|
58
|
-
functionName?: string;
|
|
59
|
-
inputs?: string[];
|
|
60
|
-
resultVar?: string;
|
|
61
|
-
}
|
|
33
|
+
// #54 (2026-05-10): SharedStepContext, SharedConvention, MatchResult
|
|
34
|
+
// and MatcherFn are now canonical in @specverse/types. Re-exported here
|
|
35
|
+
// so existing dynamic-import call sites that grab types from this path
|
|
36
|
+
// keep working. New code should import directly from @specverse/types.
|
|
37
|
+
export type {
|
|
38
|
+
SharedStepContext,
|
|
39
|
+
SharedConvention,
|
|
40
|
+
MatchResult,
|
|
41
|
+
MatcherFn,
|
|
42
|
+
} from '@specverse/types';
|
|
43
|
+
import type { SharedStepContext, SharedConvention, MatchResult } from '@specverse/types';
|
|
62
44
|
|
|
63
45
|
// ── Audit-trail recorder hook ──────────────────────────────────────────
|
|
64
46
|
// Forward-logging discipline (engines 6.22.0+): the matcher records every
|