UNPKG

@qbcart/cosmos

Version:

Azure Cosmos DB access common across the QBCart node ecosystem.

28 lines (27 loc) 1.01 kB
/*********************************************** * @license * Copyright (c) QBCart Inc. All rights reserved. ************************************************/ import { CosmosClient } from '@azure/cosmos'; import Customers from './containers/customers'; import Info from './containers/info'; import LineItems from './containers/line-items'; import Users from './containers/users'; export default class Cosmos { client; database; info; lineItems; customers; users; constructor(connectionString) { if (!connectionString) throw 'Missing connection string!'; this.client = new CosmosClient(connectionString); this.database = this.client.database('QBCart'); this.info = new Info(this.database.container('Info')); this.lineItems = new LineItems(this.database.container('LineItems')); this.customers = new Customers(this.database.container('Customers')); this.users = new Users(this.database.container('Users')); } }