writer 1.26.0rc6__py3-none-any.whl → 1.26.0rc7__py3-none-any.whl

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 (59) hide show
  1. writer/blueprints.py +74 -13
  2. writer/core.py +0 -4
  3. writer/serve.py +20 -37
  4. writer/static/assets/BaseMarkdown-BSc5Bag2.js +1 -0
  5. writer/static/assets/{BlueprintToolbar-DVUfMDOe.js → BlueprintToolbar-DWShS72N.js} +1 -1
  6. writer/static/assets/{BuilderApp-qED3aDKo.js → BuilderApp-DQFSeMDQ.js} +3 -3
  7. writer/static/assets/{BuilderApplicationSelect-BJ1wURn2.js → BuilderApplicationSelect-Dmjc2Qut.js} +2 -2
  8. writer/static/assets/{BuilderBlueprintLibraryPanel-x19vMLF4.js → BuilderBlueprintLibraryPanel-zYV3k4oQ.js} +1 -1
  9. writer/static/assets/{BuilderEmbeddedCodeEditor-Bj6Sgtgt.js → BuilderEmbeddedCodeEditor-D2Lwpt_c.js} +6 -6
  10. writer/static/assets/{BuilderGraphSelect-D9INSON_.js → BuilderGraphSelect-C6ExUEN2.js} +2 -2
  11. writer/static/assets/{BuilderInsertionLabel-MHfXpIOO.js → BuilderInsertionLabel-lq5R-8P7.js} +1 -1
  12. writer/static/assets/{BuilderInsertionOverlay-CIpKQKuY.js → BuilderInsertionOverlay-CYr2EhtN.js} +1 -1
  13. writer/static/assets/{BuilderJournal-FTQFwGS4.js → BuilderJournal-DXgb4K4t.js} +2 -2
  14. writer/static/assets/{BuilderModelSelect-DftqmutG.js → BuilderModelSelect-B3vH5Z4Z.js} +2 -2
  15. writer/static/assets/{BuilderSettings-BbY87dIX.js → BuilderSettings-BOOx97bk.js} +5 -5
  16. writer/static/assets/{BuilderSettingsArtifactAPITriggerDetails-3nsaHJvB.js → BuilderSettingsArtifactAPITriggerDetails-DhAkYo3D.js} +1 -1
  17. writer/static/assets/{BuilderSettingsDeploySharedBlueprint-Stay3qnW.js → BuilderSettingsDeploySharedBlueprint-BRflSyXc.js} +1 -1
  18. writer/static/assets/{BuilderSettingsHandlers-RBEsCixX.js → BuilderSettingsHandlers-BEEAzbBD.js} +1 -1
  19. writer/static/assets/{BuilderSidebarComponentTree-DpiYnJWr.js → BuilderSidebarComponentTree-U702DURV.js} +1 -1
  20. writer/static/assets/{BuilderSidebarToolkit-CpNDSTww.js → BuilderSidebarToolkit-Y8LWbc4D.js} +2 -2
  21. writer/static/assets/{BuilderTemplateEditor-CcFKJYey.js → BuilderTemplateEditor-p38HXz8H.js} +1 -1
  22. writer/static/assets/{BuilderVault-CxhSSIIr.js → BuilderVault-BNAOSuT2.js} +1 -1
  23. writer/static/assets/{ComponentRenderer-zimca0Eh.js → ComponentRenderer-C6-z50aM.js} +1 -1
  24. writer/static/assets/{SharedCopyClipboardButton-7YmYxT3t.js → SharedCopyClipboardButton-zKPPEoWf.js} +1 -1
  25. writer/static/assets/{WdsCheckbox-EE871rXO.js → WdsCheckbox-CjK48piR.js} +1 -1
  26. writer/static/assets/{WdsDropdownMenu-BvcU3OWW.js → WdsDropdownMenu-DPkY81S5.js} +1 -1
  27. writer/static/assets/{WdsFieldWrapper-CRqycMNr.js → WdsFieldWrapper-DRQKJkmD.js} +1 -1
  28. writer/static/assets/{WdsTabs-XqPTINWn.js → WdsTabs-3Pn5IB6k.js} +1 -1
  29. writer/static/assets/{cssMode-BVRi2g3_.js → cssMode-D2hEl28S.js} +1 -1
  30. writer/static/assets/{freemarker2-Vg1gfNc8.js → freemarker2-Do_jeiok.js} +1 -1
  31. writer/static/assets/{handlebars-DsG3EQRC.js → handlebars-CkprOcIc.js} +1 -1
  32. writer/static/assets/{html-DwKOS_Zw.js → html-CaHdQD7y.js} +1 -1
  33. writer/static/assets/{htmlMode-CHiSrjBo.js → htmlMode-CpM6fZMW.js} +1 -1
  34. writer/static/assets/{index-CLl1LyU3.js → index-Ddb1pi-T.js} +1 -1
  35. writer/static/assets/{index-R5GTxlxw.js → index-NiGRlfsB.js} +1 -1
  36. writer/static/assets/{index-D4wn96Pc.js → index-dyx4v2bZ.js} +12 -12
  37. writer/static/assets/{javascript-cy7za2vf.js → javascript-CWNDfvsl.js} +1 -1
  38. writer/static/assets/{jsonMode-B9G9YRRg.js → jsonMode-BW3rVtJH.js} +1 -1
  39. writer/static/assets/{liquid-Dn8FCzAD.js → liquid-DDiOMe80.js} +1 -1
  40. writer/static/assets/{mapbox-gl-CGlfgAZd.js → mapbox-gl-DfMRdLTn.js} +1 -1
  41. writer/static/assets/{mdx-Bevk2Se_.js → mdx-hjngaGrl.js} +1 -1
  42. writer/static/assets/{pdf-BxGdrNqo.js → pdf-9658WUVu.js} +1 -1
  43. writer/static/assets/{plotly.min-BdJVbxh8.js → plotly.min-ClZhwGlN.js} +1 -1
  44. writer/static/assets/{python-BIK2GyIe.js → python-xCo7eXR9.js} +1 -1
  45. writer/static/assets/{razor-Dm-08NmG.js → razor-DUCCVGM0.js} +1 -1
  46. writer/static/assets/{tsMode-uuJlx9Li.js → tsMode-BdY9EHbB.js} +1 -1
  47. writer/static/assets/{typescript-BoguEfAA.js → typescript-CC5Uj4fk.js} +1 -1
  48. writer/static/assets/{useBlueprintRun-Bx90XHia.js → useBlueprintRun-Daoo3Uhe.js} +1 -1
  49. writer/static/assets/{useKeyValueEditor-BWemAJdj.js → useKeyValueEditor-BHh_FKR7.js} +1 -1
  50. writer/static/assets/{useListResources-DjUI1zxo.js → useListResources-DdhCMljT.js} +1 -1
  51. writer/static/assets/{xml-BQNlasD4.js → xml-BP6Z214C.js} +1 -1
  52. writer/static/assets/{yaml-B61Z_xae.js → yaml-DkcSXuEO.js} +1 -1
  53. writer/static/index.html +1 -1
  54. {writer-1.26.0rc6.dist-info → writer-1.26.0rc7.dist-info}/METADATA +1 -1
  55. {writer-1.26.0rc6.dist-info → writer-1.26.0rc7.dist-info}/RECORD +58 -58
  56. writer/static/assets/BaseMarkdown-NctCalz1.js +0 -1
  57. {writer-1.26.0rc6.dist-info → writer-1.26.0rc7.dist-info}/WHEEL +0 -0
  58. {writer-1.26.0rc6.dist-info → writer-1.26.0rc7.dist-info}/entry_points.txt +0 -0
  59. {writer-1.26.0rc6.dist-info → writer-1.26.0rc7.dist-info}/licenses/LICENSE.txt +0 -0
