@parhelia/alpaca 0.1.12808 → 0.1.12838

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 +1 @@
1
- {"version":3,"file":"GraphQL.d.ts","sourceRoot":"","sources":["../src/GraphQL.tsx"],"names":[],"mappings":"AA+BA,wBAAgB,OAAO,mDAmQtB"}
1
+ {"version":3,"file":"GraphQL.d.ts","sourceRoot":"","sources":["../src/GraphQL.tsx"],"names":[],"mappings":"AA4BA,wBAAgB,OAAO,mDAsRtB"}
package/dist/GraphQL.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from "react";
3
3
  import { ActionButton, createAgentCommand, getComponentById, SecretAgentIcon, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, useEditContext, } from "@parhelia/core";
4
- import { getGraphQLSchema, } from "./graphqlService";
4
+ import { getGraphQLSchema } from "./graphqlService";
5
5
  import { GraphiQLPanel } from "./GraphiQLPanel";
6
6
  function sameItem(left, right) {
7
7
  return (!!left &&
@@ -17,6 +17,7 @@ export function GraphQL() {
17
17
  const [query, setQuery] = useState("");
18
18
  const [schemaResult, setSchemaResult] = useState({});
19
19
  const [showSchemaSpinner, setShowSchemaSpinner] = useState(false);
20
+ const [schemaLoadKey, setSchemaLoadKey] = useState("");
20
21
  const [aiGeneratedQuery, setAiGeneratedQuery] = useState("");
21
22
  const [graphiqlVariables, setGraphiqlVariables] = useState("{}");
22
23
  const [baseItem, setBaseItem] = useState(null);
@@ -24,7 +25,7 @@ export function GraphQL() {
24
25
  if (!editContext?.page || (editContext.selection?.length || 0) !== 1) {
25
26
  return null;
26
27
  }
27
- return getComponentById(editContext.selection[0], editContext.page) || null;
28
+ return (getComponentById(editContext.selection[0], editContext.page) || null);
28
29
  }, [editContext?.page, selectionKey]);
29
30
  const baseItemDescriptor = useMemo(() => {
30
31
  const componentItem = selectedComponent?.datasourceItem || selectedComponent?.items?.[0];
@@ -95,18 +96,30 @@ export function GraphQL() {
95
96
  }, [queryField?.id, queryField?.rawValue]);
96
97
  useEffect(() => {
97
98
  setSchemaResult({});
99
+ setSchemaLoadKey("");
98
100
  setGraphiqlVariables("{}");
99
101
  setAiGeneratedQuery("");
100
102
  }, [currentItem?.id, currentItem?.language, currentItem?.version]);
103
+ const currentItemKey = currentItem
104
+ ? `${currentItem.id}:${currentItem.language}:${currentItem.version}`
105
+ : "";
101
106
  useEffect(() => {
102
- if (currentItem && !schemaResult?.data && !showSchemaSpinner) {
107
+ if (currentItem &&
108
+ !schemaResult?.data &&
109
+ !schemaResult?.error &&
110
+ !showSchemaSpinner &&
111
+ schemaLoadKey !== currentItemKey) {
112
+ setSchemaLoadKey(currentItemKey);
103
113
  void fetchSchema();
104
114
  }
105
115
  }, [
106
116
  currentItem?.id,
107
117
  currentItem?.language,
108
118
  currentItem?.version,
119
+ currentItemKey,
120
+ schemaLoadKey,
109
121
  schemaResult?.data,
122
+ schemaResult?.error,
110
123
  showSchemaSpinner,
111
124
  ]);
112
125
  useEffect(() => {
@@ -169,7 +182,7 @@ export function GraphQL() {
169
182
  setQuery(newQuery);
170
183
  setAiGeneratedQuery(newQuery);
171
184
  };
172
- return (_jsxs("div", { className: "relative flex h-full min-h-0 flex-col overflow-hidden text-xs", children: [aiGeneratedQuery && aiGeneratedQuery !== query && (_jsxs("div", { className: "shrink-0 flex items-center gap-2 border-b border-yellow-200 bg-yellow-50 p-2 text-xs", children: [_jsx("span", { className: "text-yellow-800", children: "AI generated a new query" }), _jsx(ActionButton, { onClick: () => applyQueryToEditor(aiGeneratedQuery), className: "p-1 text-xs", variant: "outline", children: "Apply" }), _jsx(ActionButton, { onClick: () => setAiGeneratedQuery(""), className: "p-1", variant: "ghost", children: "x" })] })), _jsx(GraphiQLPanel, { item: currentItem, itemLabel: baseItemLabel, query: query, variables: graphiqlVariables, onQueryChange: setQuery, onVariablesChange: setGraphiqlVariables, onExecutionResult: () => { }, headerActions: _jsx(TooltipProvider, { delayDuration: 300, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(ActionButton, { variant: "outline", className: "h-8 w-8 rounded-full p-0", onClick: () => {
185
+ return (_jsxs("div", { className: "relative flex h-full min-h-0 flex-col overflow-hidden text-xs", children: [aiGeneratedQuery && aiGeneratedQuery !== query && (_jsxs("div", { className: "shrink-0 flex items-center gap-2 border-b border-feedback-orange bg-feedback-orange-light p-2 text-xs", children: [_jsx("span", { className: "text-feedback-orange", children: "AI generated a new query" }), _jsx(ActionButton, { onClick: () => applyQueryToEditor(aiGeneratedQuery), className: "p-1 text-xs", variant: "outline", children: "Apply" }), _jsx(ActionButton, { onClick: () => setAiGeneratedQuery(""), className: "p-1", variant: "ghost", children: "x" })] })), _jsx(GraphiQLPanel, { item: currentItem, itemLabel: baseItemLabel, query: query, variables: graphiqlVariables, onQueryChange: setQuery, onVariablesChange: setGraphiqlVariables, onExecutionResult: () => { }, headerActions: _jsx(TooltipProvider, { delayDuration: 300, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(ActionButton, { variant: "outline", className: "h-8 w-8 rounded-full p-0", onClick: () => {
173
186
  editContext?.executeCommand?.({
174
187
  command: createAgentCommand,
175
188
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"GraphiQLPanel.d.ts","sourceRoot":"","sources":["../src/GraphiQLPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,qCAAqC,CAAC;AAC7C,OAAO,gCAAgC,CAAC;AAOxC,OAAO,EAGL,uBAAuB,EAEvB,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAwD1B,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,aAAa,GACd,EAAE;IACD,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,iBAAiB,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,2CA4IA"}
1
+ {"version":3,"file":"GraphiQLPanel.d.ts","sourceRoot":"","sources":["../src/GraphiQLPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,qCAAqC,CAAC;AAC7C,OAAO,gCAAgC,CAAC;AAQxC,OAAO,EAGL,uBAAuB,EAEvB,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAiF1B,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,aAAa,GACd,EAAE;IACD,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,iBAAiB,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,2CAmOA"}
@@ -6,6 +6,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { GraphiQL as GraphiQLIDE } from "graphiql";
7
7
  import { useGraphiQL, useGraphiQLActions } from "@graphiql/react";
8
8
  import { explorerPlugin } from "@graphiql/plugin-explorer";
9
+ import { ActionButton } from "@parhelia/core";
10
+ import { RefreshCw } from "lucide-react";
9
11
  import { executeGraphiQLRequest, fetchGraphiQLSchema, isSchemaIntrospectionQuery, } from "./graphqlService";
10
12
  function GraphiQLSyncBridge({ query, variables, }) {
11
13
  const { updateActiveTabValues } = useGraphiQLActions();
@@ -40,31 +42,91 @@ function parseVariables(variables) {
40
42
  : "Variables JSON is invalid.");
41
43
  }
42
44
  }
45
+ function getSchemaErrorMessage(result) {
46
+ if (result.error) {
47
+ return result.error;
48
+ }
49
+ const firstError = Array.isArray(result.errors)
50
+ ? result.errors[0]
51
+ : result.errors;
52
+ if (firstError) {
53
+ if (typeof firstError.message === "string") {
54
+ return firstError.message;
55
+ }
56
+ if (typeof firstError === "string") {
57
+ return firstError;
58
+ }
59
+ }
60
+ if (result.status && result.status !== 200) {
61
+ return "Schema introspection failed";
62
+ }
63
+ return undefined;
64
+ }
43
65
  export function GraphiQLPanel({ item, query, variables, onQueryChange, onVariablesChange, onExecutionResult, itemLabel, headerActions, }) {
44
66
  const [schemaResult, setSchemaResult] = useState({});
45
67
  const [isRefreshingSchema, setIsRefreshingSchema] = useState(false);
68
+ const [autoSchemaLoadKey, setAutoSchemaLoadKey] = useState("");
69
+ const activeSchemaRequestRef = useRef(0);
70
+ const failedSchemaRequestKeyRef = useRef("");
46
71
  const explorer = useMemo(() => explorerPlugin(), []);
47
72
  const plugins = useMemo(() => [explorer], [explorer]);
48
73
  const handleEditHeaders = useCallback(() => { }, []);
49
74
  const graphiqlSchema = schemaResult.schema ?? null;
75
+ const schemaRequestKey = useMemo(() => `${item.id}:${item.language}:${item.version}`, [item.id, item.language, item.version]);
50
76
  const refreshSchema = useCallback(async () => {
77
+ const requestKey = schemaRequestKey;
78
+ const requestId = activeSchemaRequestRef.current + 1;
79
+ activeSchemaRequestRef.current = requestId;
51
80
  setIsRefreshingSchema(true);
52
81
  try {
53
82
  const result = await fetchGraphiQLSchema(item);
54
- setSchemaResult(result);
83
+ if (activeSchemaRequestRef.current === requestId) {
84
+ const error = getSchemaErrorMessage(result);
85
+ if (error) {
86
+ failedSchemaRequestKeyRef.current = requestKey;
87
+ setSchemaResult({ ...result, error });
88
+ }
89
+ else {
90
+ failedSchemaRequestKeyRef.current = "";
91
+ setSchemaResult(result);
92
+ }
93
+ }
55
94
  }
56
95
  finally {
57
- setIsRefreshingSchema(false);
96
+ if (activeSchemaRequestRef.current === requestId) {
97
+ setIsRefreshingSchema(false);
98
+ }
58
99
  }
59
- }, [item.id, item.language, item.version]);
100
+ }, [item.id, item.language, item.version, schemaRequestKey]);
60
101
  useEffect(() => {
102
+ activeSchemaRequestRef.current += 1;
103
+ failedSchemaRequestKeyRef.current = "";
104
+ setAutoSchemaLoadKey("");
61
105
  setSchemaResult({});
62
- }, [item.id, item.language, item.version]);
106
+ setIsRefreshingSchema(false);
107
+ }, [schemaRequestKey]);
63
108
  useEffect(() => {
64
- if (!graphiqlSchema && !isRefreshingSchema) {
109
+ if (!graphiqlSchema &&
110
+ !schemaResult.error &&
111
+ !isRefreshingSchema &&
112
+ autoSchemaLoadKey !== schemaRequestKey) {
113
+ setAutoSchemaLoadKey(schemaRequestKey);
65
114
  void refreshSchema();
66
115
  }
67
- }, [graphiqlSchema, isRefreshingSchema, refreshSchema]);
116
+ }, [
117
+ autoSchemaLoadKey,
118
+ graphiqlSchema,
119
+ isRefreshingSchema,
120
+ refreshSchema,
121
+ schemaRequestKey,
122
+ schemaResult.error,
123
+ ]);
124
+ const handleRefreshSchema = useCallback(() => {
125
+ failedSchemaRequestKeyRef.current = "";
126
+ setSchemaResult({});
127
+ setAutoSchemaLoadKey(schemaRequestKey);
128
+ void refreshSchema();
129
+ }, [refreshSchema, schemaRequestKey]);
68
130
  const fetcher = useCallback(async (graphQLParams) => {
69
131
  if (!graphQLParams.query) {
70
132
  return {
@@ -82,14 +144,32 @@ export function GraphiQLPanel({ item, query, variables, onQueryChange, onVariabl
82
144
  ],
83
145
  };
84
146
  }
147
+ const isIntrospectionQuery = isSchemaIntrospectionQuery(graphQLParams.query);
148
+ if (isIntrospectionQuery &&
149
+ failedSchemaRequestKeyRef.current === schemaRequestKey) {
150
+ const message = schemaResult.error ||
151
+ "Schema introspection failed. Use Retry to try loading the schema again.";
152
+ return {
153
+ data: null,
154
+ errors: [{ message }],
155
+ };
156
+ }
85
157
  const result = await executeGraphiQLRequest({
86
158
  item,
87
159
  query: graphQLParams.query,
88
160
  variables: graphQLParams.variables ?? parsedVariables,
89
161
  operationName: graphQLParams.operationName,
90
162
  });
91
- if (isSchemaIntrospectionQuery(graphQLParams.query)) {
92
- setSchemaResult(result);
163
+ if (isIntrospectionQuery) {
164
+ const error = getSchemaErrorMessage(result);
165
+ if (error) {
166
+ failedSchemaRequestKeyRef.current = schemaRequestKey;
167
+ setSchemaResult({ ...result, error });
168
+ }
169
+ else {
170
+ failedSchemaRequestKeyRef.current = "";
171
+ setSchemaResult(result);
172
+ }
93
173
  }
94
174
  else {
95
175
  onExecutionResult(result);
@@ -104,7 +184,15 @@ export function GraphiQLPanel({ item, query, variables, onQueryChange, onVariabl
104
184
  data: result.data ?? null,
105
185
  errors: result.errors,
106
186
  };
107
- }, [item.id, item.language, item.version, onExecutionResult, variables]);
187
+ }, [
188
+ item.id,
189
+ item.language,
190
+ item.version,
191
+ onExecutionResult,
192
+ schemaRequestKey,
193
+ schemaResult.error,
194
+ variables,
195
+ ]);
108
196
  const lastTransportMessage = useMemo(() => {
109
197
  if (schemaResult.transport?.used === "v1-fallback") {
110
198
  return `Schema fetch fell back to v1 after v2 status ${schemaResult.transport.fallbackFromStatus}.`;
@@ -115,5 +203,5 @@ export function GraphiQLPanel({ item, query, variables, onQueryChange, onVariabl
115
203
  .alpaca-graphiql-shell .graphiql-logo {
116
204
  display: none;
117
205
  }
118
- ` }), _jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsxs("span", { children: ["Base item: ", _jsx("span", { className: "font-mono", children: itemLabel || item.id })] }), _jsxs("span", { children: [item.language, " v", item.version] })] }), headerActions && (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: headerActions }))] }), !!lastTransportMessage && (_jsx("div", { className: "border-b border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-800", children: lastTransportMessage })), schemaResult.error && (_jsx("div", { className: "border-b border-red-300 bg-red-50 px-3 py-2 text-xs text-red-800", children: schemaResult.error })), _jsx("div", { className: "alpaca-graphiql-shell min-h-0 flex-1 bg-white [&_.graphiql-container]:h-full", children: _jsx(GraphiQLIDE, { className: "h-full", fetcher: fetcher, schema: graphiqlSchema, forcedTheme: "light", initialQuery: query, initialVariables: variables, initialHeaders: "", onEditQuery: onQueryChange, onEditVariables: onVariablesChange, onEditHeaders: handleEditHeaders, isHeadersEditorEnabled: false, defaultEditorToolsVisibility: "variables", plugins: plugins, children: _jsx(GraphiQLSyncBridge, { query: query, variables: variables }) }) })] }));
206
+ ` }), _jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-border-default bg-neutral-grey-5 px-3 py-2 text-xs text-neutral-grey-50", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsxs("span", { children: ["Base item: ", _jsx("span", { className: "font-mono", children: itemLabel || item.id })] }), _jsxs("span", { children: [item.language, " v", item.version] })] }), headerActions && (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: headerActions }))] }), !!lastTransportMessage && (_jsx("div", { className: "border-b border-feedback-orange bg-feedback-orange-light px-3 py-2 text-xs text-feedback-orange", children: lastTransportMessage })), schemaResult.error && (_jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-feedback-red bg-feedback-red-light px-3 py-2 text-xs text-feedback-red", children: [_jsx("span", { children: schemaResult.error }), _jsxs(ActionButton, { className: "shrink-0", disabled: isRefreshingSchema, isLoading: isRefreshingSchema, loadingText: "Retrying", onClick: handleRefreshSchema, variant: "outline", children: [_jsx(RefreshCw, { className: "h-3.5 w-3.5" }), _jsx("span", { children: "Retry" })] })] })), _jsx("div", { className: "alpaca-graphiql-shell min-h-0 flex-1 bg-white [&_.graphiql-container]:h-full", children: _jsx(GraphiQLIDE, { className: "h-full", fetcher: fetcher, schema: graphiqlSchema, forcedTheme: "light", initialQuery: query, initialVariables: variables, initialHeaders: "", onEditQuery: onQueryChange, onEditVariables: onVariablesChange, onEditHeaders: handleEditHeaders, isHeadersEditorEnabled: false, defaultEditorToolsVisibility: "variables", plugins: plugins, children: _jsx(GraphiQLSyncBridge, { query: query, variables: variables }) }) })] }));
119
207
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,mDA0GrB"}
1
+ {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,mDA6GrB"}
package/dist/Layout.js CHANGED
@@ -62,5 +62,5 @@ export function Layout() {
62
62
  id: "page",
63
63
  content: (_jsx("div", { className: "relative h-full min-h-0", children: _jsx("div", { className: "absolute inset-0 overflow-auto p-2", children: _jsx(ObjectInspector, { data: page, nodeRenderer: defaultNodeRenderer }) }) })),
64
64
  });
65
- return (_jsxs("div", { className: "relative flex h-full min-h-0 flex-col", children: [_jsx(SimpleTabs, { tabs: tabs, activeTab: activeTab, setActiveTab: setActiveTab, className: "border-gray-3 flex border-b px-2 pt-2 text-xs" }), _jsx("div", { className: "absolute top-2 right-1 h-4 w-4", children: _jsx(CopyButton, { textToCopy: JSON.stringify(activeTab === 0 && component ? component : page, replacer, 2), iconOnly: true }) })] }));
65
+ return (_jsxs("div", { className: "relative flex h-full min-h-0 flex-col", children: [_jsx(SimpleTabs, { tabs: tabs, activeTab: activeTab, setActiveTab: setActiveTab, className: "border-border-default flex border-b px-2 pt-2" }), _jsx("div", { className: "absolute top-2 right-1 h-4 w-4", children: _jsx(CopyButton, { textToCopy: JSON.stringify(activeTab === 0 && component ? component : page, replacer, 2), iconOnly: true }) })] }));
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlService.d.ts","sourceRoot":"","sources":["../src/graphqlService.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAKd,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,IAAI,GAAG,aAAa,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS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kDnC;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAuC/B;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,oBAAoB,UAcvE"}
@@ -140,7 +140,7 @@ function getStatus(result) {
140
140
  return result.response?.status ?? 500;
141
141
  }
142
142
  function getErrorMessage(result) {
143
- return result.details || result.summary || result.rawDetails || "Request failed";
143
+ return (result.details || result.summary || result.rawDetails || "Request failed");
144
144
  }
145
145
  function joinWarnings(...warnings) {
146
146
  return warnings.filter(Boolean).join(" ");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AAuCxB,wBAAgB,eAAe,CAAC,aAAa,EAAE,mBAAmB,uBAgCjE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AAwDxB,wBAAgB,eAAe,CAAC,aAAa,EAAE,mBAAmB,uBA6BjE"}
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy, Suspense } from "react";
2
3
  import { PanelsTopLeft } from "lucide-react";
3
4
  import { GraphQLIcon, JsonIcon, } from "@parhelia/core";
4
5
  import { Layout } from "./Layout";
5
- import { GraphQL } from "./GraphQL";
6
6
  import { alpacaComponentCommandProvider } from "./componentCommands";
7
+ const GraphQL = lazy(() => import("./GraphQL").then((module) => ({ default: module.GraphQL })));
8
+ function LazyGraphQLPanel() {
9
+ return (_jsx(Suspense, { fallback: _jsx("div", { className: "p-4 text-sm text-muted-foreground", children: "Loading GraphQL editor..." }), children: _jsx(GraphQL, {}) }));
10
+ }
7
11
  const layoutDebugSidebar = {
8
12
  id: "layout",
9
13
  title: "Layout",
@@ -31,7 +35,7 @@ const graphqlSidebar = {
31
35
  name: "graphql",
32
36
  icon: _jsx(GraphQLIcon, {}),
33
37
  title: "GraphQL",
34
- content: _jsx(GraphQL, {}),
38
+ content: _jsx(LazyGraphQLPanel, {}),
35
39
  initialSize: 100,
36
40
  },
37
41
  ],
@@ -52,10 +56,7 @@ export function configureAlpaca(configuration) {
52
56
  const componentCommandProviders = configuration.componentCommands?.providers ?? [];
53
57
  if (!componentCommandProviders.includes(alpacaComponentCommandProvider)) {
54
58
  configuration.componentCommands = {
55
- providers: [
56
- ...componentCommandProviders,
57
- alpacaComponentCommandProvider,
58
- ],
59
+ providers: [...componentCommandProviders, alpacaComponentCommandProvider],
59
60
  };
60
61
  }
61
62
  return configuration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parhelia/alpaca",
3
- "version": "0.1.12808",
3
+ "version": "0.1.12838",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"