@ethisyscore/plugin-ui 1.76.0 → 1.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/connectors/index.cjs +1087 -13
- package/dist/components/connectors/index.cjs.map +1 -1
- package/dist/components/connectors/index.d.cts +198 -1
- package/dist/components/connectors/index.d.ts +198 -1
- package/dist/components/connectors/index.js +1088 -15
- package/dist/components/connectors/index.js.map +1 -1
- package/dist/components/ui/index.cjs +4 -0
- package/dist/components/ui/index.d.cts +66 -1
- package/dist/components/ui/index.d.ts +66 -1
- package/dist/components/ui/index.js +1 -1
- package/package.json +1 -1
|
@@ -40,6 +40,93 @@ interface MappingCompletenessItem {
|
|
|
40
40
|
interface MappingCompletenessResult {
|
|
41
41
|
operations: MappingCompletenessItem[];
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Type discriminator for a canonical field. Mirrors the backend `CanonicalFieldKind` enum.
|
|
45
|
+
*
|
|
46
|
+
* Wire format is the enum member name (e.g. `"String"`, `"StringArray"`); the editor renders the
|
|
47
|
+
* value verbatim as the field-kind chip, so an unrecognised kind degrades to a label rather than
|
|
48
|
+
* a blank.
|
|
49
|
+
*/
|
|
50
|
+
type ConnectorCanonicalFieldKind = "String" | "Integer" | "Boolean" | "DateTime" | "Object" | "StringArray";
|
|
51
|
+
/**
|
|
52
|
+
* A single canonical field on an operation's request or response schema. Carried on the mapping row
|
|
53
|
+
* so the editor can render an input per field without a separate schema fetch.
|
|
54
|
+
*/
|
|
55
|
+
interface ConnectorCanonicalField {
|
|
56
|
+
name: string;
|
|
57
|
+
kind: ConnectorCanonicalFieldKind;
|
|
58
|
+
isRequired: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Arguments the editor hands to the consumer-supplied `onTestMapping` callback. The consumer builds
|
|
62
|
+
* the full service request from these plus its own `connectorId` / `operationKey` / `toolName` — the
|
|
63
|
+
* editor owns no network call.
|
|
64
|
+
*/
|
|
65
|
+
interface TestToolMappingRequest {
|
|
66
|
+
/** Sample values the operator typed — one entry per canonical request field. */
|
|
67
|
+
sampleArgs: Record<string, unknown>;
|
|
68
|
+
/** Current unsaved request-field map (empty inputs stripped; `null` if all blank). */
|
|
69
|
+
requestFieldMap: Record<string, string> | null;
|
|
70
|
+
/** Current unsaved response-field paths (empty inputs stripped; `null` if all blank). */
|
|
71
|
+
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[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Result the consumer's `onSuggestTranslation` callback resolves with. When `success` is true, the
|
|
112
|
+
* editor merges the two dictionaries over its current inputs so the operator can review the
|
|
113
|
+
* AI proposal before saving.
|
|
114
|
+
*/
|
|
115
|
+
interface ConnectorMappingSuggestionResult {
|
|
116
|
+
success: boolean;
|
|
117
|
+
/** Error message when `success` is false. `null` when `success` is true. */
|
|
118
|
+
error: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* Proposed canonical-request → tool-field-name rewrite. Empty object `{}` when the model found no
|
|
121
|
+
* request-side rewrites to apply.
|
|
122
|
+
*/
|
|
123
|
+
requestFieldMap: Record<string, string>;
|
|
124
|
+
/**
|
|
125
|
+
* Proposed canonical-response → JSON-path rewrite (e.g. `{ "content": "base64:$.content" }`).
|
|
126
|
+
* Empty object `{}` when the model found no response-side rewrites.
|
|
127
|
+
*/
|
|
128
|
+
responseFieldPaths: Record<string, string>;
|
|
129
|
+
}
|
|
43
130
|
|
|
44
131
|
interface MappingCompletenessBannerProps {
|
|
45
132
|
/**
|
|
@@ -97,6 +184,116 @@ interface MappingCompletenessBannerProps {
|
|
|
97
184
|
*/
|
|
98
185
|
declare function MappingCompletenessBanner({ operations, onSuggestWithAi, onOpenMappingEditor, suggestingOperationKey, disableSuggest, }: MappingCompletenessBannerProps): react.JSX.Element | null;
|
|
99
186
|
|
|
187
|
+
interface ConnectorMappingTranslationEditorProps {
|
|
188
|
+
open: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Human-readable operation label for the dialog title (e.g. "Get File").
|
|
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.
|
|
195
|
+
*/
|
|
196
|
+
operationLabel?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Tool name the mapping currently points at — shown in the dialog header for context.
|
|
199
|
+
*
|
|
200
|
+
* Optional and nullable because the editor opens for an operation that may not be mapped yet:
|
|
201
|
+
* every caller passes `string | null | undefined`.
|
|
202
|
+
*/
|
|
203
|
+
toolName?: string | null;
|
|
204
|
+
/**
|
|
205
|
+
* Canonical request fields the editor renders one input per.
|
|
206
|
+
*
|
|
207
|
+
* Optional and nullable: an operation may declare no canonical schema, and the editor already
|
|
208
|
+
* gates on their presence. See the coalescing note in the component body — this is not cosmetic.
|
|
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`.
|
|
240
|
+
*/
|
|
241
|
+
onTestMapping?: (request: TestToolMappingRequest) => Promise<TestToolMappingResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Optional. When provided, the editor renders an "Auto-configure" button in the Test section. The
|
|
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.
|
|
247
|
+
*
|
|
248
|
+
* @param sampleArgs - Sample values the operator typed, one entry per canonical request field.
|
|
249
|
+
* @returns The suggestion result (success/error + proposed maps).
|
|
250
|
+
*/
|
|
251
|
+
onSuggestTranslation?: (sampleArgs: Record<string, unknown>) => Promise<ConnectorMappingSuggestionResult>;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Per-mapping translation editor — surfaced when the operator picks a tool whose schema doesn't
|
|
255
|
+
* match the operation's canonical request/response field names. Renders two stacked tables
|
|
256
|
+
* (request / response): left column shows the canonical field's name + kind chip + required
|
|
257
|
+
* indicator; right column captures the operator-supplied tool field name (request side) or JSON
|
|
258
|
+
* path (response side).
|
|
259
|
+
*
|
|
260
|
+
* <p><b>Identity semantics.</b> An empty input on a field means "identity — pass the canonical name
|
|
261
|
+
* through unchanged". On Save the editor strips empty values; if every input on a side was blank,
|
|
262
|
+
* that side is delivered to `onSave` as <code>null</code> (not <code>{}</code>) so the BE writes a
|
|
263
|
+
* NULL column. The resolver then treats the NULL as "no operator override" and falls back to the
|
|
264
|
+
* connector's vendor-default translation; a populated dictionary means "rewrite these fields
|
|
265
|
+
* explicitly" and applies on top of the vendor default.</p>
|
|
266
|
+
*
|
|
267
|
+
* <p><b>State seeding.</b> The consumer page mounts/unmounts this dialog every time the editor opens
|
|
268
|
+
* (the `open` prop is always `true` in practice — the parent gates rendering via conditional mount),
|
|
269
|
+
* so local state initialises lazily from the props on each mount. This avoids the "setState in
|
|
270
|
+
* useEffect" pattern the eslint react-hooks ruleset blocks, AND keeps the operator's in-flight edits
|
|
271
|
+
* sovereign once the dialog is open — a concurrent refresh of the mapping row doesn't clobber what
|
|
272
|
+
* they're typing.</p>
|
|
273
|
+
*
|
|
274
|
+
* <p><b>Promoted, not designed here.</b> This file existed FOUR times — the host's gogo-ui adapter
|
|
275
|
+
* plus `self-healing`, `tech` and `timesheets` — and the copies had already drifted. Three
|
|
276
|
+
* differences were adjudicated on the way in, and each is a reason the duplication was expensive:</p>
|
|
277
|
+
*
|
|
278
|
+
* <ol>
|
|
279
|
+
* <li><b>The Test button is gated on `onTestMapping`.</b> The enclosing block is gated on
|
|
280
|
+
* <code>(onTestMapping || onSuggestTranslation)</code>, so without the inner guard a consumer
|
|
281
|
+
* supplying only <code>onSuggestTranslation</code> rendered a "Test mapping" button whose
|
|
282
|
+
* handler returns immediately — a DEAD CONTROL. `self-healing` shipped that; `tech` and
|
|
283
|
+
* `timesheets` had fixed it. Nothing noticed, because there was no single source to notice
|
|
284
|
+
* it against.</li>
|
|
285
|
+
* <li><b>Backgrounds come from the theme (`action.hover`), never a hardcoded
|
|
286
|
+
* <code>rgba()</code>.</b> A literal <code>rgba(0,0,0,0.03)</code> is invisible in dark mode
|
|
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
|
+
|
|
100
297
|
/**
|
|
101
298
|
* Every operation with a gap, required or optional. Use it to decide whether to mount a banner at
|
|
102
299
|
* all, without duplicating the predicate.
|
|
@@ -174,4 +371,4 @@ declare function connectorMappingsQueryKey(connectorId: string | undefined, modu
|
|
|
174
371
|
*/
|
|
175
372
|
declare function connectorMappingCompletenessQueryKey(connectorId: string | undefined, moduleKey: string): readonly ["connector-mappings", string | undefined, string, "completeness"];
|
|
176
373
|
|
|
177
|
-
export { MappingCompletenessBanner, type MappingCompletenessBannerProps, type MappingCompletenessItem, type MappingCompletenessResult, type MappingReadiness, connectorMappingCompletenessQueryKey, connectorMappingsQueryKey, selectIncompleteOperations, selectMappingReadiness, selectOptionalIncompleteOperations, selectRequiredIncompleteOperations };
|
|
374
|
+
export { type ConnectorCanonicalField, type ConnectorCanonicalFieldKind, type ConnectorMappingSuggestionResult, type ConnectorMappingTranslationEditorProps, ConnectorMappingTranslationEditorView, MappingCompletenessBanner, type MappingCompletenessBannerProps, type MappingCompletenessItem, type MappingCompletenessResult, type MappingReadiness, type TestToolMappingExtractedField, type TestToolMappingRequest, type TestToolMappingResult, connectorMappingCompletenessQueryKey, connectorMappingsQueryKey, selectIncompleteOperations, selectMappingReadiness, selectOptionalIncompleteOperations, selectRequiredIncompleteOperations };
|
|
@@ -40,6 +40,93 @@ interface MappingCompletenessItem {
|
|
|
40
40
|
interface MappingCompletenessResult {
|
|
41
41
|
operations: MappingCompletenessItem[];
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Type discriminator for a canonical field. Mirrors the backend `CanonicalFieldKind` enum.
|
|
45
|
+
*
|
|
46
|
+
* Wire format is the enum member name (e.g. `"String"`, `"StringArray"`); the editor renders the
|
|
47
|
+
* value verbatim as the field-kind chip, so an unrecognised kind degrades to a label rather than
|
|
48
|
+
* a blank.
|
|
49
|
+
*/
|
|
50
|
+
type ConnectorCanonicalFieldKind = "String" | "Integer" | "Boolean" | "DateTime" | "Object" | "StringArray";
|
|
51
|
+
/**
|
|
52
|
+
* A single canonical field on an operation's request or response schema. Carried on the mapping row
|
|
53
|
+
* so the editor can render an input per field without a separate schema fetch.
|
|
54
|
+
*/
|
|
55
|
+
interface ConnectorCanonicalField {
|
|
56
|
+
name: string;
|
|
57
|
+
kind: ConnectorCanonicalFieldKind;
|
|
58
|
+
isRequired: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Arguments the editor hands to the consumer-supplied `onTestMapping` callback. The consumer builds
|
|
62
|
+
* the full service request from these plus its own `connectorId` / `operationKey` / `toolName` — the
|
|
63
|
+
* editor owns no network call.
|
|
64
|
+
*/
|
|
65
|
+
interface TestToolMappingRequest {
|
|
66
|
+
/** Sample values the operator typed — one entry per canonical request field. */
|
|
67
|
+
sampleArgs: Record<string, unknown>;
|
|
68
|
+
/** Current unsaved request-field map (empty inputs stripped; `null` if all blank). */
|
|
69
|
+
requestFieldMap: Record<string, string> | null;
|
|
70
|
+
/** Current unsaved response-field paths (empty inputs stripped; `null` if all blank). */
|
|
71
|
+
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[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Result the consumer's `onSuggestTranslation` callback resolves with. When `success` is true, the
|
|
112
|
+
* editor merges the two dictionaries over its current inputs so the operator can review the
|
|
113
|
+
* AI proposal before saving.
|
|
114
|
+
*/
|
|
115
|
+
interface ConnectorMappingSuggestionResult {
|
|
116
|
+
success: boolean;
|
|
117
|
+
/** Error message when `success` is false. `null` when `success` is true. */
|
|
118
|
+
error: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* Proposed canonical-request → tool-field-name rewrite. Empty object `{}` when the model found no
|
|
121
|
+
* request-side rewrites to apply.
|
|
122
|
+
*/
|
|
123
|
+
requestFieldMap: Record<string, string>;
|
|
124
|
+
/**
|
|
125
|
+
* Proposed canonical-response → JSON-path rewrite (e.g. `{ "content": "base64:$.content" }`).
|
|
126
|
+
* Empty object `{}` when the model found no response-side rewrites.
|
|
127
|
+
*/
|
|
128
|
+
responseFieldPaths: Record<string, string>;
|
|
129
|
+
}
|
|
43
130
|
|
|
44
131
|
interface MappingCompletenessBannerProps {
|
|
45
132
|
/**
|
|
@@ -97,6 +184,116 @@ interface MappingCompletenessBannerProps {
|
|
|
97
184
|
*/
|
|
98
185
|
declare function MappingCompletenessBanner({ operations, onSuggestWithAi, onOpenMappingEditor, suggestingOperationKey, disableSuggest, }: MappingCompletenessBannerProps): react.JSX.Element | null;
|
|
99
186
|
|
|
187
|
+
interface ConnectorMappingTranslationEditorProps {
|
|
188
|
+
open: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Human-readable operation label for the dialog title (e.g. "Get File").
|
|
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.
|
|
195
|
+
*/
|
|
196
|
+
operationLabel?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Tool name the mapping currently points at — shown in the dialog header for context.
|
|
199
|
+
*
|
|
200
|
+
* Optional and nullable because the editor opens for an operation that may not be mapped yet:
|
|
201
|
+
* every caller passes `string | null | undefined`.
|
|
202
|
+
*/
|
|
203
|
+
toolName?: string | null;
|
|
204
|
+
/**
|
|
205
|
+
* Canonical request fields the editor renders one input per.
|
|
206
|
+
*
|
|
207
|
+
* Optional and nullable: an operation may declare no canonical schema, and the editor already
|
|
208
|
+
* gates on their presence. See the coalescing note in the component body — this is not cosmetic.
|
|
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`.
|
|
240
|
+
*/
|
|
241
|
+
onTestMapping?: (request: TestToolMappingRequest) => Promise<TestToolMappingResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Optional. When provided, the editor renders an "Auto-configure" button in the Test section. The
|
|
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.
|
|
247
|
+
*
|
|
248
|
+
* @param sampleArgs - Sample values the operator typed, one entry per canonical request field.
|
|
249
|
+
* @returns The suggestion result (success/error + proposed maps).
|
|
250
|
+
*/
|
|
251
|
+
onSuggestTranslation?: (sampleArgs: Record<string, unknown>) => Promise<ConnectorMappingSuggestionResult>;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Per-mapping translation editor — surfaced when the operator picks a tool whose schema doesn't
|
|
255
|
+
* match the operation's canonical request/response field names. Renders two stacked tables
|
|
256
|
+
* (request / response): left column shows the canonical field's name + kind chip + required
|
|
257
|
+
* indicator; right column captures the operator-supplied tool field name (request side) or JSON
|
|
258
|
+
* path (response side).
|
|
259
|
+
*
|
|
260
|
+
* <p><b>Identity semantics.</b> An empty input on a field means "identity — pass the canonical name
|
|
261
|
+
* through unchanged". On Save the editor strips empty values; if every input on a side was blank,
|
|
262
|
+
* that side is delivered to `onSave` as <code>null</code> (not <code>{}</code>) so the BE writes a
|
|
263
|
+
* NULL column. The resolver then treats the NULL as "no operator override" and falls back to the
|
|
264
|
+
* connector's vendor-default translation; a populated dictionary means "rewrite these fields
|
|
265
|
+
* explicitly" and applies on top of the vendor default.</p>
|
|
266
|
+
*
|
|
267
|
+
* <p><b>State seeding.</b> The consumer page mounts/unmounts this dialog every time the editor opens
|
|
268
|
+
* (the `open` prop is always `true` in practice — the parent gates rendering via conditional mount),
|
|
269
|
+
* so local state initialises lazily from the props on each mount. This avoids the "setState in
|
|
270
|
+
* useEffect" pattern the eslint react-hooks ruleset blocks, AND keeps the operator's in-flight edits
|
|
271
|
+
* sovereign once the dialog is open — a concurrent refresh of the mapping row doesn't clobber what
|
|
272
|
+
* they're typing.</p>
|
|
273
|
+
*
|
|
274
|
+
* <p><b>Promoted, not designed here.</b> This file existed FOUR times — the host's gogo-ui adapter
|
|
275
|
+
* plus `self-healing`, `tech` and `timesheets` — and the copies had already drifted. Three
|
|
276
|
+
* differences were adjudicated on the way in, and each is a reason the duplication was expensive:</p>
|
|
277
|
+
*
|
|
278
|
+
* <ol>
|
|
279
|
+
* <li><b>The Test button is gated on `onTestMapping`.</b> The enclosing block is gated on
|
|
280
|
+
* <code>(onTestMapping || onSuggestTranslation)</code>, so without the inner guard a consumer
|
|
281
|
+
* supplying only <code>onSuggestTranslation</code> rendered a "Test mapping" button whose
|
|
282
|
+
* handler returns immediately — a DEAD CONTROL. `self-healing` shipped that; `tech` and
|
|
283
|
+
* `timesheets` had fixed it. Nothing noticed, because there was no single source to notice
|
|
284
|
+
* it against.</li>
|
|
285
|
+
* <li><b>Backgrounds come from the theme (`action.hover`), never a hardcoded
|
|
286
|
+
* <code>rgba()</code>.</b> A literal <code>rgba(0,0,0,0.03)</code> is invisible in dark mode
|
|
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
|
+
|
|
100
297
|
/**
|
|
101
298
|
* Every operation with a gap, required or optional. Use it to decide whether to mount a banner at
|
|
102
299
|
* all, without duplicating the predicate.
|
|
@@ -174,4 +371,4 @@ declare function connectorMappingsQueryKey(connectorId: string | undefined, modu
|
|
|
174
371
|
*/
|
|
175
372
|
declare function connectorMappingCompletenessQueryKey(connectorId: string | undefined, moduleKey: string): readonly ["connector-mappings", string | undefined, string, "completeness"];
|
|
176
373
|
|
|
177
|
-
export { MappingCompletenessBanner, type MappingCompletenessBannerProps, type MappingCompletenessItem, type MappingCompletenessResult, type MappingReadiness, connectorMappingCompletenessQueryKey, connectorMappingsQueryKey, selectIncompleteOperations, selectMappingReadiness, selectOptionalIncompleteOperations, selectRequiredIncompleteOperations };
|
|
374
|
+
export { type ConnectorCanonicalField, type ConnectorCanonicalFieldKind, type ConnectorMappingSuggestionResult, type ConnectorMappingTranslationEditorProps, ConnectorMappingTranslationEditorView, MappingCompletenessBanner, type MappingCompletenessBannerProps, type MappingCompletenessItem, type MappingCompletenessResult, type MappingReadiness, type TestToolMappingExtractedField, type TestToolMappingRequest, type TestToolMappingResult, connectorMappingCompletenessQueryKey, connectorMappingsQueryKey, selectIncompleteOperations, selectMappingReadiness, selectOptionalIncompleteOperations, selectRequiredIncompleteOperations };
|