@graphql-codegen/flutter-freezed 2.11.2 → 3.0.1-alpha-20230130180936-04996f117

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 (53) hide show
  1. package/cjs/config/config-value.js +132 -0
  2. package/cjs/config/pattern.js +731 -0
  3. package/cjs/config/plugin-config.js +141 -0
  4. package/cjs/freezed-declaration-blocks/class-block.js +86 -224
  5. package/cjs/freezed-declaration-blocks/enum-block.js +54 -0
  6. package/cjs/freezed-declaration-blocks/factory-block.js +81 -113
  7. package/cjs/freezed-declaration-blocks/index.js +91 -4
  8. package/cjs/freezed-declaration-blocks/node-repository.js +26 -0
  9. package/cjs/freezed-declaration-blocks/parameter-block.js +55 -143
  10. package/cjs/index.js +10 -14
  11. package/cjs/schema-visitor.js +8 -7
  12. package/cjs/utils.js +64 -219
  13. package/esm/config/config-value.js +128 -0
  14. package/esm/config/pattern.js +723 -0
  15. package/esm/config/plugin-config.js +138 -0
  16. package/esm/freezed-declaration-blocks/class-block.js +85 -223
  17. package/esm/freezed-declaration-blocks/enum-block.js +50 -0
  18. package/esm/freezed-declaration-blocks/factory-block.js +81 -113
  19. package/esm/freezed-declaration-blocks/index.js +89 -3
  20. package/esm/freezed-declaration-blocks/node-repository.js +22 -0
  21. package/esm/freezed-declaration-blocks/parameter-block.js +53 -141
  22. package/esm/index.js +11 -15
  23. package/esm/schema-visitor.js +8 -7
  24. package/esm/utils.js +56 -212
  25. package/package.json +5 -5
  26. package/typings/config/config-value.d.cts +24 -0
  27. package/typings/config/config-value.d.ts +24 -0
  28. package/typings/config/pattern.d.cts +252 -0
  29. package/typings/config/pattern.d.ts +252 -0
  30. package/typings/config/plugin-config.d.cts +727 -0
  31. package/typings/config/plugin-config.d.ts +727 -0
  32. package/typings/freezed-declaration-blocks/class-block.d.cts +11 -35
  33. package/typings/freezed-declaration-blocks/class-block.d.ts +11 -35
  34. package/typings/freezed-declaration-blocks/enum-block.d.cts +10 -0
  35. package/typings/freezed-declaration-blocks/enum-block.d.ts +10 -0
  36. package/typings/freezed-declaration-blocks/factory-block.d.cts +16 -37
  37. package/typings/freezed-declaration-blocks/factory-block.d.ts +16 -37
  38. package/typings/freezed-declaration-blocks/index.d.cts +27 -3
  39. package/typings/freezed-declaration-blocks/index.d.ts +27 -3
  40. package/typings/freezed-declaration-blocks/node-repository.d.cts +10 -0
  41. package/typings/freezed-declaration-blocks/node-repository.d.ts +10 -0
  42. package/typings/freezed-declaration-blocks/parameter-block.d.cts +11 -44
  43. package/typings/freezed-declaration-blocks/parameter-block.d.ts +11 -44
  44. package/typings/index.d.cts +1 -1
  45. package/typings/index.d.ts +1 -1
  46. package/typings/schema-visitor.d.cts +7 -7
  47. package/typings/schema-visitor.d.ts +7 -7
  48. package/typings/utils.d.cts +33 -72
  49. package/typings/utils.d.ts +33 -72
  50. package/cjs/config.js +0 -2
  51. package/esm/config.js +0 -1
  52. package/typings/config.d.cts +0 -479
  53. package/typings/config.d.ts +0 -479
