windmill-components 1.447.7 → 1.448.1

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 (82) hide show
  1. package/package/autosize.js +3 -8
  2. package/package/components/AppConnectInner.svelte +7 -1
  3. package/package/components/ArgInput.svelte +673 -596
  4. package/package/components/ArgInput.svelte.d.ts +11 -0
  5. package/package/components/AssignableTags.svelte +2 -1
  6. package/package/components/AssignableTags.svelte.d.ts +1 -0
  7. package/package/components/AssignableTagsInner.svelte +5 -1
  8. package/package/components/AssignableTagsInner.svelte.d.ts +3 -1
  9. package/package/components/AuthSettings.svelte +1 -1
  10. package/package/components/AuthSettings.svelte.d.ts +1 -0
  11. package/package/components/EditableSchemaForm.svelte +61 -29
  12. package/package/components/EditableSchemaForm.svelte.d.ts +9 -0
  13. package/package/components/FirstStepInputs.svelte +3 -1
  14. package/package/components/FlowPreviewContent.svelte +46 -45
  15. package/package/components/HistoricInputs.svelte +2 -0
  16. package/package/components/InstanceSettings.svelte +5 -1
  17. package/package/components/Range.svelte +5 -4
  18. package/package/components/Range.svelte.d.ts +2 -0
  19. package/package/components/RunFormAdvancedPopup.svelte +2 -2
  20. package/package/components/SavedInputsPicker.svelte +6 -0
  21. package/package/components/SchemaForm.svelte +70 -4
  22. package/package/components/SchemaForm.svelte.d.ts +11 -0
  23. package/package/components/ScriptBuilder.svelte +9 -1
  24. package/package/components/ScriptEditor.svelte.d.ts +2 -2
  25. package/package/components/ScriptPicker.svelte.d.ts +1 -1
  26. package/package/components/SimpleEditor.svelte +3 -1
  27. package/package/components/TestConnection.svelte +1 -1
  28. package/package/components/WorkerGroup.svelte +21 -0
  29. package/package/components/WorkerTagPicker.svelte +2 -2
  30. package/package/components/WorkerTagSelect.svelte +2 -2
  31. package/package/components/apps/components/display/table/AppAggridTable.svelte +3 -1
  32. package/package/components/apps/editor/component/components.d.ts +79 -79
  33. package/package/components/details/EmailTriggerConfigSection.svelte.d.ts +1 -1
  34. package/package/components/flows/content/FlowEditorPanel.svelte +2 -2
  35. package/package/components/flows/content/FlowInput.svelte +193 -130
  36. package/package/components/flows/content/FlowInputEditor.svelte +12 -36
  37. package/package/components/flows/content/FlowInputEditor.svelte.d.ts +1 -5
  38. package/package/components/flows/content/FlowInputsQuick.svelte.d.ts +1 -1
  39. package/package/components/flows/content/FlowModuleWorkerTagSelect.svelte +2 -2
  40. package/package/components/flows/flowStateUtils.d.ts +1 -2
  41. package/package/components/flows/flowStateUtils.js +1 -1
  42. package/package/components/flows/pickers/WorkspaceScriptPickerQuick.svelte.d.ts +1 -1
  43. package/package/components/meltComponents/SideBarTab.svelte +60 -0
  44. package/package/components/meltComponents/SideBarTab.svelte.d.ts +24 -0
  45. package/package/components/runs/NoWorkerWithTagWarning.svelte +5 -1
  46. package/package/components/schema/AddProperty.svelte +3 -1
  47. package/package/components/schema/AddPropertyV2.svelte +5 -8
  48. package/package/components/schema/AddPropertyV2.svelte.d.ts +3 -0
  49. package/package/components/schema/EditableSchemaDrawer.svelte +12 -3
  50. package/package/components/schema/EditableSchemaWrapper.svelte +5 -0
  51. package/package/components/schema/SchemaFormDND.svelte +25 -9
  52. package/package/components/schema/SchemaFormDND.svelte.d.ts +12 -0
  53. package/package/components/schema/schemaUtils.d.ts +26 -0
  54. package/package/components/schema/schemaUtils.js +185 -0
  55. package/package/components/settings/PremiumInfo.svelte +212 -30
  56. package/package/components/triggers/CaptureSection.svelte.d.ts +1 -1
  57. package/package/components/triggers/CaptureTable.svelte +10 -2
  58. package/package/components/triggers/CaptureWrapper.svelte +2 -1
  59. package/package/components/triggers/KafkaTriggersConfigSection.svelte.d.ts +1 -1
  60. package/package/components/triggers/NatsTriggersConfigSection.svelte.d.ts +1 -1
  61. package/package/components/triggers/RouteEditorConfigSection.svelte +3 -2
  62. package/package/components/triggers/RouteEditorConfigSection.svelte.d.ts +2 -1
  63. package/package/components/triggers/RoutesPanel.svelte +2 -0
  64. package/package/components/triggers/RoutesPanel.svelte.d.ts +1 -0
  65. package/package/components/triggers/TriggersEditor.svelte +3 -1
  66. package/package/components/triggers/TriggersEditor.svelte.d.ts +1 -0
  67. package/package/components/triggers/TriggersEditorSection.svelte +0 -1
  68. package/package/components/triggers/TriggersWrapper.svelte +1 -1
  69. package/package/components/triggers/WebhooksConfigSection.svelte +9 -9
  70. package/package/components/triggers/WebhooksConfigSection.svelte.d.ts +2 -2
  71. package/package/components/triggers/WebhooksPanel.svelte +2 -2
  72. package/package/components/triggers/WebhooksPanel.svelte.d.ts +1 -1
  73. package/package/components/triggers/WebsocketEditorConfigSection.svelte.d.ts +1 -1
  74. package/package/gen/core/OpenAPI.js +1 -1
  75. package/package/gen/schemas.gen.d.ts +2 -2
  76. package/package/gen/schemas.gen.js +2 -2
  77. package/package/gen/services.gen.d.ts +22 -2
  78. package/package/gen/services.gen.js +44 -2
  79. package/package/gen/types.gen.d.ts +62 -2
  80. package/package/script_helpers.d.ts +1 -1
  81. package/package/script_helpers.js +7 -7
  82. package/package.json +11 -3
