@ronin/compiler 0.13.11 → 0.13.12-leo-ron-1099-1-experimental-308

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.js +25 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -784,8 +784,11 @@ var composeFieldValues = (models, model, statementParams, instructionName, value
784
784
  );
785
785
  const collectStatementValue = options.type !== "fields";
786
786
  const symbol = getSymbol(value);
787
- const syntax = WITH_CONDITIONS[options.condition || "being"](value);
788
- let conditionValue = syntax[1];
787
+ let conditionMatcher = "=";
788
+ let conditionValue = value;
789
+ if (options.condition) {
790
+ [conditionMatcher, conditionValue] = WITH_CONDITIONS[options.condition](value);
791
+ }
789
792
  if (symbol) {
790
793
  if (symbol?.type === "expression") {
791
794
  conditionValue = parseFieldExpression(
@@ -803,7 +806,7 @@ var composeFieldValues = (models, model, statementParams, instructionName, value
803
806
  }
804
807
  if (options.type === "fields") return conditionSelector;
805
808
  if (options.type === "values") return conditionValue;
806
- return `${conditionSelector} ${syntax[0]} ${conditionValue}`;
809
+ return `${conditionSelector} ${conditionMatcher} ${conditionValue}`;
807
810
  };
808
811
  var composeConditions = (models, model, statementParams, instructionName, value, options) => {
809
812
  const isNested = isObject(value) && Object.keys(value).length > 0;
@@ -1588,11 +1591,29 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query)
1588
1591
  return [pluralType2, formatModelEntity(type, list)];
1589
1592
  })
1590
1593
  );
1594
+ models.push(modelWithPresets);
1591
1595
  dependencyStatements.push({
1592
1596
  statement: `CREATE TABLE "${modelWithPresets.table}" (${columns.join(", ")})`,
1593
1597
  params: []
1594
1598
  });
1595
- models.push(modelWithPresets);
1599
+ for (const [modelEntity, pluralModelEntity] of [
1600
+ ["index", "indexes"],
1601
+ ["trigger", "triggers"]
1602
+ ]) {
1603
+ const entityValue = modelWithPresets[pluralModelEntity];
1604
+ if (!entityValue) continue;
1605
+ for (const item of entityValue) {
1606
+ const query2 = {
1607
+ alter: {
1608
+ model: modelWithPresets.slug,
1609
+ create: {
1610
+ [modelEntity]: item
1611
+ }
1612
+ }
1613
+ };
1614
+ transformMetaQuery(models, dependencyStatements, null, query2);
1615
+ }
1616
+ }
1596
1617
  const modelWithObjects = Object.assign({}, modelWithPresets);
1597
1618
  for (const entity2 in entities) {
1598
1619
  if (!Object.hasOwn(entities, entity2)) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.13.11",
3
+ "version": "0.13.12-leo-ron-1099-1-experimental-308",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {