@powerhousedao/reactor-api 6.2.3-dev.104 → 6.2.3-dev.105

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.mjs CHANGED
@@ -1,7 +1,7 @@
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]="577fbb83-65ea-558f-a795-e8fa41dfbb1a")}catch(e){}}();
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]="99ad2751-bdef-5035-a0b3-ed1e3e9cc3ab")}catch(e){}}();
3
3
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
4
- import { A as manifestDeclaredSubgraphs, B as applyReadableFilter, C as extractUpgradeManifests, D as loadProcessors, E as loadDocumentModels, F as createCredentialInvalidator, G as AuthorizationPolicy, H as readableDocumentsSubquery, I as DEFAULT_ROOT_TYPES, J as AuthEvaluationUnsupportedError, K as AuthorizedDocumentHandle, L as EVERYONE, M as callerSubject, N as RequestClientBinder, O as loadScalars, P as AuthService, Q as RefusalNotRecordedError, R as READABLE_DOCUMENTS_NAMESPACE, S as debounce, U as CanonicalDocumentIdResolutionError, V as isDocumentListed, W as createCanonicalDocumentIdResolver, X as ForbiddenError, Y as AuthenticationRequiredError, Z as MalformedStoredOperationError, _ as CodeFirstSubgraphError, a as PIECE_SOURCE_LIST, b as runDetached, c as piecesFromCdnList, d as buildGraphQlDocument, f as buildGraphQlDriveDocument, g as codeFirstCheck, h as isSubgraphClass, j as BaseSubgraph, k as loadSubgraphs, l as piecesFromListModule, m as buildGraphqlOperations, n as scalarExportsOf, p as buildGraphqlOperation, q as createAuthorizationService, s as pieceListLocation, t as extractSubgraphs, u as extractDocumentModels, v as compileSubgraphClass, w as failedLoadHeader, x as PACKAGE_MODULE_FAILED, y as reportFailure, z as ReadableDocumentsProjection } from "./subgraph-extraction-D5RG9I-y.mjs";
4
+ import { $ as RefusalNotRecordedError, A as manifestDeclaredSubgraphs, B as ReadableDocumentsProjection, C as extractUpgradeManifests, D as loadProcessors, E as loadDocumentModels, F as NO_LICENCE_MESSAGE, G as createCanonicalDocumentIdResolver, H as isDocumentListed, I as createCredentialInvalidator, J as createAuthorizationService, K as AuthorizationPolicy, L as DEFAULT_ROOT_TYPES, M as callerSubject, N as RequestClientBinder, O as loadScalars, P as AuthService, Q as MalformedStoredOperationError, R as EVERYONE, S as debounce, U as readableDocumentsSubquery, V as applyReadableFilter, W as CanonicalDocumentIdResolutionError, X as AuthenticationRequiredError, Y as AuthEvaluationUnsupportedError, Z as ForbiddenError, _ as CodeFirstSubgraphError, a as PIECE_SOURCE_LIST, b as runDetached, c as piecesFromCdnList, d as buildGraphQlDocument, f as buildGraphQlDriveDocument, g as codeFirstCheck, h as isSubgraphClass, j as BaseSubgraph, k as loadSubgraphs, l as piecesFromListModule, m as buildGraphqlOperations, n as scalarExportsOf, p as buildGraphqlOperation, q as AuthorizedDocumentHandle, s as pieceListLocation, t as extractSubgraphs, u as extractDocumentModels, v as compileSubgraphClass, w as failedLoadHeader, x as PACKAGE_MODULE_FAILED, y as reportFailure, z as READABLE_DOCUMENTS_NAMESPACE } from "./subgraph-extraction-uJ8BR0he.mjs";
5
5
  import { A as getDocumentModelTypeDefs, B as sameScalarRegistry, C as createMergedSchema, D as generateDocumentModelSchema, E as findSubgraphTypeCollisions, F as typeDefinitionNames, I as documentModelSchemaSource, L as selectDocumentModelSchemaSource, M as hasOperationSchemas, N as reservedTypeNames, O as generatedTypesOf, P as reservedTypeNamesTaken, R as getDocumentModelSchemaName, S as buildSubgraphSchemaModule, T as documentModelSubgraphTypes, V as schema_default$1, _ as describeOwnershipConflicts, a as inspectionAdminTypeDefs, b as assembleSubgraphTypeDefs, c as HOST_ORIGIN, d as byClaimPriority, f as decideAdmission, g as collectSubgraphClaims, h as supergraphClaimLosers, i as inspectionTypeDefs, j as getGeneratedDocumentModelTypes, k as getDocumentModelSubgraphName, l as RegistrationOrder, m as documentModelSubgraphSources, n as systemTypeDefs, o as CORE_ORIGIN, p as describeOrigin, r as schema_default$2, s as DOCUMENT_MODEL_ORIGIN, t as baseDocumentModels, u as admitDocumentModels, v as DocumentModelSchemaCache, w as createSchema, x as buildDocumentModelSchema, y as SubgraphTypeCollisionError, z as EMPTY_SCALAR_REGISTRY } from "./base-document-models-caJpqTLw.mjs";
