Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6c04a0e
fix: normalize UI RepositoryData types and props
jescalada Oct 31, 2025
4e91205
refactor: remove duplicate commitTs and CommitData
jescalada Oct 31, 2025
b5356ac
refactor: unify attestation-related types
jescalada Oct 31, 2025
642de69
chore: remove unused UserType and replace with Partial<UserData>
jescalada Oct 31, 2025
99ddef1
chore: move ui-only types (UserData, PushData, Route) from src/types/…
jescalada Nov 1, 2025
b5ddbd9
refactor: duplicate ContextData types
jescalada Nov 1, 2025
8740d62
chore: move repo metadata types and fix isAdminUser typings
jescalada Nov 1, 2025
2db6d4e
refactor: extra config types into own types file
jescalada Nov 1, 2025
311a103
chore: generate config types for JWT roleMapping
jescalada Nov 1, 2025
91b8750
refactor: remove duplicate RoleMapping type
jescalada Nov 1, 2025
1bc75ba
refactor: remove duplicate Commit interface in Action.ts
jescalada Nov 6, 2025
276da56
refactor: replace PushData type with PushActionView
jescalada Nov 6, 2025
70677d5
refactor: add PublicUser type and replace usages of UserData
jescalada Nov 6, 2025
92eb9c2
refactor: replace generic data, setData, row with user equivalents
jescalada Nov 6, 2025
33ee86b
fix: missing user errors
jescalada Nov 7, 2025
35ecfb0
refactor: replace RepositoryData and related types with RepoView
jescalada Nov 7, 2025
7396564
refactor: replace generic data/setData variables with push versions
jescalada Nov 7, 2025
c3e4116
chore: simplify unexported UI types
jescalada Nov 8, 2025
c92c649
refactor: duplicate TabConfig/TabItem
jescalada Nov 8, 2025
23fbc4e
chore: move UserContext and AuthContext to ui/context.ts
jescalada Nov 8, 2025
ef15d58
Merge branch 'main' of https://github.com/finos/git-proxy into 1193-c…
jescalada Nov 8, 2025
f14d937
fix: cli type import error
jescalada Nov 8, 2025
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
9 changes: 8 additions & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,14 @@
"description": "Additional JWT configuration.",
"properties": {
"clientID": { "type": "string" },
"authorityURL": { "type": "string" }
"authorityURL": { "type": "string" },
"expectedAudience": { "type": "string" },
"roleMapping": {
"type": "object",
"properties": {
"admin": { "type": "object" }
}
}
},
"required": ["clientID", "authorityURL"]
}
Expand Down
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,25 @@
"require": "./dist/src/db/index.js",
"types": "./dist/src/db/index.d.ts"
},
"./plugin": {
"import": "./dist/src/plugin.js",
"require": "./dist/src/plugin.js",
"types": "./dist/src/plugin.d.ts"
},
"./proxy": {
"import": "./dist/src/proxy/index.js",
"require": "./dist/src/proxy/index.js",
"types": "./dist/src/proxy/index.d.ts"
},
"./types": {
"import": "./dist/src/types/models.js",
"require": "./dist/src/types/models.js",
"types": "./dist/src/types/models.d.ts"
"./proxy/actions": {
"import": "./dist/src/proxy/actions/index.js",
"require": "./dist/src/proxy/actions/index.js",
"types": "./dist/src/proxy/actions/index.d.ts"
},
"./plugin": {
"import": "./dist/src/plugin.js",
"require": "./dist/src/plugin.js",
"types": "./dist/src/plugin.d.ts"
"./ui": {
"import": "./dist/src/ui/index.js",
"require": "./dist/src/ui/index.js",
"types": "./dist/src/ui/index.d.ts"
}
},
"scripts": {
Expand Down
132 changes: 72 additions & 60 deletions packages/git-proxy-cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { hideBin } from 'yargs/helpers';
import fs from 'fs';
import util from 'util';

import { CommitData, PushData } from '@finos/git-proxy/types';
import { PushQuery } from '@finos/git-proxy/db';
import { Action } from '@finos/git-proxy/proxy/actions';

const GIT_PROXY_COOKIE_FILE = 'git-proxy-cookie';
// GitProxy UI HOST and PORT (configurable via environment variable)
Expand Down Expand Up @@ -88,74 +88,86 @@ async function getGitPushes(filters: Partial<PushQuery>) {

try {
const cookies = JSON.parse(fs.readFileSync(GIT_PROXY_COOKIE_FILE, 'utf8'));

const response = await axios.get(`${baseUrl}/api/v1/push/`, {
const { data } = await axios.get<Action[]>(`${baseUrl}/api/v1/push/`, {
headers: { Cookie: cookies },
params: filters,
});

const records: PushData[] = [];
response.data.forEach((push: PushData) => {
const record: PushData = {
id: push.id,
repo: push.repo,
branch: push.branch,
commitFrom: push.commitFrom,
commitTo: push.commitTo,
commitData: push.commitData,
diff: push.diff,
error: push.error,
canceled: push.canceled,
rejected: push.rejected,
blocked: push.blocked,
authorised: push.authorised,
attestation: push.attestation,
autoApproved: push.autoApproved,
timestamp: push.timestamp,
url: push.url,
allowPush: push.allowPush,
const records = data.map((push: Action) => {
const {
id,
repo,
branch,
commitFrom,
commitTo,
commitData,
error,
canceled,
rejected,
blocked,
authorised,
attestation,
autoApproved,
timestamp,
url,
allowPush,
lastStep,
} = push;

return {
id,
repo,
branch,
commitFrom,
commitTo,
commitData: commitData?.map(
({
message,
committer,
committerEmail,
author,
authorEmail,
commitTimestamp,
tree,
parent,
}) => ({
message,
committer,
committerEmail,
author,
authorEmail,
commitTimestamp,
tree,
parent,
}),
),
error,
canceled,
rejected,
blocked,
authorised,
attestation,
autoApproved,
timestamp,
url,
allowPush,
lastStep: lastStep && {
id: lastStep.id,
content: lastStep.content,
logs: lastStep.logs,
stepName: lastStep.stepName,
error: lastStep.error,
errorMessage: lastStep.errorMessage,
blocked: lastStep.blocked,
blockedMessage: lastStep.blockedMessage,
},
};

if (push.lastStep) {
record.lastStep = {
id: push.lastStep?.id,
content: push.lastStep?.content,
logs: push.lastStep?.logs,
stepName: push.lastStep?.stepName,
error: push.lastStep?.error,
errorMessage: push.lastStep?.errorMessage,
blocked: push.lastStep?.blocked,
blockedMessage: push.lastStep?.blockedMessage,
};
}

if (push.commitData) {
const commitData: CommitData[] = [];
push.commitData.forEach((pushCommitDataRecord: CommitData) => {
commitData.push({
message: pushCommitDataRecord.message,
committer: pushCommitDataRecord.committer,
committerEmail: pushCommitDataRecord.committerEmail,
author: pushCommitDataRecord.author,
authorEmail: pushCommitDataRecord.authorEmail,
commitTimestamp: pushCommitDataRecord.commitTimestamp,
tree: pushCommitDataRecord.tree,
parent: pushCommitDataRecord.parent,
commitTs: pushCommitDataRecord.commitTs,
});
});
record.commitData = commitData;
}

records.push(record);
});

console.log(`${util.inspect(records, false, null, false)}`);
console.log(util.inspect(records, false, null, false));
} catch (error: any) {
// default error
const errorMessage = `Error: List: '${error.message}'`;
console.error(`Error: List: '${error.message}'`);
process.exitCode = 2;
console.error(errorMessage);
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/git-proxy-cli/test/testCliUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ async function addGitPushToDb(
parent: 'parent',
author: 'author',
committer: 'committer',
commitTs: 'commitTs',
message: 'message',
authorEmail: 'authorEmail',
committerEmail: 'committerEmail',
Expand Down
49 changes: 1 addition & 48 deletions src/config/ConfigLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,10 @@ import { promisify } from 'util';
import { EventEmitter } from 'events';
import envPaths from 'env-paths';
import { GitProxyConfig, Convert } from './generated/config';
import { Configuration, ConfigurationSource, FileSource, HttpSource, GitSource } from './types';

const execFileAsync = promisify(execFile);

interface GitAuth {
type: 'ssh';
privateKeyPath: string;
}

interface HttpAuth {
type: 'bearer';
token: string;
}

interface BaseSource {
type: 'file' | 'http' | 'git';
enabled: boolean;
}

interface FileSource extends BaseSource {
type: 'file';
path: string;
}

interface HttpSource extends BaseSource {
type: 'http';
url: string;
headers?: Record<string, string>;
auth?: HttpAuth;
}

interface GitSource extends BaseSource {
type: 'git';
repository: string;
branch?: string;
path: string;
auth?: GitAuth;
}

type ConfigurationSource = FileSource | HttpSource | GitSource;

export interface ConfigurationSources {
enabled: boolean;
sources: ConfigurationSource[];
reloadIntervalSeconds: number;
merge?: boolean;
}

export interface Configuration extends GitProxyConfig {
configurationSources?: ConfigurationSources;
}

// Add path validation helper
function isValidPath(filePath: string): boolean {
if (!filePath || typeof filePath !== 'string') return false;
Expand Down
9 changes: 1 addition & 8 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
export type ServerConfig = {
GIT_PROXY_SERVER_PORT: string | number;
GIT_PROXY_HTTPS_SERVER_PORT: string | number;
GIT_PROXY_UI_HOST: string;
GIT_PROXY_UI_PORT: string | number;
GIT_PROXY_COOKIE_SECRET: string | undefined;
GIT_PROXY_MONGO_CONNECTION_STRING: string;
};
import { ServerConfig } from './types';

const {
GIT_PROXY_SERVER_PORT = 8000,
Expand Down
10 changes: 10 additions & 0 deletions src/config/generated/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ export interface AdConfig {
export interface JwtConfig {
authorityURL: string;
clientID: string;
expectedAudience?: string;
roleMapping?: RoleMapping;
[property: string]: any;
}

export interface RoleMapping {
admin?: { [key: string]: any };
[property: string]: any;
}

Expand Down Expand Up @@ -754,9 +761,12 @@ const typeMap: any = {
[
{ json: 'authorityURL', js: 'authorityURL', typ: '' },
{ json: 'clientID', js: 'clientID', typ: '' },
{ json: 'expectedAudience', js: 'expectedAudience', typ: u(undefined, '') },
{ json: 'roleMapping', js: 'roleMapping', typ: u(undefined, r('RoleMapping')) },
],
'any',
),
RoleMapping: o([{ json: 'admin', js: 'admin', typ: u(undefined, m('any')) }], 'any'),
OidcConfig: o(
[
{ json: 'callbackURL', js: 'callbackURL', typ: '' },
Expand Down
3 changes: 2 additions & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { existsSync, readFileSync } from 'fs';

import defaultSettings from '../../proxy.config.json';
import { GitProxyConfig, Convert } from './generated/config';
import { ConfigLoader, Configuration } from './ConfigLoader';
import { ConfigLoader } from './ConfigLoader';
import { Configuration } from './types';
import { serverConfig } from './env';
import { configFile } from './file';

Expand Down
58 changes: 58 additions & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { GitProxyConfig } from './generated/config';

export type ServerConfig = {
GIT_PROXY_SERVER_PORT: string | number;
GIT_PROXY_HTTPS_SERVER_PORT: string | number;
GIT_PROXY_UI_HOST: string;
GIT_PROXY_UI_PORT: string | number;
GIT_PROXY_COOKIE_SECRET: string | undefined;
GIT_PROXY_MONGO_CONNECTION_STRING: string;
};

interface GitAuth {
type: 'ssh';
privateKeyPath: string;
}

interface HttpAuth {
type: 'bearer';
token: string;
}

interface BaseSource {
type: 'file' | 'http' | 'git';
enabled: boolean;
}

export interface FileSource extends BaseSource {
type: 'file';
path: string;
}

export interface HttpSource extends BaseSource {
type: 'http';
url: string;
headers?: Record<string, string>;
auth?: HttpAuth;
}

export interface GitSource extends BaseSource {
type: 'git';
repository: string;
branch?: string;
path: string;
auth?: GitAuth;
}

export type ConfigurationSource = FileSource | HttpSource | GitSource;

interface ConfigurationSources {
enabled: boolean;
sources: ConfigurationSource[];
reloadIntervalSeconds: number;
merge?: boolean;
}

export interface Configuration extends GitProxyConfig {
configurationSources?: ConfigurationSources;
}
8 changes: 0 additions & 8 deletions src/context.ts

This file was deleted.

Loading
Loading