svelte-reflector 1.0.26 → 1.0.28
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/method.js +1 -1
- package/dist/module.js +0 -9
- package/dist/object.property.d.ts +1 -0
- package/dist/object.property.js +2 -2
- package/dist/primitive-property.js +3 -1
- package/dist/schema.js +8 -1
- package/package.json +1 -1
package/dist/method.js
CHANGED
|
@@ -55,7 +55,7 @@ export class Method {
|
|
|
55
55
|
const paths = this.gee(this.paths);
|
|
56
56
|
const cookies = this.gee(this.cookies);
|
|
57
57
|
return `
|
|
58
|
-
${querys.length > 0 ? `const querys = this.querys.bundle()` : ""};
|
|
58
|
+
${querys.length > 0 ? `const { ${querys} } = this.querys.bundle()` : ""};
|
|
59
59
|
${paths.length > 0 ? `const paths = this.paths.bundle()` : ""};
|
|
60
60
|
${cookies.length > 0 ? `const cookies = this.cookies.bundle()` : ""};
|
|
61
61
|
`;
|
package/dist/module.js
CHANGED
|
@@ -29,15 +29,6 @@ export class Module {
|
|
|
29
29
|
moduleName: this.name,
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
// // não vão entrar metodos que não tiverem uma resposta tipada
|
|
33
|
-
// this.methods = methods.filter((op) => {
|
|
34
|
-
// const responseTypeOk = op.request.responseType;
|
|
35
|
-
// if (op.request.apiType === "delete") return true;
|
|
36
|
-
// if (!responseTypeOk) {
|
|
37
|
-
// createDangerMessage(`Método [ ${op.name} ] do módulo [ ${this.moduleName} ] sem tipagem na resposta.`);
|
|
38
|
-
// }
|
|
39
|
-
// return responseTypeOk;
|
|
40
|
-
// });
|
|
41
32
|
const { cookies, headers, paths, querys } = this.getParameters();
|
|
42
33
|
const { moduleAttributes, moduleTypes, moduleInit, moduleClear, form } = this.creator({ cookies, headers, paths, querys });
|
|
43
34
|
this.moduleConstructor = this.buildConstructor(form);
|
package/dist/object.property.js
CHANGED
|
@@ -3,10 +3,10 @@ export class ObjectProp {
|
|
|
3
3
|
type;
|
|
4
4
|
required;
|
|
5
5
|
constructor(params) {
|
|
6
|
-
const { referenceObject, name } = params;
|
|
6
|
+
const { referenceObject, name, isRequired } = params;
|
|
7
7
|
this.name = name;
|
|
8
8
|
this.type = referenceObject.$ref.split("/").at(-1) ?? "";
|
|
9
|
-
this.required = true; // tem que ver isso daí
|
|
9
|
+
this.required = isRequired ?? true; // tem que ver isso daí
|
|
10
10
|
}
|
|
11
11
|
constructorBuild() {
|
|
12
12
|
return `this.${this.name} = new ${this.type}(params?.${this.name})`;
|
|
@@ -10,9 +10,11 @@ export class PrimitiveProp {
|
|
|
10
10
|
const { example: rawExample, type: rawType } = schemaObject;
|
|
11
11
|
const type = rawType ?? "string";
|
|
12
12
|
const example = rawExample ?? this.getEmptyExample({ type, schemaObject });
|
|
13
|
+
// const buildedType = required ? type : `${type} | undefined`;
|
|
14
|
+
const buildedType = type;
|
|
13
15
|
this.name = this.treatName(name);
|
|
14
16
|
this.rawType = type ?? "any";
|
|
15
|
-
this.type = `BuildedInput<${
|
|
17
|
+
this.type = `BuildedInput<${buildedType}>`;
|
|
16
18
|
this.required = required;
|
|
17
19
|
this.buildedConst = this.buildConst({ example, name: this.name, required, type });
|
|
18
20
|
}
|
package/dist/schema.js
CHANGED
|
@@ -17,7 +17,14 @@ export class Schema {
|
|
|
17
17
|
this.name = `${isEmpty ? "Empty" : ""}${name}`;
|
|
18
18
|
for (const [key, value] of Object.entries(properties)) {
|
|
19
19
|
if ("$ref" in value || !value?.type) {
|
|
20
|
-
if ("
|
|
20
|
+
if ("allOf" in value) {
|
|
21
|
+
const ref = value.allOf?.[0];
|
|
22
|
+
const isRequired = !!value.nullable;
|
|
23
|
+
if (ref && "$ref" in ref) {
|
|
24
|
+
this.objectProps.push(new ObjectProp({ name: key, referenceObject: ref, isRequired }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if ("$ref" in value) {
|
|
21
28
|
this.objectProps.push(new ObjectProp({ name: key, referenceObject: value }));
|
|
22
29
|
}
|
|
23
30
|
continue;
|