@diagonal-hq/cli 0.22.3 → 0.22.5

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.
@@ -7807,9 +7807,11 @@ type SdkHooks = {
7807
7807
  * @example
7808
7808
  * ```tsx
7809
7809
  * function ReserveButton({ slotId }) {
7810
+ * const slots = Sdk.hooks.useApi(['slots'], (api) => api.get('/api/slots'));
7810
7811
  * const action = Sdk.hooks.useWorkflowAction({
7811
7812
  * workflowId: 'reserve-slot',
7812
- * idempotent: true
7813
+ * idempotent: true,
7814
+ * onSuccess: () => slots.invalidate()
7813
7815
  * });
7814
7816
  *
7815
7817
  * return (
@@ -7839,8 +7841,28 @@ type SdkHooks = {
7839
7841
  params?: Record<string, any>;
7840
7842
  /** Generate and manage the conventional `idempotency_key` input. */
7841
7843
  idempotent?: boolean;
7844
+ /** Called with the parsed response after every successful run, including a run
7845
+ * that a later run replaced. Refresh the data that the workflow changed here. */
7846
+ onSuccess?: (response: SdkWorkflowResponse) => void;
7842
7847
  }): UseWorkflowActionResult;
7843
7848
 
7849
+ /**
7850
+ * Returns a function that refreshes every data query on the page. Use it after a
7851
+ * write when the page cannot name the data that the write changed. Prefer the
7852
+ * `invalidate()` of each affected data hook, because a full refresh refetches
7853
+ * every query on the page.
7854
+ *
7855
+ * @example
7856
+ * ```tsx
7857
+ * const invalidateAll = Sdk.hooks.useInvalidateAll();
7858
+ * const importMembers = Sdk.hooks.useWorkflowAction({
7859
+ * workflowId: 'import-members',
7860
+ * onSuccess: () => invalidateAll()
7861
+ * });
7862
+ * ```
7863
+ */
7864
+ useInvalidateAll(): () => Promise<void>;
7865
+
7844
7866
  /**
7845
7867
  * Reactive timelines of a record's schedule workflow runs, the data behind
7846
7868
  * `Sdk.Components.RecordScheduleDisplay`, for pages that render a custom
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.22.3",
3
+ "version": "0.22.5",
4
4
  "description": "The diagonal CLI and the configuration helpers for file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {