@ronin/syntax
Advanced tools
Comparing version 0.2.5-corny-ron-1099-experimental-63 to 0.2.5-corny-ron-1099-experimental-64
@@ -1,1 +0,1 @@ | ||
export { c as PromiseTuple, S as SyntaxItem, d as getBatchProxy, e as getProperty, g as getSyntaxProxy, s as setProperty } from './queries-ygz2NG9G.js'; | ||
export { c as PromiseTuple, S as SyntaxItem, d as getBatchProxy, e as getProperty, g as getSyntaxProxy, s as setProperty } from './queries-hEG0GOi0.js'; |
@@ -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 SyntaxItem } from './queries-ygz2NG9G.js'; | ||
import { P as PublicModel, M as ModelIndex, a as ModelField, b as ModelTrigger, G as GetInstructions, W as WithInstruction, S as SyntaxItem } from './queries-hEG0GOi0.js'; | ||
@@ -73,4 +73,12 @@ interface RoninFields { | ||
type ModelFieldExpression = Omit<ModelField, 'check' | 'computedAs' | 'defaultValue'> & { | ||
check?: (fields: Record<string, string>) => string; | ||
computedAs?: { | ||
kind: 'VIRTUAL' | 'STORED'; | ||
value: (fields: Record<string, string>) => string; | ||
}; | ||
defaultValue?: (fields: Record<string, string>) => string; | ||
}; | ||
/** A utility type that maps an attribute's type to a function signature. */ | ||
type AttributeSignature<T, Attribute> = T extends boolean ? () => any : Attribute extends keyof Omit<ModelField, 'type' | 'slug'> ? (value: ModelField[Attribute]) => any : never; | ||
type AttributeSignature<T, Attribute> = T extends boolean ? () => any : Attribute extends keyof Omit<ModelFieldExpression, 'type' | 'slug'> ? (value: ModelFieldExpression[Attribute]) => any : never; | ||
/** | ||
@@ -90,6 +98,9 @@ * Represents a chain of field attributes in the form of a function chain. | ||
} : {}); | ||
type FieldOutput<Type extends ModelField['type']> = Omit<Extract<ModelField, { | ||
type FieldInput<Type> = Partial<Omit<Extract<ModelFieldExpression, { | ||
type: Type; | ||
}>, 'slug' | 'type'>>; | ||
type FieldOutput<Type extends ModelFieldExpression['type']> = Omit<Extract<ModelFieldExpression, { | ||
type: Type; | ||
}>, 'slug'>; | ||
type SyntaxField<Type extends ModelField['type']> = SyntaxItem<FieldOutput<Type>>; | ||
type SyntaxField<Type extends ModelFieldExpression['type']> = SyntaxItem<FieldOutput<Type>>; | ||
/** | ||
@@ -103,30 +114,3 @@ * Creates a string field definition returning an object that includes the field type | ||
*/ | ||
declare const string: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "string"; | ||
collation?: "BINARY" | "NOCASE" | "RTRIM"; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"string">, never>; | ||
declare const string: (initialAttributes?: FieldInput<"string">) => Chain<FieldOutput<"string">>; | ||
/** | ||
@@ -140,30 +124,3 @@ * Creates a number field definition returning an object that includes the field type | ||
*/ | ||
declare const number: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "number"; | ||
increment?: boolean; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"number">, never>; | ||
declare const number: (initialAttributes?: FieldInput<"number">) => Chain<FieldOutput<"number">>; | ||
/** | ||
@@ -177,35 +134,3 @@ * Creates a link field definition returning an object that includes the field type | ||
*/ | ||
declare const link: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "link"; | ||
target: string; | ||
kind?: "one" | "many"; | ||
actions?: { | ||
onDelete?: "CASCADE" | "RESTRICT" | "SET NULL" | "SET DEFAULT" | "NO ACTION"; | ||
onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL" | "SET DEFAULT" | "NO ACTION"; | ||
}; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"link">, never>; | ||
declare const link: (initialAttributes?: FieldInput<"link">) => Chain<FieldOutput<"link">>; | ||
/** | ||
@@ -219,29 +144,3 @@ * Creates a JSON field definition returning an object that includes the field type | ||
*/ | ||
declare const json: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "json"; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"json">, never>; | ||
declare const json: (initialAttributes?: FieldInput<"json">) => Chain<FieldOutput<"json">>; | ||
/** | ||
@@ -255,29 +154,3 @@ * Creates a date field definition returning an object that includes the field type | ||
*/ | ||
declare const date: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "date"; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"date">, never>; | ||
declare const date: (initialAttributes?: FieldInput<"date">) => Chain<FieldOutput<"date">>; | ||
/** | ||
@@ -291,29 +164,3 @@ * Creates a boolean field definition returning an object that includes the field type | ||
*/ | ||
declare const boolean: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "boolean"; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"boolean">, never>; | ||
declare const boolean: (initialAttributes?: FieldInput<"boolean">) => Chain<FieldOutput<"boolean">>; | ||
/** | ||
@@ -327,30 +174,4 @@ * Creates a blob field definition returning an object that includes the field type | ||
*/ | ||
declare const blob: (initialAttributes?: Partial<Omit<{ | ||
name?: string; | ||
slug: string; | ||
displayAs?: string; | ||
unique?: boolean; | ||
required?: boolean; | ||
defaultValue?: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | (() => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
computedAs?: { | ||
kind: "VIRTUAL" | "STORED"; | ||
value: { | ||
__RONIN_EXPRESSION: string; | ||
} | unknown | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
}; | ||
check?: { | ||
__RONIN_EXPRESSION: string; | ||
} | ((fields: Record<string, unknown>) => { | ||
__RONIN_EXPRESSION: string; | ||
}); | ||
} & { | ||
type: "blob"; | ||
}, "type" | "slug">>) => Chain<FieldOutput<"blob">, never>; | ||
declare const blob: (initialAttributes?: FieldInput<"blob">) => Chain<FieldOutput<"blob">>; | ||
export { type Chain, type FieldOutput, type SyntaxField, blob, boolean, date, json, link, model, number, string }; | ||
export { type Chain, type FieldOutput, type ModelFieldExpression, type SyntaxField, blob, boolean, date, json, link, model, number, string }; |
{ | ||
"name": "@ronin/syntax", | ||
"version": "0.2.5-corny-ron-1099-experimental-63", | ||
"version": "0.2.5-corny-ron-1099-experimental-64", | ||
"type": "module", | ||
@@ -44,3 +44,3 @@ "description": "Allows for defining RONIN queries and schemas in code.", | ||
"@biomejs/biome": "1.9.4", | ||
"@ronin/compiler": "0.14.6-corny-ron-1099-experimental-331", | ||
"@ronin/compiler": "0.14.6", | ||
"@types/bun": "1.1.16", | ||
@@ -47,0 +47,0 @@ "tsup": "8.3.5", |
48478
1001