@constructive-io/data 0.3.0 → 0.6.0

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.d.cts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { DocumentNode, FieldNode, SelectionSetNode, VariableDefinitionNode } from 'graphql';
2
+ import { ConstructiveError } from '@constructive-io/errors';
3
+ export { ConstructiveError, ErrorClass, ErrorContext, ParsedError, classify, errors, format, isPublicCode, parse, toError } from '@constructive-io/errors';
2
4
 
3
5
  /**
4
6
  * Runtime types for Constructive's PostGraphile `_meta` contract.
@@ -1833,176 +1835,55 @@ declare function toOrderByEnumValue(fieldName: string, direction: 'asc' | 'desc'
1833
1835
  declare function toOrderByTypeName(tableName: string, table?: Table | null): string;
1834
1836
 
1835
1837
  /**
1836
- * Centralized error handling for the data layer
1837
- * Provides consistent error types, messages, and handling patterns
1838
- */
1839
- declare const DataErrorType: {
1840
- readonly NETWORK_ERROR: "NETWORK_ERROR";
1841
- readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
1842
- readonly VALIDATION_FAILED: "VALIDATION_FAILED";
1843
- readonly REQUIRED_FIELD_MISSING: "REQUIRED_FIELD_MISSING";
1844
- readonly INVALID_MUTATION_DATA: "INVALID_MUTATION_DATA";
1845
- readonly QUERY_GENERATION_FAILED: "QUERY_GENERATION_FAILED";
1846
- readonly QUERY_EXECUTION_FAILED: "QUERY_EXECUTION_FAILED";
1847
- readonly UNAUTHORIZED: "UNAUTHORIZED";
1848
- readonly FORBIDDEN: "FORBIDDEN";
1849
- readonly TABLE_NOT_FOUND: "TABLE_NOT_FOUND";
1850
- readonly BAD_REQUEST: "BAD_REQUEST";
1851
- readonly NOT_FOUND: "NOT_FOUND";
1852
- readonly GRAPHQL_ERROR: "GRAPHQL_ERROR";
1853
- readonly UNIQUE_VIOLATION: "UNIQUE_VIOLATION";
1854
- readonly FOREIGN_KEY_VIOLATION: "FOREIGN_KEY_VIOLATION";
1855
- readonly NOT_NULL_VIOLATION: "NOT_NULL_VIOLATION";
1856
- readonly CHECK_VIOLATION: "CHECK_VIOLATION";
1857
- readonly EXCLUSION_VIOLATION: "EXCLUSION_VIOLATION";
1858
- readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
1859
- };
1860
- type DataErrorType = (typeof DataErrorType)[keyof typeof DataErrorType];
1861
- interface DataErrorOptions {
1862
- /** Optional table name for data-layer operations */
1863
- tableName?: string;
1864
- /** Optional field name for data-layer operations */
1865
- fieldName?: string;
1866
- /** Optional constraint name for PostgreSQL constraint violations */
1867
- constraint?: string;
1868
- originalError?: Error;
1869
- code?: string;
1870
- context?: Record<string, unknown>;
1871
- }
1872
- /**
1873
- * Standard data layer error class
1874
- */
1875
- declare class DataError extends Error {
1876
- readonly type: DataErrorType;
1877
- readonly code?: string;
1878
- readonly originalError?: Error;
1879
- readonly context?: Record<string, unknown>;
1880
- readonly tableName?: string;
1881
- readonly fieldName?: string;
1882
- readonly constraint?: string;
1883
- constructor(type: DataErrorType, message: string, options?: DataErrorOptions);
1884
- /**
1885
- * Get a user-friendly error message.
1886
- * Checks constraint-specific messages first, then falls back to generic messages.
1887
- */
1888
- getUserMessage(): string;
1889
- /**
1890
- * Check if this error is retryable
1891
- */
1892
- isRetryable(): boolean;
1893
- /**
1894
- * Get error details for logging
1895
- */
1896
- getLogDetails(): Record<string, unknown>;
1897
- }
1898
- interface GraphQLErrorLocation {
1899
- line: number;
1900
- column: number;
1901
- }
1902
- type GraphQLErrorPath = Array<string | number>;
1903
- interface GraphQLError {
1904
- message: string;
1905
- extensions?: {
1906
- code?: string;
1907
- } & Record<string, unknown>;
1908
- locations?: GraphQLErrorLocation[];
1909
- path?: GraphQLErrorPath;
1910
- }
1911
- declare const createDataError: {
1912
- networkError: (originalError?: Error, tableName?: string) => DataError;
1913
- timeoutError: (originalError?: Error, tableName?: string) => DataError;
1914
- validationFailed: (tableName: string | undefined, validationErrors: string[]) => DataError;
1915
- requiredFieldMissing: (fieldName: string, tableName?: string) => DataError;
1916
- unauthorized: (message?: string, tableName?: string) => DataError;
1917
- forbidden: (tableName?: string) => DataError;
1918
- queryGenerationFailed: (message: string, tableName?: string, code?: string) => DataError;
1919
- queryExecutionFailed: (message: string, tableName?: string, code?: string) => DataError;
1920
- tableNotFound: (message?: string, tableName?: string, code?: string) => DataError;
1921
- invalidMutationData: (message: string, tableName?: string, code?: string, context?: Record<string, unknown>) => DataError;
1922
- uniqueViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1923
- foreignKeyViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1924
- notNullViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1925
- checkViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1926
- exclusionViolation: (message: string, tableName?: string, constraint?: string) => DataError;
1927
- unknown: (originalError: Error, tableName?: string) => DataError;
1928
- };
1929
- declare const createError: {
1930
- network: (originalError?: Error) => DataError;
1931
- timeout: (originalError?: Error) => DataError;
1932
- unauthorized: (message?: string) => DataError;
1933
- forbidden: (message?: string) => DataError;
1934
- badRequest: (message: string, code?: string) => DataError;
1935
- notFound: (message?: string) => DataError;
1936
- graphql: (message: string, code?: string) => DataError;
1937
- unknown: (originalError: Error) => DataError;
1938
- };
1939
- /**
1940
- * PostgreSQL SQLSTATE error codes
1941
- * https://www.postgresql.org/docs/current/errcodes-appendix.html
1942
- */
1943
- declare const PG_ERROR_CODES: {
1944
- readonly UNIQUE_VIOLATION: "23505";
1945
- readonly FOREIGN_KEY_VIOLATION: "23503";
1946
- readonly NOT_NULL_VIOLATION: "23502";
1947
- readonly CHECK_VIOLATION: "23514";
1948
- readonly EXCLUSION_VIOLATION: "23P01";
1949
- readonly NUMERIC_VALUE_OUT_OF_RANGE: "22003";
1950
- readonly STRING_DATA_RIGHT_TRUNCATION: "22001";
1951
- readonly INVALID_TEXT_REPRESENTATION: "22P02";
1952
- readonly DATETIME_FIELD_OVERFLOW: "22008";
1953
- readonly UNDEFINED_TABLE: "42P01";
1954
- readonly UNDEFINED_COLUMN: "42703";
1955
- readonly INSUFFICIENT_PRIVILEGE: "42501";
1956
- readonly DISK_FULL: "53100";
1957
- readonly OUT_OF_MEMORY: "53200";
1958
- readonly TOO_MANY_CONNECTIONS: "53300";
1959
- };
1960
- declare function parseGraphQLErrorCode(code: string | undefined): DataErrorType;
1961
- /**
1962
- * Generic error matching API.
1963
- * Works with any DataErrorType — no need for per-type helper functions.
1964
- */
1965
- declare const Errors: {
1966
- /** Map a raw extensions.code to its DataErrorType */
1967
- readonly parse: (code: string | undefined) => DataErrorType;
1968
- /** Check if a raw extensions.code matches a DataErrorType */
1969
- readonly is: (code: unknown, type: DataErrorType) => boolean;
1970
- /** Check if any error object matches a DataErrorType */
1971
- readonly match: (error: unknown, type: DataErrorType) => boolean;
1972
- /** Parse any error into a classified DataError */
1973
- readonly from: (error: unknown, tableName?: string) => DataError;
1974
- };
1975
- /**
1976
- * Parse any error into a DataError.
1977
- * Optional tableName adds context for data-layer operations.
1838
+ * Data-layer error handling.
1839
+ *
1840
+ * The canonical error system lives in `@constructive-io/errors`: one machine
1841
+ * `code`, structured `context`, public/internal `class`, localizable messages,
1842
+ * and cross-source parsing (PostgreSQL `DETAIL`, GraphQL `extensions`, message
1843
+ * tokens, SQLSTATE). This module re-exports it and adds the few app-level
1844
+ * ergonomics consumers rely on (retryability, a retry wrapper, a friendly
1845
+ * constraint-message overlay, and small factory/accessor helpers).
1978
1846
  */