writer/blueprints.py CHANGED
@@ -69,6 +69,10 @@ class BlueprintRunner:
69
69
  def api_blueprints(self):
70
70
  return self._gather_api_blueprints()
71
71
 
72
+ @property
73
+ def cron_blueprints(self):
74
+ return self._gather_cron_blueprints()
75
+
72
76
  @contextmanager
73
77
  def _get_executor(self) -> Generator[ThreadPoolExecutor, None, None]:
74
78
  """Return the application's thread pool executor.
@@ -137,6 +141,17 @@ class BlueprintRunner:
137
141
  """
138
142
  return blueprint_id in self.api_blueprints
139
143
 
144
+ def is_blueprint_cron_available(
145
+ self, blueprint_id: str
146
+ ):
147
+ """
148
+ Checks if a blueprint with the given key is available for Cron execution.
149
+
150
+ :param blueprint_id: The blueprint identifier.
151
+ :return: True if the blueprint is available for Cron execution, False otherwise.
152
+ """
153
+ return blueprint_id in self.cron_blueprints
154
+
140
155
  def get_blueprint_api_trigger(
141
156
  self, blueprint_id: str
142
157
  ):
@@ -152,17 +167,33 @@ class BlueprintRunner:
152
167
  )
153
168
  return self.api_blueprints[blueprint_id]
