@knime/hub-features 1.27.0 → 1.29.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +4 -4
  3. package/src/analytics/analytics.ts +39 -13
  4. package/src/analytics/schema/cloudhome-event-functions.ts +245 -0
  5. package/src/analytics/schema/code-generator.js +17 -8
  6. package/src/analytics/schema/{event-functions.ts → editor-event-functions.ts} +7 -9
  7. package/src/analytics/schema/schema.d.ts +133 -7
  8. package/src/analytics/schema/schema.json +833 -157
  9. package/src/analytics/types.ts +4 -1
  10. package/src/httpClient/constants.ts +1 -0
  11. package/src/{common/ofetchClient.ts → httpClient/createHttpClient.ts} +6 -5
  12. package/src/httpClient/index.ts +2 -0
  13. package/src/index.ts +1 -0
  14. package/src/useDownloadArtifact/useDownloadArtifact.ts +2 -2
  15. package/src/useFileUpload/useFileUpload.ts +2 -2
  16. package/src/common/constants.ts +0 -1
  17. package/src/components/versions/components/CreateVersionForm.vue +0 -155
  18. package/src/components/versions/components/CurrentState.vue +0 -258
  19. package/src/components/versions/components/LabelList.vue +0 -253
  20. package/src/components/versions/components/ManageVersions.vue +0 -191
  21. package/src/components/versions/components/NoVersionItem.vue +0 -23
  22. package/src/components/versions/components/VersionHistory.vue +0 -138
  23. package/src/components/versions/components/VersionItem.vue +0 -278
  24. package/src/components/versions/components/VersionLimitInfo.vue +0 -37
  25. package/src/components/versions/composables/useVersionsApi.ts +0 -254
  26. package/src/components/versions/constants.ts +0 -3
  27. package/src/components/versions/index.ts +0 -7
  28. package/src/components/versions/types.ts +0 -77
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @knime/hub-features
2
2
 
3
+ ## 1.29.0
4
+
5
+ ### Minor Changes
6
+
7
+ - da43d97: Migrate from versions:
8
+
9
+ - `ManageVersions` component -> KDS `VersionHistory` component
10
+ - `CreateVersionForm` component -> KDS `CreateVersionForm` component
11
+ - `useVersionsApi` composable -> knime-ui `useVersionsApi` composable
12
+
13
+ Add new export to `hub-features` - `httpClient` - moved from `hub-features/common`.
14
+
15
+ ### Patch Changes
16
+
17
+ - ee02850: Minor changes to analytics event:
18
+
19
+ - rename from "my" secrets to "personal" secrets in cloud home events
20
+ - made the location value `noderepository` into `node_repository` in editor events to be more consistent with others
21
+ - deambiguate events for annotation created and annotation explain via kai
22
+
23
+ ## 1.28.0
24
+
25
+ ### Minor Changes
26
+
27
+ - 2908385: - split returned events based on event source (editor/cloudhome)
28
+ - add secret created event (cloudhome)
29
+ - introduce page property to interaction property (only for cloudhome events)
30
+
31
+ ### Patch Changes
32
+
33
+ - a2f988b: add cloudhome events for creating and sharing deployments
34
+
3
35
  ## 1.27.0
4
36
 
5
37
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/hub-features",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "Vue components & composables for shared hub features",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,11 +24,11 @@
24
24
  ".": {
25
25
  "import": "./src/index.ts"
26
26
  },
27
- "./versions": {
28
- "import": "./src/components/versions/index.ts"
29
- },
30
27
  "./analytics": {
31
28
  "import": "./src/analytics/index.ts"
29
+ },
30
+ "./http-client": {
31
+ "import": "./src/httpClient/index.ts"
32
32
  }
33
33
  },
