@powerhousedao/reactor-api 6.0.0-dev.254 → 6.0.0-dev.255
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.mts +4 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +109 -75
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7376325d-a64e-53ca-8757-5f06b3be132b")}catch(e){}}();
|
|
3
3
|
import { a as isSubgraphClass, c as loadDocumentModels, d as BaseSubgraph, i as buildGraphqlOperations, l as loadProcessors, n as buildGraphQlDriveDocument, o as debounce, r as buildGraphqlOperation, t as buildGraphQlDocument, u as loadSubgraphs } from "./utils-CHCRSWig.mjs";
|
|
4
4
|
import { AnalyticsQueryEngine } from "@powerhousedao/analytics-engine-core";
|
|
5
5
|
import { AnalyticsModel, AnalyticsResolvers, typedefs } from "@powerhousedao/analytics-engine-graphql";
|
|
@@ -252,12 +252,12 @@ var AuthSubgraph = class extends BaseSubgraph {
|
|
|
252
252
|
resolvers = {
|
|
253
253
|
Query: {
|
|
254
254
|
documentAccess: async (_parent, args) => {
|
|
255
|
-
this.logger.debug("documentAccess", args);
|
|
255
|
+
this.logger.debug("documentAccess(@args)", args);
|
|
256
256
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
257
257
|
try {
|
|
258
258
|
return await documentAccess(this.documentPermissionService, args);
|
|
259
259
|
} catch (error) {
|
|
260
|
-
this.logger.error("Error in documentAccess:", error);
|
|
260
|
+
this.logger.error("Error in documentAccess: @error", error);
|
|
261
261
|
throw error;
|
|
262
262
|
}
|
|
263
263
|
},
|
|
@@ -268,7 +268,7 @@ var AuthSubgraph = class extends BaseSubgraph {
|
|
|
268
268
|
try {
|
|
269
269
|
return await userDocumentPermissions(this.documentPermissionService, ctx.user.address);
|
|
270
270
|
} catch (error) {
|
|
271
|
-
this.logger.error("Error in userDocumentPermissions:", error);
|
|
271
|
+
this.logger.error("Error in userDocumentPermissions: @error", error);
|
|
272
272
|
throw error;
|
|
273
273
|
}
|
|
274
274
|
},
|
|
@@ -278,210 +278,210 @@ var AuthSubgraph = class extends BaseSubgraph {
|
|
|
278
278
|
try {
|
|
279
279
|
return await groups(this.documentPermissionService);
|
|
280
280
|
} catch (error) {
|
|
281
|
-
this.logger.error("Error in groups:", error);
|
|
281
|
+
this.logger.error("Error in groups: @error", error);
|
|
282
282
|
throw error;
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
285
|
group: async (_parent, args) => {
|
|
286
|
-
this.logger.debug("group", args);
|
|
286
|
+
this.logger.debug("group(@args)", args);
|
|
287
287
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
288
288
|
try {
|
|
289
289
|
return await group(this.documentPermissionService, args);
|
|
290
290
|
} catch (error) {
|
|
291
|
-
this.logger.error("Error in group:", error);
|
|
291
|
+
this.logger.error("Error in group: @error", error);
|
|
292
292
|
throw error;
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
295
|
userGroups: async (_parent, args) => {
|
|
296
|
-
this.logger.debug("userGroups", args);
|
|
296
|
+
this.logger.debug("userGroups(@args)", args);
|
|
297
297
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
298
298
|
try {
|
|
299
299
|
return await userGroups(this.documentPermissionService, args);
|
|
300
300
|
} catch (error) {
|
|
301
|
-
this.logger.error("Error in userGroups:", error);
|
|
301
|
+
this.logger.error("Error in userGroups: @error", error);
|
|
302
302
|
throw error;
|
|
303
303
|
}
|
|
304
304
|
},
|
|
305
305
|
operationPermissions: async (_parent, args) => {
|
|
306
|
-
this.logger.debug("operationPermissions", args);
|
|
306
|
+
this.logger.debug("operationPermissions(@args)", args);
|
|
307
307
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
308
308
|
try {
|
|
309
309
|
return await operationPermissions(this.documentPermissionService, args);
|
|
310
310
|
} catch (error) {
|
|
311
|
-
this.logger.error("Error in operationPermissions:", error);
|
|
311
|
+
this.logger.error("Error in operationPermissions: @error", error);
|
|
312
312
|
throw error;
|
|
313
313
|
}
|
|
314
314
|
},
|
|
315
315
|
canExecuteOperation: async (_parent, args, ctx) => {
|
|
316
|
-
this.logger.debug("canExecuteOperation", args);
|
|
316
|
+
this.logger.debug("canExecuteOperation(@args)", args);
|
|
317
317
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
318
318
|
try {
|
|
319
319
|
return await canExecuteOperation(this.documentPermissionService, args, ctx.user?.address);
|
|
320
320
|
} catch (error) {
|
|
321
|
-
this.logger.error("Error in canExecuteOperation:", error);
|
|
321
|
+
this.logger.error("Error in canExecuteOperation: @error", error);
|
|
322
322
|
throw error;
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
325
|
documentProtection: async (_parent, args, ctx) => {
|
|
326
|
-
this.logger.debug("documentProtection", args);
|
|
326
|
+
this.logger.debug("documentProtection(@args)", args);
|
|
327
327
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
328
328
|
if (!ctx.user?.address) throw new GraphQLError("Authentication required to view document protection info");
|
|
329
329
|
try {
|
|
330
330
|
return await documentProtection(this.documentPermissionService, args);
|
|
331
331
|
} catch (error) {
|
|
332
|
-
this.logger.error("Error in documentProtection:", error);
|
|
332
|
+
this.logger.error("Error in documentProtection: @error", error);
|
|
333
333
|
throw error;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
},
|
|
337
337
|
Mutation: {
|
|
338
338
|
setDocumentProtection: async (_parent, args, ctx) => {
|
|
339
|
-
this.logger.debug("setDocumentProtection", args);
|
|
339
|
+
this.logger.debug("setDocumentProtection(@args)", args);
|
|
340
340
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
341
341
|
try {
|
|
342
342
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
343
343
|
return await setDocumentProtection(this.documentPermissionService, this.authorizationService, args, ctx.user?.address, isGlobalAdmin);
|
|
344
344
|
} catch (error) {
|
|
345
|
-
this.logger.error("Error in setDocumentProtection:", error);
|
|
345
|
+
this.logger.error("Error in setDocumentProtection: @error", error);
|
|
346
346
|
throw error;
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
transferDocumentOwnership: async (_parent, args, ctx) => {
|
|
350
|
-
this.logger.debug("transferDocumentOwnership", args);
|
|
350
|
+
this.logger.debug("transferDocumentOwnership(@args)", args);
|
|
351
351
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
352
352
|
try {
|
|
353
353
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
354
354
|
return await transferDocumentOwnership(this.documentPermissionService, this.authorizationService, args, ctx.user?.address, isGlobalAdmin);
|
|
355
355
|
} catch (error) {
|
|
356
|
-
this.logger.error("Error in transferDocumentOwnership:", error);
|
|
356
|
+
this.logger.error("Error in transferDocumentOwnership: @error", error);
|
|
357
357
|
throw error;
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
360
|
grantDocumentPermission: async (_parent, args, ctx) => {
|
|
361
|
-
this.logger.debug("grantDocumentPermission", args);
|
|
361
|
+
this.logger.debug("grantDocumentPermission(@args)", args);
|
|
362
362
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
363
363
|
try {
|
|
364
364
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
365
365
|
return await grantDocumentPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
366
366
|
} catch (error) {
|
|
367
|
-
this.logger.error("Error in grantDocumentPermission:", error);
|
|
367
|
+
this.logger.error("Error in grantDocumentPermission: @error", error);
|
|
368
368
|
throw error;
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
371
|
revokeDocumentPermission: async (_parent, args, ctx) => {
|
|
372
|
-
this.logger.debug("revokeDocumentPermission", args);
|
|
372
|
+
this.logger.debug("revokeDocumentPermission(@args)", args);
|
|
373
373
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
374
374
|
try {
|
|
375
375
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
376
376
|
return await revokeDocumentPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
377
377
|
} catch (error) {
|
|
378
|
-
this.logger.error("Error in revokeDocumentPermission:", error);
|
|
378
|
+
this.logger.error("Error in revokeDocumentPermission: @error", error);
|
|
379
379
|
throw error;
|
|
380
380
|
}
|
|
381
381
|
},
|
|
382
382
|
createGroup: async (_parent, args) => {
|
|
383
|
-
this.logger.debug("createGroup", args);
|
|
383
|
+
this.logger.debug("createGroup(@args)", args);
|
|
384
384
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
385
385
|
try {
|
|
386
386
|
return await createGroup(this.documentPermissionService, args);
|
|
387
387
|
} catch (error) {
|
|
388
|
-
this.logger.error("Error in createGroup:", error);
|
|
388
|
+
this.logger.error("Error in createGroup: @error", error);
|
|
389
389
|
throw error;
|
|
390
390
|
}
|
|
391
391
|
},
|
|
392
392
|
deleteGroup: async (_parent, args) => {
|
|
393
|
-
this.logger.debug("deleteGroup", args);
|
|
393
|
+
this.logger.debug("deleteGroup(@args)", args);
|
|
394
394
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
395
395
|
try {
|
|
396
396
|
return await deleteGroup(this.documentPermissionService, args);
|
|
397
397
|
} catch (error) {
|
|
398
|
-
this.logger.error("Error in deleteGroup:", error);
|
|
398
|
+
this.logger.error("Error in deleteGroup: @error", error);
|
|
399
399
|
throw error;
|
|
400
400
|
}
|
|
401
401
|
},
|
|
402
402
|
addUserToGroup: async (_parent, args) => {
|
|
403
|
-
this.logger.debug("addUserToGroup", args);
|
|
403
|
+
this.logger.debug("addUserToGroup(@args)", args);
|
|
404
404
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
405
405
|
try {
|
|
406
406
|
return await addUserToGroup(this.documentPermissionService, args);
|
|
407
407
|
} catch (error) {
|
|
408
|
-
this.logger.error("Error in addUserToGroup:", error);
|
|
408
|
+
this.logger.error("Error in addUserToGroup: @error", error);
|
|
409
409
|
throw error;
|
|
410
410
|
}
|
|
411
411
|
},
|
|
412
412
|
removeUserFromGroup: async (_parent, args) => {
|
|
413
|
-
this.logger.debug("removeUserFromGroup", args);
|
|
413
|
+
this.logger.debug("removeUserFromGroup(@args)", args);
|
|
414
414
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
415
415
|
try {
|
|
416
416
|
return await removeUserFromGroup(this.documentPermissionService, args);
|
|
417
417
|
} catch (error) {
|
|
418
|
-
this.logger.error("Error in removeUserFromGroup:", error);
|
|
418
|
+
this.logger.error("Error in removeUserFromGroup: @error", error);
|
|
419
419
|
throw error;
|
|
420
420
|
}
|
|
421
421
|
},
|
|
422
422
|
grantGroupPermission: async (_parent, args, ctx) => {
|
|
423
|
-
this.logger.debug("grantGroupPermission", args);
|
|
423
|
+
this.logger.debug("grantGroupPermission(@args)", args);
|
|
424
424
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
425
425
|
try {
|
|
426
426
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
427
427
|
return await grantGroupPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
428
428
|
} catch (error) {
|
|
429
|
-
this.logger.error("Error in grantGroupPermission:", error);
|
|
429
|
+
this.logger.error("Error in grantGroupPermission: @error", error);
|
|
430
430
|
throw error;
|
|
431
431
|
}
|
|
432
432
|
},
|
|
433
433
|
revokeGroupPermission: async (_parent, args, ctx) => {
|
|
434
|
-
this.logger.debug("revokeGroupPermission", args);
|
|
434
|
+
this.logger.debug("revokeGroupPermission(@args)", args);
|
|
435
435
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
436
436
|
try {
|
|
437
437
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
438
438
|
return await revokeGroupPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
439
439
|
} catch (error) {
|
|
440
|
-
this.logger.error("Error in revokeGroupPermission:", error);
|
|
440
|
+
this.logger.error("Error in revokeGroupPermission: @error", error);
|
|
441
441
|
throw error;
|
|
442
442
|
}
|
|
443
443
|
},
|
|
444
444
|
grantOperationPermission: async (_parent, args, ctx) => {
|
|
445
|
-
this.logger.debug("grantOperationPermission", args);
|
|
445
|
+
this.logger.debug("grantOperationPermission(@args)", args);
|
|
446
446
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
447
447
|
try {
|
|
448
448
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
449
449
|
return await grantOperationPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
450
450
|
} catch (error) {
|
|
451
|
-
this.logger.error("Error in grantOperationPermission:", error);
|
|
451
|
+
this.logger.error("Error in grantOperationPermission: @error", error);
|
|
452
452
|
throw error;
|
|
453
453
|
}
|
|
454
454
|
},
|
|
455
455
|
revokeOperationPermission: async (_parent, args, ctx) => {
|
|
456
|
-
this.logger.debug("revokeOperationPermission", args);
|
|
456
|
+
this.logger.debug("revokeOperationPermission(@args)", args);
|
|
457
457
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
458
458
|
try {
|
|
459
459
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
460
460
|
return await revokeOperationPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
461
461
|
} catch (error) {
|
|
462
|
-
this.logger.error("Error in revokeOperationPermission:", error);
|
|
462
|
+
this.logger.error("Error in revokeOperationPermission: @error", error);
|
|
463
463
|
throw error;
|
|
464
464
|
}
|
|
465
465
|
},
|
|
466
466
|
grantGroupOperationPermission: async (_parent, args, ctx) => {
|
|
467
|
-
this.logger.debug("grantGroupOperationPermission", args);
|
|
467
|
+
this.logger.debug("grantGroupOperationPermission(@args)", args);
|
|
468
468
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
469
469
|
try {
|
|
470
470
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
471
471
|
return await grantGroupOperationPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
472
472
|
} catch (error) {
|
|
473
|
-
this.logger.error("Error in grantGroupOperationPermission:", error);
|
|
473
|
+
this.logger.error("Error in grantGroupOperationPermission: @error", error);
|
|
474
474
|
throw error;
|
|
475
475
|
}
|
|
476
476
|
},
|
|
477
477
|
revokeGroupOperationPermission: async (_parent, args, ctx) => {
|
|
478
|
-
this.logger.debug("revokeGroupOperationPermission", args);
|
|
478
|
+
this.logger.debug("revokeGroupOperationPermission(@args)", args);
|
|
479
479
|
if (!this.documentPermissionService) throw new GraphQLError("DocumentPermissionService not available");
|
|
480
480
|
try {
|
|
481
481
|
const isGlobalAdmin = ctx.isAdmin?.(ctx.user?.address ?? "") ?? false;
|
|
482
482
|
return await revokeGroupOperationPermission(this.documentPermissionService, args, ctx.user?.address, isGlobalAdmin);
|
|
483
483
|
} catch (error) {
|
|
484
|
-
this.logger.error("Error in revokeGroupOperationPermission:", error);
|
|
484
|
+
this.logger.error("Error in revokeGroupOperationPermission: @error", error);
|
|
485
485
|
throw error;
|
|
486
486
|
}
|
|
487
487
|
}
|
|
@@ -3837,7 +3837,7 @@ var GraphQLManager = class {
|
|
|
3837
3837
|
await this.updateRouter();
|
|
3838
3838
|
this.logger.info("Regenerated document model subgraphs with @count models", models.length);
|
|
3839
3839
|
} catch (error) {
|
|
3840
|
-
this.logger.error("Failed to regenerate document model subgraphs", error);
|
|
3840
|
+
this.logger.error("Failed to regenerate document model subgraphs: @error", error);
|
|
3841
3841
|
throw error;
|
|
3842
3842
|
}
|
|
3843
3843
|
}
|
|
@@ -3921,7 +3921,7 @@ var GraphQLManager = class {
|
|
|
3921
3921
|
await this.gatewayAdapter.updateSupergraph();
|
|
3922
3922
|
this.logger.debug("Updated Apollo Gateway supergraph");
|
|
3923
3923
|
} catch (error) {
|
|
3924
|
-
this.logger.error("Failed to update Apollo Gateway supergraph", error);
|
|
3924
|
+
this.logger.error("Failed to update Apollo Gateway supergraph: @error", error);
|
|
3925
3925
|
}
|
|
3926
3926
|
const superGraphPath = path.join(this.path, "graphql");
|
|
3927
3927
|
this.#setupSupergraphSSE(superGraphPath);
|
|
@@ -4159,16 +4159,16 @@ var PackagesSubgraph = class extends BaseSubgraph {
|
|
|
4159
4159
|
try {
|
|
4160
4160
|
return await installedPackages(this.packageManagementService);
|
|
4161
4161
|
} catch (error) {
|
|
4162
|
-
this.logger.error("Error in installedPackages:", error);
|
|
4162
|
+
this.logger.error("Error in installedPackages: @error", error);
|
|
4163
4163
|
throw error;
|
|
4164
4164
|
}
|
|
4165
4165
|
},
|
|
4166
4166
|
installedPackage: async (_parent, args) => {
|
|
4167
|
-
this.logger.debug("installedPackage", args);
|
|
4167
|
+
this.logger.debug("installedPackage(@args)", args);
|
|
4168
4168
|
try {
|
|
4169
4169
|
return await installedPackage(this.packageManagementService, args);
|
|
4170
4170
|
} catch (error) {
|
|
4171
|
-
this.logger.error("Error in installedPackage:", error);
|
|
4171
|
+
this.logger.error("Error in installedPackage: @error", error);
|
|
4172
4172
|
throw error;
|
|
4173
4173
|
}
|
|
4174
4174
|
}
|
|
@@ -4176,20 +4176,20 @@ var PackagesSubgraph = class extends BaseSubgraph {
|
|
|
4176
4176
|
Mutation: { Packages: () => ({}) },
|
|
4177
4177
|
PackagesMutations: {
|
|
4178
4178
|
installPackage: async (_parent, args, ctx) => {
|
|
4179
|
-
this.logger.debug("installPackage", args);
|
|
4179
|
+
this.logger.debug("installPackage(@args)", args);
|
|
4180
4180
|
try {
|
|
4181
4181
|
return await installPackage(this.packageManagementService, args, ctx);
|
|
4182
4182
|
} catch (error) {
|
|
4183
|
-
this.logger.error("Error in installPackage:", error);
|
|
4183
|
+
this.logger.error("Error in installPackage: @error", error);
|
|
4184
4184
|
throw error;
|
|
4185
4185
|
}
|
|
4186
4186
|
},
|
|
4187
4187
|
uninstallPackage: async (_parent, args, ctx) => {
|
|
4188
|
-
this.logger.debug("uninstallPackage", args);
|
|
4188
|
+
this.logger.debug("uninstallPackage(@args)", args);
|
|
4189
4189
|
try {
|
|
4190
4190
|
return await uninstallPackage(this.packageManagementService, args, ctx);
|
|
4191
4191
|
} catch (error) {
|
|
4192
|
-
this.logger.error("Error in uninstallPackage:", error);
|
|
4192
|
+
this.logger.error("Error in uninstallPackage: @error", error);
|
|
4193
4193
|
throw error;
|
|
4194
4194
|
}
|
|
4195
4195
|
}
|
|
@@ -4758,7 +4758,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4758
4758
|
hasMore
|
|
4759
4759
|
};
|
|
4760
4760
|
} catch (error) {
|
|
4761
|
-
this.logger.error("Error in pollSyncEnvelopes(@args): @Error", error);
|
|
4761
|
+
this.logger.error("Error in pollSyncEnvelopes(@args): @Error", args, error);
|
|
4762
4762
|
throw error;
|
|
4763
4763
|
}
|
|
4764
4764
|
}
|
|
@@ -4778,7 +4778,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4778
4778
|
if (this.authorizationService && ctx.user?.address && result?.id) await this.documentPermissionService?.initializeDocumentProtection(result.id, ctx.user.address, this.authorizationService.config.defaultProtection);
|
|
4779
4779
|
return result;
|
|
4780
4780
|
} catch (error) {
|
|
4781
|
-
this.logger.error("Error in createDocument(@args): @Error", error);
|
|
4781
|
+
this.logger.error("Error in createDocument(@args): @Error", args, error);
|
|
4782
4782
|
throw error;
|
|
4783
4783
|
}
|
|
4784
4784
|
},
|
|
@@ -4796,7 +4796,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4796
4796
|
if (this.authorizationService && ctx.user?.address && result?.id) await this.documentPermissionService?.initializeDocumentProtection(result.id, ctx.user.address, this.authorizationService.config.defaultProtection);
|
|
4797
4797
|
return result;
|
|
4798
4798
|
} catch (error) {
|
|
4799
|
-
this.logger.error("Error in createEmptyDocument(@args): @Error", error);
|
|
4799
|
+
this.logger.error("Error in createEmptyDocument(@args): @Error", args, error);
|
|
4800
4800
|
throw error;
|
|
4801
4801
|
}
|
|
4802
4802
|
},
|
|
@@ -4807,7 +4807,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4807
4807
|
await this.assertCanExecuteOperations(args.documentIdentifier, args.actions, ctx);
|
|
4808
4808
|
return await mutateDocument(this.reactorClient, args);
|
|
4809
4809
|
} catch (error) {
|
|
4810
|
-
this.logger.error("Error in mutateDocument(@args): @Error", error);
|
|
4810
|
+
this.logger.error("Error in mutateDocument(@args): @Error", args, error);
|
|
4811
4811
|
throw error;
|
|
4812
4812
|
}
|
|
4813
4813
|
},
|
|
@@ -4818,7 +4818,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4818
4818
|
await this.assertCanExecuteOperations(args.documentIdentifier, args.actions, ctx);
|
|
4819
4819
|
return await mutateDocumentAsync(this.reactorClient, args);
|
|
4820
4820
|
} catch (error) {
|
|
4821
|
-
this.logger.error("Error in mutateDocumentAsync(@args): @Error", error);
|
|
4821
|
+
this.logger.error("Error in mutateDocumentAsync(@args): @Error", args, error);
|
|
4822
4822
|
throw error;
|
|
4823
4823
|
}
|
|
4824
4824
|
},
|
|
@@ -4828,7 +4828,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4828
4828
|
await this.assertCanWrite(args.documentIdentifier, ctx);
|
|
4829
4829
|
return await renameDocument(this.reactorClient, args);
|
|
4830
4830
|
} catch (error) {
|
|
4831
|
-
this.logger.error("Error in renameDocument(@args): @Error", error);
|
|
4831
|
+
this.logger.error("Error in renameDocument(@args): @Error", args, error);
|
|
4832
4832
|
throw error;
|
|
4833
4833
|
}
|
|
4834
4834
|
},
|
|
@@ -4838,7 +4838,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4838
4838
|
await this.assertCanWrite(args.documentIdentifier, ctx);
|
|
4839
4839
|
return await setPreferredEditor(this.reactorClient, args);
|
|
4840
4840
|
} catch (error) {
|
|
4841
|
-
this.logger.error("Error in setPreferredEditor(@args): @Error", error);
|
|
4841
|
+
this.logger.error("Error in setPreferredEditor(@args): @Error", args, error);
|
|
4842
4842
|
throw error;
|
|
4843
4843
|
}
|
|
4844
4844
|
},
|
|
@@ -4848,7 +4848,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4848
4848
|
await this.assertCanWrite(args.sourceIdentifier, ctx);
|
|
4849
4849
|
return await addRelationship(this.reactorClient, args);
|
|
4850
4850
|
} catch (error) {
|
|
4851
|
-
this.logger.error("Error in addRelationship(@args): @Error", error);
|
|
4851
|
+
this.logger.error("Error in addRelationship(@args): @Error", args, error);
|
|
4852
4852
|
throw error;
|
|
4853
4853
|
}
|
|
4854
4854
|
},
|
|
@@ -4858,7 +4858,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4858
4858
|
await this.assertCanWrite(args.sourceIdentifier, ctx);
|
|
4859
4859
|
return await removeRelationship(this.reactorClient, args);
|
|
4860
4860
|
} catch (error) {
|
|
4861
|
-
this.logger.error("Error in removeRelationship(@args): @Error", error);
|
|
4861
|
+
this.logger.error("Error in removeRelationship(@args): @Error", args, error);
|
|
4862
4862
|
throw error;
|
|
4863
4863
|
}
|
|
4864
4864
|
},
|
|
@@ -4882,7 +4882,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4882
4882
|
if (result && driveIdToInvalidate) this.graphqlManager.driveOwnershipCache.remove(driveIdToInvalidate);
|
|
4883
4883
|
return result;
|
|
4884
4884
|
} catch (error) {
|
|
4885
|
-
this.logger.error("Error in deleteDocument(@args): @Error", error);
|
|
4885
|
+
this.logger.error("Error in deleteDocument(@args): @Error", args, error);
|
|
4886
4886
|
throw error;
|
|
4887
4887
|
}
|
|
4888
4888
|
},
|
|
@@ -4892,7 +4892,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4892
4892
|
for (const identifier of args.identifiers) await this.assertCanWrite(identifier, ctx);
|
|
4893
4893
|
return await deleteDocuments(this.reactorClient, args);
|
|
4894
4894
|
} catch (error) {
|
|
4895
|
-
this.logger.error("Error in deleteDocuments(@args): @Error", error);
|
|
4895
|
+
this.logger.error("Error in deleteDocuments(@args): @Error", args, error);
|
|
4896
4896
|
throw error;
|
|
4897
4897
|
}
|
|
4898
4898
|
},
|
|
@@ -4901,7 +4901,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4901
4901
|
try {
|
|
4902
4902
|
return await touchChannel(this.syncManager, args);
|
|
4903
4903
|
} catch (error) {
|
|
4904
|
-
this.logger.error("Error in touchChannel(@args): @Error", error);
|
|
4904
|
+
this.logger.error("Error in touchChannel(@args): @Error", args, error);
|
|
4905
4905
|
throw error;
|
|
4906
4906
|
}
|
|
4907
4907
|
},
|
|
@@ -4931,7 +4931,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4931
4931
|
})) };
|
|
4932
4932
|
return await pushSyncEnvelopes(this.syncManager, mutableArgs);
|
|
4933
4933
|
} catch (error) {
|
|
4934
|
-
this.logger.error("Error in pushSyncEnvelopes(@args): @Error", error);
|
|
4934
|
+
this.logger.error("Error in pushSyncEnvelopes(@args): @Error", args, error);
|
|
4935
4935
|
throw error;
|
|
4936
4936
|
}
|
|
4937
4937
|
}
|
|
@@ -4939,7 +4939,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4939
4939
|
Subscription: {
|
|
4940
4940
|
documentChanges: {
|
|
4941
4941
|
subscribe: withFilter((() => {
|
|
4942
|
-
this.logger.debug("documentChanges
|
|
4942
|
+
this.logger.debug("documentChanges subscription started");
|
|
4943
4943
|
ensureGlobalDocumentSubscription(this.reactorClient);
|
|
4944
4944
|
return getPubSub().asyncIterableIterator(SUBSCRIPTION_TRIGGERS.DOCUMENT_CHANGES);
|
|
4945
4945
|
}), ((payload, args) => {
|
|
@@ -4986,10 +4986,10 @@ const ADMIN_USERS = getAdminUsers();
|
|
|
4986
4986
|
//#endregion
|
|
4987
4987
|
//#region src/graphql/system/version.ts
|
|
4988
4988
|
function getVersion() {
|
|
4989
|
-
return "6.0.0-dev.
|
|
4989
|
+
return "6.0.0-dev.255";
|
|
4990
4990
|
}
|
|
4991
4991
|
function getGitHash() {
|
|
4992
|
-
return "
|
|
4992
|
+
return "9fec21bf56b8b4aeed4a623a750982706e5b2b82";
|
|
4993
4993
|
}
|
|
4994
4994
|
function getGitUrl() {
|
|
4995
4995
|
return buildTreeUrl(getGitHash());
|
|
@@ -5266,7 +5266,7 @@ var PackageManager = class {
|
|
|
5266
5266
|
try {
|
|
5267
5267
|
this.subscribePackages(packages);
|
|
5268
5268
|
} catch (error) {
|
|
5269
|
-
this.logger.error("Failed to subscribe to packages", error);
|
|
5269
|
+
this.logger.error("Failed to subscribe to packages: @error", error);
|
|
5270
5270
|
}
|
|
5271
5271
|
return {
|
|
5272
5272
|
documentModels: getUniqueDocumentModels(...Array.from(documentModelsMap.values())),
|
|
@@ -6160,7 +6160,30 @@ function isPG(connectionString) {
|
|
|
6160
6160
|
if (connectionString.startsWith("postgresql://") || connectionString.startsWith("postgres://")) return true;
|
|
6161
6161
|
return false;
|
|
6162
6162
|
}
|
|
6163
|
+
/**
|
|
6164
|
+
* Cache of DB clients keyed by connection string. Reactor-api's read-model
|
|
6165
|
+
* layer wires analytics, attachments, and document-permissions as separate
|
|
6166
|
+
* consumers but they all target the same logical database (one postgres
|
|
6167
|
+
* instance, many schemas). Without caching:
|
|
6168
|
+
* - PGlite: two `new PGlite(samePath)` calls mean two embedded postgres
|
|
6169
|
+
* processes contending for the same data dir, racing shutdown syncs
|
|
6170
|
+
* and silently losing writes — a correctness bug.
|
|
6171
|
+
* - Postgres: each consumer opens an independent pool against the same
|
|
6172
|
+
* backend — wasteful but correct.
|
|
6173
|
+
* Caching by connection string returns the same knex/PGlite pair to every
|
|
6174
|
+
* consumer so writes coexist in one MemoryFS and one atomic snapshot, and
|
|
6175
|
+
* postgres callers get connection-pool dedup for free.
|
|
6176
|
+
*
|
|
6177
|
+
* Entries are evicted from inside the wrapped `knex.destroy()` below, so a
|
|
6178
|
+
* teardown + re-init in the same process (tests, hot-reloads) constructs
|
|
6179
|
+
* a fresh client instead of returning a closed pool.
|
|
6180
|
+
*/
|
|
6181
|
+
const IN_MEMORY_CACHE_KEY = Symbol("getDbClient:in-memory");
|
|
6182
|
+
const dbClientCache = /* @__PURE__ */ new Map();
|
|
6163
6183
|
function getDbClient(connectionString = void 0, pgliteFactory) {
|
|
6184
|
+
const cacheKey = connectionString ?? IN_MEMORY_CACHE_KEY;
|
|
6185
|
+
const cached = dbClientCache.get(cacheKey);
|
|
6186
|
+
if (cached) return cached;
|
|
6164
6187
|
const isPg = connectionString && isPG(connectionString);
|
|
6165
6188
|
const client = isPg ? "pg" : ClientPgLite;
|
|
6166
6189
|
const pgliteInstance = isPg ? void 0 : pgliteFactory ? pgliteFactory(connectionString) : connectionString ? new PGlite({ fs: new AtomicNodeFs(connectionString) }) : new PGlite();
|
|
@@ -6173,7 +6196,7 @@ function getDbClient(connectionString = void 0, pgliteFactory) {
|
|
|
6173
6196
|
client,
|
|
6174
6197
|
connection
|
|
6175
6198
|
});
|
|
6176
|
-
|
|
6199
|
+
const dbClient = {
|
|
6177
6200
|
db: new Kysely({ dialect: new KyselyKnexDialect({
|
|
6178
6201
|
knex: knexInstance,
|
|
6179
6202
|
kyselySubDialect: new PGColdDialect()
|
|
@@ -6181,6 +6204,17 @@ function getDbClient(connectionString = void 0, pgliteFactory) {
|
|
|
6181
6204
|
knex: knexInstance,
|
|
6182
6205
|
pglite: pgliteInstance
|
|
6183
6206
|
};
|
|
6207
|
+
const originalDestroy = knexInstance.destroy.bind(knexInstance);
|
|
6208
|
+
Object.defineProperty(knexInstance, "destroy", {
|
|
6209
|
+
configurable: true,
|
|
6210
|
+
writable: true,
|
|
6211
|
+
value: async (...args) => {
|
|
6212
|
+
if (dbClientCache.get(cacheKey) === dbClient) dbClientCache.delete(cacheKey);
|
|
6213
|
+
return originalDestroy(...args);
|
|
6214
|
+
}
|
|
6215
|
+
});
|
|
6216
|
+
dbClientCache.set(cacheKey, dbClient);
|
|
6217
|
+
return dbClient;
|
|
6184
6218
|
}
|
|
6185
6219
|
const initAnalyticsStoreSql = [
|
|
6186
6220
|
`create table if not exists "AnalyticsSeries"
|
|
@@ -6541,24 +6575,24 @@ function buildApiDispose(args) {
|
|
|
6541
6575
|
try {
|
|
6542
6576
|
await graphqlManager.shutdown();
|
|
6543
6577
|
} catch (error) {
|
|
6544
|
-
logger.error("API dispose: graphqlManager.shutdown failed:", error);
|
|
6578
|
+
logger.error("API dispose: graphqlManager.shutdown failed: @error", error);
|
|
6545
6579
|
}
|
|
6546
6580
|
try {
|
|
6547
6581
|
for (const client of wsServer.clients) client.terminate();
|
|
6548
6582
|
await new Promise((resolve) => wsServer.close(() => resolve()));
|
|
6549
6583
|
} catch (error) {
|
|
6550
|
-
logger.error("API dispose: wsServer.close failed:", error);
|
|
6584
|
+
logger.error("API dispose: wsServer.close failed: @error", error);
|
|
6551
6585
|
}
|
|
6552
6586
|
if (httpServer.listening) try {
|
|
6553
6587
|
httpServer.closeAllConnections();
|
|
6554
6588
|
await new Promise((resolve, reject) => httpServer.close((err) => err ? reject(err) : resolve()));
|
|
6555
6589
|
} catch (error) {
|
|
6556
|
-
logger.error("API dispose: httpServer.close failed:", error);
|
|
6590
|
+
logger.error("API dispose: httpServer.close failed: @error", error);
|
|
6557
6591
|
}
|
|
6558
6592
|
for (const close of dbClosers) try {
|
|
6559
6593
|
await close();
|
|
6560
6594
|
} catch (error) {
|
|
6561
|
-
logger.error("API dispose: db closer failed:", error);
|
|
6595
|
+
logger.error("API dispose: db closer failed: @error", error);
|
|
6562
6596
|
}
|
|
6563
6597
|
};
|
|
6564
6598
|
}
|
|
@@ -6683,4 +6717,4 @@ var PackageManagementService = class {
|
|
|
6683
6717
|
export { ADMIN_USERS, ActionContextInputSchema, ActionInputSchema, AddRelationshipDocument, AnalyticsSubgraph, AttachmentInputSchema, AuthService, AuthSubgraph, BaseSubgraph, ChannelMetaInputSchema, CreateDocumentDocument, CreateEmptyDocumentDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentOperationsFilterInputSchema, DocumentPermissionService, FindDocumentsDocument, GetDocumentDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentModelsDocument, GetDocumentOperationsDocument, GetDocumentOutgoingRelationshipsDocument, GetDocumentWithOperationsDocument, GetJobStatusDocument, GraphQLManager, HttpDocumentModelLoader, HttpPackageLoader, ImportPackageLoader, InMemoryPackageStorage, JobChangesDocument, MoveRelationshipDocument, MutateDocumentAsyncDocument, MutateDocumentDocument, OperationContextInputSchema, OperationInputSchema, OperationWithContextInputSchema, OperationsFilterInputSchema, PackageManagementService, PackageManager, PackagesSubgraph, PagingInputSchema, PhDocumentFieldsFragmentDoc, PollSyncEnvelopesDocument, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, ReactorSignerAppInputSchema, ReactorSignerInputSchema, ReactorSignerUserInputSchema, ReactorSubgraph, RemoteCursorInputSchema, RemoteFilterInputSchema, RemoveRelationshipDocument, RenameDocumentDocument, SearchFilterInputSchema, SetPreferredEditorDocument, SyncEnvelopeInputSchema, SyncEnvelopeType, SyncEnvelopeTypeSchema, SystemSubgraph, TouchChannelDocument, TouchChannelInputSchema, ViewFilterInputSchema, buildGraphQlDocument, buildGraphQlDriveDocument, buildGraphqlOperation, buildGraphqlOperations, buildSubgraphSchemaModule, createAuthFetchMiddleware, createGatewayAdapter, createHttpAdapter, createMergedSchema, createReactorGraphQLClient, createSchema, definedNonNullAnySchema, driveIdFromUrl, generateDocumentModelSchema, getAuthContext, getDbClient, getDocumentModelSchemaName, getDocumentModelTypeDefs, getGitHash, getGitUrl, getSdk, getUniqueDocumentModels, getVersion, initAnalyticsStoreSql, initializeAndStartAPI, isDefinedNonNullAny, isSubgraphClass, parseDriveUrl, renderGraphqlPlayground };
|
|
6684
6718
|
|
|
6685
6719
|
//# sourceMappingURL=index.mjs.map
|
|
6686
|
-
//# debugId=
|
|
6720
|
+
//# debugId=7376325d-a64e-53ca-8757-5f06b3be132b
|