Skip to content

Commit

Permalink
Merge branch 'release51' into feat/rework-caches-to-structured-objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 10, 2023
2 parents 2b032f3 + 3c90669 commit 171e4f3
Show file tree
Hide file tree
Showing 257 changed files with 5,074 additions and 1,272 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ System documentation can be found here: [Sofie system documentation](https://nrk

## Gettings started, local development

Follow these instructions to start up Sofie Core in development mode. (For production deploys, see [System documentation](https://sofie.gitbook.io/sofie-tv-automation/documentation/installation).)
Follow these instructions to start up Sofie Core in development mode. (For production deploys, see [System documentation](https://nrkno.github.io/sofie-core/docs/user-guide/installation/intro).)

### Prerequisites

Expand Down
7 changes: 7 additions & 0 deletions meteor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ All notable changes to this project will be documented in this file. See [standa
- verifyHashedToken compatible with securityVerify ([7052f3d](https://github.com/nrkno/sofie-core/commit/7052f3dc3844bc272719fedf5c3da799a1d38dd1))
- working re-layouting of hover inspectors ([87811a9](https://github.com/nrkno/sofie-core/commit/87811a90e18eb6cd9427773e820a1cee7517da6c))

## [1.49.0](https://github.com/nrkno/sofie-core/compare/v1.49.0-in-testing.10...v1.49.0) (2023-10-06)


### Bug Fixes

* error is reported in the Rundown View when an empty Combo is created in Action Triggers ([e6a0c5f](https://github.com/nrkno/sofie-core/commit/e6a0c5f4161132e300fa225e8aad50e1cbe72ffb))
* update casparcg-connection ([366f75c](https://github.com/nrkno/sofie-core/commit/366f75ce1bfab3054cc93bee58c6601bd4a40ceb))

## [1.49.0-in-testing.10](///compare/v1.49.0-in-testing.9...v1.49.0-in-testing.10) (2023-10-03)

Expand Down
2 changes: 1 addition & 1 deletion meteor/__mocks__/Fibers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let Fiber
let Fiber: any
try {
Fiber = require('fibers-npm')
} catch (e: any) {
Expand Down
1 change: 1 addition & 0 deletions meteor/__mocks__/check/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-expect-error No types available
import * as match from './match'

export function setup(): any {
Expand Down
1 change: 1 addition & 0 deletions meteor/__mocks__/ejson.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-expect-error No types available
import EJSON from 'ejson'

export function setup(): any {
Expand Down
7 changes: 4 additions & 3 deletions meteor/__mocks__/helpers/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const METHOD_NAMES = [
export function mockupCollection<DBInterface extends { _id: ProtectedString<any> }>(
collection0: AsyncOnlyMongoCollection<DBInterface>
): AsyncOnlyMongoCollection<DBInterface> & MockedCollection {
const collection = collection0 as AsyncOnlyMongoCollection<DBInterface> & MockedCollection
const collection = collection0 as any

_.each(METHOD_NAMES, (methodName) => {
collection['__original' + methodName] = collection[methodName]
Expand All @@ -61,9 +61,10 @@ export function mockupCollection<DBInterface extends { _id: ProtectedString<any>
export function resetMockupCollection<DBInterface extends { _id: ProtectedString<any> }>(
collection: AsyncOnlyMongoCollection<DBInterface>
): void {
const collectionAny = collection as any
_.each(METHOD_NAMES, (methodName) => {
collection[methodName] = collection['__original' + methodName]
delete collection['__original' + methodName]
collectionAny[methodName] = collectionAny['__original' + methodName]
delete collectionAny['__original' + methodName]
})
}

Expand Down
2 changes: 1 addition & 1 deletion meteor/__mocks__/meteor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export namespace MeteorMock {
const fiber = Fiber.current
if (!fiber) throw new Error(500, `It appears that wrapAsync isn't running in a fiber`)

const callback = (err, value) => {
const callback = (err: any, value: any) => {
if (err) {
fiber.throwInto(err)
} else {
Expand Down
30 changes: 18 additions & 12 deletions meteor/__mocks__/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ import {
UpdateOptions,
UpsertOptions,
} from '../lib/collections/lib'
import { mongoWhere, mongoFindOptions, mongoModify } from '@sofie-automation/corelib/dist/mongo'
import {
mongoWhere,
mongoFindOptions,
mongoModify,
MongoQuery,
MongoModifier,
} from '@sofie-automation/corelib/dist/mongo'
import { Mongo } from 'meteor/mongo'
import { AsyncOnlyMongoCollection, AsyncOnlyReadOnlyMongoCollection } from '../server/collections/collection'
const clone = require('fast-clone')
Expand Down Expand Up @@ -126,18 +132,18 @@ export namespace MongoMock {
},
}
},
forEach(f) {
forEach(f: any) {
docs.forEach(f)
},
map(f) {
map(f: any) {
return docs.map(f)
},
}
}
findOne(query, options?: FindOneOptions<T>) {
findOne(query: MongoQuery<T>, options?: FindOneOptions<T>) {
return this.find(query, options).fetch()[0]
}
update(query: any, modifier, options?: UpdateOptions): number {
update(query: MongoQuery<T>, modifier: MongoModifier<T>, options?: UpdateOptions): number {
const unimplementedUsedOptions = _.without(_.keys(options), 'multi')
if (unimplementedUsedOptions.length > 0) {
throw new Error(`update being performed using unimplemented options: ${unimplementedUsedOptions}`)
Expand Down Expand Up @@ -202,7 +208,7 @@ export namespace MongoMock {
}
upsert(
query: any,
modifier,
modifier: MongoModifier<T>,
options?: UpsertOptions
): { numberAffected: number | undefined; insertedId: T['_id'] | undefined } {
const id = _.isString(query) ? query : query._id
Expand Down Expand Up @@ -248,23 +254,23 @@ export namespace MongoMock {
}
rawCollection() {
return {
bulkWrite: async (updates: AnyBulkWriteOperation<any>[], _options) => {
bulkWrite: async (updates: AnyBulkWriteOperation<any>[], _options: unknown) => {
await sleep(this.asyncBulkWriteDelay)

for (const update of updates) {
if ('insertOne' in update) {
this.insert(update.insertOne.document)
} else if ('updateOne' in update) {
if (update.updateOne.upsert) {
this.upsert(update.updateOne.filter, update.updateOne.update, { multi: false })
this.upsert(update.updateOne.filter, update.updateOne.update as any, { multi: false })
} else {
this.update(update.updateOne.filter, update.updateOne.update, { multi: false })
this.update(update.updateOne.filter, update.updateOne.update as any, { multi: false })
}
} else if ('updateMany' in update) {
if (update.updateMany.upsert) {
this.upsert(update.updateMany.filter, update.updateMany.update, { multi: true })
this.upsert(update.updateMany.filter, update.updateMany.update as any, { multi: true })
} else {
this.update(update.updateMany.filter, update.updateMany.update, { multi: true })
this.update(update.updateMany.filter, update.updateMany.update as any, { multi: true })
}
} else if ('deleteOne' in update) {
const docs = this.find(update.deleteOne.filter).fetch()
Expand Down Expand Up @@ -298,7 +304,7 @@ export namespace MongoMock {

data = data || {}
if (_.isArray(data)) {
const collectionData = {}
const collectionData: MockCollection<T> = {}
_.each(data, (doc) => {
if (!doc._id) throw Error(`mockSetData: "${collectionName}": doc._id missing`)
collectionData[unprotectString(doc._id)] = doc
Expand Down
2 changes: 1 addition & 1 deletion meteor/__mocks__/reactive-var.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ReactiveVar<T> {
val: T
constructor(initVal) {
constructor(initVal: T) {
this.val = initVal
}
get = () => {
Expand Down
15 changes: 8 additions & 7 deletions meteor/client/lib/Components/DropdownInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,26 @@ export function getDropdownInputOptions<T>(rawOptions: unknown): DropdownInputOp
}
}
} else if (rawOptions && typeof rawOptions === 'object') {
const rawOptionsAny = rawOptions as any
// Is options an enum?
const keys = Object.keys(rawOptions)
const first = rawOptions[keys[0]]
if (rawOptions[first] + '' === keys[0] + '') {
const keys = Object.keys(rawOptionsAny)
const first = rawOptionsAny[keys[0]]
if (rawOptionsAny[first] + '' === keys[0] + '') {
// is an enum, only pick
for (const key in rawOptions) {
if (!isNaN(parseInt(key, 10))) {
// key is a number (the key)
const enumValue = rawOptions[key]
const enumKey = rawOptions[enumValue]
const enumValue = rawOptionsAny[key]
const enumKey = rawOptionsAny[enumValue]
options.push({
name: enumValue,
value: enumKey,
})
}
}
} else {
for (const key in rawOptions) {
const val = rawOptions[key]
for (const key in rawOptionsAny) {
const val = rawOptionsAny[key]
if (Array.isArray(val)) {
options.push({
name: key,
Expand Down
Loading

0 comments on commit 171e4f3

Please sign in to comment.