@codelitdev/platform 0.10.0 → 0.12.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.
package/README.md CHANGED
@@ -5,11 +5,48 @@ safe errors, UUIDv7 / prefixed public IDs, health/readiness/shutdown, and
5
5
  HTTP/MCP mapping conventions.
6
6
 
7
7
  The package imports no product schema, reads no environment at import, and
8
- performs no network I/O. Products implement authentication, tenant, and
8
+ performs no network I/O unless a product calls the DNS helpers below. Products implement authentication, tenant, and
9
9
  authorization adapters.
10
10
 
11
11
  See `docs/architecture.md` §6.4 and ADR 0001.
12
12
 
13
+ ## Domain verification
14
+
15
+ Custom-domain checks shared by every product (root export). No storage, no
16
+ environment reads, no product rules: apps keep their own apex/`www` pairing or
17
+ one-domain-per-tenant policy.
18
+
19
+ ```ts
20
+ import {
21
+ createDnsResolver,
22
+ createDomainVerification,
23
+ issueOwnershipToken,
24
+ normalizeHostname,
25
+ } from "@codelitdev/platform";
26
+
27
+ const hostname = normalizeHostname(userInput); // null when invalid
28
+ const token = issueOwnershipToken(); // 16 random bytes, hex
29
+ const domains = createDomainVerification({
30
+ label: "_myproduct-verification",
31
+ resolver: createDnsResolver({ servers: ["1.1.1.1", "8.8.8.8"] }),
32
+ });
33
+
34
+ domains.ownershipRecord(hostname, token); // { type: "TXT", name, value: token }
35
+ await domains.verifyOwnership(hostname, token);
36
+ await domains.verifyRouting(hostname, {
37
+ cnameTarget: "edge.example.net",
38
+ aRecords: ["203.0.113.10"], // optional, apex only
39
+ });
40
+ ```
41
+
42
+ | Export | Use |
43
+ | --- | --- |
44
+ | `normalizeHostname(input, { allowIpLiteral?, allowPublicSuffix? })` | Lowercase, punycode, no trailing dot; null for ports, paths, credentials, bad labels, single-label names, IP literals and public suffixes (`com`, `co.uk`, `github.io`) unless allowed. |
45
+ | `isApexHostname(hostname)` | True when the host is its registrable domain (`example.co.uk` yes, `www.example.co.uk` no). Uses the public suffix list including its private section. |
46
+ | `issueOwnershipToken()` | 16 random bytes, hex. |
47
+ | `createDnsResolver({ servers?, timeoutMs? })` | `node:dns` resolver; `servers` pins trusted recursive resolvers, every lookup times out (default 5000 ms). Inject any `DnsResolver` in tests. |
48
+ | `createDomainVerification({ label, resolver? })` | `ownershipRecord`, `verifyOwnership` (TXT at `<label>.<host>`, chunks joined, exact match), `verifyRouting` (CNAME chain with loop protection; an apex may use CNAME flattening, or A records that must equal `aRecords` when given). DNS errors and timeouts are `false`. |
49
+
13
50
  ## Billing adapters
14
51
 
15
52
  `@codelitdev/platform/billing` holds the adapters a product needs around
