import type { EndpointInterface } from '@data-client/normalizr'; import { SUBSCRIBE, UNSUBSCRIBE } from '../../actionTypes.js'; import type { SubscribeAction, UnsubscribeAction } from '../../types.js'; export function createSubscription( endpoint: E, { args }: { args: readonly [...Parameters] }, ): SubscribeAction { return { type: SUBSCRIBE, key: endpoint.key(...args), args, endpoint, }; } export function createUnsubscription( endpoint: E, { args }: { args: readonly [...Parameters] }, ): UnsubscribeAction { return { type: UNSUBSCRIBE, key: endpoint.key(...args), args, endpoint, }; }