@feathersjs/feathers
Advanced tools
Comparing version 4.0.0-pre.1 to 4.0.0-pre.2
@@ -6,2 +6,15 @@ # Change Log | ||
# [4.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.1...v4.0.0-pre.2) (2019-05-15) | ||
### Bug Fixes | ||
* **typescript:** finally should be optional ([#1350](https://github.com/feathersjs/feathers/issues/1350)) ([f439a9e](https://github.com/feathersjs/feathers/commit/f439a9e)) | ||
* Fix versioning tests. Closes [#1346](https://github.com/feathersjs/feathers/issues/1346) ([dd519f6](https://github.com/feathersjs/feathers/commit/dd519f6)) | ||
* Use `export =` in TypeScript definitions ([#1285](https://github.com/feathersjs/feathers/issues/1285)) ([12d0f4b](https://github.com/feathersjs/feathers/commit/12d0f4b)) | ||
# [4.0.0-pre.1](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.0...v4.0.0-pre.1) (2019-05-08) | ||
@@ -8,0 +21,0 @@ |
331
index.d.ts
@@ -1,10 +0,1 @@ | ||
// Type definitions for @feathersjs/feathers 3.1 | ||
// Project: http://feathersjs.com/ | ||
// Definitions by: Jan Lohage <https://github.com/j2L4e> | ||
// Abraao Alves <https://github.com/AbraaoAlves> | ||
// Tim Mensch <https://github.com/TimMensch> | ||
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript | ||
// TypeScript Version: 2.3 | ||
/// <reference types='node' /> | ||
@@ -14,200 +5,210 @@ | ||
// tslint:disable-next-line no-unnecessary-generics | ||
declare const feathers: (<T = any>() => Application<T>); | ||
export default feathers; | ||
declare const createApplication: Feathers; | ||
export = createApplication; | ||
export const version: string; | ||
interface Feathers { | ||
<T = any>(): createApplication.Application<T>; | ||
readonly ACTIVATE_HOOKS: unique symbol; | ||
version: string; | ||
default: Feathers; | ||
// TODO: Write a definition for activateHooks. | ||
// activateHooks(): void | ||
} | ||
export type Id = number | string; | ||
export type NullableId = Id | null; | ||
declare namespace createApplication { | ||
type Id = number | string; | ||
type NullableId = Id | null; | ||
export interface Query { | ||
[key: string]: any; | ||
} | ||
interface Query { | ||
[key: string]: any; | ||
} | ||
export interface PaginationOptions { | ||
default: number; | ||
max: number; | ||
} | ||
interface PaginationOptions { | ||
default: number; | ||
max: number; | ||
} | ||
export type ClientSideParams = Pick<Params, 'query' | 'paginate'>; | ||
export type ServerSideParams = Params; | ||
type ClientSideParams = Pick<Params, 'query' | 'paginate'>; | ||
type ServerSideParams = Params; | ||
export interface Params { | ||
query?: Query; | ||
paginate?: false | Pick<PaginationOptions, 'max'>; | ||
interface Params { | ||
query?: Query; | ||
paginate?: false | Pick<PaginationOptions, 'max'>; | ||
[key: string]: any; // (JL) not sure if we want this | ||
} | ||
[key: string]: any; // (JL) not sure if we want this | ||
} | ||
export interface Paginated<T> { | ||
total: number; | ||
limit: number; | ||
skip: number; | ||
data: T[]; | ||
} | ||
interface Paginated<T> { | ||
total: number; | ||
limit: number; | ||
skip: number; | ||
data: T[]; | ||
} | ||
// tslint:disable-next-line void-return | ||
export type Hook = (hook: HookContext) => (Promise<HookContext | void> | HookContext | void); | ||
// tslint:disable-next-line void-return | ||
type Hook = (hook: HookContext) => (Promise<HookContext | void> | HookContext | void); | ||
export interface HookContext<T = any> { | ||
/** | ||
* A read only property that contains the Feathers application object. This can be used to | ||
* retrieve other services (via context.app.service('name')) or configuration values. | ||
*/ | ||
readonly app: Application; | ||
/** | ||
* A writeable property containing the data of a create, update and patch service | ||
* method call. | ||
*/ | ||
data?: T; | ||
/** | ||
* A writeable property with the error object that was thrown in a failed method call. | ||
* It is only available in error hooks. | ||
*/ | ||
error?: any; | ||
/** | ||
* A writeable property and the id for a get, remove, update and patch service | ||
* method call. For remove, update and patch context.id can also be null when | ||
* modifying multiple entries. In all other cases it will be undefined. | ||
*/ | ||
id?: string | number; | ||
/** | ||
* A read only property with the name of the service method (one of find, get, | ||
* create, update, patch, remove). | ||
*/ | ||
readonly method: string; | ||
/** | ||
* A writeable property that contains the service method parameters (including | ||
* params.query). | ||
*/ | ||
params: Params; | ||
/** | ||
* A read only property and contains the service name (or path) without leading or | ||
* trailing slashes. | ||
*/ | ||
readonly path: string; | ||
/** | ||
* A writeable property containing the result of the successful service method call. | ||
* It is only available in after hooks. | ||
* | ||
* `context.result` can also be set in | ||
* | ||
* - A before hook to skip the actual service method (database) call | ||
* - An error hook to swallow the error and return a result instead | ||
*/ | ||
result?: T; | ||
/** | ||
* A read only property and contains the service this hook currently runs on. | ||
*/ | ||
readonly service: Service<T>; | ||
/** | ||
* A writeable, optional property and contains a 'safe' version of the data that | ||
* should be sent to any client. If context.dispatch has not been set context.result | ||
* will be sent to the client instead. | ||
*/ | ||
dispatch?: T; | ||
/** | ||
* A writeable, optional property that allows to override the standard HTTP status | ||
* code that should be returned. | ||
*/ | ||
statusCode?: number; | ||
/** | ||
* A read only property with the hook type (one of before, after or error). | ||
*/ | ||
readonly type: 'before' | 'after' | 'error'; | ||
/** | ||
* The real-time connection object | ||
*/ | ||
connection?: any; | ||
} | ||
interface HookContext<T = any> { | ||
/** | ||
* A read only property that contains the Feathers application object. This can be used to | ||
* retrieve other services (via context.app.service('name')) or configuration values. | ||
*/ | ||
readonly app: Application; | ||
/** | ||
* A writeable property containing the data of a create, update and patch service | ||
* method call. | ||
*/ | ||
data?: T; | ||
/** | ||
* A writeable property with the error object that was thrown in a failed method call. | ||
* It is only available in error hooks. | ||
*/ | ||
error?: any; | ||
/** | ||
* A writeable property and the id for a get, remove, update and patch service | ||
* method call. For remove, update and patch context.id can also be null when | ||
* modifying multiple entries. In all other cases it will be undefined. | ||
*/ | ||
id?: string | number; | ||
/** | ||
* A read only property with the name of the service method (one of find, get, | ||
* create, update, patch, remove). | ||
*/ | ||
readonly method: string; | ||
/** | ||
* A writeable property that contains the service method parameters (including | ||
* params.query). | ||
*/ | ||
params: Params; | ||
/** | ||
* A read only property and contains the service name (or path) without leading or | ||
* trailing slashes. | ||
*/ | ||
readonly path: string; | ||
/** | ||
* A writeable property containing the result of the successful service method call. | ||
* It is only available in after hooks. | ||
* | ||
* `context.result` can also be set in | ||
* | ||
* - A before hook to skip the actual service method (database) call | ||
* - An error hook to swallow the error and return a result instead | ||
*/ | ||
result?: T; | ||
/** | ||
* A read only property and contains the service this hook currently runs on. | ||
*/ | ||
readonly service: Service<T>; | ||
/** | ||
* A writeable, optional property and contains a 'safe' version of the data that | ||
* should be sent to any client. If context.dispatch has not been set context.result | ||
* will be sent to the client instead. | ||
*/ | ||
dispatch?: T; | ||
/** | ||
* A writeable, optional property that allows to override the standard HTTP status | ||
* code that should be returned. | ||
*/ | ||
statusCode?: number; | ||
/** | ||
* A read only property with the hook type (one of before, after or error). | ||
*/ | ||
readonly type: 'before' | 'after' | 'error'; | ||
/** | ||
* The real-time connection object | ||
*/ | ||
connection?: any; | ||
} | ||
export interface HookMap { | ||
all: Hook | Hook[]; | ||
find: Hook | Hook[]; | ||
get: Hook | Hook[]; | ||
create: Hook | Hook[]; | ||
update: Hook | Hook[]; | ||
patch: Hook | Hook[]; | ||
remove: Hook | Hook[]; | ||
} | ||
interface HookMap { | ||
all: Hook | Hook[]; | ||
find: Hook | Hook[]; | ||
get: Hook | Hook[]; | ||
create: Hook | Hook[]; | ||
update: Hook | Hook[]; | ||
patch: Hook | Hook[]; | ||
remove: Hook | Hook[]; | ||
} | ||
export interface HooksObject { | ||
before: Partial<HookMap> | Hook | Hook[]; | ||
after: Partial<HookMap> | Hook | Hook[]; | ||
error: Partial<HookMap> | Hook | Hook[]; | ||
finally: Partial<HookMap> | Hook | Hook[]; | ||
} | ||
interface HooksObject { | ||
before: Partial<HookMap> | Hook | Hook[]; | ||
after: Partial<HookMap> | Hook | Hook[]; | ||
error: Partial<HookMap> | Hook | Hook[]; | ||
finally?: Partial<HookMap> | Hook | Hook[]; | ||
} | ||
// todo: figure out what to do: These methods don't actually need to be implemented, so they can be undefined at runtime. Yet making them optional gets cumbersome in strict mode. | ||
export interface ServiceMethods<T> { | ||
[key: string]: any; | ||
// todo: figure out what to do: These methods don't actually need to be | ||
// implemented, so they can be undefined at runtime. Yet making them | ||
// optional gets cumbersome in strict mode. | ||
interface ServiceMethods<T> { | ||
[key: string]: any; | ||
find? (params?: Params): Promise<T | T[] | Paginated<T>>; | ||
find? (params?: Params): Promise<T | T[] | Paginated<T>>; | ||
get? (id: Id, params?: Params): Promise<T>; | ||
get? (id: Id, params?: Params): Promise<T>; | ||
create? (data: Partial<T> | Array<Partial<T>>, params?: Params): Promise<T | T[]>; | ||
create? (data: Partial<T> | Array<Partial<T>>, params?: Params): Promise<T | T[]>; | ||
update? (id: NullableId, data: T, params?: Params): Promise<T>; | ||
update? (id: NullableId, data: T, params?: Params): Promise<T>; | ||
patch? (id: NullableId, data: Partial<T>, params?: Params): Promise<T>; | ||
patch? (id: NullableId, data: Partial<T>, params?: Params): Promise<T>; | ||
remove? (id: NullableId, params?: Params): Promise<T>; | ||
} | ||
remove? (id: NullableId, params?: Params): Promise<T>; | ||
} | ||
export interface SetupMethod { | ||
setup (app: Application, path: string): void; | ||
} | ||
interface SetupMethod { | ||
setup (app: Application, path: string): void; | ||
} | ||
export interface ServiceOverloads<T> { | ||
create? (data: Array<Partial<T>>, params?: Params): Promise<T[]>; | ||
interface ServiceOverloads<T> { | ||
create? (data: Array<Partial<T>>, params?: Params): Promise<T[]>; | ||
create? (data: Partial<T>, params?: Params): Promise<T>; | ||
create? (data: Partial<T>, params?: Params): Promise<T>; | ||
patch? (id: NullableId, data: Pick<T, keyof T>, params?: Params): Promise<T>; | ||
} | ||
patch? (id: NullableId, data: Pick<T, keyof T>, params?: Params): Promise<T>; | ||
} | ||
export interface ServiceAddons<T> extends EventEmitter { | ||
id?: any; | ||
_serviceEvents: string[]; | ||
hooks (hooks: Partial<HooksObject>): this; | ||
} | ||
interface ServiceAddons<T> extends EventEmitter { | ||
id?: any; | ||
_serviceEvents: string[]; | ||
hooks (hooks: Partial<HooksObject>): this; | ||
} | ||
export type Service<T> = ServiceOverloads<T> & ServiceAddons<T> & ServiceMethods<T>; | ||
type Service<T> = ServiceOverloads<T> & ServiceAddons<T> & ServiceMethods<T>; | ||
export type ServiceMixin = (service: Service<any>, path: string) => void; | ||
type ServiceMixin = (service: Service<any>, path: string) => void; | ||
export interface Application<ServiceTypes = any> extends EventEmitter { | ||
version: string; | ||
interface Application<ServiceTypes = any> extends EventEmitter { | ||
version: string; | ||
services: ServiceTypes; | ||
services: ServiceTypes; | ||
mixins: ServiceMixin[]; | ||
mixins: ServiceMixin[]; | ||
methods: string[]; | ||
methods: string[]; | ||
get (name: string): any; | ||
get (name: string): any; | ||
set (name: string, value: any): this; | ||
set (name: string, value: any): this; | ||
disable (name: string): this; | ||
disable (name: string): this; | ||
disabled (name: string): boolean; | ||
disabled (name: string): boolean; | ||
enable (name: string): this; | ||
enable (name: string): this; | ||
enabled (name: string): boolean; | ||
enabled (name: string): boolean; | ||
configure (callback: (this: this, app: this) => void): this; | ||
configure (callback: (this: this, app: this) => void): this; | ||
hooks (hooks: Partial<HooksObject>): this; | ||
hooks (hooks: Partial<HooksObject>): this; | ||
setup (server?: any): this; | ||
setup (server?: any): this; | ||
service<L extends keyof ServiceTypes> (location: L): ServiceTypes[L]; | ||
service<L extends keyof ServiceTypes> (location: L): ServiceTypes[L]; | ||
service (location: string): Service<any>; | ||
service (location: string): Service<any>; | ||
use (path: string, service: Partial<ServiceMethods<any> & SetupMethod> | Application, options?: any): this; | ||
use (path: string, service: Partial<ServiceMethods<any> & SetupMethod> | Application, options?: any): this; | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
module.exports = '4.0.0-pre.1'; | ||
module.exports = '4.0.0-pre.2'; |
{ | ||
"name": "@feathersjs/feathers", | ||
"description": "A REST and realtime API layer for modern applications.", | ||
"version": "4.0.0-pre.1", | ||
"version": "4.0.0-pre.2", | ||
"homepage": "http://feathersjs.com", | ||
@@ -50,3 +50,3 @@ "repository": { | ||
}, | ||
"gitHead": "e8ce9116c6a4433b64ffe400585b60a9c31ba644" | ||
"gitHead": "d665b9470435d6db0ecddd1fb152ab4a87266c52" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74765
566