@event-driven-io/pongo 0.17.0-alpha.1 → 0.17.0-alpha.3

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/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/commandLine/configFile.ts","../src/commandLine/migrate.ts","../src/commandLine/shell.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { configCommand, migrateCommand, shellCommand } from './commandLine';\n\nconst program = new Command();\n\nprogram.name('pongo').description('CLI tool for Pongo');\n\nprogram.addCommand(configCommand);\nprogram.addCommand(migrateCommand);\nprogram.addCommand(shellCommand);\n\nprogram.parse(process.argv);\n\nexport default program;\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport {\n objectEntries,\n toDbSchemaMetadata,\n type PongoDbSchemaMetadata,\n type PongoSchemaConfig,\n} from '../core';\n\nconst formatTypeName = (input: string): string => {\n if (input.length === 0) {\n return input;\n }\n\n let formatted = input.charAt(0).toUpperCase() + input.slice(1);\n\n if (formatted.endsWith('s')) {\n formatted = formatted.slice(0, -1);\n }\n\n return formatted;\n};\n\nconst sampleConfig = (collectionNames: string[] = ['users']) => {\n const types = collectionNames\n .map(\n (name) =>\n `export type ${formatTypeName(name)} = { name: string; description: string; date: Date }`,\n )\n .join('\\n');\n\n const collections = collectionNames\n .map(\n (name) =>\n ` ${name}: pongoSchema.collection<${formatTypeName(name)}>('${name}'),`,\n )\n .join('\\n');\n\n return `import { pongoSchema } from '@event-driven-io/pongo';\n\n${types}\n\nexport default {\n schema: pongoSchema.client({\n database: pongoSchema.db({\n${collections}\n }),\n }),\n};`;\n};\n\nconst missingDefaultExport = `Error: Config should contain default export, e.g.\\n\\n${sampleConfig()}`;\nconst missingSchema = `Error: Config should contain schema property, e.g.\\n\\n${sampleConfig()}`;\nconst missingDbs = `Error: Config should have at least a single database defined, e.g.\\n\\n${sampleConfig()}`;\nconst missingDefaultDb = `Error: Config should have a default database defined (without name or or with default database name), e.g.\\n\\n${sampleConfig()}`;\nconst missingCollections = `Error: Database should have defined at least one collection, e.g.\\n\\n${sampleConfig()}`;\n\nexport const loadConfigFile = async (\n configPath: string,\n): Promise<PongoDbSchemaMetadata> => {\n const configUrl = new URL(configPath, `file://${process.cwd()}/`);\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const imported: Partial<{ default: PongoSchemaConfig }> = await import(\n configUrl.href\n );\n\n const parsed = parseDefaultDbSchema(imported);\n\n if (typeof parsed === 'string') {\n console.error(parsed);\n process.exit(1);\n }\n\n return parsed;\n } catch {\n console.error(`Error: Couldn't load file: ${configUrl.href}`);\n process.exit(1);\n }\n};\n\nexport const generateConfigFile = (\n configPath: string,\n collectionNames: string[],\n): void => {\n try {\n fs.writeFileSync(configPath, sampleConfig(collectionNames), 'utf8');\n console.log(`Configuration file stored at: ${configPath}`);\n } catch (error) {\n console.error(`Error: Couldn't store config file: ${configPath}!`);\n console.error(error);\n process.exit(1);\n }\n};\n\nexport const parseDefaultDbSchema = (\n imported: Partial<{ default: PongoSchemaConfig }>,\n): PongoDbSchemaMetadata | string => {\n if (!imported.default) {\n return missingDefaultExport;\n }\n\n if (!imported.default.schema) {\n return missingSchema;\n }\n\n if (!imported.default.schema.dbs) {\n return missingDbs;\n }\n\n const dbs = objectEntries(imported.default.schema.dbs).map((db) => db[1]);\n\n const defaultDb = dbs.find((db) => db.name === undefined);\n\n if (!defaultDb) {\n return missingDefaultDb;\n }\n\n if (!defaultDb.collections) {\n return missingCollections;\n }\n\n const collections = objectEntries(defaultDb.collections).map((col) => col[1]);\n\n if (collections.length === 0) {\n return missingCollections;\n }\n\n return toDbSchemaMetadata(defaultDb);\n};\n\ntype SampleConfigOptions =\n | {\n collection: string[];\n print?: boolean;\n }\n | {\n collection: string[];\n generate?: boolean;\n file?: string;\n };\n\nexport const configCommand = new Command('config').description(\n 'Manage Pongo configuration',\n);\n\nconfigCommand\n .command('sample')\n .description('Generate or print sample configuration')\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-f, --file <path>',\n 'Path to configuration file with collection list',\n )\n .option('-g, --generate', 'Generate sample config file')\n .option('-p, --print', 'Print sample config file')\n .action((options: SampleConfigOptions) => {\n const collectionNames =\n options.collection.length > 0 ? options.collection : ['users'];\n\n if (!('print' in options) && !('generate' in options)) {\n console.error(\n 'Error: Please provide either:\\n--print param to print sample config or\\n--generate to generate sample config file',\n );\n process.exit(1);\n }\n\n if ('print' in options) {\n console.log(`${sampleConfig(collectionNames)}`);\n } else if ('generate' in options) {\n if (!options.file) {\n console.error(\n 'Error: You need to provide a config file through a --file',\n );\n process.exit(1);\n }\n\n generateConfigFile(options.file, collectionNames);\n }\n });\n","import {\n combineMigrations,\n dumbo,\n migrationTableSchemaComponent,\n runPostgreSQLMigrations,\n} from '@event-driven-io/dumbo';\nimport { Command } from 'commander';\nimport { pongoCollectionSchemaComponent } from '../core';\nimport { loadConfigFile } from './configFile';\n\ninterface MigrateRunOptions {\n collection: string[];\n connectionString: string;\n config?: string;\n dryRun?: boolean;\n}\n\ninterface MigrateSqlOptions {\n print?: boolean;\n write?: string;\n config?: string;\n collection: string[];\n}\n\nexport const migrateCommand = new Command('migrate').description(\n 'Manage database migrations',\n);\n\nmigrateCommand\n .command('run')\n .description('Run database migrations')\n .option(\n '-cs, --connection-string <string>',\n 'Connection string for the database',\n )\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option('-f, --config <path>', 'Path to configuration file with Pongo config')\n .option('-dr, --dryRun', 'Perform dry run without commiting changes', false)\n .action(async (options: MigrateRunOptions) => {\n const { collection, dryRun } = options;\n const connectionString =\n options.connectionString ?? process.env.DB_CONNECTION_STRING;\n let collectionNames: string[];\n\n if (!connectionString) {\n console.error(\n 'Error: Connection string is required. Provide it either as a \"--connection-string\" parameter or through the DB_CONNECTION_STRING environment variable.' +\n '\\nFor instance: --connection-string postgresql://postgres:postgres@localhost:5432/postgres',\n );\n process.exit(1);\n }\n\n if (options.config) {\n const config = await loadConfigFile(options.config);\n\n collectionNames = config.collections.map((c) => c.name);\n } else if (collection) {\n collectionNames = collection;\n } else {\n console.error(\n 'Error: You need to provide at least one collection name. Provide it either through \"--config\" file or as a \"--collection\" parameter.',\n );\n process.exit(1);\n }\n\n const pool = dumbo({ connectionString });\n\n const migrations = collectionNames.flatMap((collectionsName) =>\n pongoCollectionSchemaComponent(collectionsName).migrations({\n connector: 'PostgreSQL:pg', // TODO: Provide connector here\n }),\n );\n\n await runPostgreSQLMigrations(pool, migrations, {\n dryRun,\n });\n });\n\nmigrateCommand\n .command('sql')\n .description('Generate SQL for database migration')\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option('-f, --config <path>', 'Path to configuration file with Pongo config')\n .option('--print', 'Print the SQL to the console (default)', true)\n //.option('--write <filename>', 'Write the SQL to a specified file')\n .action(async (options: MigrateSqlOptions) => {\n const { collection } = options;\n\n let collectionNames: string[];\n\n if (options.config) {\n const config = await loadConfigFile(options.config);\n\n collectionNames = config.collections.map((c) => c.name);\n } else if (collection) {\n collectionNames = collection;\n } else {\n console.error(\n 'Error: You need to provide at least one collection name. Provide it either through \"--config\" file or as a \"--collection\" parameter.',\n );\n process.exit(1);\n }\n\n const coreMigrations = migrationTableSchemaComponent.migrations({\n connector: 'PostgreSQL:pg',\n });\n const migrations = [\n ...coreMigrations,\n ...collectionNames.flatMap((collectionName) =>\n pongoCollectionSchemaComponent(collectionName).migrations({\n connector: 'PostgreSQL:pg', // TODO: Provide connector here\n }),\n ),\n ];\n\n console.log('Printing SQL:');\n console.log(combineMigrations(...migrations));\n });\n","import {\n checkConnection,\n color,\n LogLevel,\n LogStyle,\n prettyJson,\n SQL,\n type MigrationStyle,\n} from '@event-driven-io/dumbo';\nimport Table from 'cli-table3';\nimport { Command } from 'commander';\nimport repl from 'node:repl';\nimport {\n pongoClient,\n pongoSchema,\n type PongoClient,\n type PongoCollectionSchema,\n type PongoDb,\n} from '../core';\n\nlet pongo: PongoClient;\n\nconst calculateColumnWidths = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n results: any[],\n columnNames: string[],\n): number[] => {\n const columnWidths = columnNames.map((col) => {\n const maxWidth = Math.max(\n col.length, // Header size\n ...results.map((result) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n result[col] ? String(result[col]).length : 0,\n ),\n );\n return maxWidth + 2; // Add padding\n });\n return columnWidths;\n};\n\nlet shouldDisplayResultsAsTable = false;\n\nconst printResultsAsTable = (print?: boolean) =>\n (shouldDisplayResultsAsTable = print === undefined || print === true);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst printOutput = (obj: any): string =>\n Array.isArray(obj) && shouldDisplayResultsAsTable\n ? displayResultsAsTable(obj)\n : prettyJson(obj);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst displayResultsAsTable = (results: any[]): string => {\n if (results.length === 0) {\n return color.yellow('No documents found.');\n }\n\n const columnNames = results\n\n .flatMap((result) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n typeof result === 'object' ? Object.keys(result) : typeof result,\n )\n .filter((value, index, array) => array.indexOf(value) === index);\n\n const columnWidths = calculateColumnWidths(results, columnNames);\n\n const table = new Table({\n head: columnNames.map((col) => color.cyan(col)),\n colWidths: columnWidths,\n });\n\n results.forEach((result) => {\n table.push(\n columnNames.map((col) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n result[col] !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Array.isArray(result[col])\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n displayResultsAsTable(result[col])\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n prettyJson(result[col])\n : typeof result === 'object'\n ? ''\n : result != undefined && result != undefined\n ? prettyJson(result)\n : '',\n ),\n );\n });\n\n return table.toString();\n};\n\nconst setLogLevel = (logLevel: string) => {\n process.env.DUMBO_LOG_LEVEL = logLevel;\n};\n\nconst setLogStyle = (logLevel: string) => {\n process.env.DUMBO_LOG_STYLE = logLevel;\n};\n\nconst prettifyLogs = (logLevel?: string) => {\n if (logLevel !== undefined) setLogLevel(logLevel);\n setLogStyle(LogStyle.PRETTY);\n};\n\nconst startRepl = async (options: {\n logging: {\n printOptions: boolean;\n logLevel: LogLevel;\n logStyle: LogStyle;\n };\n schema: {\n database: string;\n collections: string[];\n autoMigration: MigrationStyle;\n };\n connectionString: string | undefined;\n}) => {\n // TODO: This will change when we have proper tracing and logging config\n // For now, that's enough\n setLogLevel(process.env.DUMBO_LOG_LEVEL ?? options.logging.logLevel);\n setLogStyle(process.env.DUMBO_LOG_STYLE ?? options.logging.logStyle);\n\n console.log(color.green('Starting Pongo Shell (version: 0.17.0-alpha.1)'));\n\n if (options.logging.printOptions) {\n console.log(color.green('With Options:'));\n console.log(prettyJson(options));\n }\n\n const connectionString =\n options.connectionString ??\n process.env.DB_CONNECTION_STRING ??\n 'postgresql://postgres:postgres@localhost:5432/postgres';\n\n if (!(options.connectionString ?? process.env.DB_CONNECTION_STRING)) {\n console.log(\n color.yellow(\n `No connection string provided, using: 'postgresql://postgres:postgres@localhost:5432/postgres'`,\n ),\n );\n }\n\n const connectionCheck = await checkConnection(connectionString);\n\n if (!connectionCheck.successful) {\n if (connectionCheck.errorType === 'ConnectionRefused') {\n console.error(\n color.red(\n `Connection was refused. Check if the PostgreSQL server is running and accessible.`,\n ),\n );\n } else if (connectionCheck.errorType === 'Authentication') {\n console.error(\n color.red(\n `Authentication failed. Check the username and password in the connection string.`,\n ),\n );\n } else {\n console.error(color.red('Error connecting to PostgreSQL server'));\n }\n console.log(color.red('Exiting Pongo Shell...'));\n process.exit();\n }\n\n console.log(color.green(`Successfully connected`));\n console.log(color.green('Use db.<collection>.<method>() to query.'));\n\n const shell = repl.start({\n prompt: color.green('pongo> '),\n useGlobal: true,\n breakEvalOnSigint: true,\n writer: printOutput,\n });\n\n let db: PongoDb;\n\n if (options.schema.collections.length > 0) {\n const collectionsSchema: Record<string, PongoCollectionSchema> = {};\n\n for (const collectionName of options.schema.collections) {\n collectionsSchema[collectionName] =\n pongoSchema.collection(collectionName);\n }\n\n const schema = pongoSchema.client({\n database: pongoSchema.db(options.schema.database, collectionsSchema),\n });\n\n const typedClient = pongoClient(connectionString, {\n schema: {\n definition: schema,\n autoMigration: options.schema.autoMigration,\n },\n });\n\n db = typedClient.database;\n\n for (const collectionName of options.schema.collections) {\n shell.context[collectionName] = typedClient.database[collectionName];\n }\n\n pongo = typedClient;\n } else {\n pongo = pongoClient(connectionString, {\n schema: { autoMigration: options.schema.autoMigration },\n });\n\n db = pongo.db(options.schema.database);\n }\n\n shell.context.pongo = pongo;\n shell.context.db = db;\n\n // helpers\n shell.context.SQL = SQL;\n shell.context.setLogLevel = setLogLevel;\n shell.context.setLogStyle = setLogStyle;\n shell.context.prettifyLogs = prettifyLogs;\n shell.context.printResultsAsTable = printResultsAsTable;\n shell.context.LogStyle = LogStyle;\n shell.context.LogLevel = LogLevel;\n\n // Intercept REPL output to display results as a table if they are arrays\n shell.on('exit', async () => {\n await teardown();\n process.exit();\n });\n\n shell.on('SIGINT', async () => {\n await teardown();\n process.exit();\n });\n};\n\nconst teardown = async () => {\n console.log(color.yellow('Exiting Pongo Shell...'));\n await pongo.close();\n};\n\nprocess.on('uncaughtException', teardown);\nprocess.on('SIGINT', teardown);\n\ninterface ShellOptions {\n database: string;\n collection: string[];\n connectionString?: string;\n disableAutoMigrations: boolean;\n logStyle?: string;\n logLevel?: string;\n prettyLog?: boolean;\n printOptions?: boolean;\n}\n\nconst shellCommand = new Command('shell')\n .description('Start an interactive Pongo shell')\n .option(\n '-cs, --connectionString <string>',\n 'Connection string for the database',\n )\n .option('-db, --database <string>', 'Database name to connect', 'postgres')\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-no-migrations, --disable-auto-migrations',\n 'Disable automatic migrations',\n )\n .option('-o, --print-options', 'Print shell options')\n .option(\n '-ll, --log-level <logLevel>',\n 'Log level: DISABLED, INFO, LOG, WARN, ERROR',\n 'DISABLED',\n )\n .option('-ls, --log-style', 'Log style: RAW, PRETTY', 'RAW')\n .option('-p, --pretty-log', 'Turn on logging with prettified output')\n .action(async (options: ShellOptions) => {\n const { collection, database } = options;\n const connectionString = options.connectionString;\n\n await startRepl({\n logging: {\n printOptions: options.printOptions === true,\n logStyle: options.prettyLog\n ? LogStyle.PRETTY\n : ((options.logStyle as LogStyle | undefined) ?? LogStyle.RAW),\n logLevel: options.logLevel\n ? (options.logLevel as LogLevel)\n : options.prettyLog\n ? LogLevel.INFO\n : LogLevel.DISABLED,\n },\n schema: {\n collections: collection,\n database,\n autoMigration: options.disableAutoMigrations\n ? 'None'\n : 'CreateOrUpdate',\n },\n connectionString,\n });\n });\n\nexport { shellCommand };\n"],"mappings":";;;;;;;;;;AACA,SAAS,WAAAA,gBAAe;;;ACDxB,SAAS,eAAe;AACxB,OAAO,QAAQ;AAQf,IAAM,iBAAiB,CAAC,UAA0B;AAChD,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,MAAM,OAAO,CAAC,EAAE,YAAY,IAAI,MAAM,MAAM,CAAC;AAE7D,MAAI,UAAU,SAAS,GAAG,GAAG;AAC3B,gBAAY,UAAU,MAAM,GAAG,EAAE;AAAA,EACnC;AAEA,SAAO;AACT;AAEA,IAAM,eAA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;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;;;AHlTH,IAAM,UAAU,IAAIC,SAAQ;AAE5B,QAAQ,KAAK,OAAO,EAAE,YAAY,oBAAoB;AAEtD,QAAQ,WAAW,aAAa;AAChC,QAAQ,WAAW,cAAc;AACjC,QAAQ,WAAW,YAAY;AAE/B,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAO,cAAQ;","names":["Command","Command","Command","Command","Command","Command"]}
1
+ {"version":3,"sources":["../src/cli.ts","../src/commandLine/configFile.ts","../src/commandLine/migrate.ts","../src/commandLine/shell.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { configCommand, migrateCommand, shellCommand } from './commandLine';\n\nconst program = new Command();\n\nprogram.name('pongo').description('CLI tool for Pongo');\n\nprogram.addCommand(configCommand);\nprogram.addCommand(migrateCommand);\nprogram.addCommand(shellCommand);\n\nprogram.parse(process.argv);\n\nexport default program;\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport {\n objectEntries,\n toDbSchemaMetadata,\n type PongoDbSchemaMetadata,\n type PongoSchemaConfig,\n} from '../core';\n\nconst formatTypeName = (input: string): string => {\n if (input.length === 0) {\n return input;\n }\n\n let formatted = input.charAt(0).toUpperCase() + input.slice(1);\n\n if (formatted.endsWith('s')) {\n formatted = formatted.slice(0, -1);\n }\n\n return formatted;\n};\n\nconst sampleConfig = (collectionNames: string[] = ['users']) => {\n const types = collectionNames\n .map(\n (name) =>\n `export type ${formatTypeName(name)} = { name: string; description: string; date: Date }`,\n )\n .join('\\n');\n\n const collections = collectionNames\n .map(\n (name) =>\n ` ${name}: pongoSchema.collection<${formatTypeName(name)}>('${name}'),`,\n )\n .join('\\n');\n\n return `import { pongoSchema } from '@event-driven-io/pongo';\n\n${types}\n\nexport default {\n schema: pongoSchema.client({\n database: pongoSchema.db({\n${collections}\n }),\n }),\n};`;\n};\n\nconst missingDefaultExport = `Error: Config should contain default export, e.g.\\n\\n${sampleConfig()}`;\nconst missingSchema = `Error: Config should contain schema property, e.g.\\n\\n${sampleConfig()}`;\nconst missingDbs = `Error: Config should have at least a single database defined, e.g.\\n\\n${sampleConfig()}`;\nconst missingDefaultDb = `Error: Config should have a default database defined (without name or or with default database name), e.g.\\n\\n${sampleConfig()}`;\nconst missingCollections = `Error: Database should have defined at least one collection, e.g.\\n\\n${sampleConfig()}`;\n\nexport const loadConfigFile = async (\n configPath: string,\n): Promise<PongoDbSchemaMetadata> => {\n const configUrl = new URL(configPath, `file://${process.cwd()}/`);\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const imported: Partial<{ default: PongoSchemaConfig }> = await import(\n configUrl.href\n );\n\n const parsed = parseDefaultDbSchema(imported);\n\n if (typeof parsed === 'string') {\n console.error(parsed);\n process.exit(1);\n }\n\n return parsed;\n } catch {\n console.error(`Error: Couldn't load file: ${configUrl.href}`);\n process.exit(1);\n }\n};\n\nexport const generateConfigFile = (\n configPath: string,\n collectionNames: string[],\n): void => {\n try {\n fs.writeFileSync(configPath, sampleConfig(collectionNames), 'utf8');\n console.log(`Configuration file stored at: ${configPath}`);\n } catch (error) {\n console.error(`Error: Couldn't store config file: ${configPath}!`);\n console.error(error);\n process.exit(1);\n }\n};\n\nexport const parseDefaultDbSchema = (\n imported: Partial<{ default: PongoSchemaConfig }>,\n): PongoDbSchemaMetadata | string => {\n if (!imported.default) {\n return missingDefaultExport;\n }\n\n if (!imported.default.schema) {\n return missingSchema;\n }\n\n if (!imported.default.schema.dbs) {\n return missingDbs;\n }\n\n const dbs = objectEntries(imported.default.schema.dbs).map((db) => db[1]);\n\n const defaultDb = dbs.find((db) => db.name === undefined);\n\n if (!defaultDb) {\n return missingDefaultDb;\n }\n\n if (!defaultDb.collections) {\n return missingCollections;\n }\n\n const collections = objectEntries(defaultDb.collections).map((col) => col[1]);\n\n if (collections.length === 0) {\n return missingCollections;\n }\n\n return toDbSchemaMetadata(defaultDb);\n};\n\ntype SampleConfigOptions =\n | {\n collection: string[];\n print?: boolean;\n }\n | {\n collection: string[];\n generate?: boolean;\n file?: string;\n };\n\nexport const configCommand = new Command('config').description(\n 'Manage Pongo configuration',\n);\n\nconfigCommand\n .command('sample')\n .description('Generate or print sample configuration')\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-f, --file <path>',\n 'Path to configuration file with collection list',\n )\n .option('-g, --generate', 'Generate sample config file')\n .option('-p, --print', 'Print sample config file')\n .action((options: SampleConfigOptions) => {\n const collectionNames =\n options.collection.length > 0 ? options.collection : ['users'];\n\n if (!('print' in options) && !('generate' in options)) {\n console.error(\n 'Error: Please provide either:\\n--print param to print sample config or\\n--generate to generate sample config file',\n );\n process.exit(1);\n }\n\n if ('print' in options) {\n console.log(`${sampleConfig(collectionNames)}`);\n } else if ('generate' in options) {\n if (!options.file) {\n console.error(\n 'Error: You need to provide a config file through a --file',\n );\n process.exit(1);\n }\n\n generateConfigFile(options.file, collectionNames);\n }\n });\n","import { combineMigrations } from '@event-driven-io/dumbo';\nimport {\n dumbo,\n migrationTableSchemaComponent,\n runPostgreSQLMigrations,\n} from '@event-driven-io/dumbo/pg';\nimport { Command } from 'commander';\nimport { pongoCollectionSchemaComponent } from '../core';\nimport { loadConfigFile } from './configFile';\n\ninterface MigrateRunOptions {\n collection: string[];\n connectionString: string;\n config?: string;\n dryRun?: boolean;\n}\n\ninterface MigrateSqlOptions {\n print?: boolean;\n write?: string;\n config?: string;\n collection: string[];\n}\n\nexport const migrateCommand = new Command('migrate').description(\n 'Manage database migrations',\n);\n\nmigrateCommand\n .command('run')\n .description('Run database migrations')\n .option(\n '-cs, --connection-string <string>',\n 'Connection string for the database',\n )\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option('-f, --config <path>', 'Path to configuration file with Pongo config')\n .option('-dr, --dryRun', 'Perform dry run without commiting changes', false)\n .action(async (options: MigrateRunOptions) => {\n const { collection, dryRun } = options;\n const connectionString =\n options.connectionString ?? process.env.DB_CONNECTION_STRING;\n let collectionNames: string[];\n\n if (!connectionString) {\n console.error(\n 'Error: Connection string is required. Provide it either as a \"--connection-string\" parameter or through the DB_CONNECTION_STRING environment variable.' +\n '\\nFor instance: --connection-string postgresql://postgres:postgres@localhost:5432/postgres',\n );\n process.exit(1);\n }\n\n if (options.config) {\n const config = await loadConfigFile(options.config);\n\n collectionNames = config.collections.map((c) => c.name);\n } else if (collection) {\n collectionNames = collection;\n } else {\n console.error(\n 'Error: You need to provide at least one collection name. Provide it either through \"--config\" file or as a \"--collection\" parameter.',\n );\n process.exit(1);\n }\n\n const pool = dumbo({ connectionString });\n\n const migrations = collectionNames.flatMap((collectionsName) =>\n pongoCollectionSchemaComponent(collectionsName).migrations({\n connector: 'PostgreSQL:pg', // TODO: Provide connector here\n }),\n );\n\n await runPostgreSQLMigrations(pool, migrations, {\n dryRun,\n });\n });\n\nmigrateCommand\n .command('sql')\n .description('Generate SQL for database migration')\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option('-f, --config <path>', 'Path to configuration file with Pongo config')\n .option('--print', 'Print the SQL to the console (default)', true)\n //.option('--write <filename>', 'Write the SQL to a specified file')\n .action(async (options: MigrateSqlOptions) => {\n const { collection } = options;\n\n let collectionNames: string[];\n\n if (options.config) {\n const config = await loadConfigFile(options.config);\n\n collectionNames = config.collections.map((c) => c.name);\n } else if (collection) {\n collectionNames = collection;\n } else {\n console.error(\n 'Error: You need to provide at least one collection name. Provide it either through \"--config\" file or as a \"--collection\" parameter.',\n );\n process.exit(1);\n }\n\n const coreMigrations = migrationTableSchemaComponent.migrations({\n connector: 'PostgreSQL:pg',\n });\n const migrations = [\n ...coreMigrations,\n ...collectionNames.flatMap((collectionName) =>\n pongoCollectionSchemaComponent(collectionName).migrations({\n connector: 'PostgreSQL:pg', // TODO: Provide connector here\n }),\n ),\n ];\n\n console.log('Printing SQL:');\n console.log(combineMigrations(...migrations));\n });\n","import {\n color,\n LogLevel,\n LogStyle,\n prettyJson,\n SQL,\n type MigrationStyle,\n} from '@event-driven-io/dumbo';\nimport { checkConnection } from '@event-driven-io/dumbo/pg';\nimport Table from 'cli-table3';\nimport { Command } from 'commander';\nimport repl from 'node:repl';\nimport {\n pongoClient,\n pongoSchema,\n type PongoClient,\n type PongoCollectionSchema,\n type PongoDb,\n} from '../core';\n\nlet pongo: PongoClient;\n\nconst calculateColumnWidths = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n results: any[],\n columnNames: string[],\n): number[] => {\n const columnWidths = columnNames.map((col) => {\n const maxWidth = Math.max(\n col.length, // Header size\n ...results.map((result) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n result[col] ? String(result[col]).length : 0,\n ),\n );\n return maxWidth + 2; // Add padding\n });\n return columnWidths;\n};\n\nlet shouldDisplayResultsAsTable = false;\n\nconst printResultsAsTable = (print?: boolean) =>\n (shouldDisplayResultsAsTable = print === undefined || print === true);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst printOutput = (obj: any): string =>\n Array.isArray(obj) && shouldDisplayResultsAsTable\n ? displayResultsAsTable(obj)\n : prettyJson(obj);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst displayResultsAsTable = (results: any[]): string => {\n if (results.length === 0) {\n return color.yellow('No documents found.');\n }\n\n const columnNames = results\n\n .flatMap((result) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n typeof result === 'object' ? Object.keys(result) : typeof result,\n )\n .filter((value, index, array) => array.indexOf(value) === index);\n\n const columnWidths = calculateColumnWidths(results, columnNames);\n\n const table = new Table({\n head: columnNames.map((col) => color.cyan(col)),\n colWidths: columnWidths,\n });\n\n results.forEach((result) => {\n table.push(\n columnNames.map((col) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n result[col] !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Array.isArray(result[col])\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n displayResultsAsTable(result[col])\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n prettyJson(result[col])\n : typeof result === 'object'\n ? ''\n : result != undefined && result != undefined\n ? prettyJson(result)\n : '',\n ),\n );\n });\n\n return table.toString();\n};\n\nconst setLogLevel = (logLevel: string) => {\n process.env.DUMBO_LOG_LEVEL = logLevel;\n};\n\nconst setLogStyle = (logLevel: string) => {\n process.env.DUMBO_LOG_STYLE = logLevel;\n};\n\nconst prettifyLogs = (logLevel?: string) => {\n if (logLevel !== undefined) setLogLevel(logLevel);\n setLogStyle(LogStyle.PRETTY);\n};\n\nconst startRepl = async (options: {\n logging: {\n printOptions: boolean;\n logLevel: LogLevel;\n logStyle: LogStyle;\n };\n schema: {\n database: string;\n collections: string[];\n autoMigration: MigrationStyle;\n };\n connectionString: string | undefined;\n}) => {\n // TODO: This will change when we have proper tracing and logging config\n // For now, that's enough\n setLogLevel(process.env.DUMBO_LOG_LEVEL ?? options.logging.logLevel);\n setLogStyle(process.env.DUMBO_LOG_STYLE ?? options.logging.logStyle);\n\n console.log(color.green('Starting Pongo Shell (version: 0.17.0-alpha.3)'));\n\n if (options.logging.printOptions) {\n console.log(color.green('With Options:'));\n console.log(prettyJson(options));\n }\n\n const connectionString =\n options.connectionString ??\n process.env.DB_CONNECTION_STRING ??\n 'postgresql://postgres:postgres@localhost:5432/postgres';\n\n if (!(options.connectionString ?? process.env.DB_CONNECTION_STRING)) {\n console.log(\n color.yellow(\n `No connection string provided, using: 'postgresql://postgres:postgres@localhost:5432/postgres'`,\n ),\n );\n }\n\n const connectionCheck = await checkConnection(connectionString);\n\n if (!connectionCheck.successful) {\n if (connectionCheck.errorType === 'ConnectionRefused') {\n console.error(\n color.red(\n `Connection was refused. Check if the PostgreSQL server is running and accessible.`,\n ),\n );\n } else if (connectionCheck.errorType === 'Authentication') {\n console.error(\n color.red(\n `Authentication failed. Check the username and password in the connection string.`,\n ),\n );\n } else {\n console.error(color.red('Error connecting to PostgreSQL server'));\n }\n console.log(color.red('Exiting Pongo Shell...'));\n process.exit();\n }\n\n console.log(color.green(`Successfully connected`));\n console.log(color.green('Use db.<collection>.<method>() to query.'));\n\n const shell = repl.start({\n prompt: color.green('pongo> '),\n useGlobal: true,\n breakEvalOnSigint: true,\n writer: printOutput,\n });\n\n let db: PongoDb;\n\n if (options.schema.collections.length > 0) {\n const collectionsSchema: Record<string, PongoCollectionSchema> = {};\n\n for (const collectionName of options.schema.collections) {\n collectionsSchema[collectionName] =\n pongoSchema.collection(collectionName);\n }\n\n const schema = pongoSchema.client({\n database: pongoSchema.db(options.schema.database, collectionsSchema),\n });\n\n const typedClient = pongoClient(connectionString, {\n schema: {\n definition: schema,\n autoMigration: options.schema.autoMigration,\n },\n });\n\n db = typedClient.database;\n\n for (const collectionName of options.schema.collections) {\n shell.context[collectionName] = typedClient.database[collectionName];\n }\n\n pongo = typedClient;\n } else {\n pongo = pongoClient(connectionString, {\n schema: { autoMigration: options.schema.autoMigration },\n });\n\n db = pongo.db(options.schema.database);\n }\n\n shell.context.pongo = pongo;\n shell.context.db = db;\n\n // helpers\n shell.context.SQL = SQL;\n shell.context.setLogLevel = setLogLevel;\n shell.context.setLogStyle = setLogStyle;\n shell.context.prettifyLogs = prettifyLogs;\n shell.context.printResultsAsTable = printResultsAsTable;\n shell.context.LogStyle = LogStyle;\n shell.context.LogLevel = LogLevel;\n\n // Intercept REPL output to display results as a table if they are arrays\n shell.on('exit', async () => {\n await teardown();\n process.exit();\n });\n\n shell.on('SIGINT', async () => {\n await teardown();\n process.exit();\n });\n};\n\nconst teardown = async () => {\n console.log(color.yellow('Exiting Pongo Shell...'));\n await pongo.close();\n};\n\nprocess.on('uncaughtException', teardown);\nprocess.on('SIGINT', teardown);\n\ninterface ShellOptions {\n database: string;\n collection: string[];\n connectionString?: string;\n disableAutoMigrations: boolean;\n logStyle?: string;\n logLevel?: string;\n prettyLog?: boolean;\n printOptions?: boolean;\n}\n\nconst shellCommand = new Command('shell')\n .description('Start an interactive Pongo shell')\n .option(\n '-cs, --connectionString <string>',\n 'Connection string for the database',\n )\n .option('-db, --database <string>', 'Database name to connect', 'postgres')\n .option(\n '-col, --collection <name>',\n 'Specify the collection name',\n (value: string, previous: string[]) => {\n // Accumulate collection names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-no-migrations, --disable-auto-migrations',\n 'Disable automatic migrations',\n )\n .option('-o, --print-options', 'Print shell options')\n .option(\n '-ll, --log-level <logLevel>',\n 'Log level: DISABLED, INFO, LOG, WARN, ERROR',\n 'DISABLED',\n )\n .option('-ls, --log-style', 'Log style: RAW, PRETTY', 'RAW')\n .option('-p, --pretty-log', 'Turn on logging with prettified output')\n .action(async (options: ShellOptions) => {\n const { collection, database } = options;\n const connectionString = options.connectionString;\n\n await startRepl({\n logging: {\n printOptions: options.printOptions === true,\n logStyle: options.prettyLog\n ? LogStyle.PRETTY\n : ((options.logStyle as LogStyle | undefined) ?? LogStyle.RAW),\n logLevel: options.logLevel\n ? (options.logLevel as LogLevel)\n : options.prettyLog\n ? LogLevel.INFO\n : LogLevel.DISABLED,\n },\n schema: {\n collections: collection,\n database,\n autoMigration: options.disableAutoMigrations\n ? 'None'\n : 'CreateOrUpdate',\n },\n connectionString,\n });\n });\n\nexport { shellCommand };\n"],"mappings":";;;;;;;;;;AACA,SAAS,WAAAA,gBAAe;;;ACDxB,SAAS,eAAe;AACxB,OAAO,QAAQ;AAQf,IAAM,iBAAiB,CAAC,UAA0B;AAChD,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,MA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,YAAqC,SAAS;AAAA,MAC5D,UAAU,QAAQ,WACb,QAAQ,WACT,QAAQ,YACN,SAAS,OACT,SAAS;AAAA,IACjB;AAAA,IACA,QAAQ;AAAA,MACN,aAAa;AAAA,MACb;AAAA,MACA,eAAe,QAAQ,wBACnB,SACA;AAAA,IACN;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;;;AHlTH,IAAM,UAAU,IAAIC,SAAQ;AAE5B,QAAQ,KAAK,OAAO,EAAE,YAAY,oBAAoB;AAEtD,QAAQ,WAAW,aAAa;AAChC,QAAQ,WAAW,cAAc;AACjC,QAAQ,WAAW,YAAY;AAE/B,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAO,cAAQ;","names":["Command","Command","Command","Command","Command","Command"]}
package/dist/index.cjs CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
 
