@quatronic/sdk 0.8.0-rc.12 → 0.8.0-rc.13
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/{chunk-2AYDFLKR.js → chunk-F3NHTHFO.js} +6 -104
- package/dist/chunk-F3NHTHFO.js.map +1 -0
- package/dist/chunk-P7HNHLW7.js +65 -0
- package/dist/chunk-P7HNHLW7.js.map +1 -0
- package/dist/chunk-QMOZDE3U.js +158 -0
- package/dist/chunk-QMOZDE3U.js.map +1 -0
- package/dist/chunk-TOBGX4CZ.js +109 -0
- package/dist/chunk-TOBGX4CZ.js.map +1 -0
- package/dist/chunk-WU7N4PET.js +20 -0
- package/dist/chunk-WU7N4PET.js.map +1 -0
- package/dist/cli/legacy/qdc-sourcemaps.js +16 -6
- package/dist/cli/sourcemaps.js +16 -6
- package/dist/integrations/index.d.ts +3 -75
- package/dist/integrations/index.js +6 -4
- package/dist/mail/index.d.ts +9 -0
- package/dist/mail/index.js +26 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/next/auth/index.js +3 -152
- package/dist/next/auth/index.js.map +1 -1
- package/dist/next/boot/index.d.ts +33 -0
- package/dist/next/boot/index.js +21 -0
- package/dist/next/boot/index.js.map +1 -0
- package/dist/next/db/index.d.ts +18 -1
- package/dist/next/db/index.js +25 -0
- package/dist/next/db/index.js.map +1 -1
- package/dist/next/global-error/index.d.ts +9 -0
- package/dist/next/global-error/index.js +17 -0
- package/dist/next/global-error/index.js.map +1 -0
- package/dist/next/integrations/index.d.ts +2 -1
- package/dist/next/integrations/index.js +6 -4
- package/dist/next/platform/index.d.ts +19 -0
- package/dist/next/platform/index.js +44 -0
- package/dist/next/platform/index.js.map +1 -0
- package/dist/next/security/index.d.ts +23 -1
- package/dist/next/security/index.js +39 -56
- package/dist/next/security/index.js.map +1 -1
- package/dist/next/security/testing.js +10 -1
- package/dist/next/security/testing.js.map +1 -1
- package/dist/next/sentry/register.js +5 -13
- package/dist/next/sentry/register.js.map +1 -1
- package/dist/node/boot/index.d.ts +9 -0
- package/dist/node/boot/index.js +13 -0
- package/dist/node/boot/index.js.map +1 -0
- package/dist/node/integrations/index.d.ts +2 -1
- package/dist/node/integrations/index.js +6 -4
- package/dist/node-Z7ERWJDZ.js +46 -0
- package/dist/node-Z7ERWJDZ.js.map +1 -0
- package/dist/types-CAwj03sM.d.ts +75 -0
- package/migrations/bootstrap-qore-env/codemod.mjs +77 -0
- package/migrations/bootstrap-qore-env/instructions.md +28 -0
- package/migrations/bootstrap-qore-env/meta.json +7 -0
- package/migrations/global-error/codemod.mjs +28 -0
- package/migrations/global-error/instructions.md +26 -0
- package/migrations/global-error/meta.json +7 -0
- package/migrations/local-db-port/codemod.mjs +61 -0
- package/migrations/local-db-port/instructions.md +45 -0
- package/migrations/local-db-port/meta.json +7 -0
- package/migrations/mail-reexport/codemod.mjs +64 -0
- package/migrations/mail-reexport/instructions.md +27 -0
- package/migrations/mail-reexport/meta.json +7 -0
- package/migrations/no-raw-fetch/meta.json +1 -1
- package/migrations/platform-routes/codemod.mjs +45 -0
- package/migrations/platform-routes/instructions.md +30 -0
- package/migrations/platform-routes/meta.json +7 -0
- package/migrations/qore-boot/codemod.mjs +263 -0
- package/migrations/qore-boot/instructions.md +74 -0
- package/migrations/qore-boot/meta.json +7 -0
- package/migrations/qore-proxy/codemod.mjs +88 -0
- package/migrations/qore-proxy/instructions.md +56 -0
- package/migrations/qore-proxy/meta.json +7 -0
- package/migrations/run.mjs +334 -0
- package/migrations/sourcemaps-finalize/codemod.mjs +63 -0
- package/migrations/sourcemaps-finalize/instructions.md +56 -0
- package/migrations/sourcemaps-finalize/meta.json +7 -0
- package/package.json +23 -2
- package/workspace-requirements.json +4 -0
- package/dist/chunk-2AYDFLKR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/next/security/testing.ts"],"sourcesContent":["import { ALWAYS_EXCLUDED } from \"../../security-core/proxy\"\nimport type { SecuredProxy } from \"./index\"\n\n/**\n * The security-header contract, as a list of checks an app runs against its own\n * proxy.\n *\n * These are not tests of `@quatronic/sdk` — this package has its own. They are\n * for the generated app, so that removing `withSecurityHeaders` from\n * `src/proxy.ts`, or matching so few routes that it stops running, fails that\n * app's build rather than being noticed in a penetration test.\n *\n * It returns checks rather than declaring them, so this module needs no test\n * runner of its own and works under whichever one the app uses:\n *\n * import { describe, it } from \"vitest\"\n * import { securityHeaderChecks } from \"@quatronic/sdk/next/security/testing\"\n * import { config, proxy } from \"@/proxy\"\n *\n * describe(\"security headers\", () => {\n * for (const check of securityHeaderChecks({ proxy, config })) it(check.name, check.run)\n * })\n *\n * A failing check throws with the header it wanted and the value it got, which\n * every runner reports as the test failure.\n */\n\nexport interface SecurityContractCookie {\n name: string\n value: string\n}\n\nexport interface SecurityContractTarget {\n /** The app's `proxy` export — the value `withSecurityHeaders` returned. */\n proxy: SecuredProxy\n /** The app's `config` export. Its matcher is checked too. */\n config: { matcher: readonly string[] }\n /**\n * Cookies that make a request look signed-in, so an auth module's proxy\n * passes it through instead of redirecting.\n *\n * Defaults to both QDC session cookies at once, which is what lets one\n * shipped test file cover every recipe: an app generated from `next-auth`\n * reads `qdc_session`, one from `next-betterauth` reads\n * `better-auth.session_token`, and a `next-base` app reads neither.\n */\n sessionCookies?: readonly SecurityContractCookie[]\n /** The URL the stub request carries. Must be a route the matcher covers. */\n url?: string\n}\n\nexport interface SecurityCheck {\n name: string\n run: () => Promise<void>\n}\n\nconst DEFAULT_SESSION_COOKIES: SecurityContractCookie[] = [\n { name: \"qdc_session\", value: \"test\" },\n { name: \"better-auth.session_token\", value: \"test\" },\n]\n\nconst DEFAULT_URL = \"https://app.example.test/dashboard\"\n\nfunction nextUrlStub(href: string): URL {\n return Object.assign(new URL(href), { clone: () => nextUrlStub(href) })\n}\n\n/**\n * Enough of a `NextRequest` for a proxy: the URL it can clone and the cookie\n * jar it reads. Casting through `unknown` keeps the stub honest about being one\n * — a partial `NextRequest` is exactly what this is.\n */\nfunction makeRequest(url: string, cookies: readonly SecurityContractCookie[]): NextRequestStub {\n return Object.assign(new Request(url), {\n nextUrl: nextUrlStub(url),\n cookies: {\n has: (name: string) => cookies.some((cookie) => cookie.name === name),\n get: (name: string) => cookies.find((cookie) => cookie.name === name),\n getAll: () => [...cookies],\n },\n }) as unknown as NextRequestStub\n}\n\ntype NextRequestStub = Parameters<SecuredProxy>[0]\n\n/** No runtime reads the fetch event, and jsdom has no `NextFetchEvent`. */\nconst NO_EVENT = {} as unknown as Parameters<SecuredProxy>[1]\n\nfunction cspOf(response: Response): string {\n return (\n response.headers.get(\"content-security-policy\") ??\n response.headers.get(\"content-security-policy-report-only\") ??\n \"\"\n )\n}\n\nfunction nonceOf(csp: string): string | undefined {\n return /'nonce-([^']+)'/.exec(csp)?.[1]\n}\n\nfunction expectHeader(response: Response, name: string, value: string): void {\n const actual = response.headers.get(name)\n if (actual !== value) {\n throw new Error(\n `${name}: expected ${JSON.stringify(value)}, got ${actual === null ? \"no header\" : JSON.stringify(actual)}`,\n )\n }\n}\n\nfunction expectContains(actual: string, needle: string, what: string): void {\n if (!actual.includes(needle)) {\n throw new Error(`${what}: expected it to contain ${JSON.stringify(needle)}, got ${JSON.stringify(actual)}`)\n }\n}\n\nexport function securityHeaderChecks(target: SecurityContractTarget): SecurityCheck[] {\n const url = target.url ?? DEFAULT_URL\n const signedIn = target.sessionCookies ?? DEFAULT_SESSION_COOKIES\n const run = (cookies: readonly SecurityContractCookie[]): Promise<Response> =>\n Promise.resolve(target.proxy(makeRequest(url, cookies), NO_EVENT))\n\n return [\n {\n name: \"sends the static headers on a signed-in request\",\n async run() {\n const response = await run(signedIn)\n expectHeader(response, \"x-content-type-options\", \"nosniff\")\n expectHeader(response, \"x-frame-options\", \"DENY\")\n expectHeader(response, \"referrer-policy\", \"strict-origin-when-cross-origin\")\n expectHeader(response, \"cross-origin-resource-policy\", \"same-origin\")\n expectContains(\n response.headers.get(\"strict-transport-security\") ?? \"\",\n \"max-age=\",\n \"strict-transport-security\",\n )\n expectContains(\n response.headers.get(\"permissions-policy\") ?? \"\",\n \"camera=()\",\n \"permissions-policy\",\n )\n },\n },\n {\n name: \"sends them on a request with no session too\",\n async run() {\n // Whatever this app does with an anonymous request — pass it through or\n // redirect it to a login — the response is still one the browser hardens.\n const response = await run([])\n expectHeader(response, \"x-content-type-options\", \"nosniff\")\n expectContains(cspOf(response), \"default-src 'self'\", \"content-security-policy\")\n },\n },\n {\n name: \"builds a CSP with a fresh nonce per response\",\n async run() {\n const first = cspOf(await run(signedIn))\n const second = cspOf(await run(signedIn))\n\n expectContains(first, \"'strict-dynamic'\", \"content-security-policy\")\n expectContains(first, \"frame-ancestors 'none'\", \"content-security-policy\")\n expectContains(first, \"object-src 'none'\", \"content-security-policy\")\n expectContains(first, \"report-uri /api/csp-report\", \"content-security-policy\")\n\n const nonce = nonceOf(first)\n if (!nonce) throw new Error(`content-security-policy carries no nonce: ${first}`)\n if (nonce === nonceOf(second)) {\n throw new Error(`two responses shared one nonce (${nonce}); a reused nonce protects nothing`)\n }\n },\n },\n {\n name: \"hands the nonce to the renderer on the forwarded request\",\n async run() {\n // A nonce only protects anything if the page carrying it is the page the\n // nonce was minted for. Next reads it off the request's CSP header.\n const response = await run(signedIn)\n const nonce = nonceOf(cspOf(response))\n if (!nonce) throw new Error(\"content-security-policy carries no nonce\")\n\n expectHeader(response, \"x-middleware-request-x-qdc-nonce\", nonce)\n expectContains(\n response.headers.get(\"x-middleware-request-content-security-policy\") ?? \"\",\n `'nonce-${nonce}'`,\n \"the forwarded request's content-security-policy\",\n )\n },\n },\n {\n name: \"matches every route that serves HTML\",\n run() {\n if (target.config.matcher.length === 0) {\n throw new Error(\"config.matcher is empty, so the proxy never runs\")\n }\n // Next extracts `config` statically, so the app writes this as a\n // literal rather than calling `proxyMatcher`. That makes the literal\n // the thing that can drift, and this the check that catches it: the\n // build output and the image optimizer are the only sanctioned holes,\n // and nonce-ing them would be pointless work on every asset request.\n for (const pattern of target.config.matcher) {\n for (const excluded of ALWAYS_EXCLUDED) {\n expectContains(pattern, excluded, \"config.matcher entry\")\n }\n }\n return Promise.resolve()\n },\n },\n ]\n}\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/next/security/testing.ts"],"sourcesContent":["import { ALWAYS_EXCLUDED } from \"../../security-core/proxy\"\nimport { QORE_CSP_REPORT_URI } from \"../../security-core/cspReport\"\nimport type { SecuredProxy } from \"./index\"\n\n/**\n * The security-header contract, as a list of checks an app runs against its own\n * proxy.\n *\n * These are not tests of `@quatronic/sdk` — this package has its own. They are\n * for the generated app, so that removing `withSecurityHeaders` from\n * `src/proxy.ts`, or matching so few routes that it stops running, fails that\n * app's build rather than being noticed in a penetration test.\n *\n * It returns checks rather than declaring them, so this module needs no test\n * runner of its own and works under whichever one the app uses:\n *\n * import { describe, it } from \"vitest\"\n * import { securityHeaderChecks } from \"@quatronic/sdk/next/security/testing\"\n * import { config, proxy } from \"@/proxy\"\n *\n * describe(\"security headers\", () => {\n * for (const check of securityHeaderChecks({ proxy, config })) it(check.name, check.run)\n * })\n *\n * A failing check throws with the header it wanted and the value it got, which\n * every runner reports as the test failure.\n */\n\nexport interface SecurityContractCookie {\n name: string\n value: string\n}\n\nexport interface SecurityContractTarget {\n /** The app's `proxy` export — the value `withSecurityHeaders` returned. */\n proxy: SecuredProxy\n /** The app's `config` export. Its matcher is checked too. */\n config: { matcher: readonly string[] }\n /**\n * Cookies that make a request look signed-in, so an auth module's proxy\n * passes it through instead of redirecting.\n *\n * Defaults to both QDC session cookies at once, which is what lets one\n * shipped test file cover every recipe: an app generated from `next-auth`\n * reads `qdc_session`, one from `next-betterauth` reads\n * `better-auth.session_token`, and a `next-base` app reads neither.\n */\n sessionCookies?: readonly SecurityContractCookie[]\n /** The URL the stub request carries. Must be a route the matcher covers. */\n url?: string\n}\n\nexport interface SecurityCheck {\n name: string\n run: () => Promise<void>\n}\n\nconst DEFAULT_SESSION_COOKIES: SecurityContractCookie[] = [\n { name: \"qdc_session\", value: \"test\" },\n { name: \"better-auth.session_token\", value: \"test\" },\n]\n\nconst DEFAULT_URL = \"https://app.example.test/dashboard\"\n\nfunction nextUrlStub(href: string): URL {\n return Object.assign(new URL(href), { clone: () => nextUrlStub(href) })\n}\n\n/**\n * Enough of a `NextRequest` for a proxy: the URL it can clone and the cookie\n * jar it reads. Casting through `unknown` keeps the stub honest about being one\n * — a partial `NextRequest` is exactly what this is.\n */\nfunction makeRequest(url: string, cookies: readonly SecurityContractCookie[]): NextRequestStub {\n return Object.assign(new Request(url), {\n nextUrl: nextUrlStub(url),\n cookies: {\n has: (name: string) => cookies.some((cookie) => cookie.name === name),\n get: (name: string) => cookies.find((cookie) => cookie.name === name),\n getAll: () => [...cookies],\n },\n }) as unknown as NextRequestStub\n}\n\ntype NextRequestStub = Parameters<SecuredProxy>[0]\n\n/** No runtime reads the fetch event, and jsdom has no `NextFetchEvent`. */\nconst NO_EVENT = {} as unknown as Parameters<SecuredProxy>[1]\n\nfunction cspOf(response: Response): string {\n return (\n response.headers.get(\"content-security-policy\") ??\n response.headers.get(\"content-security-policy-report-only\") ??\n \"\"\n )\n}\n\nfunction nonceOf(csp: string): string | undefined {\n return /'nonce-([^']+)'/.exec(csp)?.[1]\n}\n\nfunction expectHeader(response: Response, name: string, value: string): void {\n const actual = response.headers.get(name)\n if (actual !== value) {\n throw new Error(\n `${name}: expected ${JSON.stringify(value)}, got ${actual === null ? \"no header\" : JSON.stringify(actual)}`,\n )\n }\n}\n\nconst REPORT_URIS = [\"/api/csp-report\", QORE_CSP_REPORT_URI]\n\nfunction expectContains(actual: string, needle: string, what: string): void {\n if (!actual.includes(needle)) {\n throw new Error(`${what}: expected it to contain ${JSON.stringify(needle)}, got ${JSON.stringify(actual)}`)\n }\n}\n\nexport function securityHeaderChecks(target: SecurityContractTarget): SecurityCheck[] {\n const url = target.url ?? DEFAULT_URL\n const signedIn = target.sessionCookies ?? DEFAULT_SESSION_COOKIES\n const run = (cookies: readonly SecurityContractCookie[]): Promise<Response> =>\n Promise.resolve(target.proxy(makeRequest(url, cookies), NO_EVENT))\n\n return [\n {\n name: \"sends the static headers on a signed-in request\",\n async run() {\n const response = await run(signedIn)\n expectHeader(response, \"x-content-type-options\", \"nosniff\")\n expectHeader(response, \"x-frame-options\", \"DENY\")\n expectHeader(response, \"referrer-policy\", \"strict-origin-when-cross-origin\")\n expectHeader(response, \"cross-origin-resource-policy\", \"same-origin\")\n expectContains(\n response.headers.get(\"strict-transport-security\") ?? \"\",\n \"max-age=\",\n \"strict-transport-security\",\n )\n expectContains(\n response.headers.get(\"permissions-policy\") ?? \"\",\n \"camera=()\",\n \"permissions-policy\",\n )\n },\n },\n {\n name: \"sends them on a request with no session too\",\n async run() {\n // Whatever this app does with an anonymous request — pass it through or\n // redirect it to a login — the response is still one the browser hardens.\n const response = await run([])\n expectHeader(response, \"x-content-type-options\", \"nosniff\")\n expectContains(cspOf(response), \"default-src 'self'\", \"content-security-policy\")\n },\n },\n {\n name: \"builds a CSP with a fresh nonce per response\",\n async run() {\n const first = cspOf(await run(signedIn))\n const second = cspOf(await run(signedIn))\n\n expectContains(first, \"'strict-dynamic'\", \"content-security-policy\")\n expectContains(first, \"frame-ancestors 'none'\", \"content-security-policy\")\n expectContains(first, \"object-src 'none'\", \"content-security-policy\")\n // `withSecurityHeaders` reports to the app's own route, `qoreProxy` to the\n // platform's; either one collects the evidence.\n if (!REPORT_URIS.some((uri) => first.includes(`report-uri ${uri}`))) {\n throw new Error(\n `content-security-policy: expected a report-uri of ${REPORT_URIS.join(\" or \")}, got ${JSON.stringify(first)}`,\n )\n }\n\n const nonce = nonceOf(first)\n if (!nonce) throw new Error(`content-security-policy carries no nonce: ${first}`)\n if (nonce === nonceOf(second)) {\n throw new Error(`two responses shared one nonce (${nonce}); a reused nonce protects nothing`)\n }\n },\n },\n {\n name: \"hands the nonce to the renderer on the forwarded request\",\n async run() {\n // A nonce only protects anything if the page carrying it is the page the\n // nonce was minted for. Next reads it off the request's CSP header.\n const response = await run(signedIn)\n const nonce = nonceOf(cspOf(response))\n if (!nonce) throw new Error(\"content-security-policy carries no nonce\")\n\n expectHeader(response, \"x-middleware-request-x-qdc-nonce\", nonce)\n expectContains(\n response.headers.get(\"x-middleware-request-content-security-policy\") ?? \"\",\n `'nonce-${nonce}'`,\n \"the forwarded request's content-security-policy\",\n )\n },\n },\n {\n name: \"matches every route that serves HTML\",\n run() {\n if (target.config.matcher.length === 0) {\n throw new Error(\"config.matcher is empty, so the proxy never runs\")\n }\n // Next extracts `config` statically, so the app writes this as a\n // literal rather than calling `proxyMatcher`. That makes the literal\n // the thing that can drift, and this the check that catches it: the\n // build output and the image optimizer are the only sanctioned holes,\n // and nonce-ing them would be pointless work on every asset request.\n for (const pattern of target.config.matcher) {\n for (const excluded of ALWAYS_EXCLUDED) {\n expectContains(pattern, excluded, \"config.matcher entry\")\n }\n }\n return Promise.resolve()\n },\n },\n ]\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
onRequestError,
|
|
3
|
+
register
|
|
4
|
+
} from "../../chunk-WU7N4PET.js";
|
|
5
|
+
import "../../chunk-G7VPNC6M.js";
|
|
4
6
|
import "../../chunk-MET4SIMB.js";
|
|
5
|
-
import
|
|
6
|
-
readSentryConfig
|
|
7
|
-
} from "../../chunk-7ASQHY7O.js";
|
|
8
|
-
|
|
9
|
-
// src/next/sentry/register.ts
|
|
10
|
-
import * as Sentry from "@sentry/nextjs";
|
|
11
|
-
async function register() {
|
|
12
|
-
const runtime = process.env.NEXT_RUNTIME === "edge" ? "edge" : "node";
|
|
13
|
-
initSentry(Sentry, runtime, readSentryConfig(process.env, { frontend: true }));
|
|
14
|
-
}
|
|
15
|
-
var onRequestError = Sentry.captureRequestError;
|
|
7
|
+
import "../../chunk-7ASQHY7O.js";
|
|
16
8
|
export {
|
|
17
9
|
onRequestError,
|
|
18
10
|
register
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { I as IntegrationMap } from '../../types-CAwj03sM.js';
|
|
2
|
+
|
|
3
|
+
interface QoreBootOptions {
|
|
4
|
+
/** The backend's `integrations` from `./config/integrations.js`. */
|
|
5
|
+
integrations?: IntegrationMap;
|
|
6
|
+
}
|
|
7
|
+
declare function qoreBoot(options?: QoreBootOptions): void;
|
|
8
|
+
|
|
9
|
+
export { type QoreBootOptions, qoreBoot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertIntegrations
|
|
3
|
+
} from "../../chunk-TOBGX4CZ.js";
|
|
4
|
+
import "../../chunk-5XMTUPIY.js";
|
|
5
|
+
|
|
6
|
+
// src/node/boot/index.ts
|
|
7
|
+
function qoreBoot(options = {}) {
|
|
8
|
+
if (options.integrations) assertIntegrations(options.integrations);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
qoreBoot
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/node/boot/index.ts"],"sourcesContent":["// The platform's boot steps for a Node backend, called once at the top of\n// `src/index.ts`. Sentry itself starts earlier, through\n// `node --import @quatronic/sdk/node/sentry/register`; everything after that\n// lives here, so a new boot step reaches every backend as an SDK release.\nimport { assertIntegrations } from \"../../integrations-core/assertIntegrations\"\nimport type { IntegrationMap } from \"../../integrations-core/types\"\n\nexport interface QoreBootOptions {\n /** The backend's `integrations` from `./config/integrations.js`. */\n integrations?: IntegrationMap\n}\n\nexport function qoreBoot(options: QoreBootOptions = {}): void {\n // Visibility, never a gate: one warning per required integration key that is\n // unset. The service starts regardless; only calls to that integration fail.\n if (options.integrations) assertIntegrations(options.integrations)\n}\n"],"mappings":";;;;;;AAYO,SAAS,SAAS,UAA2B,CAAC,GAAS;AAG5D,MAAI,QAAQ,aAAc,oBAAmB,QAAQ,YAAY;AACnE;","names":[]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { AUTH_ENV_FIELDS, AUTH_SECRET_FIELDS, AuthKind,
|
|
1
|
+
export { A as AUTH_ENV_FIELDS, b as AUTH_SECRET_FIELDS, c as AuthKind, d as EnvKey, E as EnvRef, e as IntegrationAuth, a as IntegrationDefinition, I as IntegrationMap, P as Protocol, R as RESERVED_KEY_PREFIX, f as defineIntegrations } from '../../types-CAwj03sM.js';
|
|
2
|
+
export { DEFAULT_INTEGRATION_TIMEOUT_MS, INTEGRATION_ALIAS_ATTR, INTEGRATION_SPAN_TYPE, INTEGRATION_SPAN_TYPE_ATTR, IntegrationClient, IntegrationConfig, IntegrationError, IntegrationErrorCode, IntegrationHandle, IntegrationProblem, IntegrationRequest, OAUTH_REFRESH_SKEW_MS, PLATFORM_MANAGED_HOSTS, ParamValue, allKeys, assertIntegrations, createIntegrationClient, isPlatformManagedHost, loggingEnabled, loggingKey, readRef, requiredKeys } from '../../integrations/index.js';
|
|
2
3
|
import '../../env-R-bci5RU.js';
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AUTH_ENV_FIELDS,
|
|
3
|
-
AUTH_SECRET_FIELDS,
|
|
4
2
|
DEFAULT_INTEGRATION_TIMEOUT_MS,
|
|
5
3
|
INTEGRATION_ALIAS_ATTR,
|
|
6
4
|
INTEGRATION_SPAN_TYPE,
|
|
7
5
|
INTEGRATION_SPAN_TYPE_ATTR,
|
|
8
6
|
IntegrationError,
|
|
9
7
|
OAUTH_REFRESH_SKEW_MS,
|
|
8
|
+
createIntegrationClient
|
|
9
|
+
} from "../../chunk-F3NHTHFO.js";
|
|
10
|
+
import {
|
|
11
|
+
AUTH_ENV_FIELDS,
|
|
12
|
+
AUTH_SECRET_FIELDS,
|
|
10
13
|
RESERVED_KEY_PREFIX,
|
|
11
14
|
allKeys,
|
|
12
15
|
assertIntegrations,
|
|
13
|
-
createIntegrationClient,
|
|
14
16
|
defineIntegrations,
|
|
15
17
|
loggingEnabled,
|
|
16
18
|
loggingKey,
|
|
17
19
|
readRef,
|
|
18
20
|
requiredKeys
|
|
19
|
-
} from "../../chunk-
|
|
21
|
+
} from "../../chunk-TOBGX4CZ.js";
|
|
20
22
|
import {
|
|
21
23
|
PLATFORM_MANAGED_HOSTS,
|
|
22
24
|
isPlatformManagedHost
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertIntegrations
|
|
3
|
+
} from "./chunk-TOBGX4CZ.js";
|
|
4
|
+
import "./chunk-5XMTUPIY.js";
|
|
5
|
+
import {
|
|
6
|
+
runAuthMigrations
|
|
7
|
+
} from "./chunk-QMOZDE3U.js";
|
|
8
|
+
import {
|
|
9
|
+
createMigrationDb,
|
|
10
|
+
parseRoleFromUrl
|
|
11
|
+
} from "./chunk-BJN7YE63.js";
|
|
12
|
+
import "./chunk-4MBB2UQW.js";
|
|
13
|
+
|
|
14
|
+
// src/next/boot/node.ts
|
|
15
|
+
import * as Sentry from "@sentry/nextjs";
|
|
16
|
+
function required(key) {
|
|
17
|
+
const value = process.env[key];
|
|
18
|
+
if (!value) throw new Error(`qoreRegister: ${key} is required`);
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
async function bootNode(boot) {
|
|
22
|
+
if (boot.integrations) {
|
|
23
|
+
assertIntegrations((await boot.integrations()).integrations);
|
|
24
|
+
}
|
|
25
|
+
if (boot.env) (await boot.env()).serverEnv();
|
|
26
|
+
if (boot.authMigrations) {
|
|
27
|
+
const { db, close } = createMigrationDb(required("MIGRATION_DATABASE_URL"));
|
|
28
|
+
try {
|
|
29
|
+
await runAuthMigrations(db, { runtimeRole: parseRoleFromUrl(required("DATABASE_URL")) });
|
|
30
|
+
} finally {
|
|
31
|
+
await close();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (boot.migrations) await (await boot.migrations()).runAppMigrations();
|
|
35
|
+
if (boot.seed && process.env.QORE_RUN_SEED === "true") {
|
|
36
|
+
try {
|
|
37
|
+
await (await boot.seed()).default();
|
|
38
|
+
} catch (err) {
|
|
39
|
+
Sentry.captureException(err, { tags: { "qore.seed.phase": "boot" } });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
bootNode
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=node-Z7ERWJDZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/next/boot/node.ts"],"sourcesContent":["// The Node-runtime half of qoreRegister. Loaded only behind the NEXT_RUNTIME\n// check in ./index.ts, so pg, drizzle and the auth migrations never reach the\n// edge bundle.\nimport * as Sentry from \"@sentry/nextjs\"\nimport { runAuthMigrations } from \"../../auth-core/migrate\"\nimport { createMigrationDb, parseRoleFromUrl } from \"../../db-core/migration-db\"\nimport { assertIntegrations } from \"../../integrations-core/assertIntegrations\"\nimport type { NodeBoot } from \"./types\"\n\nfunction required(key: string): string {\n const value = process.env[key]\n if (!value) throw new Error(`qoreRegister: ${key} is required`)\n return value\n}\n\nexport async function bootNode(boot: NodeBoot): Promise<void> {\n if (boot.integrations) {\n // Visibility, never a gate: one warning per required integration key that\n // is unset. The app boots regardless; only calls to that integration fail.\n assertIntegrations((await boot.integrations()).integrations)\n }\n\n // Validating the app's env first turns a missing key into the app's own\n // \"copy values from the portal\" message instead of a database error.\n if (boot.env) (await boot.env()).serverEnv()\n\n if (boot.authMigrations) {\n const { db, close } = createMigrationDb(required(\"MIGRATION_DATABASE_URL\"))\n try {\n await runAuthMigrations(db, { runtimeRole: parseRoleFromUrl(required(\"DATABASE_URL\")) })\n } finally {\n await close()\n }\n }\n\n if (boot.migrations) await (await boot.migrations()).runAppMigrations()\n\n // The preview seed must never keep the app from booting: a failure is reported, not thrown.\n if (boot.seed && process.env.QORE_RUN_SEED === \"true\") {\n try {\n await (await boot.seed()).default()\n } catch (err) {\n Sentry.captureException(err, { tags: { \"qore.seed.phase\": \"boot\" } })\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,YAAY,YAAY;AAMxB,SAAS,SAAS,KAAqB;AACrC,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,iBAAiB,GAAG,cAAc;AAC9D,SAAO;AACT;AAEA,eAAsB,SAAS,MAA+B;AAC5D,MAAI,KAAK,cAAc;AAGrB,wBAAoB,MAAM,KAAK,aAAa,GAAG,YAAY;AAAA,EAC7D;AAIA,MAAI,KAAK,IAAK,EAAC,MAAM,KAAK,IAAI,GAAG,UAAU;AAE3C,MAAI,KAAK,gBAAgB;AACvB,UAAM,EAAE,IAAI,MAAM,IAAI,kBAAkB,SAAS,wBAAwB,CAAC;AAC1E,QAAI;AACF,YAAM,kBAAkB,IAAI,EAAE,aAAa,iBAAiB,SAAS,cAAc,CAAC,EAAE,CAAC;AAAA,IACzF,UAAE;AACA,YAAM,MAAM;AAAA,IACd;AAAA,EACF;AAEA,MAAI,KAAK,WAAY,QAAO,MAAM,KAAK,WAAW,GAAG,iBAAiB;AAGtE,MAAI,KAAK,QAAQ,QAAQ,IAAI,kBAAkB,QAAQ;AACrD,QAAI;AACF,aAAO,MAAM,KAAK,KAAK,GAAG,QAAQ;AAAA,IACpC,SAAS,KAAK;AACZ,MAAO,wBAAiB,KAAK,EAAE,MAAM,EAAE,mBAAmB,OAAO,EAAE,CAAC;AAAA,IACtE;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an integration authenticates. Every field except `header` and
|
|
3
|
+
* `credentialsIn` names an **env key** — the SDK reads the value from the
|
|
4
|
+
* environment at call time, never from the declaration — so a declaration can
|
|
5
|
+
* sit in source control and carry no secret.
|
|
6
|
+
*/
|
|
7
|
+
type AuthKind = "none" | "api_key_header" | "bearer_static" | "basic" | "oauth2_client_credentials";
|
|
8
|
+
/** What the API speaks. Informational for the portal; the client sends bytes either way. */
|
|
9
|
+
type Protocol = "rest" | "odata" | "soap" | "graphql";
|
|
10
|
+
/** The name of an env var, e.g. `SAP_BASE_URL`. */
|
|
11
|
+
type EnvKey = string;
|
|
12
|
+
/**
|
|
13
|
+
* A reference to an env var. The short form is required; the object form can
|
|
14
|
+
* be optional and carry a default the app falls back on when the key is unset.
|
|
15
|
+
*/
|
|
16
|
+
type EnvRef = EnvKey | {
|
|
17
|
+
key: EnvKey;
|
|
18
|
+
optional?: boolean;
|
|
19
|
+
default?: string | number | boolean;
|
|
20
|
+
};
|
|
21
|
+
type IntegrationAuth = {
|
|
22
|
+
kind: "none";
|
|
23
|
+
} | {
|
|
24
|
+
kind: "api_key_header";
|
|
25
|
+
header: string;
|
|
26
|
+
apiKey: EnvKey;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "bearer_static";
|
|
29
|
+
token: EnvKey;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "basic";
|
|
32
|
+
username: EnvKey;
|
|
33
|
+
password: EnvKey;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "oauth2_client_credentials";
|
|
36
|
+
tokenUrl: EnvKey;
|
|
37
|
+
clientId: EnvKey;
|
|
38
|
+
clientSecret: EnvKey;
|
|
39
|
+
scope?: EnvKey;
|
|
40
|
+
audience?: EnvKey;
|
|
41
|
+
/** Where the client credentials go on the token request. Default `"header"`. */
|
|
42
|
+
credentialsIn?: "header" | "body";
|
|
43
|
+
};
|
|
44
|
+
interface IntegrationDefinition {
|
|
45
|
+
/** Human name shown in the portal, e.g. "SAP S/4HANA Cloud". */
|
|
46
|
+
label: string;
|
|
47
|
+
protocol: Protocol;
|
|
48
|
+
/** Env key holding the base URL for this environment. */
|
|
49
|
+
baseUrl: EnvKey;
|
|
50
|
+
auth: IntegrationAuth;
|
|
51
|
+
/** Further env the app reads for this integration, by logical name. */
|
|
52
|
+
config?: Record<string, EnvRef>;
|
|
53
|
+
}
|
|
54
|
+
type IntegrationMap = Record<string, IntegrationDefinition>;
|
|
55
|
+
/**
|
|
56
|
+
* Identity function that pins the literal types of the map, so an alias typo
|
|
57
|
+
* at a call site is a compile error (`keyof M`) rather than a runtime
|
|
58
|
+
* `not_declared`. Same shape as `definePermissions` in `auth-core`.
|
|
59
|
+
*/
|
|
60
|
+
declare function defineIntegrations<const M extends IntegrationMap>(map: M): M;
|
|
61
|
+
/**
|
|
62
|
+
* Which fields of each auth kind name an env key. Shared with the manifest
|
|
63
|
+
* extractor and the portal, which derive the required-env list from a
|
|
64
|
+
* declaration without evaluating app code.
|
|
65
|
+
*/
|
|
66
|
+
declare const AUTH_ENV_FIELDS: Record<AuthKind, readonly string[]>;
|
|
67
|
+
/** Auth fields whose env value is a secret, so the portal masks it. */
|
|
68
|
+
declare const AUTH_SECRET_FIELDS: readonly ["apiKey", "token", "password", "clientSecret"];
|
|
69
|
+
/**
|
|
70
|
+
* Env keys under this prefix belong to the platform
|
|
71
|
+
* (`QORE_INTEGRATION_<ALIAS>_LOGGING` today). A declaration may not claim one.
|
|
72
|
+
*/
|
|
73
|
+
declare const RESERVED_KEY_PREFIX = "QORE_INTEGRATION_";
|
|
74
|
+
|
|
75
|
+
export { AUTH_ENV_FIELDS as A, type EnvRef as E, type IntegrationMap as I, type Protocol as P, RESERVED_KEY_PREFIX as R, type IntegrationDefinition as a, AUTH_SECRET_FIELDS as b, type AuthKind as c, type EnvKey as d, type IntegrationAuth as e, defineIntegrations as f };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Code migration bootstrap-qore-env. `pnpm bootstrap` used to fetch local
|
|
2
|
+
// secrets through `qdc-setup-env` (the `setup:env` script), which talks to a
|
|
3
|
+
// portal endpoint that is being retired. It now runs `qore env pull`.
|
|
4
|
+
//
|
|
5
|
+
// Every `pnpm run setup:env` in the scripts becomes `qore env pull`, and a
|
|
6
|
+
// `setup:env` that runs qdc-setup-env goes once nothing calls it. The file is
|
|
7
|
+
// edited as text, so its formatting and every other key stay as they are; an
|
|
8
|
+
// edit whose result does not parse to exactly the expected object is not
|
|
9
|
+
// written.
|
|
10
|
+
export const parser = "text"
|
|
11
|
+
|
|
12
|
+
const CALL = /\bpnpm (?:run )?setup:env\b/
|
|
13
|
+
const SEE = "see the bootstrap-qore-env instructions"
|
|
14
|
+
|
|
15
|
+
/** Every key of `a` and `b` equal, compared as JSON. */
|
|
16
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b)
|
|
17
|
+
|
|
18
|
+
/** Replaces one script's value in the text, or null when it is not there exactly once. */
|
|
19
|
+
function setValue(text, key, from, to) {
|
|
20
|
+
const literal = `${JSON.stringify(key)}: ${JSON.stringify(from)}`
|
|
21
|
+
if (text.split(literal).length !== 2) return null
|
|
22
|
+
return text.replace(literal, () => `${JSON.stringify(key)}: ${JSON.stringify(to)}`)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Drops the `"key": ...` line, and a comma it leaves dangling. */
|
|
26
|
+
function dropLine(text, key) {
|
|
27
|
+
const lines = text.split("\n")
|
|
28
|
+
const i = lines.findIndex((l) => l.trimStart().startsWith(`${JSON.stringify(key)}:`))
|
|
29
|
+
if (i < 0) return null
|
|
30
|
+
const hadComma = /,\s*$/.test(lines[i])
|
|
31
|
+
lines.splice(i, 1)
|
|
32
|
+
if (!hadComma) {
|
|
33
|
+
let p = i - 1
|
|
34
|
+
while (p >= 0 && lines[p].trim() === "") p--
|
|
35
|
+
if (p >= 0) lines[p] = lines[p].replace(/,(\s*)$/, "$1")
|
|
36
|
+
}
|
|
37
|
+
return lines.join("\n")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default function transformer(file, api) {
|
|
41
|
+
if (file.path !== "package.json") return undefined
|
|
42
|
+
let pkg
|
|
43
|
+
try {
|
|
44
|
+
pkg = JSON.parse(file.source)
|
|
45
|
+
} catch {
|
|
46
|
+
return undefined
|
|
47
|
+
}
|
|
48
|
+
const scripts = pkg.scripts ?? {}
|
|
49
|
+
const legacy = typeof scripts["setup:env"] === "string" && scripts["setup:env"].includes("qdc-setup-env")
|
|
50
|
+
const direct = Object.entries(scripts).filter(([k, v]) => k !== "setup:env" && typeof v === "string" && v.includes("qdc-setup-env"))
|
|
51
|
+
if (direct.length > 0) {
|
|
52
|
+
return void api.report({ status: "manual", reason: `"${direct[0][0]}" runs qdc-setup-env; use qore env pull, ${SEE}` })
|
|
53
|
+
}
|
|
54
|
+
if (!legacy) return undefined
|
|
55
|
+
|
|
56
|
+
const want = { ...pkg, scripts: { ...scripts } }
|
|
57
|
+
let text = file.source
|
|
58
|
+
for (const [key, value] of Object.entries(scripts)) {
|
|
59
|
+
if (key === "setup:env" || typeof value !== "string" || !CALL.test(value)) continue
|
|
60
|
+
const next = value.replace(new RegExp(CALL.source, "g"), "qore env pull")
|
|
61
|
+
want.scripts[key] = next
|
|
62
|
+
text = setValue(text, key, value, next)
|
|
63
|
+
if (text === null) return void api.report({ status: "manual", reason: `could not edit "${key}" safely; ${SEE}` })
|
|
64
|
+
}
|
|
65
|
+
if (!Object.values(want.scripts).some((v) => typeof v === "string" && v.includes("setup:env"))) {
|
|
66
|
+
delete want.scripts["setup:env"]
|
|
67
|
+
text = dropLine(text, "setup:env")
|
|
68
|
+
}
|
|
69
|
+
let got
|
|
70
|
+
try {
|
|
71
|
+
got = text === null ? null : JSON.parse(text)
|
|
72
|
+
} catch {
|
|
73
|
+
got = null
|
|
74
|
+
}
|
|
75
|
+
if (!got || !same(got, want)) return void api.report({ status: "manual", reason: `could not edit the scripts safely; ${SEE}` })
|
|
76
|
+
return text
|
|
77
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# bootstrap-qore-env: local secrets through the Qore CLI
|
|
2
|
+
|
|
3
|
+
`pnpm bootstrap` used to fetch your local secrets with `qdc-setup-env` (the
|
|
4
|
+
`setup:env` script). That talks to a portal endpoint that is being retired, after
|
|
5
|
+
which it stops working. The Qore CLI does the same with `qore env pull`.
|
|
6
|
+
|
|
7
|
+
The upgrade bot runs this for you:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
node node_modules/@quatronic/sdk/migrations/run.mjs --only bootstrap-qore-env
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It changes `package.json` like this, and leaves every other script alone:
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
- "bootstrap": "pnpm install && pnpm run setup:env && pnpm run db:up",
|
|
17
|
+
+ "bootstrap": "pnpm install && qore env pull && pnpm run db:up",
|
|
18
|
+
- "setup:env": "qdc-setup-env",
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Install the CLI once on your machine if you have not: see the Qore CLI page in
|
|
22
|
+
the portal.
|
|
23
|
+
|
|
24
|
+
## By hand
|
|
25
|
+
|
|
26
|
+
A script of your own that runs `qdc-setup-env` directly is listed in the pull
|
|
27
|
+
request. Replace that call with `qore env pull`. It writes `.env.local` for a
|
|
28
|
+
Next app and `.env` for a backend, and asks you to log in the first time.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Code migration global-error. The page Next shows when the root layout
|
|
2
|
+
// throws becomes a re-export of @quatronic/sdk/next/global-error, so how a
|
|
3
|
+
// crash is reported and shown reaches the app as SDK releases.
|
|
4
|
+
//
|
|
5
|
+
// Tier 1 only: a global-error.tsx the team changed is kept as it is.
|
|
6
|
+
export const parser = "text"
|
|
7
|
+
|
|
8
|
+
// node scripts/tier1-fingerprints.mjs --templates <QDC-app-templates> src/app/global-error.tsx
|
|
9
|
+
const GLOBAL_ERROR = new Set([
|
|
10
|
+
"041294fbb8d4a355", // react-betterauth-next@8292521 2026-09-29
|
|
11
|
+
])
|
|
12
|
+
|
|
13
|
+
const REEXPORT = "@quatronic/sdk/next/global-error"
|
|
14
|
+
|
|
15
|
+
// "use client" stays here: bundling the SDK drops the directive from the
|
|
16
|
+
// package, and Next requires it on this file.
|
|
17
|
+
export const GLOBAL_ERROR_SOURCE = `"use client"
|
|
18
|
+
|
|
19
|
+
// What Next renders when the root layout itself throws. It lives in the SDK, so
|
|
20
|
+
// how a crash is reported and shown reaches this app with a version bump.
|
|
21
|
+
export { default } from "${REEXPORT}"
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export default function transformer(file, api) {
|
|
25
|
+
if (file.source.includes(REEXPORT)) return undefined
|
|
26
|
+
if (GLOBAL_ERROR.has(api.fingerprint(file.source))) return GLOBAL_ERROR_SOURCE
|
|
27
|
+
return void api.report({ status: "kept", reason: `changed by the team; it can re-export the default from ${REEXPORT}` })
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# global-error: the crash page from the SDK
|
|
2
|
+
|
|
3
|
+
`src/app/global-error.tsx` is what Next renders when the root layout throws. It
|
|
4
|
+
used to call Sentry itself. It now re-exports the SDK's page, which reports the
|
|
5
|
+
error to Sentry the same way, so a change to crash reporting reaches your app as
|
|
6
|
+
an SDK release.
|
|
7
|
+
|
|
8
|
+
The upgrade bot runs this for you:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
node node_modules/@quatronic/sdk/migrations/run.mjs --only global-error
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
A file exactly as the templates generated it becomes:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
"use client"
|
|
18
|
+
|
|
19
|
+
export { default } from "@quatronic/sdk/next/global-error"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Keep `"use client"`: Next requires it on this file, and the SDK's bundle does not
|
|
23
|
+
carry it.
|
|
24
|
+
|
|
25
|
+
A file your team changed is kept and listed in the pull request. If it only
|
|
26
|
+
restyled the page, keep it as it is: it goes on reporting through Sentry.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Code migration local-db-port. The local database listens on the port the
|
|
2
|
+
// portal assigned this module (DB_PORT), on loopback only:
|
|
3
|
+
//
|
|
4
|
+
// docker-compose.yml "${DB_PORT:-5432}:5432" -> "127.0.0.1:${DB_PORT:-5432}:5432"
|
|
5
|
+
// "5432:5432" -> the same
|
|
6
|
+
// package.json (Next) docker compose ... -> docker compose --env-file .env.local ...
|
|
7
|
+
//
|
|
8
|
+
// Without the second, a Next app's DB_PORT (in .env.local, where `qore env
|
|
9
|
+
// pull` writes it) never reaches docker compose, so the database starts on
|
|
10
|
+
// 5432 while DATABASE_URL points at the assigned port. Without the first, the
|
|
11
|
+
// database (postgres/postgres) is reachable from the whole network.
|
|
12
|
+
//
|
|
13
|
+
// Line edits, so files the team changed elsewhere migrate too.
|
|
14
|
+
export const parser = "text"
|
|
15
|
+
|
|
16
|
+
const SEE = "see the local-db-port instructions"
|
|
17
|
+
const PORT_LINE = /^(\s*-\s*)(["']?)(?:\$\{DB_PORT:-5432\}|5432):5432\2[ \t]*$/m
|
|
18
|
+
const COMPOSE = /\bdocker compose (?!--env-file)/g
|
|
19
|
+
|
|
20
|
+
const isNext = (api) => ["next.config.mjs", "next.config.ts", "next.config.js"].some((p) => api.exists(p))
|
|
21
|
+
|
|
22
|
+
function compose(file) {
|
|
23
|
+
if (!PORT_LINE.test(file.source)) return undefined
|
|
24
|
+
return file.source.replace(PORT_LINE, (_, lead) => `${lead}"127.0.0.1:\${DB_PORT:-5432}:5432"`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function packageJson(file, api) {
|
|
28
|
+
if (!isNext(api) || !api.exists("docker-compose.yml")) return undefined
|
|
29
|
+
let pkg
|
|
30
|
+
try {
|
|
31
|
+
pkg = JSON.parse(file.source)
|
|
32
|
+
} catch {
|
|
33
|
+
return undefined
|
|
34
|
+
}
|
|
35
|
+
const scripts = pkg.scripts ?? {}
|
|
36
|
+
const want = { ...pkg, scripts: { ...scripts } }
|
|
37
|
+
let text = file.source
|
|
38
|
+
for (const [key, value] of Object.entries(scripts)) {
|
|
39
|
+
if (typeof value !== "string" || !new RegExp(COMPOSE.source).test(value)) continue
|
|
40
|
+
const next = value.replace(COMPOSE, "docker compose --env-file .env.local ")
|
|
41
|
+
const literal = `${JSON.stringify(key)}: ${JSON.stringify(value)}`
|
|
42
|
+
if (text.split(literal).length !== 2) {
|
|
43
|
+
return void api.report({ status: "manual", reason: `could not edit "${key}" safely; add --env-file .env.local, ${SEE}` })
|
|
44
|
+
}
|
|
45
|
+
text = text.replace(literal, () => `${JSON.stringify(key)}: ${JSON.stringify(next)}`)
|
|
46
|
+
want.scripts[key] = next
|
|
47
|
+
}
|
|
48
|
+
if (text === file.source) return undefined
|
|
49
|
+
try {
|
|
50
|
+
if (JSON.stringify(JSON.parse(text)) === JSON.stringify(want)) return text
|
|
51
|
+
} catch {
|
|
52
|
+
// fall through
|
|
53
|
+
}
|
|
54
|
+
return void api.report({ status: "manual", reason: `could not edit the scripts safely; ${SEE}` })
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default function transformer(file, api) {
|
|
58
|
+
if (file.path === "docker-compose.yml") return compose(file)
|
|
59
|
+
if (file.path === "package.json") return packageJson(file, api)
|
|
60
|
+
return undefined
|
|
61
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# local-db-port: the local database on the assigned port, loopback only
|
|
2
|
+
|
|
3
|
+
The portal assigns every module with a database its own local port (`DB_PORT`),
|
|
4
|
+
so two modules never fight over 5432, and `DATABASE_URL` from `qore env pull`
|
|
5
|
+
points at that port. Two things in older apps get in the way:
|
|
6
|
+
|
|
7
|
+
- `docker-compose.yml` binds the port on every network interface, so the
|
|
8
|
+
database, with its well-known `postgres`/`postgres` login, is reachable from
|
|
9
|
+
your whole network.
|
|
10
|
+
- In a Next app, `pnpm db:up` does not read `.env.local`, where `DB_PORT` is. The
|
|
11
|
+
database then starts on 5432 while the app connects to the assigned port.
|
|
12
|
+
|
|
13
|
+
The upgrade bot runs this for you:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
node node_modules/@quatronic/sdk/migrations/run.mjs --only local-db-port
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```diff
|
|
20
|
+
# docker-compose.yml
|
|
21
|
+
ports:
|
|
22
|
+
- - "${DB_PORT:-5432}:5432"
|
|
23
|
+
+ - "127.0.0.1:${DB_PORT:-5432}:5432"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```diff
|
|
27
|
+
# package.json (Next apps)
|
|
28
|
+
- "db:up": "docker compose up -d --wait",
|
|
29
|
+
+ "db:up": "docker compose --env-file .env.local up -d --wait",
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
A backend needs no `--env-file`: docker compose reads `.env` by itself.
|
|
33
|
+
|
|
34
|
+
## Did you put `DB_PORT` in `.env`?
|
|
35
|
+
|
|
36
|
+
Apps generated before August 2026 have a README tip: "Create a `.env` file next
|
|
37
|
+
to `docker-compose.yml` with `DB_PORT=5433`". After this migration a Next app's
|
|
38
|
+
`db:up` reads `.env.local` only, so that `.env` is ignored and the database
|
|
39
|
+
starts on 5432 again. Move the line to `.env.local` (or run `qore env pull`,
|
|
40
|
+
which writes the assigned `DB_PORT` there) and delete the `.env` if nothing
|
|
41
|
+
else is in it. `.env` is not committed, so the upgrade bot cannot see or move
|
|
42
|
+
it for you.
|
|
43
|
+
|
|
44
|
+
If your database was already running, restart it once with
|
|
45
|
+
`pnpm db:down && pnpm db:up`. It comes back on the assigned port with its data.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Code migration mail-reexport. An app's src/lib/mail.ts becomes a re-export
|
|
2
|
+
// of @quatronic/sdk/mail, so how mail is sent (and logged) reaches it as SDK
|
|
3
|
+
// releases. Every rendering the templates produced has the SDK's signature,
|
|
4
|
+
// `sendMail(mail: Mail)`, so callers do not change.
|
|
5
|
+
//
|
|
6
|
+
// Tier 1 only: a mail.ts the team changed is kept as it is. The template's
|
|
7
|
+
// mail.test.ts (src/lib/ in Next apps, tests/ in backends) tests the old body
|
|
8
|
+
// (it mocks fetch and the logger), so it is
|
|
9
|
+
// deleted together with a replaced mail.ts; one the team changed is left for a
|
|
10
|
+
// person, since it will fail against the re-export.
|
|
11
|
+
export const parser = "text"
|
|
12
|
+
|
|
13
|
+
// node scripts/tier1-fingerprints.mjs --templates <QDC-app-templates> src/lib/mail.ts src/lib/mail.test.ts tests/mail.test.ts
|
|
14
|
+
const MAIL = new Set([
|
|
15
|
+
"865b9881e187cf73", // node-backend@30fdec5 2026-08-04
|
|
16
|
+
"6cb0fa829d99cf77", // node-backend@2fd295e 2026-09-07
|
|
17
|
+
"11fde4240bd6d7f7", // node-backend@8292521 2026-09-29
|
|
18
|
+
"94120fb267e75af8", // node-backend@a691748 2026-10-08
|
|
19
|
+
"f3d629f9d27883d6", // react-betterauth-next@30fdec5 2026-08-04
|
|
20
|
+
"39030a91919715e8", // react-betterauth-next@2fd295e 2026-09-07
|
|
21
|
+
"67c5fad8bf33b463", // react-betterauth-next@a691748 2026-10-08
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
const MAIL_TEST = new Set([
|
|
25
|
+
"e9225a45d7032231", // react-betterauth-next@30fdec5 2026-08-04
|
|
26
|
+
"a5491c7c345292b0", // react-betterauth-next@a691748 2026-10-08
|
|
27
|
+
"0e14f2ab2f8524dc", // node-backend@28d9400 2026-09-21 tests/mail.test.ts
|
|
28
|
+
"9737c403a50268e4", // node-backend@a691748 2026-10-08 tests/mail.test.ts
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
const MAIL_TESTS = new Set(["src/lib/mail.test.ts", "tests/mail.test.ts"])
|
|
32
|
+
|
|
33
|
+
const MAIL_TS = "src/lib/mail.ts"
|
|
34
|
+
const REEXPORT = "@quatronic/sdk/mail"
|
|
35
|
+
|
|
36
|
+
export const MAIL_SOURCE = `// Mail transport: Resend when MAIL_API_KEY is set, otherwise a logged skip.
|
|
37
|
+
// It lives in the SDK, so a fix to how mail is sent reaches this app with a
|
|
38
|
+
// version bump.
|
|
39
|
+
export { sendMail, type Mail } from "${REEXPORT}"
|
|
40
|
+
`
|
|
41
|
+
|
|
42
|
+
/** Whether mail.ts is, or is about to become, the re-export. */
|
|
43
|
+
function mailMoves(api) {
|
|
44
|
+
const source = api.read(MAIL_TS)
|
|
45
|
+
if (source === null) return false
|
|
46
|
+
return source.includes(REEXPORT) || MAIL.has(api.fingerprint(source))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default function transformer(file, api) {
|
|
50
|
+
if (file.path === MAIL_TS) {
|
|
51
|
+
if (file.source.includes(REEXPORT)) return undefined
|
|
52
|
+
if (MAIL.has(api.fingerprint(file.source))) return MAIL_SOURCE
|
|
53
|
+
return void api.report({ status: "kept", reason: `changed by the team; it can re-export sendMail from ${REEXPORT}` })
|
|
54
|
+
}
|
|
55
|
+
if (MAIL_TESTS.has(file.path)) {
|
|
56
|
+
if (!mailMoves(api)) return undefined
|
|
57
|
+
if (MAIL_TEST.has(api.fingerprint(file.source))) return null
|
|
58
|
+
return void api.report({
|
|
59
|
+
status: "manual",
|
|
60
|
+
reason: "tests the mail.ts body that moved to the SDK; delete it or test your callers instead",
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
return undefined
|
|
64
|
+
}
|