How to use the @reactioncommerce/api-utils/graphql/namespaces.js.Account function in @reactioncommerce/api-utils

To help you get started, we’ve selected a few @reactioncommerce/api-utils 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 reactioncommerce / reaction / imports / plugins / core / graphql / server / no-meteor / xforms / account.js View on Github external
import { assocPath, dissoc, pipe } from "ramda";
import namespaces from "@reactioncommerce/api-utils/graphql/namespaces.js";
import { assocInternalId, assocOpaqueId, decodeOpaqueIdForNamespace, encodeOpaqueId } from "./id";
import { renameKeys } from "./ramda-ext";

export const assocAccountInternalId = assocInternalId(namespaces.Account);
export const assocAccountOpaqueId = assocOpaqueId(namespaces.Account);
export const decodeAccountOpaqueId = decodeOpaqueIdForNamespace(namespaces.Account);
export const encodeAccountOpaqueId = encodeOpaqueId(namespaces.Account);

export const mergeAddressBookToProfile = (item) =>
  assocPath(["profile", "addressBook"], item.addressBook, item);

export const mergeCurrencyToProfile = (item) =>
  assocPath(["profile", "currency"], item.currency, item);

export const mergePreferencesToProfile = (item) =>
  assocPath(["profile", "preferences"], item.preferences, item);

export const xformAccountInput = pipe(
  assocAccountInternalId,
  mergeAddressBookToProfile,
github reactioncommerce / reaction / imports / plugins / core / graphql / server / no-meteor / xforms / account.js View on Github external
import { assocPath, dissoc, pipe } from "ramda";
import namespaces from "@reactioncommerce/api-utils/graphql/namespaces.js";
import { assocInternalId, assocOpaqueId, decodeOpaqueIdForNamespace, encodeOpaqueId } from "./id";
import { renameKeys } from "./ramda-ext";

export const assocAccountInternalId = assocInternalId(namespaces.Account);
export const assocAccountOpaqueId = assocOpaqueId(namespaces.Account);
export const decodeAccountOpaqueId = decodeOpaqueIdForNamespace(namespaces.Account);
export const encodeAccountOpaqueId = encodeOpaqueId(namespaces.Account);

export const mergeAddressBookToProfile = (item) =>
  assocPath(["profile", "addressBook"], item.addressBook, item);

export const mergeCurrencyToProfile = (item) =>
  assocPath(["profile", "currency"], item.currency, item);

export const mergePreferencesToProfile = (item) =>
  assocPath(["profile", "preferences"], item.preferences, item);

export const xformAccountInput = pipe(
  assocAccountInternalId,
  mergeAddressBookToProfile,
  mergeCurrencyToProfile,
  mergePreferencesToProfile,
  dissoc("addressBook"),