[WIP] Refactor to NPM workspaces (#104)

This commit is contained in:
Gregory Schier
2024-09-22 21:27:10 -07:00
committed by GitHub
parent 93633875ac
commit 101b6284d6
176 changed files with 1983 additions and 1249 deletions

View File

@@ -1,6 +1,6 @@
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';
import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest';
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import type { GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
import { Input } from './core/Input';
import { VStack } from './core/Stacks';

View File

@@ -1,6 +1,6 @@
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';
import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest';
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import type { GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
import { Input } from './core/Input';
import { VStack } from './core/Stacks';

View File

@@ -1,6 +1,6 @@
import mime from 'mime';
import { useKeyValue } from '../hooks/useKeyValue';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { Banner } from './core/Banner';
import { Button } from './core/Button';
import { InlineCode } from './core/InlineCode';

View File

@@ -1,4 +1,4 @@
import type { Cookie } from '@yaakapp/api';
import type { Cookie } from '@yaakapp-internal/models';
import { useCookieJars } from '../hooks/useCookieJars';
import { useUpdateCookieJar } from '../hooks/useUpdateCookieJar';
import { cookieDomain } from '../lib/model_util';

View File

@@ -9,7 +9,7 @@ import { useKeyValue } from '../hooks/useKeyValue';
import { usePrompt } from '../hooks/usePrompt';
import { useUpdateEnvironment } from '../hooks/useUpdateEnvironment';
import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace';
import type { Environment, Workspace } from '@yaakapp/api';
import type { Environment, Workspace } from '@yaakapp-internal/models';
import { Button } from './core/Button';
import { ContextMenu } from './core/Dropdown';
import type {

View File

@@ -1,7 +1,7 @@
import { save } from '@tauri-apps/plugin-dialog';
import { useCallback, useMemo, useState } from 'react';
import slugify from 'slugify';
import type { Workspace } from '@yaakapp/api';
import type { Workspace } from '@yaakapp-internal/models';
import { count } from '../lib/pluralize';
import { invokeCmd } from '../lib/tauri';
import { Button } from './core/Button';

View File

@@ -1,5 +1,5 @@
import { useCallback, useMemo } from 'react';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import type { Pair, PairEditorProps } from './core/PairEditor';
import { PairEditor } from './core/PairEditor';

View File

@@ -1,5 +1,5 @@
import { useCallback, useMemo } from 'react';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import type { Pair, PairEditorProps } from './core/PairEditor';
import { PairOrBulkEditor } from './core/PairOrBulkEditor';

View File

@@ -1,6 +1,6 @@
import { useQueryClient } from '@tanstack/react-query';
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import type { Model } from '@yaakapp/api';
import type { AnyModel } from '@yaakapp-internal/models';
import { useSetAtom } from 'jotai';
import { useEffect } from 'react';
import { useEnsureActiveCookieJar, useMigrateActiveCookieJarId } from '../hooks/useActiveCookieJar';
@@ -62,7 +62,7 @@ export function GlobalHooks() {
const { wasUpdatedExternally } = useRequestUpdateKey(null);
interface ModelPayload {
model: Model;
model: AnyModel;
windowLabel: string;
}
@@ -94,7 +94,7 @@ export function GlobalHooks() {
wasUpdatedExternally(model.id);
}
const pushToFront = (['http_response', 'grpc_connection'] as Model['model'][]).includes(
const pushToFront = (['http_response', 'grpc_connection'] as AnyModel['model'][]).includes(
model.model,
);
@@ -197,7 +197,7 @@ export function GlobalHooks() {
return null;
}
function updateModelList<T extends Model>(model: T, pushToFront: boolean) {
function updateModelList<T extends AnyModel>(model: T, pushToFront: boolean) {
return (current: T[]): T[] => {
const index = current.findIndex((v) => modelsEq(v, model)) ?? -1;
if (index >= 0) {
@@ -212,7 +212,7 @@ function removeById<T extends { id: string }>(model: T) {
return (entries: T[] | undefined) => entries?.filter((e) => e.id !== model.id) ?? [];
}
const shouldIgnoreModel = (payload: Model, windowLabel: string) => {
const shouldIgnoreModel = (payload: AnyModel, windowLabel: string) => {
if (windowLabel === getCurrentWebviewWindow().label) {
// Never ignore same-window updates
return false;

View File

@@ -2,7 +2,7 @@ import type { EditorView } from 'codemirror';
import { useCallback, useEffect, useMemo, useRef } from 'react';
import { useIntrospectGraphQL } from '../hooks/useIntrospectGraphQL';
import { tryFormatJson } from '../lib/formatters';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { Button } from './core/Button';
import type { EditorProps } from './core/Editor';
import { Editor, formatGraphQL } from './core/Editor';

View File

@@ -5,7 +5,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import { useGrpcEvents } from '../hooks/useGrpcEvents';
import { usePinnedGrpcConnection } from '../hooks/usePinnedGrpcConnection';
import { useStateWithDeps } from '../hooks/useStateWithDeps';
import type { GrpcEvent, GrpcRequest } from '@yaakapp/api';
import type { GrpcEvent, GrpcRequest } from '@yaakapp-internal/models';
import { isResponseLoading } from '../lib/model_util';
import { Banner } from './core/Banner';
import { Button } from './core/Button';

View File

@@ -6,7 +6,7 @@ import { createGlobalState } from 'react-use';
import type { ReflectResponseService } from '../hooks/useGrpc';
import { useRequestUpdateKey } from '../hooks/useRequestUpdateKey';
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';
import type { GrpcMetadataEntry, GrpcRequest } from '@yaakapp/api';
import type { GrpcMetadataEntry, GrpcRequest } from '@yaakapp-internal/models';
import { AUTH_TYPE_BASIC, AUTH_TYPE_BEARER, AUTH_TYPE_NONE } from '../lib/model_util';
import { BasicAuth } from './BasicAuth';
import { BearerAuth } from './BearerAuth';

View File

@@ -15,7 +15,7 @@ import { useEffect, useMemo, useRef } from 'react';
import { useAlert } from '../hooks/useAlert';
import type { ReflectResponseService } from '../hooks/useGrpc';
import { tryFormatJson } from '../lib/formatters';
import type { GrpcRequest } from '@yaakapp/api';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { count } from '../lib/pluralize';
import { Button } from './core/Button';
import type { EditorProps } from './core/Editor';

View File

@@ -3,7 +3,7 @@ import { connections } from '../lib/data/connections';
import { encodings } from '../lib/data/encodings';
import { headerNames } from '../lib/data/headerNames';
import { mimeTypes } from '../lib/data/mimetypes';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import type { GenericCompletionConfig } from './core/Editor/genericCompletion';
import type { PairEditorProps } from './core/PairEditor';
import { PairOrBulkEditor } from './core/PairOrBulkEditor';

View File

@@ -1,6 +1,6 @@
import type { CSSProperties } from 'react';
import React from 'react';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { SplitLayout } from './core/SplitLayout';
import { RequestPane } from './RequestPane';
import { ResponsePane } from './ResponsePane';

View File

@@ -1,4 +1,4 @@
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import type { GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
import React, { useState } from 'react';
import { useAppRoutes } from '../hooks/useAppRoutes';
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';

View File

@@ -2,7 +2,7 @@ import { useState } from 'react';
import { useOpenWorkspace } from '../hooks/useOpenWorkspace';
import { useSettings } from '../hooks/useSettings';
import { useUpdateSettings } from '../hooks/useUpdateSettings';
import type { Workspace } from '@yaakapp/api';
import type { Workspace } from '@yaakapp-internal/models';
import { Button } from './core/Button';
import { Checkbox } from './core/Checkbox';
import { Icon } from './core/Icon';

View File

@@ -1,7 +1,7 @@
import { formatDistanceToNowStrict } from 'date-fns';
import { useDeleteGrpcConnection } from '../hooks/useDeleteGrpcConnection';
import { useDeleteGrpcConnections } from '../hooks/useDeleteGrpcConnections';
import type { GrpcConnection } from '@yaakapp/api';
import type { GrpcConnection } from '@yaakapp-internal/models';
import { count } from '../lib/pluralize';
import { Dropdown } from './core/Dropdown';
import { Icon } from './core/Icon';

View File

@@ -1,4 +1,4 @@
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { useCopyHttpResponse } from '../hooks/useCopyHttpResponse';
import { useDeleteHttpResponse } from '../hooks/useDeleteHttpResponse';
import { useDeleteHttpResponses } from '../hooks/useDeleteHttpResponses';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest, HttpRequestHeader, HttpUrlParameter } from '@yaakapp/api';
import type { HttpRequest, HttpRequestHeader, HttpUrlParameter } from '@yaakapp-internal/models';
import classNames from 'classnames';
import type { CSSProperties } from 'react';
import React, { memo, useCallback, useMemo, useState } from 'react';

View File

@@ -1,4 +1,4 @@
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { KeyValueRow, KeyValueRows } from './core/KeyValueRow';
interface Props {

View File

@@ -1,5 +1,5 @@
import { open } from '@tauri-apps/plugin-shell';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { IconButton } from './core/IconButton';
import { KeyValueRow, KeyValueRows } from './core/KeyValueRow';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import classNames from 'classnames';
import type { CSSProperties } from 'react';
import { memo, useCallback, useMemo } from 'react';

View File

@@ -1,4 +1,4 @@
import type { Plugin } from '@yaakapp/api';
import type { Plugin } from '@yaakapp-internal/models';
import { open } from '@tauri-apps/plugin-shell';
import React from 'react';
import { useInstallPlugin } from '../../hooks/useInstallPlugin';

View File

@@ -1,4 +1,10 @@
import type { Folder, GrpcRequest, HttpRequest, Model, Workspace } from '@yaakapp/api';
import type {
AnyModel,
Folder,
GrpcRequest,
HttpRequest,
Workspace,
} from '@yaakapp-internal/models';
import classNames from 'classnames';
import type { ReactNode } from 'react';
import React, { Fragment, useCallback, useMemo, useRef, useState } from 'react';
@@ -575,7 +581,7 @@ type SidebarItemProps = {
itemId: string;
itemName: string;
itemFallbackName: string;
itemModel: Model['model'];
itemModel: AnyModel['model'];
itemPrefix: ReactNode;
useProminentStyles?: boolean;
selected: boolean;

View File

@@ -5,10 +5,9 @@ import type {
TemplateFunctionHttpRequestArg,
TemplateFunctionSelectArg,
TemplateFunctionTextArg,
} from '@yaakapp/api';
} from '@yaakapp-internal/plugin';
import type { FnArg, Tokens } from '@yaakapp-internal/template';
import { useCallback, useMemo, useState } from 'react';
import type { FnArg } from '../gen/FnArg';
import type { Tokens } from '../gen/Tokens';
import { useActiveRequest } from '../hooks/useActiveRequest';
import { useDebouncedValue } from '../hooks/useDebouncedValue';
import { useHttpRequests } from '../hooks/useHttpRequests';
@@ -62,8 +61,8 @@ export function TemplateFunctionDialog({ templateFunction, hide, initialTokens,
argValues[name] === NULL_ARG
? { type: 'null' }
: typeof argValues[name] === 'boolean'
? { type: 'bool', value: argValues[name] === true }
: { type: 'str', text: String(argValues[name] ?? '') },
? { type: 'bool', value: argValues[name] === true }
: { type: 'str', text: String(argValues[name] ?? '') },
}));
return {

View File

@@ -1,5 +1,5 @@
import type { Tokens } from '@yaakapp-internal/template';
import { useCallback, useMemo, useState } from 'react';
import type { Tokens } from '../gen/Tokens';
import { useActiveEnvironmentVariables } from '../hooks/useActiveEnvironmentVariables';
import { useRenderTemplate } from '../hooks/useRenderTemplate';
import { useTemplateTokensToString } from '../hooks/useTemplateTokensToString';

View File

@@ -1,7 +1,7 @@
import type { ShowToastRequest } from '@yaakapp-internal/plugin';
import { AnimatePresence } from 'framer-motion';
import type { ReactNode } from 'react';
import React, { createContext, useContext, useMemo, useRef, useState } from 'react';
import type { ShowToastRequest } from '@yaakapp/api';
import { useListenToTauriEvent } from '../hooks/useListenToTauriEvent';
import { generateId } from '../lib/generateId';
import type { ToastProps } from './core/Toast';

View File

@@ -3,7 +3,7 @@ import type { EditorView } from 'codemirror';
import type { FormEvent, ReactNode } from 'react';
import { memo, useRef, useState } from 'react';
import { useHotKey } from '../hooks/useHotKey';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import type { IconProps } from './core/Icon';
import { IconButton } from './core/IconButton';
import type { InputProps } from './core/Input';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { useRequestEditor, useRequestEditorEvent } from '../hooks/useRequestEditor';
import type { PairEditorRef } from './core/PairEditor';
import { PairOrBulkEditor } from './core/PairOrBulkEditor';

View File

@@ -2,7 +2,8 @@ import { defaultKeymap } from '@codemirror/commands';
import { forceParsing } from '@codemirror/language';
import { Compartment, EditorState, type Extension } from '@codemirror/state';
import { keymap, placeholder as placeholderExt, tooltips } from '@codemirror/view';
import type { EnvironmentVariable, TemplateFunction } from '@yaakapp/api';
import type { EnvironmentVariable } from '@yaakapp-internal/models';
import type { TemplateFunction } from '@yaakapp-internal/plugin';
import classNames from 'classnames';
import { EditorView } from 'codemirror';
import type { MutableRefObject, ReactNode } from 'react';

View File

@@ -31,7 +31,8 @@ import {
rectangularSelection,
} from '@codemirror/view';
import { tags as t } from '@lezer/highlight';
import type { EnvironmentVariable, TemplateFunction } from '@yaakapp/api';
import type { EnvironmentVariable } from '@yaakapp-internal/models';
import type { TemplateFunction } from '@yaakapp-internal/plugin';
import { graphql } from 'cm6-graphql';
import { EditorView } from 'codemirror';
import type { EditorProps } from './index';

View File

@@ -1,7 +1,8 @@
import type { LanguageSupport } from '@codemirror/language';
import { LRLanguage } from '@codemirror/language';
import { parseMixed } from '@lezer/common';
import type { EnvironmentVariable, TemplateFunction } from '@yaakapp/api';
import type { EnvironmentVariable } from '@yaakapp-internal/models';
import type { TemplateFunction } from '@yaakapp-internal/plugin';
import type { GenericCompletionConfig } from '../genericCompletion';
import { genericCompletion } from '../genericCompletion';
import { textLanguageName } from '../text/extension';

View File

@@ -1,5 +1,5 @@
import classNames from 'classnames';
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import type { GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
interface Props {
request: HttpRequest | GrpcRequest;
@@ -34,8 +34,8 @@ export function HttpMethodTag({ shortNames, request, className }: Props) {
request.model === 'http_request' && request.bodyType === 'graphql'
? 'GQL'
: request.model === 'grpc_request'
? 'GRPC'
: request.method;
? 'GRPC'
: request.method;
const m = method.toLowerCase();
const methodMap: Record<string, string> = shortNames ? shortMethodMap : longMethodMap;

View File

@@ -1,5 +1,5 @@
import classNames from 'classnames';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: Pick<HttpResponse, 'status' | 'statusReason' | 'error'>;

View File

@@ -1,4 +1,4 @@
import type { ShowToastRequest } from '@yaakapp/api';
import type { ShowToastRequest } from '@yaakapp-internal/plugin';
import classNames from 'classnames';
import { motion } from 'framer-motion';
import type { ReactNode } from 'react';

View File

@@ -1,6 +1,6 @@
import { convertFileSrc } from '@tauri-apps/api/core';
import React from 'react';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;

View File

@@ -1,5 +1,5 @@
import { useSaveResponse } from '../../hooks/useSaveResponse';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { getContentTypeHeader } from '../../lib/model_util';
import { Banner } from '../core/Banner';
import { Button } from '../core/Button';

View File

@@ -2,7 +2,7 @@ import classNames from 'classnames';
import Papa from 'papaparse';
import { useMemo } from 'react';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;

View File

@@ -1,4 +1,4 @@
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { useContentTypeFromHeaders } from '../../hooks/useContentTypeFromHeaders';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import { isJSON, languageFromContentType } from '../../lib/contentType';

View File

@@ -1,7 +1,7 @@
import { convertFileSrc } from '@tauri-apps/api/core';
import classNames from 'classnames';
import { useState } from 'react';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;

View File

@@ -1,6 +1,6 @@
import classNames from 'classnames';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { JsonAttributeTree } from '../core/JsonAttributeTree';
interface Props {

View File

@@ -6,7 +6,7 @@ import type { PDFDocumentProxy } from 'pdfjs-dist';
import React, { useRef, useState } from 'react';
import { Document, Page } from 'react-pdf';
import { useDebouncedState } from '../../hooks/useDebouncedState';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import './PdfViewer.css';
interface Props {

View File

@@ -1,4 +1,4 @@
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import classNames from 'classnames';
import type { ReactNode } from 'react';
import { useCallback, useMemo } from 'react';
@@ -161,8 +161,8 @@ export function TextViewer({ response, pretty, className }: Props) {
pretty && language === 'json'
? tryFormatJson(rawBody.data)
: pretty && (language === 'xml' || language === 'html')
? tryFormatXml(rawBody.data)
: rawBody.data;
? tryFormatXml(rawBody.data)
: rawBody.data;
let body;
if (isSearching && filterText?.length > 0) {

View File

@@ -1,6 +1,6 @@
import { convertFileSrc } from '@tauri-apps/api/core';
import React from 'react';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;

View File

@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;

View File

@@ -1,4 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Val } from "./Val";
export type FnArg = { name: string, value: Val, };

View File

@@ -1,4 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Val } from "./Val";
export type Token = { "type": "raw", text: string, } | { "type": "tag", val: Val, } | { "type": "eof" };

View File

@@ -1,4 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Token } from "./Token";
export type Tokens = { tokens: Array<Token>, };

View File

@@ -1,4 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { FnArg } from "./FnArg";
export type Val = { "type": "str", text: string, } | { "type": "var", name: string, } | { "type": "bool", value: boolean, } | { "type": "fn", name: string, args: Array<FnArg>, } | { "type": "null" };

View File

@@ -1,4 +1,4 @@
import type { EnvironmentVariable } from '@yaakapp/api';
import type { EnvironmentVariable } from '@yaakapp-internal/models';
import { useMemo } from 'react';
import { useActiveEnvironment } from './useActiveEnvironment';
import { useActiveWorkspace } from './useActiveWorkspace';

View File

@@ -1,4 +1,4 @@
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import type { GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
import { useActiveRequestId } from './useActiveRequestId';
import { useRequests } from './useRequests';

View File

@@ -1,4 +1,4 @@
import type { Workspace } from '@yaakapp/api';
import type { Workspace } from '@yaakapp-internal/models';
import { useMemo } from 'react';
import { useParams } from 'react-router-dom';
import type { RouteParamsWorkspace } from './useAppRoutes';

View File

@@ -1,4 +1,4 @@
import type { Environment } from '@yaakapp/api';
import type { Environment } from '@yaakapp-internal/models';
import { useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { QUERY_COOKIE_JAR_ID } from './useActiveCookieJar';

View File

@@ -1,4 +1,4 @@
import type { HttpResponseHeader } from '@yaakapp/api';
import type { HttpResponseHeader } from '@yaakapp-internal/models';
import { useMemo } from 'react';
export function useContentTypeFromHeaders(headers: HttpResponseHeader[] | null): string | null {

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { CookieJar } from '@yaakapp/api';
import type { CookieJar } from '@yaakapp-internal/models';
import { invokeCmd } from '../lib/tauri';
import { useActiveWorkspace } from './useActiveWorkspace';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { useCopy } from './useCopy';
import { getResponseBodyText } from '../lib/responseBody';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { CookieJar } from '@yaakapp/api';
import type { CookieJar } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveWorkspace } from './useActiveWorkspace';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Environment } from '@yaakapp/api';
import type { Environment } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveEnvironment } from './useActiveEnvironment';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Folder } from '@yaakapp/api';
import type { Folder } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveWorkspace } from './useActiveWorkspace';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { GrpcRequest } from '@yaakapp/api';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveEnvironment } from './useActiveEnvironment';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveEnvironment } from './useActiveEnvironment';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Workspace } from '@yaakapp/api';
import type { Workspace } from '@yaakapp-internal/models';
import { invokeCmd } from '../lib/tauri';
import { useAppRoutes } from './useAppRoutes';
import { usePrompt } from './usePrompt';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { GrpcRequest } from '@yaakapp/api';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { trackEvent } from '../lib/analytics';
import { fallbackRequestName } from '../lib/fallbackRequestName';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { trackEvent } from '../lib/analytics';
import { fallbackRequestName } from '../lib/fallbackRequestName';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { CookieJar } from '@yaakapp/api';
import type { CookieJar } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Environment } from '@yaakapp/api';
import type { Environment } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Folder } from '@yaakapp/api';
import type { Folder } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { trackEvent } from '../lib/analytics';
import { getFolder } from '../lib/store';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { GrpcConnection } from '@yaakapp/api';
import type { GrpcConnection } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Workspace } from '@yaakapp/api';
import type { Workspace } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { GrpcRequest } from '@yaakapp/api';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveEnvironment } from './useActiveEnvironment';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveEnvironment } from './useActiveEnvironment';

View File

@@ -1,4 +1,4 @@
import type { Environment } from '@yaakapp/api';
import type { Environment } from '@yaakapp-internal/models';
import { atom, useAtom } from 'jotai/index';
import { useEffect } from 'react';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { FilterResponse } from '@yaakapp/api';
import type { FilterResponse } from '@yaakapp-internal/plugin';
import { invokeCmd } from '../lib/tauri';
export function useFilterResponse({

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { Folder } from '@yaakapp/api';
import type { Folder } from '@yaakapp-internal/models';
import { invokeCmd } from '../lib/tauri';
import { useActiveWorkspace } from './useActiveWorkspace';

View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery } from '@tanstack/react-query';
import { emit } from '@tauri-apps/api/event';
import type { GrpcConnection, GrpcRequest } from '@yaakapp/api';
import type { GrpcConnection, GrpcRequest } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { minPromiseMillis } from '../lib/minPromiseMillis';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { GrpcConnection } from '@yaakapp/api';
import type { GrpcConnection } from '@yaakapp-internal/models';
import { invokeCmd } from '../lib/tauri';
export function grpcConnectionsQueryKey({ requestId }: { requestId: string }) {

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { GrpcEvent } from '@yaakapp/api';
import type { GrpcEvent } from '@yaakapp-internal/models';
import { invokeCmd } from '../lib/tauri';
export function grpcEventsQueryKey({ connectionId }: { connectionId: string }) {

View File

@@ -1,4 +1,4 @@
import type { GrpcRequest } from '@yaakapp/api';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { useGrpcRequests } from './useGrpcRequests';
export function useGrpcRequest(id: string | null): GrpcRequest | null {

View File

@@ -1,4 +1,4 @@
import type { GrpcRequest } from '@yaakapp/api';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { atom, useAtom } from 'jotai';
import { useEffect } from 'react';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { useHttpRequests } from './useHttpRequests';
export function useHttpRequest(id: string | null): HttpRequest | null {

View File

@@ -1,9 +1,9 @@
import { useQuery } from '@tanstack/react-query';
import type { HttpRequest } from '@yaakapp-internal/models';
import type {
CallHttpRequestActionRequest,
GetHttpRequestActionsResponse,
HttpRequest,
} from '@yaakapp/api';
} from '@yaakapp-internal/plugin';
import { invokeCmd } from '../lib/tauri';
import { usePluginsKey } from './usePlugins';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import { atom, useAtom } from 'jotai';
import { useEffect } from 'react';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { invokeCmd } from '../lib/tauri';
export function httpResponsesQueryKey({ requestId }: { requestId: string }) {

View File

@@ -1,5 +1,11 @@
import { useMutation } from '@tanstack/react-query';
import type { Environment, Folder, GrpcRequest, HttpRequest, Workspace } from '@yaakapp/api';
import type {
Environment,
Folder,
GrpcRequest,
HttpRequest,
Workspace,
} from '@yaakapp-internal/models';
import { Button } from '../components/core/Button';
import { FormattedError } from '../components/core/FormattedError';
import { VStack } from '../components/core/Stacks';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpUrlParameter } from '@yaakapp/api';
import type { HttpUrlParameter } from '@yaakapp-internal/models';
import { useToast } from '../components/ToastContext';
import { pluralize } from '../lib/pluralize';
import { getHttpRequest } from '../lib/store';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest } from '@yaakapp/api';
import type { HttpRequest } from '@yaakapp-internal/models';
import type { IntrospectionQuery } from 'graphql';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { buildClientSchema, getIntrospectionQuery } from '../components/core/Editor';

View File

@@ -1,4 +1,4 @@
import type { GrpcConnection } from '@yaakapp/api';
import type { GrpcConnection } from '@yaakapp-internal/models';
import { useGrpcConnections } from './useGrpcConnections';
export function useLatestGrpcConnection(requestId: string | null): GrpcConnection | null {

View File

@@ -1,4 +1,4 @@
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { useHttpResponses } from './useHttpResponses';
export function useLatestHttpResponse(requestId: string | null): HttpResponse | null {

View File

@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import type { Tokens } from '../gen/Tokens';
import { invokeCmd } from '../lib/tauri';
import type { Tokens } from '@yaakapp-internal/template';
export function useParseTemplate(template: string) {
return useQuery<Tokens>({

View File

@@ -1,4 +1,4 @@
import type { GrpcConnection, GrpcRequest } from '@yaakapp/api';
import type { GrpcConnection, GrpcRequest } from '@yaakapp-internal/models';
import { useGrpcConnections } from './useGrpcConnections';
import { useKeyValue } from './useKeyValue';
import { useLatestGrpcConnection } from './useLatestGrpcConnection';

View File

@@ -1,4 +1,4 @@
import type { HttpRequest, HttpResponse } from '@yaakapp/api';
import type { HttpRequest, HttpResponse } from '@yaakapp-internal/models';
import { useHttpResponses } from './useHttpResponses';
import { useKeyValue } from './useKeyValue';
import { useLatestHttpResponse } from './useLatestHttpResponse';

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { BootResponse } from '@yaakapp/api';
import type { BootResponse } from '@yaakapp-internal/plugin';
import { invokeCmd } from '../lib/tauri';
export function usePluginInfo(id: string) {

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { Plugin } from '@yaakapp/api';
import type { Plugin } from '@yaakapp-internal/models';
import { atom, useAtomValue, useSetAtom } from 'jotai';
import { minPromiseMillis } from '../lib/minPromiseMillis';
import { listPlugins } from '../lib/store';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import type { GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
import { InlineCode } from '../components/core/InlineCode';
import { usePrompt } from './usePrompt';
import { useRequests } from './useRequests';

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { getResponseBodyBlob } from '../lib/responseBody';
export function useResponseBodyBlob(response: HttpResponse) {

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { getResponseBodyText } from '../lib/responseBody';
export function useResponseBodyText(response: HttpResponse) {

View File

@@ -4,7 +4,7 @@ import mime from 'mime';
import slugify from 'slugify';
import { InlineCode } from '../components/core/InlineCode';
import { useToast } from '../components/ToastContext';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { getContentTypeHeader } from '../lib/model_util';
import { getHttpRequest } from '../lib/store';
import { invokeCmd } from '../lib/tauri';

View File

@@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import type { HttpResponse } from '@yaakapp/api';
import type { HttpResponse } from '@yaakapp-internal/models';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
import { useActiveCookieJar } from './useActiveCookieJar';

Some files were not shown because too many files have changed in this diff Show More