@prisma/extension-accelerate
Advanced tools
Comparing version 0.0.0-experimental-15ed6eb to 0.0.0-experimental-9ab6d60
@@ -1,3 +0,4 @@ | ||
import { Prisma } from "@prisma/client"; | ||
import PrismaDefault, { type Prisma } from "@prisma/client/scripts/default-index.js"; | ||
import type { Types } from "@prisma/client/runtime"; | ||
type QueryOptionsCb = Parameters<Types.Extensions.UserArgs["query"]["someModel"]["someAction"]>[0]; | ||
export interface PrismaCacheStrategy { | ||
@@ -11,28 +12,26 @@ /** TODO */ | ||
} | ||
declare const _default: (client: any) => import(".prisma/client").PrismaClient<any, any, any, { | ||
result: {} & Record<string, {}>; | ||
model: {} & Record<string, {}> & Record<string, { | ||
aggregate: () => <T, A>(this: T, args: Prisma.Exact<A, Types.Public.Args<T, "aggregate"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T, A, "aggregate">>; | ||
count: () => <T_1, A_1>(this: T_1, args: Prisma.Exact<A_1, Types.Public.Args<T_1, "count"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_1, A_1, "count">>; | ||
findFirst: () => <T_2, A_2>(this: T_2, args: Prisma.Exact<A_2, Types.Public.Args<T_2, "findFirst"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_2, A_2, "findFirst">>; | ||
findFirstOrThrow: () => <T_3, A_3>(this: T_3, args: Prisma.Exact<A_3, Types.Public.Args<T_3, "findFirstOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_3, A_3, "findFirstOrThrow">>; | ||
findMany: () => <T_4, A_4>(this: T_4, args: Prisma.Exact<A_4, Types.Public.Args<T_4, "findMany"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_4, A_4, "findMany">>; | ||
findUnique: () => <T_5, A_5>(this: T_5, args: Prisma.Exact<A_5, Types.Public.Args<T_5, "findUnique"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_5, A_5, "findUnique">>; | ||
findUniqueOrThrow: () => <T_6, A_6>(this: T_6, args: Prisma.Exact<A_6, Types.Public.Args<T_6, "findUniqueOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_6, A_6, "findUniqueOrThrow">>; | ||
groupBy: () => <T_7, A_7>(this: T_7, args: Prisma.Exact<A_7, Types.Public.Args<T_7, "groupBy"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_7, A_7, "groupBy">>; | ||
}> & { | ||
$allModels: { | ||
aggregate: () => <T, A>(this: T, args: Prisma.Exact<A, Types.Public.Args<T, "aggregate"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T, A, "aggregate">>; | ||
count: () => <T_1, A_1>(this: T_1, args: Prisma.Exact<A_1, Types.Public.Args<T_1, "count"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_1, A_1, "count">>; | ||
findFirst: () => <T_2, A_2>(this: T_2, args: Prisma.Exact<A_2, Types.Public.Args<T_2, "findFirst"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_2, A_2, "findFirst">>; | ||
findFirstOrThrow: () => <T_3, A_3>(this: T_3, args: Prisma.Exact<A_3, Types.Public.Args<T_3, "findFirstOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_3, A_3, "findFirstOrThrow">>; | ||
findMany: () => <T_4, A_4>(this: T_4, args: Prisma.Exact<A_4, Types.Public.Args<T_4, "findMany"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_4, A_4, "findMany">>; | ||
findUnique: () => <T_5, A_5>(this: T_5, args: Prisma.Exact<A_5, Types.Public.Args<T_5, "findUnique"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_5, A_5, "findUnique">>; | ||
findUniqueOrThrow: () => <T_6, A_6>(this: T_6, args: Prisma.Exact<A_6, Types.Public.Args<T_6, "findUniqueOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_6, A_6, "findUniqueOrThrow">>; | ||
groupBy: () => <T_7, A_7>(this: T_7, args: Prisma.Exact<A_7, Types.Public.Args<T_7, "groupBy"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_7, A_7, "groupBy">>; | ||
}; | ||
declare function withCacheHeaders(params: QueryOptionsCb): Promise<any>; | ||
declare const _default: (client: any) => PrismaDefault.PrismaClientExtends<Types.Extensions.InternalArgs<{}, { | ||
$allModels: { | ||
aggregate<T, A>(this: T, args: Prisma.Exact<A, Types.Public.Args<T, "aggregate"> & PrismaCacheStrategy>): Promise<Prisma.Result<T, A, "aggregate">>; | ||
count<T_1, A_1>(this: T_1, args?: Prisma.Exact<A_1, Types.Public.Args<T_1, "count"> & PrismaCacheStrategy> | undefined): Promise<Prisma.Result<T_1, A_1, "count">>; | ||
findFirst<T_2, A_2>(this: T_2, args?: Prisma.Exact<A_2, Types.Public.Args<T_2, "findFirst"> & PrismaCacheStrategy> | undefined): Promise<Prisma.Result<T_2, A_2, "findFirst">>; | ||
findFirstOrThrow<T_3, A_3>(this: T_3, args?: Prisma.Exact<A_3, Types.Public.Args<T_3, "findFirstOrThrow"> & PrismaCacheStrategy> | undefined): Promise<Prisma.Result<T_3, A_3, "findFirstOrThrow">>; | ||
findMany<T_4, A_4>(this: T_4, args?: Prisma.Exact<A_4, Types.Public.Args<T_4, "findMany"> & PrismaCacheStrategy> | undefined): Promise<Prisma.Result<T_4, A_4, "findMany">>; | ||
findUnique<T_5, A_5>(this: T_5, args: Prisma.Exact<A_5, Types.Public.Args<T_5, "findUnique"> & PrismaCacheStrategy>): Promise<Prisma.Result<T_5, A_5, "findUnique">>; | ||
findUniqueOrThrow<T_6, A_6>(this: T_6, args: Prisma.Exact<A_6, Types.Public.Args<T_6, "findUniqueOrThrow"> & PrismaCacheStrategy>): Promise<Prisma.Result<T_6, A_6, "findUniqueOrThrow">>; | ||
groupBy<T_7, A_7>(this: T_7, args: Prisma.Exact<A_7, Types.Public.Args<T_7, "groupBy"> & PrismaCacheStrategy>): Promise<Prisma.Result<T_7, A_7, "groupBy">>; | ||
}; | ||
client: {}; | ||
query: {}; | ||
}>; | ||
}, {}, {}> & Types.Extensions.InternalArgs<{}, {}, { | ||
$allModels: { | ||
aggregate: typeof withCacheHeaders; | ||
count: typeof withCacheHeaders; | ||
findFirst: typeof withCacheHeaders; | ||
findFirstOrThrow: typeof withCacheHeaders; | ||
findMany: typeof withCacheHeaders; | ||
findUnique: typeof withCacheHeaders; | ||
findUniqueOrThrow: typeof withCacheHeaders; | ||
groupBy: typeof withCacheHeaders; | ||
}; | ||
}, {}> & Types.Extensions.DefaultArgs>; | ||
export default _default; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const client_1 = require("@prisma/client"); | ||
// importing default is needed for ESM compatibility | ||
// default-index is a CJS file, so named exports are not resolved | ||
// the types create a separate resolution issue, so they are still imported by name | ||
const default_index_js_1 = __importDefault(require("@prisma/client/scripts/default-index.js")); | ||
const EXTENSION_NAME = "@prisma/extension-accelerate"; | ||
exports.default = client_1.Prisma.defineExtension((client) => { | ||
function withCacheHeaders(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
} | ||
exports.default = default_index_js_1.default.Prisma.defineExtension((client) => { | ||
const xclient = client.$extends({ | ||
@@ -10,99 +28,10 @@ name: EXTENSION_NAME, | ||
$allModels: { | ||
// TODO: these functions are repetitive. Is there a type we can use to generic this? | ||
aggregate(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
count(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
findFirst(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
findFirstOrThrow(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
findMany(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
findUnique(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
findUniqueOrThrow(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
groupBy(params) { | ||
const { args } = params; | ||
const { cacheStrategy, ...rest } = args; | ||
const { __internalParams, query } = params; | ||
__internalParams.headers = { | ||
...__internalParams.headers, | ||
"cache-control": cacheStrategy | ||
? `max-age=${cacheStrategy.ttl};stale-while-revalidate=${cacheStrategy.swr}` | ||
: `no-cache`, | ||
}; | ||
return query(rest, __internalParams); | ||
}, | ||
aggregate: withCacheHeaders, | ||
count: withCacheHeaders, | ||
findFirst: withCacheHeaders, | ||
findFirstOrThrow: withCacheHeaders, | ||
findMany: withCacheHeaders, | ||
findUnique: withCacheHeaders, | ||
findUniqueOrThrow: withCacheHeaders, | ||
groupBy: withCacheHeaders, | ||
}, | ||
@@ -118,31 +47,31 @@ }, | ||
aggregate(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].aggregate(args); | ||
}, | ||
count(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].count(args); | ||
}, | ||
findFirst(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].findFirst(args); | ||
}, | ||
findFirstOrThrow(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].findFirstOrThrow(args); | ||
}, | ||
findMany(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].findMany(args); | ||
}, | ||
findUnique(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].findUnique(args); | ||
}, | ||
findUniqueOrThrow(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].findUniqueOrThrow(args); | ||
}, | ||
groupBy(args) { | ||
const ctx = client_1.Prisma.getExtensionContext(this); | ||
const ctx = this; | ||
return xclient[ctx.name].groupBy(args); | ||
@@ -149,0 +78,0 @@ }, |
@@ -1,3 +0,2 @@ | ||
import { Prisma } from "@prisma/client"; | ||
import type { Types } from "@prisma/client/runtime"; | ||
import PrismaDefault from "@prisma/client/scripts/default-index.js"; | ||
export interface PrismaCacheStrategy { | ||
@@ -11,28 +10,3 @@ /** TODO */ | ||
} | ||
declare const _default: (client: any) => import(".prisma/client").PrismaClient<any, any, any, { | ||
result: {} & Record<string, {}>; | ||
model: {} & Record<string, {}> & Record<string, { | ||
aggregate: () => <T, A>(this: T, args: Prisma.Exact<A, Types.Public.Args<T, "aggregate"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T, A, "aggregate">>; | ||
count: () => <T_1, A_1>(this: T_1, args: Prisma.Exact<A_1, Types.Public.Args<T_1, "count"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_1, A_1, "count">>; | ||
findFirst: () => <T_2, A_2>(this: T_2, args: Prisma.Exact<A_2, Types.Public.Args<T_2, "findFirst"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_2, A_2, "findFirst">>; | ||
findFirstOrThrow: () => <T_3, A_3>(this: T_3, args: Prisma.Exact<A_3, Types.Public.Args<T_3, "findFirstOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_3, A_3, "findFirstOrThrow">>; | ||
findMany: () => <T_4, A_4>(this: T_4, args: Prisma.Exact<A_4, Types.Public.Args<T_4, "findMany"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_4, A_4, "findMany">>; | ||
findUnique: () => <T_5, A_5>(this: T_5, args: Prisma.Exact<A_5, Types.Public.Args<T_5, "findUnique"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_5, A_5, "findUnique">>; | ||
findUniqueOrThrow: () => <T_6, A_6>(this: T_6, args: Prisma.Exact<A_6, Types.Public.Args<T_6, "findUniqueOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_6, A_6, "findUniqueOrThrow">>; | ||
groupBy: () => <T_7, A_7>(this: T_7, args: Prisma.Exact<A_7, Types.Public.Args<T_7, "groupBy"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_7, A_7, "groupBy">>; | ||
}> & { | ||
$allModels: { | ||
aggregate: () => <T, A>(this: T, args: Prisma.Exact<A, Types.Public.Args<T, "aggregate"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T, A, "aggregate">>; | ||
count: () => <T_1, A_1>(this: T_1, args: Prisma.Exact<A_1, Types.Public.Args<T_1, "count"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_1, A_1, "count">>; | ||
findFirst: () => <T_2, A_2>(this: T_2, args: Prisma.Exact<A_2, Types.Public.Args<T_2, "findFirst"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_2, A_2, "findFirst">>; | ||
findFirstOrThrow: () => <T_3, A_3>(this: T_3, args: Prisma.Exact<A_3, Types.Public.Args<T_3, "findFirstOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_3, A_3, "findFirstOrThrow">>; | ||
findMany: () => <T_4, A_4>(this: T_4, args: Prisma.Exact<A_4, Types.Public.Args<T_4, "findMany"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_4, A_4, "findMany">>; | ||
findUnique: () => <T_5, A_5>(this: T_5, args: Prisma.Exact<A_5, Types.Public.Args<T_5, "findUnique"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_5, A_5, "findUnique">>; | ||
findUniqueOrThrow: () => <T_6, A_6>(this: T_6, args: Prisma.Exact<A_6, Types.Public.Args<T_6, "findUniqueOrThrow"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_6, A_6, "findUniqueOrThrow">>; | ||
groupBy: () => <T_7, A_7>(this: T_7, args: Prisma.Exact<A_7, Types.Public.Args<T_7, "groupBy"> & PrismaCacheStrategy>) => Promise<Types.Public.Result<T_7, A_7, "groupBy">>; | ||
}; | ||
}; | ||
client: {}; | ||
query: {}; | ||
}>; | ||
declare const _default: (client: any) => PrismaDefault.PrismaClientExtends<any>; | ||
export default _default; |
@@ -23,5 +23,17 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { Prisma } from "@prisma/client"; | ||
// importing default is needed for ESM compatibility | ||
// default-index is a CJS file, so named exports are not resolved | ||
// the types create a separate resolution issue, so they are still imported by name | ||
import PrismaDefault from "@prisma/client/scripts/default-index.js"; | ||
var EXTENSION_NAME = "@prisma/extension-accelerate"; | ||
export default Prisma.defineExtension(function (client) { | ||
function withCacheHeaders(params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
} | ||
export default PrismaDefault.Prisma.defineExtension(function (client) { | ||
var xclient = client.$extends({ | ||
@@ -31,75 +43,10 @@ name: EXTENSION_NAME, | ||
$allModels: { | ||
// TODO: these functions are repetitive. Is there a type we can use to generic this? | ||
aggregate: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
count: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
findFirst: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
findFirstOrThrow: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
findMany: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
findUnique: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
findUniqueOrThrow: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
}, | ||
groupBy: function (params) { | ||
var args = params.args; | ||
var _a = args, cacheStrategy = _a.cacheStrategy, rest = __rest(_a, ["cacheStrategy"]); | ||
var _b = params, __internalParams = _b.__internalParams, query = _b.query; | ||
__internalParams.headers = __assign(__assign({}, __internalParams.headers), { "cache-control": cacheStrategy | ||
? "max-age=".concat(cacheStrategy.ttl, ";stale-while-revalidate=").concat(cacheStrategy.swr) | ||
: "no-cache" }); | ||
return query(rest, __internalParams); | ||
} | ||
aggregate: withCacheHeaders, | ||
count: withCacheHeaders, | ||
findFirst: withCacheHeaders, | ||
findFirstOrThrow: withCacheHeaders, | ||
findMany: withCacheHeaders, | ||
findUnique: withCacheHeaders, | ||
findUniqueOrThrow: withCacheHeaders, | ||
groupBy: withCacheHeaders | ||
} | ||
@@ -115,31 +62,31 @@ } | ||
aggregate: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].aggregate(args); | ||
}, | ||
count: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].count(args); | ||
}, | ||
findFirst: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].findFirst(args); | ||
}, | ||
findFirstOrThrow: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].findFirstOrThrow(args); | ||
}, | ||
findMany: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].findMany(args); | ||
}, | ||
findUnique: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].findUnique(args); | ||
}, | ||
findUniqueOrThrow: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].findUniqueOrThrow(args); | ||
}, | ||
groupBy: function (args) { | ||
var ctx = Prisma.getExtensionContext(this); | ||
var ctx = this; | ||
return xclient[ctx.name].groupBy(args); | ||
@@ -146,0 +93,0 @@ } |
{ | ||
"name": "@prisma/extension-accelerate", | ||
"type": "module", | ||
"version": "0.0.0-experimental-15ed6eb", | ||
"version": "0.0.0-experimental-9ab6d60", | ||
"description": "Prisma Client extension for Accelerate", | ||
@@ -33,3 +33,2 @@ "sideEffects": false, | ||
"prettier": "2.8.1", | ||
"prisma": "^4.9.0", | ||
"ts-node": "^10.9.1", | ||
@@ -36,0 +35,0 @@ "typescript": "^4.9.4" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10
11224
221
1