154
169
 
155
- def _gather_api_blueprints(self):
170
+ def get_blueprint_cron_trigger(
171
+ self, blueprint_id: str
172
+ ):
156
173
  """
157
- Gathers all blueprints that have an API trigger.
174
+ Retrieves the Cron trigger for a given blueprint key.
175
+
176
+ :param blueprint_key: The blueprint identifier.
177
+ :return: The Cron trigger component.
178
+ """
179
+ if not self.is_blueprint_cron_available(blueprint_id):
180
+ raise ValueError(
181
+ f'Cron trigger not found for blueprint "{blueprint_id}".'
182
+ )
183
+ return self.cron_blueprints[blueprint_id]
158
184
 
159
- :return: A set of blueprint keys that have an API trigger.
185
+ def _gather_blueprints_by_trigger(self, trigger_type: str):
186
+ """
187
+ Gathers all blueprints that have a trigger of the specified type.
188
+
189
+ :param trigger_type: The trigger component type (e.g., "blueprints_apitrigger").
190
+ :return: A dict mapping blueprint IDs to their trigger IDs.
160
191
  """
161
192
  triggers = [
162
193
  c for c in self.session.session_component_tree.components.values()
163
- if c.type == "blueprints_apitrigger"
164
- ]
165
- api_blueprints = {}
194
+ if c.type == trigger_type
195
+ ]
196
+ blueprints = {}
166
197
 
167
198
  for trigger in triggers:
168
199
  parent_blueprint_id = \
@@ -170,7 +201,7 @@ class BlueprintRunner:
170
201
  parent_blueprint = \
171
202
  self.session.session_component_tree.get_component(
172
203
  parent_blueprint_id
173
- )
204
+ )
174
205
 
175
206
  if (
176
207
  parent_blueprint
@@ -178,15 +209,29 @@ class BlueprintRunner:
178
209
  parent_blueprint.type == "blueprints_blueprint"
179
210
  ):
180
211
  # Store the blueprint key against its trigger ID
181
- api_blueprints[parent_blueprint_id] = \
182
- trigger.id
212
+ blueprints[parent_blueprint_id] = trigger.id
183
213
 
184
- return api_blueprints
214
+ return blueprints
215
+
216
+ def _gather_api_blueprints(self):
217
+ """
218
+ Gathers all blueprints that have an API trigger.
219
+
220
+ :return: A dict mapping blueprint IDs to their API trigger IDs.
221
+ """
222
+ return self._gather_blueprints_by_trigger("blueprints_apitrigger")
223
+
224
+ def _gather_cron_blueprints(self):
225
+ """
226
+ Gathers all blueprints that have a Cron trigger.
227
+
228
+ :return: A dict mapping blueprint IDs to their Cron trigger IDs.
229
+ """
230
+ return self._gather_blueprints_by_trigger("blueprints_crontrigger")
185
231
 
186
232
  def run_blueprint_via_api(
187
233
  self,
188
234
  blueprint_id: str,
189
- trigger_type: Literal["API", "Cron"],
190
235
  branch_id: Optional[str] = None,
191
236
  execution_environment: Optional[Dict[str, Any]] = None
192
237
  ):
@@ -194,6 +239,7 @@ class BlueprintRunner:
194
239
  Executes a blueprint by its key via the API.
195
240
 
196
241
  :param blueprint_id: The blueprint identifier.
242
+ :param branch_id: Optional branch ID to start execution from.
197
243
  :param execution_environment: The execution environment for
198
244
  the blueprint.
199
245
  :return: The result of the blueprint execution.
@@ -202,9 +248,24 @@ class BlueprintRunner:
202
248
  execution_environment = {}
203
249
 
204
250
  trigger_id = branch_id
205
- if trigger_id is None:
251
+ if trigger_id is not None:
252
+ # Determine trigger type from the component
253
+ component = self.session.session_component_tree.get_component(trigger_id)
254
+ if component and component.type == "blueprints_apitrigger":
255
+ trigger_type = "API"
256
+ elif component and component.type == "blueprints_crontrigger":
257
+ trigger_type = "Cron"
258
+ else:
259
+ trigger_type = "Branch"
260
+ elif self.is_blueprint_api_available(blueprint_id):
261
+ # Prioritize API trigger over Cron if both exist
206
262
  trigger_id = self.get_blueprint_api_trigger(blueprint_id)
