@limetry/preflight 0.0.0-stage → 1.2.57

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 (70) hide show
  1. package/README.md +128 -2
  2. package/dist/checks.d.ts +46 -0
  3. package/dist/checks.d.ts.map +1 -0
  4. package/dist/checks.js +61 -0
  5. package/dist/checks.js.map +1 -0
  6. package/dist/dotenv-files.d.ts +23 -0
  7. package/dist/dotenv-files.d.ts.map +1 -0
  8. package/dist/dotenv-files.js +57 -0
  9. package/dist/dotenv-files.js.map +1 -0
  10. package/dist/env-runtime.d.ts +43 -0
  11. package/dist/env-runtime.d.ts.map +1 -0
  12. package/dist/env-runtime.js +60 -0
  13. package/dist/env-runtime.js.map +1 -0
  14. package/dist/format.d.ts +40 -0
  15. package/dist/format.d.ts.map +1 -0
  16. package/dist/format.js +94 -0
  17. package/dist/format.js.map +1 -0
  18. package/dist/index.d.ts +34 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +34 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/listen-urls.d.ts +37 -0
  23. package/dist/listen-urls.d.ts.map +1 -0
  24. package/dist/listen-urls.js +91 -0
  25. package/dist/listen-urls.js.map +1 -0
  26. package/dist/logger.d.ts +14 -0
  27. package/dist/logger.d.ts.map +1 -0
  28. package/dist/logger.js +64 -0
  29. package/dist/logger.js.map +1 -0
  30. package/dist/mask.d.ts +26 -0
  31. package/dist/mask.d.ts.map +1 -0
  32. package/dist/mask.js +55 -0
  33. package/dist/mask.js.map +1 -0
  34. package/dist/ports.d.ts +58 -0
  35. package/dist/ports.d.ts.map +1 -0
  36. package/dist/ports.js +134 -0
  37. package/dist/ports.js.map +1 -0
  38. package/dist/probes/http.d.ts +61 -0
  39. package/dist/probes/http.d.ts.map +1 -0
  40. package/dist/probes/http.js +106 -0
  41. package/dist/probes/http.js.map +1 -0
  42. package/dist/probes/postgres.d.ts +27 -0
  43. package/dist/probes/postgres.d.ts.map +1 -0
  44. package/dist/probes/postgres.js +64 -0
  45. package/dist/probes/postgres.js.map +1 -0
  46. package/dist/probes/posthog.d.ts +37 -0
  47. package/dist/probes/posthog.d.ts.map +1 -0
  48. package/dist/probes/posthog.js +79 -0
  49. package/dist/probes/posthog.js.map +1 -0
  50. package/dist/probes/redis.d.ts +25 -0
  51. package/dist/probes/redis.d.ts.map +1 -0
  52. package/dist/probes/redis.js +65 -0
  53. package/dist/probes/redis.js.map +1 -0
  54. package/dist/probes/sentry.d.ts +56 -0
  55. package/dist/probes/sentry.d.ts.map +1 -0
  56. package/dist/probes/sentry.js +130 -0
  57. package/dist/probes/sentry.js.map +1 -0
  58. package/dist/probes/telemetry.d.ts +30 -0
  59. package/dist/probes/telemetry.d.ts.map +1 -0
  60. package/dist/probes/telemetry.js +77 -0
  61. package/dist/probes/telemetry.js.map +1 -0
  62. package/dist/run.d.ts +70 -0
  63. package/dist/run.d.ts.map +1 -0
  64. package/dist/run.js +82 -0
  65. package/dist/run.js.map +1 -0
  66. package/dist/types.d.ts +90 -0
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/types.js +16 -0
  69. package/dist/types.js.map +1 -0
  70. package/package.json +74 -4
