windmill-components 1.13.7 → 1.13.10

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 (39) hide show
  1. package/components/ArgInfo.svelte +1 -1
  2. package/components/FlowBuilder.svelte +1 -1
  3. package/components/FlowBuilder.svelte.d.ts +1 -1
  4. package/components/FlowEditor.svelte +3 -2
  5. package/components/FlowEditor.svelte.d.ts +1 -1
  6. package/components/FlowPreview.svelte +1 -1
  7. package/components/FlowPreview.svelte.d.ts +1 -1
  8. package/components/FlowStatusViewer.svelte +1 -1
  9. package/components/FlowStatusViewer.svelte.d.ts +1 -1
  10. package/components/GroupModal.svelte +1 -1
  11. package/components/InviteGlobalUser.svelte +1 -1
  12. package/components/InviteUser.svelte +1 -1
  13. package/components/JobStatus.svelte.d.ts +1 -1
  14. package/components/ModuleStep.svelte +2 -1
  15. package/components/ModuleStep.svelte.d.ts +1 -1
  16. package/components/ObjectResourceInput.svelte +1 -1
  17. package/components/Path.svelte +1 -1
  18. package/components/ResourceEditor.svelte +1 -1
  19. package/components/ResourcePicker.svelte +1 -1
  20. package/components/ResourceTypePicker.svelte +1 -1
  21. package/components/RunForm.svelte.d.ts +1 -1
  22. package/components/ScriptBuilder.svelte +1 -1
  23. package/components/ScriptBuilder.svelte.d.ts +1 -1
  24. package/components/ScriptEditor.svelte +1 -1
  25. package/components/ScriptPicker.svelte +1 -1
  26. package/components/ShareModal.svelte +1 -1
  27. package/components/VariableEditor.svelte +1 -1
  28. package/infer.d.ts +1 -1
  29. package/infer.js +2 -2
  30. package/logout.js +3 -3
  31. package/package.json +4 -2
  32. package/scripts.d.ts +1 -0
  33. package/scripts.js +20 -0
  34. package/stores.d.ts +1 -1
  35. package/stores.js +1 -1
  36. package/user.d.ts +3 -0
  37. package/user.js +31 -0
  38. package/utils.d.ts +1 -6
  39. package/utils.js +0 -47
@@ -4,7 +4,7 @@ import Tooltip from './Tooltip.svelte';
4
4
  import json from 'svelte-highlight/languages/json';
5
5
  import github from 'svelte-highlight/styles/github';
6
6
  import { Highlight } from 'svelte-highlight';
7
- import { ResourceService } from '../gen/index';
7
+ import { ResourceService } from '../gen/index.js';
8
8
  import { workspaceStore } from '../stores';
9
9
  export let value;
10
10
  let resourceViewer;
@@ -1,4 +1,4 @@
1
- <script>import { FlowService } from '../gen/index';
1
+ <script>import { FlowService } from '../gen/index.js';
2
2
  import { sendUserToast } from '../utils';
3
3
  import { page } from '$app/stores';
4
4
  import { goto } from '$app/navigation';
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Flow } from '../gen/index';
2
+ import { type Flow } from '../gen/index.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  flow: Flow;
@@ -1,11 +1,12 @@
1
1
  <script>import { faPlus } from '@fortawesome/free-solid-svg-icons';
2
- import { emptySchema, loadSchema } from '../utils';
2
+ import { emptySchema } from '../utils';
3
3
  import Icon from 'svelte-awesome';
4
- import { FlowModuleValue, ScriptService } from '../gen/index';
4
+ import { FlowModuleValue, ScriptService } from '../gen/index.js';
5
5
  import SchemaEditor from './SchemaEditor.svelte';
6
6
  import { workspaceStore } from '../stores';
7
7
  import ModuleStep from './ModuleStep.svelte';
8
8
  import FlowPreview from './FlowPreview.svelte';
9
+ import { loadSchema } from '../scripts';
9
10
  export let flow;
10
11
  let args = {};
11
12
  let schemas = [];
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Flow } from '../gen/index';
2
+ import { type Flow } from '../gen/index.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  flow: Flow;
@@ -1,7 +1,7 @@
1
1
  <script>import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
2
2
  import { sendUserToast, truncateRev } from '../utils';
3
3
  import Icon from 'svelte-awesome';
