Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions google-drive/utils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { QueryCondition } from "./types.ts";

/**
* Builds a Google Drive API query string from an array of query conditions.
*
*
* @param queries Array of query conditions
* @returns Formatted query string for Google Drive API
*
*
* @example
* ```typescript
* const queries = [
Expand Down Expand Up @@ -63,4 +63,3 @@ export function buildQueryString(queries: QueryCondition[]): string {
return conditionStr;
}).join(" ");
}

38 changes: 19 additions & 19 deletions google-drive/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ export interface QueryCondition {
* The field to filter by (e.g., 'name', 'mimeType', 'trashed')
*/
term: QueryTerm;

/**
* The comparison operator (e.g., '=', 'contains', '>', 'in')
*/
operator: QueryOperator;

/**
* The value to compare against.
* - For strings: use quotes in the value if needed (e.g., 'hello')
Expand All @@ -144,16 +144,16 @@ export interface QueryCondition {
* - For 'has' operator (properties): object like "{ key='dept' and value='sales' }"
*/
value: string;

/**
* How to combine with the next condition.
* - 'and': Both conditions must be true
* - 'or': Either condition must be true
*
*
* Omit for the last condition in the array.
*/
combinator?: QueryCombinator;

/**
* If true, negates this condition with 'not'.
* @default false
Expand All @@ -165,81 +165,81 @@ export interface SearchFilesParams {
/**
* Array of query conditions to filter files.
* Each condition specifies a term, operator, value, and optional combinator.
*
*
* Examples:
* ```typescript
* // Search for non-trashed image files
* queries: [
* { term: "trashed", operator: "=", value: "false", combinator: "and" },
* { term: "mimeType", operator: "contains", value: "image/" }
* ]
*
*
* // Search for files named "hello" or "goodbye"
* queries: [
* { term: "name", operator: "=", value: "hello", combinator: "or" },
* { term: "name", operator: "=", value: "goodbye" }
* ]
*
*
* // Search for Google Docs I own
* queries: [
* { term: "mimeType", operator: "=", value: "application/vnd.google-apps.document", combinator: "and" },
* { term: "owners", operator: "in", value: "me" }
* ]
*
*
* // Search in specific folder
* queries: [
* { term: "parents", operator: "in", value: "FOLDER_ID_HERE" }
* ]
*
*
* // Files modified after date
* queries: [
* { term: "modifiedTime", operator: ">", value: "2024-01-01T12:00:00" }
* ]
* ```
*
*
* @see https://developers.google.com/drive/api/guides/search-files
*/
queries: QueryCondition[];

/**
* Maximum number of files to return per page (1-1000).
* @default 100
*/
pageSize?: number;

/**
* Token for retrieving the next page of results.
*/
pageToken?: string;

/**
* Selector specifying which fields to include in the response.
* @default "nextPageToken, files(id, name, mimeType, modifiedTime, size, webViewLink)"
*/
fields?: string;

/**
* Comma-separated list of spaces to query within.
* Supported values: 'drive', 'appDataFolder', 'photos'
* @default "drive"
*/
spaces?: string;

/**
* Bodies of items (files/documents) to which the query applies.
* Supported values: 'user', 'domain', 'drive', 'allDrives'
* @default "user"
*/
corpora?: string;

/**
* Sort order for the returned files.
* Examples: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime',
* Examples: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime',
* 'name', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', 'viewedByMeTime'
* Add 'desc' suffix for descending order: 'modifiedTime desc'
*/
orderBy?: string;

