mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 06:23:38 -05:00
[misc] bump logger-sharelatex to version 2.2.0
This commit is contained in:
parent
0c83e19863
commit
d1da5e43af
26 changed files with 277 additions and 293 deletions
3
services/docstore/.gitignore
vendored
3
services/docstore/.gitignore
vendored
|
@ -1,2 +1,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
forever
|
forever
|
||||||
|
|
||||||
|
# managed by dev-environment$ bin/update_build_scripts
|
||||||
|
.npmrc
|
||||||
|
|
|
@ -24,8 +24,8 @@ module.exports = {
|
||||||
unArchiveAllDocs,
|
unArchiveAllDocs,
|
||||||
unarchiveDoc,
|
unarchiveDoc,
|
||||||
destroyAllDocs,
|
destroyAllDocs,
|
||||||
destroyDoc
|
destroyDoc,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
async function archiveAllDocs(projectId) {
|
async function archiveAllDocs(projectId) {
|
||||||
|
@ -61,7 +61,7 @@ async function archiveDoc(projectId, doc) {
|
||||||
const json = JSON.stringify({
|
const json = JSON.stringify({
|
||||||
lines: doc.lines,
|
lines: doc.lines,
|
||||||
ranges: doc.ranges,
|
ranges: doc.ranges,
|
||||||
schema_v: 1
|
schema_v: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
// this should never happen, but protects against memory-corruption errors that
|
// this should never happen, but protects against memory-corruption errors that
|
||||||
|
@ -75,7 +75,7 @@ async function archiveDoc(projectId, doc) {
|
||||||
const md5 = crypto.createHash('md5').update(json).digest('hex')
|
const md5 = crypto.createHash('md5').update(json).digest('hex')
|
||||||
const stream = Streamifier.createReadStream(json)
|
const stream = Streamifier.createReadStream(json)
|
||||||
await PersistorManager.sendStream(settings.docstore.bucket, key, stream, {
|
await PersistorManager.sendStream(settings.docstore.bucket, key, stream, {
|
||||||
sourceMd5: md5
|
sourceMd5: md5,
|
||||||
})
|
})
|
||||||
await MongoManager.markDocAsArchived(doc._id, doc.rev)
|
await MongoManager.markDocAsArchived(doc._id, doc.rev)
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ async function unarchiveDoc(projectId, docId) {
|
||||||
throw new Errors.Md5MismatchError('md5 mismatch when downloading doc', {
|
throw new Errors.Md5MismatchError('md5 mismatch when downloading doc', {
|
||||||
key,
|
key,
|
||||||
sourceMd5,
|
sourceMd5,
|
||||||
md5
|
md5,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ async function destroyDoc(projectId, docId) {
|
||||||
'removing doc from mongo and persistor'
|
'removing doc from mongo and persistor'
|
||||||
)
|
)
|
||||||
const doc = await MongoManager.findDoc(projectId, docId, {
|
const doc = await MongoManager.findDoc(projectId, docId, {
|
||||||
inS3: 1
|
inS3: 1,
|
||||||
})
|
})
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
throw new Errors.NotFoundError('Doc not found in Mongo')
|
throw new Errors.NotFoundError('Doc not found in Mongo')
|
||||||
|
|
|
@ -103,7 +103,7 @@ module.exports = DocManager = {
|
||||||
deleted: true,
|
deleted: true,
|
||||||
version: true,
|
version: true,
|
||||||
ranges: true,
|
ranges: true,
|
||||||
inS3: true
|
inS3: true,
|
||||||
},
|
},
|
||||||
function (err, doc) {
|
function (err, doc) {
|
||||||
if (err != null) {
|
if (err != null) {
|
||||||
|
@ -175,7 +175,7 @@ module.exports = DocManager = {
|
||||||
lines: true,
|
lines: true,
|
||||||
version: true,
|
version: true,
|
||||||
ranges: true,
|
ranges: true,
|
||||||
inS3: true
|
inS3: true,
|
||||||
},
|
},
|
||||||
function (err, doc) {
|
function (err, doc) {
|
||||||
let updateLines, updateRanges, updateVersion
|
let updateLines, updateRanges, updateVersion
|
||||||
|
@ -238,7 +238,7 @@ module.exports = DocManager = {
|
||||||
project_id,
|
project_id,
|
||||||
doc_id,
|
doc_id,
|
||||||
oldVersion: doc != null ? doc.version : undefined,
|
oldVersion: doc != null ? doc.version : undefined,
|
||||||
newVersion: version
|
newVersion: version,
|
||||||
},
|
},
|
||||||
'updating doc version'
|
'updating doc version'
|
||||||
)
|
)
|
||||||
|
@ -288,5 +288,5 @@ module.exports = DocManager = {
|
||||||
}
|
}
|
||||||
return MongoManager.markDocAsDeleted(project_id, doc_id, callback)
|
return MongoManager.markDocAsDeleted(project_id, doc_id, callback)
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,5 +6,5 @@ class Md5MismatchError extends OError {}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Md5MismatchError,
|
Md5MismatchError,
|
||||||
...Errors
|
...Errors,
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,11 @@ module.exports = {
|
||||||
const url = `http://localhost:${port}/project/${project_id}/doc/${doc_id}`
|
const url = `http://localhost:${port}/project/${project_id}/doc/${doc_id}`
|
||||||
const lines = [
|
const lines = [
|
||||||
'smoke test - delete me',
|
'smoke test - delete me',
|
||||||
`${crypto.randomBytes(32).toString('hex')}`
|
`${crypto.randomBytes(32).toString('hex')}`,
|
||||||
]
|
]
|
||||||
const getOpts = () => ({
|
const getOpts = () => ({
|
||||||
url,
|
url,
|
||||||
timeout: 3000
|
timeout: 3000,
|
||||||
})
|
})
|
||||||
logger.log({ lines, url, doc_id, project_id }, 'running health check')
|
logger.log({ lines, url, doc_id, project_id }, 'running health check')
|
||||||
const jobs = [
|
const jobs = [
|
||||||
|
@ -61,8 +61,8 @@ module.exports = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
(cb) => db.docs.remove({ _id: doc_id, project_id }, cb),
|
(cb) => db.docs.remove({ _id: doc_id, project_id }, cb),
|
||||||
(cb) => db.docOps.remove({ doc_id }, cb)
|
(cb) => db.docOps.remove({ doc_id }, cb),
|
||||||
]
|
]
|
||||||
return async.series(jobs, callback)
|
return async.series(jobs, callback)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ module.exports = HttpController = {
|
||||||
}
|
}
|
||||||
return res.json({
|
return res.json({
|
||||||
modified,
|
modified,
|
||||||
rev
|
rev,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -259,5 +259,5 @@ module.exports = HttpController = {
|
||||||
return res.sendStatus(200)
|
return res.sendStatus(200)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ module.exports = MongoManager = {
|
||||||
return db.docs.find(
|
return db.docs.find(
|
||||||
{
|
{
|
||||||
_id: ObjectId(doc_id.toString()),
|
_id: ObjectId(doc_id.toString()),
|
||||||
project_id: ObjectId(project_id.toString())
|
project_id: ObjectId(project_id.toString()),
|
||||||
},
|
},
|
||||||
filter,
|
filter,
|
||||||
function (error, docs) {
|
function (error, docs) {
|
||||||
|
@ -50,7 +50,7 @@ module.exports = MongoManager = {
|
||||||
getArchivedProjectDocs(project_id, callback) {
|
getArchivedProjectDocs(project_id, callback) {
|
||||||
const query = {
|
const query = {
|
||||||
project_id: ObjectId(project_id.toString()),
|
project_id: ObjectId(project_id.toString()),
|
||||||
inS3: true
|
inS3: true,
|
||||||
}
|
}
|
||||||
return db.docs.find(query, {}, callback)
|
return db.docs.find(query, {}, callback)
|
||||||
},
|
},
|
||||||
|
@ -59,11 +59,11 @@ module.exports = MongoManager = {
|
||||||
const update = {
|
const update = {
|
||||||
$set: updates,
|
$set: updates,
|
||||||
$inc: {
|
$inc: {
|
||||||
rev: 1
|
rev: 1,
|
||||||
},
|
},
|
||||||
$unset: {
|
$unset: {
|
||||||
inS3: true
|
inS3: true,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
update.$set.project_id = ObjectId(project_id)
|
update.$set.project_id = ObjectId(project_id)
|
||||||
return db.docs.update(
|
return db.docs.update(
|
||||||
|
@ -78,10 +78,10 @@ module.exports = MongoManager = {
|
||||||
return db.docs.update(
|
return db.docs.update(
|
||||||
{
|
{
|
||||||
_id: ObjectId(doc_id),
|
_id: ObjectId(doc_id),
|
||||||
project_id: ObjectId(project_id)
|
project_id: ObjectId(project_id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$set: { deleted: true }
|
$set: { deleted: true },
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -90,14 +90,14 @@ module.exports = MongoManager = {
|
||||||
markDocAsArchived(doc_id, rev, callback) {
|
markDocAsArchived(doc_id, rev, callback) {
|
||||||
const update = {
|
const update = {
|
||||||
$set: {},
|
$set: {},
|
||||||
$unset: {}
|
$unset: {},
|
||||||
}
|
}
|
||||||
update.$set.inS3 = true
|
update.$set.inS3 = true
|
||||||
update.$unset.lines = true
|
update.$unset.lines = true
|
||||||
update.$unset.ranges = true
|
update.$unset.ranges = true
|
||||||
const query = {
|
const query = {
|
||||||
_id: doc_id,
|
_id: doc_id,
|
||||||
rev
|
rev,
|
||||||
}
|
}
|
||||||
return db.docs.update(query, update, (err) => callback(err))
|
return db.docs.update(query, update, (err) => callback(err))
|
||||||
},
|
},
|
||||||
|
@ -108,10 +108,10 @@ module.exports = MongoManager = {
|
||||||
}
|
}
|
||||||
return db.docOps.find(
|
return db.docOps.find(
|
||||||
{
|
{
|
||||||
doc_id: ObjectId(doc_id)
|
doc_id: ObjectId(doc_id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: 1
|
version: 1,
|
||||||
},
|
},
|
||||||
function (error, docs) {
|
function (error, docs) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
|
@ -132,13 +132,13 @@ module.exports = MongoManager = {
|
||||||
}
|
}
|
||||||
return db.docOps.update(
|
return db.docOps.update(
|
||||||
{
|
{
|
||||||
doc_id: ObjectId(doc_id)
|
doc_id: ObjectId(doc_id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$set: { version }
|
$set: { version },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
upsert: true
|
upsert: true,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -147,7 +147,7 @@ module.exports = MongoManager = {
|
||||||
destroyDoc(doc_id, callback) {
|
destroyDoc(doc_id, callback) {
|
||||||
return db.docs.remove(
|
return db.docs.remove(
|
||||||
{
|
{
|
||||||
_id: ObjectId(doc_id)
|
_id: ObjectId(doc_id),
|
||||||
},
|
},
|
||||||
function (err) {
|
function (err) {
|
||||||
if (err != null) {
|
if (err != null) {
|
||||||
|
@ -155,13 +155,13 @@ module.exports = MongoManager = {
|
||||||
}
|
}
|
||||||
return db.docOps.remove(
|
return db.docOps.remove(
|
||||||
{
|
{
|
||||||
doc_id: ObjectId(doc_id)
|
doc_id: ObjectId(doc_id),
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const methods = Object.getOwnPropertyNames(MongoManager)
|
const methods = Object.getOwnPropertyNames(MongoManager)
|
||||||
|
|
|
@ -65,5 +65,5 @@ module.exports = RangeManager = {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,5 @@ const mongojs = require('mongojs')
|
||||||
const db = mongojs(Settings.mongo.url, ['docs', 'docOps'])
|
const db = mongojs(Settings.mongo.url, ['docs', 'docOps'])
|
||||||
module.exports = {
|
module.exports = {
|
||||||
db,
|
db,
|
||||||
ObjectId: mongojs.ObjectId
|
ObjectId: mongojs.ObjectId,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@ docstore
|
||||||
--env-pass-through=
|
--env-pass-through=
|
||||||
--node-version=10.21.0
|
--node-version=10.21.0
|
||||||
--public-repo=True
|
--public-repo=True
|
||||||
--script-version=3.2.0
|
--script-version=3.3.2
|
||||||
|
|
|
@ -10,8 +10,8 @@ const Settings = {
|
||||||
internal: {
|
internal: {
|
||||||
docstore: {
|
docstore: {
|
||||||
port: 3016,
|
port: 3016,
|
||||||
host: process.env.LISTEN_ADDRESS || 'localhost'
|
host: process.env.LISTEN_ADDRESS || 'localhost',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mongo: {},
|
mongo: {},
|
||||||
|
@ -19,17 +19,17 @@ const Settings = {
|
||||||
docstore: {
|
docstore: {
|
||||||
backend: process.env.BACKEND || 's3',
|
backend: process.env.BACKEND || 's3',
|
||||||
healthCheck: {
|
healthCheck: {
|
||||||
project_id: process.env.HEALTH_CHECK_PROJECT_ID
|
project_id: process.env.HEALTH_CHECK_PROJECT_ID,
|
||||||
},
|
},
|
||||||
bucket: process.env.BUCKET_NAME || process.env.AWS_BUCKET || 'bucket',
|
bucket: process.env.BUCKET_NAME || process.env.AWS_BUCKET || 'bucket',
|
||||||
gcs: {
|
gcs: {
|
||||||
unlockBeforeDelete: process.env.GCS_UNLOCK_BEFORE_DELETE === 'true',
|
unlockBeforeDelete: process.env.GCS_UNLOCK_BEFORE_DELETE === 'true',
|
||||||
deletedBucketSuffix: process.env.GCS_DELETED_BUCKET_SUFFIX,
|
deletedBucketSuffix: process.env.GCS_DELETED_BUCKET_SUFFIX,
|
||||||
deleteConcurrency: parseInt(process.env.GCS_DELETE_CONCURRENCY) || 50
|
deleteConcurrency: parseInt(process.env.GCS_DELETE_CONCURRENCY) || 50,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
max_doc_length: parseInt(process.env.MAX_DOC_LENGTH) || 2 * 1024 * 1024 // 2mb
|
max_doc_length: parseInt(process.env.MAX_DOC_LENGTH) || 2 * 1024 * 1024, // 2mb
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.MONGO_CONNECTION_STRING != null) {
|
if (process.env.MONGO_CONNECTION_STRING != null) {
|
||||||
|
@ -51,7 +51,7 @@ if (
|
||||||
bucket: process.env.AWS_BUCKET,
|
bucket: process.env.AWS_BUCKET,
|
||||||
endpoint: process.env.AWS_S3_ENDPOINT,
|
endpoint: process.env.AWS_S3_ENDPOINT,
|
||||||
pathStyle: process.env.AWS_S3_PATH_STYLE,
|
pathStyle: process.env.AWS_S3_PATH_STYLE,
|
||||||
partSize: parseInt(process.env.AWS_S3_PARTSIZE) || 100 * 1024 * 1024
|
partSize: parseInt(process.env.AWS_S3_PARTSIZE) || 100 * 1024 * 1024,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ if (process.env.GCS_API_ENDPOINT) {
|
||||||
Settings.docstore.gcs.endpoint = {
|
Settings.docstore.gcs.endpoint = {
|
||||||
apiEndpoint: process.env.GCS_API_ENDPOINT,
|
apiEndpoint: process.env.GCS_API_ENDPOINT,
|
||||||
apiScheme: process.env.GCS_API_SCHEME,
|
apiScheme: process.env.GCS_API_SCHEME,
|
||||||
projectId: process.env.GCS_PROJECT_ID
|
projectId: process.env.GCS_PROJECT_ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ if (process.env.FALLBACK_BACKEND) {
|
||||||
// mapping of bucket names on the fallback, to bucket names on the primary.
|
// mapping of bucket names on the fallback, to bucket names on the primary.
|
||||||
// e.g. { myS3UserFilesBucketName: 'myGoogleUserFilesBucketName' }
|
// e.g. { myS3UserFilesBucketName: 'myGoogleUserFilesBucketName' }
|
||||||
buckets: JSON.parse(process.env.FALLBACK_BUCKET_MAPPING || '{}'),
|
buckets: JSON.parse(process.env.FALLBACK_BUCKET_MAPPING || '{}'),
|
||||||
copyOnMiss: process.env.COPY_ON_MISS === 'true'
|
copyOnMiss: process.env.COPY_ON_MISS === 'true',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ services:
|
||||||
command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
|
command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
|
||||||
user: root
|
user: root
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:3.6
|
image: mongo:4.0
|
||||||
gcs:
|
gcs:
|
||||||
build:
|
build:
|
||||||
context: test/acceptance/deps
|
context: test/acceptance/deps
|
||||||
|
|
|
@ -47,7 +47,7 @@ services:
|
||||||
command: npm run --silent test:acceptance
|
command: npm run --silent test:acceptance
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:3.6
|
image: mongo:4.0
|
||||||
|
|
||||||
gcs:
|
gcs:
|
||||||
build:
|
build:
|
||||||
|
|
75
services/docstore/package-lock.json
generated
75
services/docstore/package-lock.json
generated
|
@ -993,9 +993,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@grpc/proto-loader": {
|
"@grpc/proto-loader": {
|
||||||
"version": "0.5.4",
|
"version": "0.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz",
|
||||||
"integrity": "sha512-HTM4QpI9B2XFkPz7pjwMyMgZchJ93TVkL3kWPW8GDMDKYxsMnmf4w2TNMJK7+KNiYHS5cJrCEAFlF+AwtXWVPA==",
|
"integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"lodash.camelcase": "^4.3.0",
|
"lodash.camelcase": "^4.3.0",
|
||||||
"protobufjs": "^6.8.6"
|
"protobufjs": "^6.8.6"
|
||||||
|
@ -1760,7 +1760,6 @@
|
||||||
"version": "1.8.14",
|
"version": "1.8.14",
|
||||||
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
|
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
|
||||||
"integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
|
"integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"dtrace-provider": "~0.8",
|
"dtrace-provider": "~0.8",
|
||||||
"moment": "^2.19.3",
|
"moment": "^2.19.3",
|
||||||
|
@ -1869,7 +1868,7 @@
|
||||||
"charenc": {
|
"charenc": {
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
|
||||||
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="
|
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
|
||||||
},
|
},
|
||||||
"check-error": {
|
"check-error": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
|
@ -2155,7 +2154,7 @@
|
||||||
"crypt": {
|
"crypt": {
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
|
||||||
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="
|
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
|
||||||
},
|
},
|
||||||
"crypto-random-string": {
|
"crypto-random-string": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
@ -2165,7 +2164,7 @@
|
||||||
"d64": {
|
"d64": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/d64/-/d64-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/d64/-/d64-1.0.0.tgz",
|
||||||
"integrity": "sha512-5eNy3WZziVYnrogqgXhcdEmqcDB2IHurTqLcrgssJsfkMVCUoUaZpK6cJjxxvLV2dUm5SuJMNcYfVGoin9UIRw=="
|
"integrity": "sha1-QAKofoUMv8n52XBrYPymE6MzbpA="
|
||||||
},
|
},
|
||||||
"damerau-levenshtein": {
|
"damerau-levenshtein": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
|
@ -2584,12 +2583,6 @@
|
||||||
"integrity": "sha512-ExTJKhgeYMfY8wDj3UiZmgpMKJOUHGNHmWMlxT49JUDB1vTnw0sSNfXJSxnX+LcebyBD/gudXzjzD136WqPJrQ==",
|
"integrity": "sha512-ExTJKhgeYMfY8wDj3UiZmgpMKJOUHGNHmWMlxT49JUDB1vTnw0sSNfXJSxnX+LcebyBD/gudXzjzD136WqPJrQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint-plugin-chai-friendly": {
|
|
||||||
"version": "0.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.6.0.tgz",
|
|
||||||
"integrity": "sha512-Uvvv1gkbRGp/qfN15B0kQyQWg+oFA8buDSqrwmW3egNSk/FpqH2MjQqKOuKwmEL6w4QIQrIjDp+gg6kGGmD3oQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"eslint-plugin-es": {
|
"eslint-plugin-es": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
|
||||||
|
@ -4292,12 +4285,12 @@
|
||||||
"lodash.at": {
|
"lodash.at": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.at/-/lodash.at-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.at/-/lodash.at-4.6.0.tgz",
|
||||||
"integrity": "sha512-GOTh0SEp+Yosnlpjic+8cl2WM9MykorogkGA9xyIFkkObQ3H3kNZqZ+ohuq4K3FrSVo7hMcZBMataJemrxC3BA=="
|
"integrity": "sha1-k83OZk8KGZTqM9181A4jr9EbD/g="
|
||||||
},
|
},
|
||||||
"lodash.camelcase": {
|
"lodash.camelcase": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
||||||
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
|
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
|
||||||
},
|
},
|
||||||
"lodash.flattendeep": {
|
"lodash.flattendeep": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
|
@ -4313,7 +4306,7 @@
|
||||||
"lodash.has": {
|
"lodash.has": {
|
||||||
"version": "4.5.2",
|
"version": "4.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz",
|
||||||
"integrity": "sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g=="
|
"integrity": "sha1-0Z9NwQlQWMzL4rDN9O4P5Ko3yGI="
|
||||||
},
|
},
|
||||||
"lodash.memoize": {
|
"lodash.memoize": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
|
@ -4353,28 +4346,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logger-sharelatex": {
|
"logger-sharelatex": {
|
||||||
"version": "2.1.1",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.2.0.tgz",
|
||||||
"integrity": "sha512-qqSrBqUgHWnStxtTZ/fSsqPxj9Ju9onok7Vfm3bv5MS702jH+hRsCSA9oXOMvOLcWJrZFnhCZaLGeOvXToUaxw==",
|
"integrity": "sha512-ko+OmE25XHJJCiz1R9EgwlfM7J/5olpunUfR3WcfuqOQrcUqsdBrDA2sOytngT0ViwjCR0Fh4qZVPwEWfmrvwA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@google-cloud/logging-bunyan": "^3.0.0",
|
"@google-cloud/logging-bunyan": "^3.0.0",
|
||||||
"@overleaf/o-error": "^3.0.0",
|
"@overleaf/o-error": "^3.0.0",
|
||||||
"bunyan": "^1.8.14",
|
"bunyan": "^1.8.14",
|
||||||
|
"node-fetch": "^2.6.0",
|
||||||
"raven": "^2.6.4",
|
"raven": "^2.6.4",
|
||||||
"yn": "^4.0.0"
|
"yn": "^4.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"bunyan": {
|
|
||||||
"version": "1.8.14",
|
|
||||||
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
|
|
||||||
"integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
|
|
||||||
"requires": {
|
|
||||||
"dtrace-provider": "~0.8",
|
|
||||||
"moment": "^2.19.3",
|
|
||||||
"mv": "~2",
|
|
||||||
"safe-json-stringify": "~1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loglevel": {
|
"loglevel": {
|
||||||
|
@ -4506,13 +4487,13 @@
|
||||||
"integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
|
"integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
|
||||||
},
|
},
|
||||||
"md5": {
|
"md5": {
|
||||||
"version": "2.2.1",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
|
||||||
"integrity": "sha512-PlGG4z5mBANDGCKsYQe0CaUYHdZYZt8ZPZLmEt+Urf0W4GlpTX4HescwHU+dc9+Z/G/vZKYZYFrwgm9VxK6QOQ==",
|
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"charenc": "~0.0.1",
|
"charenc": "0.0.2",
|
||||||
"crypt": "~0.0.1",
|
"crypt": "0.0.2",
|
||||||
"is-buffer": "~1.1.1"
|
"is-buffer": "~1.1.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-buffer": {
|
"is-buffer": {
|
||||||
|
@ -6019,9 +6000,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"protobufjs": {
|
"protobufjs": {
|
||||||
"version": "6.9.0",
|
"version": "6.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.1.tgz",
|
||||||
"integrity": "sha512-LlGVfEWDXoI/STstRDdZZKb/qusoAWUnmLg9R8OLSO473mBLWHowx8clbX5/+mKDEI+v7GzjoK9tRPZMMcoTrg==",
|
"integrity": "sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@protobufjs/aspromise": "^1.1.2",
|
"@protobufjs/aspromise": "^1.1.2",
|
||||||
"@protobufjs/base64": "^1.1.2",
|
"@protobufjs/base64": "^1.1.2",
|
||||||
|
@ -6147,12 +6128,12 @@
|
||||||
"cookie": {
|
"cookie": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
|
||||||
"integrity": "sha512-+IJOX0OqlHCszo2mBUq+SrEbCj6w7Kpffqx60zYbPTFaO4+yYgRjHwcZNpWvaTylDHaV7PPmBHzSecZiMhtPgw=="
|
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
|
||||||
},
|
},
|
||||||
"stack-trace": {
|
"stack-trace": {
|
||||||
"version": "0.0.10",
|
"version": "0.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||||
"integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg=="
|
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
|
||||||
},
|
},
|
||||||
"uuid": {
|
"uuid": {
|
||||||
"version": "3.3.2",
|
"version": "3.3.2",
|
||||||
|
@ -7163,7 +7144,7 @@
|
||||||
"timed-out": {
|
"timed-out": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
|
||||||
"integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA=="
|
"integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
|
||||||
},
|
},
|
||||||
"tiny-async-pool": {
|
"tiny-async-pool": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
|
@ -7196,7 +7177,7 @@
|
||||||
"to-no-case": {
|
"to-no-case": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz",
|
||||||
"integrity": "sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg=="
|
"integrity": "sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo="
|
||||||
},
|
},
|
||||||
"to-regex-range": {
|
"to-regex-range": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
|
@ -7210,7 +7191,7 @@
|
||||||
"to-snake-case": {
|
"to-snake-case": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/to-snake-case/-/to-snake-case-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/to-snake-case/-/to-snake-case-1.0.0.tgz",
|
||||||
"integrity": "sha512-joRpzBAk1Bhi2eGEYBjukEWHOe/IvclOkiJl3DtA91jV6NwQ3MwXA4FHYeqk8BNp/D8bmi9tcNbRu/SozP0jbQ==",
|
"integrity": "sha1-znRpE4l5RgGah+Yu366upMYIq4w=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"to-space-case": "^1.0.0"
|
"to-space-case": "^1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -7218,7 +7199,7 @@
|
||||||
"to-space-case": {
|
"to-space-case": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz",
|
||||||
"integrity": "sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==",
|
"integrity": "sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"to-no-case": "^1.0.0"
|
"to-no-case": "^1.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"async": "^2.6.3",
|
"async": "^2.6.3",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"logger-sharelatex": "^2.1.1",
|
"logger-sharelatex": "^2.2.0",
|
||||||
"metrics-sharelatex": "^2.7.0",
|
"metrics-sharelatex": "^2.7.0",
|
||||||
"mongojs": "3.1.0",
|
"mongojs": "3.1.0",
|
||||||
"settings-sharelatex": "^1.1.0",
|
"settings-sharelatex": "^1.1.0",
|
||||||
|
@ -38,22 +38,22 @@
|
||||||
"chai": "~4.2.0",
|
"chai": "~4.2.0",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.10.0",
|
||||||
"eslint-config-standard": "^14.1.1",
|
"eslint-config-standard": "^14.1.0",
|
||||||
"eslint-config-standard-jsx": "^8.1.0",
|
"eslint-config-standard-jsx": "^8.1.0",
|
||||||
"eslint-config-standard-react": "^9.2.0",
|
"eslint-config-standard-react": "^9.2.0",
|
||||||
"eslint-plugin-chai-expect": "^2.2.0",
|
"eslint-plugin-chai-expect": "^2.1.0",
|
||||||
"eslint-plugin-chai-friendly": "^0.6.0",
|
"eslint-plugin-chai-friendly": "^0.5.0",
|
||||||
"eslint-plugin-import": "^2.22.0",
|
"eslint-plugin-import": "^2.20.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.3.1",
|
"eslint-plugin-jsx-a11y": "^6.3.1",
|
||||||
"eslint-plugin-mocha": "^6.3.0",
|
"eslint-plugin-mocha": "^6.3.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.0.0",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"eslint-plugin-react": "^7.20.3",
|
"eslint-plugin-react": "^7.20.3",
|
||||||
"eslint-plugin-standard": "^4.0.1",
|
"eslint-plugin-standard": "^4.0.1",
|
||||||
"mocha": "^7.2.0",
|
"mocha": "^7.2.0",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.0",
|
||||||
"prettier-eslint-cli": "^5.0.0",
|
"prettier-eslint-cli": "^5.0.0",
|
||||||
"request": "~2.88.2",
|
"request": "~2.88.2",
|
||||||
"sandboxed-module": "~2.0.4",
|
"sandboxed-module": "~2.0.4",
|
||||||
|
|
|
@ -51,14 +51,14 @@ describe('Archiving', function () {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['one', 'two', 'three'],
|
lines: ['one', 'two', 'three'],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 2
|
version: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['aaa', 'bbb', 'ccc'],
|
lines: ['aaa', 'bbb', 'ccc'],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 4
|
version: 4,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
const jobs = Array.from(this.docs).map((doc) =>
|
const jobs = Array.from(this.docs).map((doc) =>
|
||||||
((doc) => {
|
((doc) => {
|
||||||
|
@ -173,7 +173,7 @@ describe('Archiving', function () {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['one', 'two', 'three'],
|
lines: ['one', 'two', 'three'],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 2
|
version: 2,
|
||||||
}
|
}
|
||||||
return DocstoreClient.createDoc(
|
return DocstoreClient.createDoc(
|
||||||
this.project_id,
|
this.project_id,
|
||||||
|
@ -287,7 +287,7 @@ describe('Archiving', function () {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: [big_line, big_line, big_line, big_line],
|
lines: [big_line, big_line, big_line, big_line],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 2
|
version: 2,
|
||||||
}
|
}
|
||||||
return DocstoreClient.createDoc(
|
return DocstoreClient.createDoc(
|
||||||
this.project_id,
|
this.project_id,
|
||||||
|
@ -758,10 +758,10 @@ describe('Archiving', function () {
|
||||||
'Roses are \u001b[0;31mred\u001b[0m, violets are \u001b[0;34mblue. Hope you enjoy terminal hue',
|
'Roses are \u001b[0;31mred\u001b[0m, violets are \u001b[0;34mblue. Hope you enjoy terminal hue',
|
||||||
'But now...\u001b[20Cfor my greatest trick...\u001b[8m',
|
'But now...\u001b[20Cfor my greatest trick...\u001b[8m',
|
||||||
'The quic\b\b\b\b\b\bk brown fo\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007x... [Beeeep]',
|
'The quic\b\b\b\b\b\bk brown fo\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007\u0007x... [Beeeep]',
|
||||||
'Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗'
|
'Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗',
|
||||||
],
|
],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 2
|
version: 2,
|
||||||
}
|
}
|
||||||
return DocstoreClient.createDoc(
|
return DocstoreClient.createDoc(
|
||||||
this.project_id,
|
this.project_id,
|
||||||
|
@ -857,17 +857,17 @@ describe('Archiving', function () {
|
||||||
op: { i: 'foo', p: 24 },
|
op: { i: 'foo', p: 24 },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id: ObjectId(),
|
user_id: ObjectId(),
|
||||||
ts: new Date('2017-01-27T16:10:44.194Z')
|
ts: new Date('2017-01-27T16:10:44.194Z'),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: ObjectId(),
|
id: ObjectId(),
|
||||||
op: { d: 'bar', p: 50 },
|
op: { d: 'bar', p: 50 },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id: ObjectId(),
|
user_id: ObjectId(),
|
||||||
ts: new Date('2017-01-27T18:10:44.194Z')
|
ts: new Date('2017-01-27T18:10:44.194Z'),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
|
@ -875,12 +875,12 @@ describe('Archiving', function () {
|
||||||
op: { c: 'comment', p: 284, t: ObjectId() },
|
op: { c: 'comment', p: 284, t: ObjectId() },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id: ObjectId(),
|
user_id: ObjectId(),
|
||||||
ts: new Date('2017-01-26T14:22:04.869Z')
|
ts: new Date('2017-01-26T14:22:04.869Z'),
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
version: 2
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
version: 2,
|
||||||
}
|
}
|
||||||
return DocstoreClient.createDoc(
|
return DocstoreClient.createDoc(
|
||||||
this.project_id,
|
this.project_id,
|
||||||
|
@ -971,7 +971,7 @@ describe('Archiving', function () {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['abc', 'def', 'ghi'],
|
lines: ['abc', 'def', 'ghi'],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 2
|
version: 2,
|
||||||
}
|
}
|
||||||
return DocstoreClient.createDoc(
|
return DocstoreClient.createDoc(
|
||||||
this.project_id,
|
this.project_id,
|
||||||
|
@ -1067,7 +1067,7 @@ describe('Archiving', function () {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['abc', 'def', 'ghi'],
|
lines: ['abc', 'def', 'ghi'],
|
||||||
ranges: {},
|
ranges: {},
|
||||||
version: 2
|
version: 2,
|
||||||
}
|
}
|
||||||
uploadContent(
|
uploadContent(
|
||||||
`${this.project_id}/${this.doc._id}`,
|
`${this.project_id}/${this.doc._id}`,
|
||||||
|
@ -1079,7 +1079,7 @@ describe('Archiving', function () {
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
_id: this.doc._id,
|
_id: this.doc._id,
|
||||||
rev: this.doc.version,
|
rev: this.doc.version,
|
||||||
inS3: true
|
inS3: true,
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
|
|
|
@ -28,26 +28,26 @@ describe('Getting all docs', function () {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['one', 'two', 'three'],
|
lines: ['one', 'two', 'three'],
|
||||||
ranges: { mock: 'one' },
|
ranges: { mock: 'one' },
|
||||||
rev: 2
|
rev: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['aaa', 'bbb', 'ccc'],
|
lines: ['aaa', 'bbb', 'ccc'],
|
||||||
ranges: { mock: 'two' },
|
ranges: { mock: 'two' },
|
||||||
rev: 4
|
rev: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['111', '222', '333'],
|
lines: ['111', '222', '333'],
|
||||||
ranges: { mock: 'three' },
|
ranges: { mock: 'three' },
|
||||||
rev: 6
|
rev: 6,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
this.deleted_doc = {
|
this.deleted_doc = {
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['deleted'],
|
lines: ['deleted'],
|
||||||
ranges: { mock: 'four' },
|
ranges: { mock: 'four' },
|
||||||
rev: 8
|
rev: 8,
|
||||||
}
|
}
|
||||||
const version = 42
|
const version = 42
|
||||||
const jobs = Array.from(this.docs).map((doc) =>
|
const jobs = Array.from(this.docs).map((doc) =>
|
||||||
|
|
|
@ -32,10 +32,10 @@ describe('Getting a doc', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
meta: {
|
meta: {
|
||||||
user_id: ObjectId().toString(),
|
user_id: ObjectId().toString(),
|
||||||
ts: new Date().toString()
|
ts: new Date().toString(),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
return DocstoreApp.ensureRunning(() => {
|
return DocstoreApp.ensureRunning(() => {
|
||||||
return DocstoreClient.createDoc(
|
return DocstoreClient.createDoc(
|
||||||
|
|
|
@ -31,10 +31,10 @@ describe('Applying updates to a doc', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
meta: {
|
meta: {
|
||||||
user_id: ObjectId().toString(),
|
user_id: ObjectId().toString(),
|
||||||
ts: new Date().toString()
|
ts: new Date().toString(),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
this.newRanges = {
|
this.newRanges = {
|
||||||
changes: [
|
changes: [
|
||||||
|
@ -43,10 +43,10 @@ describe('Applying updates to a doc', function () {
|
||||||
op: { i: 'bar', p: 6 },
|
op: { i: 'bar', p: 6 },
|
||||||
meta: {
|
meta: {
|
||||||
user_id: ObjectId().toString(),
|
user_id: ObjectId().toString(),
|
||||||
ts: new Date().toString()
|
ts: new Date().toString(),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
this.version = 42
|
this.version = 42
|
||||||
return DocstoreApp.ensureRunning(() => {
|
return DocstoreApp.ensureRunning(() => {
|
||||||
|
|
|
@ -48,5 +48,5 @@ module.exports = {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ module.exports = DocstoreClient = {
|
||||||
{
|
{
|
||||||
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/doc/${doc_id}`,
|
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/doc/${doc_id}`,
|
||||||
json: true,
|
json: true,
|
||||||
qs
|
qs,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -67,7 +67,7 @@ module.exports = DocstoreClient = {
|
||||||
return request.get(
|
return request.get(
|
||||||
{
|
{
|
||||||
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/doc`,
|
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/doc`,
|
||||||
json: true
|
json: true,
|
||||||
},
|
},
|
||||||
(req, res, body) => {
|
(req, res, body) => {
|
||||||
callback(req, res, body)
|
callback(req, res, body)
|
||||||
|
@ -82,7 +82,7 @@ module.exports = DocstoreClient = {
|
||||||
return request.get(
|
return request.get(
|
||||||
{
|
{
|
||||||
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/ranges`,
|
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/ranges`,
|
||||||
json: true
|
json: true,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -98,8 +98,8 @@ module.exports = DocstoreClient = {
|
||||||
json: {
|
json: {
|
||||||
lines,
|
lines,
|
||||||
version,
|
version,
|
||||||
ranges
|
ranges,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -111,7 +111,7 @@ module.exports = DocstoreClient = {
|
||||||
}
|
}
|
||||||
return request.del(
|
return request.del(
|
||||||
{
|
{
|
||||||
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/doc/${doc_id}`
|
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/doc/${doc_id}`,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -123,7 +123,7 @@ module.exports = DocstoreClient = {
|
||||||
}
|
}
|
||||||
return request.post(
|
return request.post(
|
||||||
{
|
{
|
||||||
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/archive`
|
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/archive`,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -135,7 +135,7 @@ module.exports = DocstoreClient = {
|
||||||
}
|
}
|
||||||
return request.post(
|
return request.post(
|
||||||
{
|
{
|
||||||
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/destroy`
|
url: `http://localhost:${settings.internal.docstore.port}/project/${project_id}/destroy`,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -151,5 +151,5 @@ module.exports = DocstoreClient = {
|
||||||
callback(null, JSON.parse(data))
|
callback(null, JSON.parse(data))
|
||||||
})
|
})
|
||||||
.catch(callback)
|
.catch(callback)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,24 +32,24 @@ describe('DocArchiveManager', function () {
|
||||||
md5Sum = 'decafbad'
|
md5Sum = 'decafbad'
|
||||||
|
|
||||||
RangeManager = {
|
RangeManager = {
|
||||||
jsonRangesToMongo: sinon.stub().returns({ mongo: 'ranges' })
|
jsonRangesToMongo: sinon.stub().returns({ mongo: 'ranges' }),
|
||||||
}
|
}
|
||||||
Settings = {
|
Settings = {
|
||||||
docstore: {
|
docstore: {
|
||||||
bucket: 'wombat'
|
bucket: 'wombat',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
Logger = {
|
Logger = {
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
err: sinon.stub()
|
err: sinon.stub(),
|
||||||
}
|
}
|
||||||
HashDigest = sinon.stub().returns(md5Sum)
|
HashDigest = sinon.stub().returns(md5Sum)
|
||||||
HashUpdate = sinon.stub().returns({ digest: HashDigest })
|
HashUpdate = sinon.stub().returns({ digest: HashDigest })
|
||||||
Crypto = {
|
Crypto = {
|
||||||
createHash: sinon.stub().returns({ update: HashUpdate })
|
createHash: sinon.stub().returns({ update: HashUpdate }),
|
||||||
}
|
}
|
||||||
Streamifier = {
|
Streamifier = {
|
||||||
createReadStream: sinon.stub().returns({ stream: 'readStream' })
|
createReadStream: sinon.stub().returns({ stream: 'readStream' }),
|
||||||
}
|
}
|
||||||
|
|
||||||
projectId = ObjectId()
|
projectId = ObjectId()
|
||||||
|
@ -57,69 +57,69 @@ describe('DocArchiveManager', function () {
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
inS3: true,
|
inS3: true,
|
||||||
rev: 2
|
rev: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
inS3: true,
|
inS3: true,
|
||||||
rev: 4
|
rev: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
inS3: true,
|
inS3: true,
|
||||||
rev: 6
|
rev: 6,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
mongoDocs = [
|
mongoDocs = [
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['one', 'two', 'three'],
|
lines: ['one', 'two', 'three'],
|
||||||
rev: 2
|
rev: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['aaa', 'bbb', 'ccc'],
|
lines: ['aaa', 'bbb', 'ccc'],
|
||||||
rev: 4
|
rev: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
inS3: true,
|
inS3: true,
|
||||||
rev: 6
|
rev: 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
inS3: true,
|
inS3: true,
|
||||||
rev: 6
|
rev: 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['111', '222', '333'],
|
lines: ['111', '222', '333'],
|
||||||
rev: 6
|
rev: 6,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
docJson = JSON.stringify({
|
docJson = JSON.stringify({
|
||||||
lines: mongoDocs[0].lines,
|
lines: mongoDocs[0].lines,
|
||||||
ranges: mongoDocs[0].ranges,
|
ranges: mongoDocs[0].ranges,
|
||||||
schema_v: 1
|
schema_v: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
stream = {
|
stream = {
|
||||||
on: sinon.stub(),
|
on: sinon.stub(),
|
||||||
resume: sinon.stub()
|
resume: sinon.stub(),
|
||||||
}
|
}
|
||||||
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
||||||
stream.on.withArgs('end').yields()
|
stream.on.withArgs('end').yields()
|
||||||
|
|
||||||
readStream = {
|
readStream = {
|
||||||
stream: 'readStream'
|
stream: 'readStream',
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistorManager = {
|
PersistorManager = {
|
||||||
getObjectStream: sinon.stub().resolves(stream),
|
getObjectStream: sinon.stub().resolves(stream),
|
||||||
sendStream: sinon.stub().resolves(),
|
sendStream: sinon.stub().resolves(),
|
||||||
getObjectMd5Hash: sinon.stub().resolves(md5Sum),
|
getObjectMd5Hash: sinon.stub().resolves(md5Sum),
|
||||||
deleteObject: sinon.stub().resolves()
|
deleteObject: sinon.stub().resolves(),
|
||||||
}
|
}
|
||||||
|
|
||||||
MongoManager = {
|
MongoManager = {
|
||||||
|
@ -129,8 +129,8 @@ describe('DocArchiveManager', function () {
|
||||||
getProjectsDocs: sinon.stub().resolves(mongoDocs),
|
getProjectsDocs: sinon.stub().resolves(mongoDocs),
|
||||||
getArchivedProjectDocs: sinon.stub().resolves(archivedDocs),
|
getArchivedProjectDocs: sinon.stub().resolves(archivedDocs),
|
||||||
findDoc: sinon.stub().resolves(),
|
findDoc: sinon.stub().resolves(),
|
||||||
destroyDoc: sinon.stub().resolves()
|
destroyDoc: sinon.stub().resolves(),
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
for (const mongoDoc of mongoDocs) {
|
for (const mongoDoc of mongoDocs) {
|
||||||
MongoManager.promises.findDoc
|
MongoManager.promises.findDoc
|
||||||
|
@ -147,12 +147,12 @@ describe('DocArchiveManager', function () {
|
||||||
'./MongoManager': MongoManager,
|
'./MongoManager': MongoManager,
|
||||||
'./RangeManager': RangeManager,
|
'./RangeManager': RangeManager,
|
||||||
'./PersistorManager': PersistorManager,
|
'./PersistorManager': PersistorManager,
|
||||||
'./Errors': Errors
|
'./Errors': Errors,
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
console,
|
console,
|
||||||
JSON
|
JSON,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ describe('DocArchiveManager', function () {
|
||||||
const json = JSON.stringify({
|
const json = JSON.stringify({
|
||||||
lines: mongoDocs[0].lines,
|
lines: mongoDocs[0].lines,
|
||||||
ranges: mongoDocs[0].ranges,
|
ranges: mongoDocs[0].ranges,
|
||||||
schema_v: 1
|
schema_v: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
await DocArchiveManager.promises.archiveDoc(projectId, mongoDocs[0])
|
await DocArchiveManager.promises.archiveDoc(projectId, mongoDocs[0])
|
||||||
|
@ -290,7 +290,7 @@ describe('DocArchiveManager', function () {
|
||||||
describe('when the doc has the old schema', function () {
|
describe('when the doc has the old schema', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mongoDoc = {
|
mongoDoc = {
|
||||||
lines: ['doc', 'lines']
|
lines: ['doc', 'lines'],
|
||||||
}
|
}
|
||||||
s3Doc = ['doc', 'lines']
|
s3Doc = ['doc', 'lines']
|
||||||
docJson = JSON.stringify(s3Doc)
|
docJson = JSON.stringify(s3Doc)
|
||||||
|
@ -310,11 +310,11 @@ describe('DocArchiveManager', function () {
|
||||||
s3Doc = {
|
s3Doc = {
|
||||||
lines: ['doc', 'lines'],
|
lines: ['doc', 'lines'],
|
||||||
ranges: { json: 'ranges' },
|
ranges: { json: 'ranges' },
|
||||||
schema_v: 1
|
schema_v: 1,
|
||||||
}
|
}
|
||||||
mongoDoc = {
|
mongoDoc = {
|
||||||
lines: ['doc', 'lines'],
|
lines: ['doc', 'lines'],
|
||||||
ranges: { mongo: 'ranges' }
|
ranges: { mongo: 'ranges' },
|
||||||
}
|
}
|
||||||
docJson = JSON.stringify(s3Doc)
|
docJson = JSON.stringify(s3Doc)
|
||||||
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
||||||
|
@ -332,10 +332,10 @@ describe('DocArchiveManager', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
s3Doc = {
|
s3Doc = {
|
||||||
lines: ['doc', 'lines'],
|
lines: ['doc', 'lines'],
|
||||||
schema_v: 1
|
schema_v: 1,
|
||||||
}
|
}
|
||||||
mongoDoc = {
|
mongoDoc = {
|
||||||
lines: ['doc', 'lines']
|
lines: ['doc', 'lines'],
|
||||||
}
|
}
|
||||||
docJson = JSON.stringify(s3Doc)
|
docJson = JSON.stringify(s3Doc)
|
||||||
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
||||||
|
@ -353,7 +353,7 @@ describe('DocArchiveManager', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
s3Doc = {
|
s3Doc = {
|
||||||
lines: ['doc', 'lines'],
|
lines: ['doc', 'lines'],
|
||||||
schema_v: 2
|
schema_v: 2,
|
||||||
}
|
}
|
||||||
docJson = JSON.stringify(s3Doc)
|
docJson = JSON.stringify(s3Doc)
|
||||||
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
stream.on.withArgs('data').yields(Buffer.from(docJson, 'utf8'))
|
||||||
|
|
|
@ -32,15 +32,15 @@ describe('DocManager', function () {
|
||||||
jsonRangesToMongo(r) {
|
jsonRangesToMongo(r) {
|
||||||
return r
|
return r
|
||||||
},
|
},
|
||||||
shouldUpdateRanges: sinon.stub().returns(false)
|
shouldUpdateRanges: sinon.stub().returns(false),
|
||||||
}),
|
}),
|
||||||
'logger-sharelatex': (this.logger = {
|
'logger-sharelatex': (this.logger = {
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
warn() {},
|
warn() {},
|
||||||
err() {}
|
err() {},
|
||||||
}),
|
}),
|
||||||
'./Errors': Errors
|
'./Errors': Errors,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
this.doc_id = ObjectId().toString()
|
this.doc_id = ObjectId().toString()
|
||||||
this.project_id = ObjectId().toString()
|
this.project_id = ObjectId().toString()
|
||||||
|
@ -99,7 +99,7 @@ describe('DocManager', function () {
|
||||||
this.DocManager._getDoc = sinon.stub()
|
this.DocManager._getDoc = sinon.stub()
|
||||||
return (this.doc = {
|
return (this.doc = {
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
lines: ['2134']
|
lines: ['2134'],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ describe('DocManager', function () {
|
||||||
deleted: true,
|
deleted: true,
|
||||||
version: true,
|
version: true,
|
||||||
ranges: true,
|
ranges: true,
|
||||||
inS3: true
|
inS3: true,
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
return done()
|
return done()
|
||||||
|
@ -154,7 +154,7 @@ describe('DocManager', function () {
|
||||||
this.DocManager._getDoc
|
this.DocManager._getDoc
|
||||||
.calledWith(this.project_id, this.doc_id, {
|
.calledWith(this.project_id, this.doc_id, {
|
||||||
lines: true,
|
lines: true,
|
||||||
inS3: true
|
inS3: true,
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
return done()
|
return done()
|
||||||
|
@ -181,7 +181,7 @@ describe('DocManager', function () {
|
||||||
this.doc = {
|
this.doc = {
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
lines: ['mock-lines']
|
lines: ['mock-lines'],
|
||||||
}
|
}
|
||||||
this.version = 42
|
this.version = 42
|
||||||
this.MongoManager.findDoc = sinon.stub()
|
this.MongoManager.findDoc = sinon.stub()
|
||||||
|
@ -302,7 +302,7 @@ describe('DocManager', function () {
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
lines: ['mock-lines'],
|
lines: ['mock-lines'],
|
||||||
inS3: true
|
inS3: true,
|
||||||
}
|
}
|
||||||
this.MongoManager.findDoc.yields(null, this.doc)
|
this.MongoManager.findDoc.yields(null, this.doc)
|
||||||
this.DocArchiveManager.unarchiveDoc = (
|
this.DocArchiveManager.unarchiveDoc = (
|
||||||
|
@ -368,8 +368,8 @@ describe('DocManager', function () {
|
||||||
{
|
{
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
lines: ['mock-lines']
|
lines: ['mock-lines'],
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
this.MongoManager.getProjectsDocs = sinon
|
this.MongoManager.getProjectsDocs = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -490,10 +490,10 @@ describe('DocManager', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
meta: {
|
meta: {
|
||||||
user_id: ObjectId().toString(),
|
user_id: ObjectId().toString(),
|
||||||
ts: new Date().toString()
|
ts: new Date().toString(),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
this.newRanges = {
|
this.newRanges = {
|
||||||
changes: [
|
changes: [
|
||||||
|
@ -502,10 +502,10 @@ describe('DocManager', function () {
|
||||||
op: { i: 'bar', p: 6 },
|
op: { i: 'bar', p: 6 },
|
||||||
meta: {
|
meta: {
|
||||||
user_id: ObjectId().toString(),
|
user_id: ObjectId().toString(),
|
||||||
ts: new Date().toString()
|
ts: new Date().toString(),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
this.version = 42
|
this.version = 42
|
||||||
this.doc = {
|
this.doc = {
|
||||||
|
@ -514,7 +514,7 @@ describe('DocManager', function () {
|
||||||
lines: this.oldDocLines,
|
lines: this.oldDocLines,
|
||||||
rev: (this.rev = 5),
|
rev: (this.rev = 5),
|
||||||
version: this.version,
|
version: this.version,
|
||||||
ranges: this.originalRanges
|
ranges: this.originalRanges,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.MongoManager.upsertIntoDocCollection = sinon.stub().callsArg(3)
|
this.MongoManager.upsertIntoDocCollection = sinon.stub().callsArg(3)
|
||||||
|
@ -543,7 +543,7 @@ describe('DocManager', function () {
|
||||||
lines: true,
|
lines: true,
|
||||||
version: true,
|
version: true,
|
||||||
ranges: true,
|
ranges: true,
|
||||||
inS3: true
|
inS3: true,
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -789,7 +789,7 @@ describe('DocManager', function () {
|
||||||
return this.MongoManager.upsertIntoDocCollection
|
return this.MongoManager.upsertIntoDocCollection
|
||||||
.calledWith(this.project_id, this.doc_id, {
|
.calledWith(this.project_id, this.doc_id, {
|
||||||
lines: this.newDocLines,
|
lines: this.newDocLines,
|
||||||
ranges: this.originalRanges
|
ranges: this.originalRanges,
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,17 +29,17 @@ describe('HttpController', function () {
|
||||||
'./DocArchiveManager': (this.DocArchiveManager = {}),
|
'./DocArchiveManager': (this.DocArchiveManager = {}),
|
||||||
'logger-sharelatex': (this.logger = {
|
'logger-sharelatex': (this.logger = {
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
error: sinon.stub()
|
error: sinon.stub(),
|
||||||
}),
|
}),
|
||||||
'./HealthChecker': {}
|
'./HealthChecker': {},
|
||||||
},
|
},
|
||||||
globals: { process }
|
globals: { process },
|
||||||
})
|
})
|
||||||
this.res = {
|
this.res = {
|
||||||
send: sinon.stub(),
|
send: sinon.stub(),
|
||||||
sendStatus: sinon.stub(),
|
sendStatus: sinon.stub(),
|
||||||
json: sinon.stub(),
|
json: sinon.stub(),
|
||||||
setHeader: sinon.stub()
|
setHeader: sinon.stub(),
|
||||||
}
|
}
|
||||||
this.res.status = sinon.stub().returns(this.res)
|
this.res.status = sinon.stub().returns(this.res)
|
||||||
this.req = { query: {} }
|
this.req = { query: {} }
|
||||||
|
@ -50,14 +50,14 @@ describe('HttpController', function () {
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
lines: ['mock', 'lines', ' here', '', '', ' spaces '],
|
lines: ['mock', 'lines', ' here', '', '', ' spaces '],
|
||||||
version: 42,
|
version: 42,
|
||||||
rev: 5
|
rev: 5,
|
||||||
}
|
}
|
||||||
return (this.deletedDoc = {
|
return (this.deletedDoc = {
|
||||||
deleted: true,
|
deleted: true,
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
lines: ['mock', 'lines', ' here', '', '', ' spaces '],
|
lines: ['mock', 'lines', ' here', '', '', ' spaces '],
|
||||||
version: 42,
|
version: 42,
|
||||||
rev: 5
|
rev: 5,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ describe('HttpController', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.req.params = {
|
this.req.params = {
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
doc_id: this.doc_id
|
doc_id: this.doc_id,
|
||||||
}
|
}
|
||||||
this.DocManager.getFullDoc = sinon
|
this.DocManager.getFullDoc = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -86,7 +86,7 @@ describe('HttpController', function () {
|
||||||
_id: this.doc_id,
|
_id: this.doc_id,
|
||||||
lines: this.doc.lines,
|
lines: this.doc.lines,
|
||||||
rev: this.doc.rev,
|
rev: this.doc.rev,
|
||||||
version: this.doc.version
|
version: this.doc.version,
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -96,7 +96,7 @@ describe('HttpController', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.req.params = {
|
this.req.params = {
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
doc_id: this.doc_id
|
doc_id: this.doc_id,
|
||||||
}
|
}
|
||||||
return (this.DocManager.getFullDoc = sinon
|
return (this.DocManager.getFullDoc = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -124,7 +124,7 @@ describe('HttpController', function () {
|
||||||
lines: this.doc.lines,
|
lines: this.doc.lines,
|
||||||
rev: this.doc.rev,
|
rev: this.doc.rev,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
version: this.doc.version
|
version: this.doc.version,
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -135,7 +135,7 @@ describe('HttpController', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.req.params = {
|
this.req.params = {
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
doc_id: this.doc_id
|
doc_id: this.doc_id,
|
||||||
}
|
}
|
||||||
this.DocManager.getDocLines = sinon.stub().callsArgWith(2, null, this.doc)
|
this.DocManager.getDocLines = sinon.stub().callsArgWith(2, null, this.doc)
|
||||||
return this.HttpController.getRawDoc(this.req, this.res, this.next)
|
return this.HttpController.getRawDoc(this.req, this.res, this.next)
|
||||||
|
@ -169,13 +169,13 @@ describe('HttpController', function () {
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['mock', 'lines', 'one'],
|
lines: ['mock', 'lines', 'one'],
|
||||||
rev: 2
|
rev: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['mock', 'lines', 'two'],
|
lines: ['mock', 'lines', 'two'],
|
||||||
rev: 4
|
rev: 4,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
this.DocManager.getAllNonDeletedDocs = sinon
|
this.DocManager.getAllNonDeletedDocs = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -195,13 +195,13 @@ describe('HttpController', function () {
|
||||||
{
|
{
|
||||||
_id: this.docs[0]._id.toString(),
|
_id: this.docs[0]._id.toString(),
|
||||||
lines: this.docs[0].lines,
|
lines: this.docs[0].lines,
|
||||||
rev: this.docs[0].rev
|
rev: this.docs[0].rev,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: this.docs[1]._id.toString(),
|
_id: this.docs[1]._id.toString(),
|
||||||
lines: this.docs[1].lines,
|
lines: this.docs[1].lines,
|
||||||
rev: this.docs[1].rev
|
rev: this.docs[1].rev,
|
||||||
}
|
},
|
||||||
])
|
])
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -214,14 +214,14 @@ describe('HttpController', function () {
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['mock', 'lines', 'one'],
|
lines: ['mock', 'lines', 'one'],
|
||||||
rev: 2
|
rev: 2,
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
lines: ['mock', 'lines', 'two'],
|
lines: ['mock', 'lines', 'two'],
|
||||||
rev: 4
|
rev: 4,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
this.DocManager.getAllNonDeletedDocs = sinon
|
this.DocManager.getAllNonDeletedDocs = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -235,13 +235,13 @@ describe('HttpController', function () {
|
||||||
{
|
{
|
||||||
_id: this.docs[0]._id.toString(),
|
_id: this.docs[0]._id.toString(),
|
||||||
lines: this.docs[0].lines,
|
lines: this.docs[0].lines,
|
||||||
rev: this.docs[0].rev
|
rev: this.docs[0].rev,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: this.docs[2]._id.toString(),
|
_id: this.docs[2]._id.toString(),
|
||||||
lines: this.docs[2].lines,
|
lines: this.docs[2].lines,
|
||||||
rev: this.docs[2].rev
|
rev: this.docs[2].rev,
|
||||||
}
|
},
|
||||||
])
|
])
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -251,7 +251,7 @@ describe('HttpController', function () {
|
||||||
.calledWith(
|
.calledWith(
|
||||||
{
|
{
|
||||||
err: sinon.match.has('message', 'null doc'),
|
err: sinon.match.has('message', 'null doc'),
|
||||||
project_id: this.project_id
|
project_id: this.project_id,
|
||||||
},
|
},
|
||||||
'encountered null doc'
|
'encountered null doc'
|
||||||
)
|
)
|
||||||
|
@ -267,12 +267,12 @@ describe('HttpController', function () {
|
||||||
this.docs = [
|
this.docs = [
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
ranges: { mock_ranges: 'one' }
|
ranges: { mock_ranges: 'one' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: ObjectId(),
|
_id: ObjectId(),
|
||||||
ranges: { mock_ranges: 'two' }
|
ranges: { mock_ranges: 'two' },
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
this.DocManager.getAllNonDeletedDocs = sinon
|
this.DocManager.getAllNonDeletedDocs = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -291,12 +291,12 @@ describe('HttpController', function () {
|
||||||
.calledWith([
|
.calledWith([
|
||||||
{
|
{
|
||||||
_id: this.docs[0]._id.toString(),
|
_id: this.docs[0]._id.toString(),
|
||||||
ranges: this.docs[0].ranges
|
ranges: this.docs[0].ranges,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: this.docs[1]._id.toString(),
|
_id: this.docs[1]._id.toString(),
|
||||||
ranges: this.docs[1].ranges
|
ranges: this.docs[1].ranges,
|
||||||
}
|
},
|
||||||
])
|
])
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -307,7 +307,7 @@ describe('HttpController', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return (this.req.params = {
|
return (this.req.params = {
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
doc_id: this.doc_id
|
doc_id: this.doc_id,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ describe('HttpController', function () {
|
||||||
this.req.body = {
|
this.req.body = {
|
||||||
lines: (this.lines = ['hello', 'world']),
|
lines: (this.lines = ['hello', 'world']),
|
||||||
version: (this.version = 42),
|
version: (this.version = 42),
|
||||||
ranges: (this.ranges = { changes: 'mock' })
|
ranges: (this.ranges = { changes: 'mock' }),
|
||||||
}
|
}
|
||||||
this.DocManager.updateDoc = sinon
|
this.DocManager.updateDoc = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -348,7 +348,7 @@ describe('HttpController', function () {
|
||||||
this.req.body = {
|
this.req.body = {
|
||||||
lines: (this.lines = ['hello', 'world']),
|
lines: (this.lines = ['hello', 'world']),
|
||||||
version: (this.version = 42),
|
version: (this.version = 42),
|
||||||
ranges: {}
|
ranges: {},
|
||||||
}
|
}
|
||||||
this.DocManager.updateDoc = sinon
|
this.DocManager.updateDoc = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -416,7 +416,7 @@ describe('HttpController', function () {
|
||||||
this.req.body = {
|
this.req.body = {
|
||||||
lines: (this.lines = Array(2049).fill('a'.repeat(1024))),
|
lines: (this.lines = Array(2049).fill('a'.repeat(1024))),
|
||||||
version: (this.version = 42),
|
version: (this.version = 42),
|
||||||
ranges: (this.ranges = { changes: 'mock' })
|
ranges: (this.ranges = { changes: 'mock' }),
|
||||||
}
|
}
|
||||||
return this.HttpController.updateDoc(this.req, this.res, this.next)
|
return this.HttpController.updateDoc(this.req, this.res, this.next)
|
||||||
})
|
})
|
||||||
|
@ -435,7 +435,7 @@ describe('HttpController', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.req.params = {
|
this.req.params = {
|
||||||
project_id: this.project_id,
|
project_id: this.project_id,
|
||||||
doc_id: this.doc_id
|
doc_id: this.doc_id,
|
||||||
}
|
}
|
||||||
this.DocManager.deleteDoc = sinon.stub().callsArg(2)
|
this.DocManager.deleteDoc = sinon.stub().callsArg(2)
|
||||||
return this.HttpController.deleteDoc(this.req, this.res, this.next)
|
return this.HttpController.deleteDoc(this.req, this.res, this.next)
|
||||||
|
|
|
@ -25,14 +25,14 @@ describe('MongoManager', function () {
|
||||||
requires: {
|
requires: {
|
||||||
'./mongojs': {
|
'./mongojs': {
|
||||||
db: (this.db = { docs: {}, docOps: {} }),
|
db: (this.db = { docs: {}, docOps: {} }),
|
||||||
ObjectId
|
ObjectId,
|
||||||
},
|
},
|
||||||
'metrics-sharelatex': { timeAsyncMethod: sinon.stub() },
|
'metrics-sharelatex': { timeAsyncMethod: sinon.stub() },
|
||||||
'logger-sharelatex': { log() {} }
|
'logger-sharelatex': { log() {} },
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
console
|
console,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
this.project_id = ObjectId().toString()
|
this.project_id = ObjectId().toString()
|
||||||
this.doc_id = ObjectId().toString()
|
this.doc_id = ObjectId().toString()
|
||||||
|
@ -58,7 +58,7 @@ describe('MongoManager', function () {
|
||||||
.calledWith(
|
.calledWith(
|
||||||
{
|
{
|
||||||
_id: ObjectId(this.doc_id),
|
_id: ObjectId(this.doc_id),
|
||||||
project_id: ObjectId(this.project_id)
|
project_id: ObjectId(this.project_id),
|
||||||
},
|
},
|
||||||
this.filter
|
this.filter
|
||||||
)
|
)
|
||||||
|
@ -97,7 +97,7 @@ describe('MongoManager', function () {
|
||||||
.calledWith(
|
.calledWith(
|
||||||
{
|
{
|
||||||
project_id: ObjectId(this.project_id),
|
project_id: ObjectId(this.project_id),
|
||||||
deleted: { $ne: true }
|
deleted: { $ne: true },
|
||||||
},
|
},
|
||||||
this.filter
|
this.filter
|
||||||
)
|
)
|
||||||
|
@ -125,7 +125,7 @@ describe('MongoManager', function () {
|
||||||
return this.db.docs.find
|
return this.db.docs.find
|
||||||
.calledWith(
|
.calledWith(
|
||||||
{
|
{
|
||||||
project_id: ObjectId(this.project_id)
|
project_id: ObjectId(this.project_id),
|
||||||
},
|
},
|
||||||
this.filter
|
this.filter
|
||||||
)
|
)
|
||||||
|
@ -189,7 +189,7 @@ describe('MongoManager', function () {
|
||||||
const args = this.db.docs.update.args[0]
|
const args = this.db.docs.update.args[0]
|
||||||
assert.deepEqual(args[0], {
|
assert.deepEqual(args[0], {
|
||||||
_id: ObjectId(this.doc_id),
|
_id: ObjectId(this.doc_id),
|
||||||
project_id: ObjectId(this.project_id)
|
project_id: ObjectId(this.project_id),
|
||||||
})
|
})
|
||||||
assert.equal(args[1].$set.deleted, true)
|
assert.equal(args[1].$set.deleted, true)
|
||||||
return done()
|
return done()
|
||||||
|
@ -218,13 +218,13 @@ describe('MongoManager', function () {
|
||||||
|
|
||||||
it('should destroy the doc', function () {
|
it('should destroy the doc', function () {
|
||||||
return sinon.assert.calledWith(this.db.docs.remove, {
|
return sinon.assert.calledWith(this.db.docs.remove, {
|
||||||
_id: ObjectId('123456789012')
|
_id: ObjectId('123456789012'),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return it('should destroy the docOps', function () {
|
return it('should destroy the docOps', function () {
|
||||||
return sinon.assert.calledWith(this.db.docOps.remove, {
|
return sinon.assert.calledWith(this.db.docOps.remove, {
|
||||||
doc_id: ObjectId('123456789012')
|
doc_id: ObjectId('123456789012'),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -275,15 +275,15 @@ describe('MongoManager', function () {
|
||||||
return this.db.docOps.update
|
return this.db.docOps.update
|
||||||
.calledWith(
|
.calledWith(
|
||||||
{
|
{
|
||||||
doc_id: ObjectId(this.doc_id)
|
doc_id: ObjectId(this.doc_id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$set: {
|
$set: {
|
||||||
version: this.version
|
version: this.version,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
upsert: true
|
upsert: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
|
|
|
@ -27,9 +27,9 @@ describe('RangeManager', function () {
|
||||||
return (this.RangeManager = SandboxedModule.require(modulePath, {
|
return (this.RangeManager = SandboxedModule.require(modulePath, {
|
||||||
requires: {
|
requires: {
|
||||||
'./mongojs': {
|
'./mongojs': {
|
||||||
ObjectId
|
ObjectId,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -47,16 +47,16 @@ describe('RangeManager', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id,
|
user_id,
|
||||||
ts
|
ts,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
id: comment_id,
|
id: comment_id,
|
||||||
op: { c: 'foo', p: 3, t: thread_id }
|
op: { c: 'foo', p: 3, t: thread_id },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}).should.deep.equal({
|
}).should.deep.equal({
|
||||||
changes: [
|
changes: [
|
||||||
{
|
{
|
||||||
|
@ -64,16 +64,16 @@ describe('RangeManager', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id: ObjectId(user_id),
|
user_id: ObjectId(user_id),
|
||||||
ts: new Date(ts)
|
ts: new Date(ts),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
id: ObjectId(comment_id),
|
id: ObjectId(comment_id),
|
||||||
op: { c: 'foo', p: 3, t: ObjectId(thread_id) }
|
op: { c: 'foo', p: 3, t: ObjectId(thread_id) },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -86,29 +86,29 @@ describe('RangeManager', function () {
|
||||||
{
|
{
|
||||||
id: change_id,
|
id: change_id,
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id
|
user_id,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
id: comment_id
|
id: comment_id,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}).should.deep.equal({
|
}).should.deep.equal({
|
||||||
changes: [
|
changes: [
|
||||||
{
|
{
|
||||||
id: change_id,
|
id: change_id,
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id
|
user_id,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
id: comment_id
|
id: comment_id,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -125,16 +125,16 @@ describe('RangeManager', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id,
|
user_id,
|
||||||
ts
|
ts,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
id: comment_id,
|
id: comment_id,
|
||||||
op: { c: 'foo', p: 3, t: thread_id }
|
op: { c: 'foo', p: 3, t: thread_id },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
const ranges1_copy = JSON.parse(JSON.stringify(ranges1)) // jsonRangesToMongo modifies in place
|
const ranges1_copy = JSON.parse(JSON.stringify(ranges1)) // jsonRangesToMongo modifies in place
|
||||||
const ranges2 = JSON.parse(
|
const ranges2 = JSON.parse(
|
||||||
|
@ -153,16 +153,16 @@ describe('RangeManager', function () {
|
||||||
op: { i: 'foo', p: 3 },
|
op: { i: 'foo', p: 3 },
|
||||||
metadata: {
|
metadata: {
|
||||||
user_id: ObjectId(),
|
user_id: ObjectId(),
|
||||||
ts: new Date()
|
ts: new Date(),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
id: ObjectId(),
|
id: ObjectId(),
|
||||||
op: { c: 'foo', p: 3, t: ObjectId() }
|
op: { c: 'foo', p: 3, t: ObjectId() },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
return (this.ranges_copy = this.RangeManager.jsonRangesToMongo(
|
return (this.ranges_copy = this.RangeManager.jsonRangesToMongo(
|
||||||
JSON.parse(JSON.stringify(this.ranges))
|
JSON.parse(JSON.stringify(this.ranges))
|
||||||
|
|
Loading…
Reference in a new issue