@hasna/domains 0.0.27 → 0.0.30

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 (107) hide show
  1. package/README.md +28 -0
  2. package/dist/cli/commands/brandsight.d.ts.map +1 -1
  3. package/dist/cli/commands/db.d.ts +7 -0
  4. package/dist/cli/commands/db.d.ts.map +1 -0
  5. package/dist/cli/commands/dns.d.ts.map +1 -1
  6. package/dist/cli/commands/domain.d.ts.map +1 -1
  7. package/dist/cli/commands/history.d.ts.map +1 -1
  8. package/dist/cli/commands/monitor.d.ts.map +1 -1
  9. package/dist/cli/commands/outreach.d.ts.map +1 -1
  10. package/dist/cli/commands/owner.d.ts.map +1 -1
  11. package/dist/cli/commands/research.d.ts.map +1 -1
  12. package/dist/cli/commands/route53.d.ts.map +1 -1
  13. package/dist/cli/commands/sedo.d.ts.map +1 -1
  14. package/dist/cli/commands/serve.d.ts.map +1 -1
  15. package/dist/cli/commands/ssl.d.ts.map +1 -1
  16. package/dist/cli/commands/wallet.d.ts.map +1 -1
  17. package/dist/cli/commands/zone.d.ts.map +1 -1
  18. package/dist/cli/index.js +62413 -40499
  19. package/dist/cli/tui/App.d.ts.map +1 -1
  20. package/dist/cli/tui/DomainDetail.d.ts +1 -1
  21. package/dist/cli/tui/DomainDetail.d.ts.map +1 -1
  22. package/dist/db/dns-tools.d.ts +10 -6
  23. package/dist/db/dns-tools.d.ts.map +1 -1
  24. package/dist/db/domain-owners.d.ts +6 -21
  25. package/dist/db/domain-owners.d.ts.map +1 -1
  26. package/dist/db/domain-reputation.d.ts +0 -11
  27. package/dist/db/domain-reputation.d.ts.map +1 -1
  28. package/dist/db/domain-research.d.ts +1 -1
  29. package/dist/db/domain-research.d.ts.map +1 -1
  30. package/dist/db/domains.d.ts +51 -8
  31. package/dist/db/domains.d.ts.map +1 -1
  32. package/dist/db/history.d.ts +27 -0
  33. package/dist/db/history.d.ts.map +1 -0
  34. package/dist/db/monitoring.d.ts +2 -2
  35. package/dist/db/monitoring.d.ts.map +1 -1
  36. package/dist/db/owners.d.ts +48 -0
  37. package/dist/db/owners.d.ts.map +1 -0
  38. package/dist/db/reputation.d.ts +28 -0
  39. package/dist/db/reputation.d.ts.map +1 -0
  40. package/dist/db/store.d.ts +249 -0
  41. package/dist/db/store.d.ts.map +1 -0
  42. package/dist/generated/storage-kit/health.d.ts +20 -0
  43. package/dist/generated/storage-kit/health.d.ts.map +1 -0
  44. package/dist/generated/storage-kit/index.d.ts +8 -0
  45. package/dist/generated/storage-kit/index.d.ts.map +1 -0
  46. package/dist/generated/storage-kit/migrations.d.ts +48 -0
  47. package/dist/generated/storage-kit/migrations.d.ts.map +1 -0
  48. package/dist/generated/storage-kit/mode.d.ts +48 -0
  49. package/dist/generated/storage-kit/mode.d.ts.map +1 -0
  50. package/dist/generated/storage-kit/pool.d.ts +34 -0
  51. package/dist/generated/storage-kit/pool.d.ts.map +1 -0
  52. package/dist/generated/storage-kit/query.d.ts +36 -0
  53. package/dist/generated/storage-kit/query.d.ts.map +1 -0
  54. package/dist/generated/storage-kit/tls.d.ts +26 -0
  55. package/dist/generated/storage-kit/tls.d.ts.map +1 -0
  56. package/dist/index.d.ts +4 -5
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +47868 -26139
  59. package/dist/lib/brandsight.d.ts +3 -3
  60. package/dist/lib/brandsight.d.ts.map +1 -1
  61. package/dist/lib/cloudflare.js +3 -3
  62. package/dist/lib/compact-output.d.ts +31 -0
  63. package/dist/lib/compact-output.d.ts.map +1 -0
  64. package/dist/lib/godaddy.d.ts +3 -3
  65. package/dist/lib/godaddy.d.ts.map +1 -1
  66. package/dist/lib/namecheap.d.ts +5 -5
  67. package/dist/lib/namecheap.d.ts.map +1 -1
  68. package/dist/lib/registrar.d.ts +4 -4
  69. package/dist/lib/registrar.d.ts.map +1 -1
  70. package/dist/lib/registrar.js +17 -17
  71. package/dist/lib/route53.js +3 -3
  72. package/dist/lib/sedo.d.ts +1 -1
  73. package/dist/lib/sedo.d.ts.map +1 -1
  74. package/dist/mcp/http.d.ts +8 -3
  75. package/dist/mcp/http.d.ts.map +1 -1
  76. package/dist/mcp/index.d.ts.map +1 -1
  77. package/dist/mcp/index.js +32250 -10445
  78. package/dist/sdk/client.d.ts +198 -0
  79. package/dist/sdk/client.d.ts.map +1 -0
  80. package/dist/sdk/index.d.ts +14 -0
  81. package/dist/sdk/index.d.ts.map +1 -0
  82. package/dist/sdk/index.js +176 -0
  83. package/dist/server/app.d.ts +33 -0
  84. package/dist/server/app.d.ts.map +1 -0
  85. package/dist/server/index.d.ts +19 -0
  86. package/dist/server/index.d.ts.map +1 -0
  87. package/dist/server/index.js +2388 -0
  88. package/dist/server/migrations.d.ts +22 -0
  89. package/dist/server/migrations.d.ts.map +1 -0
  90. package/dist/server/openapi.d.ts +25 -0
  91. package/dist/server/openapi.d.ts.map +1 -0
  92. package/dist/server/repo.d.ts +96 -0
  93. package/dist/server/repo.d.ts.map +1 -0
  94. package/package.json +13 -7
  95. package/dist/cli/commands/domains.d.ts +0 -3
  96. package/dist/cli/commands/domains.d.ts.map +0 -1
  97. package/dist/cli/commands/storage.d.ts +0 -3
  98. package/dist/cli/commands/storage.d.ts.map +0 -1
  99. package/dist/db/remote-storage.d.ts +0 -10
  100. package/dist/db/remote-storage.d.ts.map +0 -1
  101. package/dist/db/storage-sync.d.ts +0 -55
  102. package/dist/db/storage-sync.d.ts.map +0 -1
  103. package/dist/mcp/storage-tools.d.ts +0 -3
  104. package/dist/mcp/storage-tools.d.ts.map +0 -1
  105. package/dist/storage.d.ts +0 -5
  106. package/dist/storage.d.ts.map +0 -1
  107. package/dist/storage.js +0 -5691
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Cloud Postgres migrations for domains-serve.
3
+ *
4
+ * Combines the app schema (`PG_MIGRATIONS`) with the vendored storage kit's
5
+ * checksum-guarded `MigrationLedger` and the @hasna/contracts api-keys table.
6
+ * Runs against the OWNER role DSN (DDL), not the request-path app role.
7
+ *
8
+ * PURE REMOTE (Amendment A1): migrations run against the cloud Postgres. There
9
+ * is no local schema and no ledger sync between machines.
10
+ */
11
+ import { type Migration, type MigrationResult } from "../generated/storage-kit/index.js";
12
+ /** Env var holding the owner-role DSN (DDL privileges). Falls back to the app DSN. */
13
+ export declare const OWNER_DSN_ENV = "HASNA_DOMAINS_DATABASE_URL_OWNER";
14
+ export declare const APP_DSN_ENV = "HASNA_DOMAINS_DATABASE_URL";
15
+ /** The ordered migration set: app schema first, then the shared api-keys table. */
16
+ export declare function buildMigrations(): Migration[];
17
+ /** Run all pending migrations against the owner DSN. */
18
+ export declare function runMigrations(opts?: {
19
+ dryRun?: boolean;
20
+ env?: NodeJS.ProcessEnv;
21
+ }): Promise<MigrationResult>;
22
+ //# sourceMappingURL=migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/server/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAK3C,sFAAsF;AACtF,eAAO,MAAM,aAAa,qCAAqC,CAAC;AAChE,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAGxD,mFAAmF;AACnF,wBAAgB,eAAe,IAAI,SAAS,EAAE,CAU7C;AAYD,wDAAwD;AACxD,wBAAsB,aAAa,CACjC,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAO,GACvD,OAAO,CAAC,eAAe,CAAC,CAW1B"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * OpenAPI 3.1 description of the domains-serve HTTP API.
3
+ *
4
+ * This is the single source of truth for the versioned `/v1` surface and the
5
+ * generated SDK (`src/sdk`, produced by `@hasna/contracts` generateSdkFromOpenApi).
6
+ */
7
+ export interface OpenApiDoc {
8
+ openapi: string;
9
+ info: {
10
+ title: string;
11
+ version: string;
12
+ description?: string;
13
+ };
14
+ servers?: {
15
+ url: string;
16
+ }[];
17
+ paths: Record<string, Record<string, unknown>>;
18
+ components: {
19
+ schemas: Record<string, unknown>;
20
+ securitySchemes?: Record<string, unknown>;
21
+ };
22
+ security?: Record<string, unknown[]>[];
23
+ }
24
+ export declare function buildOpenApiSpec(version: string): OpenApiDoc;
25
+ //# sourceMappingURL=openapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/server/openapi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC5F,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;CACxC;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAqW5D"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * PG-backed repository for the domains-serve HTTP API.
3
+ *
4
+ * PURE REMOTE (Amendment A1): every call reads and writes the app's cloud
5
+ * Postgres directly through the vendored storage kit's typed query client.
6
+ * There is no cache, no local mirror, and no sync engine here — that degraded
7
+ * client behaviour lives in the CLIENT, out of scope for the service.
8
+ *
9
+ * The row shapes mirror the local SQLite model in `src/db`, but the storage is
10
+ * native Postgres: booleans are real BOOLEAN columns and the JSON columns
11
+ * (nameservers / whois / metadata) are TEXT holding JSON strings.
12
+ */
13
+ import type { TypedQueryClient } from "../generated/storage-kit/index.js";
14
+ import type { Domain, CreateDomainInput, UpdateDomainInput, DomainStats, DomainOffer, CreateDomainOfferInput } from "../db/domain-records.js";
15
+ import type { DnsRecord, CreateDnsRecordInput, UpdateDnsRecordInput } from "../db/dns-records.js";
16
+ import type { Alert, CreateAlertInput } from "../db/alerts.js";
17
+ import type { DomainEmailLink, CreateDomainEmailLinkInput } from "../db/domain-records.js";
18
+ import type { DomainOwner, CreateDomainOwnerInput, DomainWithOwner } from "../db/domain-owners.js";
19
+ import type { DomainHistory, CreateHistoryEntryInput } from "../db/domain-history.js";
20
+ import type { DomainReputation, CreateReputationInput } from "../db/domain-reputation.js";
21
+ export declare class HttpError extends Error {
22
+ readonly status: number;
23
+ constructor(status: number, message: string);
24
+ }
25
+ /** Repository bound to a typed query client (the vendored kit's cloud pool). */
26
+ export declare class DomainsRepo {
27
+ private readonly db;
28
+ constructor(db: TypedQueryClient);
29
+ createDomain(input: CreateDomainInput): Promise<Domain>;
30
+ getDomain(id: string): Promise<Domain | null>;
31
+ getDomainByName(name: string): Promise<Domain | null>;
32
+ listDomains(opts: {
33
+ search?: string;
34
+ status?: string;
35
+ limit?: number;
36
+ offset?: number;
37
+ }): Promise<Domain[]>;
38
+ updateDomain(id: string, patch: UpdateDomainInput): Promise<Domain | null>;
39
+ deleteDomain(id: string): Promise<boolean>;
40
+ countDomains(): Promise<number>;
41
+ getStats(): Promise<DomainStats>;
42
+ listDnsRecords(domainId: string): Promise<DnsRecord[]>;
43
+ createDnsRecord(domainId: string, input: CreateDnsRecordInput): Promise<DnsRecord>;
44
+ getDnsRecord(id: string): Promise<DnsRecord | null>;
45
+ deleteDnsRecord(id: string): Promise<boolean>;
46
+ listOffers(domainId: string): Promise<DomainOffer[]>;
47
+ createOffer(domainId: string, input: CreateDomainOfferInput): Promise<DomainOffer>;
48
+ getOffer(id: string): Promise<DomainOffer | null>;
49
+ updateDnsRecord(id: string, patch: UpdateDnsRecordInput): Promise<DnsRecord | null>;
50
+ listEmailLinks(domainId: string): Promise<DomainEmailLink[]>;
51
+ getEmailLink(id: string): Promise<DomainEmailLink | null>;
52
+ linkEmail(domainId: string, input: Omit<CreateDomainEmailLinkInput, "domain_id">): Promise<DomainEmailLink>;
53
+ listAlerts(domainId: string): Promise<Alert[]>;
54
+ getAlert(id: string): Promise<Alert | null>;
55
+ createAlert(domainId: string, input: Omit<CreateAlertInput, "domain_id">): Promise<Alert>;
56
+ deleteAlert(id: string): Promise<boolean>;
57
+ private ownerRow;
58
+ listOwnersForDomain(domainId: string): Promise<DomainOwner[]>;
59
+ listOwners(opts: {
60
+ search?: string;
61
+ source?: string;
62
+ verified?: boolean;
63
+ }): Promise<DomainOwner[]>;
64
+ getOwner(id: string): Promise<DomainOwner | null>;
65
+ createOwner(domainId: string, input: Omit<CreateDomainOwnerInput, "domain_id">): Promise<DomainOwner>;
66
+ updateOwner(id: string, patch: Partial<CreateDomainOwnerInput>): Promise<DomainOwner | null>;
67
+ deleteOwner(id: string): Promise<boolean>;
68
+ listDomainsWithOwners(): Promise<DomainWithOwner[]>;
69
+ private historyRow;
70
+ createHistory(domainId: string, input: Omit<CreateHistoryEntryInput, "domain_id">): Promise<DomainHistory>;
71
+ getHistory(id: string): Promise<DomainHistory | null>;
72
+ listHistory(domainId: string, opts: {
73
+ type?: string;
74
+ limit?: number;
75
+ }): Promise<DomainHistory[]>;
76
+ listHistoryByDateRange(start: string, end: string, domainId?: string): Promise<DomainHistory[]>;
77
+ deleteHistory(id: string): Promise<boolean>;
78
+ deleteHistoryByDomain(domainId: string): Promise<boolean>;
79
+ listHistoryChanges(): Promise<Array<{
80
+ domain_id: string;
81
+ domain_name: string;
82
+ latest_snapshot_type: string;
83
+ latest_snapshot_at: string;
84
+ snapshot_count: number;
85
+ }>>;
86
+ private reputationRow;
87
+ getReputation(domainId: string): Promise<DomainReputation | null>;
88
+ upsertReputation(domainId: string, input: Omit<CreateReputationInput, "domain_id">): Promise<DomainReputation>;
89
+ updateReputation(id: string, patch: Partial<CreateReputationInput>): Promise<DomainReputation | null>;
90
+ deleteReputation(id: string): Promise<boolean>;
91
+ listReputation(opts: {
92
+ blacklisted?: boolean;
93
+ threshold?: number;
94
+ }): Promise<DomainReputation[]>;
95
+ }
96
+ //# sourceMappingURL=repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/server/repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EACV,MAAM,EAEN,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAqB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEtH,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAqB,MAAM,yBAAyB,CAAC;AAEzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAuF1F,qBAAa,SAAU,SAAQ,KAAK;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CA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AC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAoBxK,OAAO,CAAC,aAAa;IAkBf,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKjE,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwC9G,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAMrG,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK9C,cAAc,CAAC,IAAI,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAcvG"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@hasna/domains",
3
- "version": "0.0.27",
4
- "description": "Domain portfolio, registrar, marketplace, and DNS management for AI agents — CLI + MCP server with SQLite",
3
+ "version": "0.0.30",
4
+ "description": "Domain portfolio, registrar, marketplace, and DNS management for AI agents — CLI + MCP + HTTP API + SDK, local SQLite or cloud Postgres",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
9
  "domains": "dist/cli/index.js",
