Scan your whole stack
From OX Research Newsroom
Are you using @shing.wong/sure-factor?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.6.3
@shing.wong/sure-factor was last scanned on 1 Dec 2026 at version 0.6.3. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.6.3 LATEST | 1 Dec 2026 | No rules fired |
| 0.6.2 | 19 Nov 2026 | No rules fired |
| 0.6.1 | 19 Nov 2026 | No rules fired |
| 0.6.0 | 19 Nov 2026 | Not shown |
| 0.5.9 | 19 Nov 2026 | Not shown |
Findings for v0.6.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.6.3; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Database schema → production-grade UI components. A code generation framework that introspects SQL schemas, matches columns to a typed catalog, and generates validated, sanitized, internationalized form UIs at three tiers — vibe, prototype, and production.
import { introspectSchemaFromDdl } from '@shing.wong/sure-factor/introspect'
import { matchColumnToTypeSync, loadAllTypesSync } from '@shing.wong/sure-factor'
import { generateForTier } from '@shing.wong/sure-factor/generate'
const schema = introspectSchemaFromDdl(`CREATE TABLE patients (
id UUID PRIMARY KEY,
email VARCHAR(255) NOT NULL,
full_name VARCHAR(100),
zip VARCHAR(5)
);`)
const output = generateForTier(schema, { tier: 'production', component: 'form' })
// → { routes, template, i18n, styles, validation, sanitization, ... }
| Problem | How sure-factor solves it |
|---|---|
| Forms are repetitive | SQL schema → full form UI in one step. Introspect, match, generate — no hand-written forms. |
| Validation is scattered | Type definitions encode regex, length, and lookup validation per tier. Same validation for vibe (quick) and production (strict). |
| Sanitization is an afterthought | Declarative pipeline per type: [trim, lowercase, normalize(NFKC), slice(0, 254)]. Input and output pipelines are separate. |
| i18n is tedious | Type hints include English, Spanish, and French placeholders, help text, and error messages. Generated forms are multi-language from day one. |
| Code quality varies by stage | Three tiers: vibe (quick regex), prototype (full validation + 2-3 languages), production (lookup datasets + encryption + audit). |
| No standard type catalog | 15 built-in types (email, zip5, icd10, ssn, phone, url, ...) with match rules, validation, sanitization, i18n, and security policies. |
| sure-factor | QuickDBD / dbdiagram | Prisma | Low-Code platforms | |
|---|---|---|---|---|
| SQL schema → UI | ✅ Full pipeline | ❌ Diagram only | ⚠️ Schema only | ❌ Proprietary DSL |
| Type catalog | ✅ 15 types, YAML-defined | ❌ | ⚠️ Native types only | ❌ |
| Tiered generation | ✅ vibe / prototype / production | ❌ | ❌ | ❌ |
| i18n built-in | ✅ en/es/fr per type | ❌ | ❌ | ❌ |
| Sanitization pipeline | ✅ Declarative input + output steps | ❌ | ❌ | ❌ |
| Lookup datasets | ✅ ICD-10, ZIP codes | ❌ | ❌ | ❌ |
| Audio feedback | ✅ Error bell, success chime, voice help | ❌ | ❌ | ❌ |
| Export formats | ✅ HTML + CSS + JS + YAML + JSON + XML | ❌ | ❌ | ❌ |
| Framework | Agnostic (generates HTML/CSS/JS) | ❌ | ❌ | ❌ |
| File size | ~1 MB (catalog + engine) | N/A | ~15 MB | N/A |
┌──────────┐
DDL or SQL ─────▶│introspect│
│DDL→Schema│
└────┬─────┘
│ SchemaInfo
▼
┌──────────┐ ┌─────────────┐
│ match │◀───│catalog/types │
│ col→type │ │15 YAML defs │
└────┬─────┘ └─────────────┘
│ TypeMatchResult
▼
┌──────────┐ ┌────────────────┐
│ generate │◀───│catalog/components│
│ tiered │ │5 templates │
│ output │ └────────────────┘
└────┬─────┘
│ routes, template, i18n, styles,
│ validation, sanitization, scripts
▼
┌──────────┐
│ format │
│(Prettier)│
└──────────┘
Three phases:
information_schema → SchemaInfo (tables, columns, types, constraints, foreign keys)TypeMatchResult with confidence scoringnpm install @shing.wong/sure-factor
No peer dependencies. pg and prettier are regular dependencies, so live
schema introspection and code formatting work without extra setup.
Requires Node >= 20.
import { introspectSchemaFromDdl } from '@shing.wong/sure-factor/introspect'
import { loadAllTypesSync, matchColumnToTypeSync } from '@shing.wong/sure-factor'
import { generateForTier } from '@shing.wong/sure-factor/generate'
import { generateStore } from '@shing.wong/sure-factor/generate-store'
import { sanitize } from '@shing.wong/sure-factor/sanitize'
import { convert } from '@shing.wong/sure-factor/serialize'
// 1. Introspect — parse DDL into typed schema
const schema = introspectSchemaFromDdl(`
CREATE TABLE patients (
id UUID PRIMARY KEY,
email VARCHAR(255) NOT NULL,
full_name VARCHAR(100) NOT NULL,
diagnosis VARCHAR(8),
zip VARCHAR(5)
);
`)
// …or introspect a live database (the `pg` driver ships as a dependency):
// import { introspectSchema } from '@shing.wong/sure-factor'
// const live = await introspectSchema(process.env.DATABASE_URL!, ['public'])
// 2. Match — match columns to catalog types
const allTypes = loadAllTypesSync()
const emailCol = schema.tables[0]!.columns.find(c => c.columnName === 'email')!
const result = matchColumnToTypeSync(emailCol, allTypes)
// → { type: { name: 'email', confidence: 1 }, confidence: 1 }
// 3. Generate — produce tiered UI output
const output = generateForTier(schema, { tier: 'production', component: 'form' })
// → {
// routes: "app.post('/patients', ...)",
// template: "<form class='sure-form'>...",
// i18n: { email_placeholder: 'user@example.com', ... },
// styles: "@layer sure.tokens, ... sure-ui compose [form, buttons]...",
// notifications: "…showNotification() runtime… | null (inline-only)",
// validation: "z.string().regex(/^[a-zA-Z0-9.../).max(254)",
// sanitization: "[trim, lowercase, normalize(NFKC), ...]"
// }
// 4. Generate a sure-state store
const store = generateStore({
tableName: 'patients',
columns: schema.tables[0]!.columns,
tier: 'production',
})
// → { interfaceCode, apiCode, storeCode, fullCode }
// 5. Sanitize input
sanitize(' user@Example.COM ', ['trim', 'lowercase', 'normalize(NFKC)'])
// → 'user@example.com'
// 6. Serialize between formats
convert(yamlString, 'yaml', 'json') // YAML → JSON
convert(jsonString, 'json', 'md') // JSON → Markdown
15 built-in type definitions in catalog/types/:
| Type | Match patterns | Validation | Sanitization | Security |
|---|---|---|---|---|
email |
%email%, %mail% |
RFC 5322 regex | trim, lowercase, normalize(NFKC) | Unicode normalization |
zip5 |
%zip%, %postal% |
^\d{5}$ |
stripNonDigits, slice(5) | — |
zip9 |
%zip9%, %zip+4% |
^\d{5}-\d{4}$ |
format to 5+4 | — |
ssn |
%ssn%, %social% |
^\d{3}-\d{2}-\d{4}$ |
stripNonDigits, format | Encrypt at rest |
ein |
%ein% |
^\d{2}-\d{7}$ |
stripNonDigits, format | Encrypt at rest |
full-name |
%name%, %full_name% |
2-100 chars | collapseWhitespace, title case | — |
icd10 |
%diagnosis%, %icd%, %code% |
^[A-Z]\d{2}\.\d{1,2}$ |
uppercase | Lookup dataset |
intl-phone |
%phone% |
E.164 | stripNonDigits | — |
us-phone |
%phone% with US hint |
^\d{10}$ |
format (XXX) XXX-XXXX | — |
us-address |
%address%, %street% |
Multi-line | collapseWhitespace | — |
date-iso |
%date%, %created% |
ISO 8601 | trim | — |
date-us |
%date% with US hint |
MM/DD/YYYY | format | — |
password |
%password%, %pwd% |
8+ chars, complexity | N/A (hash server-side) | Bcrypt |
credit-card |
%card%, %cc% |
Luhn check | stripNonDigits | Encrypt at rest |
url |
%url%, %website% |
URL regex | trim, lowercase | — |
# catalog/types/email.yaml
name: email
description: Email address conforming to RFC 5322
match:
sql: column_name LIKE '%email%' OR column_name LIKE '%mail%'
regex: ^[^@]+@[^@]+\.[^@]+$
maxLength: 254
validation:
regex: ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
maxLength: 254
sanitize:
input: [trim, lowercase, normalize(NFKC), slice(0, 254)]
output: [htmlEscape]
hints:
en: { placeholder: 'user@example.com', help: 'Email address' }
es: { placeholder: 'usuario@example.com', help: 'Dirección de correo' }
fr: { placeholder: 'utilisateur@example.com', help: 'Adresse e-mail' }
tiers:
vibe:
validation: { regex: ^[^@]+@[^@]+\.[^@]+$ }
sanitize: [trim, lowercase]
prototype:
validation: { regex: [full RFC], maxLength: 254 }
sanitize: [trim, lowercase, normalize(NFKC), slice(254)]
hints: { en, es }
production:
validation: { regex: [full RFC], maxLength: 254, lookup: null }
sanitize: [trim, lowercase, normalize(NFKC), slice(254)]
hints: { en, es, fr }
security:
encrypt: false
notes:
- 'Normalize Unicode NFKC to prevent homoglyph attacks'
- 'Lowercase to ensure case-insensitive matching'
5 component templates in catalog/components/:
| Component | Description | Notification Modes | CSS Classes |
|---|---|---|---|
form |
Single-column create/edit form | inline, toast, statusBar, sidePanel | .sure-form__* |
form-modal |
Modal dialog form | inline, toast, statusBar | .sure-modal__* |
data-table |
Read-only data table | toast | .sure-table__* |
crud-resource |
Full CRUD with table + modal | inline, toast, statusBar, sidePanel | .sure-crud__* |
search-filter |
Search with filter controls | inline, toast | .sure-search__* |
generateForTier generates one table per call. For a multi-table schema,
pass tableName (or its resource alias) and call it once per table:
for (const table of schema.tables) {
const output = generateForTier(schema, {
tier: 'production', component: 'form', tableName: table.tableName,
})
}
Fields, routes, i18n, validation and sanitisation are all scoped to that table; unrelated tables are never flattened into one form. When the option is omitted the first table in the schema is used — the table the routes already targeted — so single-table callers are unchanged. An unknown table name fails loudly.
Template shape follows the catalog entry: form components keep the htmx/express
<form> with hx-post, data-table emits a real <table> (thead/tbody,
.sure-table__* cells bound to {{#each rows}}), and document parts emit their
own markup. Class names always come from the entry's cssClasses.
horizontal-icon-menu is application chrome, so its items come from the caller.
An item may carry a display-only shortcut, such as Ctrl+Shift+C. The
generated menu puts the same name on both title and aria-label, using the
fixed form "<Description> (<Shortcut>)":
const nav = renderMenu({
items: [{ id: 'copy', label: 'Copy', title: 'Copy Output', shortcut: 'Ctrl+Shift+C', onClick }],
})
// tooltip and accessible name: "Copy Output (Ctrl+Shift+C)"
shortcut is shown, never parsed: it binds no key. The name is rebuilt live
with setMenuShortcut(root, id, shortcut) (pass null to clear); a badge
change through setMenuBadge(root, id, count) keeps the shortcut, and the
combined form is "<Description> (<Shortcut>) (<N> new)".
A catalog entry may describe a document part instead of a form. Five optional
keys extend CatalogComponent for this; they are data, not a second registry
(the entries themselves live in sure-store/components/):
| Key | Shape | Purpose |
|---|---|---|
family |
structure \| data \| figure |
which part of a document this is |
data |
{ entity?, projection?, shape? } |
store name, the closed set of column names, and shape (record \| rows \| series \| none \| derived) |
print |
{ keepTogether?, breakBefore?, repeatHeader?, … } |
the three checked booleans; other print declarations pass through to sure-document |
guards |
string[] |
expressions to verify at render time |
fixture |
{ input?, expect? } |
seeded, synthetic input and the facts its output must hold |
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.