@knime/product-features 6.1.1 → 6.2.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/CHANGELOG.md +16 -0
- package/README.md +13 -12
- package/dist/dataTransfer.js +1 -1
- package/dist/embedding.js +74 -0
- package/dist/embedding.js.map +1 -0
- package/dist/{rfcErrors-C59cEDGj.js → rfcErrors-CNWg8BiD.js} +13 -3
- package/dist/{rfcErrors-C59cEDGj.js.map → rfcErrors-CNWg8BiD.js.map} +1 -1
- package/dist/rfcErrors.js +2 -2
- package/dist/src/embedding/capabilities.d.ts +40 -0
- package/dist/src/embedding/capabilities.d.ts.map +1 -0
- package/dist/src/embedding/index.d.ts +6 -0
- package/dist/src/embedding/index.d.ts.map +1 -0
- package/dist/src/embedding/outlets/index.d.ts +23 -0
- package/dist/src/embedding/outlets/index.d.ts.map +1 -0
- package/dist/src/embedding/outlets/spaceExplorer.d.ts +74 -0
- package/dist/src/embedding/outlets/spaceExplorer.d.ts.map +1 -0
- package/dist/src/embedding/toasts.d.ts +14 -0
- package/dist/src/embedding/toasts.d.ts.map +1 -0
- package/dist/src/embedding/types.d.ts +131 -0
- package/dist/src/embedding/types.d.ts.map +1 -0
- package/dist/src/rfcErrors/index.d.ts +10 -0
- package/dist/src/rfcErrors/index.d.ts.map +1 -1
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @knime/product-features
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 96e525c: `embedding`: Add a new package that establishes the contract for embedding the workflow editor in a shadow root. This package also owns the declaration of features that are injected into the embedded application over the embedding boundary. For more information, refer to the README of the `embedding` package
|
|
8
|
+
|
|
9
|
+
`rfcErrors`: `toToast` keeps the error data in `meta.rfcError` (`RFC_ERROR_TOAST_META_KEY`), so the toast can be rebuilt where its component cannot be rendered.
|
|
10
|
+
|
|
11
|
+
## 6.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [d61ae48]
|
|
16
|
+
- @knime/kds-components@13.0.0
|
|
17
|
+
- @knime/kds-styles@13.0.0
|
|
18
|
+
|
|
3
19
|
## 6.1.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -23,18 +23,19 @@ Peer dependencies: `@knime/kds-components`, `@knime/kds-styles`, `@vueuse/core`,
|
|
|
23
23
|
This package has **no root export** — import from one of the subpath entry
|
|
24
24
|
points, so consumers only pull in the feature area they use:
|
|
25
25
|
|
|
26
|
-
| Entry point | Source | Contents
|
|
27
|
-
| -------------------------------------------- | -------------------------- |
|
|
28
|
-
| `@knime/product-features/ai` | `src/ai` | AI assistant building blocks (`KdsPromptInput`)
|
|
29
|
-
| `@knime/product-features/analytics` | `src/analytics` | Typed analytics event builders ([README](src/analytics/README.md))
|
|
30
|
-
| `@knime/product-features/auth-utils` | `src/authUtils` | KNIME Hub auth refresher and auth state ([README](src/authUtils/README.md))
|
|
31
|
-
| `@knime/product-features/data-transfer` | `src/dataTransfer` | File upload/download progress panels and composables
|
|
32
|
-
| `@knime/product-features/data-transfer/core` | `src/dataTransfer/core.ts` | Framework-agnostic upload managers and upload client
|
|
33
|
-
| `@knime/product-features/embedding
|
|
34
|
-
| `@knime/product-features/
|
|
35
|
-
| `@knime/product-features/
|
|
36
|
-
| `@knime/product-features/
|
|
37
|
-
| `@knime/product-features/
|
|
26
|
+
| Entry point | Source | Contents |
|
|
27
|
+
| -------------------------------------------- | -------------------------- | -------------------------------------------------------------------------------------- |
|
|
28
|
+
| `@knime/product-features/ai` | `src/ai` | AI assistant building blocks (`KdsPromptInput`) |
|
|
29
|
+
| `@knime/product-features/analytics` | `src/analytics` | Typed analytics event builders ([README](src/analytics/README.md)) |
|
|
30
|
+
| `@knime/product-features/auth-utils` | `src/authUtils` | KNIME Hub auth refresher and auth state ([README](src/authUtils/README.md)) |
|
|
31
|
+
| `@knime/product-features/data-transfer` | `src/dataTransfer` | File upload/download progress panels and composables |
|
|
32
|
+
| `@knime/product-features/data-transfer/core` | `src/dataTransfer/core.ts` | Framework-agnostic upload managers and upload client |
|
|
33
|
+
| `@knime/product-features/embedding` | `src/embedding` | Contract for embedding the editor in a shadow root ([README](src/embedding/README.md)) |
|
|
34
|
+
| `@knime/product-features/embedding-sdk` | `src/embeddingSDK` | Host/guest messaging for embedding an application in an iframe |
|
|
35
|
+
| `@knime/product-features/nodes` | `src/nodes` | Node description tabs and node preview |
|
|
36
|
+
| `@knime/product-features/rfc-errors` | `src/rfcErrors` | RFC 9457 problem-details error handling and error toasts |
|
|
37
|
+
| `@knime/product-features/toasts` | `src/toasts` | Toast notifications |
|
|
38
|
+
| `@knime/product-features/versions` | `src/versions` | Version history and create-version form |
|
|
38
39
|
|
|
39
40
|
```ts
|
|
40
41
|
// ✅ import from a subpath
|
package/dist/dataTransfer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
|
|
2
2
|
import { a as getFileExtension, c as promise_exports, l as sleep, r as formatFileSize, s as knimeFileFormats } from "./dist-htLRPkoq.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as rfcErrors } from "./rfcErrors-CNWg8BiD.js";
|
|
4
4
|
import { a as createUploadManager, c as API_BASE_URL, n as createUploadClient, o as createHttpClient, s as defaultConfig, t as createUploadStatusPoller } from "./core-CIwP11Fc.js";
|
|
5
5
|
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, vShow, watch, withCtx, withDirectives } from "vue";
|
|
6
6
|
import { KdsBadge, KdsButton, KdsIcon, KdsLoadingSkeleton, KdsProgressBar, vKdsTooltip } from "@knime/kds-components";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { n as rfcErrors, t as RFC_ERROR_TOAST_META_KEY } from "./rfcErrors-CNWg8BiD.js";
|
|
2
|
+
//#region src/embedding/outlets/spaceExplorer.ts
|
|
3
|
+
/**
|
|
4
|
+
* Keep only the capabilities that this contract version knows.
|
|
5
|
+
*/
|
|
6
|
+
var resolveSpaceExplorerGuestCapabilities = (declared) => ({ ...declared.itemDrop && { itemDrop: true } });
|
|
7
|
+
var resolveSpaceExplorerHostCapabilities = (declared) => ({ ...declared.revealItem && { revealItem: true } });
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/embedding/outlets/index.ts
|
|
10
|
+
var outletCapabilityResolvers = { spaceExplorer: {
|
|
11
|
+
guest: resolveSpaceExplorerGuestCapabilities,
|
|
12
|
+
host: resolveSpaceExplorerHostCapabilities
|
|
13
|
+
} };
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/embedding/capabilities.ts
|
|
16
|
+
/**
|
|
17
|
+
* Version of `@knime/product-features` that this build uses. Informational
|
|
18
|
+
* only: logs, support, deprecation tracking. It never gates behavior.
|
|
19
|
+
*/
|
|
20
|
+
var contractVersion = "6.2.0";
|
|
21
|
+
/**
|
|
22
|
+
* Outlets that both sides declare. Capabilities that this contract version does not know are
|
|
23
|
+
* dropped.
|
|
24
|
+
*/
|
|
25
|
+
var resolveOutlets = (guest, host) => {
|
|
26
|
+
const resolved = {};
|
|
27
|
+
for (const [name, resolvers] of Object.entries(outletCapabilityResolvers)) {
|
|
28
|
+
const guestDeclared = guest.outlets?.[name];
|
|
29
|
+
const hostDeclared = host.outlets?.[name];
|
|
30
|
+
if (guestDeclared && hostDeclared) resolved[name] = {
|
|
31
|
+
guest: resolvers.guest(guestDeclared),
|
|
32
|
+
host: resolvers.host(hostDeclared)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return resolved;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/embedding/toasts.ts
|
|
39
|
+
/**
|
|
40
|
+
* Guest: turns a toast into data the host can render. An RFC error toast
|
|
41
|
+
* keeps its error data. Any other component is dropped, because the host
|
|
42
|
+
* cannot render a component from the guest's Vue runtime.
|
|
43
|
+
*/
|
|
44
|
+
var toHostToast = (toast) => {
|
|
45
|
+
const { component, meta, ...rest } = toast;
|
|
46
|
+
const rfcError = meta?.[RFC_ERROR_TOAST_META_KEY];
|
|
47
|
+
if (component && !rfcError) consola.warn("Embedding: dropped the component of a toast", toast);
|
|
48
|
+
return {
|
|
49
|
+
...rest,
|
|
50
|
+
...meta && { meta },
|
|
51
|
+
...rfcError && { rfcError }
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Host: turns a toast from the guest into a toast for its own
|
|
56
|
+
* toast service context.
|
|
57
|
+
*/
|
|
58
|
+
var fromHostToast = (hostToast) => {
|
|
59
|
+
const { rfcError, ...toast } = hostToast;
|
|
60
|
+
if (!rfcError) return toast;
|
|
61
|
+
return {
|
|
62
|
+
...toast,
|
|
63
|
+
...rfcErrors.toToast({
|
|
64
|
+
headline: toast.headline ?? "",
|
|
65
|
+
rfcError: new rfcErrors.RFCError(rfcError.data),
|
|
66
|
+
canCopyToClipboard: rfcError.canCopyToClipboard,
|
|
67
|
+
serializeErrorForClipboard: rfcError.serializeErrorForClipboard
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { contractVersion, fromHostToast, resolveOutlets, toHostToast };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=embedding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding.js","names":[],"sources":["../src/embedding/outlets/spaceExplorer.ts","../src/embedding/outlets/index.ts","../src/embedding/capabilities.ts","../src/embedding/toasts.ts"],"sourcesContent":["/**\n * An item that the space explorer drags onto the canvas.\n */\nexport type SpaceExplorerDragItem = {\n spaceId: string;\n itemId: string;\n name: string;\n type: string;\n};\n\n/**\n * Drags items from the space explorer onto the another container. This allows custom control\n * over rendering a drag preview and also running custom logic when an item is dropped onto another\n * container.\n */\nexport type SpaceExplorerItemDrop = {\n start: (item: SpaceExplorerDragItem) => void;\n /**\n * When `accepts` is true, the space explorer hides its own drag ghost.\n */\n move: (clientX: number, clientY: number) => { accepts: boolean };\n /**\n * Resolves to whether the guest added the item.\n */\n end: (clientX: number, clientY: number) => Promise<boolean>;\n cancel: () => void;\n};\n\n/**\n * Announced by the guest when the element the outlet will render to exists.\n */\nexport type SpaceExplorerOutletHandle = {\n name: \"spaceExplorer\";\n /**\n * A stable, empty element. Must not be patched/removed by the guest\n */\n element: HTMLElement;\n /**\n * Present when both sides declare `itemDrop`.\n */\n itemDrop?: SpaceExplorerItemDrop;\n};\n\n/**\n * The space explorer's public api. Returned after `announce`ing the feature.\n */\nexport type SpaceExplorerFeatureAPI = {\n /**\n * Shows the item: its parent folder, with the item selected. Present when\n * the host declares `revealItem`.\n */\n revealItem?: (item: { spaceId: string; itemId: string }) => void;\n};\n\n/**\n * Capabilities the space explorer expects the guest to implement\n */\nexport type SpaceExplorerGuestCapabilities = {\n itemDrop?: true;\n};\n\n/**\n * Capabilities the space explorer of the host offers to the guest for public/direct usage\n * (all behavior is normally self-contained).\n */\nexport type SpaceExplorerHostCapabilities = {\n revealItem?: true;\n};\n\n/**\n * Keep only the capabilities that this contract version knows.\n */\nexport const resolveSpaceExplorerGuestCapabilities = (\n declared: SpaceExplorerGuestCapabilities,\n): SpaceExplorerGuestCapabilities => ({\n ...(declared.itemDrop && { itemDrop: true }),\n});\n\nexport const resolveSpaceExplorerHostCapabilities = (\n declared: SpaceExplorerHostCapabilities,\n): SpaceExplorerHostCapabilities => ({\n ...(declared.revealItem && { revealItem: true }),\n});\n","import {\n type SpaceExplorerFeatureAPI,\n type SpaceExplorerGuestCapabilities,\n type SpaceExplorerHostCapabilities,\n type SpaceExplorerOutletHandle,\n resolveSpaceExplorerGuestCapabilities,\n resolveSpaceExplorerHostCapabilities,\n} from \"./spaceExplorer\";\n\n/**\n * Outlets the guest can expose (the editor in this case). Each outlet contains one feature of the host.\n */\nexport type OutletHandle = SpaceExplorerOutletHandle;\n\nexport type OutletName = OutletHandle[\"name\"];\n\nexport type OutletRegistry = {\n spaceExplorer: SpaceExplorerFeatureAPI;\n};\n\nexport type GuestCapabilitiesForOutlet = {\n spaceExplorer: SpaceExplorerGuestCapabilities;\n};\n\nexport type HostCapabilitiesForOutlet = {\n spaceExplorer: SpaceExplorerHostCapabilities;\n};\n\nexport const outletCapabilityResolvers: {\n [N in OutletName]: {\n guest: (\n declared: GuestCapabilitiesForOutlet[N],\n ) => GuestCapabilitiesForOutlet[N];\n host: (\n declared: HostCapabilitiesForOutlet[N],\n ) => HostCapabilitiesForOutlet[N];\n };\n} = {\n spaceExplorer: {\n guest: resolveSpaceExplorerGuestCapabilities,\n host: resolveSpaceExplorerHostCapabilities,\n },\n};\n\nexport type {\n SpaceExplorerDragItem,\n SpaceExplorerFeatureAPI,\n SpaceExplorerItemDrop,\n SpaceExplorerOutletHandle,\n} from \"./spaceExplorer\";\n","import {\n type GuestCapabilitiesForOutlet,\n type HostCapabilitiesForOutlet,\n type OutletName,\n outletCapabilityResolvers,\n} from \"./outlets\";\n\n/**\n * Version of `@knime/product-features` that this build uses. Informational\n * only: logs, support, deprecation tracking. It never gates behavior.\n */\nexport const contractVersion: string = __PRODUCT_FEATURES_VERSION__;\n\n/**\n * Static declaration of the guest app. The host reads it before embedding.\n */\nexport type GuestCapabilities = {\n contractVersion: string;\n /**\n * Outlets the guest declares and supports. The host does not send a feature\n * for an outlet the guest does not support\n */\n outlets: Partial<GuestCapabilitiesForOutlet>;\n};\n\n/**\n * Static declaration of the host, passed as context for mounting the embedded guest\n */\nexport type HostCapabilities = {\n contractVersion: string;\n /**\n * Outlets the host has features for. The guest does not render an outlet that the\n * host cannot provide.\n */\n outlets: Partial<HostCapabilitiesForOutlet>;\n};\n\nexport type ResolvedOutlets = {\n [N in OutletName]?: {\n guest: GuestCapabilitiesForOutlet[N];\n host: HostCapabilitiesForOutlet[N];\n };\n};\n\n/**\n * Outlets that both sides declare. Capabilities that this contract version does not know are\n * dropped.\n */\nexport const resolveOutlets = (\n guest: GuestCapabilities,\n host: HostCapabilities,\n): ResolvedOutlets => {\n const resolved: ResolvedOutlets = {};\n\n for (const [name, resolvers] of Object.entries(outletCapabilityResolvers)) {\n const guestDeclared = guest.outlets?.[name as OutletName];\n const hostDeclared = host.outlets?.[name as OutletName];\n if (guestDeclared && hostDeclared) {\n resolved[name as OutletName] = {\n guest: resolvers.guest(guestDeclared),\n host: resolvers.host(hostDeclared),\n };\n }\n }\n\n return resolved;\n};\n","import {\n type RFCErrorToastMeta,\n RFC_ERROR_TOAST_META_KEY,\n rfcErrors,\n} from \"../rfcErrors\";\nimport type { Toast } from \"../toasts\";\n\nimport type { HostToast } from \"./types\";\n\n/**\n * Guest: turns a toast into data the host can render. An RFC error toast\n * keeps its error data. Any other component is dropped, because the host\n * cannot render a component from the guest's Vue runtime.\n */\nexport const toHostToast = (toast: Toast): HostToast => {\n const { component, meta, ...rest } = toast;\n const rfcError = meta?.[RFC_ERROR_TOAST_META_KEY] as\n RFCErrorToastMeta | undefined;\n\n if (component && !rfcError) {\n consola.warn(\"Embedding: dropped the component of a toast\", toast);\n }\n\n return {\n ...rest,\n ...(meta && { meta }),\n ...(rfcError && { rfcError }),\n };\n};\n\n/**\n * Host: turns a toast from the guest into a toast for its own\n * toast service context.\n */\nexport const fromHostToast = (hostToast: HostToast): Toast => {\n const { rfcError, ...toast } = hostToast;\n\n if (!rfcError) {\n return toast;\n }\n\n return {\n ...toast,\n ...rfcErrors.toToast({\n headline: toast.headline ?? \"\",\n rfcError: new rfcErrors.RFCError(rfcError.data),\n canCopyToClipboard: rfcError.canCopyToClipboard,\n serializeErrorForClipboard: rfcError.serializeErrorForClipboard,\n }),\n };\n};\n"],"mappings":";;;;;AAwEA,IAAa,yCACX,cACoC,EACpC,GAAI,SAAS,YAAY,EAAE,UAAU,KAAK,EAC5C;AAEA,IAAa,wCACX,cACmC,EACnC,GAAI,SAAS,cAAc,EAAE,YAAY,KAAK,EAChD;;;ACtDA,IAAa,4BAST,EACF,eAAe;CACb,OAAO;CACP,MAAM;AACR,EACF;;;;;;;AC/BA,IAAa,kBAAA;;;;;AAqCb,IAAa,kBACX,OACA,SACoB;CACpB,MAAM,WAA4B,CAAC;CAEnC,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,yBAAyB,GAAG;EACzE,MAAM,gBAAgB,MAAM,UAAU;EACtC,MAAM,eAAe,KAAK,UAAU;EACpC,IAAI,iBAAiB,cACnB,SAAS,QAAsB;GAC7B,OAAO,UAAU,MAAM,aAAa;GACpC,MAAM,UAAU,KAAK,YAAY;EACnC;CAEJ;CAEA,OAAO;AACT;;;;;;;;ACpDA,IAAa,eAAe,UAA4B;CACtD,MAAM,EAAE,WAAW,MAAM,GAAG,SAAS;CACrC,MAAM,WAAW,OAAO;CAGxB,IAAI,aAAa,CAAC,UAChB,QAAQ,KAAK,+CAA+C,KAAK;CAGnE,OAAO;EACL,GAAG;EACH,GAAI,QAAQ,EAAE,KAAK;EACnB,GAAI,YAAY,EAAE,SAAS;CAC7B;AACF;;;;;AAMA,IAAa,iBAAiB,cAAgC;CAC5D,MAAM,EAAE,UAAU,GAAG,UAAU;CAE/B,IAAI,CAAC,UACH,OAAO;CAGT,OAAO;EACL,GAAG;EACH,GAAG,UAAU,QAAQ;GACnB,UAAU,MAAM,YAAY;GAC5B,UAAU,IAAI,UAAU,SAAS,SAAS,IAAI;GAC9C,oBAAoB,SAAS;GAC7B,4BAA4B,SAAS;EACvC,CAAC;CACH;AACF"}
|
|
@@ -125,6 +125,11 @@ var RFCError = class extends Error {
|
|
|
125
125
|
//#endregion
|
|
126
126
|
//#region src/rfcErrors/index.ts
|
|
127
127
|
/**
|
|
128
|
+
* Key in `Toast.meta` under which `toToast` keeps the error data, so the toast
|
|
129
|
+
* can be rebuilt where its component cannot be rendered.
|
|
130
|
+
*/
|
|
131
|
+
var RFC_ERROR_TOAST_META_KEY = "rfcError";
|
|
132
|
+
/**
|
|
128
133
|
* Map to a toast template component compatible with an RFCError format
|
|
129
134
|
*/
|
|
130
135
|
var toToast = ({ headline, rfcError, canCopyToClipboard = true, serializeErrorForClipboard = void 0 }) => {
|
|
@@ -138,7 +143,12 @@ var toToast = ({ headline, rfcError, canCopyToClipboard = true, serializeErrorFo
|
|
|
138
143
|
canCopyToClipboard,
|
|
139
144
|
serializeErrorForClipboard
|
|
140
145
|
}),
|
|
141
|
-
autoRemove: false
|
|
146
|
+
autoRemove: false,
|
|
147
|
+
meta: { [RFC_ERROR_TOAST_META_KEY]: {
|
|
148
|
+
data,
|
|
149
|
+
canCopyToClipboard,
|
|
150
|
+
serializeErrorForClipboard
|
|
151
|
+
} }
|
|
142
152
|
};
|
|
143
153
|
};
|
|
144
154
|
var isFetchError = (error) => {
|
|
@@ -167,6 +177,6 @@ var rfcErrors = {
|
|
|
167
177
|
RFCError
|
|
168
178
|
};
|
|
169
179
|
//#endregion
|
|
170
|
-
export { rfcErrors as t };
|
|
180
|
+
export { rfcErrors as n, RFC_ERROR_TOAST_META_KEY as t };
|
|
171
181
|
|
|
172
|
-
//# sourceMappingURL=rfcErrors-
|
|
182
|
+
//# sourceMappingURL=rfcErrors-CNWg8BiD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rfcErrors-C59cEDGj.js","names":[],"sources":["../src/rfcErrors/serializeRFCErrorData.ts","../src/rfcErrors/RFCErrorToastTemplate.vue","../src/rfcErrors/RFCErrorToastTemplate.vue","../src/rfcErrors/types.ts","../src/rfcErrors/index.ts"],"sourcesContent":["import type { RFCErrorData } from \"./types\";\n\nexport const serializeErrorForClipboard = (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n): string => {\n let details = \"\";\n if (error.details?.length) {\n if (error.details.length > 1) {\n const detailLines = error.details\n .map((item) => `\\u2022 ${item}`)\n .join(\"\\n\");\n details = `\\n${detailLines}`;\n } else {\n details = error.details[0];\n }\n }\n\n let errorText = `${headline}\\n\\n`;\n errorText += `${error.title}\\n\\n`;\n errorText += details ? `Details: ${details}\\n\\n` : \"\";\n\n if (error.status !== undefined) {\n errorText += `Status: ${error.status}\\n`;\n }\n\n if (error.date) {\n errorText += `Date: ${formatDate(error.date)}\\n`;\n }\n\n if (error.requestId) {\n errorText += `Request Id: ${error.requestId}\\n`;\n }\n\n if (error.errorId) {\n errorText += `Error Id: ${error.errorId}\\n`;\n }\n\n if (error.stacktrace) {\n errorText += \"------\\n\"; // separator\n errorText += `Stacktrace:\\n\\n${error.stacktrace}\\n`;\n }\n\n return errorText;\n};\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { useClipboard } from \"@vueuse/core\";\n\nimport { KdsButton } from \"@knime/kds-components\";\nimport { formatDateTimeString } from \"@knime/utils\";\n\nimport { serializeErrorForClipboard as defaultSerializeRFCErrorData } from \"./serializeRFCErrorData\";\nimport type { RFCErrorData } from \"./types\";\n\ntype Props = {\n /**\n * Toast headline shown in the toast title bar. Not rendered inside this\n * template, but included when serializing the error to the clipboard.\n */\n headline: string;\n /** Whether to show the \"Copy error to clipboard\" button. */\n canCopyToClipboard?: boolean;\n /**\n * Custom serializer for the clipboard payload. Defaults to\n * `serializeRFCErrorData` which formats the full error as text.\n */\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n} & RFCErrorData;\n\nconst {\n headline,\n canCopyToClipboard = true,\n serializeErrorForClipboard = defaultSerializeRFCErrorData,\n ...rfcError\n} = defineProps<Props>();\n\nconst emits = defineEmits([\"showMore\"]);\n\nconst { copy, copied } = useClipboard({\n copiedDuring: 3000,\n});\n\nconst hasDetails =\n rfcError.details?.length ||\n rfcError.status !== undefined ||\n rfcError.date !== undefined ||\n rfcError.requestId !== undefined ||\n rfcError.errorId !== undefined;\n// don't show 'Show details' button if there are no details to show\nconst showDetails = ref(!hasDetails);\n\nconst formatDate = (date: Date): string =>\n date ? formatDateTimeString(date.getTime()) : \"\";\n\nconst copyToClipboard = () => {\n if (copied.value) {\n return;\n }\n copy(serializeErrorForClipboard(rfcError, headline, formatDate)).catch(\n (error) => {\n consola.error(\"Failed to copy to clipboard\", { error });\n },\n );\n};\n\nconst onShowDetailsClicked = () => {\n showDetails.value = true;\n emits(\"showMore\");\n};\n</script>\n\n<template>\n <div class=\"wrapper\">\n <div class=\"title\">\n {{ title }}\n </div>\n <div v-if=\"showDetails\">\n <div v-if=\"details?.length\">\n <strong>Details: </strong>\n <template v-if=\"details.length === 1\">\n {{ details[0] }}\n </template>\n <template v-else>\n <ul class=\"details-list\">\n <li v-for=\"(item, index) in details\" :key=\"index\">{{ item }}</li>\n </ul>\n </template>\n </div>\n\n <div v-if=\"status !== undefined\">\n <strong>Status: </strong>{{ status }}\n </div>\n <div v-if=\"date\"><strong>Date: </strong>{{ formatDate(date) }}</div>\n <div v-if=\"requestId\"><strong>Request id: </strong>{{ requestId }}</div>\n <div v-if=\"errorId\"><strong>Error id: </strong>{{ errorId }}</div>\n <div v-if=\"stacktrace && canCopyToClipboard\">\n <strong>Stacktrace: </strong>Part of clipboard text\n </div>\n </div>\n <div class=\"actions-wrapper\">\n <KdsButton\n v-if=\"!showDetails\"\n data-testid=\"show-details\"\n variant=\"transparent\"\n label=\"Show details\"\n size=\"xsmall\"\n @click=\"onShowDetailsClicked\"\n />\n <KdsButton\n v-if=\"canCopyToClipboard\"\n data-testid=\"copy-to-clipboard\"\n :label=\"copied ? 'Error was copied' : 'Copy error to clipboard'\"\n :leading-icon=\"copied ? 'checkmark' : 'copy'\"\n variant=\"transparent\"\n size=\"xsmall\"\n @click=\"copyToClipboard\"\n />\n </div>\n </div>\n</template>\n\n<style scoped>\n.wrapper {\n display: flex;\n flex-direction: column;\n gap: var(--kds-spacing-container-0-25x);\n font: var(--kds-font-base-body-small);\n color: var(--kds-color-text-and-icon-neutral);\n}\n\n.details-list {\n padding-left: var(--kds-spacing-container-1-5x);\n margin-top: var(--kds-spacing-container-0-37x);\n margin-bottom: var(--kds-spacing-container-0-37x);\n}\n\n.actions-wrapper {\n display: flex;\n gap: var(--kds-spacing-container-0-5x);\n align-items: center;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { useClipboard } from \"@vueuse/core\";\n\nimport { KdsButton } from \"@knime/kds-components\";\nimport { formatDateTimeString } from \"@knime/utils\";\n\nimport { serializeErrorForClipboard as defaultSerializeRFCErrorData } from \"./serializeRFCErrorData\";\nimport type { RFCErrorData } from \"./types\";\n\ntype Props = {\n /**\n * Toast headline shown in the toast title bar. Not rendered inside this\n * template, but included when serializing the error to the clipboard.\n */\n headline: string;\n /** Whether to show the \"Copy error to clipboard\" button. */\n canCopyToClipboard?: boolean;\n /**\n * Custom serializer for the clipboard payload. Defaults to\n * `serializeRFCErrorData` which formats the full error as text.\n */\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n} & RFCErrorData;\n\nconst {\n headline,\n canCopyToClipboard = true,\n serializeErrorForClipboard = defaultSerializeRFCErrorData,\n ...rfcError\n} = defineProps<Props>();\n\nconst emits = defineEmits([\"showMore\"]);\n\nconst { copy, copied } = useClipboard({\n copiedDuring: 3000,\n});\n\nconst hasDetails =\n rfcError.details?.length ||\n rfcError.status !== undefined ||\n rfcError.date !== undefined ||\n rfcError.requestId !== undefined ||\n rfcError.errorId !== undefined;\n// don't show 'Show details' button if there are no details to show\nconst showDetails = ref(!hasDetails);\n\nconst formatDate = (date: Date): string =>\n date ? formatDateTimeString(date.getTime()) : \"\";\n\nconst copyToClipboard = () => {\n if (copied.value) {\n return;\n }\n copy(serializeErrorForClipboard(rfcError, headline, formatDate)).catch(\n (error) => {\n consola.error(\"Failed to copy to clipboard\", { error });\n },\n );\n};\n\nconst onShowDetailsClicked = () => {\n showDetails.value = true;\n emits(\"showMore\");\n};\n</script>\n\n<template>\n <div class=\"wrapper\">\n <div class=\"title\">\n {{ title }}\n </div>\n <div v-if=\"showDetails\">\n <div v-if=\"details?.length\">\n <strong>Details: </strong>\n <template v-if=\"details.length === 1\">\n {{ details[0] }}\n </template>\n <template v-else>\n <ul class=\"details-list\">\n <li v-for=\"(item, index) in details\" :key=\"index\">{{ item }}</li>\n </ul>\n </template>\n </div>\n\n <div v-if=\"status !== undefined\">\n <strong>Status: </strong>{{ status }}\n </div>\n <div v-if=\"date\"><strong>Date: </strong>{{ formatDate(date) }}</div>\n <div v-if=\"requestId\"><strong>Request id: </strong>{{ requestId }}</div>\n <div v-if=\"errorId\"><strong>Error id: </strong>{{ errorId }}</div>\n <div v-if=\"stacktrace && canCopyToClipboard\">\n <strong>Stacktrace: </strong>Part of clipboard text\n </div>\n </div>\n <div class=\"actions-wrapper\">\n <KdsButton\n v-if=\"!showDetails\"\n data-testid=\"show-details\"\n variant=\"transparent\"\n label=\"Show details\"\n size=\"xsmall\"\n @click=\"onShowDetailsClicked\"\n />\n <KdsButton\n v-if=\"canCopyToClipboard\"\n data-testid=\"copy-to-clipboard\"\n :label=\"copied ? 'Error was copied' : 'Copy error to clipboard'\"\n :leading-icon=\"copied ? 'checkmark' : 'copy'\"\n variant=\"transparent\"\n size=\"xsmall\"\n @click=\"copyToClipboard\"\n />\n </div>\n </div>\n</template>\n\n<style scoped>\n.wrapper {\n display: flex;\n flex-direction: column;\n gap: var(--kds-spacing-container-0-25x);\n font: var(--kds-font-base-body-small);\n color: var(--kds-color-text-and-icon-neutral);\n}\n\n.details-list {\n padding-left: var(--kds-spacing-container-1-5x);\n margin-top: var(--kds-spacing-container-0-37x);\n margin-bottom: var(--kds-spacing-container-0-37x);\n}\n\n.actions-wrapper {\n display: flex;\n gap: var(--kds-spacing-container-0-5x);\n align-items: center;\n}\n</style>\n","/**\n * Type based on an RFC-9457 error standard (https://www.rfc-editor.org/rfc/rfc9457)\n * Also see:\n * https://knime-com.atlassian.net/wiki/spaces/SPECS/pages/4126769212/API+Errors+Problem+Details\n */\nexport type RFCErrorData = {\n /** Short human-readable summary of the error. */\n title: string;\n /** HTTP status code associated with the error. */\n status?: number;\n /** Date/time when the error occurred. */\n date?: Date;\n /** Additional human-readable detail messages. */\n details?: string[];\n /** Correlation id for the request that triggered the error. */\n requestId?: string;\n /**\n * Id used to find an error in the Hub logs. Specially relevant\n * when details of the error are not wanted to be exposed to the user.\n */\n errorId?: string;\n /**\n * Relevant only for the Analytics Platform, since the Hub does not expose\n * stack traces.\n */\n stacktrace?: string;\n};\n\nexport class RFCError extends Error {\n data: RFCErrorData;\n\n constructor(data: RFCErrorData) {\n super(data.title);\n this.data = data;\n }\n}\n\nexport type FetchError = {\n response: {\n headers: Headers;\n };\n statusCode: number;\n data: {\n title: string;\n details: string[];\n };\n};\n","import { h } from \"vue\";\n\nimport type { Toast } from \"../toasts\";\n\nimport RFCErrorToastTemplate from \"./RFCErrorToastTemplate.vue\";\nimport { type FetchError, RFCError, type RFCErrorData } from \"./types\";\n\n/**\n * Map to a toast template component compatible with an RFCError format\n */\nconst toToast = ({\n headline,\n rfcError,\n canCopyToClipboard = true,\n serializeErrorForClipboard = undefined,\n}: {\n headline: string;\n rfcError: RFCError;\n canCopyToClipboard?: boolean;\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n}): Toast => {\n const { data } = rfcError;\n\n const rfcErrorToastContent = h(RFCErrorToastTemplate, {\n headline,\n ...data,\n canCopyToClipboard,\n serializeErrorForClipboard,\n });\n\n return {\n type: \"error\",\n headline,\n component: rfcErrorToastContent,\n autoRemove: false,\n };\n};\n\nconst isFetchError = (error: unknown): error is FetchError => {\n return (\n error !== null &&\n typeof error === \"object\" &&\n \"response\" in error &&\n \"statusCode\" in error &&\n \"data\" in error\n );\n};\n\n/**\n * Parse a generic request error to an `RFCError`.\n * When parsing is not possible it returns undefined.\n */\nconst tryParse = (error: unknown): RFCError | undefined => {\n if (!isFetchError(error)) {\n return undefined;\n }\n\n if (!error.response) {\n return undefined;\n }\n\n const responseDate = error.response.headers.get(\"date\")\n ? new Date(error.response.headers.get(\"date\")!)\n : undefined;\n\n const title =\n typeof error.data === \"string\" ? error.data : (error.data?.title ?? \"\");\n\n const rfcErrorData: RFCErrorData = {\n title: title as string,\n details: error.data?.details as string[] | undefined,\n status: error.statusCode as number,\n date: responseDate,\n requestId: error.response.headers.get(\"x-request-id\") ?? undefined,\n errorId: error.response.headers.get(\"x-error-id\") ?? undefined,\n };\n\n return new RFCError(rfcErrorData);\n};\n\nexport const rfcErrors = {\n toToast,\n tryParse,\n RFCError,\n};\n"],"mappings":";;;;;;AAEA,IAAa,8BACX,OACA,UACA,eACW;CACX,IAAI,UAAU;CACd,IAAI,MAAM,SAAS,QACjB,IAAI,MAAM,QAAQ,SAAS,GAIzB,UAAU,KAHU,MAAM,QACvB,KAAK,SAAS,UAAU,MAAM,CAAC,CAC/B,KAAK,IACO;MAEf,UAAU,MAAM,QAAQ;CAI5B,IAAI,YAAY,GAAG,SAAS;CAC5B,aAAa,GAAG,MAAM,MAAM;CAC5B,aAAa,UAAU,YAAY,QAAQ,QAAQ;CAEnD,IAAI,MAAM,WAAW,KAAA,GACnB,aAAa,WAAW,MAAM,OAAO;CAGvC,IAAI,MAAM,MACR,aAAa,SAAS,WAAW,MAAM,IAAI,EAAE;CAG/C,IAAI,MAAM,WACR,aAAa,eAAe,MAAM,UAAU;CAG9C,IAAI,MAAM,SACR,aAAa,aAAa,MAAM,QAAQ;CAG1C,IAAI,MAAM,YAAY;EACpB,aAAa;EACb,aAAa,kBAAkB,MAAM,WAAW;CAClD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EChBA,MAAM,WAKF,qBAAA,SAAA;GAAA;GAAA;GAAA;EAAA,CAAA;EAEJ,MAAM,QAAQ;EAEd,MAAM,EAAE,MAAM,W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AAb,cAA8B,MAAM;CAClC;CAEA,YAAY,MAAoB;EAC9B,MAAM,KAAK,KAAK;EAChB,KAAK,OAAO;CACd;AACF;;;;;;ACzBA,IAAM,WAAW,EACf,UACA,UACA,qBAAqB,MACrB,6BAA6B,KAAA,QAUlB;CACX,MAAM,EAAE,SAAS;CASjB,OAAO;EACL,MAAM;EACN;EACA,WAV2B,EAAE,+BAAuB;GACpD;GACA,GAAG;GACH;GACA;EACF,CAKa;EACX,YAAY;CACd;AACF;AAEA,IAAM,gBAAgB,UAAwC;CAC5D,OACE,UAAU,QACV,OAAO,UAAU,YACjB,cAAc,SACd,gBAAgB,SAChB,UAAU;AAEd;;;;;AAMA,IAAM,YAAY,UAAyC;CACzD,IAAI,CAAC,aAAa,KAAK,GACrB;CAGF,IAAI,CAAC,MAAM,UACT;CAGF,MAAM,eAAe,MAAM,SAAS,QAAQ,IAAI,MAAM,IAClD,IAAI,KAAK,MAAM,SAAS,QAAQ,IAAI,MAAM,CAAE,IAC5C,KAAA;CAcJ,OAAO,IAAI,SAAS;EARX,OAHP,OAAO,MAAM,SAAS,WAAW,MAAM,OAAQ,MAAM,MAAM,SAAS;EAIpE,SAAS,MAAM,MAAM;EACrB,QAAQ,MAAM;EACd,MAAM;EACN,WAAW,MAAM,SAAS,QAAQ,IAAI,cAAc,KAAK,KAAA;EACzD,SAAS,MAAM,SAAS,QAAQ,IAAI,YAAY,KAAK,KAAA;CAGnC,CAAY;AAClC;AAEA,IAAa,YAAY;CACvB;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"rfcErrors-CNWg8BiD.js","names":[],"sources":["../src/rfcErrors/serializeRFCErrorData.ts","../src/rfcErrors/RFCErrorToastTemplate.vue","../src/rfcErrors/RFCErrorToastTemplate.vue","../src/rfcErrors/types.ts","../src/rfcErrors/index.ts"],"sourcesContent":["import type { RFCErrorData } from \"./types\";\n\nexport const serializeErrorForClipboard = (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n): string => {\n let details = \"\";\n if (error.details?.length) {\n if (error.details.length > 1) {\n const detailLines = error.details\n .map((item) => `\\u2022 ${item}`)\n .join(\"\\n\");\n details = `\\n${detailLines}`;\n } else {\n details = error.details[0];\n }\n }\n\n let errorText = `${headline}\\n\\n`;\n errorText += `${error.title}\\n\\n`;\n errorText += details ? `Details: ${details}\\n\\n` : \"\";\n\n if (error.status !== undefined) {\n errorText += `Status: ${error.status}\\n`;\n }\n\n if (error.date) {\n errorText += `Date: ${formatDate(error.date)}\\n`;\n }\n\n if (error.requestId) {\n errorText += `Request Id: ${error.requestId}\\n`;\n }\n\n if (error.errorId) {\n errorText += `Error Id: ${error.errorId}\\n`;\n }\n\n if (error.stacktrace) {\n errorText += \"------\\n\"; // separator\n errorText += `Stacktrace:\\n\\n${error.stacktrace}\\n`;\n }\n\n return errorText;\n};\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { useClipboard } from \"@vueuse/core\";\n\nimport { KdsButton } from \"@knime/kds-components\";\nimport { formatDateTimeString } from \"@knime/utils\";\n\nimport { serializeErrorForClipboard as defaultSerializeRFCErrorData } from \"./serializeRFCErrorData\";\nimport type { RFCErrorData } from \"./types\";\n\ntype Props = {\n /**\n * Toast headline shown in the toast title bar. Not rendered inside this\n * template, but included when serializing the error to the clipboard.\n */\n headline: string;\n /** Whether to show the \"Copy error to clipboard\" button. */\n canCopyToClipboard?: boolean;\n /**\n * Custom serializer for the clipboard payload. Defaults to\n * `serializeRFCErrorData` which formats the full error as text.\n */\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n} & RFCErrorData;\n\nconst {\n headline,\n canCopyToClipboard = true,\n serializeErrorForClipboard = defaultSerializeRFCErrorData,\n ...rfcError\n} = defineProps<Props>();\n\nconst emits = defineEmits([\"showMore\"]);\n\nconst { copy, copied } = useClipboard({\n copiedDuring: 3000,\n});\n\nconst hasDetails =\n rfcError.details?.length ||\n rfcError.status !== undefined ||\n rfcError.date !== undefined ||\n rfcError.requestId !== undefined ||\n rfcError.errorId !== undefined;\n// don't show 'Show details' button if there are no details to show\nconst showDetails = ref(!hasDetails);\n\nconst formatDate = (date: Date): string =>\n date ? formatDateTimeString(date.getTime()) : \"\";\n\nconst copyToClipboard = () => {\n if (copied.value) {\n return;\n }\n copy(serializeErrorForClipboard(rfcError, headline, formatDate)).catch(\n (error) => {\n consola.error(\"Failed to copy to clipboard\", { error });\n },\n );\n};\n\nconst onShowDetailsClicked = () => {\n showDetails.value = true;\n emits(\"showMore\");\n};\n</script>\n\n<template>\n <div class=\"wrapper\">\n <div class=\"title\">\n {{ title }}\n </div>\n <div v-if=\"showDetails\">\n <div v-if=\"details?.length\">\n <strong>Details: </strong>\n <template v-if=\"details.length === 1\">\n {{ details[0] }}\n </template>\n <template v-else>\n <ul class=\"details-list\">\n <li v-for=\"(item, index) in details\" :key=\"index\">{{ item }}</li>\n </ul>\n </template>\n </div>\n\n <div v-if=\"status !== undefined\">\n <strong>Status: </strong>{{ status }}\n </div>\n <div v-if=\"date\"><strong>Date: </strong>{{ formatDate(date) }}</div>\n <div v-if=\"requestId\"><strong>Request id: </strong>{{ requestId }}</div>\n <div v-if=\"errorId\"><strong>Error id: </strong>{{ errorId }}</div>\n <div v-if=\"stacktrace && canCopyToClipboard\">\n <strong>Stacktrace: </strong>Part of clipboard text\n </div>\n </div>\n <div class=\"actions-wrapper\">\n <KdsButton\n v-if=\"!showDetails\"\n data-testid=\"show-details\"\n variant=\"transparent\"\n label=\"Show details\"\n size=\"xsmall\"\n @click=\"onShowDetailsClicked\"\n />\n <KdsButton\n v-if=\"canCopyToClipboard\"\n data-testid=\"copy-to-clipboard\"\n :label=\"copied ? 'Error was copied' : 'Copy error to clipboard'\"\n :leading-icon=\"copied ? 'checkmark' : 'copy'\"\n variant=\"transparent\"\n size=\"xsmall\"\n @click=\"copyToClipboard\"\n />\n </div>\n </div>\n</template>\n\n<style scoped>\n.wrapper {\n display: flex;\n flex-direction: column;\n gap: var(--kds-spacing-container-0-25x);\n font: var(--kds-font-base-body-small);\n color: var(--kds-color-text-and-icon-neutral);\n}\n\n.details-list {\n padding-left: var(--kds-spacing-container-1-5x);\n margin-top: var(--kds-spacing-container-0-37x);\n margin-bottom: var(--kds-spacing-container-0-37x);\n}\n\n.actions-wrapper {\n display: flex;\n gap: var(--kds-spacing-container-0-5x);\n align-items: center;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { useClipboard } from \"@vueuse/core\";\n\nimport { KdsButton } from \"@knime/kds-components\";\nimport { formatDateTimeString } from \"@knime/utils\";\n\nimport { serializeErrorForClipboard as defaultSerializeRFCErrorData } from \"./serializeRFCErrorData\";\nimport type { RFCErrorData } from \"./types\";\n\ntype Props = {\n /**\n * Toast headline shown in the toast title bar. Not rendered inside this\n * template, but included when serializing the error to the clipboard.\n */\n headline: string;\n /** Whether to show the \"Copy error to clipboard\" button. */\n canCopyToClipboard?: boolean;\n /**\n * Custom serializer for the clipboard payload. Defaults to\n * `serializeRFCErrorData` which formats the full error as text.\n */\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n} & RFCErrorData;\n\nconst {\n headline,\n canCopyToClipboard = true,\n serializeErrorForClipboard = defaultSerializeRFCErrorData,\n ...rfcError\n} = defineProps<Props>();\n\nconst emits = defineEmits([\"showMore\"]);\n\nconst { copy, copied } = useClipboard({\n copiedDuring: 3000,\n});\n\nconst hasDetails =\n rfcError.details?.length ||\n rfcError.status !== undefined ||\n rfcError.date !== undefined ||\n rfcError.requestId !== undefined ||\n rfcError.errorId !== undefined;\n// don't show 'Show details' button if there are no details to show\nconst showDetails = ref(!hasDetails);\n\nconst formatDate = (date: Date): string =>\n date ? formatDateTimeString(date.getTime()) : \"\";\n\nconst copyToClipboard = () => {\n if (copied.value) {\n return;\n }\n copy(serializeErrorForClipboard(rfcError, headline, formatDate)).catch(\n (error) => {\n consola.error(\"Failed to copy to clipboard\", { error });\n },\n );\n};\n\nconst onShowDetailsClicked = () => {\n showDetails.value = true;\n emits(\"showMore\");\n};\n</script>\n\n<template>\n <div class=\"wrapper\">\n <div class=\"title\">\n {{ title }}\n </div>\n <div v-if=\"showDetails\">\n <div v-if=\"details?.length\">\n <strong>Details: </strong>\n <template v-if=\"details.length === 1\">\n {{ details[0] }}\n </template>\n <template v-else>\n <ul class=\"details-list\">\n <li v-for=\"(item, index) in details\" :key=\"index\">{{ item }}</li>\n </ul>\n </template>\n </div>\n\n <div v-if=\"status !== undefined\">\n <strong>Status: </strong>{{ status }}\n </div>\n <div v-if=\"date\"><strong>Date: </strong>{{ formatDate(date) }}</div>\n <div v-if=\"requestId\"><strong>Request id: </strong>{{ requestId }}</div>\n <div v-if=\"errorId\"><strong>Error id: </strong>{{ errorId }}</div>\n <div v-if=\"stacktrace && canCopyToClipboard\">\n <strong>Stacktrace: </strong>Part of clipboard text\n </div>\n </div>\n <div class=\"actions-wrapper\">\n <KdsButton\n v-if=\"!showDetails\"\n data-testid=\"show-details\"\n variant=\"transparent\"\n label=\"Show details\"\n size=\"xsmall\"\n @click=\"onShowDetailsClicked\"\n />\n <KdsButton\n v-if=\"canCopyToClipboard\"\n data-testid=\"copy-to-clipboard\"\n :label=\"copied ? 'Error was copied' : 'Copy error to clipboard'\"\n :leading-icon=\"copied ? 'checkmark' : 'copy'\"\n variant=\"transparent\"\n size=\"xsmall\"\n @click=\"copyToClipboard\"\n />\n </div>\n </div>\n</template>\n\n<style scoped>\n.wrapper {\n display: flex;\n flex-direction: column;\n gap: var(--kds-spacing-container-0-25x);\n font: var(--kds-font-base-body-small);\n color: var(--kds-color-text-and-icon-neutral);\n}\n\n.details-list {\n padding-left: var(--kds-spacing-container-1-5x);\n margin-top: var(--kds-spacing-container-0-37x);\n margin-bottom: var(--kds-spacing-container-0-37x);\n}\n\n.actions-wrapper {\n display: flex;\n gap: var(--kds-spacing-container-0-5x);\n align-items: center;\n}\n</style>\n","/**\n * Type based on an RFC-9457 error standard (https://www.rfc-editor.org/rfc/rfc9457)\n * Also see:\n * https://knime-com.atlassian.net/wiki/spaces/SPECS/pages/4126769212/API+Errors+Problem+Details\n */\nexport type RFCErrorData = {\n /** Short human-readable summary of the error. */\n title: string;\n /** HTTP status code associated with the error. */\n status?: number;\n /** Date/time when the error occurred. */\n date?: Date;\n /** Additional human-readable detail messages. */\n details?: string[];\n /** Correlation id for the request that triggered the error. */\n requestId?: string;\n /**\n * Id used to find an error in the Hub logs. Specially relevant\n * when details of the error are not wanted to be exposed to the user.\n */\n errorId?: string;\n /**\n * Relevant only for the Analytics Platform, since the Hub does not expose\n * stack traces.\n */\n stacktrace?: string;\n};\n\nexport class RFCError extends Error {\n data: RFCErrorData;\n\n constructor(data: RFCErrorData) {\n super(data.title);\n this.data = data;\n }\n}\n\nexport type FetchError = {\n response: {\n headers: Headers;\n };\n statusCode: number;\n data: {\n title: string;\n details: string[];\n };\n};\n","import { h } from \"vue\";\n\nimport type { Toast } from \"../toasts\";\n\nimport RFCErrorToastTemplate from \"./RFCErrorToastTemplate.vue\";\nimport { type FetchError, RFCError, type RFCErrorData } from \"./types\";\n\n/**\n * Key in `Toast.meta` under which `toToast` keeps the error data, so the toast\n * can be rebuilt where its component cannot be rendered.\n */\nexport const RFC_ERROR_TOAST_META_KEY = \"rfcError\";\n\nexport type RFCErrorToastMeta = {\n data: RFCErrorData;\n canCopyToClipboard?: boolean;\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n};\n\n/**\n * Map to a toast template component compatible with an RFCError format\n */\nconst toToast = ({\n headline,\n rfcError,\n canCopyToClipboard = true,\n serializeErrorForClipboard = undefined,\n}: {\n headline: string;\n rfcError: RFCError;\n canCopyToClipboard?: boolean;\n serializeErrorForClipboard?: (\n error: RFCErrorData,\n headline: string,\n formatDate: (date: Date) => string,\n ) => string;\n}): Toast => {\n const { data } = rfcError;\n\n const rfcErrorToastContent = h(RFCErrorToastTemplate, {\n headline,\n ...data,\n canCopyToClipboard,\n serializeErrorForClipboard,\n });\n\n return {\n type: \"error\",\n headline,\n component: rfcErrorToastContent,\n autoRemove: false,\n meta: {\n [RFC_ERROR_TOAST_META_KEY]: {\n data,\n canCopyToClipboard,\n serializeErrorForClipboard,\n } satisfies RFCErrorToastMeta,\n },\n };\n};\n\nconst isFetchError = (error: unknown): error is FetchError => {\n return (\n error !== null &&\n typeof error === \"object\" &&\n \"response\" in error &&\n \"statusCode\" in error &&\n \"data\" in error\n );\n};\n\n/**\n * Parse a generic request error to an `RFCError`.\n * When parsing is not possible it returns undefined.\n */\nconst tryParse = (error: unknown): RFCError | undefined => {\n if (!isFetchError(error)) {\n return undefined;\n }\n\n if (!error.response) {\n return undefined;\n }\n\n const responseDate = error.response.headers.get(\"date\")\n ? new Date(error.response.headers.get(\"date\")!)\n : undefined;\n\n const title =\n typeof error.data === \"string\" ? error.data : (error.data?.title ?? \"\");\n\n const rfcErrorData: RFCErrorData = {\n title: title as string,\n details: error.data?.details as string[] | undefined,\n status: error.statusCode as number,\n date: responseDate,\n requestId: error.response.headers.get(\"x-request-id\") ?? undefined,\n errorId: error.response.headers.get(\"x-error-id\") ?? undefined,\n };\n\n return new RFCError(rfcErrorData);\n};\n\nexport const rfcErrors = {\n toToast,\n tryParse,\n RFCError,\n};\n"],"mappings":";;;;;;AAEA,IAAa,8BACX,OACA,UACA,eACW;CACX,IAAI,UAAU;CACd,IAAI,MAAM,SAAS,QACjB,IAAI,MAAM,QAAQ,SAAS,GAIzB,UAAU,KAHU,MAAM,QACvB,KAAK,SAAS,UAAU,MAAM,CAAC,CAC/B,KAAK,IACO;MAEf,UAAU,MAAM,QAAQ;CAI5B,IAAI,YAAY,GAAG,SAAS;CAC5B,aAAa,GAAG,MAAM,MAAM;CAC5B,aAAa,UAAU,YAAY,QAAQ,QAAQ;CAEnD,IAAI,MAAM,WAAW,KAAA,GACnB,aAAa,WAAW,MAAM,OAAO;CAGvC,IAAI,MA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MAAM;EACN,WAAW,MAAM,SAAS,QAAQ,IAAI,cAAc,KAAK,KAAA;EACzD,SAAS,MAAM,SAAS,QAAQ,IAAI,YAAY,KAAK,KAAA;CAGnC,CAAY;AAClC;AAEA,IAAa,YAAY;CACvB;CACA;CACA;AACF"}
|
package/dist/rfcErrors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { rfcErrors };
|
|
1
|
+
import { n as rfcErrors, t as RFC_ERROR_TOAST_META_KEY } from "./rfcErrors-CNWg8BiD.js";
|
|
2
|
+
export { RFC_ERROR_TOAST_META_KEY, rfcErrors };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { GuestCapabilitiesForOutlet, HostCapabilitiesForOutlet, OutletName } from './outlets';
|
|
2
|
+
/**
|
|
3
|
+
* Version of `@knime/product-features` that this build uses. Informational
|
|
4
|
+
* only: logs, support, deprecation tracking. It never gates behavior.
|
|
5
|
+
*/
|
|
6
|
+
export declare const contractVersion: string;
|
|
7
|
+
/**
|
|
8
|
+
* Static declaration of the guest app. The host reads it before embedding.
|
|
9
|
+
*/
|
|
10
|
+
export type GuestCapabilities = {
|
|
11
|
+
contractVersion: string;
|
|
12
|
+
/**
|
|
13
|
+
* Outlets the guest declares and supports. The host does not send a feature
|
|
14
|
+
* for an outlet the guest does not support
|
|
15
|
+
*/
|
|
16
|
+
outlets: Partial<GuestCapabilitiesForOutlet>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Static declaration of the host, passed as context for mounting the embedded guest
|
|
20
|
+
*/
|
|
21
|
+
export type HostCapabilities = {
|
|
22
|
+
contractVersion: string;
|
|
23
|
+
/**
|
|
24
|
+
* Outlets the host has features for. The guest does not render an outlet that the
|
|
25
|
+
* host cannot provide.
|
|
26
|
+
*/
|
|
27
|
+
outlets: Partial<HostCapabilitiesForOutlet>;
|
|
28
|
+
};
|
|
29
|
+
export type ResolvedOutlets = {
|
|
30
|
+
[N in OutletName]?: {
|
|
31
|
+
guest: GuestCapabilitiesForOutlet[N];
|
|
32
|
+
host: HostCapabilitiesForOutlet[N];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Outlets that both sides declare. Capabilities that this contract version does not know are
|
|
37
|
+
* dropped.
|
|
38
|
+
*/
|
|
39
|
+
export declare const resolveOutlets: (guest: GuestCapabilities, host: HostCapabilities) => ResolvedOutlets;
|
|
40
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/embedding/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,UAAU,EAEhB,MAAM,WAAW,CAAC;AAEnB;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAqC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;KAC3B,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE;QAClB,KAAK,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;KACpC;CACF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,iBAAiB,EACxB,MAAM,gBAAgB,KACrB,eAeF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { contractVersion, resolveOutlets } from './capabilities';
|
|
2
|
+
export type { GuestCapabilities, HostCapabilities, ResolvedOutlets, } from './capabilities';
|
|
3
|
+
export type { HostCapabilitiesForOutlet, OutletHandle, OutletName, OutletRegistry, SpaceExplorerDragItem, SpaceExplorerFeatureAPI, SpaceExplorerItemDrop, SpaceExplorerOutletHandle, } from './outlets';
|
|
4
|
+
export { fromHostToast, toHostToast } from './toasts';
|
|
5
|
+
export type { EmbeddedGuestAPI, EmbeddingContext, EmbeddingHostAPI, GuestEmbedModuleBootstrap, NavigationIntent, UserActivity, } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/embedding/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,yBAAyB,EACzB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,GACb,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SpaceExplorerFeatureAPI, SpaceExplorerGuestCapabilities, SpaceExplorerHostCapabilities, SpaceExplorerOutletHandle } from './spaceExplorer';
|
|
2
|
+
/**
|
|
3
|
+
* Outlets the guest can expose (the editor in this case). Each outlet contains one feature of the host.
|
|
4
|
+
*/
|
|
5
|
+
export type OutletHandle = SpaceExplorerOutletHandle;
|
|
6
|
+
export type OutletName = OutletHandle["name"];
|
|
7
|
+
export type OutletRegistry = {
|
|
8
|
+
spaceExplorer: SpaceExplorerFeatureAPI;
|
|
9
|
+
};
|
|
10
|
+
export type GuestCapabilitiesForOutlet = {
|
|
11
|
+
spaceExplorer: SpaceExplorerGuestCapabilities;
|
|
12
|
+
};
|
|
13
|
+
export type HostCapabilitiesForOutlet = {
|
|
14
|
+
spaceExplorer: SpaceExplorerHostCapabilities;
|
|
15
|
+
};
|
|
16
|
+
export declare const outletCapabilityResolvers: {
|
|
17
|
+
[N in OutletName]: {
|
|
18
|
+
guest: (declared: GuestCapabilitiesForOutlet[N]) => GuestCapabilitiesForOutlet[N];
|
|
19
|
+
host: (declared: HostCapabilitiesForOutlet[N]) => HostCapabilitiesForOutlet[N];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type { SpaceExplorerDragItem, SpaceExplorerFeatureAPI, SpaceExplorerItemDrop, SpaceExplorerOutletHandle, } from './spaceExplorer';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/embedding/outlets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAG/B,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,uBAAuB,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,aAAa,EAAE,8BAA8B,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,6BAA6B,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE;KACrC,CAAC,IAAI,UAAU,GAAG;QACjB,KAAK,EAAE,CACL,QAAQ,EAAE,0BAA0B,CAAC,CAAC,CAAC,KACpC,0BAA0B,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,EAAE,CACJ,QAAQ,EAAE,yBAAyB,CAAC,CAAC,CAAC,KACnC,yBAAyB,CAAC,CAAC,CAAC,CAAC;KACnC;CAMF,CAAC;AAEF,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An item that the space explorer drags onto the canvas.
|
|
3
|
+
*/
|
|
4
|
+
export type SpaceExplorerDragItem = {
|
|
5
|
+
spaceId: string;
|
|
6
|
+
itemId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Drags items from the space explorer onto the another container. This allows custom control
|
|
12
|
+
* over rendering a drag preview and also running custom logic when an item is dropped onto another
|
|
13
|
+
* container.
|
|
14
|
+
*/
|
|
15
|
+
export type SpaceExplorerItemDrop = {
|
|
16
|
+
start: (item: SpaceExplorerDragItem) => void;
|
|
17
|
+
/**
|
|
18
|
+
* When `accepts` is true, the space explorer hides its own drag ghost.
|
|
19
|
+
*/
|
|
20
|
+
move: (clientX: number, clientY: number) => {
|
|
21
|
+
accepts: boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Resolves to whether the guest added the item.
|
|
25
|
+
*/
|
|
26
|
+
end: (clientX: number, clientY: number) => Promise<boolean>;
|
|
27
|
+
cancel: () => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Announced by the guest when the element the outlet will render to exists.
|
|
31
|
+
*/
|
|
32
|
+
export type SpaceExplorerOutletHandle = {
|
|
33
|
+
name: "spaceExplorer";
|
|
34
|
+
/**
|
|
35
|
+
* A stable, empty element. Must not be patched/removed by the guest
|
|
36
|
+
*/
|
|
37
|
+
element: HTMLElement;
|
|
38
|
+
/**
|
|
39
|
+
* Present when both sides declare `itemDrop`.
|
|
40
|
+
*/
|
|
41
|
+
itemDrop?: SpaceExplorerItemDrop;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The space explorer's public api. Returned after `announce`ing the feature.
|
|
45
|
+
*/
|
|
46
|
+
export type SpaceExplorerFeatureAPI = {
|
|
47
|
+
/**
|
|
48
|
+
* Shows the item: its parent folder, with the item selected. Present when
|
|
49
|
+
* the host declares `revealItem`.
|
|
50
|
+
*/
|
|
51
|
+
revealItem?: (item: {
|
|
52
|
+
spaceId: string;
|
|
53
|
+
itemId: string;
|
|
54
|
+
}) => void;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Capabilities the space explorer expects the guest to implement
|
|
58
|
+
*/
|
|
59
|
+
export type SpaceExplorerGuestCapabilities = {
|
|
60
|
+
itemDrop?: true;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Capabilities the space explorer of the host offers to the guest for public/direct usage
|
|
64
|
+
* (all behavior is normally self-contained).
|
|
65
|
+
*/
|
|
66
|
+
export type SpaceExplorerHostCapabilities = {
|
|
67
|
+
revealItem?: true;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Keep only the capabilities that this contract version knows.
|
|
71
|
+
*/
|
|
72
|
+
export declare const resolveSpaceExplorerGuestCapabilities: (declared: SpaceExplorerGuestCapabilities) => SpaceExplorerGuestCapabilities;
|
|
73
|
+
export declare const resolveSpaceExplorerHostCapabilities: (declared: SpaceExplorerHostCapabilities) => SpaceExplorerHostCapabilities;
|
|
74
|
+
//# sourceMappingURL=spaceExplorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceExplorer.d.ts","sourceRoot":"","sources":["../../../../src/embedding/outlets/spaceExplorer.ts"],"names":[],"mappings":"AAAA;;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AoC,GAC/C,UAAU,6BAA6B,KACtC,6BAED,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Toast } from '../toasts';
|
|
2
|
+
import { HostToast } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Guest: turns a toast into data the host can render. An RFC error toast
|
|
5
|
+
* keeps its error data. Any other component is dropped, because the host
|
|
6
|
+
* cannot render a component from the guest's Vue runtime.
|
|
7
|
+
*/
|
|
8
|
+
export declare const toHostToast: (toast: Toast) => HostToast;
|
|
9
|
+
/**
|
|
10
|
+
* Host: turns a toast from the guest into a toast for its own
|
|
11
|
+
* toast service context.
|
|
12
|
+
*/
|
|
13
|
+
export declare const fromHostToast: (hostToast: HostToast) => Toast;
|
|
14
|
+
//# sourceMappingURL=toasts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toasts.d.ts","sourceRoot":"","sources":["../../../src/embedding/toasts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,KAAG,SAc1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,WAAW,SAAS,KAAG,KAgBpD,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { RFCErrorToastMeta } from '../rfcErrors';
|
|
2
|
+
import { Toast } from '../toasts';
|
|
3
|
+
import { GuestCapabilities, HostCapabilities } from './capabilities';
|
|
4
|
+
import { OutletHandle, OutletName, OutletRegistry } from './outlets';
|
|
5
|
+
/**
|
|
6
|
+
* Data the host provisions before it mounts the guest.
|
|
7
|
+
*/
|
|
8
|
+
export type EmbeddingContext = {
|
|
9
|
+
/**
|
|
10
|
+
* URI of the WS connection.
|
|
11
|
+
*/
|
|
12
|
+
wsConnectionUri: string;
|
|
13
|
+
/**
|
|
14
|
+
* URI of the HTTP endpoint to fetch resources from.
|
|
15
|
+
*/
|
|
16
|
+
httpResourceUri: string;
|
|
17
|
+
/**
|
|
18
|
+
* Base URL of the Hub REST API.
|
|
19
|
+
*/
|
|
20
|
+
restApiBaseUrl: string;
|
|
21
|
+
/**
|
|
22
|
+
* Id of the job that is loaded into the executor.
|
|
23
|
+
*/
|
|
24
|
+
jobId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Time in ms without user interaction after which the user is idle.
|
|
27
|
+
*/
|
|
28
|
+
userIdleTimeout?: number;
|
|
29
|
+
analytics?: {
|
|
30
|
+
/**
|
|
31
|
+
* Whether the editor can send analytics events.
|
|
32
|
+
*/
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Property bag containing assorted data that does not strictly belong to the stable
|
|
37
|
+
* emedding context, which should be a stable contract not changing often. Properties in here
|
|
38
|
+
* should be validated by the guest before being used. An example would be passing the theme data
|
|
39
|
+
*/
|
|
40
|
+
customProperties?: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A toast as raw data.
|
|
44
|
+
*/
|
|
45
|
+
export type HostToast = Omit<Toast, "component"> & {
|
|
46
|
+
/**
|
|
47
|
+
* The host renders the content of an RFC 9457 error toast from this data.
|
|
48
|
+
*/
|
|
49
|
+
rfcError?: RFCErrorToastMeta;
|
|
50
|
+
};
|
|
51
|
+
export type NavigationIntent = {
|
|
52
|
+
intent: "reload";
|
|
53
|
+
} | {
|
|
54
|
+
intent: "go-to";
|
|
55
|
+
destination: "cloud-home";
|
|
56
|
+
openIn: "_blank" | "_self";
|
|
57
|
+
} | {
|
|
58
|
+
intent: "navigate";
|
|
59
|
+
href: string;
|
|
60
|
+
openIn: "_blank" | "_self";
|
|
61
|
+
};
|
|
62
|
+
export type UserActivity = {
|
|
63
|
+
/**
|
|
64
|
+
* - `active`: the user interacts with the guest app and no background task runs.
|
|
65
|
+
* - `idle`: the user does not interact and no background task runs.
|
|
66
|
+
* - `background-task`: a background task runs, regardless of whatever the user does.
|
|
67
|
+
* The host blocks page unload in this state.
|
|
68
|
+
*/
|
|
69
|
+
state: "active" | "idle" | "background-task";
|
|
70
|
+
/**
|
|
71
|
+
* ISO 8601 timestamp.
|
|
72
|
+
*/
|
|
73
|
+
lastActive: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* API contract for Calls from the guest to the host.
|
|
77
|
+
*/
|
|
78
|
+
export type EmbeddingHostAPI = {
|
|
79
|
+
/**
|
|
80
|
+
* Resolves to the id of the toast.
|
|
81
|
+
*/
|
|
82
|
+
showNotification: (toast: HostToast) => string;
|
|
83
|
+
clearNotification: (target: {
|
|
84
|
+
id: string;
|
|
85
|
+
} | {
|
|
86
|
+
deduplicationKey: string;
|
|
87
|
+
}) => void;
|
|
88
|
+
requestNavigation: (intent: NavigationIntent) => void;
|
|
89
|
+
reportActivity: (activity: UserActivity) => void;
|
|
90
|
+
/**
|
|
91
|
+
* Send when embedding failed to start.
|
|
92
|
+
*/
|
|
93
|
+
reportFailure: (error: {
|
|
94
|
+
message: string;
|
|
95
|
+
}) => void;
|
|
96
|
+
trackAnalytics: (event: {
|
|
97
|
+
id: string;
|
|
98
|
+
data: unknown;
|
|
99
|
+
}) => void;
|
|
100
|
+
outlets: {
|
|
101
|
+
/**
|
|
102
|
+
* Returns the feature's API of the outlet right away, before the
|
|
103
|
+
* feature renders.
|
|
104
|
+
*/
|
|
105
|
+
announce: <H extends OutletHandle>(handle: H) => OutletRegistry[H["name"]];
|
|
106
|
+
withdraw: (name: OutletName) => void;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Handle the host gets from a `mount`.
|
|
111
|
+
*/
|
|
112
|
+
export type EmbeddedGuestAPI = {
|
|
113
|
+
/**
|
|
114
|
+
* Cleanup ran inside the guest
|
|
115
|
+
*/
|
|
116
|
+
teardown: () => Promise<void>;
|
|
117
|
+
};
|
|
118
|
+
type MountOptions = {
|
|
119
|
+
context: EmbeddingContext;
|
|
120
|
+
host: EmbeddingHostAPI;
|
|
121
|
+
hostCapabilities: HostCapabilities;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Contract for mounting a guest, by loading its entry module to embed
|
|
125
|
+
*/
|
|
126
|
+
export type GuestEmbedModuleBootstrap = {
|
|
127
|
+
capabilities: GuestCapabilities;
|
|
128
|
+
mount: (shadowRoot: ShadowRoot, options: MountOptions) => EmbeddedGuestAPI;
|
|
129
|
+
};
|
|
130
|
+
export {};
|
|
131
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/embedding/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE;QACV;;WAEG;QACH,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,M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,QAAQ,EAAE,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3E,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;KACtC,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,gBAAgB,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,YAAY,EAAE,iBAAiB,CAAC;IAChC,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,KAAK,gBAAgB,CAAC;CAC5E,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { Toast } from '../toasts';
|
|
2
2
|
import { RFCError, RFCErrorData } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Key in `Toast.meta` under which `toToast` keeps the error data, so the toast
|
|
5
|
+
* can be rebuilt where its component cannot be rendered.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RFC_ERROR_TOAST_META_KEY = "rfcError";
|
|
8
|
+
export type RFCErrorToastMeta = {
|
|
9
|
+
data: RFCErrorData;
|
|
10
|
+
canCopyToClipboard?: boolean;
|
|
11
|
+
serializeErrorForClipboard?: (error: RFCErrorData, headline: string, formatDate: (date: Date) => string) => string;
|
|
12
|
+
};
|
|
3
13
|
export declare const rfcErrors: {
|
|
4
14
|
toToast: ({ headline, rfcError, canCopyToClipboard, serializeErrorForClipboard, }: {
|
|
5
15
|
headline: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rfcErrors/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAmB,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rfcErrors/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAmB,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0BAA0B,CAAC,EAAE,CAC3B,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,KAC/B,MAAM,CAAC;CACb,CAAC;AAsFF,eAAO,MAAM,SAAS;uFA5EnB;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,QAAQ,CAAC;QACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,0BAA0B,CAAC,EAAE,CAC3B,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,KAC/B,MAAM,CAAC;KACb,KAAG,KAAK;sBAuCgB,OAAO,KAAG,QAAQ,GAAG,SAAS;;CAgCtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/product-features",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Package containing composition patterns of KDS Components and KNIME business logic",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
"types": "./dist/src/dataTransfer/core.d.ts",
|
|
38
38
|
"import": "./dist/dataTransfer/core.js"
|
|
39
39
|
},
|
|
40
|
+
"./embedding": {
|
|
41
|
+
"types": "./dist/src/embedding/index.d.ts",
|
|
42
|
+
"import": "./dist/embedding.js"
|
|
43
|
+
},
|
|
40
44
|
"./embedding-sdk": {
|
|
41
45
|
"types": "./dist/src/embeddingSDK/index.d.ts",
|
|
42
46
|
"import": "./dist/embeddingSDK.js"
|
|
@@ -63,8 +67,8 @@
|
|
|
63
67
|
"CHANGELOG.md"
|
|
64
68
|
],
|
|
65
69
|
"peerDependencies": {
|
|
66
|
-
"@knime/kds-components": "^
|
|
67
|
-
"@knime/kds-styles": "^
|
|
70
|
+
"@knime/kds-components": "^13.0.0",
|
|
71
|
+
"@knime/kds-styles": "^13.0.0",
|
|
68
72
|
"@vueuse/core": "^14.0.0",
|
|
69
73
|
"es-toolkit": "^1.49.0",
|
|
70
74
|
"ofetch": "^1.5.1",
|
|
@@ -75,8 +79,8 @@
|
|
|
75
79
|
"consola": "^3.4.2"
|
|
76
80
|
},
|
|
77
81
|
"devDependencies": {
|
|
78
|
-
"@knime/kds-components": "^
|
|
79
|
-
"@knime/kds-styles": "^
|
|
82
|
+
"@knime/kds-components": "^13.0.2",
|
|
83
|
+
"@knime/kds-styles": "^13.0.2",
|
|
80
84
|
"@storybook/addon-docs": "^10.6.2",
|
|
81
85
|
"@storybook/vue3-vite": "^10.6.2",
|
|
82
86
|
"@vitejs/plugin-vue": "^6.0.8",
|