Conversation
- Add extractSnapshotIdFromHost utility to detect environment from URL - Include Base44-Functions-Version header in function calls - Support functionsVersion parameter in client configuration - Automatically route function calls to correct deployment based on URL pattern This ensures backend functions work correctly with app versioning, calling the right deployment for production, preview, and checkpoint environments.
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.7.0-pr.29.7a5b54ePrefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.7.0-pr.29.7a5b54e"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.7.0-pr.29.7a5b54e"
}
}
Preview published to npm registry — try new features instantly! |
|
Claude finished @GabiGrin's task —— View job Pull Request Review: Add backend function versioning supportI've completed my review of this PR. Here's my comprehensive feedback: Review SummaryThis PR adds backend function versioning support by introducing a 🟢 Strengths
🟡 Areas for Improvement1. Missing Test CoverageThe test suite doesn't include any tests for the new versioning functionality:
Recommendation: Add tests similar to this pattern: test("should include Base44-Functions-Version header when functionsVersion is provided", async () => {
const functionsVersion = "v2-snapshot-123";
const versionedClient = createClient({
serverUrl,
appId,
functionsVersion,
});
// Mock and verify the header is sent
scope
.post(`/api/apps/${appId}/functions/testFunction`)
.matchHeader("Base44-Functions-Version", functionsVersion)
.reply(200, { success: true });
await versionedClient.functions.invoke("testFunction", {});
expect(scope.isDone()).toBe(true);
});2. Missing DocumentationThe PR doesn't include updates to documentation or JSDoc comments for the new parameter. Recommendation: Update the JSDoc comment for * @param {string} [config.functionsVersion] - Optional version identifier for function routing🟢 Code QualityThe code quality is excellent:
🟢 PerformanceThe implementation has minimal performance impact:
🟢 SecurityNo security concerns identified:
🔵 Additional Observations
📋 Recommendations
Once test coverage is added, this implementation is solid and ready for production use. The code is clean, follows best practices, and integrates well with the existing SDK architecture. |
Summary
Changes
Base44-Functions-Versionheader in all function callsfunctionsVersionparameter support in client configurationcreateClientFromRequestto extract and pass functions version from headers