@ndla/types-taxonomy 1.0.48 → 1.0.50
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/build/scripts/generate-openapi.js +7 -21
- package/build/scripts/generate-openapi.js.map +1 -1
- package/build/taxonomy-api.d.ts +8385 -58
- package/build/taxonomy-api.js +0 -37
- package/build/taxonomy-api.js.map +1 -1
- package/package.json +4 -4
- package/scripts/generate-openapi.ts +7 -34
- package/taxonomy-api.ts +8385 -60
- package/build/taxonomy-api-openapi.d.ts +0 -8328
- package/build/taxonomy-api-openapi.js +0 -3
- package/build/taxonomy-api-openapi.js.map +0 -1
- package/taxonomy-api-openapi.ts +0 -8328
|
@@ -81,15 +81,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
81
81
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
82
82
|
var node_fs_1 = __importDefault(require("node:fs"));
|
|
83
83
|
var openapi_typescript_1 = __importStar(require("openapi-typescript"));
|
|
84
|
-
|
|
85
|
-
if (process.argv.length !== 2) {
|
|
86
|
-
throw new Error("Invalid use");
|
|
87
|
-
}
|
|
88
|
-
var BLOB = typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier("Blob"));
|
|
89
|
-
var NULL = typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createNull()); // `null`
|
|
90
|
-
function generate_types(appName) {
|
|
84
|
+
function generate_types() {
|
|
91
85
|
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
var jsonFile, schema, schemaContent, ast, outputPath, output
|
|
86
|
+
var jsonFile, schema, schemaContent, ast, outputPath, output;
|
|
93
87
|
return __generator(this, function (_a) {
|
|
94
88
|
switch (_a.label) {
|
|
95
89
|
case 0:
|
|
@@ -102,28 +96,20 @@ function generate_types(appName) {
|
|
|
102
96
|
return [4 /*yield*/, (0, openapi_typescript_1.default)(schemaContent, {
|
|
103
97
|
defaultNonNullable: false,
|
|
104
98
|
exportType: true,
|
|
99
|
+
rootTypes: true,
|
|
100
|
+
rootTypesKeepCasing: true,
|
|
101
|
+
rootTypesNoSchemaPrefix: true,
|
|
105
102
|
})];
|
|
106
103
|
case 2:
|
|
107
104
|
ast = _a.sent();
|
|
108
|
-
outputPath = "./taxonomy-api
|
|
105
|
+
outputPath = "./taxonomy-api.ts";
|
|
109
106
|
output = (0, openapi_typescript_1.astToString)(ast);
|
|
110
107
|
console.log("Outputting to ".concat(outputPath));
|
|
111
108
|
node_fs_1.default.writeFileSync(outputPath, output);
|
|
112
|
-
header = "// This file is generated automatically. Do not edit.\n";
|
|
113
|
-
newFileContent = "".concat(header, "import * as openapi from \"./taxonomy-api-openapi\";\ntype schemas = openapi.components[\"schemas\"];\nexport { openapi };\n\n");
|
|
114
|
-
schemas = schemaContent.components.schemas;
|
|
115
|
-
schemaNames = Object.keys(schemas);
|
|
116
|
-
for (_i = 0, schemaNames_1 = schemaNames; _i < schemaNames_1.length; _i++) {
|
|
117
|
-
schemaName = schemaNames_1[_i];
|
|
118
|
-
newFileContent += "export type ".concat(schemaName, " = schemas[\"").concat(schemaName, "\"];\n");
|
|
119
|
-
}
|
|
120
|
-
newFilePath = "./taxonomy-api.ts";
|
|
121
|
-
console.log("Outputting to ".concat(newFilePath));
|
|
122
|
-
node_fs_1.default.writeFileSync(newFilePath, newFileContent);
|
|
123
109
|
return [2 /*return*/];
|
|
124
110
|
}
|
|
125
111
|
});
|
|
126
112
|
});
|
|
127
113
|
}
|
|
128
|
-
generate_types(
|
|
114
|
+
generate_types();
|
|
129
115
|
//# sourceMappingURL=generate-openapi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-openapi.js","sourceRoot":"","sources":["../../scripts/generate-openapi.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"generate-openapi.js","sourceRoot":"","sources":["../../scripts/generate-openapi.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAyB;AACzB,uEAA4D;AAE5D,SAAe,cAAc;;;;;;oBACrB,QAAQ,GAAG,gBAAgB,CAAC;oBAClC,OAAO,CAAC,GAAG,CAAC,kBAAW,QAAQ,qCAAkC,CAAC,CAAC;oBACpD,qBAAM,iBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAA;;oBAArD,MAAM,GAAG,SAA4C;oBACrD,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBAE7B,qBAAM,IAAA,4BAAS,EAAC,aAAa,EAAE;4BACzC,kBAAkB,EAAE,KAAK;4BACzB,UAAU,EAAE,IAAI;4BAChB,SAAS,EAAE,IAAI;4BACf,mBAAmB,EAAE,IAAI;4BACzB,uBAAuB,EAAE,IAAI;yBAC9B,CAAC,EAAA;;oBANI,GAAG,GAAG,SAMV;oBAEI,UAAU,GAAG,mBAAmB,CAAC;oBAEjC,MAAM,GAAG,IAAA,gCAAW,EAAC,GAAG,CAAC,CAAC;oBAEhC,OAAO,CAAC,GAAG,CAAC,wBAAiB,UAAU,CAAE,CAAC,CAAC;oBAE3C,iBAAE,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;;;;;CACtC;AAED,cAAc,EAAE,CAAC"}
|