@ostack.tech/kform-scaffolder 0.36.0 → 0.37.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.
|
@@ -342,7 +342,7 @@ function scaffoldModels(schematic, data) {
|
|
|
342
342
|
}
|
|
343
343
|
function scaffoldModelDeclaration(schematic, data) {
|
|
344
344
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
345
|
-
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}
|
|
345
|
+
if (!schematicKind) throw new Error(`Unknown schematic kind: '${schematic.kind}'.`);
|
|
346
346
|
const nDecls = data.currentFile.declarations.length;
|
|
347
347
|
data.currentFile.declarations.push("");
|
|
348
348
|
const decl = schematicKind.scaffoldModel?.(schematic, data) ?? `typealias ${schematic.name} = ${scaffoldType(schematic, data)}`;
|
|
@@ -350,12 +350,12 @@ function scaffoldModelDeclaration(schematic, data) {
|
|
|
350
350
|
}
|
|
351
351
|
function scaffoldPropertyAnnotations(schematic, data) {
|
|
352
352
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
353
|
-
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}
|
|
353
|
+
if (!schematicKind) throw new Error(`Unknown schematic kind: '${schematic.kind}'.`);
|
|
354
354
|
return typeof schematicKind.propertyAnnotations === "function" ? schematicKind.propertyAnnotations(schematic, data) : schematicKind.propertyAnnotations;
|
|
355
355
|
}
|
|
356
356
|
function scaffoldType(schematic, data) {
|
|
357
357
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
358
|
-
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}
|
|
358
|
+
if (!schematicKind) throw new Error(`Unknown schematic kind: '${schematic.kind}'.`);
|
|
359
359
|
const schematicPackage = schematicKind.package ?? joinPackages(data.currentPackage, schematic.packageSuffix);
|
|
360
360
|
const schematicName = schematic.name || schematicKind.name;
|
|
361
361
|
if (schematicPackage !== data.currentPackage) data.currentFile.imports.add(joinPackages(schematicPackage, schematicName));
|
|
@@ -369,7 +369,7 @@ function scaffoldType(schematic, data) {
|
|
|
369
369
|
}
|
|
370
370
|
function scaffoldDefaultValue(schematic, data) {
|
|
371
371
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
372
|
-
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}
|
|
372
|
+
if (!schematicKind) throw new Error(`Unknown schematic kind: '${schematic.kind}'.`);
|
|
373
373
|
return schematic.nullable ? "null" : typeof schematicKind.defaultValue === "function" ? schematicKind.defaultValue(schematic, data) : schematicKind.defaultValue;
|
|
374
374
|
}
|
|
375
375
|
//#endregion
|
|
@@ -1226,7 +1226,7 @@ function scaffoldSchemas(schematic, data) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
function scaffoldSchemaDeclaration(schematic, data) {
|
|
1228
1228
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
1229
|
-
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}
|
|
1229
|
+
if (!schematicKind) throw new Error(`Unknown schematic kind: '${schematic.kind}'.`);
|
|
1230
1230
|
const nDecls = data.currentFile.declarations.length;
|
|
1231
1231
|
data.currentFile.declarations.push("");
|
|
1232
1232
|
const decl = `val ${schematic.name}Schema = ${schematicKind.scaffoldSchema?.(schematic, data) ?? `${simpleKtName(schematicKind.schema)}()`}`;
|
|
@@ -1235,7 +1235,7 @@ function scaffoldSchemaDeclaration(schematic, data) {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
function scaffoldSchema(schematic, data) {
|
|
1237
1237
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
1238
|
-
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}
|
|
1238
|
+
if (!schematicKind) throw new Error(`Unknown schematic kind: '${schematic.kind}'.`);
|
|
1239
1239
|
const schematicPackage = schematicKind.package ?? joinPackages(data.currentPackage, schematic.packageSuffix);
|
|
1240
1240
|
let scaffoldedSchema;
|
|
1241
1241
|
if (schematicKind.package == null && schematicPackage !== data.currentPackage) {
|
|
@@ -1382,7 +1382,7 @@ function SchematicBuilder({ name = "kform", title = document.title, basePath, ba
|
|
|
1382
1382
|
/* @__PURE__ */ jsx(LoadSchematic, {}),
|
|
1383
1383
|
/* @__PURE__ */ jsx(SaveSchematic, {}),
|
|
1384
1384
|
/* @__PURE__ */ jsx(ScaffoldToZip, {})
|
|
1385
|
-
] }), configs = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(UseFileBase64SerializerConfig, {}), /* @__PURE__ */ jsx(UseTableValuesSerializerConfig, {})] }), version = "0.
|
|
1385
|
+
] }), configs = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(UseFileBase64SerializerConfig, {}), /* @__PURE__ */ jsx(UseTableValuesSerializerConfig, {})] }), version = "0.37.1" }) {
|
|
1386
1386
|
const [useSchematic] = useState(() => create(persist(() => createSchematic({
|
|
1387
1387
|
kind: classSchematicKind.kind,
|
|
1388
1388
|
packageSuffix: defaultRootClassPackage,
|
|
@@ -1494,7 +1494,7 @@ function tsImportsToStatements(imports) {
|
|
|
1494
1494
|
return Array.from(importsStatements.values());
|
|
1495
1495
|
}
|
|
1496
1496
|
function tsImportStatementToString(importStatement) {
|
|
1497
|
-
const namedImportsArr = [
|
|
1497
|
+
const namedImportsArr = [.../* @__PURE__ */ new Set([...importStatement.namedImports ?? [], ...importStatement.typedImports ?? []])].sort((i1, i2) => i1.localeCompare(i2));
|
|
1498
1498
|
const allNamedImportsAreTyped = namedImportsArr.every((i) => !importStatement.namedImports?.has(i));
|
|
1499
1499
|
const namedImports = namedImportsArr.length > 0 ? allNamedImportsAreTyped ? `type { ${namedImportsArr.join(", ")} }` : `{ ${namedImportsArr.map((i) => importStatement.namedImports?.has(i) ? i : `type ${i}`).join(", ")} }` : null;
|
|
1500
1500
|
const allImports = [
|