Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	apps/appcontainer-node/app/CHANGELOG.md
#	apps/appcontainer-node/app/package.json
#	apps/appcontainer-node/packages/generic/CHANGELOG.md
#	apps/appcontainer-node/packages/generic/package.json
#	apps/package-manager/app/CHANGELOG.md
#	apps/package-manager/app/package.json
#	apps/package-manager/packages/generic/CHANGELOG.md
#	apps/package-manager/packages/generic/package.json
#	apps/single-app/app/CHANGELOG.md
#	apps/single-app/app/package.json
#	apps/worker/app/CHANGELOG.md
#	apps/worker/app/package.json
#	apps/worker/packages/generic/CHANGELOG.md
#	apps/worker/packages/generic/package.json
#	lerna.json
#	shared/packages/expectationManager/CHANGELOG.md
#	shared/packages/expectationManager/package.json
#	shared/packages/worker/CHANGELOG.md
#	shared/packages/worker/package.json
#	tests/internal-tests/CHANGELOG.md
#	tests/internal-tests/package.json
  • Loading branch information
nytamin committed Jan 22, 2024
2 parents 47ae56c + 3a5df89 commit eadb9ec
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
10 changes: 7 additions & 3 deletions shared/packages/worker/src/worker/accessorHandlers/atem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ export class ATEMAccessorHandle<Metadata> extends GenericAccessorHandle<Metadata
) {
super(worker, accessorId, accessor, content, ATEMAccessorHandle.type)

this.content = content
// Verify content data:
if (!content.onlyContainerAccess) {
if (!content.filePath) throw new Error('Bad input data: content.filePath not set!')
if (!this._getFilePath())
throw new Error('Bad input data: neither content.filePath nor accessor.filePath are set!')
}
this.content = content
}
static doYouSupportAccess(worker: GenericWorker, accessor0: AccessorOnPackage.Any): boolean {
const accessor = accessor0 as AccessorOnPackage.AtemMediaStore
Expand Down Expand Up @@ -348,7 +349,7 @@ export class ATEMAccessorHandle<Metadata> extends GenericAccessorHandle<Metadata
return streamWrapper
}
private getAtemClipName(): string {
const filePath = this.accessor.filePath || this.content.filePath
const filePath = this._getFilePath()

if (!filePath) throw new Error('Atem: filePath not set!')
return filePath
Expand Down Expand Up @@ -444,6 +445,9 @@ export class ATEMAccessorHandle<Metadata> extends GenericAccessorHandle<Metadata

return crypto.createHash('md5').update(concatenatedHash).digest('base64')
}
private _getFilePath(): string | undefined {
return this.accessor.filePath || this.content.filePath
}
}

