zudoku 0.66.7 → 0.67.0

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.
Files changed (45) hide show
  1. package/dist/cli/common/version-check.js +12 -3
  2. package/dist/cli/common/version-check.js.map +1 -1
  3. package/dist/config/validators/validate.d.ts +21 -3
  4. package/dist/config/validators/validate.js +6 -3
  5. package/dist/config/validators/validate.js.map +1 -1
  6. package/dist/flat-config.d.ts +25 -24
  7. package/dist/lib/plugins/openapi/OasProvider.js +6 -2
  8. package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
  9. package/dist/lib/plugins/openapi/OperationList.js +4 -8
  10. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  11. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -0
  12. package/dist/lib/plugins/openapi/util/getRoutes.d.ts +3 -0
  13. package/dist/lib/plugins/openapi/util/getRoutes.js +2 -1
  14. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  15. package/dist/vite/api/SchemaManager.d.ts +11 -1
  16. package/dist/vite/api/SchemaManager.js +28 -17
  17. package/dist/vite/api/SchemaManager.js.map +1 -1
  18. package/dist/vite/api/SchemaManager.test.js +44 -0
  19. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  20. package/dist/vite/error-handler.js +1 -5
  21. package/dist/vite/error-handler.js.map +1 -1
  22. package/dist/vite/plugin-api.js +5 -3
  23. package/dist/vite/plugin-api.js.map +1 -1
  24. package/lib/OasProvider-D-4BX8P3.js +48 -0
  25. package/lib/OasProvider-D-4BX8P3.js.map +1 -0
  26. package/lib/{OperationList-CaknPbvq.js → OperationList-BOu9Qd_k.js} +817 -820
  27. package/lib/{OperationList-CaknPbvq.js.map → OperationList-BOu9Qd_k.js.map} +1 -1
  28. package/lib/{SchemaList-Dw3-CJPb.js → SchemaList-B167Xmbd.js} +3 -3
  29. package/lib/{SchemaList-Dw3-CJPb.js.map → SchemaList-B167Xmbd.js.map} +1 -1
  30. package/lib/{SchemaView-DyJkiQkD.js → SchemaView-Dx9gtne2.js} +2 -2
  31. package/lib/{SchemaView-DyJkiQkD.js.map → SchemaView-Dx9gtne2.js.map} +1 -1
  32. package/lib/{circular-DFquXeY2.js → circular-B5aq06Lb.js} +2 -2
  33. package/lib/{circular-DFquXeY2.js.map → circular-B5aq06Lb.js.map} +1 -1
  34. package/lib/{createServer-BXZ0CAUn.js → createServer-CasZ-UG7.js} +3 -3
  35. package/lib/{createServer-BXZ0CAUn.js.map → createServer-CasZ-UG7.js.map} +1 -1
  36. package/lib/{index-BQB9hb6n.js → index-BcAudYNw.js} +52 -49
  37. package/lib/{index-BQB9hb6n.js.map → index-BcAudYNw.js.map} +1 -1
  38. package/lib/zudoku.plugin-openapi.js +1 -1
  39. package/package.json +2 -2
  40. package/src/lib/plugins/openapi/OasProvider.tsx +10 -2
  41. package/src/lib/plugins/openapi/OperationList.tsx +4 -9
  42. package/src/lib/plugins/openapi/interfaces.ts +6 -1
  43. package/src/lib/plugins/openapi/util/getRoutes.tsx +4 -1
  44. package/lib/OasProvider-DSe-hk5Y.js +0 -40
  45. package/lib/OasProvider-DSe-hk5Y.js.map +0 -1
@@ -3,7 +3,7 @@ import "lucide-react";
3
3
  import "./chunk-EPOLDU6W-C6C8jAwd.js";
4
4
  import "./ui/Button.js";
5
5
  import "./ZudokuContext-BZB1TWdT.js";
