@vantreeseba/drizzle-graphql 7.9.0 → 7.9.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/README.md +7 -0
- package/dist/README.md +7 -0
- package/dist/index.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/package.json +3 -10
- package/package.json +3 -10
package/README.md
CHANGED
|
@@ -1920,6 +1920,7 @@ that explains it, where there is one.
|
|
|
1920
1920
|
| --- | --- | --- |
|
|
1921
1921
|
| `mutations` | `true` | `false` omits the `Mutation` type entirely |
|
|
1922
1922
|
| `features` | see [Choosing what gets generated](#choosing-what-gets-generated) | which operations are generated, per operation |
|
|
1923
|
+
| `exclude` | none | [tables and columns left out](#excluding-tables-and-columns) of the generated schema entirely |
|
|
1923
1924
|
| `relationsDepthLimit` | unlimited | how deep relation fields are generated; `0` gives a flat, columns-only schema |
|
|
1924
1925
|
| `prefixes` / `suffixes` / `typeNameMapper` | see [Naming](#naming) | operation and type names |
|
|
1925
1926
|
| `scalars` / `mapColumnType` | built-in detection | [override a column's GraphQL type](#overriding-a-columns-scalar), by name or by rule |
|
|
@@ -1929,5 +1930,11 @@ that explains it, where there is one.
|
|
|
1929
1930
|
| `conflictDoNothing` | `false` | PostgreSQL only — `ON CONFLICT DO NOTHING` on inserts, which makes `create<Table>Single` nullable |
|
|
1930
1931
|
| `complexity` | on | [cost hints](#query-cost) in field extensions; `false` turns them off |
|
|
1931
1932
|
| `transactions` | `'none'` | `'auto'` wraps a multi-mutation request in one [transaction](#transactions) |
|
|
1933
|
+
| `limits` | unbounded | [default and maximum page size](#bounding-page-size), globally or per table |
|
|
1934
|
+
| `defaults` | none | [per-table default `orderBy`](#default-ordering) for requests that omit one |
|
|
1935
|
+
| `scope` | none | [row-level predicate](#row-scoping-and-multi-tenancy) every read and write of a table is confined to |
|
|
1936
|
+
| `contextValues` | none | [columns the server stamps from context](#columns-the-server-owns) instead of accepting from the client |
|
|
1937
|
+
| `softDelete` | none | [tables that mark rows deleted](#soft-delete) instead of removing them |
|
|
1938
|
+
| `onWrite` | none | [hook that runs inside the mutation's own transaction](#write-hooks) |
|
|
1932
1939
|
| `onError` | replaces driver errors | [error handling](#error-handling) hook — log, or surface a different error |
|
|
1933
1940
|
| `eagerLoadRelations` | `true` | [which relations are pre-fetched](#overriding-a-relations-resolver-without-overfetching) with the parent query |
|
package/dist/README.md
CHANGED
|
@@ -1920,6 +1920,7 @@ that explains it, where there is one.
|
|
|
1920
1920
|
| --- | --- | --- |
|
|
1921
1921
|
| `mutations` | `true` | `false` omits the `Mutation` type entirely |
|
|
1922
1922
|
| `features` | see [Choosing what gets generated](#choosing-what-gets-generated) | which operations are generated, per operation |
|
|
1923
|
+
| `exclude` | none | [tables and columns left out](#excluding-tables-and-columns) of the generated schema entirely |
|
|
1923
1924
|
| `relationsDepthLimit` | unlimited | how deep relation fields are generated; `0` gives a flat, columns-only schema |
|
|
1924
1925
|
| `prefixes` / `suffixes` / `typeNameMapper` | see [Naming](#naming) | operation and type names |
|
|
1925
1926
|
| `scalars` / `mapColumnType` | built-in detection | [override a column's GraphQL type](#overriding-a-columns-scalar), by name or by rule |
|
|
@@ -1929,5 +1930,11 @@ that explains it, where there is one.
|
|
|
1929
1930
|
| `conflictDoNothing` | `false` | PostgreSQL only — `ON CONFLICT DO NOTHING` on inserts, which makes `create<Table>Single` nullable |
|
|
1930
1931
|
| `complexity` | on | [cost hints](#query-cost) in field extensions; `false` turns them off |
|
|
1931
1932
|
| `transactions` | `'none'` | `'auto'` wraps a multi-mutation request in one [transaction](#transactions) |
|
|
1933
|
+
| `limits` | unbounded | [default and maximum page size](#bounding-page-size), globally or per table |
|
|
1934
|
+
| `defaults` | none | [per-table default `orderBy`](#default-ordering) for requests that omit one |
|
|
1935
|
+
| `scope` | none | [row-level predicate](#row-scoping-and-multi-tenancy) every read and write of a table is confined to |
|
|
1936
|
+
| `contextValues` | none | [columns the server stamps from context](#columns-the-server-owns) instead of accepting from the client |
|
|
1937
|
+
| `softDelete` | none | [tables that mark rows deleted](#soft-delete) instead of removing them |
|
|
1938
|
+
| `onWrite` | none | [hook that runs inside the mutation's own transaction](#write-hooks) |
|
|
1932
1939
|
| `onError` | replaces driver errors | [error handling](#error-handling) hook — log, or surface a different error |
|
|
1933
1940
|
| `eagerLoadRelations` | `true` | [which relations are pre-fetched](#overriding-a-relations-resolver-without-overfetching) with the parent query |
|
package/dist/index.cjs
CHANGED
|
@@ -464,6 +464,7 @@ var remapToGraphQLCore = (key, value, tableName, column, relationMap) => {
|
|
|
464
464
|
return value;
|
|
465
465
|
};
|
|
466
466
|
var remapToGraphQLSingleOutput = (queryOutput, tableName, table, relationMap) => {
|
|
467
|
+
const columns = (0, import_drizzle_orm2.getTableColumns)(table);
|
|
467
468
|
for (const [key, value] of Object.entries(queryOutput)) {
|
|
468
469
|
if (value === void 0 || value === null) {
|
|
469
470
|
const relEntry = value === null ? relationMap?.[tableName]?.[key] : void 0;
|
|
@@ -474,7 +475,7 @@ var remapToGraphQLSingleOutput = (queryOutput, tableName, table, relationMap) =>
|
|
|
474
475
|
delete queryOutput[key];
|
|
475
476
|
continue;
|
|
476
477
|
}
|
|
477
|
-
const column =
|
|
478
|
+
const column = columns[key];
|
|
478
479
|
if (value === 0n && column && column.columnType === "SQLiteBigInt" && !column.notNull) {
|
|
479
480
|
delete queryOutput[key];
|
|
480
481
|
continue;
|
|
@@ -926,6 +927,7 @@ var resolveQueryExecutor = (db, context, tableName, buildTimeQueryBase) => {
|
|
|
926
927
|
queryBase: buildTimeQueryBase ? executor?.query?.[tableName] ?? buildTimeQueryBase : buildTimeQueryBase
|
|
927
928
|
};
|
|
928
929
|
};
|
|
930
|
+
var DEFAULT_TRANSACTION_TIMEOUT_MS = 3e4;
|
|
929
931
|
var createMutationTxCtx = (options) => options ? { timeoutMs: options.timeoutMs, fieldNames: /* @__PURE__ */ new Set(), states: /* @__PURE__ */ new WeakMap() } : void 0;
|
|
930
932
|
var includedByDirectives = (node, variables) => {
|
|
931
933
|
for (const directive of node.directives ?? []) {
|
|
@@ -3927,7 +3929,7 @@ var parseAggregateRequest = (info, target, rootTypeName = `${target.typeName}Agg
|
|
|
3927
3929
|
for (const field of Object.values(selectionTree)) {
|
|
3928
3930
|
if (field.name === "count") {
|
|
3929
3931
|
request.count = true;
|
|
3930
|
-
request.selection
|
|
3932
|
+
request.selection["count"] = (0, import_drizzle_orm5.count)();
|
|
3931
3933
|
continue;
|
|
3932
3934
|
}
|
|
3933
3935
|
if (!AGGREGATE_OPS.includes(field.name)) {
|
|
@@ -3953,7 +3955,7 @@ var parseAggregateRequest = (info, target, rootTypeName = `${target.typeName}Agg
|
|
|
3953
3955
|
var assembleAggregateRow = (row, request, target) => {
|
|
3954
3956
|
const result = {};
|
|
3955
3957
|
if (request.count) {
|
|
3956
|
-
result
|
|
3958
|
+
result["count"] = row["count"] == null ? 0 : Number(row["count"]);
|
|
3957
3959
|
}
|
|
3958
3960
|
for (const op of AGGREGATE_OPS) {
|
|
3959
3961
|
if (!request.ops[op].length) {
|
|
@@ -4850,7 +4852,7 @@ var generateSchemaData = (db, schema, relations, options) => {
|
|
|
4850
4852
|
const inputs = {};
|
|
4851
4853
|
const outputs = {};
|
|
4852
4854
|
if (["insert", "upsert", "update", "delete"].some((feature) => anyTable(feature))) {
|
|
4853
|
-
outputs
|
|
4855
|
+
outputs["MutationReturn"] = mutationReturnType;
|
|
4854
4856
|
}
|
|
4855
4857
|
for (const [tableName, tableTypes] of Object.entries(gqlSchemaTypes)) {
|
|
4856
4858
|
const tableFeatures = featureOf(tableName);
|
|
@@ -6601,7 +6603,7 @@ function generateSchemaData2(db, schema, relations, options) {
|
|
|
6601
6603
|
for (const excluded of excludedTables) {
|
|
6602
6604
|
delete namedRelations[excluded];
|
|
6603
6605
|
}
|
|
6604
|
-
attachTargetPrimaryKeys(namedRelations, tables, pgPrimaryKeyPropNames);
|
|
6606
|
+
attachTargetPrimaryKeys(namedRelations, tables, (table) => pgPrimaryKeyPropNames(table));
|
|
6605
6607
|
const eagerRelations = pruneNonEagerRelations(namedRelations, shouldEagerLoad);
|
|
6606
6608
|
const filterCtx = { tables, relationMap: namedRelations };
|
|
6607
6609
|
const tablePolicies = options.policies;
|
|
@@ -8734,7 +8736,9 @@ var buildSchema = (db, config) => {
|
|
|
8734
8736
|
aggregateCost: (complexityConfig === true ? void 0 : complexityConfig.aggregateCost) ?? 10
|
|
8735
8737
|
};
|
|
8736
8738
|
const transactionsOpt = config?.transactions;
|
|
8737
|
-
const transactions = transactionsOpt === void 0 || transactionsOpt === "none" ? void 0 : {
|
|
8739
|
+
const transactions = transactionsOpt === void 0 || transactionsOpt === "none" ? void 0 : {
|
|
8740
|
+
timeoutMs: (transactionsOpt === "auto" ? void 0 : transactionsOpt.timeoutMs) ?? DEFAULT_TRANSACTION_TIMEOUT_MS
|
|
8741
|
+
};
|
|
8738
8742
|
const limitsConfig = config?.limits;
|
|
8739
8743
|
if (limitsConfig) {
|
|
8740
8744
|
const check = (policy, where) => {
|