207
-
263
+ trigger_type = "API"
264
+ elif self.is_blueprint_cron_available(blueprint_id):
265
+ trigger_id = self.get_blueprint_cron_trigger(blueprint_id)
266
+ trigger_type = "Cron"
267
+ else:
268
+ raise ValueError(f'No trigger found for blueprint "{blueprint_id}".')
208
269
  return self.run_branch(
209
270
  trigger_id,
210
271
  None,
writer/core.py CHANGED
@@ -1283,15 +1283,11 @@ class EventHandlerRegistry:
1283
1283
  blueprint_id = payload.pop("blueprint_id", None)
1284
1284
  if not blueprint_id:
1285
1285
  raise ValueError("Missing blueprint_id in payload")
1286
- trigger_type = payload.pop("trigger_type", None)
1287
- if not trigger_type:
1288
- raise ValueError("Missing trigger_type in payload")
1289
1286
  execution_environment = EventHandler._get_blueprint_execution_environment(
1290
1287
  payload, context, session, vault
1291
1288
  )
1292
1289
  return blueprint_runner.run_blueprint_via_api(
1293
1290
  blueprint_id=blueprint_id,
1294
- trigger_type=trigger_type,
1295
1291
  branch_id=payload.pop("branch_id", None),
1296
1292
  execution_environment=execution_environment,
1297
1293
  )
writer/serve.py CHANGED
@@ -385,12 +385,13 @@ def get_asgi_app(
385
385
  raise HTTPException(status_code=400, detail="Cannot parse the payload.")
386
386
  return payload
387
387
 
388
- def has_api_trigger(app_runner: AppRunner, blueprint_id: str) -> bool:
389
- # Check if blueprint has at least one API trigger component
388
+ def is_blueprint_triggerable(app_runner: AppRunner, blueprint_id: str) -> bool:
389
+ """Check if blueprint has at least one supported trigger (API or Cron)."""
390
390
  if not app_runner.bmc_components:
391
391
  return False
392
+ supported_triggers = ("blueprints_apitrigger", "blueprints_crontrigger")
392
393
  return any(
393
- comp["type"] == "blueprints_apitrigger" and comp.get("parentId") == blueprint_id
394
+ comp["type"] in supported_triggers and comp.get("parentId") == blueprint_id
394
395
  for comp in app_runner.bmc_components.values()
395
396
  )
396
397
 
@@ -409,7 +410,7 @@ def get_asgi_app(
409
410
  }
410
411
  for comp in app_runner.bmc_components.values()
411
412
  if comp["type"] == "blueprints_blueprint"
412
- and has_api_trigger(app_runner, comp["id"])
413
+ and is_blueprint_triggerable(app_runner, comp["id"])
413
414
  ]
414
415
 
415
416
  return JSONResponse(content=blueprints)
@@ -520,9 +521,9 @@ def get_asgi_app(
520
521
  }))
521
522
  return
522
523
 
523
- if not branch_id and not has_api_trigger(app_runner, blueprint_id):
524
+ if not branch_id and not is_blueprint_triggerable(app_runner, blueprint_id):
524
525
  await queue.put(await format_event("error", {
525
- "msg": f"Blueprint '{blueprint_id}' lacks an API trigger.",
526
+ "msg": f"Blueprint '{blueprint_id}' lacks a supported trigger (API or Cron).",
526
527
  "finished_at": int(time.time())
527
528
  }))
528
529
  return
