CHANGES.md
2026-01-19
Fixed - Prevent invalid datetime import in schema.ts generation
- Fixed
templates/liwe3-cloudflare/gen_schema.pyto filter out built-in types from custom type imports- Added
BUILTIN_TYPESset containing all primitive types:str,string,text,int,num,number,float,double,real,bool,boolean,date,datetime,json,obj,object,file,upload - When a field type is incorrectly marked as custom but is actually a built-in type, it is now skipped
- Prevents invalid imports like
import type { datetime } from './types'which don't exist in SQLite - The
datetimetype in SQLite is handled asintegerwith.$type<Date>()annotation, not as a separate import
- Added
2026-01-18
Enhanced - Made created/updated timestamp fields optional in DB schema generation
- Modified
lib/json_to_drizzle.pyandlib/json_to_sql.pyto makecreatedandupdatedtimestamp fields optional instead of automatically added- Removed automatic addition of
createdandupdatedfields to all database types - These fields are now only included when explicitly defined by the user in the flow JSON
- When user defines these fields, they still receive proper auto-update rules:
- Drizzle ORM:
.default( sqlCURRENT_TIMESTAMP) - SQL:
DEFAULT CURRENT_TIMESTAMP(andON UPDATE CURRENT_TIMESTAMPforupdatedfield in MySQL/MariaDB)
- Drizzle ORM:
- This gives users more control over which tables have timestamp tracking
- Backward compatible: existing flow files with
created/updatedfields will continue to work with auto-update behavior
- Removed automatic addition of
2026-01-16
Fixed - liwe3-cloudflare-svelte index.ts f2c block formatting
- Fixed truncated newlines in
f2c_start/f2c_endblocks in generatedindex.ts- The
f2c_endmarker was appearing on the same line as the last line of custom content - Root cause: extracted snippets have trailing whitespace stripped by
template_base.py - Solution: ensure snippet content ends with a newline before writing the
f2c_endmarker - Updated
templates/liwe3-cloudflare-svelte/gen_index.pyto handle this properly
- The
2025-10-28
Enhanced - Added LiWESysParams to Generated Methods
-
Added optional
sysparameter of typeLiWESysParamsto all generated method functions inliwe3-cloudflaretemplate- Updated
templates/liwe3-cloudflare/texts.pyto importLiWESysParamsfrom@backend/liwe3/corein bothMETHOD_UTILS_FILEandMETHOD_FILE_START - Modified
METHOD_FUNCTION_STARTto includesys?: LiWESysParamsas the third optional parameter - This parameter allows passing system-level configuration and context to all generated methods
- Example signature:
export const pet = async ( app: LiWEApp, params: PetParams, sys?: LiWESysParams ): Promise<LiWEResponse<PetResult>>
- Updated
-
Updated
templates/liwe3-nodejs-ng/texts.pyto importLiWESysParamsin methods file- Added
LiWESysParamsto the imports inMETHODS_FILE_START - Modified both
EP_STARTandFUNCTION_STARTtemplates to includesys?: LiWESysParamsparameter - Maintains consistency across all backend templates
- Added
2025-10-27
Enhanced - Cloudflare Template Utils File
- Added f2c code preservation markers to
utils.tsfile generation in theliwe3-cloudflaretemplate- Users can now add custom imports, utilities, and helper functions that will be preserved between regenerations
- Follows the same pattern as method files with
/* f2c_start utils */and/* f2c_end utils */markers - Updated
templates/liwe3-cloudflare/texts.pyto include the snippet placeholder - Updated
templates/liwe3-cloudflare/gen_methods.pyto use snippet extraction mechanism - Default placeholder comment: "Add custom imports or utilities here"
2025-10-04
Added - Cloudflare Workers Template
- Created new
liwe3-cloudflaretemplate for generating Cloudflare Workers compatible code- Based on
liwe3-nodejs-ngtemplate architecture - Uses Hono framework for HTTP routing
- Implements Zod schema validation
- Supports Drizzle ORM for database operations
- Generates complete module structure with tests configuration
- Based on
Template Structure
templates/liwe3-cloudflare/template.py- Main template class extending TemplateBasetemplates/liwe3-cloudflare/texts.py- Template strings for all generated filestemplates/liwe3-cloudflare/gen_index.py- Generates module index with Hono endpointstemplates/liwe3-cloudflare/gen_perms.py- Generates permissions definitionstemplates/liwe3-cloudflare/gen_methods.py- Generates individual method files with Zod validationtemplates/liwe3-cloudflare/gen_schema.py- Generates Drizzle ORM table schemastemplates/liwe3-cloudflare/gen_sql.py- Generates SQLite SQL schema filestemplates/liwe3-cloudflare/gen_config.py- Generates configuration files
Generated Files
-
src/index.ts- Module initialization with Hono endpoint registration- Different templates for GET, POST, PUT, PATCH, DELETE methods
- Error handling for body parsing
- Query parameter handling for GET requests
-
src/perms.ts- Module permissions array- SystemPermission type definitions
- JSDoc documentation
- Proper quote escaping in descriptions
-
src/methods/- Individual method files- Zod schema definitions with validation
- Type inference for parameters and results
- Full JSDoc documentation
- f2c preservation blocks for custom code
- Parameter extraction and validation
-
src/methods/index.ts- Re-exports all methods and types -
src/methods/utils.ts- Common imports (LiWE core, Drizzle ORM, Zod) -
src/methods.ts- Backward compatibility wrapper -
src/schema.ts- Drizzle ORM table definitions- Generated only for types with
coll_tablefield - Includes indexes (unique, multi, array, fulltext)
- JSDoc comments for tables and fields
- Type inference exports
- Generated only for types with
-
sql/{module_name}.sql- SQLite schema file- Table definitions with field comments
- Index creation statements
- Generated only for types with
coll_tablefield
-
package.json- Module package configuration- Workspace dependencies
- TypeScript and Vitest setup
- Build and test scripts
-
tsconfig.json- TypeScript compiler configuration- ES2022 target with ESNext modules
- Bundler module resolution
- Declaration file generation
-
vitest.config.ts- Vitest testing framework configuration- Path aliases for core imports
- Test file patterns
- Coverage reporting
Key Features
-
Zod Integration: Uses
lib/json_to_zod.pyfor schema generation- Custom type resolution from module flow definitions
- Array and optional field support
- String length validation (min/max)
-
Drizzle Integration: Uses
lib/json_to_drizzle.pyfor ORM schemas- Field index flags converted to string format
- Handles missing attributes gracefully
- Type inference support
-
SQL Generation: Uses
lib/json_to_sql.pyfor schema files- SQLite dialect support
- Inline field documentation
- Index creation
-
File Naming: Endpoint paths converted to file names
/user/add→user-add.ts- Path parts joined with dashes
-
Code Preservation: f2c_start/f2c_end blocks for custom code retention
Added - Core Libraries
-
Created
lib/json_to_drizzle.pymodule to convert LiWE Flow JSON type definitions to Drizzle ORM schemas- Maps flow field types to native Drizzle types (boolean, date, timestamp, text, integer, etc.)
- Generates JSDoc comments for tables, fields, and indexes
- Auto-pluralizes table names to lowercase
- Supports all index types (unique, multi, array, fulltext)
- Includes type inference exports
-
Created
tools/json2drizzle.pyCLI tool to convert JSON files to Drizzle schemas- Reads JSON type definition from file
- Outputs formatted Drizzle schema to stdout
- Includes error handling and help documentation
-
Added comprehensive test suite in
tests/test_json_to_drizzle.py- 34 unit tests covering all functionality
- Tests helper functions, main conversion, and edge cases
- Uses
data/user-type.jsonas test fixture
-
Created
CLAUDE.mdwith comprehensive project documentation for Claude Code instances- Core architecture overview
- Template system documentation
- Common commands and workflow
- Flow file format specification
- Key implementation details and conventions
Changed
- Type mappings now use native Drizzle types instead of SQLite-specific conversions
boolean→boolean()(wasinteger())date→date()(wastext())datetime→timestamp()(wastext())- This allows easier database switching and lets Drizzle handle type conversion
Fixed
- Quote escaping in permission descriptions (e.g., "user's tag")
- Custom type resolution in Zod schemas now uses actual type/enum names
- Field attribute handling for
sizeinstead ofmax_length - Index flag conversion from boolean attributes to string format
Metadata
Release files for flow2code 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flow2code-0.3.1.tar.gz | 267.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flow2code-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 698.0 kB
Release files / flow2code-0.3.1.tar.gz
| Download URL | flow2code-0.3.1.tar.gz |
|---|---|
| Size | 267.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5979b14383fe13657b5c321c1c9d1656528690b5babf51a2f5c87120127e605c
|
|
BLAKE2b-256 checksum How to use checksums |
d313d339e61d49bc07bc863f100ecb087a132a6fe679e689334e8ef76fd57ed4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / flow2code-0.3.1-py3-none-any.whl
| Download URL | flow2code-0.3.1-py3-none-any.whl |
|---|---|
| Size | 430.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72627d0305fd65ec14158eee81188e2f65bea3d60a0e322e60809970a9cbb1de
|
|
BLAKE2b-256 checksum How to use checksums |
698b49a0c077dc5d3f84b217016fbc79ba5dbe746470d88f2ee9da4e6e796492
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|