@burdenoff/be-sdk 2026.1006.1 → 2026.1008.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.d.ts +2 -2
- package/dist/{chunk-7WLOO2VU.js → chunk-3CUOJTE3.js} +3 -3
- package/dist/{chunk-7WLOO2VU.js.map → chunk-3CUOJTE3.js.map} +1 -1
- package/dist/{chunk-L22J3BYR.js → chunk-BOKCGHLE.js} +15 -4
- package/dist/chunk-BOKCGHLE.js.map +1 -0
- package/dist/{chunk-FA5ROGTS.js → chunk-CYY4VIRK.js} +257 -131
- package/dist/chunk-CYY4VIRK.js.map +1 -0
- package/dist/{chunk-CVMQRWCB.js → chunk-EOHPDXXW.js} +7 -3
- package/dist/chunk-EOHPDXXW.js.map +1 -0
- package/dist/{chunk-RFXAHMY4.js → chunk-MYK6X4RS.js} +3 -3
- package/dist/{chunk-RFXAHMY4.js.map → chunk-MYK6X4RS.js.map} +1 -1
- package/dist/export/index.js +2 -2
- package/dist/feature-flags/index.d.ts +3 -3
- package/dist/gateway/index.js +1 -1
- package/dist/{index-Daj7nq9V.d.ts → index-Dl8EAdYu.d.ts} +10 -2
- package/dist/{index-Drvw0QPe.d.ts → index-Rc5EphmY.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/init/index.js +2 -2
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.js +2 -2
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/{types-Biv0uaJk.d.ts → types-C-6m9NoG.d.ts} +1 -1
- package/dist/{workspace-extension-DlxYz3P4.d.ts → workspace-extension-DiNiTLa3.d.ts} +29 -1
- package/package.json +2 -1
- package/dist/chunk-CVMQRWCB.js.map +0 -1
- package/dist/chunk-FA5ROGTS.js.map +0 -1
- package/dist/chunk-L22J3BYR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/export/index.ts","../src/export/base-exporter.ts","../src/export/pagination.ts","../src/export/csv.ts","../src/export/gateway-client.ts"],"names":["BaseModuleExporter","moduleKey","displayName","description","defaultExcludeFields","supportedProducts","modelName","filterFields","entity","excludeFields","fieldsToExclude","length","filtered","record","key","value","Object","entries","includes","filterFieldsMany","entities","map","paginate","queryFn","page","pageSize","skip","take","items","total","data","hasMore","nextCursor","String","undefined","fetchAll","fetchBatch","batchSize","allItems","cursor","batch","push","lastItem","id","transformForExport","validateOptions","options","validFormats","format","Error","join","getSupportedFormats","getMetadata","supportedFormats","PaginationService","params","start","end","paginatedItems","slice","totalCount","pageInfo","hasNextPage","hasPreviousPage","startCursor","endCursor","Math","min","calculatePagination","totalPages","ceil","startIndex","endIndex","currentPage","paginatedQuery","fetchFn","limit","initialCursor","totalYielded","item","collectPaginatedQuery","createPrismaFetchFn","_batchSize","calculateOffset","max","parseCursor","decoded","Buffer","from","toString","JSON","parse","createCursor","stringify","FORMULA_PREFIX_RE","sanitizeCSVCell","test","convertToCSV","delimiter","includeHeaders","flattenFields","maxFlattenDepth","flattenObject","obj","prefix","depth","result","newKey","Date","toISOString","Array","isArray","assign","flattenedRecords","allKeys","Set","keys","add","headers","sort","a","b","localeCompare","escapeCSV","sanitizedValue","replace","lines","row","header","parseCSV","csv","hasHeaders","split","filter","line","trim","parseLine","values","current","inQuotes","i","char","nextChar","dataLines","firstLine","firstRow","_","forEach","csvToJSON","pretty","parseOptions","getCSVHeaders","collectKeys","fullKey","estimateCSVSize","sampleSize","sample","sampleCSV","averageRowSize","headerSize","CREATE_EXPORT_JOB_MUTATION","triggerExportJob","serviceName","layer","actorId","actorType","workspaceId","name","entityTypes","includeMetadata","dateRangeStart","dateRangeEnd","client","GatewayClient","input","response","internalQuery","query","variables","job","createExportJob"],"mappings":";;;;AAAA,IAAA,cAAA,GAAA;;;;;;;;;;;;;ACoCO,IAAeA,qBAAf,MAAeA;EApCtB;;;;AAsCEC,EAAAA,SAAAA;;AAGAC,EA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EAAMsJ,eAAAA;AAC3B,EAAA,IAAI,CAACD,GAAAA,EAAK;AACR,IAAA,MAAM,IAAIlI,MAAM,qCAAA,CAAA;AAClB,EAAA;AACA,EAAA,OAAOkI,GAAAA;AACT;AA1CsBlB,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"chunk-RFXAHMY4.js","sourcesContent":["/**\n * Export Module\n *\n * Provides common utilities for data export operations across all Burdenoff microservices.\n * Includes pagination services, base exporter classes, CSV utilities, and type definitions.\n *\n * @module export\n *\n * @example\n * ```typescript\n * // Import from the export module\n * import {\n * BaseModuleExporter,\n * PaginationService,\n * convertToCSV,\n * } from '@burdenoff/be-sdk/export';\n *\n * // Create a custom exporter\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * const data = await this.fetchAll(\n * (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : {},\n * take: 100,\n * })\n * );\n *\n * const csv = convertToCSV(data);\n * return { data, format: 'csv' };\n * }\n * }\n *\n * // Use pagination utilities\n * const result = PaginationService.paginate(items, { page: 1, pageSize: 20 });\n * ```\n */\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type {\n // Export format types\n ExportFormat,\n ExportFormatEnum,\n\n // Configuration types\n ExportConfig,\n ExportOptions,\n\n // Job types\n ExportJobStatus,\n ExportJob,\n ExportProgress,\n ExportResult,\n\n // Fetch types\n ExportFetchOptions,\n ExportFetchResult,\n\n // Pagination types\n PaginationParams,\n PaginatedResult,\n PaginatedQueryOptions,\n PaginateResult,\n PaginateQueryFn,\n\n // Module interface\n ExportableModule,\n\n // CSV types\n CSVConversionOptions,\n} from './types.js';\n\n// ============================================================================\n// Class Exports\n// ============================================================================\n\nexport { BaseModuleExporter } from './base-exporter.js';\nexport { PaginationService } from './pagination.js';\n\n// ============================================================================\n// Function Exports\n// ============================================================================\n\nexport { convertToCSV, parseCSV, csvToJSON, getCSVHeaders, estimateCSVSize } from './csv.js';\n\n// ============================================================================\n// Gateway Helper Exports\n// ============================================================================\n\nexport { triggerExportJob } from './gateway-client.js';\nexport type { TriggerExportJobParams, ExportJobResult, ExportActorType, ExportFormatGql } from './gateway-client.js';\n","/**\n * Base Module Exporter\n *\n * Abstract base class for module exporters across all Burdenoff microservices.\n * Provides common functionality for exporting data from different modules.\n *\n * @module export/base-exporter\n *\n * @example\n * ```typescript\n * import { BaseModuleExporter } from '@burdenoff/be-sdk/export';\n *\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n * description = 'Export user data';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * // Implementation\n * }\n * }\n * ```\n */\n\nimport type { ExportOptions, ExportResult, PaginateQueryFn, PaginateResult } from './types.js';\n\n/**\n * Abstract base class for module exporters\n *\n * Provides common functionality that all module exporters can inherit:\n * - Field filtering\n * - Pagination helpers\n * - Module metadata\n *\n * @typeParam T - The type of entity this exporter handles\n */\nexport abstract class BaseModuleExporter<T = unknown> {\n /** Unique key identifying this module (e.g., 'users', 'tags', 'orders') */\n moduleKey?: string;\n\n /** Human-readable display name for the module */\n displayName?: string;\n\n /** Description of what this module exports */\n description?: string;\n\n /** Default fields to exclude from export (e.g., sensitive data) */\n defaultExcludeFields?: string[];\n\n /** List of product IDs this exporter supports */\n supportedProducts?: string[];\n\n /** Model name for database operations */\n protected modelName?: string;\n\n /**\n * Export data from this module\n *\n * Subclasses should implement this method to perform the actual export.\n * The method is optional to allow for gradual implementation.\n *\n * @param options - Export options including format, filters, and pagination\n * @returns Export result with data or download URL\n */\n export?(options: ExportOptions): Promise<ExportResult>;\n\n /**\n * Filter fields from an entity based on exclude list\n *\n * Use this to remove sensitive or unnecessary fields from exported data.\n *\n * @param entity - Entity to filter\n * @param excludeFields - Fields to exclude (uses defaultExcludeFields if not provided)\n * @returns Filtered entity as a plain object\n *\n * @example\n * ```typescript\n * const user = { id: '1', name: 'John', password: 'secret', ssn: '123' };\n * const filtered = this.filterFields(user, ['password', 'ssn']);\n * // Result: { id: '1', name: 'John' }\n * ```\n */\n protected filterFields(entity: T | Record<string, unknown>, excludeFields?: string[]): Record<string, unknown> {\n const fieldsToExclude = excludeFields || this.defaultExcludeFields || [];\n\n if (fieldsToExclude.length === 0) {\n return entity as Record<string, unknown>;\n }\n\n const filtered: Record<string, unknown> = {};\n const record = entity as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(record)) {\n if (!fieldsToExclude.includes(key)) {\n filtered[key] = value;\n }\n }\n\n return filtered;\n }\n\n /**\n * Filter multiple entities\n *\n * @param entities - Array of entities to filter\n * @param excludeFields - Fields to exclude\n * @returns Array of filtered entities\n */\n protected filterFieldsMany(\n entities: (T | Record<string, unknown>)[],\n excludeFields?: string[]\n ): Record<string, unknown>[] {\n return entities.map((entity) => this.filterFields(entity, excludeFields));\n }\n\n /**\n * Paginate helper for database queries\n *\n * Use this to implement paginated data fetching in your export method.\n *\n * @param queryFn - Function that executes the paginated query\n * @param page - Page number (1-indexed)\n * @param pageSize - Number of items per page\n * @returns Paginated result with data and metadata\n *\n * @example\n * ```typescript\n * const result = await this.paginate(\n * async ({ skip, take }) => {\n * const items = await db.user.findMany({ skip, take });\n * const total = await db.user.count();\n * return { items, total };\n * },\n * 1,\n * 100\n * );\n * ```\n */\n protected async paginate(\n queryFn: PaginateQueryFn<T>,\n page: number = 1,\n pageSize: number = 100\n ): Promise<PaginateResult<T>> {\n const skip = (page - 1) * pageSize;\n const take = pageSize;\n\n const { items, total } = await queryFn({ skip, take });\n\n return {\n data: items,\n total,\n hasMore: skip + items.length < total,\n nextCursor: items.length > 0 && skip + items.length < total ? String(page + 1) : undefined,\n };\n }\n\n /**\n * Fetch all data using cursor-based pagination\n *\n * Use this for exporting large datasets efficiently.\n *\n * @param fetchBatch - Function to fetch a batch of data\n * @param batchSize - Number of items per batch\n * @returns All fetched items\n *\n * @example\n * ```typescript\n * const allUsers = await this.fetchAll(\n * async (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n * ```\n */\n protected async fetchAll(\n fetchBatch: (cursor?: string) => Promise<(T & { id: string })[]>,\n batchSize: number = 100\n ): Promise<T[]> {\n const allItems: T[] = [];\n let cursor: string | undefined;\n\n while (true) {\n const batch = await fetchBatch(cursor);\n\n if (batch.length === 0) {\n break;\n }\n\n allItems.push(...batch);\n\n // Get cursor from last item\n const lastItem = batch[batch.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than batch size, we're done\n if (batch.length < batchSize) {\n break;\n }\n }\n\n return allItems;\n }\n\n /**\n * Transform entity for export\n *\n * Override this method to customize how entities are transformed before export.\n * Default implementation returns the entity as-is after field filtering.\n *\n * @param entity - Entity to transform\n * @param excludeFields - Fields to exclude\n * @returns Transformed entity\n */\n protected transformForExport(entity: T, excludeFields?: string[]): Record<string, unknown> {\n return this.filterFields(entity, excludeFields);\n }\n\n /**\n * Validate export options\n *\n * Override this to add custom validation for export options.\n *\n * @param options - Export options to validate\n * @throws Error if options are invalid\n */\n protected validateOptions(options: ExportOptions): void {\n const validFormats = ['csv', 'json', 'xlsx'];\n if (!validFormats.includes(options.format)) {\n throw new Error(`Invalid export format: ${options.format}. Valid formats: ${validFormats.join(', ')}`);\n }\n }\n\n /**\n * Get supported export formats\n *\n * @returns Array of supported format strings\n */\n getSupportedFormats(): string[] {\n return ['csv', 'json', 'xlsx'];\n }\n\n /**\n * Get module metadata\n *\n * @returns Module metadata object\n */\n getMetadata(): {\n moduleKey?: string;\n displayName?: string;\n description?: string;\n supportedProducts?: string[];\n supportedFormats: string[];\n } {\n return {\n moduleKey: this.moduleKey,\n displayName: this.displayName,\n description: this.description,\n supportedProducts: this.supportedProducts,\n supportedFormats: this.getSupportedFormats(),\n };\n }\n}\n","/**\n * Pagination Service\n *\n * Provides pagination utilities for export operations across all Burdenoff microservices.\n * Supports both offset-based and cursor-based pagination strategies.\n *\n * @module export/pagination\n *\n * @example\n * ```typescript\n * import { PaginationService } from '@burdenoff/be-sdk/export';\n *\n * // Offset-based pagination\n * const result = PaginationService.paginate(items, { page: 2, pageSize: 20 });\n *\n * // Cursor-based pagination with async generator\n * for await (const item of PaginationService.paginatedQuery(fetchFn, { limit: 100 })) {\n * console.log(item);\n * }\n * ```\n */\n\nimport type { PaginatedQueryOptions, PaginatedResult, PaginationParams } from './types.js';\n\n/**\n * Service providing pagination utilities for export and data fetching operations\n */\nexport class PaginationService {\n /**\n * Paginate an array of items using offset-based pagination\n *\n * @param items - Array of items to paginate\n * @param params - Pagination parameters\n * @returns Paginated result with items and metadata\n *\n * @example\n * ```typescript\n * const allUsers = await db.user.findMany();\n * const page = PaginationService.paginate(allUsers, { page: 1, pageSize: 10 });\n * console.log(page.items); // First 10 users\n * console.log(page.pageInfo.hasNextPage); // true if more pages exist\n * ```\n */\n static paginate<T>(items: T[], params: PaginationParams): PaginatedResult<T> {\n const page = params.page ?? 1;\n const pageSize = params.pageSize ?? 20;\n const start = (page - 1) * pageSize;\n const end = start + pageSize;\n\n const paginatedItems = items.slice(start, end);\n\n return {\n items: paginatedItems,\n totalCount: items.length,\n pageInfo: {\n hasNextPage: end < items.length,\n hasPreviousPage: page > 1,\n startCursor: paginatedItems.length > 0 ? String(start) : undefined,\n endCursor: paginatedItems.length > 0 ? String(Math.min(end, items.length) - 1) : undefined,\n },\n };\n }\n\n /**\n * Calculate pagination metadata without slicing data\n *\n * @param totalCount - Total number of items\n * @param page - Current page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Pagination metadata\n *\n * @example\n * ```typescript\n * const meta = PaginationService.calculatePagination(150, 3, 20);\n * // meta.hasNextPage = true (page 4 exists)\n * // meta.hasPreviousPage = true (page 2 exists)\n * // meta.totalPages = 8\n * ```\n */\n static calculatePagination(\n totalCount: number,\n page: number,\n pageSize: number\n ): {\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n totalPages: number;\n currentPage: number;\n pageSize: number;\n startIndex: number;\n endIndex: number;\n } {\n const totalPages = Math.ceil(totalCount / pageSize);\n const startIndex = (page - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalCount - 1);\n\n return {\n hasNextPage: page < totalPages,\n hasPreviousPage: page > 1,\n totalPages,\n currentPage: page,\n pageSize,\n startIndex,\n endIndex,\n };\n }\n\n /**\n * Async generator for paginated database queries using cursor-based pagination\n *\n * This is ideal for processing large datasets without loading everything into memory.\n * The generator yields items one at a time, fetching new batches as needed.\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Async generator of items\n *\n * @example\n * ```typescript\n * // Define fetch function that queries the database\n * const fetchUsers = async (cursor?: string) => {\n * return db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * });\n * };\n *\n * // Process all users without loading all into memory\n * for await (const user of PaginationService.paginatedQuery(fetchUsers)) {\n * await processUser(user);\n * }\n * ```\n */\n static async *paginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): AsyncGenerator<T, void, unknown> {\n const { limit, initialCursor } = options;\n let cursor = initialCursor;\n let hasMore = true;\n let totalYielded = 0;\n\n while (hasMore) {\n const items = await fetchFn(cursor);\n\n if (items.length === 0) {\n break;\n }\n\n for (const item of items) {\n yield item;\n totalYielded++;\n\n if (limit && totalYielded >= limit) {\n return;\n }\n }\n\n // Get next cursor from last item\n const lastItem = items[items.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than expected batch size, we're done\n // Note: This assumes fetchFn respects a consistent batch size internally\n hasMore = items.length > 0;\n }\n }\n\n /**\n * Collect all items from a paginated query into an array\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Array of all items\n *\n * @example\n * ```typescript\n * const allUsers = await PaginationService.collectPaginatedQuery(fetchUsers, { limit: 1000 });\n * ```\n */\n static async collectPaginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): Promise<T[]> {\n const items: T[] = [];\n\n for await (const item of PaginationService.paginatedQuery(fetchFn, options)) {\n items.push(item);\n }\n\n return items;\n }\n\n /**\n * Create a cursor-based paginated fetch function from a Prisma-style query\n *\n * @param queryFn - Prisma-style query function\n * @param batchSize - Number of items to fetch per batch\n * @returns Fetch function compatible with paginatedQuery\n *\n * @example\n * ```typescript\n * const fetchFn = PaginationService.createPrismaFetchFn(\n * (cursor) => db.user.findMany({\n * where: { isActive: true, ...(cursor ? { id: { gt: cursor } } : {}) },\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n *\n * for await (const user of PaginationService.paginatedQuery(fetchFn)) {\n * console.log(user);\n * }\n * ```\n */\n static createPrismaFetchFn<T extends { id: string }>(\n queryFn: (cursor?: string) => Promise<T[]>,\n _batchSize: number = 100\n ): (cursor?: string) => Promise<T[]> {\n return queryFn;\n }\n\n /**\n * Calculate offset for skip-based pagination\n *\n * @param page - Page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Offset value for skip\n */\n static calculateOffset(page: number, pageSize: number): number {\n return (Math.max(1, page) - 1) * pageSize;\n }\n\n /**\n * Parse cursor string to extract pagination state\n *\n * @param cursor - Base64-encoded cursor string\n * @returns Decoded cursor data or null if invalid\n */\n static parseCursor<T = Record<string, unknown>>(cursor: string): T | null {\n try {\n const decoded = Buffer.from(cursor, 'base64').toString('utf-8');\n return JSON.parse(decoded) as T;\n } catch {\n return null;\n }\n }\n\n /**\n * Create cursor string from pagination state\n *\n * @param data - Data to encode in cursor\n * @returns Base64-encoded cursor string\n */\n static createCursor(data: Record<string, unknown>): string {\n return Buffer.from(JSON.stringify(data)).toString('base64');\n }\n}\n","/**\n * CSV Utilities\n *\n * Utilities for converting data to CSV format for export operations.\n *\n * @module export/csv\n *\n * @example\n * ```typescript\n * import { convertToCSV, parseCSV } from '@burdenoff/be-sdk/export';\n *\n * const csv = convertToCSV(users, { includeHeaders: true });\n * console.log(csv);\n * ```\n */\n\nimport type { CSVConversionOptions } from './types.js';\n\nconst FORMULA_PREFIX_RE = /^[=+\\-@]/;\n\nexport function sanitizeCSVCell(value: string): string {\n return FORMULA_PREFIX_RE.test(value) ? `'${value}` : value;\n}\n\n/**\n * Convert an array of objects to CSV format\n *\n * Handles nested objects by flattening them with dot notation.\n * Arrays are JSON stringified.\n * Dates are converted to ISO strings.\n *\n * @param data - Array of objects to convert\n * @param options - CSV conversion options\n * @returns CSV string\n *\n * @example\n * ```typescript\n * const users = [\n * { id: 1, name: 'John', address: { city: 'NYC' } },\n * { id: 2, name: 'Jane', address: { city: 'LA' } },\n * ];\n *\n * const csv = convertToCSV(users);\n * // Output:\n * // id,name,address.city\n * // 1,John,NYC\n * // 2,Jane,LA\n * ```\n */\nexport function convertToCSV(data: unknown[], options: CSVConversionOptions = {}): string {\n const { delimiter = ',', includeHeaders = true, flattenFields = true, maxFlattenDepth = 3 } = options;\n\n if (data.length === 0) {\n return '';\n }\n\n // Flatten objects and get all keys\n const flattenObject = (obj: unknown, prefix = '', depth = 0): Record<string, string> => {\n const result: Record<string, string> = {};\n\n if (obj === null || obj === undefined) {\n return result;\n }\n\n if (typeof obj !== 'object') {\n return { [prefix || 'value']: String(obj) };\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n\n if (value === null || value === undefined) {\n result[newKey] = '';\n } else if (value instanceof Date) {\n result[newKey] = value.toISOString();\n } else if (Array.isArray(value)) {\n result[newKey] = JSON.stringify(value);\n } else if (typeof value === 'object' && flattenFields && depth < maxFlattenDepth) {\n Object.assign(result, flattenObject(value, newKey, depth + 1));\n } else if (typeof value === 'object') {\n result[newKey] = JSON.stringify(value);\n } else {\n result[newKey] = String(value);\n }\n }\n\n return result;\n };\n\n // Flatten all records and collect all keys\n const flattenedRecords = data.map((item) => flattenObject(item));\n const allKeys = new Set<string>();\n for (const record of flattenedRecords) {\n for (const key of Object.keys(record)) {\n allKeys.add(key);\n }\n }\n\n const headers = Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n\n // Escape CSV values\n const escapeCSV = (value: string): string => {\n const sanitizedValue = sanitizeCSVCell(value);\n\n if (\n sanitizedValue.includes(delimiter) ||\n sanitizedValue.includes('\"') ||\n sanitizedValue.includes('\\n') ||\n sanitizedValue.includes('\\r')\n ) {\n return `\"${sanitizedValue.replace(/\"/g, '\"\"')}\"`;\n }\n return sanitizedValue;\n };\n\n // Build CSV\n const lines: string[] = [];\n\n if (includeHeaders) {\n lines.push(headers.map(escapeCSV).join(delimiter));\n }\n\n for (const record of flattenedRecords) {\n const row = headers.map((header) => escapeCSV(record[header] || ''));\n lines.push(row.join(delimiter));\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Parse a CSV string into an array of objects\n *\n * @param csv - CSV string to parse\n * @param options - Parse options\n * @returns Array of parsed objects\n *\n * @example\n * ```typescript\n * const csv = 'id,name\\n1,John\\n2,Jane';\n * const data = parseCSV(csv);\n * // [{ id: '1', name: 'John' }, { id: '2', name: 'Jane' }]\n * ```\n */\nexport function parseCSV(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean } = {}\n): Record<string, string>[] {\n const { delimiter = ',', hasHeaders = true } = options;\n\n const lines = csv.split(/\\r?\\n/).filter((line) => line.trim());\n\n if (lines.length === 0) {\n return [];\n }\n\n // Parse a single CSV line, handling quoted values\n const parseLine = (line: string): string[] => {\n const values: string[] = [];\n let current = '';\n let inQuotes = false;\n\n let i = 0;\n while (i < line.length) {\n const char = line[i];\n const nextChar = line[i + 1];\n\n if (char === '\"' && inQuotes && nextChar === '\"') {\n current += '\"';\n i += 2; // Skip next quote\n } else if (char === '\"') {\n inQuotes = !inQuotes;\n i++;\n } else if (char === delimiter && !inQuotes) {\n values.push(current);\n current = '';\n i++;\n } else {\n current += char;\n i++;\n }\n }\n\n values.push(current);\n return values;\n };\n\n let headers: string[];\n let dataLines: string[];\n\n // We've already checked that lines.length > 0, so lines[0] is guaranteed to exist\n const firstLine = lines[0] as string;\n\n if (hasHeaders) {\n headers = parseLine(firstLine);\n dataLines = lines.slice(1);\n } else {\n // Generate numeric headers if no header row\n const firstRow = parseLine(firstLine);\n headers = firstRow.map((_, i) => `col${i}`);\n dataLines = lines;\n }\n\n return dataLines.map((line) => {\n const values = parseLine(line);\n const obj: Record<string, string> = {};\n\n headers.forEach((header, i) => {\n obj[header] = values[i] || '';\n });\n\n return obj;\n });\n}\n\n/**\n * Convert CSV to JSON string\n *\n * @param csv - CSV string\n * @param options - Parse options\n * @returns JSON string\n */\nexport function csvToJSON(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean; pretty?: boolean } = {}\n): string {\n const { pretty = false, ...parseOptions } = options;\n const data = parseCSV(csv, parseOptions);\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);\n}\n\n/**\n * Get CSV headers from data\n *\n * @param data - Array of objects\n * @param flattenFields - Whether to flatten nested objects\n * @returns Array of header strings\n */\nexport function getCSVHeaders(data: unknown[], flattenFields: boolean = true): string[] {\n if (data.length === 0) {\n return [];\n }\n\n const collectKeys = (obj: unknown, prefix = '', depth = 0): string[] => {\n const keys: string[] = [];\n\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return prefix ? [prefix] : [];\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n flattenFields &&\n depth < 3\n ) {\n keys.push(...collectKeys(value, fullKey, depth + 1));\n } else {\n keys.push(fullKey);\n }\n }\n\n return keys;\n };\n\n const allKeys = new Set<string>();\n for (const item of data) {\n for (const key of collectKeys(item)) {\n allKeys.add(key);\n }\n }\n\n return Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Estimate CSV file size for a dataset\n *\n * @param data - Array of objects\n * @param sampleSize - Number of records to sample for estimation\n * @returns Estimated size in bytes\n */\nexport function estimateCSVSize(data: unknown[], sampleSize: number = 100): number {\n if (data.length === 0) {\n return 0;\n }\n\n // Take a sample to estimate average row size\n const sample = data.slice(0, Math.min(sampleSize, data.length));\n const sampleCSV = convertToCSV(sample);\n const averageRowSize = sampleCSV.length / sample.length;\n\n // Estimate total size (headers + data rows)\n const headers = getCSVHeaders(data);\n const headerSize = headers.join(',').length + 1; // +1 for newline\n\n return Math.ceil(headerSize + averageRowSize * data.length);\n}\n","/**\n * Export Gateway Helper\n *\n * Centralised wrapper around the workspace internal gateway's\n * `createExportJob` mutation, used by per-svc convenience resolvers\n * (e.g. `createTagsExportJob`, `createGroupsExportJob`).\n *\n * Replaces the duplicated `src/clients/export-gateway.ts` files that\n * existed in 19+ workspace svcs.\n *\n * @module export/gateway-client\n *\n * @example\n * ```typescript\n * import { triggerExportJob } from '@burdenoff/be-sdk/export';\n *\n * const result = await triggerExportJob({\n * serviceName: 'wspace-tags-svc',\n * workspaceId: ctx.workspaceId,\n * name: input.name,\n * entityTypes: ['tags', 'vocabularies'],\n * format: input.format,\n * actorId: ctx.actorId,\n * actorType: ctx.actorType,\n * });\n * ```\n */\n\nimport { GatewayClient } from '../gateway/index.js';\nimport type { ServiceLayer } from '../types/layer.js';\n\nconst CREATE_EXPORT_JOB_MUTATION = `mutation CreateExportJob($input: CreateExportJobInput!) {\n createExportJob(input: $input) {\n id\n status\n workspaceId\n entityTypes\n format\n createdAt\n }\n}`;\n\nexport type ExportActorType = 'user' | 'app' | 'service' | 'super_admin';\nexport type ExportFormatGql = 'JSON' | 'CSV';\n\nexport interface TriggerExportJobParams {\n /** Caller service name, used by gateway client telemetry/auth */\n serviceName: string;\n /** Layer for the gateway. Defaults to `wspace`. */\n layer?: ServiceLayer;\n /** Workspace context (required for wspace exports). */\n workspaceId: string;\n /** Human-readable name for the export job. */\n name: string;\n /** Entity types registered in `wspace-export-svc` to include. */\n entityTypes: string[];\n /** Output format. */\n format: ExportFormatGql;\n /** Actor making the request (forwarded to RBAC). */\n actorId: string;\n actorType: ExportActorType;\n /** Whether to include extended metadata in the export ZIP. */\n includeMetadata?: boolean;\n /** Optional ISO date-range bounds. */\n dateRangeStart?: string;\n dateRangeEnd?: string;\n}\n\nexport interface ExportJobResult {\n id: string;\n status: string;\n workspaceId: string;\n entityTypes: string[];\n format: string;\n createdAt: string;\n}\n\ninterface CreateExportJobResponse {\n createExportJob?: ExportJobResult;\n}\n\n/**\n * Submit a `createExportJob` mutation to the workspace internal gateway.\n *\n * The caller is expected to map the returned `ExportJobResult` to its\n * own GraphQL output type (the per-svc `ExportJobResponse`).\n */\nexport async function triggerExportJob(params: TriggerExportJobParams): Promise<ExportJobResult> {\n const {\n serviceName,\n layer = 'wspace',\n actorId,\n actorType,\n workspaceId,\n name,\n entityTypes,\n format,\n includeMetadata,\n dateRangeStart,\n dateRangeEnd,\n } = params;\n\n const client = new GatewayClient({ layer, serviceName });\n\n const input = {\n workspaceId,\n name,\n entityTypes,\n format,\n ...(includeMetadata !== undefined ? { includeMetadata } : {}),\n ...(dateRangeStart !== undefined ? { dateRangeStart } : {}),\n ...(dateRangeEnd !== undefined ? { dateRangeEnd } : {}),\n };\n\n const response = await client.internalQuery<CreateExportJobResponse>({\n query: CREATE_EXPORT_JOB_MUTATION,\n variables: { input },\n headers: {\n 'x-actor-id': actorId,\n 'x-actor-type': actorType,\n 'x-workspace-id': workspaceId,\n },\n });\n\n const job = response.data?.createExportJob;\n if (!job) {\n throw new Error('Export service did not return a job');\n }\n return job;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/export/index.ts","../src/export/base-exporter.ts","../src/export/pagination.ts","../src/export/csv.ts","../src/export/gateway-client.ts"],"names":["BaseModuleExporter","moduleKey","displayName","description","defaultExcludeFields","supportedProducts","modelName","filterFields","entity","excludeFields","fieldsToExclude","length","filtered","record","key","value","Object","entries","includes","filterFieldsMany","entities","map","paginate","queryFn","page","pageSize","skip","take","items","total","data","hasMore","nextCursor","String","undefined","fetchAll","fetchBatch","batchSize","allItems","cursor","batch","push","lastItem","id","transformForExport","validateOptions","options","validFormats","format","Error","join","getSupportedFormats","getMetadata","supportedFormats","PaginationService","params","start","end","paginatedItems","slice","totalCount","pageInfo","hasNextPage","hasPreviousPage","startCursor","endCursor","Math","min","calculatePagination","totalPages","ceil","startIndex","endIndex","currentPage","paginatedQuery","fetchFn","limit","initialCursor","totalYielded","item","collectPaginatedQuery","createPrismaFetchFn","_batchSize","calculateOffset","max","parseCursor","decoded","Buffer","from","toString","JSON","parse","createCursor","stringify","FORMULA_PREFIX_RE","sanitizeCSVCell","test","convertToCSV","delimiter","includeHeaders","flattenFields","maxFlattenDepth","flattenObject","obj","prefix","depth","result","newKey","Date","toISOString","Array","isArray","assign","flattenedRecords","allKeys","Set","keys","add","headers","sort","a","b","localeCompare","escapeCSV","sanitizedValue","replace","lines","row","header","parseCSV","csv","hasHeaders","split","filter","line","trim","parseLine","values","current","inQuotes","i","char","nextChar","dataLines","firstLine","firstRow","_","forEach","csvToJSON","pretty","parseOptions","getCSVHeaders","collectKeys","fullKey","estimateCSVSize","sampleSize","sample","sampleCSV","averageRowSize","headerSize","CREATE_EXPORT_JOB_MUTATION","triggerExportJob","serviceName","layer","actorId","actorType","workspaceId","name","entityTypes","includeMetadata","dateRangeStart","dateRangeEnd","client","GatewayClient","input","response","internalQuery","query","variables","job","createExportJob"],"mappings":";;;;AAAA,IAAA,cAAA,GAAA;;;;;;;;;;;;;ACoCO,IAAeA,qBAAf,MAAeA;EApCtB;;;;AAsCEC,EAAAA,SAAAA;;AAGAC,EAAAA,WAAAA;;AAGAC,EAAAA,WAAAA;;AAGAC,EAAAA,oBAAAA;;AAGAC,EAAAA,iBAAAA;;AAGUC,EAAAA,SAAAA;;;;;;;;;;;;;;;;;AA6BAC,EAAAA,YAAAA,CAAaC,QAAqCC,aAAAA,EAAmD;AAC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A,kBAAAA,CAAAA","file":"chunk-MYK6X4RS.js","sourcesContent":["/**\n * Export Module\n *\n * Provides common utilities for data export operations across all Burdenoff microservices.\n * Includes pagination services, base exporter classes, CSV utilities, and type definitions.\n *\n * @module export\n *\n * @example\n * ```typescript\n * // Import from the export module\n * import {\n * BaseModuleExporter,\n * PaginationService,\n * convertToCSV,\n * } from '@burdenoff/be-sdk/export';\n *\n * // Create a custom exporter\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * const data = await this.fetchAll(\n * (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : {},\n * take: 100,\n * })\n * );\n *\n * const csv = convertToCSV(data);\n * return { data, format: 'csv' };\n * }\n * }\n *\n * // Use pagination utilities\n * const result = PaginationService.paginate(items, { page: 1, pageSize: 20 });\n * ```\n */\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type {\n // Export format types\n ExportFormat,\n ExportFormatEnum,\n\n // Configuration types\n ExportConfig,\n ExportOptions,\n\n // Job types\n ExportJobStatus,\n ExportJob,\n ExportProgress,\n ExportResult,\n\n // Fetch types\n ExportFetchOptions,\n ExportFetchResult,\n\n // Pagination types\n PaginationParams,\n PaginatedResult,\n PaginatedQueryOptions,\n PaginateResult,\n PaginateQueryFn,\n\n // Module interface\n ExportableModule,\n\n // CSV types\n CSVConversionOptions,\n} from './types.js';\n\n// ============================================================================\n// Class Exports\n// ============================================================================\n\nexport { BaseModuleExporter } from './base-exporter.js';\nexport { PaginationService } from './pagination.js';\n\n// ============================================================================\n// Function Exports\n// ============================================================================\n\nexport { convertToCSV, parseCSV, csvToJSON, getCSVHeaders, estimateCSVSize } from './csv.js';\n\n// ============================================================================\n// Gateway Helper Exports\n// ============================================================================\n\nexport { triggerExportJob } from './gateway-client.js';\nexport type { TriggerExportJobParams, ExportJobResult, ExportActorType, ExportFormatGql } from './gateway-client.js';\n","/**\n * Base Module Exporter\n *\n * Abstract base class for module exporters across all Burdenoff microservices.\n * Provides common functionality for exporting data from different modules.\n *\n * @module export/base-exporter\n *\n * @example\n * ```typescript\n * import { BaseModuleExporter } from '@burdenoff/be-sdk/export';\n *\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n * description = 'Export user data';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * // Implementation\n * }\n * }\n * ```\n */\n\nimport type { ExportOptions, ExportResult, PaginateQueryFn, PaginateResult } from './types.js';\n\n/**\n * Abstract base class for module exporters\n *\n * Provides common functionality that all module exporters can inherit:\n * - Field filtering\n * - Pagination helpers\n * - Module metadata\n *\n * @typeParam T - The type of entity this exporter handles\n */\nexport abstract class BaseModuleExporter<T = unknown> {\n /** Unique key identifying this module (e.g., 'users', 'tags', 'orders') */\n moduleKey?: string;\n\n /** Human-readable display name for the module */\n displayName?: string;\n\n /** Description of what this module exports */\n description?: string;\n\n /** Default fields to exclude from export (e.g., sensitive data) */\n defaultExcludeFields?: string[];\n\n /** List of product IDs this exporter supports */\n supportedProducts?: string[];\n\n /** Model name for database operations */\n protected modelName?: string;\n\n /**\n * Export data from this module\n *\n * Subclasses should implement this method to perform the actual export.\n * The method is optional to allow for gradual implementation.\n *\n * @param options - Export options including format, filters, and pagination\n * @returns Export result with data or download URL\n */\n export?(options: ExportOptions): Promise<ExportResult>;\n\n /**\n * Filter fields from an entity based on exclude list\n *\n * Use this to remove sensitive or unnecessary fields from exported data.\n *\n * @param entity - Entity to filter\n * @param excludeFields - Fields to exclude (uses defaultExcludeFields if not provided)\n * @returns Filtered entity as a plain object\n *\n * @example\n * ```typescript\n * const user = { id: '1', name: 'John', password: 'secret', ssn: '123' };\n * const filtered = this.filterFields(user, ['password', 'ssn']);\n * // Result: { id: '1', name: 'John' }\n * ```\n */\n protected filterFields(entity: T | Record<string, unknown>, excludeFields?: string[]): Record<string, unknown> {\n const fieldsToExclude = excludeFields || this.defaultExcludeFields || [];\n\n if (fieldsToExclude.length === 0) {\n return entity as Record<string, unknown>;\n }\n\n const filtered: Record<string, unknown> = {};\n const record = entity as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(record)) {\n if (!fieldsToExclude.includes(key)) {\n filtered[key] = value;\n }\n }\n\n return filtered;\n }\n\n /**\n * Filter multiple entities\n *\n * @param entities - Array of entities to filter\n * @param excludeFields - Fields to exclude\n * @returns Array of filtered entities\n */\n protected filterFieldsMany(\n entities: (T | Record<string, unknown>)[],\n excludeFields?: string[]\n ): Record<string, unknown>[] {\n return entities.map((entity) => this.filterFields(entity, excludeFields));\n }\n\n /**\n * Paginate helper for database queries\n *\n * Use this to implement paginated data fetching in your export method.\n *\n * @param queryFn - Function that executes the paginated query\n * @param page - Page number (1-indexed)\n * @param pageSize - Number of items per page\n * @returns Paginated result with data and metadata\n *\n * @example\n * ```typescript\n * const result = await this.paginate(\n * async ({ skip, take }) => {\n * const items = await db.user.findMany({ skip, take });\n * const total = await db.user.count();\n * return { items, total };\n * },\n * 1,\n * 100\n * );\n * ```\n */\n protected async paginate(\n queryFn: PaginateQueryFn<T>,\n page: number = 1,\n pageSize: number = 100\n ): Promise<PaginateResult<T>> {\n const skip = (page - 1) * pageSize;\n const take = pageSize;\n\n const { items, total } = await queryFn({ skip, take });\n\n return {\n data: items,\n total,\n hasMore: skip + items.length < total,\n nextCursor: items.length > 0 && skip + items.length < total ? String(page + 1) : undefined,\n };\n }\n\n /**\n * Fetch all data using cursor-based pagination\n *\n * Use this for exporting large datasets efficiently.\n *\n * @param fetchBatch - Function to fetch a batch of data\n * @param batchSize - Number of items per batch\n * @returns All fetched items\n *\n * @example\n * ```typescript\n * const allUsers = await this.fetchAll(\n * async (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n * ```\n */\n protected async fetchAll(\n fetchBatch: (cursor?: string) => Promise<(T & { id: string })[]>,\n batchSize: number = 100\n ): Promise<T[]> {\n const allItems: T[] = [];\n let cursor: string | undefined;\n\n while (true) {\n const batch = await fetchBatch(cursor);\n\n if (batch.length === 0) {\n break;\n }\n\n allItems.push(...batch);\n\n // Get cursor from last item\n const lastItem = batch[batch.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than batch size, we're done\n if (batch.length < batchSize) {\n break;\n }\n }\n\n return allItems;\n }\n\n /**\n * Transform entity for export\n *\n * Override this method to customize how entities are transformed before export.\n * Default implementation returns the entity as-is after field filtering.\n *\n * @param entity - Entity to transform\n * @param excludeFields - Fields to exclude\n * @returns Transformed entity\n */\n protected transformForExport(entity: T, excludeFields?: string[]): Record<string, unknown> {\n return this.filterFields(entity, excludeFields);\n }\n\n /**\n * Validate export options\n *\n * Override this to add custom validation for export options.\n *\n * @param options - Export options to validate\n * @throws Error if options are invalid\n */\n protected validateOptions(options: ExportOptions): void {\n const validFormats = ['csv', 'json', 'xlsx'];\n if (!validFormats.includes(options.format)) {\n throw new Error(`Invalid export format: ${options.format}. Valid formats: ${validFormats.join(', ')}`);\n }\n }\n\n /**\n * Get supported export formats\n *\n * @returns Array of supported format strings\n */\n getSupportedFormats(): string[] {\n return ['csv', 'json', 'xlsx'];\n }\n\n /**\n * Get module metadata\n *\n * @returns Module metadata object\n */\n getMetadata(): {\n moduleKey?: string;\n displayName?: string;\n description?: string;\n supportedProducts?: string[];\n supportedFormats: string[];\n } {\n return {\n moduleKey: this.moduleKey,\n displayName: this.displayName,\n description: this.description,\n supportedProducts: this.supportedProducts,\n supportedFormats: this.getSupportedFormats(),\n };\n }\n}\n","/**\n * Pagination Service\n *\n * Provides pagination utilities for export operations across all Burdenoff microservices.\n * Supports both offset-based and cursor-based pagination strategies.\n *\n * @module export/pagination\n *\n * @example\n * ```typescript\n * import { PaginationService } from '@burdenoff/be-sdk/export';\n *\n * // Offset-based pagination\n * const result = PaginationService.paginate(items, { page: 2, pageSize: 20 });\n *\n * // Cursor-based pagination with async generator\n * for await (const item of PaginationService.paginatedQuery(fetchFn, { limit: 100 })) {\n * console.log(item);\n * }\n * ```\n */\n\nimport type { PaginatedQueryOptions, PaginatedResult, PaginationParams } from './types.js';\n\n/**\n * Service providing pagination utilities for export and data fetching operations\n */\nexport class PaginationService {\n /**\n * Paginate an array of items using offset-based pagination\n *\n * @param items - Array of items to paginate\n * @param params - Pagination parameters\n * @returns Paginated result with items and metadata\n *\n * @example\n * ```typescript\n * const allUsers = await db.user.findMany();\n * const page = PaginationService.paginate(allUsers, { page: 1, pageSize: 10 });\n * console.log(page.items); // First 10 users\n * console.log(page.pageInfo.hasNextPage); // true if more pages exist\n * ```\n */\n static paginate<T>(items: T[], params: PaginationParams): PaginatedResult<T> {\n const page = params.page ?? 1;\n const pageSize = params.pageSize ?? 20;\n const start = (page - 1) * pageSize;\n const end = start + pageSize;\n\n const paginatedItems = items.slice(start, end);\n\n return {\n items: paginatedItems,\n totalCount: items.length,\n pageInfo: {\n hasNextPage: end < items.length,\n hasPreviousPage: page > 1,\n startCursor: paginatedItems.length > 0 ? String(start) : undefined,\n endCursor: paginatedItems.length > 0 ? String(Math.min(end, items.length) - 1) : undefined,\n },\n };\n }\n\n /**\n * Calculate pagination metadata without slicing data\n *\n * @param totalCount - Total number of items\n * @param page - Current page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Pagination metadata\n *\n * @example\n * ```typescript\n * const meta = PaginationService.calculatePagination(150, 3, 20);\n * // meta.hasNextPage = true (page 4 exists)\n * // meta.hasPreviousPage = true (page 2 exists)\n * // meta.totalPages = 8\n * ```\n */\n static calculatePagination(\n totalCount: number,\n page: number,\n pageSize: number\n ): {\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n totalPages: number;\n currentPage: number;\n pageSize: number;\n startIndex: number;\n endIndex: number;\n } {\n const totalPages = Math.ceil(totalCount / pageSize);\n const startIndex = (page - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalCount - 1);\n\n return {\n hasNextPage: page < totalPages,\n hasPreviousPage: page > 1,\n totalPages,\n currentPage: page,\n pageSize,\n startIndex,\n endIndex,\n };\n }\n\n /**\n * Async generator for paginated database queries using cursor-based pagination\n *\n * This is ideal for processing large datasets without loading everything into memory.\n * The generator yields items one at a time, fetching new batches as needed.\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Async generator of items\n *\n * @example\n * ```typescript\n * // Define fetch function that queries the database\n * const fetchUsers = async (cursor?: string) => {\n * return db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * });\n * };\n *\n * // Process all users without loading all into memory\n * for await (const user of PaginationService.paginatedQuery(fetchUsers)) {\n * await processUser(user);\n * }\n * ```\n */\n static async *paginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): AsyncGenerator<T, void, unknown> {\n const { limit, initialCursor } = options;\n let cursor = initialCursor;\n let hasMore = true;\n let totalYielded = 0;\n\n while (hasMore) {\n const items = await fetchFn(cursor);\n\n if (items.length === 0) {\n break;\n }\n\n for (const item of items) {\n yield item;\n totalYielded++;\n\n if (limit && totalYielded >= limit) {\n return;\n }\n }\n\n // Get next cursor from last item\n const lastItem = items[items.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than expected batch size, we're done\n // Note: This assumes fetchFn respects a consistent batch size internally\n hasMore = items.length > 0;\n }\n }\n\n /**\n * Collect all items from a paginated query into an array\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Array of all items\n *\n * @example\n * ```typescript\n * const allUsers = await PaginationService.collectPaginatedQuery(fetchUsers, { limit: 1000 });\n * ```\n */\n static async collectPaginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): Promise<T[]> {\n const items: T[] = [];\n\n for await (const item of PaginationService.paginatedQuery(fetchFn, options)) {\n items.push(item);\n }\n\n return items;\n }\n\n /**\n * Create a cursor-based paginated fetch function from a Prisma-style query\n *\n * @param queryFn - Prisma-style query function\n * @param batchSize - Number of items to fetch per batch\n * @returns Fetch function compatible with paginatedQuery\n *\n * @example\n * ```typescript\n * const fetchFn = PaginationService.createPrismaFetchFn(\n * (cursor) => db.user.findMany({\n * where: { isActive: true, ...(cursor ? { id: { gt: cursor } } : {}) },\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n *\n * for await (const user of PaginationService.paginatedQuery(fetchFn)) {\n * console.log(user);\n * }\n * ```\n */\n static createPrismaFetchFn<T extends { id: string }>(\n queryFn: (cursor?: string) => Promise<T[]>,\n _batchSize: number = 100\n ): (cursor?: string) => Promise<T[]> {\n return queryFn;\n }\n\n /**\n * Calculate offset for skip-based pagination\n *\n * @param page - Page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Offset value for skip\n */\n static calculateOffset(page: number, pageSize: number): number {\n return (Math.max(1, page) - 1) * pageSize;\n }\n\n /**\n * Parse cursor string to extract pagination state\n *\n * @param cursor - Base64-encoded cursor string\n * @returns Decoded cursor data or null if invalid\n */\n static parseCursor<T = Record<string, unknown>>(cursor: string): T | null {\n try {\n const decoded = Buffer.from(cursor, 'base64').toString('utf-8');\n return JSON.parse(decoded) as T;\n } catch {\n return null;\n }\n }\n\n /**\n * Create cursor string from pagination state\n *\n * @param data - Data to encode in cursor\n * @returns Base64-encoded cursor string\n */\n static createCursor(data: Record<string, unknown>): string {\n return Buffer.from(JSON.stringify(data)).toString('base64');\n }\n}\n","/**\n * CSV Utilities\n *\n * Utilities for converting data to CSV format for export operations.\n *\n * @module export/csv\n *\n * @example\n * ```typescript\n * import { convertToCSV, parseCSV } from '@burdenoff/be-sdk/export';\n *\n * const csv = convertToCSV(users, { includeHeaders: true });\n * console.log(csv);\n * ```\n */\n\nimport type { CSVConversionOptions } from './types.js';\n\nconst FORMULA_PREFIX_RE = /^[=+\\-@]/;\n\nexport function sanitizeCSVCell(value: string): string {\n return FORMULA_PREFIX_RE.test(value) ? `'${value}` : value;\n}\n\n/**\n * Convert an array of objects to CSV format\n *\n * Handles nested objects by flattening them with dot notation.\n * Arrays are JSON stringified.\n * Dates are converted to ISO strings.\n *\n * @param data - Array of objects to convert\n * @param options - CSV conversion options\n * @returns CSV string\n *\n * @example\n * ```typescript\n * const users = [\n * { id: 1, name: 'John', address: { city: 'NYC' } },\n * { id: 2, name: 'Jane', address: { city: 'LA' } },\n * ];\n *\n * const csv = convertToCSV(users);\n * // Output:\n * // id,name,address.city\n * // 1,John,NYC\n * // 2,Jane,LA\n * ```\n */\nexport function convertToCSV(data: unknown[], options: CSVConversionOptions = {}): string {\n const { delimiter = ',', includeHeaders = true, flattenFields = true, maxFlattenDepth = 3 } = options;\n\n if (data.length === 0) {\n return '';\n }\n\n // Flatten objects and get all keys\n const flattenObject = (obj: unknown, prefix = '', depth = 0): Record<string, string> => {\n const result: Record<string, string> = {};\n\n if (obj === null || obj === undefined) {\n return result;\n }\n\n if (typeof obj !== 'object') {\n return { [prefix || 'value']: String(obj) };\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n\n if (value === null || value === undefined) {\n result[newKey] = '';\n } else if (value instanceof Date) {\n result[newKey] = value.toISOString();\n } else if (Array.isArray(value)) {\n result[newKey] = JSON.stringify(value);\n } else if (typeof value === 'object' && flattenFields && depth < maxFlattenDepth) {\n Object.assign(result, flattenObject(value, newKey, depth + 1));\n } else if (typeof value === 'object') {\n result[newKey] = JSON.stringify(value);\n } else {\n result[newKey] = String(value);\n }\n }\n\n return result;\n };\n\n // Flatten all records and collect all keys\n const flattenedRecords = data.map((item) => flattenObject(item));\n const allKeys = new Set<string>();\n for (const record of flattenedRecords) {\n for (const key of Object.keys(record)) {\n allKeys.add(key);\n }\n }\n\n const headers = Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n\n // Escape CSV values\n const escapeCSV = (value: string): string => {\n const sanitizedValue = sanitizeCSVCell(value);\n\n if (\n sanitizedValue.includes(delimiter) ||\n sanitizedValue.includes('\"') ||\n sanitizedValue.includes('\\n') ||\n sanitizedValue.includes('\\r')\n ) {\n return `\"${sanitizedValue.replace(/\"/g, '\"\"')}\"`;\n }\n return sanitizedValue;\n };\n\n // Build CSV\n const lines: string[] = [];\n\n if (includeHeaders) {\n lines.push(headers.map(escapeCSV).join(delimiter));\n }\n\n for (const record of flattenedRecords) {\n const row = headers.map((header) => escapeCSV(record[header] || ''));\n lines.push(row.join(delimiter));\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Parse a CSV string into an array of objects\n *\n * @param csv - CSV string to parse\n * @param options - Parse options\n * @returns Array of parsed objects\n *\n * @example\n * ```typescript\n * const csv = 'id,name\\n1,John\\n2,Jane';\n * const data = parseCSV(csv);\n * // [{ id: '1', name: 'John' }, { id: '2', name: 'Jane' }]\n * ```\n */\nexport function parseCSV(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean } = {}\n): Record<string, string>[] {\n const { delimiter = ',', hasHeaders = true } = options;\n\n const lines = csv.split(/\\r?\\n/).filter((line) => line.trim());\n\n if (lines.length === 0) {\n return [];\n }\n\n // Parse a single CSV line, handling quoted values\n const parseLine = (line: string): string[] => {\n const values: string[] = [];\n let current = '';\n let inQuotes = false;\n\n let i = 0;\n while (i < line.length) {\n const char = line[i];\n const nextChar = line[i + 1];\n\n if (char === '\"' && inQuotes && nextChar === '\"') {\n current += '\"';\n i += 2; // Skip next quote\n } else if (char === '\"') {\n inQuotes = !inQuotes;\n i++;\n } else if (char === delimiter && !inQuotes) {\n values.push(current);\n current = '';\n i++;\n } else {\n current += char;\n i++;\n }\n }\n\n values.push(current);\n return values;\n };\n\n let headers: string[];\n let dataLines: string[];\n\n // We've already checked that lines.length > 0, so lines[0] is guaranteed to exist\n const firstLine = lines[0] as string;\n\n if (hasHeaders) {\n headers = parseLine(firstLine);\n dataLines = lines.slice(1);\n } else {\n // Generate numeric headers if no header row\n const firstRow = parseLine(firstLine);\n headers = firstRow.map((_, i) => `col${i}`);\n dataLines = lines;\n }\n\n return dataLines.map((line) => {\n const values = parseLine(line);\n const obj: Record<string, string> = {};\n\n headers.forEach((header, i) => {\n obj[header] = values[i] || '';\n });\n\n return obj;\n });\n}\n\n/**\n * Convert CSV to JSON string\n *\n * @param csv - CSV string\n * @param options - Parse options\n * @returns JSON string\n */\nexport function csvToJSON(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean; pretty?: boolean } = {}\n): string {\n const { pretty = false, ...parseOptions } = options;\n const data = parseCSV(csv, parseOptions);\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);\n}\n\n/**\n * Get CSV headers from data\n *\n * @param data - Array of objects\n * @param flattenFields - Whether to flatten nested objects\n * @returns Array of header strings\n */\nexport function getCSVHeaders(data: unknown[], flattenFields: boolean = true): string[] {\n if (data.length === 0) {\n return [];\n }\n\n const collectKeys = (obj: unknown, prefix = '', depth = 0): string[] => {\n const keys: string[] = [];\n\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return prefix ? [prefix] : [];\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n flattenFields &&\n depth < 3\n ) {\n keys.push(...collectKeys(value, fullKey, depth + 1));\n } else {\n keys.push(fullKey);\n }\n }\n\n return keys;\n };\n\n const allKeys = new Set<string>();\n for (const item of data) {\n for (const key of collectKeys(item)) {\n allKeys.add(key);\n }\n }\n\n return Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Estimate CSV file size for a dataset\n *\n * @param data - Array of objects\n * @param sampleSize - Number of records to sample for estimation\n * @returns Estimated size in bytes\n */\nexport function estimateCSVSize(data: unknown[], sampleSize: number = 100): number {\n if (data.length === 0) {\n return 0;\n }\n\n // Take a sample to estimate average row size\n const sample = data.slice(0, Math.min(sampleSize, data.length));\n const sampleCSV = convertToCSV(sample);\n const averageRowSize = sampleCSV.length / sample.length;\n\n // Estimate total size (headers + data rows)\n const headers = getCSVHeaders(data);\n const headerSize = headers.join(',').length + 1; // +1 for newline\n\n return Math.ceil(headerSize + averageRowSize * data.length);\n}\n","/**\n * Export Gateway Helper\n *\n * Centralised wrapper around the workspace internal gateway's\n * `createExportJob` mutation, used by per-svc convenience resolvers\n * (e.g. `createTagsExportJob`, `createGroupsExportJob`).\n *\n * Replaces the duplicated `src/clients/export-gateway.ts` files that\n * existed in 19+ workspace svcs.\n *\n * @module export/gateway-client\n *\n * @example\n * ```typescript\n * import { triggerExportJob } from '@burdenoff/be-sdk/export';\n *\n * const result = await triggerExportJob({\n * serviceName: 'wspace-tags-svc',\n * workspaceId: ctx.workspaceId,\n * name: input.name,\n * entityTypes: ['tags', 'vocabularies'],\n * format: input.format,\n * actorId: ctx.actorId,\n * actorType: ctx.actorType,\n * });\n * ```\n */\n\nimport { GatewayClient } from '../gateway/index.js';\nimport type { ServiceLayer } from '../types/layer.js';\n\nconst CREATE_EXPORT_JOB_MUTATION = `mutation CreateExportJob($input: CreateExportJobInput!) {\n createExportJob(input: $input) {\n id\n status\n workspaceId\n entityTypes\n format\n createdAt\n }\n}`;\n\nexport type ExportActorType = 'user' | 'app' | 'service' | 'super_admin';\nexport type ExportFormatGql = 'JSON' | 'CSV';\n\nexport interface TriggerExportJobParams {\n /** Caller service name, used by gateway client telemetry/auth */\n serviceName: string;\n /** Layer for the gateway. Defaults to `wspace`. */\n layer?: ServiceLayer;\n /** Workspace context (required for wspace exports). */\n workspaceId: string;\n /** Human-readable name for the export job. */\n name: string;\n /** Entity types registered in `wspace-export-svc` to include. */\n entityTypes: string[];\n /** Output format. */\n format: ExportFormatGql;\n /** Actor making the request (forwarded to RBAC). */\n actorId: string;\n actorType: ExportActorType;\n /** Whether to include extended metadata in the export ZIP. */\n includeMetadata?: boolean;\n /** Optional ISO date-range bounds. */\n dateRangeStart?: string;\n dateRangeEnd?: string;\n}\n\nexport interface ExportJobResult {\n id: string;\n status: string;\n workspaceId: string;\n entityTypes: string[];\n format: string;\n createdAt: string;\n}\n\ninterface CreateExportJobResponse {\n createExportJob?: ExportJobResult;\n}\n\n/**\n * Submit a `createExportJob` mutation to the workspace internal gateway.\n *\n * The caller is expected to map the returned `ExportJobResult` to its\n * own GraphQL output type (the per-svc `ExportJobResponse`).\n */\nexport async function triggerExportJob(params: TriggerExportJobParams): Promise<ExportJobResult> {\n const {\n serviceName,\n layer = 'wspace',\n actorId,\n actorType,\n workspaceId,\n name,\n entityTypes,\n format,\n includeMetadata,\n dateRangeStart,\n dateRangeEnd,\n } = params;\n\n const client = new GatewayClient({ layer, serviceName });\n\n const input = {\n workspaceId,\n name,\n entityTypes,\n format,\n ...(includeMetadata !== undefined ? { includeMetadata } : {}),\n ...(dateRangeStart !== undefined ? { dateRangeStart } : {}),\n ...(dateRangeEnd !== undefined ? { dateRangeEnd } : {}),\n };\n\n const response = await client.internalQuery<CreateExportJobResponse>({\n query: CREATE_EXPORT_JOB_MUTATION,\n variables: { input },\n headers: {\n 'x-actor-id': actorId,\n 'x-actor-type': actorType,\n 'x-workspace-id': workspaceId,\n },\n });\n\n const job = response.data?.createExportJob;\n if (!job) {\n throw new Error('Export service did not return a job');\n }\n return job;\n}\n"]}
|
package/dist/export/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { BaseModuleExporter, PaginationService, convertToCSV, csvToJSON, estimateCSVSize, getCSVHeaders, parseCSV, triggerExportJob } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { BaseModuleExporter, PaginationService, convertToCSV, csvToJSON, estimateCSVSize, getCSVHeaders, parseCSV, triggerExportJob } from '../chunk-MYK6X4RS.js';
|
|
2
|
+
import '../chunk-BOKCGHLE.js';
|
|
3
3
|
import '../chunk-KXY4RSYI.js';
|
|
4
4
|
import '../chunk-FZRODKIN.js';
|
|
5
5
|
import '../chunk-5NT2OEDQ.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { E as EvaluationContext, F as FeatureFlagProvider, a as FeatureFlagProviderConfig, b as FlagEvaluation, c as FlagType, G as GatedOperationType, O as OperationsFlagGatePluginOptions, R as ResolutionDetails, d as createOperationsFlagGatePlugin } from '../index-
|
|
2
|
-
import '../types-
|
|
1
|
+
export { E as EvaluationContext, F as FeatureFlagProvider, a as FeatureFlagProviderConfig, b as FlagEvaluation, c as FlagType, G as GatedOperationType, O as OperationsFlagGatePluginOptions, R as ResolutionDetails, d as createOperationsFlagGatePlugin } from '../index-Rc5EphmY.js';
|
|
2
|
+
import '../types-C-6m9NoG.js';
|
|
3
3
|
import 'graphql';
|
|
4
4
|
import 'graphql-yoga';
|
|
5
5
|
import '../client-CCXpAZ2r.js';
|
|
6
6
|
import '@prisma/adapter-pg';
|
|
7
7
|
import 'pg';
|
|
8
|
-
import '../workspace-extension-
|
|
8
|
+
import '../workspace-extension-DiNiTLa3.js';
|
|
9
9
|
import '../types-C8TbSdEj.js';
|
package/dist/gateway/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CircuitState, GatewayClient, GatewayError, GatewayErrorType, createGatewayClient, createGatewayClientFromEnv } from '../chunk-
|
|
1
|
+
export { CircuitState, GatewayClient, GatewayError, GatewayErrorType, createGatewayClient, createGatewayClientFromEnv } from '../chunk-BOKCGHLE.js';
|
|
2
2
|
export { security_exports as Security } from '../chunk-KXY4RSYI.js';
|
|
3
3
|
import '../chunk-FZRODKIN.js';
|
|
4
4
|
import '../chunk-5NT2OEDQ.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as PrismaClientBase, b as PrismaClientWrapper, c as PrismaClientConfig, a as PrismaClientConstructorOptions, D as DatabaseReturnType, d as DatabaseHealth, C as ConnectionState, e as PrismaEvent, f as PrismaLogDefinition, g as PrismaLogEvent, h as PrismaLogLevel, i as PrismaQueryEvent, j as PrismaTransactionOptions, k as configurePrismaLogging, l as createConnectionPool, m as createPrismaAdapter, n as createPrismaClient, o as ensureServiceApplicationName, p as installAcquireRetry, q as isTransientAcquireError } from './client-CCXpAZ2r.js';
|
|
2
2
|
import { G as GraphEventEmitter } from './prisma-extension-krXnYnrN.js';
|
|
3
|
-
import { W as WorkspaceExtensionConfig, a as WorkspaceContext, b as addWorkspaceExtension, d as defaultWorkspaceExtensionConfig, g as getWorkspaceContext, i as injectCreateFields,
|
|
3
|
+
import { W as WorkspaceExtensionConfig, C as CallerTransaction, P as PrismaQueryInternalParams, R as RawPrismaForCallerTransaction, T as TransactionContextStatement, a as WorkspaceContext, b as addWorkspaceExtension, c as buildTransactionContextStatement, d as defaultWorkspaceExtensionConfig, g as getCallerTransaction, e as getWorkspaceContext, i as injectCreateFields, f as injectWhereWorkspaceId, m as maybeSetRlsGuc, h as maybeTagConnection, r as resetCallerTransactionStateForTests, j as runOperationInCallerTransaction, k as runOperationWithRlsGuc, s as setWorkspaceContext, w as withWorkspaceContext, l as withWorkspaceContextSync } from './workspace-extension-DiNiTLa3.js';
|
|
4
4
|
|
|
5
5
|
interface DatabaseClientConfig extends PrismaClientConfig {
|
|
6
6
|
productName: string;
|
|
@@ -114,6 +114,7 @@ declare function createContextFromSDK(sdkContext: {
|
|
|
114
114
|
organizationId?: string;
|
|
115
115
|
}): OperationContext;
|
|
116
116
|
|
|
117
|
+
declare const index_CallerTransaction: typeof CallerTransaction;
|
|
117
118
|
declare const index_ConnectionState: typeof ConnectionState;
|
|
118
119
|
type index_ContextFilterInput = ContextFilterInput;
|
|
119
120
|
type index_ContextWhereCondition = ContextWhereCondition;
|
|
@@ -138,12 +139,16 @@ declare const index_PrismaLogDefinition: typeof PrismaLogDefinition;
|
|
|
138
139
|
declare const index_PrismaLogEvent: typeof PrismaLogEvent;
|
|
139
140
|
declare const index_PrismaLogLevel: typeof PrismaLogLevel;
|
|
140
141
|
declare const index_PrismaQueryEvent: typeof PrismaQueryEvent;
|
|
142
|
+
declare const index_PrismaQueryInternalParams: typeof PrismaQueryInternalParams;
|
|
141
143
|
declare const index_PrismaTransactionOptions: typeof PrismaTransactionOptions;
|
|
144
|
+
declare const index_RawPrismaForCallerTransaction: typeof RawPrismaForCallerTransaction;
|
|
145
|
+
declare const index_TransactionContextStatement: typeof TransactionContextStatement;
|
|
142
146
|
declare const index_WorkspaceContext: typeof WorkspaceContext;
|
|
143
147
|
declare const index_WorkspaceExtensionConfig: typeof WorkspaceExtensionConfig;
|
|
144
148
|
declare const index_addWorkspaceExtension: typeof addWorkspaceExtension;
|
|
145
149
|
declare const index_buildContextWhereClause: typeof buildContextWhereClause;
|
|
146
150
|
declare const index_buildContextWhereConditions: typeof buildContextWhereConditions;
|
|
151
|
+
declare const index_buildTransactionContextStatement: typeof buildTransactionContextStatement;
|
|
147
152
|
declare const index_checkDatabaseHealth: typeof checkDatabaseHealth;
|
|
148
153
|
declare const index_configurePrismaLogging: typeof configurePrismaLogging;
|
|
149
154
|
declare const index_contextMatches: typeof contextMatches;
|
|
@@ -157,6 +162,7 @@ declare const index_defaultWorkspaceExtensionConfig: typeof defaultWorkspaceExte
|
|
|
157
162
|
declare const index_ensureServiceApplicationName: typeof ensureServiceApplicationName;
|
|
158
163
|
declare const index_extractFieldsFromModel: typeof extractFieldsFromModel;
|
|
159
164
|
declare const index_getAllModelNames: typeof getAllModelNames;
|
|
165
|
+
declare const index_getCallerTransaction: typeof getCallerTransaction;
|
|
160
166
|
declare const index_getDatabaseManager: typeof getDatabaseManager;
|
|
161
167
|
declare const index_getDatabaseProductName: typeof getDatabaseProductName;
|
|
162
168
|
declare const index_getDatabaseStats: typeof getDatabaseStats;
|
|
@@ -177,8 +183,10 @@ declare const index_maybeSetRlsGuc: typeof maybeSetRlsGuc;
|
|
|
177
183
|
declare const index_maybeTagConnection: typeof maybeTagConnection;
|
|
178
184
|
declare const index_mergeContext: typeof mergeContext;
|
|
179
185
|
declare const index_parseContext: typeof parseContext;
|
|
186
|
+
declare const index_resetCallerTransactionStateForTests: typeof resetCallerTransactionStateForTests;
|
|
180
187
|
declare const index_resetDatabaseManager: typeof resetDatabaseManager;
|
|
181
188
|
declare const index_resolvePoolTuningFromEnv: typeof resolvePoolTuningFromEnv;
|
|
189
|
+
declare const index_runOperationInCallerTransaction: typeof runOperationInCallerTransaction;
|
|
182
190
|
declare const index_runOperationWithRlsGuc: typeof runOperationWithRlsGuc;
|
|
183
191
|
declare const index_setWorkspaceContext: typeof setWorkspaceContext;
|
|
184
192
|
declare const index_testConnection: typeof testConnection;
|
|
@@ -186,7 +194,7 @@ declare const index_toContextJson: typeof toContextJson;
|
|
|
186
194
|
declare const index_withWorkspaceContext: typeof withWorkspaceContext;
|
|
187
195
|
declare const index_withWorkspaceContextSync: typeof withWorkspaceContextSync;
|
|
188
196
|
declare namespace index {
|
|
189
|
-
export { index_ConnectionState as ConnectionState, type index_ContextFilterInput as ContextFilterInput, type index_ContextWhereCondition as ContextWhereCondition, type index_DatabaseClient as DatabaseClient, type index_DatabaseClientConfig as DatabaseClientConfig, index_DatabaseHealth as DatabaseHealth, index_DatabaseReturnType as DatabaseReturnType, type index_FieldExtractionOptions as FieldExtractionOptions, type index_FieldExtractionResult as FieldExtractionResult, type index_InputJsonValue as InputJsonValue, type index_JsonValue as JsonValue, type index_ModelFieldsMap as ModelFieldsMap, type index_OperationContext as OperationContext, type index_PoolTuningEnv as PoolTuningEnv, index_PrismaClientBase as PrismaClientBase, index_PrismaClientConfig as PrismaClientConfig, index_PrismaClientConstructorOptions as PrismaClientConstructorOptions, index_PrismaClientWrapper as PrismaClientWrapper, index_PrismaEvent as PrismaEvent, type index_PrismaJsonFilter as PrismaJsonFilter, index_PrismaLogDefinition as PrismaLogDefinition, index_PrismaLogEvent as PrismaLogEvent, index_PrismaLogLevel as PrismaLogLevel, index_PrismaQueryEvent as PrismaQueryEvent, index_PrismaTransactionOptions as PrismaTransactionOptions, index_WorkspaceContext as WorkspaceContext, index_WorkspaceExtensionConfig as WorkspaceExtensionConfig, index_addWorkspaceExtension as addWorkspaceExtension, index_buildContextWhereClause as buildContextWhereClause, index_buildContextWhereConditions as buildContextWhereConditions, index_checkDatabaseHealth as checkDatabaseHealth, index_configurePrismaLogging as configurePrismaLogging, index_contextMatches as contextMatches, index_createConnectionPool as createConnectionPool, index_createContextFromSDK as createContextFromSDK, index_createDatabaseClient as createDatabaseClient, index_createDatabaseClientFromEnv as createDatabaseClientFromEnv, index_createPrismaAdapter as createPrismaAdapter, index_createPrismaClient as createPrismaClient, index_defaultWorkspaceExtensionConfig as defaultWorkspaceExtensionConfig, index_ensureServiceApplicationName as ensureServiceApplicationName, index_extractFieldsFromModel as extractFieldsFromModel, index_getAllModelNames as getAllModelNames, index_getDatabaseManager as getDatabaseManager, index_getDatabaseProductName as getDatabaseProductName, index_getDatabaseStats as getDatabaseStats, index_getDatabaseVersion as getDatabaseVersion, index_getDb as getDb, index_getModelFields as getModelFields, index_getWorkspaceContext as getWorkspaceContext, index_hasModel as hasModel, index_initializeDatabase as initializeDatabase, index_initializeDatabaseWithConfig as initializeDatabaseWithConfig, index_injectCreateFields as injectCreateFields, index_injectWhereWorkspaceId as injectWhereWorkspaceId, index_installAcquireRetry as installAcquireRetry, index_isDatabaseInitialized as isDatabaseInitialized, index_isTransientAcquireError as isTransientAcquireError, index_loadGeneratedFields as loadGeneratedFields, index_maybeSetRlsGuc as maybeSetRlsGuc, index_maybeTagConnection as maybeTagConnection, index_mergeContext as mergeContext, index_parseContext as parseContext, index_resetDatabaseManager as resetDatabaseManager, index_resolvePoolTuningFromEnv as resolvePoolTuningFromEnv, index_runOperationWithRlsGuc as runOperationWithRlsGuc, index_setWorkspaceContext as setWorkspaceContext, index_testConnection as testConnection, index_toContextJson as toContextJson, index_withWorkspaceContext as withWorkspaceContext, index_withWorkspaceContextSync as withWorkspaceContextSync };
|
|
197
|
+
export { index_CallerTransaction as CallerTransaction, index_ConnectionState as ConnectionState, type index_ContextFilterInput as ContextFilterInput, type index_ContextWhereCondition as ContextWhereCondition, type index_DatabaseClient as DatabaseClient, type index_DatabaseClientConfig as DatabaseClientConfig, index_DatabaseHealth as DatabaseHealth, index_DatabaseReturnType as DatabaseReturnType, type index_FieldExtractionOptions as FieldExtractionOptions, type index_FieldExtractionResult as FieldExtractionResult, type index_InputJsonValue as InputJsonValue, type index_JsonValue as JsonValue, type index_ModelFieldsMap as ModelFieldsMap, type index_OperationContext as OperationContext, type index_PoolTuningEnv as PoolTuningEnv, index_PrismaClientBase as PrismaClientBase, index_PrismaClientConfig as PrismaClientConfig, index_PrismaClientConstructorOptions as PrismaClientConstructorOptions, index_PrismaClientWrapper as PrismaClientWrapper, index_PrismaEvent as PrismaEvent, type index_PrismaJsonFilter as PrismaJsonFilter, index_PrismaLogDefinition as PrismaLogDefinition, index_PrismaLogEvent as PrismaLogEvent, index_PrismaLogLevel as PrismaLogLevel, index_PrismaQueryEvent as PrismaQueryEvent, index_PrismaQueryInternalParams as PrismaQueryInternalParams, index_PrismaTransactionOptions as PrismaTransactionOptions, index_RawPrismaForCallerTransaction as RawPrismaForCallerTransaction, index_TransactionContextStatement as TransactionContextStatement, index_WorkspaceContext as WorkspaceContext, index_WorkspaceExtensionConfig as WorkspaceExtensionConfig, index_addWorkspaceExtension as addWorkspaceExtension, index_buildContextWhereClause as buildContextWhereClause, index_buildContextWhereConditions as buildContextWhereConditions, index_buildTransactionContextStatement as buildTransactionContextStatement, index_checkDatabaseHealth as checkDatabaseHealth, index_configurePrismaLogging as configurePrismaLogging, index_contextMatches as contextMatches, index_createConnectionPool as createConnectionPool, index_createContextFromSDK as createContextFromSDK, index_createDatabaseClient as createDatabaseClient, index_createDatabaseClientFromEnv as createDatabaseClientFromEnv, index_createPrismaAdapter as createPrismaAdapter, index_createPrismaClient as createPrismaClient, index_defaultWorkspaceExtensionConfig as defaultWorkspaceExtensionConfig, index_ensureServiceApplicationName as ensureServiceApplicationName, index_extractFieldsFromModel as extractFieldsFromModel, index_getAllModelNames as getAllModelNames, index_getCallerTransaction as getCallerTransaction, index_getDatabaseManager as getDatabaseManager, index_getDatabaseProductName as getDatabaseProductName, index_getDatabaseStats as getDatabaseStats, index_getDatabaseVersion as getDatabaseVersion, index_getDb as getDb, index_getModelFields as getModelFields, index_getWorkspaceContext as getWorkspaceContext, index_hasModel as hasModel, index_initializeDatabase as initializeDatabase, index_initializeDatabaseWithConfig as initializeDatabaseWithConfig, index_injectCreateFields as injectCreateFields, index_injectWhereWorkspaceId as injectWhereWorkspaceId, index_installAcquireRetry as installAcquireRetry, index_isDatabaseInitialized as isDatabaseInitialized, index_isTransientAcquireError as isTransientAcquireError, index_loadGeneratedFields as loadGeneratedFields, index_maybeSetRlsGuc as maybeSetRlsGuc, index_maybeTagConnection as maybeTagConnection, index_mergeContext as mergeContext, index_parseContext as parseContext, index_resetCallerTransactionStateForTests as resetCallerTransactionStateForTests, index_resetDatabaseManager as resetDatabaseManager, index_resolvePoolTuningFromEnv as resolvePoolTuningFromEnv, index_runOperationInCallerTransaction as runOperationInCallerTransaction, index_runOperationWithRlsGuc as runOperationWithRlsGuc, index_setWorkspaceContext as setWorkspaceContext, index_testConnection as testConnection, index_toContextJson as toContextJson, index_withWorkspaceContext as withWorkspaceContext, index_withWorkspaceContextSync as withWorkspaceContextSync };
|
|
190
198
|
}
|
|
191
199
|
|
|
192
200
|
export { parseContext as A, resetDatabaseManager as B, type ContextFilterInput as C, type DatabaseClient as D, resolvePoolTuningFromEnv as E, type FieldExtractionOptions as F, testConnection as G, toContextJson as H, type InputJsonValue as I, type JsonValue as J, type ModelFieldsMap as M, type OperationContext as O, type PoolTuningEnv as P, type ContextWhereCondition as a, type DatabaseClientConfig as b, type FieldExtractionResult as c, type PrismaJsonFilter as d, buildContextWhereClause as e, buildContextWhereConditions as f, checkDatabaseHealth as g, contextMatches as h, index as i, createContextFromSDK as j, createDatabaseClient as k, createDatabaseClientFromEnv as l, extractFieldsFromModel as m, getAllModelNames as n, getDatabaseManager as o, getDatabaseProductName as p, getDatabaseStats as q, getDatabaseVersion as r, getDb as s, getModelFields as t, hasModel as u, initializeDatabase as v, initializeDatabaseWithConfig as w, isDatabaseInitialized as x, loadGeneratedFields as y, mergeContext as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { i as Cache } from './index-Cx5I3ydM.js';
|
|
|
24
24
|
export { i as Middleware } from './index-DSOpj8DI.js';
|
|
25
25
|
export { i as Observability } from './index-4gKQKZ2B.js';
|
|
26
26
|
export { i as GraphQL } from './index-joONjwLt.js';
|
|
27
|
-
export { i as Prisma } from './index-
|
|
27
|
+
export { i as Prisma } from './index-Dl8EAdYu.js';
|
|
28
28
|
export { i as Utils } from './index-PaojfSdd.js';
|
|
29
29
|
export { i as I18n, I as I18nCapableContext, T as Translator, c as createTranslator, g as getLanguage, a as getLocale, h as hasI18n, t } from './index-D4l1u8VR.js';
|
|
30
30
|
export { i as Export } from './index-B4ciT3OZ.js';
|
|
@@ -34,20 +34,20 @@ export { i as Instrumentation } from './index-Dvv6irk0.js';
|
|
|
34
34
|
export { i as Layer } from './index-BCUkR8sC.js';
|
|
35
35
|
export { i as Crypto } from './index-e_18DzAg.js';
|
|
36
36
|
export { i as Gateway } from './index-Dy6neH2G.js';
|
|
37
|
-
export { i as FeatureFlags } from './index-
|
|
37
|
+
export { i as FeatureFlags } from './index-Rc5EphmY.js';
|
|
38
38
|
export { i as Captcha, R as RecaptchaVerifyOptions, a as RecaptchaVerifyResult, b as isCaptchaEnabled, v as verifyCaptcha, c as verifyCaptchaIfEnabled } from './index-B70b5mYS.js';
|
|
39
39
|
export { i as Platform } from './index-PJZzGd8r.js';
|
|
40
40
|
export { N as NAME_MAX_LENGTH, a as NAME_MIN_LENGTH, b as NameErrorCode, c as NameValidationResult, U as USERNAME_MAX_LENGTH, d as USERNAME_MIN_LENGTH, e as UserFieldError, f as UserFieldKey, g as UserFieldsValidationResult, h as UsernameErrorCode, i as UsernameValidationResult, V as ValidatedUserFields, j as Validation, l as lengthInCodePoints, v as validateName, k as validateUserFields, m as validateUsername } from './index-B2jIInhp.js';
|
|
41
41
|
export { E as EmitGeneration, P as PRODUCT_RENAMES, a as PRODUCT_RENAME_EMIT, b as PRODUCT_SLUG_ALIASES, i as ProductAlias, c as ProductRename, R as RENAME_CONCERNS, d as RenameConcern, e as billingIdVariants, f as emitBillingId, g as emitName, h as emitProductSlug, j as emitQuotaKey, k as emitRbacResource, l as emitTemplateKey, m as isLegacyName, n as isSameBillingId, o as isSameGraphQLName, p as isSameName, q as isSameProductSlug, r as isSameQuotaKey, s as isSameRbacResource, t as isSameTemplateKey, u as nameVariants, v as normalizeBillingId, w as normalizeGraphQLName, x as normalizeProductSlug, y as normalizeQuotaKey, z as normalizeRbacResource, A as normalizeTemplateKey, B as productSlugVariants, C as quotaKeyVariants, D as rbacResourceVariants, F as readRenamedEnv, G as templateKeyVariants, H as toCurrentName, I as toLegacyName } from './index-BuAj5nXg.js';
|
|
42
42
|
export { C as CircuitBreakerConfig, h as DEFAULT_CIRCUIT_BREAKER_CONFIG, i as DEFAULT_GATEWAY_RETRY_CONFIG, D as DEFAULT_GATEWAY_ROUTING, b as DEFAULT_LAYER_RESOURCES, c as DEFAULT_LAYER_STREAMS, f as GatewayRequestHeaders, g as GatewayRetryConfig, G as GatewayRoutingConfig, L as LayerConfig, a as LayerFullConfig, d as LayerGatewayConfig, e as LayerResourceUrls, S as ServiceLayer } from './layer-GNAVXBMf.js';
|
|
43
43
|
export { S as ShutdownDisposable, d as disposeAll, g as getRegisteredDisposableCount, r as registerDisposable, u as unregisterDisposable } from './shutdown-registry-CW9LryO8.js';
|
|
44
|
-
import './types-
|
|
44
|
+
import './types-C-6m9NoG.js';
|
|
45
45
|
import 'graphql';
|
|
46
46
|
import 'graphql-yoga';
|
|
47
47
|
import './client-CCXpAZ2r.js';
|
|
48
48
|
import '@prisma/adapter-pg';
|
|
49
49
|
import 'pg';
|
|
50
|
-
import './workspace-extension-
|
|
50
|
+
import './workspace-extension-DiNiTLa3.js';
|
|
51
51
|
import './types-C8TbSdEj.js';
|
|
52
52
|
import 'graphql-request';
|
|
53
53
|
import '@envelop/core';
|
package/dist/index.js
CHANGED
|
@@ -5,16 +5,16 @@ export { ActivityModule, TrackerModule, UsageModule } from './chunk-NCC5UN3L.js'
|
|
|
5
5
|
export { NAME_MAX_LENGTH, NAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, validation_exports as Validation, lengthInCodePoints, validateName, validateUserFields, validateUsername } from './chunk-AHEXIONU.js';
|
|
6
6
|
export { observability_exports as Observability } from './chunk-VAT66FJA.js';
|
|
7
7
|
export { platform_exports as Platform } from './chunk-Z5BURBFZ.js';
|
|
8
|
-
export { prisma_exports as Prisma } from './chunk-
|
|
8
|
+
export { prisma_exports as Prisma } from './chunk-EOHPDXXW.js';
|
|
9
9
|
export { PRODUCT_RENAMES, PRODUCT_RENAME_EMIT, PRODUCT_SLUG_ALIASES, product_alias_exports as ProductAlias, RENAME_CONCERNS, billingIdVariants, emitBillingId, emitName, emitProductSlug, emitQuotaKey, emitRbacResource, emitTemplateKey, isLegacyName, isSameBillingId, isSameGraphQLName, isSameName, isSameProductSlug, isSameQuotaKey, isSameRbacResource, isSameTemplateKey, nameVariants, normalizeBillingId, normalizeGraphQLName, normalizeProductSlug, normalizeQuotaKey, normalizeRbacResource, normalizeTemplateKey, productSlugVariants, quotaKeyVariants, rbacResourceVariants, readRenamedEnv, templateKeyVariants, toCurrentName, toLegacyName } from './chunk-OBBCR6WY.js';
|
|
10
10
|
import { RBACModule } from './chunk-5JNHVKHG.js';
|
|
11
11
|
export { RBACModule, createRBACDirective, createRBACDirectiveForLayer, createRBACDirectiveFromEnv } from './chunk-5JNHVKHG.js';
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-CYY4VIRK.js';
|
|
13
13
|
export { instrumentation_exports as Instrumentation } from './chunk-E5DTAGCA.js';
|
|
14
14
|
export { middleware_exports as Middleware } from './chunk-ELU7VL3E.js';
|
|
15
15
|
import { TenantNotificationsModule, NotificationsModule } from './chunk-INAZ3PKF.js';
|
|
16
16
|
export { tenant_notifications_exports as Notifications, NotificationsModule } from './chunk-INAZ3PKF.js';
|
|
17
|
-
export { export_exports as Export } from './chunk-
|
|
17
|
+
export { export_exports as Export } from './chunk-MYK6X4RS.js';
|
|
18
18
|
export { feature_flags_exports as FeatureFlags } from './chunk-UNASM5VJ.js';
|
|
19
19
|
import { GraphModule } from './chunk-VVBA3LQV.js';
|
|
20
20
|
export { graph_exports as Graph, GraphModule } from './chunk-VVBA3LQV.js';
|
|
@@ -27,11 +27,11 @@ export { graphql_exports as GraphQL } from './chunk-KMNSVLDS.js';
|
|
|
27
27
|
import './chunk-MWPYA2HD.js';
|
|
28
28
|
import './chunk-LKCBI6B2.js';
|
|
29
29
|
export { i18n_exports as I18n, createTranslator, getLanguage, getLocale, hasI18n, t } from './chunk-EBDHIL7V.js';
|
|
30
|
-
export { init_exports as Init } from './chunk-
|
|
30
|
+
export { init_exports as Init } from './chunk-3CUOJTE3.js';
|
|
31
31
|
export { RESOURCE_CAP_DEFAULTS, ResourceCapExceededError, ResourceCapsModule, configureResourceCaps, getResourceCaps } from './chunk-MZCBEJ67.js';
|
|
32
32
|
import './chunk-AWPNRV3L.js';
|
|
33
|
-
import { GatewayClient, GatewayError, GatewayErrorType } from './chunk-
|
|
34
|
-
export { gateway_exports as Gateway } from './chunk-
|
|
33
|
+
import { GatewayClient, GatewayError, GatewayErrorType } from './chunk-BOKCGHLE.js';
|
|
34
|
+
export { gateway_exports as Gateway } from './chunk-BOKCGHLE.js';
|
|
35
35
|
import './chunk-KXY4RSYI.js';
|
|
36
36
|
import './chunk-FZRODKIN.js';
|
|
37
37
|
export { layer_exports as Layer } from './chunk-5NT2OEDQ.js';
|
package/dist/init/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getSDKState, initializeBurdenoffSDK, isSDKInitialized, resetSDK } from '../chunk-
|
|
1
|
+
export { getSDKState, initializeBurdenoffSDK, isSDKInitialized, resetSDK } from '../chunk-3CUOJTE3.js';
|
|
2
2
|
import '../chunk-MZCBEJ67.js';
|
|
3
3
|
import '../chunk-AWPNRV3L.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-BOKCGHLE.js';
|
|
5
5
|
import '../chunk-KXY4RSYI.js';
|
|
6
6
|
import '../chunk-FZRODKIN.js';
|
|
7
7
|
import '../chunk-5NT2OEDQ.js';
|
package/dist/prisma/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as ContextFilterInput, a as ContextWhereCondition, D as DatabaseClient, b as DatabaseClientConfig, F as FieldExtractionOptions, c as FieldExtractionResult, I as InputJsonValue, J as JsonValue, M as ModelFieldsMap, O as OperationContext, P as PoolTuningEnv, d as PrismaJsonFilter, e as buildContextWhereClause, f as buildContextWhereConditions, g as checkDatabaseHealth, h as contextMatches, j as createContextFromSDK, k as createDatabaseClient, l as createDatabaseClientFromEnv, m as extractFieldsFromModel, n as getAllModelNames, o as getDatabaseManager, p as getDatabaseProductName, q as getDatabaseStats, r as getDatabaseVersion, s as getDb, t as getModelFields, u as hasModel, v as initializeDatabase, w as initializeDatabaseWithConfig, x as isDatabaseInitialized, y as loadGeneratedFields, z as mergeContext, A as parseContext, B as resetDatabaseManager, E as resolvePoolTuningFromEnv, G as testConnection, H as toContextJson } from '../index-
|
|
1
|
+
export { C as ContextFilterInput, a as ContextWhereCondition, D as DatabaseClient, b as DatabaseClientConfig, F as FieldExtractionOptions, c as FieldExtractionResult, I as InputJsonValue, J as JsonValue, M as ModelFieldsMap, O as OperationContext, P as PoolTuningEnv, d as PrismaJsonFilter, e as buildContextWhereClause, f as buildContextWhereConditions, g as checkDatabaseHealth, h as contextMatches, j as createContextFromSDK, k as createDatabaseClient, l as createDatabaseClientFromEnv, m as extractFieldsFromModel, n as getAllModelNames, o as getDatabaseManager, p as getDatabaseProductName, q as getDatabaseStats, r as getDatabaseVersion, s as getDb, t as getModelFields, u as hasModel, v as initializeDatabase, w as initializeDatabaseWithConfig, x as isDatabaseInitialized, y as loadGeneratedFields, z as mergeContext, A as parseContext, B as resetDatabaseManager, E as resolvePoolTuningFromEnv, G as testConnection, H as toContextJson } from '../index-Dl8EAdYu.js';
|
|
2
2
|
export { C as ConnectionState, d as DatabaseHealth, D as DatabaseReturnType, P as PrismaClientBase, c as PrismaClientConfig, a as PrismaClientConstructorOptions, b as PrismaClientWrapper, e as PrismaEvent, f as PrismaLogDefinition, g as PrismaLogEvent, h as PrismaLogLevel, i as PrismaQueryEvent, j as PrismaTransactionOptions, k as configurePrismaLogging, l as createConnectionPool, m as createPrismaAdapter, n as createPrismaClient, o as ensureServiceApplicationName, p as installAcquireRetry, q as isTransientAcquireError } from '../client-CCXpAZ2r.js';
|
|
3
|
-
export { a as WorkspaceContext, W as WorkspaceExtensionConfig, b as addWorkspaceExtension, d as defaultWorkspaceExtensionConfig, g as getWorkspaceContext, i as injectCreateFields,
|
|
3
|
+
export { C as CallerTransaction, P as PrismaQueryInternalParams, R as RawPrismaForCallerTransaction, T as TransactionContextStatement, a as WorkspaceContext, W as WorkspaceExtensionConfig, b as addWorkspaceExtension, c as buildTransactionContextStatement, d as defaultWorkspaceExtensionConfig, g as getCallerTransaction, e as getWorkspaceContext, i as injectCreateFields, f as injectWhereWorkspaceId, m as maybeSetRlsGuc, h as maybeTagConnection, r as resetCallerTransactionStateForTests, j as runOperationInCallerTransaction, k as runOperationWithRlsGuc, s as setWorkspaceContext, w as withWorkspaceContext, l as withWorkspaceContextSync } from '../workspace-extension-DiNiTLa3.js';
|
|
4
4
|
import '../prisma-extension-krXnYnrN.js';
|
|
5
5
|
import '@prisma/adapter-pg';
|
|
6
6
|
import 'pg';
|
package/dist/prisma/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { buildContextWhereClause, buildContextWhereConditions, checkDatabaseHealth, contextMatches, createContextFromSDK, createDatabaseClient, createDatabaseClientFromEnv, extractFieldsFromModel, getAllModelNames, getDatabaseManager, getDatabaseProductName, getDatabaseStats, getDatabaseVersion, getDb, getModelFields, hasModel, initializeDatabase, initializeDatabaseWithConfig, isDatabaseInitialized, loadGeneratedFields, mergeContext, parseContext, resetDatabaseManager, resolvePoolTuningFromEnv, testConnection, toContextJson } from '../chunk-
|
|
1
|
+
export { buildContextWhereClause, buildContextWhereConditions, checkDatabaseHealth, contextMatches, createContextFromSDK, createDatabaseClient, createDatabaseClientFromEnv, extractFieldsFromModel, getAllModelNames, getDatabaseManager, getDatabaseProductName, getDatabaseStats, getDatabaseVersion, getDb, getModelFields, hasModel, initializeDatabase, initializeDatabaseWithConfig, isDatabaseInitialized, loadGeneratedFields, mergeContext, parseContext, resetDatabaseManager, resolvePoolTuningFromEnv, testConnection, toContextJson } from '../chunk-EOHPDXXW.js';
|
|
2
2
|
import '../chunk-OBBCR6WY.js';
|
|
3
|
-
export { addWorkspaceExtension, defaultWorkspaceExtensionConfig, getWorkspaceContext, injectCreateFields, injectWhereWorkspaceId, maybeSetRlsGuc, maybeTagConnection, runOperationWithRlsGuc, setWorkspaceContext, withWorkspaceContext, withWorkspaceContextSync } from '../chunk-
|
|
3
|
+
export { addWorkspaceExtension, buildTransactionContextStatement, defaultWorkspaceExtensionConfig, getCallerTransaction, getWorkspaceContext, injectCreateFields, injectWhereWorkspaceId, maybeSetRlsGuc, maybeTagConnection, resetCallerTransactionStateForTests, runOperationInCallerTransaction, runOperationWithRlsGuc, setWorkspaceContext, withWorkspaceContext, withWorkspaceContextSync } from '../chunk-CYY4VIRK.js';
|
|
4
4
|
export { PrismaClientWrapper, configurePrismaLogging, createConnectionPool, createPrismaAdapter, createPrismaClient, ensureServiceApplicationName, installAcquireRetry, isTransientAcquireError } from '../chunk-L5TDUAFN.js';
|
|
5
5
|
import '../chunk-3AEU6G6V.js';
|
|
6
6
|
import '../chunk-MLBNB5DB.js';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-
|
|
2
|
-
export { A as ActorProvenance, C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, V as VerifiedDelegationContext, m as WspaceGraphQLContext } from '../types-
|
|
1
|
+
import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-C-6m9NoG.js';
|
|
2
|
+
export { A as ActorProvenance, C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, V as VerifiedDelegationContext, m as WspaceGraphQLContext } from '../types-C-6m9NoG.js';
|
|
3
3
|
import * as jose from 'jose';
|
|
4
4
|
import { VerifyOptions } from 'jsonwebtoken';
|
|
5
5
|
import { I as I18n } from '../i18n-DrdPTann.js';
|
|
@@ -7,7 +7,7 @@ import { GraphQLError } from 'graphql';
|
|
|
7
7
|
export { I as I18nContext, L as LocaleCode } from '../types-C8TbSdEj.js';
|
|
8
8
|
export { P as PrismaClientBase } from '../client-CCXpAZ2r.js';
|
|
9
9
|
import 'graphql-yoga';
|
|
10
|
-
import '../workspace-extension-
|
|
10
|
+
import '../workspace-extension-DiNiTLa3.js';
|
|
11
11
|
import '@prisma/adapter-pg';
|
|
12
12
|
import 'pg';
|
|
13
13
|
|
package/dist/server/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHumanReadableErrorPlugin, formatHttpError, normalizeGraphQLResponse, createHttpErrorResponse } from '../chunk-6GL4SLU7.js';
|
|
2
2
|
export { UserFacingGraphQLError, createHttpErrorResponse, createHumanReadableErrorPlugin, createWorkspaceGuardPlugin, formatHttpError, normalizeError, normalizeExecutionResultErrors, normalizeGraphQLResponse, normalizeGraphQLResponsePayload, toUserFacingGraphQLError } from '../chunk-6GL4SLU7.js';
|
|
3
3
|
import { getWorkspaceQuotaRegistry } from '../chunk-WTEHAVBX.js';
|
|
4
|
-
import { setWorkspaceContext } from '../chunk-
|
|
4
|
+
import { setWorkspaceContext } from '../chunk-CYY4VIRK.js';
|
|
5
5
|
import { I18n } from '../chunk-EBDHIL7V.js';
|
|
6
6
|
import { getMetricsRegistry } from '../chunk-AWPNRV3L.js';
|
|
7
7
|
import { ContextManager } from '../chunk-RZOFS2BQ.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { PubSub } from 'graphql-yoga';
|
|
3
3
|
import { P as PrismaClientBase, a as PrismaClientConstructorOptions } from './client-CCXpAZ2r.js';
|
|
4
|
-
import { W as WorkspaceExtensionConfig } from './workspace-extension-
|
|
4
|
+
import { W as WorkspaceExtensionConfig } from './workspace-extension-DiNiTLa3.js';
|
|
5
5
|
import { I as I18nContext, L as LocaleCode } from './types-C8TbSdEj.js';
|
|
6
6
|
|
|
7
7
|
type ActorProvenance = 'direct_human' | 'delegated' | 'non_human' | 'unknown';
|
|
@@ -46,6 +46,34 @@ type RawPrismaForRlsTransaction = {
|
|
|
46
46
|
$transaction: <TResult>(fn: (tx: PrismaTxForRlsGuc) => Promise<TResult>) => Promise<TResult>;
|
|
47
47
|
};
|
|
48
48
|
declare function runOperationWithRlsGuc<TResult>(rootClient: RawPrismaForRlsTransaction, wsCtx: WorkspaceContext, model: string, operation: string, args: unknown): Promise<TResult>;
|
|
49
|
+
interface PrismaQueryInternalParams {
|
|
50
|
+
transaction?: unknown;
|
|
51
|
+
}
|
|
52
|
+
type CallerTransaction = {
|
|
53
|
+
kind: 'itx';
|
|
54
|
+
id: string;
|
|
55
|
+
descriptor: object;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'batch';
|
|
58
|
+
};
|
|
59
|
+
declare function getCallerTransaction(internalParams: PrismaQueryInternalParams | undefined): CallerTransaction | undefined;
|
|
60
|
+
interface TransactionContextStatement {
|
|
61
|
+
sql: string;
|
|
62
|
+
params: string[];
|
|
63
|
+
key: string;
|
|
64
|
+
}
|
|
65
|
+
declare function buildTransactionContextStatement(wsCtx: WorkspaceContext, config: Pick<Required<WorkspaceExtensionConfig>, 'enableRlsGucTagging' | 'enableApplicationNameTagging'>): TransactionContextStatement | undefined;
|
|
66
|
+
type PendingRawStatement = PromiseLike<number> & {
|
|
67
|
+
requestTransaction?: (transaction: object) => PromiseLike<unknown>;
|
|
68
|
+
};
|
|
69
|
+
type RawPrismaForCallerTransaction = {
|
|
70
|
+
$executeRawUnsafe: (query: string, ...values: unknown[]) => PendingRawStatement;
|
|
71
|
+
};
|
|
72
|
+
declare function runOperationInCallerTransaction<TResult>(rawPrisma: RawPrismaForCallerTransaction, transaction: {
|
|
73
|
+
id: string;
|
|
74
|
+
descriptor: object;
|
|
75
|
+
}, wsCtx: WorkspaceContext, config: Pick<Required<WorkspaceExtensionConfig>, 'enableRlsGucTagging' | 'enableApplicationNameTagging'>, run: () => Promise<TResult>): Promise<TResult>;
|
|
76
|
+
declare function resetCallerTransactionStateForTests(): void;
|
|
49
77
|
declare function addWorkspaceExtension<T>(baseClient: T, config?: WorkspaceExtensionConfig): T;
|
|
50
78
|
|
|
51
|
-
export { type WorkspaceExtensionConfig as W, type WorkspaceContext as a, addWorkspaceExtension as b,
|
|
79
|
+
export { type CallerTransaction as C, type PrismaQueryInternalParams as P, type RawPrismaForCallerTransaction as R, type TransactionContextStatement as T, type WorkspaceExtensionConfig as W, type WorkspaceContext as a, addWorkspaceExtension as b, buildTransactionContextStatement as c, defaultWorkspaceExtensionConfig as d, getWorkspaceContext as e, injectWhereWorkspaceId as f, getCallerTransaction as g, maybeTagConnection as h, injectCreateFields as i, runOperationInCallerTransaction as j, runOperationWithRlsGuc as k, withWorkspaceContextSync as l, maybeSetRlsGuc as m, resetCallerTransactionStateForTests as r, setWorkspaceContext as s, withWorkspaceContext as w };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/be-sdk",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1008.2",
|
|
4
4
|
"description": "Backend SDK for Burdenoff products providing unified access to notifications, RBAC, activity tracking, usage monitoring, and more",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"test": "bun test 2>/dev/null || echo 'No tests found or tests passed'",
|
|
90
90
|
"test:watch": "bun test --watch",
|
|
91
91
|
"test:coverage": "bun test --coverage",
|
|
92
|
+
"test:live-pg": "bunx prisma generate --schema tests/live-pg/rls-transactions/schema.prisma && bun test tests/live-pg",
|
|
92
93
|
"test:ci": "if ls src/**/*.test.ts 1>/dev/null 2>&1; then bun test; else echo 'No test files found, skipping'; fi",
|
|
93
94
|
"audit": "bun audit",
|
|
94
95
|
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run format:check && bun run lint:sanity && bun run typecheck && bun run build && bun run test:ci && bun run audit'",
|