make skipMultilineEncoding null|undefined|bool

This commit is contained in:
Maidul Islam
2024-06-11 00:28:55 -04:00
parent 163d33509b
commit e2550d70b5
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ export const SecretsSchema = z.object({
secretCommentTag: z.string().nullable().optional(), secretCommentTag: z.string().nullable().optional(),
secretReminderNote: z.string().nullable().optional(), secretReminderNote: z.string().nullable().optional(),
secretReminderRepeatDays: z.number().nullable().optional(), secretReminderRepeatDays: z.number().nullable().optional(),
skipMultilineEncoding: z.boolean().default(false).optional(), skipMultilineEncoding: z.boolean().default(false).nullable().optional(),
algorithm: z.string().default("aes-256-gcm"), algorithm: z.string().default("aes-256-gcm"),
keyEncoding: z.string().default("utf8"), keyEncoding: z.string().default("utf8"),
metadata: z.unknown().nullable().optional(), metadata: z.unknown().nullable().optional(),
+1 -1
View File
@@ -309,7 +309,7 @@ export const interpolateSecrets = ({ projectId, secretEncKey, secretDAL, folderD
}; };
const expandSecrets = async ( const expandSecrets = async (
secrets: Record<string, { value: string; comment?: string; skipMultilineEncoding?: boolean }> secrets: Record<string, { value: string; comment?: string; skipMultilineEncoding: boolean | null | undefined }>
) => { ) => {
const expandedSec: Record<string, string> = {}; const expandedSec: Record<string, string> = {};
const interpolatedSec: Record<string, string> = {}; const interpolatedSec: Record<string, string> = {};
+11 -3
View File
@@ -976,13 +976,18 @@ export const secretServiceFactory = ({
secretValue: string; secretValue: string;
secretComment?: string; secretComment?: string;
secretPath: string; secretPath: string;
skipMultilineEncoding?: boolean; skipMultilineEncoding: boolean | null | undefined;
}[] }[]
) => { ) => {
// Group secrets by secretPath // Group secrets by secretPath
const secretsByPath: Record< const secretsByPath: Record<
string, string,
{ secretKey: string; secretValue: string; secretComment?: string; skipMultilineEncoding?: boolean }[] {
secretKey: string;
secretValue: string;
secretComment?: string;
skipMultilineEncoding: boolean | null | undefined;
}[]
> = {}; > = {};
secretBatch.forEach((secret) => { secretBatch.forEach((secret) => {
@@ -999,7 +1004,10 @@ export const secretServiceFactory = ({
continue; continue;
} }
const secretRecord: Record<string, { value: string; comment?: string; skipMultilineEncoding?: boolean }> = {}; const secretRecord: Record<
string,
{ value: string; comment?: string; skipMultilineEncoding: boolean | null | undefined }
> = {};
secretsByPath[secPath].forEach((decryptedSecret) => { secretsByPath[secPath].forEach((decryptedSecret) => {
secretRecord[decryptedSecret.secretKey] = { secretRecord[decryptedSecret.secretKey] = {
value: decryptedSecret.secretValue, value: decryptedSecret.secretValue,