@ronin/compiler
Advanced tools
Comparing version 0.17.0 to 0.17.1
@@ -264,3 +264,3 @@ /** | ||
}); | ||
type ModelIndexField<T extends Array<ModelField> = Array<ModelField>> = { | ||
type ModelIndexField<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> = { | ||
/** The collating sequence used for text placed inside the field. */ | ||
@@ -272,3 +272,3 @@ collation?: ModelFieldCollation; | ||
/** The field slug for which the index should be created. */ | ||
slug: T[number]['slug']; | ||
slug: keyof T; | ||
} | { | ||
@@ -278,3 +278,3 @@ /** The field expression for which the index should be created. */ | ||
}); | ||
type ModelIndex<T extends Array<ModelField> = Array<ModelField>> = { | ||
type ModelIndex<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> = { | ||
/** | ||
@@ -287,3 +287,3 @@ * The list of fields in the model for which the index should be created. | ||
*/ | ||
slug?: string; | ||
slug: string; | ||
/** | ||
@@ -299,3 +299,3 @@ * Whether only one record with a unique value for the provided fields will be allowed. | ||
}; | ||
type ModelTriggerField<T extends Array<ModelField> = Array<ModelField>> = { | ||
type ModelTriggerField<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> = { | ||
/** | ||
@@ -305,9 +305,7 @@ * The slug of the field that should cause the trigger to fire if the value of the | ||
*/ | ||
slug: T[number]['slug']; | ||
slug: keyof T; | ||
}; | ||
type ModelTrigger<T extends Array<ModelField> = Array<ModelField>> = { | ||
/** | ||
* The identifier of the trigger. | ||
*/ | ||
slug?: string; | ||
type ModelTrigger<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> = { | ||
/** The identifier of the trigger. */ | ||
slug: string; | ||
/** The type of query for which the trigger should fire. */ | ||
@@ -333,3 +331,6 @@ action: 'INSERT' | 'UPDATE' | 'DELETE'; | ||
}; | ||
interface Model<T extends Array<ModelField> = Array<ModelField>> { | ||
type ModelEntityList<T extends { | ||
slug: string; | ||
}> = Record<NonNullable<T['slug']>, Partial<T>>; | ||
interface Model<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> { | ||
id: string; | ||
@@ -341,4 +342,4 @@ name: string; | ||
identifiers: { | ||
name: T[number]['slug']; | ||
slug: T[number]['slug']; | ||
name: keyof T; | ||
slug: keyof T; | ||
}; | ||
@@ -368,7 +369,7 @@ idPrefix: string; | ||
fields: T; | ||
indexes?: Array<ModelIndex<T>>; | ||
triggers?: Array<ModelTrigger<T>>; | ||
presets?: Array<ModelPreset>; | ||
indexes?: ModelEntityList<ModelIndex<T>>; | ||
triggers?: ModelEntityList<ModelTrigger<T>>; | ||
presets?: ModelEntityList<ModelPreset>; | ||
} | ||
type PublicModel<T extends Array<ModelField> = Array<ModelField>> = Omit<Partial<Model<T>>, 'slug' | 'identifiers' | 'system' | 'tableAlias'> & { | ||
type PublicModel<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> = Omit<Partial<Model<T>>, 'slug' | 'identifiers' | 'system' | 'tableAlias'> & { | ||
slug: Required<Model['slug']>; | ||
@@ -375,0 +376,0 @@ identifiers?: Partial<Model['identifiers']>; |
{ | ||
"name": "@ronin/compiler", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Compiles RONIN queries to SQL statements.", |
Sorry, the diff of this file is too big to display
116440
2700