@atproto/sync 0.3.1 → 0.3.3

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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atproto/sync
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5117](https://github.com/bluesky-social/atproto/pull/5117) [`8a4c88b`](https://github.com/bluesky-social/atproto/commit/8a4c88b0f63fb2d82b1391d64c54e0c760fac48b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Improve concurrency management in MemoryRunner
8
+
9
+ ## 0.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
15
+ - Updated dependencies [[`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5)]:
16
+ - @atproto/xrpc-server@0.11.2
17
+ - @atproto/identity@0.5.1
18
+ - @atproto/lex@0.1.4
19
+ - @atproto/common@0.6.3
20
+ - @atproto/syntax@0.6.2
21
+ - @atproto/repo@0.10.1
22
+
3
23
  ## 0.3.1
4
24
 
5
25
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/firehose/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAEvC,OAAO,EAEL,UAAU,EAEX,MAAM,mBAAmB,CAAA;AAa1B,OAAO,EACL,UAAU,EAEV,SAAS,EAET,KAAK,EACL,WAAW,EACX,OAAO,EACR,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE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CAAC,IAAI;QACd,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,MAAM,EAAE,GAAG,CAAC,MAAmC;KAChD,CAAA;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,GAAW,EAAwB,EAAE;IAC1D,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAC3E,CAAC,CAAA;AAED,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YACE,GAAY,EACL,KAAc;QAErB,KAAK,CAAC,4CAA4C,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QAF5D,UAAK,GAAL,KAAK,CAAS;IAGvB,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YACE,GAAY,EACL,KAA+C;QAEtD,KAAK,CAAC,oDAAoD,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QAFpE,UAAK,GAAL,KAAK,CAA0C;IAGxD,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,GAAY;QACtB,KAAK,CAAC,gCAAgC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACzD,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YACE,GAAY,EACL,KAAY;QAEnB,KAAK,CAAC,iCAAiC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QAFjD,UAAK,GAAL,KAAK,CAAO;IAGrB,CAAC;CACF","sourcesContent":["import type { ClientOptions } from 'ws'\nimport { Deferrable, createDeferrable, wait } from '@atproto/common'\nimport {\n DidDocument,\n IdResolver,\n parseToAtprotoDocument,\n} from '@atproto/identity'\nimport { Cid } from '@atproto/lex'\nimport {\n RepoVerificationError,\n cborToLexRecord,\n formatDataKey,\n parseDataKey,\n readCar,\n readCarWithRoot,\n verifyProofs,\n} from '@atproto/repo'\nimport { AtUri } from '@atproto/syntax'\nimport { Subscription } from '@atproto/xrpc-server'\nimport {\n AccountEvt,\n AccountStatus,\n CommitEvt,\n CommitMeta,\n Event,\n IdentityEvt,\n SyncEvt,\n} from '../events.js'\nimport { com } from '../lexicons/index.js'\nimport { EventRunner } from '../runner/index.js'\nimport { didAndSeqForEvt } from '../util.js'\n\nexport type FirehoseOptions = ClientOptions & {\n idResolver: IdResolver\n\n handleEvent: (evt: Event) => void | Promise<void>\n onError: (err: Error) => void\n getCursor?: () => number | undefined | Promise<number | undefined>\n\n runner?: EventRunner // should only set getCursor *or* runner\n\n service?: string\n subscriptionReconnectDelay?: number\n\n unauthenticatedCommits?: boolean\n unauthenticatedHandles?: boolean\n\n filterCollections?: string[]\n excludeIdentity?: boolean\n excludeAccount?: boolean\n excludeCommit?: boolean\n excludeSync?: boolean\n}\n\nexport class Firehose {\n private sub: Subscription<com.atproto.sync.subscribeRepos.$Message>\n private abortController: AbortController\n private destoryDefer: Deferrable\n private matchCollection: ((col: string) => boolean) | null = null\n\n constructor(public opts: FirehoseOptions) {\n this.destoryDefer = createDeferrable()\n this.abortController = new AbortController()\n if (this.opts.getCursor && this.opts.runner) {\n throw new Error('Must set only `getCursor` or `runner`')\n }\n if (opts.filterCollections) {\n const exact = new Set<string>()\n const prefixes: string[] = []\n\n for (const pattern of opts.filterCollections) {\n if (pattern.endsWith('.*')) {\n prefixes.push(pattern.slice(0, -2))\n } else {\n exact.add(pattern)\n }\n }\n this.matchCollection = (col: string): boolean => {\n if (exact.has(col)) return true\n for (const prefix of prefixes) {\n if (col.startsWith(prefix)) return true\n }\n return false\n }\n }\n this.sub = new Subscription({\n ...opts,\n service: opts.service ?? 'wss://bsky.network',\n method: com.atproto.sync.subscribeRepos.$lxm,\n signal: this.abortController.signal,\n getParams: async () => {\n let cursor: number | undefined\n if (this.opts.runner) {\n cursor = await this.opts.runner.getCursor()\n } else if (this.opts.getCursor) {\n cursor = await this.opts.getCursor()\n }\n return cursor === undefined ? undefined : { cursor }\n },\n validate: (value: unknown) => {\n const result = com.atproto.sync.subscribeRepos.$message.safeParse(value)\n if (result.success) {\n return result.value\n } else {\n this.opts.onError(new FirehoseValidationError(result.reason, value))\n }\n },\n })\n }\n\n async start() {\n try {\n for await (const evt of this.sub) {\n if (this.opts.runner) {\n const parsed = didAndSeqForEvt(evt)\n if (!parsed) {\n continue\n }\n this.opts.runner.trackEvent(parsed.did, parsed.seq, async () => {\n const parsed = await this.parseEvt(evt)\n for (const write of parsed) {\n try {\n await this.opts.handleEvent(write)\n } catch (err) {\n this.opts.onError(new FirehoseHandlerError(err, write))\n }\n }\n })\n } else {\n await this.processEvt(evt)\n }\n }\n } catch (err) {\n if (err && err['name'] === 'AbortError') {\n this.destoryDefer.resolve()\n return\n }\n this.opts.onError(new FirehoseSubscriptionError(err))\n await wait(this.opts.subscriptionReconnectDelay ?? 3000)\n return this.start()\n }\n }\n\n private async parseEvt(\n evt: com.atproto.sync.subscribeRepos.$Message,\n ): Promise<Event[]> {\n try {\n if (com.atproto.sync.subscribeRepos.commit.$isTypeOf(evt)) {\n if (this.opts.excludeCommit) return []\n\n return this.opts.unauthenticatedCommits\n ? await parseCommitUnauthenticated(evt, this.matchCollection)\n : await parseCommitAuthenticated(\n this.opts.idResolver,\n evt,\n this.matchCollection,\n )\n } else if (com.atproto.sync.subscribeRepos.account.$isTypeOf(evt)) {\n if (this.opts.excludeAccount) return []\n\n const parsed = parseAccount(evt)\n return parsed ? [parsed] : []\n } else if (com.atproto.sync.subscribeRepos.identity.$isTypeOf(evt)) {\n if (this.opts.excludeIdentity) return []\n\n const parsed = await parseIdentity(\n this.opts.idResolver,\n evt,\n this.opts.unauthenticatedHandles,\n )\n return parsed ? [parsed] : []\n } else if (com.atproto.sync.subscribeRepos.sync.$isTypeOf(evt)) {\n if (this.opts.excludeSync) return []\n\n const parsed = await parseSync(evt)\n return parsed ? [parsed] : []\n } else {\n return []\n }\n } catch (err) {\n this.opts.onError(new FirehoseParseError(err, evt))\n return []\n }\n }\n\n private async processEvt(evt: com.atproto.sync.subscribeRepos.$Message) {\n const parsed = await this.parseEvt(evt)\n for (const write of parsed) {\n try {\n await this.opts.handleEvent(write)\n } catch (err) {\n this.opts.onError(new FirehoseHandlerError(err, write))\n }\n }\n }\n\n async destroy(): Promise<void> {\n this.abortController.abort()\n await this.destoryDefer.complete\n }\n}\n\nexport const parseCommitAuthenticated = async (\n idResolver: IdResolver,\n evt: com.atproto.sync.subscribeRepos.Commit,\n matchCollection?: ((col: string) => boolean) | null,\n forceKeyRefresh = false,\n): Promise<CommitEvt[]> => {\n const did = evt.repo\n const ops = maybeFilterOps(evt.ops, matchCollection)\n if (ops.length === 0) {\n return []\n }\n const claims = ops.map((op) => {\n const { collection, rkey } = parseDataKey(op.path)\n return {\n collection,\n rkey,\n cid: op.action === 'delete' ? null : op.cid,\n }\n })\n const key = await idResolver.did.resolveAtprotoKey(did, forceKeyRefresh)\n const verifiedCids: Record<string, Cid | null> = {}\n try {\n const results = await verifyProofs(evt.blocks, claims, did, key)\n results.verified.forEach((op) => {\n const path = formatDataKey(op.collection, op.rkey)\n verifiedCids[path] = op.cid\n })\n } catch (err) {\n if (err instanceof RepoVerificationError && !forceKeyRefresh) {\n return parseCommitAuthenticated(idResolver, evt, matchCollection, true)\n }\n throw err\n }\n const verifiedOps: com.atproto.sync.subscribeRepos.RepoOp[] = ops.filter(\n (op) => {\n const verifiedCid = verifiedCids[op.path]\n if (op.action === 'delete') {\n return verifiedCid === null\n } else {\n return (\n op.cid != null && verifiedCid != null && verifiedCid.equals(op.cid)\n )\n }\n },\n )\n return formatCommitOps(evt, verifiedOps, {\n skipCidVerification: true, // already checked via verifyProofs()\n })\n}\n\nexport const parseCommitUnauthenticated = async (\n evt: com.atproto.sync.subscribeRepos.Commit,\n matchCollection?: ((col: string) => boolean) | null,\n): Promise<CommitEvt[]> => {\n const ops = maybeFilterOps(evt.ops, matchCollection)\n return formatCommitOps(evt, ops)\n}\n\nconst maybeFilterOps = (\n ops: com.atproto.sync.subscribeRepos.RepoOp[],\n matchCollection?: ((col: string) => boolean) | null,\n): com.atproto.sync.subscribeRepos.RepoOp[] => {\n if (!matchCollection) return ops\n return ops.filter((op) => {\n const { collection } = parseDataKey(op.path)\n return matchCollection(collection)\n })\n}\n\nconst formatCommitOps = async (\n evt: com.atproto.sync.subscribeRepos.Commit,\n ops: com.atproto.sync.subscribeRepos.RepoOp[],\n options?: { skipCidVerification: boolean },\n) => {\n const car = await readCar(evt.blocks, options)\n\n const evts: CommitEvt[] = []\n\n for (const op of ops) {\n const uri = AtUri.make(evt.repo, op.path)\n\n const meta: CommitMeta = {\n seq: evt.seq,\n time: evt.time,\n commit: evt.commit,\n blocks: car.blocks,\n rev: evt.rev,\n uri,\n did: uri.did,\n collection: uri.collection,\n rkey: uri.rkey,\n }\n\n if (op.action === 'create' || op.action === 'update') {\n if (!op.cid) continue\n const recordBytes = car.blocks.get(op.cid)\n if (!recordBytes) continue\n const record = cborToLexRecord(recordBytes)\n evts.push({\n ...meta,\n event: op.action as 'create' | 'update',\n cid: op.cid,\n record,\n })\n }\n\n if (op.action === 'delete') {\n evts.push({\n ...meta,\n event: 'delete',\n })\n }\n }\n\n return evts\n}\n\nexport const parseSync = async (\n evt: com.atproto.sync.subscribeRepos.Sync,\n): Promise<SyncEvt | null> => {\n const car = await readCarWithRoot(evt.blocks)\n\n return {\n event: 'sync',\n seq: evt.seq,\n time: evt.time,\n did: evt.did,\n cid: car.root,\n rev: evt.rev,\n blocks: car.blocks,\n }\n}\n\nexport const parseIdentity = async (\n idResolver: IdResolver,\n evt: com.atproto.sync.subscribeRepos.Identity,\n unauthenticated = false,\n): Promise<IdentityEvt | null> => {\n const res = await idResolver.did.resolve(evt.did)\n const handle =\n res && !unauthenticated\n ? await verifyHandle(idResolver, evt.did, res)\n : undefined\n\n return {\n event: 'identity',\n seq: evt.seq,\n time: evt.time,\n did: evt.did,\n handle,\n didDocument: res ?? undefined,\n }\n}\n\nconst verifyHandle = async (\n idResolver: IdResolver,\n did: string,\n didDoc: DidDocument,\n): Promise<string | undefined> => {\n const { handle } = parseToAtprotoDocument(didDoc)\n if (!handle) {\n return undefined\n }\n const res = await idResolver.handle.resolve(handle)\n return res === did ? handle : undefined\n}\n\nexport const parseAccount = (\n evt: com.atproto.sync.subscribeRepos.Account,\n): AccountEvt | undefined => {\n if (evt.status && !isValidStatus(evt.status)) return\n return {\n event: 'account',\n seq: evt.seq,\n time: evt.time,\n did: evt.did,\n active: evt.active,\n status: evt.status as AccountStatus | undefined,\n }\n}\n\nconst isValidStatus = (str: string): str is AccountStatus => {\n return ['takendown', 'suspended', 'deleted', 'deactivated'].includes(str)\n}\n\nexport class FirehoseValidationError extends Error {\n constructor(\n err: unknown,\n public value: unknown,\n ) {\n super('error in firehose event lexicon validation', { cause: err })\n }\n}\n\nexport class FirehoseParseError extends Error {\n constructor(\n err: unknown,\n public event: com.atproto.sync.subscribeRepos.$Message,\n ) {\n super('error in parsing and authenticating firehose event', { cause: err })\n }\n}\n\nexport class FirehoseSubscriptionError extends Error {\n constructor(err: unknown) {\n super('error on firehose subscription', { cause: err })\n }\n}\n\nexport class FirehoseHandlerError extends Error {\n constructor(\n err: unknown,\n public event: Event,\n ) {\n super('error in firehose event handler', { cause: err })\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/firehose/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,gBAAgB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAGL,sBAAsB,GACvB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,OAAO,EACP,eAAe,EACf,YAAY,GACb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,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,CAAA;qBAFpE,KAAK;IAGd,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,GAAY;QACtB,KAAK,CAAC,gCAAgC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACzD,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YACE,GAAY,EACL,KAAY;QAEnB,KAAK,CAAC,iCAAiC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;qBAFjD,KAAK;IAGd,CAAC;CACF","sourcesContent":["import type { ClientOptions } from 'ws'\nimport { Deferrable, createDeferrable, wait } from '@atproto/common'\nimport {\n DidDocument,\n IdResolver,\n parseToAtprotoDocument,\n} from '@atproto/identity'\nimport { Cid } from '@atproto/lex'\nimport {\n RepoVerificationError,\n cborToLexRecord,\n formatDataKey,\n parseDataKey,\n readCar,\n readCarWithRoot,\n verifyProofs,\n} from '@atproto/repo'\nimport { AtUri } from '@atproto/syntax'\nimport { Subscription } from '@atproto/xrpc-server'\nimport {\n AccountEvt,\n AccountStatus,\n CommitEvt,\n CommitMeta,\n Event,\n IdentityEvt,\n SyncEvt,\n} from '../events.js'\nimport { com } from '../lexicons/index.js'\nimport { EventRunner } from '../runner/index.js'\nimport { didAndSeqForEvt } from '../util.js'\n\nexport type FirehoseOptions = ClientOptions & {\n idResolver: IdResolver\n\n handleEvent: (evt: Event) => void | Promise<void>\n onError: (err: Error) => void\n getCursor?: () => number | undefined | Promise<number | undefined>\n\n runner?: EventRunner // should only set getCursor *or* runner\n\n service?: string\n subscriptionReconnectDelay?: number\n\n unauthenticatedCommits?: boolean\n unauthenticatedHandles?: boolean\n\n filterCollections?: string[]\n excludeIdentity?: boolean\n excludeAccount?: boolean\n excludeCommit?: boolean\n excludeSync?: boolean\n}\n\nexport class Firehose {\n private sub: Subscription<com.atproto.sync.subscribeRepos.$Message>\n private abortController: AbortController\n private destoryDefer: Deferrable\n private matchCollection: ((col: string) => boolean) | null = null\n\n constructor(public opts: FirehoseOptions) {\n this.destoryDefer = createDeferrable()\n this.abortController = new AbortController()\n if (this.opts.getCursor && this.opts.runner) {\n throw new Error('Must set only `getCursor` or `runner`')\n }\n if (opts.filterCollections) {\n const exact = new Set<string>()\n const prefixes: string[] = []\n\n for (const pattern of opts.filterCollections) {\n if (pattern.endsWith('.*')) {\n prefixes.push(pattern.slice(0, -2))\n } else {\n exact.add(pattern)\n }\n }\n this.matchCollection = (col: string): boolean => {\n if (exact.has(col)) return true\n for (const prefix of prefixes) {\n if (col.startsWith(prefix)) return true\n }\n return false\n }\n }\n this.sub = new Subscription({\n ...opts,\n service: opts.service ?? 'wss://bsky.network',\n method: com.atproto.sync.subscribeRepos.$lxm,\n signal: this.abortController.signal,\n getParams: async () => {\n let cursor: number | undefined\n if (this.opts.runner) {\n cursor = await this.opts.runner.getCursor()\n } else if (this.opts.getCursor) {\n cursor = await this.opts.getCursor()\n }\n return cursor === undefined ? undefined : { cursor }\n },\n validate: (value: unknown) => {\n const result = com.atproto.sync.subscribeRepos.$message.safeParse(value)\n if (result.success) {\n return result.value\n } else {\n this.opts.onError(new FirehoseValidationError(result.reason, value))\n }\n },\n })\n }\n\n async start() {\n try {\n for await (const evt of this.sub) {\n if (this.opts.runner) {\n const parsed = didAndSeqForEvt(evt)\n if (!parsed) {\n continue\n }\n this.opts.runner.trackEvent(parsed.did, parsed.seq, async () => {\n const parsed = await this.parseEvt(evt)\n for (const write of parsed) {\n try {\n await this.opts.handleEvent(write)\n } catch (err) {\n this.opts.onError(new FirehoseHandlerError(err, write))\n }\n }\n })\n } else {\n await this.processEvt(evt)\n }\n }\n } catch (err) {\n if (err && err['name'] === 'AbortError') {\n this.destoryDefer.resolve()\n return\n }\n this.opts.onError(new FirehoseSubscriptionError(err))\n await wait(this.opts.subscriptionReconnectDelay ?? 3000)\n return this.start()\n }\n }\n\n private async parseEvt(\n evt: com.atproto.sync.subscribeRepos.$Message,\n ): Promise<Event[]> {\n try {\n if (com.atproto.sync.subscribeRepos.commit.$isTypeOf(evt)) {\n if (this.opts.excludeCommit) return []\n\n return this.opts.unauthenticatedCommits\n ? await parseCommitUnauthenticated(evt, this.matchCollection)\n : await parseCommitAuthenticated(\n this.opts.idResolver,\n evt,\n this.matchCollection,\n )\n } else if (com.atproto.sync.subscribeRepos.account.$isTypeOf(evt)) {\n if (this.opts.excludeAccount) return []\n\n const parsed = parseAccount(evt)\n return parsed ? [parsed] : []\n } else if (com.atproto.sync.subscribeRepos.identity.$isTypeOf(evt)) {\n if (this.opts.excludeIdentity) return []\n\n const parsed = await parseIdentity(\n this.opts.idResolver,\n evt,\n this.opts.unauthenticatedHandles,\n )\n return parsed ? [parsed] : []\n } else if (com.atproto.sync.subscribeRepos.sync.$isTypeOf(evt)) {\n if (this.opts.excludeSync) return []\n\n const parsed = await parseSync(evt)\n return parsed ? [parsed] : []\n } else {\n return []\n }\n } catch (err) {\n this.opts.onError(new FirehoseParseError(err, evt))\n return []\n }\n }\n\n private async processEvt(evt: com.atproto.sync.subscribeRepos.$Message) {\n const parsed = await this.parseEvt(evt)\n for (const write of parsed) {\n try {\n await this.opts.handleEvent(write)\n } catch (err) {\n this.opts.onError(new FirehoseHandlerError(err, write))\n }\n }\n }\n\n async destroy(): Promise<void> {\n this.abortController.abort()\n await this.destoryDefer.complete\n }\n}\n\nexport const parseCommitAuthenticated = async (\n idResolver: IdResolver,\n evt: com.atproto.sync.subscribeRepos.Commit,\n matchCollection?: ((col: string) => boolean) | null,\n forceKeyRefresh = false,\n): Promise<CommitEvt[]> => {\n const did = evt.repo\n const ops = maybeFilterOps(evt.ops, matchCollection)\n if (ops.length === 0) {\n return []\n }\n const claims = ops.map((op) => {\n const { collection, rkey } = parseDataKey(op.path)\n return {\n collection,\n rkey,\n cid: op.action === 'delete' ? null : op.cid,\n }\n })\n const key = await idResolver.did.resolveAtprotoKey(did, forceKeyRefresh)\n const verifiedCids: Record<string, Cid | null> = {}\n try {\n const results = await verifyProofs(evt.blocks, claims, did, key)\n results.verified.forEach((op) => {\n const path = formatDataKey(op.collection, op.rkey)\n verifiedCids[path] = op.cid\n })\n } catch (err) {\n if (err instanceof RepoVerificationError && !forceKeyRefresh) {\n return parseCommitAuthenticated(idResolver, evt, matchCollection, true)\n }\n throw err\n }\n const verifiedOps: com.atproto.sync.subscribeRepos.RepoOp[] = ops.filter(\n (op) => {\n const verifiedCid = verifiedCids[op.path]\n if (op.action === 'delete') {\n return verifiedCid === null\n } else {\n return (\n op.cid != null && verifiedCid != null && verifiedCid.equals(op.cid)\n )\n }\n },\n )\n return formatCommitOps(evt, verifiedOps, {\n skipCidVerification: true, // already checked via verifyProofs()\n })\n}\n\nexport const parseCommitUnauthenticated = async (\n evt: com.atproto.sync.subscribeRepos.Commit,\n matchCollection?: ((col: string) => boolean) | null,\n): Promise<CommitEvt[]> => {\n const ops = maybeFilterOps(evt.ops, matchCollection)\n return formatCommitOps(evt, ops)\n}\n\nconst maybeFilterOps = (\n ops: com.atproto.sync.subscribeRepos.RepoOp[],\n matchCollection?: ((col: string) => boolean) | null,\n): com.atproto.sync.subscribeRepos.RepoOp[] => {\n if (!matchCollection) return ops\n return ops.filter((op) => {\n const { collection } = parseDataKey(op.path)\n return matchCollection(collection)\n })\n}\n\nconst formatCommitOps = async (\n evt: com.atproto.sync.subscribeRepos.Commit,\n ops: com.atproto.sync.subscribeRepos.RepoOp[],\n options?: { skipCidVerification: boolean },\n) => {\n const car = await readCar(evt.blocks, options)\n\n const evts: CommitEvt[] = []\n\n for (const op of ops) {\n const uri = AtUri.make(evt.repo, op.path)\n\n const meta: CommitMeta = {\n seq: evt.seq,\n time: evt.time,\n commit: evt.commit,\n blocks: car.blocks,\n rev: evt.rev,\n uri,\n did: uri.did,\n collection: uri.collection,\n rkey: uri.rkey,\n }\n\n if (op.action === 'create' || op.action === 'update') {\n if (!op.cid) continue\n const recordBytes = car.blocks.get(op.cid)\n if (!recordBytes) continue\n const record = cborToLexRecord(recordBytes)\n evts.push({\n ...meta,\n event: op.action as 'create' | 'update',\n cid: op.cid,\n record,\n })\n }\n\n if (op.action === 'delete') {\n evts.push({\n ...meta,\n event: 'delete',\n })\n }\n }\n\n return evts\n}\n\nexport const parseSync = async (\n evt: com.atproto.sync.subscribeRepos.Sync,\n): Promise<SyncEvt | null> => {\n const car = await readCarWithRoot(evt.blocks)\n\n return {\n event: 'sync',\n seq: evt.seq,\n time: evt.time,\n did: evt.did,\n cid: car.root,\n rev: evt.rev,\n blocks: car.blocks,\n }\n}\n\nexport const parseIdentity = async (\n idResolver: IdResolver,\n evt: com.atproto.sync.subscribeRepos.Identity,\n unauthenticated = false,\n): Promise<IdentityEvt | null> => {\n const res = await idResolver.did.resolve(evt.did)\n const handle =\n res && !unauthenticated\n ? await verifyHandle(idResolver, evt.did, res)\n : undefined\n\n return {\n event: 'identity',\n seq: evt.seq,\n time: evt.time,\n did: evt.did,\n handle,\n didDocument: res ?? undefined,\n }\n}\n\nconst verifyHandle = async (\n idResolver: IdResolver,\n did: string,\n didDoc: DidDocument,\n): Promise<string | undefined> => {\n const { handle } = parseToAtprotoDocument(didDoc)\n if (!handle) {\n return undefined\n }\n const res = await idResolver.handle.resolve(handle)\n return res === did ? handle : undefined\n}\n\nexport const parseAccount = (\n evt: com.atproto.sync.subscribeRepos.Account,\n): AccountEvt | undefined => {\n if (evt.status && !isValidStatus(evt.status)) return\n return {\n event: 'account',\n seq: evt.seq,\n time: evt.time,\n did: evt.did,\n active: evt.active,\n status: evt.status as AccountStatus | undefined,\n }\n}\n\nconst isValidStatus = (str: string): str is AccountStatus => {\n return ['takendown', 'suspended', 'deleted', 'deactivated'].includes(str)\n}\n\nexport class FirehoseValidationError extends Error {\n constructor(\n err: unknown,\n public value: unknown,\n ) {\n super('error in firehose event lexicon validation', { cause: err })\n }\n}\n\nexport class FirehoseParseError extends Error {\n constructor(\n err: unknown,\n public event: com.atproto.sync.subscribeRepos.$Message,\n ) {\n super('error in parsing and authenticating firehose event', { cause: err })\n }\n}\n\nexport class FirehoseSubscriptionError extends Error {\n constructor(err: unknown) {\n super('error on firehose subscription', { cause: err })\n }\n}\n\nexport class FirehoseHandlerError extends Error {\n constructor(\n err: unknown,\n public event: Event,\n ) {\n super('error in firehose event handler', { cause: err })\n }\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  export * from './subscribeRepos.defs.js';
2
- export * as $defs from './subscribeRepos.defs.js';
2
+ export { main as default } from './subscribeRepos.defs.js';
3
3
  //# sourceMappingURL=subscribeRepos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeRepos.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA"}
1
+ {"version":3,"file":"subscribeRepos.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAA"}
@@ -1,18 +1,18 @@
1
1
  import { l } from '@atproto/lex';
2
2
  declare const $nsid = "com.atproto.sync.subscribeRepos";
3
3
  export { $nsid };
4
- export declare const $lxm = "com.atproto.sync.subscribeRepos";
5
4
  export declare const $params: l.ParamsSchema<{
6
5
  readonly cursor: l.OptionalSchema<l.IntegerSchema>;
7
6
  }>;
7
+ export type $Params = l.InferOutput<typeof $params>;
8
8
  export declare const $message: l.TypedUnionSchema<readonly [l.TypedRefSchema<l.TypedObjectValidator<Commit, Commit>>, l.TypedRefSchema<l.TypedObjectValidator<Sync, Sync>>, l.TypedRefSchema<l.TypedObjectValidator<Identity, Identity>>, l.TypedRefSchema<l.TypedObjectValidator<Account, Account>>, l.TypedRefSchema<l.TypedObjectValidator<Info, Info>>], false>;
9
+ export type $Message = l.InferOutput<typeof $message>;
9
10
  /** Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. */
10
11
  declare const main: l.Subscription<"com.atproto.sync.subscribeRepos", l.ParamsSchema<{
11
12
  readonly cursor: l.OptionalSchema<l.IntegerSchema>;
12
13
  }>, l.TypedUnionSchema<readonly [l.TypedRefSchema<l.TypedObjectValidator<Commit, Commit>>, l.TypedRefSchema<l.TypedObjectValidator<Sync, Sync>>, l.TypedRefSchema<l.TypedObjectValidator<Identity, Identity>>, l.TypedRefSchema<l.TypedObjectValidator<Account, Account>>, l.TypedRefSchema<l.TypedObjectValidator<Info, Info>>], false>, readonly ["FutureCursor", "ConsumerTooSlow"]>;
13
14
  export { main };
14
- export type $Params = l.InferMethodParams<typeof main>;
15
- export type $Message = l.InferSubscriptionMessage<typeof main>;
15
+ export declare const $lxm = "com.atproto.sync.subscribeRepos";
16
16
  /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */
17
17
  type Commit = {
18
18
  $type?: 'com.atproto.sync.subscribeRepos#commit';
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeRepos.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,QAAA,MAAM,KAAK,oCAAoC,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,eAAO,MAAM,IAAI,oCAAQ,CAAA;AACzB,eAAO,MAAM,OAAO;;EAAgD,CAAA;AACpE,eAAO,MAAM,QAAQ,sUASpB,CAAA;AACD,oVAAoV;AACpV,QAAA,MAAM,IAAI;;uXAGR,CAAA;AAEF,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAA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AAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,IAAI,CAAA;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAA;CACb,CAAA;AAED,YAAY,EAAE,MAAM,EAAE,CAAA;AAEtB,0DAA0D;AAC1D,QAAA,MAAM,MAAM,4FAWX,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -4,74 +4,85 @@
4
4
  import { l } from '@atproto/lex';
5
5
  const $nsid = 'com.atproto.sync.subscribeRepos';
6
6
  export { $nsid };
7
- export const $lxm = $nsid;
8
- export const $params = l.params({ cursor: l.optional(l.integer()) });
9
- export const $message = l.typedUnion([
10
- l.typedRef((() => commit)),
11
- l.typedRef((() => sync)),
12
- l.typedRef((() => identity)),
13
- l.typedRef((() => account)),
14
- l.typedRef((() => info)),
7
+ export const $params = /*#__PURE__*/ l.params({
8
+ cursor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.integer()),
9
+ });
10
+ export const $message = /*#__PURE__*/ l.typedUnion([
11
+ /*#__PURE__*/ l.typedRef((() => commit)),
12
+ /*#__PURE__*/ l.typedRef((() => sync)),
13
+ /*#__PURE__*/ l.typedRef((() => identity)),
14
+ /*#__PURE__*/ l.typedRef((() => account)),
15
+ /*#__PURE__*/ l.typedRef((() => info)),
15
16
  ], false);
16
17
  /** Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. */
17
- const main = l.subscription($nsid, $params, $message, [
18
+ const main = /*#__PURE__*/ l.subscription($nsid, $params, $message, [
18
19
  'FutureCursor',
19
20
  'ConsumerTooSlow',
20
21
  ]);
21
22
  export { main };
23
+ export const $lxm = $nsid;
22
24
  /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */
23
- const commit = l.typedObject($nsid, 'commit', l.object({
24
- seq: l.integer(),
25
- rebase: l.boolean(),
26
- tooBig: l.boolean(),
27
- repo: l.string({ format: 'did' }),
28
- commit: l.cid(),
29
- rev: l.string({ format: 'tid' }),
30
- since: l.nullable(l.string({ format: 'tid' })),
31
- blocks: l.bytes({ maxLength: 2000000 }),
32
- ops: l.array(l.ref((() => repoOp)), { maxLength: 200 }),
33
- blobs: l.array(l.cid()),
34
- prevData: l.optional(l.cid()),
35
- time: l.string({ format: 'datetime' }),
25
+ const commit = /*#__PURE__*/ l.typedObject($nsid, 'commit',
26
+ /*#__PURE__*/ l.object({
27
+ seq: /*#__PURE__*/ l.integer(),
28
+ rebase: /*#__PURE__*/ l.boolean(),
29
+ tooBig: /*#__PURE__*/ l.boolean(),
30
+ repo: /*#__PURE__*/ l.string({ format: 'did' }),
31
+ commit: /*#__PURE__*/ l.cid(),
32
+ rev: /*#__PURE__*/ l.string({ format: 'tid' }),
33
+ since: /*#__PURE__*/ l.nullable(/*#__PURE__*/ l.string({ format: 'tid' })),
34
+ blocks: /*#__PURE__*/ l.bytes({ maxLength: 2000000 }),
35
+ ops: /*#__PURE__*/ l.array(
36
+ /*#__PURE__*/ l.ref((() => repoOp)), { maxLength: 200 }),
37
+ blobs: /*#__PURE__*/ l.array(/*#__PURE__*/ l.cid()),
38
+ prevData: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.cid()),
39
+ time: /*#__PURE__*/ l.string({ format: 'datetime' }),
36
40
  }));
37
41
  export { commit };
38
42
  /** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */
39
- const sync = l.typedObject($nsid, 'sync', l.object({
40
- seq: l.integer(),
41
- did: l.string({ format: 'did' }),
42
- blocks: l.bytes({ maxLength: 10000 }),
43
- rev: l.string(),
44
- time: l.string({ format: 'datetime' }),
43
+ const sync = /*#__PURE__*/ l.typedObject($nsid, 'sync',
44
+ /*#__PURE__*/ l.object({
45
+ seq: /*#__PURE__*/ l.integer(),
46
+ did: /*#__PURE__*/ l.string({ format: 'did' }),
47
+ blocks: /*#__PURE__*/ l.bytes({ maxLength: 10000 }),
48
+ rev: /*#__PURE__*/ l.string(),
49
+ time: /*#__PURE__*/ l.string({ format: 'datetime' }),
45
50
  }));
46
51
  export { sync };
47
52
  /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */
48
- const identity = l.typedObject($nsid, 'identity', l.object({
49
- seq: l.integer(),
50
- did: l.string({ format: 'did' }),
51
- time: l.string({ format: 'datetime' }),
52
- handle: l.optional(l.string({ format: 'handle' })),
53
+ const identity = /*#__PURE__*/ l.typedObject($nsid, 'identity',
54
+ /*#__PURE__*/ l.object({
55
+ seq: /*#__PURE__*/ l.integer(),
56
+ did: /*#__PURE__*/ l.string({ format: 'did' }),
57
+ time: /*#__PURE__*/ l.string({ format: 'datetime' }),
58
+ handle: /*#__PURE__*/ l.optional(
59
+ /*#__PURE__*/ l.string({ format: 'handle' })),
53
60
  }));
54
61
  export { identity };
55
62
  /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */
56
- const account = l.typedObject($nsid, 'account', l.object({
57
- seq: l.integer(),
58
- did: l.string({ format: 'did' }),
59
- time: l.string({ format: 'datetime' }),
60
- active: l.boolean(),
61
- status: l.optional(l.string()),
63
+ const account = /*#__PURE__*/ l.typedObject($nsid, 'account',
64
+ /*#__PURE__*/ l.object({
65
+ seq: /*#__PURE__*/ l.integer(),
66
+ did: /*#__PURE__*/ l.string({ format: 'did' }),
67
+ time: /*#__PURE__*/ l.string({ format: 'datetime' }),
68
+ active: /*#__PURE__*/ l.boolean(),
69
+ status: /*#__PURE__*/ l.optional(
70
+ /*#__PURE__*/ l.string()),
62
71
  }));
63
72
  export { account };
64
- const info = l.typedObject($nsid, 'info', l.object({
65
- name: l.string(),
66
- message: l.optional(l.string()),
73
+ const info = /*#__PURE__*/ l.typedObject($nsid, 'info',
74
+ /*#__PURE__*/ l.object({
75
+ name: /*#__PURE__*/ l.string(),
76
+ message: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
67
77
  }));
68
78
  export { info };
69
79
  /** A repo operation, ie a mutation of a single record. */
70
- const repoOp = l.typedObject($nsid, 'repoOp', l.object({
71
- action: l.string(),
72
- path: l.string(),
73
- cid: l.nullable(l.cid()),
74
- prev: l.optional(l.cid()),
80
+ const repoOp = /*#__PURE__*/ l.typedObject($nsid, 'repoOp',
81
+ /*#__PURE__*/ l.object({
82
+ action: /*#__PURE__*/ l.string(),
83
+ path: /*#__PURE__*/ l.string(),
84
+ cid: /*#__PURE__*/ l.nullable(/*#__PURE__*/ l.cid()),
85
+ prev: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.cid()),
75
86
  }));
76
87
  export { repoOp };
77
88
  //# sourceMappingURL=subscribeRepos.defs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeRepos.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,MAAM,KAAK,GAAG,iCAAiC,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAA;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAA;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,UAAU,CAClC;IACE,CAAC,CAAC,QAAQ,CAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAQ,CAAC;IACzC,CAAC,C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GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex'\n\nconst $nsid = 'com.atproto.sync.subscribeRepos'\n\nexport { $nsid }\n\nexport const $lxm = $nsid\nexport const $params = l.params({ cursor: l.optional(l.integer()) })\nexport const $message = l.typedUnion(\n [\n l.typedRef<Commit>((() => commit) as any),\n l.typedRef<Sync>((() => sync) as any),\n l.typedRef<Identity>((() => identity) as any),\n l.typedRef<Account>((() => account) as any),\n l.typedRef<Info>((() => info) as any),\n ],\n false,\n)\n/** Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. */\nconst main = l.subscription($nsid, $params, $message, [\n 'FutureCursor',\n 'ConsumerTooSlow',\n])\n\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Message = l.InferSubscriptionMessage<typeof main>\n/** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */\ntype Commit = {\n $type?: 'com.atproto.sync.subscribeRepos#commit'\n\n /**\n * The stream sequence number of this message.\n */\n seq: number\n\n /**\n * @deprecated unused\n */\n rebase: boolean\n\n /**\n * @deprecated replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data.\n */\n tooBig: boolean\n\n /**\n * The repo this event comes from. Note that all other message types name this field 'did'.\n */\n repo: l.DidString\n\n /**\n * Repo commit object CID.\n */\n commit: l.Cid\n\n /**\n * The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.\n */\n rev: l.TidString\n\n /**\n * The rev of the last emitted commit from this repo (if any).\n */\n since: l.TidString | null\n\n /**\n * CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list.\n */\n blocks: Uint8Array\n ops: RepoOp[]\n blobs: l.Cid[]\n\n /**\n * The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose.\n */\n prevData?: l.Cid\n\n /**\n * Timestamp of when this message was originally broadcast.\n */\n time: l.DatetimeString\n}\n\nexport type { Commit }\n\n/** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */\nconst commit = l.typedObject<Commit>(\n $nsid,\n 'commit',\n l.object({\n seq: l.integer(),\n rebase: l.boolean(),\n tooBig: l.boolean(),\n repo: l.string({ format: 'did' }),\n commit: l.cid(),\n rev: l.string({ format: 'tid' }),\n since: l.nullable(l.string({ format: 'tid' })),\n blocks: l.bytes({ maxLength: 2000000 }),\n ops: l.array(l.ref<RepoOp>((() => repoOp) as any), { maxLength: 200 }),\n blobs: l.array(l.cid()),\n prevData: l.optional(l.cid()),\n time: l.string({ format: 'datetime' }),\n }),\n)\n\nexport { commit }\n\n/** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */\ntype Sync = {\n $type?: 'com.atproto.sync.subscribeRepos#sync'\n\n /**\n * The stream sequence number of this message.\n */\n seq: number\n\n /**\n * The account this repo event corresponds to. Must match that in the commit object.\n */\n did: l.DidString\n\n /**\n * CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'.\n */\n blocks: Uint8Array\n\n /**\n * The rev of the commit. This value must match that in the commit object.\n */\n rev: string\n\n /**\n * Timestamp of when this message was originally broadcast.\n */\n time: l.DatetimeString\n}\n\nexport type { Sync }\n\n/** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */\nconst sync = l.typedObject<Sync>(\n $nsid,\n 'sync',\n l.object({\n seq: l.integer(),\n did: l.string({ format: 'did' }),\n blocks: l.bytes({ maxLength: 10000 }),\n rev: l.string(),\n time: l.string({ format: 'datetime' }),\n }),\n)\n\nexport { sync }\n\n/** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */\ntype Identity = {\n $type?: 'com.atproto.sync.subscribeRepos#identity'\n seq: number\n did: l.DidString\n time: l.DatetimeString\n\n /**\n * The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.\n */\n handle?: l.HandleString\n}\n\nexport type { Identity }\n\n/** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */\nconst identity = l.typedObject<Identity>(\n $nsid,\n 'identity',\n l.object({\n seq: l.integer(),\n did: l.string({ format: 'did' }),\n time: l.string({ format: 'datetime' }),\n handle: l.optional(l.string({ format: 'handle' })),\n }),\n)\n\nexport { identity }\n\n/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */\ntype Account = {\n $type?: 'com.atproto.sync.subscribeRepos#account'\n seq: number\n did: l.DidString\n time: l.DatetimeString\n\n /**\n * Indicates that the account has a repository which can be fetched from the host that emitted this event.\n */\n active: boolean\n\n /**\n * If active=false, this optional field indicates a reason for why the account is not active.\n */\n status?:\n | 'takendown'\n | 'suspended'\n | 'deleted'\n | 'deactivated'\n | 'desynchronized'\n | 'throttled'\n | l.UnknownString\n}\n\nexport type { Account }\n\n/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */\nconst account = l.typedObject<Account>(\n $nsid,\n 'account',\n l.object({\n seq: l.integer(),\n did: l.string({ format: 'did' }),\n time: l.string({ format: 'datetime' }),\n active: l.boolean(),\n status: l.optional(\n l.string<{\n knownValues: [\n 'takendown',\n 'suspended',\n 'deleted',\n 'deactivated',\n 'desynchronized',\n 'throttled',\n ]\n }>(),\n ),\n }),\n)\n\nexport { account }\n\ntype Info = {\n $type?: 'com.atproto.sync.subscribeRepos#info'\n name: 'OutdatedCursor' | l.UnknownString\n message?: string\n}\n\nexport type { Info }\n\nconst info = l.typedObject<Info>(\n $nsid,\n 'info',\n l.object({\n name: l.string<{ knownValues: ['OutdatedCursor'] }>(),\n message: l.optional(l.string()),\n }),\n)\n\nexport { info }\n\n/** A repo operation, ie a mutation of a single record. */\ntype RepoOp = {\n $type?: 'com.atproto.sync.subscribeRepos#repoOp'\n action: 'create' | 'update' | 'delete' | l.UnknownString\n path: string\n\n /**\n * For creates and updates, the new record CID. For deletions, null.\n */\n cid: l.Cid | null\n\n /**\n * For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined.\n */\n prev?: l.Cid\n}\n\nexport type { RepoOp }\n\n/** A repo operation, ie a mutation of a single record. */\nconst repoOp = l.typedObject<RepoOp>(\n $nsid,\n 'repoOp',\n l.object({\n action: l.string<{ knownValues: ['create', 'update', 'delete'] }>(),\n path: l.string(),\n cid: l.nullable(l.cid()),\n prev: l.optional(l.cid()),\n }),\n)\n\nexport { repoOp }\n"]}
1
+ {"version":3,"file":"subscribeRepos.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,MAAM,KAAK,GAAG,iCAAiC,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CAC5D,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC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AE,OAAO,EAAE,CAAA;AAUlB,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CACtC,KAAK,EACL,MAAM;AACN,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,EAAuC;IACnE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC5D,CAAC,CACH,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA;AAqBf,0DAA0D;AAC1D,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CACxC,KAAK,EACL,QAAQ;AACR,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,EAE1B;IACJ,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,EAAE;IAC9B,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACpD,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;CACtD,CAAC,CACH,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex'\n\nconst $nsid = 'com.atproto.sync.subscribeRepos'\n\nexport { $nsid }\n\nexport const $params = /*#__PURE__*/ l.params({\n cursor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.integer()),\n})\n\nexport type $Params = l.InferOutput<typeof $params>\n\nexport const $message = /*#__PURE__*/ l.typedUnion(\n [\n /*#__PURE__*/ l.typedRef<Commit>((() => commit) as any),\n /*#__PURE__*/ l.typedRef<Sync>((() => sync) as any),\n /*#__PURE__*/ l.typedRef<Identity>((() => identity) as any),\n /*#__PURE__*/ l.typedRef<Account>((() => account) as any),\n /*#__PURE__*/ l.typedRef<Info>((() => info) as any),\n ],\n false,\n)\n\nexport type $Message = l.InferOutput<typeof $message>\n\n/** Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. */\nconst main = /*#__PURE__*/ l.subscription($nsid, $params, $message, [\n 'FutureCursor',\n 'ConsumerTooSlow',\n])\n\nexport { main }\n\nexport const $lxm = $nsid\n\n/** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */\ntype Commit = {\n $type?: 'com.atproto.sync.subscribeRepos#commit'\n\n /**\n * The stream sequence number of this message.\n */\n seq: number\n\n /**\n * @deprecated unused\n */\n rebase: boolean\n\n /**\n * @deprecated replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data.\n */\n tooBig: boolean\n\n /**\n * The repo this event comes from. Note that all other message types name this field 'did'.\n */\n repo: l.DidString\n\n /**\n * Repo commit object CID.\n */\n commit: l.Cid\n\n /**\n * The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.\n */\n rev: l.TidString\n\n /**\n * The rev of the last emitted commit from this repo (if any).\n */\n since: l.TidString | null\n\n /**\n * CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list.\n */\n blocks: Uint8Array\n ops: RepoOp[]\n blobs: l.Cid[]\n\n /**\n * The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose.\n */\n prevData?: l.Cid\n\n /**\n * Timestamp of when this message was originally broadcast.\n */\n time: l.DatetimeString\n}\n\nexport type { Commit }\n\n/** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */\nconst commit = /*#__PURE__*/ l.typedObject<Commit>(\n $nsid,\n 'commit',\n /*#__PURE__*/ l.object({\n seq: /*#__PURE__*/ l.integer(),\n rebase: /*#__PURE__*/ l.boolean(),\n tooBig: /*#__PURE__*/ l.boolean(),\n repo: /*#__PURE__*/ l.string({ format: 'did' }),\n commit: /*#__PURE__*/ l.cid(),\n rev: /*#__PURE__*/ l.string({ format: 'tid' }),\n since: /*#__PURE__*/ l.nullable(/*#__PURE__*/ l.string({ format: 'tid' })),\n blocks: /*#__PURE__*/ l.bytes({ maxLength: 2000000 }),\n ops: /*#__PURE__*/ l.array(\n /*#__PURE__*/ l.ref<RepoOp>((() => repoOp) as any),\n { maxLength: 200 },\n ),\n blobs: /*#__PURE__*/ l.array(/*#__PURE__*/ l.cid()),\n prevData: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.cid()),\n time: /*#__PURE__*/ l.string({ format: 'datetime' }),\n }),\n)\n\nexport { commit }\n\n/** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */\ntype Sync = {\n $type?: 'com.atproto.sync.subscribeRepos#sync'\n\n /**\n * The stream sequence number of this message.\n */\n seq: number\n\n /**\n * The account this repo event corresponds to. Must match that in the commit object.\n */\n did: l.DidString\n\n /**\n * CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'.\n */\n blocks: Uint8Array\n\n /**\n * The rev of the commit. This value must match that in the commit object.\n */\n rev: string\n\n /**\n * Timestamp of when this message was originally broadcast.\n */\n time: l.DatetimeString\n}\n\nexport type { Sync }\n\n/** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */\nconst sync = /*#__PURE__*/ l.typedObject<Sync>(\n $nsid,\n 'sync',\n /*#__PURE__*/ l.object({\n seq: /*#__PURE__*/ l.integer(),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n blocks: /*#__PURE__*/ l.bytes({ maxLength: 10000 }),\n rev: /*#__PURE__*/ l.string(),\n time: /*#__PURE__*/ l.string({ format: 'datetime' }),\n }),\n)\n\nexport { sync }\n\n/** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */\ntype Identity = {\n $type?: 'com.atproto.sync.subscribeRepos#identity'\n seq: number\n did: l.DidString\n time: l.DatetimeString\n\n /**\n * The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.\n */\n handle?: l.HandleString\n}\n\nexport type { Identity }\n\n/** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */\nconst identity = /*#__PURE__*/ l.typedObject<Identity>(\n $nsid,\n 'identity',\n /*#__PURE__*/ l.object({\n seq: /*#__PURE__*/ l.integer(),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n time: /*#__PURE__*/ l.string({ format: 'datetime' }),\n handle: /*#__PURE__*/ l.optional(\n /*#__PURE__*/ l.string({ format: 'handle' }),\n ),\n }),\n)\n\nexport { identity }\n\n/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */\ntype Account = {\n $type?: 'com.atproto.sync.subscribeRepos#account'\n seq: number\n did: l.DidString\n time: l.DatetimeString\n\n /**\n * Indicates that the account has a repository which can be fetched from the host that emitted this event.\n */\n active: boolean\n\n /**\n * If active=false, this optional field indicates a reason for why the account is not active.\n */\n status?:\n | 'takendown'\n | 'suspended'\n | 'deleted'\n | 'deactivated'\n | 'desynchronized'\n | 'throttled'\n | l.UnknownString\n}\n\nexport type { Account }\n\n/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */\nconst account = /*#__PURE__*/ l.typedObject<Account>(\n $nsid,\n 'account',\n /*#__PURE__*/ l.object({\n seq: /*#__PURE__*/ l.integer(),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n time: /*#__PURE__*/ l.string({ format: 'datetime' }),\n active: /*#__PURE__*/ l.boolean(),\n status: /*#__PURE__*/ l.optional(\n /*#__PURE__*/ l.string<{\n knownValues: [\n 'takendown',\n 'suspended',\n 'deleted',\n 'deactivated',\n 'desynchronized',\n 'throttled',\n ]\n }>(),\n ),\n }),\n)\n\nexport { account }\n\ntype Info = {\n $type?: 'com.atproto.sync.subscribeRepos#info'\n name: 'OutdatedCursor' | l.UnknownString\n message?: string\n}\n\nexport type { Info }\n\nconst info = /*#__PURE__*/ l.typedObject<Info>(\n $nsid,\n 'info',\n /*#__PURE__*/ l.object({\n name: /*#__PURE__*/ l.string<{ knownValues: ['OutdatedCursor'] }>(),\n message: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n }),\n)\n\nexport { info }\n\n/** A repo operation, ie a mutation of a single record. */\ntype RepoOp = {\n $type?: 'com.atproto.sync.subscribeRepos#repoOp'\n action: 'create' | 'update' | 'delete' | l.UnknownString\n path: string\n\n /**\n * For creates and updates, the new record CID. For deletions, null.\n */\n cid: l.Cid | null\n\n /**\n * For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined.\n */\n prev?: l.Cid\n}\n\nexport type { RepoOp }\n\n/** A repo operation, ie a mutation of a single record. */\nconst repoOp = /*#__PURE__*/ l.typedObject<RepoOp>(\n $nsid,\n 'repoOp',\n /*#__PURE__*/ l.object({\n action: /*#__PURE__*/ l.string<{\n knownValues: ['create', 'update', 'delete']\n }>(),\n path: /*#__PURE__*/ l.string(),\n cid: /*#__PURE__*/ l.nullable(/*#__PURE__*/ l.cid()),\n prev: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.cid()),\n }),\n)\n\nexport { repoOp }\n"]}
@@ -2,5 +2,5 @@
2
2
  * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
3
  */
4
4
  export * from './subscribeRepos.defs.js';
5
- export * as $defs from './subscribeRepos.defs.js';
5
+ export { main as default } from './subscribeRepos.defs.js';
6
6
  //# sourceMappingURL=subscribeRepos.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeRepos.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,0BAA0B,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './subscribeRepos.defs.js'\nexport * as $defs from './subscribeRepos.defs.js'\n"]}
1
+ {"version":3,"file":"subscribeRepos.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './subscribeRepos.defs.js'\nexport { main as default } from './subscribeRepos.defs.js'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"consecutive-list.d.ts","sourceRoot":"","sources":["../../src/runner/consecutive-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAe,CAAC,CAAC;IAC5B,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAK;IAE/B,IAAI,CAAC,KAAK,EAAE,CAAC;IAMb,QAAQ,IAAI,CAAC,EAAE;CAOhB;AAED,qBAAa,eAAe,CAAC,CAAC;IAG1B,OAAO,CAAC,WAAW;IACZ,KAAK,EAAE,CAAC;IAHjB,UAAU,UAAQ;gBAER,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,EAChC,KAAK,EAAE,CAAC;IAGjB,QAAQ;CAIT"}
1
+ {"version":3,"file":"consecutive-list.d.ts","sourceRoot":"","sources":["../../src/runner/consecutive-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAe,CAAC,CAAC;IAC5B,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAK;IAE/B,IAAI,CAAC,KAAK,EAAE,CAAC,sBAIZ;IAED,QAAQ,IAAI,CAAC,EAAE,CAMd;CACF;AAED,qBAAa,eAAe,CAAC,CAAC;IAG1B,OAAO,CAAC,WAAW;IACZ,KAAK,EAAE,CAAC;IAHjB,UAAU,UAAQ;IAClB,YACU,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,EAChC,KAAK,EAAE,CAAC,EACb;IAEJ,QAAQ,QAGP;CACF"}
@@ -1,25 +1,24 @@
1
- import PQueue from 'p-queue';
2
- import { ConsecutiveList } from './consecutive-list.js';
3
1
  import { EventRunner } from './types.js';
4
2
  export type MemoryRunnerOptions = {
5
3
  setCursor?: (cursor: number) => Promise<void>;
6
4
  concurrency?: number;
7
5
  startCursor?: number;
8
6
  };
9
- type Queue = InstanceType<typeof PQueue>;
10
7
  export declare class MemoryRunner implements EventRunner {
11
8
  opts: MemoryRunnerOptions;
12
- consecutive: ConsecutiveList<number>;
13
- mainQueue: Queue;
14
- partitions: Map<string, Queue>;
15
- cursor: number | undefined;
9
+ private destroyed;
10
+ private readonly consecutive;
11
+ private readonly mainQueue;
12
+ private readonly partitions;
13
+ private cursor;
16
14
  constructor(opts?: MemoryRunnerOptions);
17
15
  getCursor(): number | undefined;
16
+ /** @deprecated internal use only */
17
+ get partitionCount(): number;
18
18
  addTask(partitionId: string, task: () => Promise<void>): Promise<void>;
19
19
  private getPartition;
20
20
  trackEvent(did: string, seq: number, handler: () => Promise<void>): Promise<void>;
21
21
  processAll(): Promise<void>;
22
22
  destroy(): Promise<void>;
23
23
  }
24
- export {};
25
24
  //# sourceMappingURL=memory-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-runner.d.ts","sourceRoot":"","sources":["../../src/runner/memory-runner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,KAAK,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAA;AAIxC,qBAAa,YAAa,YAAW,WAAW;IAM3B,IAAI,EAAE,mBAAmB;IAL5C,WAAW,0BAAgC;IAC3C,SAAS,EAAE,KAAK,CAAA;IAChB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAY;IAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEP,IAAI,GAAE,mBAAwB;IAKjD,SAAS;IAIH,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAO5D,OAAO,CAAC,YAAY;IAUd,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAejE,UAAU;IAIV,OAAO;CAMd"}
1
+ {"version":3,"file":"memory-runner.d.ts","sourceRoot":"","sources":["../../src/runner/memory-runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAMD,qBAAa,YAAa,YAAW,WAAW;IAO3B,IAAI,EAAE,mBAAmB;IAN5C,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAC5D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAO;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgC;IAC3D,OAAO,CAAC,MAAM,CAAoB;IAElC,YAAmB,IAAI,GAAE,mBAAwB,EAGhD;IAED,SAAS,uBAER;IAED,oCAAoC;IACpC,IAAI,cAAc,WAEjB;IAEK,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,iBAK3D;IAED,OAAO,CAAC,YAAY;IAUd,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,iBAatE;IAEK,UAAU,kBAGf;IAEK,OAAO,kBAKZ;CACF"}
@@ -5,6 +5,7 @@ import { ConsecutiveList } from './consecutive-list.js';
5
5
  export class MemoryRunner {
6
6
  constructor(opts = {}) {
7
7
  this.opts = opts;
8
+ this.destroyed = false;
8
9
  this.consecutive = new ConsecutiveList();
9
10
  this.partitions = new Map();
10
11
  this.mainQueue = new PQueue({ concurrency: opts.concurrency ?? Infinity });
@@ -13,8 +14,12 @@ export class MemoryRunner {
13
14
  getCursor() {
14
15
  return this.cursor;
15
16
  }
17
+ /** @deprecated internal use only */
18
+ get partitionCount() {
19
+ return this.partitions.size;
20
+ }
16
21
  async addTask(partitionId, task) {
17
- if (this.mainQueue.isPaused)
22
+ if (this.destroyed)
18
23
  return;
19
24
  return this.mainQueue.add(() => {
20
25
  return this.getPartition(partitionId).add(task);
@@ -30,7 +35,7 @@ export class MemoryRunner {
30
35
  return partition;
31
36
  }
32
37
  async trackEvent(did, seq, handler) {
33
- if (this.mainQueue.isPaused)
38
+ if (this.destroyed)
34
39
  return;
35
40
  const item = this.consecutive.push(seq);
36
41
  await this.addTask(did, async () => {
@@ -45,13 +50,15 @@ export class MemoryRunner {
45
50
  });
46
51
  }
47
52
  async processAll() {
48
- await this.mainQueue.onIdle();
53
+ const queue = this.mainQueue;
54
+ while (queue.size || queue.pending)
55
+ await queue.onIdle();
49
56
  }
50
57
  async destroy() {
51
- this.mainQueue.pause();
58
+ this.destroyed = true;
52
59
  this.mainQueue.clear();
53
60
  this.partitions.forEach((p) => p.clear());
54
- await this.mainQueue.onIdle();
61
+ await this.processAll();
55
62
  }
56
63
  }
57
64
  //# sourceMappingURL=memory-runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-runner.js","sourceRoot":"","sources":["../../src/runner/memory-runner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAWvD,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,OAAO,YAAY;IAMvB,YAAmB,OAA4B,EAAE;QAA9B,SAAI,GAAJ,IAAI,CAA0B;QALjD,gBAAW,GAAG,IAAI,eAAe,EAAU,CAAA;QAE3C,eAAU,GAAuB,IAAI,GAAG,EAAE,CAAA;QAIxC,IAAI,CAAC,SAAS,GAAG,IAAI,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,QAAQ,EAAE,CAAC,CAAA;QAC1E,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;IAChC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,IAAyB;Q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AI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBACxC,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;QACtB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;QACzC,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAA;IAC/B,CAAC;CACF","sourcesContent":["import PQueue from 'p-queue'\nimport { ConsecutiveList } from './consecutive-list.js'\nimport { EventRunner } from './types.js'\n\nexport type MemoryRunnerOptions = {\n setCursor?: (cursor: number) => Promise<void>\n concurrency?: number\n startCursor?: number\n}\n\ntype Queue = InstanceType<typeof PQueue>\n\n// A queue with arbitrarily many partitions, each processing work sequentially.\n// Partitions are created lazily and taken out of memory when they go idle.\nexport class MemoryRunner implements EventRunner {\n consecutive = new ConsecutiveList<number>()\n mainQueue: Queue\n partitions: Map<string, Queue> = new Map()\n cursor: number | undefined\n\n constructor(public opts: MemoryRunnerOptions = {}) {\n this.mainQueue = new PQueue({ concurrency: opts.concurrency ?? Infinity })\n this.cursor = opts.startCursor\n }\n\n getCursor() {\n return this.cursor\n }\n\n async addTask(partitionId: string, task: () => Promise<void>) {\n if (this.mainQueue.isPaused) return\n return this.mainQueue.add(() => {\n return this.getPartition(partitionId).add(task)\n })\n }\n\n private getPartition(partitionId: string) {\n let partition = this.partitions.get(partitionId)\n if (!partition) {\n partition = new PQueue({ concurrency: 1 })\n partition.once('idle', () => this.partitions.delete(partitionId))\n this.partitions.set(partitionId, partition)\n }\n return partition\n }\n\n async trackEvent(did: string, seq: number, handler: () => Promise<void>) {\n if (this.mainQueue.isPaused) return\n const item = this.consecutive.push(seq)\n await this.addTask(did, async () => {\n await handler()\n const latest = item.complete().at(-1)\n if (latest !== undefined) {\n this.cursor = latest\n if (this.opts.setCursor) {\n await this.opts.setCursor(this.cursor)\n }\n }\n })\n }\n\n async processAll() {\n await this.mainQueue.onIdle()\n }\n\n async destroy() {\n this.mainQueue.pause()\n this.mainQueue.clear()\n this.partitions.forEach((p) => p.clear())\n await this.mainQueue.onIdle()\n }\n}\n"]}
1
+ {"version":3,"file":"memory-runner.js","sourceRoot":"","sources":["../../src/runner/memory-runner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAWvD,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,OAAO,YAAY;IAOvB,YAAmB,IAAI,GAAwB,EAAE;QAA9B,SAAI,GAAJ,IAAI,CAA0B;QANzC,cAAS,GAAG,KAAK,CAAA;QACR,gBAAW,GAAG,IAAI,eAAe,EAAU,CAAA;QAE3C,eAAU,GAAuB,IAAI,GAAG,EAAE,CAAA;QAIzD,IAAI,CAAC,SAAS,GAAG,IAAI,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,QAAQ,EAAE,CAAC,CAAA;QAC1E,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;IAChC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,oCAAoC;IACpC,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,IAAyB;QAC1D,IAAI,IAAI,CAAC,SAAS;YAAE,OAAM;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,E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IAED,KAAK,CAAC,UAAU;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAA;QAC5B,OAAO,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO;YAAE,MAAM,KAAK,CAAC,MAAM,EAAE,CAAA;IAC1D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QACrB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;QACtB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;QACzC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;IACzB,CAAC;CACF","sourcesContent":["import PQueue from 'p-queue'\nimport { ConsecutiveList } from './consecutive-list.js'\nimport { EventRunner } from './types.js'\n\nexport type MemoryRunnerOptions = {\n setCursor?: (cursor: number) => Promise<void>\n concurrency?: number\n startCursor?: number\n}\n\ntype Queue = InstanceType<typeof PQueue>\n\n// A queue with arbitrarily many partitions, each processing work sequentially.\n// Partitions are created lazily and taken out of memory when they go idle.\nexport class MemoryRunner implements EventRunner {\n private destroyed = false\n private readonly consecutive = new ConsecutiveList<number>()\n private readonly mainQueue: Queue\n private readonly partitions: Map<string, Queue> = new Map()\n private cursor: number | undefined\n\n constructor(public opts: MemoryRunnerOptions = {}) {\n this.mainQueue = new PQueue({ concurrency: opts.concurrency ?? Infinity })\n this.cursor = opts.startCursor\n }\n\n getCursor() {\n return this.cursor\n }\n\n /** @deprecated internal use only */\n get partitionCount() {\n return this.partitions.size\n }\n\n async addTask(partitionId: string, task: () => Promise<void>) {\n if (this.destroyed) return\n return this.mainQueue.add(() => {\n return this.getPartition(partitionId).add(task)\n })\n }\n\n private getPartition(partitionId: string) {\n let partition = this.partitions.get(partitionId)\n if (!partition) {\n partition = new PQueue({ concurrency: 1 })\n partition.once('idle', () => this.partitions.delete(partitionId))\n this.partitions.set(partitionId, partition)\n }\n return partition\n }\n\n async trackEvent(did: string, seq: number, handler: () => Promise<void>) {\n if (this.destroyed) return\n const item = this.consecutive.push(seq)\n await this.addTask(did, async () => {\n await handler()\n const latest = item.complete().at(-1)\n if (latest !== undefined) {\n this.cursor = latest\n if (this.opts.setCursor) {\n await this.opts.setCursor(this.cursor)\n }\n }\n })\n }\n\n async processAll() {\n const queue = this.mainQueue\n while (queue.size || queue.pending) await queue.onIdle()\n }\n\n async destroy() {\n this.destroyed = true\n this.mainQueue.clear()\n this.partitions.forEach((p) => p.clear())\n await this.processAll()\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAEzC,eAAO,MAAM,eAAe,GAC1B,KAAK,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,KAC5C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAWjC,CAAA"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAEzC,eAAO,MAAM,eAAe,QACrB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,KAC5C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAWjC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/sync",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "license": "MIT",
5
5
  "description": "atproto sync library",
6
6
  "keywords": [
@@ -21,17 +21,16 @@
21
21
  "dependencies": {
22
22
  "p-queue": "^8.0.0",
23
23
  "ws": "^8.12.0",
24
- "@atproto/common": "^0.6.1",
25
- "@atproto/identity": "^0.5.0",
26
- "@atproto/lex": "^0.1.1",
27
- "@atproto/repo": "^0.10.0",
28
- "@atproto/syntax": "^0.6.1",
29
- "@atproto/xrpc-server": "^0.11.0"
24
+ "@atproto/identity": "^0.5.1",
25
+ "@atproto/common": "^0.6.3",
26
+ "@atproto/lex": "^0.1.4",
27
+ "@atproto/repo": "^0.10.1",
28
+ "@atproto/syntax": "^0.6.2",
29
+ "@atproto/xrpc-server": "^0.11.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/ws": "^8.5.4",
33
- "jest": "^30.0.0",
34
- "typescript": "^6.0.3"
33
+ "jest": "^30.0.0"
35
34
  },
36
35
  "type": "module",
37
36
  "exports": {
@@ -43,7 +42,7 @@
43
42
  "scripts": {
44
43
  "codegen": "lex build --clear --indexFile --lexicons ../../lexicons --include com.atproto.sync.subscribeRepos",
45
44
  "prebuild": "pnpm run codegen",
46
- "build": "tsc --build tsconfig.build.json",
45
+ "build": "tsgo --build tsconfig.build.json",
47
46
  "test": "NODE_OPTIONS=--experimental-vm-modules ../dev-infra/with-test-redis-and-db.sh jest"
48
47
  }
49
48
  }
@@ -13,10 +13,11 @@ type Queue = InstanceType<typeof PQueue>
13
13
  // A queue with arbitrarily many partitions, each processing work sequentially.
14
14
  // Partitions are created lazily and taken out of memory when they go idle.
15
15
  export class MemoryRunner implements EventRunner {
16
- consecutive = new ConsecutiveList<number>()
17
- mainQueue: Queue
18
- partitions: Map<string, Queue> = new Map()
19
- cursor: number | undefined
16
+ private destroyed = false
17
+ private readonly consecutive = new ConsecutiveList<number>()
18
+ private readonly mainQueue: Queue
19
+ private readonly partitions: Map<string, Queue> = new Map()
20
+ private cursor: number | undefined
20
21
 
21
22
  constructor(public opts: MemoryRunnerOptions = {}) {
22
23
  this.mainQueue = new PQueue({ concurrency: opts.concurrency ?? Infinity })
@@ -27,8 +28,13 @@ export class MemoryRunner implements EventRunner {
27
28
  return this.cursor
28
29
  }
29
30
 
31
+ /** @deprecated internal use only */
32
+ get partitionCount() {
33
+ return this.partitions.size
34
+ }
35
+
30
36
  async addTask(partitionId: string, task: () => Promise<void>) {
31
- if (this.mainQueue.isPaused) return
37
+ if (this.destroyed) return
32
38
  return this.mainQueue.add(() => {
33
39
  return this.getPartition(partitionId).add(task)
34
40
  })
@@ -45,7 +51,7 @@ export class MemoryRunner implements EventRunner {
45
51
  }
46
52
 
47
53
  async trackEvent(did: string, seq: number, handler: () => Promise<void>) {
48
- if (this.mainQueue.isPaused) return
54
+ if (this.destroyed) return
49
55
  const item = this.consecutive.push(seq)
50
56
  await this.addTask(did, async () => {
51
57
  await handler()
@@ -60,13 +66,14 @@ export class MemoryRunner implements EventRunner {
60
66
  }
61
67
 
62
68
  async processAll() {
63
- await this.mainQueue.onIdle()
69
+ const queue = this.mainQueue
70
+ while (queue.size || queue.pending) await queue.onIdle()
64
71
  }
65
72
 
66
73
  async destroy() {
67
- this.mainQueue.pause()
74
+ this.destroyed = true
68
75
  this.mainQueue.clear()
69
76
  this.partitions.forEach((p) => p.clear())
70
- await this.mainQueue.onIdle()
77
+ await this.processAll()
71
78
  }
72
79
  }
@@ -29,7 +29,7 @@ describe('firehose', () => {
29
29
  })
30
30
 
31
31
  afterAll(async () => {
32
- await network.close()
32
+ await network?.close()
33
33
  })
34
34
 
35
35
  const createAndReadFirehose = async (
@@ -130,10 +130,7 @@ describe('firehose', () => {
130
130
  it('does not naively pass through invalid handle evts', async () => {
131
131
  const evtsPromise = createAndReadFirehose(1)
132
132
  await wait(10) // give the websocket just a second to spin up
133
- await network.pds.ctx.sequencer.sequenceIdentityEvt(
134
- alice,
135
- 'bad-handle.test',
136
- )
133
+ await network.pds.ctx.sequencer.sequenceIdentity(alice, 'bad-handle.test')
137
134
  const evts = await evtsPromise
138
135
  expect(evts.at(0)).toMatchObject({ handle: 'alice.test' })
139
136
  })
@@ -48,7 +48,7 @@ describe('EventRunner utils', () => {
48
48
  runner.addTask('1', async () => {
49
49
  complete[1].push(3)
50
50
  })
51
- expect(runner.partitions.size).toEqual(1)
51
+ expect(runner.partitionCount).toEqual(1)
52
52
  // partition 2 items complete quickly except the last, which is slowest of all events.
53
53
  runner.addTask('2', async () => {
54
54
  await wait(1)
@@ -65,13 +65,13 @@ describe('EventRunner utils', () => {
65
65
  await wait(60)
66
66
  complete[2].push(4)
67
67
  })
68
- expect(runner.partitions.size).toEqual(2)
69
- await runner.mainQueue.onIdle()
68
+ expect(runner.partitionCount).toEqual(2)
69
+ await runner.processAll()
70
70
  expect(complete).toEqual({
71
71
  1: [1, 2, 3],
72
72
  2: [1, 2, 3, 4],
73
73
  })
74
- expect(runner.partitions.size).toEqual(0)
74
+ expect(runner.partitionCount).toEqual(0)
75
75
  })
76
76
 
77
77
  it('limits overall concurrency.', async () => {
@@ -96,10 +96,10 @@ describe('EventRunner utils', () => {
96
96
  complete.push(22)
97
97
  })
98
98
  // only partition 1 exists so far due to the concurrency
99
- expect(runner.partitions.size).toEqual(1)
100
- await runner.mainQueue.onIdle()
99
+ expect(runner.partitionCount).toEqual(1)
100
+ await runner.processAll()
101
101
  expect(complete).toEqual([11, 21, 12, 22])
102
- expect(runner.partitions.size).toEqual(0)
102
+ expect(runner.partitionCount).toEqual(0)
103
103
  })
104
104
 
105
105
  it('settles with many items.', async () => {
@@ -114,8 +114,8 @@ describe('EventRunner utils', () => {
114
114
  complete.push({ partition, id: i })
115
115
  })
116
116
  }
117
- expect(runner.partitions.size).toBeLessThanOrEqual(partitions.size)
118
- await runner.mainQueue.onIdle()
117
+ expect(runner.partitionCount).toBeLessThanOrEqual(partitions.size)
118
+ await runner.processAll()
119
119
  expect(complete.length).toEqual(500)
120
120
  for (const partition of partitions) {
121
121
  const ids = complete
@@ -123,7 +123,7 @@ describe('EventRunner utils', () => {
123
123
  .map((item) => item.id)
124
124
  expect(ids).toEqual([...ids].sort((a, b) => a - b))
125
125
  }
126
- expect(runner.partitions.size).toEqual(0)
126
+ expect(runner.partitionCount).toEqual(0)
127
127
  })
128
128
  })
129
129
  })
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig/node.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": "./src",
5
- "outDir": "./dist"
5
+ "outDir": "./dist",
6
6
  },
7
- "include": ["./src"]
7
+ "include": ["./src"],
8
8
  }
@@ -1 +1 @@
1
- {"root":["./src/events.ts","./src/index.ts","./src/util.ts","./src/firehose/index.ts","./src/lexicons/com.ts","./src/lexicons/index.ts","./src/lexicons/com/atproto.ts","./src/lexicons/com/atproto/sync.ts","./src/lexicons/com/atproto/sync/subscribeRepos.defs.ts","./src/lexicons/com/atproto/sync/subscribeRepos.ts","./src/runner/consecutive-list.ts","./src/runner/index.ts","./src/runner/memory-runner.ts","./src/runner/types.ts"],"version":"6.0.3"}
1
+ {"version":"7.0.0-dev.20260614.1","root":["./src/events.ts","./src/index.ts","./src/util.ts","./src/firehose/index.ts","./src/lexicons/com.ts","./src/lexicons/index.ts","./src/lexicons/com/atproto.ts","./src/lexicons/com/atproto/sync.ts","./src/lexicons/com/atproto/sync/subscribeRepos.defs.ts","./src/lexicons/com/atproto/sync/subscribeRepos.ts","./src/runner/consecutive-list.ts","./src/runner/index.ts","./src/runner/memory-runner.ts","./src/runner/types.ts"]}
package/tsconfig.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "include": [],
3
3
  "references": [
4
4
  { "path": "./tsconfig.build.json" },
5
- { "path": "./tsconfig.tests.json" }
6
- ]
5
+ { "path": "./tsconfig.tests.json" },
6
+ ],
7
7
  }
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig/tests.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": ".",
5
- "noUnusedLocals": false
5
+ "noUnusedLocals": false,
6
6
  },
7
- "include": ["./tests"]
7
+ "include": ["./tests"],
8
8
  }