Registry / database / stricture

stricture

JSON →
library4.0.2jsnpmunverified

Stricture 4.0.2 is a multi-target data definition language (MicroDDL) compiler that transforms a Markdown-inspired, line-based schema definition into MySQL scripts, Meadow schema files, relationship diagrams (Graphviz), data dictionaries (Markdown, LaTeX, CSV), and test fixtures. Unlike general-purpose schema tools, Stricture is purpose-built for the Meadow application framework and provides first-class support for audit columns, authorization definitions, and PICT UI definitions. The project follows a service-oriented architecture on the Pict/Fable 3.x stack, with both a Commander-based CLI and a programmatic API. Releases are irregular but stable; v3 introduced a major CLI syntax change (migrating from yargs to Commander subcommands).

npm install stricture
INSTALL
IMPORT
SIG · STRICTURE
S
stricture
databasejavascriptv4.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import stricture from 'stricture';
const stricture = require('stricture');
Package is ESM-only since v3. CommonJS not supported.
StrictureCompiler
import { StrictureCompiler } from 'stricture';
import { StrictureCompiler } from './node_modules/stricture/lib/compiler.js';
Named exports available for individual services.
MySQLGenerator
import { MySQLGenerator } from 'stricture';
Generators are exported as named classes. Use with new MySQLGenerator().

Programmatically compile a JSON model and generate MySQL DDL using Stricture's ESM API.

import stricture from 'stricture'; import { MySQLGenerator } from 'stricture'; const sources = [ { 'Name': 'Users', 'Columns': [ { 'Name': 'UserId', 'Type': 'int', 'PrimaryKey': true, 'Identity': true }, { 'Name': 'Username', 'Type': 'varchar(255)', 'Nullable': false }, { 'Name': 'Email', 'Type': 'varchar(255)', 'Nullable': false }, { 'Name': 'CreateDate', 'Type': 'datetime', 'Default': 'now()' } ] }, { 'Name': 'Posts', 'Columns': [ { 'Name': 'PostId', 'Type': 'int', 'PrimaryKey': true, 'Identity': true }, { 'Name': 'UserId', 'Type': 'int', 'ForeignKey': 'Users.UserId' }, { 'Name': 'Title', 'Type': 'varchar(255)', 'Nullable': false }, { 'Name': 'Body', 'Type': 'text', 'Nullable': false } ] } ]; const model = { 'Tables': sources }; const compiler = new stricture.StrictureCompiler(); const compiled = compiler.compile(model); const mysqlGen = new MySQLGenerator(); const sql = mysqlGen.generate(compiled); console.log(sql);
stricture --version
Debug
Known issues
breakingCLI syntax changed in v3: subcommands replaced yargs-style options
fix
Use 'stricture full Model.mddl' instead of 'stricture -i Model.mddl -c Full'
affects: >=3.0.0
breakingPackage is ESM-only since v3. require() will fail with ERR_REQUIRE_ESM
fix
Use import statements or dynamic import(). Add 'type': 'module' to package.json if needed.
affects: >=3.0.0
deprecatedLegacy 'yargs' CLI is removed. Old command-line flags no longer work.
fix
Migrate to subcommand syntax described in v3 migration guide.
affects: >=3.0.0
gotchaCompiler expects source files as .mddl text, not JSON. Passing JSON directly via API bypasses MicroDDL parsing.
fix
Use the programmatic API with model objects if you already have JSON; otherwise ensure input is .mddl.
affects: *
gotchaAudit column detection is case-sensitive. 'CreateDate' is recognized but 'created_at' is not.
fix
Use exact names: CreateDate, UpdateDate, Deleted (case-sensitive).
affects: *
gotchaGenerated MySQL scripts include IF NOT EXISTS by default. No IF EXISTS in DROP statements.
fix
Review generated migration scripts before running on production databases.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/stricture/index.js not supported.
Package is ESM-only since v3, but code uses CommonJS require().
fix
Switch to import statements or use dynamic import() as a fallback.
stricture: error: unknown option `-i'
Using deprecated yargs-style CLI options that were removed in v3.
fix
Use 'stricture full <input.mddl>' syntax instead.
TypeError: stricture.StrictureCompiler is not a constructor
Importing the default export and trying to access .StrictureCompiler, which may not exist or is not a constructor in the version used.
fix
Import named export directly: import { StrictureCompiler } from 'stricture'.
SyntaxError: Unexpected token 'export'
Node.js version < 12, or 'type': 'module' not set in package.json when using import statements.
fix
Use Node >= 14 and set 'type': 'module' in package.json, or use dynamic import().
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
@pict/pictrequiredCore service architecture (Pict/Fable 3.x)
@pict/pict-service-commandlineutilityoptionalCLI command handling via Commander.js
Agent activity
18 hits · last 30 days
node
14
Meta
2
OpenAI (training)
1
Resources
stricture — npm install stricture · libregistry