async function stream2Disk(sourceStream: NodeJS.ReadableStream, outputFile: string): Promise<void> {
Expand Down
11 changes: 7 additions & 4 deletions shared/packages/worker/src/worker/accessorHandlers/fileShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
this.originalFolderPath = this.accessor.folderPath
this.actualFolderPath = this.originalFolderPath // To be overwritten later

this.content = content
// Verify content data:
if (!content.onlyContainerAccess) {
if (!content.filePath && !this.accessor.filePath)
throw new Error('Bad input data: content.filePath not set!')
if (!this._getFilePath())
throw new Error('Bad input data: neither content.filePath nor accessor.filePath are set!')
}
this.content = content

if (workOptions.removeDelay && typeof workOptions.removeDelay !== 'number')
throw new Error('Bad input data: workOptions.removeDelay is not a number!')
Expand Down Expand Up @@ -387,7 +387,7 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
get filePath(): string {
if (this.content.onlyContainerAccess) throw new Error('onlyContainerAccess is set!')

const filePath = this.accessor.filePath || this.content.filePath
const filePath = this._getFilePath()
if (!filePath) throw new Error(`FileShareAccessor: filePath not set!`)
return filePath
}
Expand Down Expand Up @@ -628,6 +628,9 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
}
return { success: true }
}
private _getFilePath(): string | undefined {
return this.accessor.filePath || this.content.filePath
}
}
interface MappedDriveLetters {
[driveLetter: string]: string
Expand Down
9 changes: 6 additions & 3 deletions shared/packages/worker/src/worker/accessorHandlers/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export class HTTPAccessorHandle<Metadata> extends GenericAccessorHandle<Metadata
) {
super(worker, accessorId, accessor, content, HTTPAccessorHandle.type)

// Verify content data:
this.content = content
// Verify content data:
if (!content.onlyContainerAccess) {
if (!this.accessor.url && !this.content.path) throw new Error('Bad input data: content.path not set!')
if (!this._getFilePath()) throw new Error('Bad input data: neither content.path nor accessor.url are set!')
}

if (workOptions.removeDelay && typeof workOptions.removeDelay !== 'number')
Expand Down Expand Up @@ -234,7 +234,7 @@ export class HTTPAccessorHandle<Metadata> extends GenericAccessorHandle<Metadata
}
get path(): string {
if (this.content.onlyContainerAccess) throw new Error('onlyContainerAccess is set!')
const filePath = this.accessor.url || this.content.path
const filePath = this._getFilePath()
if (!filePath) throw new Error(`HTTPAccessorHandle: path not set!`)
return filePath
}
Expand Down Expand Up @@ -413,6 +413,9 @@ export class HTTPAccessorHandle<Metadata> extends GenericAccessorHandle<Metadata
private getMetadataPath(fullUrl: string) {
return fullUrl + '_metadata.json'
}
private _getFilePath(): string | undefined {
return this.accessor.url || this.content.path
}
}
interface HTTPHeaders {
contentType: string | null
Expand Down
12 changes: 7 additions & 5 deletions shared/packages/worker/src/worker/accessorHandlers/httpProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ export class HTTPProxyAccessorHandle<Metadata> extends GenericAccessorHandle<Met
) {
super(worker, accessorId, accessor, content, HTTPProxyAccessorHandle.type)

// Verify content data:
this.content = content
// Verify content data:
if (!content.onlyContainerAccess) {
if (!this.accessor.url || !this.content.filePath)
throw new Error('Bad input data: content.filePath not set!')
if (!content.filePath) throw new Error('Bad input data: content.filePath not set!')
if (!this._getFilePath())
throw new Error('Bad input data: neither content.filePath nor accessor.url are set!')
}

if (workOptions.removeDelay && typeof workOptions.removeDelay !== 'number')
Expand Down Expand Up @@ -262,7 +261,7 @@ export class HTTPProxyAccessorHandle<Metadata> extends GenericAccessorHandle<Met
}
get filePath(): string {
if (this.content.onlyContainerAccess) throw new Error('onlyContainerAccess is set!')
const filePath = this.accessor.url || this.content.filePath
const filePath = this._getFilePath()
if (!filePath) throw new Error(`HTTPAccessorHandle: filePath not set!`)
return filePath
}
Expand Down Expand Up @@ -428,6 +427,9 @@ export class HTTPProxyAccessorHandle<Metadata> extends GenericAccessorHandle<Met
private getMetadataPath(fullUrl: string) {
return fullUrl + '_metadata.json'
}
private _getFilePath(): string | undefined {
return this.accessor.url || this.content.filePath
}
}
interface HTTPHeaders {
contentType: string | null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ export class LocalFolderAccessorHandle<Metadata> extends GenericFileAccessorHand
) {
super(worker, accessorId, accessor, content, LocalFolderAccessorHandle.type)

this.content = content
// Verify content data:
if (!content.onlyContainerAccess) {
if (!content.filePath && !content.path && !this.accessor.filePath)
throw new Error('Bad input data: content.filePath nor content.path not set!')
if (!this._getFilePath())
throw new Error('Bad input data: neither accessor.filePath, content.filePath nor content.path are set!')
}
this.content = content

if (workOptions.removeDelay && typeof workOptions.removeDelay !== 'number')
throw new Error('Bad input data: workOptions.removeDelay is not a number!')
Expand Down Expand Up @@ -339,10 +339,11 @@ export class LocalFolderAccessorHandle<Metadata> extends GenericFileAccessorHand
get orgFolderPath(): string {
return this.folderPath
}

/** Local path to the Package, ie the File */
get filePath(): string {
if (this.content.onlyContainerAccess) throw new Error('onlyContainerAccess is set!')
const filePath = this.accessor.filePath || this.content.filePath || this.content.path
const filePath = this._getFilePath()
if (!filePath) throw new Error(`LocalFolderAccessor: filePath not set!`)
return filePath
}
Expand Down Expand Up @@ -371,4 +372,7 @@ export class LocalFolderAccessorHandle<Metadata> extends GenericFileAccessorHand
}
return { success: true }
}
private _getFilePath(): string | undefined {
return this.accessor.filePath || this.content.filePath || this.content.path
}
}

0 comments on commit eadb9ec

Please sign in to comment.