@@ -538,39 +539,21 @@ def get_asgi_app(
538
539
 
539
540
  await queue.put(await format_event("status", {"status": "executing", "msg": (f"Executing branch: {branch_id}..." if branch_id else f"Executing blueprint: {blueprint_id}...")}))
540
541
 
541
- if branch_id:
542
- task = asyncio.create_task(
543
- app_runner.handle_event(
544
- session_id,
545
- WriterEvent(
546
- type="wf-run-blueprint-via-api",
547
- isSafe=True,
548
- handler="run_blueprint_via_api",
549
- payload={
550
- "blueprint_id": blueprint_id,
551
- "trigger_type": "Cron",
552
- "branch_id": branch_id,
553
- **(payload or {})
554
- },
555
- )
556
- )
557
- )
558
- else:
559
- task = asyncio.create_task(
560
- app_runner.handle_event(
561
- session_id,
562
- WriterEvent(
563
- type="wf-run-blueprint-via-api",
564
- isSafe=True,
565
- handler="run_blueprint_via_api",
566
- payload={
567
- "blueprint_id": blueprint_id,
568
- "trigger_type": "API",
569
- **(payload or {})
570
- },
571
- )
542
+ task = asyncio.create_task(
543
+ app_runner.handle_event(
544
+ session_id,
545
+ WriterEvent(
546
+ type="wf-run-blueprint-via-api",
547
+ isSafe=True,
548
+ handler="run_blueprint_via_api",
549
+ payload={
550
+ "blueprint_id": blueprint_id,
551
+ "branch_id": branch_id,
552
+ **(payload or {})
553
+ },
572
554
  )
573
555
  )
556
+ )
574
557
 
575
558
  await queue.put(await format_event("status", {"status": "running", "msg": ("Branch is running. Awaiting output..." if branch_id else "Blueprint is running. Awaiting output...")}))
576
559
 
@@ -0,0 +1 @@
1
+ import{aV as f}from"./index-dyx4v2bZ.js";export{f as default};
@@ -1 +1 @@
1
- import{u as E}from"./useBlueprintRun-Bx90XHia.js";import{d as j,c as S,m as I,r as J,aR as M,aS as P,o as c,f as g,g as b,J as N,x as l,y as v,z as _,K as G,R as w,S as A,as as K,G as F,_ as x,i as D,a as $,D as L,E as Y,W as T,t as W,aT as H,Y as Q,b as R,A as z,ae as U}from"./index-D4wn96Pc.js";const X=["disabled"],Z=["disabled"],tt=j({__name:"WdsButtonSplit",props:{variant:{type:String,default:"primary"},size:{type:String,default:"default"},disabled:{type:Boolean,required:!1}},emits:{mainClick:()=>!0,dropdownOpen:()=>!0,dropdownClose:()=>!0},setup(u,{expose:C,emit:m}){const a=u,d=S(()=>[`WdsButtonSplit--size-${a.size}`,`WdsButtonSplit--variant-${a.variant}`,a.disabled?"WdsButtonSplit--disabled":void 0]),f=m,e=I("btn"),o=I("dropdown"),n=J(!1),{floatingStyles:r}=M(e,o,{placement:"bottom-end",middleware:[P(12)]});function s(B=!n.value){n.value=B,n.value?f("dropdownOpen"):f("dropdownClose")}return C({toggleDropdown:s}),(B,p)=>(c(),g("div",{ref_key:"btn",ref:e,class:F(["WdsButtonSplit",d.value])},[b("button",{type:"button",class:"WdsButtonSplit__main",disabled:u.disabled,onClick:p[0]||(p[0]=y=>B.$emit("mainClick"))},[N(B.$slots,"button",{},void 0,!0)],8,X),p[2]||(p[2]=b("hr",{class:"WdsButtonSplit__divider"},null,-1)),b("button",{class:"WdsButtonSplit__dropdownTrigger",type:"button",disabled:u.disabled,onClickCapture:p[1]||(p[1]=y=>s())},[l(v,{name:n.value?"chevron-up":"chevron-down"},null,8,["name"])],40,Z),l(K,null,{default:_(()=>[n.value?(c(),g("div",{key:0,ref_key:"dropdown",ref:o,style:G(w(r))},[N(B.$slots,"dropdown",{},void 0,!0)],4)):A("",!0)]),_:3})],2))}}),et=x(tt,[["__scopeId","data-v-e9224293"]]),nt={class:"BlueprintToolbarBlocksDropdown"},ot={class:"BlueprintToolbarBlocksDropdown__list"},st={class:"BlueprintToolbarBlocksDropdown__list__item__description"},at={class:"BlueprintToolbarBlocksDropdown__list__item__title"},rt=j({__name:"BlueprintToolbarBlocksDropdown",props:{components:{type:Array,required:!0}},emits:{jumpToComponent:u=>typeof u=="string",runBranch:u=>typeof u=="string"},setup(u){const C=u,m=D($.core);function a(e){const o=m.getComponentDefinition(e.type);return(o==null?void 0:o.name)??e.type}function d(e){if(e.type!=="blueprints_uieventtrigger"||!!e.content.defaultResult)return!0;const n=(e.outs??[]).map(s=>m.getComponentById(s.toNodeId)).flatMap(s=>Object.values(s.content??{}));return n.length===0?!0:!n.some(s=>s.includes("@{result}"))}const f=S(()=>C.components.map(e=>{var s;const o=m.getComponentDefinition(e.type),n=((s=e.content)==null?void 0:s.alias)||a(e),r=(o==null?void 0:o.name)??e.type;return{id:e.id,disabled:!d(e),title:n,description:n===r?void 0:r}}));return(e,o)=>(c(),g("div",nt,[o[0]||(o[0]=b("p",{class:"BlueprintToolbarBlocksDropdown__header"}," Start blueprint from ",-1)),b("div",ot,[(c(!0),g(L,null,Y(f.value,n=>(c(),g("div",{key:n.id,class:F(["BlueprintToolbarBlocksDropdown__list__item",{"BlueprintToolbarBlocksDropdown__list__item--disabled":n.disabled}])},[l(T,{variant:"primary",size:"smallIcon","custom-size":"20px",disabled:n.disabled,"data-writer-tooltip":n.disabled?"Can not run without a default result. Go to this block to define a default result.":"Run the branch",onClick:r=>e.$emit("runBranch",n.id)},{default:_(()=>[l(v,{name:"play"})]),_:2},1032,["disabled","data-writer-tooltip","onClick"]),b("div",null,[b("p",st,W(n.description),1),b("p",at,W(n.title),1)]),l(T,{variant:"neutral",size:"smallIcon","custom-size":"20px","data-writer-tooltip":"Jump to the blueprint",onClick:r=>e.$emit("jumpToComponent",n.id)},{default:_(()=>[l(v,{name:"square-dashed-mouse-pointer"})]),_:2},1032,["onClick"])],2))),128))])]))}}),lt=x(rt,[["__scopeId","data-v-e0d0a711"]]),it={ref:"root",class:"BlueprintToolbar","data-writer-unselectable":!0},ut=j({__name:"BlueprintToolbar",emits:{autogenClick:()=>!0,deploy:()=>!0},setup(u,{emit:C}){const m=C,a=D($.core),d=D($.builderManager),f=D($.componentId),e=I("runBlueprintBtn"),{run:o,stop:n,isRunning:r}=E(a,d,f),s=S(()=>Array.isArray(a.featureFlags.value)&&a.featureFlags.value.includes("blueprint_library")),B=S(()=>{const i=a.getComponentById(f);return H(i)}),p=S(()=>a.getComponents(f).filter(i=>{var t;return((t=a.getComponentDefinition(i.type))==null?void 0:t.category)==="Triggers"})),y=Q([]);function O(){y.value=U(d.selection.value),d.setSelection(null)}function q(){var i;if((i=y.value)!=null&&i.length){d.setSelection(null);for(const t of y.value)d.appendSelection(t.componentId,t.instancePath,t.source);y.value=[]}}function V(i){var t;d.setSelection(i,void 0,"click"),(t=e.value)==null||t.toggleDropdown(!1)}async function h(i){var t;(t=e.value)==null||t.toggleDropdown(!1),await o(i)}return(i,t)=>(c(),g("div",it,[l(T,{variant:"tertiary",size:"icon","data-automation-action":"run-autogen","data-writer-tooltip":"Autogen","data-writer-tooltip-placement":"bottom",onClick:t[0]||(t[0]=k=>m("autogenClick"))},{default:_(()=>[l(v,{name:"wand-sparkles"})]),_:1}),s.value&&B.value?(c(),R(T,{key:0,variant:"special","data-automation-action":"publish-shared-blueprint","data-writer-tooltip":"Publish this shared blueprint","data-writer-tooltip-placement":"bottom",onClick:t[1]||(t[1]=k=>m("deploy"))},{default:_(()=>[l(v,{name:"rocket"}),t[5]||(t[5]=z(" Publish blueprint "))]),_:1})):A("",!0),p.value.length&&!w(r)?(c(),R(et,{key:1,ref_key:"runBlueprintBtn",ref:e,class:"BlueprintToolbar__runBlueprintDropdown",variant:"special",onMainClick:t[3]||(t[3]=k=>h()),onDropdownOpen:O,onDropdownClose:q},{button:_(()=>[l(v,{name:"play"}),t[6]||(t[6]=z(" Run blueprint "))]),dropdown:_(()=>[l(lt,{components:p.value,onJumpToComponent:V,onRunBranch:t[2]||(t[2]=k=>h(k))},null,8,["components"])]),_:1},512)):(c(),R(T,{key:2,class:"BlueprintToolbar__runBlueprint","data-automation-action":"run-blueprint",variant:"special",onClick:t[4]||(t[4]=k=>w(r)?w(n)():h())},{default:_(()=>[l(v,{name:w(r)?"square":"play"},null,8,["name"]),z(" "+W(w(r)?"Stop run":"Run blueprint"),1)]),_:1}))],512))}}),ct=x(ut,[["__scopeId","data-v-5b7eb059"]]);export{ct as default};
1
+ import{u as E}from"./useBlueprintRun-Daoo3Uhe.js";import{d as j,c as S,m as I,r as J,aR as M,aS as P,o as c,f as g,g as b,J as N,x as l,y as v,z as _,K as G,R as w,S as A,as as K,G as F,_ as x,i as D,a as $,D as L,E as Y,W as T,t as W,aT as H,Y as Q,b as R,A as z,ae as U}from"./index-dyx4v2bZ.js";const X=["disabled"],Z=["disabled"],tt=j({__name:"WdsButtonSplit",props:{variant:{type:String,default:"primary"},size:{type:String,default:"default"},disabled:{type:Boolean,required:!1}},emits:{mainClick:()=>!0,dropdownOpen:()=>!0,dropdownClose:()=>!0},setup(u,{expose:C,emit:m}){const a=u,d=S(()=>[`WdsButtonSplit--size-${a.size}`,`WdsButtonSplit--variant-${a.variant}`,a.disabled?"WdsButtonSplit--disabled":void 0]),f=m,e=I("btn"),o=I("dropdown"),n=J(!1),{floatingStyles:r}=M(e,o,{placement:"bottom-end",middleware:[P(12)]});function s(B=!n.value){n.value=B,n.value?f("dropdownOpen"):f("dropdownClose")}return C({toggleDropdown:s}),(B,p)=>(c(),g("div",{ref_key:"btn",ref:e,class:F(["WdsButtonSplit",d.value])},[b("button",{type:"button",class:"WdsButtonSplit__main",disabled:u.disabled,onClick:p[0]||(p[0]=y=>B.$emit("mainClick"))},[N(B.$slots,"button",{},void 0,!0)],8,X),p[2]||(p[2]=b("hr",{class:"WdsButtonSplit__divider"},null,-1)),b("button",{class:"WdsButtonSplit__dropdownTrigger",type:"button",disabled:u.disabled,onClickCapture:p[1]||(p[1]=y=>s())},[l(v,{name:n.value?"chevron-up":"chevron-down"},null,8,["name"])],40,Z),l(K,null,{default:_(()=>[n.value?(c(),g("div",{key:0,ref_key:"dropdown",ref:o,style:G(w(r))},[N(B.$slots,"dropdown",{},void 0,!0)],4)):A("",!0)]),_:3})],2))}}),et=x(tt,[["__scopeId","data-v-e9224293"]]),nt={class:"BlueprintToolbarBlocksDropdown"},ot={class:"BlueprintToolbarBlocksDropdown__list"},st={class:"BlueprintToolbarBlocksDropdown__list__item__description"},at={class:"BlueprintToolbarBlocksDropdown__list__item__title"},rt=j({__name:"BlueprintToolbarBlocksDropdown",props:{components:{type:Array,required:!0}},emits:{jumpToComponent:u=>typeof u=="string",runBranch:u=>typeof u=="string"},setup(u){const C=u,m=D($.core);function a(e){const o=m.getComponentDefinition(e.type);return(o==null?void 0:o.name)??e.type}function d(e){if(e.type!=="blueprints_uieventtrigger"||!!e.content.defaultResult)return!0;const n=(e.outs??[]).map(s=>m.getComponentById(s.toNodeId)).flatMap(s=>Object.values(s.content??{}));return n.length===0?!0:!n.some(s=>s.includes("@{result}"))}const f=S(()=>C.components.map(e=>{var s;const o=m.getComponentDefinition(e.type),n=((s=e.content)==null?void 0:s.alias)||a(e),r=(o==null?void 0:o.name)??e.type;return{id:e.id,disabled:!d(e),title:n,description:n===r?void 0:r}}));return(e,o)=>(c(),g("div",nt,[o[0]||(o[0]=b("p",{class:"BlueprintToolbarBlocksDropdown__header"}," Start blueprint from ",-1)),b("div",ot,[(c(!0),g(L,null,Y(f.value,n=>(c(),g("div",{key:n.id,class:F(["BlueprintToolbarBlocksDropdown__list__item",{"BlueprintToolbarBlocksDropdown__list__item--disabled":n.disabled}])},[l(T,{variant:"primary",size:"smallIcon","custom-size":"20px",disabled:n.disabled,"data-writer-tooltip":n.disabled?"Can not run without a default result. Go to this block to define a default result.":"Run the branch",onClick:r=>e.$emit("runBranch",n.id)},{default:_(()=>[l(v,{name:"play"})]),_:2},1032,["disabled","data-writer-tooltip","onClick"]),b("div",null,[b("p",st,W(n.description),1),b("p",at,W(n.title),1)]),l(T,{variant:"neutral",size:"smallIcon","custom-size":"20px","data-writer-tooltip":"Jump to the blueprint",onClick:r=>e.$emit("jumpToComponent",n.id)},{default:_(()=>[l(v,{name:"square-dashed-mouse-pointer"})]),_:2},1032,["onClick"])],2))),128))])]))}}),lt=x(rt,[["__scopeId","data-v-e0d0a711"]]),it={ref:"root",class:"BlueprintToolbar","data-writer-unselectable":!0},ut=j({__name:"BlueprintToolbar",emits:{autogenClick:()=>!0,deploy:()=>!0},setup(u,{emit:C}){const m=C,a=D($.core),d=D($.builderManager),f=D($.componentId),e=I("runBlueprintBtn"),{run:o,stop:n,isRunning:r}=E(a,d,f),s=S(()=>Array.isArray(a.featureFlags.value)&&a.featureFlags.value.includes("blueprint_library")),B=S(()=>{const i=a.getComponentById(f);return H(i)}),p=S(()=>a.getComponents(f).filter(i=>{var t;return((t=a.getComponentDefinition(i.type))==null?void 0:t.category)==="Triggers"})),y=Q([]);function O(){y.value=U(d.selection.value),d.setSelection(null)}function q(){var i;if((i=y.value)!=null&&i.length){d.setSelection(null);for(const t of y.value)d.appendSelection(t.componentId,t.instancePath,t.source);y.value=[]}}function V(i){var t;d.setSelection(i,void 0,"click"),(t=e.value)==null||t.toggleDropdown(!1)}async function h(i){var t;(t=e.value)==null||t.toggleDropdown(!1),await o(i)}return(i,t)=>(c(),g("div",it,[l(T,{variant:"tertiary",size:"icon","data-automation-action":"run-autogen","data-writer-tooltip":"Autogen","data-writer-tooltip-placement":"bottom",onClick:t[0]||(t[0]=k=>m("autogenClick"))},{default:_(()=>[l(v,{name:"wand-sparkles"})]),_:1}),s.value&&B.value?(c(),R(T,{key:0,variant:"special","data-automation-action":"publish-shared-blueprint","data-writer-tooltip":"Publish this shared blueprint","data-writer-tooltip-placement":"bottom",onClick:t[1]||(t[1]=k=>m("deploy"))},{default:_(()=>[l(v,{name:"rocket"}),t[5]||(t[5]=z(" Publish blueprint "))]),_:1})):A("",!0),p.value.length&&!w(r)?(c(),R(et,{key:1,ref_key:"runBlueprintBtn",ref:e,class:"BlueprintToolbar__runBlueprintDropdown",variant:"special",onMainClick:t[3]||(t[3]=k=>h()),onDropdownOpen:O,onDropdownClose:q},{button:_(()=>[l(v,{name:"play"}),t[6]||(t[6]=z(" Run blueprint "))]),dropdown:_(()=>[l(lt,{components:p.value,onJumpToComponent:V,onRunBranch:t[2]||(t[2]=k=>h(k))},null,8,["components"])]),_:1},512)):(c(),R(T,{key:2,class:"BlueprintToolbar__runBlueprint","data-automation-action":"run-blueprint",variant:"special",onClick:t[4]||(t[4]=k=>w(r)?w(n)():h())},{default:_(()=>[l(v,{name:w(r)?"square":"play"},null,8,["name"]),z(" "+W(w(r)?"Stop run":"Run blueprint"),1)]),_:1}))],512))}}),ct=x(ut,[["__scopeId","data-v-5b7eb059"]]);export{ct as default};