Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/adapter-commons/src/declarations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Query, Params, Paginated, Id, PaginationParams, PaginationOptions } from '@feathersjs/feathers'

import type { Query, Params, Paginated, Id, PaginationParams, PaginationOptions } from '@feathersjs/feathers'
export type FilterQueryOptions = {
filters?: FilterSettings
operators?: string[]
Expand Down
3 changes: 1 addition & 2 deletions packages/adapter-commons/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { _ } from '@feathersjs/commons'
import { Params } from '@feathersjs/feathers'

import type { Params } from '@feathersjs/feathers'
export * from './declarations.js'
export * from './service.js'
export * from './query.js'
Expand Down
5 changes: 2 additions & 3 deletions packages/adapter-commons/src/query.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { _ } from '@feathersjs/commons'
import { BadRequest } from '@feathersjs/errors'
import { Query } from '@feathersjs/feathers'
import { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations.js'

import type { Query } from '@feathersjs/feathers'
import type { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations.js'
const parse = (value: any) => (typeof value !== 'undefined' ? parseInt(value, 10) : value)

const isPlainObject = (value: any) => _.isObject(value) && value.constructor === {}.constructor
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-commons/src/service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Id, Paginated, Query } from '@feathersjs/feathers'
import {
import type { Id, Paginated, Query } from '@feathersjs/feathers'
import type {
AdapterParams,
AdapterServiceOptions,
InternalServiceMethods,
Expand Down
5 changes: 3 additions & 2 deletions packages/adapter-commons/test/fixture.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AdapterBase, AdapterParams, PaginationOptions } from '../src/index.js'
import { Id, NullableId, Paginated } from '@feathersjs/feathers'
import type { AdapterParams, PaginationOptions } from '../src/index.js'
import { AdapterBase } from '../src/index.js'
import type { Id, NullableId, Paginated } from '@feathersjs/feathers'
import { BadRequest, MethodNotAllowed } from '@feathersjs/errors'

export type Data = {
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication-client/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NotAuthenticated, FeathersError } from '@feathersjs/errors'
import { Application, Params } from '@feathersjs/feathers'
import { AuthenticationRequest, AuthenticationResult } from '@feathersjs/authentication'
import type { Application, Params } from '@feathersjs/feathers'
import type { AuthenticationRequest, AuthenticationResult } from '@feathersjs/authentication'
import { Storage, StorageWrapper } from './storage.js'

class OauthError extends FeathersError {
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-client/src/hooks/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HookContext, NextFunction } from '@feathersjs/feathers'
import type { HookContext, NextFunction } from '@feathersjs/feathers'
import { stripSlashes } from '@feathersjs/commons'

export const authentication = () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/authentication-client/src/hooks/populate-header.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { HookContext, NextFunction } from '@feathersjs/feathers'

import type { HookContext, NextFunction } from '@feathersjs/feathers'
export const populateHeader = () => {
return (context: HookContext, next: NextFunction) => {
const {
Expand Down
5 changes: 3 additions & 2 deletions packages/authentication-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AuthenticationClient, AuthenticationClientOptions } from './core.js'
import type { AuthenticationClientOptions } from './core.js'
import { AuthenticationClient } from './core.js'
import * as hooks from './hooks/index.js'
import { Application } from '@feathersjs/feathers'
import type { Application } from '@feathersjs/feathers'
import { Storage, MemoryStorage, StorageWrapper } from './storage.js'

declare module '@feathersjs/feathers' {
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication-client/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert'
import { feathers, Application } from '@feathersjs/feathers'

import type { Application } from '@feathersjs/feathers'
import { feathers } from '@feathersjs/feathers'
import client from '../src/index.js'
import { AuthenticationClient } from '../src/index.js'
import { NotAuthenticated } from '@feathersjs/errors'
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-client/test/integration/commons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert'
import { Application } from '@feathersjs/feathers'
import type { Application } from '@feathersjs/feathers'
import '../../src/index.js'

export default (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from 'axios'
import { Server } from 'http'
import { feathers, Application as FeathersApplication } from '@feathersjs/feathers'
import type { Application as FeathersApplication } from '@feathersjs/feathers'
import { feathers } from '@feathersjs/feathers'
import * as express from '@feathersjs/express'
import rest from '@feathersjs/rest-client'

Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-client/test/integration/fixture.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authenticate } from '@feathersjs/authentication'
import { HookContext, Application } from '@feathersjs/feathers'
import type { HookContext, Application } from '@feathersjs/feathers'
import { memory } from '@feathersjs/memory'
import { AuthenticationService, JWTStrategy } from '@feathersjs/authentication'
import { LocalStrategy, hooks } from '@feathersjs/authentication-local'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { io } from 'socket.io-client'
import assert from 'assert'
import { feathers, Application } from '@feathersjs/feathers'
import type { Application } from '@feathersjs/feathers'
import { feathers } from '@feathersjs/feathers'
import socketio from '@feathersjs/socketio'
import socketioClient from '@feathersjs/socketio-client'

import authClient from '../../src/index.js'
import getApp from './fixture.js'
import commonTests from './commons.js'
import { AuthenticationResult } from '@feathersjs/authentication'

import type { AuthenticationResult } from '@feathersjs/authentication'
describe('@feathersjs/authentication-client Socket.io integration', () => {
let app: Application

Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-local/src/hooks/hash-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { get, set } from 'lodash-es'
import { cloneDeep } from 'lodash-es'
import { BadRequest } from '@feathersjs/errors'
import { createDebug } from '@feathersjs/commons'
import { HookContext, NextFunction } from '@feathersjs/feathers'
import type { HookContext, NextFunction } from '@feathersjs/feathers'
import { LocalStrategy } from '../strategy.js'

const debug = createDebug('@feathersjs/authentication-local/hooks/hash-password')
Expand Down
3 changes: 1 addition & 2 deletions packages/authentication-local/src/hooks/protect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { omit } from 'lodash-es'
import { HookContext, NextFunction } from '@feathersjs/feathers'

import type { HookContext, NextFunction } from '@feathersjs/feathers'
/**
* @deprecated For reliable safe data representations use Feathers schema dispatch resolvers.
* @see https://dove.feathersjs.comapi/authentication/local.html#protecting-fields
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-local/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HookContext } from '@feathersjs/feathers'
import type { HookContext } from '@feathersjs/feathers'
import hashPassword from './hooks/hash-password.js'
import protect from './hooks/protect.js'
import { LocalStrategy } from './strategy.js'
Expand Down
5 changes: 3 additions & 2 deletions packages/authentication-local/src/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import bcrypt from 'bcryptjs'
import { get } from 'lodash-es'
import { NotAuthenticated } from '@feathersjs/errors'
import { Query, Params } from '@feathersjs/feathers'
import { AuthenticationRequest, AuthenticationBaseStrategy } from '@feathersjs/authentication'
import type { Query, Params } from '@feathersjs/feathers'
import type { AuthenticationRequest } from '@feathersjs/authentication'
import { AuthenticationBaseStrategy } from '@feathersjs/authentication'
import { createDebug } from '@feathersjs/commons'

const debug = createDebug('@feathersjs/authentication-local/strategy')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import assert from 'assert'
import { Application } from '@feathersjs/feathers'

import type { Application } from '@feathersjs/feathers'
import { hooks } from '../../src/index.js'
import { createApplication, ServiceTypes } from '../fixture.js'
import { createApplication, type ServiceTypes } from '../fixture.js'

const { hashPassword } = hooks

Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-local/test/hooks/protect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert'
import { HookContext } from '@feathersjs/feathers'
import type { HookContext } from '@feathersjs/feathers'
import { hooks } from '../../src/index.js'

const { protect } = hooks
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication-local/test/strategy.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from 'assert'
import { omit } from 'lodash-es'
import { Application, HookContext } from '@feathersjs/feathers'
import type { Application, HookContext } from '@feathersjs/feathers'
import { resolve } from '@feathersjs/schema'

import { LocalStrategy, passwordHash } from '../src/index.js'
import { createApplication, ServiceTypes } from './fixture.js'
import { createApplication, type ServiceTypes } from './fixture.js'

describe('@feathersjs/authentication-local/strategy', () => {
const password = 'localsecret'
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-oauth/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Application } from '@feathersjs/feathers'
import type { Application } from '@feathersjs/feathers'
import { createDebug } from '@feathersjs/commons'
import { resolveDispatch } from '@feathersjs/schema'

Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-oauth/src/service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createDebug } from '@feathersjs/commons'
import { HookContext, NextFunction, Params } from '@feathersjs/feathers'
import type { HookContext, NextFunction, Params } from '@feathersjs/feathers'
import { FeathersError, GeneralError } from '@feathersjs/errors'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
Expand Down
6 changes: 3 additions & 3 deletions packages/authentication-oauth/src/strategy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
import type {
AuthenticationRequest,
AuthenticationBaseStrategy,
AuthenticationResult,
AuthenticationParams
} from '@feathersjs/authentication'
import { Params } from '@feathersjs/feathers'
import { AuthenticationBaseStrategy } from '@feathersjs/authentication'
import type { Params } from '@feathersjs/feathers'
import { NotAuthenticated } from '@feathersjs/errors'
import { createDebug, _ } from '@feathersjs/commons'
import qs from 'qs'
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-oauth/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strict as assert } from 'assert'
import { feathers } from '@feathersjs/feathers'
import { oauth, OauthSetupSettings } from '../src/index.js'
import { oauth, type OauthSetupSettings } from '../src/index.js'
import { AuthenticationService } from '@feathersjs/authentication'

describe('@feathersjs/authentication-oauth', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-oauth/test/service.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strict as assert } from 'assert'
import axios, { AxiosResponse } from 'axios'
import axios, { type AxiosResponse } from 'axios'
import { CookieJar } from 'tough-cookie'
import { expressFixture } from './utils/fixture.js'

Expand Down
11 changes: 4 additions & 7 deletions packages/authentication-oauth/test/utils/fixture.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Application, feathers, NextFunction } from '@feathersjs/feathers'
import type { Application, NextFunction } from '@feathersjs/feathers'
import { feathers } from '@feathersjs/feathers'
import express, { rest, errorHandler } from '@feathersjs/express'
import { memory, MemoryService } from '@feathersjs/memory'
import {
AuthenticationService,
JWTStrategy,
AuthenticationRequest,
AuthenticationParams
} from '@feathersjs/authentication'
import type { AuthenticationRequest, AuthenticationParams } from '@feathersjs/authentication'
import { AuthenticationService, JWTStrategy } from '@feathersjs/authentication'
import { provider } from './provider.js'
import { oauth, OAuthStrategy } from '../../src/index.js'

Expand Down
6 changes: 3 additions & 3 deletions packages/authentication/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import jsonwebtoken, { SignOptions, Secret, VerifyOptions, Algorithm } from 'jso
import { v4 as uuidv4 } from 'uuid'
import { NotAuthenticated } from '@feathersjs/errors'
import { createDebug } from '@feathersjs/commons'
import { Application, Params } from '@feathersjs/feathers'
import type { Application, Params } from '@feathersjs/feathers'
import { IncomingMessage, ServerResponse } from 'http'
import { AuthenticationConfiguration, defaultOptions } from './options.js'

import type { AuthenticationConfiguration } from './options.js'
import { defaultOptions } from './options.js'
const debug = createDebug('@feathersjs/authentication/base')

export interface AuthenticationResult {
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/src/hooks/authenticate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HookContext, NextFunction } from '@feathersjs/feathers'
import type { HookContext, NextFunction } from '@feathersjs/feathers'
import { NotAuthenticated } from '@feathersjs/errors'
import { createDebug } from '@feathersjs/commons'

Expand Down
6 changes: 3 additions & 3 deletions packages/authentication/src/hooks/connection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HookContext, NextFunction } from '@feathersjs/feathers'
import { AuthenticationBase, ConnectionEvent } from '../core.js'

import type { HookContext, NextFunction } from '@feathersjs/feathers'
import type { ConnectionEvent } from '../core.js'
import { AuthenticationBase } from '../core.js'
export default (event: ConnectionEvent) => async (context: HookContext, next: NextFunction) => {
await next()

Expand Down
5 changes: 2 additions & 3 deletions packages/authentication/src/hooks/event.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { HookContext, NextFunction } from '@feathersjs/feathers'
import type { HookContext, NextFunction } from '@feathersjs/feathers'
import { createDebug } from '@feathersjs/commons'
import { ConnectionEvent } from '../core.js'

import type { ConnectionEvent } from '../core.js'
const debug = createDebug('@feathersjs/authentication/hooks/connection')

export default (event: ConnectionEvent) => async (context: HookContext, next: NextFunction) => {
Expand Down
10 changes: 7 additions & 3 deletions packages/authentication/src/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/ban-ts-comment */
import { IncomingMessage } from 'http'
import { NotAuthenticated } from '@feathersjs/errors'
import { Params } from '@feathersjs/feathers'
import type { Params } from '@feathersjs/feathers'
import { createDebug } from '@feathersjs/commons'
// @ts-ignore
import lt from 'long-timeout'

import { AuthenticationBaseStrategy } from './strategy.js'
import { AuthenticationParams, AuthenticationRequest, AuthenticationResult, ConnectionEvent } from './core.js'

import type {
AuthenticationParams,
AuthenticationRequest,
AuthenticationResult,
ConnectionEvent
} from './core.js'
const debug = createDebug('@feathersjs/authentication/jwt')
const SPLIT_HEADER = /(\S+)\s+(\S+)/

Expand Down
4 changes: 2 additions & 2 deletions packages/authentication/src/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FromSchema, authenticationSettingsSchema } from '@feathersjs/schema'

import type { FromSchema } from '@feathersjs/schema'
import { authenticationSettingsSchema } from '@feathersjs/schema'
export const defaultOptions = {
authStrategies: [] as string[],
jwtOptions: {
Expand Down
14 changes: 5 additions & 9 deletions packages/authentication/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ import { merge } from 'lodash-es'
import { NotAuthenticated } from '@feathersjs/errors'
import '@feathersjs/transport-commons'
import { createDebug } from '@feathersjs/commons'
import { ServiceMethods } from '@feathersjs/feathers'
import type { ServiceMethods } from '@feathersjs/feathers'
import { resolveDispatch } from '@feathersjs/schema'
import jsonwebtoken from 'jsonwebtoken'
import { hooks } from '@feathersjs/hooks'

import {
AuthenticationBase,
AuthenticationResult,
AuthenticationRequest,
AuthenticationParams
} from './core.js'
import { connection, event } from './hooks/index.js'
import { RealTimeConnection } from '@feathersjs/feathers'
import type { AuthenticationResult, AuthenticationRequest, AuthenticationParams } from './core.js'

import { AuthenticationBase } from './core.js'
import { connection, event } from './hooks/index.js'
import type { RealTimeConnection } from '@feathersjs/feathers'
const debug = createDebug('@feathersjs/authentication/service')

declare module '@feathersjs/feathers' {
Expand Down
6 changes: 3 additions & 3 deletions packages/authentication/src/strategy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AuthenticationStrategy, AuthenticationBase } from './core.js'
import { Application, Service } from '@feathersjs/feathers'

import type { AuthenticationStrategy } from './core.js'
import { AuthenticationBase } from './core.js'
import type { Application, Service } from '@feathersjs/feathers'
export class AuthenticationBaseStrategy implements AuthenticationStrategy {
authentication?: AuthenticationBase
app?: Application
Expand Down
11 changes: 7 additions & 4 deletions packages/authentication/test/core.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import assert from 'assert'
import { feathers, Application } from '@feathersjs/feathers'
import type { Application } from '@feathersjs/feathers'
import { feathers } from '@feathersjs/feathers'
import jwt from 'jsonwebtoken'
import { Infer, schema } from '@feathersjs/schema'
import type { Infer } from '@feathersjs/schema'
import { schema } from '@feathersjs/schema'
import type { AuthenticationRequest } from '../src/core.js'

import { AuthenticationBase, AuthenticationRequest } from '../src/core.js'
import { AuthenticationBase } from '../src/core.js'
import { authenticationSettingsSchema } from '../src/options.js'
import { Strategy1, Strategy2, MockRequest } from './fixtures.js'
import { Strategy1, Strategy2, type MockRequest } from './fixtures.js'
import { ServerResponse } from 'http'

const UUID = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
Expand Down
5 changes: 2 additions & 3 deletions packages/authentication/test/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NotAuthenticated } from '@feathersjs/errors'
import { Params } from '@feathersjs/feathers'

import { AuthenticationRequest } from '../src/core.js'
import type { Params } from '@feathersjs/feathers'
import type { AuthenticationRequest } from '../src/core.js'
import { IncomingMessage } from 'http'
import { AuthenticationBaseStrategy } from '../src/strategy.js'

Expand Down
4 changes: 2 additions & 2 deletions packages/authentication/test/hooks/authenticate.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import assert from 'assert'
import { feathers, Application, Params, ServiceMethods } from '@feathersjs/feathers'

import type { Application, Params, ServiceMethods } from '@feathersjs/feathers'
import { feathers } from '@feathersjs/feathers'
import { Strategy1, Strategy2 } from '../fixtures.js'
import { AuthenticationService, hooks } from '../../src/index.js'

Expand Down
Loading