@microsoft/m365-spec-parser 0.2.7-alpha.d8fe55aa3.0 → 0.2.7-alpha.e3f6ce706.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.
@@ -7,7 +7,7 @@ var converter = require('swagger2openapi');
7
7
  var jsyaml = require('js-yaml');
8
8
  var fs = require('fs-extra');
9
9
  var path = require('path');
10
- var teamsManifest = require('@microsoft/teams-manifest');
10
+ var appManifest = require('@microsoft/app-manifest');
11
11
  var crypto = require('crypto');
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -100,7 +100,6 @@ exports.WarningType = void 0;
100
100
  WarningType["GenerateCardFailed"] = "generate-card-failed";
101
101
  WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
102
102
  WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
103
- WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
104
103
  WarningType["OperationIdContainsSpecialCharacters"] = "operationid-contains-special-characters";
105
104
  WarningType["UnsupportedAuthType"] = "unsupported-auth-type";
106
105
  WarningType["GenerateJsonDataFailed"] = "generate-json-data-failed";
@@ -247,7 +246,7 @@ class Utils {
247
246
  return Object.keys((bodyObject === null || bodyObject === void 0 ? void 0 : bodyObject.content) || {}).length > 1;
248
247
  }
249
248
  static isBearerTokenAuth(authScheme) {
250
- return authScheme.type === "http" && authScheme.scheme === "bearer";
249
+ return authScheme.type === "http" && authScheme.scheme.toLowerCase() === "bearer";
251
250
  }
252
251
  static isAPIKeyAuth(authScheme) {
253
252
  return authScheme.type === "apiKey";
@@ -1769,11 +1768,17 @@ function inferProperties(card) {
1769
1768
 
1770
1769
  // Copyright (c) Microsoft Corporation.
1771
1770
  class ManifestUpdater {
1771
+ static useCopilotExtensionsInSchema(manifest) {
1772
+ return __awaiter(this, void 0, void 0, function* () {
1773
+ const schema = yield appManifest.AppManifestUtils.fetchSchema(manifest.$schema);
1774
+ return !!schema.properties.copilotExtensions;
1775
+ });
1776
+ }
1772
1777
  static updateManifestWithAiPlugin(manifestPath, outputSpecPath, apiPluginFilePath, spec, options, authMap, existingPluginManifestInfo) {
1773
1778
  return __awaiter(this, void 0, void 0, function* () {
1774
1779
  const manifest = yield fs__default['default'].readJSON(manifestPath);
1775
1780
  const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath);
1776
- const useCopilotExtensionsInSchema = yield teamsManifest.ManifestUtil.useCopilotExtensionsInSchema(manifest);
1781
+ const useCopilotExtensionsInSchema = yield this.useCopilotExtensionsInSchema(manifest);
1777
1782
  if (manifest.copilotExtensions || useCopilotExtensionsInSchema) {
1778
1783
  manifest.copilotExtensions = manifest.copilotExtensions || {};
1779
1784
  if (!options.isGptPlugin) {
@@ -1844,15 +1849,7 @@ class ManifestUpdater {
1844
1849
  const safeFunctionName = operationId.replace(/[^a-zA-Z0-9]/g, "_");
1845
1850
  const description = (_a = operationItem.description) !== null && _a !== void 0 ? _a : "";
1846
1851
  const summary = operationItem.summary;
1847
- let funcDescription = operationItem.description || operationItem.summary || "";
1848
- if (funcDescription.length > ConstantString.FunctionDescriptionMaxLens) {
1849
- warnings.push({
1850
- type: exports.WarningType.FuncDescriptionTooLong,
1851
- content: Utils.format(ConstantString.FuncDescriptionTooLong, safeFunctionName, funcDescription.length.toString(), ConstantString.FunctionDescriptionMaxLens.toString()),
1852
- data: safeFunctionName,
1853
- });
1854
- funcDescription = funcDescription.slice(0, ConstantString.FunctionDescriptionMaxLens);
1855
- }
1852
+ const funcDescription = operationItem.description || operationItem.summary || "";
1856
1853
  const funcObj = {
1857
1854
  name: safeFunctionName,
1858
1855
  description: funcDescription,