graphql-modules 2.1.1-alpha-20230207102533-a8842e29 → 2.1.1-alpha-20230207102701-1f0fec77
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/application/application.d.ts +1 -1
- package/application/context.d.ts +1 -1
- package/application/types.d.ts +3 -3
- package/di/decorators.d.ts +1 -1
- package/di/forward-ref.d.ts +1 -1
- package/di/injector.d.ts +1 -1
- package/di/providers.d.ts +2 -2
- package/di/resolution.d.ts +2 -2
- package/module/factory.d.ts +2 -2
- package/module/metadata.d.ts +1 -1
- package/module/types.d.ts +2 -2
- package/package.json +1 -1
- package/shared/middleware.d.ts +3 -3
- package/shared/types.d.ts +8 -8
- package/testing/test-module.d.ts +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolvedModule } from '../module/factory';
|
|
2
2
|
import { ID } from '../shared/types';
|
|
3
3
|
import { ApplicationConfig, Application } from './types';
|
|
4
|
-
export type ModulesMap = Map<ID, ResolvedModule>;
|
|
4
|
+
export declare type ModulesMap = Map<ID, ResolvedModule>;
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
package/application/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injector, ReflectiveInjector } from '../di';
|
|
2
2
|
import { ResolvedProvider } from '../di/resolution';
|
|
3
3
|
import type { InternalAppContext, ModulesMap } from './application';
|
|
4
|
-
export type ExecutionContextBuilder<TContext extends {
|
|
4
|
+
export declare type ExecutionContextBuilder<TContext extends {
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
} = {}> = (context: TContext) => {
|
|
7
7
|
context: InternalAppContext;
|
package/application/types.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type { MiddlewareMap } from '../shared/middleware';
|
|
|
5
5
|
import type { ApolloRequestContext } from './apollo';
|
|
6
6
|
import type { Single } from '../shared/types';
|
|
7
7
|
import type { InternalAppContext } from './application';
|
|
8
|
-
type Execution = typeof execute;
|
|
9
|
-
type Subscription = typeof subscribe;
|
|
10
|
-
export type ApolloExecutor = (requestContext: ApolloRequestContext) => Promise<ExecutionResult>;
|
|
8
|
+
declare type Execution = typeof execute;
|
|
9
|
+
declare type Subscription = typeof subscribe;
|
|
10
|
+
export declare type ApolloExecutor = (requestContext: ApolloRequestContext) => Promise<ExecutionResult>;
|
|
11
11
|
export interface MockedApplication extends Application {
|
|
12
12
|
replaceModule(mockedModule: MockedModule): MockedApplication;
|
|
13
13
|
addProviders(providers: ApplicationConfig['providers']): MockedApplication;
|
package/di/decorators.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Injector } from './injector';
|
|
|
3
3
|
export declare function Injectable(options?: ProviderOptions): ClassDecorator;
|
|
4
4
|
export declare function Optional(): ParameterDecorator;
|
|
5
5
|
export declare function Inject(type: Type<any> | InjectionToken<any>): ParameterDecorator;
|
|
6
|
-
export type ExecutionContext = {
|
|
6
|
+
export declare type ExecutionContext = {
|
|
7
7
|
injector: Injector;
|
|
8
8
|
} & GraphQLModules.ModuleContext;
|
|
9
9
|
export declare function ExecutionContext(): PropertyDecorator;
|
package/di/forward-ref.d.ts
CHANGED
package/di/injector.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Type, InjectionToken, Provider } from './providers';
|
|
|
2
2
|
import { ResolvedProvider, GlobalProviderMap } from './resolution';
|
|
3
3
|
import { Key } from './registry';
|
|
4
4
|
import { ExecutionContext } from './decorators';
|
|
5
|
-
type ExecutionContextGetter = () => ExecutionContext | never;
|
|
5
|
+
declare type ExecutionContextGetter = () => ExecutionContext | never;
|
|
6
6
|
export declare abstract class Injector {
|
|
7
7
|
abstract get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: any): T;
|
|
8
8
|
}
|
package/di/providers.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface ValueProvider<T> extends BaseProvider<T> {
|
|
|
18
18
|
export interface ClassProvider<T> extends BaseProvider<T> {
|
|
19
19
|
useClass: Type<T>;
|
|
20
20
|
}
|
|
21
|
-
export type Factory<T> = (...args: any[]) => T;
|
|
21
|
+
export declare type Factory<T> = (...args: any[]) => T;
|
|
22
22
|
export interface FactoryProvider<T> extends BaseProvider<T> {
|
|
23
23
|
useFactory: Factory<T>;
|
|
24
24
|
deps?: any[];
|
|
@@ -28,7 +28,7 @@ export interface BaseProvider<T> extends ProviderOptions {
|
|
|
28
28
|
}
|
|
29
29
|
export interface TypeProvider<T> extends Type<T> {
|
|
30
30
|
}
|
|
31
|
-
export type Provider<T = any> = TypeProvider<T> | ValueProvider<T> | ClassProvider<T> | FactoryProvider<T>;
|
|
31
|
+
export declare type Provider<T = any> = TypeProvider<T> | ValueProvider<T> | ClassProvider<T> | FactoryProvider<T>;
|
|
32
32
|
export interface ProviderOptions {
|
|
33
33
|
scope?: Scope;
|
|
34
34
|
executionContextIn?: Array<string | symbol>;
|
package/di/resolution.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Provider, ValueProvider, ClassProvider, FactoryProvider } from './providers';
|
|
2
2
|
import { Key } from './registry';
|
|
3
3
|
import { ReflectiveInjector } from './injector';
|
|
4
|
-
export type NormalizedProvider<T = any> = ValueProvider<T> | ClassProvider<T> | FactoryProvider<T>;
|
|
5
|
-
export type GlobalProviderMap = {
|
|
4
|
+
export declare type NormalizedProvider<T = any> = ValueProvider<T> | ClassProvider<T> | FactoryProvider<T>;
|
|
5
|
+
export declare type GlobalProviderMap = {
|
|
6
6
|
has(key: Key['id']): boolean;
|
|
7
7
|
get(key: Key['id']): ReflectiveInjector;
|
|
8
8
|
};
|
package/module/factory.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { ReflectiveInjector } from '../di';
|
|
|
3
3
|
import { ResolvedProvider } from './../di/resolution';
|
|
4
4
|
import { MiddlewareMap } from '../shared/middleware';
|
|
5
5
|
import { Single } from '../shared/types';
|
|
6
|
-
export type ResolvedModule = {
|
|
6
|
+
export declare type ResolvedModule = {
|
|
7
7
|
injector: ReflectiveInjector;
|
|
8
8
|
singletonProviders: Array<ResolvedProvider>;
|
|
9
9
|
operationProviders: Array<ResolvedProvider>;
|
|
10
10
|
resolvers?: Single<Resolvers>;
|
|
11
11
|
} & Omit<Module, 'factory'>;
|
|
12
|
-
export type ModuleFactory = (app: {
|
|
12
|
+
export declare type ModuleFactory = (app: {
|
|
13
13
|
injector: ReflectiveInjector;
|
|
14
14
|
middlewares: MiddlewareMap;
|
|
15
15
|
}) => ResolvedModule;
|
package/module/metadata.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
2
|
import { ModuleConfig } from './types';
|
|
3
3
|
import { ID } from '../shared/types';
|
|
4
|
-
export type Registry = Record<string, string[]>;
|
|
4
|
+
export declare type Registry = Record<string, string[]>;
|
|
5
5
|
export interface ModuleMetadata {
|
|
6
6
|
id: ID;
|
|
7
7
|
typeDefs: DocumentNode[];
|
package/module/types.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ModuleMetadata } from './metadata';
|
|
|
5
5
|
import { Provider } from '../di';
|
|
6
6
|
import { MiddlewareMap } from '../shared/middleware';
|
|
7
7
|
import { ResolvedProvider } from '../di/resolution';
|
|
8
|
-
export type TypeDefs = Plural<DocumentNode>;
|
|
9
|
-
export type Resolvers = Plural<Record<string, any>>;
|
|
8
|
+
export declare type TypeDefs = Plural<DocumentNode>;
|
|
9
|
+
export declare type Resolvers = Plural<Record<string, any>>;
|
|
10
10
|
/**
|
|
11
11
|
* @api
|
|
12
12
|
* Module's configuration object. Represents the first argument of `createModule` function.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphql-modules",
|
|
3
|
-
"version": "2.1.1-alpha-
|
|
3
|
+
"version": "2.1.1-alpha-20230207102701-1f0fec77",
|
|
4
4
|
"description": "Create reusable, maintainable, testable and extendable GraphQL modules",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
package/shared/middleware.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLResolveInfo } from 'graphql';
|
|
2
2
|
import { ModuleMetadata } from './../module/metadata';
|
|
3
|
-
export type Next<T = any> = () => Promise<T>;
|
|
4
|
-
export type Middleware<TContext = MiddlewareContext> = (context: TContext, next: Next) => Promise<any>;
|
|
3
|
+
export declare type Next<T = any> = () => Promise<T>;
|
|
4
|
+
export declare type Middleware<TContext = MiddlewareContext> = (context: TContext, next: Next) => Promise<any>;
|
|
5
5
|
export declare function compose<TContext>(middleware: Array<Middleware<TContext>>): (context: TContext, next: Next) => Promise<any>;
|
|
6
6
|
export interface MiddlewareContext {
|
|
7
7
|
root: any;
|
|
@@ -11,7 +11,7 @@ export interface MiddlewareContext {
|
|
|
11
11
|
context: GraphQLModules.ModuleContext;
|
|
12
12
|
info: GraphQLResolveInfo;
|
|
13
13
|
}
|
|
14
|
-
export type MiddlewareMap = {
|
|
14
|
+
export declare type MiddlewareMap = {
|
|
15
15
|
[type: string]: {
|
|
16
16
|
[field: string]: Middleware[];
|
|
17
17
|
};
|
package/shared/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { GraphQLFieldResolver, GraphQLTypeResolver } from 'graphql';
|
|
2
2
|
import { Injector } from '../di';
|
|
3
|
-
export type ID = string;
|
|
4
|
-
export type Nil = undefined | null;
|
|
5
|
-
export type Maybe<T> = T | Nil;
|
|
6
|
-
export type Plural<T> = T | T[];
|
|
7
|
-
export type Single<T> = T extends Array<infer R> ? R : T;
|
|
8
|
-
export type ValueOrPromise<T> = T | Promise<T>;
|
|
9
|
-
export type ResolveFn<TContext = GraphQLModules.Context> = GraphQLFieldResolver<any, TContext, Record<string, any>>;
|
|
10
|
-
export type ResolveTypeFn<TContext = GraphQLModules.Context> = GraphQLTypeResolver<any, TContext>;
|
|
3
|
+
export declare type ID = string;
|
|
4
|
+
export declare type Nil = undefined | null;
|
|
5
|
+
export declare type Maybe<T> = T | Nil;
|
|
6
|
+
export declare type Plural<T> = T | T[];
|
|
7
|
+
export declare type Single<T> = T extends Array<infer R> ? R : T;
|
|
8
|
+
export declare type ValueOrPromise<T> = T | Promise<T>;
|
|
9
|
+
export declare type ResolveFn<TContext = GraphQLModules.Context> = GraphQLFieldResolver<any, TContext, Record<string, any>>;
|
|
10
|
+
export declare type ResolveTypeFn<TContext = GraphQLModules.Context> = GraphQLTypeResolver<any, TContext>;
|
|
11
11
|
declare global {
|
|
12
12
|
namespace GraphQLModules {
|
|
13
13
|
type ModuleContext = {
|
package/testing/test-module.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ApplicationConfig } from '../application/types';
|
|
2
2
|
import { MockedModule, Module, ModuleConfig } from '../module/types';
|
|
3
|
-
type TestModuleConfig = {
|
|
3
|
+
declare type TestModuleConfig = {
|
|
4
4
|
replaceExtensions?: boolean;
|
|
5
5
|
inheritTypeDefs?: Module[];
|
|
6
6
|
} & Partial<Pick<ApplicationConfig, 'providers' | 'modules' | 'middlewares' | 'schemaBuilder'>> & Partial<Pick<ModuleConfig, 'typeDefs' | 'resolvers'>>;
|
|
7
|
-
type MockModuleConfig = Partial<Pick<ModuleConfig, 'providers'>>;
|
|
7
|
+
declare type MockModuleConfig = Partial<Pick<ModuleConfig, 'providers'>>;
|
|
8
8
|
export declare function mockModule(testedModule: Module, overrideConfig: MockModuleConfig): MockedModule;
|
|
9
9
|
export declare function testModule(testedModule: Module, config?: TestModuleConfig): import("../application/types").Application;
|
|
10
10
|
export {};
|