@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.
- package/README.md +8 -8
- package/dist/browser/BlockSelector-BHJQOhie.js +3051 -0
- package/dist/browser/BlockSelector-BHJQOhie.js.map +1 -0
- package/dist/browser/{connection-form-D-NETdDQ.js → connection-form-CaduwBiu.js} +349 -50
- package/dist/browser/connection-form-CaduwBiu.js.map +1 -0
- package/dist/browser/{data-tree-DA4sc7B7.js → data-tree-8219PVfh.js} +2 -2
- package/dist/browser/{data-tree-DA4sc7B7.js.map → data-tree-8219PVfh.js.map} +1 -1
- package/dist/browser/document-models/index.js +2 -2
- package/dist/browser/document-models/workflow/index.js +3 -3
- package/dist/browser/{document-models-BohsduV4.js → document-models-C1ZgIZyV.js} +7 -2
- package/dist/browser/{document-models-BohsduV4.js.map → document-models-C1ZgIZyV.js.map} +1 -1
- package/dist/browser/{editor-B6N0PCuZ.js → editor-BHV1MZS8.js} +2437 -6283
- package/dist/browser/editor-BHV1MZS8.js.map +1 -0
- package/dist/{node/editor-StBssjcQ.mjs → browser/editor-C0C1eB0R.js} +385 -119
- package/dist/browser/editor-C0C1eB0R.js.map +1 -0
- package/dist/browser/{editor-BkdwuOC-.js → editor-CFcXlZY2.js} +14 -24
- package/dist/browser/editor-CFcXlZY2.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +97 -43
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{module-Bkms70LV.js → module-DU2vb3FH.js} +574 -94
- package/dist/browser/module-DU2vb3FH.js.map +1 -0
- package/dist/browser/{piece-auth-Z4mZEOtL.js → piece-auth-BS5CtQOG.js} +45 -12
- package/dist/browser/piece-auth-BS5CtQOG.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/runtime-queries-Ds2kk-Ow.js +2535 -0
- package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +1 -0
- package/dist/browser/trigger-text-BkcklsMX.js +5569 -0
- package/dist/browser/trigger-text-BkcklsMX.js.map +1 -0
- package/dist/browser/{upgrade-manifests-BLrv3cf2.js → upgrade-manifests-BpakVE9l.js} +2 -2
- package/dist/browser/{upgrade-manifests-BLrv3cf2.js.map → upgrade-manifests-BpakVE9l.js.map} +1 -1
- package/dist/browser/{workflow-CGtVlhr8.js → workflow-BxShRhVy.js} +3 -2
- package/dist/browser/workflow-BxShRhVy.js.map +1 -0
- package/dist/node/BlockSelector-lOcIiaqt.mjs +3055 -0
- package/dist/node/BlockSelector-lOcIiaqt.mjs.map +1 -0
- package/dist/node/{connection-form-C9vbfSnA.mjs → connection-form-DWt29kft.mjs} +349 -50
- package/dist/node/connection-form-DWt29kft.mjs.map +1 -0
- package/dist/node/{data-tree-CbqpF3lC.mjs → data-tree-Cdx85Y19.mjs} +2 -2
- package/dist/node/{data-tree-CbqpF3lC.mjs.map → data-tree-Cdx85Y19.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +2 -2
- package/dist/node/document-models/workflow/index.mjs +3 -3
- package/dist/{browser/editor-CZ5NvCyv.js → node/editor-CR823u-y.mjs} +385 -119
- package/dist/node/editor-CR823u-y.mjs.map +1 -0
- package/dist/node/{editor-DP36YDk5.mjs → editor-CwX-G2Jv.mjs} +2437 -7479
- package/dist/node/editor-CwX-G2Jv.mjs.map +1 -0
- package/dist/node/{editor-By9BHI8e.mjs → editor-D_t8OtZn.mjs} +14 -24
- package/dist/node/editor-D_t8OtZn.mjs.map +1 -0
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +102 -43
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{module-DuxxhgKs.mjs → module-Dhe5E-VA.mjs} +574 -94
- package/dist/node/module-Dhe5E-VA.mjs.map +1 -0
- package/dist/node/{piece-auth-Z4mZEOtL.mjs → piece-auth-BS5CtQOG.mjs} +45 -12
- package/dist/node/piece-auth-BS5CtQOG.mjs.map +1 -0
- package/dist/node/pieces/index.mjs +0 -1
- package/dist/node/pieces/index.mjs.map +1 -1
- package/dist/node/pieces/reactor/descriptor.json +85 -3
- package/dist/node/pieces/reactor/index.mjs +14843 -163
- package/dist/node/pieces/reactor/index.mjs.map +1 -1
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/runtime-queries-D5EGaCrH.mjs +2544 -0
- package/dist/node/runtime-queries-D5EGaCrH.mjs.map +1 -0
- package/dist/node/trigger-text-DJIAQBWg.mjs +6765 -0
- package/dist/node/trigger-text-DJIAQBWg.mjs.map +1 -0
- package/dist/node/{upgrade-manifests-C1sl_M-H.mjs → upgrade-manifests-CmNd742Y.mjs} +2 -2
- package/dist/node/{upgrade-manifests-C1sl_M-H.mjs.map → upgrade-manifests-CmNd742Y.mjs.map} +1 -1
- package/dist/node/{workflow-C-uuQPnf.mjs → workflow-CGzYGZnr.mjs} +3 -2
- package/dist/node/workflow-CGzYGZnr.mjs.map +1 -0
- package/dist/powerhouse.manifest.json +6 -1
- package/dist/style.css +151 -19
- package/dist/types/ai/tools.d.ts +3 -1
- package/dist/types/ai/tools.d.ts.map +1 -1
- package/dist/types/ai/workflow-tools.d.ts.map +1 -1
- package/dist/types/document-models/document-models.d.ts +3 -0
- package/dist/types/document-models/document-models.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/actions.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/actions.d.ts +3 -1
- package/dist/types/document-models/workflow/v1/gen/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/creators.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/gen/creators.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/index.d.ts +1 -0
- package/dist/types/document-models/workflow/v1/gen/index.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts +14 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts +12 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts +6 -2
- package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts +3 -2
- package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts +13 -1
- package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts +2 -1
- package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +102 -12
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +21 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts +26 -1
- package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +13 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts +13 -1
- package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts +13 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/module.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/helpers.d.ts +15 -0
- package/dist/types/document-models/workflow/v1/src/helpers.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/edges.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/runtime.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/variables.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-form.d.ts +2 -1
- package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-usage.d.ts +3 -2
- package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts +7 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/status.d.ts +2 -1
- package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
- package/dist/types/editors/shared/controls.d.ts +17 -1
- package/dist/types/editors/shared/controls.d.ts.map +1 -1
- package/dist/types/editors/shared/editor-chrome.d.ts +2 -0
- package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
- package/dist/types/editors/shared/icons.d.ts +2 -0
- package/dist/types/editors/shared/icons.d.ts.map +1 -1
- package/dist/types/editors/shared/undo-plan.d.ts +20 -0
- package/dist/types/editors/shared/undo-plan.d.ts.map +1 -0
- package/dist/types/editors/shared/undo-plan.test.d.ts +2 -0
- package/dist/types/editors/shared/undo-plan.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts +0 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/run-kinds.d.ts +5 -0
- package/dist/types/editors/workflow-editor/run-kinds.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-api.d.ts +12 -139
- package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +260 -0
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-client.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/runtime-client.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +45 -0
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-persist.d.ts +23 -0
- package/dist/types/editors/workflow-editor/runtime-persist.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts +128 -0
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +3 -3
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts +4 -3
- package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts +2 -3
- package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts +6 -5
- package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +7 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +34 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +2 -3
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepTest.d.ts +11 -0
- package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/VariablesEditor.d.ts +0 -1
- package/dist/types/editors/workflow-editor/ui/VariablesEditor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts +1 -3
- package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts +1 -3
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts +31 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts +2 -1
- package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +7 -9
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +10 -5
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts +43 -2
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts +4 -2
- package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/connection-create.d.ts +3 -3
- package/dist/types/editors/workflow-editor/ui/connection-create.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts +92 -0
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +10 -2
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/forms.d.ts +35 -6
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/model.d.ts +58 -13
- package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +11 -6
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +5 -0
- package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +54 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts +3 -8
- package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts +18 -0
- package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts +14 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/test-state.d.ts +7 -0
- package/dist/types/editors/workflow-editor/ui/test-state.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -1
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +28 -0
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/validation.d.ts +33 -1
- package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/variable-types.d.ts +14 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.d.ts +33 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/use-runtime-url.d.ts +0 -1
- package/dist/types/editors/workflow-editor/use-runtime-url.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +1 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts +4 -1
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts +2 -1
- package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +13 -0
- package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts +0 -1
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/chain.d.ts +5 -3
- package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/run-format.d.ts +11 -2
- package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/step-outline.d.ts +3 -1
- package/dist/types/editors/workflow-studio/components/step-outline.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/ui.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/ui.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/useRuns.d.ts +4 -1
- package/dist/types/editors/workflow-studio/components/useRuns.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/editor.d.ts.map +1 -1
- package/dist/types/pieces/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +14 -1
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +14 -1
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/input-schema.d.ts +11 -2
- package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/parse.d.ts +22 -4
- package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/reactor.d.ts +15 -1
- package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
- package/dist/types/scripts/ui-stack.d.ts +53 -11
- package/dist/types/scripts/ui-stack.d.ts.map +1 -1
- package/dist/types/test/ui/block-picker.spec.d.ts +2 -0
- package/dist/types/test/ui/block-picker.spec.d.ts.map +1 -0
- package/dist/types/test/ui/branch.spec.d.ts +2 -0
- package/dist/types/test/ui/branch.spec.d.ts.map +1 -0
- package/dist/types/test/ui/canvas-logos.spec.d.ts +2 -0
- package/dist/types/test/ui/canvas-logos.spec.d.ts.map +1 -0
- package/dist/types/test/ui/fixtures.d.ts +1 -0
- package/dist/types/test/ui/fixtures.d.ts.map +1 -1
- package/dist/types/test/ui/global-setup.d.ts.map +1 -1
- package/dist/types/test/ui/harness/prop-controls.d.ts.map +1 -1
- package/dist/types/test/ui/piece-version.spec.d.ts +2 -0
- package/dist/types/test/ui/piece-version.spec.d.ts.map +1 -0
- package/dist/types/test/ui/ports.spec.d.ts +2 -0
- package/dist/types/test/ui/ports.spec.d.ts.map +1 -0
- package/dist/types/test/ui/publish.spec.d.ts +2 -0
- package/dist/types/test/ui/publish.spec.d.ts.map +1 -0
- package/dist/types/test/ui/step-test.spec.d.ts +2 -0
- package/dist/types/test/ui/step-test.spec.d.ts.map +1 -0
- package/dist/types/test/ui/variables.spec.d.ts +2 -0
- package/dist/types/test/ui/variables.spec.d.ts.map +1 -0
- package/dist/types/test/ui/webhook.spec.d.ts +2 -0
- package/dist/types/test/ui/webhook.spec.d.ts.map +1 -0
- package/dist/types/test/ui/workflow-menu.spec.d.ts +2 -0
- package/dist/types/test/ui/workflow-menu.spec.d.ts.map +1 -0
- package/package.json +11 -10
- package/dist/browser/BlockSelector-D24DIiSX.js +0 -1388
- package/dist/browser/BlockSelector-D24DIiSX.js.map +0 -1
- package/dist/browser/connection-form-D-NETdDQ.js.map +0 -1
- package/dist/browser/editor-B6N0PCuZ.js.map +0 -1
- package/dist/browser/editor-BkdwuOC-.js.map +0 -1
- package/dist/browser/editor-CZ5NvCyv.js.map +0 -1
- package/dist/browser/module-Bkms70LV.js.map +0 -1
- package/dist/browser/piece-auth-Z4mZEOtL.js.map +0 -1
- package/dist/browser/runtime-api-DDMQc4PB.js +0 -558
- package/dist/browser/runtime-api-DDMQc4PB.js.map +0 -1
- package/dist/browser/trigger-text-CUv5Z2Uk.js +0 -551
- package/dist/browser/trigger-text-CUv5Z2Uk.js.map +0 -1
- package/dist/browser/workflow-CGtVlhr8.js.map +0 -1
- package/dist/node/BlockSelector-CTmmpYxu.mjs +0 -1388
- package/dist/node/BlockSelector-CTmmpYxu.mjs.map +0 -1
- package/dist/node/connection-form-C9vbfSnA.mjs.map +0 -1
- package/dist/node/editor-By9BHI8e.mjs.map +0 -1
- package/dist/node/editor-DP36YDk5.mjs.map +0 -1
- package/dist/node/editor-StBssjcQ.mjs.map +0 -1
- package/dist/node/module-DuxxhgKs.mjs.map +0 -1
- package/dist/node/piece-auth-Z4mZEOtL.mjs.map +0 -1
- package/dist/node/runtime-api-DDMQc4PB.mjs +0 -558
- package/dist/node/runtime-api-DDMQc4PB.mjs.map +0 -1
- package/dist/node/trigger-text-Bzq6VfOQ.mjs +0 -551
- package/dist/node/trigger-text-Bzq6VfOQ.mjs.map +0 -1
- package/dist/node/workflow-C-uuQPnf.mjs.map +0 -1
- package/dist/types/editors/workflow-editor/runtime-api.test.d.ts +0 -2
- package/dist/types/editors/workflow-editor/runtime-api.test.d.ts.map +0 -1
- package/dist/types/editors/workflow-editor/runtime-piece-source.d.ts +0 -2
- package/dist/types/editors/workflow-editor/runtime-piece-source.d.ts.map +0 -1
|
@@ -0,0 +1,2535 @@
|
|
|
1
|
+
import { Rt as blockKey } from "./module-DU2vb3FH.js";
|
|
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 (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, {
|
|
675
|
+
previous: this.#provider,
|
|
676
|
+
provider
|
|
677
|
+
});
|
|
678
|
+
this.#provider = provider;
|
|
679
|
+
this.#providerCalled = false;
|
|
680
|
+
}
|
|
681
|
+
setTimeout(callback, delay) {
|
|
682
|
+
this.#providerCalled = true;
|
|
683
|
+
return this.#provider.setTimeout(callback, delay);
|
|
684
|
+
}
|
|
685
|
+
clearTimeout(timeoutId) {
|
|
686
|
+
this.#provider.clearTimeout(timeoutId);
|
|
687
|
+
}
|
|
688
|
+
setInterval(callback, delay) {
|
|
689
|
+
this.#providerCalled = true;
|
|
690
|
+
return this.#provider.setInterval(callback, delay);
|
|
691
|
+
}
|
|
692
|
+
clearInterval(intervalId) {
|
|
693
|
+
this.#provider.clearInterval(intervalId);
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
var timeoutManager = new TimeoutManager();
|
|
697
|
+
function systemSetTimeoutZero(callback) {
|
|
698
|
+
setTimeout(callback, 0);
|
|
699
|
+
}
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/utils.js
|
|
702
|
+
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
703
|
+
function noop() {}
|
|
704
|
+
function functionalUpdate(updater, input) {
|
|
705
|
+
return typeof updater === "function" ? updater(input) : updater;
|
|
706
|
+
}
|
|
707
|
+
function isValidTimeout(value) {
|
|
708
|
+
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
709
|
+
}
|
|
710
|
+
function timeUntilStale(updatedAt, staleTime) {
|
|
711
|
+
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
712
|
+
}
|
|
713
|
+
function resolveStaleTime(staleTime, query) {
|
|
714
|
+
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
715
|
+
}
|
|
716
|
+
function resolveEnabled(enabled, query) {
|
|
717
|
+
return typeof enabled === "function" ? enabled(query) : enabled;
|
|
718
|
+
}
|
|
719
|
+
function matchQuery(filters, query) {
|
|
720
|
+
const { type = "all", exact, fetchStatus, predicate, queryKey, stale } = filters;
|
|
721
|
+
if (queryKey) {
|
|
722
|
+
if (exact) {
|
|
723
|
+
if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;
|
|
724
|
+
} else if (!partialMatchKey(query.queryKey, queryKey)) return false;
|
|
725
|
+
}
|
|
726
|
+
if (type !== "all") {
|
|
727
|
+
const isActive = query.isActive();
|
|
728
|
+
if (type === "active" && !isActive) return false;
|
|
729
|
+
if (type === "inactive" && isActive) return false;
|
|
730
|
+
}
|
|
731
|
+
if (typeof stale === "boolean" && query.isStale() !== stale) return false;
|
|
732
|
+
if (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;
|
|
733
|
+
if (predicate && !predicate(query)) return false;
|
|
734
|
+
return true;
|
|
735
|
+
}
|
|
736
|
+
function matchMutation(filters, mutation) {
|
|
737
|
+
const { exact, status, predicate, mutationKey } = filters;
|
|
738
|
+
if (mutationKey) {
|
|
739
|
+
if (!mutation.options.mutationKey) return false;
|
|
740
|
+
if (exact) {
|
|
741
|
+
if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false;
|
|
742
|
+
} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false;
|
|
743
|
+
}
|
|
744
|
+
if (status && mutation.state.status !== status) return false;
|
|
745
|
+
if (predicate && !predicate(mutation)) return false;
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
function hashQueryKeyByOptions(queryKey, options) {
|
|
749
|
+
return (options?.queryKeyHashFn || hashKey)(queryKey);
|
|
750
|
+
}
|
|
751
|
+
function hashKey(queryKey) {
|
|
752
|
+
return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
753
|
+
result[key] = val[key];
|
|
754
|
+
return result;
|
|
755
|
+
}, {}) : val);
|
|
756
|
+
}
|
|
757
|
+
function partialMatchKey(a, b) {
|
|
758
|
+
if (a === b) return true;
|
|
759
|
+
if (typeof a !== typeof b) return false;
|
|
760
|
+
if (a && b && typeof a === "object" && typeof b === "object") return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
764
|
+
function replaceEqualDeep(a, b, depth = 0) {
|
|
765
|
+
if (a === b) return a;
|
|
766
|
+
if (depth > 500) return b;
|
|
767
|
+
const array = isPlainArray(a) && isPlainArray(b);
|
|
768
|
+
if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
|
|
769
|
+
const aSize = (array ? a : Object.keys(a)).length;
|
|
770
|
+
const bItems = array ? b : Object.keys(b);
|
|
771
|
+
const bSize = bItems.length;
|
|
772
|
+
const copy = array ? new Array(bSize) : {};
|
|
773
|
+
let equalItems = 0;
|
|
774
|
+
for (let i = 0; i < bSize; i++) {
|
|
775
|
+
const key = array ? i : bItems[i];
|
|
776
|
+
const aItem = a[key];
|
|
777
|
+
const bItem = b[key];
|
|
778
|
+
if (aItem === bItem) {
|
|
779
|
+
copy[key] = aItem;
|
|
780
|
+
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
784
|
+
copy[key] = bItem;
|
|
785
|
+
continue;
|
|
786
|
+
}
|
|
787
|
+
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
788
|
+
copy[key] = v;
|
|
789
|
+
if (v === aItem) equalItems++;
|
|
790
|
+
}
|
|
791
|
+
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
792
|
+
}
|
|
793
|
+
function shallowEqualObjects(a, b) {
|
|
794
|
+
if (!b || Object.keys(a).length !== Object.keys(b).length) return false;
|
|
795
|
+
for (const key in a) if (a[key] !== b[key]) return false;
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
function isPlainArray(value) {
|
|
799
|
+
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
800
|
+
}
|
|
801
|
+
function isPlainObject(o) {
|
|
802
|
+
if (!hasObjectPrototype(o)) return false;
|
|
803
|
+
const ctor = o.constructor;
|
|
804
|
+
if (ctor === void 0) return true;
|
|
805
|
+
const prot = ctor.prototype;
|
|
806
|
+
if (!hasObjectPrototype(prot)) return false;
|
|
807
|
+
if (!prot.hasOwnProperty("isPrototypeOf")) return false;
|
|
808
|
+
if (Object.getPrototypeOf(o) !== Object.prototype) return false;
|
|
809
|
+
return true;
|
|
810
|
+
}
|
|
811
|
+
function hasObjectPrototype(o) {
|
|
812
|
+
return Object.prototype.toString.call(o) === "[object Object]";
|
|
813
|
+
}
|
|
814
|
+
function sleep(timeout) {
|
|
815
|
+
return new Promise((resolve) => {
|
|
816
|
+
timeoutManager.setTimeout(resolve, timeout);
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
function replaceData(prevData, data, options) {
|
|
820
|
+
if (typeof options.structuralSharing === "function") return options.structuralSharing(prevData, data);
|
|
821
|
+
else if (options.structuralSharing !== false) try {
|
|
822
|
+
return replaceEqualDeep(prevData, data);
|
|
823
|
+
} catch (error) {
|
|
824
|
+
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}`);
|
|
825
|
+
throw error;
|
|
826
|
+
}
|
|
827
|
+
return data;
|
|
828
|
+
}
|
|
829
|
+
function keepPreviousData(previousData) {
|
|
830
|
+
return previousData;
|
|
831
|
+
}
|
|
832
|
+
function addToEnd(items, item, max = 0) {
|
|
833
|
+
const newItems = [...items, item];
|
|
834
|
+
return max && newItems.length > max ? newItems.slice(1) : newItems;
|
|
835
|
+
}
|
|
836
|
+
function addToStart(items, item, max = 0) {
|
|
837
|
+
const newItems = [item, ...items];
|
|
838
|
+
return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
|
|
839
|
+
}
|
|
840
|
+
var skipToken = /* @__PURE__ */ Symbol();
|
|
841
|
+
function ensureQueryFn(options, fetchOptions) {
|
|
842
|
+
if (options.queryFn === skipToken) console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);
|
|
843
|
+
if (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise;
|
|
844
|
+
if (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`));
|
|
845
|
+
return options.queryFn;
|
|
846
|
+
}
|
|
847
|
+
function shouldThrowError(throwOnError, params) {
|
|
848
|
+
if (typeof throwOnError === "function") return throwOnError(...params);
|
|
849
|
+
return !!throwOnError;
|
|
850
|
+
}
|
|
851
|
+
function addConsumeAwareSignal(object, getSignal, onCancelled) {
|
|
852
|
+
let consumed = false;
|
|
853
|
+
let signal;
|
|
854
|
+
Object.defineProperty(object, "signal", {
|
|
855
|
+
enumerable: true,
|
|
856
|
+
get: () => {
|
|
857
|
+
signal ??= getSignal();
|
|
858
|
+
if (consumed) return signal;
|
|
859
|
+
consumed = true;
|
|
860
|
+
if (signal.aborted) onCancelled();
|
|
861
|
+
else signal.addEventListener("abort", onCancelled, { once: true });
|
|
862
|
+
return signal;
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
return object;
|
|
866
|
+
}
|
|
867
|
+
//#endregion
|
|
868
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
869
|
+
var FocusManager = class extends Subscribable {
|
|
870
|
+
#focused;
|
|
871
|
+
#cleanup;
|
|
872
|
+
#setup;
|
|
873
|
+
constructor() {
|
|
874
|
+
super();
|
|
875
|
+
this.#setup = (onFocus) => {
|
|
876
|
+
if (!isServer && window.addEventListener) {
|
|
877
|
+
const listener = () => onFocus();
|
|
878
|
+
window.addEventListener("visibilitychange", listener, false);
|
|
879
|
+
return () => {
|
|
880
|
+
window.removeEventListener("visibilitychange", listener);
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
onSubscribe() {
|
|
886
|
+
if (!this.#cleanup) this.setEventListener(this.#setup);
|
|
887
|
+
}
|
|
888
|
+
onUnsubscribe() {
|
|
889
|
+
if (!this.hasListeners()) {
|
|
890
|
+
this.#cleanup?.();
|
|
891
|
+
this.#cleanup = void 0;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
setEventListener(setup) {
|
|
895
|
+
this.#setup = setup;
|
|
896
|
+
this.#cleanup?.();
|
|
897
|
+
this.#cleanup = setup((focused) => {
|
|
898
|
+
if (typeof focused === "boolean") this.setFocused(focused);
|
|
899
|
+
else this.onFocus();
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
setFocused(focused) {
|
|
903
|
+
if (this.#focused !== focused) {
|
|
904
|
+
this.#focused = focused;
|
|
905
|
+
this.onFocus();
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
onFocus() {
|
|
909
|
+
const isFocused = this.isFocused();
|
|
910
|
+
this.listeners.forEach((listener) => {
|
|
911
|
+
listener(isFocused);
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
isFocused() {
|
|
915
|
+
if (typeof this.#focused === "boolean") return this.#focused;
|
|
916
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
var focusManager = new FocusManager();
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
922
|
+
function pendingThenable() {
|
|
923
|
+
let resolve;
|
|
924
|
+
let reject;
|
|
925
|
+
const thenable = new Promise((_resolve, _reject) => {
|
|
926
|
+
resolve = _resolve;
|
|
927
|
+
reject = _reject;
|
|
928
|
+
});
|
|
929
|
+
thenable.status = "pending";
|
|
930
|
+
thenable.catch(() => {});
|
|
931
|
+
function finalize(data) {
|
|
932
|
+
Object.assign(thenable, data);
|
|
933
|
+
delete thenable.resolve;
|
|
934
|
+
delete thenable.reject;
|
|
935
|
+
}
|
|
936
|
+
thenable.resolve = (value) => {
|
|
937
|
+
finalize({
|
|
938
|
+
status: "fulfilled",
|
|
939
|
+
value
|
|
940
|
+
});
|
|
941
|
+
resolve(value);
|
|
942
|
+
};
|
|
943
|
+
thenable.reject = (reason) => {
|
|
944
|
+
finalize({
|
|
945
|
+
status: "rejected",
|
|
946
|
+
reason
|
|
947
|
+
});
|
|
948
|
+
reject(reason);
|
|
949
|
+
};
|
|
950
|
+
return thenable;
|
|
951
|
+
}
|
|
952
|
+
//#endregion
|
|
953
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
954
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
955
|
+
function createNotifyManager() {
|
|
956
|
+
let queue = [];
|
|
957
|
+
let transactions = 0;
|
|
958
|
+
let notifyFn = (callback) => {
|
|
959
|
+
callback();
|
|
960
|
+
};
|
|
961
|
+
let batchNotifyFn = (callback) => {
|
|
962
|
+
callback();
|
|
963
|
+
};
|
|
964
|
+
let scheduleFn = defaultScheduler;
|
|
965
|
+
const schedule = (callback) => {
|
|
966
|
+
if (transactions) queue.push(callback);
|
|
967
|
+
else scheduleFn(() => {
|
|
968
|
+
notifyFn(callback);
|
|
969
|
+
});
|
|
970
|
+
};
|
|
971
|
+
const flush = () => {
|
|
972
|
+
const originalQueue = queue;
|
|
973
|
+
queue = [];
|
|
974
|
+
if (originalQueue.length) scheduleFn(() => {
|
|
975
|
+
batchNotifyFn(() => {
|
|
976
|
+
originalQueue.forEach((callback) => {
|
|
977
|
+
notifyFn(callback);
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
});
|
|
981
|
+
};
|
|
982
|
+
return {
|
|
983
|
+
batch: (callback) => {
|
|
984
|
+
let result;
|
|
985
|
+
transactions++;
|
|
986
|
+
try {
|
|
987
|
+
result = callback();
|
|
988
|
+
} finally {
|
|
989
|
+
transactions--;
|
|
990
|
+
if (!transactions) flush();
|
|
991
|
+
}
|
|
992
|
+
return result;
|
|
993
|
+
},
|
|
994
|
+
/**
|
|
995
|
+
* All calls to the wrapped function will be batched.
|
|
996
|
+
*/
|
|
997
|
+
batchCalls: (callback) => {
|
|
998
|
+
return (...args) => {
|
|
999
|
+
schedule(() => {
|
|
1000
|
+
callback(...args);
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
},
|
|
1004
|
+
schedule,
|
|
1005
|
+
/**
|
|
1006
|
+
* Use this method to set a custom notify function.
|
|
1007
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
1008
|
+
*/
|
|
1009
|
+
setNotifyFunction: (fn) => {
|
|
1010
|
+
notifyFn = fn;
|
|
1011
|
+
},
|
|
1012
|
+
/**
|
|
1013
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
1014
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
1015
|
+
*/
|
|
1016
|
+
setBatchNotifyFunction: (fn) => {
|
|
1017
|
+
batchNotifyFn = fn;
|
|
1018
|
+
},
|
|
1019
|
+
setScheduler: (fn) => {
|
|
1020
|
+
scheduleFn = fn;
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
var notifyManager = createNotifyManager();
|
|
1025
|
+
//#endregion
|
|
1026
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
1027
|
+
var OnlineManager = class extends Subscribable {
|
|
1028
|
+
#online = true;
|
|
1029
|
+
#cleanup;
|
|
1030
|
+
#setup;
|
|
1031
|
+
constructor() {
|
|
1032
|
+
super();
|
|
1033
|
+
this.#setup = (onOnline) => {
|
|
1034
|
+
if (!isServer && window.addEventListener) {
|
|
1035
|
+
const onlineListener = () => onOnline(true);
|
|
1036
|
+
const offlineListener = () => onOnline(false);
|
|
1037
|
+
window.addEventListener("online", onlineListener, false);
|
|
1038
|
+
window.addEventListener("offline", offlineListener, false);
|
|
1039
|
+
return () => {
|
|
1040
|
+
window.removeEventListener("online", onlineListener);
|
|
1041
|
+
window.removeEventListener("offline", offlineListener);
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
onSubscribe() {
|
|
1047
|
+
if (!this.#cleanup) this.setEventListener(this.#setup);
|
|
1048
|
+
}
|
|
1049
|
+
onUnsubscribe() {
|
|
1050
|
+
if (!this.hasListeners()) {
|
|
1051
|
+
this.#cleanup?.();
|
|
1052
|
+
this.#cleanup = void 0;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
setEventListener(setup) {
|
|
1056
|
+
this.#setup = setup;
|
|
1057
|
+
this.#cleanup?.();
|
|
1058
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
1059
|
+
}
|
|
1060
|
+
setOnline(online) {
|
|
1061
|
+
if (this.#online !== online) {
|
|
1062
|
+
this.#online = online;
|
|
1063
|
+
this.listeners.forEach((listener) => {
|
|
1064
|
+
listener(online);
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
isOnline() {
|
|
1069
|
+
return this.#online;
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
var onlineManager = new OnlineManager();
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
1075
|
+
function defaultRetryDelay(failureCount) {
|
|
1076
|
+
return Math.min(1e3 * 2 ** failureCount, 3e4);
|
|
1077
|
+
}
|
|
1078
|
+
function canFetch(networkMode) {
|
|
1079
|
+
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
1080
|
+
}
|
|
1081
|
+
var CancelledError = class extends Error {
|
|
1082
|
+
constructor(options) {
|
|
1083
|
+
super("CancelledError");
|
|
1084
|
+
this.revert = options?.revert;
|
|
1085
|
+
this.silent = options?.silent;
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
function createRetryer(config) {
|
|
1089
|
+
let isRetryCancelled = false;
|
|
1090
|
+
let failureCount = 0;
|
|
1091
|
+
let continueFn;
|
|
1092
|
+
const thenable = pendingThenable();
|
|
1093
|
+
const isResolved = () => thenable.status !== "pending";
|
|
1094
|
+
const cancel = (cancelOptions) => {
|
|
1095
|
+
if (!isResolved()) {
|
|
1096
|
+
const error = new CancelledError(cancelOptions);
|
|
1097
|
+
reject(error);
|
|
1098
|
+
config.onCancel?.(error);
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
const cancelRetry = () => {
|
|
1102
|
+
isRetryCancelled = true;
|
|
1103
|
+
};
|
|
1104
|
+
const continueRetry = () => {
|
|
1105
|
+
isRetryCancelled = false;
|
|
1106
|
+
};
|
|
1107
|
+
const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
|
|
1108
|
+
const canStart = () => canFetch(config.networkMode) && config.canRun();
|
|
1109
|
+
const resolve = (value) => {
|
|
1110
|
+
if (!isResolved()) {
|
|
1111
|
+
continueFn?.();
|
|
1112
|
+
thenable.resolve(value);
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
const reject = (value) => {
|
|
1116
|
+
if (!isResolved()) {
|
|
1117
|
+
continueFn?.();
|
|
1118
|
+
thenable.reject(value);
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
const pause = () => {
|
|
1122
|
+
return new Promise((continueResolve) => {
|
|
1123
|
+
continueFn = (value) => {
|
|
1124
|
+
if (isResolved() || canContinue()) continueResolve(value);
|
|
1125
|
+
};
|
|
1126
|
+
config.onPause?.();
|
|
1127
|
+
}).then(() => {
|
|
1128
|
+
continueFn = void 0;
|
|
1129
|
+
if (!isResolved()) config.onContinue?.();
|
|
1130
|
+
});
|
|
1131
|
+
};
|
|
1132
|
+
const run = () => {
|
|
1133
|
+
if (isResolved()) return;
|
|
1134
|
+
let promiseOrValue;
|
|
1135
|
+
const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
|
|
1136
|
+
try {
|
|
1137
|
+
promiseOrValue = initialPromise ?? config.fn();
|
|
1138
|
+
} catch (error) {
|
|
1139
|
+
promiseOrValue = Promise.reject(error);
|
|
1140
|
+
}
|
|
1141
|
+
Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
|
|
1142
|
+
if (isResolved()) return;
|
|
1143
|
+
const retry = config.retry ?? (isServer ? 0 : 3);
|
|
1144
|
+
const retryDelay = config.retryDelay ?? defaultRetryDelay;
|
|
1145
|
+
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
|
|
1146
|
+
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
|
|
1147
|
+
if (isRetryCancelled || !shouldRetry) {
|
|
1148
|
+
reject(error);
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
failureCount++;
|
|
1152
|
+
config.onFail?.(failureCount, error);
|
|
1153
|
+
sleep(delay).then(() => {
|
|
1154
|
+
return canContinue() ? void 0 : pause();
|
|
1155
|
+
}).then(() => {
|
|
1156
|
+
if (isRetryCancelled) reject(error);
|
|
1157
|
+
else run();
|
|
1158
|
+
});
|
|
1159
|
+
});
|
|
1160
|
+
};
|
|
1161
|
+
return {
|
|
1162
|
+
promise: thenable,
|
|
1163
|
+
status: () => thenable.status,
|
|
1164
|
+
cancel,
|
|
1165
|
+
continue: () => {
|
|
1166
|
+
continueFn?.();
|
|
1167
|
+
return thenable;
|
|
1168
|
+
},
|
|
1169
|
+
cancelRetry,
|
|
1170
|
+
continueRetry,
|
|
1171
|
+
canStart,
|
|
1172
|
+
start: () => {
|
|
1173
|
+
if (canStart()) run();
|
|
1174
|
+
else pause().then(run);
|
|
1175
|
+
return thenable;
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
//#endregion
|
|
1180
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/removable.js
|
|
1181
|
+
var Removable = class {
|
|
1182
|
+
#gcTimeout;
|
|
1183
|
+
destroy() {
|
|
1184
|
+
this.clearGcTimeout();
|
|
1185
|
+
}
|
|
1186
|
+
scheduleGc() {
|
|
1187
|
+
this.clearGcTimeout();
|
|
1188
|
+
if (isValidTimeout(this.gcTime)) this.#gcTimeout = timeoutManager.setTimeout(() => {
|
|
1189
|
+
this.optionalRemove();
|
|
1190
|
+
}, this.gcTime);
|
|
1191
|
+
}
|
|
1192
|
+
updateGcTime(newGcTime) {
|
|
1193
|
+
this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (isServer ? Infinity : 3e5));
|
|
1194
|
+
}
|
|
1195
|
+
clearGcTimeout() {
|
|
1196
|
+
if (this.#gcTimeout) {
|
|
1197
|
+
timeoutManager.clearTimeout(this.#gcTimeout);
|
|
1198
|
+
this.#gcTimeout = void 0;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
//#endregion
|
|
1203
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/query.js
|
|
1204
|
+
var Query = class extends Removable {
|
|
1205
|
+
#initialState;
|
|
1206
|
+
#revertState;
|
|
1207
|
+
#cache;
|
|
1208
|
+
#client;
|
|
1209
|
+
#retryer;
|
|
1210
|
+
#defaultOptions;
|
|
1211
|
+
#abortSignalConsumed;
|
|
1212
|
+
constructor(config) {
|
|
1213
|
+
super();
|
|
1214
|
+
this.#abortSignalConsumed = false;
|
|
1215
|
+
this.#defaultOptions = config.defaultOptions;
|
|
1216
|
+
this.setOptions(config.options);
|
|
1217
|
+
this.observers = [];
|
|
1218
|
+
this.#client = config.client;
|
|
1219
|
+
this.#cache = this.#client.getQueryCache();
|
|
1220
|
+
this.queryKey = config.queryKey;
|
|
1221
|
+
this.queryHash = config.queryHash;
|
|
1222
|
+
this.#initialState = getDefaultState$1(this.options);
|
|
1223
|
+
this.state = config.state ?? this.#initialState;
|
|
1224
|
+
this.scheduleGc();
|
|
1225
|
+
}
|
|
1226
|
+
get meta() {
|
|
1227
|
+
return this.options.meta;
|
|
1228
|
+
}
|
|
1229
|
+
get promise() {
|
|
1230
|
+
return this.#retryer?.promise;
|
|
1231
|
+
}
|
|
1232
|
+
setOptions(options) {
|
|
1233
|
+
this.options = {
|
|
1234
|
+
...this.#defaultOptions,
|
|
1235
|
+
...options
|
|
1236
|
+
};
|
|
1237
|
+
this.updateGcTime(this.options.gcTime);
|
|
1238
|
+
if (this.state && this.state.data === void 0) {
|
|
1239
|
+
const defaultState = getDefaultState$1(this.options);
|
|
1240
|
+
if (defaultState.data !== void 0) {
|
|
1241
|
+
this.setState(successState(defaultState.data, defaultState.dataUpdatedAt));
|
|
1242
|
+
this.#initialState = defaultState;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
optionalRemove() {
|
|
1247
|
+
if (!this.observers.length && this.state.fetchStatus === "idle") this.#cache.remove(this);
|
|
1248
|
+
}
|
|
1249
|
+
setData(newData, options) {
|
|
1250
|
+
const data = replaceData(this.state.data, newData, this.options);
|
|
1251
|
+
this.#dispatch({
|
|
1252
|
+
data,
|
|
1253
|
+
type: "success",
|
|
1254
|
+
dataUpdatedAt: options?.updatedAt,
|
|
1255
|
+
manual: options?.manual
|
|
1256
|
+
});
|
|
1257
|
+
return data;
|
|
1258
|
+
}
|
|
1259
|
+
setState(state, setStateOptions) {
|
|
1260
|
+
this.#dispatch({
|
|
1261
|
+
type: "setState",
|
|
1262
|
+
state,
|
|
1263
|
+
setStateOptions
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
cancel(options) {
|
|
1267
|
+
const promise = this.#retryer?.promise;
|
|
1268
|
+
this.#retryer?.cancel(options);
|
|
1269
|
+
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
1270
|
+
}
|
|
1271
|
+
destroy() {
|
|
1272
|
+
super.destroy();
|
|
1273
|
+
this.cancel({ silent: true });
|
|
1274
|
+
}
|
|
1275
|
+
reset() {
|
|
1276
|
+
this.destroy();
|
|
1277
|
+
this.setState(this.#initialState);
|
|
1278
|
+
}
|
|
1279
|
+
isActive() {
|
|
1280
|
+
return this.observers.some((observer) => resolveEnabled(observer.options.enabled, this) !== false);
|
|
1281
|
+
}
|
|
1282
|
+
isDisabled() {
|
|
1283
|
+
if (this.getObserversCount() > 0) return !this.isActive();
|
|
1284
|
+
return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
1285
|
+
}
|
|
1286
|
+
isStatic() {
|
|
1287
|
+
if (this.getObserversCount() > 0) return this.observers.some((observer) => resolveStaleTime(observer.options.staleTime, this) === "static");
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1290
|
+
isStale() {
|
|
1291
|
+
if (this.getObserversCount() > 0) return this.observers.some((observer) => observer.getCurrentResult().isStale);
|
|
1292
|
+
return this.state.data === void 0 || this.state.isInvalidated;
|
|
1293
|
+
}
|
|
1294
|
+
isStaleByTime(staleTime = 0) {
|
|
1295
|
+
if (this.state.data === void 0) return true;
|
|
1296
|
+
if (staleTime === "static") return false;
|
|
1297
|
+
if (this.state.isInvalidated) return true;
|
|
1298
|
+
return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
1299
|
+
}
|
|
1300
|
+
onFocus() {
|
|
1301
|
+
this.observers.find((x) => x.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: false });
|
|
1302
|
+
this.#retryer?.continue();
|
|
1303
|
+
}
|
|
1304
|
+
onOnline() {
|
|
1305
|
+
this.observers.find((x) => x.shouldFetchOnReconnect())?.refetch({ cancelRefetch: false });
|
|
1306
|
+
this.#retryer?.continue();
|
|
1307
|
+
}
|
|
1308
|
+
addObserver(observer) {
|
|
1309
|
+
if (!this.observers.includes(observer)) {
|
|
1310
|
+
this.observers.push(observer);
|
|
1311
|
+
this.clearGcTimeout();
|
|
1312
|
+
this.#cache.notify({
|
|
1313
|
+
type: "observerAdded",
|
|
1314
|
+
query: this,
|
|
1315
|
+
observer
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
removeObserver(observer) {
|
|
1320
|
+
if (this.observers.includes(observer)) {
|
|
1321
|
+
this.observers = this.observers.filter((x) => x !== observer);
|
|
1322
|
+
if (!this.observers.length) {
|
|
1323
|
+
if (this.#retryer) {
|
|
1324
|
+
if (this.#abortSignalConsumed) this.#retryer.cancel({ revert: true });
|
|
1325
|
+
else this.#retryer.cancelRetry();
|
|
1326
|
+
}
|
|
1327
|
+
this.scheduleGc();
|
|
1328
|
+
}
|
|
1329
|
+
this.#cache.notify({
|
|
1330
|
+
type: "observerRemoved",
|
|
1331
|
+
query: this,
|
|
1332
|
+
observer
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
getObserversCount() {
|
|
1337
|
+
return this.observers.length;
|
|
1338
|
+
}
|
|
1339
|
+
invalidate() {
|
|
1340
|
+
if (!this.state.isInvalidated) this.#dispatch({ type: "invalidate" });
|
|
1341
|
+
}
|
|
1342
|
+
async fetch(options, fetchOptions) {
|
|
1343
|
+
if (this.state.fetchStatus !== "idle" && this.#retryer?.status() !== "rejected") {
|
|
1344
|
+
if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) this.cancel({ silent: true });
|
|
1345
|
+
else if (this.#retryer) {
|
|
1346
|
+
this.#retryer.continueRetry();
|
|
1347
|
+
return this.#retryer.promise;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
if (options) this.setOptions(options);
|
|
1351
|
+
if (!this.options.queryFn) {
|
|
1352
|
+
const observer = this.observers.find((x) => x.options.queryFn);
|
|
1353
|
+
if (observer) this.setOptions(observer.options);
|
|
1354
|
+
}
|
|
1355
|
+
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']`);
|
|
1356
|
+
const abortController = new AbortController();
|
|
1357
|
+
const addSignalProperty = (object) => {
|
|
1358
|
+
Object.defineProperty(object, "signal", {
|
|
1359
|
+
enumerable: true,
|
|
1360
|
+
get: () => {
|
|
1361
|
+
this.#abortSignalConsumed = true;
|
|
1362
|
+
return abortController.signal;
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
};
|
|
1366
|
+
const fetchFn = () => {
|
|
1367
|
+
const queryFn = ensureQueryFn(this.options, fetchOptions);
|
|
1368
|
+
const createQueryFnContext = () => {
|
|
1369
|
+
const queryFnContext2 = {
|
|
1370
|
+
client: this.#client,
|
|
1371
|
+
queryKey: this.queryKey,
|
|
1372
|
+
meta: this.meta
|
|
1373
|
+
};
|
|
1374
|
+
addSignalProperty(queryFnContext2);
|
|
1375
|
+
return queryFnContext2;
|
|
1376
|
+
};
|
|
1377
|
+
const queryFnContext = createQueryFnContext();
|
|
1378
|
+
this.#abortSignalConsumed = false;
|
|
1379
|
+
if (this.options.persister) return this.options.persister(queryFn, queryFnContext, this);
|
|
1380
|
+
return queryFn(queryFnContext);
|
|
1381
|
+
};
|
|
1382
|
+
const createFetchContext = () => {
|
|
1383
|
+
const context2 = {
|
|
1384
|
+
fetchOptions,
|
|
1385
|
+
options: this.options,
|
|
1386
|
+
queryKey: this.queryKey,
|
|
1387
|
+
client: this.#client,
|
|
1388
|
+
state: this.state,
|
|
1389
|
+
fetchFn
|
|
1390
|
+
};
|
|
1391
|
+
addSignalProperty(context2);
|
|
1392
|
+
return context2;
|
|
1393
|
+
};
|
|
1394
|
+
const context = createFetchContext();
|
|
1395
|
+
this.options.behavior?.onFetch(context, this);
|
|
1396
|
+
this.#revertState = this.state;
|
|
1397
|
+
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) this.#dispatch({
|
|
1398
|
+
type: "fetch",
|
|
1399
|
+
meta: context.fetchOptions?.meta
|
|
1400
|
+
});
|
|
1401
|
+
this.#retryer = createRetryer({
|
|
1402
|
+
initialPromise: fetchOptions?.initialPromise,
|
|
1403
|
+
fn: context.fetchFn,
|
|
1404
|
+
onCancel: (error) => {
|
|
1405
|
+
if (error instanceof CancelledError && error.revert) this.setState({
|
|
1406
|
+
...this.#revertState,
|
|
1407
|
+
fetchStatus: "idle"
|
|
1408
|
+
});
|
|
1409
|
+
abortController.abort();
|
|
1410
|
+
},
|
|
1411
|
+
onFail: (failureCount, error) => {
|
|
1412
|
+
this.#dispatch({
|
|
1413
|
+
type: "failed",
|
|
1414
|
+
failureCount,
|
|
1415
|
+
error
|
|
1416
|
+
});
|
|
1417
|
+
},
|
|
1418
|
+
onPause: () => {
|
|
1419
|
+
this.#dispatch({ type: "pause" });
|
|
1420
|
+
},
|
|
1421
|
+
onContinue: () => {
|
|
1422
|
+
this.#dispatch({ type: "continue" });
|
|
1423
|
+
},
|
|
1424
|
+
retry: context.options.retry,
|
|
1425
|
+
retryDelay: context.options.retryDelay,
|
|
1426
|
+
networkMode: context.options.networkMode,
|
|
1427
|
+
canRun: () => true
|
|
1428
|
+
});
|
|
1429
|
+
try {
|
|
1430
|
+
const data = await this.#retryer.start();
|
|
1431
|
+
if (data === void 0) {
|
|
1432
|
+
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}`);
|
|
1433
|
+
throw new Error(`${this.queryHash} data is undefined`);
|
|
1434
|
+
}
|
|
1435
|
+
this.setData(data);
|
|
1436
|
+
this.#cache.config.onSuccess?.(data, this);
|
|
1437
|
+
this.#cache.config.onSettled?.(data, this.state.error, this);
|
|
1438
|
+
return data;
|
|
1439
|
+
} catch (error) {
|
|
1440
|
+
if (error instanceof CancelledError) {
|
|
1441
|
+
if (error.silent) return this.#retryer.promise;
|
|
1442
|
+
else if (error.revert) {
|
|
1443
|
+
if (this.state.data === void 0) throw error;
|
|
1444
|
+
return this.state.data;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
this.#dispatch({
|
|
1448
|
+
type: "error",
|
|
1449
|
+
error
|
|
1450
|
+
});
|
|
1451
|
+
this.#cache.config.onError?.(error, this);
|
|
1452
|
+
this.#cache.config.onSettled?.(this.state.data, error, this);
|
|
1453
|
+
throw error;
|
|
1454
|
+
} finally {
|
|
1455
|
+
this.scheduleGc();
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
#dispatch(action) {
|
|
1459
|
+
const reducer = (state) => {
|
|
1460
|
+
switch (action.type) {
|
|
1461
|
+
case "failed": return {
|
|
1462
|
+
...state,
|
|
1463
|
+
fetchFailureCount: action.failureCount,
|
|
1464
|
+
fetchFailureReason: action.error
|
|
1465
|
+
};
|
|
1466
|
+
case "pause": return {
|
|
1467
|
+
...state,
|
|
1468
|
+
fetchStatus: "paused"
|
|
1469
|
+
};
|
|
1470
|
+
case "continue": return {
|
|
1471
|
+
...state,
|
|
1472
|
+
fetchStatus: "fetching"
|
|
1473
|
+
};
|
|
1474
|
+
case "fetch": return {
|
|
1475
|
+
...state,
|
|
1476
|
+
...fetchState(state.data, this.options),
|
|
1477
|
+
fetchMeta: action.meta ?? null
|
|
1478
|
+
};
|
|
1479
|
+
case "success":
|
|
1480
|
+
const newState = {
|
|
1481
|
+
...state,
|
|
1482
|
+
...successState(action.data, action.dataUpdatedAt),
|
|
1483
|
+
dataUpdateCount: state.dataUpdateCount + 1,
|
|
1484
|
+
...!action.manual && {
|
|
1485
|
+
fetchStatus: "idle",
|
|
1486
|
+
fetchFailureCount: 0,
|
|
1487
|
+
fetchFailureReason: null
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
this.#revertState = action.manual ? newState : void 0;
|
|
1491
|
+
return newState;
|
|
1492
|
+
case "error":
|
|
1493
|
+
const error = action.error;
|
|
1494
|
+
return {
|
|
1495
|
+
...state,
|
|
1496
|
+
error,
|
|
1497
|
+
errorUpdateCount: state.errorUpdateCount + 1,
|
|
1498
|
+
errorUpdatedAt: Date.now(),
|
|
1499
|
+
fetchFailureCount: state.fetchFailureCount + 1,
|
|
1500
|
+
fetchFailureReason: error,
|
|
1501
|
+
fetchStatus: "idle",
|
|
1502
|
+
status: "error",
|
|
1503
|
+
isInvalidated: true
|
|
1504
|
+
};
|
|
1505
|
+
case "invalidate": return {
|
|
1506
|
+
...state,
|
|
1507
|
+
isInvalidated: true
|
|
1508
|
+
};
|
|
1509
|
+
case "setState": return {
|
|
1510
|
+
...state,
|
|
1511
|
+
...action.state
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
this.state = reducer(this.state);
|
|
1516
|
+
notifyManager.batch(() => {
|
|
1517
|
+
this.observers.forEach((observer) => {
|
|
1518
|
+
observer.onQueryUpdate();
|
|
1519
|
+
});
|
|
1520
|
+
this.#cache.notify({
|
|
1521
|
+
query: this,
|
|
1522
|
+
type: "updated",
|
|
1523
|
+
action
|
|
1524
|
+
});
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
function fetchState(data, options) {
|
|
1529
|
+
return {
|
|
1530
|
+
fetchFailureCount: 0,
|
|
1531
|
+
fetchFailureReason: null,
|
|
1532
|
+
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
1533
|
+
...data === void 0 && {
|
|
1534
|
+
error: null,
|
|
1535
|
+
status: "pending"
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
function successState(data, dataUpdatedAt) {
|
|
1540
|
+
return {
|
|
1541
|
+
data,
|
|
1542
|
+
dataUpdatedAt: dataUpdatedAt ?? Date.now(),
|
|
1543
|
+
error: null,
|
|
1544
|
+
isInvalidated: false,
|
|
1545
|
+
status: "success"
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
function getDefaultState$1(options) {
|
|
1549
|
+
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
1550
|
+
const hasData = data !== void 0;
|
|
1551
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
1552
|
+
return {
|
|
1553
|
+
data,
|
|
1554
|
+
dataUpdateCount: 0,
|
|
1555
|
+
dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
|
|
1556
|
+
error: null,
|
|
1557
|
+
errorUpdateCount: 0,
|
|
1558
|
+
errorUpdatedAt: 0,
|
|
1559
|
+
fetchFailureCount: 0,
|
|
1560
|
+
fetchFailureReason: null,
|
|
1561
|
+
fetchMeta: null,
|
|
1562
|
+
isInvalidated: false,
|
|
1563
|
+
status: hasData ? "success" : "pending",
|
|
1564
|
+
fetchStatus: "idle"
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
//#endregion
|
|
1568
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
|
|
1569
|
+
function infiniteQueryBehavior(pages) {
|
|
1570
|
+
return { onFetch: (context, query) => {
|
|
1571
|
+
const options = context.options;
|
|
1572
|
+
const direction = context.fetchOptions?.meta?.fetchMore?.direction;
|
|
1573
|
+
const oldPages = context.state.data?.pages || [];
|
|
1574
|
+
const oldPageParams = context.state.data?.pageParams || [];
|
|
1575
|
+
let result = {
|
|
1576
|
+
pages: [],
|
|
1577
|
+
pageParams: []
|
|
1578
|
+
};
|
|
1579
|
+
let currentPage = 0;
|
|
1580
|
+
const fetchFn = async () => {
|
|
1581
|
+
let cancelled = false;
|
|
1582
|
+
const addSignalProperty = (object) => {
|
|
1583
|
+
addConsumeAwareSignal(object, () => context.signal, () => cancelled = true);
|
|
1584
|
+
};
|
|
1585
|
+
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
1586
|
+
const fetchPage = async (data, param, previous) => {
|
|
1587
|
+
if (cancelled) return Promise.reject();
|
|
1588
|
+
if (param == null && data.pages.length) return Promise.resolve(data);
|
|
1589
|
+
const createQueryFnContext = () => {
|
|
1590
|
+
const queryFnContext2 = {
|
|
1591
|
+
client: context.client,
|
|
1592
|
+
queryKey: context.queryKey,
|
|
1593
|
+
pageParam: param,
|
|
1594
|
+
direction: previous ? "backward" : "forward",
|
|
1595
|
+
meta: context.options.meta
|
|
1596
|
+
};
|
|
1597
|
+
addSignalProperty(queryFnContext2);
|
|
1598
|
+
return queryFnContext2;
|
|
1599
|
+
};
|
|
1600
|
+
const queryFnContext = createQueryFnContext();
|
|
1601
|
+
const page = await queryFn(queryFnContext);
|
|
1602
|
+
const { maxPages } = context.options;
|
|
1603
|
+
const addTo = previous ? addToStart : addToEnd;
|
|
1604
|
+
return {
|
|
1605
|
+
pages: addTo(data.pages, page, maxPages),
|
|
1606
|
+
pageParams: addTo(data.pageParams, param, maxPages)
|
|
1607
|
+
};
|
|
1608
|
+
};
|
|
1609
|
+
if (direction && oldPages.length) {
|
|
1610
|
+
const previous = direction === "backward";
|
|
1611
|
+
const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
|
|
1612
|
+
const oldData = {
|
|
1613
|
+
pages: oldPages,
|
|
1614
|
+
pageParams: oldPageParams
|
|
1615
|
+
};
|
|
1616
|
+
result = await fetchPage(oldData, pageParamFn(options, oldData), previous);
|
|
1617
|
+
} else {
|
|
1618
|
+
const remainingPages = pages ?? oldPages.length;
|
|
1619
|
+
do {
|
|
1620
|
+
const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
|
|
1621
|
+
if (currentPage > 0 && param == null) break;
|
|
1622
|
+
result = await fetchPage(result, param);
|
|
1623
|
+
currentPage++;
|
|
1624
|
+
} while (currentPage < remainingPages);
|
|
1625
|
+
}
|
|
1626
|
+
return result;
|
|
1627
|
+
};
|
|
1628
|
+
if (context.options.persister) context.fetchFn = () => {
|
|
1629
|
+
return context.options.persister?.(fetchFn, {
|
|
1630
|
+
client: context.client,
|
|
1631
|
+
queryKey: context.queryKey,
|
|
1632
|
+
meta: context.options.meta,
|
|
1633
|
+
signal: context.signal
|
|
1634
|
+
}, query);
|
|
1635
|
+
};
|
|
1636
|
+
else context.fetchFn = fetchFn;
|
|
1637
|
+
} };
|
|
1638
|
+
}
|
|
1639
|
+
function getNextPageParam(options, { pages, pageParams }) {
|
|
1640
|
+
const lastIndex = pages.length - 1;
|
|
1641
|
+
return pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0;
|
|
1642
|
+
}
|
|
1643
|
+
function getPreviousPageParam(options, { pages, pageParams }) {
|
|
1644
|
+
return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
|
|
1645
|
+
}
|
|
1646
|
+
function hasNextPage(options, data) {
|
|
1647
|
+
if (!data) return false;
|
|
1648
|
+
return getNextPageParam(options, data) != null;
|
|
1649
|
+
}
|
|
1650
|
+
function hasPreviousPage(options, data) {
|
|
1651
|
+
if (!data || !options.getPreviousPageParam) return false;
|
|
1652
|
+
return getPreviousPageParam(options, data) != null;
|
|
1653
|
+
}
|
|
1654
|
+
//#endregion
|
|
1655
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
1656
|
+
var Mutation = class extends Removable {
|
|
1657
|
+
#client;
|
|
1658
|
+
#observers;
|
|
1659
|
+
#mutationCache;
|
|
1660
|
+
#retryer;
|
|
1661
|
+
constructor(config) {
|
|
1662
|
+
super();
|
|
1663
|
+
this.#client = config.client;
|
|
1664
|
+
this.mutationId = config.mutationId;
|
|
1665
|
+
this.#mutationCache = config.mutationCache;
|
|
1666
|
+
this.#observers = [];
|
|
1667
|
+
this.state = config.state || getDefaultState();
|
|
1668
|
+
this.setOptions(config.options);
|
|
1669
|
+
this.scheduleGc();
|
|
1670
|
+
}
|
|
1671
|
+
setOptions(options) {
|
|
1672
|
+
this.options = options;
|
|
1673
|
+
this.updateGcTime(this.options.gcTime);
|
|
1674
|
+
}
|
|
1675
|
+
get meta() {
|
|
1676
|
+
return this.options.meta;
|
|
1677
|
+
}
|
|
1678
|
+
addObserver(observer) {
|
|
1679
|
+
if (!this.#observers.includes(observer)) {
|
|
1680
|
+
this.#observers.push(observer);
|
|
1681
|
+
this.clearGcTimeout();
|
|
1682
|
+
this.#mutationCache.notify({
|
|
1683
|
+
type: "observerAdded",
|
|
1684
|
+
mutation: this,
|
|
1685
|
+
observer
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
removeObserver(observer) {
|
|
1690
|
+
this.#observers = this.#observers.filter((x) => x !== observer);
|
|
1691
|
+
this.scheduleGc();
|
|
1692
|
+
this.#mutationCache.notify({
|
|
1693
|
+
type: "observerRemoved",
|
|
1694
|
+
mutation: this,
|
|
1695
|
+
observer
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
optionalRemove() {
|
|
1699
|
+
if (!this.#observers.length) {
|
|
1700
|
+
if (this.state.status === "pending") this.scheduleGc();
|
|
1701
|
+
else this.#mutationCache.remove(this);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
continue() {
|
|
1705
|
+
return this.#retryer?.continue() ?? this.execute(this.state.variables);
|
|
1706
|
+
}
|
|
1707
|
+
async execute(variables) {
|
|
1708
|
+
const onContinue = () => {
|
|
1709
|
+
this.#dispatch({ type: "continue" });
|
|
1710
|
+
};
|
|
1711
|
+
const mutationFnContext = {
|
|
1712
|
+
client: this.#client,
|
|
1713
|
+
meta: this.options.meta,
|
|
1714
|
+
mutationKey: this.options.mutationKey
|
|
1715
|
+
};
|
|
1716
|
+
this.#retryer = createRetryer({
|
|
1717
|
+
fn: () => {
|
|
1718
|
+
if (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error("No mutationFn found"));
|
|
1719
|
+
return this.options.mutationFn(variables, mutationFnContext);
|
|
1720
|
+
},
|
|
1721
|
+
onFail: (failureCount, error) => {
|
|
1722
|
+
this.#dispatch({
|
|
1723
|
+
type: "failed",
|
|
1724
|
+
failureCount,
|
|
1725
|
+
error
|
|
1726
|
+
});
|
|
1727
|
+
},
|
|
1728
|
+
onPause: () => {
|
|
1729
|
+
this.#dispatch({ type: "pause" });
|
|
1730
|
+
},
|
|
1731
|
+
onContinue,
|
|
1732
|
+
retry: this.options.retry ?? 0,
|
|
1733
|
+
retryDelay: this.options.retryDelay,
|
|
1734
|
+
networkMode: this.options.networkMode,
|
|
1735
|
+
canRun: () => this.#mutationCache.canRun(this)
|
|
1736
|
+
});
|
|
1737
|
+
const restored = this.state.status === "pending";
|
|
1738
|
+
const isPaused = !this.#retryer.canStart();
|
|
1739
|
+
try {
|
|
1740
|
+
if (restored) onContinue();
|
|
1741
|
+
else {
|
|
1742
|
+
this.#dispatch({
|
|
1743
|
+
type: "pending",
|
|
1744
|
+
variables,
|
|
1745
|
+
isPaused
|
|
1746
|
+
});
|
|
1747
|
+
if (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
|
|
1748
|
+
const context = await this.options.onMutate?.(variables, mutationFnContext);
|
|
1749
|
+
if (context !== this.state.context) this.#dispatch({
|
|
1750
|
+
type: "pending",
|
|
1751
|
+
context,
|
|
1752
|
+
variables,
|
|
1753
|
+
isPaused
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
const data = await this.#retryer.start();
|
|
1757
|
+
await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);
|
|
1758
|
+
await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);
|
|
1759
|
+
await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);
|
|
1760
|
+
await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);
|
|
1761
|
+
this.#dispatch({
|
|
1762
|
+
type: "success",
|
|
1763
|
+
data
|
|
1764
|
+
});
|
|
1765
|
+
return data;
|
|
1766
|
+
} catch (error) {
|
|
1767
|
+
try {
|
|
1768
|
+
await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
|
|
1769
|
+
} catch (e) {
|
|
1770
|
+
Promise.reject(e);
|
|
1771
|
+
}
|
|
1772
|
+
try {
|
|
1773
|
+
await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
|
|
1774
|
+
} catch (e) {
|
|
1775
|
+
Promise.reject(e);
|
|
1776
|
+
}
|
|
1777
|
+
try {
|
|
1778
|
+
await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);
|
|
1779
|
+
} catch (e) {
|
|
1780
|
+
Promise.reject(e);
|
|
1781
|
+
}
|
|
1782
|
+
try {
|
|
1783
|
+
await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);
|
|
1784
|
+
} catch (e) {
|
|
1785
|
+
Promise.reject(e);
|
|
1786
|
+
}
|
|
1787
|
+
this.#dispatch({
|
|
1788
|
+
type: "error",
|
|
1789
|
+
error
|
|
1790
|
+
});
|
|
1791
|
+
throw error;
|
|
1792
|
+
} finally {
|
|
1793
|
+
this.#mutationCache.runNext(this);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
#dispatch(action) {
|
|
1797
|
+
const reducer = (state) => {
|
|
1798
|
+
switch (action.type) {
|
|
1799
|
+
case "failed": return {
|
|
1800
|
+
...state,
|
|
1801
|
+
failureCount: action.failureCount,
|
|
1802
|
+
failureReason: action.error
|
|
1803
|
+
};
|
|
1804
|
+
case "pause": return {
|
|
1805
|
+
...state,
|
|
1806
|
+
isPaused: true
|
|
1807
|
+
};
|
|
1808
|
+
case "continue": return {
|
|
1809
|
+
...state,
|
|
1810
|
+
isPaused: false
|
|
1811
|
+
};
|
|
1812
|
+
case "pending": return {
|
|
1813
|
+
...state,
|
|
1814
|
+
context: action.context,
|
|
1815
|
+
data: void 0,
|
|
1816
|
+
failureCount: 0,
|
|
1817
|
+
failureReason: null,
|
|
1818
|
+
error: null,
|
|
1819
|
+
isPaused: action.isPaused,
|
|
1820
|
+
status: "pending",
|
|
1821
|
+
variables: action.variables,
|
|
1822
|
+
submittedAt: Date.now()
|
|
1823
|
+
};
|
|
1824
|
+
case "success": return {
|
|
1825
|
+
...state,
|
|
1826
|
+
data: action.data,
|
|
1827
|
+
failureCount: 0,
|
|
1828
|
+
failureReason: null,
|
|
1829
|
+
error: null,
|
|
1830
|
+
status: "success",
|
|
1831
|
+
isPaused: false
|
|
1832
|
+
};
|
|
1833
|
+
case "error": return {
|
|
1834
|
+
...state,
|
|
1835
|
+
data: void 0,
|
|
1836
|
+
error: action.error,
|
|
1837
|
+
failureCount: state.failureCount + 1,
|
|
1838
|
+
failureReason: action.error,
|
|
1839
|
+
isPaused: false,
|
|
1840
|
+
status: "error"
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
this.state = reducer(this.state);
|
|
1845
|
+
notifyManager.batch(() => {
|
|
1846
|
+
this.#observers.forEach((observer) => {
|
|
1847
|
+
observer.onMutationUpdate(action);
|
|
1848
|
+
});
|
|
1849
|
+
this.#mutationCache.notify({
|
|
1850
|
+
mutation: this,
|
|
1851
|
+
type: "updated",
|
|
1852
|
+
action
|
|
1853
|
+
});
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
function getDefaultState() {
|
|
1858
|
+
return {
|
|
1859
|
+
context: void 0,
|
|
1860
|
+
data: void 0,
|
|
1861
|
+
error: null,
|
|
1862
|
+
failureCount: 0,
|
|
1863
|
+
failureReason: null,
|
|
1864
|
+
isPaused: false,
|
|
1865
|
+
status: "idle",
|
|
1866
|
+
variables: void 0,
|
|
1867
|
+
submittedAt: 0
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
//#endregion
|
|
1871
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutationCache.js
|
|
1872
|
+
var MutationCache = class extends Subscribable {
|
|
1873
|
+
constructor(config = {}) {
|
|
1874
|
+
super();
|
|
1875
|
+
this.config = config;
|
|
1876
|
+
this.#mutations = /* @__PURE__ */ new Set();
|
|
1877
|
+
this.#scopes = /* @__PURE__ */ new Map();
|
|
1878
|
+
this.#mutationId = 0;
|
|
1879
|
+
}
|
|
1880
|
+
#mutations;
|
|
1881
|
+
#scopes;
|
|
1882
|
+
#mutationId;
|
|
1883
|
+
build(client, options, state) {
|
|
1884
|
+
const mutation = new Mutation({
|
|
1885
|
+
client,
|
|
1886
|
+
mutationCache: this,
|
|
1887
|
+
mutationId: ++this.#mutationId,
|
|
1888
|
+
options: client.defaultMutationOptions(options),
|
|
1889
|
+
state
|
|
1890
|
+
});
|
|
1891
|
+
this.add(mutation);
|
|
1892
|
+
return mutation;
|
|
1893
|
+
}
|
|
1894
|
+
add(mutation) {
|
|
1895
|
+
this.#mutations.add(mutation);
|
|
1896
|
+
const scope = scopeFor(mutation);
|
|
1897
|
+
if (typeof scope === "string") {
|
|
1898
|
+
const scopedMutations = this.#scopes.get(scope);
|
|
1899
|
+
if (scopedMutations) scopedMutations.push(mutation);
|
|
1900
|
+
else this.#scopes.set(scope, [mutation]);
|
|
1901
|
+
}
|
|
1902
|
+
this.notify({
|
|
1903
|
+
type: "added",
|
|
1904
|
+
mutation
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
remove(mutation) {
|
|
1908
|
+
if (this.#mutations.delete(mutation)) {
|
|
1909
|
+
const scope = scopeFor(mutation);
|
|
1910
|
+
if (typeof scope === "string") {
|
|
1911
|
+
const scopedMutations = this.#scopes.get(scope);
|
|
1912
|
+
if (scopedMutations) {
|
|
1913
|
+
if (scopedMutations.length > 1) {
|
|
1914
|
+
const index = scopedMutations.indexOf(mutation);
|
|
1915
|
+
if (index !== -1) scopedMutations.splice(index, 1);
|
|
1916
|
+
} else if (scopedMutations[0] === mutation) this.#scopes.delete(scope);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
this.notify({
|
|
1921
|
+
type: "removed",
|
|
1922
|
+
mutation
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
canRun(mutation) {
|
|
1926
|
+
const scope = scopeFor(mutation);
|
|
1927
|
+
if (typeof scope === "string") {
|
|
1928
|
+
const firstPendingMutation = this.#scopes.get(scope)?.find((m) => m.state.status === "pending");
|
|
1929
|
+
return !firstPendingMutation || firstPendingMutation === mutation;
|
|
1930
|
+
} else return true;
|
|
1931
|
+
}
|
|
1932
|
+
runNext(mutation) {
|
|
1933
|
+
const scope = scopeFor(mutation);
|
|
1934
|
+
if (typeof scope === "string") return (this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused))?.continue() ?? Promise.resolve();
|
|
1935
|
+
else return Promise.resolve();
|
|
1936
|
+
}
|
|
1937
|
+
clear() {
|
|
1938
|
+
notifyManager.batch(() => {
|
|
1939
|
+
this.#mutations.forEach((mutation) => {
|
|
1940
|
+
this.notify({
|
|
1941
|
+
type: "removed",
|
|
1942
|
+
mutation
|
|
1943
|
+
});
|
|
1944
|
+
});
|
|
1945
|
+
this.#mutations.clear();
|
|
1946
|
+
this.#scopes.clear();
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
getAll() {
|
|
1950
|
+
return Array.from(this.#mutations);
|
|
1951
|
+
}
|
|
1952
|
+
find(filters) {
|
|
1953
|
+
const defaultedFilters = {
|
|
1954
|
+
exact: true,
|
|
1955
|
+
...filters
|
|
1956
|
+
};
|
|
1957
|
+
return this.getAll().find((mutation) => matchMutation(defaultedFilters, mutation));
|
|
1958
|
+
}
|
|
1959
|
+
findAll(filters = {}) {
|
|
1960
|
+
return this.getAll().filter((mutation) => matchMutation(filters, mutation));
|
|
1961
|
+
}
|
|
1962
|
+
notify(event) {
|
|
1963
|
+
notifyManager.batch(() => {
|
|
1964
|
+
this.listeners.forEach((listener) => {
|
|
1965
|
+
listener(event);
|
|
1966
|
+
});
|
|
1967
|
+
});
|
|
1968
|
+
}
|
|
1969
|
+
resumePausedMutations() {
|
|
1970
|
+
const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
|
|
1971
|
+
return notifyManager.batch(() => Promise.all(pausedMutations.map((mutation) => mutation.continue().catch(noop))));
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
function scopeFor(mutation) {
|
|
1975
|
+
return mutation.options.scope?.id;
|
|
1976
|
+
}
|
|
1977
|
+
//#endregion
|
|
1978
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryCache.js
|
|
1979
|
+
var QueryCache = class extends Subscribable {
|
|
1980
|
+
constructor(config = {}) {
|
|
1981
|
+
super();
|
|
1982
|
+
this.config = config;
|
|
1983
|
+
this.#queries = /* @__PURE__ */ new Map();
|
|
1984
|
+
}
|
|
1985
|
+
#queries;
|
|
1986
|
+
build(client, options, state) {
|
|
1987
|
+
const queryKey = options.queryKey;
|
|
1988
|
+
const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
|
|
1989
|
+
let query = this.get(queryHash);
|
|
1990
|
+
if (!query) {
|
|
1991
|
+
query = new Query({
|
|
1992
|
+
client,
|
|
1993
|
+
queryKey,
|
|
1994
|
+
queryHash,
|
|
1995
|
+
options: client.defaultQueryOptions(options),
|
|
1996
|
+
state,
|
|
1997
|
+
defaultOptions: client.getQueryDefaults(queryKey)
|
|
1998
|
+
});
|
|
1999
|
+
this.add(query);
|
|
2000
|
+
}
|
|
2001
|
+
return query;
|
|
2002
|
+
}
|
|
2003
|
+
add(query) {
|
|
2004
|
+
if (!this.#queries.has(query.queryHash)) {
|
|
2005
|
+
this.#queries.set(query.queryHash, query);
|
|
2006
|
+
this.notify({
|
|
2007
|
+
type: "added",
|
|
2008
|
+
query
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
remove(query) {
|
|
2013
|
+
const queryInMap = this.#queries.get(query.queryHash);
|
|
2014
|
+
if (queryInMap) {
|
|
2015
|
+
query.destroy();
|
|
2016
|
+
if (queryInMap === query) this.#queries.delete(query.queryHash);
|
|
2017
|
+
this.notify({
|
|
2018
|
+
type: "removed",
|
|
2019
|
+
query
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
clear() {
|
|
2024
|
+
notifyManager.batch(() => {
|
|
2025
|
+
this.getAll().forEach((query) => {
|
|
2026
|
+
this.remove(query);
|
|
2027
|
+
});
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
get(queryHash) {
|
|
2031
|
+
return this.#queries.get(queryHash);
|
|
2032
|
+
}
|
|
2033
|
+
getAll() {
|
|
2034
|
+
return [...this.#queries.values()];
|
|
2035
|
+
}
|
|
2036
|
+
find(filters) {
|
|
2037
|
+
const defaultedFilters = {
|
|
2038
|
+
exact: true,
|
|
2039
|
+
...filters
|
|
2040
|
+
};
|
|
2041
|
+
return this.getAll().find((query) => matchQuery(defaultedFilters, query));
|
|
2042
|
+
}
|
|
2043
|
+
findAll(filters = {}) {
|
|
2044
|
+
const queries = this.getAll();
|
|
2045
|
+
return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
|
|
2046
|
+
}
|
|
2047
|
+
notify(event) {
|
|
2048
|
+
notifyManager.batch(() => {
|
|
2049
|
+
this.listeners.forEach((listener) => {
|
|
2050
|
+
listener(event);
|
|
2051
|
+
});
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
onFocus() {
|
|
2055
|
+
notifyManager.batch(() => {
|
|
2056
|
+
this.getAll().forEach((query) => {
|
|
2057
|
+
query.onFocus();
|
|
2058
|
+
});
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
onOnline() {
|
|
2062
|
+
notifyManager.batch(() => {
|
|
2063
|
+
this.getAll().forEach((query) => {
|
|
2064
|
+
query.onOnline();
|
|
2065
|
+
});
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
//#endregion
|
|
2070
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
2071
|
+
var QueryClient = class {
|
|
2072
|
+
#queryCache;
|
|
2073
|
+
#mutationCache;
|
|
2074
|
+
#defaultOptions;
|
|
2075
|
+
#queryDefaults;
|
|
2076
|
+
#mutationDefaults;
|
|
2077
|
+
#mountCount;
|
|
2078
|
+
#unsubscribeFocus;
|
|
2079
|
+
#unsubscribeOnline;
|
|
2080
|
+
constructor(config = {}) {
|
|
2081
|
+
this.#queryCache = config.queryCache || new QueryCache();
|
|
2082
|
+
this.#mutationCache = config.mutationCache || new MutationCache();
|
|
2083
|
+
this.#defaultOptions = config.defaultOptions || {};
|
|
2084
|
+
this.#queryDefaults = /* @__PURE__ */ new Map();
|
|
2085
|
+
this.#mutationDefaults = /* @__PURE__ */ new Map();
|
|
2086
|
+
this.#mountCount = 0;
|
|
2087
|
+
}
|
|
2088
|
+
mount() {
|
|
2089
|
+
this.#mountCount++;
|
|
2090
|
+
if (this.#mountCount !== 1) return;
|
|
2091
|
+
this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
|
|
2092
|
+
if (focused) {
|
|
2093
|
+
await this.resumePausedMutations();
|
|
2094
|
+
this.#queryCache.onFocus();
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
|
|
2098
|
+
if (online) {
|
|
2099
|
+
await this.resumePausedMutations();
|
|
2100
|
+
this.#queryCache.onOnline();
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
unmount() {
|
|
2105
|
+
this.#mountCount--;
|
|
2106
|
+
if (this.#mountCount !== 0) return;
|
|
2107
|
+
this.#unsubscribeFocus?.();
|
|
2108
|
+
this.#unsubscribeFocus = void 0;
|
|
2109
|
+
this.#unsubscribeOnline?.();
|
|
2110
|
+
this.#unsubscribeOnline = void 0;
|
|
2111
|
+
}
|
|
2112
|
+
isFetching(filters) {
|
|
2113
|
+
return this.#queryCache.findAll({
|
|
2114
|
+
...filters,
|
|
2115
|
+
fetchStatus: "fetching"
|
|
2116
|
+
}).length;
|
|
2117
|
+
}
|
|
2118
|
+
isMutating(filters) {
|
|
2119
|
+
return this.#mutationCache.findAll({
|
|
2120
|
+
...filters,
|
|
2121
|
+
status: "pending"
|
|
2122
|
+
}).length;
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
2126
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
2127
|
+
*
|
|
2128
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
2129
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
2130
|
+
*/
|
|
2131
|
+
getQueryData(queryKey) {
|
|
2132
|
+
const options = this.defaultQueryOptions({ queryKey });
|
|
2133
|
+
return this.#queryCache.get(options.queryHash)?.state.data;
|
|
2134
|
+
}
|
|
2135
|
+
ensureQueryData(options) {
|
|
2136
|
+
const defaultedOptions = this.defaultQueryOptions(options);
|
|
2137
|
+
const query = this.#queryCache.build(this, defaultedOptions);
|
|
2138
|
+
const cachedData = query.state.data;
|
|
2139
|
+
if (cachedData === void 0) return this.fetchQuery(options);
|
|
2140
|
+
if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions);
|
|
2141
|
+
return Promise.resolve(cachedData);
|
|
2142
|
+
}
|
|
2143
|
+
getQueriesData(filters) {
|
|
2144
|
+
return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
|
|
2145
|
+
return [queryKey, state.data];
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
setQueryData(queryKey, updater, options) {
|
|
2149
|
+
const defaultedOptions = this.defaultQueryOptions({ queryKey });
|
|
2150
|
+
const prevData = this.#queryCache.get(defaultedOptions.queryHash)?.state.data;
|
|
2151
|
+
const data = functionalUpdate(updater, prevData);
|
|
2152
|
+
if (data === void 0) return;
|
|
2153
|
+
return this.#queryCache.build(this, defaultedOptions).setData(data, {
|
|
2154
|
+
...options,
|
|
2155
|
+
manual: true
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
setQueriesData(filters, updater, options) {
|
|
2159
|
+
return notifyManager.batch(() => this.#queryCache.findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));
|
|
2160
|
+
}
|
|
2161
|
+
getQueryState(queryKey) {
|
|
2162
|
+
const options = this.defaultQueryOptions({ queryKey });
|
|
2163
|
+
return this.#queryCache.get(options.queryHash)?.state;
|
|
2164
|
+
}
|
|
2165
|
+
removeQueries(filters) {
|
|
2166
|
+
const queryCache = this.#queryCache;
|
|
2167
|
+
notifyManager.batch(() => {
|
|
2168
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
2169
|
+
queryCache.remove(query);
|
|
2170
|
+
});
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
resetQueries(filters, options) {
|
|
2174
|
+
const queryCache = this.#queryCache;
|
|
2175
|
+
return notifyManager.batch(() => {
|
|
2176
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
2177
|
+
query.reset();
|
|
2178
|
+
});
|
|
2179
|
+
return this.refetchQueries({
|
|
2180
|
+
type: "active",
|
|
2181
|
+
...filters
|
|
2182
|
+
}, options);
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
cancelQueries(filters, cancelOptions = {}) {
|
|
2186
|
+
const defaultedCancelOptions = {
|
|
2187
|
+
revert: true,
|
|
2188
|
+
...cancelOptions
|
|
2189
|
+
};
|
|
2190
|
+
const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions)));
|
|
2191
|
+
return Promise.all(promises).then(noop).catch(noop);
|
|
2192
|
+
}
|
|
2193
|
+
invalidateQueries(filters, options = {}) {
|
|
2194
|
+
return notifyManager.batch(() => {
|
|
2195
|
+
this.#queryCache.findAll(filters).forEach((query) => {
|
|
2196
|
+
query.invalidate();
|
|
2197
|
+
});
|
|
2198
|
+
if (filters?.refetchType === "none") return Promise.resolve();
|
|
2199
|
+
return this.refetchQueries({
|
|
2200
|
+
...filters,
|
|
2201
|
+
type: filters?.refetchType ?? filters?.type ?? "active"
|
|
2202
|
+
}, options);
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
refetchQueries(filters, options = {}) {
|
|
2206
|
+
const fetchOptions = {
|
|
2207
|
+
...options,
|
|
2208
|
+
cancelRefetch: options.cancelRefetch ?? true
|
|
2209
|
+
};
|
|
2210
|
+
const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
|
|
2211
|
+
let promise = query.fetch(void 0, fetchOptions);
|
|
2212
|
+
if (!fetchOptions.throwOnError) promise = promise.catch(noop);
|
|
2213
|
+
return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
|
|
2214
|
+
}));
|
|
2215
|
+
return Promise.all(promises).then(noop);
|
|
2216
|
+
}
|
|
2217
|
+
fetchQuery(options) {
|
|
2218
|
+
const defaultedOptions = this.defaultQueryOptions(options);
|
|
2219
|
+
if (defaultedOptions.retry === void 0) defaultedOptions.retry = false;
|
|
2220
|
+
const query = this.#queryCache.build(this, defaultedOptions);
|
|
2221
|
+
return query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
2222
|
+
}
|
|
2223
|
+
prefetchQuery(options) {
|
|
2224
|
+
return this.fetchQuery(options).then(noop).catch(noop);
|
|
2225
|
+
}
|
|
2226
|
+
fetchInfiniteQuery(options) {
|
|
2227
|
+
options.behavior = infiniteQueryBehavior(options.pages);
|
|
2228
|
+
return this.fetchQuery(options);
|
|
2229
|
+
}
|
|
2230
|
+
prefetchInfiniteQuery(options) {
|
|
2231
|
+
return this.fetchInfiniteQuery(options).then(noop).catch(noop);
|
|
2232
|
+
}
|
|
2233
|
+
ensureInfiniteQueryData(options) {
|
|
2234
|
+
options.behavior = infiniteQueryBehavior(options.pages);
|
|
2235
|
+
return this.ensureQueryData(options);
|
|
2236
|
+
}
|
|
2237
|
+
resumePausedMutations() {
|
|
2238
|
+
if (onlineManager.isOnline()) return this.#mutationCache.resumePausedMutations();
|
|
2239
|
+
return Promise.resolve();
|
|
2240
|
+
}
|
|
2241
|
+
getQueryCache() {
|
|
2242
|
+
return this.#queryCache;
|
|
2243
|
+
}
|
|
2244
|
+
getMutationCache() {
|
|
2245
|
+
return this.#mutationCache;
|
|
2246
|
+
}
|
|
2247
|
+
getDefaultOptions() {
|
|
2248
|
+
return this.#defaultOptions;
|
|
2249
|
+
}
|
|
2250
|
+
setDefaultOptions(options) {
|
|
2251
|
+
this.#defaultOptions = options;
|
|
2252
|
+
}
|
|
2253
|
+
setQueryDefaults(queryKey, options) {
|
|
2254
|
+
this.#queryDefaults.set(hashKey(queryKey), {
|
|
2255
|
+
queryKey,
|
|
2256
|
+
defaultOptions: options
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
getQueryDefaults(queryKey) {
|
|
2260
|
+
const defaults = [...this.#queryDefaults.values()];
|
|
2261
|
+
const result = {};
|
|
2262
|
+
defaults.forEach((queryDefault) => {
|
|
2263
|
+
if (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions);
|
|
2264
|
+
});
|
|
2265
|
+
return result;
|
|
2266
|
+
}
|
|
2267
|
+
setMutationDefaults(mutationKey, options) {
|
|
2268
|
+
this.#mutationDefaults.set(hashKey(mutationKey), {
|
|
2269
|
+
mutationKey,
|
|
2270
|
+
defaultOptions: options
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
getMutationDefaults(mutationKey) {
|
|
2274
|
+
const defaults = [...this.#mutationDefaults.values()];
|
|
2275
|
+
const result = {};
|
|
2276
|
+
defaults.forEach((queryDefault) => {
|
|
2277
|
+
if (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions);
|
|
2278
|
+
});
|
|
2279
|
+
return result;
|
|
2280
|
+
}
|
|
2281
|
+
defaultQueryOptions(options) {
|
|
2282
|
+
if (options._defaulted) return options;
|
|
2283
|
+
const defaultedOptions = {
|
|
2284
|
+
...this.#defaultOptions.queries,
|
|
2285
|
+
...this.getQueryDefaults(options.queryKey),
|
|
2286
|
+
...options,
|
|
2287
|
+
_defaulted: true
|
|
2288
|
+
};
|
|
2289
|
+
if (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);
|
|
2290
|
+
if (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
|
|
2291
|
+
if (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense;
|
|
2292
|
+
if (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = "offlineFirst";
|
|
2293
|
+
if (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false;
|
|
2294
|
+
return defaultedOptions;
|
|
2295
|
+
}
|
|
2296
|
+
defaultMutationOptions(options) {
|
|
2297
|
+
if (options?._defaulted) return options;
|
|
2298
|
+
return {
|
|
2299
|
+
...this.#defaultOptions.mutations,
|
|
2300
|
+
...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
|
|
2301
|
+
...options,
|
|
2302
|
+
_defaulted: true
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
clear() {
|
|
2306
|
+
this.#queryCache.clear();
|
|
2307
|
+
this.#mutationCache.clear();
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
//#endregion
|
|
2311
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/queryOptions.js
|
|
2312
|
+
function queryOptions(options) {
|
|
2313
|
+
return options;
|
|
2314
|
+
}
|
|
2315
|
+
//#endregion
|
|
2316
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js
|
|
2317
|
+
function infiniteQueryOptions(options) {
|
|
2318
|
+
return options;
|
|
2319
|
+
}
|
|
2320
|
+
//#endregion
|
|
2321
|
+
//#region editors/workflow-editor/run-kinds.ts
|
|
2322
|
+
const TEST_TRIGGER_KIND = "test";
|
|
2323
|
+
function realRuns(runs) {
|
|
2324
|
+
return runs.filter((run) => run.triggerKind !== TEST_TRIGGER_KIND);
|
|
2325
|
+
}
|
|
2326
|
+
//#endregion
|
|
2327
|
+
//#region editors/workflow-editor/ui/query-keys.ts
|
|
2328
|
+
function blockPart(block) {
|
|
2329
|
+
return [
|
|
2330
|
+
block.pieceName,
|
|
2331
|
+
block.pieceVersion,
|
|
2332
|
+
block.kind,
|
|
2333
|
+
block.name
|
|
2334
|
+
];
|
|
2335
|
+
}
|
|
2336
|
+
function blockRefKey(block) {
|
|
2337
|
+
return blockPart(block).join(" ");
|
|
2338
|
+
}
|
|
2339
|
+
function resolverKey(scope, kind, input) {
|
|
2340
|
+
return [
|
|
2341
|
+
scope,
|
|
2342
|
+
kind,
|
|
2343
|
+
blockPart(input.block),
|
|
2344
|
+
input.propName,
|
|
2345
|
+
input.refreshers,
|
|
2346
|
+
input.connectionId ?? null,
|
|
2347
|
+
input.searchValue ?? null
|
|
2348
|
+
];
|
|
2349
|
+
}
|
|
2350
|
+
const runtimeKeys = {
|
|
2351
|
+
all: (scope) => [scope],
|
|
2352
|
+
catalog: (scope) => [scope, "catalog"],
|
|
2353
|
+
form: (scope, block) => [
|
|
2354
|
+
scope,
|
|
2355
|
+
"form",
|
|
2356
|
+
blockPart(block)
|
|
2357
|
+
],
|
|
2358
|
+
pieceActions: (scope, packageName) => [
|
|
2359
|
+
scope,
|
|
2360
|
+
"pieceActions",
|
|
2361
|
+
packageName
|
|
2362
|
+
],
|
|
2363
|
+
pieceTriggers: (scope, packageName) => [
|
|
2364
|
+
scope,
|
|
2365
|
+
"pieceTriggers",
|
|
2366
|
+
packageName
|
|
2367
|
+
],
|
|
2368
|
+
searchBlocks: (scope, query, limit) => [
|
|
2369
|
+
scope,
|
|
2370
|
+
"searchBlocks",
|
|
2371
|
+
query,
|
|
2372
|
+
limit
|
|
2373
|
+
],
|
|
2374
|
+
outputTrees: (scope) => [scope, "outputTree"],
|
|
2375
|
+
outputTree: (scope, block, config) => [
|
|
2376
|
+
scope,
|
|
2377
|
+
"outputTree",
|
|
2378
|
+
blockPart(block),
|
|
2379
|
+
config ?? {}
|
|
2380
|
+
],
|
|
2381
|
+
stepOutputTree: (scope, workflowId, stepId, testedAt) => [
|
|
2382
|
+
scope,
|
|
2383
|
+
"outputTree",
|
|
2384
|
+
"step",
|
|
2385
|
+
workflowId,
|
|
2386
|
+
stepId,
|
|
2387
|
+
testedAt
|
|
2388
|
+
],
|
|
2389
|
+
options: (scope, input) => resolverKey(scope, "options", input),
|
|
2390
|
+
dynamic: (scope, input) => resolverKey(scope, "dynamic", input),
|
|
2391
|
+
connections: (scope, filter) => filter === void 0 ? [scope, "connections"] : [
|
|
2392
|
+
scope,
|
|
2393
|
+
"connections",
|
|
2394
|
+
filter
|
|
2395
|
+
],
|
|
2396
|
+
webhook: (scope, workflowId) => [
|
|
2397
|
+
scope,
|
|
2398
|
+
"webhook",
|
|
2399
|
+
workflowId
|
|
2400
|
+
],
|
|
2401
|
+
latestRun: (scope, workflowId) => [
|
|
2402
|
+
scope,
|
|
2403
|
+
"latestRun",
|
|
2404
|
+
workflowId
|
|
2405
|
+
],
|
|
2406
|
+
allRuns: (scope) => [scope, "runs"],
|
|
2407
|
+
runs: (scope, runsScope) => [
|
|
2408
|
+
scope,
|
|
2409
|
+
"runs",
|
|
2410
|
+
{
|
|
2411
|
+
workflowId: runsScope.workflowId ?? null,
|
|
2412
|
+
driveId: runsScope.driveId ?? null,
|
|
2413
|
+
limit: runsScope.limit ?? null
|
|
2414
|
+
}
|
|
2415
|
+
],
|
|
2416
|
+
runPages: (scope, runsScope) => [
|
|
2417
|
+
scope,
|
|
2418
|
+
"runs",
|
|
2419
|
+
"pages",
|
|
2420
|
+
{
|
|
2421
|
+
workflowId: runsScope.workflowId ?? null,
|
|
2422
|
+
driveId: runsScope.driveId ?? null,
|
|
2423
|
+
limit: runsScope.limit ?? null
|
|
2424
|
+
}
|
|
2425
|
+
],
|
|
2426
|
+
run: (scope, runId) => [
|
|
2427
|
+
scope,
|
|
2428
|
+
"run",
|
|
2429
|
+
runId
|
|
2430
|
+
],
|
|
2431
|
+
secret: (scope, ref) => [
|
|
2432
|
+
scope,
|
|
2433
|
+
"secret",
|
|
2434
|
+
ref
|
|
2435
|
+
],
|
|
2436
|
+
allBlockResolutions: (scope, workflowId) => [
|
|
2437
|
+
scope,
|
|
2438
|
+
"blockResolutions",
|
|
2439
|
+
workflowId
|
|
2440
|
+
],
|
|
2441
|
+
blockResolutions: (scope, workflowId, blocks) => [
|
|
2442
|
+
scope,
|
|
2443
|
+
"blockResolutions",
|
|
2444
|
+
workflowId,
|
|
2445
|
+
blocks.map(blockPart)
|
|
2446
|
+
]
|
|
2447
|
+
};
|
|
2448
|
+
function queryKind(key) {
|
|
2449
|
+
return typeof key[1] === "string" ? key[1] : void 0;
|
|
2450
|
+
}
|
|
2451
|
+
const SHARED_STALE_MS = 18e5;
|
|
2452
|
+
const RESOLVER_STALE_MS = 3e5;
|
|
2453
|
+
//#endregion
|
|
2454
|
+
//#region editors/workflow-editor/runtime-queries.ts
|
|
2455
|
+
function createRuntimeQueryClient() {
|
|
2456
|
+
return new QueryClient({ defaultOptions: {
|
|
2457
|
+
queries: {
|
|
2458
|
+
retry: false,
|
|
2459
|
+
refetchOnWindowFocus: false
|
|
2460
|
+
},
|
|
2461
|
+
mutations: { retry: false }
|
|
2462
|
+
} });
|
|
2463
|
+
}
|
|
2464
|
+
const catalogQuery = (client) => queryOptions({
|
|
2465
|
+
queryKey: runtimeKeys.catalog(client.url),
|
|
2466
|
+
queryFn: () => client.fetchPieceCatalog(),
|
|
2467
|
+
staleTime: SHARED_STALE_MS
|
|
2468
|
+
});
|
|
2469
|
+
const blockFormQuery = (client, block) => queryOptions({
|
|
2470
|
+
queryKey: runtimeKeys.form(client.url, block),
|
|
2471
|
+
queryFn: () => client.getBlockForm(block),
|
|
2472
|
+
staleTime: SHARED_STALE_MS
|
|
2473
|
+
});
|
|
2474
|
+
const pieceActionsQuery = (client, packageName) => queryOptions({
|
|
2475
|
+
queryKey: runtimeKeys.pieceActions(client.url, packageName),
|
|
2476
|
+
queryFn: () => client.fetchPieceActions(packageName),
|
|
2477
|
+
staleTime: SHARED_STALE_MS
|
|
2478
|
+
});
|
|
2479
|
+
const pieceTriggersQuery = (client, packageName) => queryOptions({
|
|
2480
|
+
queryKey: runtimeKeys.pieceTriggers(client.url, packageName),
|
|
2481
|
+
queryFn: () => client.fetchPieceTriggers(packageName),
|
|
2482
|
+
staleTime: SHARED_STALE_MS
|
|
2483
|
+
});
|
|
2484
|
+
const outputTreeQuery = (client, block, config) => queryOptions({
|
|
2485
|
+
queryKey: runtimeKeys.outputTree(client.url, block, config),
|
|
2486
|
+
queryFn: () => client.fetchBlockOutputTree(block, config),
|
|
2487
|
+
staleTime: Infinity
|
|
2488
|
+
});
|
|
2489
|
+
const stepOutputTreeQuery = (client, workflowId, stepId, testedAt) => queryOptions({
|
|
2490
|
+
queryKey: runtimeKeys.stepOutputTree(client.url, workflowId, stepId, testedAt),
|
|
2491
|
+
queryFn: () => client.fetchStepOutputTree(workflowId, stepId),
|
|
2492
|
+
staleTime: Infinity
|
|
2493
|
+
});
|
|
2494
|
+
const REAL_RUNS = [TEST_TRIGGER_KIND];
|
|
2495
|
+
const runsQuery = (client, scope) => queryOptions({
|
|
2496
|
+
queryKey: runtimeKeys.runs(client.url, scope),
|
|
2497
|
+
queryFn: () => client.fetchRuns({
|
|
2498
|
+
...scope,
|
|
2499
|
+
excludeTriggerKinds: REAL_RUNS
|
|
2500
|
+
}).then(realRuns),
|
|
2501
|
+
staleTime: 0
|
|
2502
|
+
});
|
|
2503
|
+
const runPagesQuery = (client, scope) => infiniteQueryOptions({
|
|
2504
|
+
queryKey: runtimeKeys.runPages(client.url, scope),
|
|
2505
|
+
queryFn: ({ pageParam }) => client.fetchRunsPage({
|
|
2506
|
+
...scope,
|
|
2507
|
+
excludeTriggerKinds: REAL_RUNS
|
|
2508
|
+
}, pageParam),
|
|
2509
|
+
initialPageParam: null,
|
|
2510
|
+
getNextPageParam: (page) => page.hasNextPage && page.cursor ? page.cursor : void 0,
|
|
2511
|
+
staleTime: 0
|
|
2512
|
+
});
|
|
2513
|
+
function runsOfPages(pages) {
|
|
2514
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2515
|
+
return realRuns(pages.flatMap((page) => page.items)).filter((run) => {
|
|
2516
|
+
if (seen.has(run.id)) return false;
|
|
2517
|
+
seen.add(run.id);
|
|
2518
|
+
return true;
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
const FINISHED = /* @__PURE__ */ new Set(["SUCCEEDED", "FAILED"]);
|
|
2522
|
+
const runQuery = (client, runId) => queryOptions({
|
|
2523
|
+
queryKey: runtimeKeys.run(client.url, runId),
|
|
2524
|
+
queryFn: () => client.fetchRun(runId),
|
|
2525
|
+
staleTime: (query) => query.state.data && FINISHED.has(query.state.data.status) ? Infinity : 0
|
|
2526
|
+
});
|
|
2527
|
+
const secretStatQuery = (client, ref) => queryOptions({
|
|
2528
|
+
queryKey: runtimeKeys.secret(client.url, ref),
|
|
2529
|
+
queryFn: () => client.fetchSecretStat(ref),
|
|
2530
|
+
staleTime: 0
|
|
2531
|
+
});
|
|
2532
|
+
//#endregion
|
|
2533
|
+
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 };
|
|
2534
|
+
|
|
2535
|
+
//# sourceMappingURL=runtime-queries-Ds2kk-Ow.js.map
|