@plumile/backoffice-core 0.1.59
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/LICENSE +21 -0
- package/lib/esm/base64.d.ts +3 -0
- package/lib/esm/base64.d.ts.map +1 -0
- package/lib/esm/base64.js +33 -0
- package/lib/esm/builders.d.ts +14 -0
- package/lib/esm/builders.d.ts.map +1 -0
- package/lib/esm/builders.js +34 -0
- package/lib/esm/constants.d.ts +14 -0
- package/lib/esm/constants.d.ts.map +1 -0
- package/lib/esm/constants.js +20 -0
- package/lib/esm/detail/pages.d.ts +29 -0
- package/lib/esm/detail/pages.d.ts.map +1 -0
- package/lib/esm/detail/pages.js +85 -0
- package/lib/esm/detailParams.d.ts +3 -0
- package/lib/esm/detailParams.d.ts.map +1 -0
- package/lib/esm/detailParams.js +15 -0
- package/lib/esm/filters/schema.d.ts +9 -0
- package/lib/esm/filters/schema.d.ts.map +1 -0
- package/lib/esm/filters/schema.js +101 -0
- package/lib/esm/filters/where.d.ts +4 -0
- package/lib/esm/filters/where.d.ts.map +1 -0
- package/lib/esm/filters/where.js +83 -0
- package/lib/esm/resolve.d.ts +13 -0
- package/lib/esm/resolve.d.ts.map +1 -0
- package/lib/esm/resolve.js +163 -0
- package/lib/esm/state/buildListHref.d.ts +14 -0
- package/lib/esm/state/buildListHref.d.ts.map +1 -0
- package/lib/esm/state/buildListHref.js +86 -0
- package/lib/esm/state/stableKey.d.ts +8 -0
- package/lib/esm/state/stableKey.d.ts.map +1 -0
- package/lib/esm/state/stableKey.js +17 -0
- package/lib/esm/state/urlState.d.ts +16 -0
- package/lib/esm/state/urlState.d.ts.map +1 -0
- package/lib/esm/state/urlState.js +48 -0
- package/lib/esm/types.d.ts +882 -0
- package/lib/esm/types.d.ts.map +1 -0
- package/lib/esm/types.js +8 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/types/base64.d.ts +3 -0
- package/lib/types/base64.d.ts.map +1 -0
- package/lib/types/builders.d.ts +14 -0
- package/lib/types/builders.d.ts.map +1 -0
- package/lib/types/constants.d.ts +14 -0
- package/lib/types/constants.d.ts.map +1 -0
- package/lib/types/detail/pages.d.ts +29 -0
- package/lib/types/detail/pages.d.ts.map +1 -0
- package/lib/types/detailParams.d.ts +3 -0
- package/lib/types/detailParams.d.ts.map +1 -0
- package/lib/types/filters/schema.d.ts +9 -0
- package/lib/types/filters/schema.d.ts.map +1 -0
- package/lib/types/filters/where.d.ts +4 -0
- package/lib/types/filters/where.d.ts.map +1 -0
- package/lib/types/resolve.d.ts +13 -0
- package/lib/types/resolve.d.ts.map +1 -0
- package/lib/types/state/buildListHref.d.ts +14 -0
- package/lib/types/state/buildListHref.d.ts.map +1 -0
- package/lib/types/state/stableKey.d.ts +8 -0
- package/lib/types/state/stableKey.d.ts.map +1 -0
- package/lib/types/state/urlState.d.ts +16 -0
- package/lib/types/state/urlState.d.ts.map +1 -0
- package/lib/types/types.d.ts +882 -0
- package/lib/types/types.d.ts.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,882 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { TFunction } from 'i18next';
|
|
3
|
+
import type { PreloadedQuery } from 'react-relay';
|
|
4
|
+
import type { GraphQLTaggedNode, OperationType, RecordSourceSelectorProxy } from 'relay-runtime';
|
|
5
|
+
import type { BACKOFFICE_ENTITY_FACET_KINDS } from './constants.js';
|
|
6
|
+
export type I18nLabel = (t: TFunction) => string;
|
|
7
|
+
type BivariantCallback<Fn> = Fn extends (...args: infer A) => infer R ? {
|
|
8
|
+
bivarianceHack: (...args: A) => R;
|
|
9
|
+
}['bivarianceHack'] : never;
|
|
10
|
+
export type BackofficeActionRenderNode = Exclude<ReactNode, Promise<unknown>>;
|
|
11
|
+
export type BackofficeValueLabel = string | number | null | I18nLabel;
|
|
12
|
+
export type BackofficeBadgeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
13
|
+
export type BackofficeNumberFormat = 'number' | 'currency' | 'percent';
|
|
14
|
+
export type BackofficeFieldSize = 'xs' | 's' | 'm' | 'l' | 'xl' | 'fluid';
|
|
15
|
+
export type BackofficeActionVariant = 'primary' | 'secondary' | 'text' | 'success' | 'danger' | 'brand' | 'brandGhost' | 'tab' | 'icon';
|
|
16
|
+
export type BackofficeActionSize = 'small' | 'medium' | 'large';
|
|
17
|
+
export type BackofficeActionToastViewSpec<Node = unknown, Response = unknown> = {
|
|
18
|
+
entityId: string;
|
|
19
|
+
getTargetId: BivariantCallback<(response: Response, node: Node) => string | null>;
|
|
20
|
+
label?: I18nLabel;
|
|
21
|
+
};
|
|
22
|
+
export type BackofficeActionToastSpec<Node = unknown, Response = unknown> = {
|
|
23
|
+
title: I18nLabel;
|
|
24
|
+
message?: I18nLabel;
|
|
25
|
+
view?: BackofficeActionToastViewSpec<Node, Response>;
|
|
26
|
+
};
|
|
27
|
+
export type BackofficeEntityActionBase<Node> = {
|
|
28
|
+
id: string;
|
|
29
|
+
label: I18nLabel;
|
|
30
|
+
ariaLabel?: I18nLabel;
|
|
31
|
+
variant?: BackofficeActionVariant;
|
|
32
|
+
size?: BackofficeActionSize;
|
|
33
|
+
isVisible?: BivariantCallback<(node: Node) => boolean>;
|
|
34
|
+
isDisabled?: BivariantCallback<(node: Node) => boolean>;
|
|
35
|
+
};
|
|
36
|
+
type BackofficeEntityActionFormFieldBase = {
|
|
37
|
+
id: string;
|
|
38
|
+
label: I18nLabel;
|
|
39
|
+
description?: I18nLabel;
|
|
40
|
+
};
|
|
41
|
+
export type BackofficeEntityActionFormFieldSpec = (BackofficeEntityActionFormFieldBase & {
|
|
42
|
+
id: string;
|
|
43
|
+
kind: 'text';
|
|
44
|
+
placeholder?: I18nLabel;
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
}) | (BackofficeEntityActionFormFieldBase & {
|
|
48
|
+
kind: 'number';
|
|
49
|
+
placeholder?: I18nLabel;
|
|
50
|
+
defaultValue?: number;
|
|
51
|
+
required?: boolean;
|
|
52
|
+
}) | (BackofficeEntityActionFormFieldBase & {
|
|
53
|
+
kind: 'json';
|
|
54
|
+
placeholder?: I18nLabel;
|
|
55
|
+
defaultValue?: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
jsonType?: 'object' | 'array' | 'any';
|
|
58
|
+
}) | (BackofficeEntityActionFormFieldBase & {
|
|
59
|
+
kind: 'enum';
|
|
60
|
+
options: readonly {
|
|
61
|
+
value: string;
|
|
62
|
+
label: I18nLabel;
|
|
63
|
+
}[];
|
|
64
|
+
defaultValue?: string;
|
|
65
|
+
required?: boolean;
|
|
66
|
+
}) | (BackofficeEntityActionFormFieldBase & {
|
|
67
|
+
kind: 'boolean';
|
|
68
|
+
defaultValue?: boolean;
|
|
69
|
+
}) | (BackofficeEntityActionFormFieldBase & {
|
|
70
|
+
kind: 'entityId';
|
|
71
|
+
entity: string;
|
|
72
|
+
defaultValue?: string;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
}) | (BackofficeEntityActionFormFieldBase & {
|
|
75
|
+
kind: 'multiEnum';
|
|
76
|
+
options: readonly {
|
|
77
|
+
value: string;
|
|
78
|
+
label: I18nLabel;
|
|
79
|
+
}[];
|
|
80
|
+
defaultValue?: readonly string[];
|
|
81
|
+
required?: boolean;
|
|
82
|
+
});
|
|
83
|
+
export type BackofficeEntityActionResultSpec<Node, Response = unknown> = {
|
|
84
|
+
label: I18nLabel;
|
|
85
|
+
getValue: BivariantCallback<(response: Response, node: Node) => string | null>;
|
|
86
|
+
render?: BivariantCallback<(response: Response, node: Node) => BackofficeActionRenderNode | null>;
|
|
87
|
+
};
|
|
88
|
+
export type BackofficeEntityActionUpdater<Node> = BivariantCallback<(store: RecordSourceSelectorProxy, node: Node) => void>;
|
|
89
|
+
export type BackofficeEntityMutationActionSpec<Node, Variables = Record<string, unknown>, Response = unknown> = BackofficeEntityActionBase<Node> & {
|
|
90
|
+
kind: 'mutation';
|
|
91
|
+
mutation: GraphQLTaggedNode;
|
|
92
|
+
getVariables: BivariantCallback<(node: Node) => Variables>;
|
|
93
|
+
updater?: BackofficeEntityActionUpdater<Node>;
|
|
94
|
+
mapErrorReason?: BivariantCallback<(reason: string, node: Node) => BackofficeValueLabel>;
|
|
95
|
+
onCompleted?: BivariantCallback<(response: Response, node: Node) => void>;
|
|
96
|
+
onError?: BivariantCallback<(error: Error, node: Node) => void>;
|
|
97
|
+
toasts?: {
|
|
98
|
+
success?: BackofficeActionToastSpec<Node, Response>;
|
|
99
|
+
error?: BackofficeActionToastSpec<Node, Response>;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export type BackofficeEntityFormMutationActionSpec<Node, Variables = Record<string, unknown>, Response = unknown> = BackofficeEntityActionBase<Node> & {
|
|
103
|
+
kind: 'formMutation';
|
|
104
|
+
mutation: GraphQLTaggedNode;
|
|
105
|
+
fields: readonly BackofficeEntityActionFormFieldSpec[];
|
|
106
|
+
getVariables: BivariantCallback<(node: Node, values: Record<string, unknown>) => Variables>;
|
|
107
|
+
updater?: BackofficeEntityActionUpdater<Node>;
|
|
108
|
+
getInitialValues?: BivariantCallback<(node: Node) => Record<string, unknown>>;
|
|
109
|
+
mapErrorReason?: BivariantCallback<(reason: string, node: Node) => BackofficeValueLabel>;
|
|
110
|
+
onCompleted?: BivariantCallback<(response: Response, node: Node) => void>;
|
|
111
|
+
onError?: BivariantCallback<(error: Error, node: Node) => void>;
|
|
112
|
+
toasts?: {
|
|
113
|
+
success?: BackofficeActionToastSpec<Node, Response>;
|
|
114
|
+
error?: BackofficeActionToastSpec<Node, Response>;
|
|
115
|
+
};
|
|
116
|
+
result?: BackofficeEntityActionResultSpec<Node, Response>;
|
|
117
|
+
};
|
|
118
|
+
export type BackofficeEntityRouteActionSpec<Node> = BackofficeEntityActionBase<Node> & {
|
|
119
|
+
kind: 'route';
|
|
120
|
+
to: BivariantCallback<(node: Node) => string>;
|
|
121
|
+
};
|
|
122
|
+
export type BackofficeEntityActionSpec<Node> = BackofficeEntityMutationActionSpec<Node> | BackofficeEntityFormMutationActionSpec<Node> | BackofficeEntityRouteActionSpec<Node>;
|
|
123
|
+
export type BackofficeListActionSpec = BackofficeEntityActionSpec<null>;
|
|
124
|
+
export type BackofficeEntityKind = 'list-detail' | 'tool';
|
|
125
|
+
export type BackofficeEntityManifestKind = 'list-detail' | 'tool';
|
|
126
|
+
export type BackofficeEntityFacetKind = (typeof BACKOFFICE_ENTITY_FACET_KINDS)[number];
|
|
127
|
+
export type BackofficeEntityModuleStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
128
|
+
export type BackofficeEntityLoadMode = 'cache-first' | 'reload';
|
|
129
|
+
export type BackofficeConfigAccessKind = 'manifest-only' | 'loaded-config-required';
|
|
130
|
+
export type BackofficeListState<Where, Sort extends string> = {
|
|
131
|
+
where: Where | null;
|
|
132
|
+
sort: Sort | null;
|
|
133
|
+
};
|
|
134
|
+
export type BackofficeListVariables<Where, Sort extends string> = {
|
|
135
|
+
where: Where | null;
|
|
136
|
+
sort: Sort | null;
|
|
137
|
+
count: number;
|
|
138
|
+
cursor: string | null;
|
|
139
|
+
};
|
|
140
|
+
export type BackofficeEntityRoutes = {
|
|
141
|
+
list: string;
|
|
142
|
+
detail: (id: string) => string;
|
|
143
|
+
detailPage: (id: string, pageId: string) => string;
|
|
144
|
+
};
|
|
145
|
+
export type BackofficeEntityRouteManifest = {
|
|
146
|
+
list: string;
|
|
147
|
+
detail: (id: string) => string;
|
|
148
|
+
detailPage: (id: string, pageId: string) => string;
|
|
149
|
+
};
|
|
150
|
+
export type BackofficeDetailPageManifestItem = {
|
|
151
|
+
id: string;
|
|
152
|
+
pathSegment: string;
|
|
153
|
+
label: I18nLabel;
|
|
154
|
+
isDefault?: boolean;
|
|
155
|
+
};
|
|
156
|
+
export type BackofficeDetailPageRouteSpec<LayoutView = unknown> = {
|
|
157
|
+
id: string;
|
|
158
|
+
path: string;
|
|
159
|
+
label: I18nLabel;
|
|
160
|
+
isVisible?: BivariantCallback<(layoutPage: LayoutView) => boolean>;
|
|
161
|
+
};
|
|
162
|
+
export type BackofficeDashboardConfig = {
|
|
163
|
+
title: I18nLabel;
|
|
164
|
+
subtitle?: I18nLabel;
|
|
165
|
+
query?: GraphQLTaggedNode;
|
|
166
|
+
widgets: readonly BackofficeDashboardWidget[];
|
|
167
|
+
};
|
|
168
|
+
export type BackofficeDashboardWidget = {
|
|
169
|
+
id: string;
|
|
170
|
+
kind: 'entityCount';
|
|
171
|
+
label: I18nLabel;
|
|
172
|
+
entityId: string;
|
|
173
|
+
query?: GraphQLTaggedNode;
|
|
174
|
+
resolve?: (data: unknown) => {
|
|
175
|
+
count: number | null;
|
|
176
|
+
};
|
|
177
|
+
} | {
|
|
178
|
+
id: string;
|
|
179
|
+
kind: 'shortcut';
|
|
180
|
+
label: I18nLabel;
|
|
181
|
+
entityId: string;
|
|
182
|
+
} | {
|
|
183
|
+
id: string;
|
|
184
|
+
kind: 'tablePreview';
|
|
185
|
+
title: I18nLabel;
|
|
186
|
+
query?: GraphQLTaggedNode;
|
|
187
|
+
resolve: (data: unknown) => {
|
|
188
|
+
columns: readonly BackofficeColumnSpec[];
|
|
189
|
+
rows: readonly unknown[];
|
|
190
|
+
};
|
|
191
|
+
} | {
|
|
192
|
+
id: string;
|
|
193
|
+
kind: 'textBlock';
|
|
194
|
+
title: I18nLabel;
|
|
195
|
+
body: I18nLabel;
|
|
196
|
+
};
|
|
197
|
+
export type BackofficeListUrlCodec<Where, Sort extends string> = {
|
|
198
|
+
parse: (search: URLSearchParams) => BackofficeListState<Where, Sort>;
|
|
199
|
+
serialize: (state: BackofficeListState<Where, Sort>) => URLSearchParams;
|
|
200
|
+
};
|
|
201
|
+
export type BackofficeSortSpec<Sort extends string = string> = {
|
|
202
|
+
id: Sort;
|
|
203
|
+
label: I18nLabel;
|
|
204
|
+
};
|
|
205
|
+
export type BackofficeRowFlagSpec<Row = unknown> = {
|
|
206
|
+
id: string;
|
|
207
|
+
label: BivariantCallback<(row: Row) => I18nLabel>;
|
|
208
|
+
render: BivariantCallback<(row: Row) => unknown>;
|
|
209
|
+
};
|
|
210
|
+
export type BackofficeColumnSpec<Row = unknown> = {
|
|
211
|
+
key: string;
|
|
212
|
+
header: I18nLabel;
|
|
213
|
+
size: BackofficeFieldSize;
|
|
214
|
+
cell: {
|
|
215
|
+
size?: BackofficeFieldSize;
|
|
216
|
+
type: 'text';
|
|
217
|
+
value: BivariantCallback<(row: Row) => string | number | null>;
|
|
218
|
+
} | {
|
|
219
|
+
size?: BackofficeFieldSize;
|
|
220
|
+
type: 'link';
|
|
221
|
+
value: BivariantCallback<(row: Row) => string | number | null>;
|
|
222
|
+
to: BivariantCallback<(row: Row) => string>;
|
|
223
|
+
} | {
|
|
224
|
+
size?: BackofficeFieldSize;
|
|
225
|
+
type: 'badge';
|
|
226
|
+
value: BivariantCallback<(row: Row) => string | null>;
|
|
227
|
+
tone?: BackofficeBadgeTone | BivariantCallback<(row: Row) => BackofficeBadgeTone>;
|
|
228
|
+
} | {
|
|
229
|
+
size?: BackofficeFieldSize;
|
|
230
|
+
type: 'dateTime';
|
|
231
|
+
value: BivariantCallback<(row: Row) => string | number | null>;
|
|
232
|
+
} | {
|
|
233
|
+
size?: BackofficeFieldSize;
|
|
234
|
+
type: 'entityRef';
|
|
235
|
+
entity: string;
|
|
236
|
+
value: BivariantCallback<(row: Row) => string>;
|
|
237
|
+
} | {
|
|
238
|
+
size?: BackofficeFieldSize;
|
|
239
|
+
type: 'custom';
|
|
240
|
+
render: BivariantCallback<(row: Row) => unknown>;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
export type BackofficeFilterPlacement = 'quick' | 'drawer' | 'both';
|
|
244
|
+
type BackofficeFilterBase<Where, Value> = {
|
|
245
|
+
id: string;
|
|
246
|
+
label: I18nLabel;
|
|
247
|
+
placement?: BackofficeFilterPlacement;
|
|
248
|
+
toGraphQL: (value: Value) => Partial<Where>;
|
|
249
|
+
fromGraphQL?: (where: Where) => Value | null;
|
|
250
|
+
whereKey?: keyof Where;
|
|
251
|
+
path?: readonly string[];
|
|
252
|
+
pickerScope?: BackofficePickerScope | ((where: Where | null) => BackofficePickerScope);
|
|
253
|
+
};
|
|
254
|
+
export type BackofficeFilterSpec<Where> = (BackofficeFilterBase<Where, string> & {
|
|
255
|
+
kind: 'text';
|
|
256
|
+
placeholderLabel?: I18nLabel;
|
|
257
|
+
placeholderText?: I18nLabel;
|
|
258
|
+
}) | (BackofficeFilterBase<Where, string> & {
|
|
259
|
+
kind: 'enum';
|
|
260
|
+
options: readonly {
|
|
261
|
+
value: string;
|
|
262
|
+
label: I18nLabel;
|
|
263
|
+
}[];
|
|
264
|
+
}) | (BackofficeFilterBase<Where, boolean> & {
|
|
265
|
+
kind: 'boolean';
|
|
266
|
+
trueLabel?: I18nLabel;
|
|
267
|
+
falseLabel?: I18nLabel;
|
|
268
|
+
}) | (BackofficeFilterBase<Where, string> & {
|
|
269
|
+
kind: 'entityId';
|
|
270
|
+
entity: string;
|
|
271
|
+
});
|
|
272
|
+
export type BackofficeConnectionListConfig<Where, Sort extends string, RowRef, RowView, ListQueryData = unknown, ListFragmentData = unknown, ListQueryVariables = BackofficeListVariables<Where, Sort>> = {
|
|
273
|
+
kind?: 'connection';
|
|
274
|
+
title: I18nLabel;
|
|
275
|
+
query: GraphQLTaggedNode;
|
|
276
|
+
fragment: GraphQLTaggedNode;
|
|
277
|
+
getConnection: BivariantCallback<(data: ListFragmentData) => BackofficeConnection<RowRef>>;
|
|
278
|
+
toRow: BivariantCallback<(rowRef: RowRef) => RowView>;
|
|
279
|
+
getRowId: BivariantCallback<(row: RowView) => string>;
|
|
280
|
+
columns: readonly BackofficeColumnSpec<RowView>[];
|
|
281
|
+
rowFlags?: readonly BackofficeRowFlagSpec<RowView>[];
|
|
282
|
+
sorts: readonly BackofficeSortSpec<Sort>[];
|
|
283
|
+
filters: readonly BackofficeFilterSpec<Where>[];
|
|
284
|
+
defaultState?: BackofficeListState<Where, Sort>;
|
|
285
|
+
buildVariables?: BivariantCallback<(input: BackofficeListVariables<Where, Sort>) => ListQueryVariables>;
|
|
286
|
+
__listQueryData?: ListQueryData;
|
|
287
|
+
};
|
|
288
|
+
export type BackofficeRecordListConfig<Where, Sort extends string, RowRef, RowView, ListQueryData = unknown, ListFragmentData = unknown, ListQueryVariables = BackofficeListVariables<Where, Sort>> = {
|
|
289
|
+
kind: 'records';
|
|
290
|
+
title: I18nLabel;
|
|
291
|
+
query: GraphQLTaggedNode;
|
|
292
|
+
fragment: GraphQLTaggedNode;
|
|
293
|
+
getRows: BivariantCallback<(data: ListFragmentData) => readonly RowRef[]>;
|
|
294
|
+
toRow: BivariantCallback<(rowRef: RowRef) => RowView>;
|
|
295
|
+
getNextCursor?: BivariantCallback<(data: ListQueryData) => string | null>;
|
|
296
|
+
getRowId: BivariantCallback<(row: RowView) => string>;
|
|
297
|
+
columns: readonly BackofficeColumnSpec<RowView>[];
|
|
298
|
+
rowFlags?: readonly BackofficeRowFlagSpec<RowView>[];
|
|
299
|
+
sorts: readonly BackofficeSortSpec<Sort>[];
|
|
300
|
+
filters: readonly BackofficeFilterSpec<Where>[];
|
|
301
|
+
defaultState?: BackofficeListState<Where, Sort>;
|
|
302
|
+
buildVariables?: BivariantCallback<(input: BackofficeListVariables<Where, Sort>) => ListQueryVariables>;
|
|
303
|
+
};
|
|
304
|
+
export type BackofficeEntityListConfig<Where, Sort extends string, RowRef, RowView, ListQueryData = unknown, ListFragmentData = unknown, ListQueryVariables = BackofficeListVariables<Where, Sort>> = BackofficeConnectionListConfig<Where, Sort, RowRef, RowView, ListQueryData, ListFragmentData, ListQueryVariables> | BackofficeRecordListConfig<Where, Sort, RowRef, RowView, ListQueryData, ListFragmentData, ListQueryVariables>;
|
|
305
|
+
export type BackofficeBadgeItem = {
|
|
306
|
+
id: string;
|
|
307
|
+
label: string | I18nLabel;
|
|
308
|
+
tone?: BackofficeBadgeTone;
|
|
309
|
+
};
|
|
310
|
+
export type BackofficeInlineValueSpec = {
|
|
311
|
+
type: 'text';
|
|
312
|
+
value: BackofficeValueLabel;
|
|
313
|
+
} | {
|
|
314
|
+
type: 'entityRef';
|
|
315
|
+
entity: string;
|
|
316
|
+
id: string | null;
|
|
317
|
+
label?: BackofficeValueLabel;
|
|
318
|
+
} | {
|
|
319
|
+
type: 'link';
|
|
320
|
+
href: string | null;
|
|
321
|
+
label: BackofficeValueLabel;
|
|
322
|
+
};
|
|
323
|
+
export type BackofficeDetailHeaderSubtitleItem<Node> = {
|
|
324
|
+
id: string;
|
|
325
|
+
value: BivariantCallback<(node: Node) => BackofficeInlineValueSpec>;
|
|
326
|
+
};
|
|
327
|
+
export type BackofficeDetailHeaderMetaSpec<Node> = {
|
|
328
|
+
type?: 'text';
|
|
329
|
+
label: I18nLabel;
|
|
330
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
331
|
+
} | {
|
|
332
|
+
type: 'dateTime';
|
|
333
|
+
label: I18nLabel;
|
|
334
|
+
value: BivariantCallback<(node: Node) => string | number | null>;
|
|
335
|
+
} | {
|
|
336
|
+
type: 'entityRef';
|
|
337
|
+
label: I18nLabel;
|
|
338
|
+
entity: string;
|
|
339
|
+
id: BivariantCallback<(node: Node) => string | null>;
|
|
340
|
+
value?: BivariantCallback<(node: Node) => string | null>;
|
|
341
|
+
} | {
|
|
342
|
+
type: 'link';
|
|
343
|
+
label: I18nLabel;
|
|
344
|
+
href: BivariantCallback<(node: Node) => string | null>;
|
|
345
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
346
|
+
};
|
|
347
|
+
export type BackofficeDetailHeaderStatusSpec<Node> = {
|
|
348
|
+
type: 'badge';
|
|
349
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
350
|
+
tone?: BackofficeBadgeTone | BivariantCallback<(node: Node) => BackofficeBadgeTone>;
|
|
351
|
+
} | {
|
|
352
|
+
type: 'badgeRow';
|
|
353
|
+
items: BivariantCallback<(node: Node) => readonly BackofficeBadgeItem[]>;
|
|
354
|
+
};
|
|
355
|
+
export type BackofficeDetailPlacement = 'primary' | 'secondary';
|
|
356
|
+
export type BackofficeFlagVariant = 'yesNo' | 'capability' | 'enabled' | 'failure' | 'encrypted' | 'locked' | 'default' | 'agentManaged' | 'deployedProduction' | 'forced';
|
|
357
|
+
export type BackofficeDetailFieldSpec<Node> = {
|
|
358
|
+
type: 'text';
|
|
359
|
+
label: I18nLabel;
|
|
360
|
+
size: BackofficeFieldSize;
|
|
361
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
362
|
+
copyValue?: BivariantCallback<(node: Node) => string | null>;
|
|
363
|
+
fullWidth?: boolean;
|
|
364
|
+
} | {
|
|
365
|
+
type: 'badge';
|
|
366
|
+
label: I18nLabel;
|
|
367
|
+
size: BackofficeFieldSize;
|
|
368
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
369
|
+
tone?: BackofficeBadgeTone | BivariantCallback<(node: Node) => BackofficeBadgeTone>;
|
|
370
|
+
} | {
|
|
371
|
+
type: 'badgeRow';
|
|
372
|
+
label: I18nLabel;
|
|
373
|
+
size: BackofficeFieldSize;
|
|
374
|
+
items: BivariantCallback<(node: Node) => readonly BackofficeBadgeItem[]>;
|
|
375
|
+
fullWidth?: boolean;
|
|
376
|
+
} | {
|
|
377
|
+
type: 'dateTime';
|
|
378
|
+
label: I18nLabel;
|
|
379
|
+
size: BackofficeFieldSize;
|
|
380
|
+
value: BivariantCallback<(node: Node) => string | number | null>;
|
|
381
|
+
} | {
|
|
382
|
+
type: 'number';
|
|
383
|
+
label: I18nLabel;
|
|
384
|
+
size: BackofficeFieldSize;
|
|
385
|
+
value: BivariantCallback<(node: Node) => number | null>;
|
|
386
|
+
format?: BackofficeNumberFormat;
|
|
387
|
+
} | {
|
|
388
|
+
type: 'flag';
|
|
389
|
+
label: I18nLabel;
|
|
390
|
+
size: BackofficeFieldSize;
|
|
391
|
+
value: BivariantCallback<(node: Node) => boolean | null>;
|
|
392
|
+
variant: BackofficeFlagVariant;
|
|
393
|
+
} | {
|
|
394
|
+
type: 'entityRef';
|
|
395
|
+
label: I18nLabel;
|
|
396
|
+
size: BackofficeFieldSize;
|
|
397
|
+
entity: string;
|
|
398
|
+
id: BivariantCallback<(node: Node) => string | null>;
|
|
399
|
+
value?: BivariantCallback<(node: Node) => string | null>;
|
|
400
|
+
} | {
|
|
401
|
+
type: 'link';
|
|
402
|
+
label: I18nLabel;
|
|
403
|
+
size: BackofficeFieldSize;
|
|
404
|
+
href: BivariantCallback<(node: Node) => string | null>;
|
|
405
|
+
value: BivariantCallback<(node: Node) => string | number | null>;
|
|
406
|
+
} | {
|
|
407
|
+
type: 'taggedValue';
|
|
408
|
+
label: I18nLabel;
|
|
409
|
+
size: BackofficeFieldSize;
|
|
410
|
+
tag: BivariantCallback<(node: Node) => {
|
|
411
|
+
label: string | I18nLabel;
|
|
412
|
+
tone?: BackofficeBadgeTone;
|
|
413
|
+
} | null>;
|
|
414
|
+
value: BivariantCallback<(node: Node) => BackofficeInlineValueSpec>;
|
|
415
|
+
fullWidth?: boolean;
|
|
416
|
+
} | {
|
|
417
|
+
type: 'relation';
|
|
418
|
+
label: I18nLabel;
|
|
419
|
+
size: BackofficeFieldSize;
|
|
420
|
+
entity: string;
|
|
421
|
+
filterId?: string;
|
|
422
|
+
whereKey: string;
|
|
423
|
+
value: BivariantCallback<(node: Node) => string>;
|
|
424
|
+
path?: readonly string[];
|
|
425
|
+
count?: BivariantCallback<(node: Node) => number | null>;
|
|
426
|
+
} | {
|
|
427
|
+
type: 'custom';
|
|
428
|
+
label?: I18nLabel;
|
|
429
|
+
size: BackofficeFieldSize;
|
|
430
|
+
render: BivariantCallback<(node: Node) => unknown>;
|
|
431
|
+
fullWidth?: boolean;
|
|
432
|
+
};
|
|
433
|
+
export type BackofficeDetailHeaderConfig<Node> = {
|
|
434
|
+
title: I18nLabel;
|
|
435
|
+
titleValue?: BivariantCallback<(node: Node, t: TFunction) => string | null>;
|
|
436
|
+
subtitle?: I18nLabel;
|
|
437
|
+
subtitleValue?: BivariantCallback<(node: Node, t: TFunction) => string | null>;
|
|
438
|
+
subtitleItems?: readonly BackofficeDetailHeaderSubtitleItem<Node>[];
|
|
439
|
+
subtitleSeparator?: string;
|
|
440
|
+
id?: BivariantCallback<(node: Node) => string | null>;
|
|
441
|
+
badges?: readonly {
|
|
442
|
+
label: I18nLabel;
|
|
443
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
444
|
+
tone?: BackofficeBadgeTone | BivariantCallback<(node: Node) => BackofficeBadgeTone>;
|
|
445
|
+
}[];
|
|
446
|
+
status?: BackofficeDetailHeaderStatusSpec<Node>;
|
|
447
|
+
meta?: readonly BackofficeDetailHeaderMetaSpec<Node>[];
|
|
448
|
+
};
|
|
449
|
+
export type BackofficeDetailSectionConfig<Node> = {
|
|
450
|
+
title: I18nLabel;
|
|
451
|
+
description?: I18nLabel;
|
|
452
|
+
fields: readonly BackofficeDetailFieldSpec<Node>[];
|
|
453
|
+
placement?: BackofficeDetailPlacement;
|
|
454
|
+
};
|
|
455
|
+
export type BackofficeDetailTableBlockSpec<Node, Row> = {
|
|
456
|
+
kind: 'table';
|
|
457
|
+
label: I18nLabel;
|
|
458
|
+
description?: I18nLabel;
|
|
459
|
+
columns: readonly BackofficeColumnSpec<Row>[];
|
|
460
|
+
rows: BivariantCallback<(node: Node) => readonly Row[]>;
|
|
461
|
+
placement?: BackofficeDetailPlacement;
|
|
462
|
+
};
|
|
463
|
+
export type BackofficeDetailBlockSpec<Node> = {
|
|
464
|
+
kind: 'relationList';
|
|
465
|
+
label: I18nLabel;
|
|
466
|
+
description?: I18nLabel;
|
|
467
|
+
target: string;
|
|
468
|
+
whereKey: string;
|
|
469
|
+
value: BivariantCallback<(node: Node) => string | null>;
|
|
470
|
+
path?: readonly string[];
|
|
471
|
+
placement?: BackofficeDetailPlacement;
|
|
472
|
+
} | BackofficeDetailTableBlockSpec<Node, any> | {
|
|
473
|
+
kind: 'json';
|
|
474
|
+
label: I18nLabel;
|
|
475
|
+
description?: I18nLabel;
|
|
476
|
+
value: BivariantCallback<(node: Node) => unknown>;
|
|
477
|
+
placement?: BackofficeDetailPlacement;
|
|
478
|
+
} | {
|
|
479
|
+
kind: 'code';
|
|
480
|
+
label: I18nLabel;
|
|
481
|
+
description?: I18nLabel;
|
|
482
|
+
value: BivariantCallback<(node: Node) => string>;
|
|
483
|
+
placement?: BackofficeDetailPlacement;
|
|
484
|
+
} | {
|
|
485
|
+
kind: 'keyValue';
|
|
486
|
+
label: I18nLabel;
|
|
487
|
+
description?: I18nLabel;
|
|
488
|
+
items: readonly {
|
|
489
|
+
label: I18nLabel;
|
|
490
|
+
value: BivariantCallback<(node: Node) => BackofficeValueLabel>;
|
|
491
|
+
}[];
|
|
492
|
+
placement?: BackofficeDetailPlacement;
|
|
493
|
+
} | {
|
|
494
|
+
kind: 'payload';
|
|
495
|
+
label: I18nLabel;
|
|
496
|
+
description?: I18nLabel;
|
|
497
|
+
value: BivariantCallback<(node: Node) => unknown>;
|
|
498
|
+
format?: 'markdown' | 'json' | 'text';
|
|
499
|
+
placement?: BackofficeDetailPlacement;
|
|
500
|
+
} | {
|
|
501
|
+
kind: 'errorList';
|
|
502
|
+
label: I18nLabel;
|
|
503
|
+
description?: I18nLabel;
|
|
504
|
+
errors: BivariantCallback<(node: Node) => readonly {
|
|
505
|
+
code: string;
|
|
506
|
+
message: string;
|
|
507
|
+
details?: unknown;
|
|
508
|
+
}[]>;
|
|
509
|
+
placement?: BackofficeDetailPlacement;
|
|
510
|
+
} | {
|
|
511
|
+
kind: 'custom';
|
|
512
|
+
label?: I18nLabel;
|
|
513
|
+
render: BivariantCallback<(node: Node) => unknown>;
|
|
514
|
+
placement?: BackofficeDetailPlacement;
|
|
515
|
+
};
|
|
516
|
+
export type BackofficeDetailContentSpec<Node> = (BackofficeDetailSectionConfig<Node> & {
|
|
517
|
+
kind: 'section';
|
|
518
|
+
}) | BackofficeDetailBlockSpec<Node>;
|
|
519
|
+
export type BackofficeDetailPageDataContext = {
|
|
520
|
+
id: string;
|
|
521
|
+
detailId?: string;
|
|
522
|
+
};
|
|
523
|
+
export type BackofficeDetailPageVariablesResult<DetailQueryVariables> = {
|
|
524
|
+
variables: DetailQueryVariables;
|
|
525
|
+
detailId?: string;
|
|
526
|
+
};
|
|
527
|
+
export type BackofficeDetailVariables<DetailQueryVariables> = BackofficeDetailPageVariablesResult<DetailQueryVariables>;
|
|
528
|
+
export type BackofficeDetailPageDataSpec<DetailView, DetailData = DetailView, DetailQueryData = unknown, DetailFragmentKey = unknown, DetailQueryVariables = Record<string, unknown>> = {
|
|
529
|
+
query: GraphQLTaggedNode;
|
|
530
|
+
fragment: GraphQLTaggedNode;
|
|
531
|
+
resolveNode: BivariantCallback<(data: DetailQueryData, context: BackofficeDetailPageDataContext) => DetailFragmentKey | null>;
|
|
532
|
+
toView: BivariantCallback<(data: DetailData) => DetailView>;
|
|
533
|
+
buildVariables?: (input: {
|
|
534
|
+
id: string;
|
|
535
|
+
}) => BackofficeDetailPageVariablesResult<DetailQueryVariables>;
|
|
536
|
+
};
|
|
537
|
+
export type BackofficeDetailLayoutSpec<LayoutView, LayoutData = LayoutView, LayoutQueryData = unknown, LayoutFragmentKey = unknown, LayoutQueryVariables = Record<string, unknown>> = BackofficeDetailPageDataSpec<LayoutView, LayoutData, LayoutQueryData, LayoutFragmentKey, LayoutQueryVariables>;
|
|
538
|
+
export type BackofficeDetailPageSpec<DetailView, LayoutView = DetailView, DetailData = DetailView, DetailQueryData = unknown, DetailFragmentKey = unknown, DetailQueryVariables = Record<string, unknown>> = BackofficeDetailPageDataSpec<DetailView, DetailData, DetailQueryData, DetailFragmentKey, DetailQueryVariables> & {
|
|
539
|
+
id: string;
|
|
540
|
+
path: string;
|
|
541
|
+
label: I18nLabel;
|
|
542
|
+
content: readonly BackofficeDetailContentSpec<DetailView>[];
|
|
543
|
+
actions?: readonly BackofficeEntityActionSpec<DetailView>[];
|
|
544
|
+
isVisible?: BivariantCallback<(layoutPage: LayoutView) => boolean>;
|
|
545
|
+
};
|
|
546
|
+
export type BackofficePickerValueConfig<RowRef, RowView> = {
|
|
547
|
+
query: GraphQLTaggedNode;
|
|
548
|
+
resolveRow: BivariantCallback<(data: unknown) => RowRef | null>;
|
|
549
|
+
toRow: BivariantCallback<(rowRef: RowRef) => RowView>;
|
|
550
|
+
};
|
|
551
|
+
export type BackofficeEntityDetailConfig<LayoutData = any, LayoutView = any, MainData = LayoutData, MainView = LayoutView, SubData = MainData, SubView = MainView, LayoutQueryData = unknown, MainQueryData = unknown, SubQueryData = MainQueryData, LayoutFragmentKey = unknown, MainFragmentKey = unknown, SubFragmentKey = MainFragmentKey, LayoutQueryVariables = Record<string, unknown>, MainQueryVariables = Record<string, unknown>, SubQueryVariables = MainQueryVariables> = {
|
|
552
|
+
title: I18nLabel;
|
|
553
|
+
header: BackofficeDetailHeaderConfig<LayoutView>;
|
|
554
|
+
layoutPage: BackofficeDetailLayoutSpec<LayoutView, LayoutData, LayoutQueryData, LayoutFragmentKey, LayoutQueryVariables>;
|
|
555
|
+
mainPage: BackofficeDetailPageSpec<MainView, LayoutView, MainData, MainQueryData, MainFragmentKey, MainQueryVariables>;
|
|
556
|
+
subPages?: readonly BackofficeDetailPageSpec<SubView, LayoutView, SubData, SubQueryData, SubFragmentKey, SubQueryVariables>[];
|
|
557
|
+
};
|
|
558
|
+
export type BackofficePickerScope = Record<string, string | null | undefined>;
|
|
559
|
+
export type BackofficeEntityPickerConfig<RowRef, RowView, PickerQueryData = unknown, PickerFragmentData = unknown, PickerQueryVariables = Record<string, unknown>> = {
|
|
560
|
+
query: GraphQLTaggedNode;
|
|
561
|
+
fragment: GraphQLTaggedNode;
|
|
562
|
+
value?: BackofficePickerValueConfig<RowRef, RowView>;
|
|
563
|
+
getConnection: BivariantCallback<(data: PickerFragmentData) => BackofficeConnection<RowRef>>;
|
|
564
|
+
toRow: BivariantCallback<(rowRef: RowRef) => RowView>;
|
|
565
|
+
getRowId: BivariantCallback<(row: RowView) => string>;
|
|
566
|
+
searchEnabled?: boolean;
|
|
567
|
+
searchRequired?: boolean;
|
|
568
|
+
searchPlaceholder?: I18nLabel;
|
|
569
|
+
buildVariables?: (input: {
|
|
570
|
+
search: string;
|
|
571
|
+
scope?: BackofficePickerScope;
|
|
572
|
+
}) => PickerQueryVariables;
|
|
573
|
+
__pickerQueryData?: PickerQueryData;
|
|
574
|
+
};
|
|
575
|
+
export type BackofficeToolEntityConfig = {
|
|
576
|
+
kind: 'tool';
|
|
577
|
+
id: string;
|
|
578
|
+
label?: I18nLabel;
|
|
579
|
+
route?: string;
|
|
580
|
+
operation: BackofficeToolOperation;
|
|
581
|
+
list?: never;
|
|
582
|
+
detail?: never;
|
|
583
|
+
picker?: never;
|
|
584
|
+
routes?: never;
|
|
585
|
+
};
|
|
586
|
+
export type BackofficeListFacetConfig<Where = Record<string, unknown>, Sort extends string = string, RowRef = any, RowView = any, ListQueryData = unknown, ListFragmentData = unknown, ListQueryVariables = Record<string, unknown>> = {
|
|
587
|
+
kind: 'list';
|
|
588
|
+
id: string;
|
|
589
|
+
label: I18nLabel;
|
|
590
|
+
list: BackofficeEntityListConfig<Where, Sort, RowRef, RowView, ListQueryData, ListFragmentData, ListQueryVariables>;
|
|
591
|
+
listActions?: readonly BackofficeListActionSpec[];
|
|
592
|
+
};
|
|
593
|
+
export type BackofficePickerFacetConfig<RowRef = any, RowView = any, PickerQueryData = unknown, PickerFragmentData = unknown, PickerQueryVariables = Record<string, unknown>> = {
|
|
594
|
+
kind: 'picker';
|
|
595
|
+
id: string;
|
|
596
|
+
label: I18nLabel;
|
|
597
|
+
picker: BackofficeEntityPickerConfig<RowRef, RowView, PickerQueryData, PickerFragmentData, PickerQueryVariables>;
|
|
598
|
+
};
|
|
599
|
+
export type BackofficeDetailPagesSpec<LayoutView = unknown, Page extends BackofficeDetailPageRouteSpec<LayoutView> = BackofficeDetailPageRouteSpec<LayoutView>> = {
|
|
600
|
+
title: I18nLabel;
|
|
601
|
+
header: BackofficeDetailHeaderConfig<LayoutView>;
|
|
602
|
+
mainPage: Page;
|
|
603
|
+
subPages?: readonly Page[];
|
|
604
|
+
defaultPageId: string;
|
|
605
|
+
};
|
|
606
|
+
export type BackofficeDetailLayoutFacetConfig<LayoutData = any, LayoutView = any, LayoutQueryData = unknown, LayoutFragmentKey = unknown, LayoutQueryVariables = Record<string, unknown>> = {
|
|
607
|
+
kind: 'detail-layout';
|
|
608
|
+
id: string;
|
|
609
|
+
label: I18nLabel;
|
|
610
|
+
header: BackofficeDetailHeaderConfig<LayoutView>;
|
|
611
|
+
title: I18nLabel;
|
|
612
|
+
layoutPage: BackofficeDetailLayoutSpec<LayoutView, LayoutData, LayoutQueryData, LayoutFragmentKey, LayoutQueryVariables>;
|
|
613
|
+
pages: BackofficeDetailPagesSpec<LayoutView>;
|
|
614
|
+
};
|
|
615
|
+
export type BackofficeDetailPageFacetConfig<LayoutView = unknown, DetailData = any, DetailView = any, DetailQueryData = unknown, DetailFragmentKey = unknown, DetailQueryVariables = Record<string, unknown>> = {
|
|
616
|
+
kind: 'detail-page';
|
|
617
|
+
id: string;
|
|
618
|
+
label: I18nLabel;
|
|
619
|
+
title: I18nLabel;
|
|
620
|
+
header: BackofficeDetailHeaderConfig<LayoutView>;
|
|
621
|
+
page: BackofficeDetailPageSpec<DetailView, LayoutView, DetailData, DetailQueryData, DetailFragmentKey, DetailQueryVariables>;
|
|
622
|
+
pages: BackofficeDetailPagesSpec<LayoutView>;
|
|
623
|
+
};
|
|
624
|
+
export type BackofficeToolFacetConfig = {
|
|
625
|
+
kind: 'tool';
|
|
626
|
+
id: string;
|
|
627
|
+
label: I18nLabel;
|
|
628
|
+
tool: BackofficeToolEntityConfig;
|
|
629
|
+
};
|
|
630
|
+
export type BackofficeEntityFacetConfigBase = BackofficeListFacetConfigBase | BackofficePickerFacetConfigBase | BackofficeDetailLayoutFacetConfigBase | BackofficeDetailPageFacetConfigBase | BackofficeToolFacetConfig;
|
|
631
|
+
export type BackofficeLoadedListFacetModule = {
|
|
632
|
+
kind: 'list';
|
|
633
|
+
id: string;
|
|
634
|
+
config: BackofficeListFacetConfigBase;
|
|
635
|
+
};
|
|
636
|
+
export type BackofficeLoadedPickerFacetModule = {
|
|
637
|
+
kind: 'picker';
|
|
638
|
+
id: string;
|
|
639
|
+
config: BackofficePickerFacetConfigBase;
|
|
640
|
+
};
|
|
641
|
+
export type BackofficeLoadedDetailLayoutFacetModule = {
|
|
642
|
+
kind: 'detail-layout';
|
|
643
|
+
id: string;
|
|
644
|
+
config: BackofficeDetailLayoutFacetConfigBase;
|
|
645
|
+
};
|
|
646
|
+
export type BackofficeLoadedDetailPageFacetModule = {
|
|
647
|
+
kind: 'detail-page';
|
|
648
|
+
id: string;
|
|
649
|
+
pageId: string;
|
|
650
|
+
config: BackofficeDetailPageFacetConfigBase;
|
|
651
|
+
};
|
|
652
|
+
export type BackofficeLoadedToolFacetModule = {
|
|
653
|
+
kind: 'tool';
|
|
654
|
+
id: string;
|
|
655
|
+
config: BackofficeToolFacetConfig;
|
|
656
|
+
};
|
|
657
|
+
export type BackofficeLoadedEntityFacetModule = BackofficeLoadedListFacetModule | BackofficeLoadedPickerFacetModule | BackofficeLoadedDetailLayoutFacetModule | BackofficeLoadedDetailPageFacetModule | BackofficeLoadedToolFacetModule;
|
|
658
|
+
export type BackofficeListFacetLoader = () => Promise<BackofficeLoadedListFacetModule>;
|
|
659
|
+
export type BackofficePickerFacetLoader = () => Promise<BackofficeLoadedPickerFacetModule>;
|
|
660
|
+
export type BackofficeDetailLayoutFacetLoader = () => Promise<BackofficeLoadedDetailLayoutFacetModule>;
|
|
661
|
+
export type BackofficeDetailPageFacetLoader = (pageId: string) => Promise<BackofficeLoadedDetailPageFacetModule>;
|
|
662
|
+
export type BackofficeToolFacetLoader = () => Promise<BackofficeLoadedToolFacetModule>;
|
|
663
|
+
export type BackofficeListDetailFacetLoaderMap = {
|
|
664
|
+
list?: BackofficeListFacetLoader;
|
|
665
|
+
picker?: BackofficePickerFacetLoader;
|
|
666
|
+
detailLayout: BackofficeDetailLayoutFacetLoader;
|
|
667
|
+
detailPage: BackofficeDetailPageFacetLoader;
|
|
668
|
+
};
|
|
669
|
+
export type BackofficeToolFacetLoaderMap = {
|
|
670
|
+
tool: BackofficeToolFacetLoader;
|
|
671
|
+
};
|
|
672
|
+
export type BackofficeEntityFacetLoaderMap = BackofficeListDetailFacetLoaderMap | BackofficeToolFacetLoaderMap;
|
|
673
|
+
export type BackofficeEntityManifestItem = {
|
|
674
|
+
id: string;
|
|
675
|
+
kind: BackofficeEntityManifestKind;
|
|
676
|
+
routeSegment: string;
|
|
677
|
+
groupId?: string;
|
|
678
|
+
label: I18nLabel;
|
|
679
|
+
routes: BackofficeEntityRouteManifest;
|
|
680
|
+
hasList: boolean;
|
|
681
|
+
detailPages?: readonly BackofficeDetailPageManifestItem[];
|
|
682
|
+
defaultDetailPageId?: string;
|
|
683
|
+
facets: BackofficeEntityFacetLoaderMap;
|
|
684
|
+
};
|
|
685
|
+
export type BackofficeEntityManifestMap = Record<string, BackofficeEntityManifestItem>;
|
|
686
|
+
export type BackofficeResolvedListFacetConfig<Where = Record<string, unknown>, Sort extends string = string, RowRef = any, RowView = any, ListQueryData = unknown, ListFragmentData = unknown, ListQueryVariables = Record<string, unknown>> = BackofficeListFacetConfig<Where, Sort, RowRef, RowView, ListQueryData, ListFragmentData, ListQueryVariables> & {
|
|
687
|
+
routes: BackofficeEntityRoutes;
|
|
688
|
+
listUrlCodec?: BackofficeListUrlCodec<Where, Sort>;
|
|
689
|
+
listDefaults?: BackofficeListState<Where, Sort>;
|
|
690
|
+
};
|
|
691
|
+
export type BackofficeResolvedPickerFacetConfig<RowRef = any, RowView = any, PickerQueryData = unknown, PickerFragmentData = unknown, PickerQueryVariables = Record<string, unknown>> = BackofficePickerFacetConfig<RowRef, RowView, PickerQueryData, PickerFragmentData, PickerQueryVariables> & {
|
|
692
|
+
routes: BackofficeEntityRoutes;
|
|
693
|
+
};
|
|
694
|
+
export type BackofficeResolvedDetailLayoutFacetConfig<LayoutRef = any, LayoutView = any, LayoutQueryData = unknown, LayoutFragmentRef = unknown, LayoutQueryVariables = Record<string, unknown>> = BackofficeDetailLayoutFacetConfig<LayoutRef, LayoutView, LayoutQueryData, LayoutFragmentRef, LayoutQueryVariables> & {
|
|
695
|
+
routes: BackofficeEntityRoutes;
|
|
696
|
+
};
|
|
697
|
+
export type BackofficeResolvedDetailPageFacetConfig<LayoutView = unknown, DetailRef = any, DetailView = any, DetailQueryData = unknown, DetailFragmentRef = unknown, DetailQueryVariables = Record<string, unknown>> = BackofficeDetailPageFacetConfig<LayoutView, DetailRef, DetailView, DetailQueryData, DetailFragmentRef, DetailQueryVariables> & {
|
|
698
|
+
routes: BackofficeEntityRoutes;
|
|
699
|
+
};
|
|
700
|
+
export type BackofficeResolvedToolFacetConfig = BackofficeToolFacetConfig & {
|
|
701
|
+
route: string;
|
|
702
|
+
routes: BackofficeEntityRoutes;
|
|
703
|
+
};
|
|
704
|
+
export type BackofficeResolvedEntityFacetConfigBase = BackofficeResolvedListFacetConfigBase | BackofficeResolvedPickerFacetConfigBase | BackofficeResolvedDetailLayoutFacetConfigBase | BackofficeResolvedDetailPageFacetConfigBase | BackofficeResolvedToolFacetConfig;
|
|
705
|
+
export type BackofficeResolvedListFacetModule = {
|
|
706
|
+
kind: 'list';
|
|
707
|
+
id: string;
|
|
708
|
+
manifest: BackofficeEntityManifestItem;
|
|
709
|
+
config: BackofficeResolvedListFacetConfigBase;
|
|
710
|
+
};
|
|
711
|
+
export type BackofficeResolvedPickerFacetModule = {
|
|
712
|
+
kind: 'picker';
|
|
713
|
+
id: string;
|
|
714
|
+
manifest: BackofficeEntityManifestItem;
|
|
715
|
+
config: BackofficeResolvedPickerFacetConfigBase;
|
|
716
|
+
};
|
|
717
|
+
export type BackofficeResolvedDetailLayoutFacetModule = {
|
|
718
|
+
kind: 'detail-layout';
|
|
719
|
+
id: string;
|
|
720
|
+
manifest: BackofficeEntityManifestItem;
|
|
721
|
+
config: BackofficeResolvedDetailLayoutFacetConfigBase;
|
|
722
|
+
};
|
|
723
|
+
export type BackofficeResolvedDetailPageFacetModule = {
|
|
724
|
+
kind: 'detail-page';
|
|
725
|
+
id: string;
|
|
726
|
+
pageId: string;
|
|
727
|
+
manifest: BackofficeEntityManifestItem;
|
|
728
|
+
config: BackofficeResolvedDetailPageFacetConfigBase;
|
|
729
|
+
};
|
|
730
|
+
export type BackofficeResolvedToolFacetModule = {
|
|
731
|
+
kind: 'tool';
|
|
732
|
+
id: string;
|
|
733
|
+
manifest: BackofficeEntityManifestItem;
|
|
734
|
+
config: BackofficeResolvedToolFacetConfig;
|
|
735
|
+
};
|
|
736
|
+
export type BackofficeResolvedEntityFacetModule = BackofficeResolvedListFacetModule | BackofficeResolvedPickerFacetModule | BackofficeResolvedDetailLayoutFacetModule | BackofficeResolvedDetailPageFacetModule | BackofficeResolvedToolFacetModule;
|
|
737
|
+
export type BackofficeListFacetConfigBase = BackofficeListFacetConfig<any, any, any, any, any, any, any>;
|
|
738
|
+
export type BackofficePickerFacetConfigBase = BackofficePickerFacetConfig<any, any, any, any, any>;
|
|
739
|
+
export type BackofficeDetailLayoutFacetConfigBase = BackofficeDetailLayoutFacetConfig<any, any, any, any, any>;
|
|
740
|
+
export type BackofficeDetailPageFacetConfigBase = BackofficeDetailPageFacetConfig<any, any, any, any, any, any>;
|
|
741
|
+
export type BackofficeResolvedListFacetConfigBase = BackofficeResolvedListFacetConfig<any, any, any, any, any, any, any>;
|
|
742
|
+
export type BackofficeResolvedPickerFacetConfigBase = BackofficeResolvedPickerFacetConfig<any, any, any, any, any>;
|
|
743
|
+
export type BackofficeResolvedDetailLayoutFacetConfigBase = BackofficeResolvedDetailLayoutFacetConfig<any, any, any, any, any>;
|
|
744
|
+
export type BackofficeResolvedDetailPageFacetConfigBase = BackofficeResolvedDetailPageFacetConfig<any, any, any, any, any, any>;
|
|
745
|
+
export type BackofficeEntityFacetModuleCacheEntry = {
|
|
746
|
+
status: BackofficeEntityModuleStatus;
|
|
747
|
+
promise?: Promise<BackofficeResolvedEntityFacetModule>;
|
|
748
|
+
module?: BackofficeResolvedEntityFacetModule;
|
|
749
|
+
error?: Error;
|
|
750
|
+
};
|
|
751
|
+
export type BackofficeToolScope = {
|
|
752
|
+
initiativeId: string | null;
|
|
753
|
+
projectId: string | null;
|
|
754
|
+
};
|
|
755
|
+
export type BackofficeToolVariablesContext = {
|
|
756
|
+
scope: BackofficeToolScope;
|
|
757
|
+
run: boolean;
|
|
758
|
+
};
|
|
759
|
+
export declare class BackofficeToolValidationError extends Error {
|
|
760
|
+
label: I18nLabel;
|
|
761
|
+
constructor(label: I18nLabel);
|
|
762
|
+
}
|
|
763
|
+
export type BackofficeToolOperation = {
|
|
764
|
+
title: I18nLabel;
|
|
765
|
+
subtitle?: I18nLabel;
|
|
766
|
+
inputTypeSDL?: string;
|
|
767
|
+
query: GraphQLTaggedNode;
|
|
768
|
+
inputs?: readonly BackofficeToolInputSpec[];
|
|
769
|
+
outputs?: readonly BackofficeToolOutputSpec[];
|
|
770
|
+
render?: (data: unknown) => unknown;
|
|
771
|
+
showProjectPicker?: boolean;
|
|
772
|
+
buildVariables?: (input: Record<string, unknown>, context: BackofficeToolVariablesContext) => Record<string, unknown>;
|
|
773
|
+
};
|
|
774
|
+
export type BackofficeToolInputSpec = {
|
|
775
|
+
id: string;
|
|
776
|
+
kind: 'text';
|
|
777
|
+
label: I18nLabel;
|
|
778
|
+
placeholder?: I18nLabel;
|
|
779
|
+
defaultValue?: string;
|
|
780
|
+
} | {
|
|
781
|
+
id: string;
|
|
782
|
+
kind: 'json';
|
|
783
|
+
label: I18nLabel;
|
|
784
|
+
placeholder?: I18nLabel;
|
|
785
|
+
defaultValue?: string;
|
|
786
|
+
} | {
|
|
787
|
+
id: string;
|
|
788
|
+
kind: 'enum';
|
|
789
|
+
label: I18nLabel;
|
|
790
|
+
options: readonly {
|
|
791
|
+
value: string;
|
|
792
|
+
label: I18nLabel;
|
|
793
|
+
}[];
|
|
794
|
+
defaultValue?: string;
|
|
795
|
+
} | {
|
|
796
|
+
id: string;
|
|
797
|
+
kind: 'boolean';
|
|
798
|
+
label: I18nLabel;
|
|
799
|
+
defaultValue?: boolean;
|
|
800
|
+
} | {
|
|
801
|
+
id: string;
|
|
802
|
+
kind: 'entityId';
|
|
803
|
+
label: I18nLabel;
|
|
804
|
+
entity: string;
|
|
805
|
+
defaultValue?: string;
|
|
806
|
+
};
|
|
807
|
+
export type BackofficeToolOutputSpec = {
|
|
808
|
+
kind: 'table';
|
|
809
|
+
label?: I18nLabel;
|
|
810
|
+
description?: I18nLabel;
|
|
811
|
+
columns: readonly BackofficeColumnSpec[];
|
|
812
|
+
rows: (data: unknown) => readonly unknown[];
|
|
813
|
+
} | {
|
|
814
|
+
kind: 'code';
|
|
815
|
+
label?: I18nLabel;
|
|
816
|
+
description?: I18nLabel;
|
|
817
|
+
value: (data: unknown) => string;
|
|
818
|
+
} | {
|
|
819
|
+
kind: 'json';
|
|
820
|
+
label?: I18nLabel;
|
|
821
|
+
description?: I18nLabel;
|
|
822
|
+
value: (data: unknown) => unknown;
|
|
823
|
+
} | {
|
|
824
|
+
kind: 'keyValue';
|
|
825
|
+
label?: I18nLabel;
|
|
826
|
+
description?: I18nLabel;
|
|
827
|
+
items: readonly {
|
|
828
|
+
label: I18nLabel;
|
|
829
|
+
value: (data: unknown) => BackofficeValueLabel;
|
|
830
|
+
}[];
|
|
831
|
+
} | {
|
|
832
|
+
kind: 'payload';
|
|
833
|
+
label: I18nLabel;
|
|
834
|
+
description?: I18nLabel;
|
|
835
|
+
value: (data: unknown) => unknown;
|
|
836
|
+
format?: 'markdown' | 'json' | 'text';
|
|
837
|
+
} | {
|
|
838
|
+
kind: 'custom';
|
|
839
|
+
label?: I18nLabel;
|
|
840
|
+
render: (data: unknown) => unknown;
|
|
841
|
+
};
|
|
842
|
+
export type BackofficeConnection<Row> = {
|
|
843
|
+
edges: readonly {
|
|
844
|
+
node: Row;
|
|
845
|
+
}[];
|
|
846
|
+
totalCount?: number | null;
|
|
847
|
+
};
|
|
848
|
+
export type BackofficeListDefaults<Where, Sort extends string> = {
|
|
849
|
+
where: Where | null;
|
|
850
|
+
sort: Sort | null;
|
|
851
|
+
};
|
|
852
|
+
export type BackofficePreparedListRoute = {
|
|
853
|
+
entityId: string;
|
|
854
|
+
entityManifest: BackofficeEntityManifestItem;
|
|
855
|
+
entityConfig: BackofficeResolvedListFacetConfigBase;
|
|
856
|
+
query: PreloadedQuery<OperationType>;
|
|
857
|
+
};
|
|
858
|
+
export type BackofficePreparedDetailLayoutRoute = {
|
|
859
|
+
entityId: string;
|
|
860
|
+
entityManifest: BackofficeEntityManifestItem;
|
|
861
|
+
entityConfig: BackofficeResolvedDetailLayoutFacetConfigBase;
|
|
862
|
+
layoutQuery: PreloadedQuery<OperationType>;
|
|
863
|
+
id: string;
|
|
864
|
+
};
|
|
865
|
+
export type BackofficePreparedDetailPageRoute = {
|
|
866
|
+
entityId: string;
|
|
867
|
+
entityManifest: BackofficeEntityManifestItem;
|
|
868
|
+
entityConfig: BackofficeResolvedDetailLayoutFacetConfigBase;
|
|
869
|
+
id: string;
|
|
870
|
+
pageId: string;
|
|
871
|
+
pagePath: string;
|
|
872
|
+
pageConfig: BackofficeResolvedDetailPageFacetConfigBase;
|
|
873
|
+
pageQuery: PreloadedQuery<OperationType>;
|
|
874
|
+
detailId?: string;
|
|
875
|
+
};
|
|
876
|
+
export type BackofficePreparedToolRoute = {
|
|
877
|
+
entityId: string;
|
|
878
|
+
entityManifest: BackofficeEntityManifestItem;
|
|
879
|
+
entityConfig: BackofficeResolvedToolFacetConfig;
|
|
880
|
+
};
|
|
881
|
+
export {};
|
|
882
|
+
//# sourceMappingURL=types.d.ts.map
|