@postxl/generator 0.19.0 → 0.20.0

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.
@@ -63,7 +63,7 @@ function generateDataMockModule({ models, meta }) {
63
63
  }`)
64
64
  .join(', ');
65
65
  return `
66
- import { DynamicModule } from '@nestjs/common'
66
+ import { DynamicModule } from '@pxl/common'
67
67
  import { DbModule } from '@${meta.config.project}/db'
68
68
 
69
69
  ${imports.generate()}
@@ -49,12 +49,9 @@ function generateDataModule({ models, meta }) {
49
49
  }
50
50
  const moduleName = meta.data.moduleName;
51
51
  return `
52
- import { Provider } from '@nestjs/common'
53
52
  import { DynamicModule } from '@${meta.config.project}/common'
54
53
  import { DbModule } from '@${meta.config.project}/db'
55
54
 
56
- import { Repository } from './repository.type'
57
-
58
55
  ${imports.generate()}
59
56
 
60
57
  export class ${moduleName} {
@@ -18,10 +18,12 @@ function generateSeedModel({ model, itemCount, meta, }) {
18
18
  });
19
19
  for (const relation of (0, fields_1.getRelationFields)(model)) {
20
20
  const depMeta = (0, meta_1.getModelMetadata)({ model: relation.relationToModel });
21
- imports.addImport({
22
- items: [depMeta.types.toBrandedIdTypeFnName],
23
- from: depMeta.types.importPath,
24
- });
21
+ if (relation.isRequired) {
22
+ imports.addImport({
23
+ items: [depMeta.types.toBrandedIdTypeFnName],
24
+ from: depMeta.types.importPath,
25
+ });
26
+ }
25
27
  }
26
28
  const mode = getExampleMode({ model, maxItemCount: itemCount });
27
29
  const examples = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "main": "./dist/generator.js",
5
5
  "typings": "./dist/generator.d.ts",
6
6
  "bin": {