@powerhousedao/workflow 6.2.3-dev.30 → 6.2.3-dev.32

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 (374) hide show
  1. package/README.md +8 -8
  2. package/dist/browser/BlockSelector-BHJQOhie.js +3051 -0
  3. package/dist/browser/BlockSelector-BHJQOhie.js.map +1 -0
  4. package/dist/browser/{connection-form-D-NETdDQ.js → connection-form-CaduwBiu.js} +349 -50
  5. package/dist/browser/connection-form-CaduwBiu.js.map +1 -0
  6. package/dist/browser/{data-tree-DA4sc7B7.js → data-tree-8219PVfh.js} +2 -2
  7. package/dist/browser/{data-tree-DA4sc7B7.js.map → data-tree-8219PVfh.js.map} +1 -1
  8. package/dist/browser/document-models/index.js +2 -2
  9. package/dist/browser/document-models/workflow/index.js +3 -3
  10. package/dist/browser/{document-models-BohsduV4.js → document-models-C1ZgIZyV.js} +7 -2
  11. package/dist/browser/{document-models-BohsduV4.js.map → document-models-C1ZgIZyV.js.map} +1 -1
  12. package/dist/browser/{editor-B6N0PCuZ.js → editor-BHV1MZS8.js} +2437 -6283
  13. package/dist/browser/editor-BHV1MZS8.js.map +1 -0
  14. package/dist/{node/editor-StBssjcQ.mjs → browser/editor-C0C1eB0R.js} +385 -119
  15. package/dist/browser/editor-C0C1eB0R.js.map +1 -0
  16. package/dist/browser/{editor-BkdwuOC-.js → editor-CFcXlZY2.js} +14 -24
  17. package/dist/browser/editor-CFcXlZY2.js.map +1 -0
  18. package/dist/browser/editors/connection-editor/module.js +1 -1
  19. package/dist/browser/editors/workflow-editor/module.js +1 -1
  20. package/dist/browser/editors/workflow-studio/module.js +1 -1
  21. package/dist/browser/index.js +97 -43
  22. package/dist/browser/index.js.map +1 -1
  23. package/dist/browser/{module-Bkms70LV.js → module-DU2vb3FH.js} +574 -94
  24. package/dist/browser/module-DU2vb3FH.js.map +1 -0
  25. package/dist/browser/{piece-auth-Z4mZEOtL.js → piece-auth-BS5CtQOG.js} +45 -12
  26. package/dist/browser/piece-auth-BS5CtQOG.js.map +1 -0
  27. package/dist/browser/reactor/index.js +2 -2
  28. package/dist/browser/runtime-queries-Ds2kk-Ow.js +2535 -0
  29. package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +1 -0
  30. package/dist/browser/trigger-text-BkcklsMX.js +5569 -0
  31. package/dist/browser/trigger-text-BkcklsMX.js.map +1 -0
  32. package/dist/browser/{upgrade-manifests-BLrv3cf2.js → upgrade-manifests-BpakVE9l.js} +2 -2
  33. package/dist/browser/{upgrade-manifests-BLrv3cf2.js.map → upgrade-manifests-BpakVE9l.js.map} +1 -1
  34. package/dist/browser/{workflow-CGtVlhr8.js → workflow-BxShRhVy.js} +3 -2
  35. package/dist/browser/workflow-BxShRhVy.js.map +1 -0
  36. package/dist/node/BlockSelector-lOcIiaqt.mjs +3055 -0
  37. package/dist/node/BlockSelector-lOcIiaqt.mjs.map +1 -0
  38. package/dist/node/{connection-form-C9vbfSnA.mjs → connection-form-DWt29kft.mjs} +349 -50
  39. package/dist/node/connection-form-DWt29kft.mjs.map +1 -0
  40. package/dist/node/{data-tree-CbqpF3lC.mjs → data-tree-Cdx85Y19.mjs} +2 -2
  41. package/dist/node/{data-tree-CbqpF3lC.mjs.map → data-tree-Cdx85Y19.mjs.map} +1 -1
  42. package/dist/node/document-models/index.mjs +2 -2
  43. package/dist/node/document-models/workflow/index.mjs +3 -3
  44. package/dist/{browser/editor-CZ5NvCyv.js → node/editor-CR823u-y.mjs} +385 -119
  45. package/dist/node/editor-CR823u-y.mjs.map +1 -0
  46. package/dist/node/{editor-DP36YDk5.mjs → editor-CwX-G2Jv.mjs} +2437 -7479
  47. package/dist/node/editor-CwX-G2Jv.mjs.map +1 -0
  48. package/dist/node/{editor-By9BHI8e.mjs → editor-D_t8OtZn.mjs} +14 -24
  49. package/dist/node/editor-D_t8OtZn.mjs.map +1 -0
  50. package/dist/node/editors/connection-editor/module.mjs +1 -1
  51. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  52. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  53. package/dist/node/index.mjs +102 -43
  54. package/dist/node/index.mjs.map +1 -1
  55. package/dist/node/{module-DuxxhgKs.mjs → module-Dhe5E-VA.mjs} +574 -94
  56. package/dist/node/module-Dhe5E-VA.mjs.map +1 -0
  57. package/dist/node/{piece-auth-Z4mZEOtL.mjs → piece-auth-BS5CtQOG.mjs} +45 -12
  58. package/dist/node/piece-auth-BS5CtQOG.mjs.map +1 -0
  59. package/dist/node/pieces/index.mjs +0 -1
  60. package/dist/node/pieces/index.mjs.map +1 -1
  61. package/dist/node/pieces/reactor/descriptor.json +85 -3
  62. package/dist/node/pieces/reactor/index.mjs +14843 -163
  63. package/dist/node/pieces/reactor/index.mjs.map +1 -1
  64. package/dist/node/pieces/reactor/package.json +1 -1
  65. package/dist/node/runtime-queries-D5EGaCrH.mjs +2544 -0
  66. package/dist/node/runtime-queries-D5EGaCrH.mjs.map +1 -0
  67. package/dist/node/trigger-text-DJIAQBWg.mjs +6765 -0
  68. package/dist/node/trigger-text-DJIAQBWg.mjs.map +1 -0
  69. package/dist/node/{upgrade-manifests-C1sl_M-H.mjs → upgrade-manifests-CmNd742Y.mjs} +2 -2
  70. package/dist/node/{upgrade-manifests-C1sl_M-H.mjs.map → upgrade-manifests-CmNd742Y.mjs.map} +1 -1
  71. package/dist/node/{workflow-C-uuQPnf.mjs → workflow-CGzYGZnr.mjs} +3 -2
  72. package/dist/node/workflow-CGzYGZnr.mjs.map +1 -0
  73. package/dist/powerhouse.manifest.json +6 -1
  74. package/dist/style.css +151 -19
  75. package/dist/types/ai/tools.d.ts +3 -1
  76. package/dist/types/ai/tools.d.ts.map +1 -1
  77. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  78. package/dist/types/document-models/document-models.d.ts +3 -0
  79. package/dist/types/document-models/document-models.d.ts.map +1 -1
  80. package/dist/types/document-models/workflow/v1/actions.d.ts +3 -0
  81. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  82. package/dist/types/document-models/workflow/v1/gen/actions.d.ts +3 -1
  83. package/dist/types/document-models/workflow/v1/gen/actions.d.ts.map +1 -1
  84. package/dist/types/document-models/workflow/v1/gen/creators.d.ts +2 -0
  85. package/dist/types/document-models/workflow/v1/gen/creators.d.ts.map +1 -1
  86. package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
  87. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
  88. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
  89. package/dist/types/document-models/workflow/v1/gen/index.d.ts +1 -0
  90. package/dist/types/document-models/workflow/v1/gen/index.d.ts.map +1 -1
  91. package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
  92. package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts +16 -0
  93. package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts.map +1 -0
  94. package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts +5 -0
  95. package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts.map +1 -0
  96. package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts +14 -0
  97. package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts.map +1 -0
  98. package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts +12 -0
  99. package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts.map +1 -0
  100. package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
  101. package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts +6 -2
  102. package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts.map +1 -1
  103. package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts +3 -2
  104. package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts.map +1 -1
  105. package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts +13 -1
  106. package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts.map +1 -1
  107. package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts +2 -1
  108. package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts.map +1 -1
  109. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +102 -12
  110. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  111. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +21 -1
  112. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  113. package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts +26 -1
  114. package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts.map +1 -1
  115. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +13 -1
  116. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
  117. package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
  118. package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts +13 -1
  119. package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts.map +1 -1
  120. package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts +13 -1
  121. package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts.map +1 -1
  122. package/dist/types/document-models/workflow/v1/module.d.ts +3 -0
  123. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  124. package/dist/types/document-models/workflow/v1/src/helpers.d.ts +15 -0
  125. package/dist/types/document-models/workflow/v1/src/helpers.d.ts.map +1 -0
  126. package/dist/types/document-models/workflow/v1/src/reducers/edges.d.ts.map +1 -1
  127. package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts +3 -0
  128. package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts.map +1 -0
  129. package/dist/types/document-models/workflow/v1/src/reducers/runtime.d.ts.map +1 -1
  130. package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
  131. package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
  132. package/dist/types/document-models/workflow/v1/src/reducers/variables.d.ts.map +1 -1
  133. package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
  134. package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts +2 -0
  135. package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts.map +1 -0
  136. package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts +2 -0
  137. package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts.map +1 -0
  138. package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts +2 -0
  139. package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts.map +1 -0
  140. package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts +2 -0
  141. package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts.map +1 -0
  142. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
  143. package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -1
  144. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  145. package/dist/types/editors/connection-editor/connection-form.d.ts +2 -1
  146. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  147. package/dist/types/editors/connection-editor/connection-usage.d.ts +3 -2
  148. package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
  149. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  150. package/dist/types/editors/connection-editor/piece-auth.d.ts +7 -1
  151. package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
  152. package/dist/types/editors/connection-editor/status.d.ts +2 -1
  153. package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
  154. package/dist/types/editors/shared/controls.d.ts +17 -1
  155. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  156. package/dist/types/editors/shared/editor-chrome.d.ts +2 -0
  157. package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
  158. package/dist/types/editors/shared/icons.d.ts +2 -0
  159. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  160. package/dist/types/editors/shared/undo-plan.d.ts +20 -0
  161. package/dist/types/editors/shared/undo-plan.d.ts.map +1 -0
  162. package/dist/types/editors/shared/undo-plan.test.d.ts +2 -0
  163. package/dist/types/editors/shared/undo-plan.test.d.ts.map +1 -0
  164. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  165. package/dist/types/editors/workflow-editor/editor.d.ts +0 -1
  166. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  167. package/dist/types/editors/workflow-editor/run-kinds.d.ts +5 -0
  168. package/dist/types/editors/workflow-editor/run-kinds.d.ts.map +1 -0
  169. package/dist/types/editors/workflow-editor/runtime-api.d.ts +12 -139
  170. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  171. package/dist/types/editors/workflow-editor/runtime-client.d.ts +260 -0
  172. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -0
  173. package/dist/types/editors/workflow-editor/runtime-client.test.d.ts +2 -0
  174. package/dist/types/editors/workflow-editor/runtime-client.test.d.ts.map +1 -0
  175. package/dist/types/editors/workflow-editor/runtime-context.d.ts +45 -0
  176. package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -0
  177. package/dist/types/editors/workflow-editor/runtime-persist.d.ts +23 -0
  178. package/dist/types/editors/workflow-editor/runtime-persist.d.ts.map +1 -0
  179. package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts +2 -0
  180. package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts.map +1 -0
  181. package/dist/types/editors/workflow-editor/runtime-queries.d.ts +128 -0
  182. package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -0
  183. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +3 -3
  184. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  185. package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts +4 -3
  186. package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
  187. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts +2 -3
  188. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
  189. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
  190. package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts +6 -5
  191. package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts.map +1 -1
  192. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +7 -1
  193. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  194. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +34 -0
  195. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -0
  196. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
  197. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +2 -3
  198. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  199. package/dist/types/editors/workflow-editor/ui/StepTest.d.ts +11 -0
  200. package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -0
  201. package/dist/types/editors/workflow-editor/ui/VariablesEditor.d.ts +0 -1
  202. package/dist/types/editors/workflow-editor/ui/VariablesEditor.d.ts.map +1 -1
  203. package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts +1 -3
  204. package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts.map +1 -1
  205. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts +1 -3
  206. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  207. package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts +31 -0
  208. package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts.map +1 -0
  209. package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts +2 -0
  210. package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts.map +1 -0
  211. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
  212. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts +2 -1
  213. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
  214. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +7 -9
  215. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
  216. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +10 -5
  217. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
  218. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +43 -2
  219. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  220. package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts +2 -0
  221. package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts.map +1 -0
  222. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts +4 -2
  223. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
  224. package/dist/types/editors/workflow-editor/ui/connection-create.d.ts +3 -3
  225. package/dist/types/editors/workflow-editor/ui/connection-create.d.ts.map +1 -1
  226. package/dist/types/editors/workflow-editor/ui/design-time.d.ts +92 -0
  227. package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -0
  228. package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts +2 -0
  229. package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts.map +1 -0
  230. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +10 -2
  231. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
  232. package/dist/types/editors/workflow-editor/ui/forms.d.ts +35 -6
  233. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  234. package/dist/types/editors/workflow-editor/ui/model.d.ts +58 -13
  235. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  236. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +11 -6
  237. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  238. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +5 -0
  239. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -1
  240. package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts +2 -0
  241. package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts.map +1 -0
  242. package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts +4 -0
  243. package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts.map +1 -0
  244. package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts +2 -0
  245. package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts.map +1 -0
  246. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +54 -0
  247. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -0
  248. package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts +3 -8
  249. package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts.map +1 -1
  250. package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts +18 -0
  251. package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts.map +1 -0
  252. package/dist/types/editors/workflow-editor/ui/step-test.d.ts +14 -0
  253. package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -0
  254. package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts +2 -0
  255. package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts.map +1 -0
  256. package/dist/types/editors/workflow-editor/ui/test-state.d.ts +7 -0
  257. package/dist/types/editors/workflow-editor/ui/test-state.d.ts.map +1 -0
  258. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -1
  259. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
  260. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +28 -0
  261. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -0
  262. package/dist/types/editors/workflow-editor/ui/validation.d.ts +33 -1
  263. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  264. package/dist/types/editors/workflow-editor/ui/variable-types.d.ts +14 -0
  265. package/dist/types/editors/workflow-editor/ui/variable-types.d.ts.map +1 -0
  266. package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts +2 -0
  267. package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts.map +1 -0
  268. package/dist/types/editors/workflow-editor/ui/version-badge.d.ts +33 -0
  269. package/dist/types/editors/workflow-editor/ui/version-badge.d.ts.map +1 -0
  270. package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts +2 -0
  271. package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts.map +1 -0
  272. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts +0 -1
  273. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts.map +1 -1
  274. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +1 -1
  275. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  276. package/dist/types/editors/workflow-studio/components/RunsView.d.ts +4 -1
  277. package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
  278. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
  279. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +1 -1
  280. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
  281. package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts +2 -1
  282. package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts.map +1 -1
  283. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +13 -0
  284. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -0
  285. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts +1 -1
  286. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
  287. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts +0 -1
  288. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  289. package/dist/types/editors/workflow-studio/components/chain.d.ts +5 -3
  290. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
  291. package/dist/types/editors/workflow-studio/components/run-format.d.ts +11 -2
  292. package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
  293. package/dist/types/editors/workflow-studio/components/step-outline.d.ts +3 -1
  294. package/dist/types/editors/workflow-studio/components/step-outline.d.ts.map +1 -1
  295. package/dist/types/editors/workflow-studio/components/ui.d.ts +2 -0
  296. package/dist/types/editors/workflow-studio/components/ui.d.ts.map +1 -1
  297. package/dist/types/editors/workflow-studio/components/useRuns.d.ts +4 -1
  298. package/dist/types/editors/workflow-studio/components/useRuns.d.ts.map +1 -1
  299. package/dist/types/editors/workflow-studio/editor.d.ts.map +1 -1
  300. package/dist/types/pieces/index.d.ts.map +1 -1
  301. package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts +2 -0
  302. package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts.map +1 -0
  303. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +14 -1
  304. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  305. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +14 -1
  306. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  307. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +1 -0
  308. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
  309. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +1 -0
  310. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
  311. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -1
  312. package/dist/types/pieces/reactor/lib/input-schema.d.ts +11 -2
  313. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
  314. package/dist/types/pieces/reactor/lib/parse.d.ts +22 -4
  315. package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
  316. package/dist/types/pieces/reactor/lib/reactor.d.ts +15 -1
  317. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  318. package/dist/types/scripts/ui-stack.d.ts +53 -11
  319. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  320. package/dist/types/test/ui/block-picker.spec.d.ts +2 -0
  321. package/dist/types/test/ui/block-picker.spec.d.ts.map +1 -0
  322. package/dist/types/test/ui/branch.spec.d.ts +2 -0
  323. package/dist/types/test/ui/branch.spec.d.ts.map +1 -0
  324. package/dist/types/test/ui/canvas-logos.spec.d.ts +2 -0
  325. package/dist/types/test/ui/canvas-logos.spec.d.ts.map +1 -0
  326. package/dist/types/test/ui/fixtures.d.ts +1 -0
  327. package/dist/types/test/ui/fixtures.d.ts.map +1 -1
  328. package/dist/types/test/ui/global-setup.d.ts.map +1 -1
  329. package/dist/types/test/ui/harness/prop-controls.d.ts.map +1 -1
  330. package/dist/types/test/ui/piece-version.spec.d.ts +2 -0
  331. package/dist/types/test/ui/piece-version.spec.d.ts.map +1 -0
  332. package/dist/types/test/ui/ports.spec.d.ts +2 -0
  333. package/dist/types/test/ui/ports.spec.d.ts.map +1 -0
  334. package/dist/types/test/ui/publish.spec.d.ts +2 -0
  335. package/dist/types/test/ui/publish.spec.d.ts.map +1 -0
  336. package/dist/types/test/ui/step-test.spec.d.ts +2 -0
  337. package/dist/types/test/ui/step-test.spec.d.ts.map +1 -0
  338. package/dist/types/test/ui/variables.spec.d.ts +2 -0
  339. package/dist/types/test/ui/variables.spec.d.ts.map +1 -0
  340. package/dist/types/test/ui/webhook.spec.d.ts +2 -0
  341. package/dist/types/test/ui/webhook.spec.d.ts.map +1 -0
  342. package/dist/types/test/ui/workflow-menu.spec.d.ts +2 -0
  343. package/dist/types/test/ui/workflow-menu.spec.d.ts.map +1 -0
  344. package/package.json +11 -10
  345. package/dist/browser/BlockSelector-D24DIiSX.js +0 -1388
  346. package/dist/browser/BlockSelector-D24DIiSX.js.map +0 -1
  347. package/dist/browser/connection-form-D-NETdDQ.js.map +0 -1
  348. package/dist/browser/editor-B6N0PCuZ.js.map +0 -1
  349. package/dist/browser/editor-BkdwuOC-.js.map +0 -1
  350. package/dist/browser/editor-CZ5NvCyv.js.map +0 -1
  351. package/dist/browser/module-Bkms70LV.js.map +0 -1
  352. package/dist/browser/piece-auth-Z4mZEOtL.js.map +0 -1
  353. package/dist/browser/runtime-api-DDMQc4PB.js +0 -558
  354. package/dist/browser/runtime-api-DDMQc4PB.js.map +0 -1
  355. package/dist/browser/trigger-text-CUv5Z2Uk.js +0 -551
  356. package/dist/browser/trigger-text-CUv5Z2Uk.js.map +0 -1
  357. package/dist/browser/workflow-CGtVlhr8.js.map +0 -1
  358. package/dist/node/BlockSelector-CTmmpYxu.mjs +0 -1388
  359. package/dist/node/BlockSelector-CTmmpYxu.mjs.map +0 -1
  360. package/dist/node/connection-form-C9vbfSnA.mjs.map +0 -1
  361. package/dist/node/editor-By9BHI8e.mjs.map +0 -1
  362. package/dist/node/editor-DP36YDk5.mjs.map +0 -1
  363. package/dist/node/editor-StBssjcQ.mjs.map +0 -1
  364. package/dist/node/module-DuxxhgKs.mjs.map +0 -1
  365. package/dist/node/piece-auth-Z4mZEOtL.mjs.map +0 -1
  366. package/dist/node/runtime-api-DDMQc4PB.mjs +0 -558
  367. package/dist/node/runtime-api-DDMQc4PB.mjs.map +0 -1
  368. package/dist/node/trigger-text-Bzq6VfOQ.mjs +0 -551
  369. package/dist/node/trigger-text-Bzq6VfOQ.mjs.map +0 -1
  370. package/dist/node/workflow-C-uuQPnf.mjs.map +0 -1
  371. package/dist/types/editors/workflow-editor/runtime-api.test.d.ts +0 -2
  372. package/dist/types/editors/workflow-editor/runtime-api.test.d.ts.map +0 -1
  373. package/dist/types/editors/workflow-editor/runtime-piece-source.d.ts +0 -2
  374. package/dist/types/editors/workflow-editor/runtime-piece-source.d.ts.map +0 -1
