2.0.5 • Published 6 months ago

@types/yayson v2.0.5

Weekly downloads
41
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/yayson

Summary

This package contains type definitions for yayson (https://github.com/confetti/yayson).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yayson.

index.d.ts

// Type definitions for yayson v2.0.1
// Project: https://github.com/confetti/yayson
// Definitions by: David Wood <https://github.com/Codesleuth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare module 'yayson' {
  class Store {
    sync(obj: {}): any;
    find(type: string, id: string): any;
    findAll(type: string): any[];
    remove(type: string, id?: string): void;
    reset(): void;

    records: y.Record[];
    relations: { [key: string]: any };
  }

  interface Adapter {
    get(model: {}, key?: string): any;
    id(model: {}): string;
  }

  class Presenter {
    static adapter: string;

    static render<T>(instanceOrCollection: PromiseLike<T>, options?: y.JsonOptions): PromiseLike<T>;
    static render(instanceOrCollection: {}, options?: y.JsonOptions): any;
    static toJSON(instanceOrCollection: {}, options?: y.JsonOptions): any;

    render<T>(instanceOrCollection: PromiseLike<T>, options?: y.JsonOptions): PromiseLike<T>;
    render(instanceOrCollection: {}, options?: y.JsonOptions): any;
    toJSON(instanceOrCollection: {}, options?: y.JsonOptions): any;
    id(instance: {}): string;

    type: string;
  }

  interface Yayson {
    Store: typeof Store;
    Presenter: typeof Presenter;
    Adapter: Adapter;
  }

  interface YaysonOptions {
    adapter?: 'default' | 'sequelize' | undefined;
  }

  function y(arg?: YaysonOptions): Yayson;

  namespace y {
    interface JsonOptions {
      [key: string]: any;
      meta?: {} | undefined;
    }
    interface Record {
      id: any;
      type: string;
      attributes: any;
      relationships: any;
    }
  }

  export = y;
}

Additional Details

  • Last updated: Fri, 02 Jul 2021 16:32:08 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by David Wood.

2.0.3

8 months ago

2.0.5

6 months ago

2.0.4

7 months ago

2.0.2

3 years ago

2.0.1

8 years ago