@ethisyscore/plugin-ui 1.92.1 → 1.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/components/connectors/index.cjs +676 -11
- package/dist/components/connectors/index.cjs.map +1 -1
- package/dist/components/connectors/index.d.cts +135 -343
- package/dist/components/connectors/index.d.ts +135 -343
- package/dist/components/connectors/index.js +672 -14
- package/dist/components/connectors/index.js.map +1 -1
- package/dist/components/shared/index.cjs +12 -8
- package/dist/components/shared/index.cjs.map +1 -1
- package/dist/components/shared/index.js +13 -9
- package/dist/components/shared/index.js.map +1 -1
- package/dist/components/ui/index.cjs +16 -0
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.cts +69 -3
- package/dist/components/ui/index.d.ts +69 -3
- package/dist/components/ui/index.js +14 -3
- package/dist/components/ui/index.js.map +1 -1
- package/dist/connector-mappings/index.cjs +1061 -0
- package/dist/connector-mappings/index.cjs.map +1 -0
- package/dist/connector-mappings/index.d.cts +1274 -0
- package/dist/connector-mappings/index.d.ts +1274 -0
- package/dist/connector-mappings/index.js +1020 -0
- package/dist/connector-mappings/index.js.map +1 -0
- package/dist/mappingQueryKeys-BcbA0TGy.d.cts +473 -0
- package/dist/mappingQueryKeys-BcbA0TGy.d.ts +473 -0
- package/dist/mcpService-4h3sKDpW.d.cts +35 -0
- package/dist/mcpService-4h3sKDpW.d.ts +35 -0
- package/dist/platform-react/index.d.cts +3 -35
- package/dist/platform-react/index.d.ts +3 -35
- package/package.json +6 -1
|
@@ -1,374 +1,166 @@
|
|
|
1
|
+
import { C as ConnectorCanonicalField } from '../../mappingQueryKeys-BcbA0TGy.cjs';
|
|
2
|
+
export { a as CONNECTOR_CONTROL_LABEL, b as ConnectorCanonicalFieldKind, c as ConnectorMappingSuggestionResult, d as ConnectorMappingTranslationEditorProps, e as ConnectorMappingTranslationEditorView, M as MappingCompletenessBanner, f as MappingCompletenessBannerProps, g as MappingCompletenessItem, h as MappingCompletenessResult, i as MappingReadiness, P as PLUGIN_PROVIDER_CONTROL_LABEL, j as PROVIDER_CONTROL_LABEL, k as PROVIDER_OPTION_LABEL, T as TestToolMappingExtractedField, l as TestToolMappingRequest, m as TestToolMappingResult, n as connectorMappingCompletenessQueryKey, o as connectorMappingsQueryKey, p as connectorMappingsRootQueryKey, q as pluginTargetMappingsQueryKey, s as selectIncompleteOperations, r as selectMappingReadiness, t as selectOptionalIncompleteOperations, u as selectRequiredIncompleteOperations } from '../../mappingQueryKeys-BcbA0TGy.cjs';
|
|
1
3
|
import * as react from 'react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* mapped and still be incomplete, because the tool's schema does not accept a field the operation
|
|
15
|
-
* requires. Copy that says "not mapped" when it means "fields not mapped" sends the operator to
|
|
16
|
-
* auto-match, which maps tools and cannot close a field gap.
|
|
17
|
-
*/
|
|
18
|
-
interface MappingCompletenessItem {
|
|
19
|
-
/** Canonical operation key, e.g. `list-commits`. */
|
|
20
|
-
operationKey: string;
|
|
21
|
-
/** Human label for the operation, as declared by the module's catalogue. */
|
|
22
|
-
label: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the module declares this operation as required. Required gaps block the module from
|
|
25
|
-
* working; optional ones only leave an extra capability switched off.
|
|
26
|
-
*/
|
|
27
|
-
isRequired: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Whether ANY tool is mapped to the operation. False means the operator has not chosen a tool
|
|
30
|
-
* yet; true says nothing about whether the mapping is complete.
|
|
31
|
-
*/
|
|
32
|
-
isToolMapped: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Canonical request fields the operation requires that do not map onto a property the live tool
|
|
35
|
-
* actually accepts. Non-empty means incomplete, whether or not a tool is mapped.
|
|
36
|
-
*/
|
|
37
|
-
unmappedRequiredCanonicalFields: string[];
|
|
38
|
-
}
|
|
39
|
-
/** Response envelope for the completeness read, post-unwrap. */
|
|
40
|
-
interface MappingCompletenessResult {
|
|
41
|
-
operations: MappingCompletenessItem[];
|
|
6
|
+
declare const SOURCE: {
|
|
7
|
+
readonly keyword: "keyword";
|
|
8
|
+
readonly ai: "ai";
|
|
9
|
+
readonly manual: "manual";
|
|
10
|
+
};
|
|
11
|
+
/** The vocabulary of `ToolMapping.Source` values the backend writes. Derived so the two cannot drift. */
|
|
12
|
+
type MappingSourceValue = (typeof SOURCE)[keyof typeof SOURCE];
|
|
13
|
+
/** A connector offered in the picker. */
|
|
14
|
+
interface ConnectorMappingViewConnector {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
42
17
|
}
|
|
43
18
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* value verbatim as the field-kind chip, so an unrecognised kind degrades to a label rather than
|
|
48
|
-
* a blank.
|
|
19
|
+
* What serves the module, as this view spells it. Structurally identical to `MappingTargetKind` in
|
|
20
|
+
* the hooks module, declared here for the reason every shape in this file is: the two barrels share
|
|
21
|
+
* types across the boundary only as type-only imports, and this one is two literals.
|
|
49
22
|
*/
|
|
50
|
-
type
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
interface ConnectorCanonicalField {
|
|
23
|
+
type ConnectorMappingViewProviderKind = "connector" | "plugin";
|
|
24
|
+
/** An installed application offered in the provider picker. */
|
|
25
|
+
interface ConnectorMappingViewPluginProvider {
|
|
26
|
+
extensionId: string;
|
|
56
27
|
name: string;
|
|
57
|
-
kind: ConnectorCanonicalFieldKind;
|
|
58
|
-
isRequired: boolean;
|
|
59
28
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
sampleArgs: Record<string, unknown>;
|
|
68
|
-
/** Current unsaved request-field map (empty inputs stripped; `null` if all blank). */
|
|
29
|
+
/** A tool offered in the per-row picker. */
|
|
30
|
+
interface ConnectorMappingViewTool {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}
|
|
34
|
+
/** The operator-editable translation on one row, as handed to `onEditTranslation`. */
|
|
35
|
+
interface ConnectorMappingViewTranslationState {
|
|
69
36
|
requestFieldMap: Record<string, string> | null;
|
|
70
|
-
/** Current unsaved response-field paths (empty inputs stripped; `null` if all blank). */
|
|
71
37
|
responseFieldPaths: Record<string, string> | null;
|
|
72
|
-
|
|
73
|
-
* Current unsaved static request parameters (blank-key rows dropped; `null` if none). Optional and
|
|
74
|
-
* backward-compatible: it lets the dry-run exercise the DRAFT static params — a consolidated
|
|
75
|
-
* tool's `method` discriminator, say — that the operator typed but has not saved yet. A consumer
|
|
76
|
-
* whose test endpoint does not accept static fields simply ignores it.
|
|
77
|
-
*/
|
|
78
|
-
staticRequestFields?: Record<string, string> | null;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Result of extracting one canonical response field from the tool's raw response. Mirrors the
|
|
82
|
-
* backend `ExtractedFieldResult` DTO.
|
|
83
|
-
*/
|
|
84
|
-
interface TestToolMappingExtractedField {
|
|
85
|
-
canonicalField: string;
|
|
86
|
-
/** Extracted value, or `null` when the path matched nothing. */
|
|
87
|
-
value: string | null;
|
|
88
|
-
/** `true` when the JSON path resolved to a node in the response. */
|
|
89
|
-
present: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* `true` when the extracted value looks like Base64 content (long string, charset
|
|
92
|
-
* `[A-Za-z0-9+/=]`, no whitespace). The editor shows a "prefix with base64:" hint so the operator
|
|
93
|
-
* adjusts the JSON path rather than concluding the mapping is broken.
|
|
94
|
-
*/
|
|
95
|
-
looksBase64: boolean;
|
|
96
|
-
}
|
|
97
|
-
/** Result the consumer's `onTestMapping` callback resolves with, after the dry-run. */
|
|
98
|
-
interface TestToolMappingResult {
|
|
99
|
-
success: boolean;
|
|
100
|
-
/** Error message when `success` is false. */
|
|
101
|
-
error: string | null;
|
|
102
|
-
/**
|
|
103
|
-
* Raw JSON string of the tool's response, shown in a collapsible so the operator can find the
|
|
104
|
-
* right JSON path.
|
|
105
|
-
*/
|
|
106
|
-
rawResponseJson: string | null;
|
|
107
|
-
/** Per-field extraction result. */
|
|
108
|
-
extractedFields: TestToolMappingExtractedField[];
|
|
38
|
+
staticRequestFields: Record<string, string> | null;
|
|
109
39
|
}
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
requestFieldMap
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* Empty object `{}` when the model found no response-side rewrites.
|
|
127
|
-
*/
|
|
128
|
-
responseFieldPaths: Record<string, string>;
|
|
40
|
+
/** One row of the mapping table. */
|
|
41
|
+
interface ConnectorMappingViewRow {
|
|
42
|
+
operationKey: string;
|
|
43
|
+
label: string;
|
|
44
|
+
isRequired: boolean;
|
|
45
|
+
mappedToolName: string | null;
|
|
46
|
+
source: MappingSourceValue | null;
|
|
47
|
+
confidence: number | null;
|
|
48
|
+
/** `null` when no stored row exists yet; the view sends `""` up so the host upserts. */
|
|
49
|
+
rowVersion: string | null;
|
|
50
|
+
requiresReview?: boolean;
|
|
51
|
+
canonicalRequestFields?: ConnectorCanonicalField[] | null;
|
|
52
|
+
canonicalResponseFields?: ConnectorCanonicalField[] | null;
|
|
53
|
+
requestFieldMap?: Record<string, string> | null;
|
|
54
|
+
responseFieldPaths?: Record<string, string> | null;
|
|
55
|
+
staticRequestFields?: Record<string, string> | null;
|
|
129
56
|
}
|
|
130
|
-
|
|
131
|
-
interface
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
operations: MappingCompletenessItem[];
|
|
138
|
-
/**
|
|
139
|
-
* Opt-in AI assist. Invoked with the operation the operator chose to fix. The consumer wires this
|
|
140
|
-
* to the suggest-translation mutation and decides what to do with the result (open the editor
|
|
141
|
-
* seeded with the suggestion, apply it, and so on).
|
|
142
|
-
*/
|
|
143
|
-
onSuggestWithAi: (operation: MappingCompletenessItem) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Opens the manual mapping editor for an operation. The consumer owns the editor surface and
|
|
146
|
-
* routing; the banner only raises intent.
|
|
147
|
-
*/
|
|
148
|
-
onOpenMappingEditor: (operation: MappingCompletenessItem) => void;
|
|
149
|
-
/**
|
|
150
|
-
* Operation key currently awaiting an AI suggestion, or `null`. Drives the per-row spinner and
|
|
151
|
-
* disabled state so a slow suggestion does not lock the whole banner.
|
|
152
|
-
*/
|
|
153
|
-
suggestingOperationKey?: string | null;
|
|
154
|
-
/** Disables the AI assist affordance entirely, e.g. AI not configured for the organisation. */
|
|
155
|
-
disableSuggest?: boolean;
|
|
57
|
+
/** Outcome of the most recent auto-match run, as the banner reads it. */
|
|
58
|
+
interface ConnectorMappingViewBannerState {
|
|
59
|
+
aiAvailable: boolean;
|
|
60
|
+
unmatchedRequiredCount: number;
|
|
61
|
+
matchedByKeyword: number;
|
|
62
|
+
matchedByAi: number;
|
|
63
|
+
conflictReason: string | null;
|
|
156
64
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
* It separates two cases:
|
|
164
|
-
*
|
|
165
|
-
* - **Required** operations with unmapped required fields, a warning the operator must act on
|
|
166
|
-
* because the module cannot run them.
|
|
167
|
-
* - **Optional** operations with unmapped required fields, a calm note. These power extra
|
|
168
|
-
* capabilities that stay off until their fields are mapped, and the connector may legitimately
|
|
169
|
-
* expose no suitable tool, so they must never read as a blocking error.
|
|
170
|
-
*
|
|
171
|
-
* Renders nothing when neither group has gaps.
|
|
172
|
-
*
|
|
173
|
-
* @remarks
|
|
174
|
-
* **The wording is load-bearing, and was wrong in the copy this was promoted from.** Both groups are
|
|
175
|
-
* selected on `unmappedRequiredCanonicalFields`, which is about FIELD mapping. The original optional
|
|
176
|
-
* alert was titled "Optional operations not mapped" and said they "stay off until mapped", which
|
|
177
|
-
* describes TOOL mapping. Auto-match maps tools and cannot close a field gap, so an operator who
|
|
178
|
-
* pressed auto-match saw the count refuse to move and reported the banner as broken. It was
|
|
179
|
-
* accurate; the text was not. Every string here therefore says "fields", and both alerts say plainly
|
|
180
|
-
* that auto-match will not clear them.
|
|
181
|
-
*
|
|
182
|
-
* A row without the "No tool mapped" chip already HAS a tool and needs its fields mapped. That chip
|
|
183
|
-
* is the only thing distinguishing the two states, which is why the prose points at it.
|
|
184
|
-
*/
|
|
185
|
-
declare function MappingCompletenessBanner({ operations, onSuggestWithAi, onOpenMappingEditor, suggestingOperationKey, disableSuggest, }: MappingCompletenessBannerProps): react.JSX.Element | null;
|
|
186
|
-
|
|
187
|
-
interface ConnectorMappingTranslationEditorProps {
|
|
188
|
-
open: boolean;
|
|
65
|
+
interface ConnectorMappingViewProps {
|
|
66
|
+
isLoading: boolean;
|
|
67
|
+
/** Wire key of the mapping module, e.g. `repo-monitoring`. Not rendered; kept for parity. */
|
|
68
|
+
moduleKey: string;
|
|
69
|
+
/** Human-readable module label, used in the header and the empty state. */
|
|
70
|
+
moduleLabel: string;
|
|
189
71
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* Optional because it is derived from a looked-up operation that may not be found: every caller
|
|
193
|
-
* passes `string | undefined`. The contract claimed required while reality was optional, so this
|
|
194
|
-
* states the truth rather than changing any runtime value.
|
|
72
|
+
* When `true` (the default), the view renders its own `<h1>` plus {@link breadcrumbs}. Set it to
|
|
73
|
+
* `false` on a page that already renders a `PageHeader`, or the title appears twice.
|
|
195
74
|
*/
|
|
196
|
-
|
|
75
|
+
withHeader?: boolean;
|
|
197
76
|
/**
|
|
198
|
-
*
|
|
77
|
+
* Breadcrumb trail rendered under the built-in `<h1>`, and only when {@link withHeader} is true.
|
|
199
78
|
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
79
|
+
* A node rather than an import. Breadcrumbs are plugin-specific — they need that plugin's route
|
|
80
|
+
* table and its menu context — and one of the three plugins this was promoted from had deleted
|
|
81
|
+
* the whole header block rather than lift `PageBreadcrumbs` plus its context and router shim for
|
|
82
|
+
* an import that could never execute. Injecting it means a consumer that wants the built-in
|
|
83
|
+
* header can have it without this package taking on a router dependency, and a consumer that
|
|
84
|
+
* does not simply omits both.
|
|
202
85
|
*/
|
|
203
|
-
|
|
86
|
+
breadcrumbs?: ReactNode;
|
|
204
87
|
/**
|
|
205
|
-
*
|
|
88
|
+
* What to render while {@link isLoading}. Defaults to a plain skeleton block.
|
|
206
89
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*/
|
|
210
|
-
canonicalRequestFields?: ConnectorCanonicalField[] | null;
|
|
211
|
-
/** Canonical response fields the editor renders one JSON-path input per. Same nullability. */
|
|
212
|
-
canonicalResponseFields?: ConnectorCanonicalField[] | null;
|
|
213
|
-
/** Currently-persisted request-field translation, or `null` if the operator hasn't supplied one. */
|
|
214
|
-
requestFieldMap: Record<string, string> | null;
|
|
215
|
-
/** Currently-persisted response-field translation, or `null` if the operator hasn't supplied one. */
|
|
216
|
-
responseFieldPaths: Record<string, string> | null;
|
|
217
|
-
/**
|
|
218
|
-
* Currently-persisted static request parameters (tool field name → constant literal value), or
|
|
219
|
-
* `null` if the operator hasn't supplied any. Seeds the "Static request parameters" rows.
|
|
220
|
-
*/
|
|
221
|
-
staticRequestFields: Record<string, string> | null;
|
|
222
|
-
/**
|
|
223
|
-
* Called with the operator's translation dictionaries when they click Save. Empty inputs are
|
|
224
|
-
* stripped before this fires; if every input on a side was blank, that side is delivered as `null`
|
|
225
|
-
* rather than `{}` so the consumer can pass it straight through and the BE writes a NULL column
|
|
226
|
-
* (which the resolver treats as "no operator override" and falls back to the connector's
|
|
227
|
-
* vendor-default translation). A populated dictionary means "rewrite these fields explicitly"; the
|
|
228
|
-
* BE persists it verbatim and the resolver applies it on top of vendor defaults.
|
|
229
|
-
*
|
|
230
|
-
* `staticRequestFields` carries the constant tool-request parameters (e.g. `{ method: "get" }`);
|
|
231
|
-
* same null-vs-populated semantics — `null` when every static row was left blank.
|
|
232
|
-
*/
|
|
233
|
-
onSave: (requestFieldMap: Record<string, string> | null, responseFieldPaths: Record<string, string> | null, staticRequestFields: Record<string, string> | null) => void;
|
|
234
|
-
onCancel: () => void;
|
|
235
|
-
/**
|
|
236
|
-
* Optional. When provided, the editor renders a Test section below the field tables and a "Test
|
|
237
|
-
* mapping" button inside it. The consumer supplies this callback so the editor never owns a
|
|
238
|
-
* network call. Invoked with the sample args and the current (unsaved) field maps — stripped to
|
|
239
|
-
* `null` when every input is blank, matching `onSave`.
|
|
90
|
+
* Injected for the same reason as {@link breadcrumbs}: each plugin has its own page skeleton, and
|
|
91
|
+
* a shared one that did not match would be a visible regression on adoption.
|
|
240
92
|
*/
|
|
241
|
-
|
|
93
|
+
loadingFallback?: ReactNode;
|
|
94
|
+
connectors: ConnectorMappingViewConnector[];
|
|
95
|
+
selectedConnectorId: string;
|
|
96
|
+
onConnectorChange: (connectorId: string) => void;
|
|
242
97
|
/**
|
|
243
|
-
*
|
|
244
|
-
* consumer invokes the AI suggestion endpoint with the sample inputs the Test section collects,
|
|
245
|
-
* then returns the suggested field maps so the editor can populate the request / response inputs.
|
|
246
|
-
* The operator reviews and clicks Save.
|
|
98
|
+
* What currently serves the module, or `undefined` when the operator has made no choice.
|
|
247
99
|
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* and is what `coreconnect/no-hardcoded-colors` exists to stop.</li>
|
|
288
|
-
* <li><b>No emoji in chip labels.</b> The chips already carry an icon and a semantic colour, so
|
|
289
|
-
* the emoji was a third, untranslatable, screen-reader-hostile encoding of the same state.</li>
|
|
290
|
-
* </ol>
|
|
291
|
-
*
|
|
292
|
-
* <p>The null tolerance below came from the HOST copy, which was the most hardened of the four.
|
|
293
|
-
* `coreconnect/no-local-mapping-editor` stops a fifth being written.</p>
|
|
294
|
-
*/
|
|
295
|
-
declare function ConnectorMappingTranslationEditorView({ open, operationLabel, toolName, canonicalRequestFields: canonicalRequestFieldsProp, canonicalResponseFields: canonicalResponseFieldsProp, requestFieldMap, responseFieldPaths, staticRequestFields, onSave, onCancel, onTestMapping, onSuggestTranslation, }: ConnectorMappingTranslationEditorProps): react.JSX.Element;
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Every operation with a gap, required or optional. Use it to decide whether to mount a banner at
|
|
299
|
-
* all, without duplicating the predicate.
|
|
300
|
-
*/
|
|
301
|
-
declare function selectIncompleteOperations(operations: MappingCompletenessItem[]): MappingCompletenessItem[];
|
|
302
|
-
/**
|
|
303
|
-
* REQUIRED operations with a gap. These genuinely block the module: the connector cannot run them.
|
|
304
|
-
*/
|
|
305
|
-
declare function selectRequiredIncompleteOperations(operations: MappingCompletenessItem[]): MappingCompletenessItem[];
|
|
306
|
-
/**
|
|
307
|
-
* OPTIONAL operations with a gap. Informational only: the operation powers an extra capability that
|
|
308
|
-
* stays off until its fields are mapped, and the connector may legitimately expose no suitable tool.
|
|
309
|
-
*
|
|
310
|
-
* @remarks
|
|
311
|
-
* Treat these as a note, never a warning. A connector need not expose every operation a module can
|
|
312
|
-
* use, so a correctly configured connector can sit here indefinitely — and a banner that never
|
|
313
|
-
* clears is a banner operators learn to ignore, which costs you the required warnings too.
|
|
314
|
-
*/
|
|
315
|
-
declare function selectOptionalIncompleteOperations(operations: MappingCompletenessItem[]): MappingCompletenessItem[];
|
|
316
|
-
/** A module's readiness, counted over REQUIRED operations only. */
|
|
317
|
-
interface MappingReadiness {
|
|
318
|
-
/** Required operations that are mapped AND have no field gaps. */
|
|
319
|
-
complete: number;
|
|
320
|
-
/** Total required operations declared by the module's catalogue. */
|
|
321
|
-
total: number;
|
|
322
|
-
/** True when every required operation is mapped and complete. */
|
|
323
|
-
isReady: boolean;
|
|
100
|
+
* `undefined` is a real state and is NOT rendered as "connector". An unconfigured module and a
|
|
101
|
+
* module pointed at a connector with nothing mapped yet look similar and need different actions,
|
|
102
|
+
* and defaulting here is how an operator ends up sent to the wrong control.
|
|
103
|
+
*/
|
|
104
|
+
providerKind?: ConnectorMappingViewProviderKind;
|
|
105
|
+
/** Supplying this is what turns the provider picker on. See the block comment above. */
|
|
106
|
+
onProviderKindChange?: (kind: ConnectorMappingViewProviderKind) => void;
|
|
107
|
+
/** The installed applications on offer. Only read while {@link providerKind} is `"plugin"`. */
|
|
108
|
+
pluginProviders?: ConnectorMappingViewPluginProvider[];
|
|
109
|
+
/** The chosen application, or `""`. */
|
|
110
|
+
selectedPluginExtensionId?: string;
|
|
111
|
+
onPluginProviderChange?: (extensionId: string) => void;
|
|
112
|
+
mappings: ConnectorMappingViewRow[];
|
|
113
|
+
availableTools: ConnectorMappingViewTool[];
|
|
114
|
+
/**
|
|
115
|
+
* Called with `toolName === ""` when the operator clears a row's picker. The consumer routes that
|
|
116
|
+
* to the host's delete tool — see `useConnectorMappingMutations`, which does it — because the
|
|
117
|
+
* set validator rejects an empty tool name.
|
|
118
|
+
*/
|
|
119
|
+
onUpdateMapping: (operationKey: string, toolName: string, rowVersion: string) => void;
|
|
120
|
+
onAutoMatch: () => void;
|
|
121
|
+
isUpdating: boolean;
|
|
122
|
+
isAutoMatching: boolean;
|
|
123
|
+
/** `null` when no outcome banner should render (nothing to say, or the operator dismissed it). */
|
|
124
|
+
bannerState: ConnectorMappingViewBannerState | null;
|
|
125
|
+
onDismissBanner: () => void;
|
|
126
|
+
/**
|
|
127
|
+
* Href of the host's AI-providers settings page. The view owns no routing; the consumer passes
|
|
128
|
+
* the href so the link stays correct across templates and route changes.
|
|
129
|
+
*/
|
|
130
|
+
aiProvidersHref: string;
|
|
131
|
+
/** Href of the selected connector's settings page. Same routing-ownership rule. */
|
|
132
|
+
connectorSettingsHref: string;
|
|
133
|
+
/**
|
|
134
|
+
* Raised by the per-row "Configure field translation" button. Rows with no mapped tool, or with
|
|
135
|
+
* no declared canonical schema, never raise it — the view hides the button for those, because
|
|
136
|
+
* there is nothing operator-meaningful to translate.
|
|
137
|
+
*/
|
|
138
|
+
onEditTranslation: (operationKey: string, current: ConnectorMappingViewTranslationState) => void;
|
|
324
139
|
}
|
|
325
140
|
/**
|
|
326
|
-
*
|
|
141
|
+
* The Tool Mappings table: a connector picker, one row per canonical operation with a tool picker
|
|
142
|
+
* and a source chip, the auto-match control, and the per-row translation affordance.
|
|
327
143
|
*
|
|
328
|
-
*
|
|
329
|
-
* Optional operations are excluded on purpose. Counting them would leave a properly configured
|
|
330
|
-
* connector permanently short of 100%, for operations the operator was never expected to map. This
|
|
331
|
-
* rule came from `ethisyscore-plugin-timesheets`, which had it right while another plugin was
|
|
332
|
-
* reporting optional field gaps in a standing banner.
|
|
333
|
-
*/
|
|
334
|
-
declare function selectMappingReadiness(operations: MappingCompletenessItem[]): MappingReadiness;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* React-query keys for a connector's tool mappings and the completeness read derived from them.
|
|
144
|
+
* ## Promoted, not designed here
|
|
338
145
|
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
146
|
+
* This file existed three times — `sales`, `tech` and `timesheets` — and two of the three were
|
|
147
|
+
* BYTE-IDENTICAL at 329 lines. The third was the same file with the header block deleted and one
|
|
148
|
+
* behaviour difference that was a live defect (see {@link renderBanner}). Nothing about it was
|
|
149
|
+
* plugin-specific except two imports, which are now props: the breadcrumbs and the loading
|
|
150
|
+
* skeleton.
|
|
342
151
|
*
|
|
343
|
-
*
|
|
344
|
-
* that changes a mapping can change it. When the two keys are siblings, a mutation has to remember to
|
|
345
|
-
* invalidate both, and one plugin duly invalidated only the mappings key — so its "operations aren't
|
|
346
|
-
* fully mapped" banner went stale after every save, clear and auto-match, and stayed stale until the
|
|
347
|
-
* operator navigated away. Nesting means a single `invalidateQueries({ queryKey: mappings })` takes
|
|
348
|
-
* the completeness read with it, and there is nothing left to forget.
|
|
152
|
+
* ## What it owns and what it does not
|
|
349
153
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
154
|
+
* Presentational and fully props-driven. It fetches nothing, writes nothing and routes nowhere —
|
|
155
|
+
* `aiProvidersHref` and `connectorSettingsHref` arrive as strings, and clearing a row's picker
|
|
156
|
+
* emits `onUpdateMapping(key, "", rowVersion)` for the consumer to route. Pair it with
|
|
157
|
+
* `useConnectorToolMappings` from `@ethisyscore/plugin-ui/connector-mappings`, whose `view` bundle
|
|
158
|
+
* spreads straight onto these props.
|
|
353
159
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
* // One call. Covers both, and any future query keyed beneath the mappings key.
|
|
358
|
-
* queryClient.invalidateQueries({ queryKey: mappings });
|
|
359
|
-
* ```
|
|
360
|
-
*/
|
|
361
|
-
/**
|
|
362
|
-
* Key for the mappings list of one connector + module.
|
|
363
|
-
*
|
|
364
|
-
* `connectorId` is accepted as possibly-undefined because the page renders before a connector is
|
|
365
|
-
* chosen; pair it with `enabled: !!connectorId` rather than branching on the key.
|
|
366
|
-
*/
|
|
367
|
-
declare function connectorMappingsQueryKey(connectorId: string | undefined, moduleKey: string): readonly ["connector-mappings", string | undefined, string];
|
|
368
|
-
/**
|
|
369
|
-
* Key for the completeness read, nested UNDER {@link connectorMappingsQueryKey} so invalidating the
|
|
370
|
-
* mappings prefix always covers it. Do not flatten this into a sibling key.
|
|
160
|
+
* The translation affordance appears only when a row HAS a mapped tool AND declares both canonical
|
|
161
|
+
* schemas. A row with no schema has nothing to translate, and offering the button anyway opens an
|
|
162
|
+
* editor with no fields in it.
|
|
371
163
|
*/
|
|
372
|
-
declare function
|
|
164
|
+
declare function ConnectorMappingView({ isLoading, moduleLabel, breadcrumbs, loadingFallback, connectors, selectedConnectorId, onConnectorChange, providerKind, onProviderKindChange, pluginProviders, selectedPluginExtensionId, onPluginProviderChange, mappings, availableTools, onUpdateMapping, onAutoMatch, isUpdating, isAutoMatching, bannerState, onDismissBanner, onEditTranslation, withHeader, }: ConnectorMappingViewProps): react.JSX.Element;
|
|
373
165
|
|
|
374
|
-
export {
|
|
166
|
+
export { ConnectorCanonicalField, ConnectorMappingView, type ConnectorMappingViewBannerState, type ConnectorMappingViewConnector, type ConnectorMappingViewPluginProvider, type ConnectorMappingViewProps, type ConnectorMappingViewProviderKind, type ConnectorMappingViewRow, type ConnectorMappingViewTool, type ConnectorMappingViewTranslationState };
|