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;GAGG;AACH,eAAO,MAAM,eAAe;;;CAAgD,CAAC;AAC7E;;;GAGG;AACH,eAAO,MAAM,YAAY;;;CAA6C,CAAC;AACvE;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;CAA4C,CAAC;AACrE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;CAAoD,CAAC;AACrF;;;GAGG;AACH,eAAO,MAAM,WAAW;;;CAA4C,CAAC;AACrE;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;CAA2C,CAAC;AACnE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;CAAmD,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,OAAO,wDAAwC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAA2C,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;CAA4C,CAAC;AACrE;;;;GAIG;AACH,eAAO,MAAM,eAAe,0CAAgD,CAAC;AAC7E;;;;GAIG;AACH,eAAO,MAAM,eAAe,qBAAgD,CAAC;AAC7E;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,qCAA2D,CAAC;AAEnG;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,mCAAyD,CAAC","sourcesContent":["import { type CursorIterator, PostgresPool, type QueryParams } from './pool.js';\n\nconst defaultPool = new PostgresPool();\nexport { defaultPool, type CursorIterator, type QueryParams };\n\n// We re-expose all functions from the default pool here to account for the\n// default case of a shared global pool of clients. If someone want to create\n// their own pool, we expose the `PostgresPool` class.\n//\n// Note that we explicitly bind all functions to `defaultPool`. This ensures\n// that they'll be invoked with the correct `this` context, specifically when\n// this module is imported as `import * as db from '...'` and that import is\n// subsequently transformed by Babel to `interopRequireWildcard(...)`.\n\n// VSCode currently doesn't allow for us to use `inheritDoc` to inherit the\n// documentation from the `PostgresPool` class. We mirror the documentation\n// here for *async methods* in VSCode intellisense.\n\n/**\n * Creates a new connection pool and attempts to connect to the database.\n */\nexport const initAsync = defaultPool.initAsync.bind(defaultPool);\n/**\n * Closes the connection pool.\n */\nexport const closeAsync = defaultPool.closeAsync.bind(defaultPool);\n/**\n * Gets a new client from the connection pool. The caller MUST call `release()` to\n * release the client, whether or not errors occurred while using\n * `client`. The client can call `done(truthy_value)` to force\n * destruction of the client, but this should not be used except in\n * unusual circumstances.\n */\nexport const getClientAsync = defaultPool.getClientAsync.bind(defaultPool);\n\n/**\n * Performs a query with the given client.\n */\nexport const queryWithClientAsync = defaultPool.queryWithClientAsync.bind(defaultPool);\n\n/**\n * Performs a query with the given client. Errors if the query returns more\n * than one row.\n */\nexport const queryWithClientOneRowAsync = defaultPool.queryWithClientOneRowAsync.bind(defaultPool);\n\n/**\n * Performs a query with the given client. Errors if the query returns more\n * than one row.\n */\nexport const queryWithClientZeroOrOneRowAsync =\n  defaultPool.queryWithClientZeroOrOneRowAsync.bind(defaultPool);\n/**\n * Rolls back the current transaction for the given client.\n */\nexport const rollbackWithClientAsync = defaultPool.rollbackWithClientAsync.bind(defaultPool);\nexport const beginTransactionAsync = defaultPool.beginTransactionAsync.bind(defaultPool);\n/**\n * Commits the transaction if err is null, otherwise rollbacks the transaction.\n * Also releases the client.\n */\nexport const endTransactionAsync = defaultPool.endTransactionAsync.bind(defaultPool);\n/**\n * Runs the specified function inside of a transaction. The function will\n * receive a database client as an argument, but it can also make queries\n * as usual, and the correct client will be used automatically.\n *\n * The transaction will be rolled back if the function throws an error, and\n * will be committed otherwise.\n */\nexport const runInTransactionAsync = defaultPool.runInTransactionAsync.bind(defaultPool);\n/**\n * Calls a sproc with the specified parameters using a specific client.\n */\nexport const callWithClientAsync = defaultPool.callWithClientAsync.bind(defaultPool);\n/**\n * Calls a sproc with the specified parameters using a specific client.\n * Errors if the sproc does not return exactly one row.\n */\nexport const callWithClientOneRowAsync = defaultPool.callWithClientOneRowAsync.bind(defaultPool);\n/**\n * Calls a sproc with the specified parameters using a specific client.\n * Errors if the sproc returns more than one row.\n */\nexport const callWithClientZeroOrOneRowAsync =\n  defaultPool.callWithClientZeroOrOneRowAsync.bind(defaultPool);\n/**\n * Executes a query with the specified parameters. Returns an array of rows\n * that conform to the given Zod schema.\n */\nexport const queryRows = defaultPool.queryRows.bind(defaultPool);\n/**\n * Executes a query with the specified parameters. Returns exactly one row that conforms to the given Zod schema.\n */\nexport const queryRow = defaultPool.queryRow.bind(defaultPool);\n/**\n * Executes a query with the specified parameters. Returns either null or a\n * single row that conforms to the given Zod schema, and errors otherwise.\n */\nexport const queryOptionalRow = defaultPool.queryOptionalRow.bind(defaultPool);\n/**\n * Calls the given sproc with the specified parameters.\n * Errors if the sproc does not return anything.\n */\nexport const callRows = defaultPool.callRows.bind(defaultPool);\n/**\n * Calls the given sproc with the specified parameters.\n * Returns exactly one row from the sproc that conforms to the given Zod schema.\n */\nexport const callRow = defaultPool.callRow.bind(defaultPool);\n/**\n * Calls the given sproc with the specified parameters. Returns either null\n * or a single row that conforms to the given Zod schema.\n */\nexport const callOptionalRow = defaultPool.callOptionalRow.bind(defaultPool);\n/**\n * Executes a query and returns all values from a single column, validated\n * against the given Zod schema. Errors if the query returns more than one column.\n */\nexport const queryScalars = defaultPool.queryScalars.bind(defaultPool);\n/**\n * Executes a query and returns a single value from a single column, validated\n * against the given Zod schema. Errors if the query does not return exactly\n * one row or returns more than one column.\n */\nexport const queryScalar = defaultPool.queryScalar.bind(defaultPool);\n/**\n * Executes a query and returns a single value from a single column, or null\n * if no rows are returned. Validated against the given Zod schema. Errors if\n * the query returns more than one row or more than one column.\n */\nexport const queryOptionalScalar = defaultPool.queryOptionalScalar.bind(defaultPool);\n/**\n * Calls the given sproc and returns all values from a single column, validated\n * against the given Zod schema. Errors if the sproc returns more than one column.\n */\nexport const callScalars = defaultPool.callScalars.bind(defaultPool);\n/**\n * Calls the given sproc and returns a single value from a single column, validated\n * against the given Zod schema. Errors if the sproc does not return exactly\n * one row or returns more than one column.\n */\nexport const callScalar = defaultPool.callScalar.bind(defaultPool);\n/**\n * Calls the given sproc and returns a single value from a single column, or\n * null if no rows are returned. Validated against the given Zod schema.\n * Errors if the sproc returns more than one row or more than one column.\n */\nexport const callOptionalScalar = defaultPool.callOptionalScalar.bind(defaultPool);\n\n/**\n * Executes a query with the specified parameters. Returns the number of rows affected.\n */\nexport const execute = defaultPool.execute.bind(defaultPool);\n\n/**\n * Executes a query with the specified parameter, and errors if the query doesn't return exactly one row.\n */\nexport const executeRow = defaultPool.executeRow.bind(defaultPool);\n\n/**\n * Returns an {@link CursorIterator} that can be used to iterate over the\n * results of the query in batches, which is useful for large result sets.\n * Each row will be parsed by the given Zod schema.\n */\nexport const queryCursor = defaultPool.queryCursor.bind(defaultPool);\n/**\n * Set the schema to use for the search path.\n *\n * @param schema The schema name to use (can be \"null\" to unset the search path)\n */\nexport const setSearchSchema = defaultPool.setSearchSchema.bind(defaultPool);\n/**\n * Get the schema that is currently used for the search path.\n *\n * @returns schema in use (may be `null` to indicate no schema)\n */\nexport const getSearchSchema = defaultPool.getSearchSchema.bind(defaultPool);\n/**\n * Generate, set, and return a random schema name.\n *\n * @param prefix The prefix of the new schema, only the first 28 characters will be used (after lowercasing).\n * @returns The randomly-generated search schema.\n */\nexport const setRandomSearchSchemaAsync = defaultPool.setRandomSearchSchemaAsync.bind(defaultPool);\n\n/**\n * Deletes all schemas starting with the given prefix.\n *\n * @param prefix The prefix of the schemas to delete.\n */\nexport const clearSchemasStartingWith = defaultPool.clearSchemasStartingWith.bind(defaultPool);\n"]}