Merge pull request #20520 from overleaf/em-ts-import

Use new import JSDoc syntax for Typescript annotations

GitOrigin-RevId: 782456d637fc8f2de6163b5d70fabf06c1d74964
This commit is contained in:
Eric Mc Sween 2024-09-20 09:52:23 -04:00 committed by Copybot
parent 6972186161
commit 250acbf33c
69 changed files with 150 additions and 225 deletions

View file

@ -5,6 +5,10 @@ const fetch = require('node-fetch')
const http = require('http') const http = require('http')
const https = require('https') const https = require('https')
/**
* @import { Response } from 'node-fetch'
*/
/** /**
* Make a request and return the parsed JSON response. * Make a request and return the parsed JSON response.
* *
@ -240,8 +244,6 @@ async function discardResponseBody(response) {
} }
/** /**
* @typedef {import('node-fetch').Response} Response
*
* @param {Response} response * @param {Response} response
*/ */
async function maybeGetResponseBody(response) { async function maybeGetResponseBody(response) {

View file

@ -12,8 +12,8 @@ const FileMap = require('./file_map')
const V2DocVersions = require('./v2_doc_versions') const V2DocVersions = require('./v2_doc_versions')
/** /**
* @typedef {import("./author")} Author * @import Author from "./author"
* @typedef {import("./types").BlobStore} BlobStore * @import { BlobStore } from "./types"
*/ */
/** /**

View file

@ -7,7 +7,7 @@ const Change = require('./change')
const Operation = require('./operation') const Operation = require('./operation')
/** /**
* @typedef {import("./author")} Author * @import Author from "./author"
*/ */
/** /**

View file

@ -6,9 +6,9 @@ const OError = require('@overleaf/o-error')
const History = require('./history') const History = require('./history')
/** /**
* @typedef {import("./types").BlobStore} BlobStore * @import { BlobStore } from "./types"
* @typedef {import("./change")} Change * @import Change from "./change"
* @typedef {import("./snapshot")} Snapshot * @import Snapshot from "./snapshot"
*/ */
class ConflictingEndVersion extends OError { class ConflictingEndVersion extends OError {
constructor(clientEndVersion, latestEndVersion) { constructor(clientEndVersion, latestEndVersion) {

View file

@ -3,8 +3,8 @@ const { RetainOp, InsertOp, RemoveOp } = require('./operation/scan_op')
const Range = require('./range') const Range = require('./range')
/** /**
* @typedef {import("./types").CommentRawData} CommentRawData * @import { CommentRawData } from "./types"
* @typedef {import("./operation/text_operation")} TextOperation * @import TextOperation from "./operation/text_operation"
*/ */
class Comment { class Comment {

View file

@ -10,16 +10,13 @@ const HashFileData = require('./file_data/hash_file_data')
const StringFileData = require('./file_data/string_file_data') const StringFileData = require('./file_data/string_file_data')
/** /**
* @typedef {import("./blob")} Blob * @import Blob from "./blob"
* @typedef {import("./types").BlobStore} BlobStore * @import { BlobStore, ReadonlyBlobStore, RawFileData, RawFile } from "./types"
* @typedef {import("./types").ReadonlyBlobStore} ReadonlyBlobStore * @import { StringFileRawData, CommentRawData } from "./types"
* @typedef {import("./types").RawFileData} RawFileData * @import CommentList from "./file_data/comment_list"
* @typedef {import("./types").RawFile} RawFile * @import TextOperation from "./operation/text_operation"
* @typedef {import("./types").StringFileRawData} StringFileRawData * @import TrackedChangeList from "./file_data/tracked_change_list"
* @typedef {import("./types").CommentRawData} CommentRawData *
* @typedef {import("./file_data/comment_list")} CommentList
* @typedef {import("./operation/text_operation")} TextOperation
* @typedef {import("./file_data/tracked_change_list")} TrackedChangeList
* @typedef {{filterTrackedDeletes?: boolean}} FileGetContentOptions * @typedef {{filterTrackedDeletes?: boolean}} FileGetContentOptions
*/ */

View file

@ -6,7 +6,7 @@ const Blob = require('../blob')
const FileData = require('./') const FileData = require('./')
/** /**
* @typedef {import('../types').RawBinaryFileData} RawBinaryFileData * @import { RawBinaryFileData } from '../types'
*/ */
class BinaryFileData extends FileData { class BinaryFileData extends FileData {

View file

@ -1,7 +1,7 @@
// @ts-check // @ts-check
/** /**
* @typedef {import('../types').ClearTrackingPropsRawData} ClearTrackingPropsRawData * @import { ClearTrackingPropsRawData } from '../types'
*/ */
class ClearTrackingProps { class ClearTrackingProps {

View file

@ -2,8 +2,8 @@
const Comment = require('../comment') const Comment = require('../comment')
/** /**
* @typedef {import("../types").CommentRawData} CommentRawData * @import { CommentRawData } from "../types"
* @typedef {import("../range")} Range * @import Range from "../range"
*/ */
class CommentList { class CommentList {

View file

@ -6,11 +6,10 @@ const assert = require('check-types').assert
const Blob = require('../blob') const Blob = require('../blob')
const FileData = require('./') const FileData = require('./')
/** /**
* @typedef {import('./string_file_data')} StringFileData * @import StringFileData from './string_file_data'
* @typedef {import('./lazy_string_file_data')} LazyStringFileData * @import LazyStringFileData from './lazy_string_file_data'
* @typedef {import('./hollow_string_file_data')} HollowStringFileData * @import HollowStringFileData from './hollow_string_file_data'
* @typedef {import('../types').BlobStore} BlobStore * @import { BlobStore, RawHashFileData } from '../types'
* @typedef {import('../types').RawHashFileData} RawHashFileData
*/ */
class HashFileData extends FileData { class HashFileData extends FileData {

View file

@ -5,7 +5,7 @@ const assert = require('check-types').assert
const FileData = require('./') const FileData = require('./')
/** /**
* @typedef {import('../types').RawHollowBinaryFileData} RawHollowBinaryFileData * @import { RawHollowBinaryFileData } from '../types'
*/ */
class HollowBinaryFileData extends FileData { class HollowBinaryFileData extends FileData {

View file

@ -1,15 +1,13 @@
// @ts-check // @ts-check
'use strict' 'use strict'
/**
* @typedef {import('../operation/edit_operation')} EditOperation
*/
const assert = require('check-types').assert const assert = require('check-types').assert
const FileData = require('./') const FileData = require('./')
/** /**
* @typedef {import('../types').RawHollowStringFileData} RawHollowStringFileData * @import { RawHollowStringFileData } from '../types'
* @import EditOperation from '../operation/edit_operation'
*/ */
class HollowStringFileData extends FileData { class HollowStringFileData extends FileData {

View file

@ -7,13 +7,10 @@ const assert = require('check-types').assert
const Blob = require('../blob') const Blob = require('../blob')
/** /**
* @typedef {import("../types").BlobStore} BlobStore * @import { BlobStore, ReadonlyBlobStore, RawFileData, CommentRawData } from "../types"
* @typedef {import("../types").ReadonlyBlobStore} ReadonlyBlobStore * @import EditOperation from "../operation/edit_operation"
* @typedef {import("../types").RawFileData} RawFileData * @import CommentList from "../file_data/comment_list"
* @typedef {import("../operation/edit_operation")} EditOperation * @import TrackedChangeList from "../file_data/tracked_change_list"
* @typedef {import("../file_data/comment_list")} CommentList
* @typedef {import("../types").CommentRawData} CommentRawData
* @typedef {import("../file_data/tracked_change_list")} TrackedChangeList
*/ */
/** /**

View file

@ -11,11 +11,7 @@ const EditOperation = require('../operation/edit_operation')
const EditOperationBuilder = require('../operation/edit_operation_builder') const EditOperationBuilder = require('../operation/edit_operation_builder')
/** /**
* @typedef {import('../types').BlobStore} BlobStore * @import { BlobStore, ReadonlyBlobStore, RangesBlob, RawFileData, RawLazyStringFileData } from '../types'
* @typedef {import('../types').ReadonlyBlobStore} ReadonlyBlobStore
* @typedef {import('../types').RangesBlob} RangesBlob
* @typedef {import('../types').RawFileData} RawFileData
* @typedef {import('../types').RawLazyStringFileData} RawLazyStringFileData
*/ */
class LazyStringFileData extends FileData { class LazyStringFileData extends FileData {

View file

@ -8,13 +8,9 @@ const CommentList = require('./comment_list')
const TrackedChangeList = require('./tracked_change_list') const TrackedChangeList = require('./tracked_change_list')
/** /**
* @typedef {import("../types").StringFileRawData} StringFileRawData * @import { StringFileRawData, RawFileData, BlobStore, CommentRawData } from "../types"
* @typedef {import("../types").RawFileData} RawFileData * @import { TrackedChangeRawData, RangesBlob } from "../types"
* @typedef {import("../operation/edit_operation")} EditOperation * @import EditOperation from "../operation/edit_operation"
* @typedef {import("../types").BlobStore} BlobStore
* @typedef {import("../types").CommentRawData} CommentRawData
* @typedef {import("../types").TrackedChangeRawData} TrackedChangeRawData
* @typedef {import('../types').RangesBlob} RangesBlob
*/ */
class StringFileData extends FileData { class StringFileData extends FileData {

View file

@ -3,7 +3,7 @@ const Range = require('../range')
const TrackingProps = require('./tracking_props') const TrackingProps = require('./tracking_props')
/** /**
* @typedef {import("../types").TrackedChangeRawData} TrackedChangeRawData * @import { TrackedChangeRawData } from "../types"
*/ */
class TrackedChange { class TrackedChange {

View file

@ -4,8 +4,7 @@ const TrackedChange = require('./tracked_change')
const TrackingProps = require('../file_data/tracking_props') const TrackingProps = require('../file_data/tracking_props')
/** /**
* @typedef {import("../types").TrackingDirective} TrackingDirective * @import { TrackingDirective, TrackedChangeRawData } from "../types"
* @typedef {import("../types").TrackedChangeRawData} TrackedChangeRawData
*/ */
class TrackedChangeList { class TrackedChangeList {

View file

@ -1,7 +1,6 @@
// @ts-check // @ts-check
/** /**
* @typedef {import("../types").TrackingPropsRawData} TrackingPropsRawData * @import { TrackingPropsRawData, TrackingDirective } from "../types"
* @typedef {import("../types").TrackingDirective} TrackingDirective
*/ */
class TrackingProps { class TrackingProps {

View file

@ -10,8 +10,8 @@ const File = require('./file')
const safePathname = require('./safe_pathname') const safePathname = require('./safe_pathname')
/** /**
* @typedef {import('./types').RawFile} RawFile * @import { RawFile, RawFileMap } from './types'
* @typedef {import('./types').RawFileMap} RawFileMap *
* @typedef {Record<String, File | null>} FileMapData * @typedef {Record<String, File | null>} FileMapData
*/ */

View file

@ -7,7 +7,7 @@ const Change = require('./change')
const Snapshot = require('./snapshot') const Snapshot = require('./snapshot')
/** /**
* @typedef {import("./types").BlobStore} BlobStore * @import { BlobStore } from "./types"
*/ */
class History { class History {

View file

@ -4,7 +4,7 @@
const assert = require('check-types').assert const assert = require('check-types').assert
/** /**
* @typedef {import('./types').RawLabel} RawLabel * @import { RawLabel } from './types'
*/ */
/** /**

View file

@ -5,10 +5,9 @@ const Range = require('../range')
const EditOperation = require('./edit_operation') const EditOperation = require('./edit_operation')
/** /**
* @typedef {import('./delete_comment_operation')} DeleteCommentOperation * @import DeleteCommentOperation from './delete_comment_operation'
* @typedef {import('../types').CommentRawData} CommentRawData * @import { CommentRawData, RawAddCommentOperation } from '../types'
* @typedef {import('../types').RawAddCommentOperation} RawAddCommentOperation * @import StringFileData from '../file_data/string_file_data'
* @typedef {import('../file_data/string_file_data')} StringFileData
*/ */
/** /**

View file

@ -4,9 +4,9 @@ const EditNoOperation = require('./edit_no_operation')
const EditOperation = require('./edit_operation') const EditOperation = require('./edit_operation')
/** /**
* @typedef {import('./add_comment_operation')} AddCommentOperation * @import AddCommentOperation from './add_comment_operation'
* @typedef {import('../types').RawDeleteCommentOperation} RawDeleteCommentOperation * @import StringFileData from '../file_data/string_file_data'
* @typedef {import('../file_data/string_file_data')} StringFileData * @import { RawDeleteCommentOperation } from '../types'
*/ */
/** /**

View file

@ -1,9 +1,9 @@
// @ts-check // @ts-check
'use strict' 'use strict'
/** /**
* @typedef {import('./edit_operation')} EditOperation * @import EditOperation from './edit_operation'
* @typedef {import('../types').RawEditFileOperation} RawEditFileOperation * @import { RawEditFileOperation } from '../types'
* @typedef {import("../snapshot")} Snapshot * @import Snapshot from "../snapshot"
*/ */
const Operation = require('./') const Operation = require('./')

View file

@ -1,7 +1,7 @@
const EditOperation = require('./edit_operation') const EditOperation = require('./edit_operation')
/** /**
* @typedef {import('../types').RawEditNoOperation} RawEditNoOperation * @import { RawEditNoOperation } from '../types'
*/ */
class EditNoOperation extends EditOperation { class EditNoOperation extends EditOperation {

View file

@ -1,7 +1,7 @@
// @ts-check // @ts-check
/** /**
* @typedef {import('../file_data')} FileData * @import FileData from '../file_data'
* @typedef {import('../types').RawEditOperation} RawEditOperation * @import { RawEditOperation } from '../types'
*/ */
class EditOperation { class EditOperation {

View file

@ -1,12 +1,11 @@
// @ts-check // @ts-check
/** /**
* @typedef {import('./edit_operation')} EditOperation * @import EditOperation from './edit_operation'
* @typedef {import('../types').RawTextOperation} RawTextOperation * @import { RawTextOperation, RawAddCommentOperation, RawEditOperation } from '../types'
* @typedef {import('../types').RawAddCommentOperation} RawAddCommentOperation * @import { RawDeleteCommentOperation, RawSetCommentStateOperation } from '../types'
* @typedef {import('../types').RawDeleteCommentOperation} RawDeleteCommentOperation
* @typedef {import('../types').RawSetCommentStateOperation} RawSetCommentStateOperation
* @typedef {import('../types').RawEditOperation} RawEditOperation
*/ */
const DeleteCommentOperation = require('./delete_comment_operation') const DeleteCommentOperation = require('./delete_comment_operation')
const AddCommentOperation = require('./add_comment_operation') const AddCommentOperation = require('./add_comment_operation')
const TextOperation = require('./text_operation') const TextOperation = require('./text_operation')

View file

@ -3,7 +3,10 @@ const core = require('../..')
const Comment = require('../comment') const Comment = require('../comment')
const EditNoOperation = require('./edit_no_operation') const EditNoOperation = require('./edit_no_operation')
const TextOperation = require('./text_operation') const TextOperation = require('./text_operation')
/** @typedef {import('./edit_operation')} EditOperation */
/**
* @import EditOperation from './edit_operation'
*/
class EditOperationTransformer { class EditOperationTransformer {
/** /**

View file

@ -13,8 +13,8 @@ let EditFileOperation = null
let SetFileMetadataOperation = null let SetFileMetadataOperation = null
/** /**
* @typedef {import("../types").BlobStore} BlobStore * @import { BlobStore } from "../types"
* @typedef {import("../snapshot")} Snapshot * @import Snapshot from "../snapshot"
*/ */
/** /**

View file

@ -9,12 +9,9 @@ const ClearTrackingProps = require('../file_data/clear_tracking_props')
const TrackingProps = require('../file_data/tracking_props') const TrackingProps = require('../file_data/tracking_props')
/** /**
* @import { RawScanOp, RawInsertOp, RawRetainOp, RawRemoveOp, TrackingDirective } from '../types'
*
* @typedef {{ length: number, inputCursor: number, readonly inputLength: number}} LengthApplyContext * @typedef {{ length: number, inputCursor: number, readonly inputLength: number}} LengthApplyContext
* @typedef {import('../types').RawScanOp} RawScanOp
* @typedef {import('../types').RawInsertOp} RawInsertOp
* @typedef {import('../types').RawRetainOp} RawRetainOp
* @typedef {import('../types').RawRemoveOp} RawRemoveOp
* @typedef {import('../types').TrackingDirective} TrackingDirective
*/ */
class ScanOp { class ScanOp {

View file

@ -5,10 +5,10 @@ const EditNoOperation = require('./edit_no_operation')
const EditOperation = require('./edit_operation') const EditOperation = require('./edit_operation')
/** /**
* @typedef {import('./delete_comment_operation')} DeleteCommentOperation * @import DeleteCommentOperation from './delete_comment_operation'
* @typedef {import('../types').CommentRawData} CommentRawData * @import { CommentRawData } from '../types'
* @typedef {import('../types').RawSetCommentStateOperation} RawSetCommentStateOperation * @import { RawSetCommentStateOperation } from '../types'
* @typedef {import('../file_data/string_file_data')} StringFileData * @import StringFileData from '../file_data/string_file_data'
*/ */
/** /**

View file

@ -30,11 +30,11 @@ const ClearTrackingProps = require('../file_data/clear_tracking_props')
const TrackingProps = require('../file_data/tracking_props') const TrackingProps = require('../file_data/tracking_props')
/** /**
* @typedef {import('../file_data/string_file_data')} StringFileData * @import StringFileData from '../file_data/string_file_data'
* @typedef {import('../types').RawTextOperation} RawTextOperation * @import { RawTextOperation, TrackingDirective } from '../types'
* @typedef {import('../operation/scan_op').ScanOp} ScanOp * @import { ScanOp } from '../operation/scan_op'
* @typedef {import('../file_data/tracked_change_list')} TrackedChangeList * @import TrackedChangeList from '../file_data/tracked_change_list'
* @typedef {import('../types').TrackingDirective} TrackingDirective *
* @typedef {{tracking?: TrackingProps, commentIds?: string[]}} InsertOptions * @typedef {{tracking?: TrackingProps, commentIds?: string[]}} InsertOptions
*/ */

View file

@ -3,7 +3,7 @@
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
/** /**
* @typedef {import('./types').RawRange} RawRange * @import { RawRange } from './types'
*/ */
class Range { class Range {

View file

@ -10,12 +10,10 @@ const V2DocVersions = require('./v2_doc_versions')
const FILE_LOAD_CONCURRENCY = 50 const FILE_LOAD_CONCURRENCY = 50
/** /**
* @typedef {import("./types").BlobStore} BlobStore * @import { BlobStore, RawSnapshot, ReadonlyBlobStore } from "./types"
* @typedef {import("./types").RawSnapshot} RawSnapshot * @import Change from "./change"
* @typedef {import("./types").ReadonlyBlobStore} ReadonlyBlobStore * @import TextOperation from "./operation/text_operation"
* @typedef {import("./change")} Change * @import File from "./file"
* @typedef {import("./operation/text_operation")} TextOperation
* @typedef {import("./file")} File
*/ */
class EditMissingFileError extends OError {} class EditMissingFileError extends OError {}

View file

@ -4,9 +4,9 @@
const _ = require('lodash') const _ = require('lodash')
/** /**
* @typedef {import("./file")} File * @import File from "./file"
* @typedef {import("./snapshot")} Snapshot * @import Snapshot from "./snapshot"
* @typedef {import("./types").RawV2DocVersions} RawV2DocVersions * @import { RawV2DocVersions } from "./types"
*/ */
class V2DocVersions { class V2DocVersions {

View file

@ -1,5 +1,5 @@
/** /**
* @typedef {import("../..").Blob } Blob * @import { Blob } from "../.."
*/ */
/** /**

View file

@ -3,7 +3,7 @@ const TrackedChangeList = require('../lib/file_data/tracked_change_list')
const TrackingProps = require('../lib/file_data/tracking_props') const TrackingProps = require('../lib/file_data/tracking_props')
const ClearTrackingProps = require('../lib/file_data/clear_tracking_props') const ClearTrackingProps = require('../lib/file_data/clear_tracking_props')
const { expect } = require('chai') const { expect } = require('chai')
/** @typedef {import('../lib/types').TrackedChangeRawData} TrackedChangeRawData */ /** @import { TrackedChangeRawData } from '../lib/types' */
describe('TrackedChangeList', function () { describe('TrackedChangeList', function () {
describe('applyInsert', function () { describe('applyInsert', function () {

View file

@ -9,8 +9,8 @@ const { callbackifyAll } = require('@overleaf/promise-utils')
const { setTimeout } = require('timers/promises') const { setTimeout } = require('timers/promises')
/** /**
* @typedef {import('mongodb').Document} Document * @import { Document } from 'mongodb'
* @typedef {import('mongodb').WithId} WithId * @import { WithId } from 'mongodb'
*/ */
const DocManager = { const DocManager = {

View file

@ -4,12 +4,8 @@ const _ = require('lodash')
const { isDelete } = require('./Utils') const { isDelete } = require('./Utils')
/** /**
* @typedef {import('./types').Comment} Comment * @import { Comment, HistoryComment, HistoryRanges, HistoryTrackedChange } from './types'
* @typedef {import('./types').HistoryComment} HistoryComment * @import { Ranges, TrackedChange } from './types'
* @typedef {import('./types').HistoryRanges} HistoryRanges
* @typedef {import('./types').HistoryTrackedChange} HistoryTrackedChange
* @typedef {import('./types').Ranges} Ranges
* @typedef {import('./types').TrackedChange} TrackedChange
*/ */
/** /**

View file

@ -14,7 +14,7 @@ const HistoryConversions = require('./HistoryConversions')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
/** /**
* @typedef {import('./types').Ranges} Ranges * @import { Ranges } from './types'
*/ */
const ProjectHistoryRedisManager = { const ProjectHistoryRedisManager = {

View file

@ -8,21 +8,9 @@ const _ = require('lodash')
const { isInsert, isDelete, isComment, getDocLength } = require('./Utils') const { isInsert, isDelete, isComment, getDocLength } = require('./Utils')
/** /**
* @typedef {import('./types').Comment} Comment * @import { Comment, CommentOp, InsertOp, DeleteOp, HistoryOp, Op } from './types'
* @typedef {import('./types').CommentOp} CommentOp * @import { HistoryCommentOp, HistoryDeleteOp, HistoryInsertOp, HistoryRetainOp } from './types'
* @typedef {import('./types').DeleteOp} DeleteOp * @import { HistoryDeleteTrackedChange, HistoryUpdate, Ranges, TrackedChange, Update } from './types'
* @typedef {import('./types').HistoryCommentOp} HistoryCommentOp
* @typedef {import('./types').HistoryDeleteOp} HistoryDeleteOp
* @typedef {import('./types').HistoryDeleteTrackedChange} HistoryDeleteTrackedChange
* @typedef {import('./types').HistoryInsertOp} HistoryInsertOp
* @typedef {import('./types').HistoryRetainOp} HistoryRetainOp
* @typedef {import('./types').HistoryOp} HistoryOp
* @typedef {import('./types').HistoryUpdate} HistoryUpdate
* @typedef {import('./types').InsertOp} InsertOp
* @typedef {import('./types').Op} Op
* @typedef {import('./types').Ranges} Ranges
* @typedef {import('./types').TrackedChange} TrackedChange
* @typedef {import('./types').Update} Update
*/ */
const RANGE_DELTA_BUCKETS = [0, 1, 2, 3, 4, 5, 10, 20, 50] const RANGE_DELTA_BUCKETS = [0, 1, 2, 3, 4, 5, 10, 20, 50]

View file

@ -17,12 +17,7 @@ const Profiler = require('./Profiler')
const { isInsert, isDelete, getDocLength } = require('./Utils') const { isInsert, isDelete, getDocLength } = require('./Utils')
/** /**
* @typedef {import("./types").DeleteOp} DeleteOp * @import { DeleteOp, InsertOp, Op, Ranges, Update, HistoryUpdate } from "./types"
* @typedef {import("./types").HistoryUpdate } HistoryUpdate
* @typedef {import("./types").InsertOp} InsertOp
* @typedef {import("./types").Op} Op
* @typedef {import("./types").Ranges} Ranges
* @typedef {import("./types").Update} Update
*/ */
const UpdateManager = { const UpdateManager = {

View file

@ -2,11 +2,7 @@
const _ = require('lodash') const _ = require('lodash')
/** /**
* @typedef {import('./types').CommentOp} CommentOp * @import { CommentOp, DeleteOp, InsertOp, Op, TrackedChange } from './types'
* @typedef {import('./types').DeleteOp} DeleteOp
* @typedef {import('./types').InsertOp} InsertOp
* @typedef {import('./types').Op} Op
* @typedef {import('./types').TrackedChange} TrackedChange
*/ */
/** /**

View file

@ -22,7 +22,7 @@ const postgresBackend = require('./postgres')
const mongoBackend = require('./mongo') const mongoBackend = require('./mongo')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
/** @typedef {import('stream').Readable} Readable */ /** @import { Readable } from 'stream' */
const GLOBAL_BLOBS = new Map() const GLOBAL_BLOBS = new Map()

View file

@ -1,7 +1,10 @@
// @ts-check // @ts-check
'use strict' 'use strict'
/** @typedef {import('overleaf-editor-core').Snapshot} Snapshot */ /**
* @import { Snapshot } from 'overleaf-editor-core'
* @import { BlobStore } from '../../storage/lib/blob_store/index'
*/
const Archive = require('archiver') const Archive = require('archiver')
const BPromise = require('bluebird') const BPromise = require('bluebird')
@ -15,10 +18,6 @@ const OError = require('@overleaf/o-error')
const assert = require('./assert') const assert = require('./assert')
/**
* @typedef {import('../../storage/lib/blob_store/index').BlobStore} BlobStore
*/
// The maximum safe concurrency appears to be 1. // The maximum safe concurrency appears to be 1.
// https://github.com/overleaf/issues/issues/1909 // https://github.com/overleaf/issues/issues/1909
const FETCH_CONCURRENCY = 1 // number of files to fetch at once const FETCH_CONCURRENCY = 1 // number of files to fetch at once

View file

@ -14,8 +14,7 @@ import {
} from 'overleaf-editor-core' } from 'overleaf-editor-core'
/** /**
* @typedef {import('overleaf-editor-core/lib/types').RawEditOperation} RawEditOperation * @import { RawEditOperation, TrackedChangeRawData } from 'overleaf-editor-core/lib/types'
* @typedef {import('overleaf-editor-core/lib/types').TrackedChangeRawData} TrackedChangeRawData
*/ */
export function convertToSummarizedUpdates(chunk, callback) { export function convertToSummarizedUpdates(chunk, callback) {

View file

@ -12,10 +12,9 @@ import logger from '@overleaf/logger'
import OError from '@overleaf/o-error' import OError from '@overleaf/o-error'
/** /**
* @typedef {import('./types').AddDocUpdate} AddDocUpdate * @import { AddDocUpdate } from './types'
* @typedef {import('overleaf-editor-core/lib/types').CommentRawData} CommentRawData * @import { CommentRawData, TrackedChangeRawData } from 'overleaf-editor-core/lib/types'
* @typedef {import('overleaf-editor-core/lib/types').TrackedChangeRawData} TrackedChangeRawData */
* */
/** /**
* *

View file

@ -10,9 +10,8 @@ import * as Errors from './Errors.js'
import _ from 'lodash' import _ from 'lodash'
/** /**
* @typedef {import('stream').Readable} ReadableStream * @import { Snapshot } from 'overleaf-editor-core'
* @typedef {import('overleaf-editor-core').Snapshot} Snapshot * @import { RangesSnapshot } from './types'
* @typedef {import('./types').RangesSnapshot} RangesSnapshot
*/ */
StringStream.prototype._read = function () {} StringStream.prototype._read = function () {}

View file

@ -22,18 +22,10 @@ import * as HashManager from './HashManager.js'
import { isInsert, isDelete } from './Utils.js' import { isInsert, isDelete } from './Utils.js'
/** /**
* @typedef {import('overleaf-editor-core').Comment} HistoryComment * @import { Comment as HistoryComment, TrackedChange as HistoryTrackedChange } from 'overleaf-editor-core'
* @typedef {import('overleaf-editor-core').TrackedChange} HistoryTrackedChange * @import { Comment, Entity, ResyncDocContentUpdate, RetainOp, TrackedChange } from './types'
* @typedef {import('./types').Comment} Comment * @import { TrackedChangeTransition, TrackingDirective, TrackingType, Update } from './types'
* @typedef {import('./types').Entity} Entity * @import { ProjectStructureUpdate } from './types'
* @typedef {import('./types').ResyncDocContentUpdate} ResyncDocContentUpdate
* @typedef {import('./types').RetainOp} RetainOp
* @typedef {import('./types').TrackedChange} TrackedChange
* @typedef {import('./types').TrackedChangeTransition} TrackedChangeTransition
* @typedef {import('./types').TrackingDirective} TrackingDirective
* @typedef {import('./types').TrackingType} TrackingType
* @typedef {import('./types').Update} Update
* @typedef {import('./types').ProjectStructureUpdate} ProjectStructureUpdate
*/ */
const MAX_RESYNC_HISTORY_RECORDS = 100 // keep this many records of previous resyncs const MAX_RESYNC_HISTORY_RECORDS = 100 // keep this many records of previous resyncs
const EXPIRE_RESYNC_HISTORY_INTERVAL_MS = 90 * 24 * 3600 * 1000 // 90 days const EXPIRE_RESYNC_HISTORY_INTERVAL_MS = 90 * 24 * 3600 * 1000 // 90 days

View file

@ -4,10 +4,7 @@ import OError from '@overleaf/o-error'
import DMP from 'diff-match-patch' import DMP from 'diff-match-patch'
/** /**
* @typedef {import('./types').DeleteOp} DeleteOp * @import { DeleteOp, InsertOp, Op, Update } from './types'
* @typedef {import('./types').InsertOp} InsertOp
* @typedef {import('./types').Op} Op
* @typedef {import('./types').Update} Update
*/ */
const MAX_TIME_BETWEEN_UPDATES = 60 * 1000 // one minute const MAX_TIME_BETWEEN_UPDATES = 60 * 1000 // one minute

View file

@ -7,19 +7,9 @@ import * as OperationsCompressor from './OperationsCompressor.js'
import { isInsert, isRetain, isDelete, isComment } from './Utils.js' import { isInsert, isRetain, isDelete, isComment } from './Utils.js'
/** /**
* @typedef {import('./types').AddDocUpdate} AddDocUpdate * @import { AddDocUpdate, AddFileUpdate, DeleteCommentUpdate, Op, RawScanOp } from './types'
* @typedef {import('./types').AddFileUpdate} AddFileUpdate * @import { RenameUpdate, TextUpdate, TrackingDirective, TrackingProps } from './types'
* @typedef {import('./types').DeleteCommentUpdate} DeleteCommentUpdate * @import { SetCommentStateUpdate, SetFileMetadataOperation, Update, UpdateWithBlob } from './types'
* @typedef {import('./types').Op} Op
* @typedef {import('./types').RawScanOp} RawScanOp
* @typedef {import('./types').RenameUpdate} RenameUpdate
* @typedef {import('./types').TextUpdate} TextUpdate
* @typedef {import('./types').TrackingDirective} TrackingDirective
* @typedef {import('./types').TrackingProps} TrackingProps
* @typedef {import('./types').SetCommentStateUpdate} SetCommentStateUpdate
* @typedef {import('./types').SetFileMetadataOperation} SetFileMetadataOperation
* @typedef {import('./types').Update} Update
* @typedef {import('./types').UpdateWithBlob} UpdateWithBlob
*/ */
/** /**

View file

@ -1,11 +1,7 @@
// @ts-check // @ts-check
/** /**
* @typedef {import('./types').CommentOp} CommentOp * @import { CommentOp, DeleteOp, InsertOp, Op, RetainOp } from './types'
* @typedef {import('./types').DeleteOp} DeleteOp
* @typedef {import('./types').InsertOp} InsertOp
* @typedef {import('./types').Op} Op
* @typedef {import('./types').RetainOp} RetainOp
*/ */
/** /**

View file

@ -1,7 +1,9 @@
import { expect } from 'chai' import { expect } from 'chai'
import { createRangeBlobDataFromUpdate } from '../../../../app/js/HistoryBlobTranslator.js' import { createRangeBlobDataFromUpdate } from '../../../../app/js/HistoryBlobTranslator.js'
/** @typedef {import("../../../../app/js/types").AddDocUpdate} AddDocUpdate */ /**
* @import { AddDocUpdate } from "../../../../app/js/types"
*/
/** /**
* *

View file

@ -47,9 +47,7 @@ const Modules = require('../../infrastructure/Modules')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')
/** /**
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest * @import { GetProjectsRequest, GetProjectsResponse, Project } from "./types"
* @typedef {import("./types").GetProjectsResponse} GetProjectsResponse
* @typedef {import("./types").Project} Project
*/ */
const _ProjectController = { const _ProjectController = {

View file

@ -5,7 +5,7 @@ const { promisify } = require('util')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
/** /**
* @typedef {import("./types").MongoProject} MongoProject * @import { MongoProject } from "./types"
*/ */
const ENGINE_TO_COMPILER_MAP = { const ENGINE_TO_COMPILER_MAP = {

View file

@ -27,15 +27,11 @@ const SplitTestHandler = require('../SplitTests/SplitTestHandler')
const SplitTestSessionHandler = require('../SplitTests/SplitTestSessionHandler') const SplitTestSessionHandler = require('../SplitTests/SplitTestSessionHandler')
const SubscriptionLocator = require('../Subscription/SubscriptionLocator') const SubscriptionLocator = require('../Subscription/SubscriptionLocator')
/** @typedef {import("./types").GetProjectsRequest} GetProjectsRequest */ /**
/** @typedef {import("./types").GetProjectsResponse} GetProjectsResponse */ * @import { GetProjectsRequest, GetProjectsResponse, AllUsersProjects, MongoProject } from "./types"
/** @typedef {import("../../../../types/project/dashboard/api").ProjectApi} ProjectApi */ * @import { ProjectApi, Filters, Page, Sort } from "../../../../types/project/dashboard/api"
/** @typedef {import("../../../../types/project/dashboard/api").Filters} Filters */ * @import { Tag } from "../Tags/types"
/** @typedef {import("../../../../types/project/dashboard/api").Page} Page */ */
/** @typedef {import("../../../../types/project/dashboard/api").Sort} Sort */
/** @typedef {import("./types").AllUsersProjects} AllUsersProjects */
/** @typedef {import("./types").MongoProject} MongoProject */
/** @typedef {import("../Tags/types").Tag} Tag */
const _ssoAvailable = (affiliation, session, linkedInstitutionIds) => { const _ssoAvailable = (affiliation, session, linkedInstitutionIds) => {
if (!affiliation.institution) return false if (!affiliation.institution) return false

View file

@ -17,7 +17,7 @@ const SplitTestSessionHandler = require('./SplitTestSessionHandler')
const SplitTestUserGetter = require('./SplitTestUserGetter') const SplitTestUserGetter = require('./SplitTestUserGetter')
/** /**
* @typedef {import("./types").Assignment} Assignment * @import { Assignment } from "./types"
*/ */
const DEFAULT_VARIANT = 'default' const DEFAULT_VARIANT = 'default'

View file

@ -1,6 +1,10 @@
const dateformat = require('dateformat') const dateformat = require('dateformat')
const { formatCurrencyLocalized } = require('../../util/currency') const { formatCurrencyLocalized } = require('../../util/currency')
/**
* @import { CurrencyCode } from '@/shared/utils/currency'
*/
const currencySymbols = { const currencySymbols = {
EUR: '€', EUR: '€',
USD: '$', USD: '$',
@ -48,10 +52,6 @@ function formatPriceDefault(priceInCents, currency) {
return `${symbol}${dollars}.${cents}` return `${symbol}${dollars}.${cents}`
} }
/**
* @typedef {import('@/shared/utils/currency').CurrencyCode} CurrencyCode
*/
/** /**
* @param {number} priceInCents - price in the smallest currency unit (e.g. dollar cents, CLP units, ...) * @param {number} priceInCents - price in the smallest currency unit (e.g. dollar cents, CLP units, ...)
* @param {CurrencyCode?} currency - currency code (default to USD) * @param {CurrencyCode?} currency - currency code (default to USD)

View file

@ -9,7 +9,7 @@ const { expressify } = require('@overleaf/promise-utils')
const Modules = require('../../infrastructure/Modules') const Modules = require('../../infrastructure/Modules')
/** /**
* @typedef {import("../../../../types/subscription/dashboard/subscription").Subscription} Subscription * @import { Subscription } from "../../../../types/subscription/dashboard/subscription"
*/ */
/** /**

View file

@ -9,7 +9,7 @@ function shouldPlanChangeAtTermEnd(oldPlan, newPlan) {
} }
/** /**
* @typedef {import('../../../../frontend/js/shared/utils/currency').CurrencyCode} CurrencyCode * @import { CurrencyCode } from '../../../../frontend/js/shared/utils/currency'
*/ */
/** /**

View file

@ -20,7 +20,9 @@ const {
} = require('../Errors/Errors') } = require('../Errors/Errors')
const FeaturesHelper = require('./FeaturesHelper') const FeaturesHelper = require('./FeaturesHelper')
/** @typedef {import("../../../../types/project/dashboard/subscription").Subscription} Subscription */ /**
* @import { Subscription } from "../../../../types/project/dashboard/subscription"
*/
function buildHostedLink(type) { function buildHostedLink(type) {
return `/user/subscription/recurly/${type}` return `/user/subscription/recurly/${type}`

View file

@ -5,7 +5,7 @@ const SubscriptionLocator = require('../Subscription/SubscriptionLocator')
const { callbackify } = require('@overleaf/promise-utils') const { callbackify } = require('@overleaf/promise-utils')
/** /**
* @typedef {import('../../../../types/project/dashboard/survey').Survey} Survey * @import { Survey } from '../../../../types/project/dashboard/survey'
*/ */
/** /**

View file

@ -3,8 +3,8 @@
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
/** /**
* @typedef {import('./types').HttpPermissionsPolicy} HttpPermissionsPolicy * @import { HttpPermissionsPolicy } from './types'
* */ */
class HttpPermissionsPolicyMiddleware { class HttpPermissionsPolicyMiddleware {
/** /**

View file

@ -3,7 +3,7 @@
*/ */
/** /**
* @typedef {import('@/shared/utils/currency').CurrencyCode} CurrencyCode * @import { CurrencyCode } from '@/shared/utils/currency'
*/ */
/** /**

View file

@ -1,7 +1,7 @@
import getMeta from '../../../utils/meta' import getMeta from '../../../utils/meta'
/** /**
* @typedef {import('@/shared/utils/currency').CurrencyCode} CurrencyCode * @import { CurrencyCode } from '@/shared/utils/currency'
*/ */
// plan: 'collaborator' or 'professional' // plan: 'collaborator' or 'professional'

View file

@ -1,4 +1,4 @@
/** @typedef {import("../../types/web-module").WebModule} WebModule */ /** @import { WebModule } from "../../types/web-module" */
/** @type {WebModule} */ /** @type {WebModule} */
const HistoryModule = {} const HistoryModule = {}

View file

@ -1,6 +1,6 @@
const LaunchpadRouter = require('./app/src/LaunchpadRouter') const LaunchpadRouter = require('./app/src/LaunchpadRouter')
/** @typedef {import("../../types/web-module").WebModule} WebModule */ /** @import { WebModule } from "../../types/web-module" */
/** @type {WebModule} */ /** @type {WebModule} */
const LaunchpadModule = { const LaunchpadModule = {

View file

@ -1,4 +1,4 @@
/** @typedef {import("../../types/web-module").WebModule} WebModule */ /** @import { WebModule } from "../../types/web-module" */
/** @type {WebModule} */ /** @type {WebModule} */
const ServerCeScriptsModule = {} const ServerCeScriptsModule = {}

View file

@ -1,6 +1,8 @@
const UserActivateRouter = require('./app/src/UserActivateRouter') const UserActivateRouter = require('./app/src/UserActivateRouter')
/** @typedef {import("../../types/web-module").WebModule} WebModule */ /**
* @import { WebModule } from "../../types/web-module"
*/
/** @type {WebModule} */ /** @type {WebModule} */
const UserActivateModule = { const UserActivateModule = {