@graphql-codegen/flutter-freezed 3.0.2 → 4.0.0-alpha-20230524083052-08ce957b4

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.
Files changed (31) hide show
  1. package/cjs/config/config-value.js +2 -1
  2. package/cjs/config/pattern.js +11 -3
  3. package/cjs/config/plugin-config.js +18 -3
  4. package/cjs/freezed-declaration-blocks/class-block.js +6 -4
  5. package/cjs/freezed-declaration-blocks/enum-block.js +3 -3
  6. package/cjs/freezed-declaration-blocks/factory-block.js +7 -3
  7. package/cjs/freezed-declaration-blocks/index.js +4 -2
  8. package/cjs/freezed-declaration-blocks/node-repository.js +0 -1
  9. package/cjs/freezed-declaration-blocks/parameter-block.js +2 -2
  10. package/cjs/utils.js +2 -2
  11. package/esm/config/config-value.js +2 -1
  12. package/esm/config/pattern.js +11 -3
  13. package/esm/config/plugin-config.js +18 -3
  14. package/esm/freezed-declaration-blocks/class-block.js +6 -4
  15. package/esm/freezed-declaration-blocks/enum-block.js +3 -3
  16. package/esm/freezed-declaration-blocks/factory-block.js +8 -4
  17. package/esm/freezed-declaration-blocks/index.js +4 -2
  18. package/esm/freezed-declaration-blocks/node-repository.js +0 -1
  19. package/esm/freezed-declaration-blocks/parameter-block.js +2 -2
  20. package/esm/utils.js +3 -3
  21. package/package.json +4 -1
  22. package/typings/config/pattern.d.cts +3 -3
  23. package/typings/config/pattern.d.ts +3 -3
  24. package/typings/config/plugin-config.d.cts +26 -26
  25. package/typings/config/plugin-config.d.ts +26 -26
  26. package/typings/freezed-declaration-blocks/class-block.d.cts +1 -1
  27. package/typings/freezed-declaration-blocks/class-block.d.ts +1 -1
  28. package/typings/freezed-declaration-blocks/factory-block.d.cts +1 -1
  29. package/typings/freezed-declaration-blocks/factory-block.d.ts +1 -1
  30. package/typings/utils.d.cts +2 -2
  31. package/typings/utils.d.ts +2 -2
@@ -27,7 +27,8 @@ Config.customScalars = (config, graphqlScalar) => {
27
27
  Config.defaultValues = (config, blockAppliesOn, typeName, fieldName) => {
28
28
  var _a, _b, _c, _d;
29
29
  const decorator = (defaultValue) => (defaultValue ? `@Default(${defaultValue})\n` : '');
30
- const defaultValue = (_d = (_c = (_b = (_a = config.defaultValues) === null || _a === void 0 ? void 0 : _a.filter(([pattern, , configAppliesOn]) => pattern_js_1.Pattern.findLastConfiguration(pattern, typeName, fieldName) && (0, utils_js_1.appliesOnBlock)(configAppliesOn, blockAppliesOn))) === null || _b === void 0 ? void 0 : _b.slice(-1)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[1];
30
+ const defaultValue = (_d = (_c = (_b = (_a = config.defaultValues) === null || _a === void 0 ? void 0 : _a.filter(([pattern, , configAppliesOn]) => pattern_js_1.Pattern.findLastConfiguration(pattern, typeName, fieldName) &&
31
+ (0, utils_js_1.appliesOnBlock)(configAppliesOn, blockAppliesOn))) === null || _b === void 0 ? void 0 : _b.slice(-1)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[1];
31
32
  return decorator(defaultValue);
32
33
  };
33
34
  Config.deprecated = (config, blockAppliesOn, typeName, fieldName) => {
@@ -115,7 +115,9 @@ Pattern.attemptMatchAndConfigure = (pattern, typeName, fieldName) => {
115
115
  }
116
116
  const isTypeNamePattern = (baseName) => {
117
117
  if (fieldName === undefined &&
118
- (baseName === 'TypeNames' || baseName === 'AllTypeNames' || baseName === 'AllTypeNamesExcludeTypeNames')) {
118
+ (baseName === 'TypeNames' ||
119
+ baseName === 'AllTypeNames' ||
120
+ baseName === 'AllTypeNamesExcludeTypeNames')) {
119
121
  return true;
120
122
  }
121
123
  return false;
@@ -410,7 +412,10 @@ FieldNamePattern.forFieldNamesOfTypeName = (data) => {
410
412
  }
411
413
  _typeNames.forEach(typeName => {
412
414
  var _a;
413
- expandedPattern[typeName.value] = [...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []), ..._fieldNames];
415
+ expandedPattern[typeName.value] = [
416
+ ...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []),
417
+ ..._fieldNames,
418
+ ];
414
419
  });
415
420
  });
416
421
  return FieldNamePattern.fromString(Object.keys(expandedPattern)
@@ -483,7 +488,10 @@ FieldNamePattern.forAllFieldNamesExcludeFieldNamesOfTypeName = (data) => {
483
488
  }
484
489
  _typeNames.forEach(typeName => {
485
490
  var _a;
486
- expandedPattern[typeName.value] = [...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []), ..._fieldNames];
491
+ expandedPattern[typeName.value] = [
492
+ ...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []),
493
+ ..._fieldNames,
494
+ ];
487
495
  });
488
496
  });
