@ronin/compiler 0.17.4 → 0.17.5-corny-ron-1099-experimental-386

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.
package/dist/index.d.ts CHANGED
@@ -307,7 +307,7 @@ type ModelTrigger<T extends ModelEntityList<ModelField> = ModelEntityList<ModelF
307
307
  /** When the trigger should fire in the case that a matching query is executed. */
308
308
  when: 'BEFORE' | 'DURING' | 'AFTER';
309
309
  /** A list of queries that should be executed when the trigger fires. */
310
- effects: Array<Query>;
310
+ effects: Array<Record<typeof QUERY_SYMBOLS.QUERY, Query>>;
311
311
  /** A list of field slugs for which the trigger should fire. */
312
312
  fields?: Array<ModelTriggerField<T>>;
313
313
  /**
package/dist/index.js CHANGED
@@ -1856,7 +1856,7 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query,
1856
1856
  }
1857
1857
  };
1858
1858
  }
1859
- const modelBeforeUpdate = structuredClone(model);
1859
+ const modelBeforeUpdate = structuredClone(JSON.parse(JSON.stringify(model)));
1860
1860
  const existingModel = model;
1861
1861
  const pluralType = PLURAL_MODEL_ENTITIES[entity];
1862
1862
  const existingEntity = existingModel[pluralType]?.[slug];
@@ -1987,7 +1987,7 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query,
1987
1987
  statementParts.push("WHEN", `(${withStatement})`);
1988
1988
  }
1989
1989
  const effectStatements = trigger.effects.map((effectQuery) => {
1990
- return compileQueryInput(effectQuery, models, null, {
1990
+ return compileQueryInput(effectQuery[QUERY_SYMBOLS.QUERY], models, null, {
1991
1991
  returning: false,
1992
1992
  parentModel: existingModel,
1993
1993
  inlineDefaults: options.inlineDefaults
@@ -2019,8 +2019,12 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query,
2019
2019
  newSlug,
2020
2020
  Object.getOwnPropertyDescriptor(targetEntities, slug)
2021
2021
  );
2022
+ Object.assign(targetEntities[newSlug], entityValue);
2022
2023
  delete targetEntities[slug];
2023
- const value = prepareStatementValue(statementParams, entityValue);
2024
+ const value = prepareStatementValue(statementParams, {
2025
+ ...targetEntities[newSlug],
2026
+ slug: "slug" in targetEntities ? newSlug : void 0
2027
+ });
2024
2028
  json = `json_insert(json_remove(${field}, '$.${slug}'), '$.${newSlug}', ${value})`;
2025
2029
  } else {
2026
2030
  Object.assign(targetEntities[slug], jsonValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.17.4",
3
+ "version": "0.17.5-corny-ron-1099-experimental-386",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {