@atproto-labs/handle-resolver-node 0.1.24 → 0.2.0-next.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/CHANGELOG.md +29 -0
- package/LICENSE.txt +1 -1
- package/dist/atproto-handle-resolver-node.js +7 -11
- package/dist/atproto-handle-resolver-node.js.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/node-resolve-txt-factory.js +9 -14
- package/dist/node-resolve-txt-factory.js.map +1 -1
- package/package.json +7 -9
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atproto-labs/handle-resolver-node
|
|
2
2
|
|
|
3
|
+
## 0.2.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
|
|
8
|
+
|
|
9
|
+
- [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
|
|
10
|
+
|
|
11
|
+
Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
|
|
12
|
+
|
|
13
|
+
- [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0. Emitted `.d.ts` files now use TypeScript 6's stricter `Uint8Array<ArrayBuffer>` typing in places where Web/Node APIs require buffer-backed (not shared-memory) byte arrays. Consumers compiling against these types on older TypeScript should see no runtime impact, but may need to widen or cast in spots that previously relied on `Uint8Array` defaulting to `<ArrayBufferLike>`.
|
|
14
|
+
|
|
15
|
+
Internal: tsconfig `moduleResolution: "node"` is silenced via `ignoreDeprecations: "6.0"` for now; the proper migration to `node16`/`bundler` resolution is deferred.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b), [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028), [`8e40db6`](https://github.com/bluesky-social/atproto/commit/8e40db65aab7ba5f9414c26dbe1ab658e3bffeca), [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9)]:
|
|
20
|
+
- @atproto/did@0.4.0-next.0
|
|
21
|
+
- @atproto-labs/fetch-node@0.3.0-next.0
|
|
22
|
+
- @atproto-labs/handle-resolver@0.4.0-next.0
|
|
23
|
+
|
|
24
|
+
## 0.1.25
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`d54d707`](https://github.com/bluesky-social/atproto/commit/d54d7077eb32041e1f61c312efa1dd0d768c774e), [`d54d707`](https://github.com/bluesky-social/atproto/commit/d54d7077eb32041e1f61c312efa1dd0d768c774e)]:
|
|
29
|
+
- @atproto/did@0.3.0
|
|
30
|
+
- @atproto-labs/handle-resolver@0.3.6
|
|
31
|
+
|
|
3
32
|
## 0.1.24
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Dual MIT/Apache-2.0 License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-
|
|
3
|
+
Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
|
|
4
4
|
|
|
5
5
|
Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
|
|
6
6
|
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const handle_resolver_1 = require("@atproto-labs/handle-resolver");
|
|
6
|
-
const node_resolve_txt_factory_js_1 = require("./node-resolve-txt-factory.js");
|
|
7
|
-
class AtprotoHandleResolverNode extends handle_resolver_1.AtprotoHandleResolver {
|
|
1
|
+
import { safeFetchWrap } from '@atproto-labs/fetch-node';
|
|
2
|
+
import { AtprotoHandleResolver, } from '@atproto-labs/handle-resolver';
|
|
3
|
+
import { nodeResolveTxtDefault, nodeResolveTxtFactory, } from './node-resolve-txt-factory.js';
|
|
4
|
+
export class AtprotoHandleResolverNode extends AtprotoHandleResolver {
|
|
8
5
|
constructor({ fetch = globalThis.fetch, fallbackNameservers, } = {}) {
|
|
9
6
|
super({
|
|
10
|
-
fetch:
|
|
7
|
+
fetch: safeFetchWrap({
|
|
11
8
|
fetch,
|
|
12
9
|
timeout: 3000, // 3 seconds
|
|
13
10
|
ssrfProtection: true,
|
|
14
11
|
responseMaxSize: 10 * 1048, // DID are max 2048 characters, 10kb for safety
|
|
15
12
|
}),
|
|
16
|
-
resolveTxt:
|
|
13
|
+
resolveTxt: nodeResolveTxtDefault,
|
|
17
14
|
resolveTxtFallback: fallbackNameservers?.length
|
|
18
|
-
?
|
|
15
|
+
? nodeResolveTxtFactory(fallbackNameservers)
|
|
19
16
|
: undefined,
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
exports.AtprotoHandleResolverNode = AtprotoHandleResolverNode;
|
|
24
20
|
//# sourceMappingURL=atproto-handle-resolver-node.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-handle-resolver-node.js","sourceRoot":"","sources":["../src/atproto-handle-resolver-node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"atproto-handle-resolver-node.js","sourceRoot":"","sources":["../src/atproto-handle-resolver-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,qBAAqB,GAEtB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,+BAA+B,CAAA;AAoBtC,MAAM,OAAO,yBACX,SAAQ,qBAAqB;IAG7B,YAAY,EACV,KAAK,GAAG,UAAU,CAAC,KAAK,EACxB,mBAAmB,MACiB,EAAE;QACtC,KAAK,CAAC;YACJ,KAAK,EAAE,aAAa,CAAC;gBACnB,KAAK;gBACL,OAAO,EAAE,IAAI,EAAE,YAAY;gBAC3B,cAAc,EAAE,IAAI;gBACpB,eAAe,EAAE,EAAE,GAAG,IAAI,EAAE,+CAA+C;aAC5E,CAAC;YACF,UAAU,EAAE,qBAAqB;YACjC,kBAAkB,EAAE,mBAAmB,EAAE,MAAM;gBAC7C,CAAC,CAAC,qBAAqB,CAAC,mBAAmB,CAAC;gBAC5C,CAAC,CAAC,SAAS;SACd,CAAC,CAAA;IACJ,CAAC;CACF","sourcesContent":["import { Fetch, safeFetchWrap } from '@atproto-labs/fetch-node'\nimport {\n AtprotoHandleResolver,\n HandleResolver,\n} from '@atproto-labs/handle-resolver'\nimport {\n nodeResolveTxtDefault,\n nodeResolveTxtFactory,\n} from './node-resolve-txt-factory.js'\n\nexport type AtprotoHandleResolverNodeOptions = {\n /**\n * List of backup nameservers to use in case the primary ones fail. Will\n * default to no fallback nameservers.\n */\n fallbackNameservers?: string[]\n\n /**\n * Fetch function to use for HTTP requests. Allows customizing the request\n * behavior, e.g. adding headers, setting a timeout, mocking, etc. The\n * provided fetch function will be wrapped with a safeFetchWrap function that\n * adds SSRF protection.\n *\n * @default `globalThis.fetch`\n */\n fetch?: Fetch\n}\n\nexport class AtprotoHandleResolverNode\n extends AtprotoHandleResolver\n implements HandleResolver\n{\n constructor({\n fetch = globalThis.fetch,\n fallbackNameservers,\n }: AtprotoHandleResolverNodeOptions = {}) {\n super({\n fetch: safeFetchWrap({\n fetch,\n timeout: 3000, // 3 seconds\n ssrfProtection: true,\n responseMaxSize: 10 * 1048, // DID are max 2048 characters, 10kb for safety\n }),\n resolveTxt: nodeResolveTxtDefault,\n resolveTxtFallback: fallbackNameservers?.length\n ? nodeResolveTxtFactory(fallbackNameservers)\n : undefined,\n })\n }\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./atproto-handle-resolver-node.js"), exports);
|
|
1
|
+
export * from './atproto-handle-resolver-node.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA","sourcesContent":["export * from './atproto-handle-resolver-node.js'\n"]}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const promises_1 = require("node:dns/promises");
|
|
6
|
-
const node_net_1 = require("node:net");
|
|
7
|
-
const nodeResolveTxtDefault = (hostname) => (0, promises_1.resolveTxt)(hostname).then(groupChunks, handleError);
|
|
8
|
-
exports.nodeResolveTxtDefault = nodeResolveTxtDefault;
|
|
9
|
-
function nodeResolveTxtFactory(nameservers) {
|
|
1
|
+
import { Resolver, lookup, resolveTxt } from 'node:dns/promises';
|
|
2
|
+
import { isIP } from 'node:net';
|
|
3
|
+
export const nodeResolveTxtDefault = (hostname) => resolveTxt(hostname).then(groupChunks, handleError);
|
|
4
|
+
export function nodeResolveTxtFactory(nameservers) {
|
|
10
5
|
// Optimization
|
|
11
6
|
if (!nameservers.length)
|
|
12
7
|
return async () => null;
|
|
@@ -16,9 +11,9 @@ function nodeResolveTxtFactory(nameservers) {
|
|
|
16
11
|
if (port !== null && !/^\d+$/.test(port)) {
|
|
17
12
|
throw new TypeError(`Invalid name server "${nameserver}"`);
|
|
18
13
|
}
|
|
19
|
-
return
|
|
14
|
+
return isIP(domain) === 4 || isBracedIPv6(domain)
|
|
20
15
|
? [nameserver] // No need to lookup
|
|
21
|
-
:
|
|
16
|
+
: lookup(domain, { all: true }).then((r) => r.map((a) => appendPort(a.address, port)),
|
|
22
17
|
// Let's just ignore failed nameservers resolution
|
|
23
18
|
(_err) => []);
|
|
24
19
|
})).then((results) => {
|
|
@@ -26,7 +21,7 @@ function nodeResolveTxtFactory(nameservers) {
|
|
|
26
21
|
// No resolver if no valid IP
|
|
27
22
|
if (!backupIps.length)
|
|
28
23
|
return null;
|
|
29
|
-
const resolver = new
|
|
24
|
+
const resolver = new Resolver();
|
|
30
25
|
resolver.setServers(backupIps);
|
|
31
26
|
return resolver;
|
|
32
27
|
});
|
|
@@ -44,7 +39,7 @@ function nodeResolveTxtFactory(nameservers) {
|
|
|
44
39
|
function isBracedIPv6(address) {
|
|
45
40
|
return (address.startsWith('[') &&
|
|
46
41
|
address.endsWith(']') &&
|
|
47
|
-
|
|
42
|
+
isIP(address.slice(1, -1)) === 6);
|
|
48
43
|
}
|
|
49
44
|
function groupChunks(results) {
|
|
50
45
|
return results.map((chunks) => chunks.join(''));
|
|
@@ -71,7 +66,7 @@ function handleError(err) {
|
|
|
71
66
|
return null;
|
|
72
67
|
}
|
|
73
68
|
function appendPort(address, port) {
|
|
74
|
-
switch (
|
|
69
|
+
switch (isIP(address)) {
|
|
75
70
|
case 4:
|
|
76
71
|
return port ? `${address}:${port}` : address;
|
|
77
72
|
case 6:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-resolve-txt-factory.js","sourceRoot":"","sources":["../src/node-resolve-txt-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-resolve-txt-factory.js","sourceRoot":"","sources":["../src/node-resolve-txt-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAG/B,MAAM,CAAC,MAAM,qBAAqB,GAAe,CAAC,QAAQ,EAAE,EAAE,CAC5D,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;AAErD,MAAM,UAAU,qBAAqB,CAAC,WAAqB;IACzD,eAAe;IACf,IAAI,CAAC,WAAW,CAAC,MAAM;QAAE,OAAO,KAAK,IAAI,EAAE,CAAC,IAAI,CAAA;IAEhD,mEAAmE;IACnE,MAAM,eAAe,GAA6B,OAAO,CAAC,GAAG,CAC3D,WAAW,CAAC,GAAG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AAC,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAA;QAC9C,KAAK,CAAC;YACJ,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAA;QACvD;YACE,MAAM,IAAI,SAAS,CAAC,uBAAuB,OAAO,GAAG,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC","sourcesContent":["import { Resolver, lookup, resolveTxt } from 'node:dns/promises'\nimport { isIP } from 'node:net'\nimport { ResolveTxt } from '@atproto-labs/handle-resolver'\n\nexport const nodeResolveTxtDefault: ResolveTxt = (hostname) =>\n resolveTxt(hostname).then(groupChunks, handleError)\n\nexport function nodeResolveTxtFactory(nameservers: string[]): ResolveTxt {\n // Optimization\n if (!nameservers.length) return async () => null\n\n // Build the resolver asynchronously (will be awaited on every use)\n const resolverPromise: Promise<Resolver | null> = Promise.all<string[]>(\n nameservers.map((nameserver) => {\n const [domain, port = null] = nameserver.split(':', 2)\n\n if (port !== null && !/^\\d+$/.test(port)) {\n throw new TypeError(`Invalid name server \"${nameserver}\"`)\n }\n\n return isIP(domain) === 4 || isBracedIPv6(domain)\n ? [nameserver] // No need to lookup\n : lookup(domain, { all: true }).then(\n (r) => r.map((a) => appendPort(a.address, port)),\n // Let's just ignore failed nameservers resolution\n (_err) => [],\n )\n }),\n ).then((results) => {\n const backupIps = results.flat(1)\n // No resolver if no valid IP\n if (!backupIps.length) return null\n\n const resolver = new Resolver()\n resolver.setServers(backupIps)\n return resolver\n })\n\n // Avoid uncaught promise rejection\n void resolverPromise.catch(() => {\n // Should never happen though...\n })\n\n return async (hostname) => {\n const resolver = await resolverPromise\n return resolver\n ? resolver.resolveTxt(hostname).then(groupChunks, handleError)\n : null\n }\n}\n\nfunction isBracedIPv6(address: string): boolean {\n return (\n address.startsWith('[') &&\n address.endsWith(']') &&\n isIP(address.slice(1, -1)) === 6\n )\n}\n\nfunction groupChunks(results: string[][]): string[] {\n return results.map((chunks) => chunks.join(''))\n}\n\nfunction handleError(err: unknown) {\n // Invalid argument type (e.g. hostname is a number)\n if (err instanceof TypeError) throw err\n\n // If the hostname does not resolve, return null\n if (err instanceof Error) {\n if (err['code'] === 'ENOTFOUND') return null\n\n // Hostname is not a valid domain name\n if (err['code'] === 'EBADNAME') throw err\n\n // DNS server unreachable\n // if (err['code'] === 'ETIMEOUT') throw err\n }\n\n // Historically, errors were not thrown here. A \"null\" value indicates to the\n // AtprotoHandleResolver that it should try the fallback resolver.\n\n // @TODO We might want to re-visit this to only apply when an unexpected error\n // occurs (by throwing here). For now, let's keep the same behavior as before.\n\n // throw err\n\n return null\n}\n\nfunction appendPort(address: string, port: string | null): string {\n switch (isIP(address)) {\n case 4:\n return port ? `${address}:${port}` : address\n case 6:\n return port ? `[${address}]:${port}` : `[${address}]`\n default:\n throw new TypeError(`Invalid IP address \"${address}\"`)\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto-labs/handle-resolver-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node specific ATProto handle to DID resolver",
|
|
6
6
|
"keywords": [
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
"url": "https://github.com/bluesky-social/atproto",
|
|
17
17
|
"directory": "packages/internal/handle-resolver-node"
|
|
18
18
|
},
|
|
19
|
-
"type": "
|
|
20
|
-
"main": "dist/index.js",
|
|
21
|
-
"types": "dist/index.d.ts",
|
|
19
|
+
"type": "module",
|
|
22
20
|
"exports": {
|
|
23
21
|
".": {
|
|
24
22
|
"types": "./dist/index.d.ts",
|
|
@@ -26,15 +24,15 @@
|
|
|
26
24
|
}
|
|
27
25
|
},
|
|
28
26
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
27
|
+
"node": ">=22"
|
|
30
28
|
},
|
|
31
29
|
"dependencies": {
|
|
32
|
-
"@atproto-labs/
|
|
33
|
-
"@atproto
|
|
34
|
-
"@atproto/
|
|
30
|
+
"@atproto-labs/handle-resolver": "^0.4.0-next.0",
|
|
31
|
+
"@atproto/did": "^0.4.0-next.0",
|
|
32
|
+
"@atproto-labs/fetch-node": "^0.3.0-next.0"
|
|
35
33
|
},
|
|
36
34
|
"devDependencies": {
|
|
37
|
-
"typescript": "^
|
|
35
|
+
"typescript": "^6.0.3"
|
|
38
36
|
},
|
|
39
37
|
"scripts": {
|
|
40
38
|
"build": "tsc --build tsconfig.build.json"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/atproto-handle-resolver-node.ts","./src/index.ts","./src/node-resolve-txt-factory.ts"],"version":"
|
|
1
|
+
{"root":["./src/atproto-handle-resolver-node.ts","./src/index.ts","./src/node-resolve-txt-factory.ts"],"version":"6.0.3"}
|