Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 30 lines 955 B view raw
1import type { ItemIdentifier } from '@roostorg/types'; 2 3import { tryParseNonEmptyString } from '../utils/typescript-types.js'; 4import type { 5 ScyllaItemIdentifier, 6 ScyllaRealItemIdentifier, 7} from './types.js'; 8 9export function scyllaItemIdentifierToItemIdentifier(it: ScyllaItemIdentifier) { 10 return { 11 id: tryParseNonEmptyString(it.id), 12 typeId: tryParseNonEmptyString(it.type_id), 13 }; 14} 15 16/** 17 * NB: This will throw if the item identifier is 'invalid' in the sense of 18 * containing empty strings for any of its components. ItemIdentifiers are 19 * expected to always contain non-empty strings -- even though, strictly 20 * speaking, we haven't yet updated ItemIdentifier to bake in that requirement 21 * or communicated it to users. 22 */ 23export function itemIdentifierToScyllaItemIdentifier( 24 it: ItemIdentifier, 25): ScyllaRealItemIdentifier { 26 return { 27 id: tryParseNonEmptyString(it.id), 28 type_id: tryParseNonEmptyString(it.typeId), 29 }; 30}