@air-jam/server 0.1.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,252 @@
1
+ // ../env/index.mjs
2
+ var ANSI = {
3
+ reset: "\x1B[0m",
4
+ bold: "\x1B[1m",
5
+ red: "\x1B[31m",
6
+ yellow: "\x1B[33m",
7
+ cyan: "\x1B[36m",
8
+ dim: "\x1B[2m"
9
+ };
10
+ var DEFAULT_FOOTER_HINT = "Set the required environment variables and retry.";
11
+ var resolveColorEnabled = (forced) => {
12
+ if (typeof forced === "boolean") {
13
+ return forced;
14
+ }
15
+ if (typeof process === "undefined") {
16
+ return false;
17
+ }
18
+ if (typeof process.env?.NO_COLOR !== "undefined") {
19
+ return false;
20
+ }
21
+ return Boolean(process.stderr?.isTTY);
22
+ };
23
+ var paint = (enabled, tone, value) => {
24
+ if (!enabled) {
25
+ return value;
26
+ }
27
+ return `${ANSI[tone]}${value}${ANSI.reset}`;
28
+ };
29
+ var toEnvKey = (path2) => {
30
+ if (!Array.isArray(path2) || path2.length === 0) {
31
+ return "<root>";
32
+ }
33
+ const firstStringSegment = path2.find(
34
+ (segment) => typeof segment === "string"
35
+ );
36
+ return typeof firstStringSegment === "string" ? firstStringSegment : "<root>";
37
+ };
38
+ var describeExpectedRule = (issue) => {
39
+ switch (issue.code) {
40
+ case "invalid_type":
41
+ return `type ${String(issue.expected)}`;
42
+ case "invalid_value":
43
+ return issue.values && issue.values.length > 0 ? `one of: ${issue.values.join(", ")}` : "a valid value";
44
+ case "too_small":
45
+ return issue.minimum != null ? `at least ${issue.minimum}${issue.inclusive === false ? " (exclusive)" : ""}` : "a larger value";
46
+ case "too_big":
47
+ return issue.maximum != null ? `at most ${issue.maximum}${issue.inclusive === false ? " (exclusive)" : ""}` : "a smaller value";
48
+ case "invalid_format":
49
+ return issue.format ? `format ${issue.format}` : "a valid format";
50
+ default:
51
+ return "a valid value";
52
+ }
53
+ };
54
+ var toReceivedValue = (env, envKey) => {
55
+ if (!env || envKey === "<root>") {
56
+ return void 0;
57
+ }
58
+ const value = env[envKey];
59
+ if (typeof value === "undefined") {
60
+ return void 0;
61
+ }
62
+ return String(value);
63
+ };
64
+ var normalizeIssues = ({ zodIssues, env, keyHints }) => zodIssues.map((issue) => {
65
+ const envKey = toEnvKey(issue.path);
66
+ return {
67
+ envKey,
68
+ expected: describeExpectedRule(issue),
69
+ received: toReceivedValue(env, envKey),
70
+ message: issue.message,
71
+ fix: keyHints?.[envKey] ?? (envKey === "<root>" ? "Adjust the environment values so the schema constraints pass." : `Set ${envKey} to a valid value.`)
72
+ };
73
+ }).sort((a, b) => {
74
+ if (a.envKey === b.envKey) {
75
+ return a.message.localeCompare(b.message);
76
+ }
77
+ return a.envKey.localeCompare(b.envKey);
78
+ });
79
+ var EnvValidationError = class extends Error {
80
+ constructor({ boundary, issues, docsHint }) {
81
+ const count = issues.length;
82
+ super(
83
+ `${boundary}: invalid environment configuration (${count} issue${count === 1 ? "" : "s"})`
84
+ );
85
+ this.name = "EnvValidationError";
86
+ this.boundary = boundary;
87
+ this.issues = issues;
88
+ this.docsHint = docsHint;
89
+ }
90
+ };
91
+ var isEnvValidationError = (error) => error instanceof EnvValidationError;
92
+ var validateEnv = ({
93
+ boundary,
94
+ schema,
95
+ env = process.env,
96
+ docsHint,
97
+ keyHints
98
+ }) => {
99
+ const result = schema.safeParse(env);
100
+ if (result.success) {
101
+ return result.data;
102
+ }
103
+ throw new EnvValidationError({
104
+ boundary,
105
+ docsHint,
106
+ issues: normalizeIssues({
107
+ zodIssues: result.error.issues,
108
+ env,
109
+ keyHints
110
+ })
111
+ });
112
+ };
113
+ var formatEnvValidationError = (error, { color, includeReceived = true, docsHint } = {}) => {
114
+ if (!isEnvValidationError(error)) {
115
+ return String(error);
116
+ }
117
+ const colorEnabled = resolveColorEnabled(color);
118
+ const heading = `\u2716 ${error.boundary}: invalid environment configuration`;
119
+ const lines = [
120
+ paint(colorEnabled, "red", paint(colorEnabled, "bold", heading))
121
+ ];
122
+ for (const [index, issue] of error.issues.entries()) {
123
+ lines.push(
124
+ `${paint(colorEnabled, "yellow", `${index + 1}. ${issue.envKey}`)} ${paint(colorEnabled, "dim", `(${issue.message})`)}`
125
+ );
126
+ lines.push(` expected: ${issue.expected}`);
127
+ if (includeReceived) {
128
+ lines.push(
129
+ ` received: ${typeof issue.received === "string" && issue.received.length > 0 ? `"${issue.received}"` : "<missing>"}`
130
+ );
131
+ }
132
+ lines.push(` fix: ${issue.fix}`);
133
+ }
134
+ lines.push("");
135
+ lines.push(
136
+ paint(
137
+ colorEnabled,
138
+ "cyan",
139
+ `Next: ${docsHint ?? error.docsHint ?? DEFAULT_FOOTER_HINT}`
140
+ )
141
+ );
142
+ return lines.join("\n");
143
+ };
144
+
145
+ // src/logging/logger.ts
146
+ import pino, {
147
+ destination,
148
+ multistream
149
+ } from "pino";
150
+ var resolveDefaultLogLevel = (configuredLevel) => configuredLevel ?? process.env.AIR_JAM_LOG_LEVEL ?? "info";
151
+ var createBaseLoggerOptions = (configuredLevel) => ({
152
+ level: resolveDefaultLogLevel(configuredLevel),
153
+ base: void 0,
154
+ timestamp: pino.stdTimeFunctions.isoTime,
155
+ formatters: {
156
+ level: (label) => ({ level: label })
157
+ }
158
+ });
159
+ var createServerLogger = (bindings, parent, devLogCollector, options) => {
160
+ const baseLoggerOptions = createBaseLoggerOptions(options?.level);
161
+ const logger = parent ?? (devLogCollector?.enabled ? pino(
162
+ baseLoggerOptions,
163
+ multistream([
164
+ { stream: destination(1) },
165
+ {
166
+ stream: {
167
+ write(chunk) {
168
+ const line = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
169
+ devLogCollector.enqueueServerLogLine(line);
170
+ return true;
171
+ }
172
+ }
173
+ }
174
+ ])
175
+ ) : pino(baseLoggerOptions));
176
+ return bindings ? logger.child(bindings) : logger;
177
+ };
178
+ var redactIdentifier = (value) => {
179
+ if (!value) {
180
+ return void 0;
181
+ }
182
+ if (value.length <= 12) {
183
+ return value;
184
+ }
185
+ return `${value.slice(0, 10)}...${value.slice(-4)}`;
186
+ };
187
+
188
+ // src/logging/log-paths.ts
189
+ import fs from "fs";
190
+ import path from "path";
191
+ import { fileURLToPath } from "url";
192
+ var readPackageName = (cwd) => {
193
+ const packageJsonPath = path.join(cwd, "package.json");
194
+ if (!fs.existsSync(packageJsonPath)) {
195
+ return null;
196
+ }
197
+ try {
198
+ const packageJson = JSON.parse(
199
+ fs.readFileSync(packageJsonPath, "utf8")
200
+ );
201
+ return typeof packageJson.name === "string" ? packageJson.name : null;
202
+ } catch {
203
+ return null;
204
+ }
205
+ };
206
+ var findWorkspaceRootFromCwd = (cwd) => {
207
+ let currentDir = cwd;
208
+ while (true) {
209
+ if (fs.existsSync(path.join(currentDir, "pnpm-workspace.yaml"))) {
210
+ return currentDir;
211
+ }
212
+ const packageName = readPackageName(currentDir);
213
+ if (packageName === "air-jam") {
214
+ return currentDir;
215
+ }
216
+ const parentDir = path.dirname(currentDir);
217
+ if (parentDir === currentDir) {
218
+ return null;
219
+ }
220
+ currentDir = parentDir;
221
+ }
222
+ };
223
+ var resolveAirJamLogProjectRoot = (options) => {
224
+ const cwd = options?.cwd ?? process.cwd();
225
+ const cwdPackageName = readPackageName(cwd);
226
+ if (cwdPackageName && cwdPackageName !== "@air-jam/server") {
227
+ return cwd;
228
+ }
229
+ const workspaceRoot = findWorkspaceRootFromCwd(cwd);
230
+ if (workspaceRoot) {
231
+ return workspaceRoot;
232
+ }
233
+ const moduleUrl = options?.moduleUrl ?? import.meta.url;
234
+ const thisFilePath = fileURLToPath(moduleUrl);
235
+ const loggingDir = path.dirname(thisFilePath);
236
+ return path.resolve(loggingDir, "../../../../");
237
+ };
238
+ var AIR_JAM_WORKSPACE_ROOT = resolveAirJamLogProjectRoot();
239
+ var resolveDefaultDevLogDir = () => {
240
+ return path.join(AIR_JAM_WORKSPACE_ROOT, ".airjam", "logs");
241
+ };
242
+
243
+ export {
244
+ isEnvValidationError,
245
+ validateEnv,
246
+ formatEnvValidationError,
247
+ createServerLogger,
248
+ redactIdentifier,
249
+ AIR_JAM_WORKSPACE_ROOT,
250
+ resolveDefaultDevLogDir
251
+ };
252
+ //# sourceMappingURL=chunk-5ZVGSYXC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../env/index.mjs","../src/logging/logger.ts","../src/logging/log-paths.ts"],"sourcesContent":["const ANSI = {\n reset: \"\\u001b[0m\",\n bold: \"\\u001b[1m\",\n red: \"\\u001b[31m\",\n yellow: \"\\u001b[33m\",\n cyan: \"\\u001b[36m\",\n dim: \"\\u001b[2m\",\n};\n\nconst DEFAULT_FOOTER_HINT = \"Set the required environment variables and retry.\";\n\nconst resolveColorEnabled = (forced) => {\n if (typeof forced === \"boolean\") {\n return forced;\n }\n\n if (typeof process === \"undefined\") {\n return false;\n }\n\n if (typeof process.env?.NO_COLOR !== \"undefined\") {\n return false;\n }\n\n return Boolean(process.stderr?.isTTY);\n};\n\nconst paint = (enabled, tone, value) => {\n if (!enabled) {\n return value;\n }\n\n return `${ANSI[tone]}${value}${ANSI.reset}`;\n};\n\nconst toEnvKey = (path) => {\n if (!Array.isArray(path) || path.length === 0) {\n return \"<root>\";\n }\n\n const firstStringSegment = path.find(\n (segment) => typeof segment === \"string\",\n );\n return typeof firstStringSegment === \"string\" ? firstStringSegment : \"<root>\";\n};\n\nconst describeExpectedRule = (issue) => {\n switch (issue.code) {\n case \"invalid_type\":\n return `type ${String(issue.expected)}`;\n case \"invalid_value\":\n return issue.values && issue.values.length > 0\n ? `one of: ${issue.values.join(\", \")}`\n : \"a valid value\";\n case \"too_small\":\n return issue.minimum != null\n ? `at least ${issue.minimum}${issue.inclusive === false ? \" (exclusive)\" : \"\"}`\n : \"a larger value\";\n case \"too_big\":\n return issue.maximum != null\n ? `at most ${issue.maximum}${issue.inclusive === false ? \" (exclusive)\" : \"\"}`\n : \"a smaller value\";\n case \"invalid_format\":\n return issue.format ? `format ${issue.format}` : \"a valid format\";\n default:\n return \"a valid value\";\n }\n};\n\nconst toReceivedValue = (env, envKey) => {\n if (!env || envKey === \"<root>\") {\n return undefined;\n }\n\n const value = env[envKey];\n if (typeof value === \"undefined\") {\n return undefined;\n }\n\n return String(value);\n};\n\nconst normalizeIssues = ({ zodIssues, env, keyHints }) =>\n zodIssues\n .map((issue) => {\n const envKey = toEnvKey(issue.path);\n return {\n envKey,\n expected: describeExpectedRule(issue),\n received: toReceivedValue(env, envKey),\n message: issue.message,\n fix:\n keyHints?.[envKey] ??\n (envKey === \"<root>\"\n ? \"Adjust the environment values so the schema constraints pass.\"\n : `Set ${envKey} to a valid value.`),\n };\n })\n .sort((a, b) => {\n if (a.envKey === b.envKey) {\n return a.message.localeCompare(b.message);\n }\n\n return a.envKey.localeCompare(b.envKey);\n });\n\nexport class EnvValidationError extends Error {\n constructor({ boundary, issues, docsHint }) {\n const count = issues.length;\n super(\n `${boundary}: invalid environment configuration (${count} issue${count === 1 ? \"\" : \"s\"})`,\n );\n\n this.name = \"EnvValidationError\";\n this.boundary = boundary;\n this.issues = issues;\n this.docsHint = docsHint;\n }\n}\n\nexport const isEnvValidationError = (error) =>\n error instanceof EnvValidationError;\n\nexport const validateEnv = ({\n boundary,\n schema,\n env = process.env,\n docsHint,\n keyHints,\n}) => {\n const result = schema.safeParse(env);\n if (result.success) {\n return result.data;\n }\n\n throw new EnvValidationError({\n boundary,\n docsHint,\n issues: normalizeIssues({\n zodIssues: result.error.issues,\n env,\n keyHints,\n }),\n });\n};\n\nexport const formatEnvValidationError = (\n error,\n { color, includeReceived = true, docsHint } = {},\n) => {\n if (!isEnvValidationError(error)) {\n return String(error);\n }\n\n const colorEnabled = resolveColorEnabled(color);\n const heading = `✖ ${error.boundary}: invalid environment configuration`;\n\n const lines = [\n paint(colorEnabled, \"red\", paint(colorEnabled, \"bold\", heading)),\n ];\n\n for (const [index, issue] of error.issues.entries()) {\n lines.push(\n `${paint(colorEnabled, \"yellow\", `${index + 1}. ${issue.envKey}`)} ${paint(colorEnabled, \"dim\", `(${issue.message})`)}`,\n );\n lines.push(` expected: ${issue.expected}`);\n\n if (includeReceived) {\n lines.push(\n ` received: ${\n typeof issue.received === \"string\" && issue.received.length > 0\n ? `\"${issue.received}\"`\n : \"<missing>\"\n }`,\n );\n }\n\n lines.push(` fix: ${issue.fix}`);\n }\n\n lines.push(\"\");\n lines.push(\n paint(\n colorEnabled,\n \"cyan\",\n `Next: ${docsHint ?? error.docsHint ?? DEFAULT_FOOTER_HINT}`,\n ),\n );\n\n return lines.join(\"\\n\");\n};\n","import pino, {\n destination,\n multistream,\n type Bindings,\n type DestinationStream,\n type Logger,\n type LoggerOptions,\n} from \"pino\";\nimport type { DevLogCollector } from \"./dev-log-collector.js\";\n\nexport type ServerLogger = Logger;\n\nconst resolveDefaultLogLevel = (configuredLevel?: string): string =>\n configuredLevel ?? process.env.AIR_JAM_LOG_LEVEL ?? \"info\";\n\nconst createBaseLoggerOptions = (configuredLevel?: string): LoggerOptions => ({\n level: resolveDefaultLogLevel(configuredLevel),\n base: undefined,\n timestamp: pino.stdTimeFunctions.isoTime,\n formatters: {\n level: (label) => ({ level: label }),\n },\n});\n\ninterface CreateServerLoggerOptions {\n level?: string;\n}\n\nexport const createServerLogger = (\n bindings?: Bindings,\n parent?: ServerLogger,\n devLogCollector?: DevLogCollector | null,\n options?: CreateServerLoggerOptions,\n): ServerLogger => {\n const baseLoggerOptions = createBaseLoggerOptions(options?.level);\n const logger =\n parent ??\n (devLogCollector?.enabled\n ? pino(\n baseLoggerOptions,\n multistream([\n { stream: destination(1) },\n {\n stream: {\n write(chunk: string | Uint8Array) {\n const line =\n typeof chunk === \"string\"\n ? chunk\n : Buffer.from(chunk).toString(\"utf8\");\n devLogCollector.enqueueServerLogLine(line);\n return true;\n },\n } satisfies DestinationStream,\n },\n ]),\n )\n : pino(baseLoggerOptions));\n return bindings ? logger.child(bindings) : logger;\n};\n\nexport const redactIdentifier = (value?: string): string | undefined => {\n if (!value) {\n return undefined;\n }\n\n if (value.length <= 12) {\n return value;\n }\n\n return `${value.slice(0, 10)}...${value.slice(-4)}`;\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst readPackageName = (cwd: string): string | null => {\n const packageJsonPath = path.join(cwd, \"package.json\");\n if (!fs.existsSync(packageJsonPath)) {\n return null;\n }\n\n try {\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, \"utf8\"),\n ) as {\n name?: string;\n };\n return typeof packageJson.name === \"string\" ? packageJson.name : null;\n } catch {\n return null;\n }\n};\n\nconst findWorkspaceRootFromCwd = (cwd: string): string | null => {\n let currentDir = cwd;\n\n while (true) {\n if (fs.existsSync(path.join(currentDir, \"pnpm-workspace.yaml\"))) {\n return currentDir;\n }\n\n const packageName = readPackageName(currentDir);\n if (packageName === \"air-jam\") {\n return currentDir;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n currentDir = parentDir;\n }\n};\n\nexport const resolveAirJamLogProjectRoot = (options?: {\n cwd?: string;\n moduleUrl?: string;\n}): string => {\n const cwd = options?.cwd ?? process.cwd();\n const cwdPackageName = readPackageName(cwd);\n\n if (cwdPackageName && cwdPackageName !== \"@air-jam/server\") {\n return cwd;\n }\n\n const workspaceRoot = findWorkspaceRootFromCwd(cwd);\n if (workspaceRoot) {\n return workspaceRoot;\n }\n\n const moduleUrl = options?.moduleUrl ?? import.meta.url;\n const thisFilePath = fileURLToPath(moduleUrl);\n const loggingDir = path.dirname(thisFilePath);\n return path.resolve(loggingDir, \"../../../../\");\n};\n\nexport const AIR_JAM_WORKSPACE_ROOT = resolveAirJamLogProjectRoot();\n\nexport const resolveDefaultDevLogDir = (): string => {\n return path.join(AIR_JAM_WORKSPACE_ROOT, \".airjam\", \"logs\");\n};\n"],"mappings":";AAAA,IAAM,OAAO;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ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