@feathersjs/feathers

  • Version 4.5.11
  • Published
  • 86.7 kB
  • 4 dependencies
  • MIT license

Install

npm i @feathersjs/feathers
yarn add @feathersjs/feathers
pnpm add @feathersjs/feathers

Overview

A framework for real-time applications and REST API with JavaScript and TypeScript

Index

Variables

variable createApplication

const createApplication: Feathers;

    Interfaces

    interface Application

    interface Application<ServiceTypes = {}> extends EventEmitter {}

      property methods

      methods: string[];

        property mixins

        mixins: ServiceMixin[];

          property services

          services: keyof ServiceTypes extends never ? any : ServiceTypes;

            property version

            version: string;

              method configure

              configure: (callback: (this: this, app: this) => void) => this;

                method disable

                disable: (name: string) => this;

                  method disabled

                  disabled: (name: string) => boolean;

                    method enable

                    enable: (name: string) => this;

                      method enabled

                      enabled: (name: string) => boolean;

                        method get

                        get: (name: string) => any;

                          method hooks

                          hooks: (hooks: Partial<HooksObject>) => this;

                            method listen

                            listen: (port: number) => any;

                              method service

                              service: {
                              <L extends keyof ServiceTypes>(location: L): ServiceTypes[L];
                              (location: string): keyof ServiceTypes extends never ? any : never;
                              };

                                method set

                                set: (name: string, value: any) => this;

                                  method setup

                                  setup: (server?: any) => this;

                                    method use

                                    use: (
                                    path: string,
                                    service: Partial<ServiceMethods<any> & SetupMethod> | Application,
                                    options?: any
                                    ) => this;

                                      interface HookContext

                                      interface HookContext<T = any, S = Service<T>> {}

                                        property app

                                        readonly app: Application;
                                        • 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.

                                        property data

                                        data?: T;
                                        • A writeable property containing the data of a create, update and patch service method call.

                                        property dispatch

                                        dispatch?: 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.

                                        property error

                                        error?: any;
                                        • A writeable property with the error object that was thrown in a failed method call. It is only available in error hooks.

                                        property event

                                        event?: null;
                                        • A writeable, optional property that allows service events to be skipped by setting it to null

                                        property id

                                        id?: string | number;
                                        • 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.

                                        property method

                                        readonly method: 'find' | 'get' | 'create' | 'update' | 'patch' | 'remove';
                                        • A read only property with the name of the service method (one of find, get, create, update, patch, remove).

                                        property params

                                        params: Params;
                                        • A writeable property that contains the service method parameters (including params.query).

                                        property path

                                        readonly path: string;
                                        • A read only property and contains the service name (or path) without leading or trailing slashes.

                                        property result

                                        result?: T;
                                        • 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

                                        property service

                                        readonly service: S;
                                        • A read only property and contains the service this hook currently runs on.

                                        property statusCode

                                        statusCode?: number;
                                        • A writeable, optional property that allows to override the standard HTTP status code that should be returned.

                                        property type

                                        readonly type: 'before' | 'after' | 'error';
                                        • A read only property with the hook type (one of before, after or error).

                                        interface HookMap

                                        interface HookMap<T = any> {}

                                          property all

                                          all: Hook<T> | Hook<T>[];

                                            property create

                                            create: Hook<T> | Hook<T>[];

                                              property find

                                              find: Hook<T> | Hook<T>[];

                                                property get

                                                get: Hook<T> | Hook<T>[];

                                                  property patch

                                                  patch: Hook<T> | Hook<T>[];

                                                    property remove

                                                    remove: Hook<T> | Hook<T>[];

                                                      property update

                                                      update: Hook<T> | Hook<T>[];

                                                        interface HooksObject

                                                        interface HooksObject<T = any> {}

                                                          property after

                                                          after: Partial<HookMap<T>> | Hook<T> | Hook<T>[];

                                                            property before

                                                            before: Partial<HookMap<T>> | Hook<T> | Hook<T>[];

                                                              property error

                                                              error: Partial<HookMap<T>> | Hook<T> | Hook<T>[];

                                                                property finally

                                                                finally?: Partial<HookMap<T>> | Hook<T> | Hook<T>[];

                                                                  interface Paginated

                                                                  interface Paginated<T> {}

                                                                    property data

                                                                    data: T[];

                                                                      property limit

                                                                      limit: number;

                                                                        property skip

                                                                        skip: number;

                                                                          property total

                                                                          total: number;

                                                                            interface PaginationOptions

                                                                            interface PaginationOptions {}

                                                                              property default

                                                                              default: number;

                                                                                property max

                                                                                max: number;

                                                                                  interface Params

                                                                                  interface Params {}

                                                                                  property headers

                                                                                  headers?: { [key: string]: any };

                                                                                    property paginate

                                                                                    paginate?: false | Pick<PaginationOptions, 'max'>;

                                                                                      property provider

                                                                                      provider?: string;

                                                                                        property query

                                                                                        query?: Query;

                                                                                          property route

                                                                                          route?: { [key: string]: string };

                                                                                            property user

                                                                                            user?: { [key: string]: any };

                                                                                              index signature

                                                                                              [key: string]: any;

                                                                                                interface Query

                                                                                                interface Query {}

                                                                                                  index signature

                                                                                                  [key: string]: any;

                                                                                                    interface ServiceAddons

                                                                                                    interface ServiceAddons<T> extends EventEmitter {}

                                                                                                      property id

                                                                                                      id?: any;

                                                                                                        property methods

                                                                                                        methods: { [method: string]: string[] };

                                                                                                          method hooks

                                                                                                          hooks: (hooks: Partial<HooksObject>) => this;

                                                                                                            interface ServiceMethods

                                                                                                            interface ServiceMethods<T> {}

                                                                                                              method create

                                                                                                              create: (data: Partial<T> | Partial<T>[], params?: Params) => Promise<T | T[]>;

                                                                                                              method find

                                                                                                              find: (params?: Params) => Promise<T | T[] | Paginated<T>>;

                                                                                                              method get

                                                                                                              get: (id: Id, params?: Params) => Promise<T>;

                                                                                                              method patch

                                                                                                              patch: (id: NullableId, data: Partial<T>, params?: Params) => Promise<T | T[]>;

                                                                                                              method remove

                                                                                                              remove: (id: NullableId, params?: Params) => Promise<T | T[]>;

                                                                                                              method update

                                                                                                              update: (id: NullableId, data: T, params?: Params) => Promise<T | T[]>;

                                                                                                              index signature

                                                                                                              [key: string]: any;

                                                                                                                interface ServiceOverloads

                                                                                                                interface ServiceOverloads<T> {}

                                                                                                                  method create

                                                                                                                  create: {
                                                                                                                  (data: Partial<T>, params?: Params): Promise<T>;
                                                                                                                  (data: Partial<T>[], params?: Params): Promise<T[]>;
                                                                                                                  };

                                                                                                                  method patch

                                                                                                                  patch: {
                                                                                                                  (id: Id, data: Partial<T>, params?: Params): Promise<T>;
                                                                                                                  (id: null, data: Partial<T>, params?: Params): Promise<T[]>;
                                                                                                                  };

                                                                                                                  method remove

                                                                                                                  remove: {
                                                                                                                  (id: Id, params?: Params): Promise<T>;
                                                                                                                  (id: null, params?: Params): Promise<T[]>;
                                                                                                                  };

                                                                                                                  method update

                                                                                                                  update: {
                                                                                                                  (id: Id, data: T, params?: Params): Promise<T>;
                                                                                                                  (id: null, data: T, params?: Params): Promise<T[]>;
                                                                                                                  };

                                                                                                                  interface SetupMethod

                                                                                                                  interface SetupMethod {}

                                                                                                                    method setup

                                                                                                                    setup: (app: Application, path: string) => void;

                                                                                                                      Type Aliases

                                                                                                                      type ClientSideParams

                                                                                                                      type ClientSideParams = Pick<Params, 'query' | 'paginate'>;

                                                                                                                        type Hook

                                                                                                                        type Hook<T = any, S = Service<T>> = (
                                                                                                                        context: HookContext<T, S>
                                                                                                                        ) => Promise<HookContext<T, S> | void> | HookContext<T, S> | void;

                                                                                                                          type Id

                                                                                                                          type Id = number | string;

                                                                                                                            type NullableId

                                                                                                                            type NullableId = Id | null;

                                                                                                                              type ServerSideParams

                                                                                                                              type ServerSideParams = Params;

                                                                                                                                type Service

                                                                                                                                type Service<T> = ServiceOverloads<T> & ServiceAddons<T> & ServiceMethods<T>;

                                                                                                                                  type ServiceMixin

                                                                                                                                  type ServiceMixin = (service: Service<any>, path: string) => void;

                                                                                                                                    Package Files (1)

                                                                                                                                    Dependencies (4)

                                                                                                                                    Dev Dependencies (1)

                                                                                                                                    Peer Dependencies (0)

                                                                                                                                    No peer dependencies.

                                                                                                                                    Badge

                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@feathersjs/feathers.

                                                                                                                                    • Markdown
                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@feathersjs/feathers)
                                                                                                                                    • HTML
                                                                                                                                      <a href="https://www.jsdocs.io/package/@feathersjs/feathers"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>