import { recordProxy } from "../../../shared/src/record-proxy.js";
import { newQuery } from "./query-impl.js";
import { newRunnableQuery } from "./runnable-query-impl.js";
function createBuilder(schema) {
  return createBuilderWithQueryFactory(
    schema,
    (table) => newQuery(schema, table)
  );
}
function createRunnableBuilder(delegate, schema) {
  if (!schema.enableLegacyQueries) {
    return void 0;
  }
  return createBuilderWithQueryFactory(
    schema,
    (table) => newRunnableQuery(delegate, schema, table)
  );
}
function createBuilderWithQueryFactory(schema, queryFactory) {
  const target = Object.assign(/* @__PURE__ */ Object.create(null), schema.tables);
  return recordProxy(
    target,
    (_tableSchema, prop) => queryFactory(prop)
  );
}
export {
  createBuilder,
  createRunnableBuilder
};
//# sourceMappingURL=create-builder.js.map
