@microsoft/m365-spec-parser 0.2.2-alpha.c47fc6ff9.0 → 0.2.2-alpha.c6fcafe97.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 +26 -17
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +193 -20
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +26 -17
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +193 -20
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/constants.d.ts +2 -0
- package/dist/src/interfaces.d.ts +1 -0
- package/dist/src/specOptimizer.d.ts +18 -0
- package/package.json +3 -3
package/dist/index.esm2017.js
CHANGED
|
@@ -54,6 +54,7 @@ var WarningType;
|
|
|
54
54
|
WarningType["GenerateCardFailed"] = "generate-card-failed";
|
|
55
55
|
WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
|
|
56
56
|
WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
|
|
57
|
+
WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
|
|
57
58
|
WarningType["Unknown"] = "unknown";
|
|
58
59
|
})(WarningType || (WarningType = {}));
|
|
59
60
|
/**
|
|
@@ -100,6 +101,7 @@ ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please conve
|
|
|
100
101
|
ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
|
|
101
102
|
ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
|
|
102
103
|
ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
|
|
104
|
+
ConstantString.FuncDescriptionTooLong = "The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.";
|
|
103
105
|
ConstantString.WrappedCardVersion = "devPreview";
|
|
104
106
|
ConstantString.WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
|
|
105
107
|
ConstantString.WrappedCardResponseLayout = "list";
|
|
@@ -179,6 +181,7 @@ ConstantString.ConversationStarterMaxLens = 50;
|
|
|
179
181
|
ConstantString.CommandTitleMaxLens = 32;
|
|
180
182
|
ConstantString.ParameterTitleMaxLens = 32;
|
|
181
183
|
ConstantString.SMERequiredParamsMaxNum = 5;
|
|
184
|
+
ConstantString.FunctionDescriptionMaxLens = 100;
|
|
182
185
|
ConstantString.DefaultPluginId = "plugin_1";
|
|
183
186
|
ConstantString.PluginManifestSchema = "https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json";
|
|
184
187
|
|
|
@@ -256,23 +259,28 @@ class Utils {
|
|
|
256
259
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
257
260
|
}
|
|
258
261
|
static getResponseJson(operationObject, allowMultipleMediaType = false) {
|
|
259
|
-
var _a
|
|
262
|
+
var _a;
|
|
260
263
|
let json = {};
|
|
261
264
|
let multipleMediaType = false;
|
|
262
265
|
for (const code of ConstantString.ResponseCodeFor20X) {
|
|
263
266
|
const responseObject = (_a = operationObject === null || operationObject === void 0 ? void 0 : operationObject.responses) === null || _a === void 0 ? void 0 : _a[code];
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
if (responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) {
|
|
268
|
+
for (const contentType of Object.keys(responseObject.content)) {
|
|
269
|
+
// json media type can also be "application/json; charset=utf-8"
|
|
270
|
+
if (contentType.indexOf("application/json") >= 0) {
|
|
271
|
+
multipleMediaType = false;
|
|
272
|
+
json = responseObject.content[contentType];
|
|
273
|
+
if (Utils.containMultipleMediaTypes(responseObject)) {
|
|
274
|
+
multipleMediaType = true;
|
|
275
|
+
if (!allowMultipleMediaType) {
|
|
276
|
+
json = {};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
return { json, multipleMediaType };
|
|
281
|
+
}
|
|
271
282
|
}
|
|
272
283
|
}
|
|
273
|
-
else {
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
284
|
}
|
|
277
285
|
}
|
|
278
286
|
return { json, multipleMediaType };
|
|
@@ -546,10 +554,11 @@ class Utils {
|
|
|
546
554
|
currentCount += items.length;
|
|
547
555
|
}
|
|
548
556
|
else {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
557
|
+
result.push(element);
|
|
558
|
+
currentCount++;
|
|
559
|
+
}
|
|
560
|
+
if (currentCount >= maxCount) {
|
|
561
|
+
break;
|
|
553
562
|
}
|
|
554
563
|
}
|
|
555
564
|
return result;
|
|
@@ -1410,7 +1419,7 @@ class AdaptiveCardGenerator {
|
|
|
1410
1419
|
{
|
|
1411
1420
|
type: "Image",
|
|
1412
1421
|
url: `\${${name}}`,
|
|
1413
|
-
$when: `\${${name} != null}`,
|
|
1422
|
+
$when: `\${${name} != null && ${name} != ''}`,
|
|
1414
1423
|
},
|
|
1415
1424
|
];
|
|
1416
1425
|
}
|
|
@@ -1419,7 +1428,7 @@ class AdaptiveCardGenerator {
|
|
|
1419
1428
|
{
|
|
1420
1429
|
type: "Image",
|
|
1421
1430
|
url: "${$data}",
|
|
1422
|
-
$when: "${$data != null}",
|
|
1431
|
+
$when: "${$data != null && $data != ''}",
|
|
1423
1432
|
},
|
|
1424
1433
|
];
|
|
1425
1434
|
}
|