/**
* Whether to include items from all drives (Team Drives) in results.
* @default false
Expand Down
1 change: 0 additions & 1 deletion hubspot/actions/conversations/archiveThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ export default async function archiveThread(
`/conversations/v3/conversations/threads/${threadId}`,
);
}

1 change: 0 additions & 1 deletion hubspot/actions/conversations/updateThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,3 @@ export default async function updateThread(

return response;
}

3 changes: 2 additions & 1 deletion vtex/loaders/legacy/productListingPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ const loader = async (
? getFlatCategories(vtexFacets.CategoriesTrees)
: {};


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove extra blank line to fix formatting check.

The Deno formatter detected an extra blank line here that should be removed.

Apply this diff to fix the formatting:

-
 const filters = Object.entries({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const filters = Object.entries({
🧰 Tools
🪛 GitHub Actions: ci

[error] 370-371: Deno fmt check failed. Found 1 not formatted file in 2080 files. Run 'deno fmt' to fix formatting.

🤖 Prompt for AI Agents
In vtex/loaders/legacy/productListingPage.ts around line 370, there's an extra
blank line that fails the Deno formatter; remove that blank line so the file has
no consecutive empty lines at that location and re-run the formatter (deno fmt)
to verify formatting passes.

const filters = Object.entries({
Departments: vtexFacets.Departments,
Categories: getCategoryFacets(
Expand All @@ -387,7 +388,7 @@ const loader = async (
term,
filtersBehavior,
props.ignoreCaseSelected,
name === "Categories",
false,
)
)
.flat()
Expand Down
21 changes: 19 additions & 2 deletions vtex/utils/slugify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@ const mapped = JSON.parse(
`{"Á":"A","Ä":"A","Â":"A","À":"A","Ã":"A","Å":"A","Č":"C","Ç":"C","Ć":"C","Ď":"D","É":"E","Ě":"E","Ë":"E","È":"E","Ê":"E","Ẽ":"E","Ĕ":"E","Ȇ":"E","Í":"I","Ì":"I","Î":"I","Ï":"I","Ň":"N","Ñ":"N","Ó":"O","Ö":"O","Ò":"O","Ô":"O","Õ":"O","Ø":"O","Ř":"R","Ŕ":"R","Š":"S","Ť":"T","Ú":"U","Ů":"U","Ü":"U","Ù":"U","Û":"U","Ý":"Y","Ÿ":"Y","Ž":"Z","á":"a","ä":"a","â":"a","à":"a","ã":"a","å":"a","č":"c","ç":"c","ć":"c","ď":"d","é":"e","ě":"e","ë":"e","è":"e","ê":"e","ẽ":"e","ĕ":"e","ȇ":"e","í":"i","ì":"i","î":"i","ï":"i","ň":"n","ñ":"n","ó":"o","ö":"o","ò":"o","ô":"o","õ":"o","ø":"o","ð":"o","ř":"r","ŕ":"r","š":"s","ť":"t","ú":"u","ů":"u","ü":"u","ù":"u","û":"u","ý":"y","ÿ":"y","ž":"z","þ":"b","Þ":"B","Đ":"D","đ":"d","ß":"B","Æ":"A","a":"a"}`,
);

export const slugify = (str: string) =>
str
export const slugify = (str: string) => {
// Check if this looks like a price range (e.g., "de-400-a-799.99")
const isPriceRange = /de-\d+([,.]?\d+)?-a-\d+([,.]?\d+)?/.test(str);

Comment on lines +6 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Anchor the regex to prevent false positives.

The current regex uses .test() without anchors, so it matches if the pattern appears anywhere in the string. For example, "product-name-de-400-a-799-other-text" would incorrectly be treated as a price range.

Apply this diff to anchor the regex:

-  const isPriceRange = /de-\d+([,.]?\d+)?-a-\d+([,.]?\d+)?/.test(str);
+  const isPriceRange = /^de-\d+([,.]?\d+)?-a-\d+([,.]?\d+)?$/.test(str);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Check if this looks like a price range (e.g., "de-400-a-799.99")
const isPriceRange = /de-\d+([,.]?\d+)?-a-\d+([,.]?\d+)?/.test(str);
// Check if this looks like a price range (e.g., "de-400-a-799.99")
const isPriceRange = /^de-\d+([,.]?\d+)?-a-\d+([,.]?\d+)?$/.test(str);
🤖 Prompt for AI Agents
In vtex/utils/slugify.ts around lines 6 to 8, the regex used to detect price
ranges is unanchored and can match substrings anywhere in the input; update the
pattern to anchor it (use ^ and $ or equivalent) so it only matches the entire
string formatted as a price range (e.g., ^de-\d+([,.]?\d+)?-a-\d+([,.]?\d+)?$),
then run tests or sample inputs like "product-de-400-a-799-other" to verify it
no longer yields false positives.

if (isPriceRange) {
// For price ranges, preserve decimal points and only replace other special chars
return str
.replace(/,/g, "")
.replace(/[·/_:]/g, "-") // Remove dot from this regex to preserve decimals
.replace(/[*+~()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-") // Remove dot from this regex too
.split("")
.map((char) => mapped[char] ?? char)
.join("")
.toLowerCase();
Comment on lines +11 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Comma decimals are corrupted.

The regex at Line 7 accepts both comma and dot as decimal separators ([,.]?), but Line 12 removes all commas. This means price ranges with comma decimals (e.g., "de-400-a-799,99") become "de-400-a-79999" instead of "de-400-a-799.99".

Apply this diff to convert comma decimals to dots:

-    return str
-      .replace(/,/g, "")
-      .replace(/[·/_:]/g, "-") // Remove dot from this regex to preserve decimals
+    return str
+      .replace(/,(\d+)/g, ".$1") // Convert comma decimals to dot decimals
+      .replace(/[·/_:]/g, "-")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return str
.replace(/,/g, "")
.replace(/[·/_:]/g, "-") // Remove dot from this regex to preserve decimals
.replace(/[*+~()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-") // Remove dot from this regex too
.split("")
.map((char) => mapped[char] ?? char)
.join("")
.toLowerCase();
return str
.replace(/,(\d+)/g, ".$1") // Convert comma decimals to dot decimals
.replace(/[·/_:]/g, "-")
.replace(/[*+~()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-") // Remove dot from this regex too
.split("")
.map((char) => mapped[char] ?? char)
.join("")
.toLowerCase();
🤖 Prompt for AI Agents
In vtex/utils/slugify.ts around lines 11 to 18, the current chain removes all
commas which corrupts comma-based decimals (e.g. "799,99" -> "79999"); before
removing generic commas, first convert comma decimals to dots by adding a
replacement that turns digit-comma-digit sequences into digit-dot-digit (e.g.
use a regex like /(\d),(\d+)/g -> '$1.$2'), then continue to remove any
remaining stray commas and the other characters as before so "799,99" becomes
"799.99" and then slugified correctly.

}

// Original behavior for non-price strings
return str
.replace(/,/g, "")
.replace(/[·/_,:]/g, "-")
.replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-")
.split("")
.map((char) => mapped[char] ?? char)
.join("")
.toLowerCase();
};
Loading