Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import type {
AccessLevel,
UpdateChannelSharePermission,
UpdateSharePermissionRequestV2,
} from '../../../generated/storage/types.gen';
import type { Channel } from '../channels/channel';
/** Sharing updates reference channels by handle. Null clears the corresponding grant collection. */
export type SharePermissionOptions = Omit<
UpdateSharePermissionRequestV2,
'channelSharePermissions'
> & {
/** Channel grants to create or replace. */
channelSharePermissions?:
| {
channel: Channel;
accessLevel?: AccessLevel;
operation: UpdateChannelSharePermission['operation'];
}[]
| null;
};
/** Convert sharing options into the generated backend contract. */
export function sharePermissionBody(
options: SharePermissionOptions,
): UpdateSharePermissionRequestV2 {
return {
...options,
channelSharePermissions:
options.channelSharePermissions === undefined ||
options.channelSharePermissions === null
? options.channelSharePermissions
: options.channelSharePermissions.map((g) => ({
channelId: g.channel.id,
accessLevel: g.accessLevel,
operation: g.operation,
})),
};
}