Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function index(
context: ContextWithBindings
): Promise {
const stopProcessing = undefined;
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
winston.debug(`STARTED|${context.invocationId}`);
winston.debug(
`EmailNotificationsHandlerIndex|Dequeued email notification|${JSON.stringify(
context.bindings
)}`
);
// since this function gets triggered by a queued message that gets
// deserialized from a json object, we must first check that what we
// got is what we expect.
const errorOrNotificationEvent = NotificationEvent.decode(
context.bindings.notificationEvent
);
if (isLeft(errorOrNotificationEvent)) {
export async function index(context: Context): Promise {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
try {
// iterate over the whole services collection and collect visible services
const servicesCollectionIterator = await serviceModel.getCollectionIterator();
const servicesIterator = documentDbUtils.reduceResultIterator(
servicesCollectionIterator,
reduceServicesToVisibleServices
);
const errorOrVisibleServices = await documentDbUtils.iteratorToValue(
servicesIterator,
new StrMap({})
);
if (isLeft(errorOrVisibleServices)) {
winston.error(
"ComputeVisibleServices|Error computing visible services: %s",
errorOrVisibleServices.value
);
export async function index(
context: ContextWithBindings
): Promise {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
winston.debug(
`WebhookNotificationsHandlerIndex|Dequeued webhook notification|${JSON.stringify(
context.bindings
)}`
);
// since this function gets triggered by a queued message that gets
// deserialized from a json object, we must first check that what we
// got is what we expect.
const errorOrNotificationEvent = NotificationEvent.decode(
context.bindings.notificationEvent
);
if (isLeft(errorOrNotificationEvent)) {
winston.error(
`WebhookNotificationsHandler|Fatal! No valid message found in bindings.|${readableReport(
export async function index(
context: ContextWithBindings
): Promise {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
winston.debug(
`CreatedMessageQueueHandler|queueMessage|${JSON.stringify(
context.bindings
)}`
);
// since this function gets triggered by a queued message that gets
// deserialized from a json object, we must first check that what we
// got is what we expect.
const errorOrCreatedMessageEvent = CreatedMessageEvent.decode(
context.bindings.createdMessage
);
if (isLeft(errorOrCreatedMessageEvent)) {
winston.error(
`CreatedMessageQueueHandler|Fatal! No valid message found in bindings.|${readableReport(
export function index(context: Context): void {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
setAppContext(app, context);
azureFunctionHandler(context);
}
export function index(context: Context): void {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
setAppContext(app, context);
azureFunctionHandler(context);
}
export function index(context: Context): Promise> {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
return Promise.all(
[
EMAIL_NOTIFICATION_QUEUE_NAME,
WEBHOOK_NOTIFICATION_QUEUE_NAME,
MESSAGE_QUEUE_NAME
].map(async queueName => {
(await getQueueMetadata(queueService, queueName)).bimap(
error =>
winston.error("Error in QueueMonitor: %s (%s)", error, queueName),
result => {
winston.debug(
"Queue '%s' length is: %d",
queueName,
result.approximateMessageCount
);
appInsightsClient.trackMetric({
export async function index(
context: ContextWithBindings,
event: IProfileCreatedEvent | IProfileUpdatedEvent
): Promise {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
winston.debug(
"ProfileEventsQueueHandler|Received event=%s",
JSON.stringify(event)
);
const isInboxEnabled = event.newProfile.is_inbox_enabled === true;
const isProfileCreated = event.kind === "ProfileCreatedEvent";
const hasOldProfileWithInboxDisabled =
event.kind === "ProfileUpdatedEvent" &&
event.oldProfile.is_inbox_enabled === false;
const hasJustEnabledInbox =
isInboxEnabled && (isProfileCreated || hasOldProfileWithInboxDisabled);
const appInsightsClient = getCustomTelemetryClient(
export function index(context: Context): void {
const logLevel = isProduction ? "info" : "debug";
configureAzureContextTransport(context, winston, logLevel);
setAppContext(app, context);
azureFunctionHandler(context);
}