@hasna/domains 0.0.47 → 0.1.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.
Files changed (55) hide show
  1. package/README.md +58 -34
  2. package/dist/cli/commands/dns.d.ts.map +1 -1
  3. package/dist/cli/commands/doctor.d.ts.map +1 -1
  4. package/dist/cli/commands/serve.d.ts +1 -0
  5. package/dist/cli/commands/serve.d.ts.map +1 -1
  6. package/dist/cli/index.js +4754 -2105
  7. package/dist/db/database.d.ts +6 -23
  8. package/dist/db/database.d.ts.map +1 -1
  9. package/dist/db/domains.d.ts +3 -14
  10. package/dist/db/domains.d.ts.map +1 -1
  11. package/dist/db/store.d.ts +36 -32
  12. package/dist/db/store.d.ts.map +1 -1
  13. package/dist/generated/storage-kit/backend.d.ts +4 -4
  14. package/dist/generated/storage-kit/backend.d.ts.map +1 -1
  15. package/dist/generated/storage-kit/index.d.ts +1 -1
  16. package/dist/generated/storage-kit/index.d.ts.map +1 -1
  17. package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
  18. package/dist/generated/storage-kit/pool.d.ts +2 -5
  19. package/dist/generated/storage-kit/pool.d.ts.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1127 -1734
  23. package/dist/lib/app-home.d.ts +32 -44
  24. package/dist/lib/app-home.d.ts.map +1 -1
  25. package/dist/lib/client-storage-policy.d.ts +10 -0
  26. package/dist/lib/client-storage-policy.d.ts.map +1 -0
  27. package/dist/lib/client-types.d.ts +184 -0
  28. package/dist/lib/client-types.d.ts.map +1 -0
  29. package/dist/lib/cloudflare.d.ts.map +1 -1
  30. package/dist/lib/cloudflare.js +23 -0
  31. package/dist/lib/config.d.ts +6 -16
  32. package/dist/lib/config.d.ts.map +1 -1
  33. package/dist/lib/dns-plan.d.ts +1 -1
  34. package/dist/lib/dns-plan.d.ts.map +1 -1
  35. package/dist/lib/domains-resolver.d.ts +96 -0
  36. package/dist/lib/domains-resolver.d.ts.map +1 -0
  37. package/dist/lib/registrar.d.ts +8 -0
  38. package/dist/lib/registrar.d.ts.map +1 -1
  39. package/dist/lib/registrar.js +23 -0
  40. package/dist/mcp/harness.d.ts +46 -0
  41. package/dist/mcp/harness.d.ts.map +1 -0
  42. package/dist/mcp/http.d.ts +3 -2
  43. package/dist/mcp/http.d.ts.map +1 -1
  44. package/dist/mcp/index.d.ts.map +1 -1
  45. package/dist/mcp/index.js +24162 -25378
  46. package/dist/mcp/tool-filter.d.ts +6 -0
  47. package/dist/mcp/tool-filter.d.ts.map +1 -1
  48. package/dist/sdk/index.d.ts +21 -10
  49. package/dist/sdk/index.d.ts.map +1 -1
  50. package/dist/sdk/index.js +813 -275
  51. package/dist/server/index.d.ts +6 -0
  52. package/dist/server/index.d.ts.map +1 -1
  53. package/dist/server/index.js +84 -29
  54. package/package.json +5 -7
  55. package/postinstall.js +13 -14