@@ -0,0 +1,2544 @@
1
+ import { Rt as blockKey } from "./module-Dhe5E-VA.mjs";
2
+ import { ambientRenownTokenProvider } from "@powerhousedao/reactor-browser/graphql-client";
3
+ //#region editors/workflow-editor/ui/forms.ts
4
+ const POLL_INTERVAL_PROP = {
5
+ name: "pollEverySeconds",
6
+ displayName: "Poll every (seconds)",
7
+ type: "NUMBER",
8
+ required: false,
9
+ description: "How often the reactor checks this trigger; 60 at the least. Omit to follow the piece's own cadence."
10
+ };
11
+ //#endregion
12
+ //#region ../pieces-framework/dist/workflow.js
13
+ const DELIVERIES = {
14
+ POLLING: "poll",
15
+ WEBHOOK: "webhook",
16
+ MANUAL: "manual"
17
+ };
18
+ const APP_WEBHOOK_UNSUPPORTED = "TriggerStrategy.APP_WEBHOOK (app-level webhooks) is not supported";
19
+ function checkTriggerStrategy(strategy) {
20
+ if (typeof strategy === "string" && Object.hasOwn(DELIVERIES, strategy)) return { delivery: DELIVERIES[strategy] };
21
+ if (strategy === "APP_WEBHOOK") return { issue: APP_WEBHOOK_UNSUPPORTED };
22
+ return { issue: strategy === void 0 || strategy === null || strategy === "" ? "The trigger declares no strategy" : `Unknown trigger strategy ${JSON.stringify(strategy)}` };
23
+ }
24
+ const SCHEDULE_UNIT_MS = {
25
+ minutes: 6e4,
26
+ hours: 36e5,
27
+ days: 864e5
28
+ };
29
+ var ScheduleConfigError = class extends Error {
30
+ constructor(message) {
31
+ super(`Schedule: ${message}`);
32
+ this.name = "ScheduleConfigError";
33
+ }
34
+ };
35
+ const CRON_FIELD = /^[\d*?A-Za-z]+(?:[-/][\dA-Za-z]+)*(?:,[\d*?A-Za-z]+(?:[-/][\dA-Za-z]+)*)*$/;
36
+ function isRecord(value) {
37
+ return value !== null && typeof value === "object" && !Array.isArray(value);
38
+ }
39
+ function parseTimezone(value) {
40
+ if (value === void 0 || value === null || value === "") return "UTC";
41
+ if (typeof value !== "string") throw new ScheduleConfigError("\"timezone\" must be an IANA name");
42
+ try {
43
+ new Intl.DateTimeFormat("en-US", { timeZone: value });
44
+ } catch {
45
+ throw new ScheduleConfigError(`unknown timezone "${value}" (use an IANA name such as Europe/Lisbon)`);
46
+ }
47
+ return value;
48
+ }
49
+ function parseCronText(cron) {
50
+ if (typeof cron !== "string" || cron.trim() === "") throw new ScheduleConfigError("\"cron\" is required in cron mode");
51
+ const pattern = cron.trim().replace(/\s+/g, " ");
52
+ const fields = pattern.split(" ");
53
+ if (fields.length !== 5) throw new ScheduleConfigError(`cron "${pattern}" must have exactly five fields (minute hour day month weekday)`);
54
+ const bad = fields.find((field) => !CRON_FIELD.test(field));
55
+ if (bad !== void 0) throw new ScheduleConfigError(`cron "${pattern}" has an invalid field "${bad}"`);
56
+ return pattern;
57
+ }
58
+ function parseInterval(record) {
59
+ const { every, unit } = record;
60
+ if (typeof every !== "number" || !Number.isInteger(every) || every < 1) throw new ScheduleConfigError("\"every\" must be a whole number of at least 1 in interval mode");
61
+ if (typeof unit !== "string" || !Object.hasOwn(SCHEDULE_UNIT_MS, unit)) throw new ScheduleConfigError(`"unit" must be one of ${Object.keys(SCHEDULE_UNIT_MS).join(", ")}`);
62
+ const key = unit;
63
+ return {
64
+ every,
65
+ unit: key,
66
+ everyMs: every * SCHEDULE_UNIT_MS[key]
67
+ };
68
+ }
69
+ function parseScheduleConfig(config) {
70
+ if (!isRecord(config)) throw new ScheduleConfigError("the config must be an object");
71
+ const timezone = parseTimezone(config.timezone);
72
+ if (config.mode === "cron") return {
73
+ mode: "cron",
74
+ cron: parseCronText(config.cron),
75
+ timezone
76
+ };
77
+ if (config.mode === "interval") return {
78
+ mode: "interval",
79
+ ...parseInterval(config),
80
+ timezone
81
+ };
82
+ throw new ScheduleConfigError(config.mode === void 0 ? "\"mode\" is required (\"cron\" or \"interval\")" : `"mode" must be "cron" or "interval", not ${JSON.stringify(config.mode)}`);
83
+ }
84
+ function scheduleConfigIssue(config) {
85
+ try {
86
+ parseScheduleConfig(config);
87
+ return;
88
+ } catch (error) {
89
+ return error instanceof Error ? error.message : String(error);
90
+ }
91
+ }
92
+ const NEXT_PORT = "next";
93
+ const ERROR_PORT = "error";
94
+ const PIECE_ACTION_PORTS = [NEXT_PORT, ERROR_PORT];
95
+ const TRIGGER_PORTS = [NEXT_PORT];
96
+ function flowPorts(ports) {
97
+ return ports.filter((port) => port !== ERROR_PORT);
98
+ }
99
+ const CORE_PIECE_NAME = "@powerhousedao/piece-core";
100
+ const BRANCH_PORTS = [
101
+ "true",
102
+ "false",
103
+ ERROR_PORT
104
+ ];
105
+ function knownPorts(block) {
106
+ if (block.kind === "trigger") return TRIGGER_PORTS;
107
+ return block.pieceName === "@powerhousedao/piece-core" && block.name === "branch" ? BRANCH_PORTS : PIECE_ACTION_PORTS;
108
+ }
109
+ //#endregion
110
+ //#region editors/workflow-editor/ui/blocks.ts
111
+ const CORE_PIECE = CORE_PIECE_NAME;
112
+ const REACTOR_PIECE = "@powerhousedao/piece-reactor";
113
+ const core = (kind, name) => ({
114
+ pieceName: CORE_PIECE,
115
+ kind,
116
+ name
117
+ });
118
+ const MANUAL_TRIGGER = core("trigger", "manual");
119
+ const SCHEDULE_TRIGGER = core("trigger", "schedule");
120
+ const WEBHOOK_TRIGGER = core("trigger", "webhook");
121
+ const BRANCH_BLOCK = core("action", "branch");
122
+ const ASSERT_BLOCK = core("action", "assert");
123
+ function sameBlock(a, b) {
124
+ return Boolean(a && b && blockKey(a) === blockKey(b));
125
+ }
126
+ function isCoreBlock(block) {
127
+ return block.pieceName === CORE_PIECE;
128
+ }
129
+ function isReactorPieceBlock(block) {
130
+ return block.pieceName === REACTOR_PIECE;
131
+ }
132
+ function stepBlock(step) {
133
+ return {
134
+ pieceName: step.pieceName,
135
+ pieceVersion: step.pieceVersion,
136
+ kind: "action",
137
+ name: step.actionName
138
+ };
139
+ }
140
+ function triggerBlock(trigger) {
141
+ return {
142
+ pieceName: trigger.pieceName,
143
+ pieceVersion: trigger.pieceVersion,
144
+ kind: "trigger",
145
+ name: trigger.triggerName
146
+ };
147
+ }
148
+ function stepFields(block) {
149
+ return {
150
+ pieceName: block.pieceName,
151
+ pieceVersion: block.pieceVersion,
152
+ actionName: block.name
153
+ };
154
+ }
155
+ function triggerFields(block) {
156
+ return {
157
+ pieceName: block.pieceName,
158
+ pieceVersion: block.pieceVersion,
159
+ triggerName: block.name
160
+ };
161
+ }
162
+ function pinBlock(pick, installedVersion) {
163
+ const pieceVersion = pick.pieceVersion ?? installedVersion(pick.pieceName);
164
+ if (!pieceVersion) return void 0;
165
+ return {
166
+ pieceName: pick.pieceName,
167
+ pieceVersion,
168
+ kind: pick.kind,
169
+ name: pick.name
170
+ };
171
+ }
172
+ const reactor = (kind, name) => ({
173
+ pieceName: REACTOR_PIECE,
174
+ kind,
175
+ name
176
+ });
177
+ const TRIGGER_PRESETS = [
178
+ {
179
+ label: "Manual",
180
+ block: MANUAL_TRIGGER,
181
+ group: "core",
182
+ description: "Fired on demand with a payload.",
183
+ defaultConfig: {}
184
+ },
185
+ {
186
+ label: "Schedule",
187
+ block: SCHEDULE_TRIGGER,
188
+ group: "core",
189
+ description: "Fires on a cron expression or fixed interval.",
190
+ defaultConfig: {
191
+ mode: "cron",
192
+ cron: "0 9 * * 1-5",
193
+ timezone: "UTC"
194
+ }
195
+ },
196
+ {
197
+ label: "Webhook",
198
+ block: WEBHOOK_TRIGGER,
199
+ group: "core",
200
+ description: "Fires when a provider POSTs to this workflow's URL.",
201
+ defaultConfig: {
202
+ methods: "POST",
203
+ scheme: "none",
204
+ responseMode: "async"
205
+ }
206
+ },
207
+ {
208
+ label: "Document event",
209
+ block: reactor("trigger", "document-event"),
210
+ group: "powerhouse",
211
+ description: "Fires when a matching document operation lands.",
212
+ defaultConfig: {}
213
+ },
214
+ {
215
+ label: "Document created",
216
+ block: reactor("trigger", "document-created"),
217
+ group: "powerhouse",
218
+ description: "Fires when a document is added to a drive.",
219
+ defaultConfig: {}
220
+ },
221
+ {
222
+ label: "Document deleted",
223
+ block: reactor("trigger", "document-deleted"),
224
+ group: "powerhouse",
225
+ description: "Fires when a document is removed from a drive.",
226
+ defaultConfig: {}
227
+ }
228
+ ];
229
+ const STEP_PRESETS = [
230
+ {
231
+ label: "Branch",
232
+ block: BRANCH_BLOCK,
233
+ group: "core",
234
+ description: "Routes true/false on a condition.",
235
+ defaultConfig: {}
236
+ },
237
+ {
238
+ label: "Assert",
239
+ block: ASSERT_BLOCK,
240
+ group: "core",
241
+ description: "Fails the run when a value is blank, rejected or not allowed.",
242
+ defaultConfig: {
243
+ value: "",
244
+ allowValues: []
245
+ }
246
+ },
247
+ {
248
+ label: "Create document",
249
+ block: reactor("action", "document-create"),
250
+ group: "powerhouse",
251
+ description: "Creates a Powerhouse document.",
252
+ defaultConfig: {
253
+ documentType: "",
254
+ name: ""
255
+ }
256
+ },
257
+ {
258
+ label: "Dispatch actions",
259
+ block: reactor("action", "document-dispatch"),
260
+ group: "powerhouse",
261
+ description: "Sends actions to a document.",
262
+ defaultConfig: { documentId: "" }
263
+ },
264
+ {
265
+ label: "Get document",
266
+ block: reactor("action", "document-get"),
267
+ group: "powerhouse",
268
+ description: "Reads a document's current state.",
269
+ defaultConfig: { documentId: "" }
270
+ },
271
+ {
272
+ label: "Find documents",
273
+ block: reactor("action", "document-find"),
274
+ group: "powerhouse",
275
+ description: "Lists documents by type and name.",
276
+ defaultConfig: { documentType: "" }
277
+ },
278
+ {
279
+ label: "List document types",
280
+ block: reactor("action", "document-types"),
281
+ group: "powerhouse",
282
+ description: "Document models installed on this reactor.",
283
+ defaultConfig: {}
284
+ },
285
+ {
286
+ label: "Get document schema",
287
+ block: reactor("action", "document-schema"),
288
+ group: "powerhouse",
289
+ description: "Action and state schemas of a document type.",
290
+ defaultConfig: { documentType: "" }
291
+ }
292
+ ];
293
+ //#endregion
294
+ //#region editors/workflow-editor/runtime-client.ts
295
+ const DEFAULT_RUNTIME_URL = "http://localhost:4001/graphql/workflow-runtime";
296
+ function createTransport(url, options) {
297
+ const doFetch = options.fetch ?? ((input, init) => fetch(input, init));
298
+ const tokenOf = options.token ?? ambientRenownTokenProvider;
299
+ return {
300
+ url,
301
+ gql: (query, variables) => gql(url, doFetch, tokenOf, query, variables)
302
+ };
303
+ }
304
+ var RuntimeRequestError = class extends Error {
305
+ code;
306
+ constructor(message, code) {
307
+ super(message);
308
+ this.code = code;
309
+ this.name = "RuntimeRequestError";
310
+ }
311
+ };
312
+ function isSyncingError(error) {
313
+ return error instanceof RuntimeRequestError && error.code === "WORKFLOW_SYNCING";
314
+ }
315
+ async function gql(url, doFetch, tokenOf, query, variables) {
316
+ const token = await tokenOf();
317
+ const body = await (await doFetch(url, {
318
+ method: "POST",
319
+ headers: {
320
+ "content-type": "application/json",
321
+ ...token ? { authorization: `Bearer ${token}` } : {}
322
+ },
323
+ body: JSON.stringify({
324
+ query,
325
+ variables
326
+ })
327
+ })).json();
328
+ const first = body.errors?.[0];
329
+ if (first) {
330
+ const code = first.extensions?.code;
331
+ throw new RuntimeRequestError(first.message, typeof code === "string" ? code : void 0);
332
+ }
333
+ if (!body.data) throw new Error("Empty GraphQL response");
334
+ return body.data;
335
+ }
336
+ function blockInput(block) {
337
+ return {
338
+ pieceName: block.pieceName,
339
+ pieceVersion: block.pieceVersion,
340
+ name: block.name,
341
+ kind: block.kind
342
+ };
343
+ }
344
+ function getBlockForm(t, block) {
345
+ return t.gql(`query Descriptor($block: BlockInput!) {
346
+ workflowRuntime { blockDescriptor(block: $block) }
347
+ }`, { block: blockInput(block) }).then((data) => {
348
+ const descriptor = data.workflowRuntime.blockDescriptor;
349
+ const entry = descriptor?.action ?? descriptor?.trigger;
350
+ if (!descriptor || !entry) return null;
351
+ const strategy = !descriptor.action && Boolean(descriptor.trigger) ? checkTriggerStrategy(entry.strategy) : void 0;
352
+ if (strategy && "issue" in strategy) throw new Error(strategy.issue);
353
+ const delivery = strategy?.delivery;
354
+ const polled = delivery === "poll" && !isCoreBlock(block) && !isReactorPieceBlock(block);
355
+ const props = entry.props;
356
+ return {
357
+ title: isCoreBlock(block) ? entry.displayName : `${descriptor.displayName} · ${entry.displayName}`,
358
+ requireAuth: entry.requireAuth,
359
+ auth: !descriptor.auth ? "none" : entry.requireAuth ? "required" : "optional",
360
+ props: polled ? [...props, POLL_INTERVAL_PROP] : props,
361
+ ...entry.ports ? { ports: entry.ports } : {},
362
+ ...delivery ? { triggerDelivery: delivery } : {},
363
+ ...entry.display ? { display: entry.display } : {},
364
+ ...entry.description ? { description: entry.description } : {},
365
+ ...entry.propertyGroups ? { propertyGroups: entry.propertyGroups } : {},
366
+ ...entry.classification ? { classification: entry.classification } : {},
367
+ ...entry.errorHandlingOptions ? { errorHandling: entry.errorHandlingOptions } : {}
368
+ };
369
+ });
370
+ }
371
+ function atVersion(listing) {
372
+ return listing.entries.map((entry) => ({
373
+ ...entry,
374
+ pieceName: listing.name,
375
+ pieceVersion: listing.version
376
+ }));
377
+ }
378
+ function fetchPieceCatalog(t) {
379
+ return t.gql(`query Catalog { workflowRuntime { pieceCatalog } }`, {}).then((data) => data.workflowRuntime.pieceCatalog);
380
+ }
381
+ async function fetchPieceActions(t, packageName) {
382
+ const listing = (await t.gql(`query Actions($packageName: String!) {
383
+ workflowRuntime { pieceActions(packageName: $packageName) }
384
+ }`, { packageName })).workflowRuntime.pieceActions;
385
+ return atVersion({
386
+ ...listing,
387
+ entries: listing.actions
388
+ });
389
+ }
390
+ async function fetchPieceTriggers(t, packageName) {
391
+ const listing = (await t.gql(`query Triggers($packageName: String!) {
392
+ workflowRuntime { pieceTriggers(packageName: $packageName) }
393
+ }`, { packageName })).workflowRuntime.pieceTriggers;
394
+ return atVersion({
395
+ ...listing,
396
+ entries: listing.triggers
397
+ });
398
+ }
399
+ async function searchBlocks(t, query, limit = 30) {
400
+ return (await t.gql(`query SearchBlocks($query: String!, $limit: Int) {
401
+ workflowRuntime { searchBlocks(query: $query, limit: $limit) {
402
+ status indexedPieces error
403
+ hits { pieceName pieceVersion name pieceDisplayName logoUrl displayName description kind strategy unsupported }
404
+ } }
405
+ }`, {
406
+ query,
407
+ limit
408
+ })).workflowRuntime.searchBlocks;
409
+ }
410
+ function fetchBlockOutputTree(t, block, config) {
411
+ return t.gql(`query OutputTree($block: BlockInput!, $config: Unknown) {
412
+ workflowRuntime { blockOutputTree(block: $block, config: $config) }
413
+ }`, {
414
+ block: blockInput(block),
415
+ config: config ?? {}
416
+ }).then((data) => data.workflowRuntime.blockOutputTree);
417
+ }
418
+ function fetchStepOutputTree(t, workflowId, stepId) {
419
+ return t.gql(`query StepOutputTree($workflowId: String!, $stepId: String!) {
420
+ workflowRuntime { stepOutputTree(workflowId: $workflowId, stepId: $stepId) }
421
+ }`, {
422
+ workflowId,
423
+ stepId
424
+ }).then((data) => data.workflowRuntime.stepOutputTree);
425
+ }
426
+ function fetchConnections(t) {
427
+ return t.gql(`query Connections { workflowRuntime { connections { id name connectorId authType status accountLabel } } }`, {}).then((data) => data.workflowRuntime.connections);
428
+ }
429
+ function checkConnection(t, connectionId) {
430
+ return t.gql(`mutation CheckConnection($connectionId: String!) {
431
+ workflowRuntime {
432
+ checkConnection(connectionId: $connectionId) {
433
+ ok
434
+ detail
435
+ accountLabel
436
+ }
437
+ }
438
+ }`, { connectionId }).then((data) => data.workflowRuntime.checkConnection);
439
+ }
440
+ async function fetchOAuthRedirectUri(t) {
441
+ const uri = (await t.gql(`query OAuthRedirectUri { workflowRuntime { oauthRedirectUri } }`, {})).workflowRuntime.oauthRedirectUri;
442
+ return uri === null ? null : new URL(uri, t.url).href;
443
+ }
444
+ async function startOAuth(t, connectionId, options = {}) {
445
+ return (await t.gql(`mutation StartOAuth($connectionId: String!, $redirectUri: String, $returnUrl: String) {
446
+ workflowRuntime {
447
+ startOAuth(connectionId: $connectionId, redirectUri: $redirectUri, returnUrl: $returnUrl) {
448
+ state authorizationUrl redirectUri expiresAt
449
+ }
450
+ }
451
+ }`, {
452
+ connectionId,
453
+ redirectUri: options.redirectUri ?? null,
454
+ returnUrl: options.returnUrl ?? null
455
+ })).workflowRuntime.startOAuth;
456
+ }
457
+ async function fetchOAuthAttempt(t, state) {
458
+ return (await t.gql(`query OAuthAttempt($state: String!) {
459
+ workflowRuntime { oauthAttempt(state: $state) { connectionId status error } }
460
+ }`, { state })).workflowRuntime.oauthAttempt;
461
+ }
462
+ const SECRET_FIELDS = "ref label version status createdAt updatedAt";
463
+ async function createSecret(t, value, label) {
464
+ return (await t.gql(`mutation CreateSecret($value: String!, $label: String) {
465
+ workflowRuntime { createSecret(value: $value, label: $label) { ${SECRET_FIELDS} } }
466
+ }`, {
467
+ value,
468
+ label: label ?? null
469
+ })).workflowRuntime.createSecret;
470
+ }
471
+ async function rotateSecret(t, ref, value) {
472
+ return (await t.gql(`mutation RotateSecret($ref: String!, $value: String!) {
473
+ workflowRuntime { rotateSecret(ref: $ref, value: $value) { ${SECRET_FIELDS} } }
474
+ }`, {
475
+ ref,
476
+ value
477
+ })).workflowRuntime.rotateSecret;
478
+ }
479
+ async function fetchSecretStat(t, ref) {
480
+ return (await t.gql(`query Secret($ref: String!) {
481
+ workflowRuntime { secret(ref: $ref) { ${SECRET_FIELDS} } }
482
+ }`, { ref })).workflowRuntime.secret;
483
+ }
484
+ async function fetchWebhookEndpoint(t, workflowId, driveId) {
485
+ return (await t.gql(`query WebhookEndpoint($workflowId: String!, $driveId: String) {
486
+ workflowRuntime {
487
+ webhookEndpoint(workflowId: $workflowId, driveId: $driveId) {
488
+ workflowId url absoluteUrl armed createdAt
489
+ }
490
+ }
491
+ }`, {
492
+ workflowId,
493
+ driveId: driveId ?? null
494
+ })).workflowRuntime.webhookEndpoint;
495
+ }
496
+ async function testTrigger(t, workflowId, driveId) {
497
+ return (await t.gql(`mutation TestTrigger($workflowId: String!, $driveId: String) {
498
+ workflowRuntime { testTrigger(workflowId: $workflowId, driveId: $driveId) }
499
+ }`, {
500
+ workflowId,
501
+ driveId: driveId ?? null
502
+ })).workflowRuntime.testTrigger;
503
+ }
504
+ async function testCoreTrigger(t, workflowId, options = {}) {
505
+ return (await t.gql(`mutation TestCoreTrigger($workflowId: String!, $payload: Unknown, $timeoutSeconds: Int, $driveId: String) {
506
+ workflowRuntime {
507
+ testTrigger(workflowId: $workflowId, payload: $payload, timeoutSeconds: $timeoutSeconds, driveId: $driveId)
508
+ }
509
+ }`, {
510
+ workflowId,
511
+ payload: options.payload ?? null,
512
+ timeoutSeconds: options.timeoutSeconds ?? null,
513
+ driveId: options.driveId ?? null
514
+ })).workflowRuntime.testTrigger;
515
+ }
516
+ async function cancelTriggerTest(t, workflowId) {
517
+ return (await t.gql(`mutation CancelTriggerTest($workflowId: String!) {
518
+ workflowRuntime { cancelTriggerTest(workflowId: $workflowId) }
519
+ }`, { workflowId })).workflowRuntime.cancelTriggerTest;
520
+ }
521
+ async function testStep(t, workflowId, stepId, driveId) {
522
+ return (await t.gql(`mutation TestStep($workflowId: String!, $stepId: String!, $driveId: String) {
523
+ workflowRuntime {
524
+ testStep(workflowId: $workflowId, stepId: $stepId, driveId: $driveId) {
525
+ runId status output error durationMs
526
+ }
527
+ }
528
+ }`, {
529
+ workflowId,
530
+ stepId,
531
+ driveId: driveId ?? null
532
+ })).workflowRuntime.testStep;
533
+ }
534
+ async function blockResolutions(t, workflowId) {
535
+ return (await t.gql(`query BlockResolutions($workflowId: String!) {
536
+ workflowRuntime {
537
+ blockResolutions(workflowId: $workflowId) {
538
+ stepId pieceName pieceVersion name kind resolvedVersion source match note latestVersion
539
+ }
540
+ }
541
+ }`, { workflowId })).workflowRuntime.blockResolutions;
542
+ }
543
+ const RUN_ROW_FIELDS = `id workflowId workflowName workflowVersion triggerKind
544
+ triggerPayload status error startedAt endedAt rerunOf warningNotes`;
545
+ const STEP_ROW_FIELDS = "stepId stepKey pieceName blockName status port error startedAt endedAt";
546
+ const RUN_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} input output }`;
547
+ const RUN_LIST_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} }`;
548
+ function scopeVariables(scope, limit) {
549
+ return {
550
+ workflowId: scope.workflowId ?? null,
551
+ driveId: scope.driveId ?? null,
552
+ excludeTriggerKinds: scope.excludeTriggerKinds ?? null,
553
+ limit: scope.limit ?? limit
554
+ };
555
+ }
556
+ async function fetchRuns(t, scope = {}) {
557
+ return (await t.gql(`query Runs($workflowId: String, $driveId: String, $limit: Int, $excludeTriggerKinds: [String!]) {
558
+ workflowRuntime { runs(workflowId: $workflowId, driveId: $driveId, limit: $limit, excludeTriggerKinds: $excludeTriggerKinds) { ${RUN_FIELDS} } }
559
+ }`, scopeVariables(scope, 30))).workflowRuntime.runs;
560
+ }
561
+ async function fetchRunsPage(t, scope = {}, cursor = null) {
562
+ const { limit, ...rest } = scopeVariables(scope, 30);
563
+ return (await t.gql(`query RunsPage($workflowId: String, $driveId: String, $excludeTriggerKinds: [String!], $paging: WorkflowRunsPagingInput) {
564
+ workflowRuntime {
565
+ runsPage(workflowId: $workflowId, driveId: $driveId, excludeTriggerKinds: $excludeTriggerKinds, paging: $paging) {
566
+ items { ${RUN_LIST_FIELDS} } hasNextPage cursor
567
+ }
568
+ }
569
+ }`, {
570
+ ...rest,
571
+ paging: {
572
+ limit,
573
+ cursor
574
+ }
575
+ })).workflowRuntime.runsPage;
576
+ }
577
+ async function fetchRun(t, runId) {
578
+ return (await t.gql(`query Run($id: String!) { workflowRuntime { run(id: $id) { ${RUN_FIELDS} } } }`, { id: runId })).workflowRuntime.run;
579
+ }
580
+ async function fireWorkflow(t, workflowId, payload) {
581
+ return (await t.gql(`mutation Fire($workflowId: String!, $payload: Unknown) {
582
+ workflowRuntime { fire(workflowId: $workflowId, payload: $payload) { runId status error } }
583
+ }`, {
584
+ workflowId,
585
+ payload: payload ?? {}
586
+ })).workflowRuntime.fire;
587
+ }
588
+ async function rerunRun(t, runId) {
589
+ return (await t.gql(`mutation Rerun($runId: String!) {
590
+ workflowRuntime { rerun(runId: $runId) { runId status error } }
591
+ }`, { runId })).workflowRuntime.rerun;
592
+ }
593
+ async function loadBlockOptions(t, block, propName, input, connectionId, searchValue) {
594
+ return (await t.gql(`query Options($block: BlockInput!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String) {
595
+ workflowRuntime { blockOptions(block: $block, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue) }
596
+ }`, {
597
+ block: blockInput(block),
598
+ propName,
599
+ input,
600
+ connectionId: connectionId ?? null,
601
+ searchValue: searchValue ?? null
602
+ })).workflowRuntime.blockOptions;
603
+ }
604
+ const operations = {
605
+ getBlockForm,
606
+ fetchPieceCatalog,
607
+ fetchPieceActions,
608
+ fetchPieceTriggers,
609
+ searchBlocks,
610
+ fetchBlockOutputTree,
611
+ fetchStepOutputTree,
612
+ fetchConnections,
613
+ checkConnection,
614
+ fetchOAuthRedirectUri,
615
+ startOAuth,
616
+ fetchOAuthAttempt,
617
+ createSecret,
618
+ rotateSecret,
619
+ fetchSecretStat,
620
+ fetchWebhookEndpoint,
621
+ testTrigger,
622
+ testCoreTrigger,
623
+ cancelTriggerTest,
624
+ testStep,
625
+ blockResolutions,
626
+ fetchRuns,
627
+ fetchRunsPage,
628
+ fetchRun,
629
+ fireWorkflow,
630
+ rerunRun,
631
+ loadBlockOptions
632
+ };
633
+ function createRuntimeClient(url, options = {}) {
634
+ const transport = createTransport(url, options);
635
+ const bound = Object.fromEntries(Object.entries(operations).map(([name, operation]) => [name, (...args) => operation(transport, ...args)]));
636
+ return {
637
+ ...transport,
638
+ ...bound
639
+ };
640
+ }
641
+ //#endregion
642
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/subscribable.js
643
+ var Subscribable = class {
644
+ constructor() {
645
+ this.listeners = /* @__PURE__ */ new Set();
646
+ this.subscribe = this.subscribe.bind(this);
647
+ }
648
+ subscribe(listener) {
649
+ this.listeners.add(listener);
650
+ this.onSubscribe();
651
+ return () => {
652
+ this.listeners.delete(listener);
653
+ this.onUnsubscribe();
654
+ };
655
+ }
656
+ hasListeners() {
657
+ return this.listeners.size > 0;
658
+ }
659
+ onSubscribe() {}
660
+ onUnsubscribe() {}
661
+ };
662
+ //#endregion
663
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
664
+ var defaultTimeoutProvider = {
665
+ setTimeout: (callback, delay) => setTimeout(callback, delay),
666
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId),
667
+ setInterval: (callback, delay) => setInterval(callback, delay),
668
+ clearInterval: (intervalId) => clearInterval(intervalId)
669
+ };
670
+ var TimeoutManager = class {
671
+ #provider = defaultTimeoutProvider;
672
+ #providerCalled = false;
673
+ setTimeoutProvider(provider) {
674
+ if (process.env.NODE_ENV !== "production") {
675
+ if (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, {
676
+ previous: this.#provider,
677
+ provider
678
+ });
679
+ }
680
+ this.#provider = provider;
681
+ if (process.env.NODE_ENV !== "production") this.#providerCalled = false;
682
+ }
683
+ setTimeout(callback, delay) {
684
+ if (process.env.NODE_ENV !== "production") this.#providerCalled = true;
685
+ return this.#provider.setTimeout(callback, delay);
686
+ }
687
+ clearTimeout(timeoutId) {
688
+ this.#provider.clearTimeout(timeoutId);
689
+ }
690
+ setInterval(callback, delay) {
691
+ if (process.env.NODE_ENV !== "production") this.#providerCalled = true;
692
+ return this.#provider.setInterval(callback, delay);
693
+ }
694
+ clearInterval(intervalId) {
695
+ this.#provider.clearInterval(intervalId);
696
+ }
697
+ };
698
+ var timeoutManager = new TimeoutManager();
699
+ function systemSetTimeoutZero(callback) {
700
+ setTimeout(callback, 0);
701
+ }
702
+ //#endregion
703
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/utils.js
704
+ var isServer = typeof window === "undefined" || "Deno" in globalThis;
705
+ function noop() {}
706
+ function functionalUpdate(updater, input) {
707
+ return typeof updater === "function" ? updater(input) : updater;
708
+ }
709
+ function isValidTimeout(value) {
710
+ return typeof value === "number" && value >= 0 && value !== Infinity;
711
+ }
712
+ function timeUntilStale(updatedAt, staleTime) {
713
+ return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
714
+ }
715
+ function resolveStaleTime(staleTime, query) {
716
+ return typeof staleTime === "function" ? staleTime(query) : staleTime;
717
+ }
718
+ function resolveEnabled(enabled, query) {
719
+ return typeof enabled === "function" ? enabled(query) : enabled;
720
+ }
721
+ function matchQuery(filters, query) {
722
+ const { type = "all", exact, fetchStatus, predicate, queryKey, stale } = filters;
723
+ if (queryKey) {
724
+ if (exact) {
725
+ if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;
726
+ } else if (!partialMatchKey(query.queryKey, queryKey)) return false;
727
+ }
728
+ if (type !== "all") {
729
+ const isActive = query.isActive();
730
+ if (type === "active" && !isActive) return false;
731
+ if (type === "inactive" && isActive) return false;
732
+ }
733
+ if (typeof stale === "boolean" && query.isStale() !== stale) return false;
734
+ if (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;
735
+ if (predicate && !predicate(query)) return false;
736
+ return true;
737
+ }
738
+ function matchMutation(filters, mutation) {
739
+ const { exact, status, predicate, mutationKey } = filters;
740
+ if (mutationKey) {
741
+ if (!mutation.options.mutationKey) return false;
742
+ if (exact) {
743
+ if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false;
744
+ } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false;
745
+ }
746
+ if (status && mutation.state.status !== status) return false;
747
+ if (predicate && !predicate(mutation)) return false;
748
+ return true;
749
+ }
750
+ function hashQueryKeyByOptions(queryKey, options) {
751
+ return (options?.queryKeyHashFn || hashKey)(queryKey);
752
+ }
753
+ function hashKey(queryKey) {
754
+ return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
755
+ result[key] = val[key];
756
+ return result;
757
+ }, {}) : val);
758
+ }
759
+ function partialMatchKey(a, b) {
760
+ if (a === b) return true;
761
+ if (typeof a !== typeof b) return false;
762
+ if (a && b && typeof a === "object" && typeof b === "object") return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
763
+ return false;
764
+ }
765
+ var hasOwn = Object.prototype.hasOwnProperty;
766
+ function replaceEqualDeep(a, b, depth = 0) {
767
+ if (a === b) return a;
768
+ if (depth > 500) return b;
769
+ const array = isPlainArray(a) && isPlainArray(b);
770
+ if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
771
+ const aSize = (array ? a : Object.keys(a)).length;
772
+ const bItems = array ? b : Object.keys(b);
773
+ const bSize = bItems.length;
774
+ const copy = array ? new Array(bSize) : {};
775
+ let equalItems = 0;
776
+ for (let i = 0; i < bSize; i++) {
777
+ const key = array ? i : bItems[i];
778
+ const aItem = a[key];
779
+ const bItem = b[key];
780
+ if (aItem === bItem) {
781
+ copy[key] = aItem;
782
+ if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
783
+ continue;
784
+ }
785
+ if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
786
+ copy[key] = bItem;
787
+ continue;
788
+ }
789
+ const v = replaceEqualDeep(aItem, bItem, depth + 1);
790
+ copy[key] = v;
791
+ if (v === aItem) equalItems++;
792
+ }
793
+ return aSize === bSize && equalItems === aSize ? a : copy;
794
+ }
795
+ function shallowEqualObjects(a, b) {
796
+ if (!b || Object.keys(a).length !== Object.keys(b).length) return false;
797
+ for (const key in a) if (a[key] !== b[key]) return false;
798
+ return true;
799
+ }
800
+ function isPlainArray(value) {
801
+ return Array.isArray(value) && value.length === Object.keys(value).length;
802
+ }
803
+ function isPlainObject(o) {
804
+ if (!hasObjectPrototype(o)) return false;
805
+ const ctor = o.constructor;
806
+ if (ctor === void 0) return true;
807
+ const prot = ctor.prototype;
808
+ if (!hasObjectPrototype(prot)) return false;
809
+ if (!prot.hasOwnProperty("isPrototypeOf")) return false;
810
+ if (Object.getPrototypeOf(o) !== Object.prototype) return false;
811
+ return true;
812
+ }
813
+ function hasObjectPrototype(o) {
814
+ return Object.prototype.toString.call(o) === "[object Object]";
815
+ }
816
+ function sleep(timeout) {
817
+ return new Promise((resolve) => {
818
+ timeoutManager.setTimeout(resolve, timeout);
819
+ });
820
+ }
821
+ function replaceData(prevData, data, options) {
822
+ if (typeof options.structuralSharing === "function") return options.structuralSharing(prevData, data);
823
+ else if (options.structuralSharing !== false) {
824
+ if (process.env.NODE_ENV !== "production") try {
825
+ return replaceEqualDeep(prevData, data);
826
+ } catch (error) {
827
+ console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`);
828
+ throw error;
829
+ }
830
+ return replaceEqualDeep(prevData, data);
831
+ }
832
+ return data;
833
+ }
834
+ function keepPreviousData(previousData) {
835
+ return previousData;
836
+ }
837
+ function addToEnd(items, item, max = 0) {
838
+ const newItems = [...items, item];
839
+ return max && newItems.length > max ? newItems.slice(1) : newItems;
840
+ }
841
+ function addToStart(items, item, max = 0) {
842
+ const newItems = [item, ...items];
843
+ return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
844
+ }
845
+ var skipToken = /* @__PURE__ */ Symbol();
846
+ function ensureQueryFn(options, fetchOptions) {
847
+ if (process.env.NODE_ENV !== "production") {
848
+ if (options.queryFn === skipToken) console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);
849
+ }
850
+ if (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise;
851
+ if (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`));
852
+ return options.queryFn;
853
+ }
854
+ function shouldThrowError(throwOnError, params) {
855
+ if (typeof throwOnError === "function") return throwOnError(...params);
856
+ return !!throwOnError;
857
+ }
858
+ function addConsumeAwareSignal(object, getSignal, onCancelled) {
859
+ let consumed = false;
860
+ let signal;
861
+ Object.defineProperty(object, "signal", {
862
+ enumerable: true,
863
+ get: () => {
864
+ signal ??= getSignal();
865
+ if (consumed) return signal;
866
+ consumed = true;
867
+ if (signal.aborted) onCancelled();
868
+ else signal.addEventListener("abort", onCancelled, { once: true });
869
+ return signal;
870
+ }
871
+ });
872
+ return object;
873
+ }
874
+ //#endregion
875
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/focusManager.js
876
+ var FocusManager = class extends Subscribable {
877
+ #focused;
878
+ #cleanup;
879
+ #setup;
880
+ constructor() {
881
+ super();
882
+ this.#setup = (onFocus) => {
883
+ if (!isServer && window.addEventListener) {
884
+ const listener = () => onFocus();
885
+ window.addEventListener("visibilitychange", listener, false);
886
+ return () => {
887
+ window.removeEventListener("visibilitychange", listener);
888
+ };
889
+ }
890
+ };
891
+ }
892
+ onSubscribe() {
893
+ if (!this.#cleanup) this.setEventListener(this.#setup);
894
+ }
895
+ onUnsubscribe() {
896
+ if (!this.hasListeners()) {
897
+ this.#cleanup?.();
898
+ this.#cleanup = void 0;
899
+ }
900
+ }
901
+ setEventListener(setup) {
902
+ this.#setup = setup;
903
+ this.#cleanup?.();
904
+ this.#cleanup = setup((focused) => {
905
+ if (typeof focused === "boolean") this.setFocused(focused);
906
+ else this.onFocus();
907
+ });
908
+ }
909
+ setFocused(focused) {
910
+ if (this.#focused !== focused) {
911
+ this.#focused = focused;
912
+ this.onFocus();
913
+ }
914
+ }
915
+ onFocus() {
916
+ const isFocused = this.isFocused();
917
+ this.listeners.forEach((listener) => {
918
+ listener(isFocused);
919
+ });
920
+ }
921
+ isFocused() {
922
+ if (typeof this.#focused === "boolean") return this.#focused;
923
+ return globalThis.document?.visibilityState !== "hidden";
924
+ }
925
+ };
926
+ var focusManager = new FocusManager();
927
+ //#endregion
928
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/thenable.js
929
+ function pendingThenable() {
930
+ let resolve;
931
+ let reject;
932
+ const thenable = new Promise((_resolve, _reject) => {
933
+ resolve = _resolve;
934
+ reject = _reject;
935
+ });
936
+ thenable.status = "pending";
937
+ thenable.catch(() => {});
938
+ function finalize(data) {
939
+ Object.assign(thenable, data);
940
+ delete thenable.resolve;
941
+ delete thenable.reject;
942
+ }
943
+ thenable.resolve = (value) => {
944
+ finalize({
945
+ status: "fulfilled",
946
+ value
947
+ });
948
+ resolve(value);
949
+ };
950
+ thenable.reject = (reason) => {
951
+ finalize({
952
+ status: "rejected",
953
+ reason
954
+ });
955
+ reject(reason);
956
+ };
957
+ return thenable;
958
+ }
959
+ //#endregion
960
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/notifyManager.js
961
+ var defaultScheduler = systemSetTimeoutZero;
962
+ function createNotifyManager() {
963
+ let queue = [];
964
+ let transactions = 0;
965
+ let notifyFn = (callback) => {
966
+ callback();
967
+ };
968
+ let batchNotifyFn = (callback) => {
969
+ callback();
970
+ };
971
+ let scheduleFn = defaultScheduler;
972
+ const schedule = (callback) => {
973
+ if (transactions) queue.push(callback);
974
+ else scheduleFn(() => {
975
+ notifyFn(callback);
976
+ });
977
+ };
978
+ const flush = () => {
979
+ const originalQueue = queue;
980
+ queue = [];
981
+ if (originalQueue.length) scheduleFn(() => {
982
+ batchNotifyFn(() => {
983
+ originalQueue.forEach((callback) => {
984
+ notifyFn(callback);
985
+ });
986
+ });
987
+ });
988
+ };
989
+ return {
990
+ batch: (callback) => {
991
+ let result;
992
+ transactions++;
993
+ try {
994
+ result = callback();
995
+ } finally {
996
+ transactions--;
997
+ if (!transactions) flush();
998
+ }
999
+ return result;
1000
+ },
1001
+ /**
1002
+ * All calls to the wrapped function will be batched.
1003
+ */
1004
+ batchCalls: (callback) => {
1005
+ return (...args) => {
1006
+ schedule(() => {
1007
+ callback(...args);
1008
+ });
1009
+ };
1010
+ },
1011
+ schedule,
1012
+ /**
1013
+ * Use this method to set a custom notify function.
1014
+ * This can be used to for example wrap notifications with `React.act` while running tests.
1015
+ */
1016
+ setNotifyFunction: (fn) => {
1017
+ notifyFn = fn;
1018
+ },
1019
+ /**
1020
+ * Use this method to set a custom function to batch notifications together into a single tick.
1021
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
1022
+ */
1023
+ setBatchNotifyFunction: (fn) => {
1024
+ batchNotifyFn = fn;
1025
+ },
1026
+ setScheduler: (fn) => {
1027
+ scheduleFn = fn;
1028
+ }
1029
+ };
1030
+ }
1031
+ var notifyManager = createNotifyManager();
1032
+ //#endregion
1033
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/onlineManager.js
1034
+ var OnlineManager = class extends Subscribable {
1035
+ #online = true;
1036
+ #cleanup;
1037
+ #setup;
1038
+ constructor() {
1039
+ super();
1040
+ this.#setup = (onOnline) => {
1041
+ if (!isServer && window.addEventListener) {
1042
+ const onlineListener = () => onOnline(true);
1043
+ const offlineListener = () => onOnline(false);
1044
+ window.addEventListener("online", onlineListener, false);
1045
+ window.addEventListener("offline", offlineListener, false);
1046
+ return () => {
1047
+ window.removeEventListener("online", onlineListener);
1048
+ window.removeEventListener("offline", offlineListener);
1049
+ };
1050
+ }
1051
+ };
1052
+ }
1053
+ onSubscribe() {
1054
+ if (!this.#cleanup) this.setEventListener(this.#setup);
1055
+ }
1056
+ onUnsubscribe() {
1057
+ if (!this.hasListeners()) {
1058
+ this.#cleanup?.();
1059
+ this.#cleanup = void 0;
1060
+ }
1061
+ }
1062
+ setEventListener(setup) {
1063
+ this.#setup = setup;
1064
+ this.#cleanup?.();
1065
+ this.#cleanup = setup(this.setOnline.bind(this));
1066
+ }
1067
+ setOnline(online) {
1068
+ if (this.#online !== online) {
1069
+ this.#online = online;
1070
+ this.listeners.forEach((listener) => {
1071
+ listener(online);
1072
+ });
1073
+ }
1074
+ }
1075
+ isOnline() {
1076
+ return this.#online;
1077
+ }
1078
+ };
1079
+ var onlineManager = new OnlineManager();
1080
+ //#endregion
1081
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/retryer.js
1082
+ function defaultRetryDelay(failureCount) {
1083
+ return Math.min(1e3 * 2 ** failureCount, 3e4);
1084
+ }
1085
+ function canFetch(networkMode) {
1086
+ return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
1087
+ }
1088
+ var CancelledError = class extends Error {
1089
+ constructor(options) {
1090
+ super("CancelledError");
1091
+ this.revert = options?.revert;
1092
+ this.silent = options?.silent;
1093
+ }
1094
+ };
1095
+ function createRetryer(config) {
1096
+ let isRetryCancelled = false;
1097
+ let failureCount = 0;
1098
+ let continueFn;
1099
+ const thenable = pendingThenable();
1100
+ const isResolved = () => thenable.status !== "pending";
1101
+ const cancel = (cancelOptions) => {
1102
+ if (!isResolved()) {
1103
+ const error = new CancelledError(cancelOptions);
1104
+ reject(error);
1105
+ config.onCancel?.(error);
1106
+ }
1107
+ };
1108
+ const cancelRetry = () => {
1109
+ isRetryCancelled = true;
1110
+ };
1111
+ const continueRetry = () => {
1112
+ isRetryCancelled = false;
1113
+ };
1114
+ const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
1115
+ const canStart = () => canFetch(config.networkMode) && config.canRun();
1116
+ const resolve = (value) => {
1117
+ if (!isResolved()) {
1118
+ continueFn?.();
1119
+ thenable.resolve(value);
1120
+ }
1121
+ };
1122
+ const reject = (value) => {
1123
+ if (!isResolved()) {
1124
+ continueFn?.();
1125
+ thenable.reject(value);
1126
+ }
1127
+ };
1128
+ const pause = () => {
1129
+ return new Promise((continueResolve) => {
1130
+ continueFn = (value) => {
1131
+ if (isResolved() || canContinue()) continueResolve(value);
1132
+ };
1133
+ config.onPause?.();
1134
+ }).then(() => {
1135
+ continueFn = void 0;
1136
+ if (!isResolved()) config.onContinue?.();
1137
+ });
1138
+ };
1139
+ const run = () => {
1140
+ if (isResolved()) return;
1141
+ let promiseOrValue;
1142
+ const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
1143
+ try {
1144
+ promiseOrValue = initialPromise ?? config.fn();
1145
+ } catch (error) {
1146
+ promiseOrValue = Promise.reject(error);
1147
+ }
1148
+ Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
1149
+ if (isResolved()) return;
1150
+ const retry = config.retry ?? (isServer ? 0 : 3);
1151
+ const retryDelay = config.retryDelay ?? defaultRetryDelay;
1152
+ const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
1153
+ const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
1154
+ if (isRetryCancelled || !shouldRetry) {
1155
+ reject(error);
1156
+ return;
1157
+ }
1158
+ failureCount++;
1159
+ config.onFail?.(failureCount, error);
1160
+ sleep(delay).then(() => {
1161
+ return canContinue() ? void 0 : pause();
1162
+ }).then(() => {
1163
+ if (isRetryCancelled) reject(error);
1164
+ else run();
1165
+ });
1166
+ });
1167
+ };
1168
+ return {
1169
+ promise: thenable,
1170
+ status: () => thenable.status,
1171
+ cancel,
1172
+ continue: () => {
1173
+ continueFn?.();
1174
+ return thenable;
1175
+ },
1176
+ cancelRetry,
1177
+ continueRetry,
1178
+ canStart,
1179
+ start: () => {
1180
+ if (canStart()) run();
1181
+ else pause().then(run);
1182
+ return thenable;
1183
+ }
1184
+ };
1185
+ }
1186
+ //#endregion
1187
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/removable.js
1188
+ var Removable = class {
1189
+ #gcTimeout;
1190
+ destroy() {
1191
+ this.clearGcTimeout();
1192
+ }
1193
+ scheduleGc() {
1194
+ this.clearGcTimeout();
1195
+ if (isValidTimeout(this.gcTime)) this.#gcTimeout = timeoutManager.setTimeout(() => {
1196
+ this.optionalRemove();
1197
+ }, this.gcTime);
1198
+ }
1199
+ updateGcTime(newGcTime) {
1200
+ this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (isServer ? Infinity : 3e5));
1201
+ }
1202
+ clearGcTimeout() {
1203
+ if (this.#gcTimeout) {
1204
+ timeoutManager.clearTimeout(this.#gcTimeout);
1205
+ this.#gcTimeout = void 0;
1206
+ }
1207
+ }
1208
+ };
1209
+ //#endregion
1210
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/query.js
1211
+ var Query = class extends Removable {
1212
+ #initialState;
1213
+ #revertState;
1214
+ #cache;
1215
+ #client;
1216
+ #retryer;
1217
+ #defaultOptions;
1218
+ #abortSignalConsumed;
1219
+ constructor(config) {
1220
+ super();
1221
+ this.#abortSignalConsumed = false;
1222
+ this.#defaultOptions = config.defaultOptions;
1223
+ this.setOptions(config.options);
1224
+ this.observers = [];
1225
+ this.#client = config.client;
1226
+ this.#cache = this.#client.getQueryCache();
1227
+ this.queryKey = config.queryKey;
1228
+ this.queryHash = config.queryHash;
1229
+ this.#initialState = getDefaultState$1(this.options);
1230
+ this.state = config.state ?? this.#initialState;
1231
+ this.scheduleGc();
1232
+ }
1233
+ get meta() {
1234
+ return this.options.meta;
1235
+ }
1236
+ get promise() {
1237
+ return this.#retryer?.promise;
1238
+ }
1239
+ setOptions(options) {
1240
+ this.options = {
1241
+ ...this.#defaultOptions,
1242
+ ...options
1243
+ };
1244
+ this.updateGcTime(this.options.gcTime);
1245
+ if (this.state && this.state.data === void 0) {
1246
+ const defaultState = getDefaultState$1(this.options);
1247
+ if (defaultState.data !== void 0) {
1248
+ this.setState(successState(defaultState.data, defaultState.dataUpdatedAt));
1249
+ this.#initialState = defaultState;
1250
+ }
1251
+ }
1252
+ }
1253
+ optionalRemove() {
1254
+ if (!this.observers.length && this.state.fetchStatus === "idle") this.#cache.remove(this);
1255
+ }
1256
+ setData(newData, options) {
1257
+ const data = replaceData(this.state.data, newData, this.options);
1258
+ this.#dispatch({
1259
+ data,
1260
+ type: "success",
1261
+ dataUpdatedAt: options?.updatedAt,
1262
+ manual: options?.manual
1263
+ });
1264
+ return data;
1265
+ }
1266
+ setState(state, setStateOptions) {
1267
+ this.#dispatch({
1268
+ type: "setState",
1269
+ state,
1270
+ setStateOptions
1271
+ });
1272
+ }
1273
+ cancel(options) {
1274
+ const promise = this.#retryer?.promise;
1275
+ this.#retryer?.cancel(options);
1276
+ return promise ? promise.then(noop).catch(noop) : Promise.resolve();
1277
+ }
1278
+ destroy() {
1279
+ super.destroy();
1280
+ this.cancel({ silent: true });
1281
+ }
1282
+ reset() {
1283
+ this.destroy();
1284
+ this.setState(this.#initialState);
1285
+ }
1286
+ isActive() {
1287
+ return this.observers.some((observer) => resolveEnabled(observer.options.enabled, this) !== false);
1288
+ }
1289
+ isDisabled() {
1290
+ if (this.getObserversCount() > 0) return !this.isActive();
1291
+ return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
1292
+ }
1293
+ isStatic() {
1294
+ if (this.getObserversCount() > 0) return this.observers.some((observer) => resolveStaleTime(observer.options.staleTime, this) === "static");
1295
+ return false;
1296
+ }
1297
+ isStale() {
1298
+ if (this.getObserversCount() > 0) return this.observers.some((observer) => observer.getCurrentResult().isStale);
1299
+ return this.state.data === void 0 || this.state.isInvalidated;
1300
+ }
1301
+ isStaleByTime(staleTime = 0) {
1302
+ if (this.state.data === void 0) return true;
1303
+ if (staleTime === "static") return false;
1304
+ if (this.state.isInvalidated) return true;
1305
+ return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
1306
+ }
1307
+ onFocus() {
1308
+ this.observers.find((x) => x.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: false });
1309
+ this.#retryer?.continue();
1310
+ }
1311
+ onOnline() {
1312
+ this.observers.find((x) => x.shouldFetchOnReconnect())?.refetch({ cancelRefetch: false });
1313
+ this.#retryer?.continue();
1314
+ }
1315
+ addObserver(observer) {
1316
+ if (!this.observers.includes(observer)) {
1317
+ this.observers.push(observer);
1318
+ this.clearGcTimeout();
1319
+ this.#cache.notify({
1320
+ type: "observerAdded",
1321
+ query: this,
1322
+ observer
1323
+ });
1324
+ }
1325
+ }
1326
+ removeObserver(observer) {
1327
+ if (this.observers.includes(observer)) {
1328
+ this.observers = this.observers.filter((x) => x !== observer);
1329
+ if (!this.observers.length) {
1330
+ if (this.#retryer) {
1331
+ if (this.#abortSignalConsumed) this.#retryer.cancel({ revert: true });
1332
+ else this.#retryer.cancelRetry();
1333
+ }
1334
+ this.scheduleGc();
1335
+ }
1336
+ this.#cache.notify({
1337
+ type: "observerRemoved",
1338
+ query: this,
1339
+ observer
1340
+ });
1341
+ }
1342
+ }
1343
+ getObserversCount() {
1344
+ return this.observers.length;
1345
+ }
1346
+ invalidate() {
1347
+ if (!this.state.isInvalidated) this.#dispatch({ type: "invalidate" });
1348
+ }
1349
+ async fetch(options, fetchOptions) {
1350
+ if (this.state.fetchStatus !== "idle" && this.#retryer?.status() !== "rejected") {
1351
+ if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) this.cancel({ silent: true });
1352
+ else if (this.#retryer) {
1353
+ this.#retryer.continueRetry();
1354
+ return this.#retryer.promise;
1355
+ }
1356
+ }
1357
+ if (options) this.setOptions(options);
1358
+ if (!this.options.queryFn) {
1359
+ const observer = this.observers.find((x) => x.options.queryFn);
1360
+ if (observer) this.setOptions(observer.options);
1361
+ }
1362
+ if (process.env.NODE_ENV !== "production") {
1363
+ if (!Array.isArray(this.options.queryKey)) console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`);
1364
+ }
1365
+ const abortController = new AbortController();
1366
+ const addSignalProperty = (object) => {
1367
+ Object.defineProperty(object, "signal", {
1368
+ enumerable: true,
1369
+ get: () => {
1370
+ this.#abortSignalConsumed = true;
1371
+ return abortController.signal;
1372
+ }
1373
+ });
1374
+ };
1375
+ const fetchFn = () => {
1376
+ const queryFn = ensureQueryFn(this.options, fetchOptions);
1377
+ const createQueryFnContext = () => {
1378
+ const queryFnContext2 = {
1379
+ client: this.#client,
1380
+ queryKey: this.queryKey,
1381
+ meta: this.meta
1382
+ };
1383
+ addSignalProperty(queryFnContext2);
1384
+ return queryFnContext2;
1385
+ };
1386
+ const queryFnContext = createQueryFnContext();
1387
+ this.#abortSignalConsumed = false;
1388
+ if (this.options.persister) return this.options.persister(queryFn, queryFnContext, this);
1389
+ return queryFn(queryFnContext);
1390
+ };
1391
+ const createFetchContext = () => {
1392
+ const context2 = {
1393
+ fetchOptions,
1394
+ options: this.options,
1395
+ queryKey: this.queryKey,
1396
+ client: this.#client,
1397
+ state: this.state,
1398
+ fetchFn
1399
+ };
1400
+ addSignalProperty(context2);
1401
+ return context2;
1402
+ };
1403
+ const context = createFetchContext();
1404
+ this.options.behavior?.onFetch(context, this);
1405
+ this.#revertState = this.state;
1406
+ if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) this.#dispatch({
1407
+ type: "fetch",
1408
+ meta: context.fetchOptions?.meta
1409
+ });
1410
+ this.#retryer = createRetryer({
1411
+ initialPromise: fetchOptions?.initialPromise,
1412
+ fn: context.fetchFn,
1413
+ onCancel: (error) => {
1414
+ if (error instanceof CancelledError && error.revert) this.setState({
1415
+ ...this.#revertState,
1416
+ fetchStatus: "idle"
1417
+ });
1418
+ abortController.abort();
1419
+ },
1420
+ onFail: (failureCount, error) => {
1421
+ this.#dispatch({
1422
+ type: "failed",
1423
+ failureCount,
1424
+ error
1425
+ });
1426
+ },
1427
+ onPause: () => {
1428
+ this.#dispatch({ type: "pause" });
1429
+ },
1430
+ onContinue: () => {
1431
+ this.#dispatch({ type: "continue" });
1432
+ },
1433
+ retry: context.options.retry,
1434
+ retryDelay: context.options.retryDelay,
1435
+ networkMode: context.options.networkMode,
1436
+ canRun: () => true
1437
+ });
1438
+ try {
1439
+ const data = await this.#retryer.start();
1440
+ if (data === void 0) {
1441
+ if (process.env.NODE_ENV !== "production") console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`);
1442
+ throw new Error(`${this.queryHash} data is undefined`);
1443
+ }
1444
+ this.setData(data);
1445
+ this.#cache.config.onSuccess?.(data, this);
1446
+ this.#cache.config.onSettled?.(data, this.state.error, this);
1447
+ return data;
1448
+ } catch (error) {
1449
+ if (error instanceof CancelledError) {
1450
+ if (error.silent) return this.#retryer.promise;
1451
+ else if (error.revert) {
1452
+ if (this.state.data === void 0) throw error;
1453
+ return this.state.data;
1454
+ }
1455
+ }
1456
+ this.#dispatch({
1457
+ type: "error",
1458
+ error
1459
+ });
1460
+ this.#cache.config.onError?.(error, this);
1461
+ this.#cache.config.onSettled?.(this.state.data, error, this);
1462
+ throw error;
1463
+ } finally {
1464
+ this.scheduleGc();
1465
+ }
1466
+ }
1467
+ #dispatch(action) {
1468
+ const reducer = (state) => {
1469
+ switch (action.type) {
1470
+ case "failed": return {
1471
+ ...state,
1472
+ fetchFailureCount: action.failureCount,
1473
+ fetchFailureReason: action.error
1474
+ };
1475
+ case "pause": return {
1476
+ ...state,
1477
+ fetchStatus: "paused"
1478
+ };
1479
+ case "continue": return {
1480
+ ...state,
1481
+ fetchStatus: "fetching"
1482
+ };
1483
+ case "fetch": return {
1484
+ ...state,
1485
+ ...fetchState(state.data, this.options),
1486
+ fetchMeta: action.meta ?? null
1487
+ };
1488
+ case "success":
1489
+ const newState = {
1490
+ ...state,
1491
+ ...successState(action.data, action.dataUpdatedAt),
1492
+ dataUpdateCount: state.dataUpdateCount + 1,
1493
+ ...!action.manual && {
1494
+ fetchStatus: "idle",
1495
+ fetchFailureCount: 0,
1496
+ fetchFailureReason: null
1497
+ }
1498
+ };
1499
+ this.#revertState = action.manual ? newState : void 0;
1500
+ return newState;
1501
+ case "error":
1502
+ const error = action.error;
1503
+ return {
1504
+ ...state,
1505
+ error,
1506
+ errorUpdateCount: state.errorUpdateCount + 1,
1507
+ errorUpdatedAt: Date.now(),
1508
+ fetchFailureCount: state.fetchFailureCount + 1,
1509
+ fetchFailureReason: error,
1510
+ fetchStatus: "idle",
1511
+ status: "error",
1512
+ isInvalidated: true
1513
+ };
1514
+ case "invalidate": return {
1515
+ ...state,
1516
+ isInvalidated: true
1517
+ };
1518
+ case "setState": return {
1519
+ ...state,
1520
+ ...action.state
1521
+ };
1522
+ }
1523
+ };
1524
+ this.state = reducer(this.state);
1525
+ notifyManager.batch(() => {
1526
+ this.observers.forEach((observer) => {
1527
+ observer.onQueryUpdate();
1528
+ });
1529
+ this.#cache.notify({
1530
+ query: this,
1531
+ type: "updated",
1532
+ action
1533
+ });
1534
+ });
1535
+ }
1536
+ };
1537
+ function fetchState(data, options) {
1538
+ return {
1539
+ fetchFailureCount: 0,
1540
+ fetchFailureReason: null,
1541
+ fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
1542
+ ...data === void 0 && {
1543
+ error: null,
1544
+ status: "pending"
1545
+ }
1546
+ };
1547
+ }
1548
+ function successState(data, dataUpdatedAt) {
1549
+ return {
1550
+ data,
1551
+ dataUpdatedAt: dataUpdatedAt ?? Date.now(),
1552
+ error: null,
1553
+ isInvalidated: false,
1554
+ status: "success"
1555
+ };
1556
+ }
1557
+ function getDefaultState$1(options) {
1558
+ const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
1559
+ const hasData = data !== void 0;
1560
+ const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
1561
+ return {
1562
+ data,
1563
+ dataUpdateCount: 0,
1564
+ dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
1565
+ error: null,
1566
+ errorUpdateCount: 0,
1567
+ errorUpdatedAt: 0,
1568
+ fetchFailureCount: 0,
1569
+ fetchFailureReason: null,
1570
+ fetchMeta: null,
1571
+ isInvalidated: false,
1572
+ status: hasData ? "success" : "pending",
1573
+ fetchStatus: "idle"
1574
+ };
1575
+ }
1576
+ //#endregion
1577
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
1578
+ function infiniteQueryBehavior(pages) {
1579
+ return { onFetch: (context, query) => {
1580
+ const options = context.options;
1581
+ const direction = context.fetchOptions?.meta?.fetchMore?.direction;
1582
+ const oldPages = context.state.data?.pages || [];
1583
+ const oldPageParams = context.state.data?.pageParams || [];
1584
+ let result = {
1585
+ pages: [],
1586
+ pageParams: []
1587
+ };
1588
+ let currentPage = 0;
1589
+ const fetchFn = async () => {
1590
+ let cancelled = false;
1591
+ const addSignalProperty = (object) => {
1592
+ addConsumeAwareSignal(object, () => context.signal, () => cancelled = true);
1593
+ };
1594
+ const queryFn = ensureQueryFn(context.options, context.fetchOptions);
1595
+ const fetchPage = async (data, param, previous) => {
1596
+ if (cancelled) return Promise.reject();
1597
+ if (param == null && data.pages.length) return Promise.resolve(data);
1598
+ const createQueryFnContext = () => {
1599
+ const queryFnContext2 = {
1600
+ client: context.client,
1601
+ queryKey: context.queryKey,
1602
+ pageParam: param,
1603
+ direction: previous ? "backward" : "forward",
1604
+ meta: context.options.meta
1605
+ };
1606
+ addSignalProperty(queryFnContext2);
1607
+ return queryFnContext2;
1608
+ };
1609
+ const queryFnContext = createQueryFnContext();
1610
+ const page = await queryFn(queryFnContext);
1611
+ const { maxPages } = context.options;
1612
+ const addTo = previous ? addToStart : addToEnd;
1613
+ return {
1614
+ pages: addTo(data.pages, page, maxPages),
1615
+ pageParams: addTo(data.pageParams, param, maxPages)
1616
+ };
1617
+ };
1618
+ if (direction && oldPages.length) {
1619
+ const previous = direction === "backward";
1620
+ const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
1621
+ const oldData = {
1622
+ pages: oldPages,
1623
+ pageParams: oldPageParams
1624
+ };
1625
+ result = await fetchPage(oldData, pageParamFn(options, oldData), previous);
1626
+ } else {
1627
+ const remainingPages = pages ?? oldPages.length;
1628
+ do {
1629
+ const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
1630
+ if (currentPage > 0 && param == null) break;
1631
+ result = await fetchPage(result, param);
1632
+ currentPage++;
1633
+ } while (currentPage < remainingPages);
1634
+ }
1635
+ return result;
1636
+ };
1637
+ if (context.options.persister) context.fetchFn = () => {
1638
+ return context.options.persister?.(fetchFn, {
1639
+ client: context.client,
1640
+ queryKey: context.queryKey,
1641
+ meta: context.options.meta,
1642
+ signal: context.signal
1643
+ }, query);
1644
+ };
1645
+ else context.fetchFn = fetchFn;
1646
+ } };
1647
+ }
1648
+ function getNextPageParam(options, { pages, pageParams }) {
1649
+ const lastIndex = pages.length - 1;
1650
+ return pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0;
1651
+ }
1652
+ function getPreviousPageParam(options, { pages, pageParams }) {
1653
+ return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
1654
+ }
1655
+ function hasNextPage(options, data) {
1656
+ if (!data) return false;
1657
+ return getNextPageParam(options, data) != null;
1658
+ }
1659
+ function hasPreviousPage(options, data) {
1660
+ if (!data || !options.getPreviousPageParam) return false;
1661
+ return getPreviousPageParam(options, data) != null;
1662
+ }
1663
+ //#endregion
1664
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutation.js
1665
+ var Mutation = class extends Removable {
1666
+ #client;
1667
+ #observers;
1668
+ #mutationCache;
1669
+ #retryer;
1670
+ constructor(config) {
1671
+ super();
1672
+ this.#client = config.client;
1673
+ this.mutationId = config.mutationId;
1674
+ this.#mutationCache = config.mutationCache;
1675
+ this.#observers = [];
1676
+ this.state = config.state || getDefaultState();
1677
+ this.setOptions(config.options);
1678
+ this.scheduleGc();
1679
+ }
1680
+ setOptions(options) {
1681
+ this.options = options;
1682
+ this.updateGcTime(this.options.gcTime);
1683
+ }
1684
+ get meta() {
1685
+ return this.options.meta;
1686
+ }
1687
+ addObserver(observer) {
1688
+ if (!this.#observers.includes(observer)) {
1689
+ this.#observers.push(observer);
1690
+ this.clearGcTimeout();
1691
+ this.#mutationCache.notify({
1692
+ type: "observerAdded",
1693
+ mutation: this,
1694
+ observer
1695
+ });
1696
+ }
1697
+ }
1698
+ removeObserver(observer) {
1699
+ this.#observers = this.#observers.filter((x) => x !== observer);
1700
+ this.scheduleGc();
1701
+ this.#mutationCache.notify({
1702
+ type: "observerRemoved",
1703
+ mutation: this,
1704
+ observer
1705
+ });
1706
+ }
1707
+ optionalRemove() {
1708
+ if (!this.#observers.length) {
1709
+ if (this.state.status === "pending") this.scheduleGc();
1710
+ else this.#mutationCache.remove(this);
1711
+ }
1712
+ }
1713
+ continue() {
1714
+ return this.#retryer?.continue() ?? this.execute(this.state.variables);
1715
+ }
1716
+ async execute(variables) {
1717
+ const onContinue = () => {
1718
+ this.#dispatch({ type: "continue" });
1719
+ };
1720
+ const mutationFnContext = {
1721
+ client: this.#client,
1722
+ meta: this.options.meta,
1723
+ mutationKey: this.options.mutationKey
1724
+ };
1725
+ this.#retryer = createRetryer({
1726
+ fn: () => {
1727
+ if (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error("No mutationFn found"));
1728
+ return this.options.mutationFn(variables, mutationFnContext);
1729
+ },
1730
+ onFail: (failureCount, error) => {
1731
+ this.#dispatch({
1732
+ type: "failed",
1733
+ failureCount,
1734
+ error
1735
+ });
1736
+ },
1737
+ onPause: () => {
1738
+ this.#dispatch({ type: "pause" });
1739
+ },
1740
+ onContinue,
1741
+ retry: this.options.retry ?? 0,
1742
+ retryDelay: this.options.retryDelay,
1743
+ networkMode: this.options.networkMode,
1744
+ canRun: () => this.#mutationCache.canRun(this)
1745
+ });
1746
+ const restored = this.state.status === "pending";
1747
+ const isPaused = !this.#retryer.canStart();
1748
+ try {
1749
+ if (restored) onContinue();
1750
+ else {
1751
+ this.#dispatch({
1752
+ type: "pending",
1753
+ variables,
1754
+ isPaused
1755
+ });
1756
+ if (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
1757
+ const context = await this.options.onMutate?.(variables, mutationFnContext);
1758
+ if (context !== this.state.context) this.#dispatch({
1759
+ type: "pending",
1760
+ context,
1761
+ variables,
1762
+ isPaused
1763
+ });
1764
+ }
1765
+ const data = await this.#retryer.start();
1766
+ await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);
1767
+ await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);
1768
+ await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);
1769
+ await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);
1770
+ this.#dispatch({
1771
+ type: "success",
1772
+ data
1773
+ });
1774
+ return data;
1775
+ } catch (error) {
1776
+ try {
1777
+ await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
1778
+ } catch (e) {
1779
+ Promise.reject(e);
1780
+ }
1781
+ try {
1782
+ await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
1783
+ } catch (e) {
1784
+ Promise.reject(e);
1785
+ }
1786
+ try {
1787
+ await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);
1788
+ } catch (e) {
1789
+ Promise.reject(e);
1790
+ }
1791
+ try {
1792
+ await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);
1793
+ } catch (e) {
1794
+ Promise.reject(e);
1795
+ }
1796
+ this.#dispatch({
1797
+ type: "error",
1798
+ error
1799
+ });
1800
+ throw error;
1801
+ } finally {
1802
+ this.#mutationCache.runNext(this);
1803
+ }
1804
+ }
1805
+ #dispatch(action) {
1806
+ const reducer = (state) => {
1807
+ switch (action.type) {
1808
+ case "failed": return {
1809
+ ...state,
1810
+ failureCount: action.failureCount,
1811
+ failureReason: action.error
1812
+ };
1813
+ case "pause": return {
1814
+ ...state,
1815
+ isPaused: true
1816
+ };
1817
+ case "continue": return {
1818
+ ...state,
1819
+ isPaused: false
1820
+ };
1821
+ case "pending": return {
1822
+ ...state,
1823
+ context: action.context,
1824
+ data: void 0,
1825
+ failureCount: 0,
1826
+ failureReason: null,
1827
+ error: null,
1828
+ isPaused: action.isPaused,
1829
+ status: "pending",
1830
+ variables: action.variables,
1831
+ submittedAt: Date.now()
1832
+ };
1833
+ case "success": return {
1834
+ ...state,
1835
+ data: action.data,
1836
+ failureCount: 0,
1837
+ failureReason: null,
1838
+ error: null,
1839
+ status: "success",
1840
+ isPaused: false
1841
+ };
1842
+ case "error": return {
1843
+ ...state,
1844
+ data: void 0,
1845
+ error: action.error,
1846
+ failureCount: state.failureCount + 1,
1847
+ failureReason: action.error,
1848
+ isPaused: false,
1849
+ status: "error"
1850
+ };
1851
+ }
1852
+ };
1853
+ this.state = reducer(this.state);
1854
+ notifyManager.batch(() => {
1855
+ this.#observers.forEach((observer) => {
1856
+ observer.onMutationUpdate(action);
1857
+ });
1858
+ this.#mutationCache.notify({
1859
+ mutation: this,
1860
+ type: "updated",
1861
+ action
1862
+ });
1863
+ });
1864
+ }
1865
+ };
1866
+ function getDefaultState() {
1867
+ return {
1868
+ context: void 0,
1869
+ data: void 0,
1870
+ error: null,
1871
+ failureCount: 0,
1872
+ failureReason: null,
1873
+ isPaused: false,
1874
+ status: "idle",
1875
+ variables: void 0,
1876
+ submittedAt: 0
1877
+ };
1878
+ }
1879
+ //#endregion
1880
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutationCache.js
1881
+ var MutationCache = class extends Subscribable {
1882
+ constructor(config = {}) {
1883
+ super();
1884
+ this.config = config;
1885
+ this.#mutations = /* @__PURE__ */ new Set();
1886
+ this.#scopes = /* @__PURE__ */ new Map();
1887
+ this.#mutationId = 0;
1888
+ }
1889
+ #mutations;
1890
+ #scopes;
1891
+ #mutationId;
1892
+ build(client, options, state) {
1893
+ const mutation = new Mutation({
1894
+ client,
1895
+ mutationCache: this,
1896
+ mutationId: ++this.#mutationId,
1897
+ options: client.defaultMutationOptions(options),
1898
+ state
1899
+ });
1900
+ this.add(mutation);
1901
+ return mutation;
1902
+ }
1903
+ add(mutation) {
1904
+ this.#mutations.add(mutation);
1905
+ const scope = scopeFor(mutation);
1906
+ if (typeof scope === "string") {
1907
+ const scopedMutations = this.#scopes.get(scope);
1908
+ if (scopedMutations) scopedMutations.push(mutation);
1909
+ else this.#scopes.set(scope, [mutation]);
1910
+ }
1911
+ this.notify({
1912
+ type: "added",
1913
+ mutation
1914
+ });
1915
+ }
1916
+ remove(mutation) {
1917
+ if (this.#mutations.delete(mutation)) {
1918
+ const scope = scopeFor(mutation);
1919
+ if (typeof scope === "string") {
1920
+ const scopedMutations = this.#scopes.get(scope);
1921
+ if (scopedMutations) {
1922
+ if (scopedMutations.length > 1) {
1923
+ const index = scopedMutations.indexOf(mutation);
1924
+ if (index !== -1) scopedMutations.splice(index, 1);
1925
+ } else if (scopedMutations[0] === mutation) this.#scopes.delete(scope);
1926
+ }
1927
+ }
1928
+ }
1929
+ this.notify({
1930
+ type: "removed",
1931
+ mutation
1932
+ });
1933
+ }
1934
+ canRun(mutation) {
1935
+ const scope = scopeFor(mutation);
1936
+ if (typeof scope === "string") {
1937
+ const firstPendingMutation = this.#scopes.get(scope)?.find((m) => m.state.status === "pending");
1938
+ return !firstPendingMutation || firstPendingMutation === mutation;
1939
+ } else return true;
1940
+ }
1941
+ runNext(mutation) {
1942
+ const scope = scopeFor(mutation);
1943
+ if (typeof scope === "string") return (this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused))?.continue() ?? Promise.resolve();
1944
+ else return Promise.resolve();
1945
+ }
1946
+ clear() {
1947
+ notifyManager.batch(() => {
1948
+ this.#mutations.forEach((mutation) => {
1949
+ this.notify({
1950
+ type: "removed",
1951
+ mutation
1952
+ });
1953
+ });
1954
+ this.#mutations.clear();
1955
+ this.#scopes.clear();
1956
+ });
1957
+ }
1958
+ getAll() {
1959
+ return Array.from(this.#mutations);
1960
+ }
1961
+ find(filters) {
1962
+ const defaultedFilters = {
1963
+ exact: true,
1964
+ ...filters
1965
+ };
1966
+ return this.getAll().find((mutation) => matchMutation(defaultedFilters, mutation));
1967
+ }
1968
+ findAll(filters = {}) {
1969
+ return this.getAll().filter((mutation) => matchMutation(filters, mutation));
1970
+ }
1971
+ notify(event) {
1972
+ notifyManager.batch(() => {
1973
+ this.listeners.forEach((listener) => {
1974
+ listener(event);
1975
+ });
1976
+ });
1977
+ }
1978
+ resumePausedMutations() {
1979
+ const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
1980
+ return notifyManager.batch(() => Promise.all(pausedMutations.map((mutation) => mutation.continue().catch(noop))));
1981
+ }
1982
+ };
1983
+ function scopeFor(mutation) {
1984
+ return mutation.options.scope?.id;
1985
+ }
1986
+ //#endregion
1987
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryCache.js
1988
+ var QueryCache = class extends Subscribable {
1989
+ constructor(config = {}) {
1990
+ super();
1991
+ this.config = config;
1992
+ this.#queries = /* @__PURE__ */ new Map();
1993
+ }
1994
+ #queries;
1995
+ build(client, options, state) {
1996
+ const queryKey = options.queryKey;
1997
+ const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
1998
+ let query = this.get(queryHash);
1999
+ if (!query) {
2000
+ query = new Query({
2001
+ client,
2002
+ queryKey,
2003
+ queryHash,
2004
+ options: client.defaultQueryOptions(options),
2005
+ state,
2006
+ defaultOptions: client.getQueryDefaults(queryKey)
2007
+ });
2008
+ this.add(query);
2009
+ }
2010
+ return query;
2011
+ }
2012
+ add(query) {
2013
+ if (!this.#queries.has(query.queryHash)) {
2014
+ this.#queries.set(query.queryHash, query);
2015
+ this.notify({
2016
+ type: "added",
2017
+ query
2018
+ });
2019
+ }
2020
+ }
2021
+ remove(query) {
2022
+ const queryInMap = this.#queries.get(query.queryHash);
2023
+ if (queryInMap) {
2024
+ query.destroy();
2025
+ if (queryInMap === query) this.#queries.delete(query.queryHash);
2026
+ this.notify({
2027
+ type: "removed",
2028
+ query
2029
+ });
2030
+ }
2031
+ }
2032
+ clear() {
2033
+ notifyManager.batch(() => {
2034
+ this.getAll().forEach((query) => {
2035
+ this.remove(query);
2036
+ });
2037
+ });
2038
+ }
2039
+ get(queryHash) {
2040
+ return this.#queries.get(queryHash);
2041
+ }
2042
+ getAll() {
2043
+ return [...this.#queries.values()];
2044
+ }
2045
+ find(filters) {
2046
+ const defaultedFilters = {
2047
+ exact: true,
2048
+ ...filters
2049
+ };
2050
+ return this.getAll().find((query) => matchQuery(defaultedFilters, query));
2051
+ }
2052
+ findAll(filters = {}) {
2053
+ const queries = this.getAll();
2054
+ return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
2055
+ }
2056
+ notify(event) {
2057
+ notifyManager.batch(() => {
2058
+ this.listeners.forEach((listener) => {
2059
+ listener(event);
2060
+ });
2061
+ });
2062
+ }
2063
+ onFocus() {
2064
+ notifyManager.batch(() => {
2065
+ this.getAll().forEach((query) => {
2066
+ query.onFocus();
2067
+ });
2068
+ });
2069
+ }
2070
+ onOnline() {
2071
+ notifyManager.batch(() => {
2072
+ this.getAll().forEach((query) => {
2073
+ query.onOnline();
2074
+ });
2075
+ });
2076
+ }
2077
+ };
2078
+ //#endregion
2079
+ //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryClient.js
2080
+ var QueryClient = class {
2081
+ #queryCache;
2082
+ #mutationCache;
2083
+ #defaultOptions;
2084
+ #queryDefaults;
2085
+ #mutationDefaults;
2086
+ #mountCount;
2087
+ #unsubscribeFocus;
2088
+ #unsubscribeOnline;
2089
+ constructor(config = {}) {
2090
+ this.#queryCache = config.queryCache || new QueryCache();
2091
+ this.#mutationCache = config.mutationCache || new MutationCache();
2092
+ this.#defaultOptions = config.defaultOptions || {};
2093
+ this.#queryDefaults = /* @__PURE__ */ new Map();
2094
+ this.#mutationDefaults = /* @__PURE__ */ new Map();
2095
+ this.#mountCount = 0;
2096
+ }
2097
+ mount() {
2098
+ this.#mountCount++;
2099
+ if (this.#mountCount !== 1) return;
2100
+ this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
2101
+ if (focused) {
2102
+ await this.resumePausedMutations();
2103
+ this.#queryCache.onFocus();
2104
+ }
2105
+ });
2106
+ this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
2107
+ if (online) {
2108
+ await this.resumePausedMutations();
2109
+ this.#queryCache.onOnline();
2110
+ }
2111
+ });
2112
+ }
2113
+ unmount() {
2114
+ this.#mountCount--;
2115
+ if (this.#mountCount !== 0) return;
2116
+ this.#unsubscribeFocus?.();
2117
+ this.#unsubscribeFocus = void 0;
2118
+ this.#unsubscribeOnline?.();
2119
+ this.#unsubscribeOnline = void 0;
2120
+ }
2121
+ isFetching(filters) {
2122
+ return this.#queryCache.findAll({
2123
+ ...filters,
2124
+ fetchStatus: "fetching"
2125
+ }).length;
2126
+ }
2127
+ isMutating(filters) {
2128
+ return this.#mutationCache.findAll({
2129
+ ...filters,
2130
+ status: "pending"
2131
+ }).length;
2132
+ }
2133
+ /**
2134
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
2135
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
2136
+ *
2137
+ * Hint: Do not use this function inside a component, because it won't receive updates.
2138
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
2139
+ */
2140
+ getQueryData(queryKey) {
2141
+ const options = this.defaultQueryOptions({ queryKey });
2142
+ return this.#queryCache.get(options.queryHash)?.state.data;
2143
+ }
2144
+ ensureQueryData(options) {
2145
+ const defaultedOptions = this.defaultQueryOptions(options);
2146
+ const query = this.#queryCache.build(this, defaultedOptions);
2147
+ const cachedData = query.state.data;
2148
+ if (cachedData === void 0) return this.fetchQuery(options);
2149
+ if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions);
2150
+ return Promise.resolve(cachedData);
2151
+ }
2152
+ getQueriesData(filters) {
2153
+ return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
2154
+ return [queryKey, state.data];
2155
+ });
2156
+ }
2157
+ setQueryData(queryKey, updater, options) {
2158
+ const defaultedOptions = this.defaultQueryOptions({ queryKey });
2159
+ const prevData = this.#queryCache.get(defaultedOptions.queryHash)?.state.data;
2160
+ const data = functionalUpdate(updater, prevData);
2161
+ if (data === void 0) return;
2162
+ return this.#queryCache.build(this, defaultedOptions).setData(data, {
2163
+ ...options,
2164
+ manual: true
2165
+ });
2166
+ }
2167
+ setQueriesData(filters, updater, options) {
2168
+ return notifyManager.batch(() => this.#queryCache.findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));
2169
+ }
2170
+ getQueryState(queryKey) {
2171
+ const options = this.defaultQueryOptions({ queryKey });
2172
+ return this.#queryCache.get(options.queryHash)?.state;
2173
+ }
2174
+ removeQueries(filters) {
2175
+ const queryCache = this.#queryCache;
2176
+ notifyManager.batch(() => {
2177
+ queryCache.findAll(filters).forEach((query) => {
2178
+ queryCache.remove(query);
2179
+ });
2180
+ });
2181
+ }
2182
+ resetQueries(filters, options) {
2183
+ const queryCache = this.#queryCache;
2184
+ return notifyManager.batch(() => {
2185
+ queryCache.findAll(filters).forEach((query) => {
2186
+ query.reset();
2187
+ });
2188
+ return this.refetchQueries({
2189
+ type: "active",
2190
+ ...filters
2191
+ }, options);
2192
+ });
2193
+ }
2194
+ cancelQueries(filters, cancelOptions = {}) {
2195
+ const defaultedCancelOptions = {
2196
+ revert: true,
2197
+ ...cancelOptions
2198
+ };
2199
+ const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions)));
2200
+ return Promise.all(promises).then(noop).catch(noop);
2201
+ }
2202
+ invalidateQueries(filters, options = {}) {
2203
+ return notifyManager.batch(() => {
2204
+ this.#queryCache.findAll(filters).forEach((query) => {
2205
+ query.invalidate();
2206
+ });
2207
+ if (filters?.refetchType === "none") return Promise.resolve();
2208
+ return this.refetchQueries({
2209
+ ...filters,
2210
+ type: filters?.refetchType ?? filters?.type ?? "active"
2211
+ }, options);
2212
+ });
2213
+ }
2214
+ refetchQueries(filters, options = {}) {
2215
+ const fetchOptions = {
2216
+ ...options,
2217
+ cancelRefetch: options.cancelRefetch ?? true
2218
+ };
2219
+ const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
2220
+ let promise = query.fetch(void 0, fetchOptions);
2221
+ if (!fetchOptions.throwOnError) promise = promise.catch(noop);
2222
+ return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
2223
+ }));
2224
+ return Promise.all(promises).then(noop);
2225
+ }
2226
+ fetchQuery(options) {
2227
+ const defaultedOptions = this.defaultQueryOptions(options);
2228
+ if (defaultedOptions.retry === void 0) defaultedOptions.retry = false;
2229
+ const query = this.#queryCache.build(this, defaultedOptions);
2230
+ return query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
2231
+ }
2232
+ prefetchQuery(options) {
2233
+ return this.fetchQuery(options).then(noop).catch(noop);
2234
+ }
2235
+ fetchInfiniteQuery(options) {
2236
+ options.behavior = infiniteQueryBehavior(options.pages);
2237
+ return this.fetchQuery(options);
2238
+ }
2239
+ prefetchInfiniteQuery(options) {
2240
+ return this.fetchInfiniteQuery(options).then(noop).catch(noop);
2241
+ }
2242
+ ensureInfiniteQueryData(options) {
2243
+ options.behavior = infiniteQueryBehavior(options.pages);
2244
+ return this.ensureQueryData(options);
2245
+ }
2246
+ resumePausedMutations() {
2247
+ if (onlineManager.isOnline()) return this.#mutationCache.resumePausedMutations();
2248
+ return Promise.resolve();
2249
+ }
2250
+ getQueryCache() {
2251
+ return this.#queryCache;
2252
+ }
2253
+ getMutationCache() {
2254
+ return this.#mutationCache;
2255
+ }
2256
+ getDefaultOptions() {
2257
+ return this.#defaultOptions;
2258
+ }
2259
+ setDefaultOptions(options) {
2260
+ this.#defaultOptions = options;
2261
+ }
2262
+ setQueryDefaults(queryKey, options) {
2263
+ this.#queryDefaults.set(hashKey(queryKey), {
2264
+ queryKey,
2265
+ defaultOptions: options
2266
+ });
2267
+ }
2268
+ getQueryDefaults(queryKey) {
2269
+ const defaults = [...this.#queryDefaults.values()];
2270
+ const result = {};
2271
+ defaults.forEach((queryDefault) => {
2272
+ if (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions);
2273
+ });
2274
+ return result;
2275
+ }
2276
+ setMutationDefaults(mutationKey, options) {
2277
+ this.#mutationDefaults.set(hashKey(mutationKey), {
2278
+ mutationKey,
2279
+ defaultOptions: options
2280
+ });
2281
+ }
2282
+ getMutationDefaults(mutationKey) {
2283
+ const defaults = [...this.#mutationDefaults.values()];
2284
+ const result = {};
2285
+ defaults.forEach((queryDefault) => {
2286
+ if (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions);
2287
+ });
2288
+ return result;
2289
+ }
2290
+ defaultQueryOptions(options) {
2291
+ if (options._defaulted) return options;
2292
+ const defaultedOptions = {
2293
+ ...this.#defaultOptions.queries,
2294
+ ...this.getQueryDefaults(options.queryKey),
2295
+ ...options,
2296
+ _defaulted: true
2297
+ };
2298
+ if (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);
2299
+ if (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
2300
+ if (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense;
2301
+ if (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = "offlineFirst";
2302
+ if (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false;
2303
+ return defaultedOptions;
2304
+ }
2305
+ defaultMutationOptions(options) {
2306
+ if (options?._defaulted) return options;
2307
+ return {
2308
+ ...this.#defaultOptions.mutations,
2309
+ ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
2310
+ ...options,
2311
+ _defaulted: true
2312
+ };
2313
+ }
2314
+ clear() {
2315
+ this.#queryCache.clear();
2316
+ this.#mutationCache.clear();
2317
+ }
2318
+ };
2319
+ //#endregion
2320
+ //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/queryOptions.js
2321
+ function queryOptions(options) {
2322
+ return options;
2323
+ }
2324
+ //#endregion
2325
+ //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js
2326
+ function infiniteQueryOptions(options) {
2327
+ return options;
2328
+ }
2329
+ //#endregion
2330
+ //#region editors/workflow-editor/run-kinds.ts
2331
+ const TEST_TRIGGER_KIND = "test";
2332
+ function realRuns(runs) {
2333
+ return runs.filter((run) => run.triggerKind !== TEST_TRIGGER_KIND);
2334
+ }
2335
+ //#endregion
2336
+ //#region editors/workflow-editor/ui/query-keys.ts
2337
+ function blockPart(block) {
2338
+ return [
2339
+ block.pieceName,
2340
+ block.pieceVersion,
2341
+ block.kind,
2342
+ block.name
2343
+ ];
2344
+ }
2345
+ function blockRefKey(block) {
2346
+ return blockPart(block).join(" ");
2347
+ }
2348
+ function resolverKey(scope, kind, input) {
2349
+ return [
2350
+ scope,
2351
+ kind,
2352
+ blockPart(input.block),
2353
+ input.propName,
2354
+ input.refreshers,
2355
+ input.connectionId ?? null,
2356
+ input.searchValue ?? null
2357
+ ];
2358
+ }
2359
+ const runtimeKeys = {
2360
+ all: (scope) => [scope],
2361
+ catalog: (scope) => [scope, "catalog"],
2362
+ form: (scope, block) => [
2363
+ scope,
2364
+ "form",
2365
+ blockPart(block)
2366
+ ],
2367
+ pieceActions: (scope, packageName) => [
2368
+ scope,
2369
+ "pieceActions",
2370
+ packageName
2371
+ ],
2372
+ pieceTriggers: (scope, packageName) => [
2373
+ scope,
2374
+ "pieceTriggers",
2375
+ packageName
2376
+ ],
2377
+ searchBlocks: (scope, query, limit) => [
2378
+ scope,
2379
+ "searchBlocks",
2380
+ query,
2381
+ limit
2382
+ ],
2383
+ outputTrees: (scope) => [scope, "outputTree"],
2384
+ outputTree: (scope, block, config) => [
2385
+ scope,
2386
+ "outputTree",
2387
+ blockPart(block),
2388
+ config ?? {}
2389
+ ],
2390
+ stepOutputTree: (scope, workflowId, stepId, testedAt) => [
2391
+ scope,
2392
+ "outputTree",
2393
+ "step",
2394
+ workflowId,
2395
+ stepId,
2396
+ testedAt
2397
+ ],
2398
+ options: (scope, input) => resolverKey(scope, "options", input),
2399
+ dynamic: (scope, input) => resolverKey(scope, "dynamic", input),
2400
+ connections: (scope, filter) => filter === void 0 ? [scope, "connections"] : [
2401
+ scope,
2402
+ "connections",
2403
+ filter
2404
+ ],
2405
+ webhook: (scope, workflowId) => [
2406
+ scope,
2407
+ "webhook",
2408
+ workflowId
2409
+ ],
2410
+ latestRun: (scope, workflowId) => [
2411
+ scope,
2412
+ "latestRun",
2413
+ workflowId
2414
+ ],
2415
+ allRuns: (scope) => [scope, "runs"],
2416
+ runs: (scope, runsScope) => [
2417
+ scope,
2418
+ "runs",
2419
+ {
2420
+ workflowId: runsScope.workflowId ?? null,
2421
+ driveId: runsScope.driveId ?? null,
2422
+ limit: runsScope.limit ?? null
2423
+ }
2424
+ ],
2425
+ runPages: (scope, runsScope) => [
2426
+ scope,
2427
+ "runs",
2428
+ "pages",
2429
+ {
2430
+ workflowId: runsScope.workflowId ?? null,
2431
+ driveId: runsScope.driveId ?? null,
2432
+ limit: runsScope.limit ?? null
2433
+ }
2434
+ ],
2435
+ run: (scope, runId) => [
2436
+ scope,
2437
+ "run",
2438
+ runId
2439
+ ],
2440
+ secret: (scope, ref) => [
2441
+ scope,
2442
+ "secret",
2443
+ ref
2444
+ ],
2445
+ allBlockResolutions: (scope, workflowId) => [
2446
+ scope,
2447
+ "blockResolutions",
2448
+ workflowId
2449
+ ],
2450
+ blockResolutions: (scope, workflowId, blocks) => [
2451
+ scope,
2452
+ "blockResolutions",
2453
+ workflowId,
2454
+ blocks.map(blockPart)
2455
+ ]
2456
+ };
2457
+ function queryKind(key) {
2458
+ return typeof key[1] === "string" ? key[1] : void 0;
2459
+ }
2460
+ const SHARED_STALE_MS = 18e5;
2461
+ const RESOLVER_STALE_MS = 3e5;
2462
+ //#endregion
2463
+ //#region editors/workflow-editor/runtime-queries.ts
2464
+ function createRuntimeQueryClient() {
2465
+ return new QueryClient({ defaultOptions: {
2466
+ queries: {
2467
+ retry: false,
2468
+ refetchOnWindowFocus: false
2469
+ },
2470
+ mutations: { retry: false }
2471
+ } });
2472
+ }
2473
+ const catalogQuery = (client) => queryOptions({
2474
+ queryKey: runtimeKeys.catalog(client.url),
2475
+ queryFn: () => client.fetchPieceCatalog(),
2476
+ staleTime: SHARED_STALE_MS
2477
+ });
2478
+ const blockFormQuery = (client, block) => queryOptions({
2479
+ queryKey: runtimeKeys.form(client.url, block),
2480
+ queryFn: () => client.getBlockForm(block),
2481
+ staleTime: SHARED_STALE_MS
2482
+ });
2483
+ const pieceActionsQuery = (client, packageName) => queryOptions({
2484
+ queryKey: runtimeKeys.pieceActions(client.url, packageName),
2485
+ queryFn: () => client.fetchPieceActions(packageName),
2486
+ staleTime: SHARED_STALE_MS
2487
+ });
2488
+ const pieceTriggersQuery = (client, packageName) => queryOptions({
2489
+ queryKey: runtimeKeys.pieceTriggers(client.url, packageName),
2490
+ queryFn: () => client.fetchPieceTriggers(packageName),
2491
+ staleTime: SHARED_STALE_MS
2492
+ });
2493
+ const outputTreeQuery = (client, block, config) => queryOptions({
2494
+ queryKey: runtimeKeys.outputTree(client.url, block, config),
2495
+ queryFn: () => client.fetchBlockOutputTree(block, config),
2496
+ staleTime: Infinity
2497
+ });
2498
+ const stepOutputTreeQuery = (client, workflowId, stepId, testedAt) => queryOptions({
2499
+ queryKey: runtimeKeys.stepOutputTree(client.url, workflowId, stepId, testedAt),
2500
+ queryFn: () => client.fetchStepOutputTree(workflowId, stepId),
2501
+ staleTime: Infinity
2502
+ });
2503
+ const REAL_RUNS = [TEST_TRIGGER_KIND];
2504
+ const runsQuery = (client, scope) => queryOptions({
2505
+ queryKey: runtimeKeys.runs(client.url, scope),
2506
+ queryFn: () => client.fetchRuns({
2507
+ ...scope,
2508
+ excludeTriggerKinds: REAL_RUNS
2509
+ }).then(realRuns),
2510
+ staleTime: 0
2511
+ });
2512
+ const runPagesQuery = (client, scope) => infiniteQueryOptions({
2513
+ queryKey: runtimeKeys.runPages(client.url, scope),
2514
+ queryFn: ({ pageParam }) => client.fetchRunsPage({
2515
+ ...scope,
2516
+ excludeTriggerKinds: REAL_RUNS
2517
+ }, pageParam),
2518
+ initialPageParam: null,
2519
+ getNextPageParam: (page) => page.hasNextPage && page.cursor ? page.cursor : void 0,
2520
+ staleTime: 0
2521
+ });
2522
+ function runsOfPages(pages) {
2523
+ const seen = /* @__PURE__ */ new Set();
2524
+ return realRuns(pages.flatMap((page) => page.items)).filter((run) => {
2525
+ if (seen.has(run.id)) return false;
2526
+ seen.add(run.id);
2527
+ return true;
2528
+ });
2529
+ }
2530
+ const FINISHED = /* @__PURE__ */ new Set(["SUCCEEDED", "FAILED"]);
2531
+ const runQuery = (client, runId) => queryOptions({
2532
+ queryKey: runtimeKeys.run(client.url, runId),
2533
+ queryFn: () => client.fetchRun(runId),
2534
+ staleTime: (query) => query.state.data && FINISHED.has(query.state.data.status) ? Infinity : 0
2535
+ });
2536
+ const secretStatQuery = (client, ref) => queryOptions({
2537
+ queryKey: runtimeKeys.secret(client.url, ref),
2538
+ queryFn: () => client.fetchSecretStat(ref),
2539
+ staleTime: 0
2540
+ });
2541
+ //#endregion
2542
+ export { pinBlock as $, keepPreviousData as A, Subscribable as B, infiniteQueryBehavior as C, focusManager as D, pendingThenable as E, resolveStaleTime as F, BRANCH_BLOCK as G, createRuntimeClient as H, shallowEqualObjects as I, SCHEDULE_TRIGGER as J, CORE_PIECE as K, shouldThrowError as L, replaceData as M, replaceEqualDeep as N, isServer as O, resolveEnabled as P, isCoreBlock as Q, timeUntilStale as R, hasPreviousPage as S, notifyManager as T, isSyncingError as U, DEFAULT_RUNTIME_URL as V, ASSERT_BLOCK as W, TRIGGER_PRESETS as X, STEP_PRESETS as Y, WEBHOOK_TRIGGER as Z, runtimeKeys as _, pieceActionsQuery as a, CORE_PIECE_NAME as at, QueryClient as b, runQuery as c, flowPorts as ct, secretStatQuery as d, scheduleConfigIssue as dt, sameBlock as et, stepOutputTreeQuery as f, queryKind as g, blockRefKey as h, outputTreeQuery as i, triggerFields as it, noop as j, isValidTimeout as k, runsOfPages as l, knownPorts as lt, SHARED_STALE_MS as m, catalogQuery as n, stepFields as nt, pieceTriggersQuery as o, NEXT_PORT as ot, RESOLVER_STALE_MS as p, MANUAL_TRIGGER as q, createRuntimeQueryClient as r, triggerBlock as rt, runPagesQuery as s, checkTriggerStrategy as st, blockFormQuery as t, stepBlock as tt, runsQuery as u, parseScheduleConfig as ut, TEST_TRIGGER_KIND as v, fetchState as w, hasNextPage as x, realRuns as y, timeoutManager as z };
2543
+
2544
+ //# sourceMappingURL=runtime-queries-D5EGaCrH.mjs.map