QuickNav
Methods
- addBinaryTranslationFile(args) → {Promise}
- addTranslationFile(args) → {Promise}
- createFileMetadata(args) → {Promise.<PersistenceApi.fileMetadata>}
- createJob(args) → {Promise.<SampleJobManager.JobConfig>}
- createTranslationRepository(args) → {Promise}
- createTranslationZip(args) → {Promise.<SampleJobManager.JobConfig>}
- deleteJob(args) → {Promise}
- exportTranslationZip(args) → {Promise.<PersistenceApi.ZipFileStream>}
- getAllJobs() → {Promise.<Array.<SampleJobManager.JobConfig>>}
- getBinaryFile(args) → {Promise.<string>}
- getBinaryFilePath() → {string}
- getBinaryFileSpec(args) → {string}
- getFileMetadata(args) → {Promise.<PersistenceApi.fileMetadata>}
- getFolderFiles(args) → {Array.<string>}
- getJob(args) → {Promise.<SampleJobManager.JobConfig>}
- getSourceFile(args) → {Promise.<string>}
- getSourceJobJSON(args) → {Promise.<SampleJobManager.JobDetails>}
- importSourceZip(args) → {Promise}
- updateFileMetadata(args) → {Promise.<PersistenceApi.fileMetadata>}
- updateJob(args) → {Promise.<SampleJobManager.JobConfig>}
SampleFilePersistenceStore
new SampleFilePersistenceStore()
Manage persistence of the job during the jobs lifecycle.
This module is responsible for saving the state of the job and managing the state during startup/shutdown & failover.
This module is responsible for saving the state of the job and managing the state during startup/shutdown & failover.
- Specifically, it needs to:
- Keep track of all the jobs.
- For each job:
- Store metadata about the job and mapping it to the project in the Language Service Provider.
- Store/Unpack the zip file provided by the OCE translation job.
- Store metadata about each file in the zip mapping the file to the entry in the Language Service Provider.
- Store all the translations for each of the files as they become available.
- Create a final zip of all the translated files in the format required for ingestion into the OCE translation jobs.
- On job delete, remove all artifacts associated with the job.
- "connector-data" Folder for all the connector data.
- "translation-jobs" Folder for all the translation jobs created.
- "translation-jobs" Folder for all the translation jobs created.
- {job1} Random identifier generated for each job creation
- "translation-source" Folder containing all the source files for the job
- "translation-target" Folder containing all the combined translated files for the job
- {job2} Random identifier generated for each job creation
- ...
- {job1} Random identifier generated for each job creation
- "translation-jobs" Folder for all the translation jobs created.
- "translation-jobs" Folder for all the translation jobs created.
Extends
Methods
addBinaryTranslationFile(args) → {Promise}
Add a translated binary file to the translation repository
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "addTranslationFile" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved when the file has been saved to the translation repository.
- Type
- Promise
addTranslationFile(args) → {Promise}
Add a translated file to the translation repository
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "addTranslationFile" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved when the file has been saved to the translation repository.
- Type
- Promise
createFileMetadata(args) → {Promise.<PersistenceApi.fileMetadata>}
Create the metadata to be held for a file being translated.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "createFileMetadata" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with a details on the metadata for the file
- Type
- Promise.<PersistenceApi.fileMetadata>
createJob(args) → {Promise.<SampleJobManager.JobConfig>}
Create a translation job
Create an entry for this translation job in the persistence store.
Create an entry for this translation job in the persistence store.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "createJob" parameters.
Properties
|
- Overrides:
- Source:
Returns:
The metadata created and stored for this job.
- Type
- Promise.<SampleJobManager.JobConfig>
createTranslationRepository(args) → {Promise}
Create a repository to hold all the translated files.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "createTranslationRepository" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved when the repository has been setup to receive translations.
- Type
- Promise
createTranslationZip(args) → {Promise.<SampleJobManager.JobConfig>}
Create the export zip file for the translated files.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "createTranslationZip" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with the updated job metadata containing the "translatedZipFile" property for the created zip file.
- Type
- Promise.<SampleJobManager.JobConfig>
deleteJob(args) → {Promise}
Delete all persistence data related to the provided job identifier.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "deleteJob" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved when the job has been deleted.
- Type
- Promise
exportTranslationZip(args) → {Promise.<PersistenceApi.ZipFileStream>}
Export the translated zip file
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "exportTranslationZip" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with a zip file stream that can be returned in an HTTPS response.
- Type
- Promise.<PersistenceApi.ZipFileStream>
getAllJobs() → {Promise.<Array.<SampleJobManager.JobConfig>>}
Get all the jobs currently tracked by the PersistenceApi
- Overrides:
- Source:
Returns:
A Promise that returns an array of the metadata for each of the translation jobs.
- Type
- Promise.<Array.<SampleJobManager.JobConfig>>
getBinaryFile(args) → {Promise.<string>}
Get binary file.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getSourceFile" parameters.
Properties
|
- Overrides:
- Source:
Returns:
binary file.
- Type
- Promise.<string>
getBinaryFilePath() → {string}
Get path to the binary files folder of the digital asset.
Parameters:
Name | Type | Description |
---|---|---|
args.contentItemId |
string | Digital Asset Id |
- Overrides:
- Source:
Returns:
path to the binary files folder of the digital asset.
- Type
- string
getBinaryFileSpec(args) → {string}
Get binary file spec of the binary file.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getSourceFile" parameters.
Properties
|
- Overrides:
- Source:
Returns:
binary file spec of the digital asset.
- Type
- string
getFileMetadata(args) → {Promise.<PersistenceApi.fileMetadata>}
Get the meta-data for a file being translated.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getFileMetadata" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with a details on the metadata for the file
- Type
- Promise.<PersistenceApi.fileMetadata>
getFolderFiles(args) → {Array.<string>}
Get list of files in the binary files folder of the digital asset.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getSourceFile" parameters.
Properties
|
- Overrides:
- Source:
Returns:
list of files in the binary files folder of the digital asset.
- Type
- Array.<string>
getJob(args) → {Promise.<SampleJobManager.JobConfig>}
Get a translation job.
Retrieve the job metadata from the persistence store for this job.
Retrieve the job metadata from the persistence store for this job.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getJob" parameters.
Properties
|
- Overrides:
- Source:
Returns:
The metadata created and stored for this job.
- Type
- Promise.<SampleJobManager.JobConfig>
getSourceFile(args) → {Promise.<string>}
Get the requested source file from the job.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getSourceFile" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with the file content.
- Type
- Promise.<string>
getSourceJobJSON(args) → {Promise.<SampleJobManager.JobDetails>}
Get the source job.json files that are in the zip file.
The job can be either:
The job can be either:
- "assets" job type, which has a structure of:
- job.json
- root
- "site" job type, which has a structure of:
- assets
- job.json
- root
- site
- job.json
- root
- assets
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "getSourceJobJSON" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with the combined job.json files.
- Type
- Promise.<SampleJobManager.JobDetails>
importSourceZip(args) → {Promise}
Import the source zip file and expand it into the "translation-source" folder in the persistence store.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "importSourceZip" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved when the zip file has been written to the filesystem and expanded.
- Type
- Promise
updateFileMetadata(args) → {Promise.<PersistenceApi.fileMetadata>}
Update the metadata for a file being translated.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | JavaScript object containing the "updateFileMetadata" parameters.
Properties
|
- Overrides:
- Source:
Returns:
A Promise that is resolved with a details on the metadata for the file
- Type
- Promise.<PersistenceApi.fileMetadata>
updateJob(args) → {Promise.<SampleJobManager.JobConfig>}
Update a translation job.
Update the translation job with new metadata about the jobs state.
Note: This currently supports only updating the following properties in the metadata:
Update the translation job with new metadata about the jobs state.
Note: This currently supports only updating the following properties in the metadata:
- status
- statusMessage
- translatedZipFile
- progress
Parameters:
Name | Type | Description |
---|---|---|
args |
SampleJobManager.JobConfig | JavaScript object containing the metadata to update for this job. |
- Overrides:
- Source:
Returns:
The updated metadata stored for this job.
- Type
- Promise.<SampleJobManager.JobConfig>