@kronor/dtv 9.5.1 → 9.5.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.
@@ -54,7 +54,11 @@ export interface ActionAPI {
54
54
  ordering: DataOrdering | null;
55
55
  /** Build a GraphQLQueryAST for an arbitrary rootField (usually the current view root field). */
56
56
  generateGraphQLQueryAST: typeof generateGraphQLQueryAST;
57
- /** Build a GraphQLQueryAST with top-level selections aliased to column ids. */
57
+ /**
58
+ * Build a GraphQLQueryAST with top-level selections aliased to column ids. A column with
59
+ * several top-level queries has no single selection to alias: the result is then a failure
60
+ * naming those columns, and the caller narrows their `data` to the query it wants.
61
+ */
58
62
  generateColumnAliasedGraphQLQueryAST: typeof generateColumnAliasedGraphQLQueryAST;
59
63
  /** Render a GraphQLQueryAST to a string. */
60
64
  renderGraphQLQuery: typeof renderGraphQLQuery;
@@ -1,8 +1,19 @@
1
1
  import { ColumnDefinition, FieldQuery } from '../column-definition';
2
+ import { type Result } from '../result';
2
3
  import type { GraphQLQueryAST, GraphQLSelectionSet } from '@kronor/hasura-graphql';
3
4
  export declare function generateSelectionSetFromColumns(columns: ColumnDefinition[]): GraphQLSelectionSet;
4
- export declare function generateColumnAliasedSelectionSetFromColumns(columns: ColumnDefinition[]): GraphQLSelectionSet;
5
+ /**
6
+ * Why a column-aliased query cannot be built: these columns have several
7
+ * top-level queries, so none of them alone is the column's value. Which one is
8
+ * the caller's to say; pass such a column with `data` narrowed to that query.
9
+ */
10
+ export type ColumnAliasedQueryError = {
11
+ kind: 'severalTopLevelQueries';
12
+ columnIds: string[];
13
+ };
14
+ /** One selection per column, aliased with the column id. */
15
+ export declare function generateColumnAliasedSelectionSetFromColumns(columns: ColumnDefinition[]): Result<ColumnAliasedQueryError, GraphQLSelectionSet>;
5
16
  export declare function generateGraphQLQueryAST(rootField: string, columns: ColumnDefinition[], boolExpType: string, orderByType: string, paginationKey: string, staticArgs?: Record<string, unknown>, additionalFieldQueries?: readonly FieldQuery[]): GraphQLQueryAST;
6
- export declare function generateColumnAliasedGraphQLQueryAST(rootField: string, columns: ColumnDefinition[], boolExpType: string, orderByType: string, paginationKey: string, staticArgs?: Record<string, unknown>): GraphQLQueryAST;
17
+ export declare function generateColumnAliasedGraphQLQueryAST(rootField: string, columns: ColumnDefinition[], boolExpType: string, orderByType: string, paginationKey: string, staticArgs?: Record<string, unknown>): Result<ColumnAliasedQueryError, GraphQLQueryAST>;
7
18
  export declare function generateGraphQLQuery(rootField: string, columns: ColumnDefinition[], boolExpType: string, orderByType: string, paginationKey: string, staticArgs?: Record<string, unknown>, additionalFieldQueries?: readonly FieldQuery[]): string;
8
- export declare function generateColumnAliasedGraphQLQuery(rootField: string, columns: ColumnDefinition[], boolExpType: string, orderByType: string, paginationKey: string, staticArgs?: Record<string, unknown>): string;
19
+ export declare function generateColumnAliasedGraphQLQuery(rootField: string, columns: ColumnDefinition[], boolExpType: string, orderByType: string, paginationKey: string, staticArgs?: Record<string, unknown>): Result<ColumnAliasedQueryError, string>;
@@ -30,6 +30,7 @@ export type { ActionDefinition, ActionAPI, ActionUserDataAPI } from '../framewor
30
30
  export type { DTVAnalytics, DTVAnalyticsEvent, DTVAnalyticsEventBase, DTVAnalyticsEventPayload, DTVAnalyticsEventType, DTVAnalyticsSpan, DTVAnalyticsError, DTVAnalyticsPanel, DTVAnalyticsResets, DTVAnalyticsRetainedView, DTVAnalyticsUserDataError, FiltersAppliedTrigger, FetchReason } from '../framework/analytics';
31
31
  export type { FetchErrorInfo, FetchErrorKind } from '../framework/fetch-error';
32
32
  export type { HasuraFilterObject, HasuraOperator, HasuraOperatorFor, HasuraComparable, HasuraFilterExpression, GraphQLVariable, HasuraOrderBy, GraphQLSelectionSetItem, GraphQLSelectionSet, GraphQLQueryAST, } from '../framework/graphql';
33
+ export type { ColumnAliasedQueryError } from '../framework/graphql/query';
33
34
  export type { DataOrdering } from '../framework/data-ordering';
34
35
  export type { OrderDirection } from '../framework/order-direction';
35
36
  export { hasuraFilterExpressionToObject, hasuraFilterExpressionsAreEqual, buildHasuraConditions, hasuraOperatorsAreEqual, generateSelectionSetFromColumns, generateGraphQLQueryAST, generateGraphQLQuery, renderGraphQLQuery, } from '../framework/graphql';
@@ -42,6 +43,6 @@ export type { QueryBuilder } from '../dsl/queryForRow';
42
43
  export type { Query, ValueQuery, ObjectQuery, ArrayQuery, FieldAlias, OrderByConfig } from '@kronor/hasura-graphql';
43
44
  export { buildGraphQLQueryVariables } from '../framework/data';
44
45
  export { hasuraCustomOperatorTransform, mapHasuraCustomOperatorInput } from '../framework/native-runtime';
45
- export type { Result, Failure, Success } from '../framework/result';
46
- export { isFailure, isSuccess, failure, success } from '../framework/result';
46
+ export type { Failure, Success } from '../framework/result';
47
+ export { Result, isFailure, isSuccess, failure, success, mapResult, mapFailure, bimap, flatMap, getOrElse, match, unwrapResult, } from '../framework/result';
47
48
  export * as DSL from '../dsl';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronor/dtv",
3
- "version": "9.5.1",
3
+ "version": "9.5.2",
4
4
  "description": "Schema-driven, declarative table views with advanced filtering, data fetching and AI-assisted filter generation.",
5
5
  "repository": {
6
6
  "type": "git",