@ronin/syntax
Advanced tools
Comparing version 0.2.18 to 0.2.19-leo-ron-1099-experimental-130
@@ -8,3 +8,3 @@ import { | ||
setProperty | ||
} from "./chunk-UW2PP5PM.js"; | ||
} from "./chunk-IARRHJ6P.js"; | ||
export { | ||
@@ -11,0 +11,0 @@ getBatchProxy, |
@@ -1,2 +0,2 @@ | ||
import { P as PublicModel, M as ModelIndex, a as ModelField, b as ModelTrigger, G as GetInstructions, W as WithInstruction, S as StoredObject, Q as QUERY_SYMBOLS, c as SyntaxItem } from './index-uBN48F2S.js'; | ||
import { P as PublicModel, M as ModelIndex, a as ModelField, b as ModelTrigger, G as GetInstructions, W as WithInstruction, S as StoredObject, c as SyntaxItem, Q as QUERY_SYMBOLS } from './index-uBN48F2S.js'; | ||
@@ -82,19 +82,2 @@ interface RoninFields { | ||
/** Valid operators for string concatenation */ | ||
type StringOperator = '||'; | ||
/** Valid arithmetic operators for numbers */ | ||
type NumberOperator = '+' | '-' | '*' | '/' | '%'; | ||
/** Valid comparison operators for numbers and strings */ | ||
type ComparisonOperator = '=' | '!=' | '>' | '<' | '>=' | '<='; | ||
/** | ||
* Creates a binary operation expression with type safety for operands. | ||
* | ||
* @param left - The left operand. | ||
* @param operator - The operator to use (string concatenation or arithmetic). | ||
* @param right - The right operand (must match type of left operand). | ||
* | ||
* @returns The formatted binary operation expression. | ||
*/ | ||
declare const op: <T extends string | number | Record<typeof QUERY_SYMBOLS.EXPRESSION, string>>(left: T, operator: NumberOperator | ComparisonOperator | StringOperator, right: T) => T; | ||
/** A utility type that maps an attribute's type to a function signature. */ | ||
@@ -136,3 +119,3 @@ type AttributeSignature<T, Attribute> = T extends boolean ? () => any : Attribute extends keyof Omit<ModelFieldExpressions<T>, 'type' | 'slug'> ? ModelFieldExpressions<T>[Attribute] : never; | ||
* ```ts | ||
* import { model, string } from '@ronin/syntax/schema'; | ||
* import { model, string } from 'ronin/schema'; | ||
* | ||
@@ -168,3 +151,3 @@ * const User = model({ | ||
* ```ts | ||
* import { model, number } from '@ronin/syntax/schema'; | ||
* import { model, number } from 'ronin/schema'; | ||
* | ||
@@ -200,3 +183,3 @@ * const User = model({ | ||
* ```ts | ||
* import { model, link } from '@ronin/syntax/schema'; | ||
* import { model, link } from 'ronin/schema'; | ||
* | ||
@@ -232,3 +215,3 @@ * const User = model({ | ||
* ```ts | ||
* import { model, json } from '@ronin/syntax/schema'; | ||
* import { model, json } from 'ronin/schema'; | ||
* | ||
@@ -263,3 +246,3 @@ * const User = model({ | ||
* ```ts | ||
* import { model, date } from '@ronin/syntax/schema'; | ||
* import { model, date } from 'ronin/schema'; | ||
* | ||
@@ -295,3 +278,3 @@ * const User = model({ | ||
* ```ts | ||
* import { model, boolean } from '@ronin/syntax/schema'; | ||
* import { model, boolean } from 'ronin/schema'; | ||
* | ||
@@ -327,3 +310,3 @@ * const User = model({ | ||
* ```ts | ||
* import { model, blob } from '@ronin/syntax/schema'; | ||
* import { model, blob } from 'ronin/schema'; | ||
* | ||
@@ -354,3 +337,20 @@ * const User = model({ | ||
/** Valid operators for string concatenation */ | ||
type StringOperator = '||'; | ||
/** Valid arithmetic operators for numbers */ | ||
type NumberOperator = '+' | '-' | '*' | '/' | '%'; | ||
/** Valid comparison operators for numbers and strings */ | ||
type ComparisonOperator = '=' | '!=' | '>' | '<' | '>=' | '<='; | ||
/** | ||
* Creates a binary operation expression with type safety for operands. | ||
* | ||
* @param left - The left operand. | ||
* @param operator - The operator to use (string concatenation or arithmetic). | ||
* @param right - The right operand (must match type of left operand). | ||
* | ||
* @returns The formatted binary operation expression. | ||
*/ | ||
declare const op: <T extends string | number | Record<typeof QUERY_SYMBOLS.EXPRESSION, string>>(left: T, operator: NumberOperator | ComparisonOperator | StringOperator, right: T) => T; | ||
/** | ||
* Wraps a raw SQL expression as-is. | ||
@@ -357,0 +357,0 @@ * Use with caution as this bypasses SQL injection protection. |
@@ -5,3 +5,3 @@ import { | ||
getSyntaxProxy | ||
} from "./chunk-UW2PP5PM.js"; | ||
} from "./chunk-IARRHJ6P.js"; | ||
@@ -13,2 +13,19 @@ // src/schema/model.ts | ||
// src/schema/primitives.ts | ||
var primitive = (type) => { | ||
return (initialAttributes = {}) => { | ||
return getSyntaxProxy({ propertyValue: true })({ | ||
...initialAttributes, | ||
type | ||
}); | ||
}; | ||
}; | ||
var string = primitive("string"); | ||
var number = primitive("number"); | ||
var link = primitive("link"); | ||
var json = primitive("json"); | ||
var date = primitive("date"); | ||
var boolean = primitive("boolean"); | ||
var blob = primitive("blob"); | ||
// src/helpers/expressions.ts | ||
@@ -38,19 +55,2 @@ var expression = (expression2) => { | ||
// src/schema/primitives.ts | ||
var primitive = (type) => { | ||
return (initialAttributes = {}) => { | ||
return getSyntaxProxy({ propertyValue: true })({ | ||
...initialAttributes, | ||
type | ||
}); | ||
}; | ||
}; | ||
var string = primitive("string"); | ||
var number = primitive("number"); | ||
var link = primitive("link"); | ||
var json = primitive("json"); | ||
var date = primitive("date"); | ||
var boolean = primitive("boolean"); | ||
var blob = primitive("blob"); | ||
// src/helpers/functions.ts | ||
@@ -57,0 +57,0 @@ var sql = (expressions) => { |
{ | ||
"name": "@ronin/syntax", | ||
"version": "0.2.18", | ||
"version": "0.2.19-leo-ron-1099-experimental-130", | ||
"type": "module", | ||
@@ -27,10 +27,10 @@ "description": "Allows for defining RONIN queries and schemas in code.", | ||
"scripts": { | ||
"lint": "bun run --bun lint:tsc && bun run --bun lint:biome", | ||
"lint:biome": "biome check", | ||
"lint:tsc": "tsc --pretty", | ||
"format": "biome check --write && biome format --write", | ||
"test": "bun test", | ||
"build": "tsup", | ||
"dev": "tsup --watch", | ||
"format": "biome check --write && biome format --write", | ||
"lint:biome": "biome check", | ||
"lint:tsc": "tsc --pretty", | ||
"lint": "bun run --bun lint:tsc && bun run --bun lint:biome", | ||
"prepare": "bun run build", | ||
"test": "bun test" | ||
"prepare": "bun run build" | ||
}, | ||
@@ -37,0 +37,0 @@ "keywords": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
68458
1620
0