@graphql-tools/stitching-directives 3.1.13 → 3.1.14-alpha-09de1d3da51074c5901decc7efd24f43af24378f

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/dist/index.cjs +1196 -0
  3. package/dist/index.d.cts +58 -0
  4. package/dist/index.d.ts +58 -0
  5. package/dist/index.js +1193 -0
  6. package/package.json +32 -42
  7. package/cjs/defaultStitchingDirectiveOptions.js +0 -10
  8. package/cjs/extractVariables.js +0 -52
  9. package/cjs/federationToStitchingSDL.js +0 -116
  10. package/cjs/getSourcePaths.js +0 -25
  11. package/cjs/index.js +0 -6
  12. package/cjs/package.json +0 -1
  13. package/cjs/parseMergeArgsExpr.js +0 -77
  14. package/cjs/pathsFromSelectionSet.js +0 -29
  15. package/cjs/preparseMergeArgsExpr.js +0 -31
  16. package/cjs/properties.js +0 -70
  17. package/cjs/stitchingDirectives.js +0 -78
  18. package/cjs/stitchingDirectivesTransformer.js +0 -490
  19. package/cjs/stitchingDirectivesValidator.js +0 -119
  20. package/cjs/types.js +0 -0
  21. package/esm/defaultStitchingDirectiveOptions.js +0 -7
  22. package/esm/extractVariables.js +0 -48
  23. package/esm/federationToStitchingSDL.js +0 -112
  24. package/esm/getSourcePaths.js +0 -21
  25. package/esm/index.js +0 -3
  26. package/esm/parseMergeArgsExpr.js +0 -73
  27. package/esm/pathsFromSelectionSet.js +0 -25
  28. package/esm/preparseMergeArgsExpr.js +0 -27
  29. package/esm/properties.js +0 -63
  30. package/esm/stitchingDirectives.js +0 -74
  31. package/esm/stitchingDirectivesTransformer.js +0 -486
  32. package/esm/stitchingDirectivesValidator.js +0 -115
  33. package/esm/types.js +0 -0
  34. package/typings/defaultStitchingDirectiveOptions.d.cts +0 -2
  35. package/typings/defaultStitchingDirectiveOptions.d.ts +0 -2
  36. package/typings/extractVariables.d.cts +0 -7
  37. package/typings/extractVariables.d.ts +0 -7
  38. package/typings/federationToStitchingSDL.d.cts +0 -2
  39. package/typings/federationToStitchingSDL.d.ts +0 -2
  40. package/typings/getSourcePaths.d.cts +0 -3
  41. package/typings/getSourcePaths.d.ts +0 -3
  42. package/typings/index.d.cts +0 -3
  43. package/typings/index.d.ts +0 -3
  44. package/typings/parseMergeArgsExpr.d.cts +0 -3
  45. package/typings/parseMergeArgsExpr.d.ts +0 -3
  46. package/typings/pathsFromSelectionSet.d.cts +0 -2
  47. package/typings/pathsFromSelectionSet.d.ts +0 -2
  48. package/typings/preparseMergeArgsExpr.d.cts +0 -6
  49. package/typings/preparseMergeArgsExpr.d.ts +0 -6
  50. package/typings/properties.d.cts +0 -5
  51. package/typings/properties.d.ts +0 -5
  52. package/typings/stitchingDirectives.d.cts +0 -19
  53. package/typings/stitchingDirectives.d.ts +0 -19
  54. package/typings/stitchingDirectivesTransformer.d.cts +0 -3
  55. package/typings/stitchingDirectivesTransformer.d.ts +0 -3
  56. package/typings/stitchingDirectivesValidator.d.cts +0 -3
  57. package/typings/stitchingDirectivesValidator.d.ts +0 -3
  58. package/typings/types.d.cts +0 -35
  59. package/typings/types.d.ts +0 -35
