@atproto-labs/handle-resolver-node 0.0.0-spaces-alpha-20260910222405
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 +319 -0
- package/LICENSE.txt +7 -0
- package/dist/atproto-handle-resolver-node.d.ts +39 -0
- package/dist/atproto-handle-resolver-node.d.ts.map +1 -0
- package/dist/atproto-handle-resolver-node.js +21 -0
- package/dist/atproto-handle-resolver-node.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/node-resolve-txt-factory.d.ts +4 -0
- package/dist/node-resolve-txt-factory.d.ts.map +1 -0
- package/dist/node-resolve-txt-factory.js +78 -0
- package/dist/node-resolve-txt-factory.js.map +1 -0
- package/package.json +41 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# @atproto-labs/handle-resolver-node
|
|
2
|
+
|
|
3
|
+
## 0.0.0-spaces-alpha-20260910222405
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5469](https://github.com/bluesky-social/atproto/pull/5469) [`ed361d0`](https://github.com/bluesky-social/atproto/commit/ed361d04b83915c0c5018571711667a40a04cf58) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Re-export `@atproto-labs/handle-resolver`
|
|
8
|
+
|
|
9
|
+
- [#5469](https://github.com/bluesky-social/atproto/pull/5469) [`ed361d0`](https://github.com/bluesky-social/atproto/commit/ed361d04b83915c0c5018571711667a40a04cf58) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Allow providing a custom `safeFetch` implementation when constructing a `AtprotoHandleResolverNode` instance
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`fe4087e`](https://github.com/bluesky-social/atproto/commit/fe4087ecb7a7cc53c7081c9f97d49121e5251c36), [`ed361d0`](https://github.com/bluesky-social/atproto/commit/ed361d04b83915c0c5018571711667a40a04cf58)]:
|
|
12
|
+
- @atproto/did@0.0.0-spaces-alpha-20260910222405
|
|
13
|
+
- @atproto-labs/fetch-node@0.0.0-spaces-alpha-20260910222405
|
|
14
|
+
- @atproto-labs/handle-resolver@0.0.0-spaces-alpha-20260910222405
|
|
15
|
+
|
|
16
|
+
## 0.2.8
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`6a3d607`](https://github.com/bluesky-social/atproto/commit/6a3d6073cb66c527b5b109242049c85c36b9658c)]:
|
|
21
|
+
- @atproto-labs/handle-resolver@0.4.8
|
|
22
|
+
- @atproto-labs/fetch-node@0.3.7
|
|
23
|
+
|
|
24
|
+
## 0.2.7
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`f136380`](https://github.com/bluesky-social/atproto/commit/f136380964a8ea52ef031a9732d3d1f1f1ab0c4a)]:
|
|
29
|
+
- @atproto-labs/handle-resolver@0.4.7
|
|
30
|
+
- @atproto-labs/fetch-node@0.3.6
|
|
31
|
+
|
|
32
|
+
## 0.2.6
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#5193](https://github.com/bluesky-social/atproto/pull/5193) [`ce386ee`](https://github.com/bluesky-social/atproto/commit/ce386eed324f813601db57f873fbb3b987492001) Thanks [@Rex0Lux](https://github.com/Rex0Lux)! - Add an `onError` observability option to the handle resolvers. `WellKnownHandleResolver` previously swallowed every non-abort failure and returned `null`, indistinguishable from "no `.well-known/atproto-did` endpoint exists". Passing `onError` when constructing a resolver (including `AtprotoHandleResolver` and `AtprotoHandleResolverNode`) exposes the underlying cause (SSRF blocks, 5xx upstream errors, redirects, network errors, etc.) without changing the `null` return contract. Because it is set on the instance, it also covers resolution performed internally, for example by an OAuth client the resolver is passed to.
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`ce386ee`](https://github.com/bluesky-social/atproto/commit/ce386eed324f813601db57f873fbb3b987492001)]:
|
|
39
|
+
- @atproto-labs/handle-resolver@0.4.6
|
|
40
|
+
|
|
41
|
+
## 0.2.5
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [#5197](https://github.com/bluesky-social/atproto/pull/5197) [`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Rewrite import statements to be compatible with TypeScript's `verbatimModuleSyntax` config.
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f)]:
|
|
48
|
+
- @atproto-labs/handle-resolver@0.4.5
|
|
49
|
+
- @atproto-labs/fetch-node@0.3.5
|
|
50
|
+
- @atproto/did@0.5.4
|
|
51
|
+
|
|
52
|
+
## 0.2.4
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update TypeScript build to rely on references to composite internal projects
|
|
57
|
+
|
|
58
|
+
- [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Bundle only necessary files in the NPM tarball, including the `CHANGELOG.md` and `README.md` files (if present).
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [[`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07)]:
|
|
61
|
+
- @atproto-labs/handle-resolver@0.4.4
|
|
62
|
+
- @atproto-labs/fetch-node@0.3.4
|
|
63
|
+
- @atproto/did@0.5.3
|
|
64
|
+
|
|
65
|
+
## 0.2.3
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- [#5151](https://github.com/bluesky-social/atproto/pull/5151) [`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update dependencies
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [[`60e9b83`](https://github.com/bluesky-social/atproto/commit/60e9b8391f212c274b1f21991ee2a3a2d14f2f88), [`60e9b83`](https://github.com/bluesky-social/atproto/commit/60e9b8391f212c274b1f21991ee2a3a2d14f2f88), [`60e9b83`](https://github.com/bluesky-social/atproto/commit/60e9b8391f212c274b1f21991ee2a3a2d14f2f88), [`60e9b83`](https://github.com/bluesky-social/atproto/commit/60e9b8391f212c274b1f21991ee2a3a2d14f2f88), [`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7), [`60e9b83`](https://github.com/bluesky-social/atproto/commit/60e9b8391f212c274b1f21991ee2a3a2d14f2f88)]:
|
|
72
|
+
- @atproto-labs/fetch-node@0.3.3
|
|
73
|
+
- @atproto/did@0.5.2
|
|
74
|
+
- @atproto-labs/handle-resolver@0.4.3
|
|
75
|
+
|
|
76
|
+
## 0.2.2
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- [#4967](https://github.com/bluesky-social/atproto/pull/4967) [`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use TypeScript 7 to build package
|
|
81
|
+
|
|
82
|
+
- Updated dependencies [[`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5)]:
|
|
83
|
+
- @atproto-labs/handle-resolver@0.4.2
|
|
84
|
+
- @atproto-labs/fetch-node@0.3.1
|
|
85
|
+
- @atproto/did@0.5.1
|
|
86
|
+
|
|
87
|
+
## 0.2.1
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [[`622d365`](https://github.com/bluesky-social/atproto/commit/622d365aeb240133f40763a3b1c43981112837fc)]:
|
|
92
|
+
- @atproto/did@0.5.0
|
|
93
|
+
- @atproto-labs/handle-resolver@0.4.1
|
|
94
|
+
|
|
95
|
+
## 0.2.0
|
|
96
|
+
|
|
97
|
+
### Minor Changes
|
|
98
|
+
|
|
99
|
+
- [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c) 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.
|
|
100
|
+
|
|
101
|
+
- [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9) 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.
|
|
102
|
+
|
|
103
|
+
Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
|
|
104
|
+
|
|
105
|
+
- [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0.
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies [[`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9), [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705)]:
|
|
110
|
+
- @atproto/did@0.4.0
|
|
111
|
+
- @atproto-labs/fetch-node@0.3.0
|
|
112
|
+
- @atproto-labs/handle-resolver@0.4.0
|
|
113
|
+
|
|
114
|
+
## 0.1.25
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [[`d54d707`](https://github.com/bluesky-social/atproto/commit/d54d7077eb32041e1f61c312efa1dd0d768c774e), [`d54d707`](https://github.com/bluesky-social/atproto/commit/d54d7077eb32041e1f61c312efa1dd0d768c774e)]:
|
|
119
|
+
- @atproto/did@0.3.0
|
|
120
|
+
- @atproto-labs/handle-resolver@0.3.6
|
|
121
|
+
|
|
122
|
+
## 0.1.24
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [[`2f78893`](https://github.com/bluesky-social/atproto/commit/2f78893ace3bbf14d4bac36837820ddb46658c98)]:
|
|
127
|
+
- @atproto/did@0.2.4
|
|
128
|
+
- @atproto-labs/handle-resolver@0.3.5
|
|
129
|
+
|
|
130
|
+
## 0.1.23
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [[`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`d396de0`](https://github.com/bluesky-social/atproto/commit/d396de016d1d55d08cfad1dabd3ffd9eaeea76ea)]:
|
|
135
|
+
- @atproto/did@0.2.3
|
|
136
|
+
- @atproto-labs/handle-resolver@0.3.4
|
|
137
|
+
|
|
138
|
+
## 0.1.22
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- Updated dependencies [[`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7)]:
|
|
143
|
+
- @atproto-labs/handle-resolver@0.3.3
|
|
144
|
+
- @atproto/did@0.2.2
|
|
145
|
+
|
|
146
|
+
## 0.1.21
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [[`8ff5ec4ca`](https://github.com/bluesky-social/atproto/commit/8ff5ec4caa9a1f5c1e453a416ba2af22d1ee4f58)]:
|
|
151
|
+
- @atproto-labs/fetch-node@0.2.0
|
|
152
|
+
|
|
153
|
+
## 0.1.20
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- Updated dependencies [[`09439d7d6`](https://github.com/bluesky-social/atproto/commit/09439d7d688294ad1a0c78a74b901ba2f7c5f4c3)]:
|
|
158
|
+
- @atproto/did@0.2.1
|
|
159
|
+
- @atproto-labs/handle-resolver@0.3.2
|
|
160
|
+
|
|
161
|
+
## 0.1.19
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- Updated dependencies [[`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d)]:
|
|
166
|
+
- @atproto/did@0.2.0
|
|
167
|
+
- @atproto-labs/fetch-node@0.1.10
|
|
168
|
+
- @atproto-labs/handle-resolver@0.3.1
|
|
169
|
+
|
|
170
|
+
## 0.1.18
|
|
171
|
+
|
|
172
|
+
### Patch Changes
|
|
173
|
+
|
|
174
|
+
- Updated dependencies [[`9dac8b0c6`](https://github.com/bluesky-social/atproto/commit/9dac8b0c600520ecb0066ac104787b27668dea47), [`9dac8b0c6`](https://github.com/bluesky-social/atproto/commit/9dac8b0c600520ecb0066ac104787b27668dea47)]:
|
|
175
|
+
- @atproto-labs/handle-resolver@0.3.0
|
|
176
|
+
|
|
177
|
+
## 0.1.17
|
|
178
|
+
|
|
179
|
+
### Patch Changes
|
|
180
|
+
|
|
181
|
+
- Updated dependencies [[`90b4775fc`](https://github.com/bluesky-social/atproto/commit/90b4775fc9c6959171bc12b961ce9421cc14d6ee), [`90b4775fc`](https://github.com/bluesky-social/atproto/commit/90b4775fc9c6959171bc12b961ce9421cc14d6ee)]:
|
|
182
|
+
- @atproto-labs/handle-resolver@0.2.0
|
|
183
|
+
|
|
184
|
+
## 0.1.16
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- Updated dependencies [[`5050b6550`](https://github.com/bluesky-social/atproto/commit/5050b6550e07e71b0a524eda0b71b837583294d4), [`36dbd4155`](https://github.com/bluesky-social/atproto/commit/36dbd41551f74052a3f584719a1a7edd86eca201), [`5050b6550`](https://github.com/bluesky-social/atproto/commit/5050b6550e07e71b0a524eda0b71b837583294d4), [`43861a452`](https://github.com/bluesky-social/atproto/commit/43861a452b70268e738ef12033297cddacbe25d4)]:
|
|
189
|
+
- @atproto-labs/fetch-node@0.1.9
|
|
190
|
+
|
|
191
|
+
## 0.1.15
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- Updated dependencies []:
|
|
196
|
+
- @atproto-labs/handle-resolver@0.1.8
|
|
197
|
+
|
|
198
|
+
## 0.1.14
|
|
199
|
+
|
|
200
|
+
### Patch Changes
|
|
201
|
+
|
|
202
|
+
- Updated dependencies []:
|
|
203
|
+
- @atproto-labs/fetch-node@0.1.8
|
|
204
|
+
|
|
205
|
+
## 0.1.13
|
|
206
|
+
|
|
207
|
+
### Patch Changes
|
|
208
|
+
|
|
209
|
+
- [#3220](https://github.com/bluesky-social/atproto/pull/3220) [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Apply new linting rules regarding import order
|
|
210
|
+
|
|
211
|
+
- [#3220](https://github.com/bluesky-social/atproto/pull/3220) [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update NodeJS engine requirement to >=18.7.0
|
|
212
|
+
|
|
213
|
+
- Updated dependencies [[`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd), [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd)]:
|
|
214
|
+
- @atproto-labs/handle-resolver@0.1.7
|
|
215
|
+
- @atproto-labs/fetch-node@0.1.7
|
|
216
|
+
- @atproto/did@0.1.5
|
|
217
|
+
|
|
218
|
+
## 0.1.12
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- Updated dependencies [[`cc2a1222b`](https://github.com/bluesky-social/atproto/commit/cc2a1222bd2b8ddd70d70dad174c1c63246a2d87)]:
|
|
223
|
+
- @atproto/did@0.1.4
|
|
224
|
+
- @atproto-labs/handle-resolver@0.1.6
|
|
225
|
+
|
|
226
|
+
## 0.1.11
|
|
227
|
+
|
|
228
|
+
### Patch Changes
|
|
229
|
+
|
|
230
|
+
- Updated dependencies [[`9c0128193`](https://github.com/bluesky-social/atproto/commit/9c01281931a371304bcfa465005d7363c003bc5f)]:
|
|
231
|
+
- @atproto-labs/fetch-node@0.1.6
|
|
232
|
+
|
|
233
|
+
## 0.1.10
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- Updated dependencies []:
|
|
238
|
+
- @atproto-labs/fetch-node@0.1.5
|
|
239
|
+
|
|
240
|
+
## 0.1.9
|
|
241
|
+
|
|
242
|
+
### Patch Changes
|
|
243
|
+
|
|
244
|
+
- Updated dependencies [[`a200e5095`](https://github.com/bluesky-social/atproto/commit/a200e50951d297c3f9670e96027262196bc29b0b)]:
|
|
245
|
+
- @atproto-labs/handle-resolver@0.1.5
|
|
246
|
+
|
|
247
|
+
## 0.1.8
|
|
248
|
+
|
|
249
|
+
### Patch Changes
|
|
250
|
+
|
|
251
|
+
- Updated dependencies []:
|
|
252
|
+
- @atproto-labs/fetch-node@0.1.4
|
|
253
|
+
|
|
254
|
+
## 0.1.7
|
|
255
|
+
|
|
256
|
+
### Patch Changes
|
|
257
|
+
|
|
258
|
+
- Updated dependencies [[`9d40ccbb6`](https://github.com/bluesky-social/atproto/commit/9d40ccbb69103fae9aae7e3cec31e9b3116f3ba2), [`9d40ccbb6`](https://github.com/bluesky-social/atproto/commit/9d40ccbb69103fae9aae7e3cec31e9b3116f3ba2)]:
|
|
259
|
+
- @atproto-labs/handle-resolver@0.1.4
|
|
260
|
+
- @atproto/did@0.1.3
|
|
261
|
+
|
|
262
|
+
## 0.1.6
|
|
263
|
+
|
|
264
|
+
### Patch Changes
|
|
265
|
+
|
|
266
|
+
- Updated dependencies [[`80450cbf2`](https://github.com/bluesky-social/atproto/commit/80450cbf2ca27967ee9fe1a5f4bc590b26f1e6b2)]:
|
|
267
|
+
- @atproto-labs/fetch-node@0.1.3
|
|
268
|
+
|
|
269
|
+
## 0.1.5
|
|
270
|
+
|
|
271
|
+
### Patch Changes
|
|
272
|
+
|
|
273
|
+
- Updated dependencies [[`8943c1008`](https://github.com/bluesky-social/atproto/commit/8943c10082702bbc0fc150237c6cc421251afd51)]:
|
|
274
|
+
- @atproto-labs/fetch-node@0.1.2
|
|
275
|
+
|
|
276
|
+
## 0.1.4
|
|
277
|
+
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- Updated dependencies [[`a07b21151`](https://github.com/bluesky-social/atproto/commit/a07b21151f1850340c4b7797ebb11521b1a6cdf3), [`a07b21151`](https://github.com/bluesky-social/atproto/commit/a07b21151f1850340c4b7797ebb11521b1a6cdf3)]:
|
|
281
|
+
- @atproto-labs/fetch-node@0.1.1
|
|
282
|
+
|
|
283
|
+
## 0.1.3
|
|
284
|
+
|
|
285
|
+
### Patch Changes
|
|
286
|
+
|
|
287
|
+
- Updated dependencies [[`cb4abbb67`](https://github.com/bluesky-social/atproto/commit/cb4abbb673c69a8a89b49dca5c038f3da2153c6c), [`cb4abbb67`](https://github.com/bluesky-social/atproto/commit/cb4abbb673c69a8a89b49dca5c038f3da2153c6c), [`cb4abbb67`](https://github.com/bluesky-social/atproto/commit/cb4abbb673c69a8a89b49dca5c038f3da2153c6c)]:
|
|
288
|
+
- @atproto/did@0.1.2
|
|
289
|
+
- @atproto-labs/handle-resolver@0.1.3
|
|
290
|
+
|
|
291
|
+
## 0.1.2
|
|
292
|
+
|
|
293
|
+
### Patch Changes
|
|
294
|
+
|
|
295
|
+
- Updated dependencies [[`b934b396b`](https://github.com/bluesky-social/atproto/commit/b934b396b13ba32bf2bf7e75ecdf6871e5f310dd), [`b934b396b`](https://github.com/bluesky-social/atproto/commit/b934b396b13ba32bf2bf7e75ecdf6871e5f310dd)]:
|
|
296
|
+
- @atproto-labs/handle-resolver@0.1.2
|
|
297
|
+
- @atproto/did@0.1.1
|
|
298
|
+
|
|
299
|
+
## 0.1.1
|
|
300
|
+
|
|
301
|
+
### Patch Changes
|
|
302
|
+
|
|
303
|
+
- [#2633](https://github.com/bluesky-social/atproto/pull/2633) [`acc9093d2`](https://github.com/bluesky-social/atproto/commit/acc9093d2845eba02b68fb2f9db33e4f1b59bb10) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use distinct type names to prevent conflicts
|
|
304
|
+
|
|
305
|
+
- Updated dependencies [[`acc9093d2`](https://github.com/bluesky-social/atproto/commit/acc9093d2845eba02b68fb2f9db33e4f1b59bb10)]:
|
|
306
|
+
- @atproto-labs/handle-resolver@0.1.1
|
|
307
|
+
|
|
308
|
+
## 0.1.0
|
|
309
|
+
|
|
310
|
+
### Minor Changes
|
|
311
|
+
|
|
312
|
+
- [#2482](https://github.com/bluesky-social/atproto/pull/2482) [`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add OAuth provider capability & support for DPoP signed tokens
|
|
313
|
+
|
|
314
|
+
### Patch Changes
|
|
315
|
+
|
|
316
|
+
- Updated dependencies [[`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646)]:
|
|
317
|
+
- @atproto-labs/handle-resolver@0.1.0
|
|
318
|
+
- @atproto-labs/fetch-node@0.1.0
|
|
319
|
+
- @atproto/did@0.1.0
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Dual MIT/Apache-2.0 License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Fetch } from '@atproto-labs/fetch-node';
|
|
2
|
+
import { AtprotoHandleResolver, type HandleResolver, type HandleResolverErrorHandler } from '@atproto-labs/handle-resolver';
|
|
3
|
+
export type AtprotoHandleResolverNodeOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* List of backup nameservers to use in case the primary ones fail. Will
|
|
6
|
+
* default to no fallback nameservers.
|
|
7
|
+
*/
|
|
8
|
+
fallbackNameservers?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Fetch function to use for HTTP requests. Allows customizing the request
|
|
11
|
+
* behavior, e.g. adding headers, setting a timeout, mocking, etc. This will
|
|
12
|
+
* be wrapped with {@link safeFetchWrap} to build the {@link safeFetch} when
|
|
13
|
+
* it is not provided.
|
|
14
|
+
*
|
|
15
|
+
* @default `globalThis.fetch`
|
|
16
|
+
*/
|
|
17
|
+
fetch?: Fetch;
|
|
18
|
+
/**
|
|
19
|
+
* Custom fetch function that will be used for HTTP requests. This function,
|
|
20
|
+
* if provided, *must* be safe to use with user-provided input (URL). If not
|
|
21
|
+
* provided, a safe fetch function will be created by wrapping the provided {@link fetch}
|
|
22
|
+
* function (or the default `globalThis.fetch`) with {@link safeFetchWrap}.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link safeFetchWrap}
|
|
25
|
+
*/
|
|
26
|
+
safeFetch?: Fetch;
|
|
27
|
+
/**
|
|
28
|
+
* Optional observability hook, invoked when handle resolution fails for a
|
|
29
|
+
* non-abort reason (network error, SSRF block, non-2xx response, etc.). The
|
|
30
|
+
* resolver still returns `null`; this only exposes the cause for logging or
|
|
31
|
+
* telemetry. Handy for diagnosing why a handle fails to resolve, e.g. when a
|
|
32
|
+
* PDS sits behind a firewall that trips SSRF protection.
|
|
33
|
+
*/
|
|
34
|
+
onError?: HandleResolverErrorHandler;
|
|
35
|
+
};
|
|
36
|
+
export declare class AtprotoHandleResolverNode extends AtprotoHandleResolver implements HandleResolver {
|
|
37
|
+
constructor({ fetch, safeFetch, fallbackNameservers, onError, }?: AtprotoHandleResolverNodeOptions);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=atproto-handle-resolver-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atproto-handle-resolver-node.d.ts","sourceRoot":"","sources":["../src/atproto-handle-resolver-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAiB,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,+BAA+B,CAAA;AAMtC,MAAM,MAAM,gCAAgC,GAAG;IAC7C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE9B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,KAAK,CAAA;IAEjB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,0BAA0B,CAAA;CACrC,CAAA;AAED,qBAAa,yBACX,SAAQ,qBACR,YAAW,cAAc;IAEzB,YAAY,EACV,KAAwB,EACxB,SAKE,EACF,mBAAmB,EACnB,OAAO,GACR,GAAE,gCAAqC,EASvC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 {
|
|
5
|
+
constructor({ fetch = globalThis.fetch, safeFetch = safeFetchWrap({
|
|
6
|
+
fetch,
|
|
7
|
+
timeout: 3000, // 3 seconds
|
|
8
|
+
ssrfProtection: true,
|
|
9
|
+
responseMaxSize: 10 * 1024, // DID are max 2048 characters, 10kb for safety
|
|
10
|
+
}), fallbackNameservers, onError, } = {}) {
|
|
11
|
+
super({
|
|
12
|
+
fetch: safeFetch,
|
|
13
|
+
resolveTxt: nodeResolveTxtDefault,
|
|
14
|
+
resolveTxtFallback: fallbackNameservers?.length
|
|
15
|
+
? nodeResolveTxtFactory(fallbackNameservers)
|
|
16
|
+
: undefined,
|
|
17
|
+
onError,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=atproto-handle-resolver-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atproto-handle-resolver-node.js","sourceRoot":"","sources":["../src/atproto-handle-resolver-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,qBAAqB,GAGtB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,+BAA+B,CAAA;AAuCtC,MAAM,OAAO,yBACX,SAAQ,qBAAqB;IAG7B,YAAY,EACV,KAAK,GAAG,UAAU,CAAC,KAAK,EACxB,SAAS,GAAG,aAAa,CAAC;QACxB,KAAK;QACL,OAAO,EAAE,IAAI,EAAE,YAAY;QAC3B,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,EAAE,GAAG,IAAI,EAAE,+CAA+C;KAC5E,CAAC,EACF,mBAAmB,EACnB,OAAO,GACR,GAAqC,EAAE;QACtC,KAAK,CAAC;YACJ,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,qBAAqB;YACjC,kBAAkB,EAAE,mBAAmB,EAAE,MAAM;gBAC7C,CAAC,CAAC,qBAAqB,CAAC,mBAAmB,CAAC;gBAC5C,CAAC,CAAC,SAAS;YACb,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF","sourcesContent":["import { type Fetch, safeFetchWrap } from '@atproto-labs/fetch-node'\nimport {\n AtprotoHandleResolver,\n type HandleResolver,\n type HandleResolverErrorHandler,\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. This will\n * be wrapped with {@link safeFetchWrap} to build the {@link safeFetch} when\n * it is not provided.\n *\n * @default `globalThis.fetch`\n */\n fetch?: Fetch\n\n /**\n * Custom fetch function that will be used for HTTP requests. This function,\n * if provided, *must* be safe to use with user-provided input (URL). If not\n * provided, a safe fetch function will be created by wrapping the provided {@link fetch}\n * function (or the default `globalThis.fetch`) with {@link safeFetchWrap}.\n *\n * @see {@link safeFetchWrap}\n */\n safeFetch?: Fetch\n\n /**\n * Optional observability hook, invoked when handle resolution fails for a\n * non-abort reason (network error, SSRF block, non-2xx response, etc.). The\n * resolver still returns `null`; this only exposes the cause for logging or\n * telemetry. Handy for diagnosing why a handle fails to resolve, e.g. when a\n * PDS sits behind a firewall that trips SSRF protection.\n */\n onError?: HandleResolverErrorHandler\n}\n\nexport class AtprotoHandleResolverNode\n extends AtprotoHandleResolver\n implements HandleResolver\n{\n constructor({\n fetch = globalThis.fetch,\n safeFetch = safeFetchWrap({\n fetch,\n timeout: 3000, // 3 seconds\n ssrfProtection: true,\n responseMaxSize: 10 * 1024, // DID are max 2048 characters, 10kb for safety\n }),\n fallbackNameservers,\n onError,\n }: AtprotoHandleResolverNodeOptions = {}) {\n super({\n fetch: safeFetch,\n resolveTxt: nodeResolveTxtDefault,\n resolveTxtFallback: fallbackNameservers?.length\n ? nodeResolveTxtFactory(fallbackNameservers)\n : undefined,\n onError,\n })\n }\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mCAAmC,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mCAAmC,CAAA","sourcesContent":["export * from '@atproto-labs/handle-resolver'\nexport * from './atproto-handle-resolver-node.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-resolve-txt-factory.d.ts","sourceRoot":"","sources":["../src/node-resolve-txt-factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAE/D,eAAO,MAAM,qBAAqB,EAAE,UACiB,CAAA;AAErD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,UAAU,CA0CvE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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) {
|
|
5
|
+
// Optimization
|
|
6
|
+
if (!nameservers.length)
|
|
7
|
+
return async () => null;
|
|
8
|
+
// Build the resolver asynchronously (will be awaited on every use)
|
|
9
|
+
const resolverPromise = Promise.all(nameservers.map((nameserver) => {
|
|
10
|
+
const [domain, port = null] = nameserver.split(':', 2);
|
|
11
|
+
if (port !== null && !/^\d+$/.test(port)) {
|
|
12
|
+
throw new TypeError(`Invalid name server "${nameserver}"`);
|
|
13
|
+
}
|
|
14
|
+
return isIP(domain) === 4 || isBracedIPv6(domain)
|
|
15
|
+
? [nameserver] // No need to lookup
|
|
16
|
+
: lookup(domain, { all: true }).then((r) => r.map((a) => appendPort(a.address, port)),
|
|
17
|
+
// Let's just ignore failed nameservers resolution
|
|
18
|
+
(_err) => []);
|
|
19
|
+
})).then((results) => {
|
|
20
|
+
const backupIps = results.flat(1);
|
|
21
|
+
// No resolver if no valid IP
|
|
22
|
+
if (!backupIps.length)
|
|
23
|
+
return null;
|
|
24
|
+
const resolver = new Resolver();
|
|
25
|
+
resolver.setServers(backupIps);
|
|
26
|
+
return resolver;
|
|
27
|
+
});
|
|
28
|
+
// Avoid uncaught promise rejection
|
|
29
|
+
void resolverPromise.catch(() => {
|
|
30
|
+
// Should never happen though...
|
|
31
|
+
});
|
|
32
|
+
return async (hostname) => {
|
|
33
|
+
const resolver = await resolverPromise;
|
|
34
|
+
return resolver
|
|
35
|
+
? resolver.resolveTxt(hostname).then(groupChunks, handleError)
|
|
36
|
+
: null;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function isBracedIPv6(address) {
|
|
40
|
+
return (address.startsWith('[') &&
|
|
41
|
+
address.endsWith(']') &&
|
|
42
|
+
isIP(address.slice(1, -1)) === 6);
|
|
43
|
+
}
|
|
44
|
+
function groupChunks(results) {
|
|
45
|
+
return results.map((chunks) => chunks.join(''));
|
|
46
|
+
}
|
|
47
|
+
function handleError(err) {
|
|
48
|
+
// Invalid argument type (e.g. hostname is a number)
|
|
49
|
+
if (err instanceof TypeError)
|
|
50
|
+
throw err;
|
|
51
|
+
// If the hostname does not resolve, return null
|
|
52
|
+
if (err instanceof Error && 'code' in err) {
|
|
53
|
+
if (err.code === 'ENOTFOUND')
|
|
54
|
+
return null;
|
|
55
|
+
// Hostname is not a valid domain name
|
|
56
|
+
if (err.code === 'EBADNAME')
|
|
57
|
+
throw err;
|
|
58
|
+
// DNS server unreachable
|
|
59
|
+
// if (err.code === 'ETIMEOUT') throw err
|
|
60
|
+
}
|
|
61
|
+
// Historically, errors were not thrown here. A "null" value indicates to the
|
|
62
|
+
// AtprotoHandleResolver that it should try the fallback resolver.
|
|
63
|
+
// @TODO We might want to re-visit this to only apply when an unexpected error
|
|
64
|
+
// occurs (by throwing here). For now, let's keep the same behavior as before.
|
|
65
|
+
// throw err
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function appendPort(address, port) {
|
|
69
|
+
switch (isIP(address)) {
|
|
70
|
+
case 4:
|
|
71
|
+
return port ? `${address}:${port}` : address;
|
|
72
|
+
case 6:
|
|
73
|
+
return port ? `[${address}]:${port}` : `[${address}]`;
|
|
74
|
+
default:
|
|
75
|
+
throw new TypeError(`Invalid IP address "${address}"`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=node-resolve-txt-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-resolve-txt-factory.js","sourceRoot":"","sources":["../src/node-resolve-txt-factory.ts"],"names":[],"mappings":"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","sourcesContent":["import { Resolver, lookup, resolveTxt } from 'node:dns/promises'\nimport { isIP } from 'node:net'\nimport type { 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 && 'code' in err) {\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
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atproto-labs/handle-resolver-node",
|
|
3
|
+
"version": "0.0.0-spaces-alpha-20260910222405",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Node specific ATProto handle to DID resolver",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"atproto",
|
|
8
|
+
"oauth",
|
|
9
|
+
"handle",
|
|
10
|
+
"identity",
|
|
11
|
+
"node"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://atproto.com",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/bluesky-social/atproto",
|
|
17
|
+
"directory": "packages/internal/handle-resolver-node"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"./dist",
|
|
21
|
+
"./CHANGELOG.md"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=22"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@atproto-labs/fetch-node": "^0.0.0-spaces-alpha-20260910222405",
|
|
35
|
+
"@atproto-labs/handle-resolver": "^0.0.0-spaces-alpha-20260910222405",
|
|
36
|
+
"@atproto/did": "^0.0.0-spaces-alpha-20260910222405"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc --build tsconfig.build.json"
|
|
40
|
+
}
|
|
41
|
+
}
|