@microsoft/m365-spec-parser 0.2.7-alpha.ef180c1c1.0 → 0.2.7-alpha.fdd1bfa46.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.
- package/dist/index.esm2017.js +2 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +9 -12
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +2 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +11 -12
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/adaptiveCardWrapper.d.ts +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/interfaces.d.ts +2 -2
- package/dist/src/manifestUpdater.d.ts +2 -1
- package/dist/src/utils.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.esm2017.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import converter from 'swagger2openapi';
|
|
|
3
3
|
import jsyaml from 'js-yaml';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import {
|
|
6
|
+
import { AppManifestUtils } from '@microsoft/app-manifest';
|
|
7
7
|
import { createHash } from 'crypto';
|
|
8
8
|
|
|
9
9
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -58,7 +58,7 @@ var WarningType;
|
|
|
58
58
|
WarningType["GenerateCardFailed"] = "generate-card-failed";
|
|
59
59
|
WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
|
|
60
60
|
WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
|
|
61
|
-
WarningType["
|
|
61
|
+
WarningType["OpenAPI31ConvertTo30"] = "openapi31-convert-to-30";
|
|
62
62
|
WarningType["OperationIdContainsSpecialCharacters"] = "operationid-contains-special-characters";
|
|
63
63
|
WarningType["UnsupportedAuthType"] = "unsupported-auth-type";
|
|
64
64
|
WarningType["GenerateJsonDataFailed"] = "generate-json-data-failed";
|
|
@@ -101,6 +101,7 @@ ConstantString.RelativeServerUrlNotSupported = "Server url is not correct: relat
|
|
|
101
101
|
ConstantString.ResolveServerUrlFailed = "Unable to resolve the server URL: please make sure that the environment variable %s is defined.";
|
|
102
102
|
ConstantString.OperationOnlyContainsOptionalParam = "Operation %s contains multiple optional parameters. The first optional parameter is used for this command.";
|
|
103
103
|
ConstantString.ConvertSwaggerToOpenAPI = "The Swagger 2.0 file has been converted to OpenAPI 3.0.";
|
|
104
|
+
ConstantString.OpenAPI31ConvertTo30 = "OpenAPI 3.1 document has been converted to OpenAPI 3.0.";
|
|
104
105
|
ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.";
|
|
105
106
|
ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
|
|
106
107
|
ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
|
|
@@ -1727,10 +1728,14 @@ function inferProperties(card) {
|
|
|
1727
1728
|
|
|
1728
1729
|
// Copyright (c) Microsoft Corporation.
|
|
1729
1730
|
class ManifestUpdater {
|
|
1731
|
+
static async useCopilotExtensionsInSchema(manifest) {
|
|
1732
|
+
const schema = await AppManifestUtils.fetchSchema(manifest.$schema);
|
|
1733
|
+
return !!schema.properties.copilotExtensions;
|
|
1734
|
+
}
|
|
1730
1735
|
static async updateManifestWithAiPlugin(manifestPath, outputSpecPath, apiPluginFilePath, spec, options, authMap, existingPluginManifestInfo) {
|
|
1731
1736
|
const manifest = await fs.readJSON(manifestPath);
|
|
1732
1737
|
const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath);
|
|
1733
|
-
const useCopilotExtensionsInSchema = await
|
|
1738
|
+
const useCopilotExtensionsInSchema = await this.useCopilotExtensionsInSchema(manifest);
|
|
1734
1739
|
if (manifest.copilotExtensions || useCopilotExtensionsInSchema) {
|
|
1735
1740
|
manifest.copilotExtensions = manifest.copilotExtensions || {};
|
|
1736
1741
|
if (!options.isGptPlugin) {
|
|
@@ -1799,15 +1804,7 @@ class ManifestUpdater {
|
|
|
1799
1804
|
const safeFunctionName = operationId.replace(/[^a-zA-Z0-9]/g, "_");
|
|
1800
1805
|
const description = (_a = operationItem.description) !== null && _a !== void 0 ? _a : "";
|
|
1801
1806
|
const summary = operationItem.summary;
|
|
1802
|
-
|
|
1803
|
-
if (funcDescription.length > ConstantString.FunctionDescriptionMaxLens) {
|
|
1804
|
-
warnings.push({
|
|
1805
|
-
type: WarningType.FuncDescriptionTooLong,
|
|
1806
|
-
content: Utils.format(ConstantString.FuncDescriptionTooLong, safeFunctionName, funcDescription.length.toString(), ConstantString.FunctionDescriptionMaxLens.toString()),
|
|
1807
|
-
data: safeFunctionName,
|
|
1808
|
-
});
|
|
1809
|
-
funcDescription = funcDescription.slice(0, ConstantString.FunctionDescriptionMaxLens);
|
|
1810
|
-
}
|
|
1807
|
+
const funcDescription = operationItem.description || operationItem.summary || "";
|
|
1811
1808
|
const funcObj = {
|
|
1812
1809
|
name: safeFunctionName,
|
|
1813
1810
|
description: funcDescription,
|