@ronin/compiler 0.13.0-leo-ron-1071-experimental-277 → 0.13.1-leo-ron-1071-experimental-278

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 +12 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -676,7 +676,9 @@ var RONIN_MODEL_FIELD_REGEX = new RegExp(
676
676
  "g"
677
677
  );
678
678
  var RAW_FIELD_TYPES = ["string", "number", "boolean"];
679
- var composeIncludedTableAlias = (fieldSlug) => `including_${fieldSlug}`;
679
+ var composeIncludedTableAlias = (fieldSlug) => {
680
+ return `including_${fieldSlug}`;
681
+ };
680
682
  var MODEL_ENTITY_ERROR_CODES = {
681
683
  field: "FIELD_NOT_FOUND",
682
684
  index: "INDEX_NOT_FOUND",
@@ -742,6 +744,7 @@ var getSymbol = (value) => {
742
744
  var findInObject = (obj, pattern, replacer) => {
743
745
  let found = false;
744
746
  for (const key in obj) {
747
+ if (!Object.hasOwn(obj, key)) continue;
745
748
  const value = obj[key];
746
749
  if (isObject(value)) {
747
750
  found = findInObject(value, pattern, replacer);
@@ -758,6 +761,7 @@ var findInObject = (obj, pattern, replacer) => {
758
761
  };
759
762
  var flatten = (obj, prefix = "", res = {}) => {
760
763
  for (const key in obj) {
764
+ if (!Object.hasOwn(obj, key)) continue;
761
765
  const path = prefix ? `${prefix}.${key}` : key;
762
766
  const value = obj[key];
763
767
  if (typeof value === "object" && value !== null && !getSymbol(value)) {
@@ -1509,6 +1513,7 @@ var getFieldStatement = (models, model, field) => {
1509
1513
  const targetTable = getModelBySlug(modelList, field.target).table;
1510
1514
  statement += ` REFERENCES ${targetTable}("id")`;
1511
1515
  for (const trigger in actions) {
1516
+ if (!Object.hasOwn(actions, trigger)) continue;
1512
1517
  const triggerName = trigger.toUpperCase().slice(2);
1513
1518
  const action = actions[trigger];
1514
1519
  statement += ` ON ${triggerName} ${action}`;
@@ -1601,7 +1606,8 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query)
1601
1606
  models.push(modelWithPresets);
1602
1607
  const modelWithObjects = Object.assign({}, modelWithPresets);
1603
1608
  for (const entity2 in entities) {
1604
- if (entities[entity2]) modelWithObjects[entity2] = entities[entity2];
1609
+ if (!Object.hasOwn(entities, entity2)) continue;
1610
+ Object.defineProperty(modelWithObjects, entity2, { value: entities[entity2] });
1605
1611
  }
1606
1612
  queryTypeDetails = { to: modelWithObjects };
1607
1613
  getSystemModels(models, modelWithPresets).map((systemModel) => {
@@ -1935,6 +1941,7 @@ var handleBeforeOrAfter = (model, statementParams, instructions) => {
1935
1941
  var handleFor = (model, instructions) => {
1936
1942
  const normalizedFor = Array.isArray(instructions.for) ? Object.fromEntries(instructions.for.map((presetSlug) => [presetSlug, null])) : instructions.for;
1937
1943
  for (const presetSlug in normalizedFor) {
1944
+ if (!Object.hasOwn(normalizedFor, presetSlug)) continue;
1938
1945
  const arg = normalizedFor[presetSlug];
1939
1946
  const preset = model.presets?.find((preset2) => preset2.slug === presetSlug);
1940
1947
  if (!preset) {
@@ -1952,6 +1959,7 @@ var handleFor = (model, instructions) => {
1952
1959
  );
1953
1960
  }
1954
1961
  for (const subInstruction in replacedForFilter) {
1962
+ if (!Object.hasOwn(replacedForFilter, subInstruction)) continue;
1955
1963
  const instructionName = subInstruction;
1956
1964
  const currentValue = instructions[instructionName];
1957
1965
  if (currentValue) {
@@ -1983,6 +1991,7 @@ var handleIncluding = (models, model, statementParams, instruction) => {
1983
1991
  let statement = "";
1984
1992
  let tableSubQuery;
1985
1993
  for (const ephemeralFieldSlug in instruction) {
1994
+ if (!Object.hasOwn(instruction, ephemeralFieldSlug)) continue;
1986
1995
  const symbol = getSymbol(instruction[ephemeralFieldSlug]);
1987
1996
  if (symbol?.type !== "query") continue;
1988
1997
  const { queryType, queryModel, queryInstructions } = splitQuery(symbol.value);
@@ -2216,6 +2225,7 @@ var handleTo = (models, model, statementParams, queryType, dependencyStatements,
2216
2225
  }
2217
2226
  Object.assign(toInstruction, defaultFields);
2218
2227
  for (const fieldSlug in toInstruction) {
2228
+ if (!Object.hasOwn(toInstruction, fieldSlug)) continue;
2219
2229
  const fieldValue = toInstruction[fieldSlug];
2220
2230
  const fieldDetails = getFieldFromModel(model, fieldSlug, "to", false);
2221
2231
  if (fieldDetails?.field.type === "link" && fieldDetails.field.kind === "many") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.13.0-leo-ron-1071-experimental-277",
3
+ "version": "0.13.1-leo-ron-1071-experimental-278",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "lint": "bun run --bun lint:tsc && bun run --bun lint:biome",
16
- "lint:biome": "biome check",
16
+ "lint:biome": "biome check --error-on-warnings",
17
17
  "lint:tsc": "tsc --pretty",
18
18
  "format": "biome check --write && biome format --write",
19
19
  "test": "bun test",