mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02: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:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user