@@ -1,60 +1,48 @@
1
1
  /**
2
- * @hasna/domains home resolution — the legacy `~/.hasna/domains` root,
3
- * resolved through the @hasna/paths resolver (XDG / macOS home layout).
2
+ * @hasna/domains LOCAL data home resolution — the on-box SQLite store's root.
4
3
  *
5
- * The legacy `~/.hasna/domains` default stays the effective home until the
6
- * XDG data home is adopted the operator sets `HASNA_DATA_HOME` (the
7
- * data-kind override a deliberate opt-in to the XDG layout), or the store
8
- * has already been physically migrated there (`domains.db` exists at the
9
- * resolver home) — so an existing local store and config never become
10
- * invisible on upgrade. An exact-app override (`HASNA_DOMAINS_HOME` /
11
- * `DOMAINS_HOME`, and the pre-existing `HASNA_DOMAINS_DIR` / `DOMAINS_DIR`
12
- * names) wins unconditionally and keeps the legacy layout under the override
13
- * root.
4
+ * This is NOT a credential chain. Credentials and the service authority come
5
+ * from the ONE shared resolver in @hasna/contracts (see
6
+ * `../lib/domains-resolver.ts`); this module only answers where the local
7
+ * store lives when the operator explicitly opted into it.
8
+ *
9
+ * The default is the legacy `~/.hasna/domains` root, which IS the shared
10
+ * `~/.hasna` root the resolver's disk tier already reads
11
+ * (`~/.hasna/domains/config/credentials`), so the local data and the
12
+ * credential file stay under one operator-known namespace. When `HASNA_HOME`
13
+ * (the shared root override @hasna/contracts honours) is set, the local data
14
+ * root follows it: `$HASNA_HOME/domains`.
15
+ *
16
+ * STRIPPED (2026-09-06, hasna/apps#1720 class B): the in-package reimplementation
17
+ * of the deleted @hasna/paths resolver, the XDG data/config home layout,
18
+ * `~/.config/hasna` / `$XDG_CONFIG_HOME` / `$XDG_DATA_HOME` consultation, and
19
+ * the one-time migrations from the pre-XDG layout. Nothing in this package
20
+ * consults those locations any more. An exact-app override
21
+ * (`HASNA_DOMAINS_HOME` / `HASNA_DOMAINS_DIR` win over their legacy unprefixed
22
+ * aliases) still names a concrete local store root and keeps the legacy layout
23
+ * under it.
14
24
  *
15
25
  * Everything accepts an explicit env object (default `process.env`) so the
16
- * resolver is deterministic in tests and honors the same `$HOME`-first home
17
- * resolution the package has always used.
26
+ * resolver is deterministic in tests.
18
27
  */
19
28
  export declare const APP: "domains";
20
29
  /** The effective user home, mirroring the pre-existing domains resolution (`HOME` || `USERPROFILE` || os.homedir()). */
21
30
  export declare function effectiveHome(env?: NodeJS.ProcessEnv): string;
22
- /** Pre-XDG default home: ~/.hasna/domains. */
23
- export declare function legacyHomeDir(env?: NodeJS.ProcessEnv): string;
24
- /**
25
- * The @hasna/paths-resolved data home for domains (XDG / macOS home layout).
26
- * The home override mirrors the pre-existing `$HOME`-first resolution, and the
27
- * env object is passed through so `HASNA_DATA_HOME` in the caller's env (not
28
- * only process.env) is honored.
29
- */
30
- export declare function resolverHome(env?: NodeJS.ProcessEnv): string;
31
- /**
32
- * Whether the resolver (XDG) home should be adopted as the store home. The
33
- * resolver home is adopted only when the operator has set `HASNA_DATA_HOME`
34
- * (a deliberate opt-in to the XDG layout) or the store has already been
35
- * physically migrated there (`domains.db` exists). A machine that only
36
- * redirects another kind (e.g. cache to tmpfs) must NOT have its data home
37
- * moved, and a live store at the legacy home must never become invisible on
38
- * upgrade.
39
- */
40
- export declare function adoptResolverHome(resolved: string, env?: NodeJS.ProcessEnv): boolean;
41
31
  /**
42
- * The exact-app override root, when set: `HASNA_DOMAINS_HOME` / `DOMAINS_HOME`
43
- * (the wave-wide names), then the pre-existing `HASNA_DOMAINS_DIR` /
44
- * `DOMAINS_DIR` aliases. Wins unconditionally and keeps the legacy layout
45
- * under the override root.
32
+ * The exact-app override root, when set: `HASNA_DOMAINS_HOME` /
33
+ * `HASNA_DOMAINS_DIR` (the canonical names) win over the legacy unprefixed
34
+ * `DOMAINS_HOME` / `DOMAINS_DIR` aliases. Wins unconditionally and keeps the
35
+ * legacy layout under the override root.
46
36
  */
47
37
  export declare function exactAppOverride(env?: NodeJS.ProcessEnv): string | undefined;
48
38
  /**
49
- * The effective app home: the exact-app override wins unconditionally;
50
- * otherwise the resolver (XDG) data home once adopted (`HASNA_DATA_HOME` set,
51
- * or the store already migrated there); otherwise the legacy
52
- * `~/.hasna/domains` default — an existing store and config never become
53
- * invisible on upgrade.
39
+ * The effective local data home: the exact-app override wins unconditionally;
40
+ * otherwise `$HASNA_HOME/domains` (the shared-root override) or the legacy
41
+ * `~/.hasna/domains` default.
54
42
  */
