@ronin/compiler 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +15 -15
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -5880,23 +5880,23 @@ type ModelFieldReference = ModelFieldBasics & {
5880
5880
  };
5881
5881
  };
5882
5882
  type ModelField = ModelFieldNormal | ModelFieldReference;
5883
- type ModelIndexField = {
5883
+ type ModelIndexField<T extends Array<ModelField> = Array<ModelField>> = {
5884
5884
  /** The collating sequence used for text placed inside the field. */
5885
5885
  collation?: ModelFieldCollation;
5886
5886
  /** How the records in the index should be ordered. */
5887
5887
  order?: 'ASC' | 'DESC';
5888
5888
  } & ({
5889
5889
  /** The field slug for which the index should be created. */
5890
- slug: string;
5890
+ slug: T[number]['slug'];
5891
5891
  } | {
5892
5892
  /** The field expression for which the index should be created. */
5893
5893
  expression: string;
5894
5894
  });
5895
- type ModelIndex = {
5895
+ type ModelIndex<T extends Array<ModelField> = Array<ModelField>> = {
5896
5896
  /**
5897
5897
  * The list of fields in the model for which the index should be created.
5898
5898
  */
5899
- fields: Array<ModelIndexField>;
5899
+ fields: Array<ModelIndexField<T>>;
5900
5900
  /**
5901
5901
  * The identifier of the index.
5902
5902
  */
@@ -5911,14 +5911,14 @@ type ModelIndex = {
5911
5911
  */
5912
5912
  filter?: WithInstruction;
5913
5913
  };
5914
- type ModelTriggerField = {
5914
+ type ModelTriggerField<T extends Array<ModelField> = Array<ModelField>> = {
5915
5915
  /**
5916
5916
  * The slug of the field that should cause the trigger to fire if the value of the
5917
5917
  * field has changed.
5918
5918
  */
5919
- slug: string;
5919
+ slug: T[number]['slug'];
5920
5920
  };
5921
- type ModelTrigger = {
5921
+ type ModelTrigger<T extends Array<ModelField> = Array<ModelField>> = {
5922
5922
  /** The type of query for which the trigger should fire. */
5923
5923
  action: 'INSERT' | 'UPDATE' | 'DELETE';
5924
5924
  /** When the trigger should fire in the case that a matching query is executed. */
@@ -5926,7 +5926,7 @@ type ModelTrigger = {
5926
5926
  /** A list of queries that should be executed when the trigger fires. */
5927
5927
  effects: Array<Query>;
5928
5928
  /** A list of field slugs for which the trigger should fire. */
5929
- fields?: Array<ModelTriggerField>;
5929
+ fields?: Array<ModelTriggerField<T>>;
5930
5930
  /**
5931
5931
  * An object containing query instructions used to determine whether the trigger should
5932
5932
  * fire, or not.
@@ -5939,14 +5939,14 @@ type ModelPreset = {
5939
5939
  /** The query instructions that should be applied when the preset is used. */
5940
5940
  instructions: GetInstructions;
5941
5941
  };
5942
- interface Model {
5942
+ interface Model<T extends Array<ModelField> = Array<ModelField>> {
5943
5943
  name: string;
5944
5944
  pluralName: string;
5945
5945
  slug: string;
5946
5946
  pluralSlug: string;
5947
5947
  identifiers: {
5948
- name: string;
5949
- slug: string;
5948
+ name: T[number]['slug'];
5949
+ slug: T[number]['slug'];
5950
5950
  };
5951
5951
  idPrefix: string;
5952
5952
  /** The name of the table in SQLite. */
@@ -5962,12 +5962,12 @@ interface Model {
5962
5962
  * the associative model should be mounted on the source model.
5963
5963
  */
5964
5964
  associationSlug?: string;
5965
- fields: Array<ModelField>;
5966
- indexes?: Array<ModelIndex>;
5967
- triggers?: Array<ModelTrigger>;
5965
+ fields: T;
5966
+ indexes?: Array<ModelIndex<T>>;
5967
+ triggers?: Array<ModelTrigger<T>>;
5968
5968
  presets?: Array<ModelPreset>;
5969
5969
  }
5970
- type PublicModel = Omit<Partial<Model>, 'slug' | 'identifiers' | 'associationSlug' | 'table' | 'tableAlias'> & {
5970
+ type PublicModel<T extends Array<ModelField> = Array<ModelField>> = Omit<Partial<Model<T>>, 'slug' | 'identifiers' | 'associationSlug' | 'table' | 'tableAlias'> & {
5971
5971
  slug: Required<Model['slug']>;
5972
5972
  identifiers?: Partial<Model['identifiers']>;
5973
5973
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {