@osdk/vite-plugin-oac 0.3.0-beta.4 → 0.3.0-beta.5
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/CHANGELOG.md +11 -0
- package/build/cjs/index.cjs +2 -2
- package/build/cjs/index.cjs.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @osdk/vite-plugin-oac
|
|
2
2
|
|
|
3
|
+
## 0.3.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3d7461d]
|
|
8
|
+
- Updated dependencies [052a96b]
|
|
9
|
+
- @osdk/faux@0.3.0-beta.5
|
|
10
|
+
- @osdk/api@2.5.0-beta.5
|
|
11
|
+
- @osdk/client.unstable@2.5.0-beta.5
|
|
12
|
+
- @osdk/generator-converters.ontologyir@2.5.0-beta.5
|
|
13
|
+
|
|
3
14
|
## 0.3.0-beta.4
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/build/cjs/index.cjs
CHANGED
|
@@ -308,13 +308,13 @@ async function compileOsdk(logger) {
|
|
|
308
308
|
}
|
|
309
309
|
return exitCode;
|
|
310
310
|
}
|
|
311
|
-
var Level = /* @__PURE__ */ function(Level2) {
|
|
311
|
+
var Level = /* @__PURE__ */ (function(Level2) {
|
|
312
312
|
Level2[Level2["debug"] = 0] = "debug";
|
|
313
313
|
Level2[Level2["info"] = 1] = "info";
|
|
314
314
|
Level2[Level2["warn"] = 2] = "warn";
|
|
315
315
|
Level2[Level2["error"] = 3] = "error";
|
|
316
316
|
return Level2;
|
|
317
|
-
}({});
|
|
317
|
+
})({});
|
|
318
318
|
var Logger = class {
|
|
319
319
|
#level;
|
|
320
320
|
#viteLogger;
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OacConfig.ts","../../src/syncDirectories.ts","../../src/generateOntologyAssets.ts","../../src/Logger.ts","../../src/OacContext.ts","../../src/applySeed.ts","../../src/registerOntologyFullMetadata.ts","../../src/utils/readJsonFile.ts","../../src/applyOntologyAndSeed.ts","../../src/OacServerContext.ts","../../src/routeConnectToMsw.ts","../../src/OacDevServer.ts","../../src/ontologyAsCode.ts"],"names":["fs","path","crypto","fs2","path2","execa","OntologyIrToFullMetadataConverter","inspect","Level","chalk","path3","FauxFoundry","jiti","createJiti","invariant","fs3","path4","Emittery","Readable","msw","stream","EventEmitter","fs4","util","fs5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,IAAM,YAAN,MAAgB;AAAA,EACrB,YAAY,MAAQ,EAAA;AAClB,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,MAAM,CAAA;AAAA;AAE9B;ACEA,eAAsB,eAAA,CAAgB,SAAW,EAAA,SAAA,EAAW,MAAQ,EAAA;AAClE,EAAA,MAAA,CAAO,KAAM,CAAA,CAAA,cAAA,EAAiB,SAAS,CAAA,IAAA,EAAO,SAAS,CAAE,CAAA,CAAA;AAGzD,EAAM,MAAAA,qBAAA,CAAG,QAAS,CAAA,KAAA,CAAM,SAAW,EAAA;AAAA,IACjC,SAAW,EAAA;AAAA,GACZ,CAAA;AAGD,EAAA,MAAM,CAAC,WAAA,EAAa,WAAW,CAAA,GAAI,MAAM,OAAQ,CAAA,GAAA,CAAI,CAAC,WAAA,CAAY,SAAS,CAAA,EAAG,WAAY,CAAA,SAAS,CAAC,CAAC,CAAA;AACrG,EAAA,IAAI,YAAe,GAAA,CAAA;AACnB,EAAA,IAAI,UAAa,GAAA,CAAA;AACjB,EAAA,IAAI,YAAe,GAAA,CAAA;AACnB,EAAA,IAAI,cAAiB,GAAA,CAAA;AACrB,EAAA,MAAM,SAAS,EAAC;AAGhB,EAAA,KAAA,MAAW,gBAAgB,WAAa,EAAA;AACtC,IAAA,MAAM,UAAa,GAAAC,uBAAA,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OAAS,EAAA;AAAA,YACnC,SAAW,EAAA;AAAA,WACZ,CAAA;AACD,UAAA,MAAM,uBAAuB,GAAG,CAAA;AAChC,UAAI,GAAA,CAAA,MAAA,CAAO,KAAK,kDAAkD,CAAA;AAAA,iBAC3D,KAAO,EAAA;AACd,UAAI,GAAA,CAAA,MAAA,CAAO,KAAM,CAAA,CAAA,oCAAA,EAAuC,KAAiB,YAAA,KAAA,GAAQ,MAAM,OAAU,GAAA,MAAA,CAAO,KAAK,CAAC,CAAE,CAAA,CAAA;AAChH,UAAM,MAAA,KAAA;AAAA;AACR;AACF;AACF,GACF;AACF","file":"index.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class OacConfig {\n constructor(config) {\n Object.assign(this, config);\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n/**\n * Synchronize directories by copying only changed files and removing obsolete ones\n */\nexport async function syncDirectories(sourceDir, targetDir, logger) {\n logger.debug(`Synchronizing ${sourceDir} to ${targetDir}`);\n\n // Ensure target directory exists\n await fs.promises.mkdir(targetDir, {\n recursive: true\n });\n\n // Get all files in both directories\n const [sourceFiles, targetFiles] = await Promise.all([getAllFiles(sourceDir), getAllFiles(targetDir)]);\n let updatedCount = 0;\n let addedCount = 0;\n let removedCount = 0;\n let unchangedCount = 0;\n const errors = [];\n\n // Process files from source directory\n for (const relativeFile of sourceFiles) {\n const sourceFile = path.join(sourceDir, relativeFile);\n const targetFile = path.join(targetDir, relativeFile);\n try {\n const targetExists = targetFiles.includes(relativeFile);\n const isDifferent = await areFilesDifferent(sourceFile, targetFile);\n if (!targetExists) {\n // New file - need to create directory structure\n await fs.promises.mkdir(path.dirname(targetFile), {\n recursive: true\n });\n await fs.promises.copyFile(sourceFile, targetFile);\n addedCount++;\n logger.debug(`Added: ${relativeFile}`);\n } else if (isDifferent) {\n // Changed file - update it\n await fs.promises.copyFile(sourceFile, targetFile);\n updatedCount++;\n logger.debug(`Updated: ${targetFile}`);\n } else {\n // File is unchanged\n unchangedCount++;\n }\n } catch (error) {\n const errorMsg = `Failed to sync ${relativeFile}: ${error instanceof Error ? error.message : String(error)}`;\n errors.push(errorMsg);\n logger.error(errorMsg);\n }\n }\n\n // Remove files that exist in target but not in source\n for (const relativeFile of targetFiles) {\n if (!sourceFiles.includes(relativeFile)) {\n const targetFile = path.join(targetDir, relativeFile);\n try {\n await fs.promises.unlink(targetFile);\n removedCount++;\n logger.debug(`Removed: ${relativeFile}`);\n } catch (error) {\n const errorMsg = `Failed to remove ${relativeFile}: ${error instanceof Error ? error.message : String(error)}`;\n errors.push(errorMsg);\n logger.error(errorMsg);\n }\n }\n }\n\n // Clean up empty directories in target\n try {\n await removeEmptyDirectories(targetDir);\n } catch (error) {\n logger.warn(`Failed to clean up empty directories: ${error instanceof Error ? error.message : String(error)}`);\n }\n\n // Log summary\n logger.debug(`Sync complete: ${addedCount} added, ${updatedCount} updated, ${removedCount} removed, ${unchangedCount} unchanged`);\n if (errors.length > 0) {\n logger.warn(`Encountered ${errors.length} errors during sync`);\n }\n}\n\n/**\n * Remove empty directories recursively\n */\nasync function removeEmptyDirectories(dir) {\n try {\n const entries = await fs.promises.readdir(dir, {\n withFileTypes: true\n });\n\n // First, recursively clean subdirectories\n for (const entry of entries) {\n if (entry.isDirectory()) {\n const subdir = path.join(dir, entry.name);\n await removeEmptyDirectories(subdir);\n }\n }\n\n // Then check if this directory is now empty\n const remainingEntries = await fs.promises.readdir(dir);\n if (remainingEntries.length === 0) {\n // Don't remove the root target directory itself\n const targetDir = \".osdk/src\";\n if (path.resolve(dir) !== path.resolve(targetDir)) {\n await fs.promises.rmdir(dir);\n }\n }\n } catch (error) {\n // Ignore errors when cleaning up directories\n }\n}\n\n/**\n * Calculate SHA-256 hash of a file's contents\n */\nasync function getFileHash(filePath) {\n try {\n const content = await fs.promises.readFile(filePath);\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n } catch (error) {\n // Return empty hash for non-existent files\n return \"\";\n }\n}\n\n/**\n * Check if two files are different by comparing their hashes\n */\nasync function areFilesDifferent(sourceFile, targetFile) {\n try {\n const [sourceHash, targetHash] = await Promise.all([getFileHash(sourceFile), getFileHash(targetFile)]);\n return sourceHash !== targetHash || sourceHash === \"\"; // Different if hashes differ or source doesn't exist\n } catch (error) {\n // If we can't compare, assume they're different to be safe\n return true;\n }\n}\n\n/**\n * Recursively get all files in a directory\n */\nasync function getAllFiles(dir, baseDir = dir) {\n const files = [];\n try {\n const entries = await fs.promises.readdir(dir, {\n withFileTypes: true\n });\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativePath = path.relative(baseDir, fullPath);\n if (entry.isDirectory()) {\n const subFiles = await getAllFiles(fullPath, baseDir);\n files.push(...subFiles);\n } else if (entry.isFile()) {\n files.push(relativePath);\n }\n }\n } catch (error) {\n // Directory doesn't exist or can't be read\n }\n return files;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyIrToFullMetadataConverter } from \"@osdk/generator-converters.ontologyir\";\nimport { execa } from \"execa\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { inspect } from \"node:util\";\nimport { syncDirectories } from \"./syncDirectories.js\";\n\n/**\n * Generate all ontology assets: IR, full metadata, and OSDK.\n * This function contains the core generation logic extracted from watchOntologyAsCode\n * so it can be used both in dev mode (via file watching) and build mode.\n */\nexport async function generateOntologyAssets(opts) {\n const {\n ontologyDir,\n logger\n } = opts;\n await fs.promises.mkdir(opts.workDir, {\n recursive: true\n });\n\n // Ensure the ontology directory exists\n if (!fs.existsSync(ontologyDir)) {\n fs.mkdirSync(ontologyDir, {\n recursive: true\n });\n logger.info(\"Created .ontology directory\");\n }\n\n // Generate the assets in sequence\n await ontologyJsToIr(opts);\n await ontologyIrToFullMetadata(opts);\n await fullMetadataToOsdk(opts);\n}\nexport function ontologyIrPath(workDir) {\n return path.join(workDir, \".ontology.ir.json\");\n}\nexport function ontologyFullMetadataPath(workDir) {\n return path.join(workDir, \".ontology.json\");\n}\n\n/**\n * Convert ontology.mjs to IR format using the maker tool\n */\nasync function ontologyJsToIr({\n logger,\n ontologyDir,\n workDir\n}) {\n logger.debug(\"Generating Ontology IR\");\n const {\n stdout,\n stderr,\n exitCode\n } = await execa(\"pnpm\", [\"exec\", \"maker\", \"-i\", `${ontologyDir}/ontology.mts`, \"-o\", ontologyIrPath(workDir)]);\n if (exitCode !== 0) {\n logger.error(`Ontology IR generation failed with exit code ${exitCode}`);\n if (stderr) {\n logger.error(`Command stderr: ${stderr}`);\n }\n throw new Error(`Failed to generate ontology IR: exit code ${exitCode}`);\n }\n\n // Log stdout for debugging if needed\n if (stdout) {\n logger.debug(`Ontology IR generation output: ${stdout}`);\n }\n}\n\n/**\n * Convert IR to full metadata format\n */\nasync function ontologyIrToFullMetadata({\n logger,\n workDir\n}) {\n logger.debug(\"Converting IR to Full metadata\");\n try {\n const irContent = await fs.promises.readFile(ontologyIrPath(workDir), {\n encoding: \"utf-8\"\n });\n const blockData = JSON.parse(irContent).blockData;\n const fullMeta = OntologyIrToFullMetadataConverter.getFullMetadataFromIr(blockData);\n await fs.promises.writeFile(ontologyFullMetadataPath(workDir), JSON.stringify(fullMeta, null, 2));\n logger.debug(\"Successfully converted IR to full metadata\");\n } catch (error) {\n logger.error(`Failed to convert IR to full metadata: ${inspect(error)}`);\n throw error;\n }\n}\n\n/**\n * Generate OSDK from full metadata\n */\nasync function fullMetadataToOsdk({\n logger,\n workDir\n}) {\n logger.debug(\"Generating OSDK from full metadata\");\n\n // First create a clean temporary directory to generate the SDK into\n const tempDir = path.join(workDir, \".osdkGenerationTmp\", \"src\");\n await fs.promises.rm(tempDir, {\n recursive: true,\n force: true\n });\n await fs.promises.mkdir(tempDir, {\n recursive: true\n });\n\n // The osdk cli currently mutes package.json files which we don't want in this case\n // so we give it a fake package.json file\n await fs.promises.writeFile(path.join(tempDir, \"..\", \"package.json\"), JSON.stringify({}, null, 2), {\n encoding: \"utf-8\"\n });\n try {\n // Then generate the source code for the osdk\n const tempSrcDir = path.join(tempDir, \"src\");\n const {\n stdout,\n stderr,\n exitCode\n } = await execa(\"pnpm\", [\"exec\", \"osdk\", \"unstable\", \"typescript\", \"generate\", \"--outDir\", tempSrcDir, \"--ontologyPath\", ontologyFullMetadataPath(workDir), \"--beta\", \"true\", \"--packageType\", \"module\", \"--version\", \"dev\"]);\n logger.debug(`OSDK generation output: ${stdout}`);\n if (stderr) {\n logger.error(`OSDK generation stderr: ${stderr}`);\n }\n\n // Then if it was successful, synchronize the generated code with the target directory\n if (exitCode === 0) {\n // TODO we should just generate this whole thing into the work dir?\n const targetDir = \".osdk/src\";\n try {\n logger.debug(\"OSDK generation successful, synchronizing with target directory\");\n\n // Use granular synchronization instead of wholesale replacement\n await syncDirectories(tempSrcDir, targetDir, logger);\n logger.debug(`Successfully synchronized ${targetDir} with newly generated code`);\n await compileOsdk(logger);\n\n // Clean up temporary directory after successful sync\n await fs.promises.rm(tempDir, {\n recursive: true,\n force: true\n });\n } catch (error) {\n logger.error(`Failed to synchronize ${targetDir} directory: ${inspect(error)}`);\n logger.error(`Temporary files left at: ${tempDir}`);\n throw error;\n }\n } else {\n logger.error(`OSDK generation failed with exit code ${exitCode}`);\n logger.error(`Temporary files left at: ${tempDir}`);\n throw new Error(`OSDK generation failed with exit code ${exitCode}`);\n }\n } catch (error) {\n // Make sure to clean up temp directory even if there's an error\n try {\n await fs.promises.rm(tempDir, {\n recursive: true,\n force: true\n });\n } catch (cleanupError) {\n logger.warn(`Failed to clean up temporary directory: ${inspect(cleanupError)}`);\n }\n throw error;\n }\n}\nasync function compileOsdk(logger) {\n const {\n stdout,\n stderr,\n exitCode\n } = await execa(\"pnpm\", [\"exec\", \"tsc\"], {\n cwd: \".osdk\"\n });\n logger.debug(`OSDK generation output: ${stdout}`);\n if (stderr) {\n logger.error(`OSDK generation stderr: ${stderr}`);\n }\n return exitCode;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from \"chalk\";\nexport let Level = /*#__PURE__*/function (Level) {\n Level[Level[\"debug\"] = 0] = \"debug\";\n Level[Level[\"info\"] = 1] = \"info\";\n Level[Level[\"warn\"] = 2] = \"warn\";\n Level[Level[\"error\"] = 3] = \"error\";\n return Level;\n}({});\nexport class Logger {\n #level;\n #viteLogger;\n constructor({\n level,\n viteLogger\n }) {\n this.#level = typeof level === \"string\" ? Level[level] : level;\n this.#viteLogger = viteLogger;\n }\n debug(message) {\n if (this.#level <= Level.debug) {\n this.#viteLogger.info(`${chalk.cyan(\"[osdk]\")} ${chalk.gray(`DEBUG: ${message}`)}`, {\n timestamp: true\n });\n }\n }\n info(message) {\n if (this.#level <= Level.info) {\n this.#viteLogger.info(`${chalk.cyan(\"[osdk]\")} ${message}`, {\n timestamp: true\n });\n }\n }\n error(message) {\n if (this.#level <= Level.error) {\n this.#viteLogger.error(`${chalk.cyan(\"[osdk]\")} ${chalk.red(message)}`, {\n timestamp: true\n });\n }\n }\n warn(message) {\n if (this.#level <= Level.warn) {\n this.#viteLogger.warn(`${chalk.cyan(\"[osdk]\")} ${chalk.yellow(message)}`, {\n timestamp: true\n });\n }\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FauxFoundry } from \"@osdk/faux\";\nimport * as path from \"node:path\";\nimport { Level as LoggerLevel, Logger } from \"./Logger.js\";\nimport { OacConfig } from \"./OacConfig.js\";\nexport class OacContext extends OacConfig {\n constructor(config, resolvedConfig) {\n super(config);\n this.serverUrl = `http${resolvedConfig.server.https ? \"s\" : \"\"}://localhost:${resolvedConfig.server.port}`;\n this.defaultOntologyRid = `ri.ontology.main.ontology.00000000-0000-0000-0000-000000000000`;\n this.workDir = path.join(\"node_modules\", \".osdk\", \".oac\");\n this.logger = new Logger({\n level: config.loggerLevel ?? LoggerLevel.info,\n viteLogger: resolvedConfig.logger\n });\n this.workDir = path.join(\"node_modules\", \".osdk\", \".oac\");\n }\n fauxFoundryFactory = () => {\n return new FauxFoundry(this.serverUrl, {\n apiName: \"DefaultOntology\",\n description: \"Description\",\n displayName: \"Ontology\",\n rid: this.defaultOntologyRid\n });\n };\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createJiti } from \"jiti\";\nexport async function applySeed(fauxFoundry, seedPath) {\n const jiti = createJiti(import.meta.filename, {\n moduleCache: false,\n debug: false,\n importMeta: import.meta\n });\n const module = await jiti.import(seedPath);\n module.default(fauxFoundry);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { inspect } from \"node:util\";\nimport invariant from \"tiny-invariant\";\ninspect.defaultOptions = {\n colors: true,\n depth: Infinity\n};\nexport function registerOntologyFullMetadata(ontology, ontologyFullMetadata) {\n // Register object types\n Object.values(ontologyFullMetadata.objectTypes).forEach(objectType => {\n ontology.registerObjectType(objectType);\n });\n // Register action types with implementations\n Object.values(ontologyFullMetadata.actionTypes).forEach(actionType => {\n const implementation = createActionImplementation(actionType, ontologyFullMetadata);\n const actionTypeWithCamelCaseApiName = {\n ...actionType,\n apiName: camelcase(actionType.apiName)\n };\n ontology.registerActionType(actionTypeWithCamelCaseApiName, implementation);\n });\n Object.values(ontologyFullMetadata.sharedPropertyTypes).forEach(actionType => {\n ontology.registerSharedPropertyType(actionType);\n });\n Object.values(ontologyFullMetadata.queryTypes).forEach(query => {\n ontology.registerQueryType(query);\n });\n Object.values(ontologyFullMetadata.interfaceTypes).forEach(iface => {\n ontology.registerInterfaceType(iface);\n });\n}\n\n// NOTE: The ontology full metadata is not sufficient for doing this properly.\n\n/**\n * Creates a fake implementation for an action type based on its operations\n */\nfunction createActionImplementation(actionType, fullMetadata) {\n return (batch, payload, _ctx) => {\n // Extract parameters from payload\n const params = payload.parameters;\n\n // Handle different operation types\n for (const operation of actionType.operations) {\n switch (operation.type) {\n case \"createObject\":\n {\n // Handle create object operation\n const objectType = getObjectTypeForOperation(operation, fullMetadata);\n\n // we don't store the PK with the other properties\n const primaryKeyProp = objectType.objectType.primaryKey;\n const primaryKey = extractAndDelete(params, primaryKeyProp);\n\n // Create object data from parameters\n const objectData = paramsToDataValues(params, actionType);\n batch.addObject(objectType.objectType.apiName, primaryKey, objectData);\n\n // TODO: this shouldn't send params but the actual object!\n handleObjectLinks(batch, fullMetadata, objectType.objectType.apiName, primaryKey, params);\n break;\n }\n case \"modifyObject\":\n {\n // Handle modify object operation\n const {\n objectType\n } = getObjectTypeForOperation(operation, fullMetadata);\n const primaryKey = extractAndDelete(params, \"objectToModifyParameter\");\n const targetObject = batch.getObject(objectType.apiName, primaryKey);\n !targetObject ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Could not find object ${objectType.apiName} with PK ${primaryKey}`) : invariant(false) : void 0;\n if (objectType.primaryKey in params) {\n // TODO Is this true? Or are you allowed to change the PK value?\n !(params[objectType.primaryKey] === primaryKey) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `If the primary key is provided, it must match the 'objectToModifyParameter'`) : invariant(false) : void 0;\n // delete the key since we don't store it directly on the object\n delete params[objectType.primaryKey];\n }\n const objectData = paramsToDataValues(params, actionType);\n batch.modifyObject(objectType.apiName, primaryKey, objectData);\n\n // TODO: this shouldn't send params but the actual object!\n handleObjectLinks(batch, fullMetadata, objectType.apiName, primaryKey, params);\n break;\n }\n case \"deleteObject\":\n {\n const {\n objectType\n } = getObjectTypeForOperation(operation, fullMetadata);\n const primaryKey = extractAndDelete(params, \"objectToDeleteParameter\");\n\n // Handle delete object operation\n batch.deleteObject(objectType.apiName, primaryKey);\n break;\n }\n case \"createLink\":\n {\n // Handle create link operation\n const aSideObjectTypeApiName = operation.aSideObjectTypeApiName;\n const bSideObjectTypeApiName = operation.bSideObjectTypeApiName;\n const linkTypeApiNameAtoB = operation.linkTypeApiNameAtoB;\n\n // For simplicity, assume we have the primary keys in the parameters\n // In a real implementation, we would need to extract them from the parameters\n const aSidePrimaryKey = params.aSidePrimaryKey || params.primaryKey_;\n const bSidePrimaryKey = params.bSidePrimaryKey || params.linkedObjectPrimaryKey;\n if (aSidePrimaryKey && bSidePrimaryKey) {\n batch.addLink(aSideObjectTypeApiName, aSidePrimaryKey, linkTypeApiNameAtoB, bSideObjectTypeApiName, bSidePrimaryKey);\n }\n break;\n }\n case \"deleteLink\":\n {\n // Handle delete link operation\n const aSideObjectTypeApiName = operation.aSideObjectTypeApiName;\n const bSideObjectTypeApiName = operation.bSideObjectTypeApiName;\n const linkTypeApiNameAtoB = operation.linkTypeApiNameAtoB;\n\n // For simplicity, assume we have the primary keys in the parameters\n // In a real implementation, we would need to extract them from the parameters\n const aSidePrimaryKey = params.aSidePrimaryKey || params.primaryKey_;\n const bSidePrimaryKey = params.bSidePrimaryKey || params.linkedObjectPrimaryKey;\n if (aSidePrimaryKey && bSidePrimaryKey) {\n batch.removeLink(aSideObjectTypeApiName, aSidePrimaryKey, linkTypeApiNameAtoB, bSideObjectTypeApiName, bSidePrimaryKey);\n }\n break;\n }\n\n // Handle other operation types as needed\n case \"createInterfaceObject\":\n case \"modifyInterfaceObject\":\n case \"deleteInterfaceObject\":\n // These operations are not implemented for now\n throw new Error(`Operation type ${operation.type} not implemented yet`);\n break;\n default:\n throw new Error(`Unknown operation type: ${operation.type}`);\n }\n }\n };\n}\nfunction extractAndDelete(obj, key) {\n const value = obj[key];\n delete obj[key];\n return value;\n}\nfunction getObjectTypeForOperation(operation, fullMetadata) {\n const objectTypeApiName = operation.objectTypeApiName;\n const objectType = fullMetadata.objectTypes[objectTypeApiName];\n !objectType ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n return objectType;\n}\nfunction paramsToDataValues(params, actionType) {\n const objectData = {};\n for (const [key, value] of Object.entries(params)) {\n objectData[key] = toDataValue(value, actionType.parameters[key]);\n }\n return objectData;\n}\nfunction camelcase(apiName) {\n return apiName.toLowerCase().replace(/[-_]+(.)?/g, (_, chr) => chr ? chr.toUpperCase() : \"\");\n}\nfunction toDataValue(value, param) {\n if (param.dataType.type === \"geohash\" && typeof value === \"string\") {\n return latLonStringToGeoJSON(value);\n }\n return value;\n}\nfunction latLonStringToGeoJSON(latLonStr) {\n // Split the string by comma and parse as floats\n const [lat, lon] = latLonStr.split(\",\").map(Number);\n\n // Basic validation\n if (isNaN(lat) || isNaN(lon) || lat < -90 || lat > 90 || lon < -180 || lon > 180) {\n throw new Error(\"Invalid latitude or longitude\");\n }\n\n // Return GeoJSON Point\n return {\n type: \"Point\",\n coordinates: [lon, lat] // GeoJSON uses [longitude, latitude]\n };\n}\n\n/**\n * Handles linking objects based on parameter values and existing objects\n */\nfunction handleObjectLinks(batch, fullMetadata, objectTypeApiName, primaryKey, params) {\n // HACK HACK HACK\n fullMetadata.objectTypes[objectTypeApiName].linkTypes.forEach(link => {\n const cardinality = link.cardinality;\n if (cardinality === \"ONE\") {\n // This means its a one to many and we are on the one side of the link\n for (const foreignObject of batch.getObjects(link.objectTypeApiName)) {\n if (anyValueMatches(params, foreignObject.__primaryKey)) {\n batch.addLink(objectTypeApiName, primaryKey, link.apiName, link.objectTypeApiName, foreignObject.__primaryKey);\n }\n }\n } else {\n // This means its a one to many and we are on the many side of the link\n for (const foreignObject of batch.getObjects(link.objectTypeApiName)) {\n if (anyValueMatches(foreignObject, primaryKey)) {\n batch.addLink(objectTypeApiName, primaryKey, link.apiName, link.objectTypeApiName, foreignObject.__primaryKey);\n }\n }\n }\n });\n}\nfunction anyValueMatches(obj, primaryKey) {\n return Object.values(obj).some(val => val === primaryKey);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nexport function readJsonFile(arg0) {\n const content = fs.readFileSync(arg0, \"utf-8\");\n return JSON.parse(content);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as path from \"node:path\";\nimport { inspect } from \"node:util\";\nimport { applySeed } from \"./applySeed.js\";\nimport { ontologyFullMetadataPath } from \"./generateOntologyAssets.js\";\nimport { registerOntologyFullMetadata } from \"./registerOntologyFullMetadata.js\";\nimport { readJsonFile } from \"./utils/readJsonFile.js\";\nexport async function applyOntologyAndSeed(fauxFoundry, ctx) {\n const ontology = fauxFoundry.getDefaultOntology();\n const ontologyFullMetadata = readJsonFile(ontologyFullMetadataPath(ctx.workDir));\n registerOntologyFullMetadata(ontology, ontologyFullMetadata);\n try {\n if (ctx.hooks?.preSeed) {\n ctx.logger.debug(\"calling preSeed hook\");\n }\n await ctx.hooks?.preSeed?.(ontology);\n } catch (e) {\n ctx.logger.error(`Unhandled error from preSeed hook. Ignoring and continuing. ${inspect(e)}`);\n }\n ctx.logger.debug(\"applying seed data\");\n await applySeed(fauxFoundry, path.resolve(ctx.ontologyDir, \"seed.ts\"));\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Emittery from \"emittery\";\nimport { OacContext } from \"./OacContext.js\";\nexport class OacServerContext extends OacContext {\n constructor(config, server) {\n super(config, server.config);\n this.watcher = server.watcher;\n this.emitter = new Emittery();\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { msw } from \"@osdk/faux\";\nimport { Readable } from \"stream\";\nexport async function routeConnectToMsw(baseUrl, handlers, emitter, req, res, next) {\n const method = req.method ?? \"GET\";\n const canRequestHaveBody = method !== \"HEAD\" && method !== \"GET\";\n const mockRequest = new Request(new URL(req.url, baseUrl), {\n method,\n headers: new Headers(req.headers),\n credentials: \"omit\",\n // @ts-expect-error Internal Undici property.\n duplex: canRequestHaveBody ? \"half\" : undefined,\n body: canRequestHaveBody ? Readable.toWeb(req) : undefined\n });\n await msw.handleRequest(mockRequest, crypto.randomUUID(), handlers, {\n onUnhandledRequest: \"bypass\"\n }, emitter, {\n resolutionContext: {\n baseUrl\n },\n // eslint-disable-next-line @typescript-eslint/require-await\n async onMockedResponse(mockedResponse) {\n const {\n status,\n statusText,\n headers\n } = mockedResponse;\n res.statusCode = status;\n res.statusMessage = statusText;\n headers.forEach((value, name) => {\n res.appendHeader(name, value);\n });\n if (mockedResponse.body) {\n // @ts-expect-error Types don't match exactly\n const stream = Readable.fromWeb(mockedResponse.body);\n stream.pipe(res);\n } else {\n res.end();\n }\n },\n onPassthroughResponse() {\n next();\n }\n });\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport EventEmitter from \"node:events\";\nimport * as fs from \"node:fs\";\nimport * as util from \"node:util\";\nimport { applyOntologyAndSeed } from \"./applyOntologyAndSeed.js\";\nimport { generateOntologyAssets } from \"./generateOntologyAssets.js\";\nimport { OacServerContext } from \"./OacServerContext.js\";\nimport { routeConnectToMsw } from \"./routeConnectToMsw.js\";\nexport class OacDevServer extends OacServerContext {\n constructor(config, server) {\n super(config, server);\n\n // create one up front so its never null\n this.foundry = this.fauxFoundryFactory();\n this.emitter.on(\"generatedOntologyAssets\", async () => {\n this.foundry = this.fauxFoundryFactory();\n await applyOntologyAndSeed(this.foundry, this);\n server.hot.send({\n type: \"full-reload\"\n });\n });\n server.middlewares.use(this.#connectMiddleware);\n }\n #connectMiddleware = async (req, res, next) => {\n const mswEmitter = new EventEmitter();\n return void (await routeConnectToMsw(this.serverUrl, this.foundry.handlers, mswEmitter, req, res, next));\n };\n watchOntologyAsCode = async () => {\n const {\n ontologyDir,\n watcher\n } = this;\n this.logger.info(`Starting OAC file watcher for ${ontologyDir}`);\n if (!fs.existsSync(ontologyDir)) {\n fs.mkdirSync(ontologyDir, {\n recursive: true\n });\n }\n watcher.add(ontologyDir);\n\n // Add event listeners\n watcher.on(\"add\", this.#handleOacFileChanged).on(\"change\", this.#handleOacFileChanged).on(\"unlink\", this.#handleOacFileChanged);\n\n // invoke the handler at startup\n await this.#handleOacFileChanged(undefined);\n return;\n };\n #handleOacFileChanged = async filePath => {\n if (filePath && !filePath.startsWith(`${this.ontologyDir}/`)) {\n return;\n }\n if (filePath) {\n this.logger.info(`File ${filePath} changed.`);\n }\n try {\n await fs.promises.mkdir(this.workDir, {\n recursive: true\n });\n await generateOntologyAssets(this);\n await this.emitter.emit(\"generatedOntologyAssets\");\n } catch (error) {\n this.logger.error(`Error generating ontology assets: ${util.inspect(error)}`);\n }\n };\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nimport { generateOntologyAssets } from \"./generateOntologyAssets.js\";\nimport { OacContext } from \"./OacContext.js\";\nimport { OacDevServer } from \"./OacDevServer.js\";\n\n/**\n * Vite plugin for Ontology as Code (OAC) that generates ontology IR, metadata, and OSDK\n * in both development and build modes.\n */\nexport function ontologyAsCode(oacConfig) {\n let viteConfig;\n return {\n name: \"oac-vite-plugin\",\n configResolved(resolvedConfig) {\n viteConfig = resolvedConfig;\n },\n async configureServer(server) {\n const oacDevServer = new OacDevServer(oacConfig, server);\n\n // We await here so we get a full ontology compile and seed before the webserver starts\n await oacDevServer.watchOntologyAsCode();\n },\n async buildStart() {\n const ctx = new OacContext(oacConfig, viteConfig);\n // Generate ontology assets during build\n if (viteConfig.command === \"build\") {\n ctx.logger.info(\"Generating ontology assets for build...\");\n try {\n await fs.promises.mkdir(ctx.workDir, {\n recursive: true\n });\n await generateOntologyAssets(ctx);\n ctx.logger.info(\"Successfully generated ontology assets for build\");\n } catch (error) {\n ctx.logger.error(`Failed to generate ontology assets: ${error instanceof Error ? error.message : String(error)}`);\n throw error;\n }\n }\n }\n };\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/OacConfig.ts","../../src/syncDirectories.ts","../../src/generateOntologyAssets.ts","../../src/Logger.ts","../../src/OacContext.ts","../../src/applySeed.ts","../../src/registerOntologyFullMetadata.ts","../../src/utils/readJsonFile.ts","../../src/applyOntologyAndSeed.ts","../../src/OacServerContext.ts","../../src/routeConnectToMsw.ts","../../src/OacDevServer.ts","../../src/ontologyAsCode.ts"],"names":["fs","path","crypto","fs2","path2","execa","OntologyIrToFullMetadataConverter","inspect","Level","chalk","path3","FauxFoundry","jiti","createJiti","invariant","fs3","path4","Emittery","Readable","msw","stream","EventEmitter","fs4","util","fs5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,IAAM,YAAN,MAAgB;AAAA,EACrB,YAAY,MAAQ,EAAA;AAClB,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,MAAM,CAAA;AAAA;AAE9B;ACEA,eAAsB,eAAA,CAAgB,SAAW,EAAA,SAAA,EAAW,MAAQ,EAAA;AAClE,EAAA,MAAA,CAAO,KAAM,C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A;AACxC,EAAI,IAAA,UAAA;AACJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,iBAAA;AAAA,IACN,eAAe,cAAgB,EAAA;AAC7B,MAAa,UAAA,GAAA,cAAA;AAAA,KACf;AAAA,IACA,MAAM,gBAAgB,MAAQ,EAAA;AAC5B,MAAA,MAAM,YAAe,GAAA,IAAI,YAAa,CAAA,SAAA,EAAW,MAAM,CAAA;AAGvD,MAAA,MAAM,aAAa,mBAAoB,EAAA;AAAA,KACzC;AAAA,IACA,MAAM,UAAa,GAAA;AACjB,MAAA,MAAM,GAAM,GAAA,IAAI,UAAW,CAAA,SAAA,EAAW,UAAU,CAAA;AAEhD,MAAI,IAAA,UAAA,CAAW,YAAY,OAAS,EAAA;AAClC,QAAI,GAAA,CAAA,MAAA,CAAO,KAAK,yCAAyC,CAAA;AACzD,QAAI,IAAA;AACF,UAAS,MAAAC,aAAA,CAAA,QAAA,CAAS,KAAM,CAAA,GAAA,CAAI,OAAS,EAAA;AAAA,YACnC,SAAW,EAAA;AAAA,WACZ,CAAA;AACD,UAAA,MAAM,uBAAuB,GAAG,CAAA;AAChC,UAAI,GAAA,CAAA,MAAA,CAAO,KAAK,kDAAkD,CAAA;AAAA,iBAC3D,KAAO,EAAA;AACd,UAAI,GAAA,CAAA,MAAA,CAAO,KAAM,CAAA,CAAA,oCAAA,EAAuC,KAAiB,YAAA,KAAA,GAAQ,MAAM,OAAU,GAAA,MAAA,CAAO,KAAK,CAAC,CAAE,CAAA,CAAA;AAChH,UAAM,MAAA,KAAA;AAAA;AACR;AACF;AACF,GACF;AACF","file":"index.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class OacConfig {\n constructor(config) {\n Object.assign(this, config);\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n/**\n * Synchronize directories by copying only changed files and removing obsolete ones\n */\nexport async function syncDirectories(sourceDir, targetDir, logger) {\n logger.debug(`Synchronizing ${sourceDir} to ${targetDir}`);\n\n // Ensure target directory exists\n await fs.promises.mkdir(targetDir, {\n recursive: true\n });\n\n // Get all files in both directories\n const [sourceFiles, targetFiles] = await Promise.all([getAllFiles(sourceDir), getAllFiles(targetDir)]);\n let updatedCount = 0;\n let addedCount = 0;\n let removedCount = 0;\n let unchangedCount = 0;\n const errors = [];\n\n // Process files from source directory\n for (const relativeFile of sourceFiles) {\n const sourceFile = path.join(sourceDir, relativeFile);\n const targetFile = path.join(targetDir, relativeFile);\n try {\n const targetExists = targetFiles.includes(relativeFile);\n const isDifferent = await areFilesDifferent(sourceFile, targetFile);\n if (!targetExists) {\n // New file - need to create directory structure\n await fs.promises.mkdir(path.dirname(targetFile), {\n recursive: true\n });\n await fs.promises.copyFile(sourceFile, targetFile);\n addedCount++;\n logger.debug(`Added: ${relativeFile}`);\n } else if (isDifferent) {\n // Changed file - update it\n await fs.promises.copyFile(sourceFile, targetFile);\n updatedCount++;\n logger.debug(`Updated: ${targetFile}`);\n } else {\n // File is unchanged\n unchangedCount++;\n }\n } catch (error) {\n const errorMsg = `Failed to sync ${relativeFile}: ${error instanceof Error ? error.message : String(error)}`;\n errors.push(errorMsg);\n logger.error(errorMsg);\n }\n }\n\n // Remove files that exist in target but not in source\n for (const relativeFile of targetFiles) {\n if (!sourceFiles.includes(relativeFile)) {\n const targetFile = path.join(targetDir, relativeFile);\n try {\n await fs.promises.unlink(targetFile);\n removedCount++;\n logger.debug(`Removed: ${relativeFile}`);\n } catch (error) {\n const errorMsg = `Failed to remove ${relativeFile}: ${error instanceof Error ? error.message : String(error)}`;\n errors.push(errorMsg);\n logger.error(errorMsg);\n }\n }\n }\n\n // Clean up empty directories in target\n try {\n await removeEmptyDirectories(targetDir);\n } catch (error) {\n logger.warn(`Failed to clean up empty directories: ${error instanceof Error ? error.message : String(error)}`);\n }\n\n // Log summary\n logger.debug(`Sync complete: ${addedCount} added, ${updatedCount} updated, ${removedCount} removed, ${unchangedCount} unchanged`);\n if (errors.length > 0) {\n logger.warn(`Encountered ${errors.length} errors during sync`);\n }\n}\n\n/**\n * Remove empty directories recursively\n */\nasync function removeEmptyDirectories(dir) {\n try {\n const entries = await fs.promises.readdir(dir, {\n withFileTypes: true\n });\n\n // First, recursively clean subdirectories\n for (const entry of entries) {\n if (entry.isDirectory()) {\n const subdir = path.join(dir, entry.name);\n await removeEmptyDirectories(subdir);\n }\n }\n\n // Then check if this directory is now empty\n const remainingEntries = await fs.promises.readdir(dir);\n if (remainingEntries.length === 0) {\n // Don't remove the root target directory itself\n const targetDir = \".osdk/src\";\n if (path.resolve(dir) !== path.resolve(targetDir)) {\n await fs.promises.rmdir(dir);\n }\n }\n } catch (error) {\n // Ignore errors when cleaning up directories\n }\n}\n\n/**\n * Calculate SHA-256 hash of a file's contents\n */\nasync function getFileHash(filePath) {\n try {\n const content = await fs.promises.readFile(filePath);\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n } catch (error) {\n // Return empty hash for non-existent files\n return \"\";\n }\n}\n\n/**\n * Check if two files are different by comparing their hashes\n */\nasync function areFilesDifferent(sourceFile, targetFile) {\n try {\n const [sourceHash, targetHash] = await Promise.all([getFileHash(sourceFile), getFileHash(targetFile)]);\n return sourceHash !== targetHash || sourceHash === \"\"; // Different if hashes differ or source doesn't exist\n } catch (error) {\n // If we can't compare, assume they're different to be safe\n return true;\n }\n}\n\n/**\n * Recursively get all files in a directory\n */\nasync function getAllFiles(dir, baseDir = dir) {\n const files = [];\n try {\n const entries = await fs.promises.readdir(dir, {\n withFileTypes: true\n });\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativePath = path.relative(baseDir, fullPath);\n if (entry.isDirectory()) {\n const subFiles = await getAllFiles(fullPath, baseDir);\n files.push(...subFiles);\n } else if (entry.isFile()) {\n files.push(relativePath);\n }\n }\n } catch (error) {\n // Directory doesn't exist or can't be read\n }\n return files;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyIrToFullMetadataConverter } from \"@osdk/generator-converters.ontologyir\";\nimport { execa } from \"execa\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { inspect } from \"node:util\";\nimport { syncDirectories } from \"./syncDirectories.js\";\n\n/**\n * Generate all ontology assets: IR, full metadata, and OSDK.\n * This function contains the core generation logic extracted from watchOntologyAsCode\n * so it can be used both in dev mode (via file watching) and build mode.\n */\nexport async function generateOntologyAssets(opts) {\n const {\n ontologyDir,\n logger\n } = opts;\n await fs.promises.mkdir(opts.workDir, {\n recursive: true\n });\n\n // Ensure the ontology directory exists\n if (!fs.existsSync(ontologyDir)) {\n fs.mkdirSync(ontologyDir, {\n recursive: true\n });\n logger.info(\"Created .ontology directory\");\n }\n\n // Generate the assets in sequence\n await ontologyJsToIr(opts);\n await ontologyIrToFullMetadata(opts);\n await fullMetadataToOsdk(opts);\n}\nexport function ontologyIrPath(workDir) {\n return path.join(workDir, \".ontology.ir.json\");\n}\nexport function ontologyFullMetadataPath(workDir) {\n return path.join(workDir, \".ontology.json\");\n}\n\n/**\n * Convert ontology.mjs to IR format using the maker tool\n */\nasync function ontologyJsToIr({\n logger,\n ontologyDir,\n workDir\n}) {\n logger.debug(\"Generating Ontology IR\");\n const {\n stdout,\n stderr,\n exitCode\n } = await execa(\"pnpm\", [\"exec\", \"maker\", \"-i\", `${ontologyDir}/ontology.mts`, \"-o\", ontologyIrPath(workDir)]);\n if (exitCode !== 0) {\n logger.error(`Ontology IR generation failed with exit code ${exitCode}`);\n if (stderr) {\n logger.error(`Command stderr: ${stderr}`);\n }\n throw new Error(`Failed to generate ontology IR: exit code ${exitCode}`);\n }\n\n // Log stdout for debugging if needed\n if (stdout) {\n logger.debug(`Ontology IR generation output: ${stdout}`);\n }\n}\n\n/**\n * Convert IR to full metadata format\n */\nasync function ontologyIrToFullMetadata({\n logger,\n workDir\n}) {\n logger.debug(\"Converting IR to Full metadata\");\n try {\n const irContent = await fs.promises.readFile(ontologyIrPath(workDir), {\n encoding: \"utf-8\"\n });\n const blockData = JSON.parse(irContent).blockData;\n const fullMeta = OntologyIrToFullMetadataConverter.getFullMetadataFromIr(blockData);\n await fs.promises.writeFile(ontologyFullMetadataPath(workDir), JSON.stringify(fullMeta, null, 2));\n logger.debug(\"Successfully converted IR to full metadata\");\n } catch (error) {\n logger.error(`Failed to convert IR to full metadata: ${inspect(error)}`);\n throw error;\n }\n}\n\n/**\n * Generate OSDK from full metadata\n */\nasync function fullMetadataToOsdk({\n logger,\n workDir\n}) {\n logger.debug(\"Generating OSDK from full metadata\");\n\n // First create a clean temporary directory to generate the SDK into\n const tempDir = path.join(workDir, \".osdkGenerationTmp\", \"src\");\n await fs.promises.rm(tempDir, {\n recursive: true,\n force: true\n });\n await fs.promises.mkdir(tempDir, {\n recursive: true\n });\n\n // The osdk cli currently mutes package.json files which we don't want in this case\n // so we give it a fake package.json file\n await fs.promises.writeFile(path.join(tempDir, \"..\", \"package.json\"), JSON.stringify({}, null, 2), {\n encoding: \"utf-8\"\n });\n try {\n // Then generate the source code for the osdk\n const tempSrcDir = path.join(tempDir, \"src\");\n const {\n stdout,\n stderr,\n exitCode\n } = await execa(\"pnpm\", [\"exec\", \"osdk\", \"unstable\", \"typescript\", \"generate\", \"--outDir\", tempSrcDir, \"--ontologyPath\", ontologyFullMetadataPath(workDir), \"--beta\", \"true\", \"--packageType\", \"module\", \"--version\", \"dev\"]);\n logger.debug(`OSDK generation output: ${stdout}`);\n if (stderr) {\n logger.error(`OSDK generation stderr: ${stderr}`);\n }\n\n // Then if it was successful, synchronize the generated code with the target directory\n if (exitCode === 0) {\n // TODO we should just generate this whole thing into the work dir?\n const targetDir = \".osdk/src\";\n try {\n logger.debug(\"OSDK generation successful, synchronizing with target directory\");\n\n // Use granular synchronization instead of wholesale replacement\n await syncDirectories(tempSrcDir, targetDir, logger);\n logger.debug(`Successfully synchronized ${targetDir} with newly generated code`);\n await compileOsdk(logger);\n\n // Clean up temporary directory after successful sync\n await fs.promises.rm(tempDir, {\n recursive: true,\n force: true\n });\n } catch (error) {\n logger.error(`Failed to synchronize ${targetDir} directory: ${inspect(error)}`);\n logger.error(`Temporary files left at: ${tempDir}`);\n throw error;\n }\n } else {\n logger.error(`OSDK generation failed with exit code ${exitCode}`);\n logger.error(`Temporary files left at: ${tempDir}`);\n throw new Error(`OSDK generation failed with exit code ${exitCode}`);\n }\n } catch (error) {\n // Make sure to clean up temp directory even if there's an error\n try {\n await fs.promises.rm(tempDir, {\n recursive: true,\n force: true\n });\n } catch (cleanupError) {\n logger.warn(`Failed to clean up temporary directory: ${inspect(cleanupError)}`);\n }\n throw error;\n }\n}\nasync function compileOsdk(logger) {\n const {\n stdout,\n stderr,\n exitCode\n } = await execa(\"pnpm\", [\"exec\", \"tsc\"], {\n cwd: \".osdk\"\n });\n logger.debug(`OSDK generation output: ${stdout}`);\n if (stderr) {\n logger.error(`OSDK generation stderr: ${stderr}`);\n }\n return exitCode;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from \"chalk\";\nexport let Level = /*#__PURE__*/function (Level) {\n Level[Level[\"debug\"] = 0] = \"debug\";\n Level[Level[\"info\"] = 1] = \"info\";\n Level[Level[\"warn\"] = 2] = \"warn\";\n Level[Level[\"error\"] = 3] = \"error\";\n return Level;\n}({});\nexport class Logger {\n #level;\n #viteLogger;\n constructor({\n level,\n viteLogger\n }) {\n this.#level = typeof level === \"string\" ? Level[level] : level;\n this.#viteLogger = viteLogger;\n }\n debug(message) {\n if (this.#level <= Level.debug) {\n this.#viteLogger.info(`${chalk.cyan(\"[osdk]\")} ${chalk.gray(`DEBUG: ${message}`)}`, {\n timestamp: true\n });\n }\n }\n info(message) {\n if (this.#level <= Level.info) {\n this.#viteLogger.info(`${chalk.cyan(\"[osdk]\")} ${message}`, {\n timestamp: true\n });\n }\n }\n error(message) {\n if (this.#level <= Level.error) {\n this.#viteLogger.error(`${chalk.cyan(\"[osdk]\")} ${chalk.red(message)}`, {\n timestamp: true\n });\n }\n }\n warn(message) {\n if (this.#level <= Level.warn) {\n this.#viteLogger.warn(`${chalk.cyan(\"[osdk]\")} ${chalk.yellow(message)}`, {\n timestamp: true\n });\n }\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FauxFoundry } from \"@osdk/faux\";\nimport * as path from \"node:path\";\nimport { Level as LoggerLevel, Logger } from \"./Logger.js\";\nimport { OacConfig } from \"./OacConfig.js\";\nexport class OacContext extends OacConfig {\n constructor(config, resolvedConfig) {\n super(config);\n this.serverUrl = `http${resolvedConfig.server.https ? \"s\" : \"\"}://localhost:${resolvedConfig.server.port}`;\n this.defaultOntologyRid = `ri.ontology.main.ontology.00000000-0000-0000-0000-000000000000`;\n this.workDir = path.join(\"node_modules\", \".osdk\", \".oac\");\n this.logger = new Logger({\n level: config.loggerLevel ?? LoggerLevel.info,\n viteLogger: resolvedConfig.logger\n });\n this.workDir = path.join(\"node_modules\", \".osdk\", \".oac\");\n }\n fauxFoundryFactory = () => {\n return new FauxFoundry(this.serverUrl, {\n apiName: \"DefaultOntology\",\n description: \"Description\",\n displayName: \"Ontology\",\n rid: this.defaultOntologyRid\n });\n };\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createJiti } from \"jiti\";\nexport async function applySeed(fauxFoundry, seedPath) {\n const jiti = createJiti(import.meta.filename, {\n moduleCache: false,\n debug: false,\n importMeta: import.meta\n });\n const module = await jiti.import(seedPath);\n module.default(fauxFoundry);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { inspect } from \"node:util\";\nimport invariant from \"tiny-invariant\";\ninspect.defaultOptions = {\n colors: true,\n depth: Infinity\n};\nexport function registerOntologyFullMetadata(ontology, ontologyFullMetadata) {\n // Register object types\n Object.values(ontologyFullMetadata.objectTypes).forEach(objectType => {\n ontology.registerObjectType(objectType);\n });\n // Register action types with implementations\n Object.values(ontologyFullMetadata.actionTypes).forEach(actionType => {\n const implementation = createActionImplementation(actionType, ontologyFullMetadata);\n const actionTypeWithCamelCaseApiName = {\n ...actionType,\n apiName: camelcase(actionType.apiName)\n };\n ontology.registerActionType(actionTypeWithCamelCaseApiName, implementation);\n });\n Object.values(ontologyFullMetadata.sharedPropertyTypes).forEach(actionType => {\n ontology.registerSharedPropertyType(actionType);\n });\n Object.values(ontologyFullMetadata.queryTypes).forEach(query => {\n ontology.registerQueryType(query);\n });\n Object.values(ontologyFullMetadata.interfaceTypes).forEach(iface => {\n ontology.registerInterfaceType(iface);\n });\n}\n\n// NOTE: The ontology full metadata is not sufficient for doing this properly.\n\n/**\n * Creates a fake implementation for an action type based on its operations\n */\nfunction createActionImplementation(actionType, fullMetadata) {\n return (batch, payload, _ctx) => {\n // Extract parameters from payload\n const params = payload.parameters;\n\n // Handle different operation types\n for (const operation of actionType.operations) {\n switch (operation.type) {\n case \"createObject\":\n {\n // Handle create object operation\n const objectType = getObjectTypeForOperation(operation, fullMetadata);\n\n // we don't store the PK with the other properties\n const primaryKeyProp = objectType.objectType.primaryKey;\n const primaryKey = extractAndDelete(params, primaryKeyProp);\n\n // Create object data from parameters\n const objectData = paramsToDataValues(params, actionType);\n batch.addObject(objectType.objectType.apiName, primaryKey, objectData);\n\n // TODO: this shouldn't send params but the actual object!\n handleObjectLinks(batch, fullMetadata, objectType.objectType.apiName, primaryKey, params);\n break;\n }\n case \"modifyObject\":\n {\n // Handle modify object operation\n const {\n objectType\n } = getObjectTypeForOperation(operation, fullMetadata);\n const primaryKey = extractAndDelete(params, \"objectToModifyParameter\");\n const targetObject = batch.getObject(objectType.apiName, primaryKey);\n !targetObject ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Could not find object ${objectType.apiName} with PK ${primaryKey}`) : invariant(false) : void 0;\n if (objectType.primaryKey in params) {\n // TODO Is this true? Or are you allowed to change the PK value?\n !(params[objectType.primaryKey] === primaryKey) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `If the primary key is provided, it must match the 'objectToModifyParameter'`) : invariant(false) : void 0;\n // delete the key since we don't store it directly on the object\n delete params[objectType.primaryKey];\n }\n const objectData = paramsToDataValues(params, actionType);\n batch.modifyObject(objectType.apiName, primaryKey, objectData);\n\n // TODO: this shouldn't send params but the actual object!\n handleObjectLinks(batch, fullMetadata, objectType.apiName, primaryKey, params);\n break;\n }\n case \"deleteObject\":\n {\n const {\n objectType\n } = getObjectTypeForOperation(operation, fullMetadata);\n const primaryKey = extractAndDelete(params, \"objectToDeleteParameter\");\n\n // Handle delete object operation\n batch.deleteObject(objectType.apiName, primaryKey);\n break;\n }\n case \"createLink\":\n {\n // Handle create link operation\n const aSideObjectTypeApiName = operation.aSideObjectTypeApiName;\n const bSideObjectTypeApiName = operation.bSideObjectTypeApiName;\n const linkTypeApiNameAtoB = operation.linkTypeApiNameAtoB;\n\n // For simplicity, assume we have the primary keys in the parameters\n // In a real implementation, we would need to extract them from the parameters\n const aSidePrimaryKey = params.aSidePrimaryKey || params.primaryKey_;\n const bSidePrimaryKey = params.bSidePrimaryKey || params.linkedObjectPrimaryKey;\n if (aSidePrimaryKey && bSidePrimaryKey) {\n batch.addLink(aSideObjectTypeApiName, aSidePrimaryKey, linkTypeApiNameAtoB, bSideObjectTypeApiName, bSidePrimaryKey);\n }\n break;\n }\n case \"deleteLink\":\n {\n // Handle delete link operation\n const aSideObjectTypeApiName = operation.aSideObjectTypeApiName;\n const bSideObjectTypeApiName = operation.bSideObjectTypeApiName;\n const linkTypeApiNameAtoB = operation.linkTypeApiNameAtoB;\n\n // For simplicity, assume we have the primary keys in the parameters\n // In a real implementation, we would need to extract them from the parameters\n const aSidePrimaryKey = params.aSidePrimaryKey || params.primaryKey_;\n const bSidePrimaryKey = params.bSidePrimaryKey || params.linkedObjectPrimaryKey;\n if (aSidePrimaryKey && bSidePrimaryKey) {\n batch.removeLink(aSideObjectTypeApiName, aSidePrimaryKey, linkTypeApiNameAtoB, bSideObjectTypeApiName, bSidePrimaryKey);\n }\n break;\n }\n\n // Handle other operation types as needed\n case \"createInterfaceObject\":\n case \"modifyInterfaceObject\":\n case \"deleteInterfaceObject\":\n // These operations are not implemented for now\n throw new Error(`Operation type ${operation.type} not implemented yet`);\n break;\n default:\n throw new Error(`Unknown operation type: ${operation.type}`);\n }\n }\n };\n}\nfunction extractAndDelete(obj, key) {\n const value = obj[key];\n delete obj[key];\n return value;\n}\nfunction getObjectTypeForOperation(operation, fullMetadata) {\n const objectTypeApiName = operation.objectTypeApiName;\n const objectType = fullMetadata.objectTypes[objectTypeApiName];\n !objectType ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n return objectType;\n}\nfunction paramsToDataValues(params, actionType) {\n const objectData = {};\n for (const [key, value] of Object.entries(params)) {\n objectData[key] = toDataValue(value, actionType.parameters[key]);\n }\n return objectData;\n}\nfunction camelcase(apiName) {\n return apiName.toLowerCase().replace(/[-_]+(.)?/g, (_, chr) => chr ? chr.toUpperCase() : \"\");\n}\nfunction toDataValue(value, param) {\n if (param.dataType.type === \"geohash\" && typeof value === \"string\") {\n return latLonStringToGeoJSON(value);\n }\n return value;\n}\nfunction latLonStringToGeoJSON(latLonStr) {\n // Split the string by comma and parse as floats\n const [lat, lon] = latLonStr.split(\",\").map(Number);\n\n // Basic validation\n if (isNaN(lat) || isNaN(lon) || lat < -90 || lat > 90 || lon < -180 || lon > 180) {\n throw new Error(\"Invalid latitude or longitude\");\n }\n\n // Return GeoJSON Point\n return {\n type: \"Point\",\n coordinates: [lon, lat] // GeoJSON uses [longitude, latitude]\n };\n}\n\n/**\n * Handles linking objects based on parameter values and existing objects\n */\nfunction handleObjectLinks(batch, fullMetadata, objectTypeApiName, primaryKey, params) {\n // HACK HACK HACK\n fullMetadata.objectTypes[objectTypeApiName].linkTypes.forEach(link => {\n const cardinality = link.cardinality;\n if (cardinality === \"ONE\") {\n // This means its a one to many and we are on the one side of the link\n for (const foreignObject of batch.getObjects(link.objectTypeApiName)) {\n if (anyValueMatches(params, foreignObject.__primaryKey)) {\n batch.addLink(objectTypeApiName, primaryKey, link.apiName, link.objectTypeApiName, foreignObject.__primaryKey);\n }\n }\n } else {\n // This means its a one to many and we are on the many side of the link\n for (const foreignObject of batch.getObjects(link.objectTypeApiName)) {\n if (anyValueMatches(foreignObject, primaryKey)) {\n batch.addLink(objectTypeApiName, primaryKey, link.apiName, link.objectTypeApiName, foreignObject.__primaryKey);\n }\n }\n }\n });\n}\nfunction anyValueMatches(obj, primaryKey) {\n return Object.values(obj).some(val => val === primaryKey);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nexport function readJsonFile(arg0) {\n const content = fs.readFileSync(arg0, \"utf-8\");\n return JSON.parse(content);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as path from \"node:path\";\nimport { inspect } from \"node:util\";\nimport { applySeed } from \"./applySeed.js\";\nimport { ontologyFullMetadataPath } from \"./generateOntologyAssets.js\";\nimport { registerOntologyFullMetadata } from \"./registerOntologyFullMetadata.js\";\nimport { readJsonFile } from \"./utils/readJsonFile.js\";\nexport async function applyOntologyAndSeed(fauxFoundry, ctx) {\n const ontology = fauxFoundry.getDefaultOntology();\n const ontologyFullMetadata = readJsonFile(ontologyFullMetadataPath(ctx.workDir));\n registerOntologyFullMetadata(ontology, ontologyFullMetadata);\n try {\n if (ctx.hooks?.preSeed) {\n ctx.logger.debug(\"calling preSeed hook\");\n }\n await ctx.hooks?.preSeed?.(ontology);\n } catch (e) {\n ctx.logger.error(`Unhandled error from preSeed hook. Ignoring and continuing. ${inspect(e)}`);\n }\n ctx.logger.debug(\"applying seed data\");\n await applySeed(fauxFoundry, path.resolve(ctx.ontologyDir, \"seed.ts\"));\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Emittery from \"emittery\";\nimport { OacContext } from \"./OacContext.js\";\nexport class OacServerContext extends OacContext {\n constructor(config, server) {\n super(config, server.config);\n this.watcher = server.watcher;\n this.emitter = new Emittery();\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { msw } from \"@osdk/faux\";\nimport { Readable } from \"stream\";\nexport async function routeConnectToMsw(baseUrl, handlers, emitter, req, res, next) {\n const method = req.method ?? \"GET\";\n const canRequestHaveBody = method !== \"HEAD\" && method !== \"GET\";\n const mockRequest = new Request(new URL(req.url, baseUrl), {\n method,\n headers: new Headers(req.headers),\n credentials: \"omit\",\n // @ts-expect-error Internal Undici property.\n duplex: canRequestHaveBody ? \"half\" : undefined,\n body: canRequestHaveBody ? Readable.toWeb(req) : undefined\n });\n await msw.handleRequest(mockRequest, crypto.randomUUID(), handlers, {\n onUnhandledRequest: \"bypass\"\n }, emitter, {\n resolutionContext: {\n baseUrl\n },\n // eslint-disable-next-line @typescript-eslint/require-await\n async onMockedResponse(mockedResponse) {\n const {\n status,\n statusText,\n headers\n } = mockedResponse;\n res.statusCode = status;\n res.statusMessage = statusText;\n headers.forEach((value, name) => {\n res.appendHeader(name, value);\n });\n if (mockedResponse.body) {\n // @ts-expect-error Types don't match exactly\n const stream = Readable.fromWeb(mockedResponse.body);\n stream.pipe(res);\n } else {\n res.end();\n }\n },\n onPassthroughResponse() {\n next();\n }\n });\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport EventEmitter from \"node:events\";\nimport * as fs from \"node:fs\";\nimport * as util from \"node:util\";\nimport { applyOntologyAndSeed } from \"./applyOntologyAndSeed.js\";\nimport { generateOntologyAssets } from \"./generateOntologyAssets.js\";\nimport { OacServerContext } from \"./OacServerContext.js\";\nimport { routeConnectToMsw } from \"./routeConnectToMsw.js\";\nexport class OacDevServer extends OacServerContext {\n constructor(config, server) {\n super(config, server);\n\n // create one up front so its never null\n this.foundry = this.fauxFoundryFactory();\n this.emitter.on(\"generatedOntologyAssets\", async () => {\n this.foundry = this.fauxFoundryFactory();\n await applyOntologyAndSeed(this.foundry, this);\n server.hot.send({\n type: \"full-reload\"\n });\n });\n server.middlewares.use(this.#connectMiddleware);\n }\n #connectMiddleware = async (req, res, next) => {\n const mswEmitter = new EventEmitter();\n return void (await routeConnectToMsw(this.serverUrl, this.foundry.handlers, mswEmitter, req, res, next));\n };\n watchOntologyAsCode = async () => {\n const {\n ontologyDir,\n watcher\n } = this;\n this.logger.info(`Starting OAC file watcher for ${ontologyDir}`);\n if (!fs.existsSync(ontologyDir)) {\n fs.mkdirSync(ontologyDir, {\n recursive: true\n });\n }\n watcher.add(ontologyDir);\n\n // Add event listeners\n watcher.on(\"add\", this.#handleOacFileChanged).on(\"change\", this.#handleOacFileChanged).on(\"unlink\", this.#handleOacFileChanged);\n\n // invoke the handler at startup\n await this.#handleOacFileChanged(undefined);\n return;\n };\n #handleOacFileChanged = async filePath => {\n if (filePath && !filePath.startsWith(`${this.ontologyDir}/`)) {\n return;\n }\n if (filePath) {\n this.logger.info(`File ${filePath} changed.`);\n }\n try {\n await fs.promises.mkdir(this.workDir, {\n recursive: true\n });\n await generateOntologyAssets(this);\n await this.emitter.emit(\"generatedOntologyAssets\");\n } catch (error) {\n this.logger.error(`Error generating ontology assets: ${util.inspect(error)}`);\n }\n };\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nimport { generateOntologyAssets } from \"./generateOntologyAssets.js\";\nimport { OacContext } from \"./OacContext.js\";\nimport { OacDevServer } from \"./OacDevServer.js\";\n\n/**\n * Vite plugin for Ontology as Code (OAC) that generates ontology IR, metadata, and OSDK\n * in both development and build modes.\n */\nexport function ontologyAsCode(oacConfig) {\n let viteConfig;\n return {\n name: \"oac-vite-plugin\",\n configResolved(resolvedConfig) {\n viteConfig = resolvedConfig;\n },\n async configureServer(server) {\n const oacDevServer = new OacDevServer(oacConfig, server);\n\n // We await here so we get a full ontology compile and seed before the webserver starts\n await oacDevServer.watchOntologyAsCode();\n },\n async buildStart() {\n const ctx = new OacContext(oacConfig, viteConfig);\n // Generate ontology assets during build\n if (viteConfig.command === \"build\") {\n ctx.logger.info(\"Generating ontology assets for build...\");\n try {\n await fs.promises.mkdir(ctx.workDir, {\n recursive: true\n });\n await generateOntologyAssets(ctx);\n ctx.logger.info(\"Successfully generated ontology assets for build\");\n } catch (error) {\n ctx.logger.error(`Failed to generate ontology assets: ${error instanceof Error ? error.message : String(error)}`);\n throw error;\n }\n }\n }\n };\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/vite-plugin-oac",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,25 +28,25 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@osdk/foundry.ontologies": "^2.30.0",
|
|
31
|
-
"chalk": "^5.
|
|
31
|
+
"chalk": "^5.6.2",
|
|
32
32
|
"emittery": "^1.2.0",
|
|
33
33
|
"execa": "^9.6.0",
|
|
34
34
|
"express": "^5.1.0",
|
|
35
|
-
"jiti": "^2.
|
|
35
|
+
"jiti": "^2.5.1",
|
|
36
36
|
"tiny-invariant": "^1.3.3",
|
|
37
|
-
"@osdk/api": "2.5.0-beta.
|
|
37
|
+
"@osdk/api": "2.5.0-beta.5",
|
|
38
38
|
"@osdk/cli": "0.29.0-beta.4",
|
|
39
|
-
"@osdk/client.unstable": "2.5.0-beta.
|
|
40
|
-
"@osdk/
|
|
41
|
-
"@osdk/
|
|
42
|
-
"@osdk/
|
|
39
|
+
"@osdk/client.unstable": "2.5.0-beta.5",
|
|
40
|
+
"@osdk/generator-converters.ontologyir": "2.5.0-beta.5",
|
|
41
|
+
"@osdk/faux": "0.3.0-beta.5",
|
|
42
|
+
"@osdk/maker": "0.13.0-beta.4"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@osdk/maker": "*",
|
|
46
46
|
"vite": "*"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "^20.19.
|
|
49
|
+
"@types/node": "^20.19.13",
|
|
50
50
|
"typescript": "~5.5.4",
|
|
51
51
|
"@osdk/monorepo.api-extractor": "~0.4.0-beta.1",
|
|
52
52
|
"@osdk/monorepo.tsconfig": "~0.4.0-beta.1"
|