Skip to content

Commit

Permalink
Merge pull request #675 from feathersjs-ecosystem/not-destructure-fea…
Browse files Browse the repository at this point in the history
…thers-errors

fix(esm): import errors from @feathersjs/errors
  • Loading branch information
fratzinger authored Jun 8, 2022
2 parents 0098dd5 + 0c5b2c0 commit 424e632
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/hooks/alter-items.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;

import type { Hook, HookContext } from '@feathersjs/feathers';
import { isPromise } from '../common';
import { getItems } from '../utils/get-items';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/disallow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MethodNotAllowed } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { MethodNotAllowed } = errors;
import type { Hook } from '@feathersjs/feathers';
import type { TransportName } from '../types';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/keep-in-array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import _get from 'lodash/get';
import _set from 'lodash/set';
import _has from 'lodash/has';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/keep-query-in-array.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { checkContext } from '../utils/check-context';
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import _get from 'lodash/get';
import _set from 'lodash/set';
import _has from 'lodash/has';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/lower-case.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _set from 'lodash/set';
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;

import { transformItems } from '../common';
import { checkContextIf } from './check-context-if';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/populate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _get from 'lodash/get';
import _set from 'lodash/set';
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;

import { hrtime } from 'process';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/prevent-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import _has from 'lodash/has';
import _omit from 'lodash/omit';

import { checkContext } from '../utils/check-context';
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/required.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _get from 'lodash/get';
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import _has from 'lodash/has';

import { checkContext } from '../utils/check-context';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/run-parallel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/set-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import _setWith from 'lodash/setWith';
import _clone from 'lodash/clone';
import _debug from 'debug';
import { checkContext } from '../utils/check-context';
import { Forbidden } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { Forbidden } = errors;
import type { Hook } from '@feathersjs/feathers';
import type { SetFieldOptions } from '../types';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/set-now.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';
import { setFields as _setFields } from '../common';
import { getItems } from '../utils/get-items';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/set-slug.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _set from 'lodash/set';
import { GeneralError } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { GeneralError } = errors;
import type { Hook } from '@feathersjs/feathers';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/sifter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';
import type { SyncContextFunction } from '../types';
import { checkContext } from '../utils/check-context';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/soft-delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GeneralError } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { GeneralError } = errors;
import type { SoftDeleteOptions } from '../types';
import { checkContext } from '../utils/check-context';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/stash-before.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';
import { checkContext } from '../utils/check-context';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/validate-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';
import type { AjvOrNewable, ValidateSchemaOptions } from '../types';
import { getItems } from '../utils/get-items';
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/validate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;
import type { Hook } from '@feathersjs/feathers';
import { isPromise } from '../common';
import type { ValidatorFn } from '../types';
Expand Down
3 changes: 2 additions & 1 deletion src/utils/is-not.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MethodNotAllowed } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { MethodNotAllowed } = errors;
import { isPromise } from '../common';
import type { PredicateFn } from '../types';

Expand Down
3 changes: 2 additions & 1 deletion src/utils/is-provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MethodNotAllowed } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { MethodNotAllowed } = errors;
import type { SyncContextFunction, TransportName } from '../types';

/**
Expand Down
3 changes: 2 additions & 1 deletion test/hooks/validate.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert } from 'chai';
import { validate } from '../../src';
import { BadRequest } from '@feathersjs/errors';
import errors from '@feathersjs/errors';
const { BadRequest } = errors;

let fcnSync: any;
let fcnPromise: any;
Expand Down

0 comments on commit 424e632

Please sign in to comment.