first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import { GetUserAccessProfilesResponse } from "@enterprise/lib/types/accessProfile";
// OSS build has no access-profile backend — return undefined data so consumers
// (e.g. useVirtualKeyUsage) fall back to VK-owned budget/rate-limit values.
export const useGetUserAccessProfilesQuery = (
_userId: string,
_opts?: { skip?: boolean; pollingInterval?: number },
): {
data: GetUserAccessProfilesResponse | undefined;
isLoading: boolean;
isError: boolean;
error: null;
} => ({
data: undefined,
isLoading: false,
isError: false,
error: null,
});

View File

@@ -0,0 +1,11 @@
// Placeholder for enterprise APIs
// Export empty objects when enterprise features are not available
export const scimApi = null;
export const guardrailsApi = null;
export const clusterApi = null;
export const rbacApi = null;
export const auditLogsApi = null;
// Empty apis array when enterprise features are not available
export const apis = [];

View File

@@ -0,0 +1,18 @@
import { LargePayloadConfig } from "@enterprise/lib/types/largePayload";
export const useGetLargePayloadConfigQuery = (): {
data: LargePayloadConfig | undefined;
isLoading: boolean;
isError: boolean;
error: null;
} => ({
data: undefined,
isLoading: false,
isError: false,
error: null,
});
export const useUpdateLargePayloadConfigMutation = (): [
(_config: LargePayloadConfig) => { unwrap: () => Promise<void> },
{ isLoading: boolean },
] => [() => ({ unwrap: async () => {} }), { isLoading: false }];

View File

@@ -0,0 +1,22 @@
import { User } from "@enterprise/lib/types/user";
export interface GetVirtualKeyUsersResponse {
users: User[];
}
// OSS build has no VK-user-attachment backend — return undefined data so the
// consumer treats the VK as unassigned (no AP-managed detection happens).
export const useGetVirtualKeyUsersQuery = (
_vkId: string,
_opts?: { skip?: boolean },
): {
data: GetVirtualKeyUsersResponse | undefined;
isLoading: boolean;
isError: boolean;
error: null;
} => ({
data: undefined,
isLoading: false,
isError: false,
error: null,
});

View File

@@ -0,0 +1,23 @@
// Fallback exports for non-enterprise builds
export * from "./apis";
export * from "./slices";
// Export OAuth token management utilities (fallback no-ops)
export {
REFRESH_TOKEN_ENDPOINT,
clearOAuthStorage,
clearUserInfo,
getAccessToken,
getRefreshState,
getRefreshToken,
getTokenExpiry,
getUserInfo,
isTokenExpired,
setOAuthTokens,
setRefreshState,
setUserInfo,
type UserInfo,
} from "./utils/tokenManager";
// Export base query (fallback passthrough)
export { createBaseQueryWithRefresh } from "./utils/baseQueryWithRefresh";

View File

@@ -0,0 +1,12 @@
// Placeholder for enterprise reducers
// Export noop reducers when enterprise features are not available
export const scimReducer = (state = {}) => state;
export const userReducer = (state = {}) => state;
export const guardrailReducer = (state = {}) => state;
// Empty reducers map when enterprise features are not available
export const reducers = {};
// Empty enterprise state type when enterprise features are not available
export type EnterpriseState = {};

View File

@@ -0,0 +1,13 @@
// Fallback base query for non-enterprise builds
// Simply passes through the base query without any refresh logic
import type { BaseQueryFn } from "@reduxjs/toolkit/query/react";
/**
* Fallback base query wrapper that does nothing
* Used when enterprise features are not available
*/
export function createBaseQueryWithRefresh(baseQuery: BaseQueryFn): BaseQueryFn {
// Simply return the base query as-is (no refresh logic)
return baseQuery;
}

View File

@@ -0,0 +1,77 @@
// Fallback OAuth Token Manager for non-enterprise builds
// These functions return null/no-op when enterprise features are not available
export const getAccessToken = async (): Promise<string | null> => Promise.resolve(null);
export const getRefreshToken = async (): Promise<string | null> => Promise.resolve(null);
export const getTokenExpiry = (): number | null => null;
export const isTokenExpired = (): boolean => false;
export const setOAuthTokens = async (_accessToken: string, _expiresIn?: number | null) => {
// No-op in non-enterprise builds
};
export const clearOAuthStorage = () => {
// No-op in non-enterprise builds
};
export const getRefreshState = () => ({
isRefreshing: false,
refreshPromise: null,
});
export const setRefreshState = (_refreshing: boolean, _promise: Promise<any> | null = null) => {
// No-op in non-enterprise builds
};
export const REFRESH_TOKEN_ENDPOINT = "";
// User info type definition (matching enterprise version)
export interface UserInfo {
name?: string;
email?: string;
picture?: string;
preferred_username?: string;
given_name?: string;
family_name?: string;
}
// Fallback getUserInfo that returns null for non-enterprise builds
export const getUserInfo = (): UserInfo | null => null;
// Fallback setUserInfo - no-op
export const setUserInfo = (_userInfo: UserInfo) => {
// No-op in non-enterprise builds
};
// Fallback clearUserInfo - no-op
export const clearUserInfo = () => {
// No-op in non-enterprise builds
};
// Fallback secure storage functions - no-op
export const setSecureItem = async (key: string, value: string): Promise<void> => {
// No-op in non-enterprise builds
};
export const getSecureItem = async (key: string): Promise<string | null> => Promise.resolve(null);
export const removeSecureItem = (key: string): void => {
// No-op in non-enterprise builds
};
export const setSecureLocalItem = async (key: string, value: string): Promise<void> => {
// No-op in non-enterprise builds
};
export const getSecureLocalItem = async (key: string): Promise<string | null> => Promise.resolve(null);
export const removeSecureLocalItem = (key: string): void => {
// No-op in non-enterprise builds
};
export const clearEncryptionKey = (): void => {
// No-op in non-enterprise builds
};