UNPKG

forge-sql-orm

Version:

Drizzle ORM integration for Atlassian @forge/sql. Provides a custom driver, schema migration, two levels of caching (local and global via @forge/kvs), optimistic locking, and query analysis.

12 lines (9 loc) 409 B
import { AsyncLocalStorage } from "node:async_hooks"; export type OperationType = "DML" | "DDL"; export type OperationTypeQueryContext = { operationType: OperationType; }; export const operationTypeQueryContext = new AsyncLocalStorage<OperationTypeQueryContext>(); export async function getOperationType(): Promise<OperationType> { return operationTypeQueryContext.getStore()?.operationType ?? "DML"; }