@graphql-codegen/flutter-freezed 2.11.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/cjs/config.js +2 -0
- package/cjs/freezed-declaration-blocks/class-block.js +221 -0
- package/cjs/freezed-declaration-blocks/factory-block.js +121 -0
- package/cjs/freezed-declaration-blocks/index.js +6 -0
- package/cjs/freezed-declaration-blocks/parameter-block.js +150 -0
- package/cjs/index.js +27 -0
- package/cjs/package.json +1 -0
- package/cjs/schema-visitor.js +15 -0
- package/cjs/utils.js +221 -0
- package/esm/config.js +1 -0
- package/esm/freezed-declaration-blocks/class-block.js +217 -0
- package/esm/freezed-declaration-blocks/factory-block.js +117 -0
- package/esm/freezed-declaration-blocks/index.js +3 -0
- package/esm/freezed-declaration-blocks/parameter-block.js +146 -0
- package/esm/index.js +23 -0
- package/esm/schema-visitor.js +11 -0
- package/esm/utils.js +209 -0
- package/package.json +46 -0
- package/typings/config.d.cts +453 -0
- package/typings/config.d.ts +453 -0
- package/typings/freezed-declaration-blocks/class-block.d.cts +36 -0
- package/typings/freezed-declaration-blocks/class-block.d.ts +36 -0
- package/typings/freezed-declaration-blocks/factory-block.d.cts +38 -0
- package/typings/freezed-declaration-blocks/factory-block.d.ts +38 -0
- package/typings/freezed-declaration-blocks/index.d.cts +3 -0
- package/typings/freezed-declaration-blocks/index.d.ts +3 -0
- package/typings/freezed-declaration-blocks/parameter-block.d.cts +45 -0
- package/typings/freezed-declaration-blocks/parameter-block.d.ts +45 -0
- package/typings/index.d.cts +3 -0
- package/typings/index.d.ts +3 -0
- package/typings/schema-visitor.d.cts +10 -0
- package/typings/schema-visitor.d.ts +10 -0
- package/typings/utils.d.cts +78 -0
- package/typings/utils.d.ts +78 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name
|
|
3
|
+
* @description Values that are passed to the `DecoratorToFreezed.applyOn` field that specifies where the custom decorator should be applied
|
|
4
|
+
*/
|
|
5
|
+
export declare type ApplyDecoratorOn = 'enum' | 'class' | 'class_factory' | 'union_factory' | 'class_factory_parameter' | 'union_factory_parameter';
|
|
6
|
+
export declare type DecoratorToFreezed = {
|
|
7
|
+
/**
|
|
8
|
+
* @name arguments
|
|
9
|
+
* @description arrange the arguments of the directive in order of how the should be outputted
|
|
10
|
+
* @default undefined
|
|
11
|
+
* @exampleMarkdown
|
|
12
|
+
* ```yml
|
|
13
|
+
* arguments: [$0] # $0 is the first argument, $1 is the 2nd ...
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
arguments?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* @name applyOn
|
|
19
|
+
* @description Specify where the decorator should be applied
|
|
20
|
+
* @exampleMarkdown
|
|
21
|
+
* ```yml
|
|
22
|
+
* applyOn: ['class_factory','union_factory'], # applies this decorator on both class and union factory blocks
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
applyOn: ApplyDecoratorOn[];
|
|
26
|
+
/**
|
|
27
|
+
* @name mapsToFreezedAs
|
|
28
|
+
* @description maps to a Freezed decorator or use `custom` to use a custom decorator */
|
|
29
|
+
mapsToFreezedAs: '@Default' | '@deprecated' | 'final' | 'directive' | 'custom';
|
|
30
|
+
};
|
|
31
|
+
export declare type CustomDecorator = Record<string, DecoratorToFreezed>;
|
|
32
|
+
export interface FreezedConfig {
|
|
33
|
+
/**
|
|
34
|
+
* @name alwaysUseJsonKeyName
|
|
35
|
+
* @description Use @JsonKey(name: 'name') even if the name is already camelCased
|
|
36
|
+
* @default false
|
|
37
|
+
*
|
|
38
|
+
* @exampleMarkdown
|
|
39
|
+
* ```yml
|
|
40
|
+
* generates:
|
|
41
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
42
|
+
* plugins:
|
|
43
|
+
* - flutter-freezed
|
|
44
|
+
* config:
|
|
45
|
+
* alwaysUseJsonKeyName: true
|
|
46
|
+
*
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
alwaysUseJsonKeyName?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @name copyWith
|
|
52
|
+
* @description set to false to disable Freezed copyWith method helper
|
|
53
|
+
* @default undefined
|
|
54
|
+
*
|
|
55
|
+
* @exampleMarkdown
|
|
56
|
+
* ```yml
|
|
57
|
+
* generates:
|
|
58
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
59
|
+
* plugins:
|
|
60
|
+
* - flutter-freezed
|
|
61
|
+
* config:
|
|
62
|
+
* copyWith: false
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
copyWith?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* @name customDecorators
|
|
68
|
+
* @description maps GraphQL directives to freezed decorators. Arguments of the directive are passed using template strings: $1 is the first argument, $2 is the second... All `mapsToFreezedAs` values except `custom` are parsed so use the name of the directive without the `@` symbol as the key of the customDecorators. With the `custom` value, whatever you use as the key of the custom directive is used just as it is, and the arguments spread into a parenthesis ()
|
|
69
|
+
* @default {}
|
|
70
|
+
*
|
|
71
|
+
* @exampleMarkdown
|
|
72
|
+
* ```yml
|
|
73
|
+
* generates:
|
|
74
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
75
|
+
* plugins:
|
|
76
|
+
* - flutter-freezed
|
|
77
|
+
* config:
|
|
78
|
+
* customDecorators: {
|
|
79
|
+
* 'default' : {
|
|
80
|
+
* mapsToFreezedAs: '@Default',
|
|
81
|
+
* arguments: ['$0'],
|
|
82
|
+
* },
|
|
83
|
+
* 'deprecated' : {
|
|
84
|
+
* mapsToFreezedAs: '@deprecated',
|
|
85
|
+
* },
|
|
86
|
+
* 'readonly' : {
|
|
87
|
+
* mapsToFreezedAs: 'final',
|
|
88
|
+
* },
|
|
89
|
+
* '@Assert' : {
|
|
90
|
+
* mapsToFreezedAs: 'custom',
|
|
91
|
+
* applyOn: ['class_factory','union_factory'], # @Assert should ONLY be used on factories
|
|
92
|
+
* arguments: [
|
|
93
|
+
* '(email != null && email != "") || (phoneNumber != null && phoneNumber != "")',
|
|
94
|
+
* 'provide either an email or a phoneNumber',
|
|
95
|
+
* ],
|
|
96
|
+
* }, # custom are used just as it given
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
customDecorators?: CustomDecorator;
|
|
102
|
+
/**
|
|
103
|
+
* @name defaultUnionConstructor
|
|
104
|
+
* @description generate empty constructors for Union Types
|
|
105
|
+
* @default true
|
|
106
|
+
*
|
|
107
|
+
* @exampleMarkdown
|
|
108
|
+
* ```yml
|
|
109
|
+
* generates:
|
|
110
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
111
|
+
* plugins:
|
|
112
|
+
* - flutter-freezed
|
|
113
|
+
* config:
|
|
114
|
+
* defaultUnionConstructor: true
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
defaultUnionConstructor?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* @name equal
|
|
120
|
+
* @description set to false to disable Freezed equal method helper
|
|
121
|
+
* @default undefined
|
|
122
|
+
*
|
|
123
|
+
* @exampleMarkdown
|
|
124
|
+
* ```yml
|
|
125
|
+
* generates:
|
|
126
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
127
|
+
* plugins:
|
|
128
|
+
* - flutter-freezed
|
|
129
|
+
* config:
|
|
130
|
+
* equal: false
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
equal?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* @name fromJsonToJson
|
|
136
|
+
* @description generate fromJson toJson methods on the classes with json_serialization. Requires the [json_serializable](https://pub.dev/packages/json_serializable) to be installed in your Flutter app
|
|
137
|
+
* @default true
|
|
138
|
+
*
|
|
139
|
+
* @exampleMarkdown
|
|
140
|
+
* ```yml
|
|
141
|
+
* generates:
|
|
142
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
143
|
+
* plugins:
|
|
144
|
+
* - flutter-freezed
|
|
145
|
+
* config:
|
|
146
|
+
* fromJsonToJson: true
|
|
147
|
+
*
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
fromJsonToJson?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* @name immutable
|
|
153
|
+
* @description set to true to use the `@freezed` decorator or false to use the `@unfreezed` decorator
|
|
154
|
+
* @default true
|
|
155
|
+
*
|
|
156
|
+
* @exampleMarkdown
|
|
157
|
+
* ```yml
|
|
158
|
+
* generates:
|
|
159
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
160
|
+
* plugins:
|
|
161
|
+
* - flutter-freezed
|
|
162
|
+
* config:
|
|
163
|
+
* immutable: true
|
|
164
|
+
*
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
immutable?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* @name makeCollectionsUnmodifiable
|
|
170
|
+
* @description allows collections(lists/maps) to be modified even if class is immutable
|
|
171
|
+
* @default undefined
|
|
172
|
+
*
|
|
173
|
+
* @exampleMarkdown
|
|
174
|
+
* ```yml
|
|
175
|
+
* generates:
|
|
176
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
177
|
+
* plugins:
|
|
178
|
+
* - flutter-freezed
|
|
179
|
+
* config:
|
|
180
|
+
* makeCollectionsUnmodifiable: true
|
|
181
|
+
*
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
makeCollectionsUnmodifiable?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* @name mergeInputs
|
|
187
|
+
* @description merge InputTypes as a union of an ObjectType where ObjectType is denoted by a $ in the pattern.
|
|
188
|
+
* @default []
|
|
189
|
+
*
|
|
190
|
+
* @exampleMarkdown
|
|
191
|
+
* ```yml
|
|
192
|
+
* generates:
|
|
193
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
194
|
+
* plugins:
|
|
195
|
+
* - flutter-freezed
|
|
196
|
+
* config:
|
|
197
|
+
* mergeInputs: ["Create$Input", "Update$Input", "Delete$Input"]
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
mergeInputs?: string[];
|
|
201
|
+
/**
|
|
202
|
+
* @name mutableInputs
|
|
203
|
+
* @description since inputs will be used to collect data, it makes sense to make them mutable with Freezed's `@unfreezed` decorator. This overrides(in order words: has a higher precedence than) the `immutable` config value `ONLY` for GraphQL `input types`.
|
|
204
|
+
* @default true
|
|
205
|
+
*
|
|
206
|
+
* @exampleMarkdown
|
|
207
|
+
* ```yml
|
|
208
|
+
* generates:
|
|
209
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
210
|
+
* plugins:
|
|
211
|
+
* - flutter-freezed
|
|
212
|
+
* config:
|
|
213
|
+
* mutableInputs: true
|
|
214
|
+
*
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
mutableInputs?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* @name privateEmptyConstructor
|
|
220
|
+
* @description if true, defines a private empty constructor to allow getter and methods to work on the class
|
|
221
|
+
* @default true
|
|
222
|
+
*
|
|
223
|
+
* @exampleMarkdown
|
|
224
|
+
* ```yml
|
|
225
|
+
* generates:
|
|
226
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
227
|
+
* plugins:
|
|
228
|
+
* - flutter-freezed
|
|
229
|
+
* config:
|
|
230
|
+
* privateEmptyConstructor: true
|
|
231
|
+
*
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
privateEmptyConstructor?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* @name unionKey
|
|
237
|
+
* @description specify the key to be used for Freezed union/sealed classes
|
|
238
|
+
* @default undefined
|
|
239
|
+
*
|
|
240
|
+
* @exampleMarkdown
|
|
241
|
+
* ```yml
|
|
242
|
+
* generates:
|
|
243
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
244
|
+
* plugins:
|
|
245
|
+
* - flutter-freezed
|
|
246
|
+
* config:
|
|
247
|
+
* unionKey: 'type'
|
|
248
|
+
*
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
unionKey?: string;
|
|
252
|
+
/**
|
|
253
|
+
* @name unionValueCase
|
|
254
|
+
* @description specify the casing style to be used for Freezed union/sealed classes
|
|
255
|
+
* @default undefined
|
|
256
|
+
*
|
|
257
|
+
* @exampleMarkdown
|
|
258
|
+
* ```yml
|
|
259
|
+
* generates:
|
|
260
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
261
|
+
* plugins:
|
|
262
|
+
* - flutter-freezed
|
|
263
|
+
* config:
|
|
264
|
+
* unionValueCase: 'FreezedUnionCase.pascal'
|
|
265
|
+
*
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
unionValueCase?: 'FreezedUnionCase.camel' | 'FreezedUnionCase.pascal';
|
|
269
|
+
}
|
|
270
|
+
export interface FieldConfig {
|
|
271
|
+
/**
|
|
272
|
+
* @name final
|
|
273
|
+
* @description marks a field as final
|
|
274
|
+
* @default undefined
|
|
275
|
+
*/
|
|
276
|
+
final?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* @name deprecated
|
|
279
|
+
* @description marks a field as deprecated
|
|
280
|
+
* @default undefined
|
|
281
|
+
*/
|
|
282
|
+
deprecated?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* @name defaultValue
|
|
285
|
+
* @description annotate a field with a @Default(value: defaultValue) decorator
|
|
286
|
+
* @default undefined
|
|
287
|
+
*/
|
|
288
|
+
defaultValue?: any;
|
|
289
|
+
/**
|
|
290
|
+
* @name customDecorators
|
|
291
|
+
* @description specific directives to apply to the field. All `mapsToFreezedAs` values except `custom` are parsed so use the name of the directive without the `@` symbol as the key of the customDecorators. With the `custom` value, whatever you use as the key of the custom directive is used just as it is, and the arguments spread into a parenthesis ()
|
|
292
|
+
* @default undefined
|
|
293
|
+
* @exampleMarkdown
|
|
294
|
+
* ```yml
|
|
295
|
+
* customDecorators: {
|
|
296
|
+
* 'default' : {
|
|
297
|
+
* mapsToFreezedAs: '@Default',
|
|
298
|
+
* applyOn: ['class_factory_parameter],
|
|
299
|
+
* arguments: ['$0'],
|
|
300
|
+
* },
|
|
301
|
+
* 'deprecated' : {
|
|
302
|
+
* mapsToFreezedAs: '@deprecated',
|
|
303
|
+
* applyOn: ['union_factory_parameter],
|
|
304
|
+
* },
|
|
305
|
+
* 'readonly' : {
|
|
306
|
+
* mapsToFreezedAs: 'final',
|
|
307
|
+
* applyOn: ['class_factory_parameter','union_factory_parameter'],
|
|
308
|
+
* },
|
|
309
|
+
* '@HiveField' : {
|
|
310
|
+
* mapsToFreezedAs: 'custom',
|
|
311
|
+
* applyOn: ['class_factory_parameter'],
|
|
312
|
+
* arguments: ['1'],
|
|
313
|
+
* }, # custom are used just as it given
|
|
314
|
+
* }
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
customDecorators?: CustomDecorator;
|
|
318
|
+
}
|
|
319
|
+
export interface TypeSpecificFreezedConfig {
|
|
320
|
+
/** marks a type as deprecated */
|
|
321
|
+
deprecated?: boolean;
|
|
322
|
+
/** overrides the `globalFreezedConfig` for this type */
|
|
323
|
+
config?: FreezedConfig;
|
|
324
|
+
/** configure fields for this type */
|
|
325
|
+
fields?: Record<string, FieldConfig>;
|
|
326
|
+
}
|
|
327
|
+
export interface FlutterFreezedPluginConfig {
|
|
328
|
+
/**
|
|
329
|
+
* @name customScalars
|
|
330
|
+
* @description map custom Scalars to Dart built-in types
|
|
331
|
+
* @default {}
|
|
332
|
+
*
|
|
333
|
+
* @exampleMarkdown
|
|
334
|
+
* ```yml
|
|
335
|
+
* generates:
|
|
336
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
337
|
+
* plugins:
|
|
338
|
+
* - flutter-freezed
|
|
339
|
+
* config:
|
|
340
|
+
* customScalars:
|
|
341
|
+
* {
|
|
342
|
+
* "jsonb": "Map<String, dynamic>",
|
|
343
|
+
* "timestamptz": "DateTime",
|
|
344
|
+
* "UUID": "String",
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
customScalars?: {
|
|
349
|
+
[name: string]: string;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* @name fileName
|
|
353
|
+
* @description if `modular` is set to false, this fileName will be used for the generated output file
|
|
354
|
+
* @default "app_models"
|
|
355
|
+
*
|
|
356
|
+
* @exampleMarkdown
|
|
357
|
+
* ```yml
|
|
358
|
+
* generates:
|
|
359
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
360
|
+
* plugins:
|
|
361
|
+
* - flutter-freezed
|
|
362
|
+
* config:
|
|
363
|
+
* fileName: app_models
|
|
364
|
+
*
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
fileName?: string;
|
|
368
|
+
/**
|
|
369
|
+
* @name globalFreezedConfig
|
|
370
|
+
* @description use the same Freezed configuration for every generated output
|
|
371
|
+
* @default undefined
|
|
372
|
+
*
|
|
373
|
+
* @exampleMarkdown
|
|
374
|
+
* ```yml
|
|
375
|
+
* generates:
|
|
376
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
377
|
+
* plugins:
|
|
378
|
+
* - flutter-freezed
|
|
379
|
+
* config:
|
|
380
|
+
* globalFreezedConfig:
|
|
381
|
+
* {
|
|
382
|
+
* immutable: false,
|
|
383
|
+
* unionValueCase: FreezedUnionCase.pascal,
|
|
384
|
+
* }
|
|
385
|
+
*
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
globalFreezedConfig?: FreezedConfig;
|
|
389
|
+
/**
|
|
390
|
+
* @name typeSpecificFreezedConfig
|
|
391
|
+
* @description override the `globalFreezedConfig` for specific types
|
|
392
|
+
* @default undefined
|
|
393
|
+
*
|
|
394
|
+
* @exampleMarkdown
|
|
395
|
+
* ```yml
|
|
396
|
+
* generates:
|
|
397
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
398
|
+
* plugins:
|
|
399
|
+
* - flutter-freezed
|
|
400
|
+
* config:
|
|
401
|
+
* typeSpecificFreezedConfig:
|
|
402
|
+
* {
|
|
403
|
+
* 'Starship':{
|
|
404
|
+
* config: {
|
|
405
|
+
* immutable: false,
|
|
406
|
+
* unionValueCase: FreezedUnionCase.pascal,
|
|
407
|
+
* },
|
|
408
|
+
* fields: {
|
|
409
|
+
* 'id': {
|
|
410
|
+
* final: true,
|
|
411
|
+
* defaultValue: NanoId.id(),
|
|
412
|
+
* },
|
|
413
|
+
* },
|
|
414
|
+
* },
|
|
415
|
+
* },
|
|
416
|
+
*
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
typeSpecificFreezedConfig?: Record<string, TypeSpecificFreezedConfig>;
|
|
420
|
+
/**
|
|
421
|
+
* @name ignoreTypes
|
|
422
|
+
* @description names of GraphQL types to ignore when generating Freezed classes
|
|
423
|
+
* @default []
|
|
424
|
+
*
|
|
425
|
+
* @exampleMarkdown
|
|
426
|
+
* ```yml
|
|
427
|
+
* generates:
|
|
428
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
429
|
+
* plugins:
|
|
430
|
+
* - flutter-freezed
|
|
431
|
+
* config:
|
|
432
|
+
* ignoreTypes: ["PaginatorInfo"]
|
|
433
|
+
*
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
ignoreTypes?: string[];
|
|
437
|
+
/**
|
|
438
|
+
* @name lowercaseEnums
|
|
439
|
+
* @description make enum fields lowercase
|
|
440
|
+
* @default true
|
|
441
|
+
*
|
|
442
|
+
* @exampleMarkdown
|
|
443
|
+
* ```yml
|
|
444
|
+
* generates:
|
|
445
|
+
* flutter_app/lib/data/models/app_models.dart
|
|
446
|
+
* plugins:
|
|
447
|
+
* - flutter-freezed
|
|
448
|
+
* config:
|
|
449
|
+
* lowercaseEnums: true
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
lowercaseEnums?: boolean;
|
|
453
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FlutterFreezedPluginConfig } from '../config.cjs';
|
|
2
|
+
import { FreezedFactoryBlockRepository, NodeType } from '../utils.cjs';
|
|
3
|
+
import { FreezedFactoryBlock } from './factory-block.cjs';
|
|
4
|
+
export declare class FreezedDeclarationBlock {
|
|
5
|
+
private _config;
|
|
6
|
+
private _freezedFactoryBlockRepository;
|
|
7
|
+
private _node;
|
|
8
|
+
/** document the class */
|
|
9
|
+
_comment: string;
|
|
10
|
+
/** a list of decorators to copy paste to the generator */
|
|
11
|
+
_decorators: string[];
|
|
12
|
+
/** the name of the class */
|
|
13
|
+
_name: string | undefined;
|
|
14
|
+
/** a list of default constructor and named Constructors used create a Freezed union/sealed class */
|
|
15
|
+
_factoryBlocks: FreezedFactoryBlock[];
|
|
16
|
+
/** the shape is the content of the block */
|
|
17
|
+
_shape: string | undefined;
|
|
18
|
+
/** the block is the final structure that is generated */
|
|
19
|
+
_block: string | undefined;
|
|
20
|
+
private _freezedConfigValue;
|
|
21
|
+
constructor(_config: FlutterFreezedPluginConfig, _freezedFactoryBlockRepository: FreezedFactoryBlockRepository, _node: NodeType);
|
|
22
|
+
init(): FreezedDeclarationBlock;
|
|
23
|
+
private setComment;
|
|
24
|
+
private getEnumComment;
|
|
25
|
+
private setDecorators;
|
|
26
|
+
private getFreezedDecorator;
|
|
27
|
+
private setName;
|
|
28
|
+
private setFactoryBlocks;
|
|
29
|
+
private setShape;
|
|
30
|
+
/**
|
|
31
|
+
* returns the string output of the block
|
|
32
|
+
*/
|
|
33
|
+
private setBlock;
|
|
34
|
+
/** returns the block */
|
|
35
|
+
toString(): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FlutterFreezedPluginConfig } from '../config.js';
|
|
2
|
+
import { FreezedFactoryBlockRepository, NodeType } from '../utils.js';
|
|
3
|
+
import { FreezedFactoryBlock } from './factory-block.js';
|
|
4
|
+
export declare class FreezedDeclarationBlock {
|
|
5
|
+
private _config;
|
|
6
|
+
private _freezedFactoryBlockRepository;
|
|
7
|
+
private _node;
|
|
8
|
+
/** document the class */
|
|
9
|
+
_comment: string;
|
|
10
|
+
/** a list of decorators to copy paste to the generator */
|
|
11
|
+
_decorators: string[];
|
|
12
|
+
/** the name of the class */
|
|
13
|
+
_name: string | undefined;
|
|
14
|
+
/** a list of default constructor and named Constructors used create a Freezed union/sealed class */
|
|
15
|
+
_factoryBlocks: FreezedFactoryBlock[];
|
|
16
|
+
/** the shape is the content of the block */
|
|
17
|
+
_shape: string | undefined;
|
|
18
|
+
/** the block is the final structure that is generated */
|
|
19
|
+
_block: string | undefined;
|
|
20
|
+
private _freezedConfigValue;
|
|
21
|
+
constructor(_config: FlutterFreezedPluginConfig, _freezedFactoryBlockRepository: FreezedFactoryBlockRepository, _node: NodeType);
|
|
22
|
+
init(): FreezedDeclarationBlock;
|
|
23
|
+
private setComment;
|
|
24
|
+
private getEnumComment;
|
|
25
|
+
private setDecorators;
|
|
26
|
+
private getFreezedDecorator;
|
|
27
|
+
private setName;
|
|
28
|
+
private setFactoryBlocks;
|
|
29
|
+
private setShape;
|
|
30
|
+
/**
|
|
31
|
+
* returns the string output of the block
|
|
32
|
+
*/
|
|
33
|
+
private setBlock;
|
|
34
|
+
/** returns the block */
|
|
35
|
+
toString(): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FreezedParameterBlock } from './parameter-block.cjs';
|
|
2
|
+
import { FlutterFreezedPluginConfig } from '../config.cjs';
|
|
3
|
+
import { NodeType } from '../utils.cjs';
|
|
4
|
+
export declare class FreezedFactoryBlock {
|
|
5
|
+
private _config;
|
|
6
|
+
private _node;
|
|
7
|
+
/** document the constructor */
|
|
8
|
+
_comment: string;
|
|
9
|
+
/** a list of decorators to copy paste to the generator */
|
|
10
|
+
_decorators: string[];
|
|
11
|
+
/** the key of the original type name */
|
|
12
|
+
_key: string | undefined;
|
|
13
|
+
/** the name of the class */
|
|
14
|
+
_name: string | undefined;
|
|
15
|
+
/** the namedConstructor is used for GraphQL Union types or if mergeInput is true */
|
|
16
|
+
_namedConstructor: string | undefined;
|
|
17
|
+
/** a list of interfaces to implements */
|
|
18
|
+
/** a list of class to mixin with */
|
|
19
|
+
/** the parameters of this factory constructor */
|
|
20
|
+
_parameters: FreezedParameterBlock[];
|
|
21
|
+
/** the shape is the content of the block */
|
|
22
|
+
_shape: string | undefined;
|
|
23
|
+
/** the block is the final structure that is generated */
|
|
24
|
+
_block: string | undefined;
|
|
25
|
+
private _freezedConfigValue;
|
|
26
|
+
constructor(_config: FlutterFreezedPluginConfig, _node: NodeType);
|
|
27
|
+
init(): FreezedFactoryBlock;
|
|
28
|
+
private setComment;
|
|
29
|
+
setDecorators(appliesOn: string, nodeName: string): FreezedFactoryBlock;
|
|
30
|
+
setKey(key: string): FreezedFactoryBlock;
|
|
31
|
+
setName(name: string): FreezedFactoryBlock;
|
|
32
|
+
setNamedConstructor(namedConstructor: string | undefined): FreezedFactoryBlock;
|
|
33
|
+
private setParameters;
|
|
34
|
+
private setShape;
|
|
35
|
+
private setBlock;
|
|
36
|
+
/** returns the block */
|
|
37
|
+
toString(): string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FreezedParameterBlock } from './parameter-block.js';
|
|
2
|
+
import { FlutterFreezedPluginConfig } from '../config.js';
|
|
3
|
+
import { NodeType } from '../utils.js';
|
|
4
|
+
export declare class FreezedFactoryBlock {
|
|
5
|
+
private _config;
|
|
6
|
+
private _node;
|
|
7
|
+
/** document the constructor */
|
|
8
|
+
_comment: string;
|
|
9
|
+
/** a list of decorators to copy paste to the generator */
|
|
10
|
+
_decorators: string[];
|
|
11
|
+
/** the key of the original type name */
|
|
12
|
+
_key: string | undefined;
|
|
13
|
+
/** the name of the class */
|
|
14
|
+
_name: string | undefined;
|
|
15
|
+
/** the namedConstructor is used for GraphQL Union types or if mergeInput is true */
|
|
16
|
+
_namedConstructor: string | undefined;
|
|
17
|
+
/** a list of interfaces to implements */
|
|
18
|
+
/** a list of class to mixin with */
|
|
19
|
+
/** the parameters of this factory constructor */
|
|
20
|
+
_parameters: FreezedParameterBlock[];
|
|
21
|
+
/** the shape is the content of the block */
|
|
22
|
+
_shape: string | undefined;
|
|
23
|
+
/** the block is the final structure that is generated */
|
|
24
|
+
_block: string | undefined;
|
|
25
|
+
private _freezedConfigValue;
|
|
26
|
+
constructor(_config: FlutterFreezedPluginConfig, _node: NodeType);
|
|
27
|
+
init(): FreezedFactoryBlock;
|
|
28
|
+
private setComment;
|
|
29
|
+
setDecorators(appliesOn: string, nodeName: string): FreezedFactoryBlock;
|
|
30
|
+
setKey(key: string): FreezedFactoryBlock;
|
|
31
|
+
setName(name: string): FreezedFactoryBlock;
|
|
32
|
+
setNamedConstructor(namedConstructor: string | undefined): FreezedFactoryBlock;
|
|
33
|
+
private setParameters;
|
|
34
|
+
private setShape;
|
|
35
|
+
private setBlock;
|
|
36
|
+
/** returns the block */
|
|
37
|
+
toString(): string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ApplyDecoratorOn, FlutterFreezedPluginConfig } from '../config.cjs';
|
|
2
|
+
import { FieldType, NodeType } from '../utils.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* maps GraphQL scalar types to Dart's scalar types
|
|
5
|
+
*/
|
|
6
|
+
export declare const DART_SCALARS: Record<string, string>;
|
|
7
|
+
export declare class FreezedParameterBlock {
|
|
8
|
+
private _config;
|
|
9
|
+
private _appliesOn;
|
|
10
|
+
private _node;
|
|
11
|
+
private _field;
|
|
12
|
+
/** document the property */
|
|
13
|
+
_comment: string;
|
|
14
|
+
/** a list of decorators to copy paste to the generator */
|
|
15
|
+
_decorators: string[];
|
|
16
|
+
/** mark the property as required */
|
|
17
|
+
_required: boolean | undefined;
|
|
18
|
+
/** mark the property as required */
|
|
19
|
+
_type: string | undefined;
|
|
20
|
+
/** the name of the property */
|
|
21
|
+
_name: string | undefined;
|
|
22
|
+
/** the shape is the content of the block */
|
|
23
|
+
_shape: string | undefined;
|
|
24
|
+
/** the block is the final structure that is generated */
|
|
25
|
+
_block: string | undefined;
|
|
26
|
+
private _freezedConfigValue;
|
|
27
|
+
constructor(_config: FlutterFreezedPluginConfig, _appliesOn: ApplyDecoratorOn[], _node: NodeType, _field: FieldType);
|
|
28
|
+
init(): FreezedParameterBlock;
|
|
29
|
+
private setComment;
|
|
30
|
+
private setDecorators;
|
|
31
|
+
private setRequired;
|
|
32
|
+
private setType;
|
|
33
|
+
private setName;
|
|
34
|
+
/** compose the freezed constructor property */
|
|
35
|
+
private setShape;
|
|
36
|
+
/** composes the full block */
|
|
37
|
+
private setBlock;
|
|
38
|
+
private propertyType;
|
|
39
|
+
private isListType;
|
|
40
|
+
private isNonNullType;
|
|
41
|
+
private isNamedType;
|
|
42
|
+
private scalar;
|
|
43
|
+
/** returns the block */
|
|
44
|
+
toString(): string;
|
|
45
|
+
}
|