session.cjs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __export = (target, all) => {
  7. for (var name in all)
  8. __defProp(target, name, { get: all[name], enumerable: true });
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  19. var session_exports = {};
  20. __export(session_exports, {
  21. PrismaPgPreparedQuery: () => PrismaPgPreparedQuery,
  22. PrismaPgSession: () => PrismaPgSession
  23. });
  24. module.exports = __toCommonJS(session_exports);
  25. var import_entity = require("../../entity.cjs");
  26. var import_logger = require("../../logger.cjs");
  27. var import_pg_core = require("../../pg-core/index.cjs");
  28. var import_sql = require("../../sql/sql.cjs");
  29. class PrismaPgPreparedQuery extends import_pg_core.PgPreparedQuery {
  30. constructor(prisma, query, logger) {
  31. super(query, void 0, void 0, void 0);
  32. this.prisma = prisma;
  33. this.logger = logger;
  34. }
  35. static [import_entity.entityKind] = "PrismaPgPreparedQuery";
  36. execute(placeholderValues) {
  37. const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
  38. this.logger.logQuery(this.query.sql, params);
  39. return this.prisma.$queryRawUnsafe(this.query.sql, ...params);
  40. }
  41. all() {
  42. throw new Error("Method not implemented.");
  43. }
  44. isResponseInArrayMode() {
  45. return false;
  46. }
  47. }
  48. class PrismaPgSession extends import_pg_core.PgSession {
  49. constructor(dialect, prisma, options) {
  50. super(dialect);
  51. this.prisma = prisma;
  52. this.options = options;
  53. this.logger = options.logger ?? new import_logger.NoopLogger();
  54. }
  55. static [import_entity.entityKind] = "PrismaPgSession";
  56. logger;
  57. execute(query) {
  58. return this.prepareQuery(this.dialect.sqlToQuery(query)).execute();
  59. }
  60. prepareQuery(query) {
  61. return new PrismaPgPreparedQuery(this.prisma, query, this.logger);
  62. }
  63. transaction(_transaction, _config) {
  64. throw new Error("Method not implemented.");
  65. }
  66. }
  67. // Annotate the CommonJS export names for ESM import in node:
  68. 0 && (module.exports = {
  69. PrismaPgPreparedQuery,
  70. PrismaPgSession
  71. });
  72. //# sourceMappingURL=session.cjs.map