@statezero/core 0.1.4 → 0.1.5
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.
|
@@ -159,7 +159,7 @@ const JS_MODEL_TEMPLATE = `/**
|
|
|
159
159
|
|
|
160
160
|
import { Model, Manager, QuerySet, getModelClass } from '{{modulePath}}';
|
|
161
161
|
import { wrapReactiveModel } from '{{modulePath}}';
|
|
162
|
-
import schemaData from './{{className}}.schema.json';
|
|
162
|
+
import schemaData from './{{toLowerCase className}}.schema.json';
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* Model-specific QuerySet implementation
|
|
@@ -499,6 +499,9 @@ Handlebars.registerHelper("ifDefaultProvided", function (defaultValue, options)
|
|
|
499
499
|
Handlebars.registerHelper("isRequired", function (required) {
|
|
500
500
|
return required ? "" : "?";
|
|
501
501
|
});
|
|
502
|
+
Handlebars.registerHelper("toLowerCase", function (str) {
|
|
503
|
+
return str.toLowerCase();
|
|
504
|
+
});
|
|
502
505
|
const jsTemplate = Handlebars.compile(JS_MODEL_TEMPLATE);
|
|
503
506
|
const dtsTemplate = Handlebars.compile(TS_DECLARATION_TEMPLATE);
|
|
504
507
|
// --------------------
|
|
@@ -511,9 +514,8 @@ const dtsTemplate = Handlebars.compile(TS_DECLARATION_TEMPLATE);
|
|
|
511
514
|
* @returns {Promise<{model: string, relativePath: string}>}
|
|
512
515
|
*/
|
|
513
516
|
async function generateSchemaForModel(backend, model) {
|
|
514
|
-
const authHeaders = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
|
|
515
517
|
const schemaUrl = `${backend.API_URL}/${model}/get-schema/`;
|
|
516
|
-
const schemaResponse = await axios.get(schemaUrl
|
|
518
|
+
const schemaResponse = await axios.get(schemaUrl);
|
|
517
519
|
/** @type {SchemaDefinition} */
|
|
518
520
|
let schema;
|
|
519
521
|
if (schemaResponse.data.components?.schemas?.[model]) {
|
|
@@ -1008,10 +1010,7 @@ async function main() {
|
|
|
1008
1010
|
const backend = backendConfigs[key];
|
|
1009
1011
|
backend.NAME = key;
|
|
1010
1012
|
try {
|
|
1011
|
-
const
|
|
1012
|
-
? backend.getAuthHeaders()
|
|
1013
|
-
: {};
|
|
1014
|
-
const response = await axios.get(`${backend.API_URL}/models/`, authHeaders);
|
|
1013
|
+
const response = await axios.get(`${backend.API_URL}/models/`);
|
|
1015
1014
|
return { backend, models: response.data };
|
|
1016
1015
|
}
|
|
1017
1016
|
catch (error) {
|
package/package.json
CHANGED