@vantreeseba/drizzle-graphql 8.2.0 → 8.2.1

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/dist/index.cjs CHANGED
@@ -3093,6 +3093,7 @@ var BatchLoader = class {
3093
3093
  constructor(batchFn) {
3094
3094
  this.batchFn = batchFn;
3095
3095
  }
3096
+ batchFn;
3096
3097
  batch = [];
3097
3098
  scheduled = false;
3098
3099
  load(key) {
@@ -5553,7 +5554,7 @@ var createNestedWriteRuntime = (params) => {
5553
5554
  const scope = resolveScope(policies, context, filterCtx);
5554
5555
  for (const [relationName, op] of Object.entries(ops)) {
5555
5556
  const plan = tablePlans[relationName];
5556
- if (!plan || plan.fkSide !== "parent") {
5557
+ if (plan?.fkSide !== "parent") {
5557
5558
  continue;
5558
5559
  }
5559
5560
  assertSingleOperation(plan, op);
@@ -5595,7 +5596,7 @@ var createNestedWriteRuntime = (params) => {
5595
5596
  const scope = resolveScope(policies, context, filterCtx);
5596
5597
  for (const [relationName, op] of Object.entries(ops)) {
5597
5598
  const plan = tablePlans[relationName];
5598
- if (!plan || plan.fkSide !== "child") {
5599
+ if (plan?.fkSide !== "child") {
5599
5600
  continue;
5600
5601
  }
5601
5602
  if (plan.isOne) {
@@ -5685,7 +5686,7 @@ var import_graphql_parse_resolve_info2 = require("graphql-parse-resolve-info");
5685
5686
 
5686
5687
  // src/util/builders/errors.ts
5687
5688
  var missingQueryBuilderError = (tableName) => new Error(
5688
- `Drizzle-GraphQL Error: Table '${tableName}' was passed to the drizzle constructor's schema but is missing from its relations config, so drizzle-orm exposes no query builder for it. Include it in the relations you pass to buildRelations/defineRelations, or drop it from the generated schema with config.exclude.tables.`
5689
+ `Drizzle-GraphQL Error: Table '${tableName}' has no query builder on the drizzle instance, so there is nothing for its resolvers to read through. Include it in the relations you pass to buildRelations/defineRelations, or drop it from the generated schema with config.exclude.tables.`
5689
5690
  );
5690
5691
 
5691
5692
  // src/util/builders/select.ts
@@ -7702,13 +7703,13 @@ var import_sqlite_core3 = require("drizzle-orm/sqlite-core");
7702
7703
  var import_graphql_parse_resolve_info5 = require("graphql-parse-resolve-info");
7703
7704
  var contextCache = /* @__PURE__ */ new WeakMap();
7704
7705
  var tableConfigFor = (db) => {
7705
- if ((0, import_drizzle_orm27.is)(db, import_mysql_core3.MySqlDatabase)) {
7706
+ if ((0, import_drizzle_orm27.is)(db, import_mysql_core3.MySqlAsyncDatabase)) {
7706
7707
  return import_mysql_core3.getTableConfig;
7707
7708
  }
7708
7709
  if ((0, import_drizzle_orm27.is)(db, import_pg_core3.PgAsyncDatabase)) {
7709
7710
  return import_pg_core3.getTableConfig;
7710
7711
  }
7711
- if ((0, import_drizzle_orm27.is)(db, import_sqlite_core3.BaseSQLiteDatabase)) {
7712
+ if ((0, import_drizzle_orm27.is)(db, import_sqlite_core3.SQLiteAsyncDatabase)) {
7712
7713
  return import_sqlite_core3.getTableConfig;
7713
7714
  }
7714
7715
  throw new Error("Drizzle-GraphQL Error: unsupported database instance \u2014 expected a PostgreSQL, MySQL or SQLite one.");
@@ -7719,7 +7720,7 @@ var contextFor = (db) => {
7719
7720
  return cached;
7720
7721
  }
7721
7722
  const relations = db._.relations ?? {};
7722
- const schema = db._.fullSchema ?? Object.fromEntries(
7723
+ const schema = Object.fromEntries(
7723
7724
  Object.entries(relations).filter(([, config]) => config?.table != null).map(([key, config]) => [key, config.table])
7724
7725
  );
7725
7726
  const tableEntries = Object.entries(schema).filter(([, value]) => (0, import_drizzle_orm27.is)(value, import_drizzle_orm27.Table));
@@ -7844,21 +7845,21 @@ var resolveSelection = async (info, options) => {
7844
7845
  // src/index.ts
7845
7846
  var buildSchema = (db, config) => {
7846
7847
  const relations = db._.relations;
7847
- const schema = db._.fullSchema ?? Object.fromEntries(
7848
+ const schema = Object.fromEntries(
7848
7849
  Object.entries(relations).filter(([, config2]) => config2?.table != null).map(([key, config2]) => [key, config2.table])
7849
7850
  );
7850
- if (!schema || !Object.keys(schema).length) {
7851
+ if (!Object.keys(schema).length) {
7851
7852
  throw new Error(
7852
7853
  "Drizzle-GraphQL Error: Schema not found in drizzle instance. Pass relations (from buildRelations/defineRelations) to the drizzle constructor so drizzle-graphql can detect your tables."
7853
7854
  );
7854
7855
  }
7855
7856
  const generatorOptions = resolveBuildConfig(config, schema);
7856
7857
  let generatorOutput;
7857
- if ((0, import_drizzle_orm28.is)(db, import_mysql_core4.MySqlDatabase)) {
7858
+ if ((0, import_drizzle_orm28.is)(db, import_mysql_core4.MySqlAsyncDatabase)) {
7858
7859
  generatorOutput = generateSchemaData(db, schema, relations, generatorOptions);
7859
7860
  } else if ((0, import_drizzle_orm28.is)(db, import_pg_core4.PgAsyncDatabase)) {
7860
7861
  generatorOutput = generateSchemaData2(db, schema, relations, generatorOptions);
7861
- } else if ((0, import_drizzle_orm28.is)(db, import_sqlite_core4.BaseSQLiteDatabase)) {
7862
+ } else if ((0, import_drizzle_orm28.is)(db, import_sqlite_core4.SQLiteAsyncDatabase)) {
7862
7863
  generatorOutput = generateSchemaData3(db, schema, relations, generatorOptions);
7863
7864
  } else {
7864
7865
  throw new Error("Drizzle-GraphQL Error: Unknown database instance type");