@@ -0,0 +1,727 @@
1
+ import { ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode, UnionTypeDefinitionNode, EnumTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode } from 'graphql';
2
+ import { TypeNamePattern, TypeName, FieldNamePattern, Pattern } from './pattern.cjs';
3
+ /**
4
+ * @name FlutterFreezedPluginConfig
5
+ * @description configure the `flutter-freezed` plugin
6
+ */
7
+ export declare type FlutterFreezedPluginConfig = {
8
+ /**
9
+ * @name camelCasedEnums
10
+ * @type {(boolean | DartIdentifierCasing)}
11
+ * @default true
12
+ * @summary Specify how Enum values should be cased.
13
+ * @description Setting this option to `true` will camelCase enum values as required by Dart's recommended linter.
14
+ *
15
+ * If set to false, the original casing as specified in the Graphql Schema is used
16
+ *
17
+ * You can also transform the casing by specifying your preferred casing for Enum values.
18
+ *
19
+ * Available options are: `'snake_case'`, `'camelCase'` and `'PascalCase'`
20
+ *
21
+ * For consistency, this option applies the same configuration to all Enum Types in the GraphQL Schema
22
+ * @exampleMarkdown
23
+ * ## Usage:
24
+ * ```ts filename='codegen.ts'
25
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
26
+ *
27
+ * const config: CodegenConfig = {
28
+ * // ...
29
+ * generates: {
30
+ * 'lib/data/models/app_models.dart': {
31
+ * plugins: {
32
+ * 'flutter-freezed': {
33
+ * // ...
34
+ * camelCasedEnums: true, // or false
35
+ * // OR: specify a DartIdentifierCasing
36
+ * camelCasedEnums: 'snake_case',
37
+ * },
38
+ * },
39
+ * },
40
+ * },
41
+ * };
42
+ * export default config;
43
+ * ```
44
+ */
45
+ camelCasedEnums?: boolean | DartIdentifierCasing;
46
+ /**
47
+ * @name copyWith
48
+ * @type {(boolean | TypeNamePattern)}
49
+ * @default undefined
50
+ * @see {@link https://pub.dev/packages/freezed#how-copywith-works How copyWith works}
51
+ * @see {@link https://pub.dev/documentation/freezed_annotation/latest/freezed_annotation/Freezed/copyWith.html Freezed annotation copyWith property}
52
+ * @summary enables Freezed copyWith helper method
53
+ * @description The [`freezed`](https://pub.dev/packages/freezed) library has this option enabled by default.
54
+ * Use this option to enable/disable this option completely.
55
+ *
56
+ * The plugin by default generates immutable Freezed models using the `@freezed` decorator.
57
+ *
58
+ * If this option is configured, the plugin will generate immutable Freezed models using the `@Freezed(copyWith: value)` instead.
59
+ *
60
+ * Setting a boolean value will enable/disable this option globally for every GraphQL Type
61
+ * but you can also set this option to `true` for one or more GraphQL Types using a `TypeNamePattern`.
62
+ * @exampleMarkdown
63
+ * ## Usage:
64
+ * ```ts filename='codegen.ts'
65
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
66
+ *
67
+ * const Droid = TypeName.fromString('Droid');
68
+ * const Starship = TypeName.fromString('Starship');
69
+ *
70
+ * const config: CodegenConfig = {
71
+ * // ...
72
+ * generates: {
73
+ * 'lib/data/models/app_models.dart': {
74
+ * plugins: {
75
+ * 'flutter-freezed': {
76
+ * // ...
77
+ * copyWith: true,
78
+ * // OR: enable it for only Droid and Starship GraphQL types
79
+ * copyWith: TypeNamePattern.forTypeNames([Droid, Starship]),
80
+ * },
81
+ * },
82
+ * },
83
+ * },
84
+ * };
85
+ * export default config;
86
+ * ```
87
+ */
88
+ copyWith?: boolean | TypeNamePattern;
89
+ /**
90
+ * @name customScalars
91
+ * @type {(Record<string, string>)}
92
+ * @default {}
93
+ * @summary Maps GraphQL Scalar Types to Dart built-in types
94
+ * @description The `key` is the GraphQL Scalar Type and the `value` is the equivalent Dart Type
95
+ *
96
+ * The plugin automatically handles built-in GraphQL Scalar Types so only specify the custom Scalars in your Graphql Schema.
97
+ * @exampleMarkdown
98
+ * ## Usage
99
+ * ```ts filename='codegen.ts'
100
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
101
+ *
102
+ * const config: CodegenConfig = {
103
+ * // ...
104
+ * generates: {
105
+ * 'lib/data/models/app_models.dart': {
106
+ * plugins: {
107
+ * 'flutter-freezed': {
108
+ * // ...
109
+ * customScalars: {
110
+ * jsonb: 'Map<String, dynamic>',
111
+ * timestamp: 'DateTime',
112
+ * UUID: 'String',
113
+ * },
114
+ * },
115
+ * },
116
+ * },
117
+ * },
118
+ * };
119
+ * export default config;
120
+ * ```
121
+ */
122
+ customScalars?: Record<string, string>;
123
+ /**
124
+ * @name defaultValues
125
+ * @type {([pattern: FieldNamePattern, value: string, appliesOn: AppliesOnParameters[]][])}
126
+ * @default undefined
127
+ * @see {@link https://pub.dev/packages/freezed#default-values Default values}
128
+ * @see {@link https://pub.dev/documentation/freezed_annotation/latest/freezed_annotation/Default-class.html Default class}
129
+ * @summary set the default value for a field.
130
+ * @description This will annotate the generated parameter with a `@Default(value: defaultValue)` decorator.
131
+ *
132
+ * The default value will be interpolated into the `@Default(value: ${value})` decorator so
133
+ * Use backticks for the value element so that you can use quotation marks for string values.
134
+ * E.g: `"I'm a string default value"` but `Episode.jedi` is not a string value.
135
+ *
136
+ * Use the `appliesOn` to specify where this option should be applied on
137
+ *
138
+ * @exampleMarkdown
139
+ * ## Usage:
140
+ * ```ts filename='codegen.ts'
141
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
142
+ *
143
+ * const MovieCharacter = TypeName.fromString('MovieCharacter');
144
+ * const appearsIn = FieldName.fromString('appearsIn');
145
+ *
146
+ * const config: CodegenConfig = {
147
+ * // ...
148
+ * generates: {
149
+ * 'lib/data/models/app_models.dart': {
150
+ * plugins: {
151
+ * 'flutter-freezed': {
152
+ * // ...
153
+ * defaultValues: [
154
+ * [FieldNamePattern.forFieldNamesOfTypeName(MovieCharacter, appearsIn), `Episode.jedi`, ['default_factory_parameter']],
155
+ * ],
156
+ * },
157
+ * },
158
+ * },
159
+ * },
160
+ * };
161
+ * export default config;
162
+ * ```
163
+ */
164
+ defaultValues?: [
165
+ pattern: FieldNamePattern,
166
+ value: string,
167
+ appliesOn: AppliesOnParameters[]
168
+ ][];
169
+ /**
170
+ * @name deprecated
171
+ * @type {([pattern: Pattern, appliesOn: (AppliesOnFactory | AppliesOnParameters)[]][])}
172
+ * @default undefined
173
+ * @see {@link https://pub.dev/packages/freezed#decorators-and-comments Decorators and comments}
174
+ * @summary a list of Graphql Types(factory constructors) or fields(parameters) to be marked as deprecated.
175
+ * @description Using a TypeNamePattern, you can mark an entire factory constructor for one or more GraphQL types as deprecated.
176
+ *
177
+ * Likewise, using a FieldNamePattern, you can mark one or more fields as deprecated
178
+ *
179
+ * Since the first element in the tuple has a type signature of `Pattern`,
180
+ * you can use either TypeNamePattern or FieldNamePattern or use both
181
+ * by composing them with `Pattern.compose(...)`
182
+ *
183
+ * Use the `appliesOn` to specify which block this option should be applied on
184
+ * @exampleMarkdown
185
+ * ## Usage:
186
+ *
187
+ * ```ts filename='codegen.ts'
188
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
189
+ *
190
+ * const MovieCharacter = TypeName.fromString('MovieCharacter');
191
+ * const Droid = TypeName.fromString('Droid');
192
+ * const Starship = TypeName.fromString('Starship');
193
+ * const Human = TypeName.fromString('Human');
194
+ *
195
+ * const name = FieldName.fromString('name');
196
+ * const appearsIn = FieldName.fromString('appearsIn');
197
+ *
198
+ * const config: CodegenConfig = {
199
+ * // ...
200
+ * generates: {
201
+ * 'lib/data/models/app_models.dart': {
202
+ * plugins: {
203
+ * 'flutter-freezed': {
204
+ * // ...
205
+ * deprecated: [
206
+ * // using FieldNamePattern
207
+ * [FieldNamePattern.forFieldNamesOfTypeName(MovieCharacter, [appearsIn, name]), ['default_factory_parameter']],
208
+ * // using TypeNamePattern
209
+ * [TypeNamePattern.forTypeNames([Starship,Droid,Human]), ['union_factory']],
210
+ * ],
211
+ * },
212
+ * },
213
+ * },
214
+ * },
215
+ * };
216
+ * export default config;
217
+ * ```
218
+ */
219
+ deprecated?: [pattern: Pattern, appliesOn: (AppliesOnFactory | AppliesOnParameters)[]][];
220
+ /**
221
+ * @name equal
222
+ * @type {(boolean | TypeNamePattern)}
223
+ * @default undefined
224
+ * @see {@link https://pub.dev/packages/freezed#changing-the-behavior-for-a-specific-model Freezed equal helper method usage}
225
+ * @see {@link https://pub.dev/documentation/freezed_annotation/latest/freezed_annotation/Freezed/equal.html Freezed annotation equal property}
226
+ * @summary enables Freezed equal helper method
227
+ * @description The [`freezed`](https://pub.dev/packages/freezed) library has this option enabled by default.
228
+ * Use this option to enable/disable this option completely.
229
+ *
230
+ * The plugin by default generates immutable Freezed models using the `@freezed` decorator.
231
+ *
232
+ * If this option is configured, the plugin will generate immutable Freezed models using the `@Freezed(equal: value)` instead.
233
+ *
234
+ * Setting a boolean value will enable/disable this option globally for every GraphQL Type
235
+ * but you can also set this option to `true` for one or more GraphQL Types using a `TypeNamePattern`.
236
+ * @exampleMarkdown
237
+ * ## Usage:
238
+ * ```ts filename='codegen.ts'
239
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
240
+ *
241
+ * const Droid = TypeName.fromString('Droid');
242
+ * const Starship = TypeName.fromString('Starship');
243
+ *
244
+ * const config: CodegenConfig = {
245
+ * // ...
246
+ * generates: {
247
+ * 'lib/data/models/app_models.dart': {
248
+ * plugins: {
249
+ * 'flutter-freezed': {
250
+ * // ...
251
+ * equal: true,
252
+ * // OR: enable it for only Droid and Starship GraphQL types
253
+ * equal: TypeNamePattern.forTypeNames([Droid, Starship]),
254
+ * },
255
+ * },
256
+ * },
257
+ * },
258
+ * };
259
+ * export default config;
260
+ * ```
261
+ */
262
+ equal?: boolean | TypeNamePattern;
263
+ /**
264
+ * @name escapeDartKeywords
265
+ * @type {(boolean | [pattern: Pattern, prefix?: string, suffix?: string, appliesOn?: AppliesOn[]][])}
266
+ * @default true
267
+ * @see_also [dartKeywordEscapePrefix,dartKeywordEscapeSuffix]
268
+ * @summary ensures that the generated Freezed models do not use any of Dart's reserved keywords as identifiers
269
+ * @description Wraps the fields names that are valid Dart keywords with the prefix and suffix given
270
+ *
271
+ * @exampleMarkdown
272
+ * ## Usage:
273
+ *
274
+ * ```ts filename='codegen.ts'
275
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
276
+ *
277
+ * const Episode = TypeName.fromString('Episode');
278
+ *
279
+ * const config: CodegenConfig = {
280
+ * // ...
281
+ * generates: {
282
+ * 'lib/data/models/app_models.dart': {
283
+ * plugins: {
284
+ * 'flutter-freezed': {
285
+ * // ...
286
+ * // WARNING: Setting this option to `false` might generate output that contains Dart keywords as identifiers. Defaults to `true`
287
+ * escapeDartKeywords: false,
288
+ * // OR configure how Dart keywords are handled for each type
289
+ * escapeDartKeywords: [
290
+ * [
291
+ * Pattern.compose([
292
+ * TypeNamePattern.forAllTypeNames(),
293
+ * FieldNamePattern.forAllFieldNamesOfTypeName([Episode]),
294
+ * ]),
295
+ * // `prefix`: defaults to an empty string `''` if undefined.
296
+ * // WARNING: Note that using a underscore `_` as a prefix will make the field as private
297
+ * undefined,
298
+ * // `suffix`: defaults to an underscore `_` if undefined
299
+ * undefined,
300
+ * // `appliesOn`: defaults to an ['enum', 'enum_value', 'class', 'factory', 'parameter'] if undefined.
301
+ * undefined,
302
+ * ],
303
+ * ],
304
+ * },
305
+ * },
306
+ * },
307
+ * },
308
+ * };
309
+ * export default config;
310
+ * ```
311
+ */
312
+ escapeDartKeywords?: boolean | [pattern: Pattern, prefix?: string, suffix?: string, appliesOn?: AppliesOn[]][];
313
+ /**
314
+ * @name final
315
+ * @type {([pattern: FieldNamePattern, appliesOn: AppliesOnParameters[]][])}
316
+ * @default undefined
317
+ * @see {@link https://pub.dev/packages/freezed#defining-a-mutable-class-instead-of-an-immutable-one Freezed annotation equal property}
318
+ * @summary marks fields as final
319
+ * @description This will mark the specified parameters as final
320
+ * @exampleMarkdown
321
+ * ## Usage:
322
+ * ```ts filename='codegen.ts'
323
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
324
+ *
325
+ * const id = FieldName.fromString('id');
326
+ *
327
+ * const config: CodegenConfig = {
328
+ * // ...
329
+ * generates: {
330
+ * 'lib/data/models/app_models.dart': {
331
+ * plugins: {
332
+ * 'flutter-freezed': {
333
+ * // ...
334
+ * final: [[FieldNamePattern.forFieldNamesOfAllTypeNames([id]), ['parameter']]],
335
+ * },
336
+ * },
337
+ * },
338
+ * },
339
+ * };
340
+ * export default config;
341
+ * ```
342
+ */
343
+ final?: [pattern: FieldNamePattern, appliesOn: AppliesOnParameters[]][];
344
+ /**
345
+ * @name ignoreTypes
346
+ * @type {(TypeNamePattern)}
347
+ * @default undefined
348
+ * @description names of GraphQL types to ignore when generating Freezed classes
349
+ *
350
+ * @exampleMarkdown
351
+ * ## Usage:
352
+ * ```ts filename='codegen.ts'
353
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
354
+ *
355
+ * const PaginatorInfo = TypeName.fromString('PaginatorInfo');
356
+ *
357
+ * const config: CodegenConfig = {
358
+ * // ...
359
+ * generates: {
360
+ * 'lib/data/models/app_models.dart': {
361
+ * plugins: {
362
+ * 'flutter-freezed': {
363
+ * // ...
364
+ * ignoreTypes: TypeNamePattern.forTypeNames([PaginatorInfo]),
365
+ * },
366
+ * },
367
+ * },
368
+ * },
369
+ * };
370
+ * export default config;
371
+ * ```
372
+ */
373
+ ignoreTypes?: TypeNamePattern;
374
+ /**
375
+ * @name immutable
376
+ * @type {(boolean | TypeNamePattern)}
377
+ * @default undefined
378
+ * @see {@link https://pub.dev/packages/freezed#creating-a-model-using-freezed Creating a Model using Freezed}
379
+ * @summary enables Freezed immutable helper method
380
+ * @description set to true to use the `@freezed` decorator or false to use the `@unfreezed` decorator
381
+ * @description The [`freezed`](https://pub.dev/packages/freezed) library by default generates immutable models decorated with the `@freezed` decorator.
382
+ * This option if set to `false` the plugin will generate mutable Freezed models using the `@unfreezed` decorator instead.
383
+ *
384
+ * Setting a boolean value will enable/disable this option globally for every GraphQL Type
385
+ * but you can also set this option to `true` for one or more GraphQL Types using a `TypeNamePattern`.
386
+ * @exampleMarkdown
387
+ * ## Usage:
388
+ * ```ts filename='codegen.ts'
389
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
390
+ *
391
+ * const Droid = TypeName.fromString('Droid');
392
+ * const Starship = TypeName.fromString('Starship');
393
+ *
394
+ * const config: CodegenConfig = {
395
+ * // ...
396
+ * generates: {
397
+ * 'lib/data/models/app_models.dart': {
398
+ * plugins: {
399
+ * 'flutter-freezed': {
400
+ * // ...
401
+ * immutable: true,
402
+ * // OR: enable it for all GraphQL types except Droid and Starship types
403
+ * immutable: TypeNamePattern.forTypeNamesExcludeTypeNames([Droid, Starship]),
404
+ * },
405
+ * },
406
+ * },
407
+ * },
408
+ * };
409
+ * export default config;
410
+ * ```
411
+ */
412
+ immutable?: boolean | TypeNamePattern;
413
+ /**
414
+ * @name makeCollectionsUnmodifiable
415
+ * @type {(boolean | TypeNamePattern)}
416
+ * @default undefined
417
+ * @see {@link https://pub.dev/packages/freezed#allowing-the-mutation-of-listsmapssets Allowing the mutation of Lists/Maps/Sets}
418
+ * @description allows collections(lists/maps) to be modified even if class is immutable
419
+ *
420
+ * @exampleMarkdown
421
+ * ## Usage:
422
+ * ```ts filename='codegen.ts'
423
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
424
+ *
425
+ * const Droid = TypeName.fromString('Droid');
426
+ * const Starship = TypeName.fromString('Starship');
427
+ *
428
+ * const config: CodegenConfig = {
429
+ * // ...
430
+ * generates: {
431
+ * 'lib/data/models/app_models.dart': {
432
+ * plugins: {
433
+ * 'flutter-freezed': {
434
+ * // ...
435
+ * makeCollectionsUnmodifiable: true,
436
+ * // OR: enable it for only Droid and Starship GraphQL types
437
+ * makeCollectionsUnmodifiable: TypeNamePattern.forTypeNames([Droid, Starship]),
438
+ * },
439
+ * },
440
+ * },
441
+ * },
442
+ * };
443
+ * export default config;
444
+ * ```
445
+ */
446
+ makeCollectionsUnmodifiable?: boolean | TypeNamePattern;
447
+ /**
448
+ * @name mergeTypes
449
+ * @type {(Record<string, TypeName[]>)}
450
+ * @default undefined
451
+ * @description maps over the value(array of typeNames) and transform each as a named factory constructor inside a class generated for the key(target GraphQL Object Type).
452
+ * @exampleMarkdown
453
+ * ## Usage:
454
+ * ```ts filename='codegen.ts'
455
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
456
+ *
457
+ * const Movie = TypeName.fromString('Movie');
458
+ * const CreateMovieInput = TypeName.fromString('CreateMovieInput');
459
+ * const UpdateMovieInput = TypeName.fromString('UpdateMovieInput');
460
+ * const UpsertMovieInput = TypeName.fromString('UpsertMovieInput');
461
+ *
462
+ * const config: CodegenConfig = {
463
+ * // ...
464
+ * generates: {
465
+ * 'lib/data/models/app_models.dart': {
466
+ * plugins: {
467
+ * 'flutter-freezed': {
468
+ * // ...
469
+ * mergeTypes: {
470
+ * [Movie.value]: [CreateMovieInput, UpdateMovieInput, UpsertMovieInput],
471
+ * },
472
+ * },
473
+ * },
474
+ * },
475
+ * },
476
+ * };
477
+ * export default config;
478
+ * ```
479
+ */
480
+ mergeTypes?: Record<string, TypeName[]>;
481
+ /**
482
+ * @name mutableInputs
483
+ * @description since inputs will be used to collect data, it makes sense to make them mutable with Freezed's `@unfreezed` decorator.
484
+ *
485
+ * This overrides(in order words: has a higher precedence than) the `immutable` config value `ONLY` for GraphQL `input types`.
486
+ * @default true
487
+ *
488
+ * @exampleMarkdown
489
+ * ## Usage:
490
+ * ```ts filename='codegen.ts'
491
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
492
+ *
493
+ * const CreateMovieInput = TypeName.fromString('CreateMovieInput');
494
+ * const UpdateMovieInput = TypeName.fromString('UpdateMovieInput');
495
+ *
496
+ * const config: CodegenConfig = {
497
+ * // ...
498
+ * generates: {
499
+ * 'lib/data/models/app_models.dart': {
500
+ * plugins: {
501
+ * 'flutter-freezed': {
502
+ * // ...
503
+ * mutableInputs: true,
504
+ * // OR: enable it for only Droid and Starship GraphQL types
505
+ * mutableInputs: TypeNamePattern.forTypeNames([CreateMovieInput, UpdateMovieInput]),
506
+ * },
507
+ * },
508
+ * },
509
+ * },
510
+ * };
511
+ * export default config;
512
+ * ```
513
+ */
514
+ mutableInputs?: boolean | TypeNamePattern;
515
+ /**
516
+ * @name privateEmptyConstructor
517
+ * @description if true, defines a private empty constructor to allow getter and methods to work on the class
518
+ * @default true
519
+ *
520
+ * @exampleMarkdown
521
+ * ## Usage:
522
+ * ```ts filename='codegen.ts'
523
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
524
+ *
525
+ * const Droid = TypeName.fromString('Droid');
526
+ * const Starship = TypeName.fromString('Starship');
527
+ *
528
+ * const config: CodegenConfig = {
529
+ * // ...
530
+ * generates: {
531
+ * 'lib/data/models/app_models.dart': {
532
+ * plugins: {
533
+ * 'flutter-freezed': {
534
+ * // ...
535
+ * privateEmptyConstructor: true,
536
+ * // OR: enable it for only Droid and Starship GraphQL types
537
+ * privateEmptyConstructor: TypeNamePattern.forTypeNames([Droid, Starship]),
538
+ * },
539
+ * },
540
+ * },
541
+ * },
542
+ * };
543
+ * export default config;
544
+ * ```
545
+ */
546
+ privateEmptyConstructor?: boolean | TypeNamePattern;
547
+ /**
548
+ * @name unionClass
549
+ * @description customize the key to be used for fromJson with multiple constructors
550
+ * @see {@link https://pub.dev/packages/freezed#fromjson---classes-with-multiple-constructors fromJSON - classes with multiple constructors}
551
+ * @default undefined
552
+ * @exampleMarkdown
553
+ * ## Usage:
554
+ * ```ts filename='codegen.ts'
555
+ * import type { CodegenConfig } from '@graphql-codegen/cli';
556
+ *
557
+ * const config: CodegenConfig = {
558
+ * // ...
559
+ * generates: {
560
+ * 'lib/data/models/app_models.dart': {
561
+ * plugins: {
562
+ * 'flutter-freezed': {
563
+ * // ...
564
+ * unionClass: [
565
+ * [
566
+ * 'SearchResult', // <-- unionTypeName
567
+ * 'namedConstructor', // <-- unionKey
568
+ * 'FreezedUnionCase.pascal', // <-- unionValueCase
569
+ * [ // <-- unionValuesNameMap
570
+ * [ Droid, 'special droid'],
571
+ * [ Human, 'astronaut'],
572
+ * [ Starship, 'space_Shuttle'],
573
+ * ],
574
+ * ],
575
+ * ],
576
+ * },
577
+ * },
578
+ * },
579
+ * },
580
+ * };
581
+ * export default config;
582
+ * ```
583
+ */
584
+ unionClass?: [
585
+ /**
586
+ * The name of the Graphql Union Type (or in the case of merged types, the base type on which other types are merged with)
587
+ */
588
+ unionTypeName: TypeNamePattern,
589
+ /**
590
+ * in a fromJSON/toJson encoding a response/object({key:value}), you can specify what name should be used as the key ?
591
+ */
592
+ unionKey?: string,
593
+ /**
594
+ * normally in camelCase but you can change that to PascalCase
595
+ */
596
+ unionValueCase?: UnionValueCase,
597
+ /**
598
+ * just as the unionKey changes the key used, this changes the value for each union/sealed factories
599
+ */
600
+ unionValuesNameMap?: [typeName: TypeName, unionValueKey: string][]
601
+ ][];
602
+ };
603
+ /**
604
+ * @name ApplyDecoratorOn
605
+ * @description Values that are passed to the `DecoratorToFreezed.applyOn` field that specifies where the custom decorator should be applied
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';
608
+ export declare const APPLIES_ON_ENUM: readonly ["enum"];
609
+ export declare type AppliesOnEnum = (typeof APPLIES_ON_ENUM)[number];
610
+ export declare const APPLIES_ON_ENUM_VALUE: readonly ["enum_value"];
611
+ export declare type AppliesOnEnumValue = (typeof APPLIES_ON_ENUM_VALUE)[number];
612
+ export declare const APPLIES_ON_CLASS: readonly ["class"];
613
+ export declare type AppliesOnClass = (typeof APPLIES_ON_CLASS)[number];
614
+ export declare const APPLIES_ON_DEFAULT_FACTORY: readonly ["factory", "default_factory"];
615
+ export declare type AppliesOnDefaultFactory = (typeof APPLIES_ON_DEFAULT_FACTORY)[number];
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];
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;
621
+ export declare const APPLIES_ON_FACTORY: string[];
622
+ export declare type AppliesOnFactory = AppliesOnDefaultFactory | AppliesOnNamedFactory;
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];
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];
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;
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;
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';
642
+ /**
643
+ * maps GraphQL scalar types to Dart's scalar types
644
+ */
645
+ export declare const DART_SCALARS: Record<string, string>;
646
+ export declare const DART_KEYWORDS: {
647
+ abstract: string;
648
+ else: string;
649
+ import: string;
650
+ show: string;
651
+ as: string;
652
+ enum: string;
653
+ in: string;
654
+ static: string;
655
+ assert: string;
656
+ export: string;
657
+ interface: string;
658
+ super: string;
659
+ async: string;
660
+ extends: string;
661
+ is: string;
662
+ switch: string;
663
+ await: string;
664
+ extension: string;
665
+ late: string;
666
+ sync: string;
667
+ break: string;
668
+ external: string;
669
+ library: string;
670
+ this: string;
671
+ case: string;
672
+ factory: string;
673
+ mixin: string;
674
+ throw: string;
675
+ catch: string;
676
+ false: string;
677
+ new: string;
678
+ true: string;
679
+ class: string;
680
+ final: string;
681
+ null: string;
682
+ try: string;
683
+ const: string;
684
+ finally: string;
685
+ on: string;
686
+ typedef: string;
687
+ continue: string;
688
+ for: string;
689
+ operator: string;
690
+ var: string;
691
+ covariant: string;
692
+ Function: string;
693
+ part: string;
694
+ void: string;
695
+ default: string;
696
+ get: string;
697
+ required: string;
698
+ while: string;
699
+ deferred: string;
700
+ hide: string;
701
+ rethrow: string;
702
+ with: string;
703
+ do: string;
704
+ if: string;
705
+ return: string;
706
+ yield: string;
707
+ dynamic: string;
708
+ implements: string;
709
+ set: string;
710
+ int: string;
711
+ double: string;
712
+ String: string;
713
+ bool: string;
714
+ List: string;
715
+ Set: string;
716
+ Map: string;
717
+ Runes: string;
718
+ Symbol: string;
719
+ Object: string;
720
+ Null: string;
721
+ Never: string;
722
+ Enum: string;
723
+ Future: string;
724
+ Iterable: string;
725
+ };
726
+ /** initializes a FreezedPluginConfig with the defaults values */
727
+ export declare const defaultFreezedPluginConfig: FlutterFreezedPluginConfig;