@powerhousedao/reactor-api 6.0.2-staging.8 → 6.1.0-dev.0
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-IZuGzFaY.mjs +134 -0
- package/dist/adapter-gateway-apollo-IZuGzFaY.mjs.map +1 -0
- package/dist/adapter-gateway-mercurius-CLmTtNJC.mjs +132 -0
- package/dist/adapter-gateway-mercurius-CLmTtNJC.mjs.map +1 -0
- package/dist/adapter-http-express-DO4ui7AV.mjs +135 -0
- package/dist/adapter-http-express-DO4ui7AV.mjs.map +1 -0
- package/dist/adapter-http-fastify-B248RJtm.mjs +208 -0
- package/dist/adapter-http-fastify-B248RJtm.mjs.map +1 -0
- package/dist/index.d.mts +68 -17
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +268 -733
- package/dist/index.mjs.map +1 -1
- package/dist/src/packages/vite-loader.d.mts +1 -1
- package/dist/src/packages/vite-loader.mjs +1 -1
- package/dist/{types-Do4QTfT3.d.mts → types-DnHgkahK.d.mts} +1 -1
- package/dist/{types-Do4QTfT3.d.mts.map → types-DnHgkahK.d.mts.map} +1 -1
- package/dist/{utils-CHCRSWig.mjs → utils-BFkbSO_H.mjs} +13 -6
- package/dist/utils-BFkbSO_H.mjs.map +1 -0
- package/dist/websocket-DncAB9XK.mjs +18 -0
- package/dist/websocket-DncAB9XK.mjs.map +1 -0
- package/package.json +53 -21
- package/dist/utils-CHCRSWig.mjs.map +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
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]="4fb1d468-f1ff-54b7-91b9-0b7da8b78c2d")}catch(e){}}();
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { match } from "path-to-regexp";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import http from "node:http";
|
|
7
|
+
import https from "node:https";
|
|
8
|
+
import Fastify from "fastify";
|
|
9
|
+
import devcert from "devcert";
|
|
10
|
+
import fastifyCors from "@fastify/cors";
|
|
11
|
+
import fastifyFormbody from "@fastify/formbody";
|
|
12
|
+
import fastifyMiddie from "@fastify/middie";
|
|
13
|
+
//#region src/graphql/gateway/adapter-http-fastify.ts
|
|
14
|
+
/**
|
|
15
|
+
* Normalises a route path for path-to-regexp v8:
|
|
16
|
+
* - Collapses duplicate slashes (e.g. "//explorer" → "/explorer")
|
|
17
|
+
* - Converts legacy optional-param syntax ":param?" → "{/:param}?"
|
|
18
|
+
*/
|
|
19
|
+
function normalizePath(path) {
|
|
20
|
+
return path.replace(/\/+/g, "/").replace(/:(\w+)\?/g, "{/:$1}");
|
|
21
|
+
}
|
|
22
|
+
/** Parses body-limit strings like "50mb" to bytes. */
|
|
23
|
+
function parseBodyLimit(limit) {
|
|
24
|
+
const m = /^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/i.exec(limit.trim());
|
|
25
|
+
if (!m) return 52428800;
|
|
26
|
+
const n = parseFloat(m[1]);
|
|
27
|
+
return Math.round(n * ({
|
|
28
|
+
b: 1,
|
|
29
|
+
kb: 1024,
|
|
30
|
+
mb: 1048576,
|
|
31
|
+
gb: 1073741824
|
|
32
|
+
}[(m[2] ?? "b").toLowerCase()] ?? 1));
|
|
33
|
+
}
|
|
34
|
+
var FastifyHttpAdapter = class {
|
|
35
|
+
#fetchRoutes = [];
|
|
36
|
+
#getRoutes = /* @__PURE__ */ new Map();
|
|
37
|
+
#nodeRoutes = [];
|
|
38
|
+
#setupOps = [];
|
|
39
|
+
#instance;
|
|
40
|
+
get handle() {
|
|
41
|
+
return this.#instance;
|
|
42
|
+
}
|
|
43
|
+
setupMiddleware({ corsOptions, bodyLimit = "50mb" }) {
|
|
44
|
+
this.#setupOps.push({
|
|
45
|
+
kind: "cors",
|
|
46
|
+
options: corsOptions,
|
|
47
|
+
bodyLimit: parseBodyLimit(bodyLimit)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
mount(path, handler, { exact = false } = {}) {
|
|
51
|
+
this.#fetchRoutes.push({
|
|
52
|
+
handler,
|
|
53
|
+
matcher: match(normalizePath(path), { end: !exact }),
|
|
54
|
+
prefix: exact
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
getRoute(path, handler) {
|
|
58
|
+
this.#getRoutes.set(path, {
|
|
59
|
+
handler,
|
|
60
|
+
matcher: match(normalizePath(path))
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
mountNodeRoute(method, path, handler) {
|
|
64
|
+
this.#nodeRoutes.push({
|
|
65
|
+
method,
|
|
66
|
+
matcher: match(normalizePath(path)),
|
|
67
|
+
handler
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
mountRawMiddleware(middleware) {
|
|
71
|
+
if (this.#instance) this.#instance.use(middleware);
|
|
72
|
+
else this.#setupOps.push({
|
|
73
|
+
kind: "middie",
|
|
74
|
+
middleware
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
setupSentryErrorHandler(sentry) {
|
|
78
|
+
if (!this.#instance) return;
|
|
79
|
+
sentry.setupFastifyErrorHandler(this.#instance);
|
|
80
|
+
}
|
|
81
|
+
async listen(port, tls) {
|
|
82
|
+
let httpServer;
|
|
83
|
+
if (tls === true) {
|
|
84
|
+
const { cert, key } = await devcert.certificateFor("localhost");
|
|
85
|
+
if (!cert || !key) throw new Error("Invalid certificate generated");
|
|
86
|
+
httpServer = https.createServer({
|
|
87
|
+
cert,
|
|
88
|
+
key
|
|
89
|
+
});
|
|
90
|
+
} else if (tls && "keyPath" in tls) {
|
|
91
|
+
const cwd = process.cwd();
|
|
92
|
+
httpServer = https.createServer({
|
|
93
|
+
key: fs.readFileSync(path.join(cwd, tls.keyPath)),
|
|
94
|
+
cert: fs.readFileSync(path.join(cwd, tls.certPath))
|
|
95
|
+
});
|
|
96
|
+
} else if (tls && "cert" in tls) httpServer = https.createServer({
|
|
97
|
+
cert: tls.cert,
|
|
98
|
+
key: tls.key
|
|
99
|
+
});
|
|
100
|
+
else httpServer = http.createServer();
|
|
101
|
+
const instance = Fastify({
|
|
102
|
+
serverFactory: (handler) => {
|
|
103
|
+
httpServer.on("request", handler);
|
|
104
|
+
return httpServer;
|
|
105
|
+
},
|
|
106
|
+
bodyLimit: this.#setupOps.find((op) => op.kind === "cors")?.bodyLimit ?? 52428800,
|
|
107
|
+
logger: false
|
|
108
|
+
});
|
|
109
|
+
this.#instance = instance;
|
|
110
|
+
await instance.register(fastifyMiddie);
|
|
111
|
+
await instance.register(fastifyFormbody);
|
|
112
|
+
for (const op of this.#setupOps) if (op.kind === "cors") await instance.register(fastifyCors, op.options);
|
|
113
|
+
else instance.use(op.middleware);
|
|
114
|
+
instance.route({
|
|
115
|
+
method: [
|
|
116
|
+
"DELETE",
|
|
117
|
+
"GET",
|
|
118
|
+
"HEAD",
|
|
119
|
+
"PATCH",
|
|
120
|
+
"POST",
|
|
121
|
+
"PUT"
|
|
122
|
+
],
|
|
123
|
+
url: "/*",
|
|
124
|
+
handler: (req, reply) => this.#dispatch(req, reply)
|
|
125
|
+
});
|
|
126
|
+
await instance.ready();
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
128
|
+
httpServer.once("error", reject);
|
|
129
|
+
httpServer.listen(port, () => {
|
|
130
|
+
httpServer.off("error", reject);
|
|
131
|
+
resolve(httpServer);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
#dispatch(req, reply) {
|
|
136
|
+
const pathname = new URL(req.url, "http://localhost").pathname;
|
|
137
|
+
const method = req.method.toUpperCase();
|
|
138
|
+
for (const entry of this.#nodeRoutes) {
|
|
139
|
+
if (entry.method !== method) continue;
|
|
140
|
+
const result = entry.matcher(pathname);
|
|
141
|
+
if (!result) continue;
|
|
142
|
+
req.raw.params = result.params;
|
|
143
|
+
reply.hijack();
|
|
144
|
+
entry.handler(req.raw, reply.raw, req.body);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (method === "GET") {
|
|
148
|
+
for (const entry of this.#getRoutes.values()) if (entry.matcher(pathname)) return this.#serveGetEntry(entry, req, reply);
|
|
149
|
+
}
|
|
150
|
+
for (let i = this.#fetchRoutes.length - 1; i >= 0; i--) {
|
|
151
|
+
const entry = this.#fetchRoutes[i];
|
|
152
|
+
if (entry.matcher(pathname)) return serveFetchHandler(entry.handler, req, reply);
|
|
153
|
+
}
|
|
154
|
+
reply.status(404).send({
|
|
155
|
+
message: `Route ${req.method}:${pathname} not found`,
|
|
156
|
+
error: "Not Found",
|
|
157
|
+
statusCode: 404
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async #serveGetEntry(entry, req, reply) {
|
|
161
|
+
const url = buildUrl(req);
|
|
162
|
+
const headers = buildHeaders(req);
|
|
163
|
+
const fetchReq = new Request(url, {
|
|
164
|
+
method: "GET",
|
|
165
|
+
headers
|
|
166
|
+
});
|
|
167
|
+
const response = await entry.handler(fetchReq);
|
|
168
|
+
writeResponse(reply, response);
|
|
169
|
+
return reply.send(await response.text());
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
async function serveFetchHandler(handler, req, reply) {
|
|
173
|
+
const url = buildUrl(req);
|
|
174
|
+
const headers = buildHeaders(req);
|
|
175
|
+
let body;
|
|
176
|
+
if (req.method !== "GET" && req.method !== "HEAD" && req.body !== void 0) body = JSON.stringify(req.body);
|
|
177
|
+
const response = await handler(new Request(url, {
|
|
178
|
+
method: req.method,
|
|
179
|
+
headers,
|
|
180
|
+
body
|
|
181
|
+
}));
|
|
182
|
+
writeResponse(reply, response);
|
|
183
|
+
return reply.send(await response.text());
|
|
184
|
+
}
|
|
185
|
+
function buildUrl(req) {
|
|
186
|
+
const host = req.headers.host ?? "localhost";
|
|
187
|
+
return `${req.protocol}://${host}${req.url}`;
|
|
188
|
+
}
|
|
189
|
+
function buildHeaders(req) {
|
|
190
|
+
const headers = new Headers();
|
|
191
|
+
for (const [key, value] of Object.entries(req.headers)) if (typeof value === "string") headers.set(key, value);
|
|
192
|
+
else if (Array.isArray(value)) headers.set(key, value.join(", "));
|
|
193
|
+
return headers;
|
|
194
|
+
}
|
|
195
|
+
function writeResponse(reply, response) {
|
|
196
|
+
reply.status(response.status);
|
|
197
|
+
response.headers.forEach((value, key) => {
|
|
198
|
+
reply.header(key, value);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function createFastifyHttpAdapter() {
|
|
202
|
+
return { adapter: new FastifyHttpAdapter() };
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { createFastifyHttpAdapter };
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=adapter-http-fastify-B248RJtm.mjs.map
|
|
208
|
+
//# debugId=4fb1d468-f1ff-54b7-91b9-0b7da8b78c2d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-http-fastify-B248RJtm.mjs","sources":["../src/graphql/gateway/adapter-http-fastify.ts"],"sourcesContent":["import fastifyCors from \"@fastify/cors\";\nimport fastifyFormbody from \"@fastify/formbody\";\nimport fastifyMiddie from \"@fastify/middie\";\nimport devcert from \"devcert\";\nimport Fastify from \"fastify\";\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport type { CorsOptions } from \"cors\";\nimport fs from \"node:fs\";\nimport http from \"node:http\";\nimport https from \"node:https\";\nimport nodePath from \"node:path\";\nimport { match, type MatchFunction, type ParamData } from \"path-to-regexp\";\nimport type { FetchHandler, IHttpAdapter, TlsOptions } from \"./types.js\";\n\n/**\n * Normalises a route path for path-to-regexp v8:\n * - Collapses duplicate slashes (e.g. \"//explorer\" → \"/explorer\")\n * - Converts legacy optional-param syntax \":param?\" → \"{/:param}?\"\n */\nfunction normalizePath(path: string): string {\n return path.replace(/\\/+/g, \"/\").replace(/:(\\w+)\\?/g, \"{/:$1}\");\n}\n\n/** Parses body-limit strings like \"50mb\" to bytes. */\nfunction parseBodyLimit(limit: string): number {\n const m = /^(\\d+(?:\\.\\d+)?)\\s*(b|kb|mb|gb)?$/i.exec(limit.trim());\n if (!m) return 52_428_800; // 50 MB fallback\n const n = parseFloat(m[1]);\n const units: Record<string, number> = {\n b: 1,\n kb: 1_024,\n mb: 1_048_576,\n gb: 1_073_741_824,\n };\n return Math.round(n * (units[(m[2] ?? \"b\").toLowerCase()] ?? 1));\n}\n\ntype FetchEntry = {\n handler: FetchHandler;\n matcher: MatchFunction<ParamData>;\n prefix: boolean;\n};\n\ntype GetEntry = {\n handler: (r: Request) => Response | Promise<Response>;\n matcher: MatchFunction<ParamData>;\n};\n\ntype NodeHandler = (\n req: http.IncomingMessage,\n res: http.ServerResponse,\n body?: unknown,\n) => void;\n\ntype NodeEntry = {\n method: \"DELETE\" | \"GET\" | \"HEAD\" | \"POST\" | \"PUT\";\n matcher: MatchFunction<ParamData>;\n handler: NodeHandler;\n};\n\n// Pre-listen configuration ops (need the Fastify instance to apply).\ntype SetupOp =\n | { kind: \"cors\"; options?: CorsOptions; bodyLimit: number }\n | { kind: \"middie\"; middleware: unknown };\n\nexport class FastifyHttpAdapter implements IHttpAdapter {\n // Dispatch maps — populated at any time (before or after listen).\n readonly #fetchRoutes: FetchEntry[] = [];\n readonly #getRoutes: Map<string, GetEntry> = new Map();\n // Iterated in registration order on dispatch; entries carry their own\n // path-to-regexp matcher so parameterised paths (e.g. \"/attachments/:hash\")\n // resolve correctly and populate `req.params`.\n readonly #nodeRoutes: NodeEntry[] = [];\n\n // Ops that need the Fastify instance (CORS config, Connect middleware).\n readonly #setupOps: SetupOp[] = [];\n\n #instance: FastifyInstance | undefined;\n\n get handle(): unknown {\n return this.#instance;\n }\n\n setupMiddleware({\n corsOptions,\n bodyLimit = \"50mb\",\n }: {\n corsOptions?: CorsOptions;\n bodyLimit?: string;\n }): void {\n this.#setupOps.push({\n kind: \"cors\",\n options: corsOptions,\n bodyLimit: parseBodyLimit(bodyLimit),\n });\n }\n\n mount(\n path: string,\n handler: FetchHandler,\n { exact = false }: { exact?: boolean } = {},\n ): void {\n this.#fetchRoutes.push({\n handler,\n // exact=false → exact path match; exact=true → prefix match.\n matcher: match(normalizePath(path), { end: !exact }),\n prefix: exact,\n });\n }\n\n getRoute(\n path: string,\n handler: (request: Request) => Response | Promise<Response>,\n ): void {\n this.#getRoutes.set(path, { handler, matcher: match(normalizePath(path)) });\n }\n\n mountNodeRoute(\n method: \"DELETE\" | \"GET\" | \"HEAD\" | \"POST\" | \"PUT\",\n path: string,\n handler: NodeHandler,\n ): void {\n this.#nodeRoutes.push({\n method,\n matcher: match(normalizePath(path)),\n handler,\n });\n }\n\n mountRawMiddleware(middleware: unknown): void {\n if (this.#instance) {\n // @fastify/middie is always registered, so .use() is available post-listen.\n (\n this.#instance as FastifyInstance & {\n use(middleware: unknown): FastifyInstance;\n }\n ).use(middleware);\n } else {\n this.#setupOps.push({ kind: \"middie\", middleware });\n }\n }\n\n setupSentryErrorHandler(sentry: object): void {\n if (!this.#instance) return;\n const s = sentry as {\n setupFastifyErrorHandler(app: FastifyInstance): void;\n };\n s.setupFastifyErrorHandler(this.#instance);\n }\n\n async listen(port: number, tls?: TlsOptions): Promise<http.Server> {\n let httpServer: http.Server;\n\n if (tls === true) {\n const { cert, key } = (await devcert.certificateFor(\"localhost\")) as {\n cert: Buffer;\n key: Buffer;\n };\n if (!cert || !key) throw new Error(\"Invalid certificate generated\");\n httpServer = https.createServer({ cert, key });\n } else if (tls && \"keyPath\" in tls) {\n const cwd = process.cwd();\n httpServer = https.createServer({\n key: fs.readFileSync(nodePath.join(cwd, tls.keyPath)),\n cert: fs.readFileSync(nodePath.join(cwd, tls.certPath)),\n });\n } else if (tls && \"cert\" in tls) {\n httpServer = https.createServer({ cert: tls.cert, key: tls.key });\n } else {\n httpServer = http.createServer();\n }\n\n const corsOp = this.#setupOps.find(\n (op): op is Extract<SetupOp, { kind: \"cors\" }> => op.kind === \"cors\",\n );\n const bodyLimit = corsOp?.bodyLimit ?? 52_428_800;\n\n const instance = Fastify({\n serverFactory: (handler) => {\n httpServer.on(\"request\", handler);\n return httpServer;\n },\n bodyLimit,\n logger: false,\n });\n\n this.#instance = instance;\n\n // Always register middie first so .use() is available post-listen.\n await instance.register(fastifyMiddie);\n await instance.register(fastifyFormbody);\n\n for (const op of this.#setupOps) {\n if (op.kind === \"cors\") {\n await instance.register(\n fastifyCors,\n op.options as Parameters<typeof fastifyCors>[1],\n );\n } else {\n (\n instance as FastifyInstance & {\n use(middleware: unknown): FastifyInstance;\n }\n ).use(op.middleware);\n }\n }\n\n // Single catch-all route — all dispatching is done via the Maps above so\n // that routes registered after listen() are picked up automatically.\n // OPTIONS is excluded because @fastify/cors registers its own OPTIONS /*\n // handler for preflight; including it here would cause a duplicate-route\n // conflict at startup.\n instance.route({\n method: [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\"],\n url: \"/*\",\n handler: (req, reply) => this.#dispatch(req, reply),\n });\n\n await instance.ready();\n\n return new Promise<http.Server>((resolve, reject) => {\n httpServer.once(\"error\", reject);\n httpServer.listen(port, () => {\n httpServer.off(\"error\", reject);\n resolve(httpServer);\n });\n });\n }\n\n #dispatch(req: FastifyRequest, reply: FastifyReply): void | Promise<void> {\n const pathname = new URL(req.url, \"http://localhost\").pathname;\n const method = req.method.toUpperCase() as\n | \"DELETE\"\n | \"GET\"\n | \"HEAD\"\n | \"POST\"\n | \"PUT\";\n\n // 1. Node routes — path-to-regexp match + method, handler manages raw\n // response. Attach decoded params onto `req.raw` so downstream handlers\n // can read them via the same `req.params` API the Express adapter exposes.\n for (const entry of this.#nodeRoutes) {\n if (entry.method !== method) continue;\n const result = entry.matcher(pathname);\n if (!result) continue;\n (req.raw as http.IncomingMessage & { params?: ParamData }).params =\n result.params;\n reply.hijack();\n entry.handler(req.raw, reply.raw, req.body);\n return;\n }\n\n // 2. GET-specific routes (health, explorer, etc.).\n if (method === \"GET\") {\n for (const entry of this.#getRoutes.values()) {\n if (entry.matcher(pathname)) {\n return this.#serveGetEntry(entry, req, reply);\n }\n }\n }\n\n // 3. Fetch routes (GraphQL handlers, SSE, etc.).\n // Iterate in reverse so that the last-mounted handler wins when the same\n // path is mounted more than once (e.g. supergraph remount after reload).\n for (let i = this.#fetchRoutes.length - 1; i >= 0; i--) {\n const entry = this.#fetchRoutes[i]!;\n if (entry.matcher(pathname)) {\n return serveFetchHandler(entry.handler, req, reply);\n }\n }\n\n void reply.status(404).send({\n message: `Route ${req.method}:${pathname} not found`,\n error: \"Not Found\",\n statusCode: 404,\n });\n }\n\n async #serveGetEntry(\n entry: GetEntry,\n req: FastifyRequest,\n reply: FastifyReply,\n ): Promise<void> {\n const url = buildUrl(req);\n const headers = buildHeaders(req);\n const fetchReq = new Request(url, { method: \"GET\", headers });\n const response = await entry.handler(fetchReq);\n writeResponse(reply, response);\n return reply.send(await response.text());\n }\n}\n\nasync function serveFetchHandler(\n handler: FetchHandler,\n req: FastifyRequest,\n reply: FastifyReply,\n): Promise<void> {\n const url = buildUrl(req);\n const headers = buildHeaders(req);\n\n let body: string | undefined;\n if (req.method !== \"GET\" && req.method !== \"HEAD\" && req.body !== undefined) {\n body = JSON.stringify(req.body);\n }\n\n const fetchRequest = new Request(url, { method: req.method, headers, body });\n const response = await handler(fetchRequest);\n writeResponse(reply, response);\n return reply.send(await response.text());\n}\n\nfunction buildUrl(req: FastifyRequest): string {\n const host = req.headers.host ?? \"localhost\";\n return `${req.protocol}://${host}${req.url}`;\n}\n\nfunction buildHeaders(req: FastifyRequest): Headers {\n const headers = new Headers();\n for (const [key, value] of Object.entries(req.headers)) {\n if (typeof value === \"string\") {\n headers.set(key, value);\n } else if (Array.isArray(value)) {\n headers.set(key, value.join(\", \"));\n }\n }\n return headers;\n}\n\nfunction writeResponse(reply: FastifyReply, response: Response): void {\n void reply.status(response.status);\n response.headers.forEach((value, key) => {\n void reply.header(key, value);\n });\n}\n\nexport function createFastifyHttpAdapter(): { adapter: IHttpAdapter } {\n return { adapter: new FastifyHttpAdapter() };\n}\n"],"names":["#fetchRoutes","#getRoutes","#nodeRoutes","#setupOps","#instance","nodePath","#dispatch","#serveGetEntry"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAAS,cAAc,MAAsB;AAC3C,QAAO,KAAK,QAAQ,QAAQ,IAAI,CAAC,QAAQ,aAAa,SAAS;;;AAIjE,SAAS,eAAe,OAAuB;CAC7C,MAAM,IAAI,qCAAqC,KAAK,MAAM,MAAM,CAAC;AACjE,KAAI,CAAC,EAAG,QAAO;CACf,MAAM,IAAI,WAAW,EAAE,GAAG;AAO1B,QAAO,KAAK,MAAM,KANoB;EACpC,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,IAAI;EACL,EAC6B,EAAE,MAAM,KAAK,aAAa,KAAK,GAAG;;AA+BlE,IAAa,qBAAb,MAAwD;CAEtD,eAAsC,EAAE;CACxC,6BAA6C,IAAI,KAAK;CAItD,cAAoC,EAAE;CAGtC,YAAgC,EAAE;CAElC;CAEA,IAAI,SAAkB;AACpB,SAAO,MAAA;;CAGT,gBAAgB,EACd,aACA,YAAY,UAIL;AACP,QAAA,SAAe,KAAK;GAClB,MAAM;GACN,SAAS;GACT,WAAW,eAAe,UAAU;GACrC,CAAC;;CAGJ,MACE,MACA,SACA,EAAE,QAAQ,UAA+B,EAAE,EACrC;AACN,QAAA,YAAkB,KAAK;GACrB;GAEA,SAAS,MAAM,cAAc,KAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC;GACpD,QAAQ;GACT,CAAC;;CAGJ,SACE,MACA,SACM;AACN,QAAA,UAAgB,IAAI,MAAM;GAAE;GAAS,SAAS,MAAM,cAAc,KAAK,CAAC;GAAE,CAAC;;CAG7E,eACE,QACA,MACA,SACM;AACN,QAAA,WAAiB,KAAK;GACpB;GACA,SAAS,MAAM,cAAc,KAAK,CAAC;GACnC;GACD,CAAC;;CAGJ,mBAAmB,YAA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erResult, t as IPackageLoader } from "./types-
|
|
1
|
+
import { i as IPackageManagerOptions, n as IPackageLoaderOptions, r as IPackageManager, s as PackageManagerResult, t as IPackageLoader } from "./types-DnHgkahK.mjs";
|
|
2
2
|
import { IAnalyticsStore } from "@powerhousedao/analytics-engine-core";
|
|
3
3
|
import { AnalyticsModel } from "@powerhousedao/analytics-engine-graphql";
|
|
4
4
|
import * as graphql from "graphql";
|
|
5
5
|
import { DocumentNode, GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig, GraphQLSchema } from "graphql";
|
|
6
6
|
import { ILogger } from "document-model";
|
|
7
|
-
import { CorsOptions } from "cors";
|
|
8
|
-
import http from "node:http";
|
|
9
7
|
import { DocumentModelGlobalState as DocumentModelGlobalState$1, DocumentModelModule, Operation, PHDocument, PHDocumentHeader } from "@powerhousedao/shared/document-model";
|
|
10
|
-
import { IDocumentModelLoader, IDocumentModelRegistry, IReactorClient, IRelationalDb, ISyncManager, ParsedDriveUrl, ReactorClientModule, driveIdFromUrl, parseDriveUrl } from "@powerhousedao/reactor";
|
|
8
|
+
import { IDocumentModelLoader, IDocumentModelRegistry, IDriveClient, IReactorClient, IRelationalDb, ISyncManager, ParsedDriveUrl, ReactorClientModule, driveIdFromUrl, parseDriveUrl } from "@powerhousedao/reactor";
|
|
11
9
|
import * as z$1 from "zod";
|
|
12
10
|
import { DocumentDriveDocument, DocumentDriveGlobalState } from "@powerhousedao/shared/document-drive";
|
|
13
11
|
import { AttachmentBuildResult } from "@powerhousedao/reactor-attachments";
|
|
@@ -16,6 +14,8 @@ import { IProcessorHostModule, IRelationalDb as IRelationalDb$1, ProcessorApp, P
|
|
|
16
14
|
import { Generated, Kysely } from "kysely";
|
|
17
15
|
import { PGlite } from "@electric-sql/pglite";
|
|
18
16
|
import { Knex } from "knex";
|
|
17
|
+
import http from "node:http";
|
|
18
|
+
import { CorsOptions } from "cors";
|
|
19
19
|
import { GraphQLResolverMap, GraphQLSchemaModule } from "@apollo/subgraph/dist/schema-helper/resolverMap.js";
|
|
20
20
|
import { Context as Context$1, GqlDocument as GqlDocument$1, GqlDriveDocument as GqlDriveDocument$1, GqlOperation as GqlOperation$1, GraphQLManager as GraphQLManager$1, ISubgraph as ISubgraph$1, Processor as Processor$1, SubgraphArgs as SubgraphArgs$1, SubgraphClass as SubgraphClass$1 } from "@powerhousedao/reactor-api";
|
|
21
21
|
import { IncomingHttpHeaders } from "http";
|
|
@@ -102,11 +102,12 @@ type Db = Kysely<any>;
|
|
|
102
102
|
* current PGLite class for the surface knex-pglite uses.
|
|
103
103
|
*/
|
|
104
104
|
type PgliteFactory = (connectionString: string | undefined) => PGlite;
|
|
105
|
-
|
|
105
|
+
interface DbClient {
|
|
106
106
|
db: Db;
|
|
107
107
|
knex: Knex;
|
|
108
108
|
pglite: PGlite | undefined;
|
|
109
|
-
}
|
|
109
|
+
}
|
|
110
|
+
declare function getDbClient(connectionString?: string | undefined, pgliteFactory?: PgliteFactory): DbClient;
|
|
110
111
|
declare const initAnalyticsStoreSql: string[];
|
|
111
112
|
//#endregion
|
|
112
113
|
//#region src/services/document-permission.service.d.ts
|
|
@@ -970,21 +971,22 @@ declare function createAuthFetchMiddleware(authService: AuthService): AuthFetchM
|
|
|
970
971
|
//#region src/graphql/gateway/factory.d.ts
|
|
971
972
|
type GatewayAdapterType = "apollo" | "mercurius";
|
|
972
973
|
type HttpAdapterType = "express" | "fastify";
|
|
973
|
-
declare function createGatewayAdapter(type: GatewayAdapterType, logger: ILogger): IGatewayAdapter<Context
|
|
974
|
+
declare function createGatewayAdapter(type: GatewayAdapterType, logger: ILogger): Promise<IGatewayAdapter<Context>>;
|
|
974
975
|
type HttpAdapterSetup = {
|
|
975
976
|
adapter: IHttpAdapter;
|
|
976
977
|
};
|
|
977
|
-
declare function createHttpAdapter(type: HttpAdapterType): HttpAdapterSetup
|
|
978
|
+
declare function createHttpAdapter(type: HttpAdapterType): Promise<HttpAdapterSetup>;
|
|
978
979
|
//#endregion
|
|
979
980
|
//#region src/graphql/gateway/drive-ownership-cache.d.ts
|
|
980
981
|
/**
|
|
981
982
|
* In-memory record of which drives this switchboard instance owns.
|
|
982
983
|
*
|
|
983
|
-
* Populated at startup by walking the reactor for documents
|
|
984
|
-
*
|
|
985
|
-
*
|
|
986
|
-
* drive
|
|
987
|
-
* requests with a structured
|
|
984
|
+
* Populated at startup by walking the reactor for documents whose type is
|
|
985
|
+
* listed in `DEFAULT_DRIVE_CONTAINER_TYPES` (both legacy `document-drive`
|
|
986
|
+
* and `reactor-drive`). Mutated explicitly by resolver hooks after
|
|
987
|
+
* successful drive create / delete operations. Read by the drive-validation
|
|
988
|
+
* fetch middleware to short-circuit wrong-shard requests with a structured
|
|
989
|
+
* 421 response.
|
|
988
990
|
*/
|
|
989
991
|
declare class DriveOwnershipCache {
|
|
990
992
|
private readonly reactorClient;
|
|
@@ -1028,7 +1030,13 @@ declare class GraphQLManager {
|
|
|
1028
1030
|
/** Cached document models for schema generation - updated on init and regenerate */
|
|
1029
1031
|
private cachedDocumentModels;
|
|
1030
1032
|
private readonly subgraphHandlerCache;
|
|
1031
|
-
|
|
1033
|
+
/**
|
|
1034
|
+
* Optional reactor-drive client. When the switchboard is configured with a
|
|
1035
|
+
* reactor-drive container, this is provided and the resolvers dispatch to
|
|
1036
|
+
* it for reactor-drive parents.
|
|
1037
|
+
*/
|
|
1038
|
+
readonly reactorDriveClient?: IDriveClient;
|
|
1039
|
+
constructor(path: string, httpServer: http.Server, wsServer: WebSocketServer, reactorClient: IReactorClient, relationalDb: IRelationalDb, analyticsStore: IAnalyticsStore, syncManager: ISyncManager, logger: ILogger, httpAdapter: IHttpAdapter, gatewayAdapter: IGatewayAdapter<Context$1>, authConfig?: AuthConfig | undefined, documentPermissionService?: DocumentPermissionService | undefined, featureFlags?: GraphqlManagerFeatureFlags, port?: number, authorizationService?: AuthorizationService | undefined, reactorDriveClient?: IDriveClient);
|
|
1032
1040
|
init(coreSubgraphs: SubgraphClass$1[], authMiddleware?: AuthFetchMiddleware): Promise<void>;
|
|
1033
1041
|
/**
|
|
1034
1042
|
* Regenerate document model subgraphs when models are dynamically loaded.
|
|
@@ -1423,6 +1431,7 @@ type Mutation = {
|
|
|
1423
1431
|
readonly pushSyncEnvelopes: Scalars["Boolean"]["output"];
|
|
1424
1432
|
readonly removeRelationship: PhDocument;
|
|
1425
1433
|
readonly renameDocument: PhDocument;
|
|
1434
|
+
readonly setPreferredEditor: PhDocument;
|
|
1426
1435
|
readonly touchChannel: TouchChannelResult;
|
|
1427
1436
|
};
|
|
1428
1437
|
type MutationAddRelationshipArgs = {
|
|
@@ -1478,6 +1487,11 @@ type MutationRenameDocumentArgs = {
|
|
|
1478
1487
|
documentIdentifier: Scalars["String"]["input"];
|
|
1479
1488
|
name: Scalars["String"]["input"];
|
|
1480
1489
|
};
|
|
1490
|
+
type MutationSetPreferredEditorArgs = {
|
|
1491
|
+
branch?: InputMaybe<Scalars["String"]["input"]>;
|
|
1492
|
+
documentIdentifier: Scalars["String"]["input"];
|
|
1493
|
+
preferredEditor?: InputMaybe<Scalars["String"]["input"]>;
|
|
1494
|
+
};
|
|
1481
1495
|
type MutationTouchChannelArgs = {
|
|
1482
1496
|
input: TouchChannelInput;
|
|
1483
1497
|
};
|
|
@@ -2067,6 +2081,26 @@ type RenameDocumentMutation = {
|
|
|
2067
2081
|
}>;
|
|
2068
2082
|
};
|
|
2069
2083
|
};
|
|
2084
|
+
type SetPreferredEditorMutationVariables = Exact<{
|
|
2085
|
+
documentIdentifier: Scalars["String"]["input"];
|
|
2086
|
+
preferredEditor?: InputMaybe<Scalars["String"]["input"]>;
|
|
2087
|
+
branch?: InputMaybe<Scalars["String"]["input"]>;
|
|
2088
|
+
}>;
|
|
2089
|
+
type SetPreferredEditorMutation = {
|
|
2090
|
+
readonly setPreferredEditor: {
|
|
2091
|
+
readonly id: string;
|
|
2092
|
+
readonly slug?: string | null | undefined;
|
|
2093
|
+
readonly name: string;
|
|
2094
|
+
readonly documentType: string;
|
|
2095
|
+
readonly state: NonNullable<unknown>;
|
|
2096
|
+
readonly createdAtUtcIso: string | Date;
|
|
2097
|
+
readonly lastModifiedAtUtcIso: string | Date;
|
|
2098
|
+
readonly revisionsList: ReadonlyArray<{
|
|
2099
|
+
readonly scope: string;
|
|
2100
|
+
readonly revision: number;
|
|
2101
|
+
}>;
|
|
2102
|
+
};
|
|
2103
|
+
};
|
|
2070
2104
|
type AddRelationshipMutationVariables = Exact<{
|
|
2071
2105
|
sourceIdentifier: Scalars["String"]["input"];
|
|
2072
2106
|
targetIdentifier: Scalars["String"]["input"];
|
|
@@ -2518,6 +2552,7 @@ type MutationResolvers<ContextType = Context, ParentType extends ResolversParent
|
|
|
2518
2552
|
pushSyncEnvelopes?: Resolver<ResolversTypes["Boolean"], ParentType, ContextType, RequireFields<MutationPushSyncEnvelopesArgs, "envelopes">>;
|
|
2519
2553
|
removeRelationship?: Resolver<ResolversTypes["PHDocument"], ParentType, ContextType, RequireFields<MutationRemoveRelationshipArgs, "relationshipType" | "sourceIdentifier" | "targetIdentifier">>;
|
|
2520
2554
|
renameDocument?: Resolver<ResolversTypes["PHDocument"], ParentType, ContextType, RequireFields<MutationRenameDocumentArgs, "documentIdentifier" | "name">>;
|
|
2555
|
+
setPreferredEditor?: Resolver<ResolversTypes["PHDocument"], ParentType, ContextType, RequireFields<MutationSetPreferredEditorArgs, "documentIdentifier">>;
|
|
2521
2556
|
touchChannel?: Resolver<ResolversTypes["TouchChannelResult"], ParentType, ContextType, RequireFields<MutationTouchChannelArgs, "input">>;
|
|
2522
2557
|
}>;
|
|
2523
2558
|
type OperationContextResolvers<ContextType = Context, ParentType extends ResolversParentTypes["OperationContext"] = ResolversParentTypes["OperationContext"]> = ResolversObject<{
|
|
@@ -2695,6 +2730,7 @@ declare const CreateEmptyDocumentDocument: DocumentNode;
|
|
|
2695
2730
|
declare const MutateDocumentDocument: DocumentNode;
|
|
2696
2731
|
declare const MutateDocumentAsyncDocument: DocumentNode;
|
|
2697
2732
|
declare const RenameDocumentDocument: DocumentNode;
|
|
2733
|
+
declare const SetPreferredEditorDocument: DocumentNode;
|
|
2698
2734
|
declare const AddRelationshipDocument: DocumentNode;
|
|
2699
2735
|
declare const RemoveRelationshipDocument: DocumentNode;
|
|
2700
2736
|
declare const MoveRelationshipDocument: DocumentNode;
|
|
@@ -2720,6 +2756,7 @@ declare function getSdk<C>(requester: Requester<C>): {
|
|
|
2720
2756
|
MutateDocument(variables: MutateDocumentMutationVariables, options?: C): Promise<MutateDocumentMutation>;
|
|
2721
2757
|
MutateDocumentAsync(variables: MutateDocumentAsyncMutationVariables, options?: C): Promise<MutateDocumentAsyncMutation>;
|
|
2722
2758
|
RenameDocument(variables: RenameDocumentMutationVariables, options?: C): Promise<RenameDocumentMutation>;
|
|
2759
|
+
SetPreferredEditor(variables: SetPreferredEditorMutationVariables, options?: C): Promise<SetPreferredEditorMutation>;
|
|
2723
2760
|
AddRelationship(variables: AddRelationshipMutationVariables, options?: C): Promise<AddRelationshipMutation>;
|
|
2724
2761
|
RemoveRelationship(variables: RemoveRelationshipMutationVariables, options?: C): Promise<RemoveRelationshipMutation>;
|
|
2725
2762
|
MoveRelationship(variables: MoveRelationshipMutationVariables, options?: C): Promise<MoveRelationshipMutation>;
|
|
@@ -2799,6 +2836,11 @@ declare function createReactorGraphQLClient(url: string, fetchImpl?: FetchLike,
|
|
|
2799
2836
|
name: Scalars["String"]["input"];
|
|
2800
2837
|
branch?: InputMaybe<Scalars["String"]["input"]>;
|
|
2801
2838
|
}>, options?: {} | undefined): Promise<RenameDocumentMutation>;
|
|
2839
|
+
SetPreferredEditor(variables: Exact<{
|
|
2840
|
+
documentIdentifier: Scalars["String"]["input"];
|
|
2841
|
+
preferredEditor?: InputMaybe<Scalars["String"]["input"]>;
|
|
2842
|
+
branch?: InputMaybe<Scalars["String"]["input"]>;
|
|
2843
|
+
}>, options?: {} | undefined): Promise<SetPreferredEditorMutation>;
|
|
2802
2844
|
AddRelationship(variables: Exact<{
|
|
2803
2845
|
sourceIdentifier: Scalars["String"]["input"];
|
|
2804
2846
|
targetIdentifier: Scalars["String"]["input"];
|
|
@@ -2907,7 +2949,7 @@ declare class ImportPackageLoader implements IPackageLoader {
|
|
|
2907
2949
|
}
|
|
2908
2950
|
//#endregion
|
|
2909
2951
|
//#region src/packages/package-manager.d.ts
|
|
2910
|
-
declare function getUniqueDocumentModels(...documentModels: DocumentModelModule<any>[][]): DocumentModelModule[];
|
|
2952
|
+
declare function getUniqueDocumentModels(...documentModels: readonly (readonly DocumentModelModule<any>[])[]): DocumentModelModule[];
|
|
2911
2953
|
declare class PackageManager implements IPackageManager {
|
|
2912
2954
|
protected options: IPackageManagerOptions;
|
|
2913
2955
|
private readonly logger;
|
|
@@ -2991,7 +3033,16 @@ type ProcessorInitializer = ProcessorFactoryBuilder;
|
|
|
2991
3033
|
*
|
|
2992
3034
|
* @returns The API server components along with the created client instances.
|
|
2993
3035
|
*/
|
|
2994
|
-
|
|
3036
|
+
/**
|
|
3037
|
+
* Result of a client initializer. `reactorDriveClient` is optionally returned
|
|
3038
|
+
* alongside the reactor module so resolvers can dispatch reactor-drive parent
|
|
3039
|
+
* ops to it; legacy switchboards omit it.
|
|
3040
|
+
*/
|
|
3041
|
+
interface ClientInitializerResult {
|
|
3042
|
+
module: ReactorClientModule;
|
|
3043
|
+
reactorDriveClient?: IDriveClient;
|
|
3044
|
+
}
|
|
3045
|
+
declare function initializeAndStartAPI(clientInitializer: (documentModels: DocumentModelModule[]) => Promise<ClientInitializerResult>, options: Options, processorApp: ProcessorApp): Promise<API & {
|
|
2995
3046
|
client: IReactorClient;
|
|
2996
3047
|
syncManager: ISyncManager;
|
|
2997
3048
|
documentModelRegistry: IDocumentModelRegistry;
|
|
@@ -3030,5 +3081,5 @@ interface DocumentModelSchemaOptions {
|
|
|
3030
3081
|
*/
|
|
3031
3082
|
declare function generateDocumentModelSchema(documentModel: DocumentModelGlobalState$1, options?: DocumentModelSchemaOptions): DocumentNode;
|
|
3032
3083
|
//#endregion
|
|
3033
|
-
export { ADMIN_USERS, API, Action, ActionContext, ActionContextInput, ActionContextInputSchema, ActionContextResolvers, ActionInput, ActionInputSchema, ActionResolvers, AddRelationshipDocument, AddRelationshipMutation, AddRelationshipMutationVariables, AnalyticsSubgraph, Attachment, AttachmentInput, AttachmentInputSchema, AttachmentResolvers, AuthConfig, AuthContext, AuthFetchMiddleware, AuthService, AuthSubgraph, BaseSubgraph, ChannelMeta, ChannelMetaInput, ChannelMetaInputSchema, ChannelMetaResolvers, Context, CreateDocumentDocument, CreateDocumentMutation, CreateDocumentMutationVariables, CreateEmptyDocumentDocument, CreateEmptyDocumentMutation, CreateEmptyDocumentMutationVariables, DateTimeScalarConfig, DeadLetterInfo, DeadLetterInfoResolvers, DeleteDocumentDocument, DeleteDocumentMutation, DeleteDocumentMutationVariables, DeleteDocumentsDocument, DeleteDocumentsMutation, DeleteDocumentsMutationVariables, DirectiveResolverFn, DocumentChangeContext, DocumentChangeContextResolvers, DocumentChangeEvent, DocumentChangeEventResolvers, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentChangesSubscription, DocumentChangesSubscriptionVariables, DocumentGroupPermissionEntry, DocumentGroupPermissionTable, DocumentModelGlobalState, DocumentModelGlobalStateResolvers, DocumentModelResultPage, DocumentModelResultPageResolvers, DocumentModelSchemaOptions, DocumentOperationsFilterInput, DocumentOperationsFilterInputSchema, DocumentPermissionConfig, DocumentPermissionDatabase, DocumentPermissionEntry, DocumentPermissionLevel, DocumentPermissionService, DocumentPermissionTable, DocumentProtectionTable, DocumentWithChildren, DocumentWithChildrenResolvers, Exact, FetchHandler, FindDocumentsDocument, FindDocumentsQuery, FindDocumentsQueryVariables, GatewayAdapterType, GatewayContextFactory, GetDocumentDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentIncomingRelationshipsQuery, GetDocumentIncomingRelationshipsQueryVariables, GetDocumentModelsDocument, GetDocumentModelsQuery, GetDocumentModelsQueryVariables, GetDocumentOperationsDocument, GetDocumentOperationsQuery, GetDocumentOperationsQueryVariables, GetDocumentOutgoingRelationshipsDocument, GetDocumentOutgoingRelationshipsQuery, GetDocumentOutgoingRelationshipsQueryVariables, GetDocumentQuery, GetDocumentQueryVariables, GetDocumentWithOperationsDocument, GetDocumentWithOperationsQuery, GetDocumentWithOperationsQueryVariables, GetJobStatusDocument, GetJobStatusQuery, GetJobStatusQueryVariables, GetParentIdsFn, GqlDocument, GqlDriveDocument, GqlOperation, GqlOperationContext, GqlSigner, GqlSignerApp, GqlSignerUser, GraphQLManager, GraphqlManagerFeatureFlags, Group, GroupTable, HttpAdapterSetup, HttpAdapterType, HttpDocumentModelLoader, HttpPackageLoader, HttpPackageLoaderLogger, HttpPackageLoaderOptions, IGatewayAdapter, IHttpAdapter, type IPackageLoader, type IPackageLoaderOptions, IPackageStorage, ISubgraph, ImportPackageLoader, InMemoryPackageStorage, Incremental, InputMaybe, InstallPackageResult, InstalledPackageInfo, IsTypeOfResolverFn, JobChangeEvent, JobChangeEventResolvers, JobChangesDocument, JobChangesSubscription, JobChangesSubscriptionVariables, JobInfo, JobInfoResolvers, JsonObjectScalarConfig, MakeEmpty, MakeMaybe, MakeOptional, Maybe, MoveRelationshipDocument, MoveRelationshipMutation, MoveRelationshipMutationVariables, MoveRelationshipResult, MoveRelationshipResultResolvers, MutateDocumentAsyncDocument, MutateDocumentAsyncMutation, MutateDocumentAsyncMutationVariables, MutateDocumentDocument, MutateDocumentMutation, MutateDocumentMutationVariables, Mutation, MutationAddRelationshipArgs, MutationCreateDocumentArgs, MutationCreateEmptyDocumentArgs, MutationDeleteDocumentArgs, MutationDeleteDocumentsArgs, MutationMoveRelationshipArgs, MutationMutateDocumentArgs, MutationMutateDocumentAsyncArgs, MutationPushSyncEnvelopesArgs, MutationRemoveRelationshipArgs, MutationRenameDocumentArgs, MutationResolvers, MutationTouchChannelArgs, NextResolverFn, OperationContext, OperationContextInput, OperationContextInputSchema, OperationContextResolvers, OperationGroupPermissionEntry, OperationGroupPermissionTable, OperationInput, OperationInputSchema, OperationUserPermissionEntry, OperationUserPermissionTable, OperationWithContext, OperationWithContextInput, OperationWithContextInputSchema, OperationWithContextResolvers, OperationsFilterInput, OperationsFilterInputSchema, PackageManagementService, PackageManagementServiceOptions, PackageManager, PackagesSubgraph, type PackagesSubgraphArgs, PagingInput, PagingInputSchema, type ParsedDriveUrl, PgliteFactory, PhDocument, PhDocumentFieldsFragment, PhDocumentFieldsFragmentDoc, PhDocumentOperationsArgs, PhDocumentResolvers, PhDocumentResultPage, PhDocumentResultPageResolvers, PollSyncEnvelopesDocument, PollSyncEnvelopesQuery, PollSyncEnvelopesQueryVariables, PollSyncEnvelopesResult, PollSyncEnvelopesResultResolvers, Processor, ProcessorDriveFactory, ProcessorFactoryBuilder, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, PushSyncEnvelopesMutation, PushSyncEnvelopesMutationVariables, Query, QueryDocumentArgs, QueryDocumentIncomingRelationshipsArgs, QueryDocumentModelsArgs, QueryDocumentOperationsArgs, QueryDocumentOutgoingRelationshipsArgs, QueryFindDocumentsArgs, QueryJobStatusArgs, QueryPollSyncEnvelopesArgs, QueryResolvers, ReactorModule, ReactorOperation, ReactorOperationResolvers, ReactorOperationResultPage, ReactorOperationResultPageResolvers, ReactorSigner, ReactorSignerApp, ReactorSignerAppInput, ReactorSignerAppInputSchema, ReactorSignerAppResolvers, ReactorSignerInput, ReactorSignerInputSchema, ReactorSignerResolvers, ReactorSignerUser, ReactorSignerUserInput, ReactorSignerUserInputSchema, ReactorSignerUserResolvers, ReactorSubgraph, RemoteCursor, RemoteCursorInput, RemoteCursorInputSchema, RemoteCursorResolvers, RemoteFilterInput, RemoteFilterInputSchema, RemoveRelationshipDocument, RemoveRelationshipMutation, RemoveRelationshipMutationVariables, RenameDocumentDocument, RenameDocumentMutation, RenameDocumentMutationVariables, Requester, RequireFields, Resolver, ResolverFn, ResolverTypeWrapper, ResolverWithResolve, Resolvers, ResolversObject, ResolversParentTypes, ResolversTypes, Revision, RevisionResolvers, Scalars, Sdk, SearchFilterInput, SearchFilterInputSchema, SubgraphArgs, SubgraphClass, SubgraphDefinition, Subscription, SubscriptionDocumentChangesArgs, SubscriptionJobChangesArgs, SubscriptionObject, SubscriptionResolveFn, SubscriptionResolver, SubscriptionResolverObject, SubscriptionResolvers, SubscriptionSubscribeFn, SubscriptionSubscriberObject, SyncEnvelope, SyncEnvelopeInput, SyncEnvelopeInputSchema, SyncEnvelopeResolvers, SyncEnvelopeType, SyncEnvelopeTypeSchema, SystemSubgraph, TlsOptions, TouchChannelDocument, TouchChannelInput, TouchChannelInputSchema, TouchChannelMutation, TouchChannelMutationVariables, TouchChannelResult, TouchChannelResultResolvers, TypeResolveFn, User, UserGroupTable, ViewFilterInput, ViewFilterInputSchema, WithIndex, WsContextFactory, WsDisposer, 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 };
|
|
3084
|
+
export { ADMIN_USERS, API, Action, ActionContext, ActionContextInput, ActionContextInputSchema, ActionContextResolvers, ActionInput, ActionInputSchema, ActionResolvers, AddRelationshipDocument, AddRelationshipMutation, AddRelationshipMutationVariables, AnalyticsSubgraph, Attachment, AttachmentInput, AttachmentInputSchema, AttachmentResolvers, AuthConfig, AuthContext, AuthFetchMiddleware, AuthService, AuthSubgraph, BaseSubgraph, ChannelMeta, ChannelMetaInput, ChannelMetaInputSchema, ChannelMetaResolvers, ClientInitializerResult, Context, CreateDocumentDocument, CreateDocumentMutation, CreateDocumentMutationVariables, CreateEmptyDocumentDocument, CreateEmptyDocumentMutation, CreateEmptyDocumentMutationVariables, DateTimeScalarConfig, DbClient, DeadLetterInfo, DeadLetterInfoResolvers, DeleteDocumentDocument, DeleteDocumentMutation, DeleteDocumentMutationVariables, DeleteDocumentsDocument, DeleteDocumentsMutation, DeleteDocumentsMutationVariables, DirectiveResolverFn, DocumentChangeContext, DocumentChangeContextResolvers, DocumentChangeEvent, DocumentChangeEventResolvers, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentChangesSubscription, DocumentChangesSubscriptionVariables, DocumentGroupPermissionEntry, DocumentGroupPermissionTable, DocumentModelGlobalState, DocumentModelGlobalStateResolvers, DocumentModelResultPage, DocumentModelResultPageResolvers, DocumentModelSchemaOptions, DocumentOperationsFilterInput, DocumentOperationsFilterInputSchema, DocumentPermissionConfig, DocumentPermissionDatabase, DocumentPermissionEntry, DocumentPermissionLevel, DocumentPermissionService, DocumentPermissionTable, DocumentProtectionTable, DocumentWithChildren, DocumentWithChildrenResolvers, Exact, FetchHandler, FindDocumentsDocument, FindDocumentsQuery, FindDocumentsQueryVariables, GatewayAdapterType, GatewayContextFactory, GetDocumentDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentIncomingRelationshipsQuery, GetDocumentIncomingRelationshipsQueryVariables, GetDocumentModelsDocument, GetDocumentModelsQuery, GetDocumentModelsQueryVariables, GetDocumentOperationsDocument, GetDocumentOperationsQuery, GetDocumentOperationsQueryVariables, GetDocumentOutgoingRelationshipsDocument, GetDocumentOutgoingRelationshipsQuery, GetDocumentOutgoingRelationshipsQueryVariables, GetDocumentQuery, GetDocumentQueryVariables, GetDocumentWithOperationsDocument, GetDocumentWithOperationsQuery, GetDocumentWithOperationsQueryVariables, GetJobStatusDocument, GetJobStatusQuery, GetJobStatusQueryVariables, GetParentIdsFn, GqlDocument, GqlDriveDocument, GqlOperation, GqlOperationContext, GqlSigner, GqlSignerApp, GqlSignerUser, GraphQLManager, GraphqlManagerFeatureFlags, Group, GroupTable, HttpAdapterSetup, HttpAdapterType, HttpDocumentModelLoader, HttpPackageLoader, HttpPackageLoaderLogger, HttpPackageLoaderOptions, IGatewayAdapter, IHttpAdapter, type IPackageLoader, type IPackageLoaderOptions, IPackageStorage, ISubgraph, ImportPackageLoader, InMemoryPackageStorage, Incremental, InputMaybe, InstallPackageResult, InstalledPackageInfo, IsTypeOfResolverFn, JobChangeEvent, JobChangeEventResolvers, JobChangesDocument, JobChangesSubscription, JobChangesSubscriptionVariables, JobInfo, JobInfoResolvers, JsonObjectScalarConfig, MakeEmpty, MakeMaybe, MakeOptional, Maybe, MoveRelationshipDocument, MoveRelationshipMutation, MoveRelationshipMutationVariables, MoveRelationshipResult, MoveRelationshipResultResolvers, MutateDocumentAsyncDocument, MutateDocumentAsyncMutation, MutateDocumentAsyncMutationVariables, MutateDocumentDocument, MutateDocumentMutation, MutateDocumentMutationVariables, Mutation, MutationAddRelationshipArgs, MutationCreateDocumentArgs, MutationCreateEmptyDocumentArgs, MutationDeleteDocumentArgs, MutationDeleteDocumentsArgs, MutationMoveRelationshipArgs, MutationMutateDocumentArgs, MutationMutateDocumentAsyncArgs, MutationPushSyncEnvelopesArgs, MutationRemoveRelationshipArgs, MutationRenameDocumentArgs, MutationResolvers, MutationSetPreferredEditorArgs, MutationTouchChannelArgs, NextResolverFn, OperationContext, OperationContextInput, OperationContextInputSchema, OperationContextResolvers, OperationGroupPermissionEntry, OperationGroupPermissionTable, OperationInput, OperationInputSchema, OperationUserPermissionEntry, OperationUserPermissionTable, OperationWithContext, OperationWithContextInput, OperationWithContextInputSchema, OperationWithContextResolvers, OperationsFilterInput, OperationsFilterInputSchema, PackageManagementService, PackageManagementServiceOptions, PackageManager, PackagesSubgraph, type PackagesSubgraphArgs, PagingInput, PagingInputSchema, type ParsedDriveUrl, PgliteFactory, PhDocument, PhDocumentFieldsFragment, PhDocumentFieldsFragmentDoc, PhDocumentOperationsArgs, PhDocumentResolvers, PhDocumentResultPage, PhDocumentResultPageResolvers, PollSyncEnvelopesDocument, PollSyncEnvelopesQuery, PollSyncEnvelopesQueryVariables, PollSyncEnvelopesResult, PollSyncEnvelopesResultResolvers, Processor, ProcessorDriveFactory, ProcessorFactoryBuilder, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, PushSyncEnvelopesMutation, PushSyncEnvelopesMutationVariables, Query, QueryDocumentArgs, QueryDocumentIncomingRelationshipsArgs, QueryDocumentModelsArgs, QueryDocumentOperationsArgs, QueryDocumentOutgoingRelationshipsArgs, QueryFindDocumentsArgs, QueryJobStatusArgs, QueryPollSyncEnvelopesArgs, QueryResolvers, ReactorModule, ReactorOperation, ReactorOperationResolvers, ReactorOperationResultPage, ReactorOperationResultPageResolvers, ReactorSigner, ReactorSignerApp, ReactorSignerAppInput, ReactorSignerAppInputSchema, ReactorSignerAppResolvers, ReactorSignerInput, ReactorSignerInputSchema, ReactorSignerResolvers, ReactorSignerUser, ReactorSignerUserInput, ReactorSignerUserInputSchema, ReactorSignerUserResolvers, ReactorSubgraph, RemoteCursor, RemoteCursorInput, RemoteCursorInputSchema, RemoteCursorResolvers, RemoteFilterInput, RemoteFilterInputSchema, RemoveRelationshipDocument, RemoveRelationshipMutation, RemoveRelationshipMutationVariables, RenameDocumentDocument, RenameDocumentMutation, RenameDocumentMutationVariables, Requester, RequireFields, Resolver, ResolverFn, ResolverTypeWrapper, ResolverWithResolve, Resolvers, ResolversObject, ResolversParentTypes, ResolversTypes, Revision, RevisionResolvers, Scalars, Sdk, SearchFilterInput, SearchFilterInputSchema, SetPreferredEditorDocument, SetPreferredEditorMutation, SetPreferredEditorMutationVariables, SubgraphArgs, SubgraphClass, SubgraphDefinition, Subscription, SubscriptionDocumentChangesArgs, SubscriptionJobChangesArgs, SubscriptionObject, SubscriptionResolveFn, SubscriptionResolver, SubscriptionResolverObject, SubscriptionResolvers, SubscriptionSubscribeFn, SubscriptionSubscriberObject, SyncEnvelope, SyncEnvelopeInput, SyncEnvelopeInputSchema, SyncEnvelopeResolvers, SyncEnvelopeType, SyncEnvelopeTypeSchema, SystemSubgraph, TlsOptions, TouchChannelDocument, TouchChannelInput, TouchChannelInputSchema, TouchChannelMutation, TouchChannelMutationVariables, TouchChannelResult, TouchChannelResultResolvers, TypeResolveFn, User, UserGroupTable, ViewFilterInput, ViewFilterInputSchema, WithIndex, WsContextFactory, WsDisposer, 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 };
|
|
3034
3085
|
//# sourceMappingURL=index.d.mts.map
|