@superblocksteam/ai-service-templates 2.0.70 → 2.0.71-next.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 (2) hide show
  1. package/package.json +2 -2
  2. package/templates.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/ai-service-templates",
3
- "version": "2.0.70",
3
+ "version": "2.0.71-next.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./reify-template": {
@@ -20,7 +20,7 @@
20
20
  "devDependencies": {
21
21
  "@types/node": "^20",
22
22
  "vite": "6.4.1",
23
- "vitest": "^3.2.0"
23
+ "vitest": "^4.0.0"
24
24
  },
25
25
  "publishConfig": {
26
26
  "registry": "https://registry.npmjs.org"
package/templates.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export const templates = {
3
3
  "api-builder-to-yaml": {
4
4
  "bootstrap.mjs": "import { register } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\n\nregister(\"./shim-loader.mjs\", pathToFileURL(\"./\"));\n",
5
- "package.json": "{\n \"type\": \"module\",\n \"scripts\": {\n \"build\": \"tsc\",\n \"test\": \"pnpm build && vitest run src/superblocks-library-shim/index.test.ts\"\n },\n \"dependencies\": {\n \"@types/node\": \"^20\",\n \"@typescript-eslint/parser\": \"^8.34.0\",\n \"acorn\": \"^8.14.0\",\n \"eslint\": \"^9.39.1\",\n \"prettier\": \"^3.6.2\",\n \"typescript\": \"^5.9.3\",\n \"yaml\": \"^2.7.1\"\n },\n \"devDependencies\": {\n \"vite\": \"6.4.1\",\n \"vitest\": \"^3.2.0\"\n }\n}\n",
5
+ "package.json": "{\n \"type\": \"module\",\n \"scripts\": {\n \"build\": \"tsc\",\n \"test\": \"pnpm build && vitest run src/superblocks-library-shim/index.test.ts\"\n },\n \"dependencies\": {\n \"@types/node\": \"^20\",\n \"@typescript-eslint/parser\": \"^8.34.0\",\n \"acorn\": \"^8.14.0\",\n \"eslint\": \"^9.39.1\",\n \"prettier\": \"^3.7.4\",\n \"typescript\": \"^5.9.3\",\n \"yaml\": \"^2.7.1\"\n },\n \"devDependencies\": {\n \"vite\": \"6.4.1\",\n \"vitest\": \"^4.0.0\"\n }\n}\n",
6
6
  "shim-loader.mjs": "import path from \"path\";\nimport { pathToFileURL } from \"url\";\n\nconst overrideMap = {\n \"@superblocksteam/library\": \"./dist/superblocks-library-shim/index.js\",\n};\n\nexport async function resolve(specifier, context, nextResolve) {\n if (overrideMap[specifier]) {\n const fullPath = path.resolve(overrideMap[specifier]);\n return {\n shortCircuit: true,\n url: pathToFileURL(fullPath).href,\n };\n }\n\n return nextResolve(specifier, context);\n}\n",
7
7
  "src/do-eval-to-sdk.ts": "import fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\n// finds all JavaScript files in the specified directory,\n// imports each module, converts its JSON representation to SDK,\n// and returns a map with filenames as keys and SDK content as values.\nexport async function processSdkFiles(\n apisDir: string,\n): Promise<Record<string, string>> {\n const files = fs.readdirSync(apisDir);\n const jsFiles = files.filter(\n (file) => file.endsWith(\".js\") && file !== \"__template__.js\",\n );\n const results: Record<string, string> = {};\n\n for (const jsFile of jsFiles) {\n const filePath = path.join(apisDir, jsFile);\n const absolutePath = path.resolve(filePath);\n\n try {\n const fileUrl = new URL(`file://${absolutePath}`);\n const module = await import(fileUrl.href);\n\n const defaultExport = module.default;\n\n if (defaultExport && typeof defaultExport.toSDK === \"function\") {\n const sdkData = await defaultExport.toSDK();\n\n results[jsFile] = sdkData;\n } else {\n console.warn(`${jsFile}: Default export doesn't have a toSDK method`);\n }\n } catch (error) {\n console.error(`Error processing ${jsFile}:`, error);\n }\n }\n\n return results;\n}\n\nasync function main() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const apisDir = path.resolve(__dirname, \"./to-sdk\");\n\n const results = await processSdkFiles(apisDir);\n console.log(JSON.stringify(results, null, 2));\n}\n\nmain().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n});\n",
8
8
  "src/do-eval-to-yaml.ts": "import fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport yaml from \"yaml\";\n\n// finds all JavaScript files in the specified directory,\n// imports each module, converts its JSON representation to YAML,\n// and returns a map with filenames as keys and YAML content as values.\n\nexport async function processYamlFiles(apisDir: string): Promise<Record<string, string>> {\n const files = fs.readdirSync(apisDir);\n const jsFiles = files.filter((file) => file.endsWith(\".js\"));\n const results: Record<string, string> = {};\n\n for (const jsFile of jsFiles) {\n const filePath = path.join(apisDir, jsFile);\n const absolutePath = path.resolve(filePath);\n\n try {\n const fileUrl = new URL(`file://${absolutePath}`);\n const module = await import(fileUrl.href);\n\n const defaultExport = module.default;\n\n if (defaultExport && typeof defaultExport.toJSON === \"function\") {\n const jsonData = await defaultExport.toJSON();\n const yamlContent = yaml.stringify(jsonData);\n results[jsFile] = yamlContent;\n } else {\n console.warn(`${jsFile}: Default export doesn't have a toJSON method`);\n }\n } catch (error) {\n console.error(`Error processing ${jsFile}:`, error);\n }\n }\n\n return results;\n}\n\nasync function main() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const apisDir = path.resolve(__dirname, \"./to-yaml\");\n \n const results = await processYamlFiles(apisDir);\n console.log(JSON.stringify(results, null, 2));\n}\n\nmain().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n});\n",