{"version":3,"file":"getRoleMe.27e51428.js","sources":["../../../../../../src/grpc/workspace/getRoleMe.ts"],"sourcesContent":["import * as grpcWeb from \"@improbable-eng/grpc-web\";\n\nimport { grpcError } from \"$lib/utils/grpcError\";\n\nimport { type WorkspaceGetCurrentUserRoleReply, WorkspaceGetCurrentUserRoleRequest } from \"@aymeric_henry_sr/svelte-proto/workspace_pb\";\nimport { Workspaces, type WorkspacesGetCurrentUserRole } from \"@aymeric_henry_sr/svelte-proto/workspace_pb_service\";\n\nimport { unaryTransport } from \"../transport\";\nimport { GRPC_HOST } from \"../../constants/env.constants\";\n\nconst { grpc } = grpcWeb;\n\nexport function getRoleMe(workspaceId: string) {\n return new Promise<{ status: grpc.Code, message: WorkspaceGetCurrentUserRoleReply }>((resolve, reject) => {\n const req = new WorkspaceGetCurrentUserRoleRequest()\n req.setWorkspaceid(workspaceId)\n grpc.unary(Workspaces.GetCurrentUserRole, {\n request: req,\n host: GRPC_HOST,\n transport: unaryTransport,\n onEnd: res => {\n const { status, message } = res;\n if (status === grpc.Code.OK && message !== null) {\n resolve({\n status,\n message,\n })\n }\n\n reject(grpcError(\"Get My role\", arguments, res))\n }\n })\n })\n}\n"],"names":["grpc","grpcWeb","getRoleMe","workspaceId","resolve","reject","req","WorkspaceGetCurrentUserRoleRequest","Workspaces","GRPC_HOST","unaryTransport","res","status","message","grpcError"],"mappings":"wkBAUA,KAAM,CAAE,KAAAA,CAAS,EAAAC,EAEV,SAASC,EAAUC,EAAqB,CAC7C,OAAO,IAAI,QAA0E,CAACC,EAASC,IAAW,CAClG,MAAAC,EAAM,IAAIC,EAAAA,mCAChBD,EAAI,eAAeH,CAAW,EACzBH,EAAA,MAA0GQ,EAAW,mBAAoB,CAC5I,QAASF,EACT,KAAMG,EACN,UAAWC,EACX,MAAcC,GAAA,CACN,KAAA,CAAE,OAAAC,EAAQ,QAAAC,CAAY,EAAAF,EACxBC,IAAWZ,EAAK,KAAK,IAAMa,IAAY,MACjCT,EAAA,CACN,OAAAQ,EACA,QAAAC,CAAA,CACD,EAGHR,EAAOS,EAAU,cAAe,UAAWH,CAAG,CAAC,CACjD,CAAA,CACD,CAAA,CACF,CACH"}