@@ -1,14 +1,19 @@
1
1
  <script>import { base } from '../../base';
2
- import { capitalize, sendUserToast } from '../../utils';
2
+ import { capitalize, pluralize, sendUserToast } from '../../utils';
3
3
  import DataTable from '../table/DataTable.svelte';
4
4
  import Cell from '../table/Cell.svelte';
5
5
  import { WorkspaceService, UserService } from '../../gen';
6
6
  import { workspaceStore } from '../../stores';
7
7
  import { Button } from '../common';
8
8
  import Tooltip from '../Tooltip.svelte';
9
- import { ExternalLink, Loader2 } from 'lucide-svelte';
9
+ import { ExternalLink, Loader2, Pen, X } from 'lucide-svelte';
10
10
  import { twMerge } from 'tailwind-merge';
11
11
  import Toggle from '../Toggle.svelte';
12
+ import Section from '../Section.svelte';
13
+ import Range from '../Range.svelte';
14
+ import Label from '../Label.svelte';
15
+ import Modal from '../common/modal/Modal.svelte';
16
+ import { slide } from 'svelte/transition';
12
17
  export let plan;
13
18
  export let customer_id;
14
19
  let users = undefined;
@@ -37,6 +42,7 @@ $: {
37
42
  if ($workspaceStore) {
38
43
  loadPremiumInfo();
39
44
  listUsers();
45
+ getThresholdAlert();
40
46
  }
41
47
  }
