UNPKG

@qbcart/cosmos

Version:

Azure Cosmos DB access common across the QBCart node ecosystem.

20 lines (19 loc) 1.04 kB
/*********************************************** * @license * Copyright (c) QBCart Inc. All rights reserved. ************************************************/ import type { Container } from '@azure/cosmos'; import type CosmosBase from '@qbcart/types/extended/cosmos-base'; export default abstract class Base { container: Container; constructor(container: Container); read<T>(id: string, partitionKey: string): Promise<T | null>; queryFirst<T>(query: string, partitionKey: string): Promise<T | null>; queryAll<T>(query: string, partitionKey: string): Promise<T[]>; create<T extends CosmosBase>(object: T): Promise<T | null>; upsert<T extends CosmosBase>(object: T): Promise<T | null>; replace<T extends CosmosBase>(object: T): Promise<T | null>; safeReplace<T extends CosmosBase>(object: T): Promise<T | null | undefined>; delete<T extends CosmosBase>(object: T): Promise<T | null>; sync(returnProps: string[], filter: string, partitionKey: string, lastSynced: number): Promise<CosmosBase[]>; }