10
- "domains-mcp": "dist/mcp/index.js"
10
+ "domains-mcp": "dist/mcp/index.js",
11
+ "domains-serve": "dist/server/index.js"
11
12
  },
12
13
  "exports": {
13
14
  ".": {
@@ -38,9 +39,9 @@
38
39
  "types": "./dist/lib/route53.d.ts",
39
40
  "import": "./dist/lib/route53.js"
40
41
  },
41
- "./storage": {
42
- "types": "./dist/storage.d.ts",
43
- "import": "./dist/storage.js"
42
+ "./sdk": {
43
+ "types": "./dist/sdk/index.d.ts",
44
+ "import": "./dist/sdk/index.js"
44
45
  }
45
46
  },
46
47
  "files": [
@@ -50,11 +51,14 @@
50
51
  ],
51
52
  "scripts": {
52
53
  "clean": "rm -rf dist",
53
- "build": "bun run clean && bun build src/cli/index.ts --outdir dist/cli --target bun --external ink --external react --external chalk --external ink-text-input --external @modelcontextprotocol/sdk && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk && bun build src/index.ts src/storage.ts --outdir dist --target bun && bun build src/lib/capability.ts src/lib/cloudflare.ts src/lib/cloudflare-auth.ts src/lib/delegate.ts src/lib/registrar.ts src/lib/route53.ts --outdir dist/lib --target node --packages external && tsc --emitDeclarationOnly --outDir dist",
54
+ "build": "bun run clean && bun build src/cli/index.ts --outdir dist/cli --target bun --external ink --external react --external chalk --external ink-text-input --external @modelcontextprotocol/sdk --external pg && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external pg && bun build src/server/index.ts --outdir dist/server --target bun --external pg && bun build src/sdk/index.ts --outdir dist/sdk --target bun && bun build src/index.ts --outdir dist --target bun --external pg && bun build src/lib/capability.ts src/lib/cloudflare.ts src/lib/cloudflare-auth.ts src/lib/delegate.ts src/lib/registrar.ts src/lib/route53.ts --outdir dist/lib --target node --packages external && tsc --emitDeclarationOnly --outDir dist",
54
55
  "typecheck": "tsc --noEmit",
55
56
  "test": "bun test",
57
+ "sdk:gen": "bun run scripts/gen-sdk.ts",
58
+ "kit:check": "contracts vendor-kit --check",
56
59
  "dev:cli": "bun run src/cli/index.ts",
57
60
  "dev:mcp": "bun run src/mcp/index.ts",
61
+ "dev:serve": "bun run src/server/index.ts",
58
62
  "prepublishOnly": "bun run build",
59
63
  "postinstall": "mkdir -p ${XDG_DATA_HOME:-$HOME/.local/share}/open-domains ${XDG_CONFIG_HOME:-$HOME/.config}/open-domains 2>/dev/null || true"
60
64
  },
@@ -91,6 +95,7 @@
91
95
  "@aws-sdk/client-route-53": "^3.1067.0",
92
96
  "@aws-sdk/client-route-53-domains": "^3.1067.0",
93
97
  "@aws-sdk/credential-provider-ini": "3.972.53",
98
+ "@hasna/contracts": "^0.5.2",
94
99
  "@modelcontextprotocol/sdk": "^1.29.0",
95
100
  "chalk": "^5.4.1",
96
101
  "commander": "^13.1.0",
@@ -105,6 +110,7 @@
105
110
  "@hasna/events": "^0.1.7"
106
111
  },
