Skip to content

Commit

Permalink
Feature / add tc ready support (#189)
Browse files Browse the repository at this point in the history
* bump version

* adding tc-ready support

* add topic and ignoreDoor43Catalog to catalog search

* bump version

---------

Co-authored-by: blm <[email protected]>
  • Loading branch information
PhotoNomad0 and blm authored Dec 11, 2024
1 parent 0c1492b commit c1e4a76
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tc-source-content-updater",
"version": "1.4.31",
"version": "1.4.32",
"description": "Module that updates source content for the desktop application translationCore.",
"main": "lib/index.js",
"display": "library",
Expand Down
8 changes: 7 additions & 1 deletion src/helpers/apiHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,16 @@ export async function getCatalog(config = {}) {
DCS_BASE_URL: config.DCS_BASE_URL,
partialMatch: '0',
};
const catalogReleases = await searchCatalogNext(searchParams);
const fetchDoor43Catalog = !config.ignoreDoor43Catalog;
const catalogReleases = fetchDoor43Catalog ? await searchCatalogNext(searchParams) : [];
console.log(`getCatalog - found ${catalogReleases.length} items in old Door43-Catalog`);
searchParams = {
subject: SUBJECT.ALL_TC_RESOURCES,
stage: config.stage || STAGE.PROD,
DCS_BASE_URL: config.DCS_BASE_URL,
partialMatch: '0',
ignoreDoor43Catalog: config.ignoreDoor43Catalog,
topic: config.topic,
};
const newCatalogReleases = await searchCatalogNext(searchParams);
console.log(`getCatalog - found ${newCatalogReleases.length} items in catalog next`);
Expand Down Expand Up @@ -398,6 +401,7 @@ function getCompatibleResourceList(resources) {
* STAGE.LATEST -return the default branch (e.g. master) if it is a valid RC instead of the "prod", "preprod" or "draft". (default)
* @property {Number|String} checkingLevel - search only for entries with the given checking level(s). Can be 1, 2 or 3. Default is any.
* @property {String} sort - how to sort results (see defines in SORT), if undefined then sorted by by "lang", then "subject" and then "tag"
* @property {String} topic - filter by topic tags (e.g. "tc-ready")
*/

/**
Expand All @@ -419,6 +423,7 @@ export async function searchCatalogNext(searchParams, retries=3) {
partialMatch,
sort = SORT.REPO_NAME,
DCS_BASE_URL: baseUrl = DCS_BASE_URL,
topic,
} = searchParams;

try {
Expand All @@ -433,6 +438,7 @@ export async function searchCatalogNext(searchParams, retries=3) {
parameters = addUrlParameter(partialMatch, parameters, 'partialMatch');
parameters = addUrlParameter('rc', parameters, 'metadataType');
parameters = addUrlParameter(sort, parameters, 'sort');
parameters = addUrlParameter(topic, parameters, 'topic');
if (parameters) {
fetchUrl += '?' + parameters;
}
Expand Down

0 comments on commit c1e4a76

Please sign in to comment.