MCPcopy
hub / github.com/drizzle-team/drizzle-orm / prepareRoles

Function prepareRoles

drizzle-kit/src/serializer/pgSerializer.ts:926–966  ·  view source on GitHub ↗
(entities?: {
	roles: boolean | {
		provider?: string | undefined;
		include?: string[] | undefined;
		exclude?: string[] | undefined;
	};
})

Source from the content-addressed store, hash-verified

924};
925
926function prepareRoles(entities?: {
927 roles: boolean | {
928 provider?: string | undefined;
929 include?: string[] | undefined;
930 exclude?: string[] | undefined;
931 };
932}) {
933 let useRoles: boolean = false;
934 const includeRoles: string[] = [];
935 const excludeRoles: string[] = [];
936
937 if (entities && entities.roles) {
938 if (typeof entities.roles === 'object') {
939 if (entities.roles.provider) {
940 if (entities.roles.provider === 'supabase') {
941 excludeRoles.push(...[
942 'anon',
943 'authenticator',
944 'authenticated',
945 'service_role',
946 'supabase_auth_admin',
947 'supabase_storage_admin',
948 'dashboard_user',
949 'supabase_admin',
950 ]);
951 } else if (entities.roles.provider === 'neon') {
952 excludeRoles.push(...['authenticated', 'anonymous']);
953 }
954 }
955 if (entities.roles.include) {
956 includeRoles.push(...entities.roles.include);
957 }
958 if (entities.roles.exclude) {
959 excludeRoles.push(...entities.roles.exclude);
960 }
961 } else {
962 useRoles = entities.roles;
963 }
964 }
965 return { useRoles, includeRoles, excludeRoles };
966}
967
968export const fromDatabase = async (
969 db: DB,

Callers 1

pgSerializer.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected