@naisys/common-node 3.0.0-beta.4 → 3.0.0-beta.6

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/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@naisys/common-node",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.6",
4
4
  "type": "module",
5
5
  "description": "[internal] Node-only utilities for NAISYS",
6
6
  "files": [
7
7
  "dist",
8
- "!dist/**/*.map"
8
+ "!dist/**/*.map",
9
+ "!dist/**/*.d.ts",
10
+ "!dist/**/*.d.ts.map"
9
11
  ],
10
12
  "scripts": {
11
13
  "clean": "rimraf dist",
@@ -14,7 +16,7 @@
14
16
  "npm:publish": "npm publish --access public"
15
17
  },
16
18
  "dependencies": {
17
- "@naisys/common": "3.0.0-beta.4",
19
+ "@naisys/common": "3.0.0-beta.6",
18
20
  "better-sqlite3": "^12.6.2",
19
21
  "js-yaml": "^4.1.1"
20
22
  },
@@ -1,4 +0,0 @@
1
- import type { UserEntry } from "@naisys/common";
2
- /** Loads agent yaml configs from a file or directory path, returns a map of userId → UserEntry */
3
- export declare function loadAgentConfigs(startupPath: string): Map<number, UserEntry>;
4
- //# sourceMappingURL=agentConfigLoader.d.ts.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Extract the API key from an Authorization: Bearer header value.
3
- * Returns undefined if the header is missing or not in Bearer format.
4
- */
5
- export declare function extractBearerToken(authHeader: string | undefined): string | undefined;
6
- //# sourceMappingURL=bearerToken.d.ts.map
@@ -1,4 +0,0 @@
1
- import { type CustomModelsFile } from "@naisys/common";
2
- export declare function loadCustomModels(folder: string): CustomModelsFile;
3
- export declare function saveCustomModels(data: CustomModelsFile): void;
4
- //# sourceMappingURL=customModelsLoader.d.ts.map
@@ -1,3 +0,0 @@
1
- /** Expand ~ to the user's home directory in NAISYS_FOLDER */
2
- export declare function expandNaisysFolder(): void;
3
- //# sourceMappingURL=expandEnv.d.ts.map
@@ -1,3 +0,0 @@
1
- /** Hash a token (session cookie, API key) with SHA-256 for safe cache keys / DB lookup. */
2
- export declare function hashToken(token: string): string;
3
- //# sourceMappingURL=hashToken.d.ts.map
@@ -1,31 +0,0 @@
1
- import https from "https";
2
- /**
3
- * Read the hub access key from the local cert file at NAISYS_FOLDER/cert/hub-access-key.
4
- * Returns undefined if the file does not exist.
5
- */
6
- export declare function readHubAccessKeyFile(): string | undefined;
7
- /**
8
- * Resolve the hub access key from environment variable or local cert file.
9
- * Returns undefined if neither is available.
10
- */
11
- export declare function resolveHubAccessKey(): string | undefined;
12
- /** Parse a hub access key in format "<fingerprintPrefix>+<secret>" */
13
- export declare function parseHubAccessKey(accessKey: string): {
14
- fingerprintPrefix: string;
15
- secret: string;
16
- };
17
- /** Compute SHA-256 fingerprint of a DER-encoded certificate */
18
- export declare function computeCertFingerprint(derCert: Buffer): string;
19
- /**
20
- * Connect to a TLS server, verify that the certificate fingerprint matches
21
- * the expected prefix, and return the PEM-encoded certificate for use as a
22
- * trusted CA in subsequent connections.
23
- */
24
- export declare function verifyHubCertificate(host: string, port: number, fingerprintPrefix: string): Promise<string>;
25
- /**
26
- * Create an https.Agent that trusts only the given PEM certificate.
27
- * Used after verifyHubCertificate to pin all subsequent connections
28
- * to the same cert (no TOCTOU gap since Node's TLS layer enforces it).
29
- */
30
- export declare function createPinnedHttpsAgent(certPem: string): https.Agent;
31
- //# sourceMappingURL=hubCertVerification.d.ts.map
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export * from "./agentConfigLoader.js";
2
- export * from "./bearerToken.js";
3
- export * from "./expandEnv.js";
4
- export * from "./customModelsLoader.js";
5
- export * from "./hashToken.js";
6
- export * from "./hubCertVerification.js";
7
- export * from "./logFileService.js";
8
- export * from "./migrationHelper.js";
9
- export * from "./sessionCookie.js";
10
- //# sourceMappingURL=index.d.ts.map
@@ -1,11 +0,0 @@
1
- export interface PinoLogEntry {
2
- level: number;
3
- time: number;
4
- msg: string;
5
- detail?: string;
6
- }
7
- export declare function tailLogFile(filePath: string, lineCount: number, minLevel?: number): Promise<{
8
- entries: PinoLogEntry[];
9
- fileSize: number;
10
- }>;
11
- //# sourceMappingURL=logFileService.d.ts.map
@@ -1,15 +0,0 @@
1
- /**
2
- * Shared helper that runs `prisma migrate deploy` with a version-checked fast path.
3
- * Uses `better-sqlite3` directly (synchronous, no Prisma dependency) for the version check.
4
- */
5
- export declare function deployPrismaMigrations(options: {
6
- /** Directory containing prisma.config.ts and prisma/ folder */
7
- packageDir: string;
8
- /** Absolute path to the .db file */
9
- databasePath: string;
10
- /** Skip migrations if DB already at this version */
11
- expectedVersion: number;
12
- /** Extra env vars forwarded to `prisma migrate deploy` */
13
- envOverrides?: Record<string, string>;
14
- }): Promise<void>;
15
- //# sourceMappingURL=migrationHelper.d.ts.map
@@ -1,9 +0,0 @@
1
- export declare const SESSION_COOKIE_NAME = "naisys_session";
2
- export declare function sessionCookieOptions(expiresAt: Date): {
3
- path: string;
4
- httpOnly: boolean;
5
- sameSite: "lax";
6
- secure: boolean;
7
- maxAge: number;
8
- };
9
- //# sourceMappingURL=sessionCookie.d.ts.map