@kingsleyweb/bun-ui 3.0.0-rc.1 → 3.0.0-rc.2
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/docs/assets/main-0rchxtv5.js +18 -0
- package/dist/docs/assets/{main-pgxtmtja.js.map → main-0rchxtv5.js.map} +1 -1
- package/dist/docs/manifest.json +5 -5
- package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js +6 -0
- package/dist/jobs/assets/{AddFlowDialog-0ec5ff4r.js.map → AddFlowDialog-h6xkgx9b.js.map} +1 -1
- package/dist/jobs/assets/added-cbwsxv3e.js +4 -0
- package/dist/jobs/assets/{added-ma7xb2dx.js.map → added-cbwsxv3e.js.map} +1 -1
- package/dist/jobs/assets/{channel-a5chwqet.js → channel-tgkvqm8y.js} +3 -3
- package/dist/jobs/assets/{channel-a5chwqet.js.map → channel-tgkvqm8y.js.map} +1 -1
- package/dist/jobs/assets/{channelChecks-1epbhv9a.js → channelChecks-s4yz4yhw.js} +3 -3
- package/dist/jobs/assets/{channelChecks-1epbhv9a.js.map → channelChecks-s4yz4yhw.js.map} +1 -1
- package/dist/jobs/assets/index-09z2cjft.js +4 -0
- package/dist/jobs/assets/{index-m7zk18cj.js.map → index-09z2cjft.js.map} +1 -1
- package/dist/jobs/assets/index-47pxmyxn.js +4 -0
- package/dist/jobs/assets/{index-c7qk888t.js.map → index-47pxmyxn.js.map} +1 -1
- package/dist/jobs/assets/index-4e55z986.js +4 -0
- package/dist/jobs/assets/{index-7kbae3pm.js.map → index-4e55z986.js.map} +1 -1
- package/dist/jobs/assets/index-5c933424.js +4 -0
- package/dist/jobs/assets/{index-xfq292gs.js.map → index-5c933424.js.map} +1 -1
- package/dist/jobs/assets/index-d5r5n0mm.js +4 -0
- package/dist/jobs/assets/{index-j3h4v03g.js.map → index-d5r5n0mm.js.map} +3 -3
- package/dist/jobs/assets/index-hs60b25v.js +10 -0
- package/dist/jobs/assets/{index-y5zw06cs.js.map → index-hs60b25v.js.map} +1 -1
- package/dist/jobs/assets/index-k2smrr70.js +4 -0
- package/dist/jobs/assets/{index-de1fgbgf.js.map → index-k2smrr70.js.map} +1 -1
- package/dist/jobs/assets/index-q24jw3w9.js +4 -0
- package/dist/jobs/assets/{index-pjtmzrcd.js.map → index-q24jw3w9.js.map} +1 -1
- package/dist/jobs/assets/index-rtynx6wj.js +4 -0
- package/dist/jobs/assets/{index-mykmd5cv.js.map → index-rtynx6wj.js.map} +1 -1
- package/dist/jobs/assets/{live-erz9pvnm.js → live-6k7s6358.js} +3 -3
- package/dist/jobs/assets/{live-erz9pvnm.js.map → live-6k7s6358.js.map} +1 -1
- package/dist/jobs/assets/{main-smabxbn4.js → main-0jmeh6mq.js} +4 -4
- package/dist/jobs/assets/{main-smabxbn4.js.map → main-0jmeh6mq.js.map} +1 -1
- package/dist/jobs/assets/main-3yj6bv90.js +5 -0
- package/dist/jobs/assets/{main-yg6scp84.js.map → main-3yj6bv90.js.map} +1 -1
- package/dist/jobs/assets/main-4g69fn3x.js +5 -0
- package/dist/jobs/assets/{main-v2f8a4g3.js.map → main-4g69fn3x.js.map} +1 -1
- package/dist/jobs/assets/{main-e8zsqez2.js → main-4gte3eqq.js} +4 -4
- package/dist/jobs/assets/{main-e8zsqez2.js.map → main-4gte3eqq.js.map} +1 -1
- package/dist/jobs/assets/{main-zk3n47nq.js → main-4j1fcevh.js} +3 -3
- package/dist/jobs/assets/{main-zk3n47nq.js.map → main-4j1fcevh.js.map} +1 -1
- package/dist/jobs/assets/main-5grjvsy7.js +5 -0
- package/dist/jobs/assets/{main-3xxhy5jh.js.map → main-5grjvsy7.js.map} +1 -1
- package/dist/jobs/assets/{main-gzppw8ng.js → main-5zbx60gq.js} +3 -3
- package/dist/jobs/assets/{main-gzppw8ng.js.map → main-5zbx60gq.js.map} +1 -1
- package/dist/jobs/assets/{main-zx20z2e9.js → main-9prgjhg4.js} +4 -4
- package/dist/jobs/assets/{main-zx20z2e9.js.map → main-9prgjhg4.js.map} +1 -1
- package/dist/jobs/assets/main-a250ffk7.js +17 -0
- package/dist/jobs/assets/{main-xf44bv26.js.map → main-a250ffk7.js.map} +4 -4
- package/dist/jobs/assets/{main-qahvywvw.js → main-d6ge7w08.js} +4 -4
- package/dist/jobs/assets/{main-qahvywvw.js.map → main-d6ge7w08.js.map} +1 -1
- package/dist/jobs/assets/{main-kjywj2zd.js → main-gngzht43.js} +3 -3
- package/dist/jobs/assets/{main-kjywj2zd.js.map → main-gngzht43.js.map} +1 -1
- package/dist/jobs/assets/main-hg0hrg8j.js +5 -0
- package/dist/jobs/assets/{main-yjykmsvp.js.map → main-hg0hrg8j.js.map} +1 -1
- package/dist/jobs/assets/main-hm1ng3yg.js +5 -0
- package/dist/jobs/assets/{main-9qd3nqs5.js.map → main-hm1ng3yg.js.map} +1 -1
- package/dist/jobs/assets/main-jkvd92z9.js +5 -0
- package/dist/jobs/assets/{main-fcq7hfk0.js.map → main-jkvd92z9.js.map} +1 -1
- package/dist/jobs/assets/main-jv5xqd13.js +5 -0
- package/dist/jobs/assets/{main-grcj8v1z.js.map → main-jv5xqd13.js.map} +7 -7
- package/dist/jobs/assets/main-jxre7w93.js +5 -0
- package/dist/jobs/assets/{main-47391fgm.js.map → main-jxre7w93.js.map} +4 -4
- package/dist/jobs/assets/{main-b35rfpdf.js → main-kwmqkjfx.js} +4 -4
- package/dist/jobs/assets/{main-b35rfpdf.js.map → main-kwmqkjfx.js.map} +1 -1
- package/dist/jobs/assets/main-n9cf6bxm.js +5 -0
- package/dist/jobs/assets/{main-vargz49c.js.map → main-n9cf6bxm.js.map} +1 -1
- package/dist/jobs/assets/{main-6xdkyzv1.js → main-pegp0ygb.js} +2 -2
- package/dist/jobs/assets/{main-2n5wnj51.js → main-qr573853.js} +3 -3
- package/dist/jobs/assets/{main-2n5wnj51.js.map → main-qr573853.js.map} +1 -1
- package/dist/jobs/assets/main-rq97rdr4.js +4 -0
- package/dist/jobs/assets/{main-7jzem39c.js.map → main-rq97rdr4.js.map} +1 -1
- package/dist/jobs/assets/main-szjdmydc.js +5 -0
- package/dist/jobs/assets/{main-pqke97qp.js.map → main-szjdmydc.js.map} +1 -1
- package/dist/jobs/assets/{main-jex4pqaa.js → main-tnbhrm9n.js} +5 -5
- package/dist/jobs/assets/{main-jex4pqaa.js.map → main-tnbhrm9n.js.map} +1 -1
- package/dist/jobs/assets/main-ts19j4n0.js +5 -0
- package/dist/jobs/assets/{main-eekxtm5w.js.map → main-ts19j4n0.js.map} +1 -1
- package/dist/jobs/assets/{main-fn8r2zyb.js → main-w93x1dzs.js} +4 -4
- package/dist/jobs/assets/{main-fn8r2zyb.js.map → main-w93x1dzs.js.map} +1 -1
- package/dist/jobs/assets/sections-0y7w4fb4.js +4 -0
- package/dist/jobs/assets/{sections-b570mm22.js.map → sections-0y7w4fb4.js.map} +1 -1
- package/dist/jobs/assets/{sse-42e8mhar.js → sse-mn0t0fh7.js} +4 -4
- package/dist/jobs/assets/{sse-42e8mhar.js.map → sse-mn0t0fh7.js.map} +1 -1
- package/dist/jobs/assets/{sseChecks-0jskzcs1.js → sseChecks-t7tcm7ra.js} +3 -3
- package/dist/jobs/assets/{sseChecks-0jskzcs1.js.map → sseChecks-t7tcm7ra.js.map} +1 -1
- package/dist/jobs/assets/validation-ysjfy072.js +4 -0
- package/dist/jobs/assets/{validation-199pberh.js.map → validation-ysjfy072.js.map} +1 -1
- package/dist/jobs/manifest.json +213 -213
- package/package.json +10 -6
- package/dist/docs/assets/main-pgxtmtja.js +0 -18
- package/dist/jobs/assets/AddFlowDialog-0ec5ff4r.js +0 -6
- package/dist/jobs/assets/added-ma7xb2dx.js +0 -4
- package/dist/jobs/assets/index-7kbae3pm.js +0 -4
- package/dist/jobs/assets/index-c7qk888t.js +0 -4
- package/dist/jobs/assets/index-de1fgbgf.js +0 -4
- package/dist/jobs/assets/index-j3h4v03g.js +0 -4
- package/dist/jobs/assets/index-m7zk18cj.js +0 -4
- package/dist/jobs/assets/index-mykmd5cv.js +0 -4
- package/dist/jobs/assets/index-pjtmzrcd.js +0 -4
- package/dist/jobs/assets/index-xfq292gs.js +0 -4
- package/dist/jobs/assets/index-y5zw06cs.js +0 -10
- package/dist/jobs/assets/main-3xxhy5jh.js +0 -5
- package/dist/jobs/assets/main-47391fgm.js +0 -5
- package/dist/jobs/assets/main-7jzem39c.js +0 -4
- package/dist/jobs/assets/main-9qd3nqs5.js +0 -5
- package/dist/jobs/assets/main-eekxtm5w.js +0 -5
- package/dist/jobs/assets/main-fcq7hfk0.js +0 -5
- package/dist/jobs/assets/main-grcj8v1z.js +0 -5
- package/dist/jobs/assets/main-pqke97qp.js +0 -5
- package/dist/jobs/assets/main-v2f8a4g3.js +0 -5
- package/dist/jobs/assets/main-vargz49c.js +0 -5
- package/dist/jobs/assets/main-xf44bv26.js +0 -17
- package/dist/jobs/assets/main-yg6scp84.js +0 -5
- package/dist/jobs/assets/main-yjykmsvp.js +0 -5
- package/dist/jobs/assets/sections-b570mm22.js +0 -4
- package/dist/jobs/assets/validation-199pberh.js +0 -4
- /package/dist/jobs/assets/{main-6xdkyzv1.js.map → main-pegp0ygb.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{g,
|
|
1
|
+
import{g,b,J,te}from"./main-a250ffk7.js";import{On}from"./main-hm1ng3yg.js";function Ir(e){let s={};for(let n of e){let a=n.path===""?n.target:n.path;if(!(a in s))s[a]=n.message}return s}function u(e){return e.target==="body"}function d(e){return b(e)&&e.code==="VALIDATION"?e.issues:[]}function R(e){let s=d(e);return s.length>0&&s.every(u)}function w(e){return`${e.target}${e.path?`.${e.path}`:""} ${e.message}`}function O({mutationFn:e,successMessage:s,invalidate:n,errorTitle:a,toastErrors:f=!0,onSuccess:m,onError:y,...D}){let M=J(),l=te(),p=On({...D,mutationFn:e,onSuccess:async(t,o)=>{let i=typeof n==="function"?n(t,o):n??[],r=typeof s==="function"?s(t,o):s;if(r)l.success(r);await m?.(t,o);for(let c of i)M.invalidateQueries({queryKey:c})},onError:async(t,o)=>{if(f&&!R(t))if(b(t)){let i=a??t.title,r=t.detail&&t.detail!==i?t.detail:void 0,c=d(t).filter((I)=>!u(I)).map(w).join("; ");l.error(i,{description:c||(a&&!r?t.title:r)})}else l.error(a??"Something went wrong",{description:t.message||void 0});await y?.(t,o)}}),{error:T}=p,{fieldErrors:E,unplacedIssues:V}=g(()=>{let t=d(T);return{fieldErrors:Ir(t.filter(u)),unplacedIssues:t.filter((o)=>!u(o))}},[T]);return{...p,fieldErrors:E,unplacedIssues:V}}
|
|
2
2
|
export{Ir,O};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=main-
|
|
4
|
+
//# debugId=85DBCF21D3B4A73064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=main-4j1fcevh.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type {\n QueryKey,\n UseMutationOptions,\n UseMutationResult,\n} from \"@tanstack/react-query\";\nimport type { ProblemIssueDto } from \"../api/types\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { isApiError } from \"../api/errors\";\nimport { useToast } from \"../components/toast\";\n\n/** Field errors of a failed form submit: issue path (target stripped) → first message. */\nexport type FieldErrors = Record<string, string>;\n\n/**\n * Turns `VALIDATION` issues into a field → message map. The key is the\n * issue's path within its target, so `body.opts.delay` is `\"opts.delay\"`\n * and a root-level `body` issue (empty path) is `\"body\"`. The first issue\n * per key wins.\n */\nexport function issuesToFieldErrors(\n issues: readonly ProblemIssueDto[],\n): FieldErrors {\n const errors: FieldErrors = {};\n for (const issue of issues) {\n const key = issue.path === \"\" ? issue.target : issue.path;\n if (!(key in errors)) {\n errors[key] = issue.message;\n }\n }\n return errors;\n}\n\n/**\n * Whether an issue can be shown beside a form input: it is about the\n * request body, which every form's fields are sent in. Issues on `params`,\n * `query`, `headers`, `cookies` or `signedCookies` name nothing a form edits\n * (the one mutation with a query, `expectedSeq`, is not a field), so they are\n * {@link UseApiMutationResult.unplacedIssues} instead.\n */\nfunction isFieldIssue(issue: ProblemIssueDto): boolean {\n return issue.target === \"body\";\n}\n\n/** A `VALIDATION` problem's issues, or `[]` for any other error. */\nfunction validationIssues(error: unknown): readonly ProblemIssueDto[] {\n return isApiError(error) && error.code === \"VALIDATION\" ? error.issues : [];\n}\n\n/** Whether an error is a `VALIDATION` problem whose issues are all shown as field errors (so it is not toasted). */\nfunction isFieldValidation(error: unknown): boolean {\n const issues = validationIssues(error);\n return issues.length > 0 && issues.every(isFieldIssue);\n}\n\n/** An issue as one line of text, as the problem banner shows it: `cookies.session Required`. */\nfunction issueText(issue: ProblemIssueDto): string {\n return `${issue.target}${issue.path ? `.${issue.path}` : \"\"} ${issue.message}`;\n}\n\n/** Options of {@link useApiMutation}. */\nexport interface UseApiMutationOptions<\n TData,\n TVariables,\n TOnMutateResult = unknown,\n> extends Omit<\n UseMutationOptions<TData, Error, TVariables, TOnMutateResult>,\n \"mutationFn\" | \"onSuccess\" | \"onError\"\n> {\n /** The request, usually an `ApiClient` call; it rejects with an `ApiError`. */\n mutationFn: (variables: TVariables) => Promise<TData>;\n /** A success toast: a fixed message, or one built from the result (return `null` for none). No toast when omitted. */\n successMessage?:\n | string\n | ((data: TData, variables: TVariables) => string | null | undefined);\n /** Query keys to invalidate on success (prefix match, as TanStack does), or a function choosing them from the result. */\n invalidate?:\n | readonly QueryKey[]\n | ((data: TData, variables: TVariables) => readonly QueryKey[]);\n /** The error toast's headline, e.g. \"Could not pause queue\". Defaults to the problem's title. */\n errorTitle?: string;\n /** Toast failures (other than field validation). Defaults to `true`; turn off when the screen shows the error itself. */\n toastErrors?: boolean;\n /** Runs after a success, after invalidation has started. */\n onSuccess?: (data: TData, variables: TVariables) => unknown;\n /** Runs after a failure (including a validation failure). */\n onError?: (error: Error, variables: TVariables) => unknown;\n}\n\n/** What {@link useApiMutation} returns: TanStack's mutation, plus the field errors. */\nexport type UseApiMutationResult<\n TData,\n TVariables,\n TOnMutateResult = unknown,\n> = UseMutationResult<TData, Error, TVariables, TOnMutateResult> & {\n /** From the last failure's `VALIDATION` issues on the body (see {@link issuesToFieldErrors}); `{}` otherwise. Cleared by the next `mutate` or `reset`. */\n fieldErrors: FieldErrors;\n /**\n * The last failure's `VALIDATION` issues that no form field shows: those\n * not on the body, e.g. a host's own cookie check in front of the API.\n * `[]` otherwise. A screen that hides its banner while there are field\n * errors still shows it when this is non-empty, or they are shown nowhere.\n */\n unplacedIssues: readonly ProblemIssueDto[];\n};\n\n/**\n * TanStack's `useMutation` with the app's conventions: on success it toasts\n * `successMessage` and invalidates `invalidate`; on failure it toasts the\n * problem's title and detail, except a `VALIDATION` problem whose issues\n * are all on the body, which becomes `fieldErrors` for the form to show\n * beside its inputs. Issues on anything else are `unplacedIssues`, and are\n * listed in the toast.\n */\nexport function useApiMutation<\n TData,\n TVariables = void,\n TOnMutateResult = unknown,\n>({\n mutationFn,\n successMessage,\n invalidate,\n errorTitle,\n toastErrors = true,\n onSuccess,\n onError,\n ...options\n}: UseApiMutationOptions<\n TData,\n TVariables,\n TOnMutateResult\n>): UseApiMutationResult<TData, TVariables, TOnMutateResult> {\n const queryClient = useQueryClient();\n const toast = useToast();\n const mutation = useMutation<TData, Error, TVariables, TOnMutateResult>({\n ...options,\n mutationFn,\n onSuccess: async (data, variables) => {\n const keys =\n typeof invalidate === \"function\"\n ? invalidate(data, variables)\n : (invalidate ?? []);\n const message =\n typeof successMessage === \"function\"\n ? successMessage(data, variables)\n : successMessage;\n if (message) {\n toast.success(message);\n }\n await onSuccess?.(data, variables);\n // Not awaited: the mutation settles now; the refetches follow.\n for (const queryKey of keys) {\n void queryClient.invalidateQueries({ queryKey });\n }\n },\n onError: async (error, variables) => {\n if (toastErrors && !isFieldValidation(error)) {\n if (isApiError(error)) {\n const title = errorTitle ?? error.title;\n const detail =\n error.detail && error.detail !== title ? error.detail : undefined;\n const unplaced = validationIssues(error)\n .filter((issue) => !isFieldIssue(issue))\n .map(issueText)\n .join(\"; \");\n toast.error(title, {\n description:\n unplaced || (errorTitle && !detail ? error.title : detail),\n });\n } else {\n toast.error(errorTitle ?? \"Something went wrong\", {\n description: error.message || undefined,\n });\n }\n }\n await onError?.(error, variables);\n },\n });\n const { error } = mutation;\n const { fieldErrors, unplacedIssues } = useMemo(() => {\n const issues = validationIssues(error);\n return {\n fieldErrors: issuesToFieldErrors(issues.filter(isFieldIssue)),\n unplacedIssues: issues.filter((issue) => !isFieldIssue(issue)),\n };\n }, [error]);\n return { ...mutation, fieldErrors, unplacedIssues };\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "4EAoBO,SAAS,EAAmB,CACjC,EACa,CACb,IAAM,EAAsB,CAAC,EAC7B,QAAW,KAAS,EAAQ,CAC1B,IAAM,EAAM,EAAM,OAAS,GAAK,EAAM,OAAS,EAAM,KACrD,GAAI,EAAE,KAAO,GACX,EAAO,GAAO,EAAM,QAGxB,OAAO,EAUT,SAAS,CAAY,CAAC,EAAiC,CACrD,OAAO,EAAM,SAAW,OAI1B,SAAS,CAAgB,CAAC,EAA4C,CACpE,OAAO,EAAW,CAAK,GAAK,EAAM,OAAS,aAAe,EAAM,OAAS,CAAC,EAI5E,SAAS,CAAiB,CAAC,EAAyB,CAClD,IAAM,EAAS,EAAiB,CAAK,EACrC,OAAO,EAAO,OAAS,GAAK,EAAO,MAAM,CAAY,EAIvD,SAAS,CAAS,CAAC,EAAgC,CACjD,MAAO,GAAG,EAAM,SAAS,EAAM,KAAO,IAAI,EAAM,OAAS,MAAM,EAAM,UAyDhE,SAAS,CAIf,EACC,aACA,iBACA,aACA,aACA,cAAc,GACd,YACA,aACG,GAKwD,CAC3D,IAAM,EAAc,EAAe,EAC7B,EAAQ,GAAS,EACjB,EAAW,GAAuD,IACnE,EACH,aACA,UAAW,MAAO,EAAM,IAAc,CACpC,IAAM,EACJ,OAAO,IAAe,WAClB,EAAW,EAAM,CAAS,EACzB,GAAc,CAAC,EAChB,EACJ,OAAO,IAAmB,WACtB,EAAe,EAAM,CAAS,EAC9B,EACN,GAAI,EACF,EAAM,QAAQ,CAAO,EAEvB,MAAM,IAAY,EAAM,CAAS,EAEjC,QAAW,KAAY,EAChB,EAAY,kBAAkB,CAAE,UAAS,CAAC,GAGnD,QAAS,MAAO,EAAO,IAAc,CACnC,GAAI,GAAe,CAAC,EAAkB,CAAK,EACzC,GAAI,EAAW,CAAK,EAAG,CACrB,IAAM,EAAQ,GAAc,EAAM,MAC5B,EACJ,EAAM,QAAU,EAAM,SAAW,EAAQ,EAAM,OAAS,OACpD,EAAW,EAAiB,CAAK,EACpC,OAAO,CAAC,IAAU,CAAC,EAAa,CAAK,CAAC,EACtC,IAAI,CAAS,EACb,KAAK,IAAI,EACZ,EAAM,MAAM,EAAO,CACjB,YACE,IAAa,GAAc,CAAC,EAAS,EAAM,MAAQ,EACvD,CAAC,EACD,KACA,EAAM,MAAM,GAAc,uBAAwB,CAChD,YAAa,EAAM,SAAW,MAChC,CAAC,EAGL,MAAM,IAAU,EAAO,CAAS,EAEpC,CAAC,GACO,SAAU,GACV,cAAa,kBAAmB,EAAQ,IAAM,CACpD,IAAM,EAAS,EAAiB,CAAK,EACrC,MAAO,CACL,YAAa,GAAoB,EAAO,OAAO,CAAY,CAAC,EAC5D,eAAgB,EAAO,OAAO,CAAC,IAAU,CAAC,EAAa,CAAK,CAAC,CAC/D,GACC,CAAC,CAAK,CAAC,EACV,MAAO,IAAK,EAAU,cAAa,gBAAe",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "85DBCF21D3B4A73064756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{v,r,N,e,s}from"./main-a250ffk7.js";var c=1500;async function y(o){try{if(typeof navigator>"u"||!navigator.clipboard)return!1;return await navigator.clipboard.writeText(o),!0}catch{return!1}}var m="[Circular]";function g(o){let i=new WeakSet,a=(t)=>{if(typeof t==="bigint")return t.toString();if(typeof t==="function"||typeof t==="symbol")return;if(typeof t!=="object"||t===null)return t;if(i.has(t))return m;let u=t;if(typeof u.toJSON==="function")return a(u.toJSON.call(t));i.add(t);try{if(Array.isArray(t))return t.map((n)=>{let f=a(n);return f===void 0?null:f});let l={};for(let[n,f]of Object.entries(t)){let p=a(f);if(p!==void 0)l[n]=p}return l}finally{i.delete(t)}};return a(o)}function ns(o,i=2){return JSON.stringify(g(o),null,i)??"undefined"}function ge({text:o,label:i="Copy",ariaLabel:a,size:t="sm",className:u,onCopied:l}){let[n,f]=r("idle");v(()=>{if(n==="idle")return;let d=setTimeout(f,c,"idle");return()=>clearTimeout(d)},[n]);let p=async()=>{let d=await y(typeof o==="function"?o():o);f(d?"copied":"failed"),l?.(d)};return e(s,{variant:"ghost",size:t,className:N("copy-button",u),"aria-label":a,"data-status":n,onClick:()=>void p(),children:e("span",{"aria-live":"polite",children:n==="copied"?"Copied":n==="failed"?"Copy failed":i})})}
|
|
2
|
+
export{ns,ge};
|
|
3
|
+
|
|
4
|
+
//# debugId=2ABB7DE28FFACA5164756E2164756E21
|
|
5
|
+
//# sourceMappingURL=main-5grjvsy7.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { useEffect, useState } from \"react\";\nimport { Button } from \"./Button\";\nimport { cx } from \"./classNames\";\nimport { COPY_FEEDBACK_MS, copyText } from \"./copy\";\n\n/** Props of {@link CopyButton}. */\nexport interface CopyButtonProps {\n /** What to copy, or a function producing it on click (so a large payload is only serialised when asked). */\n text: string | (() => string);\n /** The button's visible text. Defaults to `\"Copy\"`. */\n label?: string;\n /** Accessible name when it differs from `label`, e.g. `\"Copy job id\"`. */\n ariaLabel?: string;\n /** Size. Defaults to `\"sm\"`. */\n size?: \"sm\" | \"md\";\n /** Extra class names. */\n className?: string;\n /** Called after each attempt with whether the clipboard write succeeded. */\n onCopied?: (ok: boolean) => void;\n}\n\n/**\n * Copies text to the clipboard and says so: the label turns into \"Copied\"\n * (or \"Copy failed\") for {@link COPY_FEEDBACK_MS}, announced politely.\n */\nexport function CopyButton({\n text,\n label = \"Copy\",\n ariaLabel,\n size = \"sm\",\n className,\n onCopied,\n}: CopyButtonProps) {\n const [status, setStatus] = useState<\"idle\" | \"copied\" | \"failed\">(\"idle\");\n\n useEffect(() => {\n if (status === \"idle\") {\n return;\n }\n const timer = setTimeout(setStatus, COPY_FEEDBACK_MS, \"idle\");\n return () => clearTimeout(timer);\n }, [status]);\n\n const onClick = async () => {\n const ok = await copyText(typeof text === \"function\" ? text() : text);\n setStatus(ok ? \"copied\" : \"failed\");\n onCopied?.(ok);\n };\n\n return (\n <Button\n variant=\"ghost\"\n size={size}\n className={cx(\"copy-button\", className)}\n aria-label={ariaLabel}\n data-status={status}\n onClick={() => void onClick()}\n >\n <span aria-live=\"polite\">\n {status === \"copied\"\n ? \"Copied\"\n : status === \"failed\"\n ? \"Copy failed\"\n : label}\n </span>\n </Button>\n );\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": "0CAMO,IAAM,EAAmB,KAOzB,eAAe,CAAQ,CAAC,EAAgC,CAC7D,GAAI,CACF,GAAI,OAAO,UAAc,KAAe,CAAC,UAAU,UACjD,MAAO,GAGT,OADA,MAAM,UAAU,UAAU,UAAU,CAAI,EACjC,GACP,KAAM,CACN,MAAO,IAKJ,IAAM,EAAkB,aAYxB,SAAS,CAAU,CAAC,EAAyB,CAClD,IAAM,EAAO,IAAI,QACX,EAAO,CAAC,IAA8B,CAC1C,GAAI,OAAO,IAAY,SACrB,OAAO,EAAQ,SAAS,EAE1B,GAAI,OAAO,IAAY,YAAc,OAAO,IAAY,SACtD,OAEF,GAAI,OAAO,IAAY,UAAY,IAAY,KAC7C,OAAO,EAET,GAAI,EAAK,IAAI,CAAO,EAClB,OAAO,EAET,IAAM,EAAW,EACjB,GAAI,OAAO,EAAS,SAAW,WAC7B,OAAO,EAAM,EAAS,OAAyB,KAAK,CAAO,CAAC,EAE9D,EAAK,IAAI,CAAO,EAChB,GAAI,CACF,G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r,or,X,Sn,tt,Ee,x,Pt,sr,ir,ar,ur,_n,lr}from"./main-a250ffk7.js";function O(i,e){let s=new Set(e);return i.filter((t)=>!s.has(t))}var Q=class extends Ee{#i;#e;#n;#t;#s;#r;#o;#u;#h;#c=[];constructor(i,e,s){super();this.#i=i,this.#t=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){if(this.listeners.size===1)this.#s.forEach((i)=>{i.subscribe((e)=>{this.#p(i,e)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach((i)=>{i.destroy()})}setQueries(i,e){this.#n=i,this.#t=e,x.batch(()=>{let s=this.#s,t=this.#f(this.#n);t.forEach((u)=>u.observer.setOptions(u.defaultedQueryOptions));let n=t.map((u)=>u.observer),o=n.map((u)=>u.getCurrentResult()),l=s.length!==n.length,c=n.some((u,d)=>u!==s[d]),a=l||c,b=a?!0:o.some((u,d)=>{let m=this.#e[d];return!m||!tt(u,m)});if(!a&&!b)return;if(a)this.#c=t,this.#s=n;if(this.#e=o,!this.hasListeners())return;if(a)O(s,n).forEach((u)=>{u.destroy()}),O(n,s).forEach((u)=>{u.subscribe((d)=>{this.#p(u,d)})});this.#d()})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map((i)=>i.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(i,e){let s=this.#f(i),t=s.map((o)=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),n=s.map((o)=>o.defaultedQueryOptions.queryHash);return[t,(o)=>this.#l(o??t,e,n),()=>this.#a(t,s)]}#a(i,e){let s=new Set;return e.map((t,n)=>{let o=i[n];return!t.defaultedQueryOptions.notifyOnChangeProps?t.observer.trackResult(o,(l)=>{if(!s.has(l))s.add(l),e.forEach((c)=>{c.observer.trackProp(l)})}):o})}#l(i,e,s){if(e){let t=this.#h,n=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((o,l)=>o!==t[l]));if(this.#e!==this.#u||n||e!==this.#o){if(this.#o=e,this.#u=this.#e,s!==void 0)this.#h=s;this.#r=Sn(this.#r,e(i))}return this.#r}return i}#b(){return!this.#t?.combine||this.#s.some((i,e)=>i.options.suspense&&this.#e[e]?.data===void 0)}#f(i){let e=new Map;this.#s.forEach((t)=>{let n=t.options.queryHash;if(!n)return;let o=e.get(n);if(o)o.push(t);else e.set(n,[t])});let s=[];return i.forEach((t)=>{let n=this.#i.defaultQueryOptions(t),o=e.get(n.queryHash)?.shift()??new Pt(this.#i,n);s.push({defaultedQueryOptions:n,observer:o})}),s}#p(i,e){let s=this.#s.indexOf(i);if(s!==-1)this.#e=this.#e.slice(),this.#e[s]=e,this.#d()}#d(){if(this.hasListeners()){let i=this.#b(),e=this.#r,s=i?e:this.#l(this.#a(this.#e,this.#c),this.#t?.combine);if(i||e!==s)x.batch(()=>{this.listeners.forEach((t)=>{t(this.#e)})})}}};function rn({queries:i,...e},s){let t=J(s),n=rr(),o=or(),l=e.subscribed!==!1,c=g(()=>i.map((h)=>{let f=t.defaultQueryOptions(h);return f._optimisticResults=n?"isRestoring":l?"optimistic":void 0,f}),[i,t,n,l]);c.forEach((h)=>{ur(h);let f=t.getQueryCache().get(h.queryHash);sr(h,o,f)}),ir(o);let[a]=r(()=>new Q(t,c,e)),[b,u,d]=a.getOptimisticResult(c,e.combine),m=!n&&l;Ae(C((h)=>m?a.subscribe(x.batchCalls(h)):X,[a,m]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),v(()=>{a.setQueries(c,e)},[c,e,a]);let y=b.some((h,f)=>_n(c[f],h))?b.flatMap((h,f)=>{let p=c[f];if(p&&_n(p,h)){let E=new Pt(t,p);return lr(p,E,o)}return[]}):[];if(y.length>0)throw Promise.all(y);let R=b.find((h,f)=>{let p=c[f];return p&&ar({result:h,errorResetBoundary:o,throwOnError:p.throwOnError,query:t.getQueryCache().get(p.queryHash),suspense:p.suspense})});if(R)throw R.error;return u(d())}
|
|
2
2
|
export{rn};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=main-
|
|
4
|
+
//# debugId=FE494B8581FB73F764756E2164756E21
|
|
5
|
+
//# sourceMappingURL=main-5zbx60gq.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary } from \"./errorBoundaryUtils.js\";\nimport { ensureSuspenseTimers, fetchOptimistic, shouldSuspend } from \"./suspense.js\";\nimport * as React from \"react\";\nimport { QueriesObserver, QueryObserver, noop, notifyManager } from \"@tanstack/query-core\";\n//#region src/useQueries.ts\n/**\n* The `useQueries` hook can be used to fetch a variable number of queries.\n*\n* The `queries` key accepts an array with query option objects mostly identical to `useQuery` — the top-level\n* `subscribed` option isn't accepted per query (see `placeholderData` below for another difference). A custom\n* `QueryClient` is supplied once, as `useQueries`' own top-level second argument, rather than per query.\n*\n* Having the same query key more than once in the array of query objects may cause some data to be shared\n* between queries. To avoid this, consider de-duplicating the queries and map the results back to the desired\n* structure.\n*\n* The `combine` option can be used to combine the results of the queries into a single value. The result will\n* be structurally shared to be as referentially stable as possible.\n*\n* @remarks The `combine` function only re-runs if it changed referentially, or if any of the query results\n* changed. An inlined `combine` function, as shown in the example below, therefore runs on every render — wrap\n* it in `useCallback`, or extract it to a stable function reference if it doesn't have any dependencies, to\n* avoid that.\n*\n* Unlike `useQuery`, `useQueries` cannot infer the `data` argument of an _inline_ `select` from its sibling\n* `queryFn`. Because `useQueries` infers the type of the whole `queries` array at once, the `select` parameter\n* of a query object written inline cannot be contextually typed from that same object's `queryFn`, so it falls\n* back to `unknown` — a [known TypeScript limitation](https://github.com/TanStack/query/issues/6556). Annotate\n* the `select` parameter explicitly, or define the query with {@link queryOptions}, which resolves its types in\n* a single object _before_ it reaches `useQueries`, to work around this — see the example below. The same\n* limitation applies to {@link useSuspenseQueries}.\n*\n* `placeholderData` is supported here too, but unlike `useQuery`, it doesn't receive information from\n* previously rendered queries, because the number of queries can differ between renders.\n* @param queryClient - Use this to provide a custom `QueryClient`. Otherwise, the one from the nearest context\n* will be used.\n* @returns The combined result. Without `combine`, this is an array with all the query results, in the same\n* order as the input. When `combine` is provided, this is the value returned by `combine` instead.\n*\n* @example\n* ```tsx\n* import { useQueries } from '@tanstack/react-query'\n*\n* function Posts({ ids }: { ids: Array<number> }) {\n* const postQueries = useQueries({\n* queries: ids.map((id) => ({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* staleTime: Infinity,\n* })),\n* })\n*\n* return (\n* <ul>\n* {postQueries.map((query, index) => {\n* if (query.isPending) return <li key={ids[index]}>Loading...</li>\n* if (query.isError) return <li key={ids[index]}>Error: {query.error.message}</li>\n* return <li key={ids[index]}>{query.data.title}</li>\n* })}\n* </ul>\n* )\n* }\n* ```\n*\n* @example\n* Combining results into a single value:\n* ```tsx\n* import { useQueries } from '@tanstack/react-query'\n*\n* function Posts({ ids }: { ids: Array<number> }) {\n* const { data, isPending, isError } = useQueries({\n* queries: ids.map((id) => ({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* })),\n* combine: (postQueries) => {\n* return {\n* data: postQueries.map((query) => query.data),\n* isPending: postQueries.some((query) => query.isPending),\n* isError: postQueries.some((query) => query.isError),\n* }\n* },\n* })\n*\n* if (isPending) return 'Loading...'\n* if (isError) return 'Error loading posts'\n*\n* return (\n* <ul>\n* {data.map((post) => (\n* <li key={post?.id}>{post?.title}</li>\n* ))}\n* </ul>\n* )\n* }\n* ```\n*\n* @example\n* Typing `select` via {@link queryOptions}. Note that spreading a `queryOptions` result and overriding\n* `select` inline still falls back to `unknown` — wrap the spread in `queryOptions` again so the override is\n* resolved before it reaches `useQueries`:\n* ```tsx\n* import { queryOptions, useQueries } from '@tanstack/react-query'\n*\n* const postOptions = (id: number) =>\n* queryOptions({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* })\n*\n* function PostTitle({ id }: { id: number }) {\n* const [{ data: broken }] = useQueries({\n* queries: [\n* {\n* ...postOptions(id),\n* // ❌ `data` is `unknown` here\n* select: (data) => data.title,\n* },\n* ],\n* })\n*\n* const [{ data: fixed }] = useQueries({\n* queries: [\n* queryOptions({\n* ...postOptions(id),\n* // ✅ `data` is `Post`\n* select: (data) => data.title,\n* }),\n* ],\n* })\n*\n* return <h1>{fixed}</h1>\n* }\n* ```\n*/\nfunction useQueries({ queries, ...options }, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst isRestoring = useIsRestoring();\n\tconst errorResetBoundary = useQueryErrorResetBoundary();\n\tconst subscribed = options.subscribed !== false;\n\tconst defaultedQueries = React.useMemo(() => queries.map((opts) => {\n\t\tconst defaultedOptions = client.defaultQueryOptions(opts);\n\t\tdefaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : subscribed ? \"optimistic\" : void 0;\n\t\treturn defaultedOptions;\n\t}), [\n\t\tqueries,\n\t\tclient,\n\t\tisRestoring,\n\t\tsubscribed\n\t]);\n\tdefaultedQueries.forEach((queryOptions) => {\n\t\tensureSuspenseTimers(queryOptions);\n\t\tconst query = client.getQueryCache().get(queryOptions.queryHash);\n\t\tensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query);\n\t});\n\tuseClearResetErrorBoundary(errorResetBoundary);\n\tconst [observer] = React.useState(() => new QueriesObserver(client, defaultedQueries, options));\n\tconst [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(defaultedQueries, options.combine);\n\tconst shouldSubscribe = !isRestoring && subscribed;\n\tReact.useSyncExternalStore(React.useCallback((onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tReact.useEffect(() => {\n\t\tobserver.setQueries(defaultedQueries, options);\n\t}, [\n\t\tdefaultedQueries,\n\t\toptions,\n\t\tobserver\n\t]);\n\tconst suspensePromises = optimisticResult.some((result, index) => shouldSuspend(defaultedQueries[index], result)) ? optimisticResult.flatMap((result, index) => {\n\t\tconst opts = defaultedQueries[index];\n\t\tif (opts && shouldSuspend(opts, result)) {\n\t\t\tconst queryObserver = new QueryObserver(client, opts);\n\t\t\treturn fetchOptimistic(opts, queryObserver, errorResetBoundary);\n\t\t}\n\t\treturn [];\n\t}) : [];\n\tif (suspensePromises.length > 0) throw Promise.all(suspensePromises);\n\tconst firstSingleResultWhichShouldThrow = optimisticResult.find((result, index) => {\n\t\tconst query = defaultedQueries[index];\n\t\treturn query && getHasError({\n\t\t\tresult,\n\t\t\terrorResetBoundary,\n\t\t\tthrowOnError: query.throwOnError,\n\t\t\tquery: client.getQueryCache().get(query.queryHash),\n\t\t\tsuspense: query.suspense\n\t\t});\n\t});\n\tif (firstSingleResultWhichShouldThrow) throw firstSingleResultWhichShouldThrow.error;\n\treturn getCombinedResult(trackResult());\n}\n//#endregion\nexport { useQueries };\n\n//# sourceMappingURL=useQueries.js.map"
|
|
7
7
|
],
|
|
8
8
|
"mappings": "qFAKA,SAAS,CAAU,CAAC,EAAQ,EAAQ,CACnC,IAAM,EAAa,IAAI,IAAI,CAAM,EACjC,OAAO,EAAO,OAAO,CAAC,IAAM,CAAC,EAAW,IAAI,CAAC,CAAC,EAqB/C,IAAI,EAAkB,cAAc,EAAa,CAChD,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GAAmB,CAAC,EACpB,WAAW,CAAC,EAAQ,EAAS,EAAS,CACrC,MAAM,EACN,KAAK,GAAU,EACf,KAAK,GAAW,EAChB,KAAK,GAAW,CAAC,EACjB,KAAK,GAAa,CAAC,EACnB,KAAK,GAAU,CAAC,EAChB,KAAK,WAAW,CAAO,EAExB,WAAW,EAAG,CACb,GAAI,KAAK,UAAU,OAAS,EAAG,KAAK,GAAW,QAAQ,CAAC,IAAa,CACpE,EAAS,UAA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AgB,EACnE,IAAM,EAAoC,EAAiB,KAAK,CAAC,EAAQ,IAAU,CAClF,IAAM,EAAQ,EAAiB,GAC/B,OAAO,GAAS,GAAY,CAC3B,SACA,qBACA,aAAc,EAAM,aACpB,MAAO,EAAO,cAAc,EAAE,IAAI,EAAM,SAAS,EACjD,SAAU,EAAM,QACjB,CAAC,EACD,EACD,GAAI,EAAmC,MAAM,EAAkC,MAC/E,OAAO,EAAkB,EAAY,CAAC",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "FE494B8581FB73F764756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{u}from"./main-a250ffk7.js";var o={ready:{label:"Ready",tone:"success",hint:"Its config is validated and it can summon."},pending:{label:"Pending",tone:"warning",hint:"Its config is still being validated. It can't summon yet, and what it declares appears once it's ready."},failed:{label:"Failed",tone:"danger",hint:"Its config was rejected, or building it threw. It can't summon until it's reconfigured; Test connection says why, where the provider has one."}};function pt(e){return typeof e==="string"&&Object.hasOwn(o,e)?o[e]:{label:u(e),tone:"neutral",hint:"A readiness this version of the UI does not know."}}var a={misconfigured:"Configuration problem: fix the provider's config.",auth:"Credentials problem: the platform refused them.",transient:"Platform trouble, for now: try again.",throttled:"The platform is throttling calls: try again later.",quota:"The platform's quota is used up.",conflict:"A bug in the provider: it gave conflicting answers."},s={pass:{label:"Pass",tone:"success"},warn:{label:"Warn",tone:"warning"},fail:{label:"Fail",tone:"danger"}};function d(e){return typeof e==="string"&&Object.hasOwn(a,e)?a[e]:`The preflight failed (${u(e)}).`}function rs(e){return typeof e==="string"&&Object.hasOwn(s,e)?s[e]:{label:u(e),tone:"neutral"}}function os(e){if(e.error!==void 0){let{kind:t,detail:n}=e.error;if(n==="timeout")return"No answer: the preflight timed out.";if(n.startsWith("invalid config: "))return`Configuration problem: invalid ${n.slice(16)}.`;return`${d(t)} (${u(n)})`}let i=e.checks.filter((t)=>t.status==="fail"),r=e.checks.filter((t)=>t.status==="warn");if(i.length>0)return`Connection failed: ${i.length} of ${e.checks.length} checks failed.`;if(r.length>0)return`Connected, with ${r.length} warning${r.length===1?"":"s"}.`;return e.checks.length===0?"Connected.":`Connected: all ${e.checks.length} checks passed.`}
|
|
2
|
+
export{pt,rs,os};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=main-
|
|
4
|
+
//# debugId=2E819A42228AE52E64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=main-9prgjhg4.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type { ProviderDto, ProviderValidationDto } from \"../../api/types\";\nimport type { BadgeTone } from \"../../components/Badge\";\nimport { displayText } from \"../../format\";\n\n/**\n * A compute provider in plain words: its readiness, and what \"Test\n * connection\" found.\n *\n * Each table is an exhaustive record of the values the contract lists, so a\n * value added there is a compile error here until it is named, and each\n * lookup shows a value this build does not know as its raw string.\n */\n\n/** A provider's readiness. */\nexport type ProviderReadiness = ProviderDto[\"readiness\"];\n\n/** The kind a failed preflight classifies as. */\nexport type ProviderErrorKind = NonNullable<\n ProviderValidationDto[\"error\"]\n>[\"kind\"];\n\n/** A check's status. */\nexport type ProviderCheckStatus =\n ProviderValidationDto[\"checks\"][number][\"status\"];\n\n/** How a readiness reads. */\ninterface ReadinessText {\n /** In plain words. */\n label: string;\n /** Its badge colour. */\n tone: BadgeTone;\n /** What it means. */\n hint: string;\n}\n\nconst READINESS: Readonly<Record<ProviderReadiness, ReadinessText>> = {\n ready: {\n label: \"Ready\",\n tone: \"success\",\n hint: \"Its config is validated and it can summon.\",\n },\n pending: {\n label: \"Pending\",\n tone: \"warning\",\n hint: \"Its config is still being validated. It can't summon yet, and what it declares appears once it's ready.\",\n },\n failed: {\n label: \"Failed\",\n tone: \"danger\",\n hint: \"Its config was rejected, or building it threw. It can't summon until it's reconfigured; Test connection says why, where the provider has one.\",\n },\n};\n\n/** A readiness in plain words, with its tone and meaning; a raw string for one this build does not know. */\nexport function providerReadiness(readiness: ProviderReadiness): ReadinessText {\n return typeof readiness === \"string\" && Object.hasOwn(READINESS, readiness)\n ? READINESS[readiness]\n : {\n label: displayText(readiness),\n tone: \"neutral\",\n hint: \"A readiness this version of the UI does not know.\",\n };\n}\n\n/**\n * Whose problem a failed preflight is: the config's or credentials' to fix,\n * the platform's for now, or the provider's own bug.\n */\nconst KIND: Readonly<Record<ProviderErrorKind, string>> = {\n misconfigured: \"Configuration problem: fix the provider's config.\",\n auth: \"Credentials problem: the platform refused them.\",\n transient: \"Platform trouble, for now: try again.\",\n throttled: \"The platform is throttling calls: try again later.\",\n quota: \"The platform's quota is used up.\",\n conflict: \"A bug in the provider: it gave conflicting answers.\",\n};\n\nconst CHECK: Readonly<\n Record<ProviderCheckStatus, { label: string; tone: BadgeTone }>\n> = {\n pass: { label: \"Pass\", tone: \"success\" },\n warn: { label: \"Warn\", tone: \"warning\" },\n fail: { label: \"Fail\", tone: \"danger\" },\n};\n\n/** Whose problem a failure is, in a sentence; a raw string for a kind this build does not know. */\nexport function providerErrorKind(kind: ProviderErrorKind): string {\n return typeof kind === \"string\" && Object.hasOwn(KIND, kind)\n ? KIND[kind]\n : `The preflight failed (${displayText(kind)}).`;\n}\n\n/** A check's status as a label and tone; a raw string for one this build does not know. */\nexport function providerCheck(status: ProviderCheckStatus): {\n label: string;\n tone: BadgeTone;\n} {\n return typeof status === \"string\" && Object.hasOwn(CHECK, status)\n ? CHECK[status]\n : { label: displayText(status), tone: \"neutral\" };\n}\n\n/**\n * What \"Test connection\" found, in one line: passed, passed with warnings,\n * a failed check, a timeout, an invalid config, or a classified failure.\n */\nexport function validationSummary(result: ProviderValidationDto): string {\n if (result.error !== undefined) {\n const { kind, detail } = result.error;\n if (detail === \"timeout\") {\n return \"No answer: the preflight timed out.\";\n }\n if (detail.startsWith(\"invalid config: \")) {\n return `Configuration problem: invalid ${detail.slice(\"invalid config: \".length)}.`;\n }\n return `${providerErrorKind(kind)} (${displayText(detail)})`;\n }\n const failed = result.checks.filter((check) => check.status === \"fail\");\n const warned = result.checks.filter((check) => check.status === \"warn\");\n if (failed.length > 0) {\n return `Connection failed: ${failed.length} of ${result.checks.length} checks failed.`;\n }\n if (warned.length > 0) {\n return `Connected, with ${warned.length} warning${warned.length === 1 ? \"\" : \"s\"}.`;\n }\n return result.checks.length === 0\n ? \"Connected.\"\n : `Connected: all ${result.checks.length} checks passed.`;\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "kCAmCA,IAAM,EAAgE,CACpE,MAAO,CACL,MAAO,QACP,KAAM,UACN,KAAM,4CACR,EACA,QAAS,CACP,MAAO,UACP,KAAM,UACN,KAAM,yGACR,EACA,OAAQ,CACN,MAAO,SACP,KAAM,SACN,KAAM,+IACR,CACF,EAGO,SAAS,EAAiB,CAAC,EAA6C,CAC7E,OAAO,OAAO,IAAc,UAAY,OAAO,OAAO,EAAW,CAAS,EACtE,EAAU,GACV,CACE,MAAO,EAAY,CAAS,EAC5B,KAAM,UACN,KAAM,mDACR,EAON,IAAM,EAAoD,CACxD,cAAe,oDACf,KAAM,kDACN,UAAW,wCACX,UAAW,qDACX,MAAO,mCACP,SAAU,qDACZ,EAEM,EAEF,CACF,KAAM,CAAE,MAAO,OAAQ,KAAM,SAAU,EACvC,KAAM,CAAE,MAAO,OAAQ,KAAM,SAAU,EACvC,KAAM,CAAE,MAAO,OAAQ,KAAM,QAAS,CACxC,EAGO,SAAS,CAAiB,CAAC,EAAiC,CACjE,OAAO,OAAO,IAAS,UAAY,OAAO,OAAO,EAAM,CAAI,EACvD,EAAK,GACL,yBAAyB,EAAY,CAAI,MAIxC,SAAS,EAAa,CAAC,EAG5B,CACA,OAAO,OAAO,IAAW,UAAY,OAAO,OAAO,EAAO,CAAM,EAC5D,EAAM,GACN,CAAE,MAAO,EAAY,CAAM,EAAG,KAAM,SAAU,EAO7C,SAAS,EAAiB,CAAC,EAAuC,CACvE,GAAI,EA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