@graphql-codegen/typescript-solid-query 1.0.0-alpha-20240201110240-bdef5b40fe364d6a5b0276786062c582bd60d3cc
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 +0 -0
- package/cjs/fetcher-custom-mapper.js +82 -0
- package/cjs/fetcher-fetch-hardcoded.js +81 -0
- package/cjs/fetcher-fetch.js +76 -0
- package/cjs/fetcher-graphql-request.js +123 -0
- package/cjs/fetcher.js +191 -0
- package/cjs/index.js +47 -0
- package/cjs/package.json +1 -0
- package/cjs/visitor.js +157 -0
- package/esm/config.js +0 -0
- package/esm/fetcher-custom-mapper.js +77 -0
- package/esm/fetcher-fetch-hardcoded.js +76 -0
- package/esm/fetcher-fetch.js +71 -0
- package/esm/fetcher-graphql-request.js +118 -0
- package/esm/fetcher.js +186 -0
- package/esm/index.js +42 -0
- package/esm/visitor.js +152 -0
- package/package.json +48 -0
- package/typings/config.d.cts +115 -0
- package/typings/config.d.ts +115 -0
- package/typings/fetcher-custom-mapper.d.cts +15 -0
- package/typings/fetcher-custom-mapper.d.ts +15 -0
- package/typings/fetcher-fetch-hardcoded.d.cts +15 -0
- package/typings/fetcher-fetch-hardcoded.d.ts +15 -0
- package/typings/fetcher-fetch.d.cts +11 -0
- package/typings/fetcher-fetch.d.ts +11 -0
- package/typings/fetcher-graphql-request.d.cts +13 -0
- package/typings/fetcher-graphql-request.d.ts +13 -0
- package/typings/fetcher.d.cts +75 -0
- package/typings/fetcher.d.ts +75 -0
- package/typings/index.d.cts +6 -0
- package/typings/index.d.ts +6 -0
- package/typings/visitor.d.cts +21 -0
- package/typings/visitor.d.ts +21 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CustomFetch } from './config.js';
|
|
2
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.js';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.js';
|
|
4
|
+
export declare class CustomMapperFetcher extends FetcherRenderer {
|
|
5
|
+
protected visitor: SolidQueryVisitor;
|
|
6
|
+
private _mapper;
|
|
7
|
+
private _isSolidHook;
|
|
8
|
+
constructor(visitor: SolidQueryVisitor, customFetcher: CustomFetch);
|
|
9
|
+
private getFetcherFnName;
|
|
10
|
+
generateFetcherImplementation(): string;
|
|
11
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
12
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
13
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
14
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HardcodedFetch } from './config.cjs';
|
|
2
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.cjs';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.cjs';
|
|
4
|
+
export declare class HardcodedFetchFetcher extends FetcherRenderer {
|
|
5
|
+
protected visitor: SolidQueryVisitor;
|
|
6
|
+
private config;
|
|
7
|
+
constructor(visitor: SolidQueryVisitor, config: HardcodedFetch);
|
|
8
|
+
private getEndpoint;
|
|
9
|
+
private getFetchParams;
|
|
10
|
+
generateFetcherImplementation(): string;
|
|
11
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
12
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
13
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
14
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HardcodedFetch } from './config.js';
|
|
2
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.js';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.js';
|
|
4
|
+
export declare class HardcodedFetchFetcher extends FetcherRenderer {
|
|
5
|
+
protected visitor: SolidQueryVisitor;
|
|
6
|
+
private config;
|
|
7
|
+
constructor(visitor: SolidQueryVisitor, config: HardcodedFetch);
|
|
8
|
+
private getEndpoint;
|
|
9
|
+
private getFetchParams;
|
|
10
|
+
generateFetcherImplementation(): string;
|
|
11
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
12
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
13
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
14
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.cjs';
|
|
2
|
+
import { SolidQueryVisitor } from './visitor.cjs';
|
|
3
|
+
export declare class FetchFetcher extends FetcherRenderer {
|
|
4
|
+
protected visitor: SolidQueryVisitor;
|
|
5
|
+
constructor(visitor: SolidQueryVisitor);
|
|
6
|
+
generateFetcherImplementation(): string;
|
|
7
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
8
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
9
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
10
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.js';
|
|
2
|
+
import { SolidQueryVisitor } from './visitor.js';
|
|
3
|
+
export declare class FetchFetcher extends FetcherRenderer {
|
|
4
|
+
protected visitor: SolidQueryVisitor;
|
|
5
|
+
constructor(visitor: SolidQueryVisitor);
|
|
6
|
+
generateFetcherImplementation(): string;
|
|
7
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
8
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
9
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
10
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQlRequest } from './config.cjs';
|
|
2
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.cjs';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.cjs';
|
|
4
|
+
export declare class GraphQLRequestClientFetcher extends FetcherRenderer {
|
|
5
|
+
protected visitor: SolidQueryVisitor;
|
|
6
|
+
private clientPath;
|
|
7
|
+
constructor(visitor: SolidQueryVisitor, config: GraphQlRequest);
|
|
8
|
+
generateFetcherImplementation(): string;
|
|
9
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
10
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
11
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
12
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQlRequest } from './config.js';
|
|
2
|
+
import { FetcherRenderer, type GenerateConfig } from './fetcher.js';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.js';
|
|
4
|
+
export declare class GraphQLRequestClientFetcher extends FetcherRenderer {
|
|
5
|
+
protected visitor: SolidQueryVisitor;
|
|
6
|
+
private clientPath;
|
|
7
|
+
constructor(visitor: SolidQueryVisitor, config: GraphQlRequest);
|
|
8
|
+
generateFetcherImplementation(): string;
|
|
9
|
+
generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
10
|
+
generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
11
|
+
generateMutationHook(config: GenerateConfig): string;
|
|
12
|
+
generateFetcherFetch(config: GenerateConfig): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { OperationDefinitionNode } from 'graphql';
|
|
2
|
+
import { SolidQueryVisitor } from './visitor.cjs';
|
|
3
|
+
export interface GenerateConfig {
|
|
4
|
+
node: OperationDefinitionNode;
|
|
5
|
+
documentVariableName: string;
|
|
6
|
+
operationName: string;
|
|
7
|
+
operationResultType: string;
|
|
8
|
+
operationVariablesTypes: string;
|
|
9
|
+
hasRequiredVariables: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface GenerateBaseHookConfig {
|
|
12
|
+
implArguments?: string;
|
|
13
|
+
implHookOuter?: string;
|
|
14
|
+
implFetcher: string;
|
|
15
|
+
}
|
|
16
|
+
type SolidQueryMethodMap = {
|
|
17
|
+
[key: string]: {
|
|
18
|
+
getHook: (operationName?: string) => string;
|
|
19
|
+
getOptions: () => string;
|
|
20
|
+
getOtherTypes?: () => {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare abstract class FetcherRenderer {
|
|
26
|
+
protected visitor: SolidQueryVisitor;
|
|
27
|
+
constructor(visitor: SolidQueryVisitor);
|
|
28
|
+
abstract generateFetcherImplementation(): string;
|
|
29
|
+
abstract generateFetcherFetch(config: GenerateConfig): string;
|
|
30
|
+
protected abstract generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
31
|
+
protected abstract generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
32
|
+
protected abstract generateMutationHook(config: GenerateConfig): string;
|
|
33
|
+
createQueryMethodMap(isSuspense?: boolean): SolidQueryMethodMap;
|
|
34
|
+
protected generateInfiniteQueryHelper(config: GenerateConfig, isSuspense: boolean): {
|
|
35
|
+
generateBaseInfiniteQueryHook: (hookConfig: GenerateBaseHookConfig) => string;
|
|
36
|
+
variables: string;
|
|
37
|
+
options: string;
|
|
38
|
+
};
|
|
39
|
+
protected generateQueryHelper(config: GenerateConfig, isSuspense: boolean): {
|
|
40
|
+
generateBaseQueryHook: (hookConfig: GenerateBaseHookConfig) => string;
|
|
41
|
+
variables: string;
|
|
42
|
+
options: string;
|
|
43
|
+
};
|
|
44
|
+
protected generateMutationHelper(config: GenerateConfig): {
|
|
45
|
+
generateBaseMutationHook: (hookConfig: GenerateBaseHookConfig) => string;
|
|
46
|
+
variables: string;
|
|
47
|
+
options: string;
|
|
48
|
+
};
|
|
49
|
+
protected generateQueryVariablesSignature({ hasRequiredVariables, operationVariablesTypes, }: GenerateConfig): string;
|
|
50
|
+
private generateQueryOptionsSignature;
|
|
51
|
+
private generateInfiniteQueryVariablesSignature;
|
|
52
|
+
private generateInfiniteQueryOptionsSignature;
|
|
53
|
+
generateInfiniteQueryKey(config: GenerateConfig, isSuspense: boolean): string;
|
|
54
|
+
generateInfiniteQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
55
|
+
hook: string;
|
|
56
|
+
getKey: string;
|
|
57
|
+
rootKey: string;
|
|
58
|
+
};
|
|
59
|
+
generateQueryKey(config: GenerateConfig, isSuspense: boolean): string;
|
|
60
|
+
generateQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
61
|
+
hook: string;
|
|
62
|
+
document: string;
|
|
63
|
+
getKey: string;
|
|
64
|
+
rootKey: string;
|
|
65
|
+
};
|
|
66
|
+
generateMutationKey({ node }: GenerateConfig): string;
|
|
67
|
+
generateMutationOutput(config: GenerateConfig): {
|
|
68
|
+
hook: string;
|
|
69
|
+
getKey: string;
|
|
70
|
+
};
|
|
71
|
+
private generateInfiniteQueryFormattedParameters;
|
|
72
|
+
private generateQueryFormattedParameters;
|
|
73
|
+
private generateMutationFormattedParameters;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { OperationDefinitionNode } from 'graphql';
|
|
2
|
+
import { SolidQueryVisitor } from './visitor.js';
|
|
3
|
+
export interface GenerateConfig {
|
|
4
|
+
node: OperationDefinitionNode;
|
|
5
|
+
documentVariableName: string;
|
|
6
|
+
operationName: string;
|
|
7
|
+
operationResultType: string;
|
|
8
|
+
operationVariablesTypes: string;
|
|
9
|
+
hasRequiredVariables: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface GenerateBaseHookConfig {
|
|
12
|
+
implArguments?: string;
|
|
13
|
+
implHookOuter?: string;
|
|
14
|
+
implFetcher: string;
|
|
15
|
+
}
|
|
16
|
+
type SolidQueryMethodMap = {
|
|
17
|
+
[key: string]: {
|
|
18
|
+
getHook: (operationName?: string) => string;
|
|
19
|
+
getOptions: () => string;
|
|
20
|
+
getOtherTypes?: () => {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare abstract class FetcherRenderer {
|
|
26
|
+
protected visitor: SolidQueryVisitor;
|
|
27
|
+
constructor(visitor: SolidQueryVisitor);
|
|
28
|
+
abstract generateFetcherImplementation(): string;
|
|
29
|
+
abstract generateFetcherFetch(config: GenerateConfig): string;
|
|
30
|
+
protected abstract generateQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
31
|
+
protected abstract generateInfiniteQueryHook(config: GenerateConfig, isSuspense?: boolean): string;
|
|
32
|
+
protected abstract generateMutationHook(config: GenerateConfig): string;
|
|
33
|
+
createQueryMethodMap(isSuspense?: boolean): SolidQueryMethodMap;
|
|
34
|
+
protected generateInfiniteQueryHelper(config: GenerateConfig, isSuspense: boolean): {
|
|
35
|
+
generateBaseInfiniteQueryHook: (hookConfig: GenerateBaseHookConfig) => string;
|
|
36
|
+
variables: string;
|
|
37
|
+
options: string;
|
|
38
|
+
};
|
|
39
|
+
protected generateQueryHelper(config: GenerateConfig, isSuspense: boolean): {
|
|
40
|
+
generateBaseQueryHook: (hookConfig: GenerateBaseHookConfig) => string;
|
|
41
|
+
variables: string;
|
|
42
|
+
options: string;
|
|
43
|
+
};
|
|
44
|
+
protected generateMutationHelper(config: GenerateConfig): {
|
|
45
|
+
generateBaseMutationHook: (hookConfig: GenerateBaseHookConfig) => string;
|
|
46
|
+
variables: string;
|
|
47
|
+
options: string;
|
|
48
|
+
};
|
|
49
|
+
protected generateQueryVariablesSignature({ hasRequiredVariables, operationVariablesTypes, }: GenerateConfig): string;
|
|
50
|
+
private generateQueryOptionsSignature;
|
|
51
|
+
private generateInfiniteQueryVariablesSignature;
|
|
52
|
+
private generateInfiniteQueryOptionsSignature;
|
|
53
|
+
generateInfiniteQueryKey(config: GenerateConfig, isSuspense: boolean): string;
|
|
54
|
+
generateInfiniteQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
55
|
+
hook: string;
|
|
56
|
+
getKey: string;
|
|
57
|
+
rootKey: string;
|
|
58
|
+
};
|
|
59
|
+
generateQueryKey(config: GenerateConfig, isSuspense: boolean): string;
|
|
60
|
+
generateQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
61
|
+
hook: string;
|
|
62
|
+
document: string;
|
|
63
|
+
getKey: string;
|
|
64
|
+
rootKey: string;
|
|
65
|
+
};
|
|
66
|
+
generateMutationKey({ node }: GenerateConfig): string;
|
|
67
|
+
generateMutationOutput(config: GenerateConfig): {
|
|
68
|
+
hook: string;
|
|
69
|
+
getKey: string;
|
|
70
|
+
};
|
|
71
|
+
private generateInfiniteQueryFormattedParameters;
|
|
72
|
+
private generateQueryFormattedParameters;
|
|
73
|
+
private generateMutationFormattedParameters;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import { SolidQueryRawPluginConfig } from './config.cjs';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.cjs';
|
|
4
|
+
export declare const plugin: PluginFunction<SolidQueryRawPluginConfig, Types.ComplexPluginOutput>;
|
|
5
|
+
export declare const validate: PluginValidateFn<any>;
|
|
6
|
+
export { SolidQueryVisitor };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import { SolidQueryRawPluginConfig } from './config.js';
|
|
3
|
+
import { SolidQueryVisitor } from './visitor.js';
|
|
4
|
+
export declare const plugin: PluginFunction<SolidQueryRawPluginConfig, Types.ComplexPluginOutput>;
|
|
5
|
+
export declare const validate: PluginValidateFn<any>;
|
|
6
|
+
export { SolidQueryVisitor };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
2
|
+
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
+
import { BaseSolidQueryPluginConfig, SolidQueryRawPluginConfig } from './config.cjs';
|
|
5
|
+
import { FetcherRenderer } from './fetcher.cjs';
|
|
6
|
+
export type SolidQueryPluginConfig = BaseSolidQueryPluginConfig & ClientSideBasePluginConfig;
|
|
7
|
+
export declare class SolidQueryVisitor extends ClientSideBaseVisitor<SolidQueryRawPluginConfig, SolidQueryPluginConfig> {
|
|
8
|
+
protected rawConfig: SolidQueryRawPluginConfig;
|
|
9
|
+
private _externalImportPrefix;
|
|
10
|
+
fetcher: FetcherRenderer;
|
|
11
|
+
solidQueryHookIdentifiersInUse: Set<string>;
|
|
12
|
+
solidQueryOptionsIdentifiersInUse: Set<string>;
|
|
13
|
+
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: SolidQueryRawPluginConfig, documents: Types.DocumentFile[]);
|
|
14
|
+
get imports(): Set<string>;
|
|
15
|
+
private createFetcher;
|
|
16
|
+
get hasOperations(): boolean;
|
|
17
|
+
getImports(): string[];
|
|
18
|
+
getFetcherImplementation(): string;
|
|
19
|
+
private _getHookSuffix;
|
|
20
|
+
protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string, hasRequiredVariables: boolean): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
2
|
+
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
+
import { BaseSolidQueryPluginConfig, SolidQueryRawPluginConfig } from './config.js';
|
|
5
|
+
import { FetcherRenderer } from './fetcher.js';
|
|
6
|
+
export type SolidQueryPluginConfig = BaseSolidQueryPluginConfig & ClientSideBasePluginConfig;
|
|
7
|
+
export declare class SolidQueryVisitor extends ClientSideBaseVisitor<SolidQueryRawPluginConfig, SolidQueryPluginConfig> {
|
|
8
|
+
protected rawConfig: SolidQueryRawPluginConfig;
|
|
9
|
+
private _externalImportPrefix;
|
|
10
|
+
fetcher: FetcherRenderer;
|
|
11
|
+
solidQueryHookIdentifiersInUse: Set<string>;
|
|
12
|
+
solidQueryOptionsIdentifiersInUse: Set<string>;
|
|
13
|
+
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: SolidQueryRawPluginConfig, documents: Types.DocumentFile[]);
|
|
14
|
+
get imports(): Set<string>;
|
|
15
|
+
private createFetcher;
|
|
16
|
+
get hasOperations(): boolean;
|
|
17
|
+
getImports(): string[];
|
|
18
|
+
getFetcherImplementation(): string;
|
|
19
|
+
private _getHookSuffix;
|
|
20
|
+
protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string, hasRequiredVariables: boolean): string;
|
|
21
|
+
}
|