6
- import { y as e, U as n, z as s } from "./index-BQB9hb6n.js";
6
+ import { y as e, U as n, z as s } from "./index-BcAudYNw.js";
7
7
  export {
8
8
  e as GetNavigationOperationsQuery,
9
9
  n as UNTAGGED_PATH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.66.7",
3
+ "version": "0.67.0",
4
4
  "type": "module",
5
5
  "homepage": "https://zudoku.dev",
6
6
  "repository": {
@@ -229,7 +229,7 @@
229
229
  "next-themes": "0.4.6",
230
230
  "oauth4webapi": "2.17.0",
231
231
  "openapi-types": "12.1.3",
232
- "pagefind": "1.4.0",
232
+ "pagefind": "1.5.0-beta.1",
233
233
  "picocolors": "1.1.1",
234
234
  "piscina": "5.1.4",
235
235
  "posthog-node": "5.14.1",
@@ -19,13 +19,21 @@ export const OasProvider = ({
19
19
  client: GraphQLClient;
20
20
  }) => {
21
21
  const value = useMemo(() => {
22
- const { versions: availableVersions, labels } = getVersionMetadata(config);
22
+ const {
23
+ versions: availableVersions,
24
+ labels,
25
+ downloadUrls,
26
+ } = getVersionMetadata(config);
23
27
  const currentVersion = version ?? availableVersions.at(0);
24
28
 
25
29
  const versionLinks = Object.fromEntries(
26
30
  availableVersions.map((id) => [
27
31
  id,
28
- { path: joinUrl(basePath, id), label: labels[id] ?? id },
32
+ {
33
+ path: joinUrl(basePath, id),
34
+ label: labels[id] ?? id,
35
+ downloadUrl: downloadUrls[id],
36
+ },
29
37
  ]),
30
38
  );
31
39
 
@@ -20,7 +20,6 @@ import { Heading } from "../../components/Heading.js";
20
20
  import { Markdown } from "../../components/Markdown.js";
21
21
  import { PagefindSearchMeta } from "../../components/PagefindSearchMeta.js";
22
22
  import { Pagination } from "../../components/Pagination.js";
23
- import { joinUrl } from "../../util/joinUrl.js";
24
23
  import { useCreateQuery } from "./client/useCreateQuery.js";
25
24
  import { useOasConfig } from "./context.js";
26
25
  import { DownloadSchemaButton } from "./DownloadSchemaButton.js";
@@ -151,11 +150,6 @@ const OperationsForTagQuery = graphql(/* GraphQL */ `
151
150
 
152
151
  const LAZY_OPERATION_LIST_THRESHOLD = 30;
153
152
 
154
- const getFileExtension = (filename: string): string => {
155
- const lastDotIndex = filename.lastIndexOf(".");
156
- return lastDotIndex !== -1 ? filename.slice(lastDotIndex) : "";
157
- };
158
-
159
153
  export const OperationList = ({
160
154
  tag,
161
155
  untagged,
@@ -163,7 +157,7 @@ export const OperationList = ({
163
157
  tag?: string;
164
158
  untagged?: boolean;
165
159
  }) => {
166
- const { path, input, type, versions, version, options } = useOasConfig();
160
+ const { input, type, versions, version, options } = useOasConfig();
167
161
  const { tag: tagFromParams } = useParams<"tag">();
168
162
  const query = useCreateQuery(OperationsForTagQuery, {
169
163
  input,
@@ -252,11 +246,12 @@ export const OperationList = ({
252
246
  const tagTitle = schema.tag.extensions?.["x-displayName"] ?? schema.tag.name;
253
247
  const helmetTitle = [tagTitle, title].filter(Boolean).join(" - ");
254
248
 
249
+ const currentVersion = version != null ? versions[version] : undefined;
255
250
  const downloadUrl =
256
251
  typeof input === "string"
257
252
  ? type === "url"
258
253
  ? input
259
- : joinUrl(path, version, `schema${getFileExtension(input)}`)
254
+ : currentVersion?.downloadUrl
260
255
  : undefined;
261
256
 
262
257
  return (
@@ -291,7 +286,7 @@ export const OperationList = ({
291
286
  {showVersions && (
292
287
  <span className="text-xl text-muted-foreground ms-1.5">
293
288
  {" "}
294
- ({version})
289
+ ({schema.version})
295
290
  </span>
296
291
  )}
297
292
  </Heading>
@@ -7,6 +7,8 @@ type DynamicInput = () => Promise<unknown>;
7
7
 
8
8
  export type VersionedInput<T> = Array<{
9
9
  path: string;
10
+ version?: string;
11
+ downloadUrl?: string;
10
12
  label?: string;
11
13
  input: T;
12
14
  }>;
@@ -85,5 +87,8 @@ export type OasPluginConfig = BaseOasConfig & OasSource;
85
87
  export type OasPluginContext = BaseOasConfig &
86
88
  ContextOasSource & {
87
89
  version?: string;
88
- versions: Record<string, { path: string; label: string }>;
90
+ versions: Record<
91
+ string,
92
+ { path: string; label: string; downloadUrl?: string }
93
+ >;
89
94
  };
@@ -150,7 +150,7 @@ const createVersionRoutes = (
150
150
 
151
151
  export const getVersionMetadata = (config: OasPluginConfig) => {
152
152
  if (config.type === "raw" || !Array.isArray(config.input)) {
153
- return { versions: [], labels: {} };
153
+ return { versions: [], labels: {}, downloadUrls: {} };
154
154
  }
155
155
 
156
156
  return {
@@ -158,6 +158,9 @@ export const getVersionMetadata = (config: OasPluginConfig) => {
158
158
  labels: Object.fromEntries(
159
159
  config.input.map((v) => [v.path, v.label ?? v.path]),
160
160
  ),
161
+ downloadUrls: Object.fromEntries(
162
+ config.input.map((v) => [v.path, v.downloadUrl]),
163
+ ),
161
164
  };
162
165
  };
163
166
 
@@ -1,40 +0,0 @@
1
- import { j as s } from "./jsx-runtime-BzflLqGi.js";
2
- import { useMemo as v } from "react";
3
- import { O as f } from "./chunk-EPOLDU6W-C6C8jAwd.js";
4
- import { j } from "./ZudokuContext-BZB1TWdT.js";
5
- import { g as c, O as x, G as O } from "./index-BQB9hb6n.js";
6
- const y = ({
7
- basePath: e,
8
- version: n,
9
- config: r,
10
- client: a
11
- }) => {
12
- const p = v(() => {
13
- const { versions: i, labels: u } = c(r), o = n ?? i.at(0), m = Object.fromEntries(
14
- i.map((t) => [
15
- t,
16
- { path: j(e, t), label: u[t] ?? t }
17
- ])
18
- );
19
- return {
20
- config: {
21
- ...r,
22
- version: o,
23
- versions: m,
24
- input: (() => {
25
- if (!Array.isArray(r.input))
26
- return r.input;
27
- const t = o ? r.input.find((l) => l.path === o) : r.input[0];
28
- if (!t)
29
- throw new Error(`No input found for version: ${o}`);
30
- return t.input;
31
- })()
32
- }
33
- };
34
- }, [r, e, n]);
35
- return /* @__PURE__ */ s.jsx(x, { value: p, children: /* @__PURE__ */ s.jsx(O, { client: a, children: /* @__PURE__ */ s.jsx(f, {}) }) });
36
- };
37
- export {
38
- y as OasProvider
39
- };
40
- //# sourceMappingURL=OasProvider-DSe-hk5Y.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OasProvider-DSe-hk5Y.js","sources":["../src/lib/plugins/openapi/OasProvider.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport type { GraphQLClient } from \"./client/GraphQLClient.js\";\nimport { GraphQLProvider } from \"./client/GraphQLContext.js\";\nimport { OasConfigProvider } from \"./context.js\";\nimport type { OasPluginConfig } from \"./interfaces.js\";\nimport { getVersionMetadata } from \"./util/getRoutes.js\";\n\nexport const OasProvider = ({\n basePath,\n version,\n config,\n client,\n}: {\n basePath: string;\n version?: string;\n config: OasPluginConfig;\n client: GraphQLClient;\n}) => {\n const value = useMemo(() => {\n const { versions: availableVersions, labels } = getVersionMetadata(config);\n const currentVersion = version ?? availableVersions.at(0);\n\n const versionLinks = Object.fromEntries(\n availableVersions.map((id) => [\n id,\n { path: joinUrl(basePath, id), label: labels[id] ?? id },\n ]),\n );\n\n const resolveInput = (): string | (() => Promise<unknown>) => {\n if (!Array.isArray(config.input)) {\n return config.input;\n }\n\n const versionConfig = currentVersion\n ? config.input.find((v) => v.path === currentVersion)\n : config.input[0];\n\n if (!versionConfig) {\n throw new Error(`No input found for version: ${currentVersion}`);\n }\n\n return versionConfig.input;\n };\n\n return {\n config: {\n ...config,\n version: currentVersion,\n versions: versionLinks,\n input: resolveInput(),\n },\n };\n }, [config, basePath, version]);\n\n return (\n <OasConfigProvider value={value}>\n <GraphQLProvider client={client}>\n <Outlet />\n </GraphQLProvider>\n </OasConfigProvider>\n );\n};\n"],"names":["OasProvider","basePath","version","config","client","value","useMemo","availableVersions","labels","getVersionMetadata","currentVersion","versionLinks","id","joinUrl","versionConfig","v","jsx","OasConfigProvider","GraphQLProvider","Outlet"],"mappings":";;;;;AASO,MAAMA,IAAc,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACF,MAKM;AACJ,QAAMC,IAAQC,EAAQ,MAAM;AAC1B,UAAM,EAAE,UAAUC,GAAmB,QAAAC,EAAA,IAAWC,EAAmBN,CAAM,GACnEO,IAAiBR,KAAWK,EAAkB,GAAG,CAAC,GAElDI,IAAe,OAAO;AAAA,MAC1BJ,EAAkB,IAAI,CAACK,MAAO;AAAA,QAC5BA;AAAA,QACA,EAAE,MAAMC,EAAQZ,GAAUW,CAAE,GAAG,OAAOJ,EAAOI,CAAE,KAAKA,EAAA;AAAA,MAAG,CACxD;AAAA,IAAA;AAmBH,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,GAAGT;AAAA,QACH,SAASO;AAAA,QACT,UAAUC;AAAA,QACV,QArBiB,MAAyC;AAC5D,cAAI,CAAC,MAAM,QAAQR,EAAO,KAAK;AAC7B,mBAAOA,EAAO;AAGhB,gBAAMW,IAAgBJ,IAClBP,EAAO,MAAM,KAAK,CAACY,MAAMA,EAAE,SAASL,CAAc,IAClDP,EAAO,MAAM,CAAC;AAElB,cAAI,CAACW;AACH,kBAAM,IAAI,MAAM,+BAA+BJ,CAAc,EAAE;AAGjE,iBAAOI,EAAc;AAAA,QACvB,GAOW;AAAA,MAAa;AAAA,IACtB;AAAA,EAEJ,GAAG,CAACX,GAAQF,GAAUC,CAAO,CAAC;AAE9B,SACEc,gBAAAA,EAAAA,IAACC,KAAkB,OAAAZ,GACjB,UAAAW,gBAAAA,EAAAA,IAACE,KAAgB,QAAAd,GACf,UAAAY,gBAAAA,EAAAA,IAACG,GAAA,CAAA,CAAO,EAAA,CACV,EAAA,CACF;AAEJ;"}