windmill-components 1.13.21 → 1.13.22

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.
@@ -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.js';
7
+ import { ResourceService } from '../gen';
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.js';
1
+ <script>import { FlowService } from '../gen';
2
2
  import { sendUserToast } from '../utils';
3
3
  import { page } from '$app/stores';
4
4
  import { goto } from '$app/navigation';
@@ -12,47 +12,33 @@ export let flow;
12
12
  export let initialPath = '';
13
13
  $: step = Number($page.url.searchParams.get('step')) || 1;
14
14
  async function saveFlow() {
15
- try {
16
- if (initialPath == '') {
17
- await FlowService.createFlow({
18
- workspace: $workspaceStore,
19
- requestBody: {
20
- path: flow.path,
21
- summary: flow.summary,
22
- description: flow.description ?? '',
23
- value: flow.value,
24
- schema: flow.schema
25
- }
26
- });
27
- }
28
- else {
29
- await FlowService.updateFlow({
30
- workspace: $workspaceStore,
31
- path: initialPath,
32
- requestBody: {
33
- path: flow.path,
34
- summary: flow.summary,
35
- description: flow.description ?? '',
36
- value: flow.value,
37
- schema: flow.schema
38
- }
39
- });
40
- }
41
- sendUserToast(`Success! flow saved at ${flow.path}`);
42
- goto(`/flows/get/${flow.path}`);
15
+ if (initialPath == '') {
16
+ await FlowService.createFlow({
17
+ workspace: $workspaceStore,
18
+ requestBody: {
19
+ path: flow.path,
20
+ summary: flow.summary,
21
+ description: flow.description ?? '',
22
+ value: flow.value,
23
+ schema: flow.schema
24
+ }
25
+ });
43
26
  }
44
- catch (error) {
45
- if (error.status === 400) {
46
- sendUserToast(error.body, true);
47
- }
48
- else {
49
- sendUserToast(`Ooops.Something bad happened: ${error}`, true);
50
- console.error(error);
51
- }
27
+ else {
28
+ await FlowService.updateFlow({
29
+ workspace: $workspaceStore,
30
+ path: initialPath,
31
+ requestBody: {
32
+ path: flow.path,
33
+ summary: flow.summary,
34
+ description: flow.description ?? '',
35
+ value: flow.value,
36
+ schema: flow.schema
37
+ }
38
+ });
52
39
  }
53
- }
54
- async function inferSchema() {
55
- //await inferArgs(flow.content, flow.schema);
40
+ sendUserToast(`Success! flow saved at ${flow.path}`);
41
+ goto(`/flows/get/${flow.path}`);
56
42
  }
57
43
  async function changeStep(step) {
58
44
  goto(`?step=${step}`);
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Flow } from '../gen/index.js';
2
+ import { type Flow } from '../gen';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  flow: Flow;
@@ -1,7 +1,7 @@
1
1
  <script>import { faPlus } from '@fortawesome/free-solid-svg-icons';
2
2
  import { emptySchema } from '../utils';
3
3
  import Icon from 'svelte-awesome';
4
- import { FlowModuleValue, ScriptService } from '../gen/index.js';
4
+ import { FlowModuleValue, ScriptService } from '../gen';
5
5
  import SchemaEditor from './SchemaEditor.svelte';
6
6
  import { workspaceStore } from '../stores';
7
7
  import ModuleStep from './ModuleStep.svelte';
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Flow } from '../gen/index.js';
2
+ import { type Flow } from '../gen';
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.js';
4
+ import { Job, JobService, InputTransform } from '../gen';
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.js';
2
+ import { type Flow } from '../gen';
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.js';
5
+ import { CompletedJob, FlowModuleValue, FlowStatusModule, JobService, QueuedJob } from '../gen';
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.js';
2
+ import { CompletedJob, QueuedJob } from '../gen';
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.js';
3
+ import { GroupService, UserService } from '../gen';
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.js';
4
+ import { UserService } from '../gen';
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.js';
5
+ import { WorkspaceService } from '../gen';
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.js';
2
+ import type { CompletedJob, QueuedJob } from '../gen';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  job: QueuedJob | CompletedJob | undefined;
@@ -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.js';
3
+ import type { Flow, FlowModule } from '../gen';
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.js';
1
+ <script>import { ResourceService } from '../gen';
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.js';
2
+ import { GroupService } from '../gen';
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.js';
1
+ <script>import { ResourceService, VariableService } from '../gen';
2
2
  import { allTrue, emptySchema, sendUserToast } from '../utils';
3
3
  import { createEventDispatcher } from 'svelte';
4
4
  import Modal from './Modal.svelte';
@@ -50,18 +50,13 @@ export async function initEdit(p) {
50
50
  modal.openModal();
51
51
  }
52
52
  async function createResource() {
53
- try {
54
- await ResourceService.createResource({
55
- workspace: $workspaceStore,
56
- requestBody: { path, value: args, description, resource_type: resourceType.name }
57
- });
58
- sendUserToast(`Successfully created resource at ${path}`);
59
- dispatch('refresh');
60
- modal.closeModal();
61
- }
62
- catch (err) {
63
- sendUserToast(`${err}`, true);
64
- }
53
+ await ResourceService.createResource({
54
+ workspace: $workspaceStore,
55
+ requestBody: { path, value: args, description, resource_type: resourceType.name }
56
+ });
57
+ sendUserToast(`Successfully created resource at ${path}`);
58
+ dispatch('refresh');
59
+ modal.closeModal();
65
60
  }
66
61
  async function editResource() {
67
62
  try {
@@ -1,4 +1,4 @@
1
- <script>import { ResourceService } from '../gen/index.js';
1
+ <script>import { ResourceService } from '../gen';
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.js';
2
+ import { ResourceService } from '../gen';
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.js';
2
+ import type { Script, Flow } from '../gen';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  runnable: Script | Flow | undefined;
@@ -14,23 +14,18 @@ let oldArgName; // when editing argument and changing name
14
14
  let viewJsonSchema = false;
15
15
  // Binding is not enough because monaco Editor does not support two-way binding
16
16
  export function getSchema() {
17
- if (viewJsonSchema) {
18
- try {
17
+ try {
18
+ if (viewJsonSchema) {
19
19
  schema = JSON.parse(schemaString);
20
20
  return schema;
21
21
  }
22
- catch (err) {
23
- throw Error(`Error: input is not a valid schema: ${err}`);
24
- }
25
- }
26
- else {
27
- try {
22
+ else {
28
23
  schemaString = JSON.stringify(schema, null, '\t');
29
24
  return schema;
30
25
  }
31
- catch (err) {
32
- throw Error(`Error: input is not a valid schema: ${err}`);
33
- }
26
+ }
27
+ catch (err) {
28
+ throw Error(`Error: input is not a valid schema: ${err}`);
34
29
  }
35
30
  }
36
31
  function handleAddOrEditArgument() {
@@ -88,7 +83,6 @@ function handleDeleteArgument(argName) {
88
83
  }
89
84
  }
90
85
  catch (err) {
91
- console.error(err);
92
86
  sendUserToast(`Could not delete argument: ${err}`, true);
93
87
  }
94
88
  }
@@ -100,13 +94,8 @@ function switchTab() {
100
94
  viewJsonSchema = false;
101
95
  }
102
96
  else {
103
- try {
104
- schemaString = JSON.stringify(schema, null, '\t');
105
- viewJsonSchema = true;
106
- }
107
- catch (err) {
108
- sendUserToast(err, true);
109
- }
97
+ schemaString = JSON.stringify(schema, null, '\t');
98
+ viewJsonSchema = true;
110
99
  }
111
100
  }
112
101
  </script>
@@ -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.js';
49
+ <script>import { ScriptService } from '../gen';
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.js';
2
+ import { type Script } from '../gen';
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.js';
1
+ <script>import { JobService, Job, CompletedJob, VariableService, ResourceService, ScriptService } from '../gen';
2
2
  import { sendUserToast, emptySchema, displayDate } from '../utils';
3
3
  import { fade } from 'svelte/transition';
4
4
  import Icon from 'svelte-awesome';
@@ -88,7 +88,7 @@ export async function runPreview() {
88
88
  }
89
89
  catch (err) {
90
90
  previewIsLoading = false;
91
- sendUserToast(`Could not run preview: ${err} `, true);
91
+ throw err;
92
92
  }
93
93
  }
94
94
  async function loadPastPreviews() {
@@ -1,5 +1,5 @@
1
1
  <script>import { sendUserToast } from '../utils';
2
- import { ScriptService, FlowService, Script } from '../gen/index.js';
2
+ import { ScriptService, FlowService, Script } from '../gen';
3
3
  import Icon from 'svelte-awesome';
4
4
  import { faSearch } from '@fortawesome/free-solid-svg-icons';
5
5
  import { hubScripts, workspaceStore } from '../stores';
@@ -38,19 +38,14 @@ async function getScript() {
38
38
  }
39
39
  }
40
40
  async function loadItems() {
41
- try {
42
- if (itemKind == 'flow') {
43
- items = await FlowService.listFlows({ workspace: $workspaceStore });
44
- }
45
- else if (itemKind == 'script') {
46
- items = await ScriptService.listScripts({ workspace: $workspaceStore });
47
- }
48
- else {
49
- items = $hubScripts ?? [];
50
- }
41
+ if (itemKind == 'flow') {
42
+ items = await FlowService.listFlows({ workspace: $workspaceStore });
51
43
  }
52
- catch (err) {
53
- sendUserToast(`Could not load items: ${err}`, true);
44
+ else if (itemKind == 'script') {
45
+ items = await ScriptService.listScripts({ workspace: $workspaceStore });
46
+ }
47
+ else {
48
+ items = $hubScripts ?? [];
54
49
  }
55
50
  }
56
51
  $: {
@@ -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.js';
5
+ import { GroupService, UserService } from '../gen';
6
6
  import { createEventDispatcher } from 'svelte';
7
7
  import AutoComplete from 'simple-svelte-autocomplete';
8
8
  import { workspaceStore } from '../stores';
@@ -52,19 +52,14 @@ async function deleteAcl(owner) {
52
52
  }
53
53
  }
54
54
  async function addAcl(owner, write) {
55
- try {
56
- await GranularAclService.addGranularAcls({
57
- workspace: $workspaceStore,
58
- path,
59
- kind,
60
- requestBody: { owner, write }
61
- });
62
- loadAcls();
63
- dispatch('change');
64
- }
65
- catch (err) {
66
- sendUserToast(err.toString(), true);
67
- }
55
+ await GranularAclService.addGranularAcls({
56
+ workspace: $workspaceStore,
57
+ path,
58
+ kind,
59
+ requestBody: { owner, write }
60
+ });
61
+ loadAcls();
62
+ dispatch('change');
68
63
  }
69
64
  </script>
70
65
 
@@ -1,6 +1,6 @@
1
1
  <script>import Password from './Password.svelte';
2
2
  import { sendUserToast } from '../utils';
3
- import { VariableService } from '../gen/index.js';
3
+ import { VariableService } from '../gen';
4
4
  import AutosizedTextarea from './AutosizedTextarea.svelte';
5
5
  import Path from './Path.svelte';
6
6
  import Modal from './Modal.svelte';
@@ -45,23 +45,18 @@ export async function editVariable(path) {
45
45
  const MAX_VARIABLE_LENGTH = 3000;
46
46
  $: valid = variable.value.length < MAX_VARIABLE_LENGTH;
47
47
  async function createVariable() {
48
- try {
49
- await VariableService.createVariable({
50
- workspace: $workspaceStore,
51
- requestBody: {
52
- path,
53
- value: variable.value,
54
- is_secret: variable.is_secret,
55
- description: variable.description
56
- }
57
- });
58
- sendUserToast(`Successfully created variable ${path}`);
59
- dispatch('create');
60
- modal.closeModal();
61
- }
62
- catch (err) {
63
- sendUserToast(`Could not create variable: ${err.body}`, true);
64
- }
48
+ await VariableService.createVariable({
49
+ workspace: $workspaceStore,
50
+ requestBody: {
51
+ path,
52
+ value: variable.value,
53
+ is_secret: variable.is_secret,
54
+ description: variable.description
55
+ }
56
+ });
57
+ sendUserToast(`Successfully created variable ${path}`);
58
+ dispatch('create');
59
+ modal.closeModal();
65
60
  }
66
61
  async function updateVariable() {
67
62
  try {
@@ -1,4 +1,8 @@
1
1
  export class ApiError extends Error {
2
+ url;
3
+ status;
4
+ statusText;
5
+ body;
2
6
  constructor(response, message) {
3
7
  super(message);
4
8
  this.name = 'ApiError';
@@ -11,6 +11,14 @@ export class CancelError extends Error {
11
11
  }
12
12
  }
13
13
  export class CancelablePromise {
14
+ [Symbol.toStringTag];
15
+ _isResolved;
16
+ _isRejected;
17
+ _isCancelled;
18
+ _cancelHandlers;
19
+ _promise;
20
+ _resolve;
21
+ _reject;
14
22
  constructor(executor) {
15
23
  this._isResolved = false;
16
24
  this._isRejected = false;
@@ -83,4 +91,3 @@ export class CancelablePromise {
83
91
  return this._isCancelled;
84
92
  }
85
93
  }
86
- Symbol.toStringTag;
package/infer.js CHANGED
@@ -1,42 +1,36 @@
1
- import { ScriptService } from './gen/index.js';
1
+ import { ScriptService } from './gen';
2
2
  import { sendUserToast } from './utils.js';
3
3
  export async function inferArgs(language, code, schema) {
4
- try {
5
- let inferedSchema;
6
- if (language == 'python3') {
7
- inferedSchema = await ScriptService.pythonToJsonschema({
8
- requestBody: code
9
- });
10
- }
11
- else if (language == 'deno') {
12
- inferedSchema = await ScriptService.denoToJsonschema({
13
- requestBody: code
14
- });
4
+ let inferedSchema;
5
+ if (language == 'python3') {
6
+ inferedSchema = await ScriptService.pythonToJsonschema({
7
+ requestBody: code
8
+ });
9
+ }
10
+ else if (language == 'deno') {
11
+ inferedSchema = await ScriptService.denoToJsonschema({
12
+ requestBody: code
13
+ });
14
+ }
15
+ else {
16
+ return;
17
+ }
18
+ schema.required = [];
19
+ const oldProperties = Object.assign({}, schema.properties);
20
+ schema.properties = {};
21
+ for (const arg of inferedSchema.args) {
22
+ if (!(arg.name in oldProperties)) {
23
+ schema.properties[arg.name] = { description: '', type: '' };
15
24
  }
16
25
  else {
17
- return;
26
+ schema.properties[arg.name] = oldProperties[arg.name];
18
27
  }
19
- schema.required = [];
20
- const oldProperties = Object.assign({}, schema.properties);
21
- schema.properties = {};
22
- for (const arg of inferedSchema.args) {
23
- if (!(arg.name in oldProperties)) {
24
- schema.properties[arg.name] = { description: '', type: '' };
25
- }
26
- else {
27
- schema.properties[arg.name] = oldProperties[arg.name];
28
- }
29
- argSigToJsonSchemaType(arg.typ, schema.properties[arg.name]);
30
- schema.properties[arg.name].default = arg.default;
31
- if (!arg.has_default) {
32
- schema.required.push(arg.name);
33
- }
28
+ argSigToJsonSchemaType(arg.typ, schema.properties[arg.name]);
29
+ schema.properties[arg.name].default = arg.default;
30
+ if (!arg.has_default) {
31
+ schema.required.push(arg.name);
34
32
  }
35
33
  }
36
- catch (err) {
37
- console.error(err);
38
- sendUserToast(`Could not infer schema: ${err.body ?? err}`, true);
39
- }
40
34
  }
41
35
  function argSigToJsonSchemaType(t, s) {
42
36
  if (t === 'int') {
package/logout.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { goto } from '$app/navigation';
2
- import { UserService } from './gen/index.js';
2
+ import { UserService } from './gen';
3
3
  import { clearStores } from './stores.js';
4
4
  import { sendUserToast } from './utils.js';
5
5
  export function logoutWithRedirect(rd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.13.21",
3
+ "version": "1.13.22",
4
4
  "devDependencies": {
5
5
  "@sveltejs/adapter-node": "^1.0.0-next.78",
6
6
  "@sveltejs/adapter-static": "^1.0.0-next.34",
package/user.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { get } from 'svelte/store';
2
- import { UserService } from './gen/index.js';
2
+ import { UserService } from './gen';
3
3
  import { superadmin } from './stores.js';
4
4
  export async function refreshSuperadmin() {
5
5
  if (get(superadmin) == undefined) {