34
34
  "dependencies": {
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import * as functions from "./schema/event-functions";
2
+ import * as cloudHomeFunctions from "./schema/cloudhome-event-functions";
3
+ import * as editorFunctions from "./schema/editor-event-functions";
3
4
  import type {
4
5
  AnalyticsEvent,
5
6
  AnalyticsEventSender,
@@ -22,26 +23,51 @@ type UnwrapFunction<T> = T extends (ctx: DefaultContext) => infer R
22
23
  : never
23
24
  : never;
24
25
 
25
- type FunctionMap = typeof functions;
26
- type Names = keyof FunctionMap;
27
- type BuilderFunctions = {
28
- [K in Names]: UnwrapFunction<(typeof functions)[K]>;
26
+ type EditorFunctionMap = typeof editorFunctions;
27
+ type CloudHomeFunctionMap = typeof cloudHomeFunctions;
28
+
29
+ type EditorBuilderFunctions = {
30
+ [K in keyof EditorFunctionMap]: UnwrapFunction<EditorFunctionMap[K]>;
31
+ };
32
+ type CloudHomeBuilderFunctions = {
33
+ [K in keyof CloudHomeFunctionMap]: UnwrapFunction<CloudHomeFunctionMap[K]>;
29
34
  };
30
35
 
31
- type SenderFunctions = {
32
- [K in Names]: (...args: Parameters<BuilderFunctions[K]>) => void;
36
+ type EditorSenderFunctions = {
37
+ [K in keyof EditorBuilderFunctions]: (
38
+ ...args: Parameters<EditorBuilderFunctions[K]>
39
+ ) => void;
40
+ };
41
+ type CloudHomeSenderFunctions = {
42
+ [K in keyof CloudHomeBuilderFunctions]: (
43
+ ...args: Parameters<CloudHomeBuilderFunctions[K]>
44
+ ) => void;
33
45
  };
34
46
 
47
+ type BuilderFunctions<T extends DefaultContext> =
48
+ T["eventSource"] extends "editor"
49
+ ? EditorBuilderFunctions
50
+ : CloudHomeBuilderFunctions;
51
+
52
+ type SenderFunctions<T extends DefaultContext> =
53
+ T["eventSource"] extends "editor"
54
+ ? EditorSenderFunctions
55
+ : CloudHomeSenderFunctions;
56
+
35
57
  /**
36
58
  * This function creates an event builder, which lets you construct correct and strongly-typed
37
59
  * event payloads according to the current schema used by this package
38
60
  * @param context
39
61
  * @returns
40
62
  */
41
- function eventBuilder<T extends DefaultContext>(context: T) {
63
+ function eventBuilder<T extends DefaultContext>(
64
+ context: T,
65
+ ): BuilderFunctions<T> {
42
66
  const unwrapped = Object.fromEntries(
43
- Object.entries(functions).map(([name, fn]) => [name, fn(context)]),
44
- ) as BuilderFunctions;
67
+ Object.entries(
68
+ context.eventSource === "editor" ? editorFunctions : cloudHomeFunctions,
69
+ ).map(([name, fn]) => [name, fn(context)]),
70
+ ) as BuilderFunctions<T>;
45
71
 
46
72
  return { ...unwrapped };
47
73
  }
@@ -67,12 +93,12 @@ export const analyticsEvents = Object.freeze({
67
93
 
68
94
  type AnyFn = (...args: any[]) => any;
69
95
 
70
- const wrapper: SenderFunctions = {} as SenderFunctions;
96
+ const wrapper = {} as SenderFunctions<T>;
71
97
 
72
98
  // keep all the same functions of the builder but wrap around them for extra behavior
73
99
  Object.keys(builder).forEach((fnName) => {
74
- const key = fnName as keyof SenderFunctions;
75
- wrapper[key] = (...args: any[]) => {
100
+ const key = fnName as keyof SenderFunctions<T>;
101
+ (wrapper as any)[key] = (...args: any[]) => {
76
102
  // TS issue:
77
103
  // ```A spread argument must either have a tuple type or be passed to a rest parameter.```
78
104
  // This happens because when calling the methods generically, TS tries to join all function signatures
@@ -0,0 +1,245 @@
1
+ /* eslint-disable */
2
+ // AUTO-GENERATED FILE. DO NOT EDIT.
3
+ import type { AnalyticsEvent, DefaultContext, EventFunctionArgs, GeneratedStaticFields, SchemaStaticFields } from "../types";
4
+ import { toSnakeCaseDeep } from "../utils/toSnakeCaseDeep";
5
+
6
+ /**
7
+ * Fired when the user clicks Run from the deployments page
8
+ */
9
+ export const adHocExecutionStartedDeploymentsPage = <T extends DefaultContext>(ctx: T) => (): AnalyticsEvent => {
10
+ const staticData = {
11
+ ...toSnakeCaseDeep(ctx),
12
+ unique_event_id: crypto.randomUUID(),
13
+ timestamp: new Date().toISOString(),
14
+ event_name: "adhoc_execution_started",
15
+ event_source: "cloudhome",
16
+ event_display_name: "Ad Hoc Execution Started",
17
+ interaction: {
18
+ location: "main_area",
19
+ page: "deployments",
20
+ trigger: "user",
21
+ type: "click",
22
+ },
23
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
24
+
25
+ const event = { id: staticData.event_name, data: { ...staticData } };
26
+
27
+ return event;
28
+ };
29
+
30
+ /**
31
+ * Fired when the user clicks Run in the ad hoc execution panel
32
+ */
33
+ export const adHocExecutionStartedExecutionPanel = <T extends DefaultContext>(ctx: T) => (): AnalyticsEvent => {
34
+ const staticData = {
35
+ ...toSnakeCaseDeep(ctx),
36
+ unique_event_id: crypto.randomUUID(),
37
+ timestamp: new Date().toISOString(),
38
+ event_name: "adhoc_execution_started",
39
+ event_source: "cloudhome",
40
+ event_display_name: "Ad Hoc Execution Started",
41
+ interaction: {
42
+ location: "contextual_side_panel",
43
+ page: "workflow_details",
44
+ trigger: "user",
45
+ type: "click",
46
+ },
47
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
48
+
49
+ const event = { id: staticData.event_name, data: { ...staticData } };
50
+
51
+ return event;
52
+ };
53
+
54
+ /**
55
+ * Fired when the user clicks Run from the workflow page
56
+ */
57
+ export const adHocExecutionStartedWorkflowPage = <T extends DefaultContext>(ctx: T) => (): AnalyticsEvent => {
58
+ const staticData = {
59
+ ...toSnakeCaseDeep(ctx),
60
+ unique_event_id: crypto.randomUUID(),
61
+ timestamp: new Date().toISOString(),
62
+ event_name: "adhoc_execution_started",
63
+ event_source: "cloudhome",
64
+ event_display_name: "Ad Hoc Execution Started",
65
+ interaction: {
66
+ location: "main_area",
67
+ page: "workflow_details",
68
+ trigger: "user",
69
+ type: "click",
70
+ },
71
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
72
+
73
+ const event = { id: staticData.event_name, data: { ...staticData } };
74
+
75
+ return event;
76
+ };
77
+
78
+ /**
79
+ * Fired when the user creates a new secret by clicking Create in the side panel on the team secrets page
80
+ */
81
+ export const secretCreatedTeamSecrets = <T extends DefaultContext>(ctx: T) => (): AnalyticsEvent => {
82
+ const staticData = {
83
+ ...toSnakeCaseDeep(ctx),
84
+ unique_event_id: crypto.randomUUID(),
85
+ timestamp: new Date().toISOString(),
86
+ event_name: "secret_created",
87
+ event_source: "cloudhome",
88
+ event_display_name: "Secret Created",
89
+ interaction: {
90
+ location: "contextual_side_panel",
91
+ page: "team_secrets",
92
+ trigger: "user",
93
+ type: "click",
94
+ },
95
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
96
+
97
+ const event = { id: staticData.event_name, data: { ...staticData } };
98
+
99
+ return event;
100
+ };
101
+
102
+ /**
103
+ * Fired when the user creates a new secret by clicking Create in the side panel on the personal secrets page
104
+ */
105
+ export const secretCreatedPersonalSecrets = <T extends DefaultContext>(ctx: T) => (): AnalyticsEvent => {
106
+ const staticData = {
107
+ ...toSnakeCaseDeep(ctx),
108
+ unique_event_id: crypto.randomUUID(),
109
+ timestamp: new Date().toISOString(),
110
+ event_name: "secret_created",
111
+ event_source: "cloudhome",
112
+ event_display_name: "Secret Created",
113
+ interaction: {
114
+ location: "contextual_side_panel",
115
+ page: "personal_secrets",
116
+ trigger: "user",
117
+ type: "click",
118
+ },
119
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
120
+
121
+ const event = { id: staticData.event_name, data: { ...staticData } };
122
+
123
+ return event;
124
+ };
125
+
126
+ /**
127
+ * Fired when the user clicks the Create button in the deployment creation side panel
128
+ */
129
+ export const deploymentCreated = <T extends DefaultContext>(ctx: T) => (eventData: EventFunctionArgs<"deploymentCreated">): AnalyticsEvent => {
130
+ const staticData = {
131
+ ...toSnakeCaseDeep(ctx),
132
+ unique_event_id: crypto.randomUUID(),
133
+ timestamp: new Date().toISOString(),
134
+ event_name: "deployment_created",
135
+ event_source: "cloudhome",
136
+ event_display_name: "Deployment Created",
137
+ interaction: {
138
+ location: "contextual_side_panel",
139
+ page: "deployments",
140
+ trigger: "user",
141
+ type: "click",
142
+ },
143
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
144
+
145
+ const event = { id: staticData.event_name, data: { ...staticData, payload: { ...toSnakeCaseDeep(eventData as Record<string, any>) } } };
146
+
147
+ return event;
148
+ };
149
+
150
+ /**
151
+ * Fired when the user shares a deployment via the access management side panel on the deployments page
152
+ */
153
+ export const deploymentSharedDeploymentsAccessPanel = <T extends DefaultContext>(ctx: T) => (eventData: EventFunctionArgs<"deploymentSharedDeploymentsAccessPanel">): AnalyticsEvent => {
154
+ const staticData = {
155
+ ...toSnakeCaseDeep(ctx),
156
+ unique_event_id: crypto.randomUUID(),
157
+ timestamp: new Date().toISOString(),
158
+ event_name: "deployment_shared",
159
+ event_source: "cloudhome",
160
+ event_display_name: "Deployment Shared",
161
+ interaction: {
162
+ location: "contextual_side_panel",
163
+ page: "deployments",
164
+ trigger: "user",
165
+ type: "click",
166
+ },
167
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
168
+
169
+ const event = { id: staticData.event_name, data: { ...staticData, payload: { ...toSnakeCaseDeep(eventData as Record<string, any>) } } };
170
+
171
+ return event;
172
+ };
173
+
174
+ /**
175
+ * Fired when the user shares a deployment via the sharing popup on the deployments page
176
+ */
177
+ export const deploymentSharedDeploymentsSharingPopup = <T extends DefaultContext>(ctx: T) => (eventData: EventFunctionArgs<"deploymentSharedDeploymentsSharingPopup">): AnalyticsEvent => {
178
+ const staticData = {
179
+ ...toSnakeCaseDeep(ctx),
180
+ unique_event_id: crypto.randomUUID(),
181
+ timestamp: new Date().toISOString(),
182
+ event_name: "deployment_shared",
183
+ event_source: "cloudhome",
184
+ event_display_name: "Deployment Shared",
185
+ interaction: {
186
+ location: "popup",
187
+ page: "deployments",
188
+ trigger: "user",
189
+ type: "click",
190
+ },
191
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
192
+
193
+ const event = { id: staticData.event_name, data: { ...staticData, payload: { ...toSnakeCaseDeep(eventData as Record<string, any>) } } };
194
+
195
+ return event;
196
+ };
197
+
198
+ /**
199
+ * Fired when the user shares a deployment via the access management side panel on the workflow page
200
+ */
201
+ export const deploymentSharedWorkflowAccessPanel = <T extends DefaultContext>(ctx: T) => (eventData: EventFunctionArgs<"deploymentSharedWorkflowAccessPanel">): AnalyticsEvent => {
202
+ const staticData = {
203
+ ...toSnakeCaseDeep(ctx),
204
+ unique_event_id: crypto.randomUUID(),
205
+ timestamp: new Date().toISOString(),
206
+ event_name: "deployment_shared",
207
+ event_source: "cloudhome",
208
+ event_display_name: "Deployment Shared",
209
+ interaction: {
210
+ location: "contextual_side_panel",
211
+ page: "workflow_details",
212
+ trigger: "user",
213
+ type: "click",
214
+ },
215
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
216
+
217
+ const event = { id: staticData.event_name, data: { ...staticData, payload: { ...toSnakeCaseDeep(eventData as Record<string, any>) } } };
218
+
219
+ return event;
220
+ };
221
+
222
+ /**
223
+ * Fired when the user shares a deployment via the sharing popup on the workflow page
224
+ */
225
+ export const deploymentSharedWorkflowSharingPopup = <T extends DefaultContext>(ctx: T) => (eventData: EventFunctionArgs<"deploymentSharedWorkflowSharingPopup">): AnalyticsEvent => {
226
+ const staticData = {
227
+ ...toSnakeCaseDeep(ctx),
228
+ unique_event_id: crypto.randomUUID(),
229
+ timestamp: new Date().toISOString(),
230
+ event_name: "deployment_shared",
231
+ event_source: "cloudhome",
232
+ event_display_name: "Deployment Shared",
233
+ interaction: {
234
+ location: "popup",
235
+ page: "workflow_details",
236
+ trigger: "user",
237
+ type: "click",
238
+ },
239
+ } satisfies SchemaStaticFields & GeneratedStaticFields;
240
+
241
+ const event = { id: staticData.event_name, data: { ...staticData, payload: { ...toSnakeCaseDeep(eventData as Record<string, any>) } } };
242
+
243
+ return event;
244
+ };
245
+
@@ -4,7 +4,11 @@ import { fileURLToPath } from "node:url";
4
4
 
5
5
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
6
  const schemaPath = path.join(__dirname, "schema.json");
7
- const outputPath = path.join(__dirname, "event-functions.ts");
7
+ const editorOutputPath = path.join(__dirname, "editor-event-functions.ts");
8
+ const cloudHomeOutputPath = path.join(
9
+ __dirname,
10
+ "cloudhome-event-functions.ts",
11
+ );
8
12
 
9
13
  const schema = JSON.parse(fs.readFileSync(schemaPath, "utf8"));
10
14
  const events = schema.properties.events.properties;
@@ -18,14 +22,13 @@ const TYPE_HELPERS = {
18
22
  };
19
23
 
20
24
  const HEADER_LINES = [
21
- "/* eslint-disable max-lines */",
22
- "/* eslint-disable camelcase */",
23
- "/* eslint-disable @typescript-eslint/no-explicit-any */",
25
+ "/* eslint-disable */",
24
26
  "// AUTO-GENERATED FILE. DO NOT EDIT.",
25
27
  `import type { ${Object.values(TYPE_HELPERS).join(", ")} } from "../types";`,
26
28
  'import { toSnakeCaseDeep } from "../utils/toSnakeCaseDeep";',
27
29
  ];
28
- const result = [];
30
+ const editorResult = [];
31
+ const cloudHomeResult = [];
29
32
 
30
33
  /**
31
34
  * Generic event definition, read from the schema.json.
@@ -137,11 +140,17 @@ for (const [fnName, eventDef] of Object.entries(events)) {
137
140
  fn = `${jsdoc}\n${fn}`;
138
141
  }
139
142
 
140
- result.push(fn);
143
+ if (eventDef.properties.event_source.const === "editor") {
144
+ editorResult.push(fn);
145
+ } else if (eventDef.properties.event_source.const === "cloudhome") {
146
+ cloudHomeResult.push(fn);
147
+ }
141
148
  }
142
149
 
143
- const fileContent = `${HEADER_LINES.join("\n")}\n\n${result.join("")}`;
150
+ const editorFileContent = `${HEADER_LINES.join("\n")}\n\n${editorResult.join("")}`;
151
+ const cloudHomeFileContent = `${HEADER_LINES.join("\n")}\n\n${cloudHomeResult.join("")}`;
144
152
 
145
- fs.writeFileSync(outputPath, fileContent, "utf8");
153
+ fs.writeFileSync(editorOutputPath, editorFileContent, "utf8");
154
+ fs.writeFileSync(cloudHomeOutputPath, cloudHomeFileContent, "utf8");
146
155
  // eslint-disable-next-line no-console
147
156
  console.log("Generated static data based on the Events JSON Schema.");
@@ -1,6 +1,4 @@
1
- /* eslint-disable max-lines */
2
- /* eslint-disable camelcase */
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+ /* eslint-disable */
4
2
  // AUTO-GENERATED FILE. DO NOT EDIT.
5
3
  import type { AnalyticsEvent, DefaultContext, EventFunctionArgs, GeneratedStaticFields, SchemaStaticFields } from "../types";
6
4
  import { toSnakeCaseDeep } from "../utils/toSnakeCaseDeep";
@@ -177,7 +175,7 @@ export const annotationCreatedKaiExplain = <T extends DefaultContext>(ctx: T) =>
177
175
  ...toSnakeCaseDeep(ctx),
178
176
  unique_event_id: crypto.randomUUID(),
179
177
  timestamp: new Date().toISOString(),
180
- event_name: "annotation_created",
178
+ event_name: "annotation_created_kai_explain",
181
179
  event_source: "editor",
182
180
  event_display_name: "Annotation Created",
183
181
  interaction: {
@@ -303,7 +301,7 @@ export const nodeCreatedNodeRepoDragDrop = <T extends DefaultContext>(ctx: T) =>
303
301
  event_source: "editor",
304
302
  event_display_name: "Node Created",
305
303
  interaction: {
306
- location: "noderepository",
304
+ location: "node_repository",
307
305
  trigger: "user",
308
306
  type: "drag_drop",
309
307
  },
@@ -323,7 +321,7 @@ export const nodeCreatedNodeRepoDoubleClick = <T extends DefaultContext>(ctx: T)
323
321
  event_source: "editor",
324
322
  event_display_name: "Node Created",
325
323
  interaction: {
326
- location: "noderepository",
324
+ location: "node_repository",
327
325
  trigger: "user",
328
326
  type: "double_click",
329
327
  },
@@ -343,7 +341,7 @@ export const nodeCreatedNodeRepoKeyboard = <T extends DefaultContext>(ctx: T) =>
343
341
  event_source: "editor",
344
342
  event_display_name: "Node Created",
345
343
  interaction: {
346
- location: "noderepository",
344
+ location: "node_repository",
347
345
  trigger: "user",
348
346
  type: "key_press",
349
347
  },
@@ -544,7 +542,7 @@ export const nodeSearchedNodeRepo = <T extends DefaultContext>(ctx: T) => (event
544
542
  event_source: "editor",
545
543
  event_display_name: "Node Searched",
546
544
  interaction: {
547
- location: "noderepository",
545
+ location: "node_repository",
548
546
  trigger: "user",
549
547
  type: "key_press",
550
548
  },
@@ -604,7 +602,7 @@ export const nodeRepositoryOpened = <T extends DefaultContext>(ctx: T) => (): An
604
602
  event_source: "editor",
605
603
  event_display_name: "Node Repository Opened",
606
604
  interaction: {
607
- location: "noderepository",
605
+ location: "node_repository",
608
606
  trigger: "user",
609
607
  type: "click",
610
608
  },