@ram_28/kf-ai-sdk 1.0.21 → 1.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ram_28/kf-ai-sdk",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Type-safe, AI-driven SDK for building modern web applications with role-based access control",
5
5
  "author": "Ramprasad",
6
6
  "license": "MIT",
@@ -304,6 +304,15 @@ export interface UseFormOptionsType<
304
304
  * @default "interactive"
305
305
  */
306
306
  interactionMode?: InteractionModeType;
307
+
308
+ /**
309
+ * Enable draft API calls in update mode
310
+ * When false (default), no draft API calls (e.g., /instance_id/draft) are made during
311
+ * field blur in update mode. The update API is only called on form submission.
312
+ * When true, draft API calls are made on blur for computed field dependencies.
313
+ * @default false
314
+ */
315
+ enableDraftInUpdateMode?: boolean;
307
316
  }
308
317
 
309
318
  // ============================================================
@@ -54,6 +54,7 @@ export function useForm<T extends Record<string, any> = Record<string, any>>(
54
54
  skipSchemaFetch = false,
55
55
  schema: manualSchema,
56
56
  interactionMode = "interactive",
57
+ enableDraftInUpdateMode = false,
57
58
  } = options;
58
59
 
59
60
  // Derived interaction mode flags
@@ -346,10 +347,15 @@ export function useForm<T extends Record<string, any> = Record<string, any>>(
346
347
  return;
347
348
  }
348
349
 
349
- // Determine if draft should be triggered based on interaction mode
350
- // For update mode, always behave as non-interactive (only trigger for computed deps)
350
+ // Determine if draft should be triggered based on interaction mode and configuration
351
+ // For update mode: skip draft API calls unless explicitly enabled via enableDraftInUpdateMode
351
352
  // Interactive mode (create only): Always trigger draft API on blur
352
353
  // Non-interactive mode: Only trigger for computed field dependencies
354
+ if (operation === "update" && !enableDraftInUpdateMode) {
355
+ // Skip draft API calls in update mode when enableDraftInUpdateMode is false (default)
356
+ return;
357
+ }
358
+
353
359
  const shouldTrigger =
354
360
  isInteractiveMode && operation !== "update"
355
361
  ? true // Interactive mode (create only): always trigger
@@ -533,6 +539,7 @@ export function useForm<T extends Record<string, any> = Record<string, any>>(
533
539
  computedFieldDependencies,
534
540
  isInteractiveMode,
535
541
  draftId,
542
+ enableDraftInUpdateMode,
536
543
  ],
537
544
  );
538
545