Add PR suggestions

This commit is contained in:
carlosmonastyrski
2025-05-06 09:45:44 -03:00
parent 7bbe971a55
commit 2c40507f81
19 changed files with 520 additions and 411 deletions

View File

@@ -30,6 +30,7 @@ export class ApiClient {
if (!config._retryCount) config._retryCount = 0;
// handle rate limits and network errors
if (
(error.response?.status === 429 ||
error.response?.status === undefined) &&

View File

@@ -9,11 +9,7 @@ export class EnvironmentsApi {
): Promise<CreateEnvironmentResponse> {
return this.apiClient.post<CreateEnvironmentResponse>(
`/api/v1/workspace/${data.projectId}/environments`,
{
name: data.name,
slug: data.slug,
position: data.position,
}
data
);
}
}

View File

@@ -21,11 +21,7 @@ export class ProjectsApi {
): Promise<InviteMembersResponse> {
return this.apiClient.post<InviteMembersResponse>(
`/api/v2/workspace/${data.projectId}/memberships`,
{
emails: data.emails,
usernames: data.usernames,
roleSlugs: data.roleSlugs,
}
data
);
}
}

View File

@@ -25,7 +25,7 @@ export class SecretsApi {
const { secretName, ...queryParams } = params;
return this.apiClient.get<GetSecretResponse>(
`/api/v3/secrets/raw/${encodeURIComponent(secretName)}`,
{ params: queryParams }
{ params }
);
}

View File

@@ -87,3 +87,43 @@ export interface RenewLeaseRequest {
export interface RenewLeaseResponse {
lease: Lease;
}
export type CreateDynamicSecretOptions = {
provider: TDynamicSecretProvider;
defaultTTL: string;
maxTTL: string;
name: string;
projectSlug: string;
environmentSlug: string;
path?: string;
metadata?: Record<string, any>;
};
export type DeleteDynamicSecretOptions = {
environmentSlug: string;
projectSlug: string;
path?: string;
isForced?: boolean;
};
export type CreateDynamicSecretLeaseOptions = {
dynamicSecretName: string;
environmentSlug: string;
projectSlug: string;
path?: string;
ttl?: string;
};
export type DeleteDynamicSecretLeaseOptions = {
environmentSlug: string;
projectSlug: string;
path?: string;
isForced?: boolean;
};
export type RenewDynamicSecretLeaseOptions = {
environmentSlug: string;
projectSlug: string;
path?: string;
ttl?: string;
};

View File

@@ -16,5 +16,14 @@ export interface CreateEnvironmentRequest {
}
export type CreateEnvironmentResponse = {
message: string;
workspace: string;
environment: Environment;
};
export type CreateEnvironmentOptions = {
name: string;
projectId: string;
slug: string;
position?: number;
};

View File

@@ -1,12 +1,14 @@
export interface Folder {
id: string;
name: string;
path: string;
workspaceId: string;
environment: string;
envId: string;
description?: string;
createdAt: string;
updatedAt: string;
parentId?: string;
isReserved?: boolean;
lastSecretModified?: string;
version?: number;
}
export interface CreateFolderRequest {
@@ -33,3 +35,18 @@ export interface ListFoldersResponse {
folders: Folder[];
}
export type CreateFolderOptions = {
name: string;
path: string;
projectId: string;
environment: string;
description?: string;
};
export type ListFoldersOptions = {
environment: string;
projectId: string;
path?: string;
recursive?: boolean;
lastSecretModified?: string;
};

View File

@@ -41,3 +41,19 @@ export interface Membership {
export interface InviteMembersResponse {
memberships: Membership[];
}
export type CreateProjectOptions = {
projectName: string;
type: string;
projectDescription?: string;
slug?: string;
template?: string;
kmsKeyId?: string;
};
export type InviteMemberToProjectOptions = {
projectId: string;
emails?: string[];
usernames?: string[];
roleSlugs?: string[];
};

View File

@@ -1,3 +1,5 @@
type SecretType = "shared" | "personal";
export interface Secret {
id: string;
workspaceId: string;
@@ -6,7 +8,21 @@ export interface Secret {
secretValue: string;
secretComment?: string;
secretPath?: string;
type: "shared" | "personal";
secretValueHidden: boolean;
secretReminderNote?: string;
secretReminderRepeatDays?: number;
skipMultilineEncoding?: boolean;
folderId?: string;
actor?: {
actorId?: string;
name?: string;
actorType?: string;
membershipId?: string;
}
isRotatedSecret: boolean;
rotationId?: string;
secretMetadata?: Record<string, any>;
type: SecretType;
createdAt: string;
updatedAt: string;
version: number;
@@ -29,6 +45,8 @@ export interface ListSecretsResponse {
imports?: Array<{
secretPath: string;
secrets: Secret[];
folderId?: string;
environment: string;
}>;
}
@@ -39,7 +57,7 @@ export interface GetSecretRequest {
expandSecretReferences?: string;
includeImports?: string;
secretPath?: string;
type?: "shared" | "personal";
type?: SecretType;
version?: number;
viewSecretValue?: string;
}
@@ -58,7 +76,7 @@ export interface CreateSecretRequest {
secretReminderRepeatDays?: number;
skipMultilineEncoding?: boolean;
tagIds?: string[];
type?: "shared" | "personal";
type?: SecretType;
}
export interface UpdateSecretRequest {
@@ -72,7 +90,7 @@ export interface UpdateSecretRequest {
secretReminderRepeatDays?: number;
skipMultilineEncoding?: boolean;
tagIds?: string[];
type?: "shared" | "personal";
type?: SecretType;
metadata?: Record<string, any>;
}
@@ -80,5 +98,58 @@ export interface DeleteSecretRequest {
workspaceId: string;
environment: string;
secretPath?: string;
type?: "shared" | "personal";
type?: SecretType;
}
export type ListSecretsOptions = {
environment: string;
projectId: string;
expandSecretReferences?: boolean;
includeImports?: boolean;
recursive?: boolean;
secretPath?: string;
tagSlugs?: string[];
viewSecretValue?: boolean;
};
export type GetSecretOptions = {
environment: string;
secretName: string;
expandSecretReferences?: boolean;
includeImports?: boolean;
secretPath?: string;
type?: SecretType;
version?: number;
projectId: string;
viewSecretValue?: boolean;
};
export type BaseSecretOptions = {
environment: string;
projectId: string;
secretComment?: string;
secretPath?: string;
secretReminderNote?: string;
secretReminderRepeatDays?: number;
skipMultilineEncoding?: boolean;
tagIds?: string[];
type?: SecretType;
metadata?: Record<string, any>;
secretMetadata?: Record<string, any>[];
};
export type UpdateSecretOptions = {
secretValue?: string;
newSecretName?: string;
} & BaseSecretOptions;
export type CreateSecretOptions = {
secretValue: string;
} & BaseSecretOptions;
export type DeleteSecretOptions = {
environment: string;
projectId: string;
secretPath?: string;
type?: SecretType;
};