@powerhousedao/reactor-api 6.2.3-dev.2 → 6.2.3-dev.4
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/{adapter-gateway-apollo-DdamNLPT.mjs → adapter-gateway-apollo-CxJNBVyD.mjs} +7 -8
- package/dist/adapter-gateway-apollo-CxJNBVyD.mjs.map +1 -0
- package/dist/adapter-gateway-apollo-DowrX6E_.mjs +4 -0
- package/dist/{adapter-gateway-mercurius-CLmTtNJC.mjs → adapter-gateway-mercurius-CZVy88Za.mjs} +6 -5
- package/dist/adapter-gateway-mercurius-CZVy88Za.mjs.map +1 -0
- package/dist/adapter-gateway-stitching-CaZjvRzx.mjs +316 -0
- package/dist/adapter-gateway-stitching-CaZjvRzx.mjs.map +1 -0
- package/dist/{adapter-http-express-54gdI9bu.mjs → adapter-http-express-B39rPhqH.mjs} +4 -4
- package/dist/{adapter-http-express-54gdI9bu.mjs.map → adapter-http-express-B39rPhqH.mjs.map} +1 -1
- package/dist/{adapter-http-fastify-DmccBVOe.mjs → adapter-http-fastify-BwXO6rqE.mjs} +4 -4
- package/dist/{adapter-http-fastify-DmccBVOe.mjs.map → adapter-http-fastify-BwXO6rqE.mjs.map} +1 -1
- package/dist/index.d.mts +46 -13
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +114 -38
- package/dist/index.mjs.map +1 -1
- package/dist/{path-normalize-DWWFLiy6.mjs → path-normalize-BOQwY9wR.mjs} +3 -3
- package/dist/{path-normalize-DWWFLiy6.mjs.map → path-normalize-BOQwY9wR.mjs.map} +1 -1
- package/dist/src/packages/vite-loader.d.mts +1 -1
- package/dist/src/packages/vite-loader.d.mts.map +1 -1
- package/dist/src/packages/vite-loader.mjs +5 -5
- package/dist/src/packages/vite-loader.mjs.map +1 -1
- package/dist/{types-Bz2niABC.d.mts → types-DcYyNcHJ.d.mts} +1 -1
- package/dist/{types-Bz2niABC.d.mts.map → types-DcYyNcHJ.d.mts.map} +1 -1
- package/package.json +17 -14
- package/dist/adapter-gateway-apollo-DdamNLPT.mjs.map +0 -1
- package/dist/adapter-gateway-mercurius-CLmTtNJC.mjs.map +0 -1
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]="a15aa3df-1a6d-517d-93c4-3e8a84cefd09")}catch(e){}}();
|
|
3
3
|
import { _ as createAuthorizationService, a as isSubgraphClass, b as MalformedStoredOperationError, d as loadSubgraphs, f as BaseSubgraph, g as AuthorizedDocumentHandle, h as AuthorizationPolicy, i as buildGraphqlOperations, l as loadDocumentModels, m as createCanonicalDocumentIdResolver, n as buildGraphQlDriveDocument, o as debounce, p as CanonicalDocumentIdResolutionError, r as buildGraphqlOperation, s as extractUpgradeManifests, t as buildGraphQlDocument, u as loadProcessors, v as AuthEvaluationUnsupportedError, y as ForbiddenError } from "./utils-XWVecaNn.mjs";
|
|
4
4
|
import { AnalyticsQueryEngine } from "@powerhousedao/analytics-engine-core";
|
|
5
5
|
import { AnalyticsModel, AnalyticsResolvers, typedefs } from "@powerhousedao/analytics-engine-graphql";
|
|
@@ -311,28 +311,40 @@ function createAuthFetchMiddleware(authService) {
|
|
|
311
311
|
async function createGatewayAdapter(type, logger) {
|
|
312
312
|
switch (type) {
|
|
313
313
|
case "apollo": {
|
|
314
|
-
const { ApolloGatewayAdapter } = await import("./adapter-gateway-apollo-
|
|
314
|
+
const { ApolloGatewayAdapter } = await import("./adapter-gateway-apollo-DowrX6E_.mjs");
|
|
315
315
|
return new ApolloGatewayAdapter(logger);
|
|
316
316
|
}
|
|
317
317
|
case "mercurius": {
|
|
318
|
-
const { MercuriusGatewayAdapter } = await import("./adapter-gateway-mercurius-
|
|
318
|
+
const { MercuriusGatewayAdapter } = await import("./adapter-gateway-mercurius-CZVy88Za.mjs");
|
|
319
319
|
return new MercuriusGatewayAdapter(logger);
|
|
320
320
|
}
|
|
321
|
+
case "stitching": {
|
|
322
|
+
const { StitchingGatewayAdapter } = await import("./adapter-gateway-stitching-CaZjvRzx.mjs");
|
|
323
|
+
return new StitchingGatewayAdapter(logger);
|
|
324
|
+
}
|
|
321
325
|
}
|
|
322
326
|
}
|
|
323
327
|
async function createHttpAdapter(type) {
|
|
324
328
|
switch (type) {
|
|
325
329
|
case "express": {
|
|
326
|
-
const { createExpressHttpAdapter } = await import("./adapter-http-express-
|
|
330
|
+
const { createExpressHttpAdapter } = await import("./adapter-http-express-B39rPhqH.mjs");
|
|
327
331
|
return createExpressHttpAdapter();
|
|
328
332
|
}
|
|
329
333
|
case "fastify": {
|
|
330
|
-
const { createFastifyHttpAdapter } = await import("./adapter-http-fastify-
|
|
334
|
+
const { createFastifyHttpAdapter } = await import("./adapter-http-fastify-BwXO6rqE.mjs");
|
|
331
335
|
return createFastifyHttpAdapter();
|
|
332
336
|
}
|
|
333
337
|
}
|
|
334
338
|
}
|
|
335
339
|
//#endregion
|
|
340
|
+
//#region src/graphql/gateway/types.ts
|
|
341
|
+
/** No authenticated caller resolved, and REQUIRE_AUTHENTICATED_CALLER wants one. */
|
|
342
|
+
const WS_CLOSE_REASON_AUTHENTICATION_REQUIRED = "authentication-required";
|
|
343
|
+
/** A bearer was sent and could not be verified. */
|
|
344
|
+
const WS_CLOSE_REASON_BEARER_REJECTED = "bearer-rejected";
|
|
345
|
+
/** Every reason a refusal closes with, for a client matching on the set. */
|
|
346
|
+
const WS_AUTH_CLOSE_REASONS = [WS_CLOSE_REASON_AUTHENTICATION_REQUIRED, WS_CLOSE_REASON_BEARER_REJECTED];
|
|
347
|
+
//#endregion
|
|
336
348
|
//#region src/http/namespace.ts
|
|
337
349
|
/**
|
|
338
350
|
* A package's namespace is its npm name, used verbatim as one or two path
|
|
@@ -3781,6 +3793,7 @@ function pollSyncEnvelopes(syncManager, args, forbiddenIds = /* @__PURE__ */ new
|
|
|
3781
3793
|
} catch (error) {
|
|
3782
3794
|
throw new GraphQLError(`Channel not found: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3783
3795
|
}
|
|
3796
|
+
remote.channel.notePoll();
|
|
3784
3797
|
const deadLetters = remote.channel.deadLetter.items.filter((syncOp) => !forbiddenIds.has(syncOp.documentId) && !heldOpIds.has(syncOp.id)).map((syncOp) => ({
|
|
3785
3798
|
documentId: syncOp.documentId,
|
|
3786
3799
|
error: syncOp.error?.message ?? "Unknown error",
|
|
@@ -3905,6 +3918,7 @@ function pushSyncEnvelopes(syncManager, args) {
|
|
|
3905
3918
|
throw new GraphQLError(`Channel not found: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3906
3919
|
}
|
|
3907
3920
|
if (!envelope.operations || envelope.operations.length === 0) continue;
|
|
3921
|
+
remote.channel.notePoll();
|
|
3908
3922
|
const syncOps = envelopesToSyncOperations(envelope, remote.meta.name);
|
|
3909
3923
|
if (!remoteSyncOps.has(remote)) remoteSyncOps.set(remote, []);
|
|
3910
3924
|
remoteSyncOps.get(remote).push(...syncOps);
|
|
@@ -4308,6 +4322,32 @@ const DefaultFeatureFlags = { enableDocumentModelSubgraphs: true };
|
|
|
4308
4322
|
* regenerateDocumentModelSubgraphs).
|
|
4309
4323
|
*/
|
|
4310
4324
|
const DOCUMENT_MODEL_SUBGRAPH_SOURCE = "document-models";
|
|
4325
|
+
function refuseConnection(connection, reason) {
|
|
4326
|
+
const { socket } = connection;
|
|
4327
|
+
socket?.close?.(4403, reason);
|
|
4328
|
+
return false;
|
|
4329
|
+
}
|
|
4330
|
+
function createWsAuthHandlers(opts) {
|
|
4331
|
+
const resolved = /* @__PURE__ */ new WeakMap();
|
|
4332
|
+
return {
|
|
4333
|
+
onConnect: async (connectionParams, connection) => {
|
|
4334
|
+
let user = null;
|
|
4335
|
+
if (opts.authService) try {
|
|
4336
|
+
user = await opts.authService.authenticateWebSocketConnection(connectionParams);
|
|
4337
|
+
} catch (error) {
|
|
4338
|
+
opts.logger.warn("Refusing WebSocket connection: @error", error instanceof Error ? error.message : error);
|
|
4339
|
+
return refuseConnection(connection, WS_CLOSE_REASON_BEARER_REJECTED);
|
|
4340
|
+
}
|
|
4341
|
+
if (user === null && opts.requireAuthenticatedCaller()) {
|
|
4342
|
+
opts.logger.warn("Refusing anonymous WebSocket connection: an authenticated caller is required");
|
|
4343
|
+
return refuseConnection(connection, WS_CLOSE_REASON_AUTHENTICATION_REQUIRED);
|
|
4344
|
+
}
|
|
4345
|
+
resolved.set(connection, user ?? void 0);
|
|
4346
|
+
return true;
|
|
4347
|
+
},
|
|
4348
|
+
context: (connectionParams, connection) => Promise.resolve(opts.buildContext(connectionParams, resolved.get(connection)))
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4311
4351
|
var GraphQLManager = class {
|
|
4312
4352
|
initialized = false;
|
|
4313
4353
|
coreSubgraphsMap = /* @__PURE__ */ new Map();
|
|
@@ -4380,13 +4420,17 @@ var GraphQLManager = class {
|
|
|
4380
4420
|
this.httpAdapter.setupMiddleware({ bodyLimit: "50mb" });
|
|
4381
4421
|
const driveRoutePath = path.posix.join(this.path, "d/:drive");
|
|
4382
4422
|
const driveMatcher = match(driveRoutePath);
|
|
4383
|
-
|
|
4423
|
+
const driveInfoHandler = async (request) => {
|
|
4384
4424
|
const url = new URL(request.url);
|
|
4385
4425
|
const matched = driveMatcher(url.pathname);
|
|
4386
4426
|
const driveIdOrSlug = matched ? matched.params.drive : void 0;
|
|
4387
4427
|
if (!driveIdOrSlug) return Response.json({ error: "Drive ID or slug is required" }, { status: 400 });
|
|
4388
4428
|
try {
|
|
4389
4429
|
const driveDoc = await this.reactorClient.get(driveIdOrSlug);
|
|
4430
|
+
if (!await this.authorizationService.canRead(driveDoc.header.id, getAuthContext(request)?.user?.address)) {
|
|
4431
|
+
this.logger.debug(`Drive read refused: ${driveIdOrSlug}`);
|
|
4432
|
+
return Response.json({ error: "Drive not found" }, { status: 404 });
|
|
4433
|
+
}
|
|
4390
4434
|
const graphqlEndpoint = `${(request.headers.get("x-forwarded-proto")?.split(",")[0].trim() ?? url.protocol.replace(":", "")) + ":"}//${request.headers.get("x-forwarded-host")?.split(",")[0].trim() ?? request.headers.get("host") ?? ""}${(request.headers.get("x-forwarded-prefix")?.split(",")[0].trim().replace(/\/$/, "") ?? "") + (this.path === "/" ? "" : this.path)}/graphql/r`;
|
|
4391
4435
|
return Response.json({
|
|
4392
4436
|
id: driveDoc.header.id,
|
|
@@ -4400,7 +4444,8 @@ var GraphQLManager = class {
|
|
|
4400
4444
|
this.logger.debug(`Drive not found: ${driveIdOrSlug}`, error);
|
|
4401
4445
|
return Response.json({ error: "Drive not found" }, { status: 404 });
|
|
4402
4446
|
}
|
|
4403
|
-
}
|
|
4447
|
+
};
|
|
4448
|
+
this.httpAdapter.mount(driveRoutePath, this.#authMiddleware ? this.#authMiddleware(driveInfoHandler) : driveInfoHandler);
|
|
4404
4449
|
this.logger.info(`Registered REST endpoint: GET ${driveRoutePath}`);
|
|
4405
4450
|
await this.#setupCoreSubgraphs("graphql", coreSubgraphs);
|
|
4406
4451
|
if (this.featureFlags.enableDocumentModelSubgraphs) await this.#setupDocumentModelSubgraphs("graphql", models);
|
|
@@ -4691,17 +4736,6 @@ var GraphQLManager = class {
|
|
|
4691
4736
|
...fields
|
|
4692
4737
|
};
|
|
4693
4738
|
}
|
|
4694
|
-
async #createWebSocketContext(connectionParams) {
|
|
4695
|
-
let user = null;
|
|
4696
|
-
if (this.authService) user = await this.authService.authenticateWebSocketConnection(connectionParams);
|
|
4697
|
-
const context = {
|
|
4698
|
-
headers: connectionParams,
|
|
4699
|
-
db: this.relationalDb,
|
|
4700
|
-
...this.getAdditionalContextFields()
|
|
4701
|
-
};
|
|
4702
|
-
if (user) context.user = user;
|
|
4703
|
-
return context;
|
|
4704
|
-
}
|
|
4705
4739
|
#makeContextFactory() {
|
|
4706
4740
|
return (request) => {
|
|
4707
4741
|
const authCtx = getAuthContext(request);
|
|
@@ -4720,7 +4754,20 @@ var GraphQLManager = class {
|
|
|
4720
4754
|
};
|
|
4721
4755
|
}
|
|
4722
4756
|
#makeWsContextFactory() {
|
|
4723
|
-
return (
|
|
4757
|
+
return createWsAuthHandlers({
|
|
4758
|
+
authService: this.authService,
|
|
4759
|
+
requireAuthenticatedCaller: () => this.#requireAuthMiddleware !== void 0,
|
|
4760
|
+
logger: this.logger,
|
|
4761
|
+
buildContext: (connectionParams, user) => {
|
|
4762
|
+
const context = {
|
|
4763
|
+
headers: connectionParams,
|
|
4764
|
+
db: this.relationalDb,
|
|
4765
|
+
...this.getAdditionalContextFields()
|
|
4766
|
+
};
|
|
4767
|
+
if (user) context.user = user;
|
|
4768
|
+
return context;
|
|
4769
|
+
}
|
|
4770
|
+
});
|
|
4724
4771
|
}
|
|
4725
4772
|
setSupergraph(supergraph, subgraphs) {
|
|
4726
4773
|
const accepted = [];
|
|
@@ -4823,11 +4870,15 @@ var GraphQLManager = class {
|
|
|
4823
4870
|
#getSubgraphDefinitions() {
|
|
4824
4871
|
const subgraphs = this.#getAllSubgraphs();
|
|
4825
4872
|
const herokuOrLocal = process.env.HEROKU_APP_DEFAULT_DOMAIN_NAME ? `https://${process.env.HEROKU_APP_DEFAULT_DOMAIN_NAME}` : `http://localhost:${this.port}`;
|
|
4826
|
-
return Array.from(subgraphs.entries()).map(([subgraphPath, subgraph]) =>
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4873
|
+
return Array.from(subgraphs.entries()).map(([subgraphPath, subgraph]) => {
|
|
4874
|
+
const module = this.#buildSubgraphSchemaModule(subgraph);
|
|
4875
|
+
return {
|
|
4876
|
+
name: subgraphPath.replace("/", ":"),
|
|
4877
|
+
typeDefs: module.typeDefs,
|
|
4878
|
+
resolvers: module.resolvers,
|
|
4879
|
+
url: `${herokuOrLocal}${subgraphPath}`
|
|
4880
|
+
};
|
|
4881
|
+
});
|
|
4831
4882
|
}
|
|
4832
4883
|
async #createSupergraphGateway() {
|
|
4833
4884
|
const superGraphPath = path.posix.join(this.path, "graphql");
|
|
@@ -5519,14 +5570,18 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
5519
5570
|
* queued for the adopter.
|
|
5520
5571
|
*
|
|
5521
5572
|
* The refusal is the shape a read denial takes, so a puller treats it as a
|
|
5522
|
-
* signal to authenticate again rather than as a transport failure.
|
|
5573
|
+
* signal to authenticate again rather than as a transport failure. Pushes are
|
|
5574
|
+
* refused the same way -- a push interacts with the same private queue, and
|
|
5575
|
+
* reports the liveness that keeps it from being reclaimed -- but they never
|
|
5576
|
+
* adopt, since the push path has no drive check to clear the claimant.
|
|
5523
5577
|
*
|
|
5524
5578
|
* Nothing is enforced or adopted without a serving gate. Below
|
|
5525
5579
|
* `authEnforcement` there is no policy being enforced for the channel to
|
|
5526
5580
|
* belong to, and refusing a poll there would break sync for no gain.
|
|
5527
5581
|
*/
|
|
5528
|
-
async #bindOrRefuseChannel(channelId, ctx) {
|
|
5582
|
+
async #bindOrRefuseChannel(channelId, ctx, options = {}) {
|
|
5529
5583
|
if (!this.syncServingGate) return;
|
|
5584
|
+
const { adopt = true, action = "poll" } = options;
|
|
5530
5585
|
let remote;
|
|
5531
5586
|
try {
|
|
5532
5587
|
remote = this.syncManager.getById(channelId);
|
|
@@ -5536,10 +5591,10 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
5536
5591
|
const bound = remote.meta.options.boundAddress;
|
|
5537
5592
|
const address = ctx.user?.address;
|
|
5538
5593
|
if (bound === void 0) {
|
|
5539
|
-
if (address !== void 0) await this.syncManager.bindRemote(channelId, address);
|
|
5594
|
+
if (adopt && address !== void 0) await this.syncManager.bindRemote(channelId, address);
|
|
5540
5595
|
return;
|
|
5541
5596
|
}
|
|
5542
|
-
if (bound !== address) throw new ForbiddenError(
|
|
5597
|
+
if (bound !== address) throw new ForbiddenError(`to ${action} this sync channel`);
|
|
5543
5598
|
}
|
|
5544
5599
|
/** The address a channel created by this request belongs to, if any. */
|
|
5545
5600
|
#creatorBinding(ctx) {
|
|
@@ -5920,6 +5975,16 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
5920
5975
|
pushSyncEnvelopes: async (_parent, args, ctx) => {
|
|
5921
5976
|
this.logger.debug("pushSyncEnvelopes(@args)", args);
|
|
5922
5977
|
try {
|
|
5978
|
+
const boundChannelIds = /* @__PURE__ */ new Set();
|
|
5979
|
+
for (const envelope of args.envelopes) {
|
|
5980
|
+
const channelId = envelope.channelMeta.id;
|
|
5981
|
+
if (boundChannelIds.has(channelId)) continue;
|
|
5982
|
+
boundChannelIds.add(channelId);
|
|
5983
|
+
await this.#bindOrRefuseChannel(channelId, ctx, {
|
|
5984
|
+
adopt: false,
|
|
5985
|
+
action: "push to"
|
|
5986
|
+
});
|
|
5987
|
+
}
|
|
5923
5988
|
const checkedOperations = /* @__PURE__ */ new Map();
|
|
5924
5989
|
for (const envelope of args.envelopes) for (const op of envelope.operations ?? []) {
|
|
5925
5990
|
const documentId = op.context.documentId;
|
|
@@ -6023,10 +6088,10 @@ const ADMIN_USERS = getAdminUsers();
|
|
|
6023
6088
|
//#endregion
|
|
6024
6089
|
//#region src/graphql/system/version.ts
|
|
6025
6090
|
function getVersion() {
|
|
6026
|
-
return "6.2.3-dev.
|
|
6091
|
+
return "6.2.3-dev.4";
|
|
6027
6092
|
}
|
|
6028
6093
|
function getGitHash() {
|
|
6029
|
-
return "
|
|
6094
|
+
return "e30f072e1e13237f4a9ce0f7c5ca18700cab7845";
|
|
6030
6095
|
}
|
|
6031
6096
|
function getGitUrl() {
|
|
6032
6097
|
return buildTreeUrl(getGitHash());
|
|
@@ -6984,13 +7049,11 @@ var AuthService = class {
|
|
|
6984
7049
|
return new Response(JSON.stringify({ error: "Authentication failed" }), { status: 401 });
|
|
6985
7050
|
}
|
|
6986
7051
|
}
|
|
7052
|
+
/** Throws only for a bearer that is present and unusable, as HTTP 401s it. */
|
|
6987
7053
|
async authenticateWebSocketConnection(connectionParams) {
|
|
6988
7054
|
if (!this.resolvesIdentity) return null;
|
|
6989
7055
|
const authHeader = connectionParams.authorization;
|
|
6990
|
-
if (!authHeader)
|
|
6991
|
-
if (!this.config.enabled) return null;
|
|
6992
|
-
throw new Error("Missing authorization in connection parameters");
|
|
6993
|
-
}
|
|
7056
|
+
if (!authHeader) return null;
|
|
6994
7057
|
const token = authHeader.split(" ")[1];
|
|
6995
7058
|
if (!token) throw new Error("Invalid authorization format");
|
|
6996
7059
|
const verified = await this.verifyToken(token);
|
|
@@ -7676,10 +7739,23 @@ function buildSyncServingGate(reactorModule, authorizationConfig, logger) {
|
|
|
7676
7739
|
return new SyncScopeGate(new ModelReadGate(model, reactorModule.documentView, reactorModule.featureFlags.authGroups, reactorModule.operationIndex, logger, { withholdUninitialized: authorizationConfig.defaultProtection }), reactorModule.documentView, logger);
|
|
7677
7740
|
}
|
|
7678
7741
|
/**
|
|
7742
|
+
* Resolves the gateway adapter type from the `GATEWAY_ADAPTER` env var.
|
|
7743
|
+
* Defaults to "apollo" (the federation gateway, production behavior).
|
|
7744
|
+
* "stitching" selects the in-process graphql-tools merge gateway (#1565
|
|
7745
|
+
* prototype); "mercurius" the Fastify federation gateway.
|
|
7746
|
+
*/
|
|
7747
|
+
function resolveGatewayAdapterType(logger) {
|
|
7748
|
+
const configured = process.env.GATEWAY_ADAPTER;
|
|
7749
|
+
if (configured === void 0) return "apollo";
|
|
7750
|
+
if (configured === "apollo" || configured === "mercurius" || configured === "stitching") return configured;
|
|
7751
|
+
logger.warn(`Unknown GATEWAY_ADAPTER="${configured}"; falling back to "apollo"`);
|
|
7752
|
+
return "apollo";
|
|
7753
|
+
}
|
|
7754
|
+
/**
|
|
7679
7755
|
* Sets up the subgraph manager and registers subgraphs
|
|
7680
7756
|
*/
|
|
7681
7757
|
async function setupGraphQLManager(httpAdapter, authFetchMiddleware, requireAuthFetchMiddleware, httpServer, wsServer, client, relationalDb, analyticsStore, syncManager, subgraphs, logger, authorizationService, authService, documentPermissionService, enableDocumentModelSubgraphs, port, reactorDriveClient, syncServingGate, httpRoutes) {
|
|
7682
|
-
const graphqlManager = new GraphQLManager(config.basePath, httpServer, wsServer, client, relationalDb, analyticsStore, syncManager, logger, httpAdapter, await createGatewayAdapter(
|
|
7758
|
+
const graphqlManager = new GraphQLManager(config.basePath, httpServer, wsServer, client, relationalDb, analyticsStore, syncManager, logger, httpAdapter, await createGatewayAdapter(resolveGatewayAdapterType(logger), logger), authService, documentPermissionService, { enableDocumentModelSubgraphs }, port, authorizationService, reactorDriveClient, syncServingGate, httpRoutes);
|
|
7683
7759
|
await graphqlManager.init(subgraphs.core, authFetchMiddleware, requireAuthFetchMiddleware);
|
|
7684
7760
|
for (const [packageName, collection] of subgraphs.extended.entries()) for (const subgraph of collection) await graphqlManager.registerSubgraph(subgraph, "graphql", false, packageName);
|
|
7685
7761
|
await graphqlManager.updateRouter();
|
|
@@ -7872,7 +7948,7 @@ async function _setupCommonInfrastructure(options) {
|
|
|
7872
7948
|
if (requireAuthenticatedCaller) {
|
|
7873
7949
|
requireAuthFetchMiddleware = createRequireAuthFetchMiddleware();
|
|
7874
7950
|
logger.info("Require-authenticated-caller middleware enabled: anonymous callers are rejected with a 401 before any subgraph");
|
|
7875
|
-
}
|
|
7951
|
+
} else logger.warn("Anonymous callers are admitted on every transport, including WebSocket subscriptions: REQUIRE_AUTHENTICATED_CALLER is not set. The authorization policy gates the reactor's own documents, but a package-provided subgraph authorizes nothing on its own. Set REQUIRE_AUTHENTICATED_CALLER=true to refuse anonymous callers before any subgraph sees them.");
|
|
7876
7952
|
}
|
|
7877
7953
|
const dbClosers = [];
|
|
7878
7954
|
const { relationalDb, analyticsStore, closers: analyticsClosers } = await initializeDatabaseAndAnalytics(options.dbPath, options.pgliteFactory);
|
|
@@ -8222,7 +8298,7 @@ var PackageManagementService = class {
|
|
|
8222
8298
|
}
|
|
8223
8299
|
};
|
|
8224
8300
|
//#endregion
|
|
8225
|
-
export { ADMIN_USERS, ActionCandidateInputSchema, ActionContextInputSchema, ActionInputSchema, AddRelationshipDocument, AnalyticsSubgraph, AttachmentAccessService, AuthDecision, AuthDecisionSchema, AuthService, AuthSubgraph, AuthorizationPolicy, AuthorizedDocumentHandle, BaseSubgraph, CORE_PACKAGE_NAME, CanonicalDocumentIdResolutionError, ChannelMetaInputSchema, CreateDocumentDocument, CreateEmptyDocumentDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentOperationsFilterInputSchema, DocumentPermissionService, EvaluateActionsDocument, FindDocumentsDocument, GetDocumentDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentModelsDocument, GetDocumentOperationsDocument, GetDocumentOutgoingRelationshipsDocument, GetDocumentWithOperationsDocument, GetJobStatusDocument, GraphQLManager, HttpDocumentModelLoader, HttpPackageLoader, HttpRouteService, ImportPackageLoader, InMemoryPackageStorage, InvalidNamespaceError, JobChangesDocument, MemoryWebhookStore, MoveRelationshipDocument, MutateDocumentAsyncDocument, MutateDocumentDocument, OperationContextInputSchema, OperationInputSchema, OperationWithContextInputSchema, OperationsFilterInputSchema, PACKAGE_ROUTE_SEGMENT, PGLITE_UTC_PARSERS, PackageManagementService, PackageManager, PackagesSubgraph, PagingInputSchema, PhDocumentFieldsFragmentDoc, PollSyncEnvelopesDocument, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, ReactorSignerAppInputSchema, ReactorSignerInputSchema, ReactorSignerUserInputSchema, ReactorSubgraph, RelationalWebhookStore, RemoteCursorInputSchema, RemoteFilterInputSchema, RemoveRelationshipDocument, RenameDocumentDocument, SearchFilterInputSchema, SetPreferredEditorDocument, SyncEnvelopeInputSchema, SyncEnvelopeType, SyncEnvelopeTypeSchema, SystemSubgraph, TouchChannelDocument, TouchChannelInputSchema, ViewFilterInputSchema, WEBHOOK_SEGMENT, WebhookService, assertAuthRequiredForDocumentPermissions, assertCredentialVerifierForSource, assertHostMountPath, assertRequireAuthenticatedCallerAllowed, assertSkipCredentialVerificationAllowed, buildGraphQlDocument, buildGraphQlDriveDocument, buildGraphqlOperation, buildGraphqlOperations, buildSubgraphSchemaModule, createAuthFetchMiddleware, createCanonicalDocumentIdResolver, createGatewayAdapter, createHttpAdapter, createMergedSchema, createReactorGraphQLClient, createRenownCredentialVerifier, createSchema, decodeExplorerUrlState, definedNonNullAnySchema, driveIdFromUrl, extractSubgraphsFromModule, generateDocumentModelSchema, getAuthContext, getDbClient, getDocumentModelSchemaName, getDocumentModelTypeDefs, getExplorerPrefix, getGitHash, getGitUrl, getSdk, getUniqueDocumentModels, getUniqueUpgradeManifests, getVersion, initAnalyticsStoreSql, initializeAndStartAPI, isDefinedNonNullAny, isExpectedLoaderMiss, isSubgraphClass, namespacePath, namespaceSegments, newWebhookToken, parseDriveUrl, parseWebhookBody, redactHeaders, renderGraphqlPlayground, resolvePackageName, resolveRenownConfig, verifyWebhook };
|
|
8301
|
+
export { ADMIN_USERS, ActionCandidateInputSchema, ActionContextInputSchema, ActionInputSchema, AddRelationshipDocument, AnalyticsSubgraph, AttachmentAccessService, AuthDecision, AuthDecisionSchema, AuthService, AuthSubgraph, AuthorizationPolicy, AuthorizedDocumentHandle, BaseSubgraph, CORE_PACKAGE_NAME, CanonicalDocumentIdResolutionError, ChannelMetaInputSchema, CreateDocumentDocument, CreateEmptyDocumentDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentOperationsFilterInputSchema, DocumentPermissionService, EvaluateActionsDocument, FindDocumentsDocument, GetDocumentDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentModelsDocument, GetDocumentOperationsDocument, GetDocumentOutgoingRelationshipsDocument, GetDocumentWithOperationsDocument, GetJobStatusDocument, GraphQLManager, HttpDocumentModelLoader, HttpPackageLoader, HttpRouteService, ImportPackageLoader, InMemoryPackageStorage, InvalidNamespaceError, JobChangesDocument, MemoryWebhookStore, MoveRelationshipDocument, MutateDocumentAsyncDocument, MutateDocumentDocument, OperationContextInputSchema, OperationInputSchema, OperationWithContextInputSchema, OperationsFilterInputSchema, PACKAGE_ROUTE_SEGMENT, PGLITE_UTC_PARSERS, PackageManagementService, PackageManager, PackagesSubgraph, PagingInputSchema, PhDocumentFieldsFragmentDoc, PollSyncEnvelopesDocument, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, ReactorSignerAppInputSchema, ReactorSignerInputSchema, ReactorSignerUserInputSchema, ReactorSubgraph, RelationalWebhookStore, RemoteCursorInputSchema, RemoteFilterInputSchema, RemoveRelationshipDocument, RenameDocumentDocument, SearchFilterInputSchema, SetPreferredEditorDocument, SyncEnvelopeInputSchema, SyncEnvelopeType, SyncEnvelopeTypeSchema, SystemSubgraph, TouchChannelDocument, TouchChannelInputSchema, ViewFilterInputSchema, WEBHOOK_SEGMENT, WS_AUTH_CLOSE_REASONS, WS_CLOSE_REASON_AUTHENTICATION_REQUIRED, WS_CLOSE_REASON_BEARER_REJECTED, WebhookService, assertAuthRequiredForDocumentPermissions, assertCredentialVerifierForSource, assertHostMountPath, assertRequireAuthenticatedCallerAllowed, assertSkipCredentialVerificationAllowed, buildGraphQlDocument, buildGraphQlDriveDocument, buildGraphqlOperation, buildGraphqlOperations, buildSubgraphSchemaModule, createAuthFetchMiddleware, createCanonicalDocumentIdResolver, createGatewayAdapter, createHttpAdapter, createMergedSchema, createReactorGraphQLClient, createRenownCredentialVerifier, createSchema, createWsAuthHandlers, decodeExplorerUrlState, definedNonNullAnySchema, driveIdFromUrl, extractSubgraphsFromModule, generateDocumentModelSchema, getAuthContext, getDbClient, getDocumentModelSchemaName, getDocumentModelTypeDefs, getExplorerPrefix, getGitHash, getGitUrl, getSdk, getUniqueDocumentModels, getUniqueUpgradeManifests, getVersion, initAnalyticsStoreSql, initializeAndStartAPI, isDefinedNonNullAny, isExpectedLoaderMiss, isSubgraphClass, namespacePath, namespaceSegments, newWebhookToken, parseDriveUrl, parseWebhookBody, redactHeaders, renderGraphqlPlayground, resolvePackageName, resolveRenownConfig, verifyWebhook };
|
|
8226
8302
|
|
|
8227
8303
|
//# sourceMappingURL=index.mjs.map
|
|
8228
|
-
//# debugId=
|
|
8304
|
+
//# debugId=a15aa3df-1a6d-517d-93c4-3e8a84cefd09
|