
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
sqon-parser
Advanced tools
Structured Queue Object Notation. New Database format (Readable & Supports Binary, Date & Bigint), (Inbuilt Schema & constraints).
SQON (Structured Queue Object Notation) is a structured data format that combines schema definitions, validation rules, and records. It ensures data consistency with strict mode, enforcing type restrictions and validation rules.
Check logs to know what's new in the new version
**SQON** is a structured data format that combines schema definitions, validation rules, and records. It supports strict mode, which ensures data consistency by enforcing type restrictions and validation rules.
A SQON file includes:
Each section is marked by specific tags (`@schema`, `@validations`, and `@records`) and closed with `@end`.
*STRICT=TRUE/FALSE
)The strict mode setting, located at the top of the file, controls whether records must strictly adhere to the schema and validation rules.
STRICT=TRUE
@schema
)The schema section defines the fields and their data types. When `STRICT=TRUE`, fields must have a single, precise data type. With `STRICT=FALSE`, fields can accept multiple types (e.g., `String | Number`).
@schema
username -> String
age -> Number
createdDate -> Date
preferences -> Object
tags -> StringArray
@end
@validations
)The validation section specifies rules for each field to ensure data integrity. These rules might include constraints like `required`, `minLength`, or `isDate`.
@validations
username -> required=true; minLength=3
age -> required=true; min=18; max=120
createdDate -> isDate=true
tags -> minLength=1; maxLength=10
@end
@records
)The records section contains actual data entries. Each record is prefixed with a unique document number (`#0`, `#1`, etc.). These entries represent real data and follow the schema and validation rules.
@records
#0 -> username("JohnDoe"); age(30); createdDate(1993-07-16T00:00:00Z); preferences{ theme: "dark" }; tags[ _0("friend"); _1("coworker") ];
#1 -> username("JaneSmith"); age(25); createdDate(1998-04-22T00:00:00Z); preferences{}; tags[ _0("family") ];
@end
**Document Numbers**: Each record is identified by a unique document number (`#0`, `#1`, `#2`), which allows for easy reference, error tracking, and quick lookup.
**Indexed Arrays**: Arrays are indexed with unique keys (e.g., `_0`, `_1`), which provides clarity and structure for managing array elements.
You can find usage examples in the `example` folder of the installed package. See:
This example demonstrates:
import { Validator, ValidateParams, ValidationResult, SchemaDefinition, ValidationRules } from './Validator';
// Example Schema Definition const schema: Record<string, SchemaDefinition> = { username: { type: ['String'] }, age: { type: ['Number'] }, birthdate: { type: ['Date'] }, isVerified: { type: ['Boolean'] }, friends: { type: ['StringArray'] }, preferences: { type: ['Object'], properties: { theme: { type: ['String'] }, notifications: { type: ['Boolean'] } } }, activities: { type: ['ObjectArray'], items: { type: ['Object'], properties: { activityName: { type: ['String'] }, duration: { type: ['Number'] } } } } };
// Example Validation Rules const validations: Record<string, ValidationRules> = { username: { rules: { required: true, minLength: 3 } }, age: { rules: { required: true, min: 18, max: 120 } }, birthdate: { rules: { isDate: true } }, isVerified: { rules: { required: true } }, friends: { rules: { minLength: 1, maxLength: 5 } }, preferences: { rules: { maxLength: 10, required: true }, theme: { rules: { required: true, minLength: 3 } }, notifications: { rules: { required: true } } }, activities: { rules: { minLength: 1, maxLength: 10, required: true, isUnique: true }, activityName: { rules: { required: true, minLength: 3 } }, duration: { rules: { required: true, min: 1 } } } };
const data = { username: "Alice", age: 30, birthdate: "1993-05-20T00:00:00Z", isVerified: true, friends: ["Bob", "Charlie"], preferences: { theme: "dark", notifications: true }, activities: [{ activityName: "Running", duration: 60 }, { activityName: "Swimming", duration: 45 }] };
async function validateSQONEntry({ schema, validateData, data, strict = true }: ValidateParams): Promise { const validator = new Validator(); return await validator.validate({ schema, validateData, data, strict }); }
validateSQONEntry({ schema
, validateData: validations, data, strict: true }).then(result => { if (result.valid) { console.log("Data is valid."); } else { console.log("Validation failed:", result.errors); } });
This format is useful in applications where structured data with flexible types, validation, and indexed array elements are needed. SQON enhances both readability and data management, making it a powerful choice for structured, validated data storage.
FAQs
Structured Queue Object Notation. New Database format (Readable & Supports Binary, Date & Bigint), (Inbuilt Schema & constraints).
The npm package sqon-parser receives a total of 0 weekly downloads. As such, sqon-parser popularity was classified as not popular.
We found that sqon-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.