1979
- declare function parseGraphQLError(error: unknown, tableName?: string): DataError;
1980
- declare function parseError(error: unknown): DataError;
1981
- declare function handleDataError(error: unknown, tableName?: string): DataError;
1847
+
1848
+ /** The canonical machine code for any error (`null` when none can be determined). */
1849
+ declare function getErrorCode(error: unknown): string | null;
1850
+ declare function isAuthenticationError(error: unknown): boolean;
1851
+ /** Whether an error is safe to retry (transient network/timeout/rate-limit). */
1852
+ declare function isRetryable(error: unknown): boolean;
1853
+ /** Run `fn`, retrying only retryable failures. Rejects with a {@link ConstructiveError}. */
1982
1854
  declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, delayMs?: number): Promise<T>;
1855
+ /** Construct canonical {@link ConstructiveError}s for common transport failures. */
1856
+ declare const createError: {
1857
+ network: (originalError?: Error) => ConstructiveError;
1858
+ timeout: () => ConstructiveError;
1859
+ unauthorized: (message?: string) => ConstructiveError;
1860
+ forbidden: (message?: string) => ConstructiveError;
1861
+ notFound: (message?: string) => ConstructiveError;
1862
+ badRequest: (message: string) => ConstructiveError;
1863
+ graphql: (message: string, code?: string) => ConstructiveError;
1864
+ unknown: (originalError: Error) => ConstructiveError;
1865
+ };
1983
1866
  /**
1984
1867
  * Constraint-specific human-friendly messages.
1985
- * Keys can be:
1986
- * - Exact constraint name: "database_schema_hash_key"
1987
- * - Pattern with wildcard prefix: "*_name_key" (matches any table's name unique constraint)
1988
1868
  *
1989
- * To add new translations, simply add entries to this map.
1869
+ * Keys can be an exact constraint name (`database_schema_hash_key`) or a
1870
+ * suffix pattern with a `*` prefix (`*_email_key`). This is app-specific UX
1871
+ * copy keyed by database constraint name; it overlays the canonical registry
1872
+ * message for constraint violations.
1990
1873
  */
1991
1874
  declare const CONSTRAINT_MESSAGES: Record<string, string>;
1992
- /**
1993
- * Get human-friendly message for a constraint violation.
1994
- * Checks exact match first, then pattern matches with * prefix.
1995
- */
1996
- declare function getConstraintMessage(constraint: string | undefined): string | undefined;
1997
- /**
1998
- * Parse any error and return a human-readable message.
1999
- * Use this in UI components for displaying errors to users.
2000
- *
2001
- * @param error - Any error (Error, GraphQL error, string, etc.)
2002
- * @param tableName - Optional table name for context
2003
- * @returns Human-friendly error message
2004
- */
2005
- declare function getHumanReadableError(error: unknown, tableName?: string): string;
1875
+ /** Friendly message for a constraint violation — exact match first, then `*` suffix patterns. */
1876
+ declare function getConstraintMessage(constraint: string | null | undefined): string | undefined;
1877
+ /** Normalize any error into a canonical {@link ConstructiveError}. */
1878
+ declare function parseError(error: unknown, locale?: string): ConstructiveError;
1879
+ /** Alias of {@link parseError} for GraphQL-shaped inputs. */
1880
+ declare function parseGraphQLError(error: unknown, locale?: string): ConstructiveError;
1881
+ /**
1882
+ * A user-facing message for any error. Prefers the friendly constraint overlay
1883
+ * when the error carries a `constraint`, otherwise the canonical (localized)
1884
+ * message.
1885
+ */
1886
+ declare function getHumanReadableError(error: unknown, locale?: string): string;
2006
1887
 