4
- import { Job, JobService, InputTransform } from '../gen/index';
4
+ import { Job, JobService, InputTransform } from '../gen/index.js';
5
5
  import { workspaceStore } from '../stores';
6
6
  import RunForm from './RunForm.svelte';
7
7
  import FlowStatusViewer from './FlowStatusViewer.svelte';
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Flow } from '../gen/index';
2
+ import { type Flow } from '../gen/index.js';
3
3
  import type { Schema } from '../common';
4
4
  declare const __propDef: {
5
5
  props: {
@@ -2,7 +2,7 @@
2
2
  import { truncateRev } from '../utils';
3
3
  import Icon from 'svelte-awesome';
4
4
  import { check } from 'svelte-awesome/icons';
5
- import { CompletedJob, FlowModuleValue, FlowStatusModule, JobService, QueuedJob } from '../gen/index';
5
+ import { CompletedJob, FlowModuleValue, FlowStatusModule, JobService, QueuedJob } from '../gen/index.js';
6
6
  import { workspaceStore } from '../stores';
7
7
  import DisplayResult from './DisplayResult.svelte';
8
8
  import ChevronButton from './ChevronButton.svelte';
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { CompletedJob, QueuedJob } from '../gen/index';
2
+ import { CompletedJob, QueuedJob } from '../gen/index.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  job: QueuedJob | CompletedJob;
@@ -1,6 +1,6 @@
1
1
  <script>import { userStore, workspaceStore } from '../stores';
2
2
  import Modal from './Modal.svelte';
3
- import { GroupService, UserService } from '../gen/index';
3
+ import { GroupService, UserService } from '../gen/index.js';
4
4
  import AutoComplete from 'simple-svelte-autocomplete';
5
5
  import PageHeader from './PageHeader.svelte';
6
6
  import TableCustom from './TableCustom.svelte';
@@ -1,7 +1,7 @@
1
1
  <script>import { sendUserToast } from '../utils';
2
2
  import Switch from './Switch.svelte';
3
3
  import { createEventDispatcher } from 'svelte';
4
- import { UserService } from '../gen/index';
4
+ import { UserService } from '../gen/index.js';
5
5
  const dispatch = createEventDispatcher();
6
6
  let valid = true;
7
7
  let modal;
@@ -2,7 +2,7 @@
2
2
  import Switch from './Switch.svelte';
3
3
  import { createEventDispatcher } from 'svelte';
4
4
  import { workspaceStore } from '../stores';
5
- import { WorkspaceService } from '../gen/index';
5
+ import { WorkspaceService } from '../gen/index.js';
6
6
  const dispatch = createEventDispatcher();
7
7
  let valid = true;
8
8
  let modal;
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { CompletedJob, QueuedJob } from '../gen/index';
2
+ import type { CompletedJob, QueuedJob } from '../gen/index.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  job: QueuedJob | CompletedJob | undefined;
@@ -1,6 +1,7 @@
1
1
  <script>import SchemaForm from './SchemaForm.svelte';
2
2
  import ScriptPicker from './ScriptPicker.svelte';
3
- import { emptySchema, loadSchema as UloadSchema } from '../utils';
3
+ import { emptySchema } from '../utils';
4
+ import { loadSchema as UloadSchema } from '../scripts';
4
5
  import FlowPreview from './FlowPreview.svelte';
5
6
  export let flow;
6
7
  export let i;
@@ -1,6 +1,6 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { Schema } from '../common';
3
- import type { Flow, FlowModule } from '../gen/index';
3
+ import type { Flow, FlowModule } from '../gen/index.js';
4
4
  import SchemaForm from './SchemaForm.svelte';
5
5
  declare const __propDef: {
6
6
  props: {
@@ -1,4 +1,4 @@
1
- <script>import { ResourceService } from '../gen/index';
1
+ <script>import { ResourceService } from '../gen/index.js';
2
2
  import ResourcePicker from './ResourcePicker.svelte';
3
3
  import { workspaceStore } from '../stores';
4
4
  import SchemaForm from './SchemaForm.svelte';
@@ -1,5 +1,5 @@
1
1
  <script>import { pathToMeta } from '../common';
2
- import { GroupService } from '../gen/index';
2
+ import { GroupService } from '../gen/index.js';
3
3
  import Tooltip from './Tooltip.svelte';
4
4
  import { userStore, workspaceStore } from '../stores';
5
5
  import { sleep } from '../utils';
@@ -1,4 +1,4 @@
1
- <script>import { ResourceService, VariableService } from '../gen/index';
1
+ <script>import { ResourceService, VariableService } from '../gen/index.js';
2
2
  import { allTrue, emptySchema, sendUserToast } from '../utils';
3
3
  import { createEventDispatcher } from 'svelte';
4
4
  import Modal from './Modal.svelte';
@@ -1,4 +1,4 @@
1
- <script>import { ResourceService } from '../gen/index';
1
+ <script>import { ResourceService } from '../gen/index.js';
2
2
  import { workspaceStore } from '../stores';
3
3
  let resources = [];
4
4
  export let value;
@@ -1,5 +1,5 @@
1
1
  <script>import { createEventDispatcher } from 'svelte';
2
- import { ResourceService } from '../gen/index';
2
+ import { ResourceService } from '../gen/index.js';
3
3
  import { workspaceStore } from '../stores';
4
4
  import IconedResourceType from './IconedResourceType.svelte';
5
5
  let resources = [];
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { Script, Flow } from '../gen/index';
2
+ import type { Script, Flow } from '../gen/index.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  runnable: Script | Flow | undefined;
@@ -46,7 +46,7 @@ export async function main(x: string, y: string = 'default arg') {
46
46
  `
47
47
  </script>
48
48
 
49
- <script>import { ScriptService } from '../gen/index';
49
+ <script>import { ScriptService } from '../gen/index.js';
50
50
  import { emptySchema, sendUserToast } from '../utils';
51
51
  import { onDestroy } from 'svelte';
52
52
  import ScriptEditor from './ScriptEditor.svelte';
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Script } from '../gen/index';
2
+ import { type Script } from '../gen/index.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  script: Script;
@@ -1,4 +1,4 @@
1
- <script>import { JobService, Job, CompletedJob, VariableService, ResourceService, ScriptService } from '../gen/index';
1
+ <script>import { JobService, Job, CompletedJob, VariableService, ResourceService, ScriptService } from '../gen/index.js';
2
2
  import { sendUserToast, emptySchema, displayDate } from '../utils';
3
3
  import { fade } from 'svelte/transition';
4
4
  import Icon from 'svelte-awesome';
@@ -1,5 +1,5 @@
1
1
  <script>import { sendUserToast } from '../utils';
2
- import { ScriptService, FlowService, Script } from '../gen/index';
2
+ import { ScriptService, FlowService, Script } from '../gen/index.js';
3
3
  import Icon from 'svelte-awesome';
4
4
  import { faSearch } from '@fortawesome/free-solid-svg-icons';
5
5
  import { hubScripts, workspaceStore } from '../stores';
@@ -2,7 +2,7 @@
2
2
  import TableCustom from './TableCustom.svelte';
3
3
  import { GranularAclService } from '../gen/services/GranularAclService';
4
4
  import { sendUserToast } from '../utils';
5
- import { GroupService, UserService } from '../gen/index';
5
+ import { GroupService, UserService } from '../gen/index.js';
6
6
  import { createEventDispatcher } from 'svelte';
7
7
  import AutoComplete from 'simple-svelte-autocomplete';
8
8
  import { workspaceStore } from '../stores';
@@ -1,6 +1,6 @@
1
1
  <script>import Password from './Password.svelte';
2
2
  import { sendUserToast } from '../utils';
3
- import { VariableService } from '../gen/index';
3
+ import { VariableService } from '../gen/index.js';
4
4
  import AutosizedTextarea from './AutosizedTextarea.svelte';
5
5
  import Path from './Path.svelte';
6
6
  import Modal from './Modal.svelte';
package/infer.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import type { Schema } from './common';
1
+ import type { Schema } from './common.js';
2
2
  export declare function inferArgs(language: 'python3' | 'deno', code: string, schema: Schema): Promise<void>;
package/infer.js CHANGED
@@ -1,5 +1,5 @@
1
- import { ScriptService } from './gen/index';
2
- import { sendUserToast } from './utils';
1
+ import { ScriptService } from './gen/index.js';
2
+ import { sendUserToast } from './utils.js';
3
3
  export async function inferArgs(language, code, schema) {
4
4
  try {
5
5
  let inferedSchema;
package/logout.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { goto } from '$app/navigation';
2
- import { UserService } from './gen';
3
- import { clearStores } from './stores';
4
- import { sendUserToast } from './utils';
2
+ import { UserService } from './gen/index.js';
3
+ import { clearStores } from './stores.js';
4
+ import { sendUserToast } from './utils.js';
5
5
  export function logoutWithRedirect(rd) {
6
6
  const error = encodeURIComponent('You have been logged out because your session has expired.');
7
7
  goto(`/user/login?error=${error}${rd ? '&rd=' + encodeURIComponent(rd) : ''}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.13.7",
3
+ "version": "1.13.10",
4
4
  "devDependencies": {
5
5
  "@sveltejs/adapter-node": "^1.0.0-next.78",
6
6
  "@sveltejs/adapter-static": "^1.0.0-next.34",
@@ -171,7 +171,9 @@
171
171
  "./gen/services/WorkspaceService": "./gen/services/WorkspaceService.js",
172
172
  "./infer": "./infer.js",
173
173
  "./logout": "./logout.js",
174
+ "./scripts": "./scripts.js",
174
175
  "./stores": "./stores.js",
176
+ "./user": "./user.js",
175
177
  "./utils": "./utils.js"
176
178
  }
177
- }
179
+ }
package/scripts.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function loadSchema(path: string): Promise<any>;
package/scripts.js ADDED
@@ -0,0 +1,20 @@
1
+ import { get } from "svelte/store";
2
+ import { ScriptService } from "./gen";
3
+ import { inferArgs } from "./infer";
4
+ import { workspaceStore } from "./stores";
5
+ import { emptySchema } from "./utils";
6
+ export async function loadSchema(path) {
7
+ if (path.startsWith('hub/')) {
8
+ const code = await ScriptService.getHubScriptContentByPath({ path });
9
+ const schema = emptySchema();
10
+ await inferArgs('deno', code, schema);
11
+ return schema;
12
+ }
13
+ else {
14
+ const script = await ScriptService.getScriptByPath({
15
+ workspace: get(workspaceStore),
16
+ path: path ?? ''
17
+ });
18
+ return script.schema;
19
+ }
20
+ }
package/stores.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { UserWorkspaceList } from './gen/index';
1
+ import type { UserWorkspaceList } from './gen/models/UserWorkspaceList.js';
2
2
  export interface UserExt {
3
3
  email: string;
4
4
  username: string;
package/stores.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { browser } from '$app/env';
2
2
  import { writable } from 'svelte/store';
3
- import { getUserExt } from './utils';
3
+ import { getUserExt } from './user';
4
4
  let persistedWorkspace = browser && localStorage.getItem('workspace');
5
5
  export const userStore = writable(undefined);
6
6
  export const workspaceStore = writable(persistedWorkspace ? String(persistedWorkspace) : undefined);
package/user.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { type UserExt } from './stores.js';
2
+ export declare function refreshSuperadmin(): Promise<void>;
3
+ export declare function getUserExt(workspace: string): Promise<UserExt | undefined>;
package/user.js ADDED
@@ -0,0 +1,31 @@
1
+ import { get } from 'svelte/store';
2
+ import { UserService } from './gen/index.js';
3
+ import { superadmin } from './stores.js';
4
+ export async function refreshSuperadmin() {
5
+ if (get(superadmin) == undefined) {
6
+ UserService.globalWhoami().then((x) => {
7
+ if (x.super_admin) {
8
+ superadmin.set(x.email);
9
+ }
10
+ else {
11
+ superadmin.set(false);
12
+ }
13
+ });
14
+ }
15
+ }
16
+ export async function getUserExt(workspace) {
17
+ try {
18
+ const user = await UserService.whoami({ workspace });
19
+ return mapUserToUserExt(user);
20
+ }
21
+ catch (error) {
22
+ return undefined;
23
+ }
24
+ }
25
+ function mapUserToUserExt(user) {
26
+ return {
27
+ ...user,
28
+ groups: user.groups,
29
+ pgroups: user.groups.map((x) => `g/${x}`)
30
+ };
31
+ }
package/utils.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { type User } from './gen/index';
2
- import { type UserExt } from './stores';
1
+ import type { UserExt } from './stores.js';
3
2
  export declare function isToday(someDate: Date): boolean;
4
3
  export declare function daysAgo(someDate: Date): number;
5
4
  export declare function secondsAgo(date: Date): number;
@@ -8,12 +7,9 @@ export declare function displayDate(dateString: string | undefined): string;
8
7
  export declare function getToday(): Date;
9
8
  export declare function sendUserToast(message: string, error?: boolean): void;
10
9
  export declare function truncateHash(hash: string): string;
11
- export declare function getUserExt(workspace: string): Promise<UserExt | undefined>;
12
10
  export declare function sleep(ms: number): Promise<void>;
13
11
  export declare function validatePassword(password: string): boolean;
14
- export declare function refreshSuperadmin(): Promise<void>;
15
12
  export declare function clickOutside(node: any): any;
16
- export declare function loadSchema(path: string): Promise<any>;
17
13
  export declare type DropdownType = 'action' | 'delete';
18
14
  export interface DropdownItem {
19
15
  displayName: string;
@@ -55,4 +51,3 @@ export declare function groupBy<T>(scripts: T[], toGroup: (t: T) => string, dflt
55
51
  export declare function truncate(s: string, n: number, suffix?: string): string;
56
52
  export declare function truncateRev(s: string, n: number, prefix?: string): string;
57
53
  export declare function isString(value: any): boolean;
58
- export declare function mapUserToUserExt(user: User): UserExt;
package/utils.js CHANGED
@@ -1,9 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2
2
  import { toast } from '@zerodevx/svelte-toast';
3
- import { get } from 'svelte/store';
4
- import { ScriptService, UserService } from './gen/index';
5
- import { inferArgs } from './infer';
6
- import { superadmin, workspaceStore } from './stores';
7
3
  export function isToday(someDate) {
8
4
  const today = new Date();
9
5
  return (someDate.getDate() == today.getDate() &&
@@ -63,15 +59,6 @@ export function truncateHash(hash) {
63
59
  return hash;
64
60
  }
65
61
  }
66
- export async function getUserExt(workspace) {
67
- try {
68
- const user = await UserService.whoami({ workspace });
69
- return mapUserToUserExt(user);
70
- }
71
- catch (error) {
72
- return undefined;
73
- }
74
- }
75
62
  export function sleep(ms) {
76
63
  return new Promise((resolve) => setTimeout(resolve, ms));
77
64
  }
@@ -79,18 +66,6 @@ export function validatePassword(password) {
79
66
  const re = /^(?=.*[\d])(?=.*[!@#$%^&*])[\w!@#$%^&*]{8,30}$/;
80
67
  return re.test(password);
81
68
  }
82
- export async function refreshSuperadmin() {
83
- if (get(superadmin) == undefined) {
84
- UserService.globalWhoami().then((x) => {
85
- if (x.super_admin) {
86
- superadmin.set(x.email);
87
- }
88
- else {
89
- superadmin.set(false);
90
- }
91
- });
92
- }
93
- }
94
69
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
70
  export function clickOutside(node) {
96
71
  const handleClick = (event) => {
@@ -105,21 +80,6 @@ export function clickOutside(node) {
105
80
  }
106
81
  };
107
82
  }
108
- export async function loadSchema(path) {
109
- if (path.startsWith('hub/')) {
110
- const code = await ScriptService.getHubScriptContentByPath({ path });
111
- const schema = emptySchema();
112
- await inferArgs('deno', code, schema);
113
- return schema;
114
- }
115
- else {
116
- const script = await ScriptService.getScriptByPath({
117
- workspace: get(workspaceStore),
118
- path: path ?? ''
119
- });
120
- return script.schema;
121
- }
122
- }
123
83
  export function emptySchema() {
124
84
  return {
125
85
  $schema: 'https://json-schema.org/draft/2020-12/schema',
@@ -232,10 +192,3 @@ export function truncateRev(s, n, prefix = '...') {
232
192
  export function isString(value) {
233
193
  return typeof value === 'string' || value instanceof String;
234
194
  }
235
- export function mapUserToUserExt(user) {
236
- return {
237
- ...user,
238
- groups: user.groups,
239
- pgroups: user.groups.map((x) => `g/${x}`)
240
- };
241
- }