zova-cli-set-front 1.2.77 → 1.2.78
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.
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ZovaOpenapiConfigModule } from 'zova-openapi';
|
|
2
2
|
|
|
3
3
|
export default function (): ZovaOpenapiConfigModule {
|
|
4
|
-
return {
|
|
4
|
+
return {
|
|
5
|
+
operations: {
|
|
6
|
+
// Specify operations.match or operations.ignore explicitly for this module.
|
|
7
|
+
match: [],
|
|
8
|
+
},
|
|
9
|
+
};
|
|
5
10
|
}
|
package/dist/index.js
CHANGED
|
@@ -1632,6 +1632,7 @@ class CliOpenapiGenerate extends BeanCliBase {
|
|
|
1632
1632
|
apiMeta: false,
|
|
1633
1633
|
apiSchema: true
|
|
1634
1634
|
}, config.default, moduleConfigCli, config.modules[moduleInfo.relativeName]);
|
|
1635
|
+
_validateOperations(moduleConfig, moduleInfo.relativeName, configFile);
|
|
1635
1636
|
const cache = await this._outputFiles(openapiTypescript, moduleConfig, moduleInfo, module, __caches);
|
|
1636
1637
|
// generate
|
|
1637
1638
|
await this._generateApis(openapiTypescript, cache.ast, moduleConfig, moduleInfo, module);
|
|
@@ -2001,10 +2002,24 @@ function _isNodeNever(node) {
|
|
|
2001
2002
|
function _q(question) {
|
|
2002
2003
|
return question ? '?' : '';
|
|
2003
2004
|
}
|
|
2005
|
+
function _hasOperationRule(rule) {
|
|
2006
|
+
if (!rule) return false;
|
|
2007
|
+
return !Array.isArray(rule) || rule.length > 0;
|
|
2008
|
+
}
|
|
2009
|
+
function _validateOperations(moduleConfig, moduleName, configFile) {
|
|
2010
|
+
if (_hasOperationRule(moduleConfig.operations?.match) || _hasOperationRule(moduleConfig.operations?.ignore)) {
|
|
2011
|
+
return;
|
|
2012
|
+
}
|
|
2013
|
+
throw new Error(`Please specify operations.match or operations.ignore in ${configFile} to avoid generating a large number of API SDKs unrelated to module "${moduleName}".`);
|
|
2014
|
+
}
|
|
2004
2015
|
function _checkOperationIdEnabled(moduleConfig, selector) {
|
|
2005
2016
|
if (!selector) return false;
|
|
2006
|
-
|
|
2007
|
-
|
|
2017
|
+
const match = moduleConfig.operations?.match;
|
|
2018
|
+
const ignore = moduleConfig.operations?.ignore;
|
|
2019
|
+
const hasMatch = _hasOperationRule(match);
|
|
2020
|
+
const hasIgnore = _hasOperationRule(ignore);
|
|
2021
|
+
if (!hasMatch && !hasIgnore) return false;
|
|
2022
|
+
return hasMatch && matchSelector(match, selector) || hasIgnore && !matchSelector(ignore, selector);
|
|
2008
2023
|
}
|
|
2009
2024
|
|
|
2010
2025
|
/**
|
package/package.json
CHANGED