@@ -0,0 +1,58 @@
1
+ import { SubschemaConfig } from '@graphql-tools/delegate';
2
+ import { GraphQLSchema, GraphQLDirective } from 'graphql';
3
+
4
+ interface PropertyTree {
5
+ [property: string]: null | PropertyTree;
6
+ }
7
+ interface ParsedMergeArgsExpr {
8
+ args: Record<string, any>;
9
+ usedProperties: PropertyTree;
10
+ mappingInstructions?: Array<MappingInstruction>;
11
+ expansions?: Array<Expansion>;
12
+ }
13
+ interface MappingInstruction {
14
+ destinationPath: Array<string>;
15
+ sourcePath: Array<string>;
16
+ }
17
+ interface Expansion {
18
+ valuePath: Array<string>;
19
+ value: any;
20
+ mappingInstructions: Array<MappingInstruction>;
21
+ }
22
+ type VariablePaths = Record<string, Array<string | number>>;
23
+ interface StitchingDirectivesOptions {
24
+ keyDirectiveName?: string;
25
+ computedDirectiveName?: string;
26
+ mergeDirectiveName?: string;
27
+ canonicalDirectiveName?: string;
28
+ pathToDirectivesInExtensions?: Array<string>;
29
+ }
30
+ type Complete<T> = {
31
+ [P in keyof Required<T>]: Exclude<Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined, undefined>;
32
+ };
33
+ type StitchingDirectivesFinalOptions = Complete<StitchingDirectivesOptions>;
34
+ interface MergedTypeResolverInfo extends ParsedMergeArgsExpr {
35
+ fieldName: string;
36
+ returnsList: boolean;
37
+ }
38
+
39
+ interface StitchingDirectivesResult {
40
+ keyDirectiveTypeDefs: string;
41
+ computedDirectiveTypeDefs: string;
42
+ mergeDirectiveTypeDefs: string;
43
+ canonicalDirectiveTypeDefs: string;
44
+ stitchingDirectivesTypeDefs: string;
45
+ allStitchingDirectivesTypeDefs: string;
46
+ stitchingDirectivesValidator: (schema: GraphQLSchema) => GraphQLSchema;
47
+ stitchingDirectivesTransformer: (subschemaConfig: SubschemaConfig) => SubschemaConfig;
48
+ keyDirective: GraphQLDirective;
49
+ computedDirective: GraphQLDirective;
50
+ mergeDirective: GraphQLDirective;
51
+ canonicalDirective: GraphQLDirective;
52
+ allStitchingDirectives: Array<GraphQLDirective>;
53
+ }
54
+ declare function stitchingDirectives(options?: StitchingDirectivesOptions): StitchingDirectivesResult;
55
+
56
+ declare function federationToStitchingSDL(federationSDL: string, stitchingConfig?: StitchingDirectivesResult): string;
57
+
58
+ export { type Expansion, type MappingInstruction, type MergedTypeResolverInfo, type ParsedMergeArgsExpr, type PropertyTree, type StitchingDirectivesFinalOptions, type StitchingDirectivesOptions, type StitchingDirectivesResult, type VariablePaths, federationToStitchingSDL, stitchingDirectives };
@@ -0,0 +1,58 @@
1
+ import { SubschemaConfig } from '@graphql-tools/delegate';
2
+ import { GraphQLSchema, GraphQLDirective } from 'graphql';
3
+
4
+ interface PropertyTree {
5
+ [property: string]: null | PropertyTree;
6
+ }
7
+ interface ParsedMergeArgsExpr {
8
+ args: Record<string, any>;
9
+ usedProperties: PropertyTree;
10
+ mappingInstructions?: Array<MappingInstruction>;
11
+ expansions?: Array<Expansion>;
12
+ }
13
+ interface MappingInstruction {
14
+ destinationPath: Array<string>;
15
+ sourcePath: Array<string>;
16
+ }
17
+ interface Expansion {
18
+ valuePath: Array<string>;
19
+ value: any;
20
+ mappingInstructions: Array<MappingInstruction>;
21
+ }
22
+ type VariablePaths = Record<string, Array<string | number>>;
23
+ interface StitchingDirectivesOptions {
24
+ keyDirectiveName?: string;
25
+ computedDirectiveName?: string;
26
+ mergeDirectiveName?: string;
27
+ canonicalDirectiveName?: string;
28
+ pathToDirectivesInExtensions?: Array<string>;
29
+ }
30
+ type Complete<T> = {
31
+ [P in keyof Required<T>]: Exclude<Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined, undefined>;
32
+ };
33
+ type StitchingDirectivesFinalOptions = Complete<StitchingDirectivesOptions>;
34
+ interface MergedTypeResolverInfo extends ParsedMergeArgsExpr {
35
+ fieldName: string;
36
+ returnsList: boolean;
37
+ }
38
+
39
+ interface StitchingDirectivesResult {
40
+ keyDirectiveTypeDefs: string;
41
+ computedDirectiveTypeDefs: string;
42
+ mergeDirectiveTypeDefs: string;
43
+ canonicalDirectiveTypeDefs: string;
44
+ stitchingDirectivesTypeDefs: string;
45
+ allStitchingDirectivesTypeDefs: string;
46
+ stitchingDirectivesValidator: (schema: GraphQLSchema) => GraphQLSchema;
47
+ stitchingDirectivesTransformer: (subschemaConfig: SubschemaConfig) => SubschemaConfig;
48
+ keyDirective: GraphQLDirective;
49
+ computedDirective: GraphQLDirective;
50
+ mergeDirective: GraphQLDirective;
51
+ canonicalDirective: GraphQLDirective;
52
+ allStitchingDirectives: Array<GraphQLDirective>;
53
+ }
54
+ declare function stitchingDirectives(options?: StitchingDirectivesOptions): StitchingDirectivesResult;
55
+
56
+ declare function federationToStitchingSDL(federationSDL: string, stitchingConfig?: StitchingDirectivesResult): string;
57
+
58
+ export { type Expansion, type MappingInstruction, type MergedTypeResolverInfo, type ParsedMergeArgsExpr, type PropertyTree, type StitchingDirectivesFinalOptions, type StitchingDirectivesOptions, type StitchingDirectivesResult, type VariablePaths, federationToStitchingSDL, stitchingDirectives };