Skip to content

Commit 3bee164

Browse files
committed
wip
1 parent a868341 commit 3bee164

File tree

11 files changed

+68
-62
lines changed

11 files changed

+68
-62
lines changed

meteor/server/systemStatus/systemStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const integrationVersionAllowPrerelease = isPrerelease(PackageInfo.version)
3434
// Any libraries that if a gateway uses should match a certain version
3535
const expectedLibraryVersions: { [libName: string]: string } = {
3636
'superfly-timeline': stripVersion(require('superfly-timeline/package.json').version),
37-
// eslint-disable-next-line node/no-extraneous-require
37+
// eslint-disable-next-line n/no-extraneous-require
3838
'@mos-connection/helper': stripVersion(require('@mos-connection/helper/package.json').version),
3939
}
4040

packages/corelib/src/mongo.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as _ from 'underscore'
22
import { ProtectedString } from './protectedString'
33
import * as objectPath from 'object-path'
4-
// eslint-disable-next-line node/no-extraneous-import
4+
// eslint-disable-next-line n/no-extraneous-import
55
import type { Condition, Filter, UpdateFilter } from 'mongodb'
66
import { clone } from './lib'
77

@@ -31,8 +31,8 @@ export type MongoFieldSpecifierOnesStrict<T extends Record<string, any>> = {
3131
[key in keyof T]?: T[key] extends ProtectedString<any>
3232
? 1
3333
: T[key] extends object | undefined
34-
? MongoFieldSpecifierOnesStrict<T[key]> | 1
35-
: 1
34+
? MongoFieldSpecifierOnesStrict<T[key]> | 1
35+
: 1
3636
}
3737