6
6
  import { n as createApolloFetchHandler } from "./adapter-gateway-apollo-D-EdZ4e-.mjs";
7
7
  import { _ as PGLITE_UTC_PARSERS, a as resolvePgliteMaintenance, r as createDurableNodeFs } from "./error-info-Cr6oQACe.mjs";
@@ -314,7 +314,14 @@ function reactorApiConfigFromEnv(env, logger = defaultLogger$1) {
314
314
  }),
315
315
  skipCredentialVerification: exactlyTrue(env.SKIP_CREDENTIAL_VERIFICATION),
316
316
  credentialCacheTtlMs: parseCredentialCacheTtlMs(env.CREDENTIAL_VERIFICATION_CACHE_TTL_MS, logger),
317
- wsRecheckMs: env.WS_CREDENTIAL_RECHECK_INTERVAL_MS === void 0 ? void 0 : validOrUnset(env.WS_CREDENTIAL_RECHECK_INTERVAL_MS, (raw) => resolveWsCredentialRecheckIntervalMs(raw, logger), isWsRecheckMs)
317
+ wsRecheckMs: env.WS_CREDENTIAL_RECHECK_INTERVAL_MS === void 0 ? void 0 : validOrUnset(env.WS_CREDENTIAL_RECHECK_INTERVAL_MS, (raw) => resolveWsCredentialRecheckIntervalMs(raw, logger), isWsRecheckMs),
318
+ access: pruned({
319
+ mode: env.ACCESS?.trim().toLowerCase() || void 0,
320
+ gateUrl: env.VETRA_GATE_URL?.trim() || void 0,
321
+ gateToken: env.VETRA_GATE_TOKEN?.trim() || void 0,
322
+ appId: env.VETRA_APP_ID?.trim() || void 0,
323
+ graceMs: parseAccessGateGraceMs(env.ACCESS_GATE_GRACE_MS, logger)
324
+ })
318
325
  }),
319
326
  inspection: pruned({ admin: exactlyTrue(env.INSPECTION_ADMIN_ENABLED) }),
320
327
  attachments: pruned({ storage: env.PH_ATTACHMENT_STORAGE === void 0 ? void 0 : parseAttachmentStorageConfig(env) })
