mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
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:
parent
6972186161
commit
250acbf33c
69 changed files with 150 additions and 225 deletions
|
@ -5,6 +5,10 @@ const fetch = require('node-fetch')
|
|||
const http = require('http')
|
||||
const https = require('https')
|
||||
|
||||
/**
|
||||
* @import { Response } from 'node-fetch'
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
async function maybeGetResponseBody(response) {
|
||||
|
|
|
@ -12,8 +12,8 @@ const FileMap = require('./file_map')
|
|||
const V2DocVersions = require('./v2_doc_versions')
|
||||
|
||||
/**
|
||||
* @typedef {import("./author")} Author
|
||||
* @typedef {import("./types").BlobStore} BlobStore
|
||||
* @import Author from "./author"
|
||||
* @import { BlobStore } from "./types"
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ const Change = require('./change')
|
|||
const Operation = require('./operation')
|
||||
|
||||
/**
|
||||
* @typedef {import("./author")} Author
|
||||
* @import Author from "./author"
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,9 @@ const OError = require('@overleaf/o-error')
|
|||
const History = require('./history')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").BlobStore} BlobStore
|
||||
* @typedef {import("./change")} Change
|
||||
* @typedef {import("./snapshot")} Snapshot
|
||||
* @import { BlobStore } from "./types"
|
||||
* @import Change from "./change"
|
||||
* @import Snapshot from "./snapshot"
|
||||
*/
|
||||
class ConflictingEndVersion extends OError {
|
||||
constructor(clientEndVersion, latestEndVersion) {
|
||||
|
|
|
@ -3,8 +3,8 @@ const { RetainOp, InsertOp, RemoveOp } = require('./operation/scan_op')
|
|||
const Range = require('./range')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").CommentRawData} CommentRawData
|
||||
* @typedef {import("./operation/text_operation")} TextOperation
|
||||
* @import { CommentRawData } from "./types"
|
||||
* @import TextOperation from "./operation/text_operation"
|
||||
*/
|
||||
|
||||
class Comment {
|
||||
|
|
|
@ -10,16 +10,13 @@ const HashFileData = require('./file_data/hash_file_data')
|
|||
const StringFileData = require('./file_data/string_file_data')
|
||||
|
||||
/**
|
||||
* @typedef {import("./blob")} Blob
|
||||
* @typedef {import("./types").BlobStore} BlobStore
|
||||
* @typedef {import("./types").ReadonlyBlobStore} ReadonlyBlobStore
|
||||
* @typedef {import("./types").RawFileData} RawFileData
|
||||
* @typedef {import("./types").RawFile} RawFile
|
||||
* @typedef {import("./types").StringFileRawData} StringFileRawData
|
||||
* @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
|
||||
* @import Blob from "./blob"
|
||||
* @import { BlobStore, ReadonlyBlobStore, RawFileData, RawFile } from "./types"
|
||||
* @import { StringFileRawData, CommentRawData } from "./types"
|
||||
* @import CommentList from "./file_data/comment_list"
|
||||
* @import TextOperation from "./operation/text_operation"
|
||||
* @import TrackedChangeList from "./file_data/tracked_change_list"
|
||||
*
|
||||
* @typedef {{filterTrackedDeletes?: boolean}} FileGetContentOptions
|
||||
*/
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const Blob = require('../blob')
|
|||
const FileData = require('./')
|
||||
|
||||
/**
|
||||
* @typedef {import('../types').RawBinaryFileData} RawBinaryFileData
|
||||
* @import { RawBinaryFileData } from '../types'
|
||||
*/
|
||||
|
||||
class BinaryFileData extends FileData {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {import('../types').ClearTrackingPropsRawData} ClearTrackingPropsRawData
|
||||
* @import { ClearTrackingPropsRawData } from '../types'
|
||||
*/
|
||||
|
||||
class ClearTrackingProps {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
const Comment = require('../comment')
|
||||
|
||||
/**
|
||||
* @typedef {import("../types").CommentRawData} CommentRawData
|
||||
* @typedef {import("../range")} Range
|
||||
* @import { CommentRawData } from "../types"
|
||||
* @import Range from "../range"
|
||||
*/
|
||||
|
||||
class CommentList {
|
||||
|
|
|
@ -6,11 +6,10 @@ const assert = require('check-types').assert
|
|||
const Blob = require('../blob')
|
||||
const FileData = require('./')
|
||||
/**
|
||||
* @typedef {import('./string_file_data')} StringFileData
|
||||
* @typedef {import('./lazy_string_file_data')} LazyStringFileData
|
||||
* @typedef {import('./hollow_string_file_data')} HollowStringFileData
|
||||
* @typedef {import('../types').BlobStore} BlobStore
|
||||
* @typedef {import('../types').RawHashFileData} RawHashFileData
|
||||
* @import StringFileData from './string_file_data'
|
||||
* @import LazyStringFileData from './lazy_string_file_data'
|
||||
* @import HollowStringFileData from './hollow_string_file_data'
|
||||
* @import { BlobStore, RawHashFileData } from '../types'
|
||||
*/
|
||||
|
||||
class HashFileData extends FileData {
|
||||
|
|
|
@ -5,7 +5,7 @@ const assert = require('check-types').assert
|
|||
const FileData = require('./')
|
||||
|
||||
/**
|
||||
* @typedef {import('../types').RawHollowBinaryFileData} RawHollowBinaryFileData
|
||||
* @import { RawHollowBinaryFileData } from '../types'
|
||||
*/
|
||||
|
||||
class HollowBinaryFileData extends FileData {
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
// @ts-check
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* @typedef {import('../operation/edit_operation')} EditOperation
|
||||
*/
|
||||
const assert = require('check-types').assert
|
||||
|
||||
const FileData = require('./')
|
||||
|
||||
/**
|
||||
* @typedef {import('../types').RawHollowStringFileData} RawHollowStringFileData
|
||||
* @import { RawHollowStringFileData } from '../types'
|
||||
* @import EditOperation from '../operation/edit_operation'
|
||||
*/
|
||||
|
||||
class HollowStringFileData extends FileData {
|
||||
|
|
|
@ -7,13 +7,10 @@ const assert = require('check-types').assert
|
|||
const Blob = require('../blob')
|
||||
|
||||
/**
|
||||
* @typedef {import("../types").BlobStore} BlobStore
|
||||
* @typedef {import("../types").ReadonlyBlobStore} ReadonlyBlobStore
|
||||
* @typedef {import("../types").RawFileData} RawFileData
|
||||
* @typedef {import("../operation/edit_operation")} EditOperation
|
||||
* @typedef {import("../file_data/comment_list")} CommentList
|
||||
* @typedef {import("../types").CommentRawData} CommentRawData
|
||||
* @typedef {import("../file_data/tracked_change_list")} TrackedChangeList
|
||||
* @import { BlobStore, ReadonlyBlobStore, RawFileData, CommentRawData } from "../types"
|
||||
* @import EditOperation from "../operation/edit_operation"
|
||||
* @import CommentList from "../file_data/comment_list"
|
||||
* @import TrackedChangeList from "../file_data/tracked_change_list"
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,11 +11,7 @@ const EditOperation = require('../operation/edit_operation')
|
|||
const EditOperationBuilder = require('../operation/edit_operation_builder')
|
||||
|
||||
/**
|
||||
* @typedef {import('../types').BlobStore} BlobStore
|
||||
* @typedef {import('../types').ReadonlyBlobStore} ReadonlyBlobStore
|
||||
* @typedef {import('../types').RangesBlob} RangesBlob
|
||||
* @typedef {import('../types').RawFileData} RawFileData
|
||||
* @typedef {import('../types').RawLazyStringFileData} RawLazyStringFileData
|
||||
* @import { BlobStore, ReadonlyBlobStore, RangesBlob, RawFileData, RawLazyStringFileData } from '../types'
|
||||
*/
|
||||
|
||||
class LazyStringFileData extends FileData {
|
||||
|
|
|
@ -8,13 +8,9 @@ const CommentList = require('./comment_list')
|
|||
const TrackedChangeList = require('./tracked_change_list')
|
||||
|
||||
/**
|
||||
* @typedef {import("../types").StringFileRawData} StringFileRawData
|
||||
* @typedef {import("../types").RawFileData} RawFileData
|
||||
* @typedef {import("../operation/edit_operation")} EditOperation
|
||||
* @typedef {import("../types").BlobStore} BlobStore
|
||||
* @typedef {import("../types").CommentRawData} CommentRawData
|
||||
* @typedef {import("../types").TrackedChangeRawData} TrackedChangeRawData
|
||||
* @typedef {import('../types').RangesBlob} RangesBlob
|
||||
* @import { StringFileRawData, RawFileData, BlobStore, CommentRawData } from "../types"
|
||||
* @import { TrackedChangeRawData, RangesBlob } from "../types"
|
||||
* @import EditOperation from "../operation/edit_operation"
|
||||
*/
|
||||
|
||||
class StringFileData extends FileData {
|
||||
|
|
|
@ -3,7 +3,7 @@ const Range = require('../range')
|
|||
const TrackingProps = require('./tracking_props')
|
||||
|
||||
/**
|
||||
* @typedef {import("../types").TrackedChangeRawData} TrackedChangeRawData
|
||||
* @import { TrackedChangeRawData } from "../types"
|
||||
*/
|
||||
|
||||
class TrackedChange {
|
||||
|
|
|
@ -4,8 +4,7 @@ const TrackedChange = require('./tracked_change')
|
|||
const TrackingProps = require('../file_data/tracking_props')
|
||||
|
||||
/**
|
||||
* @typedef {import("../types").TrackingDirective} TrackingDirective
|
||||
* @typedef {import("../types").TrackedChangeRawData} TrackedChangeRawData
|
||||
* @import { TrackingDirective, TrackedChangeRawData } from "../types"
|
||||
*/
|
||||
|
||||
class TrackedChangeList {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// @ts-check
|
||||
/**
|
||||
* @typedef {import("../types").TrackingPropsRawData} TrackingPropsRawData
|
||||
* @typedef {import("../types").TrackingDirective} TrackingDirective
|
||||
* @import { TrackingPropsRawData, TrackingDirective } from "../types"
|
||||
*/
|
||||
|
||||
class TrackingProps {
|
||||
|
|
|
@ -10,8 +10,8 @@ const File = require('./file')
|
|||
const safePathname = require('./safe_pathname')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').RawFile} RawFile
|
||||
* @typedef {import('./types').RawFileMap} RawFileMap
|
||||
* @import { RawFile, RawFileMap } from './types'
|
||||
*
|
||||
* @typedef {Record<String, File | null>} FileMapData
|
||||
*/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const Change = require('./change')
|
|||
const Snapshot = require('./snapshot')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").BlobStore} BlobStore
|
||||
* @import { BlobStore } from "./types"
|
||||
*/
|
||||
|
||||
class History {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
const assert = require('check-types').assert
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').RawLabel} RawLabel
|
||||
* @import { RawLabel } from './types'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,10 +5,9 @@ const Range = require('../range')
|
|||
const EditOperation = require('./edit_operation')
|
||||
|
||||
/**
|
||||
* @typedef {import('./delete_comment_operation')} DeleteCommentOperation
|
||||
* @typedef {import('../types').CommentRawData} CommentRawData
|
||||
* @typedef {import('../types').RawAddCommentOperation} RawAddCommentOperation
|
||||
* @typedef {import('../file_data/string_file_data')} StringFileData
|
||||
* @import DeleteCommentOperation from './delete_comment_operation'
|
||||
* @import { CommentRawData, RawAddCommentOperation } from '../types'
|
||||
* @import StringFileData from '../file_data/string_file_data'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,9 +4,9 @@ const EditNoOperation = require('./edit_no_operation')
|
|||
const EditOperation = require('./edit_operation')
|
||||
|
||||
/**
|
||||
* @typedef {import('./add_comment_operation')} AddCommentOperation
|
||||
* @typedef {import('../types').RawDeleteCommentOperation} RawDeleteCommentOperation
|
||||
* @typedef {import('../file_data/string_file_data')} StringFileData
|
||||
* @import AddCommentOperation from './add_comment_operation'
|
||||
* @import StringFileData from '../file_data/string_file_data'
|
||||
* @import { RawDeleteCommentOperation } from '../types'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// @ts-check
|
||||
'use strict'
|
||||
/**
|
||||
* @typedef {import('./edit_operation')} EditOperation
|
||||
* @typedef {import('../types').RawEditFileOperation} RawEditFileOperation
|
||||
* @typedef {import("../snapshot")} Snapshot
|
||||
* @import EditOperation from './edit_operation'
|
||||
* @import { RawEditFileOperation } from '../types'
|
||||
* @import Snapshot from "../snapshot"
|
||||
*/
|
||||
|
||||
const Operation = require('./')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const EditOperation = require('./edit_operation')
|
||||
|
||||
/**
|
||||
* @typedef {import('../types').RawEditNoOperation} RawEditNoOperation
|
||||
* @import { RawEditNoOperation } from '../types'
|
||||
*/
|
||||
|
||||
class EditNoOperation extends EditOperation {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @ts-check
|
||||
/**
|
||||
* @typedef {import('../file_data')} FileData
|
||||
* @typedef {import('../types').RawEditOperation} RawEditOperation
|
||||
* @import FileData from '../file_data'
|
||||
* @import { RawEditOperation } from '../types'
|
||||
*/
|
||||
|
||||
class EditOperation {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {import('./edit_operation')} EditOperation
|
||||
* @typedef {import('../types').RawTextOperation} RawTextOperation
|
||||
* @typedef {import('../types').RawAddCommentOperation} RawAddCommentOperation
|
||||
* @typedef {import('../types').RawDeleteCommentOperation} RawDeleteCommentOperation
|
||||
* @typedef {import('../types').RawSetCommentStateOperation} RawSetCommentStateOperation
|
||||
* @typedef {import('../types').RawEditOperation} RawEditOperation
|
||||
* @import EditOperation from './edit_operation'
|
||||
* @import { RawTextOperation, RawAddCommentOperation, RawEditOperation } from '../types'
|
||||
* @import { RawDeleteCommentOperation, RawSetCommentStateOperation } from '../types'
|
||||
*/
|
||||
|
||||
const DeleteCommentOperation = require('./delete_comment_operation')
|
||||
const AddCommentOperation = require('./add_comment_operation')
|
||||
const TextOperation = require('./text_operation')
|
||||
|
|
|
@ -3,7 +3,10 @@ const core = require('../..')
|
|||
const Comment = require('../comment')
|
||||
const EditNoOperation = require('./edit_no_operation')
|
||||
const TextOperation = require('./text_operation')
|
||||
/** @typedef {import('./edit_operation')} EditOperation */
|
||||
|
||||
/**
|
||||
* @import EditOperation from './edit_operation'
|
||||
*/
|
||||
|
||||
class EditOperationTransformer {
|
||||
/**
|
||||
|
|
|
@ -13,8 +13,8 @@ let EditFileOperation = null
|
|||
let SetFileMetadataOperation = null
|
||||
|
||||
/**
|
||||
* @typedef {import("../types").BlobStore} BlobStore
|
||||
* @typedef {import("../snapshot")} Snapshot
|
||||
* @import { BlobStore } from "../types"
|
||||
* @import Snapshot from "../snapshot"
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,12 +9,9 @@ const ClearTrackingProps = require('../file_data/clear_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 {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 {
|
||||
|
|
|
@ -5,10 +5,10 @@ const EditNoOperation = require('./edit_no_operation')
|
|||
const EditOperation = require('./edit_operation')
|
||||
|
||||
/**
|
||||
* @typedef {import('./delete_comment_operation')} DeleteCommentOperation
|
||||
* @typedef {import('../types').CommentRawData} CommentRawData
|
||||
* @typedef {import('../types').RawSetCommentStateOperation} RawSetCommentStateOperation
|
||||
* @typedef {import('../file_data/string_file_data')} StringFileData
|
||||
* @import DeleteCommentOperation from './delete_comment_operation'
|
||||
* @import { CommentRawData } from '../types'
|
||||
* @import { RawSetCommentStateOperation } from '../types'
|
||||
* @import StringFileData from '../file_data/string_file_data'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,11 +30,11 @@ const ClearTrackingProps = require('../file_data/clear_tracking_props')
|
|||
const TrackingProps = require('../file_data/tracking_props')
|
||||
|
||||
/**
|
||||
* @typedef {import('../file_data/string_file_data')} StringFileData
|
||||
* @typedef {import('../types').RawTextOperation} RawTextOperation
|
||||
* @typedef {import('../operation/scan_op').ScanOp} ScanOp
|
||||
* @typedef {import('../file_data/tracked_change_list')} TrackedChangeList
|
||||
* @typedef {import('../types').TrackingDirective} TrackingDirective
|
||||
* @import StringFileData from '../file_data/string_file_data'
|
||||
* @import { RawTextOperation, TrackingDirective } from '../types'
|
||||
* @import { ScanOp } from '../operation/scan_op'
|
||||
* @import TrackedChangeList from '../file_data/tracked_change_list'
|
||||
*
|
||||
* @typedef {{tracking?: TrackingProps, commentIds?: string[]}} InsertOptions
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const OError = require('@overleaf/o-error')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').RawRange} RawRange
|
||||
* @import { RawRange } from './types'
|
||||
*/
|
||||
|
||||
class Range {
|
||||
|
|
|
@ -10,12 +10,10 @@ const V2DocVersions = require('./v2_doc_versions')
|
|||
const FILE_LOAD_CONCURRENCY = 50
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").BlobStore} BlobStore
|
||||
* @typedef {import("./types").RawSnapshot} RawSnapshot
|
||||
* @typedef {import("./types").ReadonlyBlobStore} ReadonlyBlobStore
|
||||
* @typedef {import("./change")} Change
|
||||
* @typedef {import("./operation/text_operation")} TextOperation
|
||||
* @typedef {import("./file")} File
|
||||
* @import { BlobStore, RawSnapshot, ReadonlyBlobStore } from "./types"
|
||||
* @import Change from "./change"
|
||||
* @import TextOperation from "./operation/text_operation"
|
||||
* @import File from "./file"
|
||||
*/
|
||||
|
||||
class EditMissingFileError extends OError {}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
const _ = require('lodash')
|
||||
|
||||
/**
|
||||
* @typedef {import("./file")} File
|
||||
* @typedef {import("./snapshot")} Snapshot
|
||||
* @typedef {import("./types").RawV2DocVersions} RawV2DocVersions
|
||||
* @import File from "./file"
|
||||
* @import Snapshot from "./snapshot"
|
||||
* @import { RawV2DocVersions } from "./types"
|
||||
*/
|
||||
|
||||
class V2DocVersions {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @typedef {import("../..").Blob } Blob
|
||||
* @import { Blob } from "../.."
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@ const TrackedChangeList = require('../lib/file_data/tracked_change_list')
|
|||
const TrackingProps = require('../lib/file_data/tracking_props')
|
||||
const ClearTrackingProps = require('../lib/file_data/clear_tracking_props')
|
||||
const { expect } = require('chai')
|
||||
/** @typedef {import('../lib/types').TrackedChangeRawData} TrackedChangeRawData */
|
||||
/** @import { TrackedChangeRawData } from '../lib/types' */
|
||||
|
||||
describe('TrackedChangeList', function () {
|
||||
describe('applyInsert', function () {
|
||||
|
|
|
@ -9,8 +9,8 @@ const { callbackifyAll } = require('@overleaf/promise-utils')
|
|||
const { setTimeout } = require('timers/promises')
|
||||
|
||||
/**
|
||||
* @typedef {import('mongodb').Document} Document
|
||||
* @typedef {import('mongodb').WithId} WithId
|
||||
* @import { Document } from 'mongodb'
|
||||
* @import { WithId } from 'mongodb'
|
||||
*/
|
||||
|
||||
const DocManager = {
|
||||
|
|
|
@ -4,12 +4,8 @@ const _ = require('lodash')
|
|||
const { isDelete } = require('./Utils')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').Comment} Comment
|
||||
* @typedef {import('./types').HistoryComment} HistoryComment
|
||||
* @typedef {import('./types').HistoryRanges} HistoryRanges
|
||||
* @typedef {import('./types').HistoryTrackedChange} HistoryTrackedChange
|
||||
* @typedef {import('./types').Ranges} Ranges
|
||||
* @typedef {import('./types').TrackedChange} TrackedChange
|
||||
* @import { Comment, HistoryComment, HistoryRanges, HistoryTrackedChange } from './types'
|
||||
* @import { Ranges, TrackedChange } from './types'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@ const HistoryConversions = require('./HistoryConversions')
|
|||
const OError = require('@overleaf/o-error')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').Ranges} Ranges
|
||||
* @import { Ranges } from './types'
|
||||
*/
|
||||
|
||||
const ProjectHistoryRedisManager = {
|
||||
|
|
|
@ -8,21 +8,9 @@ const _ = require('lodash')
|
|||
const { isInsert, isDelete, isComment, getDocLength } = require('./Utils')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').Comment} Comment
|
||||
* @typedef {import('./types').CommentOp} CommentOp
|
||||
* @typedef {import('./types').DeleteOp} DeleteOp
|
||||
* @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
|
||||
* @import { Comment, CommentOp, InsertOp, DeleteOp, HistoryOp, Op } from './types'
|
||||
* @import { HistoryCommentOp, HistoryDeleteOp, HistoryInsertOp, HistoryRetainOp } from './types'
|
||||
* @import { HistoryDeleteTrackedChange, HistoryUpdate, Ranges, TrackedChange, Update } from './types'
|
||||
*/
|
||||
|
||||
const RANGE_DELTA_BUCKETS = [0, 1, 2, 3, 4, 5, 10, 20, 50]
|
||||
|
|
|
@ -17,12 +17,7 @@ const Profiler = require('./Profiler')
|
|||
const { isInsert, isDelete, getDocLength } = require('./Utils')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").DeleteOp} DeleteOp
|
||||
* @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
|
||||
* @import { DeleteOp, InsertOp, Op, Ranges, Update, HistoryUpdate } from "./types"
|
||||
*/
|
||||
|
||||
const UpdateManager = {
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
const _ = require('lodash')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').CommentOp} CommentOp
|
||||
* @typedef {import('./types').DeleteOp} DeleteOp
|
||||
* @typedef {import('./types').InsertOp} InsertOp
|
||||
* @typedef {import('./types').Op} Op
|
||||
* @typedef {import('./types').TrackedChange} TrackedChange
|
||||
* @import { CommentOp, DeleteOp, InsertOp, Op, TrackedChange } from './types'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ const postgresBackend = require('./postgres')
|
|||
const mongoBackend = require('./mongo')
|
||||
const logger = require('@overleaf/logger')
|
||||
|
||||
/** @typedef {import('stream').Readable} Readable */
|
||||
/** @import { Readable } from 'stream' */
|
||||
|
||||
const GLOBAL_BLOBS = new Map()
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
// @ts-check
|
||||
'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 BPromise = require('bluebird')
|
||||
|
@ -15,10 +18,6 @@ const OError = require('@overleaf/o-error')
|
|||
|
||||
const assert = require('./assert')
|
||||
|
||||
/**
|
||||
* @typedef {import('../../storage/lib/blob_store/index').BlobStore} BlobStore
|
||||
*/
|
||||
|
||||
// The maximum safe concurrency appears to be 1.
|
||||
// https://github.com/overleaf/issues/issues/1909
|
||||
const FETCH_CONCURRENCY = 1 // number of files to fetch at once
|
||||
|
|
|
@ -14,8 +14,7 @@ import {
|
|||
} from 'overleaf-editor-core'
|
||||
|
||||
/**
|
||||
* @typedef {import('overleaf-editor-core/lib/types').RawEditOperation} RawEditOperation
|
||||
* @typedef {import('overleaf-editor-core/lib/types').TrackedChangeRawData} TrackedChangeRawData
|
||||
* @import { RawEditOperation, TrackedChangeRawData } from 'overleaf-editor-core/lib/types'
|
||||
*/
|
||||
|
||||
export function convertToSummarizedUpdates(chunk, callback) {
|
||||
|
|
|
@ -12,10 +12,9 @@ import logger from '@overleaf/logger'
|
|||
import OError from '@overleaf/o-error'
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').AddDocUpdate} AddDocUpdate
|
||||
* @typedef {import('overleaf-editor-core/lib/types').CommentRawData} CommentRawData
|
||||
* @typedef {import('overleaf-editor-core/lib/types').TrackedChangeRawData} TrackedChangeRawData
|
||||
* */
|
||||
* @import { AddDocUpdate } from './types'
|
||||
* @import { CommentRawData, TrackedChangeRawData } from 'overleaf-editor-core/lib/types'
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -10,9 +10,8 @@ import * as Errors from './Errors.js'
|
|||
import _ from 'lodash'
|
||||
|
||||
/**
|
||||
* @typedef {import('stream').Readable} ReadableStream
|
||||
* @typedef {import('overleaf-editor-core').Snapshot} Snapshot
|
||||
* @typedef {import('./types').RangesSnapshot} RangesSnapshot
|
||||
* @import { Snapshot } from 'overleaf-editor-core'
|
||||
* @import { RangesSnapshot } from './types'
|
||||
*/
|
||||
|
||||
StringStream.prototype._read = function () {}
|
||||
|
|
|
@ -22,18 +22,10 @@ import * as HashManager from './HashManager.js'
|
|||
import { isInsert, isDelete } from './Utils.js'
|
||||
|
||||
/**
|
||||
* @typedef {import('overleaf-editor-core').Comment} HistoryComment
|
||||
* @typedef {import('overleaf-editor-core').TrackedChange} HistoryTrackedChange
|
||||
* @typedef {import('./types').Comment} Comment
|
||||
* @typedef {import('./types').Entity} Entity
|
||||
* @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
|
||||
* @import { Comment as HistoryComment, TrackedChange as HistoryTrackedChange } from 'overleaf-editor-core'
|
||||
* @import { Comment, Entity, ResyncDocContentUpdate, RetainOp, TrackedChange } from './types'
|
||||
* @import { TrackedChangeTransition, TrackingDirective, TrackingType, Update } from './types'
|
||||
* @import { ProjectStructureUpdate } from './types'
|
||||
*/
|
||||
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
|
||||
|
|
|
@ -4,10 +4,7 @@ import OError from '@overleaf/o-error'
|
|||
import DMP from 'diff-match-patch'
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').DeleteOp} DeleteOp
|
||||
* @typedef {import('./types').InsertOp} InsertOp
|
||||
* @typedef {import('./types').Op} Op
|
||||
* @typedef {import('./types').Update} Update
|
||||
* @import { DeleteOp, InsertOp, Op, Update } from './types'
|
||||
*/
|
||||
|
||||
const MAX_TIME_BETWEEN_UPDATES = 60 * 1000 // one minute
|
||||
|
|
|
@ -7,19 +7,9 @@ import * as OperationsCompressor from './OperationsCompressor.js'
|
|||
import { isInsert, isRetain, isDelete, isComment } from './Utils.js'
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').AddDocUpdate} AddDocUpdate
|
||||
* @typedef {import('./types').AddFileUpdate} AddFileUpdate
|
||||
* @typedef {import('./types').DeleteCommentUpdate} DeleteCommentUpdate
|
||||
* @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
|
||||
* @import { AddDocUpdate, AddFileUpdate, DeleteCommentUpdate, Op, RawScanOp } from './types'
|
||||
* @import { RenameUpdate, TextUpdate, TrackingDirective, TrackingProps } from './types'
|
||||
* @import { SetCommentStateUpdate, SetFileMetadataOperation, Update, UpdateWithBlob } from './types'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').CommentOp} CommentOp
|
||||
* @typedef {import('./types').DeleteOp} DeleteOp
|
||||
* @typedef {import('./types').InsertOp} InsertOp
|
||||
* @typedef {import('./types').Op} Op
|
||||
* @typedef {import('./types').RetainOp} RetainOp
|
||||
* @import { CommentOp, DeleteOp, InsertOp, Op, RetainOp } from './types'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { expect } from 'chai'
|
||||
import { createRangeBlobDataFromUpdate } from '../../../../app/js/HistoryBlobTranslator.js'
|
||||
|
||||
/** @typedef {import("../../../../app/js/types").AddDocUpdate} AddDocUpdate */
|
||||
/**
|
||||
* @import { AddDocUpdate } from "../../../../app/js/types"
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -47,9 +47,7 @@ const Modules = require('../../infrastructure/Modules')
|
|||
const UserGetter = require('../User/UserGetter')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
|
||||
* @typedef {import("./types").GetProjectsResponse} GetProjectsResponse
|
||||
* @typedef {import("./types").Project} Project
|
||||
* @import { GetProjectsRequest, GetProjectsResponse, Project } from "./types"
|
||||
*/
|
||||
|
||||
const _ProjectController = {
|
||||
|
|
|
@ -5,7 +5,7 @@ const { promisify } = require('util')
|
|||
const Settings = require('@overleaf/settings')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").MongoProject} MongoProject
|
||||
* @import { MongoProject } from "./types"
|
||||
*/
|
||||
|
||||
const ENGINE_TO_COMPILER_MAP = {
|
||||
|
|
|
@ -27,15 +27,11 @@ const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
|||
const SplitTestSessionHandler = require('../SplitTests/SplitTestSessionHandler')
|
||||
const SubscriptionLocator = require('../Subscription/SubscriptionLocator')
|
||||
|
||||
/** @typedef {import("./types").GetProjectsRequest} GetProjectsRequest */
|
||||
/** @typedef {import("./types").GetProjectsResponse} GetProjectsResponse */
|
||||
/** @typedef {import("../../../../types/project/dashboard/api").ProjectApi} ProjectApi */
|
||||
/** @typedef {import("../../../../types/project/dashboard/api").Filters} Filters */
|
||||
/** @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 */
|
||||
/**
|
||||
* @import { GetProjectsRequest, GetProjectsResponse, AllUsersProjects, MongoProject } from "./types"
|
||||
* @import { ProjectApi, Filters, Page, Sort } from "../../../../types/project/dashboard/api"
|
||||
* @import { Tag } from "../Tags/types"
|
||||
*/
|
||||
|
||||
const _ssoAvailable = (affiliation, session, linkedInstitutionIds) => {
|
||||
if (!affiliation.institution) return false
|
||||
|
|
|
@ -17,7 +17,7 @@ const SplitTestSessionHandler = require('./SplitTestSessionHandler')
|
|||
const SplitTestUserGetter = require('./SplitTestUserGetter')
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").Assignment} Assignment
|
||||
* @import { Assignment } from "./types"
|
||||
*/
|
||||
|
||||
const DEFAULT_VARIANT = 'default'
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
const dateformat = require('dateformat')
|
||||
const { formatCurrencyLocalized } = require('../../util/currency')
|
||||
|
||||
/**
|
||||
* @import { CurrencyCode } from '@/shared/utils/currency'
|
||||
*/
|
||||
|
||||
const currencySymbols = {
|
||||
EUR: '€',
|
||||
USD: '$',
|
||||
|
@ -48,10 +52,6 @@ function formatPriceDefault(priceInCents, currency) {
|
|||
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 {CurrencyCode?} currency - currency code (default to USD)
|
||||
|
|
|
@ -9,7 +9,7 @@ const { expressify } = require('@overleaf/promise-utils')
|
|||
const Modules = require('../../infrastructure/Modules')
|
||||
|
||||
/**
|
||||
* @typedef {import("../../../../types/subscription/dashboard/subscription").Subscription} Subscription
|
||||
* @import { Subscription } from "../../../../types/subscription/dashboard/subscription"
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -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'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,9 @@ const {
|
|||
} = require('../Errors/Errors')
|
||||
const FeaturesHelper = require('./FeaturesHelper')
|
||||
|
||||
/** @typedef {import("../../../../types/project/dashboard/subscription").Subscription} Subscription */
|
||||
/**
|
||||
* @import { Subscription } from "../../../../types/project/dashboard/subscription"
|
||||
*/
|
||||
|
||||
function buildHostedLink(type) {
|
||||
return `/user/subscription/recurly/${type}`
|
||||
|
|
|
@ -5,7 +5,7 @@ const SubscriptionLocator = require('../Subscription/SubscriptionLocator')
|
|||
const { callbackify } = require('@overleaf/promise-utils')
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../../types/project/dashboard/survey').Survey} Survey
|
||||
* @import { Survey } from '../../../../types/project/dashboard/survey'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
|
||||
/**
|
||||
* @typedef {import('./types').HttpPermissionsPolicy} HttpPermissionsPolicy
|
||||
* */
|
||||
* @import { HttpPermissionsPolicy } from './types'
|
||||
*/
|
||||
|
||||
class HttpPermissionsPolicyMiddleware {
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('@/shared/utils/currency').CurrencyCode} CurrencyCode
|
||||
* @import { CurrencyCode } from '@/shared/utils/currency'
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import getMeta from '../../../utils/meta'
|
||||
|
||||
/**
|
||||
* @typedef {import('@/shared/utils/currency').CurrencyCode} CurrencyCode
|
||||
* @import { CurrencyCode } from '@/shared/utils/currency'
|
||||
*/
|
||||
|
||||
// plan: 'collaborator' or 'professional'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/** @typedef {import("../../types/web-module").WebModule} WebModule */
|
||||
/** @import { WebModule } from "../../types/web-module" */
|
||||
|
||||
/** @type {WebModule} */
|
||||
const HistoryModule = {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const LaunchpadRouter = require('./app/src/LaunchpadRouter')
|
||||
|
||||
/** @typedef {import("../../types/web-module").WebModule} WebModule */
|
||||
/** @import { WebModule } from "../../types/web-module" */
|
||||
|
||||
/** @type {WebModule} */
|
||||
const LaunchpadModule = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/** @typedef {import("../../types/web-module").WebModule} WebModule */
|
||||
/** @import { WebModule } from "../../types/web-module" */
|
||||
|
||||
/** @type {WebModule} */
|
||||
const ServerCeScriptsModule = {}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const UserActivateRouter = require('./app/src/UserActivateRouter')
|
||||
|
||||
/** @typedef {import("../../types/web-module").WebModule} WebModule */
|
||||
/**
|
||||
* @import { WebModule } from "../../types/web-module"
|
||||
*/
|
||||
|
||||
/** @type {WebModule} */
|
||||
const UserActivateModule = {
|
||||
|
|
Loading…
Reference in a new issue