@burdenoff/be-sdk 2026.723.1 → 2026.725.1
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/auth/index.d.ts +2 -2
- package/dist/{chunk-MXLCLLCI.js → chunk-EJPRCENB.js} +118 -83
- package/dist/chunk-EJPRCENB.js.map +1 -0
- package/dist/{chunk-YQ6FYE37.js → chunk-RIH3XRBX.js} +4 -3
- package/dist/chunk-RIH3XRBX.js.map +1 -0
- package/dist/feature-flags/index.d.ts +3 -3
- package/dist/{index-CW_C6LQY.d.ts → index-ELt2ADCe.d.ts} +1 -1
- package/dist/{index-42_fqdmi.d.ts → index-m4sVVdZ6.d.ts} +3 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.js +2 -2
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/{types-DMZAHZNR.d.ts → types-BeDCdzH9.d.ts} +1 -1
- package/dist/{workspace-extension-TquhDEKU.d.ts → workspace-extension-DxQw6N3b.d.ts} +9 -1
- package/package.json +1 -1
- package/dist/chunk-MXLCLLCI.js.map +0 -1
- package/dist/chunk-YQ6FYE37.js.map +0 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as BurdenoffGraphQLClient } from '../graphql-Dxxpbzr3.js';
|
|
2
2
|
import { S as SDKContext } from '../index-B8viwwDM.js';
|
|
3
|
-
import { G as GraphQLContext } from '../types-
|
|
3
|
+
import { G as GraphQLContext } from '../types-BeDCdzH9.js';
|
|
4
4
|
import 'graphql-request';
|
|
5
5
|
import '../layer-GNAVXBMf.js';
|
|
6
6
|
import 'graphql';
|
|
@@ -8,7 +8,7 @@ import 'graphql-yoga';
|
|
|
8
8
|
import '../client-CCXpAZ2r.js';
|
|
9
9
|
import '@prisma/adapter-pg';
|
|
10
10
|
import 'pg';
|
|
11
|
-
import '../workspace-extension-
|
|
11
|
+
import '../workspace-extension-DxQw6N3b.js';
|
|
12
12
|
import '../types-C8TbSdEj.js';
|
|
13
13
|
|
|
14
14
|
interface CookieOptions {
|
|
@@ -166,6 +166,24 @@ async function maybeSetRlsGuc(rawPrisma, wsCtx) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
__name(maybeSetRlsGuc, "maybeSetRlsGuc");
|
|
169
|
+
function modelToClientProperty(model) {
|
|
170
|
+
return model.length > 0 ? model.charAt(0).toLowerCase() + model.slice(1) : model;
|
|
171
|
+
}
|
|
172
|
+
__name(modelToClientProperty, "modelToClientProperty");
|
|
173
|
+
async function runOperationWithRlsGuc(rootClient, wsCtx, model, operation, args) {
|
|
174
|
+
const safeWs = (wsCtx.workspaceId ?? "").replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
175
|
+
const clientProperty = modelToClientProperty(model);
|
|
176
|
+
return rootClient.$transaction(async (tx) => {
|
|
177
|
+
await tx.$executeRawUnsafe(`SET LOCAL app.workspace_id = '${safeWs}'`);
|
|
178
|
+
const delegate = tx[clientProperty];
|
|
179
|
+
const method = delegate?.[operation];
|
|
180
|
+
if (typeof method !== "function") {
|
|
181
|
+
throw new Error(`[WorkspaceExtension] Unable to resolve ${model}.${operation} (client property "${clientProperty}") on the interactive-transaction client for RLS GUC tagging.`);
|
|
182
|
+
}
|
|
183
|
+
return method(args);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
__name(runOperationWithRlsGuc, "runOperationWithRlsGuc");
|
|
169
187
|
function addWorkspaceExtension(baseClient, config) {
|
|
170
188
|
const fullConfig = {
|
|
171
189
|
...defaultConfig,
|
|
@@ -176,6 +194,7 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
176
194
|
return baseClient;
|
|
177
195
|
}
|
|
178
196
|
const rawPrisma = baseClient;
|
|
197
|
+
const rawPrismaForTransactions = baseClient;
|
|
179
198
|
const prismaClient = baseClient;
|
|
180
199
|
logger.info("[WorkspaceExtension] Workspace extension enabled", {
|
|
181
200
|
populateContextJson: fullConfig.populateContextJson,
|
|
@@ -210,9 +229,6 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
210
229
|
if (fullConfig.enableApplicationNameTagging) {
|
|
211
230
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
212
231
|
}
|
|
213
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
214
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
215
|
-
}
|
|
216
232
|
const injectedData = injectCreateFields(args.data, wsCtx, fullConfig);
|
|
217
233
|
if (fullConfig.debug) {
|
|
218
234
|
const injectedKeys = Object.keys(injectedData).filter((k) => !(k in args.data));
|
|
@@ -223,10 +239,14 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
223
239
|
});
|
|
224
240
|
}
|
|
225
241
|
}
|
|
226
|
-
|
|
242
|
+
const finalArgs = {
|
|
227
243
|
...stripSkipFlag(args),
|
|
228
244
|
data: injectedData
|
|
229
|
-
}
|
|
245
|
+
};
|
|
246
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
247
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "create", finalArgs);
|
|
248
|
+
}
|
|
249
|
+
return query(finalArgs);
|
|
230
250
|
},
|
|
231
251
|
async createMany({ model, args, query }) {
|
|
232
252
|
if (fullConfig.excludeModels.includes(model) || args._skipWorkspaceInjection) {
|
|
@@ -240,17 +260,18 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
240
260
|
if (fullConfig.enableApplicationNameTagging) {
|
|
241
261
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
242
262
|
}
|
|
243
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
244
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
245
|
-
}
|
|
246
263
|
const dataArray = Array.isArray(args.data) ? args.data : [
|
|
247
264
|
args.data
|
|
248
265
|
];
|
|
249
266
|
const injectedData = dataArray.map((item) => injectCreateFields(item, wsCtx, fullConfig));
|
|
250
|
-
|
|
267
|
+
const finalArgs = {
|
|
251
268
|
...stripSkipFlag(args),
|
|
252
269
|
data: Array.isArray(args.data) ? injectedData : injectedData[0]
|
|
253
|
-
}
|
|
270
|
+
};
|
|
271
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
272
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "createMany", finalArgs);
|
|
273
|
+
}
|
|
274
|
+
return query(finalArgs);
|
|
254
275
|
},
|
|
255
276
|
async createManyAndReturn({ model, args, query }) {
|
|
256
277
|
if (fullConfig.excludeModels.includes(model) || args._skipWorkspaceInjection) {
|
|
@@ -264,17 +285,18 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
264
285
|
if (fullConfig.enableApplicationNameTagging) {
|
|
265
286
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
266
287
|
}
|
|
267
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
268
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
269
|
-
}
|
|
270
288
|
const dataArray = Array.isArray(args.data) ? args.data : [
|
|
271
289
|
args.data
|
|
272
290
|
];
|
|
273
291
|
const injectedData = dataArray.map((item) => injectCreateFields(item, wsCtx, fullConfig));
|
|
274
|
-
|
|
292
|
+
const finalArgs = {
|
|
275
293
|
...stripSkipFlag(args),
|
|
276
294
|
data: Array.isArray(args.data) ? injectedData : injectedData[0]
|
|
277
|
-
}
|
|
295
|
+
};
|
|
296
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
297
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "createManyAndReturn", finalArgs);
|
|
298
|
+
}
|
|
299
|
+
return query(finalArgs);
|
|
278
300
|
},
|
|
279
301
|
// ================================================================
|
|
280
302
|
// UPDATE OPERATIONS - inject updatedBy into data + workspaceId into where
|
|
@@ -291,9 +313,6 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
291
313
|
if (fullConfig.enableApplicationNameTagging) {
|
|
292
314
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
293
315
|
}
|
|
294
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
295
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
296
|
-
}
|
|
297
316
|
const injectedData = injectUpdateFields(args.data, wsCtx, fullConfig);
|
|
298
317
|
let injectedWhere = args.where;
|
|
299
318
|
if (fullConfig.enableUpdateWhereIsolation && !isExcludedFromReadIsolation(model, fullConfig)) {
|
|
@@ -306,11 +325,15 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
306
325
|
logger.debug(`[WorkspaceExtension] ${model}.update - injected data: ${injectedDataKeys.join(", ")}${whereChanged ? ", where: workspaceId" : ""}`);
|
|
307
326
|
}
|
|
308
327
|
}
|
|
309
|
-
|
|
328
|
+
const finalArgs = {
|
|
310
329
|
...stripSkipFlag(args),
|
|
311
330
|
data: injectedData,
|
|
312
331
|
where: injectedWhere
|
|
313
|
-
}
|
|
332
|
+
};
|
|
333
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
334
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "update", finalArgs);
|
|
335
|
+
}
|
|
336
|
+
return query(finalArgs);
|
|
314
337
|
},
|
|
315
338
|
async updateMany({ model, args, query }) {
|
|
316
339
|
if (fullConfig.excludeModels.includes(model) || args._skipWorkspaceInjection) {
|
|
@@ -324,19 +347,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
324
347
|
if (fullConfig.enableApplicationNameTagging) {
|
|
325
348
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
326
349
|
}
|
|
327
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
328
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
329
|
-
}
|
|
330
350
|
const injectedData = injectUpdateFields(args.data, wsCtx, fullConfig);
|
|
331
351
|
let injectedWhere = args.where;
|
|
332
352
|
if (fullConfig.enableUpdateWhereIsolation && !isExcludedFromReadIsolation(model, fullConfig)) {
|
|
333
353
|
injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
334
354
|
}
|
|
335
|
-
|
|
355
|
+
const finalArgs = {
|
|
336
356
|
...stripSkipFlag(args),
|
|
337
357
|
data: injectedData,
|
|
338
358
|
where: injectedWhere
|
|
339
|
-
}
|
|
359
|
+
};
|
|
360
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
361
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "updateMany", finalArgs);
|
|
362
|
+
}
|
|
363
|
+
return query(finalArgs);
|
|
340
364
|
},
|
|
341
365
|
async upsert({ model, args, query }) {
|
|
342
366
|
if (fullConfig.excludeModels.includes(model) || args._skipWorkspaceInjection) {
|
|
@@ -350,21 +374,22 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
350
374
|
if (fullConfig.enableApplicationNameTagging) {
|
|
351
375
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
352
376
|
}
|
|
353
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
354
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
355
|
-
}
|
|
356
377
|
const injectedCreate = injectCreateFields(args.create, wsCtx, fullConfig);
|
|
357
378
|
const injectedUpdate = injectUpdateFields(args.update, wsCtx, fullConfig);
|
|
358
379
|
let injectedWhere = args.where;
|
|
359
380
|
if (fullConfig.enableUpdateWhereIsolation && !isExcludedFromReadIsolation(model, fullConfig)) {
|
|
360
381
|
injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
361
382
|
}
|
|
362
|
-
|
|
383
|
+
const finalArgs = {
|
|
363
384
|
...stripSkipFlag(args),
|
|
364
385
|
create: injectedCreate,
|
|
365
386
|
update: injectedUpdate,
|
|
366
387
|
where: injectedWhere
|
|
367
|
-
}
|
|
388
|
+
};
|
|
389
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
390
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "upsert", finalArgs);
|
|
391
|
+
}
|
|
392
|
+
return query(finalArgs);
|
|
368
393
|
},
|
|
369
394
|
// ================================================================
|
|
370
395
|
// READ OPERATIONS - inject workspaceId into where clause
|
|
@@ -381,19 +406,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
381
406
|
if (fullConfig.enableApplicationNameTagging) {
|
|
382
407
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
383
408
|
}
|
|
384
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
385
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
386
|
-
}
|
|
387
409
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
388
410
|
if (fullConfig.debug) {
|
|
389
411
|
logger.debug(`[WorkspaceExtension] ${model}.findMany - injected workspaceId into where`, {
|
|
390
412
|
workspaceId: wsCtx.workspaceId
|
|
391
413
|
});
|
|
392
414
|
}
|
|
393
|
-
|
|
415
|
+
const finalArgs = {
|
|
394
416
|
...stripSkipFlag(args),
|
|
395
417
|
where: injectedWhere
|
|
396
|
-
}
|
|
418
|
+
};
|
|
419
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
420
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "findMany", finalArgs);
|
|
421
|
+
}
|
|
422
|
+
return query(finalArgs);
|
|
397
423
|
},
|
|
398
424
|
async findFirst({ model, args, query }) {
|
|
399
425
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -407,19 +433,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
407
433
|
if (fullConfig.enableApplicationNameTagging) {
|
|
408
434
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
409
435
|
}
|
|
410
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
411
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
412
|
-
}
|
|
413
436
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
414
437
|
if (fullConfig.debug) {
|
|
415
438
|
logger.debug(`[WorkspaceExtension] ${model}.findFirst - injected workspaceId into where`, {
|
|
416
439
|
workspaceId: wsCtx.workspaceId
|
|
417
440
|
});
|
|
418
441
|
}
|
|
419
|
-
|
|
442
|
+
const finalArgs = {
|
|
420
443
|
...stripSkipFlag(args),
|
|
421
444
|
where: injectedWhere
|
|
422
|
-
}
|
|
445
|
+
};
|
|
446
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
447
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "findFirst", finalArgs);
|
|
448
|
+
}
|
|
449
|
+
return query(finalArgs);
|
|
423
450
|
},
|
|
424
451
|
async findFirstOrThrow({ model, args, query }) {
|
|
425
452
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -433,19 +460,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
433
460
|
if (fullConfig.enableApplicationNameTagging) {
|
|
434
461
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
435
462
|
}
|
|
436
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
437
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
438
|
-
}
|
|
439
463
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
440
464
|
if (fullConfig.debug) {
|
|
441
465
|
logger.debug(`[WorkspaceExtension] ${model}.findFirstOrThrow - injected workspaceId into where`, {
|
|
442
466
|
workspaceId: wsCtx.workspaceId
|
|
443
467
|
});
|
|
444
468
|
}
|
|
445
|
-
|
|
469
|
+
const finalArgs = {
|
|
446
470
|
...stripSkipFlag(args),
|
|
447
471
|
where: injectedWhere
|
|
448
|
-
}
|
|
472
|
+
};
|
|
473
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
474
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "findFirstOrThrow", finalArgs);
|
|
475
|
+
}
|
|
476
|
+
return query(finalArgs);
|
|
449
477
|
},
|
|
450
478
|
async findUnique({ model, args, query }) {
|
|
451
479
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -459,19 +487,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
459
487
|
if (fullConfig.enableApplicationNameTagging) {
|
|
460
488
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
461
489
|
}
|
|
462
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
463
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
464
|
-
}
|
|
465
490
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
466
491
|
if (fullConfig.debug) {
|
|
467
492
|
logger.debug(`[WorkspaceExtension] ${model}.findUnique - injected workspaceId into where`, {
|
|
468
493
|
workspaceId: wsCtx.workspaceId
|
|
469
494
|
});
|
|
470
495
|
}
|
|
471
|
-
|
|
496
|
+
const finalArgs = {
|
|
472
497
|
...stripSkipFlag(args),
|
|
473
498
|
where: injectedWhere
|
|
474
|
-
}
|
|
499
|
+
};
|
|
500
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
501
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "findUnique", finalArgs);
|
|
502
|
+
}
|
|
503
|
+
return query(finalArgs);
|
|
475
504
|
},
|
|
476
505
|
async findUniqueOrThrow({ model, args, query }) {
|
|
477
506
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -485,19 +514,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
485
514
|
if (fullConfig.enableApplicationNameTagging) {
|
|
486
515
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
487
516
|
}
|
|
488
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
489
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
490
|
-
}
|
|
491
517
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
492
518
|
if (fullConfig.debug) {
|
|
493
519
|
logger.debug(`[WorkspaceExtension] ${model}.findUniqueOrThrow - injected workspaceId into where`, {
|
|
494
520
|
workspaceId: wsCtx.workspaceId
|
|
495
521
|
});
|
|
496
522
|
}
|
|
497
|
-
|
|
523
|
+
const finalArgs = {
|
|
498
524
|
...stripSkipFlag(args),
|
|
499
525
|
where: injectedWhere
|
|
500
|
-
}
|
|
526
|
+
};
|
|
527
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
528
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "findUniqueOrThrow", finalArgs);
|
|
529
|
+
}
|
|
530
|
+
return query(finalArgs);
|
|
501
531
|
},
|
|
502
532
|
async count({ model, args, query }) {
|
|
503
533
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -511,19 +541,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
511
541
|
if (fullConfig.enableApplicationNameTagging) {
|
|
512
542
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
513
543
|
}
|
|
514
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
515
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
516
|
-
}
|
|
517
544
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
518
545
|
if (fullConfig.debug) {
|
|
519
546
|
logger.debug(`[WorkspaceExtension] ${model}.count - injected workspaceId into where`, {
|
|
520
547
|
workspaceId: wsCtx.workspaceId
|
|
521
548
|
});
|
|
522
549
|
}
|
|
523
|
-
|
|
550
|
+
const finalArgs = {
|
|
524
551
|
...stripSkipFlag(args),
|
|
525
552
|
where: injectedWhere
|
|
526
|
-
}
|
|
553
|
+
};
|
|
554
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
555
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "count", finalArgs);
|
|
556
|
+
}
|
|
557
|
+
return query(finalArgs);
|
|
527
558
|
},
|
|
528
559
|
async aggregate({ model, args, query }) {
|
|
529
560
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -537,19 +568,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
537
568
|
if (fullConfig.enableApplicationNameTagging) {
|
|
538
569
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
539
570
|
}
|
|
540
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
541
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
542
|
-
}
|
|
543
571
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
544
572
|
if (fullConfig.debug) {
|
|
545
573
|
logger.debug(`[WorkspaceExtension] ${model}.aggregate - injected workspaceId into where`, {
|
|
546
574
|
workspaceId: wsCtx.workspaceId
|
|
547
575
|
});
|
|
548
576
|
}
|
|
549
|
-
|
|
577
|
+
const finalArgs = {
|
|
550
578
|
...stripSkipFlag(args),
|
|
551
579
|
where: injectedWhere
|
|
552
|
-
}
|
|
580
|
+
};
|
|
581
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
582
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "aggregate", finalArgs);
|
|
583
|
+
}
|
|
584
|
+
return query(finalArgs);
|
|
553
585
|
},
|
|
554
586
|
async groupBy({ model, args, query }) {
|
|
555
587
|
if (!fullConfig.enableReadIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -563,19 +595,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
563
595
|
if (fullConfig.enableApplicationNameTagging) {
|
|
564
596
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
565
597
|
}
|
|
566
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
567
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
568
|
-
}
|
|
569
598
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
570
599
|
if (fullConfig.debug) {
|
|
571
600
|
logger.debug(`[WorkspaceExtension] ${model}.groupBy - injected workspaceId into where`, {
|
|
572
601
|
workspaceId: wsCtx.workspaceId
|
|
573
602
|
});
|
|
574
603
|
}
|
|
575
|
-
|
|
604
|
+
const finalArgs = {
|
|
576
605
|
...stripSkipFlag(args),
|
|
577
606
|
where: injectedWhere
|
|
578
|
-
}
|
|
607
|
+
};
|
|
608
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
609
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "groupBy", finalArgs);
|
|
610
|
+
}
|
|
611
|
+
return query(finalArgs);
|
|
579
612
|
},
|
|
580
613
|
// ================================================================
|
|
581
614
|
// DELETE OPERATIONS - inject workspaceId into where clause
|
|
@@ -592,19 +625,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
592
625
|
if (fullConfig.enableApplicationNameTagging) {
|
|
593
626
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
594
627
|
}
|
|
595
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
596
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
597
|
-
}
|
|
598
628
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
599
629
|
if (fullConfig.debug) {
|
|
600
630
|
logger.debug(`[WorkspaceExtension] ${model}.delete - injected workspaceId into where`, {
|
|
601
631
|
workspaceId: wsCtx.workspaceId
|
|
602
632
|
});
|
|
603
633
|
}
|
|
604
|
-
|
|
634
|
+
const finalArgs = {
|
|
605
635
|
...stripSkipFlag(args),
|
|
606
636
|
where: injectedWhere
|
|
607
|
-
}
|
|
637
|
+
};
|
|
638
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
639
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "delete", finalArgs);
|
|
640
|
+
}
|
|
641
|
+
return query(finalArgs);
|
|
608
642
|
},
|
|
609
643
|
async deleteMany({ model, args, query }) {
|
|
610
644
|
if (!fullConfig.enableDeleteIsolation || isExcludedFromReadIsolation(model, fullConfig) || args._skipWorkspaceInjection) {
|
|
@@ -618,19 +652,20 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
618
652
|
if (fullConfig.enableApplicationNameTagging) {
|
|
619
653
|
await maybeTagConnection(rawPrisma, wsCtx);
|
|
620
654
|
}
|
|
621
|
-
if (fullConfig.enableRlsGucTagging) {
|
|
622
|
-
await maybeSetRlsGuc(rawPrisma, wsCtx);
|
|
623
|
-
}
|
|
624
655
|
const injectedWhere = injectWhereClause(args.where, wsCtx);
|
|
625
656
|
if (fullConfig.debug) {
|
|
626
657
|
logger.debug(`[WorkspaceExtension] ${model}.deleteMany - injected workspaceId into where`, {
|
|
627
658
|
workspaceId: wsCtx.workspaceId
|
|
628
659
|
});
|
|
629
660
|
}
|
|
630
|
-
|
|
661
|
+
const finalArgs = {
|
|
631
662
|
...stripSkipFlag(args),
|
|
632
663
|
where: injectedWhere
|
|
633
|
-
}
|
|
664
|
+
};
|
|
665
|
+
if (fullConfig.enableRlsGucTagging) {
|
|
666
|
+
return runOperationWithRlsGuc(rawPrismaForTransactions, wsCtx, model, "deleteMany", finalArgs);
|
|
667
|
+
}
|
|
668
|
+
return query(finalArgs);
|
|
634
669
|
}
|
|
635
670
|
}
|
|
636
671
|
}
|
|
@@ -638,6 +673,6 @@ function addWorkspaceExtension(baseClient, config) {
|
|
|
638
673
|
}
|
|
639
674
|
__name(addWorkspaceExtension, "addWorkspaceExtension");
|
|
640
675
|
|
|
641
|
-
export { addWorkspaceExtension, getWorkspaceContext, injectWhereWorkspaceId, maybeSetRlsGuc, maybeTagConnection, setWorkspaceContext, withWorkspaceContext, withWorkspaceContextSync };
|
|
642
|
-
//# sourceMappingURL=chunk-
|
|
643
|
-
//# sourceMappingURL=chunk-
|
|
676
|
+
export { addWorkspaceExtension, getWorkspaceContext, injectWhereWorkspaceId, maybeSetRlsGuc, maybeTagConnection, runOperationWithRlsGuc, setWorkspaceContext, withWorkspaceContext, withWorkspaceContextSync };
|
|
677
|
+
//# sourceMappingURL=chunk-EJPRCENB.js.map
|
|
678
|
+
//# sourceMappingURL=chunk-EJPRCENB.js.map
|