@@ -200894,15 +200894,16 @@ Draw.loadPlugin(function (ui) {
200894200894 if (type == "ts") {
200895200895 const { data: doc } = (0, core_types_json_schema_1.convertOpenApiToCoreTypes)(openapi);
200896200896 const { data: sourceCode } = (0, core_types_ts_1.convertCoreTypesToTypeScript)(doc);
200897- result = `/*\n\tGenerated in drawio\n\tDatabase: ${type}\n\tPlugin: nosql\n\tVersion: ${constants_1.pluginVersion}\n*/\n\n` + result;
200897+ result =
200898+ `/*\n\tGenerated in drawio\n\tDatabase: ${type}\n\tPlugin: nosql\n\tVersion: ${constants_1.pluginVersion}\n*/\n\n` +
200899+ result;
200898200900 result += sourceCode;
200899200901 }
200900200902 else if (type == "openapi") {
200901200903 result = JSON.stringify(openapi, null, 2);
200902200904 }
200903200905 sqlInputGenSQL.value = result;
200904200906 }
200905- ;
200906200907 mxUtils.br(divGenSQL);
200907200908 const resetBtnGenSQL = mxUtils.button(mxResources.get("reset"), function () {
200908200909 sqlInputGenSQL.value = sqlExportDefault;
@@ -200971,7 +200972,7 @@ Draw.loadPlugin(function (ui) {
200971200972 let openApi = null;
200972200973 const openApiOptions = {
200973200974 title: "nosql default options",
200974- version: constants_1.pluginVersion
200975+ version: constants_1.pluginVersion,
200975200976 };
200976200977 if (type == "openapi") {
200977200978 // should already be a json, but going to serialize to openapi for validation
@@ -201009,7 +201010,6 @@ Draw.loadPlugin(function (ui) {
201009201010 console.log(error);
201010201011 }
201011201012 }
201012- ;
201013201013 mxUtils.br(divFromNOSQL);
201014201014 const resetBtnFromNOSQL = mxUtils.button(mxResources.get("Reset TS"), function () {
201015201015 sqlInputFromNOSQL.value = constants_nosql_1.defaultReset;
@@ -201178,7 +201178,7 @@ const JSONSchemaTypes = [
201178201178 "object",
201179201179 "array",
201180201180 "null",
201181- "any"
201181+ "any",
201182201182];
201183201183exports.validJSONSchemaTypes = JSONSchemaTypes;
201184201184
@@ -201357,32 +201357,35 @@ function dbToOpenApi(db) {
201357201357 //
201358201358 }
201359201359 else {
201360- // else {
201361201360 removeType = true;
201362201361 $ref = `#/components/schemas/${(0, sharedUtils_1.RemoveNameQuantifiers)(type)}`;
201363201362 }
201364201363 }
201365201364 if (["array", "object"].indexOf(type) !== -1) {
201366- const relationships = db.getRelationships().filter(x => x.entityA == key);
201365+ const relationships = db
201366+ .getRelationships()
201367+ .filter((x) => x.entityA == key);
201367201368 const roleLookup = `[${key}.${propName}]`;
201368201369 // FIND MATCH
201369- const rel = relationships.find(x => x.roleA.indexOf(roleLookup) != -1);
201370+ const rel = relationships.find((x) => x.roleA.indexOf(roleLookup) != -1);
201370201371 if (rel) {
201371201372 const commentFKIndexes = (0, sharedUtils_1.getCommentIndexes)(rel.entityB);
201372- const entityBName = rel.entityB.substring(0, commentFKIndexes.beforeStart).trim();
201373+ const entityBName = rel.entityB
201374+ .substring(0, commentFKIndexes.beforeStart)
201375+ .trim();
201373201376 $ref = `#/components/schemas/${entityBName}`;
201374201377 }
201375201378 if ($ref) {
201376201379 // if array additionalProperties.$ref
201377201380 if (type == "array") {
201378201381 items = {
201379- $ref: $ref
201382+ $ref: $ref,
201380201383 };
201381201384 }
201382201385 // if object items.$ref
201383201386 if (type == "object") {
201384201387 additionalProperties = {
201385- $ref: $ref
201388+ $ref: $ref,
201386201389 };
201387201390 }
201388201391 }
@@ -201443,9 +201446,7 @@ function GeneratePropertyModel(tableName, propertyName, property) {
201443201446 if (property.items && typeof property.items === constants_1.objectKeyword) {
201444201447 if (property.items.format && !property.format) {
201445201448 property.format = property.items.format;
201446- // columnProperties = `${(property.items as JSONSchema4).format}[]`;
201447201449 }
201448- // else
201449201450 if (property.items.type)
201450201451 columnProperties = `${property.items.type}[]`;
201451201452 }
@@ -201549,10 +201550,6 @@ function ConvertOpenApiToDatabaseModel(schemas) {
201549201550 property.type = refName;
201550201551 }
201551201552 const propertyModel = GeneratePropertyModel(tableModel.Name, propertyKey, property);
201552- // if (
201553- // propertyModel.ColumnProperties.includes(objectKeyword) ||
201554- // propertyModel.ColumnProperties.includes(arrayKeyword)
201555- // ) {
201556201553 if (refName) {
201557201554 const primaryKeyModel = {
201558201555 PrimaryKeyTableName: tableModel.Name,
@@ -201574,7 +201571,6 @@ function ConvertOpenApiToDatabaseModel(schemas) {
201574201571 models.ForeignKeyList.push(primaryKeyModel);
201575201572 propertyModel.IsForeignKey = true;
201576201573 }
201577- // }
201578201574 tableModel.Properties.push(propertyModel);
201579201575 }
201580201576 }
0 commit comments