1466 lines
61 KiB
JavaScript
1466 lines
61 KiB
JavaScript
module.exports = [
|
|
"[project]/Documents/00 - projet/plumeia/src/lib/prisma.ts [app-route] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
return __turbopack_context__.a(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try {
|
|
|
|
__turbopack_context__.s([
|
|
"default",
|
|
()=>__TURBOPACK__default__export__,
|
|
"getDB",
|
|
()=>getDB
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$externals$5d2f40$prisma$2f$client__$5b$external$5d$__$2840$prisma$2f$client$2c$__cjs$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$client$29$__ = __turbopack_context__.i("[externals]/@prisma/client [external] (@prisma/client, cjs, [project]/Documents/00 - projet/plumeia/node_modules/@prisma/client)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$adapter$2d$pg$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/00 - projet/plumeia/node_modules/@prisma/adapter-pg/dist/index.mjs [app-route] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__ = __turbopack_context__.i("[externals]/pg [external] (pg, esm_import, [project]/Documents/00 - projet/plumeia/node_modules/pg)");
|
|
var __turbopack_async_dependencies__ = __turbopack_handle_async_dependencies__([
|
|
__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$adapter$2d$pg$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__,
|
|
__TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__
|
|
]);
|
|
[__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$adapter$2d$pg$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__, __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__] = __turbopack_async_dependencies__.then ? (await __turbopack_async_dependencies__)() : __turbopack_async_dependencies__;
|
|
;
|
|
;
|
|
;
|
|
const globalForPrisma = globalThis;
|
|
function getDB() {
|
|
if (!globalForPrisma.prisma) {
|
|
const connectionString = process.env.DATABASE_URL;
|
|
const pool = new __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__["Pool"]({
|
|
connectionString
|
|
});
|
|
const adapter = new __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$adapter$2d$pg$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__["PrismaPg"](pool);
|
|
globalForPrisma.prisma = new __TURBOPACK__imported__module__$5b$externals$5d2f40$prisma$2f$client__$5b$external$5d$__$2840$prisma$2f$client$2c$__cjs$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$client$29$__["PrismaClient"]({
|
|
adapter
|
|
});
|
|
}
|
|
return globalForPrisma.prisma;
|
|
}
|
|
const __TURBOPACK__default__export__ = getDB;
|
|
__turbopack_async_result__();
|
|
} catch(e) { __turbopack_async_result__(e); } }, false);}),
|
|
"[externals]/@prisma/client [external] (@prisma/client, cjs, [project]/Documents/00 - projet/plumeia/node_modules/@prisma/client)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("@prisma/client-5d1deb26a67ff978", () => require("@prisma/client-5d1deb26a67ff978"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[project]/Documents/00 - projet/plumeia/node_modules/@prisma/debug/dist/index.mjs [app-route] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"Debug",
|
|
()=>Debug,
|
|
"clearLogs",
|
|
()=>clearLogs,
|
|
"default",
|
|
()=>index_default,
|
|
"getLogs",
|
|
()=>getLogs
|
|
]);
|
|
var __defProp = Object.defineProperty;
|
|
var __export = (target, all)=>{
|
|
for(var name in all)__defProp(target, name, {
|
|
get: all[name],
|
|
enumerable: true
|
|
});
|
|
};
|
|
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
|
|
var colors_exports = {};
|
|
__export(colors_exports, {
|
|
$: ()=>$,
|
|
bgBlack: ()=>bgBlack,
|
|
bgBlue: ()=>bgBlue,
|
|
bgCyan: ()=>bgCyan,
|
|
bgGreen: ()=>bgGreen,
|
|
bgMagenta: ()=>bgMagenta,
|
|
bgRed: ()=>bgRed,
|
|
bgWhite: ()=>bgWhite,
|
|
bgYellow: ()=>bgYellow,
|
|
black: ()=>black,
|
|
blue: ()=>blue,
|
|
bold: ()=>bold,
|
|
cyan: ()=>cyan,
|
|
dim: ()=>dim,
|
|
gray: ()=>gray,
|
|
green: ()=>green,
|
|
grey: ()=>grey,
|
|
hidden: ()=>hidden,
|
|
inverse: ()=>inverse,
|
|
italic: ()=>italic,
|
|
magenta: ()=>magenta,
|
|
red: ()=>red,
|
|
reset: ()=>reset,
|
|
strikethrough: ()=>strikethrough,
|
|
underline: ()=>underline,
|
|
white: ()=>white,
|
|
yellow: ()=>yellow
|
|
});
|
|
var FORCE_COLOR;
|
|
var NODE_DISABLE_COLORS;
|
|
var NO_COLOR;
|
|
var TERM;
|
|
var isTTY = true;
|
|
if (typeof process !== "undefined") {
|
|
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
isTTY = process.stdout && process.stdout.isTTY;
|
|
}
|
|
var $ = {
|
|
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
};
|
|
function init(x, y) {
|
|
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
|
|
return function(txt) {
|
|
if (!$.enabled || txt == null) return txt;
|
|
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
};
|
|
}
|
|
var reset = init(0, 0);
|
|
var bold = init(1, 22);
|
|
var dim = init(2, 22);
|
|
var italic = init(3, 23);
|
|
var underline = init(4, 24);
|
|
var inverse = init(7, 27);
|
|
var hidden = init(8, 28);
|
|
var strikethrough = init(9, 29);
|
|
var black = init(30, 39);
|
|
var red = init(31, 39);
|
|
var green = init(32, 39);
|
|
var yellow = init(33, 39);
|
|
var blue = init(34, 39);
|
|
var magenta = init(35, 39);
|
|
var cyan = init(36, 39);
|
|
var white = init(37, 39);
|
|
var gray = init(90, 39);
|
|
var grey = init(90, 39);
|
|
var bgBlack = init(40, 49);
|
|
var bgRed = init(41, 49);
|
|
var bgGreen = init(42, 49);
|
|
var bgYellow = init(43, 49);
|
|
var bgBlue = init(44, 49);
|
|
var bgMagenta = init(45, 49);
|
|
var bgCyan = init(46, 49);
|
|
var bgWhite = init(47, 49);
|
|
// src/index.ts
|
|
var MAX_ARGS_HISTORY = 100;
|
|
var COLORS = [
|
|
"green",
|
|
"yellow",
|
|
"blue",
|
|
"magenta",
|
|
"cyan",
|
|
"red"
|
|
];
|
|
var argsHistory = [];
|
|
var lastTimestamp = Date.now();
|
|
var lastColor = 0;
|
|
var processEnv = typeof process !== "undefined" ? process.env : {};
|
|
globalThis.DEBUG ??= processEnv.DEBUG ?? "";
|
|
globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
|
|
var topProps = {
|
|
enable (namespace) {
|
|
if (typeof namespace === "string") {
|
|
globalThis.DEBUG = namespace;
|
|
}
|
|
},
|
|
disable () {
|
|
const prev = globalThis.DEBUG;
|
|
globalThis.DEBUG = "";
|
|
return prev;
|
|
},
|
|
// this is the core logic to check if logging should happen or not
|
|
enabled (namespace) {
|
|
const listenedNamespaces = globalThis.DEBUG.split(",").map((s)=>{
|
|
return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
});
|
|
const isListened = listenedNamespaces.some((listenedNamespace)=>{
|
|
if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
|
|
return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
|
|
});
|
|
const isExcluded = listenedNamespaces.some((listenedNamespace)=>{
|
|
if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
|
|
return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
|
|
});
|
|
return isListened && !isExcluded;
|
|
},
|
|
log: (...args)=>{
|
|
const [namespace, format, ...rest] = args;
|
|
const logWithFormatting = console.warn ?? console.log;
|
|
logWithFormatting(`${namespace} ${format}`, ...rest);
|
|
},
|
|
formatters: {}
|
|
};
|
|
function debugCreate(namespace) {
|
|
const instanceProps = {
|
|
color: COLORS[lastColor++ % COLORS.length],
|
|
enabled: topProps.enabled(namespace),
|
|
namespace,
|
|
log: topProps.log,
|
|
extend: ()=>{}
|
|
};
|
|
const debugCall = (...args)=>{
|
|
const { enabled, namespace: namespace2, color, log } = instanceProps;
|
|
if (args.length !== 0) {
|
|
argsHistory.push([
|
|
namespace2,
|
|
...args
|
|
]);
|
|
}
|
|
if (argsHistory.length > MAX_ARGS_HISTORY) {
|
|
argsHistory.shift();
|
|
}
|
|
if (topProps.enabled(namespace2) || enabled) {
|
|
const stringArgs = args.map((arg)=>{
|
|
if (typeof arg === "string") {
|
|
return arg;
|
|
}
|
|
return safeStringify(arg);
|
|
});
|
|
const ms = `+${Date.now() - lastTimestamp}ms`;
|
|
lastTimestamp = Date.now();
|
|
if (globalThis.DEBUG_COLORS) {
|
|
log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
|
|
} else {
|
|
log(namespace2, ...stringArgs, ms);
|
|
}
|
|
}
|
|
};
|
|
return new Proxy(debugCall, {
|
|
get: (_, prop)=>instanceProps[prop],
|
|
set: (_, prop, value)=>instanceProps[prop] = value
|
|
});
|
|
}
|
|
var Debug = new Proxy(debugCreate, {
|
|
get: (_, prop)=>topProps[prop],
|
|
set: (_, prop, value)=>topProps[prop] = value
|
|
});
|
|
function safeStringify(value, indent = 2) {
|
|
const cache = /* @__PURE__ */ new Set();
|
|
return JSON.stringify(value, (key, value2)=>{
|
|
if (typeof value2 === "object" && value2 !== null) {
|
|
if (cache.has(value2)) {
|
|
return `[Circular *]`;
|
|
}
|
|
cache.add(value2);
|
|
} else if (typeof value2 === "bigint") {
|
|
return value2.toString();
|
|
}
|
|
return value2;
|
|
}, indent);
|
|
}
|
|
function getLogs(numChars = 7500) {
|
|
const logs = argsHistory.map(([namespace, ...args])=>{
|
|
return `${namespace} ${args.map((arg)=>{
|
|
if (typeof arg === "string") {
|
|
return arg;
|
|
} else {
|
|
return JSON.stringify(arg);
|
|
}
|
|
}).join(" ")}`;
|
|
}).join("\n");
|
|
if (logs.length < numChars) {
|
|
return logs;
|
|
}
|
|
return logs.slice(-numChars);
|
|
}
|
|
function clearLogs() {
|
|
argsHistory.length = 0;
|
|
}
|
|
var index_default = Debug;
|
|
;
|
|
}),
|
|
"[project]/Documents/00 - projet/plumeia/node_modules/@prisma/driver-adapter-utils/dist/index.mjs [app-route] (ecmascript) <locals>", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"ColumnTypeEnum",
|
|
()=>ColumnTypeEnum,
|
|
"DriverAdapterError",
|
|
()=>DriverAdapterError,
|
|
"bindAdapter",
|
|
()=>bindAdapter,
|
|
"bindMigrationAwareSqlAdapterFactory",
|
|
()=>bindMigrationAwareSqlAdapterFactory,
|
|
"bindSqlAdapterFactory",
|
|
()=>bindSqlAdapterFactory,
|
|
"err",
|
|
()=>err,
|
|
"isDriverAdapterError",
|
|
()=>isDriverAdapterError,
|
|
"mockAdapter",
|
|
()=>mockAdapter,
|
|
"mockAdapterErrors",
|
|
()=>mockAdapterErrors,
|
|
"mockAdapterFactory",
|
|
()=>mockAdapterFactory,
|
|
"mockMigrationAwareAdapterFactory",
|
|
()=>mockMigrationAwareAdapterFactory,
|
|
"ok",
|
|
()=>ok
|
|
]);
|
|
// src/debug.ts
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$debug$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/00 - projet/plumeia/node_modules/@prisma/debug/dist/index.mjs [app-route] (ecmascript)");
|
|
;
|
|
// src/error.ts
|
|
var DriverAdapterError = class extends Error {
|
|
name = "DriverAdapterError";
|
|
cause;
|
|
constructor(payload){
|
|
super(typeof payload["message"] === "string" ? payload["message"] : payload.kind);
|
|
this.cause = payload;
|
|
}
|
|
};
|
|
function isDriverAdapterError(error) {
|
|
return error["name"] === "DriverAdapterError" && typeof error["cause"] === "object";
|
|
}
|
|
// src/result.ts
|
|
function ok(value) {
|
|
return {
|
|
ok: true,
|
|
value,
|
|
map (fn) {
|
|
return ok(fn(value));
|
|
},
|
|
flatMap (fn) {
|
|
return fn(value);
|
|
}
|
|
};
|
|
}
|
|
function err(error) {
|
|
return {
|
|
ok: false,
|
|
error,
|
|
map () {
|
|
return err(error);
|
|
},
|
|
flatMap () {
|
|
return err(error);
|
|
}
|
|
};
|
|
}
|
|
// src/binder.ts
|
|
var debug = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$debug$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__["Debug"])("driver-adapter-utils");
|
|
var ErrorRegistryInternal = class {
|
|
registeredErrors = [];
|
|
consumeError(id) {
|
|
return this.registeredErrors[id];
|
|
}
|
|
registerNewError(error) {
|
|
let i = 0;
|
|
while(this.registeredErrors[i] !== void 0){
|
|
i++;
|
|
}
|
|
this.registeredErrors[i] = {
|
|
error
|
|
};
|
|
return i;
|
|
}
|
|
};
|
|
function copySymbolsFromSource(source, target) {
|
|
const symbols = Object.getOwnPropertySymbols(source);
|
|
const symbolObject = Object.fromEntries(symbols.map((symbol)=>[
|
|
symbol,
|
|
true
|
|
]));
|
|
Object.assign(target, symbolObject);
|
|
}
|
|
var bindMigrationAwareSqlAdapterFactory = (adapterFactory)=>{
|
|
const errorRegistry = new ErrorRegistryInternal();
|
|
const boundFactory = {
|
|
adapterName: adapterFactory.adapterName,
|
|
provider: adapterFactory.provider,
|
|
errorRegistry,
|
|
connect: async (...args)=>{
|
|
const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
|
|
return ctx.map((ctx2)=>bindAdapter(ctx2, errorRegistry));
|
|
},
|
|
connectToShadowDb: async (...args)=>{
|
|
const ctx = await wrapAsync(errorRegistry, adapterFactory.connectToShadowDb.bind(adapterFactory))(...args);
|
|
return ctx.map((ctx2)=>bindAdapter(ctx2, errorRegistry));
|
|
}
|
|
};
|
|
copySymbolsFromSource(adapterFactory, boundFactory);
|
|
return boundFactory;
|
|
};
|
|
var bindSqlAdapterFactory = (adapterFactory)=>{
|
|
const errorRegistry = new ErrorRegistryInternal();
|
|
const boundFactory = {
|
|
adapterName: adapterFactory.adapterName,
|
|
provider: adapterFactory.provider,
|
|
errorRegistry,
|
|
connect: async (...args)=>{
|
|
const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
|
|
return ctx.map((ctx2)=>bindAdapter(ctx2, errorRegistry));
|
|
}
|
|
};
|
|
copySymbolsFromSource(adapterFactory, boundFactory);
|
|
return boundFactory;
|
|
};
|
|
var bindAdapter = (adapter, errorRegistry = new ErrorRegistryInternal())=>{
|
|
const boundAdapter = {
|
|
adapterName: adapter.adapterName,
|
|
errorRegistry,
|
|
queryRaw: wrapAsync(errorRegistry, adapter.queryRaw.bind(adapter)),
|
|
executeRaw: wrapAsync(errorRegistry, adapter.executeRaw.bind(adapter)),
|
|
executeScript: wrapAsync(errorRegistry, adapter.executeScript.bind(adapter)),
|
|
dispose: wrapAsync(errorRegistry, adapter.dispose.bind(adapter)),
|
|
provider: adapter.provider,
|
|
startTransaction: async (...args)=>{
|
|
const ctx = await wrapAsync(errorRegistry, adapter.startTransaction.bind(adapter))(...args);
|
|
return ctx.map((ctx2)=>bindTransaction(errorRegistry, ctx2));
|
|
}
|
|
};
|
|
if (adapter.getConnectionInfo) {
|
|
boundAdapter.getConnectionInfo = wrapSync(errorRegistry, adapter.getConnectionInfo.bind(adapter));
|
|
}
|
|
return boundAdapter;
|
|
};
|
|
var bindTransaction = (errorRegistry, transaction)=>{
|
|
return {
|
|
adapterName: transaction.adapterName,
|
|
provider: transaction.provider,
|
|
options: transaction.options,
|
|
queryRaw: wrapAsync(errorRegistry, transaction.queryRaw.bind(transaction)),
|
|
executeRaw: wrapAsync(errorRegistry, transaction.executeRaw.bind(transaction)),
|
|
commit: wrapAsync(errorRegistry, transaction.commit.bind(transaction)),
|
|
rollback: wrapAsync(errorRegistry, transaction.rollback.bind(transaction))
|
|
};
|
|
};
|
|
function wrapAsync(registry, fn) {
|
|
return async (...args)=>{
|
|
try {
|
|
return ok(await fn(...args));
|
|
} catch (error) {
|
|
debug("[error@wrapAsync]", error);
|
|
if (isDriverAdapterError(error)) {
|
|
return err(error.cause);
|
|
}
|
|
const id = registry.registerNewError(error);
|
|
return err({
|
|
kind: "GenericJs",
|
|
id
|
|
});
|
|
}
|
|
};
|
|
}
|
|
function wrapSync(registry, fn) {
|
|
return (...args)=>{
|
|
try {
|
|
return ok(fn(...args));
|
|
} catch (error) {
|
|
debug("[error@wrapSync]", error);
|
|
if (isDriverAdapterError(error)) {
|
|
return err(error.cause);
|
|
}
|
|
const id = registry.registerNewError(error);
|
|
return err({
|
|
kind: "GenericJs",
|
|
id
|
|
});
|
|
}
|
|
};
|
|
}
|
|
// src/const.ts
|
|
var ColumnTypeEnum = {
|
|
// Scalars
|
|
Int32: 0,
|
|
Int64: 1,
|
|
Float: 2,
|
|
Double: 3,
|
|
Numeric: 4,
|
|
Boolean: 5,
|
|
Character: 6,
|
|
Text: 7,
|
|
Date: 8,
|
|
Time: 9,
|
|
DateTime: 10,
|
|
Json: 11,
|
|
Enum: 12,
|
|
Bytes: 13,
|
|
Set: 14,
|
|
Uuid: 15,
|
|
// Arrays
|
|
Int32Array: 64,
|
|
Int64Array: 65,
|
|
FloatArray: 66,
|
|
DoubleArray: 67,
|
|
NumericArray: 68,
|
|
BooleanArray: 69,
|
|
CharacterArray: 70,
|
|
TextArray: 71,
|
|
DateArray: 72,
|
|
TimeArray: 73,
|
|
DateTimeArray: 74,
|
|
JsonArray: 75,
|
|
EnumArray: 76,
|
|
BytesArray: 77,
|
|
UuidArray: 78,
|
|
// Custom
|
|
UnknownNumber: 128
|
|
};
|
|
// src/mock.ts
|
|
var mockAdapterErrors = {
|
|
queryRaw: new Error("Not implemented: queryRaw"),
|
|
executeRaw: new Error("Not implemented: executeRaw"),
|
|
startTransaction: new Error("Not implemented: startTransaction"),
|
|
executeScript: new Error("Not implemented: executeScript"),
|
|
dispose: new Error("Not implemented: dispose")
|
|
};
|
|
function mockAdapter(provider) {
|
|
return {
|
|
provider,
|
|
adapterName: "@prisma/adapter-mock",
|
|
queryRaw: ()=>Promise.reject(mockAdapterErrors.queryRaw),
|
|
executeRaw: ()=>Promise.reject(mockAdapterErrors.executeRaw),
|
|
startTransaction: ()=>Promise.reject(mockAdapterErrors.startTransaction),
|
|
executeScript: ()=>Promise.reject(mockAdapterErrors.executeScript),
|
|
dispose: ()=>Promise.reject(mockAdapterErrors.dispose),
|
|
[Symbol.for("adapter.mockAdapter")]: true
|
|
};
|
|
}
|
|
function mockAdapterFactory(provider) {
|
|
return {
|
|
provider,
|
|
adapterName: "@prisma/adapter-mock",
|
|
connect: ()=>Promise.resolve(mockAdapter(provider)),
|
|
[Symbol.for("adapter.mockAdapterFactory")]: true
|
|
};
|
|
}
|
|
function mockMigrationAwareAdapterFactory(provider) {
|
|
return {
|
|
provider,
|
|
adapterName: "@prisma/adapter-mock",
|
|
connect: ()=>Promise.resolve(mockAdapter(provider)),
|
|
connectToShadowDb: ()=>Promise.resolve(mockAdapter(provider)),
|
|
[Symbol.for("adapter.mockMigrationAwareAdapterFactory")]: true
|
|
};
|
|
}
|
|
;
|
|
}),
|
|
"[externals]/pg [external] (pg, esm_import, [project]/Documents/00 - projet/plumeia/node_modules/pg)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
return __turbopack_context__.a(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try {
|
|
|
|
const mod = await __turbopack_context__.y("pg-909e2581735964d3");
|
|
|
|
__turbopack_context__.n(mod);
|
|
__turbopack_async_result__();
|
|
} catch(e) { __turbopack_async_result__(e); } }, true);}),
|
|
"[project]/Documents/00 - projet/plumeia/node_modules/postgres-array/index.js [app-route] (ecmascript)", ((__turbopack_context__, module, exports) => {
|
|
"use strict";
|
|
|
|
const BACKSLASH = '\\';
|
|
const DQUOT = '"';
|
|
const LBRACE = '{';
|
|
const RBRACE = '}';
|
|
const LBRACKET = '[';
|
|
const EQUALS = '=';
|
|
const COMMA = ',';
|
|
/** When the raw value is this, it means a literal `null` */ const NULL_STRING = 'NULL';
|
|
/**
|
|
* Parses an array according to
|
|
* https://www.postgresql.org/docs/17/arrays.html#ARRAYS-IO
|
|
*
|
|
* Trusts the data (mostly), so only hook up to trusted Postgres servers.
|
|
*/ function makeParseArrayWithTransform(transform) {
|
|
const haveTransform = transform != null;
|
|
return function parseArray(str) {
|
|
const rbraceIndex = str.length - 1;
|
|
if (rbraceIndex === 1) {
|
|
return [];
|
|
}
|
|
if (str[rbraceIndex] !== RBRACE) {
|
|
throw new Error('Invalid array text - must end with }');
|
|
}
|
|
// If starts with `[`, it is specifying the index boundas. Skip past first `=`.
|
|
let position = 0;
|
|
if (str[position] === LBRACKET) {
|
|
position = str.indexOf(EQUALS) + 1;
|
|
}
|
|
if (str[position++] !== LBRACE) {
|
|
throw new Error('Invalid array text - must start with {');
|
|
}
|
|
const output = [];
|
|
let current = output;
|
|
const stack = [];
|
|
let currentStringStart = position;
|
|
let currentString = '';
|
|
let expectValue = true;
|
|
for(; position < rbraceIndex; ++position){
|
|
let char = str[position];
|
|
// > The array output routine will put double quotes around element values if
|
|
// > they are empty strings, contain curly braces, delimiter characters, double
|
|
// > quotes, backslashes, or white space, or match the word NULL. Double quotes
|
|
// > and backslashes embedded in element values will be backslash-escaped.
|
|
if (char === DQUOT) {
|
|
// It's escaped
|
|
currentStringStart = ++position;
|
|
let dquot = str.indexOf(DQUOT, currentStringStart);
|
|
let backSlash = str.indexOf(BACKSLASH, currentStringStart);
|
|
while(backSlash !== -1 && backSlash < dquot){
|
|
position = backSlash;
|
|
const part = str.slice(currentStringStart, position);
|
|
currentString += part;
|
|
currentStringStart = ++position;
|
|
if (dquot === position++) {
|
|
// This was an escaped doublequote; find the next one!
|
|
dquot = str.indexOf(DQUOT, position);
|
|
}
|
|
// Either way, find the next backslash
|
|
backSlash = str.indexOf(BACKSLASH, position);
|
|
}
|
|
position = dquot;
|
|
const part = str.slice(currentStringStart, position);
|
|
currentString += part;
|
|
current.push(haveTransform ? transform(currentString) : currentString);
|
|
currentString = '';
|
|
expectValue = false;
|
|
} else if (char === LBRACE) {
|
|
const newArray = [];
|
|
current.push(newArray);
|
|
stack.push(current);
|
|
current = newArray;
|
|
currentStringStart = position + 1;
|
|
expectValue = true;
|
|
} else if (char === COMMA) {
|
|
expectValue = true;
|
|
} else if (char === RBRACE) {
|
|
expectValue = false;
|
|
const arr = stack.pop();
|
|
if (arr === undefined) {
|
|
throw new Error("Invalid array text - too many '}'");
|
|
}
|
|
current = arr;
|
|
} else if (expectValue) {
|
|
currentStringStart = position;
|
|
while((char = str[position]) !== COMMA && char !== RBRACE && position < rbraceIndex){
|
|
++position;
|
|
}
|
|
const part = str.slice(currentStringStart, position--);
|
|
current.push(part === NULL_STRING ? null : haveTransform ? transform(part) : part);
|
|
expectValue = false;
|
|
} else {
|
|
throw new Error('Was expecting delimeter');
|
|
}
|
|
}
|
|
return output;
|
|
};
|
|
}
|
|
const parseArray = makeParseArrayWithTransform();
|
|
exports.parse = (source, transform)=>transform != null ? makeParseArrayWithTransform(transform)(source) : parseArray(source);
|
|
}),
|
|
"[project]/Documents/00 - projet/plumeia/node_modules/@prisma/adapter-pg/dist/index.mjs [app-route] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
return __turbopack_context__.a(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try {
|
|
|
|
__turbopack_context__.s([
|
|
"PrismaPg",
|
|
()=>PrismaPgAdapterFactory
|
|
]);
|
|
// src/pg.ts
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$debug$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/00 - projet/plumeia/node_modules/@prisma/debug/dist/index.mjs [app-route] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/Documents/00 - projet/plumeia/node_modules/@prisma/driver-adapter-utils/dist/index.mjs [app-route] (ecmascript) <locals>");
|
|
var __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__ = __turbopack_context__.i("[externals]/pg [external] (pg, esm_import, [project]/Documents/00 - projet/plumeia/node_modules/pg)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$postgres$2d$array$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/00 - projet/plumeia/node_modules/postgres-array/index.js [app-route] (ecmascript)");
|
|
var __turbopack_async_dependencies__ = __turbopack_handle_async_dependencies__([
|
|
__TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__
|
|
]);
|
|
[__TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__] = __turbopack_async_dependencies__.then ? (await __turbopack_async_dependencies__)() : __turbopack_async_dependencies__;
|
|
;
|
|
;
|
|
// package.json
|
|
var name = "@prisma/adapter-pg";
|
|
// src/constants.ts
|
|
var FIRST_NORMAL_OBJECT_ID = 16384;
|
|
;
|
|
;
|
|
;
|
|
var { types } = __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__["default"];
|
|
var { builtins: ScalarColumnType, getTypeParser } = types;
|
|
var AdditionalScalarColumnType = {
|
|
NAME: 19
|
|
};
|
|
var ArrayColumnType = {
|
|
BIT_ARRAY: 1561,
|
|
BOOL_ARRAY: 1e3,
|
|
BYTEA_ARRAY: 1001,
|
|
BPCHAR_ARRAY: 1014,
|
|
CHAR_ARRAY: 1002,
|
|
CIDR_ARRAY: 651,
|
|
DATE_ARRAY: 1182,
|
|
FLOAT4_ARRAY: 1021,
|
|
FLOAT8_ARRAY: 1022,
|
|
INET_ARRAY: 1041,
|
|
INT2_ARRAY: 1005,
|
|
INT4_ARRAY: 1007,
|
|
INT8_ARRAY: 1016,
|
|
JSONB_ARRAY: 3807,
|
|
JSON_ARRAY: 199,
|
|
MONEY_ARRAY: 791,
|
|
NUMERIC_ARRAY: 1231,
|
|
OID_ARRAY: 1028,
|
|
TEXT_ARRAY: 1009,
|
|
TIMESTAMP_ARRAY: 1115,
|
|
TIMESTAMPTZ_ARRAY: 1185,
|
|
TIME_ARRAY: 1183,
|
|
UUID_ARRAY: 2951,
|
|
VARBIT_ARRAY: 1563,
|
|
VARCHAR_ARRAY: 1015,
|
|
XML_ARRAY: 143
|
|
};
|
|
var UnsupportedNativeDataType = class _UnsupportedNativeDataType extends Error {
|
|
// map of type codes to type names
|
|
static typeNames = {
|
|
16: "bool",
|
|
17: "bytea",
|
|
18: "char",
|
|
19: "name",
|
|
20: "int8",
|
|
21: "int2",
|
|
22: "int2vector",
|
|
23: "int4",
|
|
24: "regproc",
|
|
25: "text",
|
|
26: "oid",
|
|
27: "tid",
|
|
28: "xid",
|
|
29: "cid",
|
|
30: "oidvector",
|
|
32: "pg_ddl_command",
|
|
71: "pg_type",
|
|
75: "pg_attribute",
|
|
81: "pg_proc",
|
|
83: "pg_class",
|
|
114: "json",
|
|
142: "xml",
|
|
194: "pg_node_tree",
|
|
269: "table_am_handler",
|
|
325: "index_am_handler",
|
|
600: "point",
|
|
601: "lseg",
|
|
602: "path",
|
|
603: "box",
|
|
604: "polygon",
|
|
628: "line",
|
|
650: "cidr",
|
|
700: "float4",
|
|
701: "float8",
|
|
705: "unknown",
|
|
718: "circle",
|
|
774: "macaddr8",
|
|
790: "money",
|
|
829: "macaddr",
|
|
869: "inet",
|
|
1033: "aclitem",
|
|
1042: "bpchar",
|
|
1043: "varchar",
|
|
1082: "date",
|
|
1083: "time",
|
|
1114: "timestamp",
|
|
1184: "timestamptz",
|
|
1186: "interval",
|
|
1266: "timetz",
|
|
1560: "bit",
|
|
1562: "varbit",
|
|
1700: "numeric",
|
|
1790: "refcursor",
|
|
2202: "regprocedure",
|
|
2203: "regoper",
|
|
2204: "regoperator",
|
|
2205: "regclass",
|
|
2206: "regtype",
|
|
2249: "record",
|
|
2275: "cstring",
|
|
2276: "any",
|
|
2277: "anyarray",
|
|
2278: "void",
|
|
2279: "trigger",
|
|
2280: "language_handler",
|
|
2281: "internal",
|
|
2283: "anyelement",
|
|
2287: "_record",
|
|
2776: "anynonarray",
|
|
2950: "uuid",
|
|
2970: "txid_snapshot",
|
|
3115: "fdw_handler",
|
|
3220: "pg_lsn",
|
|
3310: "tsm_handler",
|
|
3361: "pg_ndistinct",
|
|
3402: "pg_dependencies",
|
|
3500: "anyenum",
|
|
3614: "tsvector",
|
|
3615: "tsquery",
|
|
3642: "gtsvector",
|
|
3734: "regconfig",
|
|
3769: "regdictionary",
|
|
3802: "jsonb",
|
|
3831: "anyrange",
|
|
3838: "event_trigger",
|
|
3904: "int4range",
|
|
3906: "numrange",
|
|
3908: "tsrange",
|
|
3910: "tstzrange",
|
|
3912: "daterange",
|
|
3926: "int8range",
|
|
4072: "jsonpath",
|
|
4089: "regnamespace",
|
|
4096: "regrole",
|
|
4191: "regcollation",
|
|
4451: "int4multirange",
|
|
4532: "nummultirange",
|
|
4533: "tsmultirange",
|
|
4534: "tstzmultirange",
|
|
4535: "datemultirange",
|
|
4536: "int8multirange",
|
|
4537: "anymultirange",
|
|
4538: "anycompatiblemultirange",
|
|
4600: "pg_brin_bloom_summary",
|
|
4601: "pg_brin_minmax_multi_summary",
|
|
5017: "pg_mcv_list",
|
|
5038: "pg_snapshot",
|
|
5069: "xid8",
|
|
5077: "anycompatible",
|
|
5078: "anycompatiblearray",
|
|
5079: "anycompatiblenonarray",
|
|
5080: "anycompatiblerange"
|
|
};
|
|
type;
|
|
constructor(code){
|
|
super();
|
|
this.type = _UnsupportedNativeDataType.typeNames[code] || "Unknown";
|
|
this.message = `Unsupported column type ${this.type}`;
|
|
}
|
|
};
|
|
function fieldToColumnType(fieldTypeId) {
|
|
switch(fieldTypeId){
|
|
case ScalarColumnType.INT2:
|
|
case ScalarColumnType.INT4:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Int32;
|
|
case ScalarColumnType.INT8:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Int64;
|
|
case ScalarColumnType.FLOAT4:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Float;
|
|
case ScalarColumnType.FLOAT8:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Double;
|
|
case ScalarColumnType.BOOL:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Boolean;
|
|
case ScalarColumnType.DATE:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Date;
|
|
case ScalarColumnType.TIME:
|
|
case ScalarColumnType.TIMETZ:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Time;
|
|
case ScalarColumnType.TIMESTAMP:
|
|
case ScalarColumnType.TIMESTAMPTZ:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].DateTime;
|
|
case ScalarColumnType.NUMERIC:
|
|
case ScalarColumnType.MONEY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Numeric;
|
|
case ScalarColumnType.JSON:
|
|
case ScalarColumnType.JSONB:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Json;
|
|
case ScalarColumnType.UUID:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Uuid;
|
|
case ScalarColumnType.OID:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Int64;
|
|
case ScalarColumnType.BPCHAR:
|
|
case ScalarColumnType.TEXT:
|
|
case ScalarColumnType.VARCHAR:
|
|
case ScalarColumnType.BIT:
|
|
case ScalarColumnType.VARBIT:
|
|
case ScalarColumnType.INET:
|
|
case ScalarColumnType.CIDR:
|
|
case ScalarColumnType.XML:
|
|
case AdditionalScalarColumnType.NAME:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Text;
|
|
case ScalarColumnType.BYTEA:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Bytes;
|
|
case ArrayColumnType.INT2_ARRAY:
|
|
case ArrayColumnType.INT4_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Int32Array;
|
|
case ArrayColumnType.FLOAT4_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].FloatArray;
|
|
case ArrayColumnType.FLOAT8_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].DoubleArray;
|
|
case ArrayColumnType.NUMERIC_ARRAY:
|
|
case ArrayColumnType.MONEY_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].NumericArray;
|
|
case ArrayColumnType.BOOL_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].BooleanArray;
|
|
case ArrayColumnType.CHAR_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].CharacterArray;
|
|
case ArrayColumnType.BPCHAR_ARRAY:
|
|
case ArrayColumnType.TEXT_ARRAY:
|
|
case ArrayColumnType.VARCHAR_ARRAY:
|
|
case ArrayColumnType.VARBIT_ARRAY:
|
|
case ArrayColumnType.BIT_ARRAY:
|
|
case ArrayColumnType.INET_ARRAY:
|
|
case ArrayColumnType.CIDR_ARRAY:
|
|
case ArrayColumnType.XML_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].TextArray;
|
|
case ArrayColumnType.DATE_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].DateArray;
|
|
case ArrayColumnType.TIME_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].TimeArray;
|
|
case ArrayColumnType.TIMESTAMP_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].DateTimeArray;
|
|
case ArrayColumnType.TIMESTAMPTZ_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].DateTimeArray;
|
|
case ArrayColumnType.JSON_ARRAY:
|
|
case ArrayColumnType.JSONB_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].JsonArray;
|
|
case ArrayColumnType.BYTEA_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].BytesArray;
|
|
case ArrayColumnType.UUID_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].UuidArray;
|
|
case ArrayColumnType.INT8_ARRAY:
|
|
case ArrayColumnType.OID_ARRAY:
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Int64Array;
|
|
default:
|
|
if (fieldTypeId >= FIRST_NORMAL_OBJECT_ID) {
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ColumnTypeEnum"].Text;
|
|
}
|
|
throw new UnsupportedNativeDataType(fieldTypeId);
|
|
}
|
|
}
|
|
function normalize_array(element_normalizer) {
|
|
return (str)=>(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$postgres$2d$array$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["parse"])(str, element_normalizer);
|
|
}
|
|
function normalize_numeric(numeric) {
|
|
return numeric;
|
|
}
|
|
function normalize_date(date) {
|
|
return date;
|
|
}
|
|
function normalize_timestamp(time) {
|
|
return `${time.replace(" ", "T")}+00:00`;
|
|
}
|
|
function normalize_timestamptz(time) {
|
|
return time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00");
|
|
}
|
|
function normalize_time(time) {
|
|
return time;
|
|
}
|
|
function normalize_timez(time) {
|
|
return time.replace(/[+-]\d{2}(:\d{2})?$/, "");
|
|
}
|
|
function normalize_money(money) {
|
|
return money.slice(1);
|
|
}
|
|
function normalize_xml(xml) {
|
|
return xml;
|
|
}
|
|
function toJson(json) {
|
|
return json;
|
|
}
|
|
var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
|
|
var normalizeByteaArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
|
|
function convertBytes(serializedBytes) {
|
|
return parsePgBytes(serializedBytes);
|
|
}
|
|
function normalizeBit(bit) {
|
|
return bit;
|
|
}
|
|
var customParsers = {
|
|
[ScalarColumnType.NUMERIC]: normalize_numeric,
|
|
[ArrayColumnType.NUMERIC_ARRAY]: normalize_array(normalize_numeric),
|
|
[ScalarColumnType.TIME]: normalize_time,
|
|
[ArrayColumnType.TIME_ARRAY]: normalize_array(normalize_time),
|
|
[ScalarColumnType.TIMETZ]: normalize_timez,
|
|
[ScalarColumnType.DATE]: normalize_date,
|
|
[ArrayColumnType.DATE_ARRAY]: normalize_array(normalize_date),
|
|
[ScalarColumnType.TIMESTAMP]: normalize_timestamp,
|
|
[ArrayColumnType.TIMESTAMP_ARRAY]: normalize_array(normalize_timestamp),
|
|
[ScalarColumnType.TIMESTAMPTZ]: normalize_timestamptz,
|
|
[ArrayColumnType.TIMESTAMPTZ_ARRAY]: normalize_array(normalize_timestamptz),
|
|
[ScalarColumnType.MONEY]: normalize_money,
|
|
[ArrayColumnType.MONEY_ARRAY]: normalize_array(normalize_money),
|
|
[ScalarColumnType.JSON]: toJson,
|
|
[ArrayColumnType.JSON_ARRAY]: normalize_array(toJson),
|
|
[ScalarColumnType.JSONB]: toJson,
|
|
[ArrayColumnType.JSONB_ARRAY]: normalize_array(toJson),
|
|
[ScalarColumnType.BYTEA]: convertBytes,
|
|
[ArrayColumnType.BYTEA_ARRAY]: normalizeByteaArray,
|
|
[ArrayColumnType.BIT_ARRAY]: normalize_array(normalizeBit),
|
|
[ArrayColumnType.VARBIT_ARRAY]: normalize_array(normalizeBit),
|
|
[ArrayColumnType.XML_ARRAY]: normalize_array(normalize_xml)
|
|
};
|
|
function mapArg(arg, argType) {
|
|
if (arg === null) {
|
|
return null;
|
|
}
|
|
if (Array.isArray(arg) && argType.arity === "list") {
|
|
return arg.map((value)=>mapArg(value, argType));
|
|
}
|
|
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
arg = new Date(arg);
|
|
}
|
|
if (arg instanceof Date) {
|
|
switch(argType.dbType){
|
|
case "TIME":
|
|
case "TIMETZ":
|
|
return formatTime(arg);
|
|
case "DATE":
|
|
return formatDate(arg);
|
|
default:
|
|
return formatDateTime(arg);
|
|
}
|
|
}
|
|
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
return Buffer.from(arg, "base64");
|
|
}
|
|
if (ArrayBuffer.isView(arg)) {
|
|
return new Uint8Array(arg.buffer, arg.byteOffset, arg.byteLength);
|
|
}
|
|
return arg;
|
|
}
|
|
function formatDateTime(date) {
|
|
const pad = (n, z = 2)=>String(n).padStart(z, "0");
|
|
const ms = date.getUTCMilliseconds();
|
|
return pad(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1) + "-" + pad(date.getUTCDate()) + " " + pad(date.getUTCHours()) + ":" + pad(date.getUTCMinutes()) + ":" + pad(date.getUTCSeconds()) + (ms ? "." + String(ms).padStart(3, "0") : "");
|
|
}
|
|
function formatDate(date) {
|
|
const pad = (n, z = 2)=>String(n).padStart(z, "0");
|
|
return pad(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1) + "-" + pad(date.getUTCDate());
|
|
}
|
|
function formatTime(date) {
|
|
const pad = (n, z = 2)=>String(n).padStart(z, "0");
|
|
const ms = date.getUTCMilliseconds();
|
|
return pad(date.getUTCHours()) + ":" + pad(date.getUTCMinutes()) + ":" + pad(date.getUTCSeconds()) + (ms ? "." + String(ms).padStart(3, "0") : "");
|
|
}
|
|
// src/errors.ts
|
|
var TLS_ERRORS = /* @__PURE__ */ new Set([
|
|
"UNABLE_TO_GET_ISSUER_CERT",
|
|
"UNABLE_TO_GET_CRL",
|
|
"UNABLE_TO_DECRYPT_CERT_SIGNATURE",
|
|
"UNABLE_TO_DECRYPT_CRL_SIGNATURE",
|
|
"UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",
|
|
"CERT_SIGNATURE_FAILURE",
|
|
"CRL_SIGNATURE_FAILURE",
|
|
"CERT_NOT_YET_VALID",
|
|
"CERT_HAS_EXPIRED",
|
|
"CRL_NOT_YET_VALID",
|
|
"CRL_HAS_EXPIRED",
|
|
"ERROR_IN_CERT_NOT_BEFORE_FIELD",
|
|
"ERROR_IN_CERT_NOT_AFTER_FIELD",
|
|
"ERROR_IN_CRL_LAST_UPDATE_FIELD",
|
|
"ERROR_IN_CRL_NEXT_UPDATE_FIELD",
|
|
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
"CERT_CHAIN_TOO_LONG",
|
|
"CERT_REVOKED",
|
|
"INVALID_CA",
|
|
"INVALID_PURPOSE",
|
|
"CERT_UNTRUSTED",
|
|
"CERT_REJECTED",
|
|
"HOSTNAME_MISMATCH",
|
|
"ERR_TLS_CERT_ALTNAME_FORMAT",
|
|
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
]);
|
|
var SOCKET_ERRORS = /* @__PURE__ */ new Set([
|
|
"ENOTFOUND",
|
|
"ECONNREFUSED",
|
|
"ECONNRESET",
|
|
"ETIMEDOUT"
|
|
]);
|
|
function convertDriverError(error) {
|
|
if (isSocketError(error)) {
|
|
return mapSocketError(error);
|
|
}
|
|
if (isTlsError(error)) {
|
|
return {
|
|
kind: "TlsConnectionError",
|
|
reason: error.message
|
|
};
|
|
}
|
|
if (isDriverError(error)) {
|
|
return {
|
|
originalCode: error.code,
|
|
originalMessage: error.message,
|
|
...mapDriverError(error)
|
|
};
|
|
}
|
|
throw error;
|
|
}
|
|
function mapDriverError(error) {
|
|
switch(error.code){
|
|
case "22001":
|
|
return {
|
|
kind: "LengthMismatch",
|
|
column: error.column
|
|
};
|
|
case "22003":
|
|
return {
|
|
kind: "ValueOutOfRange",
|
|
cause: error.message
|
|
};
|
|
case "22P02":
|
|
return {
|
|
kind: "InvalidInputValue",
|
|
message: error.message
|
|
};
|
|
case "23505":
|
|
{
|
|
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
return {
|
|
kind: "UniqueConstraintViolation",
|
|
constraint: fields !== void 0 ? {
|
|
fields
|
|
} : void 0
|
|
};
|
|
}
|
|
case "23502":
|
|
{
|
|
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
return {
|
|
kind: "NullConstraintViolation",
|
|
constraint: fields !== void 0 ? {
|
|
fields
|
|
} : void 0
|
|
};
|
|
}
|
|
case "23503":
|
|
{
|
|
let constraint;
|
|
if (error.column) {
|
|
constraint = {
|
|
fields: [
|
|
error.column
|
|
]
|
|
};
|
|
} else if (error.constraint) {
|
|
constraint = {
|
|
index: error.constraint
|
|
};
|
|
}
|
|
return {
|
|
kind: "ForeignKeyConstraintViolation",
|
|
constraint
|
|
};
|
|
}
|
|
case "3D000":
|
|
return {
|
|
kind: "DatabaseDoesNotExist",
|
|
db: error.message.split(" ").at(1)?.split('"').at(1)
|
|
};
|
|
case "28000":
|
|
return {
|
|
kind: "DatabaseAccessDenied",
|
|
db: error.message.split(",").find((s)=>s.startsWith(" database"))?.split('"').at(1)
|
|
};
|
|
case "28P01":
|
|
return {
|
|
kind: "AuthenticationFailed",
|
|
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
};
|
|
case "40001":
|
|
return {
|
|
kind: "TransactionWriteConflict"
|
|
};
|
|
case "42P01":
|
|
return {
|
|
kind: "TableDoesNotExist",
|
|
table: error.message.split(" ").at(1)?.split('"').at(1)
|
|
};
|
|
case "42703":
|
|
return {
|
|
kind: "ColumnNotFound",
|
|
column: error.message.split(" ").at(1)?.split('"').at(1)
|
|
};
|
|
case "42P04":
|
|
return {
|
|
kind: "DatabaseAlreadyExists",
|
|
db: error.message.split(" ").at(1)?.split('"').at(1)
|
|
};
|
|
case "53300":
|
|
return {
|
|
kind: "TooManyConnections",
|
|
cause: error.message
|
|
};
|
|
default:
|
|
return {
|
|
kind: "postgres",
|
|
code: error.code ?? "N/A",
|
|
severity: error.severity ?? "N/A",
|
|
message: error.message,
|
|
detail: error.detail,
|
|
column: error.column,
|
|
hint: error.hint
|
|
};
|
|
}
|
|
}
|
|
function isDriverError(error) {
|
|
return typeof error.code === "string" && typeof error.message === "string" && typeof error.severity === "string" && (typeof error.detail === "string" || error.detail === void 0) && (typeof error.column === "string" || error.column === void 0) && (typeof error.hint === "string" || error.hint === void 0);
|
|
}
|
|
function mapSocketError(error) {
|
|
switch(error.code){
|
|
case "ENOTFOUND":
|
|
case "ECONNREFUSED":
|
|
return {
|
|
kind: "DatabaseNotReachable",
|
|
host: error.address ?? error.hostname,
|
|
port: error.port
|
|
};
|
|
case "ECONNRESET":
|
|
return {
|
|
kind: "ConnectionClosed"
|
|
};
|
|
case "ETIMEDOUT":
|
|
return {
|
|
kind: "SocketTimeout"
|
|
};
|
|
}
|
|
}
|
|
function isSocketError(error) {
|
|
return typeof error.code === "string" && typeof error.syscall === "string" && typeof error.errno === "number" && SOCKET_ERRORS.has(error.code);
|
|
}
|
|
function isTlsError(error) {
|
|
if (typeof error.code === "string") {
|
|
return TLS_ERRORS.has(error.code);
|
|
}
|
|
switch(error.message){
|
|
case "The server does not support SSL connections":
|
|
case "There was an error establishing an SSL connection":
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
// src/pg.ts
|
|
var types2 = __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__["default"].types;
|
|
var debug = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$debug$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__["Debug"])("prisma:driver-adapter:pg");
|
|
var PgQueryable = class {
|
|
constructor(client, pgOptions){
|
|
this.client = client;
|
|
this.pgOptions = pgOptions;
|
|
}
|
|
provider = "postgres";
|
|
adapterName = name;
|
|
/**
|
|
* Execute a query given as SQL, interpolating the given parameters.
|
|
*/ async queryRaw(query) {
|
|
const tag = "[js::query_raw]";
|
|
debug(`${tag} %O`, query);
|
|
const { fields, rows } = await this.performIO(query);
|
|
const columnNames = fields.map((field)=>field.name);
|
|
let columnTypes = [];
|
|
try {
|
|
columnTypes = fields.map((field)=>fieldToColumnType(field.dataTypeID));
|
|
} catch (e) {
|
|
if (e instanceof UnsupportedNativeDataType) {
|
|
throw new __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["DriverAdapterError"]({
|
|
kind: "UnsupportedNativeDataType",
|
|
type: e.type
|
|
});
|
|
}
|
|
throw e;
|
|
}
|
|
const udtParser = this.pgOptions?.userDefinedTypeParser;
|
|
if (udtParser) {
|
|
for(let i = 0; i < fields.length; i++){
|
|
const field = fields[i];
|
|
if (field.dataTypeID >= FIRST_NORMAL_OBJECT_ID && !Object.hasOwn(customParsers, field.dataTypeID)) {
|
|
for(let j = 0; j < rows.length; j++){
|
|
rows[j][i] = await udtParser(field.dataTypeID, rows[j][i], this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
columnNames,
|
|
columnTypes,
|
|
rows
|
|
};
|
|
}
|
|
/**
|
|
* Execute a query given as SQL, interpolating the given parameters and
|
|
* returning the number of affected rows.
|
|
* Note: Queryable expects a u64, but napi.rs only supports u32.
|
|
*/ async executeRaw(query) {
|
|
const tag = "[js::execute_raw]";
|
|
debug(`${tag} %O`, query);
|
|
return (await this.performIO(query)).rowCount ?? 0;
|
|
}
|
|
/**
|
|
* Run a query against the database, returning the result set.
|
|
* Should the query fail due to a connection error, the connection is
|
|
* marked as unhealthy.
|
|
*/ async performIO(query) {
|
|
const { sql, args } = query;
|
|
const values = args.map((arg, i)=>mapArg(arg, query.argTypes[i]));
|
|
try {
|
|
const result = await this.client.query({
|
|
text: sql,
|
|
values,
|
|
rowMode: "array",
|
|
types: {
|
|
// This is the error expected:
|
|
// No overload matches this call.
|
|
// The last overload gave the following error.
|
|
// Type '(oid: number, format?: any) => (json: string) => unknown' is not assignable to type '{ <T>(oid: number): TypeParser<string, string | T>; <T>(oid: number, format: "text"): TypeParser<string, string | T>; <T>(oid: number, format: "binary"): TypeParser<...>; }'.
|
|
// Type '(json: string) => unknown' is not assignable to type 'TypeParser<Buffer, any>'.
|
|
// Types of parameters 'json' and 'value' are incompatible.
|
|
// Type 'Buffer' is not assignable to type 'string'.ts(2769)
|
|
//
|
|
// Because pg-types types expect us to handle both binary and text protocol versions,
|
|
// where as far we can see, pg will ever pass only text version.
|
|
//
|
|
// @ts-expect-error
|
|
getTypeParser: (oid, format)=>{
|
|
if (format === "text" && customParsers[oid]) {
|
|
return customParsers[oid];
|
|
}
|
|
return types2.getTypeParser(oid, format);
|
|
}
|
|
}
|
|
}, values);
|
|
return result;
|
|
} catch (e) {
|
|
this.onError(e);
|
|
}
|
|
}
|
|
onError(error) {
|
|
debug("Error in performIO: %O", error);
|
|
throw new __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f40$prisma$2f$driver$2d$adapter$2d$utils$2f$dist$2f$index$2e$mjs__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["DriverAdapterError"](convertDriverError(error));
|
|
}
|
|
};
|
|
var PgTransaction = class extends PgQueryable {
|
|
constructor(client, options, pgOptions, cleanup){
|
|
super(client, pgOptions);
|
|
this.options = options;
|
|
this.pgOptions = pgOptions;
|
|
this.cleanup = cleanup;
|
|
}
|
|
async commit() {
|
|
debug(`[js::commit]`);
|
|
this.cleanup?.();
|
|
this.client.release();
|
|
}
|
|
async rollback() {
|
|
debug(`[js::rollback]`);
|
|
this.cleanup?.();
|
|
this.client.release();
|
|
}
|
|
};
|
|
var PrismaPgAdapter = class extends PgQueryable {
|
|
constructor(client, pgOptions, release){
|
|
super(client);
|
|
this.pgOptions = pgOptions;
|
|
this.release = release;
|
|
}
|
|
async startTransaction(isolationLevel) {
|
|
const options = {
|
|
usePhantomQuery: false
|
|
};
|
|
const tag = "[js::startTransaction]";
|
|
debug("%s options: %O", tag, options);
|
|
const conn = await this.client.connect().catch((error)=>this.onError(error));
|
|
const onError = (err)=>{
|
|
debug(`Error from pool connection: ${err.message} %O`, err);
|
|
this.pgOptions?.onConnectionError?.(err);
|
|
};
|
|
conn.on("error", onError);
|
|
const cleanup = ()=>{
|
|
conn.removeListener("error", onError);
|
|
};
|
|
try {
|
|
const tx = new PgTransaction(conn, options, this.pgOptions, cleanup);
|
|
await tx.executeRaw({
|
|
sql: "BEGIN",
|
|
args: [],
|
|
argTypes: []
|
|
});
|
|
if (isolationLevel) {
|
|
await tx.executeRaw({
|
|
sql: `SET TRANSACTION ISOLATION LEVEL ${isolationLevel}`,
|
|
args: [],
|
|
argTypes: []
|
|
});
|
|
}
|
|
return tx;
|
|
} catch (error) {
|
|
cleanup();
|
|
conn.release(error);
|
|
this.onError(error);
|
|
}
|
|
}
|
|
async executeScript(script) {
|
|
const statements = script.split(";").map((stmt)=>stmt.trim()).filter((stmt)=>stmt.length > 0);
|
|
for (const stmt of statements){
|
|
try {
|
|
await this.client.query(stmt);
|
|
} catch (error) {
|
|
this.onError(error);
|
|
}
|
|
}
|
|
}
|
|
getConnectionInfo() {
|
|
return {
|
|
schemaName: this.pgOptions?.schema,
|
|
supportsRelationJoins: true
|
|
};
|
|
}
|
|
async dispose() {
|
|
return this.release?.();
|
|
}
|
|
underlyingDriver() {
|
|
return this.client;
|
|
}
|
|
};
|
|
var PrismaPgAdapterFactory = class {
|
|
constructor(poolOrConfig, options){
|
|
this.options = options;
|
|
if (poolOrConfig instanceof __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__["default"].Pool) {
|
|
this.externalPool = poolOrConfig;
|
|
this.config = poolOrConfig.options;
|
|
} else {
|
|
this.externalPool = null;
|
|
this.config = poolOrConfig;
|
|
}
|
|
}
|
|
provider = "postgres";
|
|
adapterName = name;
|
|
config;
|
|
externalPool;
|
|
async connect() {
|
|
const client = this.externalPool ?? new __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__["default"].Pool(this.config);
|
|
const onIdleClientError = (err)=>{
|
|
debug(`Error from idle pool client: ${err.message} %O`, err);
|
|
this.options?.onPoolError?.(err);
|
|
};
|
|
client.on("error", onIdleClientError);
|
|
return new PrismaPgAdapter(client, this.options, async ()=>{
|
|
if (this.externalPool) {
|
|
if (this.options?.disposeExternalPool) {
|
|
await this.externalPool.end();
|
|
this.externalPool = null;
|
|
} else {
|
|
this.externalPool.removeListener("error", onIdleClientError);
|
|
}
|
|
} else {
|
|
await client.end();
|
|
}
|
|
});
|
|
}
|
|
async connectToShadowDb() {
|
|
const conn = await this.connect();
|
|
const database = `prisma_migrate_shadow_db_${globalThis.crypto.randomUUID()}`;
|
|
await conn.executeScript(`CREATE DATABASE "${database}"`);
|
|
const client = new __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$pg$29$__["default"].Pool({
|
|
...this.config,
|
|
database
|
|
});
|
|
return new PrismaPgAdapter(client, void 0, async ()=>{
|
|
await conn.executeScript(`DROP DATABASE "${database}"`);
|
|
await client.end();
|
|
});
|
|
}
|
|
};
|
|
;
|
|
__turbopack_async_result__();
|
|
} catch(e) { __turbopack_async_result__(e); } }, false);}),
|
|
];
|
|
|
|
//# sourceMappingURL=%5Broot-of-the-server%5D__bc7b254d._.js.map
|