Skip to content
Merged
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
60 changes: 60 additions & 0 deletions templates/cli/lib/commands/push.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ const {
databasesUpdateEnumAttribute,
databasesUpdateRelationshipAttribute,
databasesCreateRelationshipAttribute,
databasesCreatePointAttribute,
databasesUpdatePointAttribute,
databasesCreateLineAttribute,
databasesUpdateLineAttribute,
databasesCreatePolygonAttribute,
databasesUpdatePolygonAttribute,
Comment on lines +46 to +51
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

🧩 Analysis chain

Verify new databases exports exist and match names

Ensure these functions are actually defined and exported from ./databases with the exact identifiers used here (especially “Line” vs “linestring” naming).

Run:


🏁 Script executed:

#!/bin/bash
# Find definitions or exports of the new spatial helpers
rg -nC2 -S --glob '!**/node_modules/**' \
  -e '\b(databases(Create|Update)(Point|Line|Polygon)Attribute)\b' \
  -e 'module\.exports\s*=\s*{[^}]*databases(Create|Update)(Point|Line|Polygon)Attribute' 

Length of output: 306


I'll generate a simplified verification script to search for these functions without the complex regex pattern:


🏁 Script executed:

#!/bin/bash
# Step 1: Find the databases module file
echo "=== Finding databases module ==="
fd -t f 'databases\.(js|ts)' --glob '!**/node_modules/**' | head -20

echo ""
echo "=== Searching for spatial attribute functions ==="
# Search for each function name separately with simpler patterns
rg -n 'databasesCreatePointAttribute|databasesUpdatePointAttribute|databasesCreateLineAttribute|databasesUpdateLineAttribute|databasesCreatePolygonAttribute|databasesUpdatePolygonAttribute' --glob '!**/node_modules/**' -C1

Length of output: 2250



🏁 Script executed:

#!/bin/bash
# Find the import statement to see where these come from
echo "=== Import statement context ==="
rg -n 'databasesCreatePointAttribute|from.*databases' templates/cli/lib/commands/push.js.twig -B5 | head -40

echo ""
echo "=== Looking for databases module in lib/sdks or similar ==="
fd -t f 'databases' --type file | grep -E '\.(js|ts)$' | grep -v node_modules | head -20

echo ""
echo "=== Check for databases exports/definitions ==="
rg -n 'export.*databasesCreatePointAttribute|databasesCreatePointAttribute\s*=|function databasesCreatePointAttribute' --glob '!**/node_modules/**' -A2

Length of output: 622


🏁 Script executed:

#!/bin/bash
# Find the import statement to see where these come from
echo "=== Import statement context ==="
rg -n 'from.*databases|import.*databases' templates/cli/lib/commands/push.js.twig -B2 -A2 | head -50

echo ""
echo "=== Looking for databases module in sdks or sdk/functions ==="
fd 'databases' -type f | grep -E '\.(js|ts)$' | grep -v node_modules

echo ""
echo "=== Check for database spatial attribute function definitions ==="
rg -n 'databasesCreatePointAttribute|databasesCreateLineAttribute|databasesCreatePolygonAttribute' --glob '!**/node_modules/**' -A3

Length of output: 1915


🏁 Script executed:

#!/bin/bash
# Look at the beginning of push.js.twig to find import statements
echo "=== First 60 lines of push.js.twig ==="
head -60 templates/cli/lib/commands/push.js.twig

echo ""
echo "=== Search for where databases imports come from ==="
rg -n '^\s*import|^\s*const.*=.*require|from\s' templates/cli/lib/commands/push.js.twig | head -20

echo ""
echo "=== Look for any files containing these function names as exports ==="
rg -n 'export.*Point|export.*Line|export.*Polygon' --glob '!**/node_modules/**'

Length of output: 4870


🏁 Script executed:

#!/bin/bash
# Find databases.js in the commands directory
echo "=== Looking for databases file in commands directory ==="
ls -la templates/cli/lib/commands/ | grep databases

echo ""
echo "=== Check content of databases.js/twig ==="
if [ -f "templates/cli/lib/commands/databases.js" ]; then
  head -100 templates/cli/lib/commands/databases.js
elif [ -f "templates/cli/lib/commands/databases.js.twig" ]; then
  head -100 templates/cli/lib/commands/databases.js.twig
fi

echo ""
echo "=== Search for the 6 spatial functions in databases file ==="
rg -n 'databasesCreatePointAttribute|databasesUpdatePointAttribute|databasesCreateLineAttribute|databasesUpdateLineAttribute|databasesCreatePolygonAttribute|databasesUpdatePolygonAttribute' templates/cli/lib/commands/databases* -A1

Length of output: 240


🏁 Script executed:

#!/bin/bash
# Broad search for databases files
echo "=== Search for all databases-related files ==="
find . -name '*databases*' -type f | grep -v node_modules | head -20

echo ""
echo "=== Search entire codebase for databasesCreatePointAttribute definition ==="
rg -n 'const databasesCreatePointAttribute|function databasesCreatePointAttribute|databasesCreatePointAttribute\s*=' --glob '!**/node_modules/**'

echo ""
echo "=== Search for module.exports in any databases file ==="
rg -n 'module\.exports|exports\.' --glob '!**/node_modules/**' -g '*databases*'

Length of output: 329


🏁 Script executed:

#!/bin/bash
# List full directory to see what files exist
echo "=== Full contents of templates/cli/lib/commands/ ==="
find templates/cli/lib/commands/ -type f | sort

echo ""
echo "=== Check if there's a databases.js.twig template ==="
find . -name 'databases.js.twig' 2>/dev/null

echo ""
echo "=== Search for any function named databasesCreatePoint anywhere ==="
rg 'databasesCreatePoint' --glob '!**/node_modules/**'

echo ""
echo "=== Check templates directory structure ==="
ls -la templates/cli/lib/

Length of output: 1786


Spatial attribute functions are imported but not exported from databases module

The six spatial functions (databasesCreatePointAttribute, databasesUpdatePointAttribute, databasesCreateLineAttribute, databasesUpdateLineAttribute, databasesCreatePolygonAttribute, databasesUpdatePolygonAttribute) are imported in push.js.twig but do not exist anywhere in the codebase. There is no databases.js.twig template file, and no module exports these functions. The import statement require("./databases") references a module that either doesn't exist or is incomplete. These functions must be defined and exported from a databases module before they can be used in push.js.twig.

🤖 Prompt for AI Agents
In templates/cli/lib/commands/push.js.twig around lines 46 to 51, six spatial
functions are imported from "./databases" but that module does not export them
(and the databases template is missing); implement and export
databasesCreatePointAttribute, databasesUpdatePointAttribute,
databasesCreateLineAttribute, databasesUpdateLineAttribute,
databasesCreatePolygonAttribute, and databasesUpdatePolygonAttribute from the
databases module (create templates/cli/lib/commands/databases.js.twig if
missing) with the expected signatures used by push.js.twig and update the
require path if necessary so push.js.twig imports the module that actually
exports these functions.

databasesDeleteAttribute,
databasesDeleteIndex,
databasesListAttributes,
Expand Down Expand Up @@ -562,6 +568,33 @@ const createAttribute = (databaseId, collectionId, attribute) => {
onDelete: attribute.onDelete,
parseOutput: false
})
case 'point':
return databasesCreatePointAttribute({
databaseId,
collectionId,
key:attribute.key,
required:attribute.required,
xdefault:attribute.default,
parseOutput:false
})
case 'linestring':
return databasesCreateLineAttribute({
databaseId,
collectionId,
key:attribute.key,
required:attribute.required,
xdefault:attribute.default,
parseOutput:false
})
case 'polygon':
return databasesCreatePolygonAttribute({
databaseId,
collectionId,
key:attribute.key,
required:attribute.required,
xdefault:attribute.default,
parseOutput:false
})
default:
throw new Error(`Unsupported attribute type: ${attribute.type}`);
}
Expand Down Expand Up @@ -681,6 +714,33 @@ const updateAttribute = (databaseId, collectionId, attribute) => {
onDelete: attribute.onDelete,
parseOutput: false
})
case 'point':
return databasesUpdatePointAttribute({
databaseId,
collectionId,
key:attribute.key,
required:attribute.required,
xdefault:attribute.default,
parseOutput:false
})
case 'linestring':
return databasesUpdateLineAttribute({
databaseId,
collectionId,
key:attribute.key,
required:attribute.required,
xdefault:attribute.default,
parseOutput:false
})
case 'polygon':
return databasesUpdatePolygonAttribute({
databaseId,
collectionId,
key:attribute.key,
required:attribute.required,
xdefault:attribute.default,
parseOutput:false
})
default:
throw new Error(`Unsupported attribute type: ${attribute.type}`);
}
Expand Down
Loading