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