@stackql/provider-utils 0.5.2 → 0.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackql/provider-utils",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Utilities for building StackQL providers from OpenAPI specifications.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -17,7 +17,7 @@ async function loadManifest(configPath) {
17
17
  createReadStream(configPath)
18
18
  .pipe(csv())
19
19
  .on('data', (row) => {
20
- const key = `${row.filename}::${row.operationId}`;
20
+ const key = `${row.filename}::${row.path}::${row.verb}`;
21
21
  manifest[key] = row;
22
22
  })
23
23
  .on('end', () => {
@@ -251,9 +251,17 @@ export async function generate(options) {
251
251
 
252
252
  // Initialize resources object with defaultdict-like behavior
253
253
  const resources = {};
254
+
255
+ // Define valid HTTP verbs to process
256
+ const validVerbs = ['get', 'post', 'put', 'patch', 'delete'];
254
257
 
255
258
  for (const [pathKey, pathItem] of Object.entries(spec.paths || {})) {
256
259
  for (const [verb, operation] of Object.entries(pathItem)) {
260
+ // Only process valid HTTP verbs
261
+ if (!validVerbs.includes(verb)) {
262
+ continue;
263
+ }
264
+
257
265
  if (typeof operation !== 'object' || operation === null) {
258
266
  continue;
259
267
  }
@@ -263,7 +271,7 @@ export async function generate(options) {
263
271
  continue;
264
272
  }
265
273
 
266
- const manifestKey = `${filename}::${operationId}`;
274
+ const manifestKey = `${filename}::${pathKey}::${verb}`;
267
275
  const entry = manifest[manifestKey];
268
276
  if (!entry) {
269
277
  logger.error(`❌ ERROR: ${filename} → ${operationId} not found in manifest`);
@@ -337,8 +345,11 @@ export async function generate(options) {
337
345
  }
338
346
  }
339
347
 
340
- // Write enriched spec
341
- const outputPath = path.join(servicesPath, filename);
348
+ // Write enriched spec (always as YAML, ensuring .yaml extension)
349
+ const outputFilename = filename.endsWith('.json')
350
+ ? filename.replace(/\.json$/, '.yaml')
351
+ : filename;
352
+ const outputPath = path.join(servicesPath, outputFilename);
342
353
  writeSpec(outputPath, spec);
343
354
  logger.info(`✅ Wrote enriched spec: ${outputPath}`);
344
355
 
@@ -352,7 +363,7 @@ export async function generate(options) {
352
363
  name: serviceName,
353
364
  preferred: true,
354
365
  service: {
355
- $ref: `${providerId}/${version}/services/${filename}`
366
+ $ref: `${providerId}/${version}/services/${outputFilename}`
356
367
  },
357
368
  title: specTitle,
358
369
  version: version,