mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: greptile review comments
This commit is contained in:
@@ -148,7 +148,7 @@ export const listLaravelForgeServers = async (
|
||||
export const listLaravelForgeSites = async (
|
||||
appConnection: TLaravelForgeConnection,
|
||||
organizationSlug: string,
|
||||
serverId: string
|
||||
serverId: number
|
||||
): Promise<TLaravelForgeSite[]> => {
|
||||
const { credentials } = appConnection;
|
||||
const { apiToken } = credentials;
|
||||
|
||||
@@ -54,7 +54,7 @@ export const laravelForgeConnectionService = (getAppConnection: TGetAppConnectio
|
||||
connectionId: string,
|
||||
actor: OrgServiceActor,
|
||||
organizationSlug: string,
|
||||
serverId: string
|
||||
serverId: number
|
||||
): Promise<TLaravelForgeSite[]> => {
|
||||
const appConnection = await getAppConnection(AppConnection.LaravelForge, connectionId, actor);
|
||||
try {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import RE2 from "re2";
|
||||
import { z } from "zod";
|
||||
|
||||
import { SecretSyncs } from "@app/lib/api-docs";
|
||||
@@ -10,10 +11,25 @@ import {
|
||||
} from "@app/services/secret-sync/secret-sync-schemas";
|
||||
import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
|
||||
|
||||
const slugValidator = (val: string) => {
|
||||
return new RE2("^[a-z0-9.-]+$").test(val) && !new RE2(".[-]$").test(val);
|
||||
};
|
||||
|
||||
const LaravelForgeSyncDestinationConfigSchema = z.object({
|
||||
orgSlug: z.string().min(1, "Org Slug is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.orgSlug),
|
||||
orgSlug: z
|
||||
.string()
|
||||
.min(1, "Org Slug is required")
|
||||
.max(512, "Org Slug cannot exceed 512 characters")
|
||||
.refine(
|
||||
(val) => slugValidator(val),
|
||||
"Org Slug can only contain lowercase letters, numbers, dots, and dashes, and cannot end with a dot or dash."
|
||||
)
|
||||
.describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.orgSlug),
|
||||
orgName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.orgName),
|
||||
serverId: z.string().min(1, "Server ID is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.serverId),
|
||||
serverId: z.coerce
|
||||
.number()
|
||||
.int("Server ID must be a valid integer")
|
||||
.describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.serverId),
|
||||
serverName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.serverName),
|
||||
siteId: z.string().min(1, "Site ID is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.siteId),
|
||||
siteName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.siteName)
|
||||
|
||||
@@ -21,7 +21,7 @@ export type TLaravelForgeSyncWithCredentials = TLaravelForgeSync & {
|
||||
export type TGetLaravelForgeSecrets = {
|
||||
apiToken: string;
|
||||
orgSlug: string;
|
||||
serverId: string;
|
||||
serverId: number;
|
||||
siteId: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ description: "Learn how to configure a Laravel Forge Sync for Infisical."
|
||||
"destinationConfig": {
|
||||
"orgSlug": "org-abc123",
|
||||
"serverId": "server-abc123",
|
||||
"siteId": "site-abc123",
|
||||
"siteId": "site-abc123"
|
||||
}
|
||||
}'
|
||||
```
|
||||
@@ -147,7 +147,7 @@ description: "Learn how to configure a Laravel Forge Sync for Infisical."
|
||||
"destinationConfig": {
|
||||
"orgSlug": "org-abc123",
|
||||
"serverId": "server-abc123",
|
||||
"siteId": "site-abc123",
|
||||
"siteId": "site-abc123"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ const laravelForgeConnectionKeys = {
|
||||
all: [...appConnectionKeys.all, "laravel-forge"] as const,
|
||||
listOrganizations: (connectionId: string) =>
|
||||
[...laravelForgeConnectionKeys.all, "organizations", connectionId] as const,
|
||||
listServers: (connectionId: string, organizationSlug?: string) =>
|
||||
listServers: (connectionId: string, organizationSlug: string) =>
|
||||
[...laravelForgeConnectionKeys.all, "servers", connectionId, organizationSlug] as const,
|
||||
listSites: (connectionId: string, organizationSlug?: string, serverId?: string) =>
|
||||
listSites: (connectionId: string, organizationSlug: string, serverId: number) =>
|
||||
[...laravelForgeConnectionKeys.all, "sites", connectionId, organizationSlug, serverId] as const
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ export const useLaravelForgeConnectionListServers = (
|
||||
return useQuery({
|
||||
queryKey: laravelForgeConnectionKeys.listServers(connectionId, organizationSlug),
|
||||
queryFn: async () => {
|
||||
const params = organizationSlug ? { organizationSlug } : {};
|
||||
const params = { organizationSlug };
|
||||
const { data } = await apiRequest.get<TLaravelForgeServer[]>(
|
||||
`/api/v1/app-connections/laravel-forge/${connectionId}/servers`,
|
||||
{ params }
|
||||
@@ -64,15 +64,15 @@ export const useLaravelForgeConnectionListServers = (
|
||||
|
||||
return data;
|
||||
},
|
||||
enabled: Boolean(connectionId),
|
||||
enabled: Boolean(connectionId && organizationSlug),
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
export const useLaravelForgeConnectionListSites = (
|
||||
connectionId: string,
|
||||
organizationSlug?: string,
|
||||
serverId?: string,
|
||||
organizationSlug: string,
|
||||
serverId: number,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
TLaravelForgeSite[],
|
||||
@@ -86,9 +86,10 @@ export const useLaravelForgeConnectionListSites = (
|
||||
return useQuery({
|
||||
queryKey: laravelForgeConnectionKeys.listSites(connectionId, organizationSlug, serverId),
|
||||
queryFn: async () => {
|
||||
const params: Record<string, string> = {};
|
||||
if (organizationSlug) params.organizationSlug = organizationSlug;
|
||||
if (serverId) params.serverId = serverId;
|
||||
const params = {
|
||||
organizationSlug,
|
||||
serverId
|
||||
};
|
||||
|
||||
const { data } = await apiRequest.get<TLaravelForgeSite[]>(
|
||||
`/api/v1/app-connections/laravel-forge/${connectionId}/sites`,
|
||||
@@ -97,7 +98,7 @@ export const useLaravelForgeConnectionListSites = (
|
||||
|
||||
return data;
|
||||
},
|
||||
enabled: Boolean(connectionId),
|
||||
enabled: Boolean(connectionId && organizationSlug && serverId),
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ export type TLaravelForgeSync = TRootSecretSync & {
|
||||
destinationConfig: {
|
||||
orgSlug: string;
|
||||
orgName: string;
|
||||
serverId: string;
|
||||
serverId: number;
|
||||
serverName: string;
|
||||
siteId: string;
|
||||
siteName: string;
|
||||
|
||||
@@ -10,6 +10,5 @@ type Props = {
|
||||
export const LaravelForgeSyncDestinationCol = ({ secretSync }: Props) => {
|
||||
const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
|
||||
|
||||
console.log({ secretSync });
|
||||
return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user