Skip to content

Commit

Permalink
refactor(formatting): rename closures to use 'create' prefix for cons…
Browse files Browse the repository at this point in the history
…istency
  • Loading branch information
psanders committed Dec 28, 2024
1 parent ebc2bdd commit a7acc57
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 9 deletions.
5 changes: 4 additions & 1 deletion mods/apiserver/src/utils/createHandleDialEventsWithNats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import { mapDialStatus } from "./mapDialStatus";
import { CALLS_TRACK_CALL_SUBJECT } from "../envs";

function createHandleDialEventsWithNats(nc: NatsConnection) {
return async function handleDialEventsWithNats(callRef: string, event: { dialstatus: string }) {
return async function handleDialEventsWithNats(
callRef: string,
event: { dialstatus: string }
) {
const mappedStatus = mapDialStatus(event.dialstatus);
if (!mappedStatus) return; // Ignore the event if status is not mapped

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import { mapDialStatus } from "./mapDialStatus";
import { VoiceClient } from "../voice/types";

function createHandleDialEventsWithVoiceClient(voiceClient: VoiceClient) {
return async function handleDialEventsWithVoiceClient(event: { dialstatus: string }) {
return async function handleDialEventsWithVoiceClient(event: {
dialstatus: string;
}) {
const mappedStatus = mapDialStatus(event.dialstatus);
if (!mappedStatus) return; // Ignore the event if status is not mapped

Expand Down
5 changes: 4 additions & 1 deletion mods/apiserver/src/voice/VoiceDispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ class VoiceDispatcher {
SC.PLAYBACK_CONTROL_REQUEST,
createPlaybackControlHandler(ari, vc).bind(this)
);
vc.on(SC.START_STREAM_GATHER_REQUEST, createStreamGatherHandler(vc).bind(this));
vc.on(
SC.START_STREAM_GATHER_REQUEST,
createStreamGatherHandler(vc).bind(this)
);
vc.on(SC.STOP_STREAM_GATHER_REQUEST, () => {
vc.stopStreamGather();
});
Expand Down
5 changes: 4 additions & 1 deletion mods/apiserver/src/voice/createCreateVoiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const logger = getLogger({ service: "apiserver", filePath: __filename });
const createToken = createCallAccessToken(identityConfig);

// Note: By the time the call arrives here the owner of the app MUST be authenticated
function createCreateVoiceClient(createContainer: CreateContainer, filesServer) {
function createCreateVoiceClient(
createContainer: CreateContainer,
filesServer
) {
return async function createVoiceClient(params: {
ari: Client;
event: StasisStart;
Expand Down
2 changes: 1 addition & 1 deletion mods/apiserver/src/voice/handlers/dial/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import { createDialHandler } from "./createDialHandler";
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from "./createDialHandler";
export * from "./createDialHandler";
1 change: 0 additions & 1 deletion mods/apiserver/src/voice/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export * from "./createStreamGatherHandler";
export * from "./createUnmuteHandler";
export * from "./dial/createDialHandler";
export * from "./gather/createGatherHandler";

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ function createCreateContainer(prisma: Prisma, pathToIntegrations: string) {
process.exit(1);
}

return async function createContainer(appRef: string): Promise<IntegrationsContainer> {
return async function createContainer(
appRef: string
): Promise<IntegrationsContainer> {
logger.verbose("creating integrations container", { appRef });

const app = await prisma.application.findUnique({
Expand Down
5 changes: 4 additions & 1 deletion mods/authz/src/createCheckMethodAuthorized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ function createCheckMethodAuthorized(authzServer: string, methods: string[]) {
* @param {ServerInterceptingCall} call - The call object
* @return {ServerInterceptingCall} - The modified call object
*/
return function checkMethodAuthorized(methodDefinition: { path: string }, call: ServerInterceptingCall) {
return function checkMethodAuthorized(
methodDefinition: { path: string },
call: ServerInterceptingCall
) {
const { path: method } = methodDefinition;

if (!methods.includes(method)) {
Expand Down
4 changes: 3 additions & 1 deletion mods/common/src/utils/createFetchSingleCallByCallId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import { CallDetailRecord } from "@fonoster/types";
import { InfluxDBClient } from "./types";

function createFetchSingleCallByCallId(influxdb: InfluxDBClient) {
return async function fetchSingleCallByCallId(callId: string): Promise<CallDetailRecord> {
return async function fetchSingleCallByCallId(
callId: string
): Promise<CallDetailRecord> {
const query = flux`from(bucket: "${INFLUXDB_CALLS_BUCKET}")
|> range(start: -365d)
|> pivot(rowKey: ["callId"], columnKey: ["_field"], valueColumn: "_value")
Expand Down

0 comments on commit a7acc57

Please sign in to comment.