@atproto/dev-env 0.5.31 → 0.5.32
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 +13 -0
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +4 -2
- package/dist/util.js.map +1 -1
- package/package.json +7 -7
- package/src/util.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atproto/dev-env
|
|
2
2
|
|
|
3
|
+
## 0.5.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5236](https://github.com/bluesky-social/atproto/pull/5236) [`d6b4379`](https://github.com/bluesky-social/atproto/commit/d6b4379eb4be0c1c6dcb28ac59084f2329a97a94) Thanks [@devinivy](https://github.com/devinivy)! - defer service handle resolution to entryway when configured, allowing PDS_SERVICE_HANDLE_DOMAINS to match the entryway's domains
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`652016a`](https://github.com/bluesky-social/atproto/commit/652016ad57dca26f43b7f79167ecbfcabd5cbd4d), [`29adc81`](https://github.com/bluesky-social/atproto/commit/29adc81fc7925dbb0ce68c638e8092e9c4601a99), [`e408d11`](https://github.com/bluesky-social/atproto/commit/e408d11e723e3d232bcbfdb7247301273138cec6), [`cdc0faa`](https://github.com/bluesky-social/atproto/commit/cdc0faa5b57fe965b8ebb73a92462a01b464e7ef), [`d6b4379`](https://github.com/bluesky-social/atproto/commit/d6b4379eb4be0c1c6dcb28ac59084f2329a97a94), [`349693e`](https://github.com/bluesky-social/atproto/commit/349693e63865a5ba88e56a2b760d9e4ad39fe730)]:
|
|
10
|
+
- @atproto/ozone@0.2.15
|
|
11
|
+
- @atproto/bsky@0.0.260
|
|
12
|
+
- @atproto/pds@0.5.18
|
|
13
|
+
- @atproto/lex@0.2.3
|
|
14
|
+
- @atproto/sync@0.3.11
|
|
15
|
+
|
|
3
16
|
## 0.5.31
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/util.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { TestBsky } from './bsky.js';
|
|
|
3
3
|
import type { TestPds } from './pds.js';
|
|
4
4
|
import type { DidAndKey } from './types.js';
|
|
5
5
|
export declare const mockNetworkUtilities: (pds: TestPds, bsky?: TestBsky) => void;
|
|
6
|
-
export declare const mockResolvers: (idResolver: IdResolver, pds: TestPds) => void;
|
|
6
|
+
export declare const mockResolvers: (idResolver: IdResolver, pds: TestPds, handleResolveUrl?: string) => void;
|
|
7
7
|
export declare const mockMailer: (pds: TestPds) => void;
|
|
8
8
|
export declare const uniqueLockId: () => number;
|
|
9
9
|
export declare const createDidAndKey: (opts: {
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,oBAAoB,QAAS,OAAO,SAAS,QAAQ,SAMjE,CAAA;AAED,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,oBAAoB,QAAS,OAAO,SAAS,QAAQ,SAMjE,CAAA;AAED,eAAO,MAAM,aAAa,eACZ,UAAU,OACjB,OAAO,qBAEM,MAAM,SAyCzB,CAAA;AAED,eAAO,MAAM,UAAU,QAAS,OAAO,SAQtC,CAAA;AAGD,eAAO,MAAM,YAAY,cAOxB,CAAA;AAED,eAAO,MAAM,eAAe,SAAgB;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ,KAAG,OAAO,CAAC,SAAS,CAcpB,CAAA"}
|
package/dist/util.js
CHANGED
|
@@ -8,7 +8,9 @@ export const mockNetworkUtilities = (pds, bsky) => {
|
|
|
8
8
|
mockResolvers(bsky.dataplane.idResolver, pds);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
export const mockResolvers = (idResolver, pds
|
|
11
|
+
export const mockResolvers = (idResolver, pds,
|
|
12
|
+
// handles resolve against the pds by default, but may point elsewhere e.g. an entryway
|
|
13
|
+
handleResolveUrl = pds.url) => {
|
|
12
14
|
// Map pds public url to its local url when resolving from plc
|
|
13
15
|
const origResolveDid = idResolver.did.resolveNoCache;
|
|
14
16
|
idResolver.did.resolveNoCache = async (did) => {
|
|
@@ -25,7 +27,7 @@ export const mockResolvers = (idResolver, pds) => {
|
|
|
25
27
|
if (!isPdsHandle) {
|
|
26
28
|
return origResolveHandleDns.call(idResolver.handle, handle);
|
|
27
29
|
}
|
|
28
|
-
const url = new URL(`/.well-known/atproto-did`,
|
|
30
|
+
const url = new URL(`/.well-known/atproto-did`, handleResolveUrl);
|
|
29
31
|
try {
|
|
30
32
|
const res = await request(url, { headers: { host: handle } });
|
|
31
33
|
if (res.statusCode !== 200) {
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,OAAO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AAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAIrC,EAAsB,EAAE;IACvB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACpC,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,GAAG,GAAG,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;QACjD,UAAU,EAAE,GAAG,CAAC,GAAG,EAAE;QACrB,YAAY,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM;QACN,GAAG;QACH,MAAM,EAAE,GAAG;KACZ,CAAC,CAAA;IACF,OAAO;QACL,GAAG;QACH,GAAG;KACJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import * as plc from '@did-plc/lib'\nimport { request } from 'undici'\nimport { Secp256k1Keypair } from '@atproto/crypto'\nimport type { IdResolver } from '@atproto/identity'\nimport type { TestBsky } from './bsky.js'\nimport type { TestPds } from './pds.js'\nimport type { DidAndKey } from './types.js'\n\nexport const mockNetworkUtilities = (pds: TestPds, bsky?: TestBsky) => {\n mockResolvers(pds.ctx.idResolver, pds)\n if (bsky) {\n mockResolvers(bsky.ctx.idResolver, pds)\n mockResolvers(bsky.dataplane.idResolver, pds)\n }\n}\n\nexport const mockResolvers = (\n idResolver: IdResolver,\n pds: TestPds,\n // handles resolve against the pds by default, but may point elsewhere e.g. an entryway\n handleResolveUrl: string = pds.url,\n) => {\n // Map pds public url to its local url when resolving from plc\n const origResolveDid = idResolver.did.resolveNoCache\n idResolver.did.resolveNoCache = async (did: string) => {\n const result = await (origResolveDid.call(\n idResolver.did,\n did,\n ) as ReturnType<typeof origResolveDid>)\n const service = result?.service?.find((svc) => svc.id === '#atproto_pds')\n if (typeof service?.serviceEndpoint === 'string') {\n service.serviceEndpoint = service.serviceEndpoint.replace(\n pds.ctx.cfg.service.publicUrl,\n `http://localhost:${pds.port}`,\n )\n }\n return result\n }\n\n const origResolveHandleDns = idResolver.handle.resolveDns\n idResolver.handle.resolve = async (handle: string) => {\n const isPdsHandle = pds.ctx.cfg.identity.serviceHandleDomains.some(\n (domain) => handle.endsWith(domain),\n )\n if (!isPdsHandle) {\n return origResolveHandleDns.call(idResolver.handle, handle)\n }\n\n const url = new URL(`/.well-known/atproto-did`, handleResolveUrl)\n try {\n const res = await request(url, { headers: { host: handle } })\n if (res.statusCode !== 200) {\n await res.body.dump()\n return undefined\n }\n\n return res.body.text()\n } catch (err) {\n return undefined\n }\n }\n}\n\nexport const mockMailer = (pds: TestPds) => {\n const mailer = pds.ctx.mailer\n const _origSendMail = mailer.transporter.sendMail\n mailer.transporter.sendMail = async (opts) => {\n const result = await _origSendMail.call(mailer.transporter, opts)\n console.log(`✉️ Email: ${JSON.stringify(result, null, 2)}`)\n return result\n }\n}\n\nconst usedLockIds = new Set()\nexport const uniqueLockId = () => {\n let lockId: number\n do {\n lockId = 1000 + Math.ceil(1000 * Math.random())\n } while (usedLockIds.has(lockId))\n usedLockIds.add(lockId)\n return lockId\n}\n\nexport const createDidAndKey = async (opts: {\n plcUrl: string\n handle: string\n pds: string\n}): Promise<DidAndKey> => {\n const { plcUrl, handle, pds } = opts\n const key = await Secp256k1Keypair.create({ exportable: true })\n const did = await new plc.Client(plcUrl).createDid({\n signingKey: key.did(),\n rotationKeys: [key.did()],\n handle,\n pds,\n signer: key,\n })\n return {\n key,\n did,\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/dev-env",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Local development environment helper for atproto development",
|
|
6
6
|
"keywords": [
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"undici": "^8.5.0",
|
|
43
43
|
"@atproto/api": "^0.20.28",
|
|
44
44
|
"@atproto/bsync": "^0.0.36",
|
|
45
|
+
"@atproto/bsky": "^0.0.260",
|
|
45
46
|
"@atproto/common-web": "^0.5.6",
|
|
46
|
-
"@atproto/
|
|
47
|
+
"@atproto/crypto": "^0.5.4",
|
|
47
48
|
"@atproto/identity": "^0.5.6",
|
|
48
|
-
"@atproto/lex": "^0.2.2",
|
|
49
|
-
"@atproto/ozone": "^0.2.14",
|
|
50
49
|
"@atproto/lexicon": "^0.7.7",
|
|
51
|
-
"@atproto/pds": "^0.5.
|
|
52
|
-
"@atproto/
|
|
53
|
-
"@atproto/
|
|
50
|
+
"@atproto/pds": "^0.5.18",
|
|
51
|
+
"@atproto/ozone": "^0.2.15",
|
|
52
|
+
"@atproto/sync": "^0.3.11",
|
|
53
|
+
"@atproto/lex": "^0.2.3",
|
|
54
54
|
"@atproto/syntax": "^0.7.2",
|
|
55
55
|
"@atproto/xrpc-server": "^0.11.9"
|
|
56
56
|
},
|
package/src/util.ts
CHANGED
|
@@ -14,7 +14,12 @@ export const mockNetworkUtilities = (pds: TestPds, bsky?: TestBsky) => {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export const mockResolvers = (
|
|
17
|
+
export const mockResolvers = (
|
|
18
|
+
idResolver: IdResolver,
|
|
19
|
+
pds: TestPds,
|
|
20
|
+
// handles resolve against the pds by default, but may point elsewhere e.g. an entryway
|
|
21
|
+
handleResolveUrl: string = pds.url,
|
|
22
|
+
) => {
|
|
18
23
|
// Map pds public url to its local url when resolving from plc
|
|
19
24
|
const origResolveDid = idResolver.did.resolveNoCache
|
|
20
25
|
idResolver.did.resolveNoCache = async (did: string) => {
|
|
@@ -41,7 +46,7 @@ export const mockResolvers = (idResolver: IdResolver, pds: TestPds) => {
|
|
|
41
46
|
return origResolveHandleDns.call(idResolver.handle, handle)
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
const url = new URL(`/.well-known/atproto-did`,
|
|
49
|
+
const url = new URL(`/.well-known/atproto-did`, handleResolveUrl)
|
|
45
50
|
try {
|
|
46
51
|
const res = await request(url, { headers: { host: handle } })
|
|
47
52
|
if (res.statusCode !== 200) {
|