107
112
  "devDependencies": {
113
+ "@hasna/mcp-harness": "file:../open-mcp",
108
114
  "@types/bun": "^1.3.14",
109
115
  "@types/pg": "^8.20.0",
110
116
  "@types/react": "^18.3.18",
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerDomainCommands(program: Command): void;
3
- //# sourceMappingURL=domains.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/domains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyb7D"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerStorageCommand(program: Command): void;
3
- //# sourceMappingURL=storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2GzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE7D"}
@@ -1,10 +0,0 @@
1
- export declare class PgAdapterAsync {
2
- private readonly pool;
3
- constructor(connectionString: string);
4
- run(sql: string, ...params: unknown[]): Promise<{
5
- changes: number;
6
- }>;
7
- all(sql: string, ...params: unknown[]): Promise<unknown[]>;
8
- close(): Promise<void>;
9
- }
10
- //# sourceMappingURL=remote-storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote-storage.d.ts","sourceRoot":"","sources":["../../src/db/remote-storage.ts"],"names":[],"mappings":"AAmBA,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;gBAEhB,gBAAgB,EAAE,MAAM;IAI9B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAKpE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAK1D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -1,55 +0,0 @@
1
- import { PgAdapterAsync } from "./remote-storage.js";
2
- export declare const STORAGE_TABLES: readonly ["domains", "dns_records", "alerts", "domain_offers", "domain_emails", "domain_owners", "domain_history", "domain_reputation"];
3
- export declare const DOMAINS_STORAGE_TABLES: readonly ["domains", "dns_records", "alerts", "domain_offers", "domain_emails", "domain_owners", "domain_history", "domain_reputation"];
4
- type StorageTable = (typeof STORAGE_TABLES)[number];
5
- export type StorageMode = "local" | "remote" | "hybrid";
6
- export interface StorageSyncResult {
7
- table: string;
8
- rowsRead: number;
9
- rowsWritten: number;
10
- errors: string[];
11
- }
12
- export interface StorageSyncMeta {
13
- table_name: string;
14
- last_synced_at: string | null;
15
- direction: "push" | "pull";
16
- }
17
- export type SyncResult = StorageSyncResult;
18
- export type SyncMeta = StorageSyncMeta;
19
- export interface StorageStatus {
20
- configured: boolean;
21
- env: typeof STORAGE_DATABASE_ENV;
22
- mode: StorageMode;
23
- service: "domains";
24
- tables: typeof STORAGE_TABLES;
25
- sync: StorageSyncMeta[];
26
- }
27
- export declare const DOMAINS_STORAGE_ENV = "DOMAINS_DATABASE_URL";
28
- export declare const DOMAINS_STORAGE_FALLBACK_ENV = "HASNA_DOMAINS_DATABASE_URL";
29
- export declare const DOMAINS_STORAGE_MODE_ENV = "DOMAINS_STORAGE_MODE";
30
- export declare const DOMAINS_STORAGE_MODE_FALLBACK_ENV = "HASNA_DOMAINS_STORAGE_MODE";
31
- export declare const STORAGE_DATABASE_ENV: readonly ["DOMAINS_DATABASE_URL", "HASNA_DOMAINS_DATABASE_URL"];
32
- export declare const STORAGE_MODE_ENV: readonly ["DOMAINS_STORAGE_MODE", "HASNA_DOMAINS_STORAGE_MODE"];
33
- export declare function getStorageDatabaseUrl(): string | null;
34
- export declare function getStorageDatabaseEnvName(): (typeof STORAGE_DATABASE_ENV)[number] | null;
35
- export declare function getStorageMode(): StorageMode;
36
- export declare function getStoragePg(): Promise<PgAdapterAsync>;
37
- export declare function runStorageMigrations(remote: PgAdapterAsync): Promise<void>;
38
- export declare function storagePush(options?: {
39
- tables?: string[];
40
- }): Promise<StorageSyncResult[]>;
41
- export declare function storagePull(options?: {
42
- tables?: string[];
43
- }): Promise<StorageSyncResult[]>;
44
- export declare function storageSync(options?: {
45
- tables?: string[];
46
- }): Promise<{
47
- pull: StorageSyncResult[];
48
- push: StorageSyncResult[];
49
- }>;
50
- export declare function getStorageSyncMetaAll(): StorageSyncMeta[];
51
- export declare function getStorageStatus(): StorageStatus;
52
- export declare function getSyncMetaAll(): StorageSyncMeta[];
53
- export declare function resolveTables(tables?: string[]): StorageTable[];
54
- export {};
55
- //# sourceMappingURL=storage-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage-sync.d.ts","sourceRoot":"","sources":["../../src/db/storage-sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,cAAc,yIASjB,CAAC;AACX,eAAO,MAAM,sBAAsB,yIAAiB,CAAC;AAErD,KAAK,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAcpD,MAAM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,CAAC,IAAI,CAAC,CAEhF;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAY/F;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAY/F;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAAC,IAAI,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAIpI;AAED,wBAAgB,qBAAqB,IAAI,eAAe,EAAE,CAIzD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAShD;AAED,wBAAgB,cAAc,IAAI,eAAe,EAAE,CAElD;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAO/D"}
@@ -1,3 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerDomainsStorageTools(server: McpServer): void;
3
- //# sourceMappingURL=storage-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/storage-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAuBzE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0DnE"}
package/dist/storage.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { PG_MIGRATIONS } from "./db/pg-migrations.js";
2
- export { PgAdapterAsync } from "./db/remote-storage.js";
3
- export { DOMAINS_STORAGE_ENV, DOMAINS_STORAGE_FALLBACK_ENV, DOMAINS_STORAGE_MODE_ENV, DOMAINS_STORAGE_MODE_FALLBACK_ENV, DOMAINS_STORAGE_TABLES, STORAGE_DATABASE_ENV, STORAGE_MODE_ENV, STORAGE_TABLES, getStorageDatabaseEnvName, getStorageDatabaseUrl, getStorageMode, getStoragePg, getStorageStatus, getStorageSyncMetaAll, getSyncMetaAll, resolveTables, runStorageMigrations, storagePull, storagePush, storageSync, } from "./db/storage-sync.js";
4
- export type { StorageMode, StorageStatus, StorageSyncMeta, StorageSyncResult, SyncMeta, SyncResult, } from "./db/storage-sync.js";
5
- //# sourceMappingURL=storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,iCAAiC,EACjC,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,UAAU,GACX,MAAM,sBAAsB,CAAC"}