From 3a94685dac706a3b954dfcae6fd79826e276a39c Mon Sep 17 00:00:00 2001 From: hervee Date: Wed, 7 Oct 2026 08:49:07 +0200 Subject: [PATCH] WKS-2791 - Declare Xray types in worker.ts so samples deploy --- .../ai-download-risk-advisor/types.ts | 24 ++----------------- .../ai-download-risk-advisor/worker.ts | 23 +++++++++++++++++- .../openai-download-risk-advisor/types.ts | 24 ++----------------- .../openai-download-risk-advisor/worker.ts | 23 +++++++++++++++++- 4 files changed, 48 insertions(+), 46 deletions(-) diff --git a/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/types.ts b/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/types.ts index ee8de5d..93f617e 100644 --- a/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/types.ts +++ b/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/types.ts @@ -58,10 +58,6 @@ export interface DownloadMetadata { repoType: RepoType; } -export interface Header { - value: string[]; -} - export interface UserContext { /** The username or subject */ id: string; @@ -92,22 +88,6 @@ export interface RepoPath { isFolder: boolean; } -/** One entry from the Xray `/xray/api/v1/artifacts` search response */ -export interface XrayArtifact { - name: string; - repo_path: string; - repo_full_path: string; - sec_issues: { - critical: number; - high: number; - medium: number; - low: number; - total: number; - }; - violations: number; -} - -export interface XrayArtifactsSearchResponse { - data: XrayArtifact[]; - offset: number; +export interface Header { + value: string[]; } diff --git a/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/worker.ts b/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/worker.ts index 3142fba..621608e 100644 --- a/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/worker.ts +++ b/samples/artifactory/AFTER_DOWNLOAD/ai-download-risk-advisor/worker.ts @@ -1,5 +1,5 @@ import { PlatformContext } from 'jfrog-workers'; -import { AfterDownloadRequest, AfterDownloadResponse, XrayArtifactsSearchResponse } from './types'; +import { AfterDownloadRequest, AfterDownloadResponse } from './types'; export default async (context: PlatformContext, data: AfterDownloadRequest): Promise => { // Configurable via the worker's "properties" (manifest.json / Platform UI); fall back to these defaults if unset @@ -139,3 +139,24 @@ async function askClaudeForRiskSummary( } return text; } + +// Declared here rather than in types.ts: 'jf worker deploy' only uploads worker.ts and compiles it +// against the platform's own event types. +interface XrayArtifact { + name: string; + repo_path: string; + repo_full_path: string; + sec_issues: { + critical: number; + high: number; + medium: number; + low: number; + total: number; + }; + violations: number; +} + +interface XrayArtifactsSearchResponse { + data: XrayArtifact[]; + offset: number; +} diff --git a/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/types.ts b/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/types.ts index ee8de5d..93f617e 100644 --- a/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/types.ts +++ b/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/types.ts @@ -58,10 +58,6 @@ export interface DownloadMetadata { repoType: RepoType; } -export interface Header { - value: string[]; -} - export interface UserContext { /** The username or subject */ id: string; @@ -92,22 +88,6 @@ export interface RepoPath { isFolder: boolean; } -/** One entry from the Xray `/xray/api/v1/artifacts` search response */ -export interface XrayArtifact { - name: string; - repo_path: string; - repo_full_path: string; - sec_issues: { - critical: number; - high: number; - medium: number; - low: number; - total: number; - }; - violations: number; -} - -export interface XrayArtifactsSearchResponse { - data: XrayArtifact[]; - offset: number; +export interface Header { + value: string[]; } diff --git a/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/worker.ts b/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/worker.ts index c73adb9..1232b01 100644 --- a/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/worker.ts +++ b/samples/artifactory/AFTER_DOWNLOAD/openai-download-risk-advisor/worker.ts @@ -1,5 +1,5 @@ import { PlatformContext } from 'jfrog-workers'; -import { AfterDownloadRequest, AfterDownloadResponse, XrayArtifactsSearchResponse } from './types'; +import { AfterDownloadRequest, AfterDownloadResponse } from './types'; export default async (context: PlatformContext, data: AfterDownloadRequest): Promise => { // Configurable via the worker's "properties" (manifest.json / Platform UI); fall back to these defaults if unset @@ -136,3 +136,24 @@ async function askOpenAiForRiskSummary( } return text; } + +// Declared here rather than in types.ts: 'jf worker deploy' only uploads worker.ts and compiles it +// against the platform's own event types. +interface XrayArtifact { + name: string; + repo_path: string; + repo_full_path: string; + sec_issues: { + critical: number; + high: number; + medium: number; + low: number; + total: number; + }; + violations: number; +} + +interface XrayArtifactsSearchResponse { + data: XrayArtifact[]; + offset: number; +}