@atproto/dev-env 0.4.8 → 0.5.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 +31 -0
- package/bin.js +1 -4
- package/dist/bin.d.ts +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +8 -10
- package/dist/bin.js.map +1 -1
- package/dist/bsky.d.ts +1 -1
- package/dist/bsky.d.ts.map +1 -1
- package/dist/bsky.js +30 -113
- package/dist/bsky.js.map +1 -1
- package/dist/bsync.d.ts +1 -1
- package/dist/bsync.d.ts.map +1 -1
- package/dist/bsync.js +7 -62
- package/dist/bsync.js.map +1 -1
- package/dist/const.js +3 -6
- package/dist/const.js.map +1 -1
- package/dist/env.js +3 -8
- package/dist/env.js.map +1 -1
- package/dist/feed-gen.js +18 -78
- package/dist/feed-gen.js.map +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -55
- package/dist/index.js.map +1 -1
- package/dist/introspect.d.ts +4 -4
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +8 -25
- package/dist/introspect.js.map +1 -1
- package/dist/mock/data.js +2 -5
- package/dist/mock/data.js.map +1 -1
- package/dist/mock/img/blur-hash-avatar-b64.js +1 -3
- package/dist/mock/img/blur-hash-avatar-b64.js.map +1 -1
- package/dist/mock/img/labeled-img-b64.js +1 -3
- package/dist/mock/img/labeled-img-b64.js.map +1 -1
- package/dist/mock/index.d.ts +1 -1
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +29 -36
- package/dist/mock/index.js.map +1 -1
- package/dist/moderator-client.d.ts +4 -3
- package/dist/moderator-client.d.ts.map +1 -1
- package/dist/moderator-client.js +2 -17
- package/dist/moderator-client.js.map +1 -1
- package/dist/network-no-appview.d.ts +5 -5
- package/dist/network-no-appview.d.ts.map +1 -1
- package/dist/network-no-appview.js +14 -33
- package/dist/network-no-appview.js.map +1 -1
- package/dist/network.d.ts +7 -7
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +39 -104
- package/dist/network.js.map +1 -1
- package/dist/ozone.d.ts +2 -2
- package/dist/ozone.d.ts.map +1 -1
- package/dist/ozone.js +30 -106
- package/dist/ozone.js.map +1 -1
- package/dist/pds.d.ts +1 -1
- package/dist/pds.d.ts.map +1 -1
- package/dist/pds.js +29 -84
- package/dist/pds.js.map +1 -1
- package/dist/plc.d.ts +1 -1
- package/dist/plc.d.ts.map +1 -1
- package/dist/plc.js +9 -64
- package/dist/plc.js.map +1 -1
- package/dist/seed/author-feed.d.ts +2 -2
- package/dist/seed/author-feed.d.ts.map +1 -1
- package/dist/seed/author-feed.js +3 -8
- package/dist/seed/author-feed.js.map +1 -1
- package/dist/seed/basic.d.ts +3 -3
- package/dist/seed/basic.d.ts.map +1 -1
- package/dist/seed/basic.js +20 -26
- package/dist/seed/basic.js.map +1 -1
- package/dist/seed/client.d.ts +1 -1
- package/dist/seed/client.d.ts.map +1 -1
- package/dist/seed/client.js +29 -157
- package/dist/seed/client.js.map +1 -1
- package/dist/seed/follows.d.ts +1 -1
- package/dist/seed/follows.d.ts.map +1 -1
- package/dist/seed/follows.js +1 -3
- package/dist/seed/follows.js.map +1 -1
- package/dist/seed/index.d.ts +10 -10
- package/dist/seed/index.d.ts.map +1 -1
- package/dist/seed/index.js +10 -39
- package/dist/seed/index.js.map +1 -1
- package/dist/seed/likes.d.ts +2 -2
- package/dist/seed/likes.d.ts.map +1 -1
- package/dist/seed/likes.js +3 -8
- package/dist/seed/likes.js.map +1 -1
- package/dist/seed/quotes.d.ts +2 -2
- package/dist/seed/quotes.d.ts.map +1 -1
- package/dist/seed/quotes.js +3 -8
- package/dist/seed/quotes.js.map +1 -1
- package/dist/seed/reposts.d.ts +2 -2
- package/dist/seed/reposts.d.ts.map +1 -1
- package/dist/seed/reposts.js +3 -8
- package/dist/seed/reposts.js.map +1 -1
- package/dist/seed/thread-v2.d.ts +30 -30
- package/dist/seed/thread-v2.d.ts.map +1 -1
- package/dist/seed/thread-v2.js +35 -48
- package/dist/seed/thread-v2.js.map +1 -1
- package/dist/seed/users-bulk.d.ts +2 -2
- package/dist/seed/users-bulk.d.ts.map +1 -1
- package/dist/seed/users-bulk.js +3 -5
- package/dist/seed/users-bulk.js.map +1 -1
- package/dist/seed/users.d.ts +2 -2
- package/dist/seed/users.d.ts.map +1 -1
- package/dist/seed/users.js +1 -3
- package/dist/seed/users.js.map +1 -1
- package/dist/seed/verifications.d.ts +2 -2
- package/dist/seed/verifications.d.ts.map +1 -1
- package/dist/seed/verifications.js +3 -5
- package/dist/seed/verifications.js.map +1 -1
- package/dist/service-profile-lexicon.d.ts +2 -2
- package/dist/service-profile-lexicon.d.ts.map +1 -1
- package/dist/service-profile-lexicon.js +2 -6
- package/dist/service-profile-lexicon.js.map +1 -1
- package/dist/service-profile-ozone.d.ts +2 -2
- package/dist/service-profile-ozone.d.ts.map +1 -1
- package/dist/service-profile-ozone.js +6 -20
- package/dist/service-profile-ozone.js.map +1 -1
- package/dist/service-profile.d.ts +1 -1
- package/dist/service-profile.d.ts.map +1 -1
- package/dist/service-profile.js +6 -25
- package/dist/service-profile.js.map +1 -1
- package/dist/types.js +1 -2
- package/dist/util.d.ts +3 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +13 -54
- package/dist/util.js.map +1 -1
- package/package.json +25 -20
- package/src/bin.ts +4 -4
- package/src/bsky.ts +2 -2
- package/src/bsync.ts +1 -1
- package/src/index.ts +14 -14
- package/src/introspect.ts +4 -4
- package/src/mock/index.ts +11 -8
- package/src/moderator-client.ts +2 -1
- package/src/network-no-appview.ts +6 -6
- package/src/network.ts +11 -11
- package/src/ozone.ts +4 -4
- package/src/pds.ts +2 -2
- package/src/plc.ts +1 -1
- package/src/seed/author-feed.ts +2 -2
- package/src/seed/basic.ts +6 -6
- package/src/seed/client.ts +3 -1
- package/src/seed/follows.ts +1 -1
- package/src/seed/index.ts +10 -10
- package/src/seed/likes.ts +2 -2
- package/src/seed/quotes.ts +2 -2
- package/src/seed/reposts.ts +2 -2
- package/src/seed/thread-v2.ts +13 -9
- package/src/seed/users-bulk.ts +1 -1
- package/src/seed/users.ts +1 -1
- package/src/seed/verifications.ts +2 -2
- package/src/service-profile-lexicon.ts +2 -2
- package/src/service-profile-ozone.ts +2 -2
- package/src/service-profile.ts +1 -1
- package/src/util.ts +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atproto/dev-env
|
|
2
2
|
|
|
3
|
+
## 0.5.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), [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9)]:
|
|
20
|
+
- @atproto/bsky@0.0.230-next.0
|
|
21
|
+
- @atproto/bsync@0.0.26-next.0
|
|
22
|
+
- @atproto/ozone@0.1.175-next.0
|
|
23
|
+
- @atproto/pds@0.4.223-next.0
|
|
24
|
+
- @atproto/api@0.20.0-next.0
|
|
25
|
+
- @atproto/common-web@0.5.0-next.0
|
|
26
|
+
- @atproto/crypto@0.5.0-next.0
|
|
27
|
+
- @atproto/identity@0.5.0-next.0
|
|
28
|
+
- @atproto/lex@0.1.0-next.0
|
|
29
|
+
- @atproto/lexicon@0.7.0-next.0
|
|
30
|
+
- @atproto/sync@0.3.0-next.0
|
|
31
|
+
- @atproto/syntax@0.6.0-next.0
|
|
32
|
+
- @atproto/xrpc-server@0.11.0-next.0
|
|
33
|
+
|
|
3
34
|
## 0.4.8
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/bin.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/* eslint-env node */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
5
|
-
|
|
6
|
-
'use strict'
|
|
7
4
|
|
|
8
5
|
// @NOTE This file exists so that pnpm can properly link the "bin" scripts when
|
|
9
6
|
// the monorepo is being setup (during initial "pnpm install"), but was never
|
|
10
7
|
// built.
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
import './dist/bin.js'
|
package/dist/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './env';
|
|
1
|
+
import './env.js';
|
|
2
2
|
//# sourceMappingURL=bin.d.ts.map
|
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAA"}
|
package/dist/bin.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const network_1 = require("./network");
|
|
6
|
-
const util_1 = require("./util");
|
|
1
|
+
import './env.js';
|
|
2
|
+
import { generateMockSetup } from './mock/index.js';
|
|
3
|
+
import { TestNetwork } from './network.js';
|
|
4
|
+
import { mockMailer } from './util.js';
|
|
7
5
|
const run = async () => {
|
|
8
6
|
console.log(`
|
|
9
7
|
██████╗
|
|
@@ -14,7 +12,7 @@ const run = async () => {
|
|
|
14
12
|
╚╝╚═══╝ protocol
|
|
15
13
|
|
|
16
14
|
[ created by Bluesky ]`);
|
|
17
|
-
const network = await
|
|
15
|
+
const network = await TestNetwork.create({
|
|
18
16
|
pds: {
|
|
19
17
|
port: 2583,
|
|
20
18
|
hostname: 'localhost',
|
|
@@ -30,11 +28,11 @@ const run = async () => {
|
|
|
30
28
|
port: 2587,
|
|
31
29
|
chatUrl: 'http://localhost:2590', // must run separate chat service
|
|
32
30
|
chatDid: 'did:example:chat',
|
|
33
|
-
dbMaterializedViewRefreshIntervalMs:
|
|
31
|
+
dbMaterializedViewRefreshIntervalMs: 30_000,
|
|
34
32
|
},
|
|
35
33
|
introspect: { port: 2581 },
|
|
36
34
|
});
|
|
37
|
-
|
|
35
|
+
mockMailer(network.pds);
|
|
38
36
|
if (network.introspect) {
|
|
39
37
|
console.log(`🔍 Dev-env introspection server http://localhost:${network.introspect.port}`);
|
|
40
38
|
}
|
|
@@ -49,7 +47,7 @@ const run = async () => {
|
|
|
49
47
|
for (const fg of network.feedGens) {
|
|
50
48
|
console.log(`🤖 Feed Generator (${fg.did}) http://localhost:${fg.port}`);
|
|
51
49
|
}
|
|
52
|
-
await
|
|
50
|
+
await generateMockSetup(network);
|
|
53
51
|
console.log('✅ Dev environment is ready');
|
|
54
52
|
};
|
|
55
53
|
run();
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAA;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;IACrB,OAAO,CAAC,GAAG,CAAC;;;;;;;;uBAQS,CAAC,CAAA;IAEtB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC;QACvC,GAAG,EAAE;YACH,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,WAAW;YACrB,uBAAuB,EAAE,IAAI;SAC9B;QACD,IAAI,EAAE;YACJ,gBAAgB,EAAE,MAAM;YACxB,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,uBAAuB;SACnC;QACD,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACnB,KAAK,EAAE;YACL,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,uBAAuB,EAAE,iCAAiC;YACn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sBAAsB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAEhC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;AAC3C,CAAC,CAAA;AAED,GAAG,EAAE,CAAA","sourcesContent":["import './env.js'\nimport { generateMockSetup } from './mock/index.js'\nimport { TestNetwork } from './network.js'\nimport { mockMailer } from './util.js'\n\nconst run = async () => {\n console.log(`\n██████╗\n██╔═══██╗\n██║██╗██║\n██║██║██║\n╚█║████╔╝\n ╚╝╚═══╝ protocol\n\n[ created by Bluesky ]`)\n\n const network = await TestNetwork.create({\n pds: {\n port: 2583,\n hostname: 'localhost',\n enableDidDocWithSession: true,\n },\n bsky: {\n dbPostgresSchema: 'bsky',\n port: 2584,\n publicUrl: 'http://localhost:2584',\n },\n plc: { port: 2582 },\n ozone: {\n port: 2587,\n chatUrl: 'http://localhost:2590', // must run separate chat service\n chatDid: 'did:example:chat',\n dbMaterializedViewRefreshIntervalMs: 30_000,\n },\n introspect: { port: 2581 },\n })\n mockMailer(network.pds)\n\n if (network.introspect) {\n console.log(\n `🔍 Dev-env introspection server http://localhost:${network.introspect.port}`,\n )\n }\n console.log(`👤 DID Placeholder server http://localhost:${network.plc.port}`)\n console.log(`🌞 Main PDS http://localhost:${network.pds.port}`)\n console.log(`🌞 Main PDS account DB`, network.pds.ctx.cfg.db.accountDbLoc)\n console.log(\n `🔨 Lexicon authority DID ${network.pds.ctx.cfg.lexicon.didAuthority}`,\n )\n console.log(`🗼 Ozone server http://localhost:${network.ozone.port}`)\n console.log(`🗼 Ozone service DID ${network.ozone.ctx.cfg.service.did}`)\n console.log(`🌅 Bsky Appview http://localhost:${network.bsky.port}`)\n console.log(`🌅 Bsky Appview DID ${network.bsky.serverDid}`)\n for (const fg of network.feedGens) {\n console.log(`🤖 Feed Generator (${fg.did}) http://localhost:${fg.port}`)\n }\n\n await generateMockSetup(network)\n\n console.log('✅ Dev environment is ready')\n}\n\nrun()\n"]}
|
package/dist/bsky.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AtpAgent } from '@atproto/api';
|
|
2
2
|
import * as bsky from '@atproto/bsky';
|
|
3
3
|
import { Client } from '@atproto/lex';
|
|
4
|
-
import { BskyConfig } from './types';
|
|
4
|
+
import { BskyConfig } from './types.js';
|
|
5
5
|
export * from '@atproto/bsky';
|
|
6
6
|
export declare class TestBsky {
|
|
7
7
|
url: string;
|
package/dist/bsky.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bsky.d.ts","sourceRoot":"","sources":["../src/bsky.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bsky.d.ts","sourceRoot":"","sources":["../src/bsky.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,cAAc,eAAe,CAAA;AAE7B,qBAAa,QAAQ;IAEV,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,IAAI,CAAC,QAAQ;IACjB,MAAM,EAAE,IAAI,CAAC,WAAW;IACxB,SAAS,EAAE,IAAI,CAAC,eAAe;IAC/B,KAAK,EAAE,IAAI,CAAC,SAAS;IACrB,GAAG,EAAE,IAAI,CAAC,gBAAgB;IAC1B,SAAS,EAAE,MAAM;gBAPjB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,IAAI,CAAC,QAAQ,EACjB,MAAM,EAAE,IAAI,CAAC,WAAW,EACxB,SAAS,EAAE,IAAI,CAAC,eAAe,EAC/B,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAC1B,SAAS,EAAE,MAAM;WAGb,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IA0GvD,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAEzB;IAED,QAAQ,IAAI,QAAQ;IAMpB,SAAS,IAAI,MAAM;IAMnB,SAAS,IAAI,MAAM;IAQnB,gBAAgB;;;IAMV,KAAK;CAOZ"}
|
package/dist/bsky.js
CHANGED
|
@@ -1,111 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.TestBsky = void 0;
|
|
43
|
-
const lib_1 = require("@did-plc/lib");
|
|
44
|
-
const get_port_1 = __importDefault(require("get-port"));
|
|
45
|
-
const ui8 = __importStar(require("uint8arrays"));
|
|
46
|
-
const api_1 = require("@atproto/api");
|
|
47
|
-
const bsky = __importStar(require("@atproto/bsky"));
|
|
48
|
-
const crypto_1 = require("@atproto/crypto");
|
|
49
|
-
const lex_1 = require("@atproto/lex");
|
|
50
|
-
const const_1 = require("./const");
|
|
51
|
-
__exportStar(require("@atproto/bsky"), exports);
|
|
52
|
-
class TestBsky {
|
|
1
|
+
import { Client as PlcClient } from '@did-plc/lib';
|
|
2
|
+
import getPort from 'get-port';
|
|
3
|
+
import * as ui8 from 'uint8arrays';
|
|
4
|
+
import { AtpAgent } from '@atproto/api';
|
|
5
|
+
import * as bsky from '@atproto/bsky';
|
|
6
|
+
import { Secp256k1Keypair } from '@atproto/crypto';
|
|
7
|
+
import { Client } from '@atproto/lex';
|
|
8
|
+
import { ADMIN_PASSWORD, EXAMPLE_LABELER } from './const.js';
|
|
9
|
+
export * from '@atproto/bsky';
|
|
10
|
+
export class TestBsky {
|
|
53
11
|
constructor(url, port, db, server, dataplane, bsync, sub, serverDid) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
configurable: true,
|
|
63
|
-
writable: true,
|
|
64
|
-
value: port
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(this, "db", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
writable: true,
|
|
70
|
-
value: db
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(this, "server", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
configurable: true,
|
|
75
|
-
writable: true,
|
|
76
|
-
value: server
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(this, "dataplane", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
configurable: true,
|
|
81
|
-
writable: true,
|
|
82
|
-
value: dataplane
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(this, "bsync", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
configurable: true,
|
|
87
|
-
writable: true,
|
|
88
|
-
value: bsync
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(this, "sub", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
configurable: true,
|
|
93
|
-
writable: true,
|
|
94
|
-
value: sub
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(this, "serverDid", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
configurable: true,
|
|
99
|
-
writable: true,
|
|
100
|
-
value: serverDid
|
|
101
|
-
});
|
|
12
|
+
this.url = url;
|
|
13
|
+
this.port = port;
|
|
14
|
+
this.db = db;
|
|
15
|
+
this.server = server;
|
|
16
|
+
this.dataplane = dataplane;
|
|
17
|
+
this.bsync = bsync;
|
|
18
|
+
this.sub = sub;
|
|
19
|
+
this.serverDid = serverDid;
|
|
102
20
|
}
|
|
103
21
|
static async create(cfg) {
|
|
104
22
|
const serviceKeypair = cfg.privateKey
|
|
105
|
-
? await
|
|
106
|
-
: await
|
|
107
|
-
const plcClient = new
|
|
108
|
-
const port = cfg.port || (await (
|
|
23
|
+
? await Secp256k1Keypair.import(cfg.privateKey)
|
|
24
|
+
: await Secp256k1Keypair.create();
|
|
25
|
+
const plcClient = new PlcClient(cfg.plcUrl);
|
|
26
|
+
const port = cfg.port || (await getPort());
|
|
109
27
|
const url = `http://localhost:${port}`;
|
|
110
28
|
const serverDid = await plcClient.createDid({
|
|
111
29
|
signingKey: serviceKeypair.did(),
|
|
@@ -132,9 +50,9 @@ class TestBsky {
|
|
|
132
50
|
schema: cfg.dbPostgresSchema,
|
|
133
51
|
poolSize: 10,
|
|
134
52
|
});
|
|
135
|
-
const dataplanePort = await (
|
|
53
|
+
const dataplanePort = await getPort();
|
|
136
54
|
const dataplane = await bsky.DataPlaneServer.create(db, dataplanePort, cfg.plcUrl);
|
|
137
|
-
const bsyncPort = await (
|
|
55
|
+
const bsyncPort = await getPort();
|
|
138
56
|
const bsync = await bsky.MockBsync.create(db, bsyncPort);
|
|
139
57
|
const config = new bsky.ServerConfig({
|
|
140
58
|
version: 'unknown',
|
|
@@ -148,7 +66,7 @@ class TestBsky {
|
|
|
148
66
|
bsyncUrl: `http://localhost:${bsyncPort}`,
|
|
149
67
|
bsyncHttpVersion: '1.1',
|
|
150
68
|
modServiceDid: cfg.modServiceDid ?? 'did:example:invalidMod',
|
|
151
|
-
labelsFromIssuerDids: [
|
|
69
|
+
labelsFromIssuerDids: [EXAMPLE_LABELER],
|
|
152
70
|
bigThreadUris: new Set(),
|
|
153
71
|
maxThreadParents: cfg.maxThreadParents ?? 50,
|
|
154
72
|
disableSsrfProtection: true,
|
|
@@ -160,7 +78,7 @@ class TestBsky {
|
|
|
160
78
|
debugFieldAllowedDids: new Set(),
|
|
161
79
|
draftsLimit: 500,
|
|
162
80
|
...cfg,
|
|
163
|
-
adminPasswords: [
|
|
81
|
+
adminPasswords: [ADMIN_PASSWORD],
|
|
164
82
|
etcdHosts: [],
|
|
165
83
|
});
|
|
166
84
|
// Separate migration db in case migration changes some connection state that we need in the tests, e.g. "alter database ... set ..."
|
|
@@ -193,13 +111,13 @@ class TestBsky {
|
|
|
193
111
|
return this.server.ctx;
|
|
194
112
|
}
|
|
195
113
|
getAgent() {
|
|
196
|
-
const agent = new
|
|
197
|
-
agent.configureLabelers([
|
|
114
|
+
const agent = new AtpAgent({ service: this.url });
|
|
115
|
+
agent.configureLabelers([EXAMPLE_LABELER]);
|
|
198
116
|
return agent;
|
|
199
117
|
}
|
|
200
118
|
getClient() {
|
|
201
|
-
const client = new
|
|
202
|
-
client.setLabelers([
|
|
119
|
+
const client = new Client({ service: this.url });
|
|
120
|
+
client.setLabelers([EXAMPLE_LABELER]);
|
|
203
121
|
return client;
|
|
204
122
|
}
|
|
205
123
|
adminAuth() {
|
|
@@ -220,5 +138,4 @@ class TestBsky {
|
|
|
220
138
|
await this.db.close();
|
|
221
139
|
}
|
|
222
140
|
}
|
|
223
|
-
exports.TestBsky = TestBsky;
|
|
224
141
|
//# sourceMappingURL=bsky.js.map
|
package/dist/bsky.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bsky.js","sourceRoot":"","sources":["../src/bsky.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bsky.js","sourceRoot":"","sources":["../src/bsky.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5D,cAAc,eAAe,CAAA;AAE7B,MAAM,OAAO,QAAQ;IACnB,YACS,GAAW,EACX,IAAY,EACZ,EAAiB,EACjB,MAAwB,EACxB,SA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MAAM,CAAC,GAAG,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;QACjD,KAAK,CAAC,iBAAiB,CAAC,CAAC,eAAe,CAAC,CAAC,CAAA;QAC1C,OAAO,KAAK,CAAA;IACd,CAAC;IAED,SAAS;QACP,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;QAChD,MAAM,CAAC,WAAW,CAAC,CAAC,eAAe,CAAC,CAAC,CAAA;QACrC,OAAO,MAAM,CAAA;IACf,CAAC;IAED,SAAS;QACP,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAA;QAC9C,OAAO,CACL,QAAQ;YACR,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,QAAQ,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,CAAC,CACvE,CAAA;IACH,CAAC;IAED,gBAAgB;QACd,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,SAAS,EAAE;SAChC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;QAC3B,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAA;QAC1B,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;QAC9B,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;QACxB,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;CACF","sourcesContent":["import { Client as PlcClient } from '@did-plc/lib'\nimport getPort from 'get-port'\nimport * as ui8 from 'uint8arrays'\nimport { AtpAgent } from '@atproto/api'\nimport * as bsky from '@atproto/bsky'\nimport { Secp256k1Keypair } from '@atproto/crypto'\nimport { Client } from '@atproto/lex'\nimport { ADMIN_PASSWORD, EXAMPLE_LABELER } from './const.js'\nimport { BskyConfig } from './types.js'\nexport * from '@atproto/bsky'\n\nexport class TestBsky {\n constructor(\n public url: string,\n public port: number,\n public db: bsky.Database,\n public server: bsky.BskyAppView,\n public dataplane: bsky.DataPlaneServer,\n public bsync: bsky.MockBsync,\n public sub: bsky.RepoSubscription,\n public serverDid: string,\n ) {}\n\n static async create(cfg: BskyConfig): Promise<TestBsky> {\n const serviceKeypair = cfg.privateKey\n ? await Secp256k1Keypair.import(cfg.privateKey)\n : await Secp256k1Keypair.create()\n const plcClient = new PlcClient(cfg.plcUrl)\n\n const port = cfg.port || (await getPort())\n const url = `http://localhost:${port}`\n const serverDid = await plcClient.createDid({\n signingKey: serviceKeypair.did(),\n rotationKeys: [serviceKeypair.did()],\n handle: 'bsky.test',\n pds: `http://localhost:${port}`,\n signer: serviceKeypair,\n })\n\n const endpoint = `http://localhost:${port}`\n\n await plcClient.updateData(serverDid, serviceKeypair, (x) => {\n x.services['bsky_notif'] = {\n type: 'BskyNotificationService',\n endpoint,\n }\n x.services['bsky_appview'] = {\n type: 'BskyAppView',\n endpoint,\n }\n return x\n })\n\n // shared across server, ingester, and indexer in order to share pool, avoid too many pg connections.\n const db = new bsky.Database({\n url: cfg.dbPostgresUrl,\n schema: cfg.dbPostgresSchema,\n poolSize: 10,\n })\n\n const dataplanePort = await getPort()\n const dataplane = await bsky.DataPlaneServer.create(\n db,\n dataplanePort,\n cfg.plcUrl,\n )\n\n const bsyncPort = await getPort()\n const bsync = await bsky.MockBsync.create(db, bsyncPort)\n\n const config = new bsky.ServerConfig({\n version: 'unknown',\n port,\n didPlcUrl: cfg.plcUrl,\n publicUrl: 'https://bsky.public.url',\n serverDid,\n alternateAudienceDids: [],\n dataplaneUrls: [`http://localhost:${dataplanePort}`],\n dataplaneHttpVersion: '1.1',\n bsyncUrl: `http://localhost:${bsyncPort}`,\n bsyncHttpVersion: '1.1',\n modServiceDid: cfg.modServiceDid ?? 'did:example:invalidMod',\n labelsFromIssuerDids: [EXAMPLE_LABELER],\n bigThreadUris: new Set(),\n maxThreadParents: cfg.maxThreadParents ?? 50,\n disableSsrfProtection: true,\n searchTagsHide: new Set(),\n threadTagsBumpDown: new Set(),\n threadTagsHide: new Set(),\n visibilityTagHide: '',\n visibilityTagRankPrefix: '',\n debugFieldAllowedDids: new Set(),\n draftsLimit: 500,\n ...cfg,\n adminPasswords: [ADMIN_PASSWORD],\n etcdHosts: [],\n })\n\n // Separate migration db in case migration changes some connection state that we need in the tests, e.g. \"alter database ... set ...\"\n const migrationDb = new bsky.Database({\n url: cfg.dbPostgresUrl,\n schema: cfg.dbPostgresSchema,\n })\n if (cfg.migration) {\n await migrationDb.migrateToOrThrow(cfg.migration)\n } else {\n await migrationDb.migrateToLatestOrThrow()\n }\n await migrationDb.close()\n\n // api server\n const server = bsky.BskyAppView.create({\n config,\n signingKey: serviceKeypair,\n })\n\n const sub = new bsky.RepoSubscription({\n service: cfg.repoProvider,\n db,\n idResolver: dataplane.idResolver,\n })\n\n await server.start()\n\n sub.start()\n\n return new TestBsky(url, port, db, server, dataplane, bsync, sub, serverDid)\n }\n\n get ctx(): bsky.AppContext {\n return this.server.ctx\n }\n\n getAgent(): AtpAgent {\n const agent = new AtpAgent({ service: this.url })\n agent.configureLabelers([EXAMPLE_LABELER])\n return agent\n }\n\n getClient(): Client {\n const client = new Client({ service: this.url })\n client.setLabelers([EXAMPLE_LABELER])\n return client\n }\n\n adminAuth(): string {\n const [password] = this.ctx.cfg.adminPasswords\n return (\n 'Basic ' +\n ui8.toString(ui8.fromString(`admin:${password}`, 'utf8'), 'base64pad')\n )\n }\n\n adminAuthHeaders() {\n return {\n authorization: this.adminAuth(),\n }\n }\n\n async close() {\n await this.server.destroy()\n await this.bsync.destroy()\n await this.dataplane.destroy()\n await this.sub.destroy()\n await this.db.close()\n }\n}\n"]}
|
package/dist/bsync.d.ts
CHANGED
package/dist/bsync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bsync.d.ts","sourceRoot":"","sources":["../src/bsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bsync.d.ts","sourceRoot":"","sources":["../src/bsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,qBAAa,SAAS;IAEX,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,KAAK,CAAC,YAAY;gBAF3B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,CAAC,YAAY;WAGvB,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAiBzD,IAAI,GAAG,IAAI,KAAK,CAAC,UAAU,CAE1B;IAEK,KAAK;CAGZ"}
|
package/dist/bsync.js
CHANGED
|
@@ -1,67 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TestBsync = void 0;
|
|
40
|
-
const get_port_1 = __importDefault(require("get-port"));
|
|
41
|
-
const bsync = __importStar(require("@atproto/bsync"));
|
|
42
|
-
class TestBsync {
|
|
1
|
+
import getPort from 'get-port';
|
|
2
|
+
import * as bsync from '@atproto/bsync';
|
|
3
|
+
export class TestBsync {
|
|
43
4
|
constructor(url, port, service) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
writable: true,
|
|
48
|
-
value: url
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(this, "port", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: port
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(this, "service", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
configurable: true,
|
|
59
|
-
writable: true,
|
|
60
|
-
value: service
|
|
61
|
-
});
|
|
5
|
+
this.url = url;
|
|
6
|
+
this.port = port;
|
|
7
|
+
this.service = service;
|
|
62
8
|
}
|
|
63
9
|
static async create(cfg) {
|
|
64
|
-
const port = cfg.port || (await (
|
|
10
|
+
const port = cfg.port || (await getPort());
|
|
65
11
|
const url = `http://localhost:${port}`;
|
|
66
12
|
const config = bsync.envToCfg({
|
|
67
13
|
port,
|
|
@@ -80,5 +26,4 @@ class TestBsync {
|
|
|
80
26
|
await this.service.destroy();
|
|
81
27
|
}
|
|
82
28
|
}
|
|
83
|
-
exports.TestBsync = TestBsync;
|
|
84
29
|
//# sourceMappingURL=bsync.js.map
|
package/dist/bsync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bsync.js","sourceRoot":"","sources":["../src/bsync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bsync.js","sourceRoot":"","sources":["../src/bsync.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAGvC,MAAM,OAAO,SAAS;IACpB,YACS,GAAW,EACX,IAAY,EACZ,OAA2B;QAF3B,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAoB;IACjC,CAAC;IAEJ,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAgB;QAClC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,OAAO,EAAE,CAAC,CAAA;QAC1C,MAAM,GAAG,GAAG,oBAAoB,IAAI,EAAE,CAAA;QAEtC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC5B,IAAI;YACJ,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC;YACnC,GAAG,GAAG;SACP,CAAC,CAAA;QAEF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACvD,MAAM,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,sBAAsB,EAAE,CAAA;QAC7C,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QAErB,OAAO,IAAI,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import getPort from 'get-port'\nimport * as bsync from '@atproto/bsync'\nimport { BsyncConfig } from './types.js'\n\nexport class TestBsync {\n constructor(\n public url: string,\n public port: number,\n public service: bsync.BsyncService,\n ) {}\n\n static async create(cfg: BsyncConfig): Promise<TestBsync> {\n const port = cfg.port || (await getPort())\n const url = `http://localhost:${port}`\n\n const config = bsync.envToCfg({\n port,\n apiKeys: cfg.apiKeys ?? ['api-key'],\n ...cfg,\n })\n\n const service = await bsync.BsyncService.create(config)\n await service.ctx.db.migrateToLatestOrThrow()\n await service.start()\n\n return new TestBsync(url, port, service)\n }\n\n get ctx(): bsync.AppContext {\n return this.service.ctx\n }\n\n async close() {\n await this.service.destroy()\n }\n}\n"]}
|
package/dist/const.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.ADMIN_PASSWORD = 'admin-pass';
|
|
5
|
-
exports.JWT_SECRET = 'jwt-secret';
|
|
6
|
-
exports.EXAMPLE_LABELER = 'did:example:labeler';
|
|
1
|
+
export const ADMIN_PASSWORD = 'admin-pass';
|
|
2
|
+
export const JWT_SECRET = 'jwt-secret';
|
|
3
|
+
export const EXAMPLE_LABELER = 'did:example:labeler';
|
|
7
4
|
//# sourceMappingURL=const.js.map
|
package/dist/const.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAA;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAA","sourcesContent":["export const ADMIN_PASSWORD = 'admin-pass'\nexport const JWT_SECRET = 'jwt-secret'\nexport const EXAMPLE_LABELER = 'did:example:labeler'\n"]}
|
package/dist/env.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
1
|
// NOTE: this file should be imported first, particularly before `@atproto/common` (for logging), to ensure that environment variables are respected in library code
|
|
7
|
-
|
|
2
|
+
import dotenv from 'dotenv';
|
|
8
3
|
const env = process.env.ENV;
|
|
9
4
|
if (env) {
|
|
10
|
-
|
|
5
|
+
dotenv.config({ path: `./.${env}.env` });
|
|
11
6
|
}
|
|
12
7
|
else {
|
|
13
|
-
|
|
8
|
+
dotenv.config();
|
|
14
9
|
}
|
|
15
10
|
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,oKAAoK;AACpK,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAA;AAC3B,IAAI,GAAG,EAAE,CAAC;IACR,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;AAC1C,CAAC;KAAM,CAAC;IACN,MAAM,CAAC,MAAM,EAAE,CAAA;AACjB,CAAC","sourcesContent":["// NOTE: this file should be imported first, particularly before `@atproto/common` (for logging), to ensure that environment variables are respected in library code\nimport dotenv from 'dotenv'\n\nconst env = process.env.ENV\nif (env) {\n dotenv.config({ path: `./.${env}.env` })\n} else {\n dotenv.config()\n}\n"]}
|