PHP 7.4.33
Preview: utils.cjs Size: 7.53 KB
/var/www/gtechmarathon2026.bitkit.dk/httpdocs/node_modules/drizzle-orm/utils.cjs
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var utils_exports = {};
__export(utils_exports, {
  applyMixins: () => applyMixins,
  getColumnNameAndConfig: () => getColumnNameAndConfig,
  getTableColumns: () => getTableColumns,
  getTableLikeName: () => getTableLikeName,
  getViewSelectedFields: () => getViewSelectedFields,
  haveSameKeys: () => haveSameKeys,
  isConfig: () => isConfig,
  mapResultRow: () => mapResultRow,
  mapUpdateSet: () => mapUpdateSet,
  orderSelectedFields: () => orderSelectedFields
});
module.exports = __toCommonJS(utils_exports);
var import_column = require("./column.cjs");
var import_entity = require("./entity.cjs");
var import_sql = require("./sql/sql.cjs");
var import_subquery = require("./subquery.cjs");
var import_table = require("./table.cjs");
var import_view_common = require("./view-common.cjs");
function mapResultRow(columns, row, joinsNotNullableMap) {
  const nullifyMap = {};
  const result = columns.reduce(
    (result2, { path, field }, columnIndex) => {
      let decoder;
      if ((0, import_entity.is)(field, import_column.Column)) {
        decoder = field;
      } else if ((0, import_entity.is)(field, import_sql.SQL)) {
        decoder = field.decoder;
      } else {
        decoder = field.sql.decoder;
      }
      let node = result2;
      for (const [pathChunkIndex, pathChunk] of path.entries()) {
        if (pathChunkIndex < path.length - 1) {
          if (!(pathChunk in node)) {
            node[pathChunk] = {};
          }
          node = node[pathChunk];
        } else {
          const rawValue = row[columnIndex];
          const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
          if (joinsNotNullableMap && (0, import_entity.is)(field, import_column.Column) && path.length === 2) {
            const objectName = path[0];
            if (!(objectName in nullifyMap)) {
              nullifyMap[objectName] = value === null ? (0, import_table.getTableName)(field.table) : false;
            } else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== (0, import_table.getTableName)(field.table)) {
              nullifyMap[objectName] = false;
            }
          }
        }
      }
      return result2;
    },
    {}
  );
  if (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) {
    for (const [objectName, tableName] of Object.entries(nullifyMap)) {
      if (typeof tableName === "string" && !joinsNotNullableMap[tableName]) {
        result[objectName] = null;
      }
    }
  }
  return result;
}
function orderSelectedFields(fields, pathPrefix) {
  return Object.entries(fields).reduce((result, [name, field]) => {
    if (typeof name !== "string") {
      return result;
    }
    const newPath = pathPrefix ? [...pathPrefix, name] : [name];
    if ((0, import_entity.is)(field, import_column.Column) || (0, import_entity.is)(field, import_sql.SQL) || (0, import_entity.is)(field, import_sql.SQL.Aliased)) {
      result.push({ path: newPath, field });
    } else if ((0, import_entity.is)(field, import_table.Table)) {
      result.push(...orderSelectedFields(field[import_table.Table.Symbol.Columns], newPath));
    } else {
      result.push(...orderSelectedFields(field, newPath));
    }
    return result;
  }, []);
}
function haveSameKeys(left, right) {
  const leftKeys = Object.keys(left);
  const rightKeys = Object.keys(right);
  if (leftKeys.length !== rightKeys.length) {
    return false;
  }
  for (const [index, key] of leftKeys.entries()) {
    if (key !== rightKeys[index]) {
      return false;
    }
  }
  return true;
}
function mapUpdateSet(table, values) {
  const entries = Object.entries(values).filter(([, value]) => value !== void 0).map(([key, value]) => {
    if ((0, import_entity.is)(value, import_sql.SQL) || (0, import_entity.is)(value, import_column.Column)) {
      return [key, value];
    } else {
      return [key, new import_sql.Param(value, table[import_table.Table.Symbol.Columns][key])];
    }
  });
  if (entries.length === 0) {
    throw new Error("No values to set");
  }
  return Object.fromEntries(entries);
}
function applyMixins(baseClass, extendedClasses) {
  for (const extendedClass of extendedClasses) {
    for (const name of Object.getOwnPropertyNames(extendedClass.prototype)) {
      if (name === "constructor")
        continue;
      Object.defineProperty(
        baseClass.prototype,
        name,
        Object.getOwnPropertyDescriptor(extendedClass.prototype, name) || /* @__PURE__ */ Object.create(null)
      );
    }
  }
}
function getTableColumns(table) {
  return table[import_table.Table.Symbol.Columns];
}
function getViewSelectedFields(view) {
  return view[import_view_common.ViewBaseConfig].selectedFields;
}
function getTableLikeName(table) {
  return (0, import_entity.is)(table, import_subquery.Subquery) ? table._.alias : (0, import_entity.is)(table, import_sql.View) ? table[import_view_common.ViewBaseConfig].name : (0, import_entity.is)(table, import_sql.SQL) ? void 0 : table[import_table.Table.Symbol.IsAlias] ? table[import_table.Table.Symbol.Name] : table[import_table.Table.Symbol.BaseName];
}
function getColumnNameAndConfig(a, b) {
  return {
    name: typeof a === "string" && a.length > 0 ? a : "",
    config: typeof a === "object" ? a : b
  };
}
const _ = {};
const __ = {};
function isConfig(data) {
  if (typeof data !== "object" || data === null)
    return false;
  if (data.constructor.name !== "Object")
    return false;
  if ("logger" in data) {
    const type = typeof data["logger"];
    if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
      return false;
    return true;
  }
  if ("schema" in data) {
    const type = typeof data["logger"];
    if (type !== "object" && type !== "undefined")
      return false;
    return true;
  }
  if ("casing" in data) {
    const type = typeof data["logger"];
    if (type !== "string" && type !== "undefined")
      return false;
    return true;
  }
  if ("mode" in data) {
    if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
      return false;
    return true;
  }
  if ("connection" in data) {
    const type = typeof data["connection"];
    if (type !== "string" && type !== "object" && type !== "undefined")
      return false;
    return true;
  }
  if ("client" in data) {
    const type = typeof data["client"];
    if (type !== "object" && type !== "function" && type !== "undefined")
      return false;
    return true;
  }
  if (Object.keys(data).length === 0)
    return true;
  return false;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  applyMixins,
  getColumnNameAndConfig,
  getTableColumns,
  getTableLikeName,
  getViewSelectedFields,
  haveSameKeys,
  isConfig,
  mapResultRow,
  mapUpdateSet,
  orderSelectedFields
});
//# sourceMappingURL=utils.cjs.map

