UNPKG

@appello/services

Version:

Services package with api / graphql

17 lines (16 loc) 749 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cacheByIdArgProperty = exports.cacheByIdArg = exports.invalidatesList = exports.providesList = void 0; const providesList = (type) => results => { if (results) { return [{ type, id: 'LIST' }, ...results.map(({ id }) => ({ type, id }))]; } return []; }; exports.providesList = providesList; const invalidatesList = (type) => () => [{ type, id: 'LIST' }]; exports.invalidatesList = invalidatesList; const cacheByIdArg = (type) => (result, error, id) => [{ type, id }]; exports.cacheByIdArg = cacheByIdArg; const cacheByIdArgProperty = (type) => (result, error, arg) => [{ type, id: arg.id }]; exports.cacheByIdArgProperty = cacheByIdArgProperty;