2007
1888
  /**
2008
1889
  * Centralized mutation input filtering utilities.
@@ -2547,7 +2428,7 @@ declare const MEMBERSHIP_TYPES: {
2547
2428
  readonly GROUP: 3;
2548
2429
  };
2549
2430
  type PolicyFieldType = 'string' | 'boolean' | 'integer' | 'uuid' | 'uuid[]';
2550
- type PolicyFieldComponent = 'table-select' | 'membership-type-select' | 'permission-select';
2431
+ type PolicyFieldComponent = 'table-select' | 'membership-type-select' | 'capability-select';
2551
2432
  type PolicyProvisioningCategory = 'has-module' | 'needs-fields' | 'needs-table' | 'no-fields';
2552
2433
  interface PolicyFieldOverride {
2553
2434
  type?: PolicyFieldType;
@@ -2613,4 +2494,4 @@ declare function buildNodeDataForDataNodeType(dataNodeType: string | undefined,
2613
2494
  declare function buildNodeData(policyType: string, policyData: Record<string, unknown>): Record<string, unknown>;
2614
2495
  declare function groupCrudOperationsByConfig<T extends string>(enabledOperations: T[], operations: Record<T, CrudOperationPolicyConfig>, privilegeMap: Record<T, string>): GroupedCrudPrivileges[];
2615
2496
 
2616
- export { type ASTFunctionParams, type ASTNode, CONSTRAINT_MESSAGES, CRUD_OPERATIONS, CRUD_TO_PRIVILEGE, type BelongsToRelation$1 as CleanBelongsToRelation, type CleanField, type HasManyRelation$1 as CleanHasManyRelation, type HasOneRelation$1 as CleanHasOneRelation, type ManyToManyRelation$1 as CleanManyToManyRelation, type Relations$1 as CleanRelations, type CleanTable, type ConnectionResult, type CrudOperation, type CrudOperationPolicyConfig, DATA_NODE_GENERATED_FIELDS, DEFAULT_CONSOLE_APPLICATION_SCOPES, DEFAULT_CRUD_GRANT_PRIVILEGES, DataError, type DataErrorOptions, DataErrorType, Errors, type FieldFilter$1 as FieldFilter, type FieldSelection, type FieldSelectionPreset, type Filter$1 as Filter, type FilterOperator$1 as FilterOperator, type GeneratedField, type GraphQLError, type GraphQLErrorLocation, type GraphQLErrorPath, type GraphQLVariableValue, type GraphQLVariables, type GroupedCrudPrivileges, type IQueryBuilder, type IntrospectionQueryResponse, type QueryIntrospectionSchema as IntrospectionSchema, MEMBERSHIP_TYPES, META_CONTRACT_INTROSPECTION_DOCUMENT, META_CONTRACT_INTROSPECTION_SOURCE, META_CONTRACT_REQUIREMENTS, META_CONTRACT_VERSION, META_DOCUMENT, META_QUERY_SOURCE, type MetaBelongsToRelation, type MetaConstraint, type MetaContractCompatibility, MetaContractError, type MetaContractIntrospectionQuery, type MetaContractStatus, type MetaContractTypeAlias, type MetaField$2 as MetaField, type MetaFieldType$2 as MetaFieldType, type MetaForeignConstraint, type MetaHasManyRelation, type MetaHasOneRelation, type MetaManyToManyRelation, type MetaObject, type MetaQuery, type MetaRelations, type MetaSchema, type MetaTable$2 as MetaTable, type MetaType, type Metaschema, type MetaschemaCheckConstraint, type MetaschemaConstraint, type MetaschemaConstraints, type MetaschemaEnum, type MetaschemaExclusionConstraint, type MetaschemaField, type MetaschemaForeignKeyConstraint, type MetaschemaI18n, type MetaschemaI18nField, type MetaschemaIndex, type MetaschemaPrimaryKeyConstraint, type MetaschemaRealtime, type MetaschemaScalarEncoding, type MetaschemaScope, type MetaschemaScopeTier, type MetaschemaSearch, type MetaschemaSearchColumn, type MetaschemaSearchConfig, type MetaschemaStorage, type MetaschemaTable, type MetaschemaTableBelongsToRelation, type MetaschemaTableHasRelation, type MetaschemaTableInflection, type MetaschemaTableManyToManyRelation, type MetaschemaTableQuery, type MetaschemaTableRelation, type MetaschemaType, type MetaschemaUniqueConstraint, type MutationASTParams, type MutationDefinition, type MutationOptions$1 as MutationOptions, type NestedProperties, type ObjectArrayItem, type OrderByItem$1 as OrderByItem, PG_ERROR_CODES, POLICY_PROVISIONING_CONFIG, type PageInfo, type PartialBy, type PolicyFieldComponent, type PolicyFieldOverride, type PolicyFieldType, type PolicyProvisioningCategory, type PolicyProvisioningConfig, type PrepareInputOptions, type MetaField as QBMetaField, type MetaFieldType as QBMetaFieldType, type MetaTable as QBMetaTable, QueryBuilder, type QueryBuilderInstance, type QueryBuilderOptions, type QueryBuilderResult, type QueryDefinition, type QueryFieldSelection, type QueryOptions$1 as QueryOptions, type QueryProperty, type QuerySelectionOptions, type RelationalFilter$1 as RelationalFilter, type RowIdentity, type RowIdentityDefinition, type RowIdentityField, type RowIdentityObject, type RowIdentityResolution, type RowIdentityValue, SCHEMA_INTROSPECTION_QUERY, type ScalarEncodingKind, type SchemaEnumFieldMapping, type SchemaEnumValueToken, type SchemaIntrospectionAnalysis, type SchemaIntrospectionCompatibility, type SchemaIntrospectionCompatibilityStatus, type SelectConsoleDataTablesOptions, type SelectionOptions, type SimpleFieldSelection, type StrictRecord, type TableInflection$1 as TableInflection, type TableOperationNames, type TableQueryNames$1 as TableQueryNames, type TableWriteCapability, type TransformSchemaResult, TypedDocumentString, type ValidationResult, analyzeSchemaIntrospectionCompatibility, asFieldIds, assertMetaContract, assertMetaQuery, assessMetaContract, assessSchemaIntrospectionCompatibility, assessTableWriteCapability, buildCount, buildFindOne, buildNodeData, buildNodeDataForDataNodeType, buildPostGraphileCreate, buildPostGraphileDelete, buildPostGraphileUpdate, buildSelect, buildTypeRegistry, cleanTable, cleanTableToMetaObject, convertFromMetaSchema, convertToSelectionOptions, createASTQueryBuilder, createDataError, createError, createOne, deleteOne, filterOperations, generateIntrospectionSchema, geometryAst, geometryCollectionAst, geometryPointAst, getAll, getAvailableRelations, getConstraintMessage, getCount, getCustomAst, getCustomAstForCleanField, getCustomOperations, getDataNodeForPolicy, getFieldsRequiringColumns, getGeneratedFields, getHumanReadableError, getMany, getOne, getPolicyCategory, getPolicyFieldDefaults, getPolicyProvisioningConfig, getRowIdentityDefinition, getSelections, getTableOperationNames, groupCrudOperationsByConfig, handleDataError, hasGeneratedFields, injectSchemaFields, intervalAst, isGraphQLVariableValue, isGraphQLVariables, isIntervalType, isRelationalField, isTableOperation, normalizeInflectionValue, normalizeSchemaEnumInputValues, parseError, parseGraphQLError, parseGraphQLErrorCode, parseMetaSearchWeights, patchOne, pgFieldToCamelCase, policyCanBeNodeless, policyRequiresDataNode, prepareCreateInput, prepareMutationInput, preparePatchInput, prepareUpdateInput, requiresSubfieldSelection, resolveRowIdentity, rowIdentityToPrimaryKey, sanitizePolicyData, selectConsoleDataTables, serializeRowIdentity, stripEmpty, toCamelCasePlural, toCamelCaseSingular, toCreateInputTypeName, toCreateMutationName, toDeleteInputTypeName, toDeleteMutationName, toFilterTypeName, toOrderByEnumValue, toOrderByTypeName, toPatchFieldName, toUpdateInputTypeName, toUpdateMutationName, transformSchemaToOperations, validateFieldSelection, validateMetaObject, withRetry };
2497
+ export { type ASTFunctionParams, type ASTNode, CONSTRAINT_MESSAGES, CRUD_OPERATIONS, CRUD_TO_PRIVILEGE, type BelongsToRelation$1 as CleanBelongsToRelation, type CleanField, type HasManyRelation$1 as CleanHasManyRelation, type HasOneRelation$1 as CleanHasOneRelation, type ManyToManyRelation$1 as CleanManyToManyRelation, type Relations$1 as CleanRelations, type CleanTable, type ConnectionResult, type CrudOperation, type CrudOperationPolicyConfig, DATA_NODE_GENERATED_FIELDS, DEFAULT_CONSOLE_APPLICATION_SCOPES, DEFAULT_CRUD_GRANT_PRIVILEGES, type FieldFilter$1 as FieldFilter, type FieldSelection, type FieldSelectionPreset, type Filter$1 as Filter, type FilterOperator$1 as FilterOperator, type GeneratedField, type GraphQLVariableValue, type GraphQLVariables, type GroupedCrudPrivileges, type IQueryBuilder, type IntrospectionQueryResponse, type QueryIntrospectionSchema as IntrospectionSchema, MEMBERSHIP_TYPES, META_CONTRACT_INTROSPECTION_DOCUMENT, META_CONTRACT_INTROSPECTION_SOURCE, META_CONTRACT_REQUIREMENTS, META_CONTRACT_VERSION, META_DOCUMENT, META_QUERY_SOURCE, type MetaBelongsToRelation, type MetaConstraint, type MetaContractCompatibility, MetaContractError, type MetaContractIntrospectionQuery, type MetaContractStatus, type MetaContractTypeAlias, type MetaField$2 as MetaField, type MetaFieldType$2 as MetaFieldType, type MetaForeignConstraint, type MetaHasManyRelation, type MetaHasOneRelation, type MetaManyToManyRelation, type MetaObject, type MetaQuery, type MetaRelations, type MetaSchema, type MetaTable$2 as MetaTable, type MetaType, type Metaschema, type MetaschemaCheckConstraint, type MetaschemaConstraint, type MetaschemaConstraints, type MetaschemaEnum, type MetaschemaExclusionConstraint, type MetaschemaField, type MetaschemaForeignKeyConstraint, type MetaschemaI18n, type MetaschemaI18nField, type MetaschemaIndex, type MetaschemaPrimaryKeyConstraint, type MetaschemaRealtime, type MetaschemaScalarEncoding, type MetaschemaScope, type MetaschemaScopeTier, type MetaschemaSearch, type MetaschemaSearchColumn, type MetaschemaSearchConfig, type MetaschemaStorage, type MetaschemaTable, type MetaschemaTableBelongsToRelation, type MetaschemaTableHasRelation, type MetaschemaTableInflection, type MetaschemaTableManyToManyRelation, type MetaschemaTableQuery, type MetaschemaTableRelation, type MetaschemaType, type MetaschemaUniqueConstraint, type MutationASTParams, type MutationDefinition, type MutationOptions$1 as MutationOptions, type NestedProperties, type ObjectArrayItem, type OrderByItem$1 as OrderByItem, POLICY_PROVISIONING_CONFIG, type PageInfo, type PartialBy, type PolicyFieldComponent, type PolicyFieldOverride, type PolicyFieldType, type PolicyProvisioningCategory, type PolicyProvisioningConfig, type PrepareInputOptions, type MetaField as QBMetaField, type MetaFieldType as QBMetaFieldType, type MetaTable as QBMetaTable, QueryBuilder, type QueryBuilderInstance, type QueryBuilderOptions, type QueryBuilderResult, type QueryDefinition, type QueryFieldSelection, type QueryOptions$1 as QueryOptions, type QueryProperty, type QuerySelectionOptions, type RelationalFilter$1 as RelationalFilter, type RowIdentity, type RowIdentityDefinition, type RowIdentityField, type RowIdentityObject, type RowIdentityResolution, type RowIdentityValue, SCHEMA_INTROSPECTION_QUERY, type ScalarEncodingKind, type SchemaEnumFieldMapping, type SchemaEnumValueToken, type SchemaIntrospectionAnalysis, type SchemaIntrospectionCompatibility, type SchemaIntrospectionCompatibilityStatus, type SelectConsoleDataTablesOptions, type SelectionOptions, type SimpleFieldSelection, type StrictRecord, type TableInflection$1 as TableInflection, type TableOperationNames, type TableQueryNames$1 as TableQueryNames, type TableWriteCapability, type TransformSchemaResult, TypedDocumentString, type ValidationResult, analyzeSchemaIntrospectionCompatibility, asFieldIds, assertMetaContract, assertMetaQuery, assessMetaContract, assessSchemaIntrospectionCompatibility, assessTableWriteCapability, buildCount, buildFindOne, buildNodeData, buildNodeDataForDataNodeType, buildPostGraphileCreate, buildPostGraphileDelete, buildPostGraphileUpdate, buildSelect, buildTypeRegistry, cleanTable, cleanTableToMetaObject, convertFromMetaSchema, convertToSelectionOptions, createASTQueryBuilder, createError, createOne, deleteOne, filterOperations, generateIntrospectionSchema, geometryAst, geometryCollectionAst, geometryPointAst, getAll, getAvailableRelations, getConstraintMessage, getCount, getCustomAst, getCustomAstForCleanField, getCustomOperations, getDataNodeForPolicy, getErrorCode, getFieldsRequiringColumns, getGeneratedFields, getHumanReadableError, getMany, getOne, getPolicyCategory, getPolicyFieldDefaults, getPolicyProvisioningConfig, getRowIdentityDefinition, getSelections, getTableOperationNames, groupCrudOperationsByConfig, hasGeneratedFields, injectSchemaFields, intervalAst, isAuthenticationError, isGraphQLVariableValue, isGraphQLVariables, isIntervalType, isRelationalField, isRetryable, isTableOperation, normalizeInflectionValue, normalizeSchemaEnumInputValues, parseError, parseGraphQLError, parseMetaSearchWeights, patchOne, pgFieldToCamelCase, policyCanBeNodeless, policyRequiresDataNode, prepareCreateInput, prepareMutationInput, preparePatchInput, prepareUpdateInput, requiresSubfieldSelection, resolveRowIdentity, rowIdentityToPrimaryKey, sanitizePolicyData, selectConsoleDataTables, serializeRowIdentity, stripEmpty, toCamelCasePlural, toCamelCaseSingular, toCreateInputTypeName, toCreateMutationName, toDeleteInputTypeName, toDeleteMutationName, toFilterTypeName, toOrderByEnumValue, toOrderByTypeName, toPatchFieldName, toUpdateInputTypeName, toUpdateMutationName, transformSchemaToOperations, validateFieldSelection, validateMetaObject, withRetry };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { DocumentNode, FieldNode, SelectionSetNode, VariableDefinitionNode } from 'graphql';
2
+ import { ConstructiveError } from '@constructive-io/errors';
3
+ export { ConstructiveError, ErrorClass, ErrorContext, ParsedError, classify, errors, format, isPublicCode, parse, toError } from '@constructive-io/errors';
2
4
 
3
5
  /**
4
6
  * Runtime types for Constructive's PostGraphile `_meta` contract.
@@ -1833,176 +1835,55 @@ declare function toOrderByEnumValue(fieldName: string, direction: 'asc' | 'desc'
1833
1835
  declare function toOrderByTypeName(tableName: string, table?: Table | null): string;
1834
1836
 
1835
1837
  /**
1836
- * Centralized error handling for the data layer
1837
- * Provides consistent error types, messages, and handling patterns
1838
- */
1839
- declare const DataErrorType: {
1840
- readonly NETWORK_ERROR: "NETWORK_ERROR";
1841
- readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
1842
- readonly VALIDATION_FAILED: "VALIDATION_FAILED";
1843
- readonly REQUIRED_FIELD_MISSING: "REQUIRED_FIELD_MISSING";
1844
- readonly INVALID_MUTATION_DATA: "INVALID_MUTATION_DATA";
1845
- readonly QUERY_GENERATION_FAILED: "QUERY_GENERATION_FAILED";
1846
- readonly QUERY_EXECUTION_FAILED: "QUERY_EXECUTION_FAILED";
1847
- readonly UNAUTHORIZED: "UNAUTHORIZED";
1848
- readonly FORBIDDEN: "FORBIDDEN";
1849
- readonly TABLE_NOT_FOUND: "TABLE_NOT_FOUND";
1850
- readonly BAD_REQUEST: "BAD_REQUEST";
1851
- readonly NOT_FOUND: "NOT_FOUND";
1852
- readonly GRAPHQL_ERROR: "GRAPHQL_ERROR";
1853
- readonly UNIQUE_VIOLATION: "UNIQUE_VIOLATION";
1854
- readonly FOREIGN_KEY_VIOLATION: "FOREIGN_KEY_VIOLATION";
1855
- readonly NOT_NULL_VIOLATION: "NOT_NULL_VIOLATION";
1856
- readonly CHECK_VIOLATION: "CHECK_VIOLATION";
1857
- readonly EXCLUSION_VIOLATION: "EXCLUSION_VIOLATION";
1858
- readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
1859
- };
1860
- type DataErrorType = (typeof DataErrorType)[keyof typeof DataErrorType];
1861
- interface DataErrorOptions {
1862
- /** Optional table name for data-layer operations */
1863
- tableName?: string;
1864
- /** Optional field name for data-layer operations */
1865
- fieldName?: string;
1866
- /** Optional constraint name for PostgreSQL constraint violations */
1867
- constraint?: string;
1868
- originalError?: Error;
1869
- code?: string;
1870
- context?: Record<string, unknown>;
1871
- }
1872
- /**
1873
- * Standard data layer error class
1874
- */
1875
- declare class DataError extends Error {
1876
- readonly type: DataErrorType;
1877
- readonly code?: string;
1878
- readonly originalError?: Error;
1879
- readonly context?: Record<string, unknown>;
1880
- readonly tableName?: string;
1881
- readonly fieldName?: string;
1882
- readonly constraint?: string;
1883
- constructor(type: DataErrorType, message: string, options?: DataErrorOptions);
1884
- /**
1885
- * Get a user-friendly error message.
1886
- * Checks constraint-specific messages first, then falls back to generic messages.
1887
- */
1888
- getUserMessage(): string;
1889
- /**
1890
- * Check if this error is retryable
1891
- */
1892
- isRetryable(): boolean;
1893
- /**
1894
- * Get error details for logging
1895
- */
1896
- getLogDetails(): Record<string, unknown>;
1897
- }
1898
- interface GraphQLErrorLocation {
1899
- line: number;
1900
- column: number;
1901
- }
1902
- type GraphQLErrorPath = Array<string | number>;
1903
- interface GraphQLError {
1904
- message: string;
1905
- extensions?: {
1906
- code?: string;
1907
- } & Record<string, unknown>;
1908
- locations?: GraphQLErrorLocation[];
1909
- path?: GraphQLErrorPath;
1910
- }
1911
- declare const createDataError: {
1912
- networkError: (originalError?: Error, tableName?: string) => DataError;
1913
- timeoutError: (originalError?: Error, tableName?: string) => DataError;
1914
- validationFailed: (tableName: string | undefined, validationErrors: string[]) => DataError;
1915
- requiredFieldMissing: (fieldName: string, tableName?: string) => DataError;
1916
- unauthorized: (message?: string, tableName?: string) => DataError;
1917
- forbidden: (tableName?: string) => DataError;
1918
- queryGenerationFailed: (message: string, tableName?: string, code?: string) => DataError;
1919
- queryExecutionFailed: (message: string, tableName?: string, code?: string) => DataError;
1920
- tableNotFound: (message?: string, tableName?: string, code?: string) => DataError;
1921
- invalidMutationData: (message: string, tableName?: string, code?: string, context?: Record<string, unknown>) => DataError;
1922
- uniqueViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1923
- foreignKeyViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1924
- notNullViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1925
- checkViolation: (message: string, tableName?: string, fieldName?: string, constraint?: string) => DataError;
1926
- exclusionViolation: (message: string, tableName?: string, constraint?: string) => DataError;
1927
- unknown: (originalError: Error, tableName?: string) => DataError;
1928
- };
1929
- declare const createError: {
1930
- network: (originalError?: Error) => DataError;
1931
- timeout: (originalError?: Error) => DataError;
1932
- unauthorized: (message?: string) => DataError;
1933
- forbidden: (message?: string) => DataError;
1934
- badRequest: (message: string, code?: string) => DataError;
1935
- notFound: (message?: string) => DataError;
1936
- graphql: (message: string, code?: string) => DataError;
1937
- unknown: (originalError: Error) => DataError;
1938
- };
1939
- /**
1940
- * PostgreSQL SQLSTATE error codes
1941
- * https://www.postgresql.org/docs/current/errcodes-appendix.html
1942
- */
1943
- declare const PG_ERROR_CODES: {
1944
- readonly UNIQUE_VIOLATION: "23505";
1945
- readonly FOREIGN_KEY_VIOLATION: "23503";
1946
- readonly NOT_NULL_VIOLATION: "23502";
1947
- readonly CHECK_VIOLATION: "23514";
1948
- readonly EXCLUSION_VIOLATION: "23P01";
1949
- readonly NUMERIC_VALUE_OUT_OF_RANGE: "22003";
1950
- readonly STRING_DATA_RIGHT_TRUNCATION: "22001";
1951
- readonly INVALID_TEXT_REPRESENTATION: "22P02";
1952
- readonly DATETIME_FIELD_OVERFLOW: "22008";
1953
- readonly UNDEFINED_TABLE: "42P01";
1954
- readonly UNDEFINED_COLUMN: "42703";
1955
- readonly INSUFFICIENT_PRIVILEGE: "42501";
1956
- readonly DISK_FULL: "53100";
1957
- readonly OUT_OF_MEMORY: "53200";
1958
- readonly TOO_MANY_CONNECTIONS: "53300";
1959
- };
1960
- declare function parseGraphQLErrorCode(code: string | undefined): DataErrorType;
1961
- /**
1962
- * Generic error matching API.
1963
- * Works with any DataErrorType — no need for per-type helper functions.
1964
- */
1965
- declare const Errors: {
1966
- /** Map a raw extensions.code to its DataErrorType */
1967
- readonly parse: (code: string | undefined) => DataErrorType;
1968
- /** Check if a raw extensions.code matches a DataErrorType */
1969
- readonly is: (code: unknown, type: DataErrorType) => boolean;
1970
- /** Check if any error object matches a DataErrorType */
1971
- readonly match: (error: unknown, type: DataErrorType) => boolean;
1972
- /** Parse any error into a classified DataError */
1973
- readonly from: (error: unknown, tableName?: string) => DataError;
1974
- };
1975
- /**
1976
- * Parse any error into a DataError.
1977
- * Optional tableName adds context for data-layer operations.
1838
+ * Data-layer error handling.
1839
+ *
1840
+ * The canonical error system lives in `@constructive-io/errors`: one machine
1841
+ * `code`, structured `context`, public/internal `class`, localizable messages,
1842
+ * and cross-source parsing (PostgreSQL `DETAIL`, GraphQL `extensions`, message
1843
+ * tokens, SQLSTATE). This module re-exports it and adds the few app-level
1844
+ * ergonomics consumers rely on (retryability, a retry wrapper, a friendly
1845
+ * constraint-message overlay, and small factory/accessor helpers).
1978
1846
  */
