@fieldwangai/agentflow 0.1.57 → 0.1.59

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.
@@ -117,7 +117,12 @@ function isAdminRequest(opts = {}) {
117
117
  return Boolean(opts?.isAdmin);
118
118
  }
119
119
 
120
+ function shouldFilterMarketplaceOwner(opts = {}) {
121
+ return opts?.marketplaceScope === "owned";
122
+ }
123
+
120
124
  function canAccessMarketplaceOwner(ownerUserId, opts = {}) {
125
+ if (!shouldFilterMarketplaceOwner(opts)) return true;
121
126
  const requestedUserId = String(opts.userId || "").trim();
122
127
  if (!requestedUserId) return true;
123
128
  if (isAdminRequest(opts)) return true;
@@ -4763,6 +4763,7 @@ export function startUiServer({
4763
4763
  const flowId = url.searchParams.get("flowId");
4764
4764
  const flowSource = url.searchParams.get("flowSource") || "user";
4765
4765
  const lang = url.searchParams.get("lang") || "en";
4766
+ const marketplaceScope = url.searchParams.get("scope") === "owned" ? "owned" : "all";
4766
4767
  if (flowId && !isValidFlowSourceRead(flowSource)) {
4767
4768
  json(res, 400, { error: "Invalid flowSource" });
4768
4769
  return;
@@ -4771,7 +4772,7 @@ export function startUiServer({
4771
4772
  try {
4772
4773
  const { setLanguage } = await import("./i18n.mjs");
4773
4774
  setLanguage(lang);
4774
- json(res, 200, listNodesJson(root, flowId || "", flowId ? flowSource : "", { archived: nodesArchived, ...userCtx }));
4775
+ json(res, 200, listNodesJson(root, flowId || "", flowId ? flowSource : "", { archived: nodesArchived, ...userCtx, marketplaceScope }));
4775
4776
  } catch (e) {
4776
4777
  json(res, 500, { error: (e && e.message) || String(e) });
4777
4778
  }
@@ -4833,7 +4834,8 @@ export function startUiServer({
4833
4834
 
4834
4835
  if (req.method === "GET" && url.pathname === "/api/marketplace/nodes") {
4835
4836
  try {
4836
- json(res, 200, listMarketplacePackages(root, userCtx));
4837
+ const marketplaceScope = url.searchParams.get("scope") === "owned" ? "owned" : "all";
4838
+ json(res, 200, listMarketplacePackages(root, { ...userCtx, marketplaceScope }));
4837
4839
  } catch (e) {
4838
4840
  json(res, 500, { error: (e && e.message) || String(e) });
4839
4841
  }
@@ -4842,7 +4844,8 @@ export function startUiServer({
4842
4844
 
4843
4845
  if (req.method === "GET" && url.pathname === "/api/marketplace/flow-snippets") {
4844
4846
  try {
4845
- json(res, 200, listMarketplaceFlowSnippets(root, userCtx));
4847
+ const marketplaceScope = url.searchParams.get("scope") === "owned" ? "owned" : "all";
4848
+ json(res, 200, listMarketplaceFlowSnippets(root, { ...userCtx, marketplaceScope }));
4846
4849
  } catch (e) {
4847
4850
  json(res, 500, { error: (e && e.message) || String(e) });
4848
4851
  }