38
38
 
39
- var _chunkLNVXUDQHcjs = require('./chunk-LNVXUDQH.cjs');
39
+ var _chunkATI5CCCTcjs = require('./chunk-ATI5CCCT.cjs');
40
40
 
41
41
 
42
42
 
@@ -75,5 +75,5 @@ var _chunkLNVXUDQHcjs = require('./chunk-LNVXUDQH.cjs');
75
75
 
76
76
 
77
77
 
78
- exports.ConcurrencyError = _chunkLNVXUDQHcjs.ConcurrencyError; exports.DOCUMENT_DOES_NOT_EXIST = _chunkLNVXUDQHcjs.DOCUMENT_DOES_NOT_EXIST; exports.DOCUMENT_EXISTS = _chunkLNVXUDQHcjs.DOCUMENT_EXISTS; exports.NO_CONCURRENCY_CHECK = _chunkLNVXUDQHcjs.NO_CONCURRENCY_CHECK; exports.ObjectId = _chunkLNVXUDQHcjs.ObjectId; exports.OperatorMap = _chunkLNVXUDQHcjs.OperatorMap; exports.PongoError = _chunkLNVXUDQHcjs.PongoError; exports.QueryOperators = _chunkLNVXUDQHcjs.QueryOperators; exports.clientToDbOptions = _chunkLNVXUDQHcjs.clientToDbOptions; exports.deepEquals = _chunkLNVXUDQHcjs.deepEquals; exports.expectedVersion = _chunkLNVXUDQHcjs.expectedVersion; exports.expectedVersionValue = _chunkLNVXUDQHcjs.expectedVersionValue; exports.getPongoDb = _chunkLNVXUDQHcjs.getPongoDb; exports.hasOperators = _chunkLNVXUDQHcjs.hasOperators; exports.isEquatable = _chunkLNVXUDQHcjs.isEquatable; exports.isGeneralExpectedDocumentVersion = _chunkLNVXUDQHcjs.isGeneralExpectedDocumentVersion; exports.isNumber = _chunkLNVXUDQHcjs.isNumber; exports.isOperator = _chunkLNVXUDQHcjs.isOperator; exports.isPostgresClientOptions = _chunkLNVXUDQHcjs.isPostgresClientOptions; exports.isString = _chunkLNVXUDQHcjs.isString; exports.objectEntries = _chunkLNVXUDQHcjs.objectEntries; exports.operationResult = _chunkLNVXUDQHcjs.operationResult; exports.pongoClient = _chunkLNVXUDQHcjs.pongoClient; exports.pongoCollection = _chunkLNVXUDQHcjs.pongoCollection; exports.pongoCollectionPostgreSQLMigrations = _chunkLNVXUDQHcjs.pongoCollectionPostgreSQLMigrations; exports.pongoCollectionSchemaComponent = _chunkLNVXUDQHcjs.pongoCollectionSchemaComponent; exports.pongoDbSchemaComponent = _chunkLNVXUDQHcjs.pongoDbSchemaComponent; exports.pongoSchema = _chunkLNVXUDQHcjs.pongoSchema; exports.pongoSession = _chunkLNVXUDQHcjs.pongoSession; exports.pongoTransaction = _chunkLNVXUDQHcjs.pongoTransaction; exports.postgresDb = _chunkLNVXUDQHcjs.postgresDb; exports.postgresSQLBuilder = _chunkLNVXUDQHcjs.postgresSQLBuilder; exports.proxyClientWithSchema = _chunkLNVXUDQHcjs.proxyClientWithSchema; exports.proxyPongoDbWithSchema = _chunkLNVXUDQHcjs.proxyPongoDbWithSchema; exports.toClientSchemaMetadata = _chunkLNVXUDQHcjs.toClientSchemaMetadata; exports.toDbSchemaMetadata = _chunkLNVXUDQHcjs.toDbSchemaMetadata; exports.transactionExecutorOrDefault = _chunkLNVXUDQHcjs.transactionExecutorOrDefault;
78
+ exports.ConcurrencyError = _chunkATI5CCCTcjs.ConcurrencyError; exports.DOCUMENT_DOES_NOT_EXIST = _chunkATI5CCCTcjs.DOCUMENT_DOES_NOT_EXIST; exports.DOCUMENT_EXISTS = _chunkATI5CCCTcjs.DOCUMENT_EXISTS; exports.NO_CONCURRENCY_CHECK = _chunkATI5CCCTcjs.NO_CONCURRENCY_CHECK; exports.ObjectId = _chunkATI5CCCTcjs.ObjectId; exports.OperatorMap = _chunkATI5CCCTcjs.OperatorMap; exports.PongoError = _chunkATI5CCCTcjs.PongoError; exports.QueryOperators = _chunkATI5CCCTcjs.QueryOperators; exports.clientToDbOptions = _chunkATI5CCCTcjs.clientToDbOptions; exports.deepEquals = _chunkATI5CCCTcjs.deepEquals; exports.expectedVersion = _chunkATI5CCCTcjs.expectedVersion; exports.expectedVersionValue = _chunkATI5CCCTcjs.expectedVersionValue; exports.getPongoDb = _chunkATI5CCCTcjs.getPongoDb; exports.hasOperators = _chunkATI5CCCTcjs.hasOperators; exports.isEquatable = _chunkATI5CCCTcjs.isEquatable; exports.isGeneralExpectedDocumentVersion = _chunkATI5CCCTcjs.isGeneralExpectedDocumentVersion; exports.isNumber = _chunkATI5CCCTcjs.isNumber; exports.isOperator = _chunkATI5CCCTcjs.isOperator; exports.isPostgresClientOptions = _chunkATI5CCCTcjs.isPostgresClientOptions; exports.isString = _chunkATI5CCCTcjs.isString; exports.objectEntries = _chunkATI5CCCTcjs.objectEntries; exports.operationResult = _chunkATI5CCCTcjs.operationResult; exports.pongoClient = _chunkATI5CCCTcjs.pongoClient; exports.pongoCollection = _chunkATI5CCCTcjs.pongoCollection; exports.pongoCollectionPostgreSQLMigrations = _chunkATI5CCCTcjs.pongoCollectionPostgreSQLMigrations; exports.pongoCollectionSchemaComponent = _chunkATI5CCCTcjs.pongoCollectionSchemaComponent; exports.pongoDbSchemaComponent = _chunkATI5CCCTcjs.pongoDbSchemaComponent; exports.pongoSchema = _chunkATI5CCCTcjs.pongoSchema; exports.pongoSession = _chunkATI5CCCTcjs.pongoSession; exports.pongoTransaction = _chunkATI5CCCTcjs.pongoTransaction; exports.postgresDb = _chunkATI5CCCTcjs.postgresDb; exports.postgresSQLBuilder = _chunkATI5CCCTcjs.postgresSQLBuilder; exports.proxyClientWithSchema = _chunkATI5CCCTcjs.proxyClientWithSchema; exports.proxyPongoDbWithSchema = _chunkATI5CCCTcjs.proxyPongoDbWithSchema; exports.toClientSchemaMetadata = _chunkATI5CCCTcjs.toClientSchemaMetadata; exports.toDbSchemaMetadata = _chunkATI5CCCTcjs.toDbSchemaMetadata; exports.transactionExecutorOrDefault = _chunkATI5CCCTcjs.transactionExecutorOrDefault;
79
79
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,8 +1,10 @@
1
- export { P as PongoCollectionOptions, b as PongoCollectionSQLBuilder, p as pongoCollection, c as pongoCollectionPostgreSQLMigrations, a as pongoCollectionSchemaComponent, d as postgresSQLBuilder, t as transactionExecutorOrDefault } from './pg-DMJLxTdz.cjs';
2
- import { d as PongoTransactionOptions, e as PongoSession, f as PongoDbTransaction } from './pongoClient-CJBLCrlZ.cjs';
3
- export { ad as $inc, ae as $push, ab as $set, ac as $unset, A as AllowedDbClientOptions, a6 as AlternativeType, E as CollectionOperationOptions, C as CollectionsMap, a7 as Condition, o as DBsMap, aj as DOCUMENT_DOES_NOT_EXIST, ai as DOCUMENT_EXISTS, K as DeleteManyOptions, J as DeleteOneOptions, a1 as Document, D as DocumentHandler, Q as EnhancedOmit, ah as ExpectedDocumentVersion, af as ExpectedDocumentVersionGeneral, ag as ExpectedDocumentVersionValue, H as HandleOptions, L as HasId, M as InferIdType, F as InsertManyOptions, I as InsertOneOptions, ak as NO_CONCURRENCY_CHECK, a5 as NonObjectIdLikeDocument, N as NotPooledPongoOptions, O as ObjectId, a4 as ObjectIdLike, ap as OperationResult, a2 as OptionalId, S as OptionalUnlessRequiredId, V as OptionalUnlessRequiredIdAndVersion, T as OptionalUnlessRequiredVersion, a3 as OptionalVersion, B as PongoClient, b as PongoClientOptions, m as PongoClientSchema, w as PongoClientSchemaMetadata, q as PongoClientWithSchema, c as PongoCollection, k as PongoCollectionSchema, u as PongoCollectionSchemaMetadata, P as PongoDb, i as PongoDbClientOptions, l as PongoDbSchema, v as PongoDbSchemaMetadata, n as PongoDbWithSchema, aw as PongoDeleteManyResult, av as PongoDeleteResult, ax as PongoDocument, a8 as PongoFilter, aa as PongoFilterOperator, a as PongoHandleResult, as as PongoInsertManyResult, ar as PongoInsertOneResult, z as PongoSchemaConfig, ao as PongoUpdate, au as PongoUpdateManyResult, at as PongoUpdateResult, g as PooledPongoClientOptions, ay as PostgresDbClientOptions, a0 as RegExpOrString, R as ReplaceOneOptions, a9 as RootFilterOperators, G as UpdateManyOptions, U as UpdateOneOptions, W as WithId, _ as WithIdAndVersion, Y as WithVersion, X as WithoutId, $ as WithoutIdAndVersion, Z as WithoutVersion, h as clientToDbOptions, an as expectedVersion, am as expectedVersionValue, j as getPongoDb, al as isGeneralExpectedDocumentVersion, az as isPostgresClientOptions, aq as operationResult, p as pongoClient, aB as pongoDbSchemaComponent, r as pongoSchema, aA as postgresDb, t as proxyClientWithSchema, s as proxyPongoDbWithSchema, y as toClientSchemaMetadata, x as toDbSchemaMetadata } from './pongoClient-CJBLCrlZ.cjs';
1
+ export { P as PongoCollectionOptions, b as PongoCollectionSQLBuilder, p as pongoCollection, c as pongoCollectionPostgreSQLMigrations, a as pongoCollectionSchemaComponent, d as postgresSQLBuilder, t as transactionExecutorOrDefault } from './pg-CO6kw3rY.cjs';
2
+ import { d as PongoTransactionOptions, e as PongoSession, f as PongoDbTransaction } from './pongoClient-BpQPqFEh.cjs';
3
+ export { ad as $inc, ae as $push, ab as $set, ac as $unset, A as AllowedDbClientOptions, a6 as AlternativeType, E as CollectionOperationOptions, C as CollectionsMap, a7 as Condition, o as DBsMap, aj as DOCUMENT_DOES_NOT_EXIST, ai as DOCUMENT_EXISTS, K as DeleteManyOptions, J as DeleteOneOptions, a1 as Document, D as DocumentHandler, Q as EnhancedOmit, ah as ExpectedDocumentVersion, af as ExpectedDocumentVersionGeneral, ag as ExpectedDocumentVersionValue, H as HandleOptions, L as HasId, M as InferIdType, F as InsertManyOptions, I as InsertOneOptions, ak as NO_CONCURRENCY_CHECK, a5 as NonObjectIdLikeDocument, N as NotPooledPongoOptions, O as ObjectId, a4 as ObjectIdLike, ap as OperationResult, a2 as OptionalId, S as OptionalUnlessRequiredId, V as OptionalUnlessRequiredIdAndVersion, T as OptionalUnlessRequiredVersion, a3 as OptionalVersion, B as PongoClient, b as PongoClientOptions, m as PongoClientSchema, w as PongoClientSchemaMetadata, q as PongoClientWithSchema, c as PongoCollection, k as PongoCollectionSchema, u as PongoCollectionSchemaMetadata, P as PongoDb, i as PongoDbClientOptions, l as PongoDbSchema, v as PongoDbSchemaMetadata, n as PongoDbWithSchema, aw as PongoDeleteManyResult, av as PongoDeleteResult, ax as PongoDocument, a8 as PongoFilter, aa as PongoFilterOperator, a as PongoHandleResult, as as PongoInsertManyResult, ar as PongoInsertOneResult, z as PongoSchemaConfig, ao as PongoUpdate, au as PongoUpdateManyResult, at as PongoUpdateResult, g as PooledPongoClientOptions, ay as PostgresDbClientOptions, a0 as RegExpOrString, R as ReplaceOneOptions, a9 as RootFilterOperators, G as UpdateManyOptions, U as UpdateOneOptions, W as WithId, _ as WithIdAndVersion, Y as WithVersion, X as WithoutId, $ as WithoutIdAndVersion, Z as WithoutVersion, h as clientToDbOptions, an as expectedVersion, am as expectedVersionValue, j as getPongoDb, al as isGeneralExpectedDocumentVersion, az as isPostgresClientOptions, aq as operationResult, p as pongoClient, aB as pongoDbSchemaComponent, r as pongoSchema, aA as postgresDb, t as proxyClientWithSchema, s as proxyPongoDbWithSchema, y as toClientSchemaMetadata, x as toDbSchemaMetadata } from './pongoClient-BpQPqFEh.cjs';
4
4
  import '@event-driven-io/dumbo';
