windmill-components 1.28.7 → 1.34.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 (119) hide show
  1. package/common.d.ts +3 -0
  2. package/components/AppConnect.svelte +28 -12
  3. package/components/ArgInput.svelte +25 -14
  4. package/components/ArgInput.svelte.d.ts +4 -0
  5. package/components/CenteredPage.svelte +1 -1
  6. package/components/DisplayResult.svelte +3 -3
  7. package/components/Drawer.svelte +108 -0
  8. package/components/Drawer.svelte.d.ts +23 -0
  9. package/components/Editor.svelte +70 -78
  10. package/components/Editor.svelte.d.ts +3 -0
  11. package/components/EditorBar.svelte +23 -10
  12. package/components/FlowBuilder.svelte +39 -33
  13. package/components/FlowEditor.svelte +17 -58
  14. package/components/FlowJobResult.svelte +18 -17
  15. package/components/FlowPreview.svelte +13 -34
  16. package/components/FlowPreview.svelte.d.ts +2 -4
  17. package/components/FlowPreviewContent.svelte +56 -44
  18. package/components/FlowPreviewContent.svelte.d.ts +0 -1
  19. package/components/FlowStatusViewer.svelte +123 -205
  20. package/components/FlowStatusViewer.svelte.d.ts +7 -4
  21. package/components/FlowViewer.svelte +4 -1
  22. package/components/IconedPath.svelte +12 -0
  23. package/components/IconedPath.svelte.d.ts +16 -0
  24. package/components/IconedResourceType.svelte +21 -2
  25. package/components/IconedResourceType.svelte.d.ts +1 -0
  26. package/components/InputTransformForm.svelte +9 -8
  27. package/components/InputTransformForm.svelte.d.ts +1 -1
  28. package/components/InviteGlobalUser.svelte +1 -1
  29. package/components/ItemPicker.svelte +6 -1
  30. package/components/JobStatus.svelte +1 -1
  31. package/components/ModuleStep.svelte +73 -93
  32. package/components/ModuleStep.svelte.d.ts +7 -2
  33. package/components/Path.svelte +62 -40
  34. package/components/Path.svelte.d.ts +2 -0
  35. package/components/ProgressBar.svelte +31 -0
  36. package/components/ProgressBar.svelte.d.ts +17 -0
  37. package/components/ProgressBarPart.svelte +20 -0
  38. package/components/ProgressBarPart.svelte.d.ts +20 -0
  39. package/components/ResourceEditor.svelte +2 -1
  40. package/components/ResourcePicker.svelte +9 -0
  41. package/components/SchemaForm.svelte +9 -4
  42. package/components/SchemaForm.svelte.d.ts +1 -1
  43. package/components/SchemaModal.svelte +20 -3
  44. package/components/ScriptBuilder.svelte +58 -21
  45. package/components/ScriptBuilder.svelte.d.ts +1 -0
  46. package/components/ScriptEditor.svelte +4 -2
  47. package/components/SharedBadge.svelte +8 -3
  48. package/components/VariableEditor.svelte +1 -1
  49. package/components/flows/CopyFirstStepSchema.svelte +4 -3
  50. package/components/flows/DynamicInputHelpBox.svelte +6 -4
  51. package/components/flows/DynamicInputHelpBox.svelte.d.ts +1 -1
  52. package/components/flows/FlowBox.svelte +15 -2
  53. package/components/flows/FlowBox.svelte.d.ts +14 -14
  54. package/components/flows/FlowBoxHeader.svelte +10 -3
  55. package/components/flows/FlowBoxHeader.svelte.d.ts +3 -0
  56. package/components/flows/FlowInput.svelte +14 -12
  57. package/components/flows/FlowInputs.svelte +55 -35
  58. package/components/flows/FlowInputs.svelte.d.ts +3 -1
  59. package/components/flows/FlowModuleHeader.svelte +71 -55
  60. package/components/flows/FlowModuleHeader.svelte.d.ts +6 -6
  61. package/components/flows/FlowSettings.svelte +34 -57
  62. package/components/flows/FlowSettings.svelte.d.ts +0 -1
  63. package/components/flows/FlowTimeline.svelte +169 -0
  64. package/components/flows/FlowTimeline.svelte.d.ts +21 -0
  65. package/components/flows/flowState.d.ts +14 -0
  66. package/components/flows/flowState.js +52 -0
  67. package/components/flows/flowStateUtils.d.ts +37 -0
  68. package/components/flows/flowStateUtils.js +222 -0
  69. package/components/flows/flowStore.d.ts +1 -16
  70. package/components/flows/flowStore.js +7 -208
  71. package/components/flows/pickers/FlowScriptPicker.svelte +5 -9
  72. package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +0 -1
  73. package/components/flows/pickers/PickHubScript.svelte +1 -1
  74. package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -1
  75. package/components/flows/pickers/PickScript.svelte +1 -1
  76. package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
  77. package/components/flows/scheduleUtils.d.ts +7 -0
  78. package/components/flows/scheduleUtils.js +21 -0
  79. package/components/flows/stepOpenedStore.d.ts +1 -0
  80. package/components/flows/stepOpenedStore.js +6 -0
  81. package/components/flows/utils.d.ts +5 -12
  82. package/components/flows/utils.js +40 -112
  83. package/components/icons/DiscordIcon.svelte +16 -0
  84. package/components/icons/DiscordIcon.svelte.d.ts +17 -0
  85. package/components/icons/HttpIcon.svelte +21 -0
  86. package/components/icons/HttpIcon.svelte.d.ts +17 -0
  87. package/components/icons/MastodonIcon.svelte +16 -0
  88. package/components/icons/MastodonIcon.svelte.d.ts +17 -0
  89. package/components/icons/MatrixIcon.svelte +16 -0
  90. package/components/icons/MatrixIcon.svelte.d.ts +17 -0
  91. package/components/icons/S3Icon.svelte +16 -0
  92. package/components/icons/S3Icon.svelte.d.ts +17 -0
  93. package/components/icons/WindmillIcon.svelte +68 -0
  94. package/components/icons/WindmillIcon.svelte.d.ts +17 -0
  95. package/components/preview/FlowPreviewStatus.svelte +28 -0
  96. package/components/preview/FlowPreviewStatus.svelte.d.ts +17 -0
  97. package/components/propertyPicker/ObjectViewer.svelte +13 -13
  98. package/components/propertyPicker/utils.js +3 -2
  99. package/components/tabs/Tab.svelte +12 -0
  100. package/components/tabs/Tab.svelte.d.ts +19 -0
  101. package/components/tabs/TabPanel.svelte +11 -0
  102. package/components/tabs/TabPanel.svelte.d.ts +20 -0
  103. package/components/tabs/Tabs.svelte +3 -0
  104. package/components/tabs/Tabs.svelte.d.ts +23 -0
  105. package/gen/core/OpenAPI.js +1 -1
  106. package/gen/core/request.js +1 -0
  107. package/gen/models/MainArgSignature.d.ts +14 -3
  108. package/gen/services/JobService.d.ts +10 -2
  109. package/gen/services/JobService.js +4 -2
  110. package/gen/services/ScriptService.d.ts +18 -0
  111. package/gen/services/ScriptService.js +30 -0
  112. package/infer.js +47 -24
  113. package/package.json +39 -20
  114. package/script_helpers.d.ts +4 -1
  115. package/script_helpers.js +68 -17
  116. package/stores.d.ts +1 -2
  117. package/stores.js +1 -4
  118. package/utils.d.ts +4 -2
  119. package/utils.js +33 -5
