diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..1c2fda5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/api-toolkit.iml b/.idea/api-toolkit.iml new file mode 100644 index 0000000..18ec59d --- /dev/null +++ b/.idea/api-toolkit.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/cody_history.xml b/.idea/cody_history.xml new file mode 100644 index 0000000..a49a497 --- /dev/null +++ b/.idea/cody_history.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + </llm> + </llm> + </chat> + <chat> + <internalId value="26ad18d5-3f5e-42d2-9064-272e6eaf958a" /> + <llm> + <llm> + <model value="anthropic/claude-3-sonnet-20240229" /> + <provider value="Anthropic" /> + <title value="Claude 3 Sonnet" /> + </llm> + </llm> + </chat> + </list> + </chats> + <defaultLlm> + <llm> + <model value="anthropic/claude-3-sonnet-20240229" /> + <provider value="Anthropic" /> + <title value="Claude 3 Sonnet" /> + </llm> + </defaultLlm> + </AccountData> + </list> + </accountData> + </component> +</project> \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" /> + </profile> +</component> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9715c22 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8724181 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/api-toolkit.iml" filepath="$PROJECT_DIR$/.idea/api-toolkit.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c8397c9 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/src/helpers/values.ts b/src/helpers/values.ts index cc1a34e..7b8a22e 100644 --- a/src/helpers/values.ts +++ b/src/helpers/values.ts @@ -43,7 +43,7 @@ export function parseBoolean(val: string | undefined | null): boolean { case 'no': return false; default: - throw new Error(`Cannot parse boolean from "${val}"`); + throw new Error(`Cannot parse boolean`); } } @@ -64,10 +64,10 @@ export function hexToBuffer(hex: string): Buffer { return Buffer.alloc(0); } if (!hex.startsWith('0x')) { - throw new Error(`Hex string is missing the "0x" prefix: "${hex}"`); + throw new Error(`Hex string is missing the "0x" prefix`); } if (hex.length % 2 !== 0) { - throw new Error(`Hex string is an odd number of digits: ${hex}`); + throw new Error(`Hex string is an odd number of digits`); } return Buffer.from(hex.substring(2), 'hex'); } @@ -82,10 +82,10 @@ export function coerceToBuffer(hex: string | Buffer | ArrayBufferView): Buffer { hex = hex.substring(2); } if (hex.length % 2 !== 0) { - throw new Error(`Hex string is an odd number of characters: ${hex}`); + throw new Error(`Hex string is an odd number of characters`); } if (!/^[0-9a-fA-F]*$/.test(hex)) { - throw new Error(`Hex string contains non-hexadecimal characters: ${hex}`); + throw new Error(`Hex string contains non-hexadecimal characters`); } return Buffer.from(hex, 'hex'); } else if (Buffer.isBuffer(hex)) { diff --git a/src/postgres/types.ts b/src/postgres/types.ts index 8decdad..4492275 100644 --- a/src/postgres/types.ts +++ b/src/postgres/types.ts @@ -11,7 +11,7 @@ export const PG_TYPE_MAPPINGS = { if (/^(0x|0X)[a-fA-F0-9]*$/.test(x)) { // hex string with "0x" prefix if (x.length % 2 !== 0) { - throw new Error(`Hex string is an odd number of digits: "${x}"`); + throw new Error(`Hex string is an odd number of digits`); } return '\\x' + x.slice(2); } else if (x.length === 0) { @@ -19,11 +19,11 @@ export const PG_TYPE_MAPPINGS = { } else if (/^\\x[a-fA-F0-9]*$/.test(x)) { // hex string with "\x" prefix (already encoded for postgres) if (x.length % 2 !== 0) { - throw new Error(`Hex string is an odd number of digits: "${x}"`); + throw new Error(`Hex string is an odd number of digits`); } return x; } else { - throw new Error(`String value for bytea column does not have 0x prefix: "${x}"`); + throw new Error(`String value for bytea column does not have 0x prefix`); } } else if (Buffer.isBuffer(x)) { return '\\x' + x.toString('hex');