@flowgram.ai/variable-core 0.5.6 → 0.5.7

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/dist/index.d.mts CHANGED
@@ -2152,12 +2152,12 @@ declare const ScopeProvider: (props: React.PropsWithChildren<{
2152
2152
  * useCurrentScope returns the scope provided by ScopeProvider.
2153
2153
  * @returns
2154
2154
  */
2155
- declare const useCurrentScope: (params?: {
2155
+ declare const useCurrentScope: <Strict extends boolean = false>(params?: {
2156
2156
  /**
2157
2157
  * whether to throw error when no scope in ScopeProvider is found
2158
2158
  */
2159
- strict?: boolean;
2160
- }) => Scope;
2159
+ strict: Strict;
2160
+ }) => Strict extends true ? Scope : Scope | undefined;
2161
2161
 
2162
2162
  /**
2163
2163
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
package/dist/index.d.ts CHANGED
@@ -2152,12 +2152,12 @@ declare const ScopeProvider: (props: React.PropsWithChildren<{
2152
2152
  * useCurrentScope returns the scope provided by ScopeProvider.
2153
2153
  * @returns
2154
2154
  */
2155
- declare const useCurrentScope: (params?: {
2155
+ declare const useCurrentScope: <Strict extends boolean = false>(params?: {
2156
2156
  /**
2157
2157
  * whether to throw error when no scope in ScopeProvider is found
2158
2158
  */
2159
- strict?: boolean;
2160
- }) => Scope;
2159
+ strict: Strict;
2160
+ }) => Strict extends true ? Scope : Scope | undefined;
2161
2161
 
2162
2162
  /**
2163
2163
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
package/dist/index.js CHANGED
@@ -2644,7 +2644,7 @@ var import_react2 = require("react");
2644
2644
  var import_core = require("@flowgram.ai/core");
2645
2645
  function useScopeAvailable(params) {
2646
2646
  const { autoRefresh = true } = params || {};
2647
- const scope = useCurrentScope();
2647
+ const scope = useCurrentScope({ strict: true });
2648
2648
  const refresh = (0, import_core.useRefresh)();
2649
2649
  (0, import_react2.useEffect)(() => {
2650
2650
  if (!autoRefresh) {
@@ -2697,7 +2697,7 @@ function useOutputVariables() {
2697
2697
  });
2698
2698
  return () => disposable.dispose();
2699
2699
  }, []);
2700
- return scope.output.variables;
2700
+ return scope?.output.variables || [];
2701
2701
  }
2702
2702
  // Annotate the CommonJS export names for ESM import in node:
2703
2703
  0 && (module.exports = {