@quatronic/sdk 0.7.1-test.9412cbd → 0.7.1

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.
Files changed (84) hide show
  1. package/dist/{chunk-NMJOF3ZM.js → chunk-2AYDFLKR.js} +104 -6
  2. package/dist/chunk-2AYDFLKR.js.map +1 -0
  3. package/dist/cli/legacy/qdc-sourcemaps.js +6 -16
  4. package/dist/cli/skills-postinstall.js +3 -4
  5. package/dist/cli/skills.js +3 -4
  6. package/dist/cli/sourcemaps.js +6 -16
  7. package/dist/integrations/index.d.ts +75 -3
  8. package/dist/integrations/index.js +4 -6
  9. package/dist/next/auth/index.js +152 -3
  10. package/dist/next/auth/index.js.map +1 -1
  11. package/dist/next/db/index.d.ts +1 -18
  12. package/dist/next/db/index.js +0 -25
  13. package/dist/next/db/index.js.map +1 -1
  14. package/dist/next/integrations/index.d.ts +1 -2
  15. package/dist/next/integrations/index.js +4 -6
  16. package/dist/next/security/index.d.ts +1 -23
  17. package/dist/next/security/index.js +56 -39
  18. package/dist/next/security/index.js.map +1 -1
  19. package/dist/next/security/testing.js +1 -10
  20. package/dist/next/security/testing.js.map +1 -1
  21. package/dist/next/sentry/register.js +13 -5
  22. package/dist/next/sentry/register.js.map +1 -1
  23. package/dist/node/integrations/index.d.ts +1 -2
  24. package/dist/node/integrations/index.js +4 -6
  25. package/migrations/no-raw-fetch/meta.json +1 -1
  26. package/package.json +4 -26
  27. package/skills/catalog.json +0 -1
  28. package/skills/qore-add-integration/SKILL.next.md +7 -13
  29. package/skills/qore-add-integration/SKILL.node.md +7 -13
  30. package/skills/qore-author-skill/SKILL.md +0 -1
  31. package/dist/chunk-5RAO3LPF.js +0 -116
  32. package/dist/chunk-5RAO3LPF.js.map +0 -1
  33. package/dist/chunk-NMJOF3ZM.js.map +0 -1
  34. package/dist/chunk-P7HNHLW7.js +0 -65
  35. package/dist/chunk-P7HNHLW7.js.map +0 -1
  36. package/dist/chunk-QMOZDE3U.js +0 -158
  37. package/dist/chunk-QMOZDE3U.js.map +0 -1
  38. package/dist/chunk-WU7N4PET.js +0 -20
  39. package/dist/chunk-WU7N4PET.js.map +0 -1
  40. package/dist/mail/index.d.ts +0 -9
  41. package/dist/mail/index.js +0 -26
  42. package/dist/mail/index.js.map +0 -1
  43. package/dist/next/boot/index.d.ts +0 -33
  44. package/dist/next/boot/index.js +0 -21
  45. package/dist/next/boot/index.js.map +0 -1
  46. package/dist/next/global-error/index.d.ts +0 -9
  47. package/dist/next/global-error/index.js +0 -17
  48. package/dist/next/global-error/index.js.map +0 -1
  49. package/dist/next/platform/index.d.ts +0 -19
  50. package/dist/next/platform/index.js +0 -44
  51. package/dist/next/platform/index.js.map +0 -1
  52. package/dist/node/boot/index.d.ts +0 -9
  53. package/dist/node/boot/index.js +0 -13
  54. package/dist/node/boot/index.js.map +0 -1
  55. package/dist/node-HH3ZZD2R.js +0 -46
  56. package/dist/node-HH3ZZD2R.js.map +0 -1
  57. package/dist/types-Cl7g4ego.d.ts +0 -80
  58. package/migrations/bootstrap-qore-env/codemod.mjs +0 -77
  59. package/migrations/bootstrap-qore-env/instructions.md +0 -28
  60. package/migrations/bootstrap-qore-env/meta.json +0 -7
  61. package/migrations/global-error/codemod.mjs +0 -28
  62. package/migrations/global-error/instructions.md +0 -26
  63. package/migrations/global-error/meta.json +0 -7
  64. package/migrations/local-db-port/codemod.mjs +0 -61
  65. package/migrations/local-db-port/instructions.md +0 -45
  66. package/migrations/local-db-port/meta.json +0 -7
  67. package/migrations/mail-reexport/codemod.mjs +0 -64
  68. package/migrations/mail-reexport/instructions.md +0 -27
  69. package/migrations/mail-reexport/meta.json +0 -7
  70. package/migrations/platform-routes/codemod.mjs +0 -45
  71. package/migrations/platform-routes/instructions.md +0 -30
  72. package/migrations/platform-routes/meta.json +0 -7
  73. package/migrations/qore-boot/codemod.mjs +0 -263
  74. package/migrations/qore-boot/instructions.md +0 -74
  75. package/migrations/qore-boot/meta.json +0 -7
  76. package/migrations/qore-proxy/codemod.mjs +0 -88
  77. package/migrations/qore-proxy/instructions.md +0 -56
  78. package/migrations/qore-proxy/meta.json +0 -7
  79. package/migrations/run.mjs +0 -334
  80. package/migrations/sourcemaps-finalize/codemod.mjs +0 -63
  81. package/migrations/sourcemaps-finalize/instructions.md +0 -56
  82. package/migrations/sourcemaps-finalize/meta.json +0 -7
  83. package/skills/qore-add-env-key/SKILL.md +0 -57
  84. package/workspace-requirements.json +0 -4
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/mail/index.ts"],"sourcesContent":["// Mail transport for Next and Node apps alike. Sends over Resend when\n// MAIL_API_KEY is set, otherwise skips with a warning, so an app without a mail\n// provider still runs. Runtime-neutral and Sentry-free: the warning goes through\n// the SDK log.\nimport { getLogger } from \"../telemetry-hooks\"\n\nexport type Mail = { to: string; subject: string; html: string; text: string }\n\nexport async function sendMail(mail: Mail): Promise<void> {\n const apiKey = process.env.MAIL_API_KEY\n if (!apiKey) {\n getLogger().warn({}, \"mail skipped: no MAIL_API_KEY\")\n return\n }\n const from = process.env.MAIL_FROM\n if (!from) {\n throw new Error(\"sendMail: MAIL_API_KEY is set but MAIL_FROM is missing\")\n }\n const res = await fetch(\"https://api.resend.com/emails\", {\n method: \"POST\",\n headers: { Authorization: `Bearer ${apiKey}`, \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ from, to: mail.to, subject: mail.subject, html: mail.html, text: mail.text }),\n })\n if (!res.ok) throw new Error(`sendMail failed: ${res.status} ${await res.text()}`)\n}\n"],"mappings":";;;;;AAQA,eAAsB,SAAS,MAA2B;AACxD,QAAM,SAAS,QAAQ,IAAI;AAC3B,MAAI,CAAC,QAAQ;AACX,cAAU,EAAE,KAAK,CAAC,GAAG,+BAA+B;AACpD;AAAA,EACF;AACA,QAAM,OAAO,QAAQ,IAAI;AACzB,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AACA,QAAM,MAAM,MAAM,MAAM,iCAAiC;AAAA,IACvD,QAAQ;AAAA,IACR,SAAS,EAAE,eAAe,UAAU,MAAM,IAAI,gBAAgB,mBAAmB;AAAA,IACjF,MAAM,KAAK,UAAU,EAAE,MAAM,IAAI,KAAK,IAAI,SAAS,KAAK,SAAS,MAAM,KAAK,MAAM,MAAM,KAAK,KAAK,CAAC;AAAA,EACrG,CAAC;AACD,MAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,oBAAoB,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,CAAC,EAAE;AACnF;","names":[]}
@@ -1,33 +0,0 @@
1
- import { I as IntegrationMap } from '../../types-Cl7g4ego.js';
2
- export { onRequestError } from '../sentry/register.js';
3
- import '@sentry/nextjs';
4
-
5
- /**
6
- * The app-specific parts of boot. Each is a loader (`() => import(...)`), so
7
- * nothing is imported until the Node runtime asks for it, in this order:
8
- * integrations, env, auth migrations, app migrations, seed.
9
- */
10
- interface NodeBoot {
11
- /** `() => import("@/config/integrations")` */
12
- integrations?: () => Promise<{
13
- integrations: IntegrationMap;
14
- }>;
15
- /** `() => import("@/config/env")`; validated before anything touches the database. */
16
- env?: () => Promise<{
17
- serverEnv: () => unknown;
18
- }>;
19
- /** Run the SDK's own auth-schema migrations (Keycloak apps). */
20
- authMigrations?: boolean;
21
- /** `() => import("./lib/migrate")` */
22
- migrations?: () => Promise<{
23
- runAppMigrations: () => Promise<void>;
24
- }>;
25
- /** `() => import("./scripts/seed")`; runs only when `QORE_RUN_SEED=true` (previews). */
26
- seed?: () => Promise<{
27
- default: () => Promise<void>;
28
- }>;
29
- }
30
-
31
- declare function qoreRegister(node?: NodeBoot): Promise<void>;
32
-
33
- export { type NodeBoot, qoreRegister };
@@ -1,21 +0,0 @@
1
- import {
2
- onRequestError,
3
- register
4
- } from "../../chunk-WU7N4PET.js";
5
- import "../../chunk-G7VPNC6M.js";
6
- import "../../chunk-MET4SIMB.js";
7
- import "../../chunk-7ASQHY7O.js";
8
-
9
- // src/next/boot/index.ts
10
- async function qoreRegister(node) {
11
- await register();
12
- if (process.env.NEXT_RUNTIME === "nodejs" && node) {
13
- const { bootNode } = await import("../../node-HH3ZZD2R.js");
14
- await bootNode(node);
15
- }
16
- }
17
- export {
18
- onRequestError,
19
- qoreRegister
20
- };
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/next/boot/index.ts"],"sourcesContent":["// The body of a Next app's `src/instrumentation.ts`. The app passes what only\n// it can name (its env, migrations, seed); the platform's own boot steps live\n// here, so a new one reaches every app as an SDK release.\n//\n// export async function register() {\n// await qoreRegister(process.env.NEXT_RUNTIME === \"nodejs\" ? { ...loaders } : undefined)\n// // the app's own boot code, after migrations\n// }\n//\n// The ternary in the app file, and the `if` below, are what keep the Node-only\n// loaders out of the edge bundle: Next replaces NEXT_RUNTIME at build time and\n// the bundler drops the dead branch with its imports.\nimport { register as registerSentry } from \"../sentry/register\"\nimport type { NodeBoot } from \"./types\"\n\nexport { onRequestError } from \"../sentry/register\"\nexport type { NodeBoot } from \"./types\"\n\nexport async function qoreRegister(node?: NodeBoot): Promise<void> {\n await registerSentry()\n if (process.env.NEXT_RUNTIME === \"nodejs\" && node) {\n const { bootNode } = await import(\"./node\")\n await bootNode(node)\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,eAAsB,aAAa,MAAgC;AACjE,QAAM,SAAe;AACrB,MAAI,QAAQ,IAAI,iBAAiB,YAAY,MAAM;AACjD,UAAM,EAAE,SAAS,IAAI,MAAM,OAAO,wBAAQ;AAC1C,UAAM,SAAS,IAAI;AAAA,EACrB;AACF;","names":[]}
@@ -1,9 +0,0 @@
1
- import * as react from 'react';
2
-
3
- declare function GlobalError({ error }: {
4
- error: Error & {
5
- digest?: string;
6
- };
7
- }): react.JSX.Element;
8
-
9
- export { GlobalError as default };
@@ -1,17 +0,0 @@
1
- "use client";
2
-
3
- // src/next/global-error/index.tsx
4
- import { useEffect } from "react";
5
- import NextError from "next/error";
6
- import * as Sentry from "@sentry/nextjs";
7
- import { jsx } from "react/jsx-runtime";
8
- function GlobalError({ error }) {
9
- useEffect(() => {
10
- Sentry.captureException(error);
11
- }, [error]);
12
- return /* @__PURE__ */ jsx("html", { lang: "en", children: /* @__PURE__ */ jsx("body", { children: /* @__PURE__ */ jsx(NextError, { statusCode: 0 }) }) });
13
- }
14
- export {
15
- GlobalError as default
16
- };
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/next/global-error/index.tsx"],"sourcesContent":["\"use client\"\n// The page Next renders when the root layout itself throws. The app's\n// `src/app/global-error.tsx` re-exports this under its own \"use client\"\n// (bundling drops the directive here), so how a crash is reported and shown\n// changes with an SDK release.\nimport { useEffect } from \"react\"\nimport NextError from \"next/error\"\nimport * as Sentry from \"@sentry/nextjs\"\n\nexport default function GlobalError({ error }: { error: Error & { digest?: string } }) {\n useEffect(() => {\n Sentry.captureException(error)\n }, [error])\n\n return (\n <html lang=\"en\">\n <body>\n <NextError statusCode={0} />\n </body>\n </html>\n )\n}\n"],"mappings":";;;AAKA,SAAS,iBAAiB;AAC1B,OAAO,eAAe;AACtB,YAAY,YAAY;AAUhB;AARO,SAAR,YAA6B,EAAE,MAAM,GAA2C;AACrF,YAAU,MAAM;AACd,IAAO,wBAAiB,KAAK;AAAA,EAC/B,GAAG,CAAC,KAAK,CAAC;AAEV,SACE,oBAAC,UAAK,MAAK,MACT,8BAAC,UACC,8BAAC,aAAU,YAAY,GAAG,GAC5B,GACF;AAEJ;","names":[]}
@@ -1,19 +0,0 @@
1
- /**
2
- * Routes the platform serves inside every app, under `/api/qore/*`.
3
- *
4
- * The app holds one file, `src/app/api/qore/[...path]/route.ts`:
5
- *
6
- * export const runtime = "nodejs"
7
- * export const dynamic = "force-dynamic"
8
- * export { GET, POST } from "@quatronic/sdk/next/platform"
9
- *
10
- * so a new platform route arrives with an SDK release. `runtime` and `dynamic`
11
- * stay literals in the app: Next reads them off the route module and does not
12
- * follow them into a package. `/api/healthz` is not here, because the portal's
13
- * monitor calls it at that path.
14
- */
15
- type Handler = (request: Request) => Promise<Response>;
16
- declare const GET: Handler;
17
- declare const POST: Handler;
18
-
19
- export { GET, POST };
@@ -1,44 +0,0 @@
1
- import {
2
- QORE_CSP_REPORT_URI,
3
- createCspReportRoute
4
- } from "../../chunk-P7HNHLW7.js";
5
- import "../../chunk-FUPTRHT7.js";
6
- import {
7
- getLogger
8
- } from "../../chunk-MET4SIMB.js";
9
-
10
- // src/next/platform/index.ts
11
- var PREFIX = "/api/qore/";
12
- var cspReport = createCspReportRoute({
13
- log: {
14
- warn: ({ event, ...fields }) => getLogger().warn(
15
- {
16
- "qore.audit.event": String(event),
17
- ...Object.fromEntries(
18
- Object.entries(fields).filter(([, value]) => value !== void 0).map(([key, value]) => [`qore.csp.${key}`, String(value)])
19
- )
20
- },
21
- String(event)
22
- )
23
- }
24
- });
25
- var ROUTES = {
26
- [QORE_CSP_REPORT_URI.slice(PREFIX.length)]: { POST: cspReport }
27
- };
28
- function dispatch(method) {
29
- return async (request) => {
30
- const path = new URL(request.url).pathname;
31
- const route = path.startsWith(PREFIX) ? ROUTES[path.slice(PREFIX.length).replace(/\/$/, "")] : void 0;
32
- if (!route) return new Response(null, { status: 404 });
33
- const handler = route[method];
34
- if (!handler) return new Response(null, { status: 405, headers: { allow: Object.keys(route).join(", ") } });
35
- return handler(request);
36
- };
37
- }
38
- var GET = dispatch("GET");
39
- var POST = dispatch("POST");
40
- export {
41
- GET,
42
- POST
43
- };
44
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/next/platform/index.ts"],"sourcesContent":["import { getLogger } from \"../../telemetry-hooks\"\nimport { createCspReportRoute, QORE_CSP_REPORT_URI } from \"../../security-core/cspReport\"\n\n/**\n * Routes the platform serves inside every app, under `/api/qore/*`.\n *\n * The app holds one file, `src/app/api/qore/[...path]/route.ts`:\n *\n * export const runtime = \"nodejs\"\n * export const dynamic = \"force-dynamic\"\n * export { GET, POST } from \"@quatronic/sdk/next/platform\"\n *\n * so a new platform route arrives with an SDK release. `runtime` and `dynamic`\n * stay literals in the app: Next reads them off the route module and does not\n * follow them into a package. `/api/healthz` is not here, because the portal's\n * monitor calls it at that path.\n */\n\ntype Handler = (request: Request) => Promise<Response>\n\nconst PREFIX = \"/api/qore/\"\n\nconst cspReport = createCspReportRoute({\n log: {\n warn: ({ event, ...fields }) =>\n getLogger().warn(\n {\n \"qore.audit.event\": String(event),\n ...Object.fromEntries(\n Object.entries(fields)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [`qore.csp.${key}`, String(value)]),\n ),\n },\n String(event),\n ),\n },\n})\n\nconst ROUTES: Record<string, Partial<Record<\"GET\" | \"POST\", Handler>>> = {\n [QORE_CSP_REPORT_URI.slice(PREFIX.length)]: { POST: cspReport },\n}\n\nfunction dispatch(method: \"GET\" | \"POST\"): Handler {\n return async (request) => {\n const path = new URL(request.url).pathname\n const route = path.startsWith(PREFIX) ? ROUTES[path.slice(PREFIX.length).replace(/\\/$/, \"\")] : undefined\n if (!route) return new Response(null, { status: 404 })\n const handler = route[method]\n if (!handler) return new Response(null, { status: 405, headers: { allow: Object.keys(route).join(\", \") } })\n return handler(request)\n }\n}\n\nexport const GET = dispatch(\"GET\")\nexport const POST = dispatch(\"POST\")\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,SAAS;AAEf,IAAM,YAAY,qBAAqB;AAAA,EACrC,KAAK;AAAA,IACH,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,MACxB,UAAU,EAAE;AAAA,MACV;AAAA,QACE,oBAAoB,OAAO,KAAK;AAAA,QAChC,GAAG,OAAO;AAAA,UACR,OAAO,QAAQ,MAAM,EAClB,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS,EACzC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,YAAY,GAAG,IAAI,OAAO,KAAK,CAAC,CAAC;AAAA,QAC7D;AAAA,MACF;AAAA,MACA,OAAO,KAAK;AAAA,IACd;AAAA,EACJ;AACF,CAAC;AAED,IAAM,SAAmE;AAAA,EACvE,CAAC,oBAAoB,MAAM,OAAO,MAAM,CAAC,GAAG,EAAE,MAAM,UAAU;AAChE;AAEA,SAAS,SAAS,QAAiC;AACjD,SAAO,OAAO,YAAY;AACxB,UAAM,OAAO,IAAI,IAAI,QAAQ,GAAG,EAAE;AAClC,UAAM,QAAQ,KAAK,WAAW,MAAM,IAAI,OAAO,KAAK,MAAM,OAAO,MAAM,EAAE,QAAQ,OAAO,EAAE,CAAC,IAAI;AAC/F,QAAI,CAAC,MAAO,QAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;AACrD,UAAM,UAAU,MAAM,MAAM;AAC5B,QAAI,CAAC,QAAS,QAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,KAAK,SAAS,EAAE,OAAO,OAAO,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC;AAC1G,WAAO,QAAQ,OAAO;AAAA,EACxB;AACF;AAEO,IAAM,MAAM,SAAS,KAAK;AAC1B,IAAM,OAAO,SAAS,MAAM;","names":[]}
@@ -1,9 +0,0 @@
1
- import { I as IntegrationMap } from '../../types-Cl7g4ego.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 };
@@ -1,13 +0,0 @@
1
- import {
2
- assertIntegrations
3
- } from "../../chunk-5RAO3LPF.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
@@ -1 +0,0 @@
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,46 +0,0 @@
1
- import {
2
- assertIntegrations
3
- } from "./chunk-5RAO3LPF.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-HH3ZZD2R.js.map
@@ -1 +0,0 @@
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":[]}
@@ -1,80 +0,0 @@
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
- /**
68
- * Auth fields whose env value is a secret, so the portal locks it whatever
69
- * `env.ts` labels it. The identifier of a login counts with its secret:
70
- * `username` sits with `password` and `clientId` with `clientSecret`, because
71
- * that is where a person looks for them and they are replaced together.
72
- */
73
- declare const AUTH_SECRET_FIELDS: readonly ["apiKey", "token", "username", "password", "clientId", "clientSecret"];
74
- /**
75
- * Env keys under this prefix belong to the platform
76
- * (`QORE_INTEGRATION_<ALIAS>_LOGGING` today). A declaration may not claim one.
77
- */
78
- declare const RESERVED_KEY_PREFIX = "QORE_INTEGRATION_";
79
-
80
- 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 };
@@ -1,77 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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.
@@ -1,7 +0,0 @@
1
- {
2
- "id": "bootstrap-qore-env",
3
- "rule": null,
4
- "introducedIn": "0.8.0",
5
- "targets": ["package.json"],
6
- "order": 10
7
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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.
@@ -1,7 +0,0 @@
1
- {
2
- "id": "global-error",
3
- "rule": null,
4
- "introducedIn": "0.8.0",
5
- "targets": ["src/app/global-error.tsx"],
6
- "order": 10
7
- }
@@ -1,61 +0,0 @@
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
- }
@@ -1,45 +0,0 @@
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.
@@ -1,7 +0,0 @@
1
- {
2
- "id": "local-db-port",
3
- "rule": null,
4
- "introducedIn": "0.8.0",
5
- "targets": ["docker-compose.yml", "package.json"],
6
- "order": 10
7
- }