fastapi-rtk 2.4.2 → 2.5.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/.bundled/jsonforms/cjs/_virtual/index10.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index6.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index7.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index8.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index9.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/complex/MantineTableControl/MantineTableControl.cjs +3 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useArrayHeaderErrors.cjs +44 -0
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useNullableErrorProps.cjs +10 -14
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/Array/MantineArrayLayout.cjs +3 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/utils/nullOptionErrors.cjs +31 -0
- package/dist/.bundled/jsonforms/esm/_virtual/index10.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index6.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index7.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index8.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index9.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/complex/MantineTableControl/MantineTableControl.mjs +3 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useArrayHeaderErrors.mjs +44 -0
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useNullableErrorProps.mjs +10 -14
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/Array/MantineArrayLayout.mjs +3 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/utils/nullOptionErrors.mjs +31 -0
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/compile/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/applicator/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/core/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/format/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/validation/index.cjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/compile/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/applicator/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/core/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/format/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/validation/index.mjs +1 -1
- package/dist/contexts/cjs/ApiContext/ApiContext.cjs +4 -1
- package/dist/contexts/esm/ApiContext/ApiContext.mjs +4 -1
- package/dist/contexts/lib/ApiContext/ApiContext.d.ts +6 -4
- package/dist/contexts/lib/ApiContext/types.d.ts +50 -25
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideApi.cjs +1 -1
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +1 -1
- package/dist/core/lib/Dialogs/types.d.ts +2 -2
- package/dist/core/lib/Wrappers/ApiProvider/hooks/utils/useApiActions.d.ts +2 -2
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/deleteItem.d.ts +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/getInfo.d.ts +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/getItems.d.ts +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/types.d.ts +2 -2
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getItems.d.ts +1 -1
- package/dist/jsonforms/cjs/complex/MantineTableControl/MantineTableControl.cjs +3 -2
- package/dist/jsonforms/cjs/hooks/useArrayHeaderErrors.cjs +44 -0
- package/dist/jsonforms/cjs/hooks/useNullableErrorProps.cjs +10 -14
- package/dist/jsonforms/cjs/layouts/Array/MantineArrayLayout.cjs +3 -2
- package/dist/jsonforms/cjs/utils/nullOptionErrors.cjs +31 -0
- package/dist/jsonforms/esm/complex/MantineTableControl/MantineTableControl.mjs +3 -2
- package/dist/jsonforms/esm/hooks/useArrayHeaderErrors.mjs +44 -0
- package/dist/jsonforms/esm/hooks/useNullableErrorProps.mjs +10 -14
- package/dist/jsonforms/esm/layouts/Array/MantineArrayLayout.mjs +3 -2
- package/dist/jsonforms/esm/utils/nullOptionErrors.mjs +31 -0
- package/dist/jsonforms/lib/hooks/useArrayHeaderErrors.d.ts +14 -0
- package/dist/jsonforms/lib/hooks/useArrayHeaderErrors.test.d.ts +1 -0
- package/dist/jsonforms/lib/hooks/useNullableErrorProps.d.ts +3 -0
- package/dist/jsonforms/lib/utils/nullOptionErrors.d.ts +27 -0
- package/dist/jsonforms/lib/utils/nullOptionErrors.test.d.ts +1 -0
- package/dist/utils/cjs/parseResponse/parseResponse.cjs +3 -0
- package/dist/utils/esm/parseResponse/parseResponse.mjs +3 -0
- package/dist/utils/lib/parseResponse/parseResponse.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseResponseMany, BaseResponseSingle, ColumnFilterOperator, ColumnInfo, ColumnRelationInfo, ConvertedInfo, FilterInfo, InfoResponse, JsonSchema, Layout, PrimaryKey, QueryFilter, QueryParams } from 'fastapi-rtk/api-types';
|
|
2
2
|
import { InfiniteData, UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import { Schema as ValidationSchema } from '../../../.external/lib/yup';
|
|
4
|
-
/** A non-null CRUD result row, mirroring the unwrapped `BaseResponseSingle.result`. */
|
|
5
|
-
type EntryRow = NonNullable<BaseResponseSingle['result']>;
|
|
4
|
+
/** A non-null CRUD result row, mirroring the unwrapped `BaseResponseSingle.result`. Default row type for the API generics. */
|
|
5
|
+
export type EntryRow = NonNullable<BaseResponseSingle['result']>;
|
|
6
6
|
export type APIColumnInfo = ColumnInfo;
|
|
7
7
|
export type APIColumnRelationInfo = ColumnRelationInfo;
|
|
8
8
|
export type APIColumnFilter = ColumnFilterOperator;
|
|
@@ -40,11 +40,11 @@ export type APIQueryParams = Required<Pick<QueryParams, 'page' | 'page_size' | '
|
|
|
40
40
|
* `BaseResponseMany`: `count` / `result` are guaranteed non-null after a successful fetch, and
|
|
41
41
|
* `path` / `queryParams` (the resolved `APIQueryParams`) are always present.
|
|
42
42
|
*/
|
|
43
|
-
export interface APIData extends Omit<BaseResponseMany, 'count' | 'result'> {
|
|
43
|
+
export interface APIData<TData = EntryRow> extends Omit<BaseResponseMany, 'count' | 'result'> {
|
|
44
44
|
/** The total count of items existing in the database for the given query parameters. */
|
|
45
45
|
count: number;
|
|
46
46
|
/** An array of objects representing the API response data. */
|
|
47
|
-
result:
|
|
47
|
+
result: TData[];
|
|
48
48
|
/** The API path. */
|
|
49
49
|
path: string;
|
|
50
50
|
/** The query parameters used in the API request. */
|
|
@@ -56,10 +56,10 @@ export interface APISpecialKey {
|
|
|
56
56
|
/** The key to be used when retrieving actions for `NextGenDataGrid`. Typically `actions`, but can be `_actions` if `actions` is in the list of columns. */
|
|
57
57
|
actions: string;
|
|
58
58
|
}
|
|
59
|
-
export interface APIStreaming {
|
|
59
|
+
export interface APIStreaming<TData = EntryRow> {
|
|
60
60
|
/** The streaming data, organized by the page number. */
|
|
61
61
|
data: {
|
|
62
|
-
[pageNumber: string]:
|
|
62
|
+
[pageNumber: string]: TData[];
|
|
63
63
|
};
|
|
64
64
|
/** Indicates whether the streaming has ended. */
|
|
65
65
|
isEnd: boolean;
|
|
@@ -86,10 +86,10 @@ export interface APIError {
|
|
|
86
86
|
message: string;
|
|
87
87
|
originalError: Error;
|
|
88
88
|
}
|
|
89
|
-
export interface APISetErrorPayload {
|
|
89
|
+
export interface APISetErrorPayload<TData = EntryRow> {
|
|
90
90
|
message: string;
|
|
91
91
|
originalError: Error;
|
|
92
|
-
data?:
|
|
92
|
+
data?: TData;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* `APIInfo` augmented with the normalized add/edit form blocks produced by
|
|
@@ -101,13 +101,34 @@ export interface APISetErrorPayload {
|
|
|
101
101
|
export type APIInfoCanonical = ConvertedInfo<ValidationSchema> & {
|
|
102
102
|
path?: string;
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Per-operation type overrides for `useApi`. Each key maps to a backend column projection and,
|
|
106
|
+
* when set, replaces the uniform default for that operation only: `list` (list response rows,
|
|
107
|
+
* `list_columns`), `get` (a single fetched entry and the record returned by `addEntry` / `updateEntry`,
|
|
108
|
+
* `show_columns`), `add` (the `addEntry` payload, `add_columns`), `edit` (the `updateEntry` payload,
|
|
109
|
+
* `edit_columns`). `upload` (`EntryRow[]`, loosely-typed import rows) and `deleteEntry` (`null`, the 204 no-content response) are not parameterized.
|
|
110
|
+
*/
|
|
111
|
+
export interface ApiTypeOverrides {
|
|
112
|
+
list?: unknown;
|
|
113
|
+
get?: unknown;
|
|
114
|
+
add?: unknown;
|
|
115
|
+
edit?: unknown;
|
|
116
|
+
}
|
|
117
|
+
/** Resolve one operation's type from the override map, falling back to `TDefault`. */
|
|
118
|
+
export type OpType<TOverrides extends ApiTypeOverrides, K extends keyof ApiTypeOverrides, TDefault> = TOverrides extends Record<K, infer T> ? T : TDefault;
|
|
119
|
+
/**
|
|
120
|
+
* @typeParam TList - Row shape of the list response (`data.result`).
|
|
121
|
+
* @typeParam TGet - Shape of a single fetched/affected record (`getEntry`, and the record returned by `addEntry` / `updateEntry`).
|
|
122
|
+
* @typeParam TAdd - Payload accepted by `addEntry`.
|
|
123
|
+
* @typeParam TEdit - Payload accepted by `updateEntry`.
|
|
124
|
+
*/
|
|
125
|
+
export interface ApiContextValue<TList = EntryRow, TGet = EntryRow, TAdd = EntryRow, TEdit = EntryRow> {
|
|
105
126
|
/** The API path. */
|
|
106
127
|
path: string;
|
|
107
128
|
/** Information about the API, including schemas, UI schemas, and the normalized add/edit form blocks. */
|
|
108
129
|
info?: APIInfoCanonical;
|
|
109
130
|
/** The data returned by the API. */
|
|
110
|
-
data?: APIData
|
|
131
|
+
data?: APIData<TList>;
|
|
111
132
|
/** The query parameters used in the API request. */
|
|
112
133
|
queryParams?: APIQueryParams;
|
|
113
134
|
/** Indicates whether the API request is currently loading. */
|
|
@@ -125,11 +146,11 @@ export interface ApiContextValue {
|
|
|
125
146
|
/** The raw React Query object for the info request. */
|
|
126
147
|
infoQuery: UseQueryResult<APIInfoCanonical | undefined>;
|
|
127
148
|
/** The raw React Query object for the data request. */
|
|
128
|
-
dataQuery: UseQueryResult<APIData | null>;
|
|
149
|
+
dataQuery: UseQueryResult<APIData<TList> | null>;
|
|
129
150
|
/** The raw React Query infinite query object for streaming requests. */
|
|
130
|
-
streamingQuery: UseInfiniteQueryResult<InfiniteData<APIData | null>>;
|
|
151
|
+
streamingQuery: UseInfiniteQueryResult<InfiniteData<APIData<TList> | null>>;
|
|
131
152
|
/** Streaming (infinite-scroll) controller. Present only when the `ApiProvider` is configured for streaming; its presence is the streaming-mode signal. When set, `data.result` carries every row fetched so far (all pages) and `streaming.data` is the page-number-keyed breakdown. */
|
|
132
|
-
streaming?: APIStreaming
|
|
153
|
+
streaming?: APIStreaming<TList>;
|
|
133
154
|
/** An object containing special keys for the API query, such as 'all' and 'actions'. */
|
|
134
155
|
specialKey: APISpecialKey;
|
|
135
156
|
/** A function to update the query parameters. */
|
|
@@ -142,25 +163,29 @@ export interface ApiContextValue {
|
|
|
142
163
|
refetchInfo: (options?: {
|
|
143
164
|
force?: boolean;
|
|
144
165
|
}) => Promise<void>;
|
|
145
|
-
/**
|
|
146
|
-
getEntry: (id: PrimaryKey) => Promise<
|
|
147
|
-
/**
|
|
148
|
-
addEntry: (item:
|
|
149
|
-
/**
|
|
150
|
-
updateEntry: (id: PrimaryKey, item:
|
|
151
|
-
/**
|
|
152
|
-
deleteEntry: (id: PrimaryKey) => Promise<
|
|
166
|
+
/** Retrieve a specific entry by ID. Return defaults to the resolved `get` type; override per call (e.g. `getEntry<Custom>(id)`) when the route is customized. */
|
|
167
|
+
getEntry: <R = TGet>(id: PrimaryKey) => Promise<R>;
|
|
168
|
+
/** Add a new entry. Return defaults to the resolved `get` type; override per call for custom routes. */
|
|
169
|
+
addEntry: <R = TGet>(item: TAdd) => Promise<R>;
|
|
170
|
+
/** Edit an existing entry. Return defaults to the resolved `get` type; override per call for custom routes. */
|
|
171
|
+
updateEntry: <R = TGet>(id: PrimaryKey, item: TEdit) => Promise<R>;
|
|
172
|
+
/** Delete an entry. The stock endpoint responds 204 (no body), parsed to `null`, so the return defaults to `null`; override per call for custom `post_delete` payloads. */
|
|
173
|
+
deleteEntry: <R = null>(id: PrimaryKey) => Promise<R>;
|
|
153
174
|
/** A function to download data from the API. */
|
|
154
175
|
download: (label?: string, options?: APIDownloadOptions) => Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
upload: (file: File, options?: APIUploadOptions) => Promise<
|
|
176
|
+
/** Upload a CSV. The importer returns `list[dict[str, Any]]` (no response_model), so the default is `EntryRow[]` (loosely-typed rows), NOT the model/`TGet` shape; override per call if your route is typed. */
|
|
177
|
+
upload: <R = EntryRow[]>(file: File, options?: APIUploadOptions) => Promise<R>;
|
|
157
178
|
/** A function to get the URL for a file item (file name or File object). */
|
|
158
179
|
getFileURL: (item: string | File) => string;
|
|
159
180
|
/** A function to get the URL for an image item (image name or File object). */
|
|
160
181
|
getImageURL: (item: string | File) => string;
|
|
161
182
|
/** A function to set the error state, surfacing errors thrown by the action functions (`addEntry`, `updateEntry`, ...) through the shared `ErrorDialog`. */
|
|
162
|
-
setError: (error: APISetErrorPayload | undefined) => void;
|
|
183
|
+
setError: (error: APISetErrorPayload<TGet> | undefined) => void;
|
|
163
184
|
/** A function to reset the error state. */
|
|
164
185
|
resetError: () => void;
|
|
165
186
|
}
|
|
166
|
-
|
|
187
|
+
/**
|
|
188
|
+
* The `ApiContextValue` returned by `useApi<TDefault, TOverrides>`: the uniform `TDefault` applied to
|
|
189
|
+
* every operation, with any `TOverrides` keys replacing it per operation.
|
|
190
|
+
*/
|
|
191
|
+
export type UseApiResult<TDefault = EntryRow, TOverrides extends ApiTypeOverrides = ApiTypeOverrides> = ApiContextValue<OpType<TOverrides, 'list', TDefault>, OpType<TOverrides, 'get', TDefault>, OpType<TOverrides, 'add', TDefault>, OpType<TOverrides, 'edit', TDefault>>;
|
|
@@ -298,7 +298,7 @@ function useProvideApi(params, api = defaultApi) {
|
|
|
298
298
|
getImageURL: (item) => getItemURL("image", item),
|
|
299
299
|
setError,
|
|
300
300
|
resetError
|
|
301
|
-
// #MUSTASSERT useProvideApi holds raw react-query state (DataPage/StreamingPage data, raw QueryParams, null errors); this is the resolved ApiContextValue surface consumers read, normalized at runtime
|
|
301
|
+
// #MUSTASSERT #MUSTUNKNOWN useProvideApi holds raw react-query state (DataPage/StreamingPage data, raw QueryParams, null errors) and concrete (non-generic) action fns; this is the resolved ApiContextValue surface consumers read, normalized at runtime
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
304
|
exports.useProvideApi = useProvideApi;
|
|
@@ -296,7 +296,7 @@ function useProvideApi(params, api = defaultApi) {
|
|
|
296
296
|
getImageURL: (item) => getItemURL("image", item),
|
|
297
297
|
setError,
|
|
298
298
|
resetError
|
|
299
|
-
// #MUSTASSERT useProvideApi holds raw react-query state (DataPage/StreamingPage data, raw QueryParams, null errors); this is the resolved ApiContextValue surface consumers read, normalized at runtime
|
|
299
|
+
// #MUSTASSERT #MUSTUNKNOWN useProvideApi holds raw react-query state (DataPage/StreamingPage data, raw QueryParams, null errors) and concrete (non-generic) action fns; this is the resolved ApiContextValue surface consumers read, normalized at runtime
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
export {
|
|
@@ -31,8 +31,8 @@ export type EditDialogProps = AddDialogOwnProps & DialogModalProps;
|
|
|
31
31
|
export interface DeleteDialogOwnProps {
|
|
32
32
|
/** Custom text or component to display in the delete confirmation dialog. */
|
|
33
33
|
deleteText?: ReactNode;
|
|
34
|
-
/** Callback function triggered on successful
|
|
35
|
-
onSuccess?: (result:
|
|
34
|
+
/** Callback function triggered on successful deletion. Delete responds 204 (no body), parsed to `null`. */
|
|
35
|
+
onSuccess?: (result: null) => void;
|
|
36
36
|
/** Callback function triggered on form submission error. */
|
|
37
37
|
onError?: (error: unknown) => void;
|
|
38
38
|
}
|
|
@@ -4,8 +4,8 @@ export declare const useApiActions: (params: UseApiActionsParams) => {
|
|
|
4
4
|
getEntry: (id: EntryId) => Promise<MRT_RowData>;
|
|
5
5
|
addEntry: (item: MRT_RowData) => Promise<MRT_RowData>;
|
|
6
6
|
updateEntry: (id: EntryId, item: MRT_RowData) => Promise<MRT_RowData>;
|
|
7
|
-
deleteEntry: (id: EntryId) => Promise<MRT_RowData>;
|
|
7
|
+
deleteEntry: (id: EntryId) => Promise<MRT_RowData | null>;
|
|
8
8
|
download: (label?: string, { export_mode, delimiter, quotechar }?: DownloadActionOptions) => Promise<void>;
|
|
9
|
-
upload: (file: File, { delimiter, quotechar }?: UploadActionOptions) => Promise<
|
|
9
|
+
upload: (file: File, { delimiter, quotechar }?: UploadActionOptions) => Promise<import('../../utils/api/types').UploadResponse>;
|
|
10
10
|
getItemURL: (type: string, item: string | File) => string;
|
|
11
11
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MRT_RowData } from '../../../../../../.external/lib/mantine-react-table';
|
|
2
2
|
import { FetchOptions, ItemId } from './types';
|
|
3
|
-
export declare const deleteItem: (path: string, id: ItemId, options?: FetchOptions) => Promise<MRT_RowData>;
|
|
3
|
+
export declare const deleteItem: (path: string, id: ItemId, options?: FetchOptions) => Promise<MRT_RowData | null>;
|
|
@@ -7,4 +7,4 @@ import { FetchOptions } from './types';
|
|
|
7
7
|
* @returns The data fetched from the given path.
|
|
8
8
|
* @throws {Error} If the response is not ok, throws an error with the response detail.
|
|
9
9
|
*/
|
|
10
|
-
export declare const getInfo: (path: string, options?: FetchOptions) => Promise<string | object>;
|
|
10
|
+
export declare const getInfo: (path: string, options?: FetchOptions) => Promise<string | object | null>;
|
|
@@ -9,4 +9,4 @@ import { FetchOptions } from './types';
|
|
|
9
9
|
* @returns A promise that resolves to the fetched data, either as a JSON object or a text string.
|
|
10
10
|
* @throws {Error} - Throws an error if the response is not ok or if there is an issue with the fetch request.
|
|
11
11
|
*/
|
|
12
|
-
export declare const getItems: (path: string, queryParams?: QueryParams, options?: FetchOptions) => Promise<string | object>;
|
|
12
|
+
export declare const getItems: (path: string, queryParams?: QueryParams, options?: FetchOptions) => Promise<string | object | null>;
|
|
@@ -19,5 +19,5 @@ export interface UploadOptions {
|
|
|
19
19
|
delimiter?: string;
|
|
20
20
|
quotechar?: string;
|
|
21
21
|
}
|
|
22
|
-
/** The
|
|
23
|
-
export type UploadResponse = MRT_RowData;
|
|
22
|
+
/** The rows returned by the upload (CSV import) endpoint; a list of model-driven rows at runtime. */
|
|
23
|
+
export type UploadResponse = MRT_RowData[];
|
|
@@ -9,4 +9,4 @@ import { FetchOptions } from '../../../../Wrappers/ApiProvider/utils/api/types';
|
|
|
9
9
|
* @returns A promise that resolves to the fetched data, either as a JSON object or a text string.
|
|
10
10
|
* @throws {Error} - Throws an error if the response is not ok or if there is an issue with the fetch request.
|
|
11
11
|
*/
|
|
12
|
-
export declare const getItems: (path: string, queryParams?: QueryParams, options?: FetchOptions) => Promise<string | object>;
|
|
12
|
+
export declare const getItems: (path: string, queryParams?: QueryParams, options?: FetchOptions) => Promise<string | object | null>;
|
|
@@ -11,6 +11,7 @@ const range = require("../../_virtual/range.cjs");
|
|
|
11
11
|
const startCase = require("../../_virtual/startCase.cjs");
|
|
12
12
|
const union = require("../../_virtual/union.cjs");
|
|
13
13
|
const React = require("react");
|
|
14
|
+
const useArrayHeaderErrors = require("../../hooks/useArrayHeaderErrors.cjs");
|
|
14
15
|
const useContextProps = require("../../hooks/useContextProps.cjs");
|
|
15
16
|
const useNavigationComponent = require("../../hooks/useNavigationComponent.cjs");
|
|
16
17
|
const useThemeCustomizer = require("../../hooks/useThemeCustomizer.cjs");
|
|
@@ -239,7 +240,6 @@ const MantineTableControl = React.memo(function MantineTableControl2(props) {
|
|
|
239
240
|
schema,
|
|
240
241
|
rootSchema,
|
|
241
242
|
uischema,
|
|
242
|
-
errors,
|
|
243
243
|
visible,
|
|
244
244
|
enabled,
|
|
245
245
|
cells,
|
|
@@ -255,6 +255,7 @@ const MantineTableControl = React.memo(function MantineTableControl2(props) {
|
|
|
255
255
|
const isObjectSchema = isValidObjectSchema(schema);
|
|
256
256
|
const headerCells = isObjectSchema ? generateCells(TableHeaderCell, schema, path, enabled, cells) : void 0;
|
|
257
257
|
const isEnabled = enabled && !doDisableAdd;
|
|
258
|
+
const headerErrors = useArrayHeaderErrors.useArrayHeaderErrors(path, schema);
|
|
258
259
|
const [Component, _props] = useContextProps.useContextProps("Table", `${path}.Table`, {}, props, { withAllProps: false });
|
|
259
260
|
if (!visible) {
|
|
260
261
|
return null;
|
|
@@ -265,7 +266,7 @@ const MantineTableControl = React.memo(function MantineTableControl2(props) {
|
|
|
265
266
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
266
267
|
TableToolbar.TableToolbar,
|
|
267
268
|
{
|
|
268
|
-
errors,
|
|
269
|
+
errors: headerErrors,
|
|
269
270
|
label,
|
|
270
271
|
description,
|
|
271
272
|
addItem,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@jsonforms/core");
|
|
4
|
+
const react = require("@jsonforms/react");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const nullOptionErrors = require("../utils/nullOptionErrors.cjs");
|
|
7
|
+
const useArrayHeaderErrors = (path, schema) => {
|
|
8
|
+
const { core: core$1 } = react.useJsonForms();
|
|
9
|
+
const errors = core$1 == null ? void 0 : core$1.errors;
|
|
10
|
+
return React.useMemo(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!(errors == null ? void 0 : errors.length)) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
const scoped = core.errorsAt(
|
|
16
|
+
path,
|
|
17
|
+
schema,
|
|
18
|
+
(controlPath) => controlPath === path || controlPath.startsWith(`${path}.`)
|
|
19
|
+
)(errors);
|
|
20
|
+
const byField = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const error of scoped) {
|
|
22
|
+
const group = byField.get(error.instancePath);
|
|
23
|
+
if (group) {
|
|
24
|
+
group.push(error);
|
|
25
|
+
} else {
|
|
26
|
+
byField.set(error.instancePath, [error]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const messages = [];
|
|
30
|
+
for (const group of byField.values()) {
|
|
31
|
+
const [representative] = group;
|
|
32
|
+
const fieldMessages = group.map((error) => error.message).filter((message) => !!message);
|
|
33
|
+
messages.push(
|
|
34
|
+
...nullOptionErrors.resolveNullableErrorMessages(
|
|
35
|
+
representative.data,
|
|
36
|
+
nullOptionErrors.isNullableSchemaType((_a = representative.parentSchema) == null ? void 0 : _a.type),
|
|
37
|
+
fieldMessages
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return core.formatErrorMessage(messages);
|
|
42
|
+
}, [errors, path, schema]);
|
|
43
|
+
};
|
|
44
|
+
exports.useArrayHeaderErrors = useArrayHeaderErrors;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const
|
|
5
|
-
const NULL_OPTION_ERRORS = /* @__PURE__ */ new Set([
|
|
6
|
-
"must be equal to one of the allowed values",
|
|
7
|
-
"must be equal to constant",
|
|
8
|
-
"must match exactly one schema in oneOf"
|
|
9
|
-
]);
|
|
10
|
-
const REQUIRED_ERROR = "is a required property";
|
|
4
|
+
const nullOptionErrors = require("../utils/nullOptionErrors.cjs");
|
|
11
5
|
function useNullableErrorProps(value, error, schema) {
|
|
12
6
|
return React.useMemo(() => {
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
switch (nullOptionErrors.nullableErrorAction(value, nullOptionErrors.isNullableSchemaType(schema.type))) {
|
|
8
|
+
case "keep":
|
|
9
|
+
return { error };
|
|
10
|
+
case "drop-options": {
|
|
11
|
+
const kept = error == null ? void 0 : error.filter((e) => !nullOptionErrors.NULL_OPTION_ERRORS.has(e.key ?? ""));
|
|
12
|
+
return { error: (kept == null ? void 0 : kept.length) ? kept : void 0 };
|
|
13
|
+
}
|
|
14
|
+
case "required":
|
|
15
|
+
return { error: nullOptionErrors.REQUIRED_ERROR };
|
|
15
16
|
}
|
|
16
|
-
if (isSchemaTypeInclude.isSchemaTypeInclude(schema.type ?? "", "null")) {
|
|
17
|
-
const kept = error == null ? void 0 : error.filter((e) => !NULL_OPTION_ERRORS.has(e.key ?? ""));
|
|
18
|
-
return { error: (kept == null ? void 0 : kept.length) ? kept : void 0 };
|
|
19
|
-
}
|
|
20
|
-
return { error: REQUIRED_ERROR };
|
|
21
17
|
}, [error, schema.type, value]);
|
|
22
18
|
}
|
|
23
19
|
exports.useNullableErrorProps = useNullableErrorProps;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const useArrayHeaderErrors = require("../../hooks/useArrayHeaderErrors.cjs");
|
|
4
5
|
const useContextProps = require("../../hooks/useContextProps.cjs");
|
|
5
6
|
const core = require("@jsonforms/core");
|
|
6
7
|
const core$1 = require("@mantine/core");
|
|
@@ -17,7 +18,6 @@ const Component = (props) => {
|
|
|
17
18
|
path,
|
|
18
19
|
schema,
|
|
19
20
|
uischema,
|
|
20
|
-
errors,
|
|
21
21
|
addItem,
|
|
22
22
|
renderers,
|
|
23
23
|
cells,
|
|
@@ -38,6 +38,7 @@ const Component = (props) => {
|
|
|
38
38
|
const [Component2, _props] = useContextProps.useContextProps("Array.Accordion", `${path}.Accordion`, {}, props, {
|
|
39
39
|
withAllProps: false
|
|
40
40
|
});
|
|
41
|
+
const headerErrors = useArrayHeaderErrors.useArrayHeaderErrors(path, schema);
|
|
41
42
|
return /* @__PURE__ */ jsxRuntime.jsxs(core$1.Stack, { children: [
|
|
42
43
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
43
44
|
ArrayToolbar.ArrayLayoutToolbar,
|
|
@@ -45,7 +46,7 @@ const Component = (props) => {
|
|
|
45
46
|
translations,
|
|
46
47
|
label: core.computeLabel(label, required ?? false, appliedUiSchemaOptions.hideRequiredAsterisk),
|
|
47
48
|
description,
|
|
48
|
-
errors,
|
|
49
|
+
errors: headerErrors,
|
|
49
50
|
path,
|
|
50
51
|
enabled,
|
|
51
52
|
addItem,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const isSchemaTypeInclude = require("./isSchemaTypeInclude.cjs");
|
|
4
|
+
const NULL_OPTION_ERRORS = /* @__PURE__ */ new Set([
|
|
5
|
+
"must be equal to one of the allowed values",
|
|
6
|
+
"must be equal to constant",
|
|
7
|
+
"must match exactly one schema in oneOf"
|
|
8
|
+
]);
|
|
9
|
+
const REQUIRED_ERROR = "is a required property";
|
|
10
|
+
const nullableErrorAction = (value, nullable) => {
|
|
11
|
+
if (value !== null && value !== "") {
|
|
12
|
+
return "keep";
|
|
13
|
+
}
|
|
14
|
+
return nullable ? "drop-options" : "required";
|
|
15
|
+
};
|
|
16
|
+
const resolveNullableErrorMessages = (value, nullable, messages) => {
|
|
17
|
+
switch (nullableErrorAction(value, nullable)) {
|
|
18
|
+
case "keep":
|
|
19
|
+
return messages;
|
|
20
|
+
case "drop-options":
|
|
21
|
+
return messages.filter((message) => !NULL_OPTION_ERRORS.has(message));
|
|
22
|
+
case "required":
|
|
23
|
+
return [REQUIRED_ERROR];
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const isNullableSchemaType = (type) => isSchemaTypeInclude.isSchemaTypeInclude(type ?? "", "null");
|
|
27
|
+
exports.NULL_OPTION_ERRORS = NULL_OPTION_ERRORS;
|
|
28
|
+
exports.REQUIRED_ERROR = REQUIRED_ERROR;
|
|
29
|
+
exports.isNullableSchemaType = isNullableSchemaType;
|
|
30
|
+
exports.nullableErrorAction = nullableErrorAction;
|
|
31
|
+
exports.resolveNullableErrorMessages = resolveNullableErrorMessages;
|
|
@@ -9,6 +9,7 @@ import range from "../../_virtual/range.mjs";
|
|
|
9
9
|
import startCase from "../../_virtual/startCase.mjs";
|
|
10
10
|
import union from "../../_virtual/union.mjs";
|
|
11
11
|
import React, { useMemo, memo } from "react";
|
|
12
|
+
import { useArrayHeaderErrors } from "../../hooks/useArrayHeaderErrors.mjs";
|
|
12
13
|
import { useContextProps } from "../../hooks/useContextProps.mjs";
|
|
13
14
|
import { useNavigationComponent } from "../../hooks/useNavigationComponent.mjs";
|
|
14
15
|
import { useThemeCustomizer } from "../../hooks/useThemeCustomizer.mjs";
|
|
@@ -237,7 +238,6 @@ const MantineTableControl = memo(function MantineTableControl2(props) {
|
|
|
237
238
|
schema,
|
|
238
239
|
rootSchema,
|
|
239
240
|
uischema,
|
|
240
|
-
errors,
|
|
241
241
|
visible,
|
|
242
242
|
enabled,
|
|
243
243
|
cells,
|
|
@@ -253,6 +253,7 @@ const MantineTableControl = memo(function MantineTableControl2(props) {
|
|
|
253
253
|
const isObjectSchema = isValidObjectSchema(schema);
|
|
254
254
|
const headerCells = isObjectSchema ? generateCells(TableHeaderCell, schema, path, enabled, cells) : void 0;
|
|
255
255
|
const isEnabled = enabled && !doDisableAdd;
|
|
256
|
+
const headerErrors = useArrayHeaderErrors(path, schema);
|
|
256
257
|
const [Component, _props] = useContextProps("Table", `${path}.Table`, {}, props, { withAllProps: false });
|
|
257
258
|
if (!visible) {
|
|
258
259
|
return null;
|
|
@@ -263,7 +264,7 @@ const MantineTableControl = memo(function MantineTableControl2(props) {
|
|
|
263
264
|
/* @__PURE__ */ jsx(
|
|
264
265
|
TableToolbar,
|
|
265
266
|
{
|
|
266
|
-
errors,
|
|
267
|
+
errors: headerErrors,
|
|
267
268
|
label,
|
|
268
269
|
description,
|
|
269
270
|
addItem,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { errorsAt, formatErrorMessage } from "@jsonforms/core";
|
|
2
|
+
import { useJsonForms } from "@jsonforms/react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { resolveNullableErrorMessages, isNullableSchemaType } from "../utils/nullOptionErrors.mjs";
|
|
5
|
+
const useArrayHeaderErrors = (path, schema) => {
|
|
6
|
+
const { core } = useJsonForms();
|
|
7
|
+
const errors = core == null ? void 0 : core.errors;
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (!(errors == null ? void 0 : errors.length)) {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
const scoped = errorsAt(
|
|
14
|
+
path,
|
|
15
|
+
schema,
|
|
16
|
+
(controlPath) => controlPath === path || controlPath.startsWith(`${path}.`)
|
|
17
|
+
)(errors);
|
|
18
|
+
const byField = /* @__PURE__ */ new Map();
|
|
19
|
+
for (const error of scoped) {
|
|
20
|
+
const group = byField.get(error.instancePath);
|
|
21
|
+
if (group) {
|
|
22
|
+
group.push(error);
|
|
23
|
+
} else {
|
|
24
|
+
byField.set(error.instancePath, [error]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const messages = [];
|
|
28
|
+
for (const group of byField.values()) {
|
|
29
|
+
const [representative] = group;
|
|
30
|
+
const fieldMessages = group.map((error) => error.message).filter((message) => !!message);
|
|
31
|
+
messages.push(
|
|
32
|
+
...resolveNullableErrorMessages(
|
|
33
|
+
representative.data,
|
|
34
|
+
isNullableSchemaType((_a = representative.parentSchema) == null ? void 0 : _a.type),
|
|
35
|
+
fieldMessages
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return formatErrorMessage(messages);
|
|
40
|
+
}, [errors, path, schema]);
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
useArrayHeaderErrors
|
|
44
|
+
};
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
const NULL_OPTION_ERRORS = /* @__PURE__ */ new Set([
|
|
4
|
-
"must be equal to one of the allowed values",
|
|
5
|
-
"must be equal to constant",
|
|
6
|
-
"must match exactly one schema in oneOf"
|
|
7
|
-
]);
|
|
8
|
-
const REQUIRED_ERROR = "is a required property";
|
|
2
|
+
import { nullableErrorAction, isNullableSchemaType, REQUIRED_ERROR, NULL_OPTION_ERRORS } from "../utils/nullOptionErrors.mjs";
|
|
9
3
|
function useNullableErrorProps(value, error, schema) {
|
|
10
4
|
return useMemo(() => {
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
switch (nullableErrorAction(value, isNullableSchemaType(schema.type))) {
|
|
6
|
+
case "keep":
|
|
7
|
+
return { error };
|
|
8
|
+
case "drop-options": {
|
|
9
|
+
const kept = error == null ? void 0 : error.filter((e) => !NULL_OPTION_ERRORS.has(e.key ?? ""));
|
|
10
|
+
return { error: (kept == null ? void 0 : kept.length) ? kept : void 0 };
|
|
11
|
+
}
|
|
12
|
+
case "required":
|
|
13
|
+
return { error: REQUIRED_ERROR };
|
|
13
14
|
}
|
|
14
|
-
if (isSchemaTypeInclude(schema.type ?? "", "null")) {
|
|
15
|
-
const kept = error == null ? void 0 : error.filter((e) => !NULL_OPTION_ERRORS.has(e.key ?? ""));
|
|
16
|
-
return { error: (kept == null ? void 0 : kept.length) ? kept : void 0 };
|
|
17
|
-
}
|
|
18
|
-
return { error: REQUIRED_ERROR };
|
|
19
15
|
}, [error, schema.type, value]);
|
|
20
16
|
}
|
|
21
17
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useArrayHeaderErrors } from "../../hooks/useArrayHeaderErrors.mjs";
|
|
2
3
|
import { useContextProps } from "../../hooks/useContextProps.mjs";
|
|
3
4
|
import { createDefaultValue, computeLabel, Paths } from "@jsonforms/core";
|
|
4
5
|
import { Stack, Accordion, Text } from "@mantine/core";
|
|
@@ -15,7 +16,6 @@ const Component = (props) => {
|
|
|
15
16
|
path,
|
|
16
17
|
schema,
|
|
17
18
|
uischema,
|
|
18
|
-
errors,
|
|
19
19
|
addItem,
|
|
20
20
|
renderers,
|
|
21
21
|
cells,
|
|
@@ -36,6 +36,7 @@ const Component = (props) => {
|
|
|
36
36
|
const [Component2, _props] = useContextProps("Array.Accordion", `${path}.Accordion`, {}, props, {
|
|
37
37
|
withAllProps: false
|
|
38
38
|
});
|
|
39
|
+
const headerErrors = useArrayHeaderErrors(path, schema);
|
|
39
40
|
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
40
41
|
/* @__PURE__ */ jsx(
|
|
41
42
|
ArrayLayoutToolbar,
|
|
@@ -43,7 +44,7 @@ const Component = (props) => {
|
|
|
43
44
|
translations,
|
|
44
45
|
label: computeLabel(label, required ?? false, appliedUiSchemaOptions.hideRequiredAsterisk),
|
|
45
46
|
description,
|
|
46
|
-
errors,
|
|
47
|
+
errors: headerErrors,
|
|
47
48
|
path,
|
|
48
49
|
enabled,
|
|
49
50
|
addItem,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { isSchemaTypeInclude } from "./isSchemaTypeInclude.mjs";
|
|
2
|
+
const NULL_OPTION_ERRORS = /* @__PURE__ */ new Set([
|
|
3
|
+
"must be equal to one of the allowed values",
|
|
4
|
+
"must be equal to constant",
|
|
5
|
+
"must match exactly one schema in oneOf"
|
|
6
|
+
]);
|
|
7
|
+
const REQUIRED_ERROR = "is a required property";
|
|
8
|
+
const nullableErrorAction = (value, nullable) => {
|
|
9
|
+
if (value !== null && value !== "") {
|
|
10
|
+
return "keep";
|
|
11
|
+
}
|
|
12
|
+
return nullable ? "drop-options" : "required";
|
|
13
|
+
};
|
|
14
|
+
const resolveNullableErrorMessages = (value, nullable, messages) => {
|
|
15
|
+
switch (nullableErrorAction(value, nullable)) {
|
|
16
|
+
case "keep":
|
|
17
|
+
return messages;
|
|
18
|
+
case "drop-options":
|
|
19
|
+
return messages.filter((message) => !NULL_OPTION_ERRORS.has(message));
|
|
20
|
+
case "required":
|
|
21
|
+
return [REQUIRED_ERROR];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const isNullableSchemaType = (type) => isSchemaTypeInclude(type ?? "", "null");
|
|
25
|
+
export {
|
|
26
|
+
NULL_OPTION_ERRORS,
|
|
27
|
+
REQUIRED_ERROR,
|
|
28
|
+
isNullableSchemaType,
|
|
29
|
+
nullableErrorAction,
|
|
30
|
+
resolveNullableErrorMessages
|
|
31
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the aggregated validation error string shown on an array control's header. JsonForms'
|
|
4
|
+
* `mapStateToArrayLayoutProps` aggregates every descendant error unconditionally, so without this the
|
|
5
|
+
* header reports errors its own fields hide (an empty value on a nullable enum / oneOf / const field,
|
|
6
|
+
* or the raw type+option errors on a non-nullable empty field).
|
|
7
|
+
*
|
|
8
|
+
* Reconstructs that aggregation (the array's own path plus every sub-path), groups the errors by the
|
|
9
|
+
* field that owns them, then applies the same per-field rule the inputs use ({@link
|
|
10
|
+
* resolveNullableErrorMessages}) so the header and its fields hide/show identical errors. `path` is
|
|
11
|
+
* the array's data path, `schema` its resolved item schema. Returns a newline-joined error string
|
|
12
|
+
* (empty when there is nothing to show).
|
|
13
|
+
*/
|
|
14
|
+
export declare const useArrayHeaderErrors: (path: string, schema: JsonSchema) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,6 +7,9 @@ import { JsonFormsDataValue } from './types';
|
|
|
7
7
|
* is valid, so the option-mismatch errors are hidden; a non-nullable field is missing, so a single
|
|
8
8
|
* "is a required property" error is shown. A non-empty value passes its errors through unchanged.
|
|
9
9
|
*
|
|
10
|
+
* Shares its branching with the array-header aggregation via {@link nullableErrorAction} so the field
|
|
11
|
+
* and its array header always hide/show the same errors.
|
|
12
|
+
*
|
|
10
13
|
* @param value the current value; `null` or `''` counts as empty
|
|
11
14
|
* @param error the rendered error nodes from `useCommonProps`
|
|
12
15
|
* @param schema the control schema; a `type` that includes `'null'` marks the field nullable
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const NULL_OPTION_ERRORS: Set<string>;
|
|
2
|
+
export declare const REQUIRED_ERROR = "is a required property";
|
|
3
|
+
/**
|
|
4
|
+
* The single source of truth for how an empty-capable single-value field treats its validation
|
|
5
|
+
* errors, shared by `useNullableErrorProps` (per field) and `useArrayHeaderErrors` (array header) so
|
|
6
|
+
* the two never drift:
|
|
7
|
+
*
|
|
8
|
+
* - `keep`: a non-empty value passes its errors through unchanged.
|
|
9
|
+
* - `drop-options`: an empty (`null` / `''`) value of a nullable field is valid, so the
|
|
10
|
+
* option-mismatch errors ({@link NULL_OPTION_ERRORS}) are hidden.
|
|
11
|
+
* - `required`: an empty value of a non-nullable field is missing, so a single
|
|
12
|
+
* {@link REQUIRED_ERROR} replaces whatever AJV reported.
|
|
13
|
+
*
|
|
14
|
+
* `value` is the current field value (`null` / `''` counts as empty), `nullable` whether the field
|
|
15
|
+
* schema permits `null`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const nullableErrorAction: (value: unknown, nullable: boolean) => "keep" | "drop-options" | "required";
|
|
18
|
+
/**
|
|
19
|
+
* Applies {@link nullableErrorAction} to a list of AJV error messages. Used by the array header,
|
|
20
|
+
* which works with the raw message strings of one field's errors (grouped by data path).
|
|
21
|
+
*
|
|
22
|
+
* `value` / `nullable` describe that field; `messages` are its error messages. Returns the messages
|
|
23
|
+
* to surface.
|
|
24
|
+
*/
|
|
25
|
+
export declare const resolveNullableErrorMessages: (value: unknown, nullable: boolean, messages: string[]) => string[];
|
|
26
|
+
/** Whether a schema permits a `null` value (i.e. is nullable / optional). */
|
|
27
|
+
export declare const isNullableSchemaType: (type: unknown) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|