Directory Contents

Dirs: 36 × Files: 158
Name Size Perms Modified Actions
- drwxr-xr-x 2025-07-10 12:54:57
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
bun-sql DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
d1 DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
knex DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
kysely DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
libsql DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
mysql2 DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
neon DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
neon-http DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
op-sqlite DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
pg-core DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
pg-proxy DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
pglite DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
prisma DIR
- drwxr-xr-x 2025-07-10 12:54:57
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
sql DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
sql-js DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
supabase DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
xata-http DIR
- drwxr-xr-x 2025-07-10 12:55:00
Edit Download
4.76 KB lrw-r--r-- 2025-07-10 12:54:56
Edit Download
5.92 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.54 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
1.53 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
3.08 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
5.85 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
775 B lrw-r--r-- 2025-07-10 12:54:56
Edit Download
442 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
322 B lrw-r--r-- 2025-07-10 12:54:58
Edit Download
320 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
33 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
71 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.00 KB lrw-r--r-- 2025-07-10 12:54:56
Edit Download
3.69 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
503 B lrw-r--r-- 2025-07-10 12:54:58
Edit Download
500 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.86 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.64 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
4.15 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
13.94 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
10.90 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
10.89 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
3.11 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
13.90 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.28 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
6.25 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.84 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
3.84 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.28 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
6.21 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.89 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
1.84 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
395 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
395 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
867 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.79 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.56 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
932 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
366 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
365 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
490 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
887 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.14 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
183 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
45 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
44 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
83 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
151 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.46 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
854 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
484 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
469 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
502 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
724 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.94 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
1.87 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
694 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
693 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
842 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.82 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.94 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
2.58 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
398 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
398 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.21 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.49 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
790 B lrw-r--r-- 2025-07-10 12:54:58
Edit Download
1.32 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.09 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.08 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
38 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
71 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
148.17 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.27 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
601 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
370 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
367 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
253 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
562 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.60 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
1.53 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
670 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
669 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
579 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.49 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.14 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
11.10 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
25.99 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
12.02 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
12.01 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
8.72 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
26.12 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
802 B lrw-r--r-- 2025-07-10 12:54:58
Edit Download
429 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
206 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
205 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
42 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
71 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.54 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
5.18 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
464 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
461 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
2.25 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
5.17 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
781 B lrw-r--r-- 2025-07-10 12:54:58
Edit Download
341 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
166 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
165 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
35 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
71 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.54 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
1.88 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1015 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1013 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
495 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.83 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
3.36 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
7.67 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
3.76 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.76 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.93 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
7.59 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.11 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
241 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
11 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
11 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
109 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
198 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.11 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
312 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
92 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
92 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
113 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
269 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.92 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
2.18 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
11 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
11 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
898 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.14 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
7.53 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
14.16 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
2.80 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.79 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
5.63 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
14.08 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.19 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
376 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
123 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
123 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
150 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
333 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.14 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
242 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
52 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
52 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
129 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
199 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).