5
+ import '@event-driven-io/dumbo/pg';
5
6
  import 'pg';
7
+ import '@event-driven-io/dumbo/src';
6
8
 
7
9
  declare const QueryOperators: {
8
10
  $eq: string;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- export { P as PongoCollectionOptions, b as PongoCollectionSQLBuilder, p as pongoCollection, c as pongoCollectionPostgreSQLMigrations, a as pongoCollectionSchemaComponent, d as postgresSQLBuilder, t as transactionExecutorOrDefault } from './pg-CGd2X9NW.js';
2
- import { d as PongoTransactionOptions, e as PongoSession, f as PongoDbTransaction } from './pongoClient-CJBLCrlZ.js';
3
- export { ad as $inc, ae as $push, ab as $set, ac as $unset, A as AllowedDbClientOptions, a6 as AlternativeType, E as CollectionOperationOptions, C as CollectionsMap, a7 as Condition, o as DBsMap, aj as DOCUMENT_DOES_NOT_EXIST, ai as DOCUMENT_EXISTS, K as DeleteManyOptions, J as DeleteOneOptions, a1 as Document, D as DocumentHandler, Q as EnhancedOmit, ah as ExpectedDocumentVersion, af as ExpectedDocumentVersionGeneral, ag as ExpectedDocumentVersionValue, H as HandleOptions, L as HasId, M as InferIdType, F as InsertManyOptions, I as InsertOneOptions, ak as NO_CONCURRENCY_CHECK, a5 as NonObjectIdLikeDocument, N as NotPooledPongoOptions, O as ObjectId, a4 as ObjectIdLike, ap as OperationResult, a2 as OptionalId, S as OptionalUnlessRequiredId, V as OptionalUnlessRequiredIdAndVersion, T as OptionalUnlessRequiredVersion, a3 as OptionalVersion, B as PongoClient, b as PongoClientOptions, m as PongoClientSchema, w as PongoClientSchemaMetadata, q as PongoClientWithSchema, c as PongoCollection, k as PongoCollectionSchema, u as PongoCollectionSchemaMetadata, P as PongoDb, i as PongoDbClientOptions, l as PongoDbSchema, v as PongoDbSchemaMetadata, n as PongoDbWithSchema, aw as PongoDeleteManyResult, av as PongoDeleteResult, ax as PongoDocument, a8 as PongoFilter, aa as PongoFilterOperator, a as PongoHandleResult, as as PongoInsertManyResult, ar as PongoInsertOneResult, z as PongoSchemaConfig, ao as PongoUpdate, au as PongoUpdateManyResult, at as PongoUpdateResult, g as PooledPongoClientOptions, ay as PostgresDbClientOptions, a0 as RegExpOrString, R as ReplaceOneOptions, a9 as RootFilterOperators, G as UpdateManyOptions, U as UpdateOneOptions, W as WithId, _ as WithIdAndVersion, Y as WithVersion, X as WithoutId, $ as WithoutIdAndVersion, Z as WithoutVersion, h as clientToDbOptions, an as expectedVersion, am as expectedVersionValue, j as getPongoDb, al as isGeneralExpectedDocumentVersion, az as isPostgresClientOptions, aq as operationResult, p as pongoClient, aB as pongoDbSchemaComponent, r as pongoSchema, aA as postgresDb, t as proxyClientWithSchema, s as proxyPongoDbWithSchema, y as toClientSchemaMetadata, x as toDbSchemaMetadata } from './pongoClient-CJBLCrlZ.js';
1
+ export { P as PongoCollectionOptions, b as PongoCollectionSQLBuilder, p as pongoCollection, c as pongoCollectionPostgreSQLMigrations, a as pongoCollectionSchemaComponent, d as postgresSQLBuilder, t as transactionExecutorOrDefault } from './pg-BTgRFIL2.js';
2
+ import { d as PongoTransactionOptions, e as PongoSession, f as PongoDbTransaction } from './pongoClient-BpQPqFEh.js';
3
+ export { ad as $inc, ae as $push, ab as $set, ac as $unset, A as AllowedDbClientOptions, a6 as AlternativeType, E as CollectionOperationOptions, C as CollectionsMap, a7 as Condition, o as DBsMap, aj as DOCUMENT_DOES_NOT_EXIST, ai as DOCUMENT_EXISTS, K as DeleteManyOptions, J as DeleteOneOptions, a1 as Document, D as DocumentHandler, Q as EnhancedOmit, ah as ExpectedDocumentVersion, af as ExpectedDocumentVersionGeneral, ag as ExpectedDocumentVersionValue, H as HandleOptions, L as HasId, M as InferIdType, F as InsertManyOptions, I as InsertOneOptions, ak as NO_CONCURRENCY_CHECK, a5 as NonObjectIdLikeDocument, N as NotPooledPongoOptions, O as ObjectId, a4 as ObjectIdLike, ap as OperationResult, a2 as OptionalId, S as OptionalUnlessRequiredId, V as OptionalUnlessRequiredIdAndVersion, T as OptionalUnlessRequiredVersion, a3 as OptionalVersion, B as PongoClient, b as PongoClientOptions, m as PongoClientSchema, w as PongoClientSchemaMetadata, q as PongoClientWithSchema, c as PongoCollection, k as PongoCollectionSchema, u as PongoCollectionSchemaMetadata, P as PongoDb, i as PongoDbClientOptions, l as PongoDbSchema, v as PongoDbSchemaMetadata, n as PongoDbWithSchema, aw as PongoDeleteManyResult, av as PongoDeleteResult, ax as PongoDocument, a8 as PongoFilter, aa as PongoFilterOperator, a as PongoHandleResult, as as PongoInsertManyResult, ar as PongoInsertOneResult, z as PongoSchemaConfig, ao as PongoUpdate, au as PongoUpdateManyResult, at as PongoUpdateResult, g as PooledPongoClientOptions, ay as PostgresDbClientOptions, a0 as RegExpOrString, R as ReplaceOneOptions, a9 as RootFilterOperators, G as UpdateManyOptions, U as UpdateOneOptions, W as WithId, _ as WithIdAndVersion, Y as WithVersion, X as WithoutId, $ as WithoutIdAndVersion, Z as WithoutVersion, h as clientToDbOptions, an as expectedVersion, am as expectedVersionValue, j as getPongoDb, al as isGeneralExpectedDocumentVersion, az as isPostgresClientOptions, aq as operationResult, p as pongoClient, aB as pongoDbSchemaComponent, r as pongoSchema, aA as postgresDb, t as proxyClientWithSchema, s as proxyPongoDbWithSchema, y as toClientSchemaMetadata, x as toDbSchemaMetadata } from './pongoClient-BpQPqFEh.js';
4
4
  import '@event-driven-io/dumbo';
5
+ import '@event-driven-io/dumbo/pg';
5
6
  import 'pg';
7
+ import '@event-driven-io/dumbo/src';
6
8
 
7
9
  declare const QueryOperators: {
8
10
  $eq: string;
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  toClientSchemaMetadata,
37
37
  toDbSchemaMetadata,
38
38
  transactionExecutorOrDefault
39
- } from "./chunk-VZKV7AMY.js";
39
+ } from "./chunk-DRVOAVHN.js";
40
40
  export {
41
41
  ConcurrencyError,
42
42
  DOCUMENT_DOES_NOT_EXIST,
@@ -1,8 +1,8 @@
1
- import { P as PongoDb, V as OptionalUnlessRequiredIdAndVersion, a8 as PongoFilter, ao as PongoUpdate, U as UpdateOneOptions, X as WithoutId, R as ReplaceOneOptions, J as DeleteOneOptions, E as CollectionOperationOptions, ax as PongoDocument, c as PongoCollection } from './pongoClient-CJBLCrlZ.js';
2
- import { Dumbo, SQLMigration, SQL, MigrationStyle, SQLExecutor, SchemaComponent } from '@event-driven-io/dumbo';
1
+ import { P as PongoDb, V as OptionalUnlessRequiredIdAndVersion, a8 as PongoFilter, ao as PongoUpdate, U as UpdateOneOptions, X as WithoutId, R as ReplaceOneOptions, J as DeleteOneOptions, E as CollectionOperationOptions, ax as PongoDocument, c as PongoCollection } from './pongoClient-BpQPqFEh.js';
2
+ import { ConnectorType, Dumbo, SQLMigration, SQL, MigrationStyle, SQLExecutor, SchemaComponent } from '@event-driven-io/dumbo';
3
3
 
4
- type PongoCollectionOptions<ConnectorType extends string = string> = {
5
- db: PongoDb<ConnectorType>;
4
+ type PongoCollectionOptions<Connector extends ConnectorType = ConnectorType> = {
5
+ db: PongoDb<Connector>;
6
6
  collectionName: string;
7
7
  pool: Dumbo;
8
8
  sqlBuilder: PongoCollectionSQLBuilder;
@@ -13,8 +13,8 @@ type PongoCollectionOptions<ConnectorType extends string = string> = {
13
13
  throwOnOperationFailures?: boolean;
14
14
  };
15
15
  };
16
- declare const transactionExecutorOrDefault: <ConnectorType extends string = string>(db: PongoDb<ConnectorType>, options: CollectionOperationOptions | undefined, defaultSqlExecutor: SQLExecutor) => Promise<SQLExecutor>;
17
- declare const pongoCollection: <T extends PongoDocument, ConnectorType extends string = string>({ db, collectionName, pool, sqlBuilder: SqlFor, schema, errors, }: PongoCollectionOptions<ConnectorType>) => PongoCollection<T>;
16
+ declare const transactionExecutorOrDefault: <Connector extends ConnectorType = ConnectorType>(db: PongoDb<Connector>, options: CollectionOperationOptions | undefined, defaultSqlExecutor: SQLExecutor) => Promise<SQLExecutor>;
17
+ declare const pongoCollection: <T extends PongoDocument, Connector extends ConnectorType = ConnectorType>({ db, collectionName, pool, sqlBuilder: SqlFor, schema, errors, }: PongoCollectionOptions<Connector>) => PongoCollection<T>;
18
18
  declare const pongoCollectionSchemaComponent: (collectionName: string) => SchemaComponent;
19
19
  type PongoCollectionSQLBuilder = {
20
20
  migrations: () => SQLMigration[];
@@ -1,8 +1,8 @@
1
- import { P as PongoDb, V as OptionalUnlessRequiredIdAndVersion, a8 as PongoFilter, ao as PongoUpdate, U as UpdateOneOptions, X as WithoutId, R as ReplaceOneOptions, J as DeleteOneOptions, E as CollectionOperationOptions, ax as PongoDocument, c as PongoCollection } from './pongoClient-CJBLCrlZ.cjs';
2
- import { Dumbo, SQLMigration, SQL, MigrationStyle, SQLExecutor, SchemaComponent } from '@event-driven-io/dumbo';
1
+ import { P as PongoDb, V as OptionalUnlessRequiredIdAndVersion, a8 as PongoFilter, ao as PongoUpdate, U as UpdateOneOptions, X as WithoutId, R as ReplaceOneOptions, J as DeleteOneOptions, E as CollectionOperationOptions, ax as PongoDocument, c as PongoCollection } from './pongoClient-BpQPqFEh.cjs';
2
+ import { ConnectorType, Dumbo, SQLMigration, SQL, MigrationStyle, SQLExecutor, SchemaComponent } from '@event-driven-io/dumbo';
3
3
 
4
- type PongoCollectionOptions<ConnectorType extends string = string> = {
5
- db: PongoDb<ConnectorType>;
4
+ type PongoCollectionOptions<Connector extends ConnectorType = ConnectorType> = {
5
+ db: PongoDb<Connector>;
6
6
  collectionName: string;
7
7
  pool: Dumbo;
8
8
  sqlBuilder: PongoCollectionSQLBuilder;
@@ -13,8 +13,8 @@ type PongoCollectionOptions<ConnectorType extends string = string> = {
13
13
  throwOnOperationFailures?: boolean;
14
14
  };
15
15
  };
16
- declare const transactionExecutorOrDefault: <ConnectorType extends string = string>(db: PongoDb<ConnectorType>, options: CollectionOperationOptions | undefined, defaultSqlExecutor: SQLExecutor) => Promise<SQLExecutor>;
17
- declare const pongoCollection: <T extends PongoDocument, ConnectorType extends string = string>({ db, collectionName, pool, sqlBuilder: SqlFor, schema, errors, }: PongoCollectionOptions<ConnectorType>) => PongoCollection<T>;
16
+ declare const transactionExecutorOrDefault: <Connector extends ConnectorType = ConnectorType>(db: PongoDb<Connector>, options: CollectionOperationOptions | undefined, defaultSqlExecutor: SQLExecutor) => Promise<SQLExecutor>;
17
+ declare const pongoCollection: <T extends PongoDocument, Connector extends ConnectorType = ConnectorType>({ db, collectionName, pool, sqlBuilder: SqlFor, schema, errors, }: PongoCollectionOptions<Connector>) => PongoCollection<T>;
18
18
  declare const pongoCollectionSchemaComponent: (collectionName: string) => SchemaComponent;
19
19
  type PongoCollectionSQLBuilder = {
20
20
  migrations: () => SQLMigration[];
package/dist/pg.cjs CHANGED
@@ -4,12 +4,12 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkLNVXUDQHcjs = require('./chunk-LNVXUDQH.cjs');
7
+ var _chunkATI5CCCTcjs = require('./chunk-ATI5CCCT.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
- exports.isPostgresClientOptions = _chunkLNVXUDQHcjs.isPostgresClientOptions; exports.pongoCollectionPostgreSQLMigrations = _chunkLNVXUDQHcjs.pongoCollectionPostgreSQLMigrations; exports.pongoDbSchemaComponent = _chunkLNVXUDQHcjs.pongoDbSchemaComponent; exports.postgresDb = _chunkLNVXUDQHcjs.postgresDb; exports.postgresSQLBuilder = _chunkLNVXUDQHcjs.postgresSQLBuilder;
14
+ exports.isPostgresClientOptions = _chunkATI5CCCTcjs.isPostgresClientOptions; exports.pongoCollectionPostgreSQLMigrations = _chunkATI5CCCTcjs.pongoCollectionPostgreSQLMigrations; exports.pongoDbSchemaComponent = _chunkATI5CCCTcjs.pongoDbSchemaComponent; exports.postgresDb = _chunkATI5CCCTcjs.postgresDb; exports.postgresSQLBuilder = _chunkATI5CCCTcjs.postgresSQLBuilder;
15
15
  //# sourceMappingURL=pg.cjs.map
package/dist/pg.d.cts CHANGED
@@ -1,4 +1,6 @@
1
- export { ay as PostgresDbClientOptions, az as isPostgresClientOptions, aB as pongoDbSchemaComponent, aA as postgresDb } from './pongoClient-CJBLCrlZ.cjs';
2
- export { c as pongoCollectionPostgreSQLMigrations, d as postgresSQLBuilder } from './pg-DMJLxTdz.cjs';
1
+ export { ay as PostgresDbClientOptions, az as isPostgresClientOptions, aB as pongoDbSchemaComponent, aA as postgresDb } from './pongoClient-BpQPqFEh.cjs';
2
+ export { c as pongoCollectionPostgreSQLMigrations, d as postgresSQLBuilder } from './pg-CO6kw3rY.cjs';
3
3
  import '@event-driven-io/dumbo';
4
+ import '@event-driven-io/dumbo/pg';
4
5
  import 'pg';
6
+ import '@event-driven-io/dumbo/src';
package/dist/pg.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export { ay as PostgresDbClientOptions, az as isPostgresClientOptions, aB as pongoDbSchemaComponent, aA as postgresDb } from './pongoClient-CJBLCrlZ.js';
2
- export { c as pongoCollectionPostgreSQLMigrations, d as postgresSQLBuilder } from './pg-CGd2X9NW.js';
1
+ export { ay as PostgresDbClientOptions, az as isPostgresClientOptions, aB as pongoDbSchemaComponent, aA as postgresDb } from './pongoClient-BpQPqFEh.js';
2
+ export { c as pongoCollectionPostgreSQLMigrations, d as postgresSQLBuilder } from './pg-BTgRFIL2.js';
3
3
  import '@event-driven-io/dumbo';
4
+ import '@event-driven-io/dumbo/pg';
4
5
  import 'pg';
6
+ import '@event-driven-io/dumbo/src';
package/dist/pg.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  pongoDbSchemaComponent,
5
5
  postgresDb,
6
6
  postgresSQLBuilder
7
- } from "./chunk-VZKV7AMY.js";
7
+ } from "./chunk-DRVOAVHN.js";
8
8
  export {
9
9
  isPostgresClientOptions,
10
10
  pongoCollectionPostgreSQLMigrations,
@@ -1,5 +1,7 @@
1
- import { PostgresConnector, SchemaComponent, DatabaseTransactionFactory, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, NodePostgresConnection, MigrationStyle } from '@event-driven-io/dumbo';
1
+ import { SchemaComponent, ConnectorType, DatabaseTransactionFactory, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, MigrationStyle } from '@event-driven-io/dumbo';
2
+ import { PostgresConnector, NodePostgresConnection } from '@event-driven-io/dumbo/pg';
2
3
  import pg from 'pg';
4
+ import { ConnectorType as ConnectorType$1 } from '@event-driven-io/dumbo/src';
3
5
 
4
6
  type PostgresDbClientOptions = PongoDbClientOptions<PostgresConnector>;
5
7
  declare const isPostgresClientOptions: (options: PongoDbClientOptions) => options is PostgresDbClientOptions;
@@ -42,8 +44,8 @@ interface PongoSession {
42
44
  abortTransaction(): Promise<void>;
43
45
  withTransaction<T = unknown>(fn: (session: PongoSession) => Promise<T>, options?: PongoTransactionOptions): Promise<T>;
44
46
  }
45
- interface PongoDb<ConnectorType extends string = string> extends DatabaseTransactionFactory<ConnectorType> {
46
- get connectorType(): ConnectorType;
47
+ interface PongoDb<Connector extends ConnectorType = ConnectorType> extends DatabaseTransactionFactory<Connector> {
48
+ get connector(): Connector;
47
49
  get databaseName(): string;
48
50
  connect(): Promise<void>;
49
51
  close(): Promise<void>;
@@ -267,8 +269,8 @@ type PongoHandleResult<T> = (PongoInsertOneResult & {
267
269
  type PongoDocument = Record<string, unknown>;
268
270
  type DocumentHandler<T extends PongoDocument> = ((document: T | null) => T | null) | ((document: T | null) => Promise<T | null>);
269
271
 
270
- type PongoDbClientOptions<ConnectorType extends string = string> = {
271
- connectorType: ConnectorType;
272
+ type PongoDbClientOptions<Connector extends ConnectorType$1 = ConnectorType$1> = {
273
+ connector: Connector;
272
274
  connectionString: string;
273
275
  dbName: string | undefined;
274
276
  } & PongoClientOptions;
@@ -288,11 +290,11 @@ interface PongoClientSchema<T extends Record<string, PongoDbSchema> = Record<str
288
290
  type CollectionsMap<T extends Record<string, PongoCollectionSchema>> = {
289
291
  [K in keyof T]: PongoCollection<T[K] extends PongoCollectionSchema<infer U> ? U : PongoDocument>;
290
292
  };
291
- type PongoDbWithSchema<T extends Record<string, PongoCollectionSchema>, ConnectorType extends string = string> = CollectionsMap<T> & PongoDb<ConnectorType>;
292
- type DBsMap<T extends Record<string, PongoDbSchema>, ConnectorType extends string = string> = {
293
- [K in keyof T]: CollectionsMap<T[K]['collections']> & PongoDb<ConnectorType>;
293
+ type PongoDbWithSchema<T extends Record<string, PongoCollectionSchema>, Connector extends ConnectorType$1 = ConnectorType$1> = CollectionsMap<T> & PongoDb<Connector>;
294
+ type DBsMap<T extends Record<string, PongoDbSchema>, Connector extends ConnectorType$1 = ConnectorType$1> = {
295
+ [K in keyof T]: CollectionsMap<T[K]['collections']> & PongoDb<Connector>;
294
296
  };
295
- type PongoClientWithSchema<T extends PongoClientSchema, ConnectorType extends string = string> = DBsMap<T['dbs'], ConnectorType> & PongoClient;
297
+ type PongoClientWithSchema<T extends PongoClientSchema, Connector extends ConnectorType$1 = ConnectorType$1> = DBsMap<T['dbs'], Connector> & PongoClient;
296
298
  declare function pongoDbSchema<T extends Record<string, PongoCollectionSchema>>(collections: T): PongoDbSchema<T>;
297
299
  declare function pongoDbSchema<T extends Record<string, PongoCollectionSchema>>(name: string, collections: T): PongoDbSchema<T>;
298
300
  declare const pongoSchema: {
@@ -300,7 +302,7 @@ declare const pongoSchema: {
300
302
  db: typeof pongoDbSchema;
301
303
  collection: <T extends PongoDocument>(name: string) => PongoCollectionSchema<T>;
302
304
  };
303
- declare const proxyPongoDbWithSchema: <T extends Record<string, PongoCollectionSchema>, ConnectorType extends string = string>(pongoDb: PongoDb<ConnectorType>, dbSchema: PongoDbSchema<T>, collections: Map<string, PongoCollection<Document>>) => PongoDbWithSchema<T, ConnectorType>;
305
+ declare const proxyPongoDbWithSchema: <T extends Record<string, PongoCollectionSchema>, Connector extends ConnectorType$1 = ConnectorType$1>(pongoDb: PongoDb<Connector>, dbSchema: PongoDbSchema<T>, collections: Map<string, PongoCollection<Document>>) => PongoDbWithSchema<T, Connector>;
304
306
  declare const proxyClientWithSchema: <TypedClientSchema extends PongoClientSchema>(client: PongoClient, schema: TypedClientSchema | undefined) => PongoClientWithSchema<TypedClientSchema>;
305
307
  type PongoCollectionSchemaMetadata = {
306
308
  name: string;
@@ -1,5 +1,7 @@
1
- import { PostgresConnector, SchemaComponent, DatabaseTransactionFactory, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, NodePostgresConnection, MigrationStyle } from '@event-driven-io/dumbo';
1
+ import { SchemaComponent, ConnectorType, DatabaseTransactionFactory, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, MigrationStyle } from '@event-driven-io/dumbo';
2
+ import { PostgresConnector, NodePostgresConnection } from '@event-driven-io/dumbo/pg';
2
3
  import pg from 'pg';
4
+ import { ConnectorType as ConnectorType$1 } from '@event-driven-io/dumbo/src';
3
5
 
4
6
  type PostgresDbClientOptions = PongoDbClientOptions<PostgresConnector>;
5
7
  declare const isPostgresClientOptions: (options: PongoDbClientOptions) => options is PostgresDbClientOptions;
@@ -42,8 +44,8 @@ interface PongoSession {
42
44
  abortTransaction(): Promise<void>;
43
45
  withTransaction<T = unknown>(fn: (session: PongoSession) => Promise<T>, options?: PongoTransactionOptions): Promise<T>;
44
46
  }
45
- interface PongoDb<ConnectorType extends string = string> extends DatabaseTransactionFactory<ConnectorType> {
46
- get connectorType(): ConnectorType;
47
+ interface PongoDb<Connector extends ConnectorType = ConnectorType> extends DatabaseTransactionFactory<Connector> {
48
+ get connector(): Connector;
47
49
  get databaseName(): string;
48
50
  connect(): Promise<void>;
49
51
  close(): Promise<void>;
@@ -267,8 +269,8 @@ type PongoHandleResult<T> = (PongoInsertOneResult & {
267
269
  type PongoDocument = Record<string, unknown>;
268
270
  type DocumentHandler<T extends PongoDocument> = ((document: T | null) => T | null) | ((document: T | null) => Promise<T | null>);
269
271
 
270
- type PongoDbClientOptions<ConnectorType extends string = string> = {
271
- connectorType: ConnectorType;
272
+ type PongoDbClientOptions<Connector extends ConnectorType$1 = ConnectorType$1> = {
273
+ connector: Connector;
272
274
  connectionString: string;
273
275
  dbName: string | undefined;
274
276
  } & PongoClientOptions;
@@ -288,11 +290,11 @@ interface PongoClientSchema<T extends Record<string, PongoDbSchema> = Record<str
288
290
  type CollectionsMap<T extends Record<string, PongoCollectionSchema>> = {
289
291
  [K in keyof T]: PongoCollection<T[K] extends PongoCollectionSchema<infer U> ? U : PongoDocument>;
290
292
  };
291
- type PongoDbWithSchema<T extends Record<string, PongoCollectionSchema>, ConnectorType extends string = string> = CollectionsMap<T> & PongoDb<ConnectorType>;
292
- type DBsMap<T extends Record<string, PongoDbSchema>, ConnectorType extends string = string> = {
293
- [K in keyof T]: CollectionsMap<T[K]['collections']> & PongoDb<ConnectorType>;
293
+ type PongoDbWithSchema<T extends Record<string, PongoCollectionSchema>, Connector extends ConnectorType$1 = ConnectorType$1> = CollectionsMap<T> & PongoDb<Connector>;
294
+ type DBsMap<T extends Record<string, PongoDbSchema>, Connector extends ConnectorType$1 = ConnectorType$1> = {
295
+ [K in keyof T]: CollectionsMap<T[K]['collections']> & PongoDb<Connector>;
294
296
  };
295
- type PongoClientWithSchema<T extends PongoClientSchema, ConnectorType extends string = string> = DBsMap<T['dbs'], ConnectorType> & PongoClient;
297
+ type PongoClientWithSchema<T extends PongoClientSchema, Connector extends ConnectorType$1 = ConnectorType$1> = DBsMap<T['dbs'], Connector> & PongoClient;
296
298
  declare function pongoDbSchema<T extends Record<string, PongoCollectionSchema>>(collections: T): PongoDbSchema<T>;
297
299
  declare function pongoDbSchema<T extends Record<string, PongoCollectionSchema>>(name: string, collections: T): PongoDbSchema<T>;
298
300
  declare const pongoSchema: {
@@ -300,7 +302,7 @@ declare const pongoSchema: {
300
302
  db: typeof pongoDbSchema;
301
303
  collection: <T extends PongoDocument>(name: string) => PongoCollectionSchema<T>;
302
304
  };
303
- declare const proxyPongoDbWithSchema: <T extends Record<string, PongoCollectionSchema>, ConnectorType extends string = string>(pongoDb: PongoDb<ConnectorType>, dbSchema: PongoDbSchema<T>, collections: Map<string, PongoCollection<Document>>) => PongoDbWithSchema<T, ConnectorType>;
305
+ declare const proxyPongoDbWithSchema: <T extends Record<string, PongoCollectionSchema>, Connector extends ConnectorType$1 = ConnectorType$1>(pongoDb: PongoDb<Connector>, dbSchema: PongoDbSchema<T>, collections: Map<string, PongoCollection<Document>>) => PongoDbWithSchema<T, Connector>;
304
306
  declare const proxyClientWithSchema: <TypedClientSchema extends PongoClientSchema>(client: PongoClient, schema: TypedClientSchema | undefined) => PongoClientWithSchema<TypedClientSchema>;
305
307
  type PongoCollectionSchemaMetadata = {
306
308
  name: string;
package/dist/shim.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkLNVXUDQHcjs = require('./chunk-LNVXUDQH.cjs');
4
+ var _chunkATI5CCCTcjs = require('./chunk-ATI5CCCT.cjs');
5
5
 
6
6
  // src/mongo/findCursor.ts
7
7
  var FindCursor = (_class = class {
@@ -299,7 +299,7 @@ var Db = class {
299
299
  var MongoClient = class {
300
300
 
301
301
  constructor(connectionString, options = {}) {
302
- this.pongoClient = _chunkLNVXUDQHcjs.pongoClient.call(void 0, connectionString, options);
302
+ this.pongoClient = _chunkATI5CCCTcjs.pongoClient.call(void 0, connectionString, options);
303
303
  }
304
304
  async connect() {
305
305
  await this.pongoClient.connect();
@@ -312,12 +312,12 @@ var MongoClient = class {
312
312
  return new Db(this.pongoClient.db(dbName));
313
313
  }
314
314
  startSession(_options) {
315
- return _chunkLNVXUDQHcjs.pongoSession.call(void 0, );
315
+ return _chunkATI5CCCTcjs.pongoSession.call(void 0, );
316
316
  }
317
317
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
318
  async withSession(optionsOrExecutor, executor) {
319
319
  const callback = typeof optionsOrExecutor === "function" ? optionsOrExecutor : executor;
320
- const session = _chunkLNVXUDQHcjs.pongoSession.call(void 0, );
320
+ const session = _chunkATI5CCCTcjs.pongoSession.call(void 0, );
321
321
  try {
322
322
  return await callback(session);
323
323
  } finally {
package/dist/shim.d.cts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { ClientSessionOptions } from 'http2';
2
2
  import { Document, Collection as Collection$1, ObjectId, ClientSession, WithSessionCallback, ReadConcern, ReadPreference, BSONSerializeOptions, WriteConcern, Hint, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, AnyBulkWriteOperation, BulkWriteResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, WithoutId, ReplaceOptions, DeleteOptions, DeleteResult, RenameOptions, DropCollectionOptions, WithId, FindOptions, FindCursor as FindCursor$1, OperationOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, CommandOperationOptions, AbstractCursorOptions, ListIndexesCursor, IndexInformationOptions, IndexDescriptionInfo, IndexDescriptionCompact, EstimatedDocumentCountOptions, CountDocumentsOptions, EnhancedOmit, Flatten, FindOneAndDeleteOptions, ModifyResult, FindOneAndReplaceOptions, FindOneAndUpdateOptions, AggregateOptions, AggregationCursor, ChangeStreamDocument, ChangeStreamOptions, ChangeStream, UnorderedBulkOperation, OrderedBulkOperation, CountOptions, ListSearchIndexesOptions, ListSearchIndexesCursor, SearchIndexDescription } from 'mongodb';
3
- import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-CJBLCrlZ.cjs';
3
+ import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-BpQPqFEh.cjs';
4
4
  import '@event-driven-io/dumbo';
5
+ import '@event-driven-io/dumbo/pg';
5
6
  import 'pg';
7
+ import '@event-driven-io/dumbo/src';
6
8
 
7
9
  declare class FindCursor<T> {
8
10
  private findDocumentsPromise;
package/dist/shim.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { ClientSessionOptions } from 'http2';
2
2
  import { Document, Collection as Collection$1, ObjectId, ClientSession, WithSessionCallback, ReadConcern, ReadPreference, BSONSerializeOptions, WriteConcern, Hint, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, AnyBulkWriteOperation, BulkWriteResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, WithoutId, ReplaceOptions, DeleteOptions, DeleteResult, RenameOptions, DropCollectionOptions, WithId, FindOptions, FindCursor as FindCursor$1, OperationOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, CommandOperationOptions, AbstractCursorOptions, ListIndexesCursor, IndexInformationOptions, IndexDescriptionInfo, IndexDescriptionCompact, EstimatedDocumentCountOptions, CountDocumentsOptions, EnhancedOmit, Flatten, FindOneAndDeleteOptions, ModifyResult, FindOneAndReplaceOptions, FindOneAndUpdateOptions, AggregateOptions, AggregationCursor, ChangeStreamDocument, ChangeStreamOptions, ChangeStream, UnorderedBulkOperation, OrderedBulkOperation, CountOptions, ListSearchIndexesOptions, ListSearchIndexesCursor, SearchIndexDescription } from 'mongodb';
3
- import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-CJBLCrlZ.js';
3
+ import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-BpQPqFEh.js';
4
4
  import '@event-driven-io/dumbo';
5
+ import '@event-driven-io/dumbo/pg';
5
6
  import 'pg';
7
+ import '@event-driven-io/dumbo/src';
6
8
 
7
9
  declare class FindCursor<T> {
8
10
  private findDocumentsPromise;
package/dist/shim.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  pongoClient,
3
3
  pongoSession
4
- } from "./chunk-VZKV7AMY.js";
4
+ } from "./chunk-DRVOAVHN.js";
5
5
 
6
6
  // src/mongo/findCursor.ts
7
7
  var FindCursor = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-driven-io/pongo",
3
- "version": "0.17.0-alpha.1",
3
+ "version": "0.17.0-alpha.3",
4
4
  "description": "Pongo - Mongo with strong consistency on top of Postgres",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -113,7 +113,7 @@
113
113
  "pongo": "./dist/cli.js"
114
114
  },
115
115
  "peerDependencies": {
116
- "@event-driven-io/dumbo": "0.13.0-alpha.1",
116
+ "@event-driven-io/dumbo": "0.13.0-alpha.3",
117
117
  "@types/mongodb": "^4.0.7",
118
118
  "@types/pg": "^8.11.11",
119
119
  "@types/sqlite3": "^5.1.0",