pothos-drizzle-generator 0.1.4 → 0.1.5

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.
@@ -69,7 +69,9 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
69
69
  limit: p.limit && args.limit
70
70
  ? Math.min(p.limit, args.limit)
71
71
  : p.limit ?? args.limit,
72
- where: { AND: [args.where, p.where].filter((v) => v) },
72
+ where: {
73
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
74
+ },
73
75
  orderBy: args.orderBy && Object.keys(args.orderBy).length
74
76
  ? args.orderBy
75
77
  : p.orderBy,
@@ -101,7 +103,7 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
101
103
  where: where?.({ modelName, ctx, operation }),
102
104
  };
103
105
  return (0, utils_js_1.createWhereQuery)(relay.targetTable, {
104
- AND: [args.where, p.where].filter((v) => v),
106
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
105
107
  });
106
108
  },
107
109
  }),
@@ -161,7 +163,9 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
161
163
  limit: p.limit && args.limit
162
164
  ? Math.min(p.limit, args.limit)
163
165
  : p.limit ?? args.limit,
164
- where: { AND: [args.where, p.where].filter((v) => v) },
166
+ where: {
167
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
168
+ },
165
169
  orderBy: args.orderBy && Object.keys(args.orderBy).length
166
170
  ? args.orderBy
167
171
  : p.orderBy,
@@ -200,7 +204,9 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
200
204
  throw new Error("Depth limit exceeded");
201
205
  return generator.getClient(ctx).query[modelName].findFirst(query({
202
206
  ...args,
203
- where: { AND: [args.where, p.where].filter((v) => v) },
207
+ where: {
208
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
209
+ },
204
210
  orderBy: args.orderBy && Object.keys(args.orderBy).length
205
211
  ? args.orderBy
206
212
  : p.orderBy,
@@ -245,7 +251,9 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
245
251
  limit: p.limit && args.limit
246
252
  ? Math.min(p.limit, args.limit)
247
253
  : p.limit ?? args.limit,
248
- where: { AND: [args.where, p.where].filter((v) => v) },
254
+ where: {
255
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
256
+ },
249
257
  })
250
258
  .then((v) => v._count);
251
259
  },
@@ -348,7 +356,7 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
348
356
  .update(table)
349
357
  .set(args.input)
350
358
  .where((0, utils_js_1.createWhereQuery)(table, {
351
- AND: [args.where, p.where].filter((v) => v),
359
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
352
360
  }))
353
361
  .returning();
354
362
  },
@@ -384,7 +392,7 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
384
392
  return generator.getClient(ctx)
385
393
  .delete(table)
386
394
  .where((0, utils_js_1.createWhereQuery)(table, {
387
- AND: [args.where, p.where].filter((v) => v),
395
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
388
396
  }))
389
397
  .returning();
390
398
  },
@@ -66,7 +66,9 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
66
66
  limit: p.limit && args.limit
67
67
  ? Math.min(p.limit, args.limit)
68
68
  : p.limit ?? args.limit,
69
- where: { AND: [args.where, p.where].filter((v) => v) },
69
+ where: {
70
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
71
+ },
70
72
  orderBy: args.orderBy && Object.keys(args.orderBy).length
71
73
  ? args.orderBy
72
74
  : p.orderBy,
@@ -98,7 +100,7 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
98
100
  where: where?.({ modelName, ctx, operation }),
99
101
  };
100
102
  return createWhereQuery(relay.targetTable, {
101
- AND: [args.where, p.where].filter((v) => v),
103
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
102
104
  });
103
105
  },
104
106
  }),
@@ -158,7 +160,9 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
158
160
  limit: p.limit && args.limit
159
161
  ? Math.min(p.limit, args.limit)
160
162
  : p.limit ?? args.limit,
161
- where: { AND: [args.where, p.where].filter((v) => v) },
163
+ where: {
164
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
165
+ },
162
166
  orderBy: args.orderBy && Object.keys(args.orderBy).length
163
167
  ? args.orderBy
164
168
  : p.orderBy,
@@ -197,7 +201,9 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
197
201
  throw new Error("Depth limit exceeded");
198
202
  return generator.getClient(ctx).query[modelName].findFirst(query({
199
203
  ...args,
200
- where: { AND: [args.where, p.where].filter((v) => v) },
204
+ where: {
205
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
206
+ },
201
207
  orderBy: args.orderBy && Object.keys(args.orderBy).length
202
208
  ? args.orderBy
203
209
  : p.orderBy,
@@ -242,7 +248,9 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
242
248
  limit: p.limit && args.limit
243
249
  ? Math.min(p.limit, args.limit)
244
250
  : p.limit ?? args.limit,
245
- where: { AND: [args.where, p.where].filter((v) => v) },
251
+ where: {
252
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
253
+ },
246
254
  })
247
255
  .then((v) => v._count);
248
256
  },
@@ -345,7 +353,7 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
345
353
  .update(table)
346
354
  .set(args.input)
347
355
  .where(createWhereQuery(table, {
348
- AND: [args.where, p.where].filter((v) => v),
356
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
349
357
  }))
350
358
  .returning();
351
359
  },
@@ -381,7 +389,7 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
381
389
  return generator.getClient(ctx)
382
390
  .delete(table)
383
391
  .where(createWhereQuery(table, {
384
- AND: [args.where, p.where].filter((v) => v),
392
+ AND: [structuredClone(args.where), p.where].filter((v) => v),
385
393
  }))
386
394
  .returning();
387
395
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pothos-drizzle-generator",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "types": "./dist/cjs/index.d.ts",
6
6
  "exports": {