55
- export declare function appHome(env?: NodeJS.ProcessEnv): string;
56
- /** The default SQLite db path, at the root of the effective home. */
43
+ export declare function appDataHome(env?: NodeJS.ProcessEnv): string;
44
+ /** The default SQLite db path, at the root of the effective data home. */
57
45
  export declare function getDefaultDbPath(env?: NodeJS.ProcessEnv): string;
58
- /** The default config path, at the root of the effective home. */
46
+ /** The default config path, at the root of the effective data home. */
59
47
  export declare function getDefaultConfigPath(env?: NodeJS.ProcessEnv): string;
60
48
  //# sourceMappingURL=app-home.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-home.d.ts","sourceRoot":"","sources":["../../src/lib/app-home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,eAAO,MAAM,GAAG,EAAG,SAAkB,C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CAMxE;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAE7E;AAED,uEAAuE;AACvE,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,10 @@
1
+ /** Legacy variables that must no longer select a client database. */
2
+ export declare const LOCAL_PATH_VARS: readonly ["HASNA_DOMAINS_DB_PATH", "DOMAINS_DB_PATH", "HASNA_DOMAINS_DIR", "DOMAINS_DIR"];
3
+ export type LocalOptInEnv = Record<string, string | undefined>;
4
+ /** The first local-path var this env sets, or undefined when none is set. */
5
+ export declare function explicitLocalPathVar(env?: LocalOptInEnv): string | undefined;
6
+ /** Every env name that can configure a domains authority or credential, resolver-derived. */
7
+ export declare function domainsAuthorityEnvKeys(): string[];
8
+ /** Refuse obsolete local database configuration without exposing its value. */
9
+ export declare function assertDomainsClientStorage(env?: LocalOptInEnv): void;
10
+ //# sourceMappingURL=client-storage-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-storage-policy.d.ts","sourceRoot":"","sources":["../../src/lib/client-storage-policy.ts"],"names":[],"mappings":"AASA,qEAAqE;AACrE,eAAO,MAAM,eAAe,2FAKlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAE/D,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,aAA2B,GAAG,MAAM,GAAG,SAAS,CAEzF;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CASlD;AAED,+EAA+E;AAC/E,wBAAgB,0BAA0B,CAAC,GAAG,GAAE,aAA2B,GAAG,IAAI,CAKjF"}
@@ -0,0 +1,184 @@
1
+ /** An environment as the client resolver reads it. */
2
+ export type ClientEnv = Record<string, string | undefined>;
3
+ /** The env-key spec for one app, in precedence order. */
4
+ export interface ClientTransportEnvKeys {
5
+ /** API base-URL keys, in precedence order. */
6
+ apiUrlKeys: string[];
7
+ /** API-key keys, in precedence order. */
8
+ apiKeyKeys: string[];
9
+ }
10
+ /** Which tier of the credential chain supplied a key. */
11
+ export type CredentialTier = "argument" | "override" | "pointer" | "profile" | "keychain" | "disk" | "env";
12
+ /**
13
+ * A credential resolved from one tier of the chain.
14
+ *
15
+ * `apiKey` is non-enumerable and redacted by a custom-inspect hook in the
16
+ * resolver, so spreading or serializing a resolution drops it. That is a
17
+ * runtime property of the value, not something a type can carry.
18
+ */
19
+ export interface ResolvedCredential {
20
+ readonly apiKey: string;
21
+ readonly tier: CredentialTier;
22
+ /** An env key NAME, an absolute file path, or `keychain:<service>@<account>`. Never a value. */
23
+ readonly source: string;
24
+ /** True for tiers an operator sets on purpose. These never fall through. */
25
+ readonly deliberate: boolean;
26
+ /** For `tier === "pointer"`, the vault ITEM KEY to resolve at request time. Never a value. */
27
+ readonly pointerVaultKey?: string;
28
+ /** The disk paths consulted before this credential was chosen. */
29
+ readonly diskCandidates: readonly string[];
30
+ /** Human-readable advisory. Never contains key material. */
31
+ readonly warning: string | null;
32
+ }
33
+ /**
34
+ * A per-request credential source.
35
+ *
36
+ * Prefer this over a bare string for a long-lived client: the transport calls
37
+ * it fresh for every request, so a key rotation heals without a rebuild.
38
+ */
39
+ export type CredentialProvider = () => ResolvedCredential;
40
+ /** The captured outcome of one `security` invocation. `stdout` IS the secret. */
41
+ export interface KeychainCommandResult {
42
+ /** Exit status; null when the tool could not be started or was killed. */
43
+ status: number | null;
44
+ stdout: string;
45
+ stderr: string;
46
+ }
47
+ /** Runs `/usr/bin/security` with the given argv — no shell. Injected by tests. */
48
+ export type KeychainCommandRunner = (argv: readonly string[]) => KeychainCommandResult;
49
+ /** Keychain-tier controls. Every field is optional; production callers pass nothing. */
50
+ export interface KeychainTierOptions {
51
+ /**
52
+ * Whether the Keychain is consulted for a caller-built env object. The tier is
53
+ * AMBIENT: by default it runs only for the live `process.env`. Injecting `run`
54
+ * implies `true`.
55
+ */
56
+ enabled?: boolean;
57
+ /** Defaults to `process.platform`; the tier exists only on `"darwin"`. */
58
+ platform?: string;
59
+ /** The machine's host name (label before the first dot), used when `HASNA_STATION` is unset. */
60
+ hostname?: () => string;
61
+ /** The `security` runner. Defaults to spawning `/usr/bin/security` by argv. */
62
+ run?: KeychainCommandRunner;
63
+ }
64
+ /** Tier-1 credential inputs (`--api-key` / `--profile`) plus the Keychain-tier seam. */
65
+ export interface CredentialChainOptions {
66
+ /** Tier 1: an explicit key, e.g. from `--api-key`. */
67
+ apiKey?: string;
68
+ /** Tier 1: an explicit profile name, e.g. from `--profile`. Beats `HASNA_PROFILE`. */
69
+ profile?: string;
70
+ /** Tier 3: Keychain controls — a fake `security` runner in tests, an opt-out on CI. */
71
+ keychain?: KeychainTierOptions;
72
+ }
73
+ /** Where a client reads and writes. There is one: the authenticated service API. */
74
+ export type ClientTransportKind = "http";
75
+ /** The transport decision, with every source named and no key value in it. */
76
+ export interface ClientTransportResolution {
77
+ /** Where the client should read/write from. */
78
+ transport: ClientTransportKind;
79
+ /** What selected the transport: an env key NAME, a Keychain item reference, a file PATH, or `"default"`. */
80
+ transportSource: string;
81
+ /** `<origin>/v1` base for the server API. */
82
+ baseUrl: string;
83
+ /** WHERE the API URL came from: an env key NAME, a Keychain item reference, a file PATH, `"default"`, or null. */
84
+ apiUrlSource: string | null;
85
+ /** Whether an API key is present (value never exposed). */
86
+ apiKeyPresent: boolean;
87
+ /** WHERE the API key came from: an env key NAME or an absolute file path. Never the value. */
88
+ apiKeySource: string | null;
89
+ /** Which tier of the credential chain supplied the key. */
90
+ apiKeyTier: CredentialTier;
91
+ /** Kept for diagnostic shape compatibility; a successful resolution is never misconfigured. */
92
+ misconfigured: boolean;
93
+ /** Human-readable warning, or null. Never contains secret values. */
94
+ warning: string | null;
95
+ }
96
+ /** Query string params appended to a request URL. */
97
+ export type QueryParams = URLSearchParams | Record<string, string | number | boolean | null | undefined | ReadonlyArray<string | number | boolean>>;
98
+ /** Retry policy for transient failures (network errors, timeouts, 5xx, 429). */
99
+ export interface HasnaRetryOptions {
100
+ /** Max RETRY attempts after the first try. Default 2 (=> up to 3 total tries). */
101
+ retries?: number;
102
+ /** Base backoff in ms for exponential backoff. Default 200. */
103
+ baseDelayMs?: number;
104
+ /** Backoff ceiling in ms. Default 2000. */
105
+ maxDelayMs?: number;
106
+ /** HTTP statuses that trigger a retry. Default 408, 425, 429, 500, 502, 503, 504. */
107
+ retryStatuses?: number[];
108
+ }
109
+ /** Per-call request options: query, idempotency, timeout, retry, extra headers. */
110
+ export interface HasnaRequestOptions {
111
+ /** Query string params appended to the URL. */
112
+ query?: QueryParams;
113
+ /** Idempotency key sent as `Idempotency-Key`, making an unsafe method safe to retry. */
114
+ idempotencyKey?: string;
115
+ /** Override the transport timeout for this call (ms). */
116
+ timeoutMs?: number;
117
+ /** Extra headers merged into this call (override transport headers). */
118
+ headers?: Record<string, string>;
119
+ /** Override or disable retry for this call. `false` disables retries. */
120
+ retry?: HasnaRetryOptions | false;
121
+ /** Caller abort signal, combined with the internal timeout. */
122
+ signal?: AbortSignal;
123
+ }
124
+ /** The authenticated HTTP transport. The API key lives inside it and is never returned. */
125
+ export interface HasnaHttpTransport {
126
+ readonly baseUrl: string;
127
+ request<T = unknown>(method: string, path: string, body?: unknown, opts?: HasnaRequestOptions): Promise<T>;
128
+ get<T = unknown>(path: string, opts?: HasnaRequestOptions): Promise<T>;
129
+ post<T = unknown>(path: string, body?: unknown, opts?: HasnaRequestOptions): Promise<T>;
130
+ put<T = unknown>(path: string, body?: unknown, opts?: HasnaRequestOptions): Promise<T>;
131
+ patch<T = unknown>(path: string, body?: unknown, opts?: HasnaRequestOptions): Promise<T>;
132
+ del<T = unknown>(path: string, body?: unknown, opts?: HasnaRequestOptions): Promise<T>;
133
+ }
134
+ /** Options for a `list()` call: filters/pagination as query params. */
135
+ export interface StorageListOptions extends Pick<HasnaRequestOptions, "timeoutMs" | "headers" | "retry" | "signal"> {
136
+ /** Query params (limit, offset, cursor, filters, ...). */
137
+ query?: QueryParams;
138
+ }
139
+ /** Options for a `get()` call. */
140
+ export type StorageGetOptions = Pick<HasnaRequestOptions, "timeoutMs" | "headers" | "retry" | "signal" | "query">;
141
+ /** Options for a `create()` call. */
142
+ export interface StorageCreateOptions extends Pick<HasnaRequestOptions, "timeoutMs" | "headers" | "retry" | "signal" | "query"> {
143
+ /** Defaults to a fresh UUID so a retried POST is deduped rather than duplicated. */
144
+ idempotencyKey?: string;
145
+ }
146
+ /** Options for an `update()` call. */
147
+ export interface StorageUpdateOptions extends Pick<HasnaRequestOptions, "timeoutMs" | "headers" | "retry" | "signal" | "query"> {
148
+ /** HTTP verb for the update. Default `PATCH` (partial); use `PUT` for replace. */
149
+ method?: "PATCH" | "PUT";
150
+ /** Idempotency key. Set this to make a PATCH retry-safe too. */
151
+ idempotencyKey?: string;
152
+ }
153
+ /** Options for a `delete()` call. */
154
+ export type StorageDeleteOptions = Pick<HasnaRequestOptions, "timeoutMs" | "headers" | "retry" | "signal" | "query">;
155
+ /** Result of a `list()` call. `items` is the extracted array; `raw` is the full envelope. */
156
+ export interface StorageListResult<T> {
157
+ items: T[];
158
+ /** Total count when the server reports one (`total`/`count`), else null. */
159
+ total: number | null;
160
+ /** Opaque pagination cursor when the server reports one, else null. */
161
+ cursor: string | null;
162
+ /** The full parsed response body (envelope preserved). */
163
+ raw: unknown;
164
+ }
165
+ /** The app storage interface exposed by the authenticated service API. */
166
+ export interface HasnaStorageClient {
167
+ /** App slug this client targets. */
168
+ readonly name: string;
169
+ /** `<origin>/v1` base URL. */
170
+ readonly baseUrl: string;
171
+ /** The underlying HTTP transport (escape hatch for non-CRUD routes). */
172
+ readonly transport: HasnaHttpTransport;
173
+ /** List a collection. Returns extracted `items` plus the raw envelope. */
174
+ list<T = unknown>(resource: string, options?: StorageListOptions): Promise<StorageListResult<T>>;
175
+ /** Fetch one entity by id. Returns `null` on 404. */
176
+ get<T = unknown>(resource: string, id: string, options?: StorageGetOptions): Promise<T | null>;
177
+ /** Create one entity. Retry-safe via an auto `Idempotency-Key`. */
178
+ create<T = unknown>(resource: string, body: unknown, options?: StorageCreateOptions): Promise<T>;
179
+ /** Update one entity by id (PATCH by default). */
180
+ update<T = unknown>(resource: string, id: string, patch: unknown, options?: StorageUpdateOptions): Promise<T>;
181
+ /** Delete one entity by id. Resolves for 2xx and 404 (already gone). */
182
+ delete(resource: string, id: string, options?: StorageDeleteOptions): Promise<void>;
183
+ }
184
+ //# sourceMappingURL=client-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-types.d.ts","sourceRoot":"","sources":["../../src/lib/client-types.ts"],"names":[],"mappings":"AAsBA,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAE3D,yDAAyD;AACzD,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,yCAAyC;IACzC,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,yDAAyD;AACzD,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,GACT,UAAU,GACV,MAAM,GACN,KAAK,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,8FAA8F;IAC9F,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,kEAAkE;IAClE,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,4DAA4D;IA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AED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjI;AA4BD,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,GAAG,uBAAuB,CAuHzG"}
@@ -426,6 +426,29 @@ function createCloudflareProvider(config) {
426
426
  await replaceRecordsByNameType(zone.id, replacement, cfg);
427
427
  }