1979
- declare function parseGraphQLError(error: unknown, tableName?: string): DataError;
1980
- declare function parseError(error: unknown): DataError;
1981
- declare function handleDataError(error: unknown, tableName?: string): DataError;
1847
+
1848
+ /** The canonical machine code for any error (`null` when none can be determined). */
1849
+ declare function getErrorCode(error: unknown): string | null;
1850
+ declare function isAuthenticationError(error: unknown): boolean;
1851
+ /** Whether an error is safe to retry (transient network/timeout/rate-limit). */
1852
+ declare function isRetryable(error: unknown): boolean;
1853
+ /** Run `fn`, retrying only retryable failures. Rejects with a {@link ConstructiveError}. */
1982
1854
  declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, delayMs?: number): Promise<T>;
1855
+ /** Construct canonical {@link ConstructiveError}s for common transport failures. */
1856
+ declare const createError: {
1857
+ network: (originalError?: Error) => ConstructiveError;
1858
+ timeout: () => ConstructiveError;
1859
+ unauthorized: (message?: string) => ConstructiveError;
1860
+ forbidden: (message?: string) => ConstructiveError;
1861
+ notFound: (message?: string) => ConstructiveError;
1862
+ badRequest: (message: string) => ConstructiveError;
1863
+ graphql: (message: string, code?: string) => ConstructiveError;
1864
+ unknown: (originalError: Error) => ConstructiveError;
1865
+ };
1983
1866
  /**
1984
1867
  * Constraint-specific human-friendly messages.
1985
- * Keys can be:
1986
- * - Exact constraint name: "database_schema_hash_key"
1987
- * - Pattern with wildcard prefix: "*_name_key" (matches any table's name unique constraint)
1988
1868
  *
1989
- * To add new translations, simply add entries to this map.
1869
+ * Keys can be an exact constraint name (`database_schema_hash_key`) or a
1870
+ * suffix pattern with a `*` prefix (`*_email_key`). This is app-specific UX
1871
+ * copy keyed by database constraint name; it overlays the canonical registry
1872
+ * message for constraint violations.
1990
1873
  */
