Add definitions for 16 packages of the @feathersjs scope (#22805)

* add various packages in @feathersjs scope

* formatting, make feathers package pass linting.

* add typings for feathersjs core packages:

@feathersjs/authentication
@feathersjs/authentication-client
@feathersjs/authentication-jwt
@feathersjs/authentication-local
@feathersjs/authentication-oauth1
@feathersjs/authentication-oauth2
@feathersjs/configuration
@feathersjs/errors
@feathersjs/express
@feathersjs/feathers
@feathersjs/primus
@feathersjs/primus-client
@feathersjs/rest-client
@feathersjs/socket-commons
@feathersjs/socketio
@feathersjs/socketio-client

* remove unnecessary package.json files

* fix TS versions

* add some tests, fix errors module, add doc comments, minor todos left
This commit is contained in:
Jan Lohage
2018-01-17 11:16:10 -08:00
committed by Wesley Wigham
parent 426d98a191
commit ea29e9588e
69 changed files with 1418 additions and 0 deletions
@@ -0,0 +1,4 @@
import feathersAuthClient from '@feathersjs/authentication-client';
// we can't really do much, because the augmentation of @feathersjs/feathers breaks importing it here.
const configureFn = feathersAuthClient({});
@@ -0,0 +1,14 @@
declare module '@feathersjs/feathers' {
import {
FeathersAuthCredentials,
Passport
} from '@feathersjs/authentication-client';
interface Application<ServiceTypes> {
authenticate(options?: FeathersAuthCredentials): Promise<any>;
logout(): Promise<void>;
passport: Passport;
}
}
+64
View File
@@ -0,0 +1,64 @@
// Type definitions for @feathersjs/authentication-client 1.0
// Project: http://feathersjs.com/
// Definitions by: Abraao Alves <https://github.com/AbraaoAlves>, Jan Lohage <https://github.com/j2L4e>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
import './feathersjs__feathers';
export default function feathersAuthClient(config?: FeathersAuthClientConfig): () => void;
export interface FeathersAuthClientConfig {
storage?: Storage;
header?: string;
cookie?: string;
storageKey?: string;
jwtStrategy?: string;
path?: string;
entity?: string;
service?: string;
}
export interface FeathersAuthCredentials {
strategy: string;
[index: string]: any;
}
export const defaults: {
header: string;
cookie: string;
storageKey: string;
jwtStrategy: string;
path: string;
entity: string;
service: string;
timeout: number;
};
export interface Passport {
setupSocketListeners(): void;
connected(): Promise<any>;
authenticate(credentials?: FeathersAuthCredentials): any;
authenticateSocket(credentials: FeathersAuthCredentials, socket: any, emit: any): any;
logoutSocket(socket: any, emit: any): Promise<any>;
logout(): Promise<any>;
setJWT(data: any): Promise<any>;
getJWT(): Promise<any>;
verifyJWT(token: string): Promise<string>;
payloadIsValid(payload: string): boolean;
getCookie(name: string): string;
clearCookie(name: string): null;
getStorage(storage: any): any;
}
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@feathersjs/authentication-client": ["feathersjs__authentication-client"],
"@feathersjs/feathers": ["feathersjs__feathers"]
}
},
"files": [
"index.d.ts", "feathersjs__authentication-client-tests.ts"
]
}
@@ -0,0 +1,4 @@
{
"extends": "dtslint/dt.json",
"strict-export-declare-modifiers": false
}