Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
messagesCollectionUrl,
messageContainerName
);
const messageStatusModel = new MessageStatusModel(
documentClient,
messageStatusCollectionUrl
);
const serviceModel = new ServiceModel(documentClient, servicesCollectionUrl);
const senderServiceModel = new SenderServiceModel(
documentClient,
senderServicesCollectionUrl
);
const notificationModel = new NotificationModel(
documentClient,
notificationsCollectionUrl
);
const notificationStatusModel = new NotificationStatusModel(
documentClient,
notificationsStatusCollectionUrl
);
const storageConnectionString = getRequiredStringEnv("QueueStorageConnection");
const blobService = createBlobService(storageConnectionString);
// Setup handlers
const debugHandler = GetDebug(serviceModel);
app.get("/api/v1/debug", debugHandler);
export const WEBHOOK_NOTIFICATION_QUEUE_NAME = "webhooknotifications";
const queueConnectionString = getRequiredStringEnv("QueueStorageConnection");
// We create the db client, services and models here
// as if any error occurs during the construction of these objects
// that would be unrecoverable anyway and we neither may trig a retry
const documentClient = new DocumentDBClient(cosmosDbUri, {
masterKey: cosmosDbKey
});
const notificationStatusModel = new NotificationStatusModel(
documentClient,
notificationStatusCollectionUrl
);
const notificationModel = new NotificationModel(
documentClient,
notificationsCollectionUrl
);
// As we cannot use Functions bindings to do retries,
// we resort to update the message visibility timeout
// using the queue service (client for Azure queue storage)
const queueService = createQueueService(queueConnectionString);
/**
* Input and output bindings for this function
* see WebhookNotificationsQueueHandler/function.json
*/
const ContextWithBindings = t.interface({
bindings: t.partial({
notificationEvent: NotificationEvent
export const EMAIL_NOTIFICATION_QUEUE_NAME = "emailnotifications";
const queueConnectionString = getRequiredStringEnv("QueueStorageConnection");
// We create the db client, services and models here
// as if any error occurs during the construction of these objects
// that would be unrecoverable anyway and we neither may trig a retry
const documentClient = new DocumentDBClient(cosmosDbUri, {
masterKey: cosmosDbKey
});
const notificationStatusModel = new NotificationStatusModel(
documentClient,
notificationStatusCollectionUrl
);
const notificationModel = new NotificationModel(
documentClient,
notificationsCollectionUrl
);
// As we cannot use Functions bindings to do retries,
// we resort to update the message visibility timeout
// using the queue service (client for Azure queue storage)
const queueService = createQueueService(queueConnectionString);
//
// setup NodeMailer
//
const mailupUsername = getRequiredStringEnv("MAILUP_USERNAME");
const mailupSecret = getRequiredStringEnv("MAILUP_SECRET");
//
);
// As we cannot use Functions bindings to do retries,
// we resort to update the message visibility timeout
// using the queue service (client for Azure queue storage)
const queueService = createQueueService(queueConnectionString);
const profileModel = new ProfileModel(documentClient, profilesCollectionUrl);
const messageModel = new MessageModel(
documentClient,
messagesCollectionUrl,
messageContainerName
);
const notificationModel = new NotificationModel(
documentClient,
notificationsCollectionUrl
);
const senderServiceModel = new SenderServiceModel(
documentClient,
senderServicesCollectionUrl
);
const blobService = createBlobService(storageConnectionString);
const InputBindings = t.partial({
createdMessage: CreatedMessageEvent
});
type InputBindings = t.TypeOf;