428
428
  return true;
429
+ },
430
+ async deleteDnsRecords(domain, records) {
431
+ const zone = await getZone(domain, cfg);
432
+ if (!zone)
433
+ throw new Error(`No Cloudflare zone found for ${domain}`);
434
+ const grouped = new Map;
435
+ for (const record of records) {
436
+ const key = `${record.type}|${record.name}`;
437
+ const group = grouped.get(key) ?? [];
438
+ group.push(record);
439
+ grouped.set(key, group);
440
+ }
441
+ for (const group of grouped.values()) {
442
+ const { type, name } = group[0];
443
+ const existing = await listRecordsByNameType(zone.id, type, name, cfg);
444
+ for (const record of group) {
445
+ const match = existing.find((candidate) => candidate.content === record.value && (candidate.priority ?? undefined) === (record.priority ?? undefined));
446
+ if (match?.id) {
447
+ await deleteRecord(zone.id, match.id, cfg);
448
+ }
449
+ }
450
+ }
451
+ return true;
429
452
  }
430
453
  };
431
454
  }
@@ -1,5 +1,10 @@
1
1
  /**
2
2
  * Persistent config stored in the domains config directory.
3
+ *
4
+ * This is a SETTINGS store — registrant contact defaults, registrar/DNS
5
+ * defaults, the purchase AWS profile. It never holds an API key: credentials
6
+ * come from the shared @hasna/contracts resolver only (see
7
+ * `../lib/domains-resolver.ts`).
3
8
  */
