svelte-reflector 1.3.6 → 1.3.7
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.
|
@@ -67,6 +67,9 @@ export class ModuleClassBuilder {
|
|
|
67
67
|
]);
|
|
68
68
|
}
|
|
69
69
|
`;
|
|
70
|
+
if (bundle.length > 0) {
|
|
71
|
+
this.imports.addReflectorImport("bundleStrict");
|
|
72
|
+
}
|
|
70
73
|
return `
|
|
71
74
|
class ${outputName} {
|
|
72
75
|
${attributes.join(";")}
|
|
@@ -75,9 +78,9 @@ export class ModuleClassBuilder {
|
|
|
75
78
|
|
|
76
79
|
${bundle.length > 0 ? `
|
|
77
80
|
bundle() {
|
|
78
|
-
return {
|
|
81
|
+
return bundleStrict({
|
|
79
82
|
${bundle.join(",")}
|
|
80
|
-
}
|
|
83
|
+
})
|
|
81
84
|
}
|
|
82
85
|
` : ""}
|
|
83
86
|
}
|
|
@@ -92,12 +95,15 @@ export class ModuleClassBuilder {
|
|
|
92
95
|
bundle.push(prop.bundleBuild());
|
|
93
96
|
});
|
|
94
97
|
}
|
|
98
|
+
if (bundle.length > 0) {
|
|
99
|
+
this.imports.addReflectorImport("bundleStrict");
|
|
100
|
+
}
|
|
95
101
|
const bundleBuild = bundle.length > 0
|
|
96
102
|
? `
|
|
97
103
|
bundle() {
|
|
98
|
-
return {
|
|
104
|
+
return bundleStrict({
|
|
99
105
|
${bundle.join(",")}
|
|
100
|
-
}
|
|
106
|
+
})
|
|
101
107
|
}
|
|
102
108
|
`
|
|
103
109
|
: "";
|
|
@@ -18,7 +18,7 @@ export class ModuleSchemaFileBuilder {
|
|
|
18
18
|
}
|
|
19
19
|
const treatedSchemas = schemas.map((s) => `${s.interface};\n${s.schema};`);
|
|
20
20
|
const imports = [
|
|
21
|
-
`import { build, BuildedInput } from "${config.reflectorAlias}/reflector.svelte";`,
|
|
21
|
+
`import { build, BuildedInput, bundleStrict } from "${config.reflectorAlias}/reflector.svelte";`,
|
|
22
22
|
`import { validateInputs } from "${config.validatorsImport}";`,
|
|
23
23
|
];
|
|
24
24
|
if (enumDeps.size > 0) {
|
|
@@ -208,3 +208,11 @@ export function changeArrayParam({ values, key }: { values: string[]; key: strin
|
|
|
208
208
|
values.forEach((value) => url.searchParams.append(key, value));
|
|
209
209
|
goto(url, { replaceState: true, keepFocus: true });
|
|
210
210
|
}
|
|
211
|
+
|
|
212
|
+
export function bundleStrict<T extends Record<string, unknown>>(
|
|
213
|
+
payload: T,
|
|
214
|
+
): { [K in keyof T]: Exclude<T[K], undefined> extends never ? never : T[K] } {
|
|
215
|
+
return Object.fromEntries(
|
|
216
|
+
Object.entries(payload).filter(([, v]) => v !== undefined),
|
|
217
|
+
) as typeof payload as { [K in keyof T]: Exclude<T[K], undefined> extends never ? never : T[K] };
|
|
218
|
+
}
|