1991
1874
  declare const CONSTRAINT_MESSAGES: Record<string, string>;
1992
- /**
1993
- * Get human-friendly message for a constraint violation.
1994
- * Checks exact match first, then pattern matches with * prefix.
1995
- */
1996
- declare function getConstraintMessage(constraint: string | undefined): string | undefined;
1997
- /**
1998
- * Parse any error and return a human-readable message.
1999
- * Use this in UI components for displaying errors to users.
2000
- *
2001
- * @param error - Any error (Error, GraphQL error, string, etc.)
2002
- * @param tableName - Optional table name for context
2003
- * @returns Human-friendly error message
2004
- */
2005
- declare function getHumanReadableError(error: unknown, tableName?: string): string;
1875
+ /** Friendly message for a constraint violation — exact match first, then `*` suffix patterns. */
1876
+ declare function getConstraintMessage(constraint: string | null | undefined): string | undefined;
1877
+ /** Normalize any error into a canonical {@link ConstructiveError}. */
1878
+ declare function parseError(error: unknown, locale?: string): ConstructiveError;
1879
+ /** Alias of {@link parseError} for GraphQL-shaped inputs. */
1880
+ declare function parseGraphQLError(error: unknown, locale?: string): ConstructiveError;
1881
+ /**
1882
+ * A user-facing message for any error. Prefers the friendly constraint overlay
1883
+ * when the error carries a `constraint`, otherwise the canonical (localized)
1884
+ * message.
1885
+ */
1886
+ declare function getHumanReadableError(error: unknown, locale?: string): string;
2006
1887
 
