Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/move-misc-to-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@transcend-io/sdk': minor
'@transcend-io/cli': patch
---

feat(sdk): move assessment templates, ensureAllDataSubjectsExist, and syncCodePackages to SDK

- Move `fetchAllAssessmentTemplates`, `AssessmentTemplate` interface, and `ASSESSMENT_TEMPLATES` GQL to `sdk/src/assessments/`
- Move `ensureAllDataSubjectsExist` to `sdk/src/data-inventory/` with new `EnsureDataSubjectsInput` interface (replaces CLI's `TranscendInput` dependency)
- Move `createCodePackage`, `updateCodePackages`, `syncCodePackages` to `sdk/src/code-intelligence/` with `CodePackageInput` interface
- Delete dead-code `syncCookies.ts` from CLI (already duplicated in SDK, all callers already import from SDK)
- All moved functions follow the `(client, options)` signature convention with optional `logger`
5 changes: 2 additions & 3 deletions packages/cli/src/commands/inventory/scan-packages/impl.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { execSync } from 'child_process';

import { buildTranscendGraphQLClient } from '@transcend-io/sdk';
import { buildTranscendGraphQLClient, syncCodePackages } from '@transcend-io/sdk';
import colors from 'colors';

import { ADMIN_DASH } from '../../../constants.js';
import type { LocalContext } from '../../../context.js';
import { doneInputValidation } from '../../../lib/cli/done-input-validation.js';
import { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';
import { syncCodePackages } from '../../../lib/graphql/index.js';
import { logger } from '../../../logger.js';

const REPO_ERROR =
Expand Down Expand Up @@ -60,7 +59,7 @@ export async function scanPackages(
});

// Report scan to Transcend
await syncCodePackages(client, results);
await syncCodePackages(client, results, { logger });

const newUrl = new URL(ADMIN_DASH);
newUrl.pathname = '/code-scanning/code-packages';
Expand Down
56 changes: 0 additions & 56 deletions packages/cli/src/lib/graphql/ensureAllDataSubjectsExist.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/cli/src/lib/graphql/gqls/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './entry.js';
export * from './request.js';
export * from './assessmentTemplate.js';
4 changes: 0 additions & 4 deletions packages/cli/src/lib/graphql/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
export * from './ensureAllDataSubjectsExist.js';
export * from './fetchAllAssessmentTemplates.js';
export * from './fetchAllRequests.js';
export * from './fetchRequestDataSiloActiveCount.js';
export * from './gqls/index.js';
export * from './pullTranscendConfiguration.js';
export * from './syncCodePackages.js';
export * from './syncConfigurationToTranscend.js';
export * from './syncCookies.js';
export * from './syncDataSilos.js';
4 changes: 2 additions & 2 deletions packages/cli/src/lib/graphql/pullTranscendConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
fetchAllAgentFunctions,
fetchAllAgents,
fetchAllAssessments,
fetchAllAssessmentTemplates,
fetchAllAttributes,
fetchAllBusinessEntities,
fetchAllCookies,
Expand Down Expand Up @@ -91,7 +92,6 @@ import {
} from '../../codecs.js';
import { TranscendPullResource } from '../../enums.js';
import { logger } from '../../logger.js';
import { fetchAllAssessmentTemplates } from './fetchAllAssessmentTemplates.js';

export const DEFAULT_TRANSCEND_PULL_RESOURCES = [
TranscendPullResource.DataSilos,
Expand Down Expand Up @@ -334,7 +334,7 @@ export async function pullTranscendConfiguration(
: [],
// Fetch assessmentTemplates
resources.includes(TranscendPullResource.AssessmentTemplates)
? fetchAllAssessmentTemplates(client)
? fetchAllAssessmentTemplates(client, { logger })
: [],
// Fetch purpose and preferences
resources.includes(TranscendPullResource.Purposes)
Expand Down
Loading
Loading