@@ -0,0 +1,54 @@
1
+ export type DnsResolver = {
2
+ resolveTxt(name: string): Promise<string[][]>;
3
+ resolveCname(name: string): Promise<string[]>;
4
+ resolve4(name: string): Promise<string[]>;
5
+ };
6
+ /**
7
+ * A `node:dns` resolver. `servers` pins the recursive resolvers to ask (use
8
+ * trusted ones, not whatever the container is configured with). Every lookup
9
+ * is bounded by `timeoutMs` (default 5000).
10
+ */
11
+ export declare function createDnsResolver(options?: {
12
+ servers?: string[];
13
+ timeoutMs?: number;
14
+ }): DnsResolver;
15
+ /**
16
+ * Lowercases, converts IDN to punycode and strips a trailing dot. Returns null
17
+ * for ports, paths, credentials, invalid labels and single-label names; IP
18
+ * literals and public suffixes (`com`, `co.uk`, `github.io`) are rejected
19
+ * unless the matching option is set.
20
+ */
21
+ export declare function normalizeHostname(input: string, options?: {
22
+ allowIpLiteral?: boolean;
23
+ allowPublicSuffix?: boolean;
24
+ }): string | null;
25
+ /**
26
+ * True when the hostname equals its registrable domain (public-suffix aware):
27
+ * `example.co.uk` is an apex, `www.example.co.uk` is not.
28
+ */
29
+ export declare function isApexHostname(hostname: string): boolean;
30
+ /** 16 random bytes, hex encoded. */
31
+ export declare function issueOwnershipToken(): string;
32
+ export declare function createDomainVerification(options: {
33
+ label: string;
34
+ resolver?: DnsResolver;
35
+ }): {
36
+ /** The TXT record the customer publishes. The value is the bare token. */
37
+ ownershipRecord(hostname: string, token: string): {
38
+ type: "TXT";
39
+ name: string;
40
+ value: string;
41
+ };
42
+ /** TXT at `<label>.<hostname>` whose joined chunks equal the token. */
43
+ verifyOwnership(hostname: string, token: string): Promise<boolean>;
44
+ /**
45
+ * The CNAME chain from `hostname` reaches `cnameTarget`. An apex may
46
+ * instead use CNAME flattening: it must resolve to A records, which must
47
+ * equal `aRecords` when that set is given.
48
+ */
49
+ verifyRouting(hostname: string, target: {
50
+ cnameTarget: string;
51
+ aRecords?: string[];
52
+ }): Promise<boolean>;
53
+ };
54
+ //# sourceMappingURL=domain-verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-verification.d.ts","sourceRoot":"","sources":["../src/domain-verification.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC3C,CAAC;AAaF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,WAAW,CAWb;AAKD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAO,GACtE,MAAM,GAAG,IAAI,CA8Bf;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED,oCAAoC;AACpC,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAMD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;IA2BG,0EAA0E;8BAChD,MAAM,SAAS,MAAM;;;;;IAQ/C,uEAAuE;8BACvC,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUxE;;;;OAIG;4BAES,MAAM,UACR;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GACnD,OAAO,CAAC,OAAO,CAAC;EAoBtB"}
@@ -0,0 +1,160 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { Resolver } from "node:dns/promises";
3
+ import { getDomain } from "tldts";
4
+ const DEFAULT_TIMEOUT_MS = 5000;
5
+ const MAX_CNAME_HOPS = 16;
6
+ function withTimeout(promise, timeoutMs) {
7
+ let timer;
8
+ const timeout = new Promise((_, reject) => {
9
+ timer = setTimeout(() => reject(new Error("dns_lookup_timeout")), timeoutMs);
10
+ });
11
+ return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
12
+ }
13
+ /**
14
+ * A `node:dns` resolver. `servers` pins the recursive resolvers to ask (use
15
+ * trusted ones, not whatever the container is configured with). Every lookup
16
+ * is bounded by `timeoutMs` (default 5000).
17
+ */
18
+ export function createDnsResolver(options = {}) {
19
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
20
+ const resolver = new Resolver({ timeout: timeoutMs, tries: 1 });
21
+ if (options.servers && options.servers.length > 0) {
22
+ resolver.setServers(options.servers);
23
+ }
24
+ return {
25
+ resolveTxt: (name) => withTimeout(resolver.resolveTxt(name), timeoutMs),
26
+ resolveCname: (name) => withTimeout(resolver.resolveCname(name), timeoutMs),
27
+ resolve4: (name) => withTimeout(resolver.resolve4(name), timeoutMs),
28
+ };
29
+ }
30
+ const LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
31
+ const PSL = { allowPrivateDomains: true };
32
+ /**
33
+ * Lowercases, converts IDN to punycode and strips a trailing dot. Returns null
34
+ * for ports, paths, credentials, invalid labels and single-label names; IP
35
+ * literals and public suffixes (`com`, `co.uk`, `github.io`) are rejected
36
+ * unless the matching option is set.
37
+ */
38
+ export function normalizeHostname(input, options = {}) {
39
+ if (typeof input !== "string")
40
+ return null;
41
+ let candidate = input.trim().replace(/^https?:\/\//i, "");
42
+ if (candidate.endsWith("/"))
43
+ candidate = candidate.slice(0, -1);
44
+ if (!candidate || /[\s/?#\\@%]/.test(candidate))
45
+ return null;
46
+ const bracketed = candidate.startsWith("[") && candidate.endsWith("]");
47
+ if (candidate.includes(":") && !bracketed)
48
+ return null;
49
+ let hostname;
50
+ try {
51
+ hostname = new URL(`http://${candidate}`).hostname;
52
+ }
53
+ catch {
54
+ return null;
55
+ }
56
+ hostname = hostname.replace(/\.$/, "").toLowerCase();
57
+ if (!hostname || hostname.length > 253)
58
+ return null;
59
+ // WHATWG URL canonicalises IPv4 shorthands (`1.2`, `0x7f.1`) to dotted quads.
60
+ const isIp = hostname.startsWith("[") || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(hostname);
61
+ if (isIp)
62
+ return options.allowIpLiteral ? hostname : null;
63
+ const labels = hostname.split(".");
64
+ if (labels.length < 2 || labels.some((label) => !LABEL.test(label))) {
65
+ return null;
66
+ }
67
+ if (!options.allowPublicSuffix && getDomain(hostname, PSL) === null) {
68
+ return null;
69
+ }
70
+ return hostname;
71
+ }
72
+ /**
73
+ * True when the hostname equals its registrable domain (public-suffix aware):
74
+ * `example.co.uk` is an apex, `www.example.co.uk` is not.
75
+ */
76
+ export function isApexHostname(hostname) {
77
+ const normalized = hostname.trim().toLowerCase().replace(/\.$/, "");
78
+ return normalized !== "" && getDomain(normalized, PSL) === normalized;
79
+ }
80
+ /** 16 random bytes, hex encoded. */
81
+ export function issueOwnershipToken() {
82
+ return randomBytes(16).toString("hex");
83
+ }
84
+ function normalizeDnsName(name) {
85
+ return name.trim().replace(/\.$/, "").toLowerCase();
86
+ }
87
+ export function createDomainVerification(options) {
88
+ const resolver = options.resolver ?? createDnsResolver();
89
+ const label = options.label;
90
+ async function cnameChainIncludes(hostname, target) {
91
+ const seen = new Set();
92
+ let current = normalizeDnsName(hostname);
93
+ while (!seen.has(current) && seen.size < MAX_CNAME_HOPS) {
94
+ seen.add(current);
95
+ let records;
96
+ try {
97
+ records = await resolver.resolveCname(current);
98
+ }
99
+ catch {
100
+ return false;
101
+ }
102
+ const next = records.map(normalizeDnsName);
103
+ if (next.includes(target))
104
+ return true;
105
+ if (next.length === 0)
106
+ return false;
107
+ current = next[0];
108
+ }
109
+ return false;
110
+ }
111
+ return {
112
+ /** The TXT record the customer publishes. The value is the bare token. */
113
+ ownershipRecord(hostname, token) {
114
+ return {
115
+ type: "TXT",
116
+ name: `${label}.${hostname}`,
117
+ value: token,
118
+ };
119
+ },
120
+ /** TXT at `<label>.<hostname>` whose joined chunks equal the token. */
121
+ async verifyOwnership(hostname, token) {
122
+ if (!token)
123
+ return false;
124
+ try {
125
+ const records = await resolver.resolveTxt(`${label}.${hostname}`);
126
+ return records.some((chunks) => chunks.join("").trim() === token);
127
+ }
128
+ catch {
129
+ return false;
130
+ }
131
+ },
132
+ /**
133
+ * The CNAME chain from `hostname` reaches `cnameTarget`. An apex may
134
+ * instead use CNAME flattening: it must resolve to A records, which must
135
+ * equal `aRecords` when that set is given.
136
+ */
137
+ async verifyRouting(hostname, target) {
138
+ if (await cnameChainIncludes(hostname, normalizeDnsName(target.cnameTarget))) {
139
+ return true;
140
+ }
141
+ if (!isApexHostname(hostname))
142
+ return false;
143
+ let addresses;
144
+ try {
145
+ addresses = (await resolver.resolve4(hostname)).slice().sort();
146
+ }
147
+ catch {
148
+ return false;
149
+ }
150
+ if (addresses.length === 0)
151
+ return false;
152
+ const required = (target.aRecords ?? []).slice().sort();
153
+ if (required.length === 0)
154
+ return true;
155
+ return (required.length === addresses.length &&
156
+ required.every((ip, index) => ip === addresses[index]));
157
+ },
158
+ };
159
+ }
160
+ //# sourceMappingURL=domain-verification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-verification.js","sourceRoot":"","sources":["../src/domain-verification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQlC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,SAAS,WAAW,CAAI,OAAmB,EAAE,SAAiB;IAC5D,IAAI,KAAgD,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAsD,EAAE;IAExD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kBAAkB,CAAC;IAC1D,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAChE,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACv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,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;YACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACvC,OAAO,CACL,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;gBACpC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,CACvD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { type Clock, frozenClock, systemClock } from "./clock.js";
2
2
  export { type CredentialSelection, createSystemCredential, DEFAULT_SESSION_COOKIE_NAME, extractHttpCredentials, extractMcpCredentials, type HeaderMap, isTransportCredentialKind, mapTransportAuthentication, type PresentedCredential, selectHttpCredential, selectMcpCredential, selectSingleCredential, type TransportCredentialKind, } from "./credentials.js";
3
3
  export { parseDate, serializeDate, serializeDatesDeep } from "./dates.js";
4
+ export { createDnsResolver, createDomainVerification, type DnsResolver, isApexHostname, issueOwnershipToken, normalizeHostname, } from "./domain-verification.js";
4
5
  export { captureAndMapException, createPlatformError, isPlatformError, mapThrownException, PLATFORM_ERROR_CODES, PLATFORM_ERROR_HTTP_STATUS, PLATFORM_ERROR_MESSAGES, type PlatformError, type PlatformErrorCode, type PlatformSafeDetails, type PublicErrorBody, type PublicHttpError, toPublicErrorBody, toPublicHttpError, } from "./errors.js";
5
6
  export { createPublicId, createRequestId, parsePublicId, type RandomBytes, readOrCreateRequestId, uuidv7, uuidv7Hex, } from "./ids.js";
6
7
  export { createGracefulShutdown, type GracefulShutdown, type HealthReport, healthReport, type ReadinessCheck, type ReadinessReport, readinessReport, type ShutdownHook, } from "./lifecycle.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EACL,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,SAAS,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,KAAK,WAAW,EAChB,qBAAqB,EACrB,MAAM,EACN,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EACL,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,SAAS,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,WAAW,EAChB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,KAAK,WAAW,EAChB,qBAAqB,EACrB,MAAM,EACN,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { frozenClock, systemClock } from "./clock.js";
2
2
  export { createSystemCredential, DEFAULT_SESSION_COOKIE_NAME, extractHttpCredentials, extractMcpCredentials, isTransportCredentialKind, mapTransportAuthentication, selectHttpCredential, selectMcpCredential, selectSingleCredential, } from "./credentials.js";
3
3
  export { parseDate, serializeDate, serializeDatesDeep } from "./dates.js";
4
+ export { createDnsResolver, createDomainVerification, isApexHostname, issueOwnershipToken, normalizeHostname, } from "./domain-verification.js";
4
5
  export { captureAndMapException, createPlatformError, isPlatformError, mapThrownException, PLATFORM_ERROR_CODES, PLATFORM_ERROR_HTTP_STATUS, PLATFORM_ERROR_MESSAGES, toPublicErrorBody, toPublicHttpError, } from "./errors.js";
5
6
  export { createPublicId, createRequestId, parsePublicId, readOrCreateRequestId, uuidv7, uuidv7Hex, } from "./ids.js";
6
7
  export { createGracefulShutdown, healthReport, readinessReport, } from "./lifecycle.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAEL,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EAErB,yBAAyB,EACzB,0BAA0B,EAE1B,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EAMvB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EAEb,qBAAqB,EACrB,MAAM,EACN,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,sBAAsB,EAGtB,YAAY,EAGZ,eAAe,GAEhB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAEL,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EAErB,yBAAyB,EACzB,0BAA0B,EAE1B,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EAExB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EAMvB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EAEb,qBAAqB,EACrB,MAAM,EACN,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,sBAAsB,EAGtB,YAAY,EAGZ,eAAe,GAEhB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelitdev/platform",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Composition kernel for CodeLit Platform products",
5
5
  "author": "CodeLit",
6
6
  "type": "module",
@@ -48,7 +48,7 @@
48
48
  "tag": "latest"
49
49
  },
50
50
  "devDependencies": {
51
- "@codelitdev/billing": "0.10.0",
51
+ "@codelitdev/billing": "0.12.0",
52
52
  "@electric-sql/pglite": "^0.2.17",
53
53
  "@types/bun": "^1.4.1",
54
54
  "@types/node": "^22.14.1",
@@ -56,7 +56,7 @@
56
56
  "typescript": "^5.9.3"
57
57
  },
58
58
  "peerDependencies": {
59
- "@codelitdev/billing": ">=0.10.0",
59
+ "@codelitdev/billing": ">=0.12.0",
60
60
  "drizzle-orm": "^0.45.2"
61
61
  },
62
62
  "peerDependenciesMeta": {
@@ -66,5 +66,8 @@
66
66
  "drizzle-orm": {
67
67
  "optional": true
68
68
  }
69
+ },
70
+ "dependencies": {
71
+ "tldts": "7.4.19"
69
72
  }
70
73
  }