UNPKG

@magnetarjs/types

Version:
50 lines (49 loc) 2.39 kB
export const MODULE_IDENTIFIER_SPLIT = ' /// '; /** * Saved as enum, just to enforce usage of `getPathFilterIdentifier()` */ export var PathFilterIdentifier; (function (PathFilterIdentifier) { PathFilterIdentifier["KEY"] = "modulePath + JSON.stringify({ query, where, orderBy, startAfter, limit })"; })(PathFilterIdentifier || (PathFilterIdentifier = {})); /** * Creates the `key` for the Maps used to cache certain values throughout the lifecycle of an instance. * @returns `modulePath + ' /// ' + JSON.stringify({ query, where, orderBy, startAfter, limit })` */ export function getPathFilterIdentifier(modulePath, moduleConfig) { const { query, where, orderBy, startAfter, limit } = moduleConfig; const config = JSON.stringify({ query, where, orderBy, startAfter, limit }); return `${modulePath}${MODULE_IDENTIFIER_SPLIT}${config}`; } /** * Saved as enum, just to enforce usage of `getPathWhereOrderByIdentifier()` */ export var PathWhereOrderByIdentifier; (function (PathWhereOrderByIdentifier) { PathWhereOrderByIdentifier["KEY"] = "modulePath + JSON.stringify({ query, where, orderBy })"; })(PathWhereOrderByIdentifier || (PathWhereOrderByIdentifier = {})); /** * Creates the `key` for the Maps used to cache the FetchMetaDataCollection throughout the lifecycle of an instance. * @returns `modulePath + ' /// ' + JSON.stringify({ query, where, orderBy })` */ export function getPathWhereOrderByIdentifier(modulePath, moduleConfig) { const { query, where, orderBy } = moduleConfig; const config = JSON.stringify({ query, where, orderBy }); return `${modulePath}${MODULE_IDENTIFIER_SPLIT}${config}`; } /** * Saved as enum, just to enforce usage of `getPathWhereIdentifier()` */ export var PathWhereIdentifier; (function (PathWhereIdentifier) { PathWhereIdentifier["KEY"] = "modulePath + JSON.stringify({ query, where, orderBy })"; })(PathWhereIdentifier || (PathWhereIdentifier = {})); /** * Creates the `key` for the Maps used to cache the FetchMetaDataCollection throughout the lifecycle of an instance. * @returns `modulePath + ' /// ' + JSON.stringify({ query, where, orderBy })` */ export function getPathWhereIdentifier(modulePath, moduleConfig) { const { query, where, orderBy } = moduleConfig; const config = JSON.stringify({ query, where, orderBy }); return `${modulePath}${MODULE_IDENTIFIER_SPLIT}${config}`; }