42
48
  async function listUsers() {
@@ -47,16 +53,17 @@ async function loadPremiumInfo() {
47
53
  const developerNb = users?.filter((x) => !x.operator)?.length ?? 0;
48
54
  const operatorNb = users?.filter((x) => x.operator)?.length ?? 0;
49
55
  const seatsFromUsers = Math.ceil(developerNb + operatorNb / 2);
50
- const seatsFromComps = Math.ceil((info.usage ?? 0) / 10000);
51
- const usedSeats = Math.max(seatsFromUsers, seatsFromComps);
56
+ const seatsFromExtraComps = Math.max(Math.ceil((info.usage ?? 0) / 10000) - seatsFromUsers, 0);
57
+ const usedSeats = seatsFromUsers + seatsFromExtraComps;
52
58
  premiumInfo = {
53
59
  ...info,
54
60
  usage: info.usage ?? 0,
55
61
  seats: info.seats ?? 1,
62
+ owner: info.owner,
56
63
  developerNb,
57
64
  operatorNb,
58
65
  seatsFromUsers,
59
- seatsFromComps,
66
+ seatsFromExtraComps,
60
67
  usedSeats
61
68
  };
62
69
  }
@@ -64,7 +71,6 @@ let billingModeLoading = false;
64
71
  async function setAutomaticBilling(ev) {
65
72
  try {
66
73
  billingModeLoading = true;
67
- console.log('toggle check', ev.detail);
68
74
  await WorkspaceService.setAutomaticBilling({
69
75
  workspace: $workspaceStore,
70
76
  requestBody: {
@@ -81,15 +87,74 @@ async function setAutomaticBilling(ev) {
81
87
  billingModeLoading = false;
82
88
  }
83
89
  }
90
+ let thresholdAlert = undefined;
91
+ let newThresholdAlertAmount = undefined;
92
+ let thresholdAlertOpen = false;
93
+ async function getThresholdAlert() {
94
+ thresholdAlert = await WorkspaceService.getThresholdAlert({ workspace: $workspaceStore });
95
+ }
96
+ async function setThresholdAlert() {
97
+ if (thresholdAlert) {
98
+ await WorkspaceService.setThresholdAlert({
99
+ workspace: $workspaceStore,
100
+ requestBody: {
101
+ threshold_alert_amount: newThresholdAlertAmount
102
+ }
103
+ });
104
+ await getThresholdAlert();
105
+ sendUserToast('Threshold alert updated');
106
+ }
107
+ }
108
+ let estimatedDevs = 1;
109
+ let estimatedOps = 0;
110
+ $: estimatedSeats = estimatedDevs + Math.ceil(estimatedOps / 2);
111
+ let estimatedExecs = 1;
112
+ function updateExecs() {
113
+ if (estimatedExecs < estimatedSeats) {
114
+ estimatedExecs = estimatedSeats;
115
+ }
116
+ }
117
+ $: estimatedSeats && updateExecs();
84
118
  </script>
85
119
 
86
- <div class="flex flex-col gap-4 my-8">
120
+ <Modal bind:open={thresholdAlertOpen} title="Threshold alert">
121
+ <div class="flex flex-col gap-4">
122
+ <label class="block">
123
+ <span class="text-secondary text-sm">Threshold amount in $</span>
124
+ <input type="number" bind:value={newThresholdAlertAmount} />
125
+ </label>
126
+ </div>
127
+
128
+ <svelte:fragment slot="actions">
129
+ <Button
130
+ size="sm"
131
+ on:click={() => {
132
+ setThresholdAlert()
133
+ thresholdAlertOpen = false
134
+ }}
135
+ >
136
+ Save
137
+ </Button>
138
+ </svelte:fragment>
139
+ </Modal>
140
+
141
+ <div class="flex flex-col gap-4 mt-8">
87
142
  <div class="flex flex-col gap-1">
88
- <div class=" text-primary text-lg font-semibold">Plans</div>
143
+ <div class=" text-primary text-lg font-semibold">
144
+ {#if premiumInfo?.premium && plan}
145
+ Plan: {capitalize(plan)} plan{plan === 'team' && premiumInfo.automatic_billing
146
+ ? ' (usage-based)'
147
+ : plan === 'team'
148
+ ? ` (${premiumInfo.seats} seat${premiumInfo.seats > 1 ? 's' : ''})`
149
+ : ''}
150
+ {:else}
151
+ Plan: Free plan
152
+ {/if}
153
+ </div>
89
154
  </div>
90
155
  </div>
91
156
  {#if customer_id}
92
- <div class="mt-2 mb-2">
157
+ <div class="mt-2">
93
158
  <Button
94
159
  endIcon={{ icon: ExternalLink }}
95
160
  color="dark"
@@ -101,19 +166,12 @@ async function setAutomaticBilling(ev) {
101
166
  </div>
102
167
  {/if}
103
168
 
104
- <div class="text-xs my-4">
169
+ <div class="text-xs">
105
170
  {#if premiumInfo?.premium}
106
- <div class="flex flex-col gap-0.5">
171
+ <div class="flex flex-col gap-8 my-8">
107
172
  {#if plan}
108
- <div class="text-base inline font-bold leading-8 mb-2">
109
- Current plan: {capitalize(plan)} plan{plan === 'team' && premiumInfo.automatic_billing
110
- ? ' (usage-based)'
111
- : plan === 'team'
112
- ? ` (${premiumInfo.seats} seat${premiumInfo.seats > 1 ? 's' : ''})`
113
- : ''}
114
- </div>
115
- {#if plan === 'team'}
116
- <div class="flex flex-row items-center gap-2 mb-4">
173
+ {#if plan === 'team' && !premiumInfo?.automatic_billing}
174
+ <div class="flex flex-row items-center gap-2">
117
175
  <Toggle
118
176
  checked={premiumInfo?.automatic_billing}
119
177
  options={{
@@ -137,6 +195,54 @@ async function setAutomaticBilling(ev) {
137
195
  {/if}
138
196
 
139
197
  {#if plan}
198
+ {#if premiumInfo?.automatic_billing}
199
+ <div class="flex flex-col gap-1.5">
200
+ <p class="font-semibold text-sm">Billing threshold email alert</p>
201
+ <div class="flex flex-row gap-0.5 items-center">
202
+ <p class="text-base text-secondary mr-0.5"
203
+ >{thresholdAlert?.threshold_alert_amount
204
+ ? thresholdAlert?.threshold_alert_amount + '$'
205
+ : 'Not set'}</p
206
+ >
207
+ <Button
208
+ on:click={() => {
209
+ newThresholdAlertAmount = thresholdAlert?.threshold_alert_amount ?? 10
210
+ thresholdAlertOpen = true
211
+ }}
212
+ size="xs"
213
+ spacingSize="xs2"
214
+ variant="border"
215
+ color="light"
216
+ iconOnly
217
+ startIcon={{
218
+ icon: Pen
219
+ }}
220
+ />
221
+ {#if thresholdAlert?.threshold_alert_amount}
222
+ <Button
223
+ on:click={() => {
224
+ if (thresholdAlert) {
225
+ newThresholdAlertAmount = undefined
226
+ setThresholdAlert()
227
+ }
228
+ }}
229
+ variant="border"
230
+ size="xs"
231
+ spacingSize="xs2"
232
+ color="light"
233
+ iconOnly
234
+ startIcon={{
235
+ icon: X
236
+ }}
237
+ />
238
+ {/if}
239
+ </div>
240
+ <p class="italic text-xs"
241
+ >An email notification will be sent to {premiumInfo.owner} if the specified threshold amount
242
+ is reached during a given month.</p
243
+ >
244
+ </div>
245
+ {/if}
140
246
  <div class="w-full">
141
247
  <DataTable>
142
248
  <tbody class="divide-y">
@@ -169,9 +275,7 @@ async function setAutomaticBilling(ev) {
169
275
  </Cell>
170
276
  </tr>
171
277
  <tr>
172
- <Cell first
173
- ><div class="font-semibold">Minimum number of seats needed for users</div></Cell
174
- >
278
+ <Cell first><div class="font-semibold">Number of seats for users</div></Cell>
175
279
  <Cell last numeric>
176
280
  <div class="text-base font-bold">
177
281
  u = ceil({premiumInfo.developerNb} + {premiumInfo.operatorNb}/2) = {premiumInfo.seatsFromUsers}
@@ -186,14 +290,22 @@ async function setAutomaticBilling(ev) {
186
290
  </div>
187
291
  </Cell>
188
292
  </tr>
293
+ <tr>
294
+ <Cell first>Included computations with users (10k per user seat)</Cell>
295
+ <Cell last numeric>
296
+ <div class="text-base">
297
+ - {premiumInfo.seatsFromUsers * 10000}
298
+ </div>
299
+ </Cell>
300
+ </tr>
189
301
  <tr>
190
302
  <Cell first
191
- ><div class="font-semibold">Minimum number of seats needed for computations</div
192
- ></Cell
303
+ ><div class="font-semibold">Number of seats for extra computations</div></Cell
193
304
  >
194
305
  <Cell last numeric>
195
306
  <div class="text-base font-bold">
196
- c = ceil({premiumInfo.usage} / 10 000) = {premiumInfo.seatsFromComps}
307
+ c = ceil({Math.max(0, premiumInfo.usage - premiumInfo.seatsFromUsers * 10000)} /
308
+ 10 000) = {premiumInfo.seatsFromExtraComps}
197
309
  </div>
198
310
  </Cell>
199
311
  </tr>
@@ -228,8 +340,7 @@ async function setAutomaticBilling(ev) {
228
340
  : ''
229
341
  )}
230
342
  >
231
- max(u, c) = max({premiumInfo.seatsFromUsers}, {premiumInfo.seatsFromComps}) = {premiumInfo.usedSeats}{plan ===
232
- 'team' &&
343
+ u + c = {premiumInfo.usedSeats}{plan === 'team' &&
233
344
  premiumInfo.usedSeats > premiumInfo.seats &&
234
345
  !premiumInfo.automatic_billing
235
346
  ? ` > ${premiumInfo.seats}`
@@ -250,11 +361,82 @@ async function setAutomaticBilling(ev) {
250
361
  {/if}
251
362
  </div>
252
363
  {:else}
253
- This workspace is <b>not</b> on a team plan. Users use their global free-tier quotas when doing executions
254
- in this workspace. Upgrade to a Team or Enterprise plan to unlock unlimited executions in this workspace.
364
+ <div class="mb-8 mt-2">
365
+ This workspace is <b>not</b> on a team plan. Users use their global free-tier quotas when doing
366
+ executions in this workspace. Upgrade to a Team or Enterprise plan to unlock unlimited executions
367
+ in this workspace.
368
+ </div>
255
369
  {/if}
256
370
  </div>
257
371
 
372
+ <Section collapsable label="Cost estimator">
373
+ <div class="border p-4 rounded-md" transition:slide>
374
+ <Label label="Number of developers">
375
+ <Range min={1} max={20} bind:value={estimatedDevs} hideInput />
376
+ </Label>
377
+ <Label label="Number of operators">
378
+ <Range min={0} max={20} bind:value={estimatedOps} hideInput />
379
+ </Label>
380
+ <Label label="Number of executions">
381
+ <Range
382
+ min={estimatedSeats}
383
+ max={100}
384
+ bind:value={estimatedExecs}
385
+ format={(v) => `${v * 10}k`}
386
+ hideInput
387
+ />
388
+ </Label>
389
+ <div class="mt-4 text-base">
390
+ <div class="flex flex-row justify-between">
391
+ <div>Seats for users = {estimatedDevs} devs + {estimatedOps} ops / 2</div>
392
+ <div>{pluralize(estimatedSeats, 'seat')}</div>
393
+ </div>
394
+ <div class="flex flex-row justify-between">
395
+ <div
396
+ >Extra computations = {estimatedExecs * 10}k execs - {estimatedSeats * 10}k included with
397
+ users</div
398
+ >
399
+ <div
400
+ >{(estimatedExecs - estimatedSeats) * 10}k extra execs = {pluralize(
401
+ estimatedExecs - estimatedSeats,
402
+ 'seat'
403
+ )}</div
404
+ >
405
+ </div>
406
+ <div class="flex flex-row justify-between font-medium items-center">
407
+ <div>Total</div>
408
+ <div class="flex flex-col items-end">
409
+ <div>
410
+ {pluralize(estimatedSeats + (estimatedExecs - estimatedSeats), 'seat')} = {(estimatedSeats +
411
+ (estimatedExecs - estimatedSeats)) *
412
+ 10}$ / month
413
+ </div>
414
+ {#if premiumInfo?.premium && plan === 'team'}
415
+ <button
416
+ class="text-xs text-blue-500 underline"
417
+ on:click={() => {
418
+ newThresholdAlertAmount = (estimatedSeats + (estimatedExecs - estimatedSeats)) * 10
419
+ thresholdAlertOpen = true
420
+ }}
421
+ >
422
+ Setup threshold email alert
423
+ </button>
424
+ {/if}
425
+ </div>
426
+ </div>
427
+ {#if (estimatedSeats + (estimatedExecs - estimatedSeats)) * 10 > 700}
428
+ <a
429
+ class="mt-4 text-teal-600 font-semibold text-center block underline"
430
+ href="https://www.windmill.dev/pricing"
431
+ target="_blank"
432
+ >
433
+ You should consider subscribing to Cloud Enterprise
434
+ </a>
435
+ {/if}
436
+ </div>
437
+ </div>
438
+ </Section>
439
+
258
440
  <div class="text-base font-bold leading-8 mb-2 pt-8"> All plans </div>
259
441
 
260
442
  <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
@@ -19,7 +19,7 @@ declare const __propDef: {
19
19
  };
20
20
  events: {
21
21
  applyArgs: CustomEvent<{
22
- kind: "main" | "preprocessor";
22
+ kind: "preprocessor" | "main";
23
23
  args: Record<string, any> | undefined;
24
24
  }>;
25
25
  addPreprocessor: CustomEvent<null>;
@@ -100,6 +100,8 @@ async function getPropPickerElements() {
100
100
  function handleKeydown(event) {
101
101
  if (event.key === 'Escape' && selected) {
102
102
  deselect();
103
+ event.stopPropagation();
104
+ event.preventDefault();
103
105
  }
104
106
  }
105
107
  function handleError(error) {
@@ -115,7 +117,7 @@ $: path && infiniteList && initLoadCaptures();
115
117
 
116
118
  <svelte:window on:keydown={handleKeydown} />
117
119
 
118
- <Label label="Trigger captures" {headless} class="h-full flex flex-col gap-1">
120
+ <Label label="Trigger captures" {headless} class="h-full {headless ? '' : 'flex flex-col gap-1'}">
119
121
  <svelte:fragment slot="header">
120
122
  {#if addButton}
121
123
  <div class="inline-block">
@@ -146,7 +148,13 @@ $: path && infiniteList && initLoadCaptures();
146
148
  </svelte:fragment>
147
149
 
148
150
  <div
149
- class={fullHeight ? 'h-full' : capturesLength > 7 ? 'h-[300px]' : 'h-fit'}
151
+ class={fullHeight
152
+ ? headless
153
+ ? 'h-full'
154
+ : 'min-h-0 grow'
155
+ : capturesLength > 7
156
+ ? 'h-[300px]'
157
+ : 'h-fit'}
150
158
  use:clickOutside={{ capture: false, exclude: getPropPickerElements }}
151
159
  on:click_outside={() => {
152
160
  if (firstClick) {
@@ -166,7 +166,7 @@ $: args && (captureActive = false);
166
166
  {path}
167
167
  hash={data?.hash}
168
168
  token={data?.token}
169
- {args}
169
+ runnableArgs={data?.args}
170
170
  scopes={data?.scopes}
171
171
  {showCapture}
172
172
  {captureInfo}
@@ -185,6 +185,7 @@ $: args && (captureActive = false);
185
185
  {path}
186
186
  {showCapture}
187
187
  can_write={true}
188
+ runnableArgs={data?.args}
188
189
  bind:args
189
190
  headless
190
191
  {captureInfo}
@@ -16,7 +16,7 @@ declare const __propDef: {
16
16
  events: {
17
17
  captureToggle: CustomEvent<undefined>;
18
18
  applyArgs: CustomEvent<{
19
- kind: "main" | "preprocessor";
19
+ kind: "preprocessor" | "main";
20
20
  args: Record<string, any> | undefined;
21
21
  }>;
22
22
  updateSchema: CustomEvent<{
@@ -16,7 +16,7 @@ declare const __propDef: {
16
16
  events: {
17
17
  captureToggle: CustomEvent<undefined>;
18
18
  applyArgs: CustomEvent<{
19
- kind: "main" | "preprocessor";
19
+ kind: "preprocessor" | "main";
20
20
  args: Record<string, any> | undefined;
21
21
  }>;
22
22
  updateSchema: CustomEvent<{
@@ -28,6 +28,7 @@ export let headless = false;
28
28
  export let captureInfo = undefined;
29
29
  export let captureTable = undefined;
30
30
  export let isValid = false;
31
+ export let runnableArgs = {};
31
32
  let validateTimeout = undefined;
32
33
  let routeError = '';
33
34
  async function validateRoute(path, method) {
@@ -91,9 +92,9 @@ $: updateArgs(route_path, http_method);
91
92
  <CopyableCodeBlock
92
93
  disabled={!captureInfo.active}
93
94
  code={`curl \\
94
- -X POST ${captureURL} \\
95
+ -X ${http_method.toUpperCase()} ${captureURL} \\
95
96
  -H 'Content-Type: application/json' \\
96
- -d '{"foo": 42}'`}
97
+ -d '${JSON.stringify(runnableArgs ?? {}, null, 2)}'`}
97
98
  language={bash}
98
99
  />
99
100
  </Label>
@@ -21,11 +21,12 @@ declare const __propDef: {
21
21
  captureInfo?: CaptureInfo | undefined;
22
22
  captureTable?: CaptureTable | undefined;
23
23
  isValid?: boolean | undefined;
24
+ runnableArgs?: any;
24
25
  };
25
26
  events: {
26
27
  captureToggle: CustomEvent<undefined>;
27
28
  applyArgs: CustomEvent<{
28
- kind: "main" | "preprocessor";
29
+ kind: "preprocessor" | "main";
29
30
  args: Record<string, any> | undefined;
30
31
  }>;
31
32
  updateSchema: CustomEvent<{
@@ -14,6 +14,7 @@ export let newItem = false;
14
14
  export let isEditor = false;
15
15
  export let canHavePreprocessor = false;
16
16
  export let hasPreprocessor = false;
17
+ export let args = {};
17
18
  let routeEditor;
18
19
  $: path && loadTriggers();
19
20
  const { triggersCount, selectedTrigger, defaultValues } = getContext('TriggerContext');
@@ -71,6 +72,7 @@ export async function loadTriggers() {
71
72
  {canHavePreprocessor}
72
73
  {hasPreprocessor}
73
74
  {newItem}
75
+ data={{ args }}
74
76
  />
75
77
  {#if !newItem}
76
78
  <Section label="Routes">
@@ -7,6 +7,7 @@ declare const __propDef: {
7
7
  isEditor?: boolean | undefined;
8
8
  canHavePreprocessor?: boolean | undefined;
9
9
  hasPreprocessor?: boolean | undefined;
10
+ args?: Record<string, any> | undefined;
10
11
  loadTriggers?: (() => Promise<void>) | undefined;
11
12
  };
12
13
  events: {
@@ -24,6 +24,7 @@ export let schema;
24
24
  export let isFlow;
25
25
  export let canHavePreprocessor = false;
26
26
  export let hasPreprocessor = false;
27
+ export let args = {};
27
28
  let eventStreamType = 'kafka';
28
29
  $: {
29
30
  if ($selectedTrigger === 'kafka' || $selectedTrigger === 'nats') {
@@ -72,7 +73,7 @@ onDestroy(() => {
72
73
  path={currentPath}
73
74
  {hash}
74
75
  {isFlow}
75
- args={{}}
76
+ {args}
76
77
  token=""
77
78
  {newItem}
78
79
  isEditor={true}
@@ -105,6 +106,7 @@ onDestroy(() => {
105
106
  on:updateSchema
106
107
  on:testWithArgs
107
108
  {newItem}
109
+ {args}
108
110
  path={currentPath}
109
111
  {isFlow}
110
112
  isEditor={true}
@@ -10,6 +10,7 @@ declare const __propDef: {
10
10
  isFlow: boolean;
11
11
  canHavePreprocessor?: boolean | undefined;
12
12
  hasPreprocessor?: boolean | undefined;
13
+ args?: Record<string, any> | undefined;
13
14
  };
14
15
  events: {
15
16
  applyArgs: any;
@@ -69,7 +69,6 @@ function updateShowCapture(show) {
69
69
  {disabled}
70
70
  startIcon={{ icon: Save }}
71
71
  on:click={() => {
72
- console.log('saveTrigger', args)
73
72
  dispatch('saveTrigger', {
74
73
  config: args
75
74
  })
@@ -34,7 +34,7 @@ export let data = {};
34
34
  {path}
35
35
  hash={data?.hash}
36
36
  token={data?.token}
37
- {args}
37
+ runnableArgs={data?.args}
38
38
  scopes={data?.scopes}
39
39
  showCapture={false}
40
40
  />
@@ -23,7 +23,7 @@ export let isFlow = false;
23
23
  export let path = '';
24
24
  export let hash = undefined;
25
25
  export let token = '';
26
- export let args;
26
+ export let runnableArgs;
27
27
  export let triggerTokens = undefined;
28
28
  export let scopes = [];
29
29
  export let showCapture = false;
@@ -90,7 +90,7 @@ export async function main() {
90
90
  async function triggerJob() {
91
91
  ${requestType === 'get_path'
92
92
  ? '// Payload is a base64 encoded string of the arguments'
93
- : `const body = JSON.stringify(${JSON.stringify(args, null, 2).replaceAll('\n', '\n\t')});`}
93
+ : `const body = JSON.stringify(${JSON.stringify(runnableArgs ?? {}, null, 2).replaceAll('\n', '\n\t')});`}
94
94
  const endpoint = \`${url}\`;
95
95
 
96
96
  return await fetch(endpoint, {
@@ -110,7 +110,7 @@ export async function main() {
110
110
  // triggerJob function
111
111
  let triggerJobFunction = `
112
112
  async function triggerJob() {
113
- const body = JSON.stringify(${JSON.stringify(args, null, 2).replaceAll('\n', '\n\t')});
113
+ const body = JSON.stringify(${JSON.stringify(runnableArgs ?? {}, null, 2).replaceAll('\n', '\n\t')});
114
114
  const endpoint = \`${url}\`;
115
115
 
116
116
  return await fetch(endpoint, {
@@ -158,7 +158,7 @@ function captureCurlCode() {
158
158
  }
159
159
  function curlCode() {
160
160
  return `TOKEN='${token}'
161
- ${requestType !== 'get_path' ? `BODY='${JSON.stringify(args)}'` : ''}
161
+ ${requestType !== 'get_path' ? `BODY='${JSON.stringify(runnableArgs ?? {})}'` : ''}
162
162
  URL='${url}'
163
163
  ${webhookType === 'sync' ? 'RESULT' : 'UUID'}=$(curl -s ${requestType != 'get_path' ? "-H 'Content-Type: application/json'" : ''} ${tokenType === 'headers' ? `-H "Authorization: Bearer $TOKEN"` : ''} -X ${requestType === 'get_path' ? 'GET' : 'POST'} ${requestType !== 'get_path' ? `-d "$BODY" ` : ''}$URL)
164
164
 
@@ -181,10 +181,10 @@ $: url =
181
181
  webhooks[webhookType][requestType] +
182
182
  (tokenType === 'query'
183
183
  ? `?token=${token}${requestType === 'get_path'
184
- ? `&payload=${encodeURIComponent(btoa(JSON.stringify(args)))}`
184
+ ? `&payload=${encodeURIComponent(btoa(JSON.stringify(runnableArgs ?? {})))}`
185
185
  : ''}`
186
186
  : `${requestType === 'get_path'
187
- ? `?payload=${encodeURIComponent(btoa(JSON.stringify(args)))}`
187
+ ? `?payload=${encodeURIComponent(btoa(JSON.stringify(runnableArgs ?? {})))}`
188
188
  : ''}`);
189
189
  </script>
190
190
 
@@ -321,7 +321,7 @@ $: url =
321
321
 
322
322
  {#if requestType !== 'get_path'}
323
323
  <Label label="Body">
324
- <ClipboardPanel content={JSON.stringify(args, null, 2)} />
324
+ <ClipboardPanel content={JSON.stringify(runnableArgs ?? {}, null, 2)} />
325
325
  </Label>
326
326
  {/if}
327
327
  {#key requestType}
@@ -335,7 +335,7 @@ $: url =
335
335
  </TabContent>
336
336
  <TabContent value="curl" class="flex flex-col flex-1 h-full">
337
337
  <div class="relative">
338
- {#key args}
338
+ {#key runnableArgs}
339
339
  {#key requestType}
340
340
  {#key webhookType}
341
341
  {#key tokenType}
@@ -356,7 +356,7 @@ $: url =
356
356
  </div>
357
357
  </TabContent>
358
358
  <TabContent value="fetch">
359
- {#key args}
359
+ {#key runnableArgs}
360
360
  {#key requestType}
361
361
  {#key webhookType}
362
362
  {#key tokenType}
@@ -8,7 +8,7 @@ declare const __propDef: {
8
8
  path?: string | undefined;
9
9
  hash?: string | undefined;
10
10
  token?: string | undefined;
11
- args: any;
11
+ runnableArgs: any;
12
12
  triggerTokens?: TriggerTokens | undefined;
13
13
  scopes?: string[] | undefined;
14
14
  showCapture?: boolean | undefined;
@@ -18,7 +18,7 @@ declare const __propDef: {
18
18
  events: {
19
19
  captureToggle: CustomEvent<undefined>;
20
20
  applyArgs: CustomEvent<{
21
- kind: "main" | "preprocessor";
21
+ kind: "preprocessor" | "main";
22
22
  args: Record<string, any> | undefined;
23
23
  }>;
24
24
  updateSchema: CustomEvent<{
@@ -3,7 +3,7 @@ import Description from '../Description.svelte';
3
3
  import HighlightTheme from '../HighlightTheme.svelte';
4
4
  import TriggersEditorSection from './TriggersEditorSection.svelte';
5
5
  export let token;
6
- export let args;
6
+ export let args = {};
7
7
  export let scopes = [];
8
8
  export let isFlow = false;
9
9
  export let hash = undefined;
@@ -12,7 +12,7 @@ export let newItem = false;
12
12
  export let isEditor = false;
13
13
  export let canHavePreprocessor = false;
14
14
  export let hasPreprocessor = false;
15
- let data = {
15
+ $: data = {
16
16
  hash,
17
17
  token,
18
18
  scopes,
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  token: string;
5
- args: any;
5
+ args?: Record<string, any> | undefined;
6
6
  scopes?: string[] | undefined;
7
7
  isFlow?: boolean | undefined;
8
8
  hash?: string | undefined;
@@ -16,7 +16,7 @@ declare const __propDef: {
16
16
  events: {
17
17
  captureToggle: CustomEvent<undefined>;
18
18
  applyArgs: CustomEvent<{
19
- kind: "main" | "preprocessor";
19
+ kind: "preprocessor" | "main";
20
20
  args: Record<string, any> | undefined;
21
21
  }>;
22
22
  updateSchema: CustomEvent<{