@superblocksteam/library 2.0.104 → 2.0.105-next.1

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.
@@ -1,4 +1,4 @@
1
- import { _ as root_store_default, t as makeWrappedComponent, x as api_hmr_tracker_default } from "../jsx-wrapper-DnM3BCRU.js";
1
+ import { _ as root_store_default, t as makeWrappedComponent, x as api_hmr_tracker_default } from "../jsx-wrapper-BCVlG9Wg.js";
2
2
  import { SOURCE_ID_ATTRIBUTE } from "@superblocksteam/library-shared";
3
3
  import * as ReactJsxDevRuntime from "react/jsx-dev-runtime";
4
4
 
@@ -2638,7 +2638,7 @@ var ApiManager = class {
2638
2638
  const commitId = this.rootStore.commitId;
2639
2639
  const editMode$1 = isEditMode();
2640
2640
  const appMode$1 = getAppMode();
2641
- const viewMode = editMode$1 ? ViewMode.EDITOR : appMode$1 === AppMode.PREVIEW ? ViewMode.PREVIEW : ViewMode.DEPLOYED;
2641
+ const viewMode = editMode$1 ? OrchestratorViewMode.EDIT : appMode$1 === AppMode.PREVIEW ? OrchestratorViewMode.PREVIEW : OrchestratorViewMode.DEPLOYED;
2642
2642
  const profileKey = profile?.key ?? "default";
2643
2643
  const agentBaseUrl = (() => {
2644
2644
  if (this.rootStore.dataPlaneGatewayEnabled) {
@@ -2662,6 +2662,8 @@ var ApiManager = class {
2662
2662
  viewMode,
2663
2663
  entryPoint
2664
2664
  };
2665
+ const exportName = this.rootStore.getApiExportName(apiName);
2666
+ if (exportName) body.exportName = exportName;
2665
2667
  if (files.length > 0) body.files = files;
2666
2668
  if (profile) body.profile = profile;
2667
2669
  if (editMode$1) {
@@ -2694,6 +2696,7 @@ var ApiManager = class {
2694
2696
  };
2695
2697
  }
2696
2698
  }
2699
+ const fetchStartMs = Date.now();
2697
2700
  const response = await fetch(`${agentBaseUrl}v3/execute`, {
2698
2701
  method: "POST",
2699
2702
  credentials: "include",
@@ -2724,18 +2727,28 @@ var ApiManager = class {
2724
2727
  };
2725
2728
  }
2726
2729
  const result = await response.json();
2730
+ const eventPerf = result.events?.find((e) => e.end?.performance != null);
2731
+ const perfObj = result.performance ?? (eventPerf?.end)?.performance;
2732
+ const executionStartMs = perfObj?.start != null && Number.isFinite(Number(perfObj.start)) ? Number(perfObj.start) : void 0;
2733
+ const executionDurationMs = perfObj?.total != null && Number.isFinite(Number(perfObj.total)) ? Number(perfObj.total) : void 0;
2727
2734
  if (result.errors?.length) return {
2728
2735
  success: false,
2729
2736
  error: {
2730
2737
  code: "EXECUTION_ERROR",
2731
2738
  message: result.errors[0].message
2732
2739
  },
2733
- diagnostics: result.diagnostics
2740
+ diagnostics: result.diagnostics,
2741
+ executionStartMs,
2742
+ executionDurationMs,
2743
+ fetchStartMs
2734
2744
  };
2735
2745
  return {
2736
2746
  success: true,
2737
2747
  output: result.output?.result,
2738
- diagnostics: result.diagnostics
2748
+ diagnostics: result.diagnostics,
2749
+ executionStartMs,
2750
+ executionDurationMs,
2751
+ fetchStartMs
2739
2752
  };
2740
2753
  } catch (error) {
2741
2754
  if (error instanceof Error && error.name === "AbortError") return {
@@ -3324,6 +3337,13 @@ var RootStore = class {
3324
3337
  */
3325
3338
  apiEntryPoints = /* @__PURE__ */ new Map();
3326
3339
  /**
3340
+ * Maps API name → original export name in the source file.
3341
+ * Set for named exports (e.g. `export const GetUsers = api({...})`).
3342
+ * Undefined/absent for default exports.
3343
+ * Used by executeSdkApiV3 to send the correct `exportName` to the orchestrator.
3344
+ */
3345
+ apiExportNames = /* @__PURE__ */ new Map();
3346
+ /**
3327
3347
  * Maps API name → statically declared integrations.
3328
3348
  * Populated during edit-mode discovery and from the deployed build manifest.
3329
3349
  */
@@ -3401,8 +3421,15 @@ var RootStore = class {
3401
3421
  getApiEntryPoint(apiName) {
3402
3422
  return this.apiEntryPoints.get(apiName);
3403
3423
  }
3424
+ setApiExportName(apiName, exportName) {
3425
+ this.apiExportNames.set(apiName, exportName);
3426
+ }
3427
+ getApiExportName(apiName) {
3428
+ return this.apiExportNames.get(apiName);
3429
+ }
3404
3430
  clearApiEntryPoints() {
3405
3431
  this.apiEntryPoints.clear();
3432
+ this.apiExportNames.clear();
3406
3433
  }
3407
3434
  setApiIntegrations(apiName, integrations) {
3408
3435
  this.apiIntegrations.set(apiName, integrations);
@@ -4104,4 +4131,4 @@ const useJSXContext = () => {
4104
4131
 
4105
4132
  //#endregion
4106
4133
  export { useSuperblocksProfiles as A, createManagedPropsList as B, rejectById as C, useSuperblocksContext as D, getAppMode as E, editorBridge as F, getEditStore as G, PropsCategory as H, iframeMessageHandler as I, isEmbeddedBySuperblocksFirstParty as L, generateId as M, sendNotification as N, useSuperblocksDataTags as O, colors as P, sendMessageImmediately as R, addNewPromise as S, SuperblocksContextProvider as T, Section as U, Prop as V, createPropertiesPanelDefinition as W, root_store_default as _, FixWithClarkButton as a, getContextFromTraceHeaders as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, useSuperblocksUser as j, useSuperblocksGroups as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, startEditorSync as v, resolveById as w, api_hmr_tracker_default as x, createIframeSpan as y, isEditMode as z };
4107
- //# sourceMappingURL=jsx-wrapper-DnM3BCRU.js.map
4134
+ //# sourceMappingURL=jsx-wrapper-BCVlG9Wg.js.map