@inflector/optima 1.0.5 → 1.0.7

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 +4 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -578,7 +578,6 @@ var OptimaTable = class _OptimaTable {
578
578
  const orderedValues = columnKeys.map((key) => {
579
579
  let v = r[key];
580
580
  if (v == null) {
581
- console.log(this.Columns[key].config);
582
581
  if (typeof this.Columns[key].config.default === "function") {
583
582
  v = this.Columns[key].config.default();
584
583
  } else if (this.Columns[key].config.defaultNow) {
@@ -595,6 +594,7 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
595
594
  };
596
595
  this.BuildUpdate = (TableName, changes, options) => {
597
596
  const { where, returning } = options;
597
+ console.log(changes);
598
598
  const setClauses = [];
599
599
  for (const [key, value] of Object.entries(changes)) {
600
600
  if (value !== void 0) {
@@ -689,6 +689,7 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
689
689
  }
690
690
  async InitTable() {
691
691
  const SQL = SQLBuilder.BuildTable(this.Name, this.Columns);
692
+ console.log(SQL);
692
693
  await this.Connection.run(SQL);
693
694
  }
694
695
  static async create(name, Columns, Connection) {
@@ -783,7 +784,7 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
783
784
  return createFluentBuilder(async (data) => {
784
785
  this.Validate(record);
785
786
  record = this.Transform(record);
786
- const PotentialyUpdated = await this.Get().where(record);
787
+ const PotentialyUpdated = await this.Get().where(data.where);
787
788
  if (PotentialyUpdated.length == 0) return [];
788
789
  else {
789
790
  const { sql } = this.BuildUpdate(this.Name, record, data);
@@ -1020,7 +1021,7 @@ var SchemaMigrator = class {
1020
1021
  for (const [tableName, fields] of Object.entries(desiredSchema)) {
1021
1022
  if (!currentSchema[tableName]) {
1022
1023
  const fieldDefs = Object.entries(fields).map(([colName, config]) => {
1023
- let def = `"${colName}" ${config.SQlType}`;
1024
+ let def = `"${colName}" ${config.STRUCTType ? config.STRUCTType : config.SQlType}`;
1024
1025
  if (config.primaryKey) def += " PRIMARY KEY";
1025
1026
  if (config.notnull) def += " NOT NULL";
1026
1027
  return def;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflector/optima",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "author": "Inflector",
6
6
  "main": "./dist/index.js",