@@ -339,6 +346,12 @@ function isWsRecheckMs(raw) {
339
346
  function exactlyTrue(value) {
340
347
  return value === void 0 ? void 0 : value === "true";
341
348
  }
349
+ function parseAccessGateGraceMs(raw, logger) {
350
+ if (raw === void 0 || raw.trim() === "") return void 0;
351
+ const parsed = Number(raw);
352
+ if (Number.isInteger(parsed) && parsed >= 0) return parsed;
353
+ logger.warn(`Ignoring invalid ACCESS_GATE_GRACE_MS="${raw}" (expected a non-negative integer of milliseconds) — using the default`);
354
+ }
342
355
  function parseGatewayAdapter(value, logger) {
343
356
  if (value === void 0) return void 0;
344
357
  if (value === "apollo" || value === "mercurius" || value === "stitching") return value;
@@ -6045,6 +6058,7 @@ var GraphQLManager = class {
6045
6058
  const driveIdOrSlug = matched ? matched.params.drive : void 0;
6046
6059
  if (!driveIdOrSlug) return Response.json({ error: "Drive ID or slug is required" }, { status: 400 });
6047
6060
  const user = getAuthContext(request)?.user;
6061
+ if (!user && this.authService?.refusesAnonymousCallers) return Response.json({ error: "Authentication required" }, { status: 401 });
6048
6062
  try {
6049
6063
  const driveDoc = await this.#readClient.get(driveIdOrSlug, { subject: callerSubject(user) });
6050
6064
  if (!await this.authorizationService.canRead(driveDoc.header.id, user?.address)) {
@@ -9191,10 +9205,10 @@ const ADMIN_USERS = new Proxy([], {
9191
9205
  //#endregion
9192
9206
  //#region src/graphql/system/version.ts
9193
9207
  function getVersion() {
9194
- return "6.2.3-dev.104";
9208
+ return "6.2.3-dev.105";
9195
9209
  }
9196
9210
  function getGitHash() {
9197
- return "a16dea664a6e907a421f954f73640de012c100c1";
9211
+ return "6213598c00b5f32ee004638ba7d8d5afa3ce414b";
9198
9212
  }
9199
9213
  function getGitUrl() {
9200
9214
  return buildTreeUrl(getGitHash());
@@ -11524,6 +11538,169 @@ function setupEventListeners(pkgManager, graphqlManager, reactorProcessorManager
11524
11538
  });
11525
11539
  }
11526
11540
  //#endregion
11541
+ //#region src/services/access-gate.ts
11542
+ const DEFAULT_ACCESS_GATE_TIMEOUT_MS = 5e3;
11543
+ const DEFAULT_ACCESS_GATE_TTL_MS = 6e4;
11544
+ const DEFAULT_ACCESS_GATE_GRACE_MS = 864e5;
11545
+ const DEFAULT_ACCESS_GATE_MAX_ENTRIES = 1e4;
11546
+ const MIN_TTL_MS = 1e3;
11547
+ const MAX_TTL_MS = 3e5;
11548
+ /** A failing Vetra is asked at most once per address per this long. */
11549
+ const UNAVAILABLE_BACKOFF_MS = 5e3;
11550
+ const LOG_INTERVAL_MS = 6e4;
11551
+ const REFUSED = {
11552
+ allowed: false,
11553
+ source: "refused"
11554
+ };
11555
+ /**
11556
+ * The `ACCESS=licensed` client of Vetra's licence gate.
11557
+ *
11558
+ * - Answers (allowed or not) are cached per address for Vetra's `ttlSeconds`,
11559
+ * clamped to 1-300 s; concurrent checks of one address share one request.
11560
+ * - While Vetra is unreachable (network error, timeout, 429, 5xx, any other
11561
+ * unexpected answer) an address Vetra allowed within `graceMs` stays
11562
+ * allowed; a never-seen address is refused. It never fails open.
11563
+ * - A 401 (the token is bad or revoked) or 400 is final: it is never answered
11564
+ * from grace, and it drops the address's last positive answer.
11565
+ */
11566
+ function createVetraAccessGate(o) {
11567
+ const doFetch = o.fetch ?? globalThis.fetch.bind(globalThis);
11568
+ const now = o.now ?? Date.now;
11569
+ const timeoutMs = o.timeoutMs ?? 5e3;
11570
+ const defaultTtlMs = o.defaultTtlMs ?? 6e4;
11571
+ const graceMs = o.graceMs ?? 864e5;
11572
+ const maxEntries = Math.max(1, o.maxEntries ?? 1e4);
11573
+ const logger = o.logger ?? childLogger(["reactor-api", "access-gate"]);
11574
+ const entries = /* @__PURE__ */ new Map();
11575
+ let lastWarnAt = -Infinity;
11576
+ let lastErrorAt = -Infinity;
11577
+ const redact = (text) => o.token ? text.split(o.token).join("[redacted]") : text;
11578
+ function graceVerdict(entry, at) {
11579
+ return entry.lastPositiveAt !== void 0 && at - entry.lastPositiveAt <= graceMs ? {
11580
+ allowed: true,
11581
+ source: "grace"
11582
+ } : REFUSED;
11583
+ }
11584
+ function entryFor(address) {
11585
+ let entry = entries.get(address);
11586
+ if (!entry) {
11587
+ entry = {};
11588
+ entries.set(address, entry);
11589
+ while (entries.size > maxEntries) {
11590
+ const oldest = entries.keys().next().value;
11591
+ if (oldest === void 0) break;
11592
+ entries.delete(oldest);
11593
+ }
11594
+ }
11595
+ return entry;
11596
+ }
11597
+ async function ask(address) {
11598
+ const controller = new AbortController();
11599
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
11600
+ try {
11601
+ const headers = {
11602
+ authorization: `Bearer ${o.token}`,
11603
+ "content-type": "application/json"
11604
+ };
11605
+ if (o.appId) headers["x-vetra-app-id"] = o.appId;
11606
+ const response = await doFetch(o.url, {
11607
+ method: "POST",
11608
+ headers,
11609
+ body: JSON.stringify({ address }),
11610
+ signal: controller.signal
11611
+ });
11612
+ if (response.status === 401 || response.status === 400) return {
11613
+ kind: "rejected",
11614
+ status: response.status
11615
+ };
11616
+ if (response.status !== 200) return {
11617
+ kind: "unavailable",
11618
+ reason: `HTTP ${response.status}`
11619
+ };
11620
+ const body = await response.json().catch(() => void 0);
11621
+ if (typeof body?.allowed !== "boolean") return {
11622
+ kind: "unavailable",
11623
+ reason: "an unreadable answer"
11624
+ };
11625
+ return {
11626
+ kind: "answer",
11627
+ allowed: body.allowed,
11628
+ ttlMs: ttlMsOf(body.ttlSeconds, defaultTtlMs)
11629
+ };
11630
+ } catch (error) {
11631
+ return {
11632
+ kind: "unavailable",
11633
+ reason: controller.signal.aborted ? `no answer within ${timeoutMs} ms` : error instanceof Error ? `${error.name}: ${error.message}` : "a network error"
11634
+ };
11635
+ } finally {
11636
+ clearTimeout(timer);
11637
+ }
11638
+ }
11639
+ function record(entry, outcome) {
11640
+ const at = now();
11641
+ switch (outcome.kind) {
11642
+ case "answer":
11643
+ entry.fresh = {
11644
+ allowed: outcome.allowed,
11645
+ expiresAt: at + outcome.ttlMs
11646
+ };
11647
+ entry.retryAt = void 0;
11648
+ entry.lastPositiveAt = outcome.allowed ? at : void 0;
11649
+ return {
11650
+ allowed: outcome.allowed,
11651
+ source: "gate"
11652
+ };
11653
+ case "rejected":
11654
+ entry.fresh = void 0;
11655
+ entry.lastPositiveAt = void 0;
11656
+ entry.retryAt = at + UNAVAILABLE_BACKOFF_MS;
11657
+ if (at - lastErrorAt >= LOG_INTERVAL_MS) {
11658
+ lastErrorAt = at;
11659
+ logger.error(outcome.status === 401 ? "Vetra refused the gate token (401): only ADMINS can sign in" : "Vetra refused the gate check (400): only ADMINS can sign in");
11660
+ }
11661
+ return REFUSED;
11662
+ case "unavailable":
11663
+ entry.fresh = void 0;
11664
+ entry.retryAt = at + UNAVAILABLE_BACKOFF_MS;
11665
+ if (at - lastWarnAt >= LOG_INTERVAL_MS) {
11666
+ lastWarnAt = at;
11667
+ logger.warn("Vetra's licence gate is unavailable (@reason): admitting only ADMINS and callers Vetra allowed in the last @hours h", redact(outcome.reason), Math.round(graceMs / 36e5 * 10) / 10);
11668
+ }
11669
+ return graceVerdict(entry, at);
11670
+ }
11671
+ }
11672
+ async function check(address) {
11673
+ try {
11674
+ const at = now();
11675
+ const entry = entryFor(address);
11676
+ if (entry.fresh && entry.fresh.expiresAt > at) return {
11677
+ allowed: entry.fresh.allowed,
11678
+ source: "cache"
11679
+ };
11680
+ if (entry.inflight) return await entry.inflight;
11681
+ if (entry.retryAt !== void 0 && entry.retryAt > at) return graceVerdict(entry, at);
11682
+ const inflight = (async () => {
11683
+ try {
11684
+ return record(entry, await ask(address));
11685
+ } catch {
11686
+ return REFUSED;
11687
+ } finally {
11688
+ entry.inflight = void 0;
11689
+ }
11690
+ })();
11691
+ entry.inflight = inflight;
11692
+ return await inflight;
11693
+ } catch {
11694
+ return REFUSED;
11695
+ }
11696
+ }
11697
+ return { check };
11698
+ }
11699
+ function ttlMsOf(ttlSeconds, defaultTtlMs) {
11700
+ if (typeof ttlSeconds !== "number" || !Number.isFinite(ttlSeconds)) return defaultTtlMs;
11701
+ return Math.min(MAX_TTL_MS, Math.max(MIN_TTL_MS, ttlSeconds * 1e3));
11702
+ }
11703
+ //#endregion
11527
11704
  //#region src/services/renown-credential-verifier.ts
11528
11705
  async function createRenownCredentialVerifier(config = {}) {
11529
11706
  if (config.keptOnly) {
@@ -12208,6 +12385,31 @@ function assertAuthRequiredForDocumentPermissions(authEnabled, documentPermissio
12208
12385
  if (!authEnabled && documentPermissionsRequested) throw new Error("Document permissions require authentication: AUTH_ENABLED is false but document permissions were requested (DOCUMENT_PERMISSIONS_ENABLED=true or a documentPermissionService was provided). Enable authentication (AUTH_ENABLED=true, or auth.enabled in the config file) or disable document permissions.");
12209
12386
  }
12210
12387
  /**
12388
+ * `ACCESS` fails closed at boot: an unknown mode, or `licensed` without a
12389
+ * usable gate, refuses to start rather than run a host that admits either
12390
+ * nobody or everybody. Returns whether the host runs licensed.
12391
+ */
12392
+ function assertAccessConfig(access, skipCredentialVerification) {
12393
+ const mode = access?.mode ?? "open";
12394
+ if (mode === "open") return false;
12395
+ if (mode === "members") throw new Error("ACCESS=members is not supported; use ACCESS=licensed with Vetra's gate");
12396
+ if (mode !== "licensed") throw new Error(`ACCESS=${mode} is not supported: use ACCESS=open (the default) or ACCESS=licensed`);
12397
+ if (!access?.gateToken || !isGateUrl(access.gateUrl)) throw new Error("ACCESS=licensed needs VETRA_GATE_URL and VETRA_GATE_TOKEN (VETRA_GATE_URL must be https, or http on localhost)");
12398
+ if (skipCredentialVerification) throw new Error("ACCESS=licensed refuses SKIP_CREDENTIAL_VERIFICATION: a licence belongs to a verified address, and skipping the check lets a caller claim any address.");
12399
+ return true;
12400
+ }
12401
+ function isGateUrl(raw) {
12402
+ if (!raw) return false;
12403
+ let url;
12404
+ try {
12405
+ url = new URL(raw);
12406
+ } catch {
12407
+ return false;
12408
+ }
12409
+ if (url.protocol === "https:") return true;
12410
+ return url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
12411
+ }
12412
+ /**
12211
12413
  * Refuses SKIP_CREDENTIAL_VERIFICATION at boot outside tests or an explicit
12212
12414
  * opt-in: it removes the only binding between a token's claimed address and its
12213
12415
  * signing key. Fail-closed — unset NODE_ENV counts as production.
@@ -12433,7 +12635,15 @@ async function _setupCommonInfrastructure(options) {
12433
12635
  };
12434
12636
  const fileAuth = options.configFile ? getConfig(options.configFile).auth : void 0;
12435
12637
  const admins = (optionAuth.admins ?? fileAuth?.admins ?? []).map((a) => a.toLowerCase());
12436
- const authEnabled = optionAuth.enabled ?? fileAuth?.enabled ?? false;
12638
+ /**
12639
+ * `ACCESS=licensed` implies enforcement: identity is resolved, anonymous
12640
+ * callers are refused, and every verified non-admin must hold a licence
12641
+ * Vetra's gate confirms. The document policy stays OPEN among admitted
12642
+ * callers (DOCUMENT_PERMISSIONS when enabled), never ADMIN_ONLY, which would
12643
+ * let a licensee through the gate only to refuse them every document.
12644
+ */
12645
+ const licensed = assertAccessConfig(optionAuth.access, optionAuth.skipCredentialVerification ?? false);
12646
+ const authEnabled = licensed || (optionAuth.enabled ?? fileAuth?.enabled ?? false);
12437
12647
  const configuredRenown = fileAuth?.renown;
12438
12648
  /**
12439
12649
  * Whether the auth middleware reads the bearer and populates `ctx.user`,
@@ -12446,7 +12656,7 @@ async function _setupCommonInfrastructure(options) {
12446
12656
  * stays `OPEN`, which is the combination custom subgraphs need and the one
12447
12657
  * `AUTH_ENABLED` alone cannot express.
12448
12658
  */
12449
- const resolveCallerIdentity = optionAuth.resolveIdentity ?? authEnabled;
12659
+ const resolveCallerIdentity = licensed || (optionAuth.resolveIdentity ?? authEnabled);
12450
12660
  /**
12451
12661
  * Whether the require-authenticated-caller middleware is active: anonymous
12452
12662
  * callers are rejected with a 401 before any subgraph sees the request.
@@ -12461,7 +12671,7 @@ async function _setupCommonInfrastructure(options) {
12461
12671
  * out every non-admin; this expresses "authenticated callers allowed,
12462
12672
  * anonymous not".
12463
12673
  */
12464
- const requireAuthenticatedCaller = optionAuth.requireAuthenticatedCaller ?? false;
12674
+ const requireAuthenticatedCaller = licensed || (optionAuth.requireAuthenticatedCaller ?? false);
12465
12675
  /**
12466
12676
  * The paths the floor above does not apply to. Comma-separated, like
12467
12677
  * `ADMINS`, because a deployment configures this the same way it configures
@@ -12513,8 +12723,20 @@ async function _setupCommonInfrastructure(options) {
12513
12723
  assertCredentialVerifierForSource(renown.source, options.verifyCredential !== void 0);
12514
12724
  if (options.verifyCredential) logger.info("Renown credentials will be verified by the host's verifier");
12515
12725
  else logger.info("Renown credentials will be verified against @url", renown.switchboardUrl ?? renown.url ?? "the default Renown instance");
12726
+ let accessGate;
12727
+ if (licensed && optionAuth.access?.gateUrl && optionAuth.access.gateToken) {
12728
+ accessGate = createVetraAccessGate({
12729
+ url: optionAuth.access.gateUrl,
12730
+ token: optionAuth.access.gateToken,
12731
+ appId: optionAuth.access.appId,
12732
+ graceMs: optionAuth.access.graceMs,
12733
+ logger: logger.child(["access-gate"])
12734
+ });
12735
+ logger.info("ACCESS=licensed: non-admin callers are checked with Vetra (@url)", optionAuth.access.gateUrl);
12736
+ }
12516
12737
  authService = new AuthService({
12517
12738
  enabled: authEnabled,
12739
+ ...accessGate ? { accessGate } : {},
12518
12740
  resolveIdentity: resolveCallerIdentity,
12519
12741
  admins,
12520
12742
  skipCredentialVerification,
@@ -12544,7 +12766,7 @@ async function _setupCommonInfrastructure(options) {
12544
12766
  const authorizationConfig = {
12545
12767
  admins,
12546
12768
  defaultProtection,
12547
- policy: documentPermissionService || ownDocumentPermissions ? AuthorizationPolicy.DOCUMENT_PERMISSIONS : authEnabled ? AuthorizationPolicy.ADMIN_ONLY : AuthorizationPolicy.OPEN
12769
+ policy: documentPermissionService || ownDocumentPermissions ? AuthorizationPolicy.DOCUMENT_PERMISSIONS : authEnabled && !licensed ? AuthorizationPolicy.ADMIN_ONLY : AuthorizationPolicy.OPEN
12548
12770
  };
12549
12771
  const attachmentStoragePath = resolveAttachmentStoragePath(options);
12550
12772
  await mkdir(attachmentStoragePath, { recursive: true });
@@ -13239,7 +13461,7 @@ var NodeMemorySampler = class {
13239
13461
  }
13240
13462
  };
13241
13463
  //#endregion
13242
- export { ADMIN_USERS, ActionCandidateInputSchema, ActionContextInputSchema, ActionInputSchema, AddRelationshipDocument, AnalyticsSubgraph, AttachmentAccessFailed, AttachmentAccessService, AttachmentAccessUnavailable, AttachmentClientProvider, AuthDecision, AuthDecisionSchema, AuthEvaluationUnsupportedError, AuthService, AuthSubgraph, AuthenticationRequiredError, AuthorizationPolicy, AuthorizedAttachmentService, AuthorizedDocumentHandle, BaseSubgraph, CORE_PACKAGE_NAME, CanonicalDocumentIdResolutionError, ChannelMetaInputSchema, CodeFirstSubgraphError, ConsistencyCoordinateInputSchema, ConsistencyTokenInputSchema, CreateDocumentDocument, CreateEmptyDocumentDocument, DEFAULT_INSPECTION_THROTTLE, DEFAULT_PERMISSION_CACHE_OPTIONS, DEFAULT_PERMISSION_CACHE_TTL_MS, DEFAULT_ROOT_TYPES, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentModelSchemaCache, DocumentOperationsFilterInputSchema, DocumentPermissionService, DocumentPermissionSnapshot, DocumentRelationshipFieldsFragmentDoc, DriveNodeFieldsFragmentDoc, DriveNodeKind, DriveNodeKindSchema, EVERYONE, EvaluateActionsDocument, ExecuteBatchDocument, ExecutionJobInputSchema, FindDocumentsDocument, ForbiddenError, GetCreateDefaultsDocument, GetCreateProtocolVersionsDocument, GetDocumentDocument, GetDocumentIncomingRelationshipEdgesDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentModelsDocument, GetDocumentOperationsDocument, GetDocumentOutgoingRelationshipEdgesDocument, GetDocumentOutgoingRelationshipsDocument, GetDocumentServedDocument, GetDocumentWithOperationsDocument, GetDriveDescendantsDocument, GetDriveNodeDocument, GetDriveNodesDocument, GetJobStatusDocument, GetUndoRedoTargetsDocument, GraphQLManager, HttpDocumentModelLoader, HttpPackageLoader, HttpRouteService, ImportPackageLoader, InMemoryPackageStorage, InspectionAdminSubgraph, InspectionSubgraph, InspectionThrottle, InspectionThrottledError, InvalidNamespaceError, JobChangesDocument, JobInfoFieldsFragmentDoc, JsonlFile, MalformedStoredOperationError, MemoryWebhookStore, MoveRelationshipDocument, MutateDocumentAsyncDocument, MutateDocumentDocument, NodeEventLoopDelay, NodeMemorySampler, OperationContextInputSchema, OperationInputSchema, OperationWithContextInputSchema, OperationsFilterInputSchema, PACKAGE_ROUTE_SEGMENT, PGLITE_UTC_PARSERS, PackageManagementService, PackageManager, PackagesSubgraph, PagingInputSchema, PermissionCache, PhDocumentFieldsFragmentDoc, PollSyncEnvelopesDocument, PrivacyPermissionAdapter, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, READABLE_DOCUMENTS_NAMESPACE, ReactorSignerAppInputSchema, ReactorSignerInputSchema, ReactorSignerUserInputSchema, ReactorSubgraph, ReadableDocumentsProjection, RefusalNotRecordedError, RelationalWebhookStore, RemoteCursorInputSchema, RemoteFilterInputSchema, RemoveRelationshipDocument, RenameDocumentDocument, RequestLoadRecorder, SearchFilterInputSchema, SetPreferredEditorDocument, Subgraph, SubgraphTypeCollisionError, SyncEnvelopeInputSchema, SyncEnvelopeType, SyncEnvelopeTypeSchema, SyncRefusalInputSchema, SystemSubgraph, TouchChannelDocument, TouchChannelInputSchema, UpdateRelationshipDocument, ViewFilterInputSchema, WEBHOOK_SEGMENT, WS_AUTH_CLOSE_REASONS, WS_CLOSE_REASON_AUTHENTICATION_REQUIRED, WS_CLOSE_REASON_BEARER_REJECTED, WS_CLOSE_REASON_CREDENTIAL_REVOKED, WebhookService, applyReadableFilter, assembleSubgraphTypeDefs, assertAttachmentPolicyReadsAllowed, assertAuthRequiredForDocumentPermissions, assertCredentialVerifierForSource, assertHostMountPath, assertIndexAccessComplete, assertRequireAuthenticatedCallerAllowed, assertSkipCredentialVerificationAllowed, baseDocumentModels, buildDocumentModelSchema, buildGraphQlDocument, buildGraphQlDriveDocument, buildGraphqlOperation, buildGraphqlOperations, buildScalarRegistry, buildSubgraphSchemaModule, callerSubject, createAuthFetchMiddleware, createCanonicalDocumentIdResolver, createCredentialInvalidator, createGatewayAdapter, createHeapSnapshotWriter, createHttpAdapter, createInspectionResolvers, createMergedSchema, createReactorGraphQLClient, createReactorInspectionSource, createRenownCredentialVerifier, createSchema, createWsAuthHandlers, decodeExplorerUrlState, defineIndexSubgraph, definedNonNullAnySchema, documentModelSubgraphTypes, driveIdFromUrl, extractSubgraphs, extractSubgraphsFromModule, fileTimestamp, findSubgraphTypeCollisions, generateDocumentModelSchema, generatedTypesOf, getAuthContext, getDbClient, getDocumentModelSchemaName, getDocumentModelSubgraphName, getDocumentModelTypeDefs, getExplorerPrefix, getGeneratedDocumentModelTypes, getGitHash, getGitUrl, getSdk, getUniqueDocumentModels, getUniqueUpgradeManifests, getVersion, hasOperationSchemas, initAnalyticsStoreSql, initializeAndStartAPI, inspectionAdminTypeDefs, inspectionTypeDefs, isCountedRequest, isDefinedNonNullAny, isDocumentListed, isExpectedLoaderMiss, isListedAdmin, isPostgresConnectionString, isSubgraphClass, memoryFileSink, namespacePath, namespaceSegments, newWebhookToken, parseDriveUrl, parseWebhookBody, piecesBaseUrl, reactorApiConfigFromEnv, readableDocumentsSubquery, redactHeaders, renderGraphqlPlayground, reportFailure, reservedTypeNames, reservedTypeNamesTaken, resolveCredentialCacheTtlMs, resolvePackageName, resolvePermissionCacheTtlMs, resolveRenownConfig, runDetached, scalarExportsOf, setAuthContext, telemetryDir, typeDefinitionNames, validateDocumentModelsForHost, verifyWebhook };
13464
+ export { ADMIN_USERS, ActionCandidateInputSchema, ActionContextInputSchema, ActionInputSchema, AddRelationshipDocument, AnalyticsSubgraph, AttachmentAccessFailed, AttachmentAccessService, AttachmentAccessUnavailable, AttachmentClientProvider, AuthDecision, AuthDecisionSchema, AuthEvaluationUnsupportedError, AuthService, AuthSubgraph, AuthenticationRequiredError, AuthorizationPolicy, AuthorizedAttachmentService, AuthorizedDocumentHandle, BaseSubgraph, CORE_PACKAGE_NAME, CanonicalDocumentIdResolutionError, ChannelMetaInputSchema, CodeFirstSubgraphError, ConsistencyCoordinateInputSchema, ConsistencyTokenInputSchema, CreateDocumentDocument, CreateEmptyDocumentDocument, DEFAULT_ACCESS_GATE_GRACE_MS, DEFAULT_ACCESS_GATE_MAX_ENTRIES, DEFAULT_ACCESS_GATE_TIMEOUT_MS, DEFAULT_ACCESS_GATE_TTL_MS, DEFAULT_INSPECTION_THROTTLE, DEFAULT_PERMISSION_CACHE_OPTIONS, DEFAULT_PERMISSION_CACHE_TTL_MS, DEFAULT_ROOT_TYPES, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentModelSchemaCache, DocumentOperationsFilterInputSchema, DocumentPermissionService, DocumentPermissionSnapshot, DocumentRelationshipFieldsFragmentDoc, DriveNodeFieldsFragmentDoc, DriveNodeKind, DriveNodeKindSchema, EVERYONE, EvaluateActionsDocument, ExecuteBatchDocument, ExecutionJobInputSchema, FindDocumentsDocument, ForbiddenError, GetCreateDefaultsDocument, GetCreateProtocolVersionsDocument, GetDocumentDocument, GetDocumentIncomingRelationshipEdgesDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentModelsDocument, GetDocumentOperationsDocument, GetDocumentOutgoingRelationshipEdgesDocument, GetDocumentOutgoingRelationshipsDocument, GetDocumentServedDocument, GetDocumentWithOperationsDocument, GetDriveDescendantsDocument, GetDriveNodeDocument, GetDriveNodesDocument, GetJobStatusDocument, GetUndoRedoTargetsDocument, GraphQLManager, HttpDocumentModelLoader, HttpPackageLoader, HttpRouteService, ImportPackageLoader, InMemoryPackageStorage, InspectionAdminSubgraph, InspectionSubgraph, InspectionThrottle, InspectionThrottledError, InvalidNamespaceError, JobChangesDocument, JobInfoFieldsFragmentDoc, JsonlFile, MalformedStoredOperationError, MemoryWebhookStore, MoveRelationshipDocument, MutateDocumentAsyncDocument, MutateDocumentDocument, NO_LICENCE_MESSAGE, NodeEventLoopDelay, NodeMemorySampler, OperationContextInputSchema, OperationInputSchema, OperationWithContextInputSchema, OperationsFilterInputSchema, PACKAGE_ROUTE_SEGMENT, PGLITE_UTC_PARSERS, PackageManagementService, PackageManager, PackagesSubgraph, PagingInputSchema, PermissionCache, PhDocumentFieldsFragmentDoc, PollSyncEnvelopesDocument, PrivacyPermissionAdapter, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, READABLE_DOCUMENTS_NAMESPACE, ReactorSignerAppInputSchema, ReactorSignerInputSchema, ReactorSignerUserInputSchema, ReactorSubgraph, ReadableDocumentsProjection, RefusalNotRecordedError, RelationalWebhookStore, RemoteCursorInputSchema, RemoteFilterInputSchema, RemoveRelationshipDocument, RenameDocumentDocument, RequestLoadRecorder, SearchFilterInputSchema, SetPreferredEditorDocument, Subgraph, SubgraphTypeCollisionError, SyncEnvelopeInputSchema, SyncEnvelopeType, SyncEnvelopeTypeSchema, SyncRefusalInputSchema, SystemSubgraph, TouchChannelDocument, TouchChannelInputSchema, UpdateRelationshipDocument, ViewFilterInputSchema, WEBHOOK_SEGMENT, WS_AUTH_CLOSE_REASONS, WS_CLOSE_REASON_AUTHENTICATION_REQUIRED, WS_CLOSE_REASON_BEARER_REJECTED, WS_CLOSE_REASON_CREDENTIAL_REVOKED, WebhookService, applyReadableFilter, assembleSubgraphTypeDefs, assertAccessConfig, assertAttachmentPolicyReadsAllowed, assertAuthRequiredForDocumentPermissions, assertCredentialVerifierForSource, assertHostMountPath, assertIndexAccessComplete, assertRequireAuthenticatedCallerAllowed, assertSkipCredentialVerificationAllowed, baseDocumentModels, buildDocumentModelSchema, buildGraphQlDocument, buildGraphQlDriveDocument, buildGraphqlOperation, buildGraphqlOperations, buildScalarRegistry, buildSubgraphSchemaModule, callerSubject, createAuthFetchMiddleware, createCanonicalDocumentIdResolver, createCredentialInvalidator, createGatewayAdapter, createHeapSnapshotWriter, createHttpAdapter, createInspectionResolvers, createMergedSchema, createReactorGraphQLClient, createReactorInspectionSource, createRenownCredentialVerifier, createSchema, createVetraAccessGate, createWsAuthHandlers, decodeExplorerUrlState, defineIndexSubgraph, definedNonNullAnySchema, documentModelSubgraphTypes, driveIdFromUrl, extractSubgraphs, extractSubgraphsFromModule, fileTimestamp, findSubgraphTypeCollisions, generateDocumentModelSchema, generatedTypesOf, getAuthContext, getDbClient, getDocumentModelSchemaName, getDocumentModelSubgraphName, getDocumentModelTypeDefs, getExplorerPrefix, getGeneratedDocumentModelTypes, getGitHash, getGitUrl, getSdk, getUniqueDocumentModels, getUniqueUpgradeManifests, getVersion, hasOperationSchemas, initAnalyticsStoreSql, initializeAndStartAPI, inspectionAdminTypeDefs, inspectionTypeDefs, isCountedRequest, isDefinedNonNullAny, isDocumentListed, isExpectedLoaderMiss, isListedAdmin, isPostgresConnectionString, isSubgraphClass, memoryFileSink, namespacePath, namespaceSegments, newWebhookToken, parseDriveUrl, parseWebhookBody, piecesBaseUrl, reactorApiConfigFromEnv, readableDocumentsSubquery, redactHeaders, renderGraphqlPlayground, reportFailure, reservedTypeNames, reservedTypeNamesTaken, resolveCredentialCacheTtlMs, resolvePackageName, resolvePermissionCacheTtlMs, resolveRenownConfig, runDetached, scalarExportsOf, setAuthContext, telemetryDir, typeDefinitionNames, validateDocumentModelsForHost, verifyWebhook };
13243
13465
 
13244
13466
  //# sourceMappingURL=index.mjs.map
13245
- //# debugId=577fbb83-65ea-558f-a795-e8fa41dfbb1a
13467
+ //# debugId=99ad2751-bdef-5035-a0b3-ed1e3e9cc3ab