{"version":3,"file":"knex.mjs","sources":["../../src/utils/knex.ts"],"sourcesContent":["import type { Knex } from 'knex';\n\nimport KnexBuilder from 'knex/lib/query/querybuilder';\nimport KnexRaw from 'knex/lib/raw';\n\nimport type { Database } from '..';\n\n/**\n * @internal\n */\nexport function isKnexQuery(value: unknown): value is Knex.Raw | Knex.QueryBuilder {\n return value instanceof KnexBuilder || value instanceof KnexRaw;\n}\n\n/**\n * Adds the name of the schema to the table name if the schema was defined by the user.\n * Users can set the db schema only for Postgres in strapi database config.\n */\nexport const addSchema = (db: Database, tableName: string): string => {\n const schemaName = db.getSchemaName();\n return schemaName ? `${schemaName}.${tableName}` : tableName;\n};\n"],"names":["isKnexQuery","value","KnexBuilder","KnexRaw","addSchema","db","tableName","schemaName","getSchemaName"],"mappings":";;;AAOA;;IAGO,SAASA,WAAAA,CAAYC,KAAc,EAAA;IACxC,OAAOA,KAAAA,YAAiBC,eAAeD,KAAiBE,YAAAA,OAAAA;AAC1D;AAEA;;;AAGC,IACM,MAAMC,SAAY,GAAA,CAACC,EAAcC,EAAAA,SAAAA,GAAAA;IACtC,MAAMC,UAAAA,GAAaF,GAAGG,aAAa,EAAA;IACnC,OAAOD,UAAAA,GAAa,CAAC,EAAEA,UAAAA,CAAW,CAAC,EAAED,SAAAA,CAAU,CAAC,GAAGA,SAAAA;AACrD;;;;"}