@supalive/codegen 1.5.0 → 1.5.1
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/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-CsHYrzoq.js → src-DM44BrYS.js} +7 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as emit, c as loadSchemaEnums, i as resolveConfig, n as generateToDisk, o as extractClient, r as readEntryConfig, s as SchemaEnumRegistry, t as generate } from "./src-
|
|
1
|
+
import { a as emit, c as loadSchemaEnums, i as resolveConfig, n as generateToDisk, o as extractClient, r as readEntryConfig, s as SchemaEnumRegistry, t as generate } from "./src-DM44BrYS.js";
|
|
2
2
|
export { SchemaEnumRegistry, emit, extractClient, generate, generateToDisk, loadSchemaEnums, readEntryConfig, resolveConfig };
|
|
@@ -714,18 +714,18 @@ var Extractor = class {
|
|
|
714
714
|
const propType = prop.getTypeAtLocation(this.locationNode);
|
|
715
715
|
const declaredOptional = (prop.getFlags() & ts.SymbolFlags.Optional) !== 0;
|
|
716
716
|
const { core, hasNull, hasUndefined } = splitNullish(propType);
|
|
717
|
-
const dt = core.length === 0 ? { kind: "dynamic" } : core.length === 1 ? this.walkSingle(core[0], name + pascal(jsonKey)) : this.walkUnion(core, {
|
|
718
|
-
hint: name + pascal(jsonKey),
|
|
719
|
-
stem: cleanStem(name),
|
|
720
|
-
field: jsonKey
|
|
721
|
-
});
|
|
722
717
|
const acc = fieldMap.get(jsonKey) ?? {
|
|
723
718
|
types: [],
|
|
724
719
|
present: 0,
|
|
725
720
|
nullable: false,
|
|
726
721
|
optional: false
|
|
727
722
|
};
|
|
728
|
-
acc.types.push(
|
|
723
|
+
if (core.length === 1) acc.types.push(this.walkSingle(core[0], name + pascal(jsonKey)));
|
|
724
|
+
else if (core.length > 1) acc.types.push(this.walkUnion(core, {
|
|
725
|
+
hint: name + pascal(jsonKey),
|
|
726
|
+
stem: cleanStem(name),
|
|
727
|
+
field: jsonKey
|
|
728
|
+
}));
|
|
729
729
|
acc.present++;
|
|
730
730
|
if (hasNull) acc.nullable = true;
|
|
731
731
|
if (declaredOptional || hasUndefined) acc.optional = true;
|
|
@@ -733,7 +733,7 @@ var Extractor = class {
|
|
|
733
733
|
}
|
|
734
734
|
const fields = [];
|
|
735
735
|
for (const [jsonKey, acc] of fieldMap) {
|
|
736
|
-
const consistent = acc.types.every((t) => JSON.stringify(t) === JSON.stringify(acc.types[0]));
|
|
736
|
+
const consistent = acc.types.length > 0 && acc.types.every((t) => JSON.stringify(t) === JSON.stringify(acc.types[0]));
|
|
737
737
|
fields.push({
|
|
738
738
|
name: camel(jsonKey),
|
|
739
739
|
jsonKey,
|