Skip to content

Commit c40f7b3

Browse files
committed
atcutie
1 parent 711e271 commit c40f7b3

4 files changed

Lines changed: 5 additions & 9 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"@atcute/bluesky-richtext-segmenter": "3.0.0",
5757
"@atcute/tid": "1.1.2",
5858
"@atproto/api": "^0.19.0",
59-
"@atproto/common": "0.5.13",
6059
"@atproto/lex": "0.0.19",
6160
"@atproto/lex-password-session": "0.0.7",
6261
"@atproto/oauth-client-node": "^0.3.15",

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/utils/atproto/utils/likes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Backlink } from '#shared/utils/constellation'
33
import type * as blue from '#shared/types/lexicons/blue'
44
import * as dev from '#shared/types/lexicons/dev'
55
import { Client } from '@atproto/lex'
6-
import { TID } from '@atproto/common'
6+
import * as TID from '@atcute/tid'
77

88
//Cache keys and helpers
99
const CACHE_PREFIX = 'atproto-likes:'
@@ -26,8 +26,8 @@ export function aggregateBacklinksByDay(
2626
const countsByDay = new Map<string, number>()
2727
for (const backlink of backlinks) {
2828
try {
29-
const tid = TID.fromStr(backlink.rkey)
30-
const timestampMs = tid.timestamp() / 1000
29+
const { timestamp } = TID.parse(backlink.rkey)
30+
const timestampMs = timestamp / 1000
3131
const date = new Date(timestampMs)
3232
const day = date.toISOString().slice(0, 10)
3333
countsByDay.set(day, (countsByDay.get(day) ?? 0) + 1)

test/unit/server/utils/likes-evolution.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it, vi, beforeEach, type Mocked } from 'vitest'
2-
import { TID } from '@atproto/common'
2+
import * as TID from '@atcute/tid'
33
import type { ConstellationLike } from '../../../../server/utils/atproto/utils/likes'
44
import type { CacheAdapter } from '../../../../server/utils/cache/shared'
55

@@ -18,7 +18,7 @@ const { aggregateBacklinksByDay, PackageLikesUtils } =
1818

1919
function tidFromDate(date: Date): string {
2020
const microseconds = date.getTime() * 1000
21-
return TID.fromTime(microseconds, 0).toString()
21+
return TID.create(microseconds, 0).toString()
2222
}
2323

2424
function backlink(date: Date): { did: string; collection: string; rkey: string } {

0 commit comments

Comments
 (0)