drizzle-graphql-plus 0.8.24 → 0.8.25
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/index.cjs +2 -15
- package/index.cjs.map +1 -1
- package/index.js +2 -16
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2251,7 +2251,6 @@ import { BaseSQLiteDatabase as BaseSQLiteDatabase3 } from "drizzle-orm/sqlite-co
|
|
|
2251
2251
|
// src/buildSchemaSDL/generator/schema.ts
|
|
2252
2252
|
import {
|
|
2253
2253
|
getTableColumns as getTableColumns3,
|
|
2254
|
-
getTableName,
|
|
2255
2254
|
is as is7,
|
|
2256
2255
|
Relations as Relations4,
|
|
2257
2256
|
createTableRelationsHelpers as createTableRelationsHelpers4,
|
|
@@ -2364,7 +2363,7 @@ var generateTypes = (db, schema) => {
|
|
|
2364
2363
|
for (const [key, value] of schemaEntries) {
|
|
2365
2364
|
if (value && typeof value === "object" && "getSQL" in value) {
|
|
2366
2365
|
const table = value;
|
|
2367
|
-
const tableName =
|
|
2366
|
+
const tableName = key;
|
|
2368
2367
|
const columns = getTableColumns3(table);
|
|
2369
2368
|
tables[tableName] = {
|
|
2370
2369
|
name: tableName,
|
|
@@ -2479,21 +2478,8 @@ var generateTypeDefs = (tables, relations) => {
|
|
|
2479
2478
|
const targetTableName = relationInfo.targetTableName;
|
|
2480
2479
|
const targetTypeName = capitalize(targetTableName);
|
|
2481
2480
|
if (isOne) {
|
|
2482
|
-
const relation = relationInfo.relation;
|
|
2483
|
-
const config = relation.config;
|
|
2484
|
-
let isNonNullable = false;
|
|
2485
|
-
if (config?.fields && config.fields.length > 0) {
|
|
2486
|
-
isNonNullable = config.fields.every((field) => {
|
|
2487
|
-
const fieldColumnName = field.name;
|
|
2488
|
-
const column = Object.values(tableInfo.columns).find(
|
|
2489
|
-
(col) => col.name === fieldColumnName
|
|
2490
|
-
);
|
|
2491
|
-
return column && column.notNull;
|
|
2492
|
-
});
|
|
2493
|
-
}
|
|
2494
|
-
const nullableModifier = isNonNullable ? "!" : "";
|
|
2495
2481
|
fields.push(
|
|
2496
|
-
` ${relationName}(where: ${targetTypeName}Filters): ${targetTypeName}
|
|
2482
|
+
` ${relationName}(where: ${targetTypeName}Filters): ${targetTypeName}`
|
|
2497
2483
|
);
|
|
2498
2484
|
} else {
|
|
2499
2485
|
fields.push(
|