@microsoft/m365-spec-parser 0.2.2-alpha.57d96b8b5.0 → 0.2.2-alpha.5d0324fcc.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.
@@ -2148,7 +2148,7 @@ class SpecParser {
2148
2148
  * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
2149
2149
  * @param pluginFilePath File path of the api plugin file to generate.
2150
2150
  */
2151
- async generateForCopilot(manifestPath, filter, outputSpecPath, pluginFilePath, signal) {
2151
+ async generateForCopilot(manifestPath, filter, outputSpecPath, pluginFilePath, existingPluginFilePath, signal) {
2152
2152
  const result = {
2153
2153
  allSuccess: true,
2154
2154
  warnings: [],
@@ -2165,7 +2165,15 @@ class SpecParser {
2165
2165
  const [updatedManifest, apiPlugin, warnings] = await ManifestUpdater.updateManifestWithAiPlugin(manifestPath, outputSpecPath, pluginFilePath, newSpec, this.options, authInfo);
2166
2166
  result.warnings.push(...warnings);
2167
2167
  await fs.outputJSON(manifestPath, updatedManifest, { spaces: 4 });
2168
- await fs.outputJSON(pluginFilePath, apiPlugin, { spaces: 4 });
2168
+ if (existingPluginFilePath) {
2169
+ const originPluginManifest = (await fs.readJSON(existingPluginFilePath));
2170
+ // TODO (kiota): refactor to avoid generate apiPlugin
2171
+ originPluginManifest.functions = apiPlugin.functions;
2172
+ await fs.outputJSON(pluginFilePath, originPluginManifest, { spaces: 4 });
2173
+ }
2174
+ else {
2175
+ await fs.outputJSON(pluginFilePath, apiPlugin, { spaces: 4 });
2176
+ }
2169
2177
  }
2170
2178
  catch (err) {
2171
2179
  if (err instanceof SpecParserError) {