2007
1888
  /**
2008
1889
  * Centralized mutation input filtering utilities.
@@ -2547,7 +2428,7 @@ declare const MEMBERSHIP_TYPES: {
2547
2428
  readonly GROUP: 3;
2548
2429
  };
2549
2430
  type PolicyFieldType = 'string' | 'boolean' | 'integer' | 'uuid' | 'uuid[]';
2550
- type PolicyFieldComponent = 'table-select' | 'membership-type-select' | 'permission-select';
2431
+ type PolicyFieldComponent = 'table-select' | 'membership-type-select' | 'capability-select';
2551
2432
  type PolicyProvisioningCategory = 'has-module' | 'needs-fields' | 'needs-table' | 'no-fields';
2552
2433
  interface PolicyFieldOverride {
2553
2434
  type?: PolicyFieldType;
@@ -2613,4 +2494,4 @@ declare function buildNodeDataForDataNodeType(dataNodeType: string | undefined,
2613
2494
  declare function buildNodeData(policyType: string, policyData: Record<string, unknown>): Record<string, unknown>;
2614
2495
  declare function groupCrudOperationsByConfig<T extends string>(enabledOperations: T[], operations: Record<T, CrudOperationPolicyConfig>, privilegeMap: Record<T, string>): GroupedCrudPrivileges[];
2615
2496
 
2616
- export { type ASTFunctionParams, type ASTNode, CONSTRAINT_MESSAGES, CRUD_OPERATIONS, CRUD_TO_PRIVILEGE, type BelongsToRelation$1 as CleanBelongsToRelation, type CleanField, type HasManyRelation$1 as CleanHasManyRelation, type HasOneRelation$1 as CleanHasOneRelation, type ManyToManyRelation$1 as CleanManyToManyRelation, type Relations$1 as CleanRelations, type CleanTable, type ConnectionResult, type CrudOperation, type CrudOperationPolicyConfig, DATA_NODE_GENERATED_FIELDS, DEFAULT_CONSOLE_APPLICATION_SCOPES, DEFAULT_CRUD_GRANT_PRIVILEGES, DataError, type DataErrorOptions, DataErrorType, Errors, type FieldFilter$1 as FieldFilter, type FieldSelection, type FieldSelectionPreset, type Filter$1 as Filter, type FilterOperator$1 as FilterOperator, type GeneratedField, type GraphQLError, type GraphQLErrorLocation, type GraphQLErrorPath, type GraphQLVariableValue, type GraphQLVariables, type GroupedCrudPrivileges, type IQueryBuilder, type IntrospectionQueryResponse, type QueryIntrospectionSchema as IntrospectionSchema, MEMBERSHIP_TYPES, META_CONTRACT_INTROSPECTION_DOCUMENT, META_CONTRACT_INTROSPECTION_SOURCE, META_CONTRACT_REQUIREMENTS, META_CONTRACT_VERSION, META_DOCUMENT, META_QUERY_SOURCE, type MetaBelongsToRelation, type MetaConstraint, type MetaContractCompatibility, MetaContractError, type MetaContractIntrospectionQuery, type MetaContractStatus, type MetaContractTypeAlias, type MetaField$2 as MetaField, type MetaFieldType$2 as MetaFieldType, type MetaForeignConstraint, type MetaHasManyRelation, type MetaHasOneRelation, type MetaManyToManyRelation, type MetaObject, type MetaQuery, type MetaRelations, type MetaSchema, type MetaTable$2 as MetaTable, type MetaType, type Metaschema, type MetaschemaCheckConstraint, type MetaschemaConstraint, type MetaschemaConstraints, type MetaschemaEnum, type MetaschemaExclusionConstraint, type MetaschemaField, type MetaschemaForeignKeyConstraint, type MetaschemaI18n, type MetaschemaI18nField, type MetaschemaIndex, type MetaschemaPrimaryKeyConstraint, type MetaschemaRealtime, type MetaschemaScalarEncoding, type MetaschemaScope, type MetaschemaScopeTier, type MetaschemaSearch, type MetaschemaSearchColumn, type MetaschemaSearchConfig, type MetaschemaStorage, type MetaschemaTable, type MetaschemaTableBelongsToRelation, type MetaschemaTableHasRelation, type MetaschemaTableInflection, type MetaschemaTableManyToManyRelation, type MetaschemaTableQuery, type MetaschemaTableRelation, type MetaschemaType, type MetaschemaUniqueConstraint, type MutationASTParams, type MutationDefinition, type MutationOptions$1 as MutationOptions, type NestedProperties, type ObjectArrayItem, type OrderByItem$1 as OrderByItem, PG_ERROR_CODES, POLICY_PROVISIONING_CONFIG, type PageInfo, type PartialBy, type PolicyFieldComponent, type PolicyFieldOverride, type PolicyFieldType, type PolicyProvisioningCategory, type PolicyProvisioningConfig, type PrepareInputOptions, type MetaField as QBMetaField, type MetaFieldType as QBMetaFieldType, type MetaTable as QBMetaTable, QueryBuilder, type QueryBuilderInstance, type QueryBuilderOptions, type QueryBuilderResult, type QueryDefinition, type QueryFieldSelection, type QueryOptions$1 as QueryOptions, type QueryProperty, type QuerySelectionOptions, type RelationalFilter$1 as RelationalFilter, type RowIdentity, type RowIdentityDefinition, type RowIdentityField, type RowIdentityObject, type RowIdentityResolution, type RowIdentityValue, SCHEMA_INTROSPECTION_QUERY, type ScalarEncodingKind, type SchemaEnumFieldMapping, type SchemaEnumValueToken, type SchemaIntrospectionAnalysis, type SchemaIntrospectionCompatibility, type SchemaIntrospectionCompatibilityStatus, type SelectConsoleDataTablesOptions, type SelectionOptions, type SimpleFieldSelection, type StrictRecord, type TableInflection$1 as TableInflection, type TableOperationNames, type TableQueryNames$1 as TableQueryNames, type TableWriteCapability, type TransformSchemaResult, TypedDocumentString, type ValidationResult, analyzeSchemaIntrospectionCompatibility, asFieldIds, assertMetaContract, assertMetaQuery, assessMetaContract, assessSchemaIntrospectionCompatibility, assessTableWriteCapability, buildCount, buildFindOne, buildNodeData, buildNodeDataForDataNodeType, buildPostGraphileCreate, buildPostGraphileDelete, buildPostGraphileUpdate, buildSelect, buildTypeRegistry, cleanTable, cleanTableToMetaObject, convertFromMetaSchema, convertToSelectionOptions, createASTQueryBuilder, createDataError, createError, createOne, deleteOne, filterOperations, generateIntrospectionSchema, geometryAst, geometryCollectionAst, geometryPointAst, getAll, getAvailableRelations, getConstraintMessage, getCount, getCustomAst, getCustomAstForCleanField, getCustomOperations, getDataNodeForPolicy, getFieldsRequiringColumns, getGeneratedFields, getHumanReadableError, getMany, getOne, getPolicyCategory, getPolicyFieldDefaults, getPolicyProvisioningConfig, getRowIdentityDefinition, getSelections, getTableOperationNames, groupCrudOperationsByConfig, handleDataError, hasGeneratedFields, injectSchemaFields, intervalAst, isGraphQLVariableValue, isGraphQLVariables, isIntervalType, isRelationalField, isTableOperation, normalizeInflectionValue, normalizeSchemaEnumInputValues, parseError, parseGraphQLError, parseGraphQLErrorCode, parseMetaSearchWeights, patchOne, pgFieldToCamelCase, policyCanBeNodeless, policyRequiresDataNode, prepareCreateInput, prepareMutationInput, preparePatchInput, prepareUpdateInput, requiresSubfieldSelection, resolveRowIdentity, rowIdentityToPrimaryKey, sanitizePolicyData, selectConsoleDataTables, serializeRowIdentity, stripEmpty, toCamelCasePlural, toCamelCaseSingular, toCreateInputTypeName, toCreateMutationName, toDeleteInputTypeName, toDeleteMutationName, toFilterTypeName, toOrderByEnumValue, toOrderByTypeName, toPatchFieldName, toUpdateInputTypeName, toUpdateMutationName, transformSchemaToOperations, validateFieldSelection, validateMetaObject, withRetry };
2497
+ export { type ASTFunctionParams, type ASTNode, CONSTRAINT_MESSAGES, CRUD_OPERATIONS, CRUD_TO_PRIVILEGE, type BelongsToRelation$1 as CleanBelongsToRelation, type CleanField, type HasManyRelation$1 as CleanHasManyRelation, type HasOneRelation$1 as CleanHasOneRelation, type ManyToManyRelation$1 as CleanManyToManyRelation, type Relations$1 as CleanRelations, type CleanTable, type ConnectionResult, type CrudOperation, type CrudOperationPolicyConfig, DATA_NODE_GENERATED_FIELDS, DEFAULT_CONSOLE_APPLICATION_SCOPES, DEFAULT_CRUD_GRANT_PRIVILEGES, type FieldFilter$1 as FieldFilter, type FieldSelection, type FieldSelectionPreset, type Filter$1 as Filter, type FilterOperator$1 as FilterOperator, type GeneratedField, type GraphQLVariableValue, type GraphQLVariables, type GroupedCrudPrivileges, type IQueryBuilder, type IntrospectionQueryResponse, type QueryIntrospectionSchema as IntrospectionSchema, MEMBERSHIP_TYPES, META_CONTRACT_INTROSPECTION_DOCUMENT, META_CONTRACT_INTROSPECTION_SOURCE, META_CONTRACT_REQUIREMENTS, META_CONTRACT_VERSION, META_DOCUMENT, META_QUERY_SOURCE, type MetaBelongsToRelation, type MetaConstraint, type MetaContractCompatibility, MetaContractError, type MetaContractIntrospectionQuery, type MetaContractStatus, type MetaContractTypeAlias, type MetaField$2 as MetaField, type MetaFieldType$2 as MetaFieldType, type MetaForeignConstraint, type MetaHasManyRelation, type MetaHasOneRelation, type MetaManyToManyRelation, type MetaObject, type MetaQuery, type MetaRelations, type MetaSchema, type MetaTable$2 as MetaTable, type MetaType, type Metaschema, type MetaschemaCheckConstraint, type MetaschemaConstraint, type MetaschemaConstraints, type MetaschemaEnum, type MetaschemaExclusionConstraint, type MetaschemaField, type MetaschemaForeignKeyConstraint, type MetaschemaI18n, type MetaschemaI18nField, type MetaschemaIndex, type MetaschemaPrimaryKeyConstraint, type MetaschemaRealtime, type MetaschemaScalarEncoding, type MetaschemaScope, type MetaschemaScopeTier, type MetaschemaSearch, type MetaschemaSearchColumn, type MetaschemaSearchConfig, type MetaschemaStorage, type MetaschemaTable, type MetaschemaTableBelongsToRelation, type MetaschemaTableHasRelation, type MetaschemaTableInflection, type MetaschemaTableManyToManyRelation, type MetaschemaTableQuery, type MetaschemaTableRelation, type MetaschemaType, type MetaschemaUniqueConstraint, type MutationASTParams, type MutationDefinition, type MutationOptions$1 as MutationOptions, type NestedProperties, type ObjectArrayItem, type OrderByItem$1 as OrderByItem, POLICY_PROVISIONING_CONFIG, type PageInfo, type PartialBy, type PolicyFieldComponent, type PolicyFieldOverride, type PolicyFieldType, type PolicyProvisioningCategory, type PolicyProvisioningConfig, type PrepareInputOptions, type MetaField as QBMetaField, type MetaFieldType as QBMetaFieldType, type MetaTable as QBMetaTable, QueryBuilder, type QueryBuilderInstance, type QueryBuilderOptions, type QueryBuilderResult, type QueryDefinition, type QueryFieldSelection, type QueryOptions$1 as QueryOptions, type QueryProperty, type QuerySelectionOptions, type RelationalFilter$1 as RelationalFilter, type RowIdentity, type RowIdentityDefinition, type RowIdentityField, type RowIdentityObject, type RowIdentityResolution, type RowIdentityValue, SCHEMA_INTROSPECTION_QUERY, type ScalarEncodingKind, type SchemaEnumFieldMapping, type SchemaEnumValueToken, type SchemaIntrospectionAnalysis, type SchemaIntrospectionCompatibility, type SchemaIntrospectionCompatibilityStatus, type SelectConsoleDataTablesOptions, type SelectionOptions, type SimpleFieldSelection, type StrictRecord, type TableInflection$1 as TableInflection, type TableOperationNames, type TableQueryNames$1 as TableQueryNames, type TableWriteCapability, type TransformSchemaResult, TypedDocumentString, type ValidationResult, analyzeSchemaIntrospectionCompatibility, asFieldIds, assertMetaContract, assertMetaQuery, assessMetaContract, assessSchemaIntrospectionCompatibility, assessTableWriteCapability, buildCount, buildFindOne, buildNodeData, buildNodeDataForDataNodeType, buildPostGraphileCreate, buildPostGraphileDelete, buildPostGraphileUpdate, buildSelect, buildTypeRegistry, cleanTable, cleanTableToMetaObject, convertFromMetaSchema, convertToSelectionOptions, createASTQueryBuilder, createError, createOne, deleteOne, filterOperations, generateIntrospectionSchema, geometryAst, geometryCollectionAst, geometryPointAst, getAll, getAvailableRelations, getConstraintMessage, getCount, getCustomAst, getCustomAstForCleanField, getCustomOperations, getDataNodeForPolicy, getErrorCode, getFieldsRequiringColumns, getGeneratedFields, getHumanReadableError, getMany, getOne, getPolicyCategory, getPolicyFieldDefaults, getPolicyProvisioningConfig, getRowIdentityDefinition, getSelections, getTableOperationNames, groupCrudOperationsByConfig, hasGeneratedFields, injectSchemaFields, intervalAst, isAuthenticationError, isGraphQLVariableValue, isGraphQLVariables, isIntervalType, isRelationalField, isRetryable, isTableOperation, normalizeInflectionValue, normalizeSchemaEnumInputValues, parseError, parseGraphQLError, parseMetaSearchWeights, patchOne, pgFieldToCamelCase, policyCanBeNodeless, policyRequiresDataNode, prepareCreateInput, prepareMutationInput, preparePatchInput, prepareUpdateInput, requiresSubfieldSelection, resolveRowIdentity, rowIdentityToPrimaryKey, sanitizePolicyData, selectConsoleDataTables, serializeRowIdentity, stripEmpty, toCamelCasePlural, toCamelCaseSingular, toCreateInputTypeName, toCreateMutationName, toDeleteInputTypeName, toDeleteMutationName, toFilterTypeName, toOrderByEnumValue, toOrderByTypeName, toPatchFieldName, toUpdateInputTypeName, toUpdateMutationName, transformSchemaToOperations, validateFieldSelection, validateMetaObject, withRetry };