@graphql-codegen/typescript 3.0.3-alpha-20230323123056-e823c9bbd → 3.0.3-alpha-20230323131137-be90ddc5c

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/visitor.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TsVisitor = exports.MAKE_MAYBE_SIGNATURE = exports.MAKE_OPTIONAL_SIGNATURE = exports.EXACT_SIGNATURE = void 0;
3
+ exports.TsVisitor = exports.MAKE_INCREMENTAL_SIGNATURE = exports.MAKE_ALL_EMPTY_SIGNATURE = exports.MAKE_EMPTY_SIGNATURE = exports.MAKE_MAYBE_SIGNATURE = exports.MAKE_OPTIONAL_SIGNATURE = exports.EXACT_SIGNATURE = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
6
6
  const auto_bind_1 = tslib_1.__importDefault(require("auto-bind"));
@@ -9,6 +9,9 @@ const typescript_variables_to_object_js_1 = require("./typescript-variables-to-o
9
9
  exports.EXACT_SIGNATURE = `type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };`;
10
10
  exports.MAKE_OPTIONAL_SIGNATURE = `type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };`;
11
11
  exports.MAKE_MAYBE_SIGNATURE = `type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };`;
12
+ exports.MAKE_EMPTY_SIGNATURE = `type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };`;
13
+ exports.MAKE_ALL_EMPTY_SIGNATURE = `type Empty<T> = { [P in keyof T]?: never };`;
14
+ exports.MAKE_INCREMENTAL_SIGNATURE = `type Incremental<T> = T & { ' $defer': true };`;
12
15
  class TsVisitor extends visitor_plugin_common_1.BaseTypesVisitor {
13
16
  constructor(schema, pluginConfig, additionalConfig = {}) {
14
17
  super(schema, pluginConfig, {
@@ -85,6 +88,9 @@ class TsVisitor extends visitor_plugin_common_1.BaseTypesVisitor {
85
88
  this.getExactDefinition(),
86
89
  this.getMakeOptionalDefinition(),
87
90
  this.getMakeMaybeDefinition(),
91
+ this.getMakeEmptyDefinition(),
92
+ this.getMakeAllEmptyDefinition(),
93
+ this.getIncrementalDefinition(),
88
94
  ];
89
95
  if (this.config.wrapFieldDefinitions) {
90
96
  definitions.push(this.getFieldWrapperValue());
@@ -107,6 +113,15 @@ class TsVisitor extends visitor_plugin_common_1.BaseTypesVisitor {
107
113
  return '';
108
114
  return `${this.getExportPrefix()}${exports.MAKE_MAYBE_SIGNATURE}`;
109
115
  }
116
+ getMakeEmptyDefinition() {
117
+ return `${this.getExportPrefix()}${exports.MAKE_EMPTY_SIGNATURE}`;
118
+ }
119
+ getMakeAllEmptyDefinition() {
120
+ return `${this.getExportPrefix()}${exports.MAKE_ALL_EMPTY_SIGNATURE}`;
121
+ }
122
+ getIncrementalDefinition() {
123
+ return `${this.getExportPrefix()}${exports.MAKE_INCREMENTAL_SIGNATURE}`;
124
+ }
110
125
  getMaybeValue() {
111
126
  return `${this.getExportPrefix()}type Maybe<T> = ${this.config.maybeValue};`;
112
127
  }
package/esm/visitor.js CHANGED
@@ -5,6 +5,9 @@ import { TypeScriptOperationVariablesToObject } from './typescript-variables-to-
5
5
  export const EXACT_SIGNATURE = `type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };`;
6
6
  export const MAKE_OPTIONAL_SIGNATURE = `type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };`;
7
7
  export const MAKE_MAYBE_SIGNATURE = `type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };`;
8
+ export const MAKE_EMPTY_SIGNATURE = `type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };`;
9
+ export const MAKE_ALL_EMPTY_SIGNATURE = `type Empty<T> = { [P in keyof T]?: never };`;
10
+ export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental<T> = T & { ' $defer': true };`;
8
11
  export class TsVisitor extends BaseTypesVisitor {
9
12
  constructor(schema, pluginConfig, additionalConfig = {}) {
10
13
  super(schema, pluginConfig, {
@@ -81,6 +84,9 @@ export class TsVisitor extends BaseTypesVisitor {
81
84
  this.getExactDefinition(),
82
85
  this.getMakeOptionalDefinition(),
83
86
  this.getMakeMaybeDefinition(),
87
+ this.getMakeEmptyDefinition(),
88
+ this.getMakeAllEmptyDefinition(),
89
+ this.getIncrementalDefinition(),
84
90
  ];
85
91
  if (this.config.wrapFieldDefinitions) {
86
92
  definitions.push(this.getFieldWrapperValue());
@@ -103,6 +109,15 @@ export class TsVisitor extends BaseTypesVisitor {
103
109
  return '';
104
110
  return `${this.getExportPrefix()}${MAKE_MAYBE_SIGNATURE}`;
105
111
  }
112
+ getMakeEmptyDefinition() {
113
+ return `${this.getExportPrefix()}${MAKE_EMPTY_SIGNATURE}`;
114
+ }
115
+ getMakeAllEmptyDefinition() {
116
+ return `${this.getExportPrefix()}${MAKE_ALL_EMPTY_SIGNATURE}`;
117
+ }
118
+ getIncrementalDefinition() {
119
+ return `${this.getExportPrefix()}${MAKE_INCREMENTAL_SIGNATURE}`;
120
+ }
106
121
  getMaybeValue() {
107
122
  return `${this.getExportPrefix()}type Maybe<T> = ${this.config.maybeValue};`;
108
123
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript",
3
- "version": "3.0.3-alpha-20230323123056-e823c9bbd",
3
+ "version": "3.0.3-alpha-20230323131137-be90ddc5c",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript types",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@graphql-codegen/plugin-helpers": "4.2.0-alpha-20230323123056-e823c9bbd",
9
+ "@graphql-codegen/plugin-helpers": "4.2.0-alpha-20230323131137-be90ddc5c",
10
10
  "@graphql-codegen/schema-ast": "^3.0.1",
11
- "@graphql-codegen/visitor-plugin-common": "3.1.0-alpha-20230323123056-e823c9bbd",
11
+ "@graphql-codegen/visitor-plugin-common": "3.1.0-alpha-20230323131137-be90ddc5c",
12
12
  "auto-bind": "~4.0.0",
13
13
  "tslib": "~2.5.0"
14
14
  },
@@ -20,6 +20,9 @@ export interface TypeScriptPluginParsedConfig extends ParsedTypesConfig {
20
20
  export declare const EXACT_SIGNATURE = "type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };";
21
21
  export declare const MAKE_OPTIONAL_SIGNATURE = "type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };";
22
22
  export declare const MAKE_MAYBE_SIGNATURE = "type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };";
23
+ export declare const MAKE_EMPTY_SIGNATURE = "type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };";
24
+ export declare const MAKE_ALL_EMPTY_SIGNATURE = "type Empty<T> = { [P in keyof T]?: never };";
25
+ export declare const MAKE_INCREMENTAL_SIGNATURE = "type Incremental<T> = T & { ' $defer': true };";
23
26
  export declare class TsVisitor<TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, TParsedConfig extends TypeScriptPluginParsedConfig = TypeScriptPluginParsedConfig> extends BaseTypesVisitor<TRawConfig, TParsedConfig> {
24
27
  constructor(schema: GraphQLSchema, pluginConfig: TRawConfig, additionalConfig?: Partial<TParsedConfig>);
25
28
  protected _getTypeForNode(node: NamedTypeNode): string;
@@ -27,6 +30,9 @@ export declare class TsVisitor<TRawConfig extends TypeScriptPluginConfig = TypeS
27
30
  getExactDefinition(): string;
28
31
  getMakeOptionalDefinition(): string;
29
32
  getMakeMaybeDefinition(): string;
33
+ getMakeEmptyDefinition(): string;
34
+ getMakeAllEmptyDefinition(): string;
35
+ getIncrementalDefinition(): string;
30
36
  getMaybeValue(): string;
31
37
  getInputMaybeValue(): string;
32
38
  protected clearOptional(str: string): string;
@@ -20,6 +20,9 @@ export interface TypeScriptPluginParsedConfig extends ParsedTypesConfig {
20
20
  export declare const EXACT_SIGNATURE = "type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };";
21
21
  export declare const MAKE_OPTIONAL_SIGNATURE = "type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };";
22
22
  export declare const MAKE_MAYBE_SIGNATURE = "type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };";
23
+ export declare const MAKE_EMPTY_SIGNATURE = "type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };";
24
+ export declare const MAKE_ALL_EMPTY_SIGNATURE = "type Empty<T> = { [P in keyof T]?: never };";
25
+ export declare const MAKE_INCREMENTAL_SIGNATURE = "type Incremental<T> = T & { ' $defer': true };";
23
26
  export declare class TsVisitor<TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, TParsedConfig extends TypeScriptPluginParsedConfig = TypeScriptPluginParsedConfig> extends BaseTypesVisitor<TRawConfig, TParsedConfig> {
24
27
  constructor(schema: GraphQLSchema, pluginConfig: TRawConfig, additionalConfig?: Partial<TParsedConfig>);
25
28
  protected _getTypeForNode(node: NamedTypeNode): string;
@@ -27,6 +30,9 @@ export declare class TsVisitor<TRawConfig extends TypeScriptPluginConfig = TypeS
27
30
  getExactDefinition(): string;
28
31
  getMakeOptionalDefinition(): string;
29
32
  getMakeMaybeDefinition(): string;
33
+ getMakeEmptyDefinition(): string;
34
+ getMakeAllEmptyDefinition(): string;
35
+ getIncrementalDefinition(): string;
30
36
  getMaybeValue(): string;
31
37
  getInputMaybeValue(): string;
32
38
  protected clearOptional(str: string): string;