@hasna/recordings 0.1.36 → 0.1.37
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/README.md +43 -0
- package/dist/cli/index.js +14 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -0
- package/dist/mcp/index.js +14 -5
- package/dist/sdk/index.d.ts +16 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +171 -0
- package/dist/sdk/v1.generated.d.ts +150 -0
- package/dist/sdk/v1.generated.d.ts.map +1 -0
- package/dist/server/cloud.d.ts +49 -0
- package/dist/server/cloud.d.ts.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +6812 -0
- package/dist/server/openapi.d.ts +614 -0
- package/dist/server/openapi.d.ts.map +1 -0
- package/dist/server/repo.d.ts +34 -0
- package/dist/server/repo.d.ts.map +1 -0
- package/dist/server/serve.d.ts +11 -0
- package/dist/server/serve.d.ts.map +1 -0
- package/dist/server/v1.d.ts +6 -0
- package/dist/server/v1.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +13 -4
- package/scripts/generate-sdk.ts +31 -0
- package/scripts/migrate.ts +37 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/recordings",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Speech-to-text recording tool with MCP and CLI — records, transcribes, and optionally enhances text using AI",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
12
|
"bin": {
|
|
13
13
|
"recordings": "dist/cli/index.js",
|
|
14
|
-
"recordings-mcp": "dist/mcp/index.js"
|
|
14
|
+
"recordings-mcp": "dist/mcp/index.js",
|
|
15
|
+
"recordings-serve": "dist/server/index.js"
|
|
15
16
|
},
|
|
16
17
|
"exports": {
|
|
17
18
|
".": {
|
|
@@ -21,14 +22,21 @@
|
|
|
21
22
|
"./storage": {
|
|
22
23
|
"import": "./dist/storage.js",
|
|
23
24
|
"types": "./dist/storage.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./sdk": {
|
|
27
|
+
"import": "./dist/sdk/index.js",
|
|
28
|
+
"types": "./dist/sdk/index.d.ts"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"scripts": {
|
|
27
32
|
"clean": "rm -rf dist",
|
|
28
|
-
"build": "bun run clean && bun run build:cli && bun run build:mcp && bun run build:lib && tsc --emitDeclarationOnly --outDir dist",
|
|
33
|
+
"build": "bun run clean && bun run build:cli && bun run build:mcp && bun run build:serve && bun run build:lib && tsc --emitDeclarationOnly --outDir dist",
|
|
29
34
|
"build:cli": "bun build src/cli/index.ts --target=bun --outfile=dist/cli/index.js --external=commander --external=chalk --external=openai",
|
|
30
35
|
"build:mcp": "bun build src/mcp/index.ts --target=bun --outfile=dist/mcp/index.js --external=@modelcontextprotocol/sdk --external=openai",
|
|
31
|
-
"build:
|
|
36
|
+
"build:serve": "bun build src/server/index.ts --target=bun --outfile=dist/server/index.js --external=@modelcontextprotocol/sdk --external=@hasna/contracts --external=openai --external=pg",
|
|
37
|
+
"build:lib": "bun build src/index.ts src/storage.ts src/sdk/index.ts --target=bun --outdir=dist --external=openai",
|
|
38
|
+
"generate:sdk": "bun run scripts/generate-sdk.ts",
|
|
39
|
+
"migrate": "bun run scripts/migrate.ts",
|
|
32
40
|
"typecheck": "tsc --noEmit",
|
|
33
41
|
"test": "bun test",
|
|
34
42
|
"test:coverage": "bun test --coverage",
|
|
@@ -52,6 +60,7 @@
|
|
|
52
60
|
"LICENSE"
|
|
53
61
|
],
|
|
54
62
|
"dependencies": {
|
|
63
|
+
"@hasna/contracts": "0.4.1",
|
|
55
64
|
"@hasna/events": "^0.1.11",
|
|
56
65
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
57
66
|
"chalk": "^5.4.1",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Generate the typed `/v1` SDK client from the serve OpenAPI document.
|
|
4
|
+
*
|
|
5
|
+
* Source of truth: src/server/openapi.ts (also served at GET /openapi.json).
|
|
6
|
+
* Output: src/sdk/v1.generated.ts — a dependency-free typed fetch client.
|
|
7
|
+
*
|
|
8
|
+
* Usage: bun run scripts/generate-sdk.ts
|
|
9
|
+
*/
|
|
10
|
+
import { writeFileSync } from "node:fs";
|
|
11
|
+
import { join, dirname } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
import { generateSdkFromOpenApi } from "@hasna/contracts/sdk";
|
|
14
|
+
import { buildV1OpenApiDocument } from "../src/server/openapi.js";
|
|
15
|
+
|
|
16
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
17
|
+
const spec = buildV1OpenApiDocument();
|
|
18
|
+
const { code, operations, warnings } = generateSdkFromOpenApi(spec as never, {
|
|
19
|
+
className: "RecordingsV1Client",
|
|
20
|
+
apiKeyHeader: "x-api-key",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const header =
|
|
24
|
+
"// AUTO-GENERATED by scripts/generate-sdk.ts from src/server/openapi.ts — DO NOT EDIT BY HAND.\n" +
|
|
25
|
+
"// Regenerate: bun run scripts/generate-sdk.ts\n\n";
|
|
26
|
+
const outPath = join(root, "src/sdk/v1.generated.ts");
|
|
27
|
+
writeFileSync(outPath, header + code);
|
|
28
|
+
|
|
29
|
+
console.log(`Wrote ${outPath}`);
|
|
30
|
+
console.log(`Operations: ${operations.map((o) => o.functionName).join(", ")}`);
|
|
31
|
+
if (warnings.length) console.log(`Warnings:\n ${warnings.join("\n ")}`);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Migration runner for the recordings cloud (A1 pure-remote) database.
|
|
4
|
+
*
|
|
5
|
+
* Applies the relational recordings schema and the contracts API-key store,
|
|
6
|
+
* idempotently (CREATE ... IF NOT EXISTS). NEVER drops or rewrites existing
|
|
7
|
+
* tables — safe to run against a populated DB. Shares the exact code path used
|
|
8
|
+
* by the serve process (`ensureCloudSchema`).
|
|
9
|
+
*
|
|
10
|
+
* The canonical DDL is committed under migrations/*.sql for transparency.
|
|
11
|
+
*
|
|
12
|
+
* Env: HASNA_RECORDINGS_DATABASE_URL (or RECORDINGS_DATABASE_URL / DATABASE_URL).
|
|
13
|
+
* Usage: bun run scripts/migrate.ts
|
|
14
|
+
*/
|
|
15
|
+
import { ensureCloudSchema, pingCloud, resolveCloudDatabaseUrl, closeCloud } from "../src/server/cloud.js";
|
|
16
|
+
|
|
17
|
+
async function main() {
|
|
18
|
+
const url = resolveCloudDatabaseUrl();
|
|
19
|
+
if (!url) {
|
|
20
|
+
console.error(
|
|
21
|
+
"migrate: no database URL (HASNA_RECORDINGS_DATABASE_URL / RECORDINGS_DATABASE_URL / DATABASE_URL)",
|
|
22
|
+
);
|
|
23
|
+
process.exit(2);
|
|
24
|
+
}
|
|
25
|
+
console.log("migrate: connecting…");
|
|
26
|
+
await pingCloud();
|
|
27
|
+
console.log("migrate: applying schema (recordings tables + api_keys)…");
|
|
28
|
+
await ensureCloudSchema();
|
|
29
|
+
console.log("migrate: done");
|
|
30
|
+
await closeCloud();
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
main().catch((e) => {
|
|
35
|
+
console.error("migrate: failed:", (e as Error).message);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|