@atproto/bsync 0.0.0 → 0.0.1

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.
@@ -1,5 +1,5 @@
1
1
  import { ServiceImpl } from '@connectrpc/connect';
2
- import { Service } from '../gen/bsync_connect';
2
+ import { Service } from '../proto/bsync_connect';
3
3
  import AppContext from '../context';
4
4
  declare const _default: (ctx: AppContext) => Partial<ServiceImpl<typeof Service>>;
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import { ServiceImpl } from '@connectrpc/connect';
2
- import { Service } from '../gen/bsync_connect';
2
+ import { Service } from '../proto/bsync_connect';
3
3
  import AppContext from '../context';
4
4
  declare const _default: (ctx: AppContext) => Partial<ServiceImpl<typeof Service>>;
5
5
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/bsync",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "license": "MIT",
5
5
  "description": "Sychronizing service for app.bsky App View (Bluesky API)",
6
6
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  "pino-http": "^8.2.1",
27
27
  "typed-emitter": "^2.1.0",
28
28
  "@atproto/common": "^0.3.3",
29
- "@atproto/syntax": "^0.1.5"
29
+ "@atproto/syntax": "^0.2.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@bufbuild/buf": "^1.28.1",
package/src/client.ts CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  ConnectTransportOptions,
8
8
  createConnectTransport,
9
9
  } from '@connectrpc/connect-node'
10
- import { Service } from './gen/bsync_connect'
10
+ import { Service } from './proto/bsync_connect'
11
11
 
12
12
  export type BsyncClient = PromiseClient<typeof Service>
13
13
 
@@ -1,5 +1,5 @@
1
1
  import { GeneratedAlways, Selectable } from 'kysely'
2
- import { MuteOperation_Type } from '../../gen/bsync_pb'
2
+ import { MuteOperation_Type } from '../../proto/bsync_pb'
3
3
 
4
4
  export interface MuteOp {
5
5
  id: GeneratedAlways<number>
package/src/index.ts CHANGED
@@ -44,6 +44,11 @@ export class BsyncService {
44
44
  })
45
45
  const server = http.createServer((req, res) => {
46
46
  loggerMiddleware(req, res)
47
+ if (isHealth(req.url)) {
48
+ res.statusCode = 200
49
+ res.setHeader('content-type', 'application/json')
50
+ return res.end(JSON.stringify({ version: cfg.service.version }))
51
+ }
47
52
  handler(req, res)
48
53
  })
49
54
  return new BsyncService({ ctx, server, ac })
@@ -89,3 +94,9 @@ export class BsyncService {
89
94
  }
90
95
 
91
96
  export default BsyncService
97
+
98
+ const isHealth = (urlStr: string | undefined) => {
99
+ if (!urlStr) return false
100
+ const url = new URL(urlStr, 'http://host')
101
+ return url.pathname === '/_health'
102
+ }
@@ -6,8 +6,8 @@ import {
6
6
  ensureValidDid,
7
7
  } from '@atproto/syntax'
8
8
  import { Code, ConnectError, ServiceImpl } from '@connectrpc/connect'
9
- import { Service } from '../gen/bsync_connect'
10
- import { AddMuteOperationResponse, MuteOperation_Type } from '../gen/bsync_pb'
9
+ import { Service } from '../proto/bsync_connect'
10
+ import { AddMuteOperationResponse, MuteOperation_Type } from '../proto/bsync_pb'
11
11
  import AppContext from '../context'
12
12
  import { createMuteOpChannel } from '../db/schema/mute_op'
13
13
  import { authWithApiKey } from './auth'
@@ -1,6 +1,6 @@
1
1
  import { sql } from 'kysely'
2
2
  import { ConnectRouter } from '@connectrpc/connect'
3
- import { Service } from '../gen/bsync_connect'
3
+ import { Service } from '../proto/bsync_connect'
4
4
  import AppContext from '../context'
5
5
  import addMuteOperation from './add-mute-operation'
6
6
  import scanMuteOperations from './scan-mute-operations'
@@ -1,7 +1,7 @@
1
1
  import { once } from 'node:events'
2
2
  import { Code, ConnectError, ServiceImpl } from '@connectrpc/connect'
3
- import { Service } from '../gen/bsync_connect'
4
- import { ScanMuteOperationsResponse } from '../gen/bsync_pb'
3
+ import { Service } from '../proto/bsync_connect'
4
+ import { ScanMuteOperationsResponse } from '../proto/bsync_pb'
5
5
  import AppContext from '../context'
6
6
  import { createMuteOpChannel } from '../db/schema/mute_op'
7
7
  import { authWithApiKey } from './auth'
@@ -8,7 +8,7 @@ import {
8
8
  createClient,
9
9
  envToCfg,
10
10
  } from '../src'
11
- import { MuteOperation, MuteOperation_Type } from '../src/gen/bsync_pb'
11
+ import { MuteOperation, MuteOperation_Type } from '../src/proto/bsync_pb'
12
12
 
13
13
  describe('mutes', () => {
14
14
  let bsync: BsyncService
File without changes
File without changes
File without changes
File without changes