windmill-components 1.444.0 → 1.444.2
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.
|
@@ -8,7 +8,7 @@ import Label from '../Label.svelte';
|
|
|
8
8
|
import CopyableCodeBlock from '../details/CopyableCodeBlock.svelte';
|
|
9
9
|
import { bash } from 'svelte-highlight/languages';
|
|
10
10
|
import { HttpTriggerService } from '../../gen';
|
|
11
|
-
import { page } from '$app/stores'
|
|
11
|
+
// import { page } from '$app/stores'
|
|
12
12
|
import { isCloudHosted } from '../../cloud';
|
|
13
13
|
import { base } from '../../base';
|
|
14
14
|
import CaptureSection from './CaptureSection.svelte';
|
|
@@ -54,7 +54,7 @@ async function routeExists(route_path, method) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
function getHttpRoute(route_path) {
|
|
57
|
-
return `${
|
|
57
|
+
return `${location.origin}${base}/api/r/${isCloudHosted() ? $workspaceStore + '/' : ''}${route_path}`;
|
|
58
58
|
}
|
|
59
59
|
$: validateRoute(route_path, http_method);
|
|
60
60
|
$: isValid = routeError === '';
|
|
@@ -10,7 +10,7 @@ import { Highlight } from 'svelte-highlight';
|
|
|
10
10
|
import { typescript } from 'svelte-highlight/languages';
|
|
11
11
|
import ClipboardPanel from '../details/ClipboardPanel.svelte';
|
|
12
12
|
import { copyToClipboard } from '../../utils';
|
|
13
|
-
import { page } from '$app/stores'
|
|
13
|
+
// import { page } from '$app/stores'
|
|
14
14
|
import { base } from '../../base';
|
|
15
15
|
import TriggerTokens from './TriggerTokens.svelte';
|
|
16
16
|
import { workspaceStore, userStore } from '../../stores';
|
|
@@ -35,7 +35,7 @@ let userSettings;
|
|
|
35
35
|
let url = '';
|
|
36
36
|
$: webhooks = isFlow ? computeFlowWebhooks(path) : computeScriptWebhooks(hash, path);
|
|
37
37
|
function computeScriptWebhooks(hash, path) {
|
|
38
|
-
let webhookBase = `${
|
|
38
|
+
let webhookBase = `${location.origin}${base}/api/w/${$workspaceStore}/jobs`;
|
|
39
39
|
return {
|
|
40
40
|
async: {
|
|
41
41
|
hash: `${webhookBase}/run/h/${hash}`,
|
|
@@ -49,7 +49,7 @@ function computeScriptWebhooks(hash, path) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
function computeFlowWebhooks(path) {
|
|
52
|
-
let webhooksBase = `${
|
|
52
|
+
let webhooksBase = `${location.origin}${base}/api/w/${$workspaceStore}/jobs`;
|
|
53
53
|
let urlAsync = `${webhooksBase}/run/f/${path}`;
|
|
54
54
|
let urlSync = `${webhooksBase}/run_wait_result/f/${path}`;
|
|
55
55
|
return {
|
|
@@ -124,7 +124,7 @@ async function triggerJob() {
|
|
|
124
124
|
function waitForJobCompletion(UUID) {
|
|
125
125
|
return new Promise(async (resolve, reject) => {
|
|
126
126
|
try {
|
|
127
|
-
const endpoint = \`${
|
|
127
|
+
const endpoint = \`${location.origin}/api/w/${$workspaceStore}/jobs_u/completed/get_result_maybe/\${UUID}\`;
|
|
128
128
|
const checkResponse = await fetch(endpoint, {
|
|
129
129
|
method: 'GET',
|
|
130
130
|
headers: ${JSON.stringify(headers(), null, 2).replaceAll('\n', '\n\t\t\t\t')}
|
|
@@ -149,7 +149,7 @@ function waitForJobCompletion(UUID) {
|
|
|
149
149
|
// Combine and return
|
|
150
150
|
return `${mainFunction}\n\n${triggerJobFunction}\n\n${waitForJobCompletionFunction}`;
|
|
151
151
|
}
|
|
152
|
-
let captureUrl = `${
|
|
152
|
+
let captureUrl = `${location.origin}/api/w/${$workspaceStore}/capture_u/webhook/${isFlow ? 'flow' : 'script'}/${path}`;
|
|
153
153
|
function captureCurlCode() {
|
|
154
154
|
return `curl \\
|
|
155
155
|
-X POST ${captureUrl} \\
|
|
@@ -165,7 +165,7 @@ ${webhookType === 'sync' ? 'RESULT' : 'UUID'}=$(curl -s ${requestType != 'get_pa
|
|
|
165
165
|
${webhookType === 'sync'
|
|
166
166
|
? 'echo -E $RESULT | jq'
|
|
167
167
|
: `
|
|
168
|
-
URL="${
|
|
168
|
+
URL="${location.origin}/api/w/${$workspaceStore}/jobs_u/completed/get_result_maybe/$UUID"
|
|
169
169
|
while true; do
|
|
170
170
|
curl -s -H "Authorization: Bearer $TOKEN" $URL -o res.json
|
|
171
171
|
COMPLETED=$(cat res.json | jq .completed)
|