Skip to content

Commit

Permalink
feat: export Document and DocumentVersion types (#12)
Browse files Browse the repository at this point in the history
These will be useful for our importer, so I think they're worth
exporting.
  • Loading branch information
EvanHahn authored Dec 11, 2024
1 parent 3a0c48f commit 2d9544c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { reader } from './reader.js'
export { write } from './writer.js'
/** @typedef {import('./types.js').Document} Document */
/** @typedef {import('./types.js').DocumentVersion} DocumentVersion */
9 changes: 1 addition & 8 deletions src/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ import { buffer } from 'node:stream/consumers'
import * as v from 'valibot'
import yauzl from 'yauzl-promise'
import { DocumentVersionSchema } from './types.js'
/** @import { DocumentVersion } from './types.js' */
/** @import { Document, DocumentVersion } from './types.js' */

/**
* @internal
* @typedef {Map<string, yauzl.Entry>} EntriesByFilename
*/

/**
* @internal
* @typedef {object} Document
* @prop {string} id
* @prop {Array<DocumentVersion>} versions
*/

/**
* @internal
* @typedef {object} Media
Expand Down
6 changes: 6 additions & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ export const DocumentVersionSchema = v.object({
blockIndex: v.number(),
}),
})

/**
* @typedef {object} Document
* @prop {string} id
* @prop {Array<DocumentVersion>} versions
*/

0 comments on commit 2d9544c

Please sign in to comment.