Skip to content

Commit 2818664

Browse files
committed
Merge remote-tracking branch 'upstream/release53' into upstream/mos-status-flow-rework
2 parents 7a69dfc + 317020e commit 2818664

File tree

259 files changed

+1056
-1091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+1056
-1091
lines changed

meteor/__mocks__/_setupMocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { setLogLevel } from '../server/logging'
22
import { resetRandomId } from './random'
3-
import { LogLevel } from '../server/lib/tempLib'
3+
import { LogLevel } from '@sofie-automation/meteor-lib/dist/lib'
44
import { SupressLogMessages } from './suppressLogging'
55

66
// This file is run before all tests start.

meteor/__mocks__/defaultCollectionObjects.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { DBStudio } from '@sofie-automation/corelib/dist/dataModel/Studio'
2-
import { clone, unprotectString } from '../server/lib/tempLib'
2+
import { clone } from '@sofie-automation/corelib/dist/lib'
3+
import { unprotectString } from '@sofie-automation/corelib/dist/protectedString'
34
import { DBRundownPlaylist } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
45
import { DBRundown } from '@sofie-automation/corelib/dist/dataModel/Rundown'
56
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
@@ -36,7 +37,6 @@ export function defaultRundownPlaylist(_id: RundownPlaylistId, studioId: StudioI
3637
_id: _id,
3738

3839
externalId: 'MOCK_RUNDOWNPLAYLIST',
39-
organizationId: null,
4040
studioId: studioId,
4141

4242
name: 'Default RundownPlaylist',
@@ -67,8 +67,6 @@ export function defaultRundown(
6767
showStyleBaseId: showStyleBaseId,
6868
showStyleVariantId: showStyleVariantId,
6969

70-
organizationId: null,
71-
7270
playlistId: playlistId,
7371

7472
_id: getRundownId(studioId, externalId),
@@ -101,7 +99,6 @@ export function defaultStudio(_id: StudioId): DBStudio {
10199
_id: _id,
102100

103101
name: 'mockStudio',
104-
organizationId: null,
105102
mappingsWithOverrides: wrapDefaultObject({}),
106103
supportedShowStyleBase: [],
107104
blueprintConfigWithOverrides: wrapDefaultObject({}),

meteor/__mocks__/helpers/database.ts

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,8 @@ import { Blueprint } from '@sofie-automation/corelib/dist/dataModel/Blueprint'
3939
import { ICoreSystem, SYSTEM_ID } from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
4040
import { stripVersion } from '../../server/systemStatus/semverUtils'
4141
import { internalUploadBlueprint } from '../../server/api/blueprints/api'
42-
import {
43-
literal,
44-
protectString,
45-
unprotectString,
46-
getRandomId,
47-
getRandomString,
48-
Complete,
49-
normalizeArray,
50-
} from '../../server/lib/tempLib'
42+
import { literal, getRandomId, getRandomString, Complete, normalizeArray } from '@sofie-automation/corelib/dist/lib'
43+
import { protectString, unprotectString } from '@sofie-automation/corelib/dist/protectedString'
5144
import { DBRundown } from '@sofie-automation/corelib/dist/dataModel/Rundown'
5245
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
5346
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
@@ -69,7 +62,6 @@ import {
6962
import { UIShowStyleBase } from '@sofie-automation/meteor-lib/dist/api/showStyles'
7063
import {
7164
BlueprintId,
72-
OrganizationId,
7365
RundownId,
7466
RundownPlaylistId,
7567
ShowStyleBaseId,
@@ -126,7 +118,6 @@ export async function setupMockPeripheralDevice(
126118
const defaultDevice: PeripheralDevice = {
127119
_id: protectString('mockDevice' + dbI++),
128120
name: 'mockDevice',
129-
organizationId: null,
130121
studioAndConfigId: studio ? { studioId: studio._id, configId: 'test' } : undefined,
131122

132123
category: category,
@@ -259,7 +250,6 @@ export async function setupMockShowStyleBase(
259250
const defaultShowStyleBase: DBShowStyleBase = {
260251
_id: protectString('mockShowStyleBase' + dbI++),
261252
name: 'mockShowStyleBase',
262-
organizationId: null,
263253
outputLayersWithOverrides: wrapDefaultObject(
264254
normalizeArray(
265255
[
@@ -354,10 +344,7 @@ export function packageBlueprint<T extends BlueprintManifestBase>(
354344
})
355345
return `({default: (${code})()})`
356346
}
357-
export async function setupMockStudioBlueprint(
358-
showStyleBaseId: ShowStyleBaseId,
359-
organizationId: OrganizationId | null = null
360-
): Promise<Blueprint> {
347+
export async function setupMockStudioBlueprint(showStyleBaseId: ShowStyleBaseId): Promise<Blueprint> {
361348
const { INTEGRATION_VERSION, TSR_VERSION } = getBlueprintDependencyVersions()
362349

363350
const BLUEPRINT_TYPE = BlueprintManifestType.STUDIO
@@ -401,20 +388,12 @@ export async function setupMockStudioBlueprint(
401388
const blueprintId: BlueprintId = protectString('mockBlueprint' + dbI++)
402389
const blueprintName = 'mockBlueprint'
403390

404-
return internalUploadBlueprint(
405-
blueprintId,
406-
code,
407-
{
408-
blueprintName,
409-
ignoreIdChange: true,
410-
},
411-
organizationId
412-
)
391+
return internalUploadBlueprint(blueprintId, code, {
392+
blueprintName,
393+
ignoreIdChange: true,
394+
})
413395
}
414-
export async function setupMockShowStyleBlueprint(
415-
showStyleVariantId: ShowStyleVariantId,
416-
organizationId?: OrganizationId | null
417-
): Promise<Blueprint> {
396+
export async function setupMockShowStyleBlueprint(showStyleVariantId: ShowStyleVariantId): Promise<Blueprint> {
418397
const { INTEGRATION_VERSION, TSR_VERSION } = getBlueprintDependencyVersions()
419398

420399
const BLUEPRINT_TYPE = BlueprintManifestType.SHOWSTYLE
@@ -540,15 +519,10 @@ export async function setupMockShowStyleBlueprint(
540519
const blueprintId: BlueprintId = protectString('mockBlueprint' + dbI++)
541520
const blueprintName = 'mockBlueprint'
542521

543-
return internalUploadBlueprint(
544-
blueprintId,
545-
code,
546-
{
547-
blueprintName,
548-
ignoreIdChange: true,
549-
},
550-
organizationId
551-
)
522+
return internalUploadBlueprint(blueprintId, code, {
523+
blueprintName,
524+
ignoreIdChange: true,
525+
})
552526
}
553527
export interface DefaultEnvironment {
554528
showStyleBaseId: ShowStyleBaseId
@@ -567,36 +541,31 @@ export interface DefaultEnvironment {
567541

568542
ingestDevice: PeripheralDevice
569543
}
570-
export async function setupDefaultStudioEnvironment(
571-
organizationId: OrganizationId | null = null
572-
): Promise<DefaultEnvironment> {
544+
export async function setupDefaultStudioEnvironment(): Promise<DefaultEnvironment> {
573545
const core = await setupMockCore({})
574546
const systemTriggeredActions = await setupMockTriggeredActions()
575547

576548
const showStyleBaseId: ShowStyleBaseId = getRandomId()
577549
const showStyleVariantId: ShowStyleVariantId = getRandomId()
578550

579-
const studioBlueprint = await setupMockStudioBlueprint(showStyleBaseId, organizationId)
580-
const showStyleBlueprint = await setupMockShowStyleBlueprint(showStyleVariantId, organizationId)
551+
const studioBlueprint = await setupMockStudioBlueprint(showStyleBaseId)
552+
const showStyleBlueprint = await setupMockShowStyleBlueprint(showStyleVariantId)
581553

582554
const showStyleBase = await setupMockShowStyleBase(showStyleBlueprint._id, {
583555
_id: showStyleBaseId,
584-
organizationId: organizationId,
585556
})
586557
const triggeredActions = await setupMockTriggeredActions(showStyleBase._id)
587558
const showStyleVariant = await setupMockShowStyleVariant(showStyleBase._id, { _id: showStyleVariantId })
588559

589560
const studio = await setupMockStudio({
590561
blueprintId: studioBlueprint._id,
591562
supportedShowStyleBase: [showStyleBaseId],
592-
organizationId: organizationId,
593563
})
594564
const ingestDevice = await setupMockPeripheralDevice(
595565
PeripheralDeviceCategory.INGEST,
596566
PeripheralDeviceType.MOS,
597567
PERIPHERAL_SUBTYPE_PROCESS,
598-
studio,
599-
{ organizationId: organizationId }
568+
studio
600569
)
601570
const { worker, workerThreadStatuses } = await setupMockWorker()
602571

@@ -648,7 +617,6 @@ export async function setupDefaultRundown(
648617
const sourceLayerIds = Object.keys(applyAndValidateOverrides(env.showStyleBase.sourceLayersWithOverrides).obj)
649618

650619
const rundown: DBRundown = {
651-
organizationId: null,
652620
studioId: env.studio._id,
653621
showStyleBaseId: env.showStyleBase._id,
654622
showStyleVariantId: env.showStyleVariant._id,

meteor/__mocks__/helpers/lib.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import _ from 'underscore'
2-
import { LogLevel, ProtectedString } from '../../server/lib/tempLib'
2+
import { LogLevel } from '@sofie-automation/meteor-lib/dist/lib'
3+
import { ProtectedString } from '@sofie-automation/corelib/dist/protectedString'
34
import { AsyncOnlyMongoCollection } from '../../server/collections/collection'
45
import { getLogLevel, setLogLevel } from '../../server/logging'
56

meteor/__mocks__/mongo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* eslint-disable @typescript-eslint/only-throw-error */
22
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
33
import _ from 'underscore'
4-
import { literal, ProtectedString, unprotectString, protectString, getRandomString } from '../server/lib/tempLib'
4+
import { literal, getRandomString } from '@sofie-automation/corelib/dist/lib'
5+
import { protectString, unprotectString, ProtectedString } from '@sofie-automation/corelib/dist/protectedString'
56
import { RandomMock } from './random'
67
import { MeteorMock } from './meteor'
78
import { Random } from 'meteor/random'

meteor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@babel/runtime": "^7.26.7",
4141
"@koa/cors": "^5.0.0",
4242
"@koa/router": "^13.1.0",
43-
"@mos-connection/helper": "^4.3.1",
43+
"@mos-connection/helper": "^5.0.0-alpha.0",
4444
"@slack/webhook": "^7.0.4",
4545
"@sofie-automation/blueprints-integration": "portal:../packages/blueprints-integration",
4646
"@sofie-automation/corelib": "portal:../packages/corelib",

meteor/server/__tests__/_testEnvironment.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { RandomMock } from '../../__mocks__/random'
22
import { MongoMock } from '../../__mocks__/mongo'
3-
import { protectString, getRandomString } from '../lib/tempLib'
3+
import { getRandomString } from '@sofie-automation/corelib/dist/lib'
4+
import { protectString } from '@sofie-automation/corelib/dist/protectedString'
45
import { sleep } from '../lib/lib'
56
import {
67
AdLibPieces,

meteor/server/__tests__/api/serviceMessages/serviceMessagesApi.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { readAllMessages, writeMessage } from '../../../api/serviceMessages/serviceMessagesApi'
22
import * as CoreSystemUtil from '../../../coreSystem/collection'
3-
import { protectString } from '../../../lib/tempLib'
3+
import { protectString } from '@sofie-automation/corelib/dist/protectedString'
44
import {
55
Criticality,
66
ExternalServiceMessage,

meteor/server/__tests__/cronjobs.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import '../../__mocks__/_extendJest'
22
import { runAllTimers, waitUntil } from '../../__mocks__/helpers/jest'
33
import { MeteorMock } from '../../__mocks__/meteor'
44
import { logger } from '../logging'
5-
import { getRandomId, getRandomString, literal, protectString } from '../lib/tempLib'
5+
import { getRandomId, getRandomString, literal } from '@sofie-automation/corelib/dist/lib'
6+
import { protectString } from '@sofie-automation/corelib/dist/protectedString'
67
import { SnapshotType } from '@sofie-automation/meteor-lib/dist/collections/Snapshots'
78
import {
89
IBlueprintPieceType,
@@ -423,7 +424,6 @@ describe('cronjobs', () => {
423424
const userAction0 = protectString<UserActionsLogItemId>(getRandomString())
424425
await UserActionsLog.insertAsync({
425426
_id: userAction0,
426-
organizationId: null,
427427
userId: null,
428428
args: '',
429429
clientAddress: '',
@@ -436,7 +436,6 @@ describe('cronjobs', () => {
436436
const userAction1 = protectString<UserActionsLogItemId>(getRandomString())
437437
await UserActionsLog.insertAsync({
438438
_id: userAction1,
439-
organizationId: null,
440439
userId: null,
441440
args: '',
442441
clientAddress: '',
@@ -457,7 +456,6 @@ describe('cronjobs', () => {
457456
const snapshot0 = protectString<SnapshotId>(getRandomString())
458457
await Snapshots.insertAsync({
459458
_id: snapshot0,
460-
organizationId: null,
461459
comment: '',
462460
fileName: '',
463461
name: '',
@@ -470,7 +468,6 @@ describe('cronjobs', () => {
470468
const snapshot1 = protectString<SnapshotId>(getRandomString())
471469
await Snapshots.insertAsync({
472470
_id: snapshot1,
473-
organizationId: null,
474471
comment: '',
475472
fileName: '',
476473
name: '',
@@ -497,7 +494,6 @@ describe('cronjobs', () => {
497494
const deviceId = protectString<PeripheralDeviceId>(getRandomString())
498495
await PeripheralDevices.insertAsync({
499496
_id: deviceId,
500-
organizationId: null,
501497
type: PeripheralDeviceType.PLAYOUT,
502498
category: PeripheralDeviceCategory.PLAYOUT,
503499
configManifest: {
@@ -577,7 +573,6 @@ describe('cronjobs', () => {
577573
const studioId = protectString<StudioId>(getRandomString())
578574
await Studios.insertAsync({
579575
_id: studioId,
580-
organizationId: null,
581576
name: 'Studio',
582577
blueprintConfigWithOverrides: newObjectWithOverrides({}),
583578
_rundownVersionHash: '',

meteor/server/api/__tests__/cleanup.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getRandomId } from '../../lib/tempLib'
1+
import { getRandomId } from '@sofie-automation/corelib/dist/lib'
22

33
import '../../collections' // include this in order to get all of the collection set up
44
import { cleanupOldDataInner } from '../cleanup'
@@ -51,6 +51,7 @@ import { Collections } from '../../collections/lib'
5151
import { generateTranslationBundleOriginId } from '../translationsBundles'
5252
import { CollectionCleanupResult } from '@sofie-automation/meteor-lib/dist/api/system'
5353
import { DBNotificationTargetType } from '@sofie-automation/corelib/dist/dataModel/Notifications'
54+
import { CollectionName } from '@sofie-automation/corelib/dist/dataModel/Collections'
5455

5556
describe('Cleanup', () => {
5657
let env: DefaultEnvironment
@@ -67,6 +68,15 @@ describe('Cleanup', () => {
6768
expect(typeof result).not.toBe('string')
6869

6970
for (const name of Collections.keys()) {
71+
// Some collections have no 'owner'
72+
if (
73+
name === CollectionName.Blueprints ||
74+
name === CollectionName.Studios ||
75+
name === CollectionName.ShowStyleBases ||
76+
name === CollectionName.PeripheralDevices
77+
)
78+
continue
79+
7080
// Check that the collection has been handled in the function cleanupOldDataInner:
7181
expect(result).toHaveProperty(name)
7282
}
@@ -248,7 +258,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
248258
await Evaluations.insertAsync({
249259
_id: getRandomId(),
250260
answers: {} as any,
251-
organizationId: null,
252261
playlistId,
253262
studioId,
254263
timestamp: now,
@@ -401,7 +410,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
401410
created: now,
402411
fileName: '',
403412
name: '',
404-
organizationId: null,
405413
type: '' as any,
406414
version: '',
407415
})
@@ -427,7 +435,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
427435
clientAddress: '',
428436
context: '',
429437
method: '',
430-
organizationId: null,
431438
timestamp: now,
432439
userId: null,
433440
})
@@ -469,7 +476,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
469476
if (
470477
[
471478
// Ignore these:
472-
'organizations',
473479
'Users',
474480
// Deprecated:
475481
'mediaObjects',

0 commit comments

Comments
 (0)