How to use @orbit/jsonapi - 4 common examples

To help you get started, we’ve selected a few @orbit/jsonapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / data / store.ts View on Github external
import { JSONAPISerializer } from '@orbit/jsonapi';

import { api as apiEnv } from '@env';

import { defaultHeaders } from '@lib/fetch';

import { schema, keyMap } from './schema';

export const serializer = new JSONAPISerializer({ schema, keyMap });

// DEBUG!
// Orbit.fetch = (...args) => {
//   console.log(args);
//   return fetch(...args);
// };

export function defaultOptions() {
  return {
    sources: {
      remote: {
        settings: {
          ...defaultSourceOptions(),
        },
      },
    },
github cerebris / peeps-ember-orbit / app / data-sources / remote.js View on Github external
create(injections = {}) {
    // Use `fetch` implementation from `ember-fetch`
    Orbit.fetch = fetch;

    injections.name = 'remote';

    return new JSONAPISource(injections);
  }
};
github spree / spree-storefront-api-v2-js-sdk / src / Orbit.ts View on Github external
constructor() {
    this.currentSchema = currentSchema
    this.schema = new Schema(currentSchema)
    this.remote = new JSONAPISource({ schema: this.schema, name: 'remote', host: 'http://localhost:5000/api/v2/storefront' })
    this.coordinator = new Coordinator()
    this.store = new Store({ schema: this.schema, name: 'store' })

    this.coordinator.addSource(this.store)
    this.coordinator.addSource(this.remote)

    this.coordinator.addStrategy(new RequestStrategy({
      source: 'store',
      on: 'beforeQuery',
      target: 'remote',
      action: 'pull',
      blocking: true
    }))

    this.coordinator.addStrategy(new SyncStrategy({
      source: 'remote',

@orbit/jsonapi

JSON:API support for Orbit.

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular @orbit/jsonapi functions