@graphql-tools/stitching-directives 3.0.0-alpha-f6c67111.0 → 3.0.0-alpha-20230517123108-df347e95
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/README.md +0 -2
- package/cjs/defaultStitchingDirectiveOptions.js +10 -0
- package/cjs/extractVariables.js +52 -0
- package/cjs/federationToStitchingSDL.js +114 -0
- package/cjs/getSourcePaths.js +25 -0
- package/cjs/index.js +6 -0
- package/cjs/package.json +1 -0
- package/cjs/parseMergeArgsExpr.js +69 -0
- package/cjs/pathsFromSelectionSet.js +31 -0
- package/cjs/preparseMergeArgsExpr.js +31 -0
- package/cjs/properties.js +70 -0
- package/cjs/stitchingDirectives.js +78 -0
- package/cjs/stitchingDirectivesTransformer.js +423 -0
- package/cjs/stitchingDirectivesValidator.js +120 -0
- package/cjs/types.js +0 -0
- package/esm/defaultStitchingDirectiveOptions.js +7 -0
- package/esm/extractVariables.js +48 -0
- package/esm/federationToStitchingSDL.js +110 -0
- package/esm/getSourcePaths.js +21 -0
- package/esm/index.js +3 -0
- package/esm/parseMergeArgsExpr.js +65 -0
- package/esm/pathsFromSelectionSet.js +27 -0
- package/esm/preparseMergeArgsExpr.js +27 -0
- package/esm/properties.js +63 -0
- package/esm/stitchingDirectives.js +74 -0
- package/esm/stitchingDirectivesTransformer.js +419 -0
- package/esm/stitchingDirectivesValidator.js +116 -0
- package/esm/types.js +0 -0
- package/package.json +40 -15
- package/typings/defaultStitchingDirectiveOptions.d.cts +2 -0
- package/{defaultStitchingDirectiveOptions.d.ts → typings/defaultStitchingDirectiveOptions.d.ts} +1 -1
- package/typings/extractVariables.d.cts +7 -0
- package/{extractVariables.d.ts → typings/extractVariables.d.ts} +1 -1
- package/typings/federationToStitchingSDL.d.cts +2 -0
- package/{federationToStitchingSDL.d.ts → typings/federationToStitchingSDL.d.ts} +1 -1
- package/typings/getSourcePaths.d.cts +3 -0
- package/{getSourcePaths.d.ts → typings/getSourcePaths.d.ts} +1 -1
- package/typings/index.d.cts +3 -0
- package/typings/index.d.ts +3 -0
- package/typings/parseMergeArgsExpr.d.cts +3 -0
- package/{parseMergeArgsExpr.d.ts → typings/parseMergeArgsExpr.d.ts} +1 -1
- package/typings/pathsFromSelectionSet.d.ts +2 -0
- package/typings/preparseMergeArgsExpr.d.ts +6 -0
- package/typings/properties.d.cts +5 -0
- package/{properties.d.ts → typings/properties.d.ts} +1 -1
- package/typings/stitchingDirectives.d.cts +19 -0
- package/{stitchingDirectives.d.ts → typings/stitchingDirectives.d.ts} +1 -1
- package/typings/stitchingDirectivesTransformer.d.cts +3 -0
- package/{stitchingDirectivesTransformer.d.ts → typings/stitchingDirectivesTransformer.d.ts} +1 -1
- package/typings/stitchingDirectivesValidator.d.cts +3 -0
- package/{stitchingDirectivesValidator.d.ts → typings/stitchingDirectivesValidator.d.ts} +1 -1
- package/typings/types.d.cts +35 -0
- package/{types.d.ts → typings/types.d.ts} +3 -3
- package/index.d.ts +0 -3
- package/index.js +0 -972
- package/index.mjs +0 -967
- /package/{pathsFromSelectionSet.d.ts → typings/pathsFromSelectionSet.d.cts} +0 -0
- /package/{preparseMergeArgsExpr.d.ts → typings/preparseMergeArgsExpr.d.cts} +0 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
import { PropertyTree } from './types.cjs';
|
2
|
+
export declare function addProperty(object: Record<string, any>, path: Array<string | number>, value: any): void;
|
3
|
+
export declare function getProperty(object: Record<string, any>, path: Array<string>): any;
|
4
|
+
export declare function getProperties(object: Record<string, any>, propertyTree: PropertyTree): any;
|
5
|
+
export declare function propertyTreeFromPaths(paths: Array<Array<string>>): PropertyTree;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PropertyTree } from './types';
|
1
|
+
import { PropertyTree } from './types.js';
|
2
2
|
export declare function addProperty(object: Record<string, any>, path: Array<string | number>, value: any): void;
|
3
3
|
export declare function getProperty(object: Record<string, any>, path: Array<string>): any;
|
4
4
|
export declare function getProperties(object: Record<string, any>, propertyTree: PropertyTree): any;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { GraphQLDirective, GraphQLSchema } from 'graphql';
|
2
|
+
import { SubschemaConfig } from '@graphql-tools/delegate';
|
3
|
+
import { StitchingDirectivesOptions } from './types.cjs';
|
4
|
+
export interface StitchingDirectivesResult {
|
5
|
+
keyDirectiveTypeDefs: string;
|
6
|
+
computedDirectiveTypeDefs: string;
|
7
|
+
mergeDirectiveTypeDefs: string;
|
8
|
+
canonicalDirectiveTypeDefs: string;
|
9
|
+
stitchingDirectivesTypeDefs: string;
|
10
|
+
allStitchingDirectivesTypeDefs: string;
|
11
|
+
stitchingDirectivesValidator: (schema: GraphQLSchema) => GraphQLSchema;
|
12
|
+
stitchingDirectivesTransformer: (subschemaConfig: SubschemaConfig) => SubschemaConfig;
|
13
|
+
keyDirective: GraphQLDirective;
|
14
|
+
computedDirective: GraphQLDirective;
|
15
|
+
mergeDirective: GraphQLDirective;
|
16
|
+
canonicalDirective: GraphQLDirective;
|
17
|
+
allStitchingDirectives: Array<GraphQLDirective>;
|
18
|
+
}
|
19
|
+
export declare function stitchingDirectives(options?: StitchingDirectivesOptions): StitchingDirectivesResult;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { GraphQLDirective, GraphQLSchema } from 'graphql';
|
2
2
|
import { SubschemaConfig } from '@graphql-tools/delegate';
|
3
|
-
import { StitchingDirectivesOptions } from './types';
|
3
|
+
import { StitchingDirectivesOptions } from './types.js';
|
4
4
|
export interface StitchingDirectivesResult {
|
5
5
|
keyDirectiveTypeDefs: string;
|
6
6
|
computedDirectiveTypeDefs: string;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { SubschemaConfig } from '@graphql-tools/delegate';
|
2
|
-
import { StitchingDirectivesOptions } from './types';
|
2
|
+
import { StitchingDirectivesOptions } from './types.js';
|
3
3
|
export declare function stitchingDirectivesTransformer(options?: StitchingDirectivesOptions): (subschemaConfig: SubschemaConfig) => SubschemaConfig;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
2
|
-
import { StitchingDirectivesOptions } from './types';
|
2
|
+
import { StitchingDirectivesOptions } from './types.js';
|
3
3
|
export declare function stitchingDirectivesValidator(options?: StitchingDirectivesOptions): (schema: GraphQLSchema) => GraphQLSchema;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
export interface PropertyTree {
|
2
|
+
[property: string]: null | PropertyTree;
|
3
|
+
}
|
4
|
+
export interface ParsedMergeArgsExpr {
|
5
|
+
args: Record<string, any>;
|
6
|
+
usedProperties: PropertyTree;
|
7
|
+
mappingInstructions?: Array<MappingInstruction>;
|
8
|
+
expansions?: Array<Expansion>;
|
9
|
+
}
|
10
|
+
export interface MappingInstruction {
|
11
|
+
destinationPath: Array<string>;
|
12
|
+
sourcePath: Array<string>;
|
13
|
+
}
|
14
|
+
export interface Expansion {
|
15
|
+
valuePath: Array<string>;
|
16
|
+
value: any;
|
17
|
+
mappingInstructions: Array<MappingInstruction>;
|
18
|
+
}
|
19
|
+
export type VariablePaths = Record<string, Array<string | number>>;
|
20
|
+
export interface StitchingDirectivesOptions {
|
21
|
+
keyDirectiveName?: string;
|
22
|
+
computedDirectiveName?: string;
|
23
|
+
mergeDirectiveName?: string;
|
24
|
+
canonicalDirectiveName?: string;
|
25
|
+
pathToDirectivesInExtensions?: Array<string>;
|
26
|
+
}
|
27
|
+
type Complete<T> = {
|
28
|
+
[P in keyof Required<T>]: Exclude<Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined, undefined>;
|
29
|
+
};
|
30
|
+
export type StitchingDirectivesFinalOptions = Complete<StitchingDirectivesOptions>;
|
31
|
+
export interface MergedTypeResolverInfo extends ParsedMergeArgsExpr {
|
32
|
+
fieldName: string;
|
33
|
+
returnsList: boolean;
|
34
|
+
}
|
35
|
+
export {};
|
@@ -16,7 +16,7 @@ export interface Expansion {
|
|
16
16
|
value: any;
|
17
17
|
mappingInstructions: Array<MappingInstruction>;
|
18
18
|
}
|
19
|
-
export
|
19
|
+
export type VariablePaths = Record<string, Array<string | number>>;
|
20
20
|
export interface StitchingDirectivesOptions {
|
21
21
|
keyDirectiveName?: string;
|
22
22
|
computedDirectiveName?: string;
|
@@ -24,10 +24,10 @@ export interface StitchingDirectivesOptions {
|
|
24
24
|
canonicalDirectiveName?: string;
|
25
25
|
pathToDirectivesInExtensions?: Array<string>;
|
26
26
|
}
|
27
|
-
|
27
|
+
type Complete<T> = {
|
28
28
|
[P in keyof Required<T>]: Exclude<Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined, undefined>;
|
29
29
|
};
|
30
|
-
export
|
30
|
+
export type StitchingDirectivesFinalOptions = Complete<StitchingDirectivesOptions>;
|
31
31
|
export interface MergedTypeResolverInfo extends ParsedMergeArgsExpr {
|
32
32
|
fieldName: string;
|
33
33
|
returnsList: boolean;
|
package/index.d.ts
DELETED