Skip to content

Commit

Permalink
useMaster: false
Browse files Browse the repository at this point in the history
  • Loading branch information
MadDataScience committed Mar 7, 2025
1 parent 9103f6c commit 44bf7a8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
26 changes: 18 additions & 8 deletions src/cli-pull-unstructured-discovery-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { logger } from './logger';
import { splitCsvToList } from './requests';

/**
* Sync entries from Transcend inventory to a CSV
* Sync unstructured discovery files from Transcend inventory to a CSV
*
* Dev Usage:
* yarn ts-node ./src/cli-pull-entries.ts --auth=$TRANSCEND_API_KEY
* yarn ts-node ./src/cli-pull-unstructured-discovery-files.ts --auth=$TRANSCEND_API_KEY
*
* Standard usage
* yarn cli-pull-entries --auth=$TRANSCEND_API_KEY
* yarn cli-pull-unstructured-discovery-files --auth=$TRANSCEND_API_KEY
*/
async function main(): Promise<void> {
// Parse command line arguments
Expand Down Expand Up @@ -55,13 +55,17 @@ async function main(): Promise<void> {
includeEncryptedSnippets: includeEncryptedSnippetsBool,
});

logger.info(colors.magenta(`Writing entries to file "${file}"...`));
logger.info(
colors.magenta(
`Writing unstructured discovery files to file "${file}"...`,
),
);
let headers: string[] = [];
const inputs = entries.map((entry) => {
const result = {
'Entry ID': entry.id,
'Data Silo ID': entry.dataSiloId, // FIXME
'Object Path ID': entry.scannedObjectPathId, // FIXME
'Data Silo ID': entry.dataSiloId,
'Object Path ID': entry.scannedObjectPathId,
'Object ID': entry.scannedObjectId,
...(includeEncryptedSnippetsBool
? { Entry: entry.name, 'Context Snippet': entry.contextSnippet }
Expand All @@ -78,13 +82,19 @@ async function main(): Promise<void> {
writeCsv(file, inputs, headers);
} catch (err) {
logger.error(
colors.red(`An error occurred syncing the entries: ${err.message}`),
colors.red(
`An error occurred syncing the unstructured discovery files: ${err.message}`,
),
);
process.exit(1);
}

// Indicate success
logger.info(colors.green(`Successfully synced entries to disk at ${file}!`));
logger.info(
colors.green(
`Successfully synced unstructured discovery files to disk at ${file}!`,
),
);
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export async function pullUnstructuredSubDataPointRecommendations(
filterBy: $filterBy
first: $first
offset: $offset
useMaster: false
) {
nodes {
id
Expand Down
5 changes: 4 additions & 1 deletion src/graphql/gqls/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export const ENTRY_COUNT = gql`
query TranscendCliEntryCount(
$filterBy: UnstructuredSubDataPointRecommendationsFilterInput
) {
unstructuredSubDataPointRecommendations(filterBy: $filterBy) {
unstructuredSubDataPointRecommendations(
filterBy: $filterBy
useMaster: false
) {
totalCount
}
}
Expand Down

0 comments on commit 44bf7a8

Please sign in to comment.