nuxt-kirby 3.0.0 โ†’ 3.0.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/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  - ๐Ÿ”’ Protected Kirby credentials when sending queries
13
13
  - ๐Ÿชข Supports token-based authentication with the [Kirby Headless plugin](https://kirby.tools/docs/headless/getting-started/) (recommended)
14
- - ๐Ÿฑ Handle request just like with the [`useFetch`](https://nuxt.com/docs/getting-started/data-fetching/#usefetch) composable
14
+ - ๐Ÿฑ Handle request just like with the [`useFetch`](https://nuxt.com/docs/getting-started/data-fetching) composable
15
15
  - ๐Ÿฆฆ [Multiple starter kits](https://nuxt-kirby.byjohann.dev/essentials/starter-kits) available
16
16
  - ๐Ÿ—ƒ Cached query responses
17
17
  - ๐Ÿคน No CORS issues!
package/dist/module.d.mts CHANGED
@@ -8,9 +8,17 @@ interface ModuleOptions {
8
8
  * @default process.env.KIRBY_BASE_URL
9
9
  */
10
10
  url?: string;
11
+ /**
12
+ * Kirby KQL API endpoint path
13
+ *
14
+ * @default 'api/query' // for `basic` authentication
15
+ * @default 'api/kql' // for `bearer` authentication
16
+ */
17
+ kqlPath?: string;
11
18
  /**
12
19
  * Kirby KQL API route path
13
20
  *
21
+ * @deprecated Use `kqlPath` instead
14
22
  * @default 'api/query' // for `basic` authentication
15
23
  * @default 'api/kql' // for `bearer` authentication
16
24
  */
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "3.0.0",
7
+ "version": "3.0.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -34,7 +34,7 @@ async function prefetchQueries(options) {
34
34
  try {
35
35
  results.set(
36
36
  key,
37
- await ofetch(options.prefix, {
37
+ await ofetch(options.kqlPath, {
38
38
  baseURL: options.url,
39
39
  method: "POST",
40
40
  body: language ? query.query : query,
@@ -85,6 +85,7 @@ const module = defineNuxtModule({
85
85
  },
86
86
  defaults: {
87
87
  url: process.env.KIRBY_BASE_URL || "",
88
+ kqlPath: "",
88
89
  prefix: "",
89
90
  auth: "basic",
90
91
  token: process.env.KIRBY_API_TOKEN || "",
@@ -110,11 +111,15 @@ const module = defineNuxtModule({
110
111
  logger.error("Missing `KIRBY_API_USERNAME` and `KIRBY_API_PASSWORD` environment variable for basic authentication");
111
112
  if (options.auth === "bearer" && !options.token)
112
113
  logger.error("Missing `KIRBY_API_TOKEN` environment variable for bearer authentication");
113
- if (!options.prefix) {
114
+ if (options.prefix && !options.kqlPath) {
115
+ logger.warn("The `prefix` option is deprecated. Please use `kqlPath` instead.");
116
+ options.kqlPath = options.prefix;
117
+ }
118
+ if (!options.kqlPath) {
114
119
  if (options.auth === "basic")
115
- options.prefix = "api/query";
120
+ options.kqlPath = "api/query";
116
121
  else if (options.auth === "bearer")
117
- options.prefix = "api/kql";
122
+ options.kqlPath = "api/kql";
118
123
  }
119
124
  if (!nuxt.options.ssr) {
120
125
  logger.info("Kirby requests are client-only because SSR is disabled");
@@ -38,7 +38,7 @@ export function $kql(query, opts = {}) {
38
38
  },
39
39
  body: query
40
40
  };
41
- const request = useRequestFetch()(kirby.client ? kirby.prefix : buildApiProxyPath(_key), {
41
+ const request = useRequestFetch()(kirby.client ? kirby.kqlPath : buildApiProxyPath(_key), {
42
42
  ...fetchOptions,
43
43
  ...kirby.client ? _clientFetchOptions : _serverFetchOptions
44
44
  }).then((response) => {
@@ -27,7 +27,7 @@ export default defineEventHandler(async (event) => {
27
27
  body: body2
28
28
  }) => {
29
29
  const isQueryRequest2 = key2.startsWith("$kql");
30
- const response = await globalThis.$fetch.raw(isQueryRequest2 ? kirby.prefix : path, {
30
+ const response = await globalThis.$fetch.raw(isQueryRequest2 ? kirby.kqlPath : path, {
31
31
  responseType: "arrayBuffer",
32
32
  ignoreResponseError: true,
33
33
  baseURL: kirby.url,
@@ -18,7 +18,7 @@ export function $kirby(path, opts = {}) {
18
18
  export function $kql(query, opts = {}) {
19
19
  const { headers, language, ...fetchOptions } = opts;
20
20
  const kirby = useRuntimeConfig().kirby;
21
- return globalThis.$fetch(kirby.prefix, {
21
+ return globalThis.$fetch(kirby.kqlPath, {
22
22
  ...fetchOptions,
23
23
  baseURL: kirby.url,
24
24
  method: "POST",
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-kirby",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.0.2",
5
5
  "packageManager": "pnpm@10.17.0",
6
- "description": "Kirby CMS Integration for Nuxt with KQL support",
6
+ "description": "Kirby CMS integration for Nuxt with KQL support",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
8
  "license": "MIT",
9
9
  "homepage": "https://nuxt-kirby.byjohann.dev",