package/README.md CHANGED
@@ -1,3 +1,129 @@
1
- # Temporary Holding Version
1
+ # `@limetry/preflight`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Startup preflight checks for Node.js apps: masked env reporting, optional connectivity
4
+ probes, pino logging, and a single canonical listen URL.
5
+
6
+ ## Env injection model
7
+
8
+ `@limetry/preflight` is **product-agnostic**. It has no Zod schema and does not know
9
+ about `PortalEnv`, `ServerEnv`, or other product types.
10
+
11
+ - Pass an injected `source: NodeJS.ProcessEnv` into helpers (often defaulting to
12
+ `process.env` **only at the call site**).
13
+ - Once `source` is in scope, **do not** read ambient `process.env` again inside that
14
+ helper (breaks tests and hides missing keys).
15
+ - Product adapters should parse a typed env object for owned secrets/settings, then
16
+ pass the same bag into `runPreflight({ env: source, envChecks: [...] })` for
17
+ deployment flags (`NODE_ENV`, `VERCEL_*`, `NEXT_PHASE`) and shared origin resolvers.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install @limetry/preflight
23
+ ```
24
+
25
+ Use the package manager you prefer; the equivalent Yarn or pnpm command works
26
+ the same way.
27
+
28
+ Optional peers for store probes:
29
+
30
+ ```bash
31
+ npm install pg ioredis
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```ts
37
+ import {
38
+ createHttpProbe,
39
+ createPostgresProbe,
40
+ envCheck,
41
+ runPreflight,
42
+ } from "@limetry/preflight"
43
+
44
+ await runPreflight({
45
+ product: "My App",
46
+ envChecks: [
47
+ envCheck({
48
+ name: "DATABASE_URL",
49
+ value: process.env.DATABASE_URL,
50
+ secret: true,
51
+ ok: Boolean(process.env.DATABASE_URL),
52
+ required: process.env.NODE_ENV === "production",
53
+ }),
54
+ envCheck({
55
+ name: "STRIPE_WEBHOOK_SECRET",
56
+ value: process.env.STRIPE_WEBHOOK_SECRET,
57
+ secret: true,
58
+ ok: Boolean(process.env.STRIPE_WEBHOOK_SECRET),
59
+ required: true,
60
+ critical: false,
61
+ }),
62
+ ],
63
+ configuration: [
64
+ `NODE_ENV: ${process.env.NODE_ENV ?? "development"}`,
65
+ ],
66
+ probes: [
67
+ createPostgresProbe({
68
+ url: process.env.DATABASE_URL,
69
+ required: process.env.NODE_ENV === "production",
70
+ }),
71
+ createHttpProbe({
72
+ name: "upstream",
73
+ url: "https://example.com/health",
74
+ success: "Upstream reachable",
75
+ failure: "Upstream unreachable",
76
+ required: false,
77
+ }),
78
+ ],
79
+ listenUrl: `http://localhost:${process.env.PORT ?? "3000"}`,
80
+ })
81
+ ```
82
+
83
+ ## Severity model
84
+
85
+ | Kind | `required` | `critical` | Banner | Startup (`failHard`) |
86
+ | --- | --- | --- | --- | --- |
87
+ | Optional | `false` | ignored | Optional / warn | Continues |
88
+ | Required (degraded) | `true` | `false` | Required / warn | Continues with warnings |
89
+ | Required (blocking) | `true` | omit / `true` | Required / fail | Throws |
90
+
91
+ `configuration` lines render under **Context** (NODE_ENV, ports, derived hosts). Pass/fail settings belong in `envChecks` so the banner can split **Required** vs **Optional**.
92
+
93
+ ## Fail hard vs degrade: deployment guidance
94
+
95
+ **Short-circuit only when the process cannot do its primary job.** Prefer boot + degrade when a subset of routes or surfaces still works.
96
+
97
+ | Context | Prefer abort when… | Prefer boot + degrade when… |
98
+ | --- | --- | --- |
99
+ | **Vercel** (Next/serverless) | Build-time secrets for the surface being built are wrong; live Clerk/publishable keys on production marketing that must not ship test keys | Optional AI, analytics, or a BFF that only powers authenticated routes while static/home still SSG/serves |
100
+ | **AWS Lambda / API Gateway** | Auth secrets, primary datastore, or anything that makes every invocation 5xx | Secondary caches (Redis), billing webhooks, optional upstream proxies — return 503 on those routes, keep `/health` and core APIs up |
101
+ | **ECS/EKS + load balancer** | Dependencies that make the **health check** fail forever (restart storm) | Non-critical deps: keep health **200** (or a separate `/ready` vs `/live`), expose **DEGRADED** on a richer status, alert without killing the task |
102
+
103
+ Rules of thumb:
104
+
105
+ 1. **Process-blocking (`critical`)** = without this, the binary’s job is unsafe or empty (wrong auth, no primary DB when the API is DB-backed, corrupt public URLs for a CDN site).
106
+ 2. **Required-not-critical** = product feature is incomplete but home, docs, health, or a core slice still works (billing, secondary upstream, cache, AI helpers).
107
+ 3. **Optional** = nice-to-have observability or integrations.
108
+ 4. On orchestrators, never tie the LB health check to non-critical probes — that turns a Stripe outage into a restart loop.
109
+ 5. Emit structured `preflight.complete` with `failedBlocking` / `failedRequired` / `failedOptional` and mirror degraded state in metrics/alarms.
110
+
111
+ ## Behavior
112
+
113
+ - Blocking required failures throw in production (or when `failHard` is set).
114
+ - Required-not-critical and optional failures warn and never block startup.
115
+ - Connectivity is skipped in test environments unless `skipConnectivity: false`.
116
+ - Loopback listen URLs normalize to a single `localhost` line (no LAN enumeration).
117
+ - When Sentry or PostHog env keys are present, `collectConfiguredTelemetry` adds
118
+ non-blocking probes.
119
+
120
+ ## API surface
121
+
122
+ - `runPreflight` / `formatPreflightReport` / `createPreflightLogger`
123
+ - `envCheck` / `checkBlocksStartup` / `maskSecret` / `redactDatabaseUrl` / `listEffectiveDotenvFiles`
124
+ - Probes: HTTP, Postgres, Redis, Sentry, PostHog
125
+ - Listen helpers: `expandListenUrls`, `resolvePublicListenUrl`, `isLoopbackHostname`
126
+
127
+ ## License
128
+
129
+ MIT
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Helpers that build and format individual preflight banner check rows.
3
+ */
4
+ import type { PreflightCheck, PreflightCheckKind } from "./types.js";
5
+ /**
6
+ * Builds a {@link PreflightCheck} for an environment variable or secret.
7
+ *
8
+ * Pass `value` for masking/display; use `display` to override the shown text
9
+ * (e.g. same-origin proxy labels). Prefer values from a typed product env
10
+ * object rather than ambient `process.env` at the adapter layer.
11
+ *
12
+ * @param input - Check fields and optional display/masking overrides.
13
+ * @returns A fully formed {@link PreflightCheck} ready for `runPreflight`.
14
+ */
15
+ export declare function envCheck(input: {
16
+ critical?: boolean;
17
+ display?: string;
18
+ kind?: PreflightCheckKind;
19
+ name: string;
20
+ ok: boolean;
21
+ required: boolean;
22
+ secret?: boolean;
23
+ value?: string;
24
+ }): PreflightCheck;
25
+ /**
26
+ * Banner icon for a check: pass, optional warn, required-degraded warn, or fail.
27
+ *
28
+ * @param check - Severity fields from a {@link PreflightCheck}.
29
+ * @returns Emoji status glyph for the banner line.
30
+ */
31
+ export declare function connectivityIcon(check: Pick<PreflightCheck, "critical" | "ok" | "required">): string;
32
+ /**
33
+ * Formats an env/secret check line for the banner.
34
+ *
35
+ * @param check - Env or secret {@link PreflightCheck} to render.
36
+ * @returns A single banner line: icon, name, and detail.
37
+ */
38
+ export declare function formatCheckLine(check: PreflightCheck): string;
39
+ /**
40
+ * Formats a connectivity check line (detail only; name is probe-internal).
41
+ *
42
+ * @param check - Connectivity {@link PreflightCheck} to render.
43
+ * @returns A single banner line: icon and detail.
44
+ */
45
+ export declare function formatConnectivityLine(check: PreflightCheck): string;
46
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpE;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,kBAAkB,CAAA;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,cAAc,CAYjB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC,GAC1D,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE"}
package/dist/checks.js ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Helpers that build and format individual preflight banner check rows.
3
+ */
4
+ import { maskSecret } from "./mask.js";
5
+ /**
6
+ * Builds a {@link PreflightCheck} for an environment variable or secret.
7
+ *
8
+ * Pass `value` for masking/display; use `display` to override the shown text
9
+ * (e.g. same-origin proxy labels). Prefer values from a typed product env
10
+ * object rather than ambient `process.env` at the adapter layer.
11
+ *
12
+ * @param input - Check fields and optional display/masking overrides.
13
+ * @returns A fully formed {@link PreflightCheck} ready for `runPreflight`.
14
+ */
15
+ export function envCheck(input) {
16
+ const kind = input.kind ?? (input.secret ? "secret" : "env");
17
+ const detail = input.display
18
+ ?? (input.secret ? maskSecret(input.value) : (input.value || "(unset)"));
19
+ return {
20
+ name: input.name,
21
+ ok: input.ok,
22
+ required: input.required,
23
+ critical: input.critical,
24
+ detail,
25
+ kind,
26
+ };
27
+ }
28
+ /**
29
+ * Banner icon for a check: pass, optional warn, required-degraded warn, or fail.
30
+ *
31
+ * @param check - Severity fields from a {@link PreflightCheck}.
32
+ * @returns Emoji status glyph for the banner line.
33
+ */
34
+ export function connectivityIcon(check) {
35
+ if (check.ok) {
36
+ return "✅";
37
+ }
38
+ if (!check.required) {
39
+ return "⚠️";
40
+ }
41
+ return check.critical === false ? "⚠️" : "❌";
42
+ }
43
+ /**
44
+ * Formats an env/secret check line for the banner.
45
+ *
46
+ * @param check - Env or secret {@link PreflightCheck} to render.
47
+ * @returns A single banner line: icon, name, and detail.
48
+ */
49
+ export function formatCheckLine(check) {
50
+ return `${connectivityIcon(check)} ${check.name}: ${check.detail}`;
51
+ }
52
+ /**
53
+ * Formats a connectivity check line (detail only; name is probe-internal).
54
+ *
55
+ * @param check - Connectivity {@link PreflightCheck} to render.
56
+ * @returns A single banner line: icon and detail.
57
+ */
58
+ export function formatConnectivityLine(check) {
59
+ return `${connectivityIcon(check)} ${check.detail}`;
60
+ }
61
+ //# sourceMappingURL=checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.js","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAGtC;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,KASxB;IACC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO;WACvB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAA;IAC1E,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM;QACN,IAAI;KACL,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA2D;IAE3D,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QACb,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAA;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAqB;IACnD,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE,CAAA;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAqB;IAC1D,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAA;AACrD,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Dotenv file discovery and default-value annotation for preflight context lines.
3
+ */
4
+ /**
5
+ * Human-readable list of dotenv files that dotenvx would load from `cwd` upward,
6
+ * or a Vercel note when `source.VERCEL` is set.
7
+ *
8
+ * @param source - Injected env bag (checks `VERCEL`); defaults to `process.env` at call site.
9
+ * @param cwd - Starting directory for upward dotenv discovery; defaults to `process.cwd()`.
10
+ * @returns Comma-separated relative paths, a Vercel note, or `"none (process.env only)"`.
11
+ */
12
+ export declare function listEffectiveDotenvFiles(source?: NodeJS.ProcessEnv, cwd?: string): string;
13
+ /**
14
+ * Appends ` (from default)` when `name` is unset/blank on `source`.
15
+ * Use for context lines that show resolved values that may not come from env.
16
+ *
17
+ * @param name - Env key to inspect on `source`.
18
+ * @param display - Display text for the resolved value.
19
+ * @param source - Injected env bag; defaults to `process.env` at call site.
20
+ * @returns `display`, optionally annotated when the key is unset.
21
+ */
22
+ export declare function annotated(name: string, display: string, source?: NodeJS.ProcessEnv): string;
23
+ //# sourceMappingURL=dotenv-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dotenv-files.d.ts","sourceRoot":"","sources":["../src/dotenv-files.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,GAAE,MAAM,CAAC,UAAwB,EACvC,GAAG,SAAgB,GAClB,MAAM,CAkBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,UAAwB,GACtC,MAAM,CAMR"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Dotenv file discovery and default-value annotation for preflight context lines.
3
+ */
4
+ import { existsSync } from "node:fs";
5
+ import { join, relative, resolve } from "node:path";
6
+ const DOTENV_NAMES = [
7
+ ".env",
8
+ ".env.local",
9
+ ".env.development",
10
+ ".env.development.local",
11
+ ".env.production",
12
+ ".env.production.local",
13
+ ];
14
+ /**
15
+ * Human-readable list of dotenv files that dotenvx would load from `cwd` upward,
16
+ * or a Vercel note when `source.VERCEL` is set.
17
+ *
18
+ * @param source - Injected env bag (checks `VERCEL`); defaults to `process.env` at call site.
19
+ * @param cwd - Starting directory for upward dotenv discovery; defaults to `process.cwd()`.
20
+ * @returns Comma-separated relative paths, a Vercel note, or `"none (process.env only)"`.
21
+ */
22
+ export function listEffectiveDotenvFiles(source = process.env, cwd = process.cwd()) {
23
+ if (source.VERCEL) {
24
+ return "Vercel project environment (dotenvx skipped)";
25
+ }
26
+ const roots = [cwd, join(cwd, ".."), join(cwd, "../..")];
27
+ const found = [];
28
+ const seen = new Set();
29
+ for (const root of roots) {
30
+ for (const name of DOTENV_NAMES) {
31
+ const absolute = resolve(root, name);
32
+ if (!existsSync(absolute) || seen.has(absolute)) {
33
+ continue;
34
+ }
35
+ seen.add(absolute);
36
+ found.push(relative(cwd, absolute) || name);
37
+ }
38
+ }
39
+ return found.length > 0 ? found.join(", ") : "none (process.env only)";
40
+ }
41
+ /**
42
+ * Appends ` (from default)` when `name` is unset/blank on `source`.
43
+ * Use for context lines that show resolved values that may not come from env.
44
+ *
45
+ * @param name - Env key to inspect on `source`.
46
+ * @param display - Display text for the resolved value.
47
+ * @param source - Injected env bag; defaults to `process.env` at call site.
48
+ * @returns `display`, optionally annotated when the key is unset.
49
+ */
50
+ export function annotated(name, display, source = process.env) {
51
+ const raw = source[name];
52
+ if (raw === undefined || raw.trim() === "") {
53
+ return `${display} (from default)`;
54
+ }
55
+ return display;
56
+ }
57
+ //# sourceMappingURL=dotenv-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dotenv-files.js","sourceRoot":"","sources":["../src/dotenv-files.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,YAAY,GAAG;IACnB,MAAM;IACN,YAAY;IACZ,kBAAkB;IAClB,wBAAwB;IACxB,iBAAiB;IACjB,uBAAuB;CACxB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAA4B,OAAO,CAAC,GA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AO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Runtime/deployment flags read from an injected env bag.
3
+ *
4
+ * Always pass `source` from the caller. Defaulting to `process.env` is only for
5
+ * call-site convenience — do not re-read `process.env` inside these helpers.
6
+ */
7
+ /**
8
+ * True in Vitest / `NODE_ENV=test` (connectivity usually skipped).
9
+ *
10
+ * @param source - Injected env bag.
11
+ * @returns Whether the process is a test runtime.
12
+ */
13
+ export declare function isTestEnv(source?: NodeJS.ProcessEnv): boolean;
14
+ /**
15
+ * True during Next production build/export or Limetry static portal export.
16
+ *
17
+ * @param source - Injected env bag (`LIMETRY_STATIC_EXPORT`, `NEXT_PHASE`).
18
+ * @returns Whether connectivity and fail-hard should be suppressed for build.
19
+ */
20
+ export declare function isNextBuildPhase(source?: NodeJS.ProcessEnv): boolean;
21
+ /**
22
+ * True when the process is a production runtime (Node or Vercel Production).
23
+ *
24
+ * @param source - Injected env bag (`NODE_ENV`, `VERCEL_ENV`).
25
+ * @returns Whether production fail-hard policy should apply.
26
+ */
27
+ export declare function isProductionRuntime(source?: NodeJS.ProcessEnv): boolean;
28
+ /**
29
+ * Whether connectivity probes should run for this env bag.
30
+ *
31
+ * @param source - Injected env bag.
32
+ * @returns `false` in test or Next build/export phases; otherwise `true`.
33
+ */
34
+ export declare function shouldProbeConnectivity(source?: NodeJS.ProcessEnv): boolean;
35
+ /**
36
+ * Hard-fail only when a required check is actually blocking a live process.
37
+ * Preview/build/test must still boot with warnings.
38
+ *
39
+ * @param source - Injected env bag.
40
+ * @returns `true` only for production runtimes outside test/build phases.
41
+ */
42
+ export declare function shouldFailHard(source?: NodeJS.ProcessEnv): boolean;
43
+ //# sourceMappingURL=env-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-runtime.d.ts","sourceRoot":"","sources":["../src/env-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAE1E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAMjF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAEpF;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAExF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAK/E"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Runtime/deployment flags read from an injected env bag.
3
+ *
4
+ * Always pass `source` from the caller. Defaulting to `process.env` is only for
5
+ * call-site convenience — do not re-read `process.env` inside these helpers.
6
+ */
7
+ /**
8
+ * True in Vitest / `NODE_ENV=test` (connectivity usually skipped).
9
+ *
10
+ * @param source - Injected env bag.
11
+ * @returns Whether the process is a test runtime.
12
+ */
13
+ export function isTestEnv(source = process.env) {
14
+ return source.NODE_ENV === "test" || source.VITEST === "true";
15
+ }
16
+ /**
17
+ * True during Next production build/export or Limetry static portal export.
18
+ *
19
+ * @param source - Injected env bag (`LIMETRY_STATIC_EXPORT`, `NEXT_PHASE`).
20
+ * @returns Whether connectivity and fail-hard should be suppressed for build.
21
+ */
22
+ export function isNextBuildPhase(source = process.env) {
23
+ if (source.LIMETRY_STATIC_EXPORT === "1") {
24
+ return true;
25
+ }
26
+ const phase = source.NEXT_PHASE;
27
+ return phase === "phase-production-build" || phase === "phase-export";
28
+ }
29
+ /**
30
+ * True when the process is a production runtime (Node or Vercel Production).
31
+ *
32
+ * @param source - Injected env bag (`NODE_ENV`, `VERCEL_ENV`).
33
+ * @returns Whether production fail-hard policy should apply.
34
+ */
35
+ export function isProductionRuntime(source = process.env) {
36
+ return source.NODE_ENV === "production" || source.VERCEL_ENV === "production";
37
+ }
38
+ /**
39
+ * Whether connectivity probes should run for this env bag.
40
+ *
41
+ * @param source - Injected env bag.
42
+ * @returns `false` in test or Next build/export phases; otherwise `true`.
43
+ */
44
+ export function shouldProbeConnectivity(source = process.env) {
45
+ return !isTestEnv(source) && !isNextBuildPhase(source);
46
+ }
47
+ /**
48
+ * Hard-fail only when a required check is actually blocking a live process.
49
+ * Preview/build/test must still boot with warnings.
50
+ *
51
+ * @param source - Injected env bag.
52
+ * @returns `true` only for production runtimes outside test/build phases.
53
+ */
54
+ export function shouldFailHard(source = process.env) {
55
+ if (isTestEnv(source) || isNextBuildPhase(source)) {
56
+ return false;
57
+ }
58
+ return isProductionRuntime(source);
59
+ }
60
+ //# sourceMappingURL=env-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-runtime.js","sourceRoot":"","sources":["../src/env-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,SAA4B,OAAO,CAAC,GAAG;IAC/D,OAAO,MAAM,CAAC,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAA;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAA4B,OAAO,CAAC,GAAG;IACtE,IAAI,MAAM,CAAC,qBAAqB,KAAK,GAAG,EAAE,CAAC;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAA;IAC/B,OAAO,KAAK,KAAK,wBAAwB,IAAI,KAAK,KAAK,cAAc,CAAA;AACvE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA4B,OAAO,CAAC,GAAG;IACzE,OAAO,MAAM,CAAC,QAAQ,KAAK,YAAY,IAAI,MAAM,CAAC,UAAU,KAAK,YAAY,CAAA;AAC/E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAA4B,OAAO,CAAC,GAAG;IAC7E,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAA4B,OAAO,CAAC,GAAG;IACpE,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Human-readable preflight banner rendering for stdout via the preflight logger.
3
+ */
4
+ import { formatCheckLine, formatConnectivityLine } from "./checks.js";
5
+ import type { PreflightCheck } from "./types.js";
6
+ /**
7
+ * Horizontal rule used between banner sections.
8
+ */
9
+ export declare const PREFLIGHT_SEPARATOR = "-----------------------------------------";
10
+ /**
11
+ * Renders the human-readable preflight banner (stdout via the preflight logger).
12
+ *
13
+ * Prefer `envChecks` + `connectivityChecks` + `contextLines` over deprecated
14
+ * `configuration` / `connectivity` string lists so Required/Optional grouping works.
15
+ *
16
+ * @param input - Banner sections and overall pass/warn outcome.
17
+ * @returns Multi-line banner string ready to log.
18
+ */
19
+ export declare function formatPreflightReport(input: {
20
+ appVersion?: string;
21
+ /**
22
+ * @deprecated Prefer `envChecks` so Required/Optional grouping is automatic.
23
+ * When `envChecks` is set, these lines render under Context.
24
+ */
25
+ configuration?: string[];
26
+ /**
27
+ * @deprecated Prefer `connectivityChecks`. Kept for older call sites.
28
+ */
29
+ connectivity?: string[];
30
+ connectivityChecks?: PreflightCheck[];
31
+ contextLines?: string[];
32
+ envChecks?: PreflightCheck[];
33
+ envFiles: string;
34
+ listenUrls?: string[];
35
+ passed: boolean;
36
+ product: string;
37
+ warnings: boolean;
38
+ }): string;
39
+ export { formatCheckLine, formatConnectivityLine };
40
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,mBAAmB,8CAA8C,CAAA;AAgC9E;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,SAAS,CAAC,EAAE,cAAc,EAAE,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAwDT;AAED,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAA"}
package/dist/format.js ADDED
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Human-readable preflight banner rendering for stdout via the preflight logger.
3
+ */
4
+ import { formatCheckLine, formatConnectivityLine } from "./checks.js";
5
+ /**
6
+ * Horizontal rule used between banner sections.
7
+ */
8
+ export const PREFLIGHT_SEPARATOR = "-----------------------------------------";
9
+ /**
10
+ * Builds a titled subsection when `lines` is non-empty.
11
+ *
12
+ * @param title - Subsection label (e.g. `"Required:"`).
13
+ * @param lines - Already-formatted body lines.
14
+ * @returns Title plus indented body lines, or an empty array.
15
+ */
16
+ function sectionLines(title, lines) {
17
+ if (lines.length === 0) {
18
+ return [];
19
+ }
20
+ return [` ${title}`, ...lines.map((line) => ` ${line}`)];
21
+ }
22
+ /**
23
+ * Partitions checks into required vs optional for banner grouping.
24
+ *
25
+ * @param checks - Checks to split.
26
+ * @returns Two arrays keyed by `required`.
27
+ */
28
+ function splitRequiredOptional(checks) {
29
+ return {
30
+ required: checks.filter((check) => check.required),
31
+ optional: checks.filter((check) => !check.required),
32
+ };
33
+ }
34
+ /**
35
+ * Renders the human-readable preflight banner (stdout via the preflight logger).
36
+ *
37
+ * Prefer `envChecks` + `connectivityChecks` + `contextLines` over deprecated
38
+ * `configuration` / `connectivity` string lists so Required/Optional grouping works.
39
+ *
40
+ * @param input - Banner sections and overall pass/warn outcome.
41
+ * @returns Multi-line banner string ready to log.
42
+ */
43
+ export function formatPreflightReport(input) {
44
+ const envChecks = input.envChecks ?? [];
45
+ const connectivityChecks = input.connectivityChecks ?? [];
46
+ const envSplit = splitRequiredOptional(envChecks);
47
+ const connSplit = splitRequiredOptional(connectivityChecks);
48
+ const configurationBlock = envChecks.length > 0
49
+ ? [
50
+ "🔍 Environment Configuration:",
51
+ ...sectionLines("Required:", envSplit.required.map(formatCheckLine)),
52
+ ...sectionLines("Optional:", envSplit.optional.map(formatCheckLine)),
53
+ ...sectionLines("Context:", input.contextLines ?? input.configuration ?? []),
54
+ ]
55
+ : [
56
+ "🔍 Environment Configuration:",
57
+ ...(input.configuration ?? []).map((line) => ` • ${line}`),
58
+ ];
59
+ const connectivityBlock = connectivityChecks.length > 0
60
+ ? [
61
+ "🔌 Connectivity:",
62
+ ...sectionLines("Required:", connSplit.required.map(formatConnectivityLine)),
63
+ ...sectionLines("Optional:", connSplit.optional.map(formatConnectivityLine)),
64
+ ]
65
+ : (input.connectivity ?? []);
66
+ const outcome = input.passed
67
+ ? input.warnings
68
+ ? "⚠️ Preflight Check Passed with warnings."
69
+ : "✨ Preflight Check Passed!"
70
+ : "❌ Preflight Check Failed!";
71
+ const listenLines = (input.listenUrls ?? []).map((url) => `🚀 ${url}`);
72
+ const appVersionLine = input.appVersion
73
+ ? [`✅ App Version: ${input.appVersion}`]
74
+ : [];
75
+ return [
76
+ PREFLIGHT_SEPARATOR,
77
+ `🚀 ${input.product}: Starting Preflight Check`,
78
+ PREFLIGHT_SEPARATOR,
79
+ `✅ Env files (effective for dotenvx): ${input.envFiles}`,
80
+ PREFLIGHT_SEPARATOR,
81
+ ...configurationBlock,
82
+ PREFLIGHT_SEPARATOR,
83
+ ...connectivityBlock,
84
+ ...(connectivityBlock.length > 0 ? [PREFLIGHT_SEPARATOR] : []),
85
+ ...appVersionLine,
86
+ `✅ Node Version: ${process.version}`,
87
+ PREFLIGHT_SEPARATOR,
88
+ outcome,
89
+ ...listenLines,
90
+ PREFLIGHT_SEPARATOR,
91
+ ].join("\n");
92
+ }
93
+ export { formatCheckLine, formatConnectivityLine };
94
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGrE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,2CAA2C,CAAA;AAE9E;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,KAAa,EAAE,KAAe;IAClD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,OAAO,CAAC,KAAK,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,MAAwB;IAIrD,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAA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C,QAAQ,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;SAC7E;QACD,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAA;IAE9B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM;QAC1B,CAAC,CAAC,KAAK,CAAC,QAAQ;YACd,CAAC,CAAC,0CAA0C;YAC5C,CAAC,CAAC,2BAA2B;QAC/B,CAAC,CAAC,2BAA2B,CAAA;IAC/B,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACtE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU;QACrC,CAAC,CAAC,CAAC,kBAAkB,KAAK,CAAC,UAAU,EAAE,CAAC;QACxC,CAAC,CAAC,EAAE,CAAA;IAEN,OAAO;QACL,mBAAmB;QACnB,MAAM,KAAK,CAAC,OAAO,4BAA4B;QAC/C,mBAAmB;QACnB,wCAAwC,KAAK,CAAC,QAAQ,EAAE;QACxD,mBAAmB;QACnB,GAAG,kBAAkB;QACrB,mBAAmB;QACnB,GAAG,iBAAiB;QACpB,GAAG,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,cAAc;QACjB,mBAAmB,OAAO,CAAC,OAAO,EAAE;QACpC,mBAAmB;QACnB,OAAO;QACP,GAAG,WAAW;QACd,mBAAmB;KACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAA"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Startup preflight checks for Limetry apps (`@limetry/preflight`).
3
+ *
4
+ * ## Env injection model
5
+ *
6
+ * This package is product-agnostic. It never assumes a Zod schema. Callers pass
7
+ * an injected `source: NodeJS.ProcessEnv` (often defaulting to `process.env` at
8
+ * the **call site only**). Helpers that already receive `source` must not read
9
+ * ambient `process.env` again — that breaks tests and hides missing keys.
10
+ *
11
+ * Product adapters (web, servers) should:
12
+ * 1. Parse a typed env object (Zod) for owned secrets/settings.
13
+ * 2. Pass the same `source` bag into `runPreflight` / probes for deployment
14
+ * flags (`NODE_ENV`, `VERCEL_*`, `NEXT_PHASE`) and shared origin resolvers.
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ export { connectivityIcon, envCheck } from "./checks.js";
19
+ export { annotated, listEffectiveDotenvFiles } from "./dotenv-files.js";
20
+ export { isNextBuildPhase, isProductionRuntime, isTestEnv, shouldFailHard, shouldProbeConnectivity, } from "./env-runtime.js";
21
+ export { formatPreflightReport, PREFLIGHT_SEPARATOR } from "./format.js";
22
+ export { expandListenUrls, isLoopbackHostname, lanIPv4Addresses, resolvePublicListenUrl, } from "./listen-urls.js";
23
+ export { createPreflightLogger, type Logger } from "./logger.js";
24
+ export { maskSecret, redactDatabaseUrl } from "./mask.js";
25
+ export { getAvailablePort, isPortInUse, resolveAvailablePort, resolveDevListenPort, type ResolvedPort, } from "./ports.js";
26
+ export { createHttpProbe, type HttpHeaders, probeHttp, probeReachableOrigin, } from "./probes/http.js";
27
+ export { createPostgresProbe, probePostgres } from "./probes/postgres.js";
28
+ export { createPosthogProbe, probePosthogDecide, resolvePosthogHost } from "./probes/posthog.js";
29
+ export { createRedisProbe, probeRedis } from "./probes/redis.js";
30
+ export { createSentryProbe, isSentryIngestReachableStatus, parseSentryDsn, probeSentryIngest, sentryEnvelopeUrl, } from "./probes/sentry.js";
31
+ export { collectConfiguredTelemetry, type TelemetryBundle } from "./probes/telemetry.js";
32
+ export { runPreflight, type RunPreflightOptions } from "./run.js";
33
+ export { checkBlocksStartup, type ConnectivityProbe, type PreflightCheck, type PreflightCheckKind, type ProbeResult, } from "./types.js";
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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