@m1212e/rumble 0.14.2 → 0.15.2

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/README.md CHANGED
@@ -5,6 +5,8 @@ rumble is a combined ability and graphql builder built around [drizzle](https://
5
5
 
6
6
  > Using rumble and reading these docs requires some basic knowledge about the above mentioned tools. If you feel stuck, please make sure to familiarize yourself with those first! Especially familiarity with pothos and its drizzle plugin are very helpful!
7
7
 
8
+ > rumble currently works best with postgres. Some features might not work with other databases.
9
+
8
10
  ## Getting started
9
11
  The following example is an excerpt from the example setup you can find [here](./example). If you are interested in a real world app thats using rumble (and is still work in progress) please see [CHASE](https://github.com/DeutscheModelUnitedNations/munify-chase).
10
12
 
package/out/index.cjs CHANGED
@@ -1037,7 +1037,9 @@ const createEnumImplementer = ({ db, schemaBuilder }) => {
1037
1037
  Please ensure that you use the enum at least once as a column of a table!`);
1038
1038
  enumValues = enumCol.enumValues;
1039
1039
  } else if (enumColumn) {
1040
- enumSchemaName = enumColumn.config.name;
1040
+ const entry = Object.entries(db._.fullSchema).filter(([_, value]) => enumColumn.config.enum === value)[0];
1041
+ if (!entry) throw new RumbleError(`Could not find enum entry for ${enumColumn.config.name}.`);
1042
+ enumSchemaName = entry[0];
1041
1043
  enumValues = enumColumn.enumValues;
1042
1044
  }
1043
1045
  if (!enumSchemaName || !enumValues) throw new RumbleError("Could not determine enum structure!");
@@ -1457,25 +1459,25 @@ const createObjectImplementer = ({ db, search, schemaBuilder, makePubSubInstance
1457
1459
  return ref;
1458
1460
  };
1459
1461
  } })) ?? {};
1460
- const fields = Object.entries(columns).reduce((acc, [key, value]) => {
1462
+ const fields = Object.entries(columns).reduce((acc, [key, column]) => {
1461
1463
  if (userAdjustments[key]) {
1462
1464
  const { params, creatorFunction, configObject } = configMap.get(userAdjustments[key]);
1463
- if (typeof configObject.nullable !== "boolean") configObject.nullable = !value.notNull;
1465
+ if (typeof configObject.nullable !== "boolean") configObject.nullable = !column.notNull;
1464
1466
  userAdjustments[key] = creatorFunction.bind(t)(...params);
1465
1467
  return acc;
1466
1468
  }
1467
- if (isEnumSchema(value)) {
1468
- const enumImpl = enumImplementer({ enumColumn: value });
1469
+ if (isEnumSchema(column)) {
1470
+ const enumImpl = enumImplementer({ enumColumn: column });
1469
1471
  acc[key] = t.field({
1470
1472
  type: enumImpl,
1471
1473
  resolve: (element) => element[key],
1472
- nullable: !value.notNull
1474
+ nullable: !column.notNull
1473
1475
  });
1474
1476
  } else acc[key] = buildPothosResponseTypeFromGraphQLType({
1475
1477
  builder: t,
1476
- sqlType: value.getSQLType(),
1478
+ sqlType: column.getSQLType(),
1477
1479
  fieldName: key,
1478
- nullable: !value.notNull
1480
+ nullable: !column.notNull
1479
1481
  });
1480
1482
  return acc;
1481
1483
  }, {});
@@ -1492,7 +1494,7 @@ const createObjectImplementer = ({ db, search, schemaBuilder, makePubSubInstance
1492
1494
  let filterSpecifier = "many";
1493
1495
  if (value instanceof drizzle_orm.One) {
1494
1496
  isMany = false;
1495
- nullable = value.optional;
1497
+ nullable = !value.sourceColumns.every((column) => column.notNull);
1496
1498
  filterSpecifier = "single";
1497
1499
  }
1498
1500
  const subscribe = (subscriptions, _element) => {