Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@prisma/extension-accelerate

Package Overview
Dependencies
Maintainers
14
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma/extension-accelerate - npm Package Compare versions

Comparing version 0.0.0-experimental-b1c4b75 to 0.0.0-experimental-eca00f7

94

dist/cjs/index.d.ts

@@ -1,37 +0,75 @@

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 {
/** TODO */
/**
* Specifies the caching parameters for Accelerate.
*
* `cacheStrategy` only applies when used with an Accelerate connection string.
*/
readonly cacheStrategy?: {
/** TODO */
/**
* `swr` is short for Stale-While-Revalidate.
*
* `swr` defines the number of seconds that Accelerate may serve _stale_ cache data.
* _Stale_ data is a cache hit, but the cache will be refreshed in the background by Accelerate.
* The Prisma operation will not be blocked while data is refreshed.
*
* Use `swr` to reduce the latency of accessing the data while still maintaining
* a more up-to-date value in the Accelerate cache.
* `swr` without `ttl` will not reduce database load since Accelerate will
* run the query in the background.
*
* `swr` can be combined with `ttl`.
* `swr` applies **after** `ttl` has expired.
* The total number of seconds data will be cached is `ttl + swr`.
*
* `swr` only applies when used with an Accelerate connection string.
*/
readonly swr?: number;
/**
* `ttl` is short for Time-to-Live.
*
* `ttl` defines the number of seconds that Accelerate may serve _fresh_ cache data.
* _Fresh_ data is a cache hit and will not execute the query against the database.
*
* Use `ttl` to reduce database load and latency for data that does not
* require frequent updates.
* `ttl` without `swr` will incur a blocking database query for the first
* request after `ttl` expires.
*
* It's recommended to combine `ttl` and `swr` to maintain low latency while
* Accelerate refreshes cached data in the background.
* `swr` applies **after** `ttl` has expired.
* The total number of seconds data will be cached is `ttl + swr`.
*
* `ttl` only applies when used with an Accelerate connection string.
*/
readonly ttl?: number;
};
}
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,37 +0,50 @@

import { Prisma } from "@prisma/client";
import type { Types } from "@prisma/client/runtime";
import PrismaDefault from "@prisma/client/scripts/default-index.js";
export interface PrismaCacheStrategy {
/** TODO */
/**
* Specifies the caching parameters for Accelerate.
*
* `cacheStrategy` only applies when used with an Accelerate connection string.
*/
readonly cacheStrategy?: {
/** TODO */
/**
* `swr` is short for Stale-While-Revalidate.
*
* `swr` defines the number of seconds that Accelerate may serve _stale_ cache data.
* _Stale_ data is a cache hit, but the cache will be refreshed in the background by Accelerate.
* The Prisma operation will not be blocked while data is refreshed.
*
* Use `swr` to reduce the latency of accessing the data while still maintaining
* a more up-to-date value in the Accelerate cache.
* `swr` without `ttl` will not reduce database load since Accelerate will
* run the query in the background.
*
* `swr` can be combined with `ttl`.
* `swr` applies **after** `ttl` has expired.
* The total number of seconds data will be cached is `ttl + swr`.
*
* `swr` only applies when used with an Accelerate connection string.
*/
readonly swr?: number;
/**
* `ttl` is short for Time-to-Live.
*
* `ttl` defines the number of seconds that Accelerate may serve _fresh_ cache data.
* _Fresh_ data is a cache hit and will not execute the query against the database.
*
* Use `ttl` to reduce database load and latency for data that does not
* require frequent updates.
* `ttl` without `swr` will incur a blocking database query for the first
* request after `ttl` expires.
*
* It's recommended to combine `ttl` and `swr` to maintain low latency while
* Accelerate refreshes cached data in the background.
* `swr` applies **after** `ttl` has expired.
* The total number of seconds data will be cached is `ttl + swr`.
*
* `ttl` only applies when used with an Accelerate connection string.
*/
readonly ttl?: number;
};
}
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-b1c4b75",
"version": "0.0.0-experimental-eca00f7",
"description": "Prisma Client extension for Accelerate",

@@ -25,3 +25,3 @@ "sideEffects": false,

"devDependencies": {
"@prisma/client": "4.9.0-integration-feat-client-ext-generic-type-api.11",
"@prisma/client": "^4.9.0",
"@tsconfig/esm": "^1.0.2",

@@ -34,3 +34,2 @@ "@tsconfig/node14": "^1.0.3",

"prettier": "2.8.1",
"prisma": "4.9.0-integration-feat-client-ext-generic-type-api.11",
"ts-node": "^10.9.1",

@@ -40,4 +39,4 @@ "typescript": "^4.9.4"

"peerDependencies": {
"@prisma/client": "4.9.0-integration-feat-client-ext-generic-type-api.11"
"@prisma/client": ">=4.9.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc