@atproto/bsync 0.0.0-spaces-alpha-20260818021221
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 +339 -0
- package/LICENSE.txt +7 -0
- package/README.md +15 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +12 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +37 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +45 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +25 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +21 -0
- package/dist/context.js.map +1 -0
- package/dist/db/index.d.ts +32 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +150 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations/20240108T220751294Z-init.d.ts +4 -0
- package/dist/db/migrations/20240108T220751294Z-init.d.ts.map +1 -0
- package/dist/db/migrations/20240108T220751294Z-init.js +23 -0
- package/dist/db/migrations/20240108T220751294Z-init.js.map +1 -0
- package/dist/db/migrations/20240717T224303472Z-notif-ops.d.ts +4 -0
- package/dist/db/migrations/20240717T224303472Z-notif-ops.d.ts.map +1 -0
- package/dist/db/migrations/20240717T224303472Z-notif-ops.js +21 -0
- package/dist/db/migrations/20240717T224303472Z-notif-ops.js.map +1 -0
- package/dist/db/migrations/20250527T022203400Z-add-operation.d.ts +4 -0
- package/dist/db/migrations/20250527T022203400Z-add-operation.d.ts.map +1 -0
- package/dist/db/migrations/20250527T022203400Z-add-operation.js +17 -0
- package/dist/db/migrations/20250527T022203400Z-add-operation.js.map +1 -0
- package/dist/db/migrations/20250603T163446567Z-alter-operation.d.ts +4 -0
- package/dist/db/migrations/20250603T163446567Z-alter-operation.d.ts.map +1 -0
- package/dist/db/migrations/20250603T163446567Z-alter-operation.js +15 -0
- package/dist/db/migrations/20250603T163446567Z-alter-operation.js.map +1 -0
- package/dist/db/migrations/20260618T200000000Z-add-mute-scope.d.ts +4 -0
- package/dist/db/migrations/20260618T200000000Z-add-mute-scope.d.ts.map +1 -0
- package/dist/db/migrations/20260618T200000000Z-add-mute-scope.js +27 -0
- package/dist/db/migrations/20260618T200000000Z-add-mute-scope.js.map +1 -0
- package/dist/db/migrations/index.d.ts +6 -0
- package/dist/db/migrations/index.d.ts.map +1 -0
- package/dist/db/migrations/index.js +9 -0
- package/dist/db/migrations/index.js.map +1 -0
- package/dist/db/migrations/provider.d.ts +7 -0
- package/dist/db/migrations/provider.d.ts.map +1 -0
- package/dist/db/migrations/provider.js +9 -0
- package/dist/db/migrations/provider.js.map +1 -0
- package/dist/db/schema/index.d.ts +9 -0
- package/dist/db/schema/index.d.ts.map +1 -0
- package/dist/db/schema/index.js +2 -0
- package/dist/db/schema/index.js.map +1 -0
- package/dist/db/schema/mute_item.d.ts +14 -0
- package/dist/db/schema/mute_item.d.ts.map +1 -0
- package/dist/db/schema/mute_item.js +2 -0
- package/dist/db/schema/mute_item.js.map +1 -0
- package/dist/db/schema/mute_op.d.ts +18 -0
- package/dist/db/schema/mute_op.d.ts.map +1 -0
- package/dist/db/schema/mute_op.js +3 -0
- package/dist/db/schema/mute_op.js.map +1 -0
- package/dist/db/schema/notif_item.d.ts +12 -0
- package/dist/db/schema/notif_item.d.ts.map +1 -0
- package/dist/db/schema/notif_item.js +2 -0
- package/dist/db/schema/notif_item.js.map +1 -0
- package/dist/db/schema/notif_op.d.ts +14 -0
- package/dist/db/schema/notif_op.d.ts.map +1 -0
- package/dist/db/schema/notif_op.js +3 -0
- package/dist/db/schema/notif_op.js.map +1 -0
- package/dist/db/schema/operation.d.ts +18 -0
- package/dist/db/schema/operation.d.ts.map +1 -0
- package/dist/db/schema/operation.js +3 -0
- package/dist/db/schema/operation.js.map +1 -0
- package/dist/db/types.d.ts +15 -0
- package/dist/db/types.d.ts.map +1 -0
- package/dist/db/types.js +2 -0
- package/dist/db/types.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +22 -0
- package/dist/logger.js.map +1 -0
- package/dist/proto/bsync_connect.d.ts +87 -0
- package/dist/proto/bsync_connect.d.ts.map +1 -0
- package/dist/proto/bsync_connect.js +91 -0
- package/dist/proto/bsync_connect.js.map +1 -0
- package/dist/proto/bsync_pb.d.ts +481 -0
- package/dist/proto/bsync_pb.d.ts.map +1 -0
- package/dist/proto/bsync_pb.js +751 -0
- package/dist/proto/bsync_pb.js.map +1 -0
- package/dist/routes/add-mute-operation.d.ts +6 -0
- package/dist/routes/add-mute-operation.d.ts.map +1 -0
- package/dist/routes/add-mute-operation.js +128 -0
- package/dist/routes/add-mute-operation.js.map +1 -0
- package/dist/routes/add-notif-operation.d.ts +6 -0
- package/dist/routes/add-notif-operation.d.ts.map +1 -0
- package/dist/routes/add-notif-operation.js +61 -0
- package/dist/routes/add-notif-operation.js.map +1 -0
- package/dist/routes/auth.d.ts +4 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +13 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/delete-operations.d.ts +6 -0
- package/dist/routes/delete-operations.d.ts.map +1 -0
- package/dist/routes/delete-operations.js +36 -0
- package/dist/routes/delete-operations.js.map +1 -0
- package/dist/routes/index.d.ts +5 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +26 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/put-operation.d.ts +6 -0
- package/dist/routes/put-operation.d.ts.map +1 -0
- package/dist/routes/put-operation.js +78 -0
- package/dist/routes/put-operation.js.map +1 -0
- package/dist/routes/scan-mute-operations.d.ts +6 -0
- package/dist/routes/scan-mute-operations.d.ts.map +1 -0
- package/dist/routes/scan-mute-operations.js +57 -0
- package/dist/routes/scan-mute-operations.js.map +1 -0
- package/dist/routes/scan-notif-operations.d.ts +6 -0
- package/dist/routes/scan-notif-operations.d.ts.map +1 -0
- package/dist/routes/scan-notif-operations.js +54 -0
- package/dist/routes/scan-notif-operations.js.map +1 -0
- package/dist/routes/scan-operations.d.ts +6 -0
- package/dist/routes/scan-operations.d.ts.map +1 -0
- package/dist/routes/scan-operations.js +57 -0
- package/dist/routes/scan-operations.js.map +1 -0
- package/dist/routes/util.d.ts +6 -0
- package/dist/routes/util.d.ts.map +1 -0
- package/dist/routes/util.js +58 -0
- package/dist/routes/util.js.map +1 -0
- package/package.json +61 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# @atproto/bsync
|
|
2
|
+
|
|
3
|
+
## 0.0.0-spaces-alpha-20260818021221
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`2f77206`](https://github.com/bluesky-social/atproto/commit/2f77206ff8010710db5733c454abff9eb5ebb96b)]:
|
|
8
|
+
- @atproto/common@0.0.0-spaces-alpha-20260818021221
|
|
9
|
+
- @atproto/syntax@0.0.0-spaces-alpha-20260818021221
|
|
10
|
+
|
|
11
|
+
## 0.0.40
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`b66870d`](https://github.com/bluesky-social/atproto/commit/b66870d5a1efbcfa0cc07498c7cfcf3f0f243e86), [`b66870d`](https://github.com/bluesky-social/atproto/commit/b66870d5a1efbcfa0cc07498c7cfcf3f0f243e86)]:
|
|
16
|
+
- @atproto/common@0.7.6
|
|
17
|
+
|
|
18
|
+
## 0.0.39
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#5340](https://github.com/bluesky-social/atproto/pull/5340) [`8145a99`](https://github.com/bluesky-social/atproto/commit/8145a999e03219e846ae4773ec66f0de72939511) Thanks [@43081j](https://github.com/43081j)! - Remove typed-emitter and use built-in strongly typed `EventEmitter`
|
|
23
|
+
|
|
24
|
+
- [#5327](https://github.com/bluesky-social/atproto/pull/5327) [`c677bf3`](https://github.com/bluesky-social/atproto/commit/c677bf393d666bd20fc89c7386448f06375aba9c) Thanks [@rafaeleyng](https://github.com/rafaeleyng)! - Update bsync service image
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`8b55a4a`](https://github.com/bluesky-social/atproto/commit/8b55a4ab69c24e5038f67c479b3b9953666ea0c2)]:
|
|
27
|
+
- @atproto/syntax@0.7.4
|
|
28
|
+
- @atproto/common@0.7.5
|
|
29
|
+
|
|
30
|
+
## 0.0.38
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#5301](https://github.com/bluesky-social/atproto/pull/5301) [`8c07338`](https://github.com/bluesky-social/atproto/commit/8c07338232aa69427aa65322a555f70e0211d6d7) Thanks [@43081j](https://github.com/43081j)! - Switch from destructured default imports to named imports of CommonJS dependencies.
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`6a3d607`](https://github.com/bluesky-social/atproto/commit/6a3d6073cb66c527b5b109242049c85c36b9658c)]:
|
|
37
|
+
- @atproto/syntax@0.7.3
|
|
38
|
+
- @atproto/common@0.7.4
|
|
39
|
+
|
|
40
|
+
## 0.0.37
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Updated dependencies []:
|
|
45
|
+
- @atproto/common@0.7.3
|
|
46
|
+
|
|
47
|
+
## 0.0.36
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [[`9e1da84`](https://github.com/bluesky-social/atproto/commit/9e1da84cc00a1cc5b453705539a2766403f3ee55)]:
|
|
52
|
+
- @atproto/syntax@0.7.2
|
|
53
|
+
- @atproto/common@0.7.2
|
|
54
|
+
|
|
55
|
+
## 0.0.35
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- [#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.
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [[`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f)]:
|
|
62
|
+
- @atproto/common@0.7.1
|
|
63
|
+
- @atproto/syntax@0.7.1
|
|
64
|
+
|
|
65
|
+
## 0.0.34
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`d1be0ce`](https://github.com/bluesky-social/atproto/commit/d1be0cead444ef95e64cac5ea5318edbec9d8112), [`d1be0ce`](https://github.com/bluesky-social/atproto/commit/d1be0cead444ef95e64cac5ea5318edbec9d8112), [`d79f6d5`](https://github.com/bluesky-social/atproto/commit/d79f6d59a073c05cc37bd0d1482beeea482b67ed)]:
|
|
70
|
+
- @atproto/syntax@0.7.0
|
|
71
|
+
- @atproto/common@0.7.0
|
|
72
|
+
|
|
73
|
+
## 0.0.33
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- [#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
|
|
78
|
+
|
|
79
|
+
- [#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).
|
|
80
|
+
|
|
81
|
+
- [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Build with `noImplicitAny` enabled
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [[`28a0b58`](https://github.com/bluesky-social/atproto/commit/28a0b588147863eaef948cd2bb8fc0f19d08cda9), [`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), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07)]:
|
|
84
|
+
- @atproto/syntax@0.6.4
|
|
85
|
+
- @atproto/common@0.6.5
|
|
86
|
+
|
|
87
|
+
## 0.0.32
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- [#4179](https://github.com/bluesky-social/atproto/pull/4179) [`85c25ef`](https://github.com/bluesky-social/atproto/commit/85c25efde14c1d0383f32bba21b21bdad2ae2619) Thanks [@rafaeleyng](https://github.com/rafaeleyng)! - Subscribe to the real bsync service in dev-env instead of using a mock, with a `BsyncSubscription` on the bsky dataplane that consumes the mute, notif, and operation streams. Supports immediate shutdown (aborting in-flight long-polls) and cursor-based draining so tests stay fast.
|
|
92
|
+
|
|
93
|
+
## 0.0.31
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- [#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
|
|
98
|
+
|
|
99
|
+
- [#5149](https://github.com/bluesky-social/atproto/pull/5149) [`f2cf8f7`](https://github.com/bluesky-social/atproto/commit/f2cf8f7fc5f3a10847f2e6d785e5fa2244ee8cfb) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update `pino` logger to version 10
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [[`f2cf8f7`](https://github.com/bluesky-social/atproto/commit/f2cf8f7fc5f3a10847f2e6d785e5fa2244ee8cfb), [`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7), [`f2cf8f7`](https://github.com/bluesky-social/atproto/commit/f2cf8f7fc5f3a10847f2e6d785e5fa2244ee8cfb)]:
|
|
102
|
+
- @atproto/common@0.6.4
|
|
103
|
+
- @atproto/syntax@0.6.3
|
|
104
|
+
|
|
105
|
+
## 0.0.30
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- [#5117](https://github.com/bluesky-social/atproto/pull/5117) [`8a4c88b`](https://github.com/bluesky-social/atproto/commit/8a4c88b0f63fb2d82b1391d64c54e0c760fac48b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use http-terminator to close http server
|
|
110
|
+
|
|
111
|
+
## 0.0.29
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- [#5086](https://github.com/bluesky-social/atproto/pull/5086) [`20665c1`](https://github.com/bluesky-social/atproto/commit/20665c18322effe648f73d70fc1a8dcc7e312992) Thanks [@devinivy](https://github.com/devinivy)! - Upgrade kysely from 0.22 to 0.29
|
|
116
|
+
|
|
117
|
+
## 0.0.28
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- [#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
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5)]:
|
|
124
|
+
- @atproto/common@0.6.3
|
|
125
|
+
- @atproto/syntax@0.6.2
|
|
126
|
+
|
|
127
|
+
## 0.0.27
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- [#4964](https://github.com/bluesky-social/atproto/pull/4964) [`571582e`](https://github.com/bluesky-social/atproto/commit/571582ea9b1aea56938b8f24daaf49e197a987ef) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove proto buf generated code from version control
|
|
132
|
+
|
|
133
|
+
- [#4960](https://github.com/bluesky-social/atproto/pull/4960) [`53b1e07`](https://github.com/bluesky-social/atproto/commit/53b1e0731ee0d13c350dd96cbcab88447eaad441) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update protobuf to add `.js` extension
|
|
134
|
+
|
|
135
|
+
- Updated dependencies [[`e6c6343`](https://github.com/bluesky-social/atproto/commit/e6c6343bd3727455bd0da12300bb4929a944e4f1)]:
|
|
136
|
+
- @atproto/common@0.6.1
|
|
137
|
+
|
|
138
|
+
## 0.0.26
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- [#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.
|
|
143
|
+
|
|
144
|
+
- [#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.
|
|
145
|
+
|
|
146
|
+
Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
|
|
147
|
+
|
|
148
|
+
- [#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.
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [[`affb50c`](https://github.com/bluesky-social/atproto/commit/affb50c040b497a12631df99a6310f8e78cab557), [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9), [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705)]:
|
|
151
|
+
- @atproto/common@0.6.0
|
|
152
|
+
- @atproto/syntax@0.6.0
|
|
153
|
+
|
|
154
|
+
## 0.0.25
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- [#4745](https://github.com/bluesky-social/atproto/pull/4745) [`efb2b58`](https://github.com/bluesky-social/atproto/commit/efb2b58fb27a242d5308bf15916ee222daa2019b) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Add `delete-operations` file and new `deleteOperationsByActorAndNamespace` handler
|
|
159
|
+
|
|
160
|
+
- Updated dependencies [[`67eb0c1`](https://github.com/bluesky-social/atproto/commit/67eb0c19ac415e762e221b2ccda9f0bcf7b3dd6f)]:
|
|
161
|
+
- @atproto/syntax@0.5.1
|
|
162
|
+
|
|
163
|
+
## 0.0.24
|
|
164
|
+
|
|
165
|
+
### Patch Changes
|
|
166
|
+
|
|
167
|
+
- Updated dependencies [[`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`52834ab`](https://github.com/bluesky-social/atproto/commit/52834aba182da8df3611fd9dff924e6c6a3973a7), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd)]:
|
|
168
|
+
- @atproto/syntax@0.5.0
|
|
169
|
+
- @atproto/common@0.5.14
|
|
170
|
+
|
|
171
|
+
## 0.0.23
|
|
172
|
+
|
|
173
|
+
### Patch Changes
|
|
174
|
+
|
|
175
|
+
- Updated dependencies [[`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7)]:
|
|
176
|
+
- @atproto/common@0.5.0
|
|
177
|
+
|
|
178
|
+
## 0.0.22
|
|
179
|
+
|
|
180
|
+
### Patch Changes
|
|
181
|
+
|
|
182
|
+
- Updated dependencies []:
|
|
183
|
+
- @atproto/common@0.4.12
|
|
184
|
+
|
|
185
|
+
## 0.0.21
|
|
186
|
+
|
|
187
|
+
### Patch Changes
|
|
188
|
+
|
|
189
|
+
- Updated dependencies [[`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d)]:
|
|
190
|
+
- @atproto/syntax@0.4.1
|
|
191
|
+
|
|
192
|
+
## 0.0.20
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- [#3912](https://github.com/bluesky-social/atproto/pull/3912) [`a5cd018bd`](https://github.com/bluesky-social/atproto/commit/a5cd018bd5f237221902ab1b6956b46233c92187) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Unify `getPostThreadV2` and `getPostThreadHiddenV2` responses under `app.bsky.unspecced.defs` namespace and a single interface via `threadItemPost`.
|
|
197
|
+
|
|
198
|
+
## 0.0.19
|
|
199
|
+
|
|
200
|
+
### Patch Changes
|
|
201
|
+
|
|
202
|
+
- Updated dependencies []:
|
|
203
|
+
- @atproto/common@0.4.11
|
|
204
|
+
|
|
205
|
+
## 0.0.18
|
|
206
|
+
|
|
207
|
+
### Patch Changes
|
|
208
|
+
|
|
209
|
+
- Updated dependencies [[`4db923ca1`](https://github.com/bluesky-social/atproto/commit/4db923ca1c4fadd31d41c851933659e5186ee144)]:
|
|
210
|
+
- @atproto/common@0.4.10
|
|
211
|
+
|
|
212
|
+
## 0.0.17
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- Updated dependencies [[`bdbd3c3e3`](https://github.com/bluesky-social/atproto/commit/bdbd3c3e3f8fe8476a3fecac73810554846c938f)]:
|
|
217
|
+
- @atproto/common@0.4.9
|
|
218
|
+
|
|
219
|
+
## 0.0.16
|
|
220
|
+
|
|
221
|
+
### Patch Changes
|
|
222
|
+
|
|
223
|
+
- Updated dependencies [[`670b6b5de`](https://github.com/bluesky-social/atproto/commit/670b6b5de2bf91e6944761c98eb1126fb6a681ee)]:
|
|
224
|
+
- @atproto/syntax@0.4.0
|
|
225
|
+
|
|
226
|
+
## 0.0.15
|
|
227
|
+
|
|
228
|
+
### Patch Changes
|
|
229
|
+
|
|
230
|
+
- Updated dependencies [[`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29)]:
|
|
231
|
+
- @atproto/syntax@0.3.4
|
|
232
|
+
|
|
233
|
+
## 0.0.14
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- Updated dependencies [[`c53d943c8`](https://github.com/bluesky-social/atproto/commit/c53d943c8be5b8886254e020970a68c0f745b14c)]:
|
|
238
|
+
- @atproto/syntax@0.3.3
|
|
239
|
+
|
|
240
|
+
## 0.0.13
|
|
241
|
+
|
|
242
|
+
### Patch Changes
|
|
243
|
+
|
|
244
|
+
- [#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
|
|
245
|
+
|
|
246
|
+
- [#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
|
|
247
|
+
|
|
248
|
+
- Updated dependencies [[`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd), [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd)]:
|
|
249
|
+
- @atproto/common@0.4.8
|
|
250
|
+
- @atproto/syntax@0.3.2
|
|
251
|
+
|
|
252
|
+
## 0.0.12
|
|
253
|
+
|
|
254
|
+
### Patch Changes
|
|
255
|
+
|
|
256
|
+
- Updated dependencies [[`52c687a05`](https://github.com/bluesky-social/atproto/commit/52c687a05c70d5660fae1de9e1bbc6297f37f1f4)]:
|
|
257
|
+
- @atproto/common@0.4.7
|
|
258
|
+
|
|
259
|
+
## 0.0.11
|
|
260
|
+
|
|
261
|
+
### Patch Changes
|
|
262
|
+
|
|
263
|
+
- Updated dependencies []:
|
|
264
|
+
- @atproto/common@0.4.6
|
|
265
|
+
|
|
266
|
+
## 0.0.10
|
|
267
|
+
|
|
268
|
+
### Patch Changes
|
|
269
|
+
|
|
270
|
+
- Updated dependencies [[`588baae12`](https://github.com/bluesky-social/atproto/commit/588baae1212a3cba3bf0d95d2f268e80513fd9c4)]:
|
|
271
|
+
- @atproto/common@0.4.5
|
|
272
|
+
|
|
273
|
+
## 0.0.9
|
|
274
|
+
|
|
275
|
+
### Patch Changes
|
|
276
|
+
|
|
277
|
+
- Updated dependencies [[`bac9be2d3`](https://github.com/bluesky-social/atproto/commit/bac9be2d3ec904d1f984a871f43cf89aca17289d)]:
|
|
278
|
+
- @atproto/syntax@0.3.1
|
|
279
|
+
|
|
280
|
+
## 0.0.8
|
|
281
|
+
|
|
282
|
+
### Patch Changes
|
|
283
|
+
|
|
284
|
+
- Updated dependencies [[`4098d9890`](https://github.com/bluesky-social/atproto/commit/4098d9890173f4d6c6512f2d8994eebbf12b5e13)]:
|
|
285
|
+
- @atproto/common@0.4.4
|
|
286
|
+
|
|
287
|
+
## 0.0.7
|
|
288
|
+
|
|
289
|
+
### Patch Changes
|
|
290
|
+
|
|
291
|
+
- Updated dependencies [[`a07b21151`](https://github.com/bluesky-social/atproto/commit/a07b21151f1850340c4b7797ebb11521b1a6cdf3)]:
|
|
292
|
+
- @atproto/common@0.4.3
|
|
293
|
+
|
|
294
|
+
## 0.0.6
|
|
295
|
+
|
|
296
|
+
### Patch Changes
|
|
297
|
+
|
|
298
|
+
- Updated dependencies [[`98711a147`](https://github.com/bluesky-social/atproto/commit/98711a147a8674337f605c6368f39fc10c2fae93)]:
|
|
299
|
+
- @atproto/common@0.4.2
|
|
300
|
+
|
|
301
|
+
## 0.0.5
|
|
302
|
+
|
|
303
|
+
### Patch Changes
|
|
304
|
+
|
|
305
|
+
- [#2648](https://github.com/bluesky-social/atproto/pull/2648) [`76c91f832`](https://github.com/bluesky-social/atproto/commit/76c91f8325363c95e25349e8e236aa2f70e63d5b) Thanks [@dholms](https://github.com/dholms)! - Support for priority notifications
|
|
306
|
+
|
|
307
|
+
## 0.0.4
|
|
308
|
+
|
|
309
|
+
### Patch Changes
|
|
310
|
+
|
|
311
|
+
- [#2633](https://github.com/bluesky-social/atproto/pull/2633) [`acc9093d2`](https://github.com/bluesky-social/atproto/commit/acc9093d2845eba02b68fb2f9db33e4f1b59bb10) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Obfuscate request headers in logs using utils from @atproto/common
|
|
312
|
+
|
|
313
|
+
- Updated dependencies [[`acc9093d2`](https://github.com/bluesky-social/atproto/commit/acc9093d2845eba02b68fb2f9db33e4f1b59bb10)]:
|
|
314
|
+
- @atproto/common@0.4.1
|
|
315
|
+
|
|
316
|
+
## 0.0.3
|
|
317
|
+
|
|
318
|
+
### Patch Changes
|
|
319
|
+
|
|
320
|
+
- [#2169](https://github.com/bluesky-social/atproto/pull/2169) [`f689bd51a`](https://github.com/bluesky-social/atproto/commit/f689bd51a2f4e02d4eca40eb2568a1fcb95494e9) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Build system rework, stop bundling dependencies.
|
|
321
|
+
|
|
322
|
+
- Updated dependencies [[`f689bd51a`](https://github.com/bluesky-social/atproto/commit/f689bd51a2f4e02d4eca40eb2568a1fcb95494e9)]:
|
|
323
|
+
- @atproto/common@0.4.0
|
|
324
|
+
- @atproto/syntax@0.3.0
|
|
325
|
+
|
|
326
|
+
## 0.0.2
|
|
327
|
+
|
|
328
|
+
### Patch Changes
|
|
329
|
+
|
|
330
|
+
- Updated dependencies []:
|
|
331
|
+
- @atproto/common@0.3.4
|
|
332
|
+
- @atproto/syntax@0.2.1
|
|
333
|
+
|
|
334
|
+
## 0.0.1
|
|
335
|
+
|
|
336
|
+
### Patch Changes
|
|
337
|
+
|
|
338
|
+
- Updated dependencies [[`0c815b964`](https://github.com/bluesky-social/atproto/commit/0c815b964c030aa0f277c40bf9786f130dc320f4)]:
|
|
339
|
+
- @atproto/syntax@0.2.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.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @atproto/bsync: Synchronizing Service for the Bluesky AppView
|
|
2
|
+
|
|
3
|
+
This is an optional service that may be used to synchronize certain state between otherwise independent AppViews.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@atproto/bsync)
|
|
6
|
+
[](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)
|
|
7
|
+
|
|
8
|
+
## License
|
|
9
|
+
|
|
10
|
+
This project is dual-licensed under MIT and Apache 2.0 terms:
|
|
11
|
+
|
|
12
|
+
- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
|
|
13
|
+
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)
|
|
14
|
+
|
|
15
|
+
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.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Interceptor, type PromiseClient } from '@connectrpc/connect';
|
|
2
|
+
import { type ConnectTransportOptions } from '@connectrpc/connect-node';
|
|
3
|
+
import { Service } from './proto/bsync_connect.js';
|
|
4
|
+
export type BsyncClient = PromiseClient<typeof Service>;
|
|
5
|
+
export declare const createClient: (opts: ConnectTransportOptions) => BsyncClient;
|
|
6
|
+
export declare const authWithApiKey: (apiKey: string) => Interceptor;
|
|
7
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAEnB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,OAAO,CAAC,CAAA;AAEvD,eAAO,MAAM,YAAY,SAAU,uBAAuB,KAAG,WAG5D,CAAA;AAED,eAAO,MAAM,cAAc,WAChB,MAAM,KAAG,WAKjB,CAAA"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createPromiseClient, } from '@connectrpc/connect';
|
|
2
|
+
import { createConnectTransport, } from '@connectrpc/connect-node';
|
|
3
|
+
import { Service } from './proto/bsync_connect.js';
|
|
4
|
+
export const createClient = (opts) => {
|
|
5
|
+
const transport = createConnectTransport(opts);
|
|
6
|
+
return createPromiseClient(Service, transport);
|
|
7
|
+
};
|
|
8
|
+
export const authWithApiKey = (apiKey) => (next) => (req) => {
|
|
9
|
+
req.header.set('authorization', `Bearer ${apiKey}`);
|
|
10
|
+
return next(req);
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,sBAAsB,GACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAIlD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAA6B,EAAe,EAAE;IACzE,MAAM,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAA;IAC9C,OAAO,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;AAChD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GACzB,CAAC,MAAc,EAAe,EAAE,CAChC,CAAC,IAAI,EAAE,EAAE,CACT,CAAC,GAAG,EAAE,EAAE;IACN,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,MAAM,EAAE,CAAC,CAAA;IACnD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CAAA","sourcesContent":["import {\n type Interceptor,\n type PromiseClient,\n createPromiseClient,\n} from '@connectrpc/connect'\nimport {\n type ConnectTransportOptions,\n createConnectTransport,\n} from '@connectrpc/connect-node'\nimport { Service } from './proto/bsync_connect.js'\n\nexport type BsyncClient = PromiseClient<typeof Service>\n\nexport const createClient = (opts: ConnectTransportOptions): BsyncClient => {\n const transport = createConnectTransport(opts)\n return createPromiseClient(Service, transport)\n}\n\nexport const authWithApiKey =\n (apiKey: string): Interceptor =>\n (next) =>\n (req) => {\n req.header.set('authorization', `Bearer ${apiKey}`)\n return next(req)\n }\n"]}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const envToCfg: (env: ServerEnvironment) => ServerConfig;
|
|
2
|
+
export type ServerConfig = {
|
|
3
|
+
service: ServiceConfig;
|
|
4
|
+
db: DatabaseConfig;
|
|
5
|
+
auth: AuthConfig;
|
|
6
|
+
};
|
|
7
|
+
type ServiceConfig = {
|
|
8
|
+
port: number;
|
|
9
|
+
version?: string;
|
|
10
|
+
longPollTimeoutMs: number;
|
|
11
|
+
};
|
|
12
|
+
type DatabaseConfig = {
|
|
13
|
+
url: string;
|
|
14
|
+
schema?: string;
|
|
15
|
+
poolSize?: number;
|
|
16
|
+
poolMaxUses?: number;
|
|
17
|
+
poolIdleTimeoutMs?: number;
|
|
18
|
+
migrate?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type AuthConfig = {
|
|
21
|
+
apiKeys: Set<string>;
|
|
22
|
+
};
|
|
23
|
+
export declare const readEnv: () => ServerEnvironment;
|
|
24
|
+
export type ServerEnvironment = {
|
|
25
|
+
port?: number;
|
|
26
|
+
version?: string;
|
|
27
|
+
longPollTimeoutMs?: number;
|
|
28
|
+
dbUrl?: string;
|
|
29
|
+
dbSchema?: string;
|
|
30
|
+
dbPoolSize?: number;
|
|
31
|
+
dbPoolMaxUses?: number;
|
|
32
|
+
dbPoolIdleTimeoutMs?: number;
|
|
33
|
+
dbMigrate?: boolean;
|
|
34
|
+
apiKeys: string[];
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,QAAS,iBAAiB,KAAG,YA2BjD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,aAAa,CAAA;IACtB,EAAE,EAAE,cAAc,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;CACjB,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,OAAO,QAAO,iBAgB1B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAE9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { envBool, envInt, envList, envStr } from '@atproto/common';
|
|
3
|
+
export const envToCfg = (env) => {
|
|
4
|
+
const serviceCfg = {
|
|
5
|
+
port: env.port ?? 2585,
|
|
6
|
+
version: env.version ?? 'unknown',
|
|
7
|
+
longPollTimeoutMs: env.longPollTimeoutMs ?? 10000,
|
|
8
|
+
};
|
|
9
|
+
assert(env.dbUrl, 'missing postgres url');
|
|
10
|
+
const dbCfg = {
|
|
11
|
+
url: env.dbUrl,
|
|
12
|
+
schema: env.dbSchema,
|
|
13
|
+
poolSize: env.dbPoolSize,
|
|
14
|
+
poolMaxUses: env.dbPoolMaxUses,
|
|
15
|
+
poolIdleTimeoutMs: env.dbPoolIdleTimeoutMs,
|
|
16
|
+
migrate: env.dbMigrate,
|
|
17
|
+
};
|
|
18
|
+
assert(env.apiKeys.length > 0, 'missing api keys');
|
|
19
|
+
const authCfg = {
|
|
20
|
+
apiKeys: new Set(env.apiKeys),
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
service: serviceCfg,
|
|
24
|
+
db: dbCfg,
|
|
25
|
+
auth: authCfg,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const readEnv = () => {
|
|
29
|
+
return {
|
|
30
|
+
// service
|
|
31
|
+
port: envInt('BSYNC_PORT'),
|
|
32
|
+
version: envStr('BSYNC_VERSION'),
|
|
33
|
+
longPollTimeoutMs: envInt('BSYNC_LONG_POLL_TIMEOUT_MS'),
|
|
34
|
+
// database
|
|
35
|
+
dbUrl: envStr('BSYNC_DB_POSTGRES_URL'),
|
|
36
|
+
dbSchema: envStr('BSYNC_DB_POSTGRES_SCHEMA'),
|
|
37
|
+
dbPoolSize: envInt('BSYNC_DB_POOL_SIZE'),
|
|
38
|
+
dbPoolMaxUses: envInt('BSYNC_DB_POOL_MAX_USES'),
|
|
39
|
+
dbPoolIdleTimeoutMs: envInt('BSYNC_DB_POOL_IDLE_TIMEOUT_MS'),
|
|
40
|
+
dbMigrate: envBool('BSYNC_DB_MIGRATE'),
|
|
41
|
+
// secrets
|
|
42
|
+
apiKeys: envList('BSYNC_API_KEYS'),
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAElE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAsB,EAAgB,EAAE;IAC/D,MAAM,UAAU,GAA4B;QAC1C,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,IAAI;QACtB,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,SAAS;QACjC,iBAAiB,EAAE,GAAG,CAAC,iBAAiB,IAAI,KAAK;KAClD,CAAA;IAED,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAA;IACzC,MAAM,KAAK,GAAuB;QAChC,GAAG,EAAE,GAAG,CAAC,KAAK;QACd,MAAM,EAAE,GAAG,CAAC,QAAQ;QACpB,QAAQ,EAAE,GAAG,CAAC,UAAU;QACxB,WAAW,EAAE,GAAG,CAAC,aAAa;QAC9B,iBAAiB,EAAE,GAAG,CAAC,mBAAmB;QAC1C,OAAO,EAAE,GAAG,CAAC,SAAS;KACvB,CAAA;IAED,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,kBAAkB,CAAC,CAAA;IAClD,MAAM,OAAO,GAAyB;QACpC,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;KAC9B,CAAA;IAED,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,OAAO;KACd,CAAA;AACH,CAAC,CAAA;AA2BD,MAAM,CAAC,MAAM,OAAO,GAAG,GAAsB,EAAE;IAC7C,OAAO;QACL,UAAU;QACV,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC,eAAe,CAAC;QAChC,iBAAiB,EAAE,MAAM,CAAC,4BAA4B,CAAC;QACvD,WAAW;QACX,KAAK,EAAE,MAAM,CAAC,uBAAuB,CAAC;QACtC,QAAQ,EAAE,MAAM,CAAC,0BAA0B,CAAC;QAC5C,UAAU,EAAE,MAAM,CAAC,oBAAoB,CAAC;QACxC,aAAa,EAAE,MAAM,CAAC,wBAAwB,CAAC;QAC/C,mBAAmB,EAAE,MAAM,CAAC,+BAA+B,CAAC;QAC5D,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC;QACtC,UAAU;QACV,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC;KACnC,CAAA;AACH,CAAC,CAAA","sourcesContent":["import assert from 'node:assert'\nimport { envBool, envInt, envList, envStr } from '@atproto/common'\n\nexport const envToCfg = (env: ServerEnvironment): ServerConfig => {\n const serviceCfg: ServerConfig['service'] = {\n port: env.port ?? 2585,\n version: env.version ?? 'unknown',\n longPollTimeoutMs: env.longPollTimeoutMs ?? 10000,\n }\n\n assert(env.dbUrl, 'missing postgres url')\n const dbCfg: ServerConfig['db'] = {\n url: env.dbUrl,\n schema: env.dbSchema,\n poolSize: env.dbPoolSize,\n poolMaxUses: env.dbPoolMaxUses,\n poolIdleTimeoutMs: env.dbPoolIdleTimeoutMs,\n migrate: env.dbMigrate,\n }\n\n assert(env.apiKeys.length > 0, 'missing api keys')\n const authCfg: ServerConfig['auth'] = {\n apiKeys: new Set(env.apiKeys),\n }\n\n return {\n service: serviceCfg,\n db: dbCfg,\n auth: authCfg,\n }\n}\n\nexport type ServerConfig = {\n service: ServiceConfig\n db: DatabaseConfig\n auth: AuthConfig\n}\n\ntype ServiceConfig = {\n port: number\n version?: string\n longPollTimeoutMs: number\n}\n\ntype DatabaseConfig = {\n url: string\n schema?: string\n poolSize?: number\n poolMaxUses?: number\n poolIdleTimeoutMs?: number\n migrate?: boolean\n}\n\ntype AuthConfig = {\n apiKeys: Set<string>\n}\n\nexport const readEnv = (): ServerEnvironment => {\n return {\n // service\n port: envInt('BSYNC_PORT'),\n version: envStr('BSYNC_VERSION'),\n longPollTimeoutMs: envInt('BSYNC_LONG_POLL_TIMEOUT_MS'),\n // database\n dbUrl: envStr('BSYNC_DB_POSTGRES_URL'),\n dbSchema: envStr('BSYNC_DB_POSTGRES_SCHEMA'),\n dbPoolSize: envInt('BSYNC_DB_POOL_SIZE'),\n dbPoolMaxUses: envInt('BSYNC_DB_POOL_MAX_USES'),\n dbPoolIdleTimeoutMs: envInt('BSYNC_DB_POOL_IDLE_TIMEOUT_MS'),\n dbMigrate: envBool('BSYNC_DB_MIGRATE'),\n // secrets\n apiKeys: envList('BSYNC_API_KEYS'),\n }\n}\n\nexport type ServerEnvironment = {\n // service\n port?: number\n version?: string\n longPollTimeoutMs?: number\n // database\n dbUrl?: string\n dbSchema?: string\n dbPoolSize?: number\n dbPoolMaxUses?: number\n dbPoolIdleTimeoutMs?: number\n dbMigrate?: boolean\n // secrets\n apiKeys: string[]\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import type { ServerConfig } from './config.js';
|
|
3
|
+
import { Database } from './db/index.js';
|
|
4
|
+
import type { createMuteOpChannel } from './db/schema/mute_op.js';
|
|
5
|
+
import type { createNotifOpChannel } from './db/schema/notif_op.js';
|
|
6
|
+
import type { createOperationChannel } from './db/schema/operation.js';
|
|
7
|
+
export type AppContextOptions = {
|
|
8
|
+
db: Database;
|
|
9
|
+
cfg: ServerConfig;
|
|
10
|
+
shutdown: AbortSignal;
|
|
11
|
+
};
|
|
12
|
+
export declare class AppContext {
|
|
13
|
+
db: Database;
|
|
14
|
+
cfg: ServerConfig;
|
|
15
|
+
shutdown: AbortSignal;
|
|
16
|
+
events: EventEmitter<AppEvents>;
|
|
17
|
+
constructor(opts: AppContextOptions);
|
|
18
|
+
static fromConfig(cfg: ServerConfig, shutdown: AbortSignal, overrides?: Partial<AppContextOptions>): Promise<AppContext>;
|
|
19
|
+
}
|
|
20
|
+
export type AppEvents = {
|
|
21
|
+
[createMuteOpChannel]: [];
|
|
22
|
+
[createNotifOpChannel]: [];
|
|
23
|
+
[createOperationChannel]: [];
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,QAAQ,CAAA;IACZ,GAAG,EAAE,YAAY,CAAA;IACjB,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,qBAAa,UAAU;IACrB,EAAE,EAAE,QAAQ,CAAA;IACZ,GAAG,EAAE,YAAY,CAAA;IACjB,QAAQ,EAAE,WAAW,CAAA;IACrB,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;IAE/B,YAAY,IAAI,EAAE,iBAAiB,EAKlC;IAED,OAAa,UAAU,CACrB,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,WAAW,EACrB,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,OAAO,CAAC,UAAU,CAAC,CASrB;CACF;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAA;IACzB,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAA;IAC1B,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAA;CAC7B,CAAA"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { Database } from './db/index.js';
|
|
3
|
+
export class AppContext {
|
|
4
|
+
constructor(opts) {
|
|
5
|
+
this.db = opts.db;
|
|
6
|
+
this.cfg = opts.cfg;
|
|
7
|
+
this.shutdown = opts.shutdown;
|
|
8
|
+
this.events = new EventEmitter();
|
|
9
|
+
}
|
|
10
|
+
static async fromConfig(cfg, shutdown, overrides) {
|
|
11
|
+
const db = new Database({
|
|
12
|
+
url: cfg.db.url,
|
|
13
|
+
schema: cfg.db.schema,
|
|
14
|
+
poolSize: cfg.db.poolSize,
|
|
15
|
+
poolMaxUses: cfg.db.poolMaxUses,
|
|
16
|
+
poolIdleTimeoutMs: cfg.db.poolIdleTimeoutMs,
|
|
17
|
+
});
|
|
18
|
+
return new AppContext({ db, cfg, shutdown, ...overrides });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAWxC,MAAM,OAAO,UAAU;IAMrB,YAAY,IAAuB;QACjC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAA;QACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,EAAa,CAAA;IAC7C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,UAAU,CACrB,GAAiB,EACjB,QAAqB,EACrB,SAAsC;QAEtC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC;YACtB,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG;YACf,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM;YACrB,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ;YACzB,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,WAAW;YAC/B,iBAAiB,EAAE,GAAG,CAAC,EAAE,CAAC,iBAAiB;SAC5C,CAAC,CAAA;QACF,OAAO,IAAI,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC,CAAA;IAC5D,CAAC;CACF","sourcesContent":["import { EventEmitter } from 'node:events'\nimport type { ServerConfig } from './config.js'\nimport { Database } from './db/index.js'\nimport type { createMuteOpChannel } from './db/schema/mute_op.js'\nimport type { createNotifOpChannel } from './db/schema/notif_op.js'\nimport type { createOperationChannel } from './db/schema/operation.js'\n\nexport type AppContextOptions = {\n db: Database\n cfg: ServerConfig\n shutdown: AbortSignal\n}\n\nexport class AppContext {\n db: Database\n cfg: ServerConfig\n shutdown: AbortSignal\n events: EventEmitter<AppEvents>\n\n constructor(opts: AppContextOptions) {\n this.db = opts.db\n this.cfg = opts.cfg\n this.shutdown = opts.shutdown\n this.events = new EventEmitter<AppEvents>()\n }\n\n static async fromConfig(\n cfg: ServerConfig,\n shutdown: AbortSignal,\n overrides?: Partial<AppContextOptions>,\n ): Promise<AppContext> {\n const db = new Database({\n url: cfg.db.url,\n schema: cfg.db.schema,\n poolSize: cfg.db.poolSize,\n poolMaxUses: cfg.db.poolMaxUses,\n poolIdleTimeoutMs: cfg.db.poolIdleTimeoutMs,\n })\n return new AppContext({ db, cfg, shutdown, ...overrides })\n }\n}\n\nexport type AppEvents = {\n [createMuteOpChannel]: []\n [createNotifOpChannel]: []\n [createOperationChannel]: []\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { Migrator } from 'kysely/migration';
|
|
3
|
+
declare const PgPool: typeof import("pg").Pool;
|
|
4
|
+
type PgPool = InstanceType<typeof PgPool>;
|
|
5
|
+
import type { DatabaseSchema } from './schema/index.js';
|
|
6
|
+
import type { PgOptions } from './types.js';
|
|
7
|
+
export declare class Database {
|
|
8
|
+
opts: PgOptions;
|
|
9
|
+
pool: PgPool;
|
|
10
|
+
db: DatabaseSchema;
|
|
11
|
+
migrator: Migrator;
|
|
12
|
+
txEvt: EventEmitter<TxnEvents>;
|
|
13
|
+
destroyed: boolean;
|
|
14
|
+
constructor(opts: PgOptions, instances?: {
|
|
15
|
+
db: DatabaseSchema;
|
|
16
|
+
pool: PgPool;
|
|
17
|
+
});
|
|
18
|
+
get schema(): string | undefined;
|
|
19
|
+
get isTransaction(): boolean;
|
|
20
|
+
assertTransaction(): void;
|
|
21
|
+
assertNotTransaction(): void;
|
|
22
|
+
transaction<T>(fn: (db: Database) => Promise<T>): Promise<T>;
|
|
23
|
+
onCommit(fn: () => void): void;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
migrateToOrThrow(migration: string): Promise<import("kysely/migration").MigrationResult[]>;
|
|
26
|
+
migrateToLatestOrThrow(): Promise<import("kysely/migration").MigrationResult[]>;
|
|
27
|
+
}
|
|
28
|
+
export default Database;
|
|
29
|
+
type TxnEvents = {
|
|
30
|
+
commit: [];
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAW1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,QAAA,MAAc,MAAM,0BAAuB,CAAA;AAC3C,KAAK,MAAM,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAA;AAIzC,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,qBAAa,QAAQ;IAQV,IAAI,EAAE,SAAS;IAPxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,cAAc,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;IAClB,KAAK,0BAAgC;IACrC,SAAS,UAAQ;IAEjB,YACS,IAAI,EAAE,SAAS,EACtB,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAgDjD;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,IAAI,aAAa,YAEhB;IAED,iBAAiB,SAEhB;IAED,oBAAoB,SAEnB;IAEK,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAsBjE;IAED,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,QAGtB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAI3B;IAEK,gBAAgB,CAAC,SAAS,EAAE,MAAM,yDAYvC;IAEK,sBAAsB,0DAY3B;CACF;eAEc,QAAQ;AA6BvB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,EAAE,CAAA;CACX,CAAA"}
|