@graphql-codegen/plugin-helpers 3.0.0-alpha-20221207042830-c4b2354fa → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/plugin-helpers",
3
- "version": "3.0.0-alpha-20221207042830-c4b2354fa",
3
+ "version": "3.1.0",
4
4
  "description": "GraphQL Code Generator common utils and types",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
@@ -485,7 +485,9 @@ export declare namespace Types {
485
485
  };
486
486
  type PluginOutput = string | ComplexPluginOutput;
487
487
  type HookFunction = (...args: any[]) => void | Promise<void>;
488
+ type HookAlterFunction = (...args: any[]) => void | string | Promise<void | string>;
488
489
  type LifeCycleHookValue = string | HookFunction | (string | HookFunction)[];
490
+ type LifeCycleAlterHookValue = string | HookFunction | HookAlterFunction | (string | HookFunction | HookAlterFunction)[];
489
491
  /**
490
492
  * @description All available lifecycle hooks
491
493
  * @additionalProperties false
@@ -525,11 +527,14 @@ export declare namespace Types {
525
527
  */
526
528
  afterAllFileWrite: LifeCycleHookValue;
527
529
  /**
528
- * @description Triggered before a file is written to the file-system. Executed with the path for the file.
530
+ * @description Triggered before a file is written to the file-system.
531
+ * Executed with the path and content for the file.
532
+ *
533
+ * Returning a string will override the content of the file.
529
534
  *
530
535
  * If the content of the file hasn't changed since last execution - this hooks won't be triggered.
531
536
  */
532
- beforeOneFileWrite: LifeCycleHookValue;
537
+ beforeOneFileWrite: LifeCycleAlterHookValue;
533
538
  /**
534
539
  * @description Executed after the codegen has done creating the output and before writing the files to the file-system.
535
540
  *
@@ -485,7 +485,9 @@ export declare namespace Types {
485
485
  };
486
486
  type PluginOutput = string | ComplexPluginOutput;
487
487
  type HookFunction = (...args: any[]) => void | Promise<void>;
488
+ type HookAlterFunction = (...args: any[]) => void | string | Promise<void | string>;
488
489
  type LifeCycleHookValue = string | HookFunction | (string | HookFunction)[];
490
+ type LifeCycleAlterHookValue = string | HookFunction | HookAlterFunction | (string | HookFunction | HookAlterFunction)[];
489
491
  /**
490
492
  * @description All available lifecycle hooks
491
493
  * @additionalProperties false
@@ -525,11 +527,14 @@ export declare namespace Types {
525
527
  */
526
528
  afterAllFileWrite: LifeCycleHookValue;
527
529
  /**
528
- * @description Triggered before a file is written to the file-system. Executed with the path for the file.
530
+ * @description Triggered before a file is written to the file-system.
531
+ * Executed with the path and content for the file.
532
+ *
533
+ * Returning a string will override the content of the file.
529
534
  *
530
535
  * If the content of the file hasn't changed since last execution - this hooks won't be triggered.
531
536
  */
532
- beforeOneFileWrite: LifeCycleHookValue;
537
+ beforeOneFileWrite: LifeCycleAlterHookValue;
533
538
  /**
534
539
  * @description Executed after the codegen has done creating the output and before writing the files to the file-system.
535
540
  *