15 lines
349 B
TypeScript
15 lines
349 B
TypeScript
import { constructMetadata } from '../shared';
|
|
|
|
import { ArgsWithMetadata } from './types';
|
|
|
|
export const withMetadata = <TArgs extends unknown[]>(
|
|
args: TArgs,
|
|
accessId?: string | null
|
|
): ArgsWithMetadata<TArgs> => {
|
|
if (accessId) {
|
|
args.push(constructMetadata({ accessId }));
|
|
}
|
|
|
|
return args as unknown as ArgsWithMetadata<TArgs>;
|
|
};
|