UNPKG

cosmos-db-repositories

Version:
16 lines (15 loc) 623 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const eventgrid_1 = require("@azure/eventgrid"); let eventClient; const clientInstance = () => { if (!eventClient) { const topicEndpoint = process.env.AZURE_DATAGRID_TOPIC_URL; const topicKey = process.env.AZURE_DATAGRID_TOPIC_KEY; const inputSchema = 'EventGrid'; eventClient = new eventgrid_1.EventGridPublisherClient(topicEndpoint, inputSchema, new eventgrid_1.AzureKeyCredential(topicKey)); } return eventClient; }; const send = (event) => clientInstance().send(event); exports.default = { send };