4
9
  export interface DomainContact {
5
10
  first_name?: string;
@@ -28,24 +33,9 @@ export interface DomainsConfig {
28
33
  export declare function getPurchaseProfile(): string | undefined;
29
34
  /** Set AWS_PROFILE from config for purchase ops if no explicit creds are set. */
30
35
  export declare function applyPurchaseProfile(): string | undefined;
31
- export interface LegacyConfigMigrationReport {
32
- dryRun: boolean;
33
- wouldCopy: boolean;
34
- copied: boolean;
35
- }
36
- /**
37
- * One-time migration from the previous XDG config default
38
- * ($XDG_CONFIG_HOME/open-domains/config.json) into the canonical
39
- * ~/.hasna/domains/config.json. Copies, verifies by size and sha256, records a
40
- * receipt, never deletes the source, never overwrites existing canonical data,
41
- * and is idempotent (receipt + canonical file both skip it). dryRun reports
42
- * whether the config would be copied and writes nothing.
43
- */
44
- export declare function migrateLegacyConfig(env?: NodeJS.ProcessEnv, dryRun?: boolean): LegacyConfigMigrationReport;
45
36
  /**
46
37
  * The default config location — `config.json` at the root of the effective
47
- * domains home, resolved through `@hasna/paths` (legacy `~/.hasna/domains`
48
- * until the XDG data home is adopted). Env overrides (DOMAINS_CONFIG_PATH /
38
+ * local data home (see `app-home.ts`). Env overrides (DOMAINS_CONFIG_PATH /
49
39
  * DOMAINS_CONFIG_DIR) are honored unchanged and win over the default.
50
40
  */
51
41
  export declare function getConfigPath(env?: NodeJS.ProcessEnv): string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAA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G,MAAM,GAAG,SAAS,CAUhE"}
@@ -26,5 +26,5 @@ export declare function selectChangedDnsRecords(plan: DnsPlan, desired: Provider
26
26
  export declare function getDnsApplyBlockReason(plan: DnsPlan, opts: {
27
27
  yes?: boolean;
28
28
  allowDelete?: boolean;
29
- }): DnsApplyBlockReason | undefined;
29
+ }, deleteSupported?: boolean): DnsApplyBlockReason | undefined;
30
30
  //# sourceMappingURL=dns-plan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dns-plan.d.ts","sourceRoot":"","sources":["../../src/lib/dns-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,oBAAoB,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,8BAA8B,GAAG,0BAA0B,CAAC;AAMxH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAmB/F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe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BAA0B,CAAC;AAMxH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAmB/F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CA8BxF;AAUD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAgCjH;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAErD;AAMD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE,CASxG;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,EACb,IAAI,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAC9C,eAAe,UAAQ,GACtB,mBAAmB,GAAG,SAAS,CAMjC"}
@@ -0,0 +1,96 @@
1
+ import type { ClientEnv, ClientTransportResolution, CredentialChainOptions, CredentialTier, HasnaStorageClient, ResolvedCredential } from "./client-types.js";
2
+ /** The app slug the shared client seam resolves credentials and authority for. */
3
+ export declare const DOMAINS_APP_NAME: "domains";
4
+ export { domainsAuthorityEnvKeys } from "./client-storage-policy.js";
5
+ /**
6
+ * The environment as the resolver should see it: every authority/credential
7
+ * variable that is DECLARED BUT BLANK removed.
8
+ *
9
+ * A blank has always been this package's spelling for "not configured" — it is
10
+ * how fixtures scrub an inherited environment and how wrappers spell
11
+ * `HASNA_DOMAINS_API_URL="${MAYBE_UNSET}"`. @hasna/contracts takes the
12
+ * opposite and, for its purposes, correct view: a declared-but-blank credential
13
+ * is a misconfiguration it refuses loudly rather than resolving around.
14
+ *
15
+ * Both are right at their own layer, and the mismatch is not hypothetical: an
16
+ * environment carrying a real `HASNA_DOMAINS_API_KEY` alongside a blank legacy
17
+ * alias — the exact shape a scrubbed-then-overridden fixture produces — is a
18
+ * complete, unambiguous configuration that would otherwise be refused for the
19
+ * alias nobody set. Normalising here keeps "blank means unset" true at the
20
+ * domains seam while leaving the resolver's stricter rule intact for
21
+ * everything it does receive: a value that is present is still policed, and
22
+ * two aliases that actually disagree still refuse.
23
+ */
24
+ export declare function domainsResolverEnv<T extends ClientEnv>(env: T): T;
25
+ /** The env object and credential options a domains surface hands @hasna/contracts. */
26
+ export interface DomainsResolverInputs<T extends ClientEnv> {
27
+ /** The environment with every declared-but-blank authority variable removed. */
28
+ env: T;
29
+ /** The chain options, with the Keychain tier's ambient gate already decided. */
30
+ credentials: CredentialChainOptions;
31
+ }
32
+ /**
33
+ * Build the resolver's inputs: the normalised environment AND the credential
34
+ * options that keep the machine's Keychain tier reachable across it. See the
35
+ * module header for why the gate has to travel with the copy.
36
+ *
37
+ * An explicit `enabled` from the caller still wins, and an injected `run`
38
+ * (which @hasna/contracts already treats as "enabled") is left alone, so the
39
+ * hermetic seam tests rely on is untouched. When there is no blank to remove
40
+ * the inputs pass through by identity, exactly as before — the CLI hands the
41
+ * resolver `process.env` itself, never a copy.
42
+ */
43
+ export declare function domainsResolverInputs<T extends ClientEnv>(env: T, credentials?: CredentialChainOptions): DomainsResolverInputs<T>;
44
+ /**
45
+ * Options a domains surface forwards to the shared resolver: tier-1 credential
46
+ * inputs and the Keychain-tier seam.
47
+ */
48
+ export interface DomainsResolverOptions {
49
+ /** Tier-1 credential inputs (`--api-key` / `--profile`) and Keychain controls. */
50
+ credentials?: CredentialChainOptions;
51
+ }
52
+ /**
53
+ * The transport report a caller can see — sources, tier, authority — with no
54
+ * key value in it. `baseUrl` is the `<origin>/v1` base the resolver produced.
55
+ */
56
+ export interface DomainsTransportReport {
57
+ transport: "http";
58
+ /** `<origin>/v1` base for the server API. */
59
+ baseUrl: string;
60
+ /** WHERE the API URL came from: env key NAME, Keychain reference, file PATH, or `"default"`. */
61
+ apiUrlSource: string;
62
+ /** WHERE the API key came from: env key NAME, Keychain reference, or file PATH. Never a value. */
63
+ apiKeySource: string;
64
+ /** Which tier of the credential chain supplied the key. */
65
+ apiKeyTier: CredentialTier;
66
+ }
67
+ /**
68
+ * Resolve the domains authority and credential through the shared chain,
69
+ * FRESH, and return both the report and the credential VALUE.
70
+ *
71
+ * Throws a fail-closed `Error` (prefixed `domains fails closed: …`) that names
72
+ * the canonical env pair when no credential resolves from any tier, when a
73
+ * deliberate tier cannot be honoured, or when the configured authorities
74
+ * disagree — never a quiet fall-through to local data.
75
+ */
76
+ export declare function resolveDomainsTransport(env?: ClientEnv, options?: DomainsResolverOptions): {
77
+ report: DomainsTransportReport;
78
+ credential: ResolvedCredential;
79
+ };
80
+ /** A resolved HTTP storage client plus the decision that produced it. */
81
+ export interface ResolvedDomainsHttpClient {
82
+ transport: "http";
83
+ client: HasnaStorageClient;
84
+ resolution: ClientTransportResolution;
85
+ }
86
+ /**
87
+ * Resolve the authenticated domains HTTP client for this environment.
88
+ *
89
+ * The returned client resolves its credential FRESH on every request (the
90
+ * transport's per-request binding provider), so a key rotation heals a
91
+ * long-lived MCP server or daemon without a rebuild. Throws a fail-closed
92
+ * `Error` when no credential resolves from any tier — never a quiet
93
+ * fall-through to local data.
94
+ */
95
+ export declare function resolveDomainsHttpClient(env?: ClientEnv, options?: DomainsResolverOptions): ResolvedDomainsHttpClient;
96
+ //# sourceMappingURL=domains-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domains-resolver.d.ts","sourceRoot":"","sources":["../../src/lib/domains-resolver.ts"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EACV,SAAS,EACT,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAG3B,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,EAAG,SAAkB,CAAC;AAEnD,OAAO,E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AAO,GAAE,sBAA2B,GACnC,yBAAyB,CAiB3B"}
@@ -100,6 +100,14 @@ export interface DnsProvider {
100
100
  dnsWriteScope?: DnsWriteScope;
101
101
  getDnsRecords(domain: string): Promise<ProviderDnsRecord[]>;
102
102
  setDnsRecords(domain: string, records: ProviderDnsRecord[]): Promise<boolean>;
103
+ /**
104
+ * Delete the EXACT live records matching the given records.
105
+ *
106
+ * Omission is conservative: `dns apply` refuses a delete plan
107
+ * (`delete-apply-unsupported`) unless the provider can converge on deletes through
108
+ * this route, so a non-deletable provider is never written into a partial state.
109
+ */
110
+ deleteDnsRecords?(domain: string, records: ProviderDnsRecord[]): Promise<boolean>;
103
111
  }
104
112
  /** A provider that does both — e.g. Route 53 */
105
113
  export type FullProvider = RegistrarProvider & DnsProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/lib/registrar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IAC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IAAI,CAAC,CAYxB"}
@@ -426,6 +426,29 @@ function createCloudflareProvider(config) {
426
426
  await replaceRecordsByNameType(zone.id, replacement, cfg);
427
427
  }
428
428
  return true;
429
+ },
430
+ async deleteDnsRecords(domain, records) {
431
+ const zone = await getZone(domain, cfg);
432
+ if (!zone)
433
+ throw new Error(`No Cloudflare zone found for ${domain}`);
434
+ const grouped = new Map;
435
+ for (const record of records) {
436
+ const key = `${record.type}|${record.name}`;
437
+ const group = grouped.get(key) ?? [];
438
+ group.push(record);
439
+ grouped.set(key, group);
440
+ }
441
+ for (const group of grouped.values()) {
442
+ const { type, name } = group[0];
443
+ const existing = await listRecordsByNameType(zone.id, type, name, cfg);
444
+ for (const record of group) {
445
+ const match = existing.find((candidate) => candidate.content === record.value && (candidate.priority ?? undefined) === (record.priority ?? undefined));
446
+ if (match?.id) {
447
+ await deleteRecord(zone.id, match.id, cfg);
448
+ }
449
+ }
450
+ }
451
+ return true;
429
452
  }
430
453
  };
431
454
  }