@rpcbase/server 0.511.0 → 0.512.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/index.js +12 -16
- package/dist/index.js.map +1 -1
- package/dist/{queryExecutor-Xh88REQn.js → queryExecutor-DSCpsVI8.js} +45 -2
- package/dist/queryExecutor-DSCpsVI8.js.map +1 -0
- package/dist/rts/index.d.ts.map +1 -1
- package/dist/rts/index.js +9 -3
- package/dist/rts/index.js.map +1 -1
- package/dist/rts/queryExecutor.d.ts +7 -1
- package/dist/rts/queryExecutor.d.ts.map +1 -1
- package/dist/rts/ssrHydration.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/queryExecutor-Xh88REQn.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -9,19 +9,18 @@ import { dirname, posix, sep } from "path";
|
|
|
9
9
|
import fs, { createReadStream, readFileSync } from "node:fs";
|
|
10
10
|
import { createInterface } from "node:readline";
|
|
11
11
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
12
|
-
import
|
|
13
|
-
import crypto, { hkdfSync, scrypt } from "crypto";
|
|
12
|
+
import { g as getDerivedKey, r as resolveRtsRequestTenantId, i as isRtsRequestAuthorized, b as buildRtsAbilityFromRequest, n as normalizeRtsQueryOptions, a as runRtsQuery } from "./queryExecutor-DSCpsVI8.js";
|
|
14
13
|
import httpProxy from "http-proxy-3";
|
|
15
14
|
import fsPromises from "node:fs/promises";
|
|
16
15
|
import inspector from "node:inspector";
|
|
17
16
|
import path from "node:path";
|
|
18
17
|
import { fileURLToPath } from "node:url";
|
|
18
|
+
import crypto, { scrypt } from "crypto";
|
|
19
19
|
import { Writable, Transform } from "node:stream";
|
|
20
20
|
import { StrictMode, createElement } from "react";
|
|
21
21
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
22
22
|
import { jsx } from "react/jsx-runtime";
|
|
23
23
|
import { createPath, matchRoutes, parsePath, createStaticRouter, StaticRouterProvider } from "@rpcbase/router";
|
|
24
|
-
import { r as resolveRtsRequestTenantId, i as isRtsRequestAuthorized, b as buildRtsAbilityFromRequest, n as normalizeRtsQueryOptions, a as runRtsQuery } from "./queryExecutor-Xh88REQn.js";
|
|
25
24
|
import { s } from "./email-DEw8keax.js";
|
|
26
25
|
function getDefaultExportFromCjs(x) {
|
|
27
26
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -3459,16 +3458,6 @@ const ensurePosthogShutdown = () => {
|
|
|
3459
3458
|
process.on("SIGINT", stop);
|
|
3460
3459
|
process.on("beforeExit", shutdown);
|
|
3461
3460
|
};
|
|
3462
|
-
const getDerivedKey = (masterKey, info, length = 32, salt = "") => {
|
|
3463
|
-
assert$1(masterKey?.length >= 32, "MASTER_KEY must be 32 chars or longer.");
|
|
3464
|
-
return Buffer.from(hkdfSync(
|
|
3465
|
-
"sha256",
|
|
3466
|
-
masterKey,
|
|
3467
|
-
Buffer.from(salt),
|
|
3468
|
-
Buffer.from(info),
|
|
3469
|
-
length
|
|
3470
|
-
)).toString("hex");
|
|
3471
|
-
};
|
|
3472
3461
|
const POSTHOG_INGEST_TARGET = "https://eu.i.posthog.com";
|
|
3473
3462
|
const getStatusCode = (errorCode) => {
|
|
3474
3463
|
if (typeof errorCode === "string" && /HPE_INVALID/.test(errorCode)) {
|
|
@@ -4441,6 +4430,7 @@ const createRtsSsrCollector = (req, opts) => {
|
|
|
4441
4430
|
const maxSerializedBytes = DEFAULT_MAX_SERIALIZED_BYTES;
|
|
4442
4431
|
const registrations = /* @__PURE__ */ new Map();
|
|
4443
4432
|
const resolved = /* @__PURE__ */ new Map();
|
|
4433
|
+
const resolvedPageInfo = /* @__PURE__ */ new Map();
|
|
4444
4434
|
const runtime = {
|
|
4445
4435
|
registerQuery(query) {
|
|
4446
4436
|
const modelName = typeof query.modelName === "string" ? query.modelName.trim() : "";
|
|
@@ -4458,6 +4448,9 @@ const createRtsSsrCollector = (req, opts) => {
|
|
|
4458
4448
|
},
|
|
4459
4449
|
getQueryData(modelName, queryKey) {
|
|
4460
4450
|
return resolved.get(makeRegistrationKey(modelName, queryKey));
|
|
4451
|
+
},
|
|
4452
|
+
getQueryPageInfo(modelName, queryKey) {
|
|
4453
|
+
return resolvedPageInfo.get(makeRegistrationKey(modelName, queryKey));
|
|
4461
4454
|
}
|
|
4462
4455
|
};
|
|
4463
4456
|
const resolve = async () => {
|
|
@@ -4472,18 +4465,19 @@ const createRtsSsrCollector = (req, opts) => {
|
|
|
4472
4465
|
for (const registration of registrations.values()) {
|
|
4473
4466
|
const options = normalizeRtsQueryOptions(registration.options);
|
|
4474
4467
|
try {
|
|
4475
|
-
const
|
|
4468
|
+
const result = await runRtsQuery({
|
|
4476
4469
|
tenantId,
|
|
4477
4470
|
ability,
|
|
4478
4471
|
modelName: registration.modelName,
|
|
4479
4472
|
query: registration.query,
|
|
4480
4473
|
options
|
|
4481
4474
|
});
|
|
4482
|
-
const boundedData = maxDocsPerQuery > 0 ? data.slice(0, maxDocsPerQuery) : data;
|
|
4475
|
+
const boundedData = maxDocsPerQuery > 0 ? result.data.slice(0, maxDocsPerQuery) : result.data;
|
|
4483
4476
|
queryEntries.push({
|
|
4484
4477
|
modelName: registration.modelName,
|
|
4485
4478
|
queryKey: registration.queryKey,
|
|
4486
|
-
data: boundedData
|
|
4479
|
+
data: boundedData,
|
|
4480
|
+
...result.pageInfo ? { pageInfo: result.pageInfo } : {}
|
|
4487
4481
|
});
|
|
4488
4482
|
} catch {
|
|
4489
4483
|
continue;
|
|
@@ -4505,8 +4499,10 @@ const createRtsSsrCollector = (req, opts) => {
|
|
|
4505
4499
|
}
|
|
4506
4500
|
}
|
|
4507
4501
|
resolved.clear();
|
|
4502
|
+
resolvedPageInfo.clear();
|
|
4508
4503
|
for (const entry of payload.queries) {
|
|
4509
4504
|
resolved.set(makeRegistrationKey(entry.modelName, entry.queryKey), entry.data);
|
|
4505
|
+
resolvedPageInfo.set(makeRegistrationKey(entry.modelName, entry.queryKey), entry.pageInfo);
|
|
4510
4506
|
}
|
|
4511
4507
|
return payload.queries.length ? payload : null;
|
|
4512
4508
|
};
|