Skip to content

Commit 621e115

Browse files
author
Mark Everett
authored
Merge pull request #5 from zekenie/feature/configure-data-loader
Allowing config of data loader
2 parents 7594134 + b867348 commit 621e115

File tree

10 files changed

+2365
-30
lines changed

10 files changed

+2365
-30
lines changed

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# OS
14+
.DS_Store
15+
16+
# Tests
17+
/coverage
18+
/.nyc_output
19+
20+
# IDEs and editors
21+
/.idea
22+
.project
23+
.classpath
24+
.c9/
25+
*.launch
26+
.settings/
27+
*.sublime-workspace
28+
29+
# IDE - VSCode
30+
.vscode/*
31+
!.vscode/settings.json
32+
!.vscode/tasks.json
33+
!.vscode/launch.json
34+
!.vscode/extensions.json
35+
.env

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.24] - 2020-05-04
9+
10+
### Changed
11+
12+
- allow configuration of data loader
13+
814
## [0.1.23] - 2020-04-11
915

1016
### Changed

dist/index.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ export declare class DataLoaderInterceptor implements NestInterceptor {
1010
constructor(moduleRef: ModuleRef);
1111
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
1212
}
13-
export declare const Loader: (...dataOrPipes: unknown[]) => ParameterDecorator;
13+
export declare const Loader: (...dataOrPipes: (string | Function | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
1414
export declare const ensureOrder: (options: any) => any;
15-
interface IOrderedDataLoaderOptions<ID, Type> {
15+
interface IOrderedNestDataLoaderOptions<ID, Type> {
1616
propertyKey?: string;
1717
query: (keys: readonly ID[]) => Promise<Type[]>;
1818
typeName?: string;
19+
dataloaderConfig?: DataLoader.Options<ID, Type>;
1920
}
2021
export declare abstract class OrderedNestDataLoader<ID, Type> implements NestDataLoader<ID, Type> {
21-
protected abstract getOptions: () => IOrderedDataLoaderOptions<ID, Type>;
22+
protected abstract getOptions: () => IOrderedNestDataLoaderOptions<ID, Type>;
2223
generateDataLoader(): DataLoader<ID, Type, ID>;
23-
protected createLoader(options: IOrderedDataLoaderOptions<ID, Type>): DataLoader<ID, Type>;
24+
protected createLoader(options: IOrderedNestDataLoaderOptions<ID, Type>): DataLoader<ID, Type>;
2425
}
2526
export {};

dist/index.js

Lines changed: 27 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/tsc

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/tsserver

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "nestjs-graphql-dataloader",
3-
"version": "0.1.23",
3+
"version": "0.1.24",
44
"private": false,
55
"description": "NestJS GraphQL Dataloader",
66
"main": "dist/index.js",
7-
"types": "index.d.ts",
7+
"types": "dist/index.d.ts",
88
"author": "Mark Everett",
99
"license": "MIT",
1010
"repository": "https://github.com/TreeMan360/nestjs-graphql-dataloader",

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ interface IOrderedNestDataLoaderOptions<ID, Type> {
122122
propertyKey?: string;
123123
query: (keys: readonly ID[]) => Promise<Type[]>;
124124
typeName?: string;
125+
dataloaderConfig?: DataLoader.Options<ID, Type>;
125126
}
126127

127128
// tslint:disable-next-line: max-classes-per-file
@@ -145,6 +146,6 @@ export abstract class OrderedNestDataLoader<ID, Type>
145146
error: (keyValue) =>
146147
`${options.typeName || defaultTypeName} does not exist (${keyValue})`,
147148
});
148-
});
149+
}, options.dataloaderConfig);
149150
}
150151
}

0 commit comments

Comments
 (0)