3838
export interface FindOneOptions<TDoc> {
@@ -154,7 +154,7 @@ export function mongoWhere<T>(o: Record<string, any>, selector: MongoQuery<T>):
154154
}
155155
export function mongoFindOptions<TDoc extends { _id: ProtectedString<any> }>(
156156
docs0: ReadonlyArray<TDoc>,
157-
options?: FindOptions<TDoc>
157+
options?: FindOptions<TDoc>,
158158
): TDoc[] {
159159
let docs = [...docs0] // Shallow clone it
160160
if (options) {
@@ -241,7 +241,7 @@ export function mongoFindOptions<TDoc extends { _id: ProtectedString<any> }>(
241241
export function mongoModify<TDoc extends { _id: ProtectedString<any> }>(
242242
selector: MongoQuery<TDoc>,
243243
doc: TDoc,
244-
modifier: MongoModifier<TDoc>
244+
modifier: MongoModifier<TDoc>,
245245
): TDoc {
246246
let replace = false
247247
for (const [key, value] of Object.entries<any>(modifier)) {
@@ -293,7 +293,7 @@ export function mutatePath<T>(
293293
obj: Record<string, unknown>,
294294
path: string,
295295
substitutions: Record<string, unknown>,
296-
mutator: (parentObj: Record<string, unknown>, key: string) => T
296+
mutator: (parentObj: Record<string, unknown>, key: string) => T,
297297
): void {
298298
if (!path) throw new Error('parameter path missing')
299299

@@ -333,7 +333,7 @@ export function mutatePath<T>(
333333
if (attr === '$') {
334334
if (!_.isArray(o))
335335
throw new Error(
336-
'Object at "' + currentPath + '" is not an array ("' + o + '") (in path "' + path + '")'
336+
'Object at "' + currentPath + '" is not an array ("' + o + '") (in path "' + path + '")',
337337
)
338338

339339
const info = generateWildcardAttrInfo()
@@ -352,7 +352,7 @@ export function mutatePath<T>(
352352
} else {
353353
if (!_.isObject(o[attr]))
354354
throw new Error(
355-
'Object propery "' + attr + '" is not an object ("' + o[attr] + '") (in path "' + path + '")'
355+
'Object propery "' + attr + '" is not an object ("' + o[attr] + '") (in path "' + path + '")',
356356
)
357357
}
358358
o = o[attr]
@@ -389,7 +389,13 @@ export function pushOntoPath<T>(obj: Record<string, unknown>, path: string, valu
389389
} else {
390390
if (!_.isArray(o[lastAttr]))
391391
throw new Error(
392-
'Object propery "' + lastAttr + '" is not an array ("' + o[lastAttr] + '") (in path "' + path + '")'
392+
'Object propery "' +
393+
lastAttr +
394+
'" is not an array ("' +
395+
o[lastAttr] +
396+
'") (in path "' +
397+
path +
398+
'")',
393399
)
394400
}
395401
const arr: any = o[lastAttr]
@@ -410,7 +416,13 @@ export function pullFromPath<T>(obj: Record<string, unknown>, path: string, matc
410416
if (_.has(o, lastAttr)) {
411417
if (!_.isArray(o[lastAttr]))
412418
throw new Error(
413-
'Object propery "' + lastAttr + '" is not an array ("' + o[lastAttr] + '") (in path "' + path + '")'
419+
'Object propery "' +
420+
lastAttr +
421+
'" is not an array ("' +
422+
o[lastAttr] +
423+
'") (in path "' +
424+
path +
425+
'")',
414426
)
415427

416428
return (o[lastAttr] = _.filter(o[lastAttr] as any, (entry: T) => !_.isMatch(entry, matchValue)))
@@ -431,13 +443,13 @@ export function setOntoPath<T>(
431443
obj: Record<string, unknown>,
432444
path: string,
433445
substitutions: Record<string, unknown>,
434-
valueToSet: T
446+
valueToSet: T,
435447
): void {
436448
mutatePath(
437449
obj,
438450
path,
439451
substitutions,
440-
(parentObj: Record<string, unknown>, key: string) => (parentObj[key] = valueToSet)
452+
(parentObj: Record<string, unknown>, key: string) => (parentObj[key] = valueToSet),
441453
)
442454
}
443455
/**

packages/job-worker/scripts/babel-jest.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// eslint-disable-next-line node/no-extraneous-import
1+
// eslint-disable-next-line n/no-extraneous-import
22
import babelJest from 'babel-jest'
33

44
export default babelJest.default.createTransformer({

packages/job-worker/src/__tests__/rundown-updatePartInstanceRanks.test.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
66
import { DBPartInstance } from '@sofie-automation/corelib/dist/dataModel/PartInstance'
77
import { JobContext } from '../jobs'
88
import { BeforePartMapItem } from '../ingest/commit'
9-
// eslint-disable-next-line node/no-extraneous-import
109
import { mock } from 'jest-mock-extended'
1110
import { ICollection } from '../db'
1211
import { IngestModel } from '../ingest/model/IngestModel'
@@ -33,7 +32,7 @@ describe('updatePartInstanceRanks', () => {
3332
function addPartInstance(
3433
partInstances: DBPartInstance[],
3534
part: DBPart,
36-
orphaned?: DBPartInstance['orphaned']
35+
orphaned?: DBPartInstance['orphaned'],
3736
): PartInstanceId {
3837
const id: PartInstanceId = protectString(`${part._id}_instance`)
3938
partInstances.push({
@@ -56,8 +55,8 @@ describe('updatePartInstanceRanks', () => {
5655
{
5756
part: part as any,
5857
},
59-
mockOptions
60-
)
58+
mockOptions,
59+
),
6160
)
6261
return mock<IngestModel>(
6362
{
@@ -67,20 +66,20 @@ describe('updatePartInstanceRanks', () => {
6766
{
6867
parts: partModels.filter((p) => p.part.segmentId === segmentId) as any,
6968
},
70-
mockOptions
69+
mockOptions,
7170
)
7271
},
7372
getAllOrderedParts: () => partModels,
7473
},
75-
mockOptions
74+
mockOptions,
7675
)
7776
}
7877

7978
async function updateRanksForSegment(
8079
context: JobContext,
8180
expectedSegmentId: SegmentId,
8281
parts: DBPart[],
83-
initialRanks: BeforePartMapItem[]
82+
initialRanks: BeforePartMapItem[],
8483
): Promise<void> {
8584
const ingestModel = createFakeIngestModel(parts, expectedSegmentId)
8685

@@ -97,10 +96,10 @@ describe('updatePartInstanceRanks', () => {
9796
{
9897
PartInstances: fakeCollection,
9998
},
100-
mockOptions
99+
mockOptions,
101100
),
102101
},
103-
mockOptions
102+
mockOptions,
104103
)
105104

106105
const expectedQuery = {
@@ -167,7 +166,7 @@ describe('updatePartInstanceRanks', () => {
167166
parts: DBPart[],
168167
expectedOps: AnyBulkWriteOperation<DBPartInstance>[],
169168
id: string,
170-
newRank: number
169+
newRank: number,
171170
): void {
172171
const partId = protectString(id)
173172

@@ -196,7 +195,7 @@ describe('updatePartInstanceRanks', () => {
196195
expectedOps: AnyBulkWriteOperation<DBPartInstance>[],
197196
partInstanceId: PartInstanceId | string,
198197
newRank: number | null,
199-
orphaned: DBPartInstance['orphaned'] | null
198+
orphaned: DBPartInstance['orphaned'] | null,
200199
) {
201200
expectedOps.push({
202201
updateOne: {
@@ -208,20 +207,20 @@ describe('updatePartInstanceRanks', () => {
208207
...(newRank !== null
209208
? {
210209
'part._rank': newRank,
211-
}
210+
}
212211
: ''),
213212
...(orphaned
214213
? {
215214
orphaned: orphaned,
216-
}
215+
}
217216
: ''),
218217
},
219218
...(orphaned === undefined
220219
? {
221220
$unset: {
222221
orphaned: 1,
223222
},
224-
}
223+
}
225224
: ''),
226225
},
227226
},
@@ -253,7 +252,7 @@ describe('updatePartInstanceRanks', () => {
253252
},
254253
segmentId: { $in: [segmentId] },
255254
},
256-
partInstanceFetchOptions
255+
partInstanceFetchOptions,
257256
)
258257
expect(fakeCollection.bulkWrite).toHaveBeenCalledTimes(0)
259258
})
@@ -353,7 +352,7 @@ describe('updatePartInstanceRanks', () => {
353352
addPartInstance(
354353
partInstances,
355354
createMinimalPart(adlibId, 3.5), // after part03
356-
'adlib-part'
355+
'adlib-part',
357356
)
358357

359358
// remove one and offset the others
@@ -469,14 +468,14 @@ describe('updatePartInstanceRanks', () => {
469468
addPartInstance(
470469
partInstances,
471470
createMinimalPart(adlibId0, 2.5), // after part02
472-
'deleted'
471+
'deleted',
473472
)
474473

475474
const adlibId1 = 'adlib1'
476475
addPartInstance(
477476
partInstances,
478477
createMinimalPart(adlibId1, 2.75), // after adlib0
479-
'adlib-part'
478+
'adlib-part',
480479
)
481480

482481
// Ensure the segment is correct before the operation

packages/job-worker/src/ingest/commit/__tests__/updateSegmentIdsForAdlibbedPartInstances.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { PartId, RundownId, SegmentId } from '@sofie-automation/corelib/dist/dat
55
import { protectString } from '@sofie-automation/corelib/dist/protectedString'
66
import { DBPartInstance } from '@sofie-automation/corelib/dist/dataModel/PartInstance'
77
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
8-
// eslint-disable-next-line node/no-extraneous-import
98
import { mock } from 'jest-mock-extended'
109
import { ICollection } from '../../../db'
1110
import { JobContext } from '../../../jobs'
@@ -34,10 +33,10 @@ describe('updateSegmentsForAdlibbedPartInstances', () => {
3433
{
3534
PartInstances: fakeCollection,
3635
},
37-
mockOptions
36+
mockOptions,
3837
),
3938
},
40-
mockOptions
39+
mockOptions,
4140
)
4241

4342
const expectedQuery = {
@@ -65,14 +64,14 @@ describe('updateSegmentsForAdlibbedPartInstances', () => {
6564
{
6665
part: part as any,
6766
},
68-
mockOptions
69-
)
67+
mockOptions,
68+
),
7069
)
7170
const ingestModel = mock<IngestModel>(
7271
{
7372
findPart: (id: PartId) => partModels.find((p) => p.part._id === id),
7473
},
75-
mockOptions
74+
mockOptions,
7675
)
7776
;(ingestModel as any).rundownId = rundownId
7877

@@ -130,7 +129,7 @@ describe('updateSegmentsForAdlibbedPartInstances', () => {
130129
segmentParts.map((part) => ({
131130
id: part._id,
132131
rank: part._rank,
133-
}))
132+
})),
134133
)
135134
}
136135

@@ -141,7 +140,7 @@ describe('updateSegmentsForAdlibbedPartInstances', () => {
141140
segmentId: SegmentId,
142141
partId: string,
143142
rank: number,
144-
orphaned: DBPartInstance['orphaned']
143+
orphaned: DBPartInstance['orphaned'],
145144
): DBPartInstance {
146145
return literal<PartialDeep<DBPartInstance>>({
147146
_id: protectString(`instance_${partId}`),

packages/live-status-gateway/src/topics/__tests__/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { PlaylistTimingType } from '@sofie-automation/blueprints-integration/dist/documents/playlistTiming'
22
import { DBRundownPlaylist } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
33
import { protectString } from '@sofie-automation/shared-lib/dist/lib/protectedString'
4-
// eslint-disable-next-line node/no-extraneous-import
54
import { mock, MockProxy } from 'jest-mock-extended'
65
import { ShowStyleBaseExt } from '../../collections/showStyleBaseHandler'
76
import { Logger } from 'winston'

packages/playout-gateway/src/atemUploader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-process-exit */
2-
// eslint-disable-next-line node/no-extraneous-import
2+
// eslint-disable-next-line n/no-extraneous-import
33
import { Atem } from 'atem-connection'
44
import * as fs from 'fs'
55
import { AtemMediaPoolAsset, AtemMediaPoolType } from 'timeline-state-resolver'
@@ -73,7 +73,7 @@ export class AtemUploadScript {
7373
if (pool.isUsed) {
7474
consoleLog(type + ' is used')
7575
const comparisonName = fileName.substr(
76-
type === AtemMediaPoolType.Still ? -ATEM_MAX_FILENAME_LENGTH : -ATEM_MAX_CLIPNAME_LENGTH
76+
type === AtemMediaPoolType.Still ? -ATEM_MAX_FILENAME_LENGTH : -ATEM_MAX_CLIPNAME_LENGTH,
7777
)
7878
const poolName = 'fileName' in pool ? pool.fileName : pool.name
7979

@@ -150,5 +150,5 @@ singleton.connect(process.argv[2]).then(
150150
consoleLog('All media checked/uploaded, exiting...')
151151
process.exit(0)
152152
},
153-
() => process.exit(-1)
153+
() => process.exit(-1),
154154
)

0 commit comments

Comments
 (0)