package/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { type Flow, type User } from './gen';
1
+ import { type Flow, type FlowModule, type User } from './gen';
2
2
  import type { Schema } from './common';
3
3
  import { type UserExt } from './stores';
4
+ export declare function validateUsername(username: string): string;
4
5
  export declare function isToday(someDate: Date): boolean;
5
6
  export declare function daysAgo(someDate: Date): number;
6
7
  export declare function secondsAgo(date: Date): number;
@@ -31,6 +32,7 @@ export declare function emptySchema(): {
31
32
  required: never[];
32
33
  type: string;
33
34
  };
35
+ export declare function emptyModule(): FlowModule;
34
36
  export declare function simpleSchema(): {
35
37
  $schema: string;
36
38
  type: string;
@@ -66,7 +68,7 @@ export declare function schemaToTsType(schema: Schema): string;
66
68
  export declare function schemaToObject(schema: Schema, args: Record<string, any>): Object;
67
69
  export declare function valueToTsType(value: any): string;
68
70
  export declare function objectToTsType(object: Object): string;
69
- export declare type InputCat = "string" | "number" | "boolean" | "list" | "resource-object" | "enum" | "date" | "base64" | "resource-string" | "object" | "sql";
71
+ export declare type InputCat = 'string' | 'number' | 'boolean' | 'list' | 'resource-object' | 'enum' | 'date' | 'base64' | 'resource-string' | 'object' | 'sql';
70
72
  export declare function setInputCat(type: string | undefined, format: string | undefined, itemsType: string | undefined, enum_: any, contentEncoding: string | undefined): InputCat;
71
73
  export declare function scriptPathToHref(path: string): string;
72
74
  export declare function getScriptByPath(path: string): Promise<{
package/utils.js CHANGED
@@ -4,6 +4,14 @@ import { FlowService, ScriptService } from './gen';
4
4
  import { toast } from '@zerodevx/svelte-toast';
5
5
  import { get } from 'svelte/store';
6
6
  import { hubScripts, workspaceStore } from './stores';
7
+ export function validateUsername(username) {
8
+ if (username != '' && !/^\w+$/.test(username)) {
9
+ return 'username can only contain letters and numbers';
10
+ }
11
+ else {
12
+ return '';
13
+ }
14
+ }
7
15
  export function isToday(someDate) {
8
16
  const today = new Date();
9
17
  return (someDate.getDate() == today.getDate() &&
@@ -27,7 +35,13 @@ export function displayDaysAgo(dateString) {
27
35
  return `today at ${date.toLocaleTimeString()}`;
28
36
  }
29
37
  else {
30
- return `${daysAgo(date) + 1} days ago`;
38
+ let dAgo = daysAgo(date);
39
+ if (dAgo == 0) {
40
+ return `yday at ${date.toLocaleTimeString()}`;
41
+ }
42
+ else {
43
+ return `${dAgo + 1} days ago`;
44
+ }
31
45
  }
32
46
  }
33
47
  export function displayDate(dateString) {
@@ -97,6 +111,12 @@ export function emptySchema() {
97
111
  type: 'object'
98
112
  };
99
113
  }
114
+ export function emptyModule() {
115
+ return {
116
+ value: { type: 'script', path: '' },
117
+ input_transform: {}
118
+ };
119
+ }
100
120
  export function simpleSchema() {
101
121
  return {
102
122
  $schema: 'https://json-schema.org/draft/2020-12/schema',
@@ -204,6 +224,9 @@ export function groupBy(scripts, toGroup, dflts = []) {
204
224
  });
205
225
  }
206
226
  export function truncate(s, n, suffix = '...') {
227
+ if (!s) {
228
+ return suffix;
229
+ }
207
230
  if (s.length <= n) {
208
231
  return s;
209
232
  }
@@ -212,6 +235,9 @@ export function truncate(s, n, suffix = '...') {
212
235
  }
213
236
  }
214
237
  export function truncateRev(s, n, prefix = '...') {
238
+ if (!s) {
239
+ return prefix;
240
+ }
215
241
  if (s.length <= n) {
216
242
  return s;
217
243
  }
@@ -397,16 +423,18 @@ export async function getScriptByPath(path) {
397
423
  }
398
424
  export async function loadHubScripts() {
399
425
  const scripts = (await ScriptService.listHubScripts()).asks ?? [];
400
- const processed = scripts.map((x) => ({
401
- path: `hub/${x.id}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
426
+ const processed = scripts
427
+ .map((x) => ({
428
+ path: `hub/${x.id}/${x.app}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
402
429
  summary: `${x.summary} (${x.app}) ${x.views} uses`,
403
430
  approved: x.approved,
404
431
  is_trigger: x.is_trigger,
405
432
  app: x.app,
406
433
  views: x.views,
407
434
  votes: x.votes,
408
- ask_id: x.ask_id,
409
- })).sort((a, b) => b.views - a.views);
435
+ ask_id: x.ask_id
436
+ }))
437
+ .sort((a, b) => b.views - a.views);
410
438
  hubScripts.set(processed);
411
439
  }
412
440
  export async function loadHubFlows() {