489
497
  return FieldNamePattern.fromString(Object.keys(expandedPattern)
@@ -7,8 +7,17 @@ exports.APPLIES_ON_CLASS = ['class'];
7
7
  exports.APPLIES_ON_DEFAULT_FACTORY = ['factory', 'default_factory'];
8
8
  exports.APPLIES_ON_UNION_FACTORY = ['factory', 'named_factory', 'union_factory'];
9
9
  exports.APPLIES_ON_MERGED_FACTORY = ['factory', 'named_factory', 'merged_factory'];
10
- exports.APPLIES_ON_FACTORY = ['factory', 'default_factory', 'named_factory', 'merged_factory', 'union_factory'];
11
- exports.APPLIES_ON_DEFAULT_FACTORY_PARAMETERS = ['parameter', 'default_factory_parameter'];
10
+ exports.APPLIES_ON_FACTORY = [
11
+ 'factory',
12
+ 'default_factory',
13
+ 'named_factory',
14
+ 'merged_factory',
15
+ 'union_factory',
16
+ ];
17
+ exports.APPLIES_ON_DEFAULT_FACTORY_PARAMETERS = [
18
+ 'parameter',
19
+ 'default_factory_parameter',
20
+ ];
12
21
  exports.APPLIES_ON_UNION_FACTORY_PARAMETERS = [
13
22
  'parameter',
14
23
  'named_factory_parameter',
@@ -26,7 +35,13 @@ exports.APPLIES_ON_PARAMETERS = [
26
35
  'union_factory_parameter',
27
36
  'merged_factory_parameter',
28
37
  ];
29
- exports.APPLIES_ON_ALL_BLOCKS = ['enum', 'enum_value', 'class', 'factory', 'parameter'];
38
+ exports.APPLIES_ON_ALL_BLOCKS = [
39
+ 'enum',
40
+ 'enum_value',
41
+ 'class',
42
+ 'factory',
43
+ 'parameter',
44
+ ];
30
45
  /**
31
46
  * maps GraphQL scalar types to Dart's scalar types
32
47
  */
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClassBlock = void 0;
4
- const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
5
4
  const graphql_1 = require("graphql");
5
+ const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
6
6
  const config_value_js_1 = require("../config/config-value.js");
7
+ const pattern_js_1 = require("../config/pattern.js");
7
8
  const plugin_config_js_1 = require("../config/plugin-config.js");
9
+ const utils_js_1 = require("../utils.js");
8
10
  const factory_block_js_1 = require("./factory-block.js");
9
- const pattern_js_1 = require("../config/pattern.js");
10
11
  const index_js_1 = require("./index.js");
11
- const utils_js_1 = require("../utils.js");
12
12
  class ClassBlock {
13
13
  static build(config, node) {
14
14
  const typeName = pattern_js_1.TypeName.fromString(node.name.value);
@@ -52,7 +52,9 @@ ClassBlock.decorateAsFreezed = (config, node) => {
52
52
  .filter(value => value !== undefined)
53
53
  .map(value => (0, visitor_plugin_common_1.indent)(value))
54
54
  .join('');
55
- return (0, utils_js_1.stringIsNotEmpty)(body) ? `@Freezed(\n${body})\n` : ClassBlock.decorateAsUnfreezed(config, node);
55
+ return (0, utils_js_1.stringIsNotEmpty)(body)
56
+ ? `@Freezed(\n${body})\n`
57
+ : ClassBlock.decorateAsUnfreezed(config, node);
56
58
  };
57
59
  ClassBlock.decorateAsUnfreezed = (config, node) => {
58
60
  const typeName = pattern_js_1.TypeName.fromString(node.name.value);
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EnumBlock = void 0;
4
- const pattern_js_1 = require("../config/pattern.js");
5
- const plugin_config_js_1 = require("../config/plugin-config.js");
6
4
  const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
7
- const index_js_1 = require("./index.js");
8
5
  const config_value_js_1 = require("../config/config-value.js");
6
+ const pattern_js_1 = require("../config/pattern.js");
7
+ const plugin_config_js_1 = require("../config/plugin-config.js");
9
8
  const utils_js_1 = require("../utils.js");
9
+ const index_js_1 = require("./index.js");
10
10
  class EnumBlock {
11
11
  // TODO: @next-version: Implement enhanced enums
12
12
  static build(config, node) {
@@ -5,9 +5,9 @@ const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common"
5
5
  const config_value_js_1 = require("../config/config-value.js");
6
6
  const pattern_js_1 = require("../config/pattern.js");
7
7
  const plugin_config_js_1 = require("../config/plugin-config.js");
8
+ const utils_js_1 = require("../utils.js");
8
9
  const index_js_1 = require("./index.js");
9
10
  const parameter_block_js_1 = require("./parameter-block.js");
10
- const utils_js_1 = require("../utils.js");
11
11
  class FactoryBlock {
12
12
  static build(config, node, blockAppliesOn, className, factoryName) {
13
13
  let block = '';
@@ -23,13 +23,17 @@ class FactoryBlock {
23
23
  exports.FactoryBlock = FactoryBlock;
24
24
  FactoryBlock.buildDecorators = (config, blockAppliesOn, className, factoryName) => {
25
25
  // TODO: @Assert
26
- const typeName = factoryName ? pattern_js_1.TypeName.fromUnionOfTypeNames(className, factoryName) : className;
26
+ const typeName = factoryName
27
+ ? pattern_js_1.TypeName.fromUnionOfTypeNames(className, factoryName)
28
+ : className;
27
29
  const deprecatedDecorator = config_value_js_1.Config.deprecated(config, blockAppliesOn, typeName);
28
30
  const decorators = [deprecatedDecorator].join('');
29
31
  return (0, utils_js_1.stringIsNotEmpty)(decorators) ? (0, visitor_plugin_common_1.indent)(decorators) : decorators;
30
32
  };
31
33
  FactoryBlock.buildHeader = (config, blockAppliesOn, className, factoryName) => {
32
- const typeName = factoryName ? pattern_js_1.TypeName.fromUnionOfTypeNames(className, factoryName) : className;
34
+ const typeName = factoryName
35
+ ? pattern_js_1.TypeName.fromUnionOfTypeNames(className, factoryName)
36
+ : className;
33
37
  const immutable = config_value_js_1.Config.immutable(config, typeName);
34
38
  // const mutableInputs = Config.mutableInputs(config, factoryName);
35
39
  // const mutable = immutable !== true || (node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION && mutableInputs);
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Block = void 0;
4
4
  const change_case_all_1 = require("change-case-all");
5
5
  const graphql_1 = require("graphql");
6
- const pattern_js_1 = require("../config/pattern.js");
7
6
  const config_value_js_1 = require("../config/config-value.js");
7
+ const pattern_js_1 = require("../config/pattern.js");
8
8
  const utils_js_1 = require("../utils.js");
9
9
  const class_block_js_1 = require("./class-block.js");
10
10
  const enum_block_js_1 = require("./enum-block.js");
@@ -43,7 +43,9 @@ Block.build = (config, node, nodeRepository) => {
43
43
  if ((0, utils_js_1.nodeIsObjectType)(node)) {
44
44
  nodeRepository.register(node);
45
45
  }
46
- return node.kind === graphql_1.Kind.ENUM_TYPE_DEFINITION ? enum_block_js_1.EnumBlock.build(config, node) : class_block_js_1.ClassBlock.build(config, node);
46
+ return node.kind === graphql_1.Kind.ENUM_TYPE_DEFINITION
47
+ ? enum_block_js_1.EnumBlock.build(config, node)
48
+ : class_block_js_1.ClassBlock.build(config, node);
47
49
  };
48
50
  Block.buildComment = (node) => {
49
51
  var _a;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- //#region NodeRepository classes
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.NodeRepository = void 0;
5
4
  const utils_js_1 = require("../utils.js");
@@ -2,11 +2,11 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.ParameterBlock = void 0;
5
- const utils_js_1 = require("../utils.js");
5
+ const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
6
6
  const config_value_js_1 = require("../config/config-value.js");
7
7
  const pattern_js_1 = require("../config/pattern.js");
8
+ const utils_js_1 = require("../utils.js");
8
9
  const index_js_1 = require("./index.js");
9
- const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
10
10
  class ParameterBlock {
11
11
  static build(config, node, field, blockAppliesOn) {
12
12
  const typeName = pattern_js_1.TypeName.fromString(node.name.value);
package/cjs/utils.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- //#region helpers
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.stringIsNotEmpty = exports.atJsonKeyDecorator = exports.escapeDartKeyword = exports.isDartKeyword = exports.dartCasing = exports.appliesOnBlock = exports.nodeIsObjectType = exports.resetIndex = exports.arrayWrap = exports.strToList = void 0;
4
+ //#region helpers
5
5
  const change_case_all_1 = require("change-case-all");
6
6
  const graphql_1 = require("graphql");
7
7
  const config_value_js_1 = require("./config/config-value.js");
8
8
  const plugin_config_js_1 = require("./config/plugin-config.js");
9
- const strToList = (str) => (str.length < 1 ? [] : str.split(/\s*,\s*/gim).filter(s => s.length > 0));
9
+ const strToList = (str) => str.length < 1 ? [] : str.split(/\s*,\s*/gim).filter(s => s.length > 0);
10
10
  exports.strToList = strToList;
11
11
  const arrayWrap = (value) => value === undefined ? [] : Array.isArray(value) ? value : [value];
12
12
  exports.arrayWrap = arrayWrap;
@@ -23,7 +23,8 @@ Config.customScalars = (config, graphqlScalar) => {
23
23
  Config.defaultValues = (config, blockAppliesOn, typeName, fieldName) => {
24
24
  var _a, _b, _c, _d;
25
25
  const decorator = (defaultValue) => (defaultValue ? `@Default(${defaultValue})\n` : '');
26
- const defaultValue = (_d = (_c = (_b = (_a = config.defaultValues) === null || _a === void 0 ? void 0 : _a.filter(([pattern, , configAppliesOn]) => Pattern.findLastConfiguration(pattern, typeName, fieldName) && appliesOnBlock(configAppliesOn, blockAppliesOn))) === null || _b === void 0 ? void 0 : _b.slice(-1)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[1];
26
+ const defaultValue = (_d = (_c = (_b = (_a = config.defaultValues) === null || _a === void 0 ? void 0 : _a.filter(([pattern, , configAppliesOn]) => Pattern.findLastConfiguration(pattern, typeName, fieldName) &&
27
+ appliesOnBlock(configAppliesOn, blockAppliesOn))) === null || _b === void 0 ? void 0 : _b.slice(-1)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[1];
27
28
  return decorator(defaultValue);
28
29
  };
29
30
  Config.deprecated = (config, blockAppliesOn, typeName, fieldName) => {
@@ -109,7 +109,9 @@ Pattern.attemptMatchAndConfigure = (pattern, typeName, fieldName) => {
109
109
  }
110
110
  const isTypeNamePattern = (baseName) => {
111
111
  if (fieldName === undefined &&
112
- (baseName === 'TypeNames' || baseName === 'AllTypeNames' || baseName === 'AllTypeNamesExcludeTypeNames')) {
112
+ (baseName === 'TypeNames' ||
113
+ baseName === 'AllTypeNames' ||
114
+ baseName === 'AllTypeNamesExcludeTypeNames')) {
113
115
  return true;
114
116
  }
115
117
  return false;
@@ -402,7 +404,10 @@ FieldNamePattern.forFieldNamesOfTypeName = (data) => {
402
404
  }
403
405
  _typeNames.forEach(typeName => {
404
406
  var _a;
405
- expandedPattern[typeName.value] = [...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []), ..._fieldNames];
407
+ expandedPattern[typeName.value] = [
408
+ ...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []),
409
+ ..._fieldNames,
410
+ ];
406
411
  });
407
412
  });
408
413
  return FieldNamePattern.fromString(Object.keys(expandedPattern)
@@ -475,7 +480,10 @@ FieldNamePattern.forAllFieldNamesExcludeFieldNamesOfTypeName = (data) => {
475
480
  }
476
481
  _typeNames.forEach(typeName => {
477
482
  var _a;
478
- expandedPattern[typeName.value] = [...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []), ..._fieldNames];
483
+ expandedPattern[typeName.value] = [
484
+ ...((_a = expandedPattern[typeName.value]) !== null && _a !== void 0 ? _a : []),
485
+ ..._fieldNames,
486
+ ];
479
487
  });
480
488
  });
481
489
  return FieldNamePattern.fromString(Object.keys(expandedPattern)
@@ -4,8 +4,17 @@ export const APPLIES_ON_CLASS = ['class'];
4
4
  export const APPLIES_ON_DEFAULT_FACTORY = ['factory', 'default_factory'];
5
5
  export const APPLIES_ON_UNION_FACTORY = ['factory', 'named_factory', 'union_factory'];
6
6
  export const APPLIES_ON_MERGED_FACTORY = ['factory', 'named_factory', 'merged_factory'];
7
- export const APPLIES_ON_FACTORY = ['factory', 'default_factory', 'named_factory', 'merged_factory', 'union_factory'];
8
- export const APPLIES_ON_DEFAULT_FACTORY_PARAMETERS = ['parameter', 'default_factory_parameter'];
7
+ export const APPLIES_ON_FACTORY = [
8
+ 'factory',
9
+ 'default_factory',
10
+ 'named_factory',
11
+ 'merged_factory',
12
+ 'union_factory',
13
+ ];
14
+ export const APPLIES_ON_DEFAULT_FACTORY_PARAMETERS = [
15
+ 'parameter',
16
+ 'default_factory_parameter',
17
+ ];
9
18
  export const APPLIES_ON_UNION_FACTORY_PARAMETERS = [
10
19
  'parameter',
11
20
  'named_factory_parameter',
@@ -23,7 +32,13 @@ export const APPLIES_ON_PARAMETERS = [
23
32
  'union_factory_parameter',
24
33
  'merged_factory_parameter',
25
34
  ];
26
- export const APPLIES_ON_ALL_BLOCKS = ['enum', 'enum_value', 'class', 'factory', 'parameter'];
35
+ export const APPLIES_ON_ALL_BLOCKS = [
36
+ 'enum',
37
+ 'enum_value',
38
+ 'class',
39
+ 'factory',
40
+ 'parameter',
41
+ ];
27
42
  /**
28
43
  * maps GraphQL scalar types to Dart's scalar types
29
44
  */
@@ -1,11 +1,11 @@
1
- import { indent } from '@graphql-codegen/visitor-plugin-common';
2
1
  import { Kind } from 'graphql';
2
+ import { indent } from '@graphql-codegen/visitor-plugin-common';
3
3
  import { Config } from '../config/config-value.js';
4
+ import { TypeName } from '../config/pattern.js';
4
5
  import { APPLIES_ON_CLASS } from '../config/plugin-config.js';
6
+ import { nodeIsObjectType, stringIsNotEmpty } from '../utils.js';
5
7
  import { FactoryBlock } from './factory-block.js';
6
- import { TypeName } from '../config/pattern.js';
7
8
  import { Block } from './index.js';
8
- import { nodeIsObjectType, stringIsNotEmpty } from '../utils.js';
9
9
  export class ClassBlock {
10
10
  static build(config, node) {
11
11
  const typeName = TypeName.fromString(node.name.value);
@@ -48,7 +48,9 @@ ClassBlock.decorateAsFreezed = (config, node) => {
48
48
  .filter(value => value !== undefined)
49
49
  .map(value => indent(value))
50
50
  .join('');
51
- return stringIsNotEmpty(body) ? `@Freezed(\n${body})\n` : ClassBlock.decorateAsUnfreezed(config, node);
51
+ return stringIsNotEmpty(body)
52
+ ? `@Freezed(\n${body})\n`
53
+ : ClassBlock.decorateAsUnfreezed(config, node);
52
54
  };
53
55
  ClassBlock.decorateAsUnfreezed = (config, node) => {
54
56
  const typeName = TypeName.fromString(node.name.value);
@@ -1,9 +1,9 @@
1
- import { TypeName, FieldName } from '../config/pattern.js';
2
- import { APPLIES_ON_ENUM, APPLIES_ON_ENUM_VALUE } from '../config/plugin-config.js';
3
1
  import { indent } from '@graphql-codegen/visitor-plugin-common';
4
- import { Block } from './index.js';
5
2
  import { Config } from '../config/config-value.js';
3
+ import { FieldName, TypeName } from '../config/pattern.js';
4
+ import { APPLIES_ON_ENUM, APPLIES_ON_ENUM_VALUE, } from '../config/plugin-config.js';
6
5
  import { atJsonKeyDecorator, stringIsNotEmpty } from '../utils.js';
6
+ import { Block } from './index.js';
7
7
  export class EnumBlock {
8
8
  // TODO: @next-version: Implement enhanced enums
9
9
  static build(config, node) {
@@ -1,10 +1,10 @@
1
1
  import { indent } from '@graphql-codegen/visitor-plugin-common';
2
2
  import { Config } from '../config/config-value.js';
3
3
  import { TypeName } from '../config/pattern.js';
4
- import { APPLIES_ON_DEFAULT_FACTORY, APPLIES_ON_UNION_FACTORY, APPLIES_ON_MERGED_FACTORY, APPLIES_ON_DEFAULT_FACTORY_PARAMETERS, APPLIES_ON_UNION_FACTORY_PARAMETERS, APPLIES_ON_MERGED_FACTORY_PARAMETERS, } from '../config/plugin-config.js';
4
+ import { APPLIES_ON_DEFAULT_FACTORY, APPLIES_ON_DEFAULT_FACTORY_PARAMETERS, APPLIES_ON_MERGED_FACTORY, APPLIES_ON_MERGED_FACTORY_PARAMETERS, APPLIES_ON_UNION_FACTORY, APPLIES_ON_UNION_FACTORY_PARAMETERS, } from '../config/plugin-config.js';
5
+ import { stringIsNotEmpty } from '../utils.js';
5
6
  import { Block } from './index.js';
6
7
  import { ParameterBlock } from './parameter-block.js';
7
- import { stringIsNotEmpty } from '../utils.js';
8
8
  export class FactoryBlock {
9
9
  static build(config, node, blockAppliesOn, className, factoryName) {
10
10
  let block = '';
@@ -19,13 +19,17 @@ export class FactoryBlock {
19
19
  }
20
20
  FactoryBlock.buildDecorators = (config, blockAppliesOn, className, factoryName) => {
21
21
  // TODO: @Assert
22
- const typeName = factoryName ? TypeName.fromUnionOfTypeNames(className, factoryName) : className;
22
+ const typeName = factoryName
23
+ ? TypeName.fromUnionOfTypeNames(className, factoryName)
24
+ : className;
23
25
  const deprecatedDecorator = Config.deprecated(config, blockAppliesOn, typeName);
24
26
  const decorators = [deprecatedDecorator].join('');
25
27
  return stringIsNotEmpty(decorators) ? indent(decorators) : decorators;
26
28
  };
27
29
  FactoryBlock.buildHeader = (config, blockAppliesOn, className, factoryName) => {
28
- const typeName = factoryName ? TypeName.fromUnionOfTypeNames(className, factoryName) : className;
30
+ const typeName = factoryName
31
+ ? TypeName.fromUnionOfTypeNames(className, factoryName)
32
+ : className;
29
33
  const immutable = Config.immutable(config, typeName);
30
34
  // const mutableInputs = Config.mutableInputs(config, factoryName);
31
35
  // const mutable = immutable !== true || (node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION && mutableInputs);
@@ -1,7 +1,7 @@
1
1
  import { snakeCase } from 'change-case-all';
2
2
  import { Kind } from 'graphql';
3
- import { TypeName } from '../config/pattern.js';
4
3
  import { Config } from '../config/config-value.js';
4
+ import { TypeName } from '../config/pattern.js';
5
5
  import { dartCasing, escapeDartKeyword, isDartKeyword, nodeIsObjectType } from '../utils.js';
6
6
  import { ClassBlock } from './class-block.js';
7
7
  import { EnumBlock } from './enum-block.js';
@@ -39,7 +39,9 @@ Block.build = (config, node, nodeRepository) => {
39
39
  if (nodeIsObjectType(node)) {
40
40
  nodeRepository.register(node);
41
41
  }
42
- return node.kind === Kind.ENUM_TYPE_DEFINITION ? EnumBlock.build(config, node) : ClassBlock.build(config, node);
42
+ return node.kind === Kind.ENUM_TYPE_DEFINITION
43
+ ? EnumBlock.build(config, node)
44
+ : ClassBlock.build(config, node);
43
45
  };
44
46
  Block.buildComment = (node) => {
45
47
  var _a;
@@ -1,4 +1,3 @@
1
- //#region NodeRepository classes
2
1
  import { nodeIsObjectType } from '../utils.js';
3
2
  /**
4
3
  * stores an instance of `ObjectTypeDefinitionNode` or `InputObjectTypeDefinitionNode` using the node name as the key
@@ -1,9 +1,9 @@
1
1
  var _a;
2
- import { atJsonKeyDecorator, stringIsNotEmpty } from '../utils.js';
2
+ import { indent } from '@graphql-codegen/visitor-plugin-common';
3
3
  import { Config } from '../config/config-value.js';
4
4
  import { FieldName, TypeName } from '../config/pattern.js';
5
+ import { atJsonKeyDecorator, stringIsNotEmpty } from '../utils.js';
5
6
  import { Block } from './index.js';
6
- import { indent } from '@graphql-codegen/visitor-plugin-common';
7
7
  export class ParameterBlock {
8
8
  static build(config, node, field, blockAppliesOn) {
9
9
  const typeName = TypeName.fromString(node.name.value);
package/esm/utils.js CHANGED
@@ -1,9 +1,9 @@
1
1
  //#region helpers
2
2
  import { camelCase, pascalCase, snakeCase } from 'change-case-all';
3
- import { Kind } from 'graphql';
3
+ import { Kind, } from 'graphql';
4
4
  import { Config } from './config/config-value.js';
5
- import { DART_KEYWORDS } from './config/plugin-config.js';
6
- export const strToList = (str) => (str.length < 1 ? [] : str.split(/\s*,\s*/gim).filter(s => s.length > 0));
5
+ import { DART_KEYWORDS, } from './config/plugin-config.js';
6
+ export const strToList = (str) => str.length < 1 ? [] : str.split(/\s*,\s*/gim).filter(s => s.length > 0);
7
7
  export const arrayWrap = (value) => value === undefined ? [] : Array.isArray(value) ? value : [value];
8
8
  export const resetIndex = (regexp) => (regexp.lastIndex = 0);
9
9
  export const nodeIsObjectType = (node) => node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/flutter-freezed",
3
- "version": "3.0.2",
3
+ "version": "4.0.0-alpha-20230524083052-08ce957b4",
4
4
  "description": "GraphQL Code Generator plugin to generate Freezed models from your GraphQL schema",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
@@ -19,6 +19,9 @@
19
19
  "directory": "packages/plugins/typescript/typescript"
20
20
  },
21
21
  "license": "MIT",
22
+ "engines": {
23
+ "node": ">= 16.0.0"
24
+ },
22
25
  "main": "cjs/index.js",
23
26
  "module": "esm/index.js",
24
27
  "typings": "typings/index.d.ts",
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * A list of GraphQL Type Names
3
3
  */
4
- declare type TypeNames = TypeName | TypeName[];
4
+ type TypeNames = TypeName | TypeName[];
5
5
  /**
6
6
  * A list of field names of a GraphQL Type
7
7
  */
8
- declare type FieldNames = FieldName | FieldName[];
8
+ type FieldNames = FieldName | FieldName[];
9
9
  /**
10
10
  * @name TypeName
11
11
  * @description represents a single valid GraphQL Type Name used in the GraphQL Schema provided
@@ -245,7 +245,7 @@ export declare class FieldNamePattern extends Pattern {
245
245
  static regexpForAllFieldNamesExcludeFieldNamesOfAllTypeNamesExcludeTypeNames: RegExp;
246
246
  static matchAndConfigureAllFieldNamesExcludeFieldNamesOfAllTypeNamesExcludeTypeNames: (pattern: FieldNamePattern, typeName: TypeName, fieldName: FieldName) => MatchAndConfigure;
247
247
  }
248
- export declare type MatchAndConfigure = Record<string, {
248
+ export type MatchAndConfigure = Record<string, {
249
249
  matchFound: boolean;
250
250
  shouldBeConfigured: boolean;
251
251
  }>;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * A list of GraphQL Type Names
3
3
  */
4
- declare type TypeNames = TypeName | TypeName[];
4
+ type TypeNames = TypeName | TypeName[];
5
5
  /**
6
6
  * A list of field names of a GraphQL Type
7
7
  */
8
- declare type FieldNames = FieldName | FieldName[];
8
+ type FieldNames = FieldName | FieldName[];
9
9
  /**
10
10
  * @name TypeName
11
11
  * @description represents a single valid GraphQL Type Name used in the GraphQL Schema provided
@@ -245,7 +245,7 @@ export declare class FieldNamePattern extends Pattern {
245
245
  static regexpForAllFieldNamesExcludeFieldNamesOfAllTypeNamesExcludeTypeNames: RegExp;
246
246
  static matchAndConfigureAllFieldNamesExcludeFieldNamesOfAllTypeNamesExcludeTypeNames: (pattern: FieldNamePattern, typeName: TypeName, fieldName: FieldName) => MatchAndConfigure;
247
247
  }
248
- export declare type MatchAndConfigure = Record<string, {
248
+ export type MatchAndConfigure = Record<string, {
249
249
  matchFound: boolean;
250
250
  shouldBeConfigured: boolean;
251
251
  }>;
@@ -1,10 +1,10 @@
1
- import { ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode, UnionTypeDefinitionNode, EnumTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode } from 'graphql';
2
- import { TypeNamePattern, TypeName, FieldNamePattern, Pattern } from './pattern.cjs';
1
+ import { EnumTypeDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, UnionTypeDefinitionNode } from 'graphql';
2
+ import { FieldNamePattern, Pattern, TypeName, TypeNamePattern } from './pattern.cjs';
3
3
  /**
4
4
  * @name FlutterFreezedPluginConfig
5
5
  * @description configure the `flutter-freezed` plugin
6
6
  */
7
- export declare type FlutterFreezedPluginConfig = {
7
+ export type FlutterFreezedPluginConfig = {
8
8
  /**
9
9
  * @name camelCasedEnums
10
10
  * @type {(boolean | DartIdentifierCasing)}
@@ -604,41 +604,41 @@ export declare type FlutterFreezedPluginConfig = {
604
604
  * @name ApplyDecoratorOn
605
605
  * @description Values that are passed to the `DecoratorToFreezed.applyOn` field that specifies where the custom decorator should be applied
606
606
  */
607
- export declare type AppliesOn = 'enum' | 'enum_value' | 'class' | 'factory' | 'default_factory' | 'named_factory' | 'union_factory' | 'merged_factory' | 'parameter' | 'default_factory_parameter' | 'named_factory_parameter' | 'union_factory_parameter' | 'merged_factory_parameter';
607
+ export type AppliesOn = 'enum' | 'enum_value' | 'class' | 'factory' | 'default_factory' | 'named_factory' | 'union_factory' | 'merged_factory' | 'parameter' | 'default_factory_parameter' | 'named_factory_parameter' | 'union_factory_parameter' | 'merged_factory_parameter';
608
608
  export declare const APPLIES_ON_ENUM: readonly ["enum"];
609
- export declare type AppliesOnEnum = (typeof APPLIES_ON_ENUM)[number];
609
+ export type AppliesOnEnum = (typeof APPLIES_ON_ENUM)[number];
610
610
  export declare const APPLIES_ON_ENUM_VALUE: readonly ["enum_value"];
611
- export declare type AppliesOnEnumValue = (typeof APPLIES_ON_ENUM_VALUE)[number];
611
+ export type AppliesOnEnumValue = (typeof APPLIES_ON_ENUM_VALUE)[number];
612
612
  export declare const APPLIES_ON_CLASS: readonly ["class"];
613
- export declare type AppliesOnClass = (typeof APPLIES_ON_CLASS)[number];
613
+ export type AppliesOnClass = (typeof APPLIES_ON_CLASS)[number];
614
614
  export declare const APPLIES_ON_DEFAULT_FACTORY: readonly ["factory", "default_factory"];
615
- export declare type AppliesOnDefaultFactory = (typeof APPLIES_ON_DEFAULT_FACTORY)[number];
615
+ export type AppliesOnDefaultFactory = (typeof APPLIES_ON_DEFAULT_FACTORY)[number];
616
616
  export declare const APPLIES_ON_UNION_FACTORY: readonly ["factory", "named_factory", "union_factory"];
617
- export declare type AppliesOnUnionFactory = (typeof APPLIES_ON_UNION_FACTORY)[number];
617
+ export type AppliesOnUnionFactory = (typeof APPLIES_ON_UNION_FACTORY)[number];
618
618
  export declare const APPLIES_ON_MERGED_FACTORY: readonly ["factory", "named_factory", "merged_factory"];
619
- export declare type AppliesOnMergedFactory = (typeof APPLIES_ON_MERGED_FACTORY)[number];
620
- export declare type AppliesOnNamedFactory = AppliesOnUnionFactory | AppliesOnMergedFactory;
619
+ export type AppliesOnMergedFactory = (typeof APPLIES_ON_MERGED_FACTORY)[number];
620
+ export type AppliesOnNamedFactory = AppliesOnUnionFactory | AppliesOnMergedFactory;
621
621
  export declare const APPLIES_ON_FACTORY: string[];
622
- export declare type AppliesOnFactory = AppliesOnDefaultFactory | AppliesOnNamedFactory;
622
+ export type AppliesOnFactory = AppliesOnDefaultFactory | AppliesOnNamedFactory;
623
623
  export declare const APPLIES_ON_DEFAULT_FACTORY_PARAMETERS: readonly ["parameter", "default_factory_parameter"];
624
- export declare type AppliesOnDefaultFactoryParameters = (typeof APPLIES_ON_DEFAULT_FACTORY_PARAMETERS)[number];
624
+ export type AppliesOnDefaultFactoryParameters = (typeof APPLIES_ON_DEFAULT_FACTORY_PARAMETERS)[number];
625
625
  export declare const APPLIES_ON_UNION_FACTORY_PARAMETERS: readonly ["parameter", "named_factory_parameter", "union_factory_parameter"];
626
- export declare type AppliesOnUnionFactoryParameters = (typeof APPLIES_ON_UNION_FACTORY_PARAMETERS)[number];
626
+ export type AppliesOnUnionFactoryParameters = (typeof APPLIES_ON_UNION_FACTORY_PARAMETERS)[number];
627
627
  export declare const APPLIES_ON_MERGED_FACTORY_PARAMETERS: readonly ["parameter", "named_factory_parameter", "merged_factory_parameter"];
628
- export declare type AppliesOnMergedFactoryParameters = (typeof APPLIES_ON_MERGED_FACTORY_PARAMETERS)[number];
629
- export declare type AppliesOnNamedParameters = AppliesOnUnionFactoryParameters | AppliesOnMergedFactoryParameters;
628
+ export type AppliesOnMergedFactoryParameters = (typeof APPLIES_ON_MERGED_FACTORY_PARAMETERS)[number];
629
+ export type AppliesOnNamedParameters = AppliesOnUnionFactoryParameters | AppliesOnMergedFactoryParameters;
630
630
  export declare const APPLIES_ON_PARAMETERS: readonly ["parameter", "default_factory_parameter", "named_factory_parameter", "union_factory_parameter", "merged_factory_parameter"];
631
- export declare type AppliesOnParameters = AppliesOnDefaultFactoryParameters | AppliesOnNamedParameters;
631
+ export type AppliesOnParameters = AppliesOnDefaultFactoryParameters | AppliesOnNamedParameters;
632
632
  export declare const APPLIES_ON_ALL_BLOCKS: readonly ["enum", "enum_value", "class", "factory", "parameter"];
633
- export declare type DartIdentifierCasing = 'snake_case' | 'camelCase' | 'PascalCase';
634
- export declare type NodeType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode;
635
- export declare type FieldType = FieldDefinitionNode | InputValueDefinitionNode;
636
- export declare type ObjectType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode;
637
- export declare type ConfigOption = keyof FlutterFreezedPluginConfig;
638
- export declare type FreezedOption = Extract<ConfigOption, 'copyWith' | 'equal' | 'immutable' | 'makeCollectionsUnmodifiable' | 'mutableInputs' | 'privateEmptyConstructor'>;
639
- export declare type TypeFieldNameOption = Extract<ConfigOption, 'defaultValues' | 'deprecated' | 'escapeDartKeywords' | 'final' | 'fromJsonToJson'>;
640
- export declare type MultiConstructorOption = FlutterFreezedPluginConfig['unionClass'];
641
- export declare type UnionValueCase = 'FreezedUnionCase.camel' | 'FreezedUnionCase.pascal';
633
+ export type DartIdentifierCasing = 'snake_case' | 'camelCase' | 'PascalCase';
634
+ export type NodeType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode;
635
+ export type FieldType = FieldDefinitionNode | InputValueDefinitionNode;
636
+ export type ObjectType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode;
637
+ export type ConfigOption = keyof FlutterFreezedPluginConfig;
638
+ export type FreezedOption = Extract<ConfigOption, 'copyWith' | 'equal' | 'immutable' | 'makeCollectionsUnmodifiable' | 'mutableInputs' | 'privateEmptyConstructor'>;
639
+ export type TypeFieldNameOption = Extract<ConfigOption, 'defaultValues' | 'deprecated' | 'escapeDartKeywords' | 'final' | 'fromJsonToJson'>;
640
+ export type MultiConstructorOption = FlutterFreezedPluginConfig['unionClass'];
641
+ export type UnionValueCase = 'FreezedUnionCase.camel' | 'FreezedUnionCase.pascal';
642
642
  /**
643
643
  * maps GraphQL scalar types to Dart's scalar types
644
644
  */
@@ -1,10 +1,10 @@
1
- import { ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode, UnionTypeDefinitionNode, EnumTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode } from 'graphql';
2
- import { TypeNamePattern, TypeName, FieldNamePattern, Pattern } from './pattern.js';
1
+ import { EnumTypeDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, UnionTypeDefinitionNode } from 'graphql';
2
+ import { FieldNamePattern, Pattern, TypeName, TypeNamePattern } from './pattern.js';
3
3
  /**
4
4
  * @name FlutterFreezedPluginConfig
5
5
  * @description configure the `flutter-freezed` plugin
6
6
  */
7
- export declare type FlutterFreezedPluginConfig = {
7
+ export type FlutterFreezedPluginConfig = {
8
8
  /**
9
9
  * @name camelCasedEnums
10
10
  * @type {(boolean | DartIdentifierCasing)}
@@ -604,41 +604,41 @@ export declare type FlutterFreezedPluginConfig = {
604
604
  * @name ApplyDecoratorOn
605
605
  * @description Values that are passed to the `DecoratorToFreezed.applyOn` field that specifies where the custom decorator should be applied
606
606
  */
607
- export declare type AppliesOn = 'enum' | 'enum_value' | 'class' | 'factory' | 'default_factory' | 'named_factory' | 'union_factory' | 'merged_factory' | 'parameter' | 'default_factory_parameter' | 'named_factory_parameter' | 'union_factory_parameter' | 'merged_factory_parameter';
607
+ export type AppliesOn = 'enum' | 'enum_value' | 'class' | 'factory' | 'default_factory' | 'named_factory' | 'union_factory' | 'merged_factory' | 'parameter' | 'default_factory_parameter' | 'named_factory_parameter' | 'union_factory_parameter' | 'merged_factory_parameter';
608
608
  export declare const APPLIES_ON_ENUM: readonly ["enum"];
609
- export declare type AppliesOnEnum = (typeof APPLIES_ON_ENUM)[number];
609
+ export type AppliesOnEnum = (typeof APPLIES_ON_ENUM)[number];
610
610
  export declare const APPLIES_ON_ENUM_VALUE: readonly ["enum_value"];
611
- export declare type AppliesOnEnumValue = (typeof APPLIES_ON_ENUM_VALUE)[number];
611
+ export type AppliesOnEnumValue = (typeof APPLIES_ON_ENUM_VALUE)[number];
612
612
  export declare const APPLIES_ON_CLASS: readonly ["class"];
613
- export declare type AppliesOnClass = (typeof APPLIES_ON_CLASS)[number];
613
+ export type AppliesOnClass = (typeof APPLIES_ON_CLASS)[number];
614
614
  export declare const APPLIES_ON_DEFAULT_FACTORY: readonly ["factory", "default_factory"];
615
- export declare type AppliesOnDefaultFactory = (typeof APPLIES_ON_DEFAULT_FACTORY)[number];
615
+ export type AppliesOnDefaultFactory = (typeof APPLIES_ON_DEFAULT_FACTORY)[number];
616
616
  export declare const APPLIES_ON_UNION_FACTORY: readonly ["factory", "named_factory", "union_factory"];
617
- export declare type AppliesOnUnionFactory = (typeof APPLIES_ON_UNION_FACTORY)[number];
617
+ export type AppliesOnUnionFactory = (typeof APPLIES_ON_UNION_FACTORY)[number];
618
618
  export declare const APPLIES_ON_MERGED_FACTORY: readonly ["factory", "named_factory", "merged_factory"];
619
- export declare type AppliesOnMergedFactory = (typeof APPLIES_ON_MERGED_FACTORY)[number];
620
- export declare type AppliesOnNamedFactory = AppliesOnUnionFactory | AppliesOnMergedFactory;
619
+ export type AppliesOnMergedFactory = (typeof APPLIES_ON_MERGED_FACTORY)[number];
620
+ export type AppliesOnNamedFactory = AppliesOnUnionFactory | AppliesOnMergedFactory;
621
621
  export declare const APPLIES_ON_FACTORY: string[];
622
- export declare type AppliesOnFactory = AppliesOnDefaultFactory | AppliesOnNamedFactory;
622
+ export type AppliesOnFactory = AppliesOnDefaultFactory | AppliesOnNamedFactory;
623
623
  export declare const APPLIES_ON_DEFAULT_FACTORY_PARAMETERS: readonly ["parameter", "default_factory_parameter"];
624
- export declare type AppliesOnDefaultFactoryParameters = (typeof APPLIES_ON_DEFAULT_FACTORY_PARAMETERS)[number];
624
+ export type AppliesOnDefaultFactoryParameters = (typeof APPLIES_ON_DEFAULT_FACTORY_PARAMETERS)[number];
625
625
  export declare const APPLIES_ON_UNION_FACTORY_PARAMETERS: readonly ["parameter", "named_factory_parameter", "union_factory_parameter"];
626
- export declare type AppliesOnUnionFactoryParameters = (typeof APPLIES_ON_UNION_FACTORY_PARAMETERS)[number];
626
+ export type AppliesOnUnionFactoryParameters = (typeof APPLIES_ON_UNION_FACTORY_PARAMETERS)[number];
627
627
  export declare const APPLIES_ON_MERGED_FACTORY_PARAMETERS: readonly ["parameter", "named_factory_parameter", "merged_factory_parameter"];
628
- export declare type AppliesOnMergedFactoryParameters = (typeof APPLIES_ON_MERGED_FACTORY_PARAMETERS)[number];
629
- export declare type AppliesOnNamedParameters = AppliesOnUnionFactoryParameters | AppliesOnMergedFactoryParameters;
628
+ export type AppliesOnMergedFactoryParameters = (typeof APPLIES_ON_MERGED_FACTORY_PARAMETERS)[number];
629
+ export type AppliesOnNamedParameters = AppliesOnUnionFactoryParameters | AppliesOnMergedFactoryParameters;
630
630
  export declare const APPLIES_ON_PARAMETERS: readonly ["parameter", "default_factory_parameter", "named_factory_parameter", "union_factory_parameter", "merged_factory_parameter"];
631
- export declare type AppliesOnParameters = AppliesOnDefaultFactoryParameters | AppliesOnNamedParameters;
631
+ export type AppliesOnParameters = AppliesOnDefaultFactoryParameters | AppliesOnNamedParameters;
632
632
  export declare const APPLIES_ON_ALL_BLOCKS: readonly ["enum", "enum_value", "class", "factory", "parameter"];
633
- export declare type DartIdentifierCasing = 'snake_case' | 'camelCase' | 'PascalCase';
634
- export declare type NodeType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode;
635
- export declare type FieldType = FieldDefinitionNode | InputValueDefinitionNode;
636
- export declare type ObjectType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode;
637
- export declare type ConfigOption = keyof FlutterFreezedPluginConfig;
638
- export declare type FreezedOption = Extract<ConfigOption, 'copyWith' | 'equal' | 'immutable' | 'makeCollectionsUnmodifiable' | 'mutableInputs' | 'privateEmptyConstructor'>;
639
- export declare type TypeFieldNameOption = Extract<ConfigOption, 'defaultValues' | 'deprecated' | 'escapeDartKeywords' | 'final' | 'fromJsonToJson'>;
640
- export declare type MultiConstructorOption = FlutterFreezedPluginConfig['unionClass'];
641
- export declare type UnionValueCase = 'FreezedUnionCase.camel' | 'FreezedUnionCase.pascal';
633
+ export type DartIdentifierCasing = 'snake_case' | 'camelCase' | 'PascalCase';
634
+ export type NodeType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode;
635
+ export type FieldType = FieldDefinitionNode | InputValueDefinitionNode;
636
+ export type ObjectType = ObjectTypeDefinitionNode | InputObjectTypeDefinitionNode;
637
+ export type ConfigOption = keyof FlutterFreezedPluginConfig;
638
+ export type FreezedOption = Extract<ConfigOption, 'copyWith' | 'equal' | 'immutable' | 'makeCollectionsUnmodifiable' | 'mutableInputs' | 'privateEmptyConstructor'>;
639
+ export type TypeFieldNameOption = Extract<ConfigOption, 'defaultValues' | 'deprecated' | 'escapeDartKeywords' | 'final' | 'fromJsonToJson'>;
640
+ export type MultiConstructorOption = FlutterFreezedPluginConfig['unionClass'];
641
+ export type UnionValueCase = 'FreezedUnionCase.camel' | 'FreezedUnionCase.pascal';
642
642
  /**
643
643
  * maps GraphQL scalar types to Dart's scalar types
644
644
  */
@@ -1,5 +1,5 @@
1
- import { FlutterFreezedPluginConfig, NodeType } from '../config/plugin-config.cjs';
2
1
  import { TypeName } from '../config/pattern.cjs';
2
+ import { FlutterFreezedPluginConfig, NodeType } from '../config/plugin-config.cjs';
3
3
  export declare class ClassBlock {
4
4
  static build(config: FlutterFreezedPluginConfig, node: NodeType): string;
5
5
  static buildDecorators: (config: FlutterFreezedPluginConfig, node: NodeType) => string;
@@ -1,5 +1,5 @@
1
- import { FlutterFreezedPluginConfig, NodeType } from '../config/plugin-config.js';
2
1
  import { TypeName } from '../config/pattern.js';
2
+ import { FlutterFreezedPluginConfig, NodeType } from '../config/plugin-config.js';
3
3
  export declare class ClassBlock {
4
4
  static build(config: FlutterFreezedPluginConfig, node: NodeType): string;
5
5
  static buildDecorators: (config: FlutterFreezedPluginConfig, node: NodeType) => string;
@@ -1,5 +1,5 @@
1
1
  import { TypeName } from '../config/pattern.cjs';
2
- import { FlutterFreezedPluginConfig, ObjectType, AppliesOnFactory, AppliesOnDefaultFactory, AppliesOnNamedFactory } from '../config/plugin-config.cjs';
2
+ import { AppliesOnDefaultFactory, AppliesOnFactory, AppliesOnNamedFactory, FlutterFreezedPluginConfig, ObjectType } from '../config/plugin-config.cjs';
3
3
  import { NodeRepository } from './node-repository.cjs';
4
4
  export declare class FactoryBlock {
5
5
  static build(config: FlutterFreezedPluginConfig, node: ObjectType, blockAppliesOn: readonly AppliesOnFactory[], className: TypeName, factoryName?: TypeName): string;
@@ -1,5 +1,5 @@
1
1
  import { TypeName } from '../config/pattern.js';
2
- import { FlutterFreezedPluginConfig, ObjectType, AppliesOnFactory, AppliesOnDefaultFactory, AppliesOnNamedFactory } from '../config/plugin-config.js';
2
+ import { AppliesOnDefaultFactory, AppliesOnFactory, AppliesOnNamedFactory, FlutterFreezedPluginConfig, ObjectType } from '../config/plugin-config.js';
3
3
  import { NodeRepository } from './node-repository.js';
4
4
  export declare class FactoryBlock {
5
5
  static build(config: FlutterFreezedPluginConfig, node: ObjectType, blockAppliesOn: readonly AppliesOnFactory[], className: TypeName, factoryName?: TypeName): string;
@@ -1,4 +1,4 @@
1
- import { DefinitionNode, ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode } from 'graphql';
1
+ import { DefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql';
2
2
  import { FieldName, TypeName } from './config/pattern.cjs';
3
3
  import { AppliesOn, DartIdentifierCasing, FlutterFreezedPluginConfig } from './config/plugin-config.cjs';
4
4
  export declare const strToList: (str: string) => string[];
@@ -22,7 +22,7 @@ export declare const isDartKeyword: (identifier: string) => boolean;
22
22
  * @returns
23
23
  */
24
24
  export declare const escapeDartKeyword: (config: FlutterFreezedPluginConfig, blockAppliesOn: readonly AppliesOn[], identifier: string, typeName?: TypeName, fieldName?: FieldName) => string;
25
- declare type JsonKeyOptions = {
25
+ type JsonKeyOptions = {
26
26
  defaultValue?: string;
27
27
  disallowNullValue?: boolean;
28
28
  fromJson?: string;
@@ -1,4 +1,4 @@
1
- import { DefinitionNode, ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode } from 'graphql';
1
+ import { DefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql';
2
2
  import { FieldName, TypeName } from './config/pattern.js';
3
3
  import { AppliesOn, DartIdentifierCasing, FlutterFreezedPluginConfig } from './config/plugin-config.js';
4
4
  export declare const strToList: (str: string) => string[];
@@ -22,7 +22,7 @@ export declare const isDartKeyword: (identifier: string) => boolean;
22
22
  * @returns
23
23
  */
24
24
  export declare const escapeDartKeyword: (config: FlutterFreezedPluginConfig, blockAppliesOn: readonly AppliesOn[], identifier: string, typeName?: TypeName, fieldName?: FieldName) => string;
25
- declare type JsonKeyOptions = {
25
+ type JsonKeyOptions = {
26
26
  defaultValue?: string;
27
27
  disallowNullValue?: boolean;
28
28
  fromJson?: string;