@pkgverse/prismock 2.0.1-beta.0 → 2.0.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +164 -36
- package/dist/lib/client.d.ts +39 -13
- package/dist/lib/dmmf.d.ts +4 -0
- package/dist/lib/operations/create.d.ts +1 -23
- package/dist/lib/operations/find/find.d.ts +5 -141
- package/dist/lib/prismock.d.ts +11 -270
- package/package.json +9 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { generatePrismock, generatePrismockSync } from './lib/prismock';
|
|
2
|
-
export { createPrismock,
|
|
2
|
+
export { createPrismock, Prismock, type PrismaModule, PrismockClientType, getClient, getClientClass, getDefaultClient, getDefaultClientClass } from './lib/client';
|
package/dist/index.mjs
CHANGED
|
@@ -627,9 +627,6 @@ var require_src = __commonJS((exports, module) => {
|
|
|
627
627
|
exports.isCuid = isCuid;
|
|
628
628
|
});
|
|
629
629
|
|
|
630
|
-
// src/lib/prismock.ts
|
|
631
|
-
import * as path from "path";
|
|
632
|
-
|
|
633
630
|
// src/lib/operations/aggregate.ts
|
|
634
631
|
function aggregate(args, items) {
|
|
635
632
|
const aggregated = {};
|
|
@@ -4759,7 +4756,7 @@ function updateMany(args, current, delegates, onChange) {
|
|
|
4759
4756
|
return toUpdate;
|
|
4760
4757
|
}
|
|
4761
4758
|
// node_modules/@prisma/client/package.json
|
|
4762
|
-
var version = "
|
|
4759
|
+
var version = "6.10.0";
|
|
4763
4760
|
|
|
4764
4761
|
// src/lib/delegate.ts
|
|
4765
4762
|
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";
|
|
@@ -4769,7 +4766,7 @@ function generateDelegate(model, data, name, properties, delegates, onChange) {
|
|
|
4769
4766
|
delete: (args = {}) => {
|
|
4770
4767
|
const deleted = deleteMany(args, delegate, delegates, onChange);
|
|
4771
4768
|
if (deleted.length === 0)
|
|
4772
|
-
return Promise.reject(new PrismaClientKnownRequestError(`No ${delegate.model.name}
|
|
4769
|
+
return Promise.reject(new PrismaClientKnownRequestError(`No record was found for a delete on ${delegate.model.name}`, {
|
|
4773
4770
|
code: "P2025",
|
|
4774
4771
|
clientVersion: version,
|
|
4775
4772
|
meta: {
|
|
@@ -4786,7 +4783,7 @@ function generateDelegate(model, data, name, properties, delegates, onChange) {
|
|
|
4786
4783
|
update: (args) => {
|
|
4787
4784
|
const updated = updateMany(args, delegate, delegates, onChange);
|
|
4788
4785
|
const [update3] = updated;
|
|
4789
|
-
return update3 ? Promise.resolve(update3) : Promise.reject(new PrismaClientKnownRequestError(`No ${delegate.model.name}
|
|
4786
|
+
return update3 ? Promise.resolve(update3) : Promise.reject(new PrismaClientKnownRequestError(`No record was found for an update on ${delegate.model.name}`, {
|
|
4790
4787
|
code: "P2025",
|
|
4791
4788
|
clientVersion: version,
|
|
4792
4789
|
meta: {
|
|
@@ -4832,7 +4829,7 @@ function generateDelegate(model, data, name, properties, delegates, onChange) {
|
|
|
4832
4829
|
findUniqueOrThrow: (args = {}) => {
|
|
4833
4830
|
const found = findOne(args, delegate, delegates);
|
|
4834
4831
|
if (!found)
|
|
4835
|
-
return Promise.reject(new PrismaClientKnownRequestError(`No ${delegate.model.name}
|
|
4832
|
+
return Promise.reject(new PrismaClientKnownRequestError(`No record was found for a query on ${delegate.model.name}`, {
|
|
4836
4833
|
code: "P2025",
|
|
4837
4834
|
clientVersion: version
|
|
4838
4835
|
}));
|
|
@@ -4841,7 +4838,7 @@ function generateDelegate(model, data, name, properties, delegates, onChange) {
|
|
|
4841
4838
|
findFirstOrThrow: (args = {}) => {
|
|
4842
4839
|
const found = findOne(args, delegate, delegates);
|
|
4843
4840
|
if (!found)
|
|
4844
|
-
return Promise.reject(new PrismaClientKnownRequestError(`No ${delegate.model.name}
|
|
4841
|
+
return Promise.reject(new PrismaClientKnownRequestError(`No record was found for a query on ${delegate.model.name}`, {
|
|
4845
4842
|
code: "P2025",
|
|
4846
4843
|
clientVersion: version
|
|
4847
4844
|
}));
|
|
@@ -5158,6 +5155,19 @@ function applyExtensions(client, extensions) {
|
|
|
5158
5155
|
return modelExtended;
|
|
5159
5156
|
}
|
|
5160
5157
|
|
|
5158
|
+
// src/lib/client.ts
|
|
5159
|
+
import { execSync } from "child_process";
|
|
5160
|
+
|
|
5161
|
+
// src/lib/dmmf.ts
|
|
5162
|
+
import * as path from "path";
|
|
5163
|
+
var PrismaInternals = await import("@prisma/internals");
|
|
5164
|
+
var { getDMMF, getSchemaWithPath, getConfig } = PrismaInternals.default;
|
|
5165
|
+
async function generateDMMF(schemaPath) {
|
|
5166
|
+
const pathToModule = schemaPath ?? __require.resolve(path.resolve(process.cwd(), "prisma/schema.prisma"));
|
|
5167
|
+
const datamodel = await getSchemaWithPath(pathToModule);
|
|
5168
|
+
return await getDMMF({ datamodel: datamodel.schemas });
|
|
5169
|
+
}
|
|
5170
|
+
|
|
5161
5171
|
// src/lib/client.ts
|
|
5162
5172
|
class Prismock {
|
|
5163
5173
|
__prismaModule;
|
|
@@ -5176,7 +5186,9 @@ class Prismock {
|
|
|
5176
5186
|
this.generate();
|
|
5177
5187
|
}
|
|
5178
5188
|
generate() {
|
|
5179
|
-
const { delegates, setData, getData } = generateDelegates({
|
|
5189
|
+
const { delegates, setData, getData } = generateDelegates({
|
|
5190
|
+
models: this.__prismaModule.dmmf.datamodel.models
|
|
5191
|
+
});
|
|
5180
5192
|
Object.entries({ ...delegates, setData, getData }).forEach(([key, value]) => {
|
|
5181
5193
|
if (key in this)
|
|
5182
5194
|
Object.assign(this[key], value);
|
|
@@ -5241,36 +5253,150 @@ function generateClient(delegates, getData, setData) {
|
|
|
5241
5253
|
}
|
|
5242
5254
|
};
|
|
5243
5255
|
}
|
|
5244
|
-
|
|
5245
|
-
const
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5256
|
+
function getPgLitePrismockData(options) {
|
|
5257
|
+
const sql = execSync(`bun prisma migrate diff --from-empty --to-schema-datamodel=${options.schemaPath} --script`, {
|
|
5258
|
+
encoding: "utf-8"
|
|
5259
|
+
});
|
|
5260
|
+
const connectionPromise = options.adapter.connect();
|
|
5261
|
+
const reset = async () => {
|
|
5262
|
+
const connection = await connectionPromise;
|
|
5263
|
+
await connection.executeScript(`
|
|
5264
|
+
DROP SCHEMA public CASCADE;
|
|
5265
|
+
CREATE SCHEMA public;
|
|
5266
|
+
`);
|
|
5267
|
+
await connection.executeScript(sql);
|
|
5268
|
+
};
|
|
5269
|
+
const getData = async () => {
|
|
5270
|
+
const data = {};
|
|
5271
|
+
for (const model of options.datamodel.datamodel.models) {
|
|
5272
|
+
const tableName = model.dbName ?? model.name;
|
|
5273
|
+
const idColumn = model.fields.find((field) => field.isId);
|
|
5274
|
+
const defaultOrderBy = [];
|
|
5275
|
+
if (idColumn) {
|
|
5276
|
+
defaultOrderBy.push({ [idColumn.dbName ?? idColumn.name]: "asc" });
|
|
5277
|
+
}
|
|
5278
|
+
const orderBy = model.primaryKey?.fields.map((field) => ({ [field]: "asc" })) ?? defaultOrderBy;
|
|
5279
|
+
const items = await options.prismaClient[camelize(model.name)].findMany({
|
|
5280
|
+
orderBy
|
|
5281
|
+
});
|
|
5282
|
+
data[camelize(model.name)] = items;
|
|
5283
|
+
}
|
|
5284
|
+
return data;
|
|
5285
|
+
};
|
|
5286
|
+
const setData = async (data) => {
|
|
5287
|
+
for (const model in data) {
|
|
5288
|
+
const items = data[model];
|
|
5289
|
+
const prismaModel = options.datamodel.datamodel.models.find((m) => camelize(m.name) === camelize(model) || m.dbName === model);
|
|
5290
|
+
if (!prismaModel) {
|
|
5291
|
+
continue;
|
|
5292
|
+
}
|
|
5293
|
+
const tableName = prismaModel.dbName ?? prismaModel.name;
|
|
5294
|
+
await prisma[camelize(model)].createMany({
|
|
5295
|
+
data: items
|
|
5296
|
+
});
|
|
5255
5297
|
}
|
|
5256
5298
|
};
|
|
5257
|
-
return
|
|
5299
|
+
return {
|
|
5300
|
+
reset,
|
|
5301
|
+
getData,
|
|
5302
|
+
setData
|
|
5303
|
+
};
|
|
5258
5304
|
}
|
|
5259
|
-
async function
|
|
5260
|
-
|
|
5305
|
+
async function getClient(options) {
|
|
5306
|
+
const datamodel = await generateDMMF(options.schemaPath);
|
|
5307
|
+
if (options.usePgLite) {
|
|
5308
|
+
const { PGlite } = await import("@electric-sql/pglite");
|
|
5309
|
+
const { PrismaPGlite } = await import("pglite-prisma-adapter");
|
|
5310
|
+
const pglite = new PGlite("memory://");
|
|
5311
|
+
const adapter = new PrismaPGlite(pglite);
|
|
5312
|
+
const prisma2 = new options.prismaClient({
|
|
5313
|
+
adapter
|
|
5314
|
+
});
|
|
5315
|
+
const prismockData = getPgLitePrismockData({
|
|
5316
|
+
schemaPath: options.schemaPath,
|
|
5317
|
+
pglite,
|
|
5318
|
+
adapter,
|
|
5319
|
+
datamodel,
|
|
5320
|
+
prismaClient: prisma2
|
|
5321
|
+
});
|
|
5322
|
+
await prismockData.reset();
|
|
5323
|
+
return Object.assign(prisma2, prismockData);
|
|
5324
|
+
}
|
|
5325
|
+
return await Prismock.create(options.prismaModule);
|
|
5261
5326
|
}
|
|
5262
|
-
async function
|
|
5263
|
-
|
|
5327
|
+
async function getClientClass(options) {
|
|
5328
|
+
const datamodel = await generateDMMF(options.schemaPath);
|
|
5329
|
+
if (options.usePgLite) {
|
|
5330
|
+
const { PGlite } = await import("@electric-sql/pglite");
|
|
5331
|
+
const { PrismaPGlite } = await import("pglite-prisma-adapter");
|
|
5332
|
+
|
|
5333
|
+
class PrismaClientMocked2 extends options.PrismaClient {
|
|
5334
|
+
pglite;
|
|
5335
|
+
adapter;
|
|
5336
|
+
datamodel;
|
|
5337
|
+
prismockData;
|
|
5338
|
+
constructor(...args) {
|
|
5339
|
+
const pglite = new PGlite("memory://");
|
|
5340
|
+
const adapter = new PrismaPGlite(pglite);
|
|
5341
|
+
const prismaOptions = args[0] ?? {};
|
|
5342
|
+
super({ ...prismaOptions, adapter });
|
|
5343
|
+
this.pglite = pglite;
|
|
5344
|
+
this.adapter = adapter;
|
|
5345
|
+
this.datamodel = datamodel;
|
|
5346
|
+
this.prismockData = getPgLitePrismockData({
|
|
5347
|
+
schemaPath: options.schemaPath,
|
|
5348
|
+
pglite,
|
|
5349
|
+
adapter,
|
|
5350
|
+
datamodel,
|
|
5351
|
+
prismaClient: this
|
|
5352
|
+
});
|
|
5353
|
+
}
|
|
5354
|
+
async $connect() {
|
|
5355
|
+
await this.reset();
|
|
5356
|
+
return super.$connect();
|
|
5357
|
+
}
|
|
5358
|
+
async reset() {
|
|
5359
|
+
await this.prismockData.reset();
|
|
5360
|
+
}
|
|
5361
|
+
async getData() {
|
|
5362
|
+
return this.prismockData.getData();
|
|
5363
|
+
}
|
|
5364
|
+
async setData(data) {
|
|
5365
|
+
return this.prismockData.setData(data);
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5368
|
+
return PrismaClientMocked2;
|
|
5369
|
+
}
|
|
5370
|
+
|
|
5371
|
+
class PrismaClientMocked extends Prismock {
|
|
5372
|
+
constructor() {
|
|
5373
|
+
super(options.prismaModule);
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
return PrismaClientMocked;
|
|
5377
|
+
}
|
|
5378
|
+
async function getDefaultClient() {
|
|
5379
|
+
const { Prisma: Prisma2, PrismaClient } = await import("@prisma/client");
|
|
5380
|
+
return await getClient({
|
|
5381
|
+
prismaModule: Prisma2,
|
|
5382
|
+
prismaClient: PrismaClient,
|
|
5383
|
+
schemaPath: "./prisma/schema.prisma",
|
|
5384
|
+
usePgLite: process.env.PRISMOCK_USE_PG_LITE ? true : undefined
|
|
5385
|
+
});
|
|
5264
5386
|
}
|
|
5387
|
+
async function getDefaultClientClass() {
|
|
5388
|
+
const { Prisma: Prisma2, PrismaClient } = await import("@prisma/client");
|
|
5389
|
+
return await getClientClass({
|
|
5390
|
+
prismaModule: Prisma2,
|
|
5391
|
+
PrismaClient,
|
|
5392
|
+
schemaPath: "./prisma/schema.prisma",
|
|
5393
|
+
usePgLite: process.env.PRISMOCK_USE_PG_LITE ? true : undefined
|
|
5394
|
+
});
|
|
5395
|
+
}
|
|
5396
|
+
var createPrismock = getDefaultClient;
|
|
5265
5397
|
|
|
5266
5398
|
// src/lib/prismock.ts
|
|
5267
|
-
var
|
|
5268
|
-
var { getDMMF, getGenerator, getSchema } = PrismaInternals;
|
|
5269
|
-
async function generateDMMF(schemaPath) {
|
|
5270
|
-
const pathToModule = schemaPath ?? __require.resolve(path.resolve(process.cwd(), "prisma/schema.prisma"));
|
|
5271
|
-
const datamodel = await getSchema(pathToModule);
|
|
5272
|
-
return getDMMF({ datamodel });
|
|
5273
|
-
}
|
|
5399
|
+
var PrismaInternals2 = await import("@prisma/internals");
|
|
5274
5400
|
async function generatePrismock(options = {}) {
|
|
5275
5401
|
const schema = await generateDMMF(options.schemaPath);
|
|
5276
5402
|
return generatePrismockSync({ models: schema.datamodel.models });
|
|
@@ -5284,10 +5410,10 @@ function generateDelegates(options) {
|
|
|
5284
5410
|
const data = {};
|
|
5285
5411
|
const properties = {};
|
|
5286
5412
|
const delegates = {};
|
|
5287
|
-
function getData() {
|
|
5413
|
+
async function getData() {
|
|
5288
5414
|
return data;
|
|
5289
5415
|
}
|
|
5290
|
-
function setData(d) {
|
|
5416
|
+
async function setData(d) {
|
|
5291
5417
|
console.log('Deprecation notice: setData will be removed in a future version and should not be used anymore. Please use a mix of "reset" and create/createMany to achieve the same result');
|
|
5292
5418
|
Object.assign(data, d);
|
|
5293
5419
|
Object.assign(properties, Object.entries(d).reduce((accumulator, [currentKey]) => {
|
|
@@ -5326,10 +5452,12 @@ function generateDelegates(options) {
|
|
|
5326
5452
|
return { delegates: clientDelegates, getData, setData };
|
|
5327
5453
|
}
|
|
5328
5454
|
export {
|
|
5455
|
+
getDefaultClientClass,
|
|
5456
|
+
getDefaultClient,
|
|
5457
|
+
getClientClass,
|
|
5458
|
+
getClient,
|
|
5329
5459
|
generatePrismockSync,
|
|
5330
5460
|
generatePrismock,
|
|
5331
|
-
createPrismockClient,
|
|
5332
|
-
createPrismockClass,
|
|
5333
5461
|
createPrismock,
|
|
5334
5462
|
Prismock
|
|
5335
5463
|
};
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import type { PrismaClient } from
|
|
2
|
-
import type * as runtime from
|
|
3
|
-
import { Delegate } from
|
|
4
|
-
import { Data } from
|
|
5
|
-
import { type ExtensionsDefinition } from
|
|
6
|
-
type GetData = () => Data
|
|
7
|
-
type SetData = (data: Data) => void
|
|
1
|
+
import type { Prisma, PrismaClient } from "@prisma/client";
|
|
2
|
+
import type * as runtime from "@prisma/client/runtime/library";
|
|
3
|
+
import type { Delegate } from "./delegate";
|
|
4
|
+
import { Data } from "./prismock";
|
|
5
|
+
import { type ExtensionsDefinition } from "./extensions";
|
|
6
|
+
type GetData = () => Promise<Data>;
|
|
7
|
+
type SetData = (data: Data) => Promise<void>;
|
|
8
8
|
export interface PrismockData {
|
|
9
9
|
getData: GetData;
|
|
10
10
|
setData: SetData;
|
|
11
|
-
reset: () => void
|
|
11
|
+
reset: () => Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export type PrismockClientType<T = PrismaClient> = T & PrismockData;
|
|
14
|
+
export type PrismockOptions = {
|
|
15
|
+
usePgLite?: undefined | null | {
|
|
16
|
+
schemaPath: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
14
19
|
export declare class Prismock<PC = PrismaClient> {
|
|
15
20
|
__prismaModule: PrismaModule<PC>;
|
|
16
21
|
protected constructor(prismaModule: PrismaModule<PC>);
|
|
17
22
|
static create<PC = PrismaClient>(prismaModule: PrismaModule<PC>): Promise<PrismockClientType<PC>>;
|
|
18
|
-
static createDefault(): Promise<PrismaClient<
|
|
23
|
+
static createDefault(): Promise<PrismaClient<Prisma.PrismaClientOptions, never, runtime.DefaultArgs> & PrismockData>;
|
|
19
24
|
reset(): void;
|
|
20
25
|
private generate;
|
|
21
26
|
$connect(): Promise<void>;
|
|
@@ -26,14 +31,35 @@ export declare class Prismock<PC = PrismaClient> {
|
|
|
26
31
|
$executeRawUnsafe(): Promise<number>;
|
|
27
32
|
$queryRaw(): Promise<never[]>;
|
|
28
33
|
$queryRawUnsafe(): Promise<never[]>;
|
|
29
|
-
$extends(extensionDefs: ExtensionsDefinition): PrismaClient<
|
|
34
|
+
$extends(extensionDefs: ExtensionsDefinition): PrismaClient<Prisma.PrismaClientOptions, never, runtime.DefaultArgs>;
|
|
30
35
|
$transaction(args: any): Promise<any>;
|
|
31
36
|
}
|
|
32
37
|
export declare function generateClient<T = PrismaClient>(delegates: Record<string, Delegate>, getData: GetData, setData: SetData): PrismockClientType<T>;
|
|
33
38
|
export type PrismaModule<PC = PrismaClient> = {
|
|
34
39
|
dmmf: runtime.BaseDMMF;
|
|
35
40
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
type GetClientOptions<PrismaClientClassType extends new (...args: any[]) => any> = {
|
|
42
|
+
prismaModule: PrismaModule<InstanceType<PrismaClientClassType>>;
|
|
43
|
+
prismaClient: PrismaClientClassType;
|
|
44
|
+
schemaPath: string;
|
|
45
|
+
usePgLite?: boolean | null | undefined;
|
|
46
|
+
};
|
|
47
|
+
export declare function getClient<PrismaClientType extends new (options: {
|
|
48
|
+
adapter?: runtime.SqlDriverAdapterFactory | null;
|
|
49
|
+
}, ...args: any[]) => any>(options: GetClientOptions<PrismaClientType>): Promise<PrismockClientType<InstanceType<PrismaClientType>>>;
|
|
50
|
+
type GetClientClassOptions<PrismaClientClassType extends new (...args: any[]) => any> = {
|
|
51
|
+
prismaModule: PrismaModule<InstanceType<PrismaClientClassType>>;
|
|
52
|
+
PrismaClient: PrismaClientClassType;
|
|
53
|
+
schemaPath: string;
|
|
54
|
+
usePgLite?: boolean | null | undefined;
|
|
55
|
+
};
|
|
56
|
+
type PrismaClientClassMocked<PrismaClientType extends new (...args: any[]) => any> = PrismaClientType extends new (...args: infer Args) => infer Instance ? (new (...args: Args) => Instance & PrismockData) & PrismaClientType : never;
|
|
57
|
+
export declare function getClientClass<PrismaClientType extends new (...args: any[]) => any>(options: GetClientClassOptions<PrismaClientType>): Promise<PrismaClientClassMocked<PrismaClientType>>;
|
|
58
|
+
export declare function getDefaultClient(): Promise<PrismockClientType<PrismaClient<Prisma.PrismaClientOptions, unknown, runtime.InternalArgs>>>;
|
|
59
|
+
export declare function getDefaultClientClass(): Promise<(new (optionsArg?: Prisma.Subset<Prisma.PrismaClientOptions, Prisma.PrismaClientOptions> | undefined) => PrismaClient<Prisma.PrismaClientOptions, unknown, runtime.InternalArgs> & PrismockData) & typeof import(".prisma").PrismaClient>;
|
|
60
|
+
/**
|
|
61
|
+
* For backwards compatibility
|
|
62
|
+
*/
|
|
63
|
+
export declare const createPrismock: typeof getDefaultClient;
|
|
64
|
+
export declare const createPrismockClass: typeof getDefaultClientClass;
|
|
39
65
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from '@prisma/generator-helper';
|
|
2
|
+
import type { ConfigMetaFormat } from '@prisma/internals/dist/engine-commands/getConfig';
|
|
3
|
+
export declare function generateDMMF(schemaPath?: string): Promise<DMMF.Document>;
|
|
4
|
+
export declare function generateConfig(schemaPath: string): Promise<ConfigMetaFormat>;
|
|
@@ -2,29 +2,7 @@ import { DMMF } from '@prisma/generator-helper';
|
|
|
2
2
|
import { Delegate, DelegateProperties, Item } from '../delegate';
|
|
3
3
|
import { Delegates } from '../prismock';
|
|
4
4
|
import { CreateArgs } from '../types';
|
|
5
|
-
export declare const isAutoIncrement: (field:
|
|
6
|
-
kind: DMMF.FieldKind;
|
|
7
|
-
name: string;
|
|
8
|
-
isRequired: boolean;
|
|
9
|
-
isList: boolean;
|
|
10
|
-
isUnique: boolean;
|
|
11
|
-
isId: boolean;
|
|
12
|
-
isReadOnly: boolean;
|
|
13
|
-
isGenerated?: boolean | undefined;
|
|
14
|
-
isUpdatedAt?: boolean | undefined;
|
|
15
|
-
type: string;
|
|
16
|
-
dbName?: string | null | undefined;
|
|
17
|
-
hasDefaultValue: boolean;
|
|
18
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
19
|
-
name: string;
|
|
20
|
-
args: any[];
|
|
21
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
22
|
-
relationFromFields?: string[] | undefined;
|
|
23
|
-
relationToFields?: string[] | undefined;
|
|
24
|
-
relationOnDelete?: string | undefined;
|
|
25
|
-
relationName?: string | undefined;
|
|
26
|
-
documentation?: string | undefined;
|
|
27
|
-
}>) => boolean;
|
|
5
|
+
export declare const isAutoIncrement: (field: DMMF.Field) => boolean;
|
|
28
6
|
export declare function calculateDefaultFieldValue(field: DMMF.Field, properties: DelegateProperties): unknown;
|
|
29
7
|
export declare function createDefaultValues(fields: DMMF.Field[], properties: DelegateProperties): Record<string, unknown>;
|
|
30
8
|
export declare function connectOrCreate(delegate: Delegate, delegates: Delegates): (item: Item) => Item;
|
|
@@ -11,145 +11,9 @@ export declare function order(args: FindArgs, delegate: Delegate, delegates: Del
|
|
|
11
11
|
export declare function paginate(skip?: number, take?: number): (items: Item[]) => Item[];
|
|
12
12
|
export declare function includes(args: FindArgs, current: Delegate, delegates: Delegates): (item: Item) => Item;
|
|
13
13
|
export declare function select(selectArgs: FindArgs['select']): (item: Item) => Item;
|
|
14
|
-
export declare const getJoinField: (field:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isUnique: boolean;
|
|
20
|
-
isId: boolean;
|
|
21
|
-
isReadOnly: boolean;
|
|
22
|
-
isGenerated?: boolean | undefined;
|
|
23
|
-
isUpdatedAt?: boolean | undefined;
|
|
24
|
-
type: string;
|
|
25
|
-
dbName?: string | null | undefined;
|
|
26
|
-
hasDefaultValue: boolean;
|
|
27
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
28
|
-
name: string;
|
|
29
|
-
args: any[];
|
|
30
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
31
|
-
relationFromFields?: string[] | undefined;
|
|
32
|
-
relationToFields?: string[] | undefined;
|
|
33
|
-
relationOnDelete?: string | undefined;
|
|
34
|
-
relationName?: string | undefined;
|
|
35
|
-
documentation?: string | undefined;
|
|
36
|
-
}>, delegates: Delegates) => import("@prisma/generator-helper").ReadonlyDeep<import("@prisma/generator-helper").ReadonlyDeep<{
|
|
37
|
-
kind: DMMF.FieldKind;
|
|
38
|
-
name: string;
|
|
39
|
-
isRequired: boolean;
|
|
40
|
-
isList: boolean;
|
|
41
|
-
isUnique: boolean;
|
|
42
|
-
isId: boolean;
|
|
43
|
-
isReadOnly: boolean;
|
|
44
|
-
isGenerated?: boolean | undefined;
|
|
45
|
-
isUpdatedAt?: boolean | undefined;
|
|
46
|
-
type: string;
|
|
47
|
-
dbName?: string | null | undefined;
|
|
48
|
-
hasDefaultValue: boolean;
|
|
49
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
50
|
-
name: string;
|
|
51
|
-
args: any[];
|
|
52
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
53
|
-
relationFromFields?: string[] | undefined;
|
|
54
|
-
relationToFields?: string[] | undefined;
|
|
55
|
-
relationOnDelete?: string | undefined;
|
|
56
|
-
relationName?: string | undefined;
|
|
57
|
-
documentation?: string | undefined;
|
|
58
|
-
}>> | undefined;
|
|
59
|
-
export declare const getDelegateFromField: (field: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
60
|
-
kind: DMMF.FieldKind;
|
|
61
|
-
name: string;
|
|
62
|
-
isRequired: boolean;
|
|
63
|
-
isList: boolean;
|
|
64
|
-
isUnique: boolean;
|
|
65
|
-
isId: boolean;
|
|
66
|
-
isReadOnly: boolean;
|
|
67
|
-
isGenerated?: boolean | undefined;
|
|
68
|
-
isUpdatedAt?: boolean | undefined;
|
|
69
|
-
type: string;
|
|
70
|
-
dbName?: string | null | undefined;
|
|
71
|
-
hasDefaultValue: boolean;
|
|
72
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
73
|
-
name: string;
|
|
74
|
-
args: any[];
|
|
75
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
76
|
-
relationFromFields?: string[] | undefined;
|
|
77
|
-
relationToFields?: string[] | undefined;
|
|
78
|
-
relationOnDelete?: string | undefined;
|
|
79
|
-
relationName?: string | undefined;
|
|
80
|
-
documentation?: string | undefined;
|
|
81
|
-
}>, delegates: Delegates) => Delegate;
|
|
82
|
-
export declare const getFieldRelationshipWhere: (item: Item, field: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
83
|
-
kind: DMMF.FieldKind;
|
|
84
|
-
name: string;
|
|
85
|
-
isRequired: boolean;
|
|
86
|
-
isList: boolean;
|
|
87
|
-
isUnique: boolean;
|
|
88
|
-
isId: boolean;
|
|
89
|
-
isReadOnly: boolean;
|
|
90
|
-
isGenerated?: boolean | undefined;
|
|
91
|
-
isUpdatedAt?: boolean | undefined;
|
|
92
|
-
type: string;
|
|
93
|
-
dbName?: string | null | undefined;
|
|
94
|
-
hasDefaultValue: boolean;
|
|
95
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
96
|
-
name: string;
|
|
97
|
-
args: any[];
|
|
98
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
99
|
-
relationFromFields?: string[] | undefined;
|
|
100
|
-
relationToFields?: string[] | undefined;
|
|
101
|
-
relationOnDelete?: string | undefined;
|
|
102
|
-
relationName?: string | undefined;
|
|
103
|
-
documentation?: string | undefined;
|
|
104
|
-
}>, delegates: Delegates) => Record<string, GroupByFieldArg>;
|
|
105
|
-
export declare const getFieldFromRelationshipWhere: (item: Item, field: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
106
|
-
kind: DMMF.FieldKind;
|
|
107
|
-
name: string;
|
|
108
|
-
isRequired: boolean;
|
|
109
|
-
isList: boolean;
|
|
110
|
-
isUnique: boolean;
|
|
111
|
-
isId: boolean;
|
|
112
|
-
isReadOnly: boolean;
|
|
113
|
-
isGenerated?: boolean | undefined;
|
|
114
|
-
isUpdatedAt?: boolean | undefined;
|
|
115
|
-
type: string;
|
|
116
|
-
dbName?: string | null | undefined;
|
|
117
|
-
hasDefaultValue: boolean;
|
|
118
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
119
|
-
name: string;
|
|
120
|
-
args: any[];
|
|
121
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
122
|
-
relationFromFields?: string[] | undefined;
|
|
123
|
-
relationToFields?: string[] | undefined;
|
|
124
|
-
relationOnDelete?: string | undefined;
|
|
125
|
-
relationName?: string | undefined;
|
|
126
|
-
documentation?: string | undefined;
|
|
127
|
-
}>) => {
|
|
128
|
-
[x: string]: GroupByFieldArg;
|
|
129
|
-
};
|
|
130
|
-
export declare const getFieldToRelationshipWhere: (item: Item, field: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
131
|
-
kind: DMMF.FieldKind;
|
|
132
|
-
name: string;
|
|
133
|
-
isRequired: boolean;
|
|
134
|
-
isList: boolean;
|
|
135
|
-
isUnique: boolean;
|
|
136
|
-
isId: boolean;
|
|
137
|
-
isReadOnly: boolean;
|
|
138
|
-
isGenerated?: boolean | undefined;
|
|
139
|
-
isUpdatedAt?: boolean | undefined;
|
|
140
|
-
type: string;
|
|
141
|
-
dbName?: string | null | undefined;
|
|
142
|
-
hasDefaultValue: boolean;
|
|
143
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
144
|
-
name: string;
|
|
145
|
-
args: any[];
|
|
146
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
147
|
-
relationFromFields?: string[] | undefined;
|
|
148
|
-
relationToFields?: string[] | undefined;
|
|
149
|
-
relationOnDelete?: string | undefined;
|
|
150
|
-
relationName?: string | undefined;
|
|
151
|
-
documentation?: string | undefined;
|
|
152
|
-
}>) => {
|
|
153
|
-
[x: string]: GroupByFieldArg;
|
|
154
|
-
};
|
|
14
|
+
export declare const getJoinField: (field: DMMF.Field, delegates: Delegates) => DMMF.Field | undefined;
|
|
15
|
+
export declare const getDelegateFromField: (field: DMMF.Field, delegates: Delegates) => Delegate;
|
|
16
|
+
export declare const getFieldRelationshipWhere: (item: Item, field: DMMF.Field, delegates: Delegates) => Record<string, GroupByFieldArg>;
|
|
17
|
+
export declare const getFieldFromRelationshipWhere: (item: Item, field: DMMF.Field) => Record<string, GroupByFieldArg>;
|
|
18
|
+
export declare const getFieldToRelationshipWhere: (item: Item, field: DMMF.Field) => Record<string, GroupByFieldArg>;
|
|
155
19
|
export declare function findMany(args: FindArgs, current: Delegate, delegates: Delegates): Item[];
|
package/dist/lib/prismock.d.ts
CHANGED
|
@@ -12,279 +12,20 @@ type OptionsSync = {
|
|
|
12
12
|
export type Data = Record<string, Item[]>;
|
|
13
13
|
export type Properties = Record<string, DelegateProperties>;
|
|
14
14
|
export type Delegates = Record<string, Delegate>;
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
isList: boolean;
|
|
25
|
-
isUnique: boolean;
|
|
26
|
-
isId: boolean;
|
|
27
|
-
isReadOnly: boolean;
|
|
28
|
-
isGenerated?: boolean | undefined;
|
|
29
|
-
isUpdatedAt?: boolean | undefined;
|
|
30
|
-
type: string;
|
|
31
|
-
dbName?: string | null | undefined;
|
|
32
|
-
hasDefaultValue: boolean;
|
|
33
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
34
|
-
name: string;
|
|
35
|
-
args: any[];
|
|
36
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
37
|
-
relationFromFields?: string[] | undefined;
|
|
38
|
-
relationToFields?: string[] | undefined;
|
|
39
|
-
relationOnDelete?: string | undefined;
|
|
40
|
-
relationName?: string | undefined;
|
|
41
|
-
documentation?: string | undefined;
|
|
42
|
-
}>[];
|
|
43
|
-
uniqueFields: string[][];
|
|
44
|
-
uniqueIndexes: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
45
|
-
name: string;
|
|
46
|
-
fields: string[];
|
|
47
|
-
}>[];
|
|
48
|
-
documentation?: string | undefined;
|
|
49
|
-
primaryKey: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
50
|
-
name: string | null;
|
|
51
|
-
fields: string[];
|
|
52
|
-
}> | null;
|
|
53
|
-
isGenerated?: boolean | undefined;
|
|
54
|
-
}>[];
|
|
55
|
-
enums: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
56
|
-
name: string;
|
|
57
|
-
values: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
58
|
-
name: string;
|
|
59
|
-
dbName: string | null;
|
|
60
|
-
}>[];
|
|
61
|
-
dbName?: string | null | undefined;
|
|
62
|
-
documentation?: string | undefined;
|
|
63
|
-
}>[];
|
|
64
|
-
types: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
65
|
-
name: string;
|
|
66
|
-
dbName: string | null;
|
|
67
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
68
|
-
kind: DMMF.FieldKind;
|
|
69
|
-
name: string;
|
|
70
|
-
isRequired: boolean;
|
|
71
|
-
isList: boolean;
|
|
72
|
-
isUnique: boolean;
|
|
73
|
-
isId: boolean;
|
|
74
|
-
isReadOnly: boolean;
|
|
75
|
-
isGenerated?: boolean | undefined;
|
|
76
|
-
isUpdatedAt?: boolean | undefined;
|
|
77
|
-
type: string;
|
|
78
|
-
dbName?: string | null | undefined;
|
|
79
|
-
hasDefaultValue: boolean;
|
|
80
|
-
default?: DMMF.FieldDefaultScalar[] | import("@prisma/generator-helper").ReadonlyDeep<{
|
|
81
|
-
name: string;
|
|
82
|
-
args: any[];
|
|
83
|
-
}> | DMMF.FieldDefaultScalar | undefined;
|
|
84
|
-
relationFromFields?: string[] | undefined;
|
|
85
|
-
relationToFields?: string[] | undefined;
|
|
86
|
-
relationOnDelete?: string | undefined;
|
|
87
|
-
relationName?: string | undefined;
|
|
88
|
-
documentation?: string | undefined;
|
|
89
|
-
}>[];
|
|
90
|
-
uniqueFields: string[][];
|
|
91
|
-
uniqueIndexes: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
92
|
-
name: string;
|
|
93
|
-
fields: string[];
|
|
94
|
-
}>[];
|
|
95
|
-
documentation?: string | undefined;
|
|
96
|
-
primaryKey: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
97
|
-
name: string | null;
|
|
98
|
-
fields: string[];
|
|
99
|
-
}> | null;
|
|
100
|
-
isGenerated?: boolean | undefined;
|
|
101
|
-
}>[];
|
|
102
|
-
indexes: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
103
|
-
model: string;
|
|
104
|
-
type: DMMF.IndexType;
|
|
105
|
-
isDefinedOnField: boolean;
|
|
106
|
-
name?: string | undefined;
|
|
107
|
-
dbName?: string | undefined;
|
|
108
|
-
algorithm?: string | undefined;
|
|
109
|
-
clustered?: boolean | undefined;
|
|
110
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
111
|
-
name: string;
|
|
112
|
-
sortOrder?: DMMF.SortOrder | undefined;
|
|
113
|
-
length?: number | undefined;
|
|
114
|
-
operatorClass?: string | undefined;
|
|
115
|
-
}>[];
|
|
116
|
-
}>[];
|
|
117
|
-
}>;
|
|
118
|
-
schema: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
119
|
-
rootQueryType?: string | undefined;
|
|
120
|
-
rootMutationType?: string | undefined;
|
|
121
|
-
inputObjectTypes: {
|
|
122
|
-
model?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
123
|
-
name: string;
|
|
124
|
-
constraints: {
|
|
125
|
-
maxNumFields: number | null;
|
|
126
|
-
minNumFields: number | null;
|
|
127
|
-
fields?: string[] | undefined;
|
|
128
|
-
};
|
|
129
|
-
meta?: {
|
|
130
|
-
source?: string | undefined;
|
|
131
|
-
} | undefined;
|
|
132
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
133
|
-
name: string;
|
|
134
|
-
comment?: string | undefined;
|
|
135
|
-
isNullable: boolean;
|
|
136
|
-
isRequired: boolean;
|
|
137
|
-
inputTypes: DMMF.InputTypeRef[];
|
|
138
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
139
|
-
sinceVersion: string;
|
|
140
|
-
reason: string;
|
|
141
|
-
plannedRemovalVersion?: string | undefined;
|
|
142
|
-
}> | undefined;
|
|
143
|
-
}>[];
|
|
144
|
-
}>[] | undefined;
|
|
145
|
-
prisma: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
146
|
-
name: string;
|
|
147
|
-
constraints: {
|
|
148
|
-
maxNumFields: number | null;
|
|
149
|
-
minNumFields: number | null;
|
|
150
|
-
fields?: string[] | undefined;
|
|
151
|
-
};
|
|
152
|
-
meta?: {
|
|
153
|
-
source?: string | undefined;
|
|
154
|
-
} | undefined;
|
|
155
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
156
|
-
name: string;
|
|
157
|
-
comment?: string | undefined;
|
|
158
|
-
isNullable: boolean;
|
|
159
|
-
isRequired: boolean;
|
|
160
|
-
inputTypes: DMMF.InputTypeRef[];
|
|
161
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
162
|
-
sinceVersion: string;
|
|
163
|
-
reason: string;
|
|
164
|
-
plannedRemovalVersion?: string | undefined;
|
|
165
|
-
}> | undefined;
|
|
166
|
-
}>[];
|
|
167
|
-
}>[];
|
|
168
|
-
};
|
|
169
|
-
outputObjectTypes: {
|
|
170
|
-
model: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
171
|
-
name: string;
|
|
172
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
173
|
-
name: string;
|
|
174
|
-
isNullable?: boolean | undefined;
|
|
175
|
-
outputType: DMMF.OutputTypeRef;
|
|
176
|
-
args: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
177
|
-
name: string;
|
|
178
|
-
comment?: string | undefined;
|
|
179
|
-
isNullable: boolean;
|
|
180
|
-
isRequired: boolean;
|
|
181
|
-
inputTypes: DMMF.InputTypeRef[];
|
|
182
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
183
|
-
sinceVersion: string;
|
|
184
|
-
reason: string;
|
|
185
|
-
plannedRemovalVersion?: string | undefined;
|
|
186
|
-
}> | undefined;
|
|
187
|
-
}>[];
|
|
188
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
189
|
-
sinceVersion: string;
|
|
190
|
-
reason: string;
|
|
191
|
-
plannedRemovalVersion?: string | undefined;
|
|
192
|
-
}> | undefined;
|
|
193
|
-
documentation?: string | undefined;
|
|
194
|
-
}>[];
|
|
195
|
-
}>[];
|
|
196
|
-
prisma: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
197
|
-
name: string;
|
|
198
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
199
|
-
name: string;
|
|
200
|
-
isNullable?: boolean | undefined;
|
|
201
|
-
outputType: DMMF.OutputTypeRef;
|
|
202
|
-
args: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
203
|
-
name: string;
|
|
204
|
-
comment?: string | undefined;
|
|
205
|
-
isNullable: boolean;
|
|
206
|
-
isRequired: boolean;
|
|
207
|
-
inputTypes: DMMF.InputTypeRef[];
|
|
208
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
209
|
-
sinceVersion: string;
|
|
210
|
-
reason: string;
|
|
211
|
-
plannedRemovalVersion?: string | undefined;
|
|
212
|
-
}> | undefined;
|
|
213
|
-
}>[];
|
|
214
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
215
|
-
sinceVersion: string;
|
|
216
|
-
reason: string;
|
|
217
|
-
plannedRemovalVersion?: string | undefined;
|
|
218
|
-
}> | undefined;
|
|
219
|
-
documentation?: string | undefined;
|
|
220
|
-
}>[];
|
|
221
|
-
}>[];
|
|
222
|
-
};
|
|
223
|
-
enumTypes: {
|
|
224
|
-
model?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
225
|
-
name: string;
|
|
226
|
-
values: string[];
|
|
227
|
-
}>[] | undefined;
|
|
228
|
-
prisma: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
229
|
-
name: string;
|
|
230
|
-
values: string[];
|
|
231
|
-
}>[];
|
|
232
|
-
};
|
|
233
|
-
fieldRefTypes: {
|
|
234
|
-
prisma?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
235
|
-
name: string;
|
|
236
|
-
allowTypes: DMMF.FieldRefAllowType[];
|
|
237
|
-
fields: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
238
|
-
name: string;
|
|
239
|
-
comment?: string | undefined;
|
|
240
|
-
isNullable: boolean;
|
|
241
|
-
isRequired: boolean;
|
|
242
|
-
inputTypes: DMMF.InputTypeRef[];
|
|
243
|
-
deprecation?: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
244
|
-
sinceVersion: string;
|
|
245
|
-
reason: string;
|
|
246
|
-
plannedRemovalVersion?: string | undefined;
|
|
247
|
-
}> | undefined;
|
|
248
|
-
}>[];
|
|
249
|
-
}>[] | undefined;
|
|
250
|
-
};
|
|
251
|
-
}>;
|
|
252
|
-
mappings: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
253
|
-
modelOperations: import("@prisma/generator-helper").ReadonlyDeep<{
|
|
254
|
-
model: string;
|
|
255
|
-
plural: string;
|
|
256
|
-
findUnique?: string | null | undefined;
|
|
257
|
-
findUniqueOrThrow?: string | null | undefined;
|
|
258
|
-
findFirst?: string | null | undefined;
|
|
259
|
-
findFirstOrThrow?: string | null | undefined;
|
|
260
|
-
findMany?: string | null | undefined;
|
|
261
|
-
create?: string | null | undefined;
|
|
262
|
-
createMany?: string | null | undefined;
|
|
263
|
-
createManyAndReturn?: string | null | undefined;
|
|
264
|
-
update?: string | null | undefined;
|
|
265
|
-
updateMany?: string | null | undefined;
|
|
266
|
-
upsert?: string | null | undefined;
|
|
267
|
-
delete?: string | null | undefined;
|
|
268
|
-
deleteMany?: string | null | undefined;
|
|
269
|
-
aggregate?: string | null | undefined;
|
|
270
|
-
groupBy?: string | null | undefined;
|
|
271
|
-
count?: string | null | undefined;
|
|
272
|
-
findRaw?: string | null | undefined;
|
|
273
|
-
aggregateRaw?: string | null | undefined;
|
|
274
|
-
}>[];
|
|
275
|
-
otherOperations: {
|
|
276
|
-
read: string[];
|
|
277
|
-
write: string[];
|
|
278
|
-
};
|
|
279
|
-
}>;
|
|
280
|
-
}>>;
|
|
281
|
-
export declare function fetchGenerator(schemaPath?: string): Promise<Generator>;
|
|
282
|
-
export declare function getProvider(generator: Generator): import("@prisma/generator-helper").ActiveConnectorType | undefined;
|
|
15
|
+
// export async function fetchGenerator(schemaPath?: string) {
|
|
16
|
+
// const pathToModule = schemaPath ?? require.resolve(path.resolve(process.cwd(), 'prisma/schema.prisma'));
|
|
17
|
+
// const config = await generateConfig(pathToModule);
|
|
18
|
+
// return getGenerator({
|
|
19
|
+
// schemaPath: pathToModule,
|
|
20
|
+
// });
|
|
21
|
+
// }
|
|
22
|
+
export declare function fetchProvider(schemaPath?: string): Promise<string>;
|
|
23
|
+
export declare function getProvider(generator: Generator): import("@prisma/generator").ActiveConnectorType | undefined;
|
|
283
24
|
export declare function generatePrismock<T = PrismaClient>(options?: Options): Promise<PrismockClientType<T>>;
|
|
284
25
|
export declare function generatePrismockSync<T = PrismockClientType>(options: OptionsSync): PrismockClientType<T>;
|
|
285
26
|
export declare function generateDelegates(options: OptionsSync): {
|
|
286
27
|
delegates: Delegates;
|
|
287
|
-
getData: () => Data
|
|
288
|
-
setData: (d: Data) => void
|
|
28
|
+
getData: () => Promise<Data>;
|
|
29
|
+
setData: (d: Data) => Promise<void>;
|
|
289
30
|
};
|
|
290
31
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pkgverse/prismock",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
3
|
+
"version": "2.0.1-beta.2",
|
|
4
4
|
"description": "A mock for PrismaClient, dedicated to unit testing.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/JQuezada0/prismock"
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@commitlint/cli": "19.8.1",
|
|
45
45
|
"@commitlint/config-conventional": "19.8.1",
|
|
46
|
-
"@
|
|
46
|
+
"@electric-sql/pglite": "0.3.14",
|
|
47
|
+
"@prisma/client": "6.10.0",
|
|
47
48
|
"@semantic-release/changelog": "6.0.3",
|
|
48
49
|
"@semantic-release/commit-analyzer": "13.0.1",
|
|
49
50
|
"@semantic-release/git": "10.0.1",
|
|
@@ -72,8 +73,9 @@
|
|
|
72
73
|
"fs-jetpack": "5.1.0",
|
|
73
74
|
"husky": "9.1.7",
|
|
74
75
|
"lint-staged": "16.1.6",
|
|
76
|
+
"pglite-prisma-adapter": "0.6.1",
|
|
75
77
|
"prettier": "2.8.8",
|
|
76
|
-
"prisma": "
|
|
78
|
+
"prisma": "6.10.0",
|
|
77
79
|
"release-it": "19.0.6",
|
|
78
80
|
"semantic-release": "24.2.7",
|
|
79
81
|
"ts-node": "10.9.2",
|
|
@@ -101,12 +103,12 @@
|
|
|
101
103
|
},
|
|
102
104
|
"dependencies": {
|
|
103
105
|
"@paralleldrive/cuid2": "2.2.2",
|
|
104
|
-
"@prisma/generator-helper": "
|
|
105
|
-
"@prisma/internals": "
|
|
106
|
+
"@prisma/generator-helper": "6.10.0",
|
|
107
|
+
"@prisma/internals": "6.10.0",
|
|
106
108
|
"bson": "6.10.4"
|
|
107
109
|
},
|
|
108
110
|
"peerDependencies": {
|
|
109
|
-
"@prisma/client": "
|
|
110
|
-
"prisma": "
|
|
111
|
+
"@prisma/client": ">= 6.10.0",
|
|
112
|
+
"prisma": ">= 6.10.0"
|
|
111
113
|
}
|
|
112
114
|
}
|