@m1212e/rumble 0.15.1 → 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/out/index.mjs CHANGED
@@ -1010,7 +1010,9 @@ const createEnumImplementer = ({ db, schemaBuilder }) => {
1010
1010
  Please ensure that you use the enum at least once as a column of a table!`);
1011
1011
  enumValues = enumCol.enumValues;
1012
1012
  } else if (enumColumn) {
1013
- enumSchemaName = enumColumn.config.name;
1013
+ const entry = Object.entries(db._.fullSchema).filter(([_, value]) => enumColumn.config.enum === value)[0];
1014
+ if (!entry) throw new RumbleError(`Could not find enum entry for ${enumColumn.config.name}.`);
1015
+ enumSchemaName = entry[0];
1014
1016
  enumValues = enumColumn.enumValues;
1015
1017
  }
1016
1018
  if (!enumSchemaName || !enumValues) throw new RumbleError("Could not determine enum structure!");
@@ -1430,25 +1432,25 @@ const createObjectImplementer = ({ db, search, schemaBuilder, makePubSubInstance
1430
1432
  return ref;
1431
1433
  };
1432
1434
  } })) ?? {};
1433
- const fields = Object.entries(columns).reduce((acc, [key, value]) => {
1435
+ const fields = Object.entries(columns).reduce((acc, [key, column]) => {
1434
1436
  if (userAdjustments[key]) {
1435
1437
  const { params, creatorFunction, configObject } = configMap.get(userAdjustments[key]);
1436
- if (typeof configObject.nullable !== "boolean") configObject.nullable = !value.notNull;
1438
+ if (typeof configObject.nullable !== "boolean") configObject.nullable = !column.notNull;
1437
1439
  userAdjustments[key] = creatorFunction.bind(t)(...params);
1438
1440
  return acc;
1439
1441
  }
1440
- if (isEnumSchema(value)) {
1441
- const enumImpl = enumImplementer({ enumColumn: value });
1442
+ if (isEnumSchema(column)) {
1443
+ const enumImpl = enumImplementer({ enumColumn: column });
1442
1444
  acc[key] = t.field({
1443
1445
  type: enumImpl,
1444
1446
  resolve: (element) => element[key],
1445
- nullable: !value.notNull
1447
+ nullable: !column.notNull
1446
1448
  });
1447
1449
  } else acc[key] = buildPothosResponseTypeFromGraphQLType({
1448
1450
  builder: t,
1449
- sqlType: value.getSQLType(),
1451
+ sqlType: column.getSQLType(),
1450
1452
  fieldName: key,
1451
- nullable: !value.notNull
1453
+ nullable: !column.notNull
1452
1454
  });
1453
1455
  return acc;
1454
1456
  }, {});