Skip to content

Commit

Permalink
feat: add [email protected] to peerDependencies; update other dep…
Browse files Browse the repository at this point in the history
…endencies
  • Loading branch information
nodkz committed May 30, 2021
1 parent 62c3806 commit 1a4fbbd
Show file tree
Hide file tree
Showing 12 changed files with 1,061 additions and 846 deletions.
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,36 @@
"homepage": "https://github.com/graphql-compose/graphql-compose-bullmq",
"peerDependencies": {
"bullmq": "^1.14.4",
"graphql-compose": "^7.15.0 || ^8.0.0"
"graphql-compose": "^7.15.0 || ^8.0.0 || ^9.0.0"
},
"devDependencies": {
"@types/express": "4.17.11",
"@types/express": "4.17.12",
"@types/express-graphql": "^0.9.0",
"@types/graphql": "^14.5.0",
"@types/jest": "26.0.23",
"@types/node": "15.0.1",
"@types/node": "15.6.1",
"@types/node-fetch": "2.5.10",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"bullmq": "1.22.2",
"@typescript-eslint/eslint-plugin": "4.25.0",
"@typescript-eslint/parser": "4.25.0",
"bullmq": "1.28.0",
"cpx": "^1.5.0",
"cross-env": "7.0.3",
"eslint": "7.25.0",
"eslint": "7.27.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-prettier": "3.4.0",
"express": "^4.17.1",
"express-graphql": "0.12.0",
"graphql": "15.5.0",
"graphql-compose": "8.0.1",
"jest": "26.6.3",
"prettier": "2.2.1",
"graphql-compose": "9.0.0",
"jest": "27.0.3",
"prettier": "2.3.0",
"rimraf": "3.0.2",
"semantic-release": "17.4.2",
"ts-jest": "26.5.5",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"semantic-release": "17.4.3",
"ts-jest": "27.0.1",
"ts-node": "10.0.0",
"typescript": "4.3.2"
},
"scripts": {
"build": "rimraf lib && tsc -p ./tsconfig.build.json && yarn build-lua",
Expand Down
19 changes: 10 additions & 9 deletions src/helpers/composeFC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ import { Options } from '../definitions';

type FC = ObjectTypeComposerFieldConfigAsObjectDefinition<any, any>;

type Middleare = (fc: FC, sc: SchemaComposer<any>, opts: Options) => FC;
type Middleware = (fc: FC, sc: SchemaComposer<any>, opts: Options) => FC;

type Creator = (sc: SchemaComposer<any>, opts: Options) => FC;

type Wrapper = (creator: Creator) => FC;

type ComposeFCResult = (...args: Middleare[]) => Wrapper;
type ComposeFCResult = (...args: Middleware[]) => Wrapper;

/**
* Compose several FC creator with middlewares
*/
export function composeFC(sc: SchemaComposer<any>, opts: Options): ComposeFCResult {
return (...middlewares: Middleare[]): Wrapper => (creator: Creator): FC => {
let fc = creator(sc, opts);
for (let i = 0; i < middlewares.length; i++) {
fc = middlewares[i](fc, sc, opts);
}
return fc;
};
return (...middlewares: Middleware[]): Wrapper =>
(creator: Creator): FC => {
let fc = creator(sc, opts);
for (let i = 0; i < middlewares.length; i++) {
fc = middlewares[i](fc, sc, opts);
}
return fc;
};
}
2 changes: 1 addition & 1 deletion src/helpers/queueEventsListen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function getAsyncIterator(
queueName: string,
eventName: string,
opts: Options
) {
): Required<AsyncIterator<any>> {
const queueEvents = getQueueEventsSingleton(prefix, queueName, opts);
return createAsyncIterator(queueEvents, eventName);
}
Expand Down
2 changes: 2 additions & 0 deletions src/mutation/jobLogAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export function createJobLogAddFC(
const queue = await findQueue(prefix, queueName, opts);
const job = await queue.getJob(id);
if (!job) throw new MutationError('Job not found!', ErrorCodeEnum.JOB_NOT_FOUND);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const logRes = await job.log(row);
//TODO: в logRes похоже тупо количество записей в логе, подумать что с этим сотворить...

Expand Down
4 changes: 2 additions & 2 deletions src/types/info/Info.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createMemoryFC } from './Info.memory';
import { SchemaComposer } from 'graphql-compose';
import { ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
import { Options } from '../../definitions';

export function getInfoTC(sc: SchemaComposer<any>, opts: Options) {
export function getInfoTC(sc: SchemaComposer<any>, opts: Options): ObjectTypeComposer {
const { typePrefix } = opts;

return sc.getOrCreateOTC(`${typePrefix}Info`, (etc) => {
Expand Down
4 changes: 2 additions & 2 deletions src/types/job/Job.opts.repeat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchemaComposer } from 'graphql-compose';
import { ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
import { Options } from '../../definitions';

export function createRepeatOptionsTC(sc: SchemaComposer<any>, opts: Options) {
export function createRepeatOptionsTC(sc: SchemaComposer<any>, opts: Options): ObjectTypeComposer {
const { typePrefix } = opts;

const RepeatOptionsTC = sc.createObjectTC({
Expand Down
4 changes: 2 additions & 2 deletions src/types/job/Job.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createLogsFC } from './Job.logs';
import { createStateFC } from './Job.state';
import { createRepeatOptionsTC } from './Job.opts.repeat';
import { SchemaComposer } from 'graphql-compose';
import { ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
import { Options } from '../../definitions';
import { Job } from 'bullmq';

export function getJobTC(sc: SchemaComposer<any>, opts: Options) {
export function getJobTC(sc: SchemaComposer<any>, opts: Options): ObjectTypeComposer {
const { typePrefix, jobDataTC = 'JSON!' } = opts;

return sc.getOrCreateOTC(`${typePrefix}Job`, (etc) => {
Expand Down
1 change: 1 addition & 0 deletions src/types/queue/Queue.durationAvg.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { SchemaComposer, ObjectTypeComposerFieldConfigDefinition } from 'graphql-compose';
import { Queue } from 'bullmq';
import { Options } from '../../definitions';
Expand Down
4 changes: 2 additions & 2 deletions src/types/queue/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { createFailedJobsFC } from './Queue.failedJobs';
import { createWorkersTC } from './Queue.workers';
import { createDurationAvgFC } from './Queue.durationAvg';
import { createJobsMemoryUsageAvgFC } from './Queue.jobsMemoryUsageAvg';
import { SchemaComposer } from 'graphql-compose';
import { ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
import { Options } from '../../definitions';

export function getQueueTC(sc: SchemaComposer<any>, opts: Options) {
export function getQueueTC(sc: SchemaComposer<any>, opts: Options): ObjectTypeComposer {
const { typePrefix } = opts;

return sc.getOrCreateOTC(`${typePrefix}Queue`, (etc) => {
Expand Down
4 changes: 2 additions & 2 deletions src/types/scalars/JobStatusEnum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SchemaComposer } from 'graphql-compose';
import { EnumTypeComposer, SchemaComposer } from 'graphql-compose';
import { Options } from '../../definitions';

export enum JobStatusEnum {
Expand All @@ -11,7 +11,7 @@ export enum JobStatusEnum {
UNKNOWN = 'unknown',
}

export function getJobStatusEnumTC(sc: SchemaComposer<any>, opts: Options) {
export function getJobStatusEnumTC(sc: SchemaComposer<any>, opts: Options): EnumTypeComposer {
const { typePrefix } = opts;
return sc.getOrCreateETC(`${typePrefix}JobStatusEnum`, (etc) => {
etc.addFields({
Expand Down
4 changes: 2 additions & 2 deletions src/types/scalars/OrderEnum.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SchemaComposer } from 'graphql-compose';
import { EnumTypeComposer, SchemaComposer } from 'graphql-compose';
import { Options } from '../../definitions';

export enum OrderEnum {
ASC = 'asc',
DESC = 'desc',
}

export function getOrderEnumTC(sc: SchemaComposer<any>, opts: Options) {
export function getOrderEnumTC(sc: SchemaComposer<any>, opts: Options): EnumTypeComposer {
const { typePrefix } = opts;
return sc.getOrCreateETC(`${typePrefix}OrderEnum`, (etc) => {
etc.addFields({
Expand Down
Loading

0 comments on commit 1a4fbbd

Please sign in to comment.