@okam/directus-next 1.2.9 → 1.2.10

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/draft/route.d.ts CHANGED
@@ -44,4 +44,4 @@ export type HandleDraftOptions = {
44
44
  * })
45
45
  * }
46
46
  */
47
- export default function handleDraftRoute({ url, getDirectusLanguage, getDraftSecret, getJsonError, }: HandleDraftOptions): Response | undefined;
47
+ export default function handleDraftRoute({ url, getDirectusLanguage, getDraftSecret, getJsonError, }: HandleDraftOptions): Promise<Response | undefined>;
package/index.js CHANGED
@@ -98,7 +98,7 @@ function getPathFromRoute(routeUrl, url, index = 0) {
98
98
  });
99
99
  return radashi.template(routeUrl, map);
100
100
  }
101
- function handleDraftRoute({
101
+ async function handleDraftRoute({
102
102
  url,
103
103
  getDirectusLanguage,
104
104
  getDraftSecret,
@@ -147,7 +147,7 @@ function handleDraftRoute({
147
147
  const withParams = redirectUrl.indexOf("?") !== -1;
148
148
  redirectUrl = `${redirectUrl}${withParams ? "&" : "?"}version=${encodeURIComponent(version)}`;
149
149
  }
150
- headers.draftMode().enable();
150
+ (await headers.draftMode()).enable();
151
151
  navigation.redirect(redirectUrl);
152
152
  return void 0;
153
153
  }
package/index.mjs CHANGED
@@ -97,7 +97,7 @@ function getPathFromRoute(routeUrl, url, index = 0) {
97
97
  });
98
98
  return template(routeUrl, map);
99
99
  }
100
- function handleDraftRoute({
100
+ async function handleDraftRoute({
101
101
  url,
102
102
  getDirectusLanguage,
103
103
  getDraftSecret,
@@ -146,7 +146,7 @@ function handleDraftRoute({
146
146
  const withParams = redirectUrl.indexOf("?") !== -1;
147
147
  redirectUrl = `${redirectUrl}${withParams ? "&" : "?"}version=${encodeURIComponent(version)}`;
148
148
  }
149
- draftMode().enable();
149
+ (await draftMode()).enable();
150
150
  redirect(redirectUrl);
151
151
  return void 0;
152
152
  }
package/logger.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import type { LogSeverity } from '@okam/logger';
2
- export declare const logger: import("@okam/logger").Logger;
1
+ import { LogSeverity } from '../../../stack/logger/src/index.ts';
2
+
3
+ export declare const logger: import('../../../stack/logger/src/index.ts').Logger;
3
4
  export declare function log(msg: string, context?: unknown, severity?: LogSeverity): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@okam/directus-next",
3
3
  "main": "./index.js",
4
- "version": "1.2.9",
4
+ "version": "1.2.10",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
7
7
  ".": {
@@ -35,8 +35,8 @@
35
35
  "@okam/core-lib": "1.17.0",
36
36
  "@okam/directus-node": "0.6.2",
37
37
  "@okam/logger": "1.1.0",
38
- "@okam/next-component": "1.2.2",
39
- "next": "^14.1.1",
38
+ "@okam/next-component": "1.2.3",
39
+ "next": "^15.0.0",
40
40
  "radashi": "^12.3.0",
41
41
  "@okam/directus-query": "1.4.2",
42
42
  "server-only": "0.0.1",
@@ -1,4 +1,5 @@
1
- import type { Variables } from 'graphql-request';
2
- import type { TPageSettingsQueryItem, TUsePageSettingsReturn } from './interface';
1
+ import { Variables } from 'graphql-request';
2
+ import { TPageSettingsQueryItem, TUsePageSettingsReturn } from './interface';
3
+
3
4
  export declare function pageSettingsContext<Item extends TPageSettingsQueryItem>(defaultValue?: TUsePageSettingsReturn<Item>): readonly [() => TUsePageSettingsReturn<Item> | undefined, (value: TUsePageSettingsReturn<Item> | undefined) => void];
4
5
  export declare function pageSettingsVariablesContext(variables?: Variables): readonly [() => object | undefined, (value: object | undefined) => void];
@@ -1,7 +1,8 @@
1
- import { type TypedDocumentNode } from '@graphql-typed-document-node/core';
2
- import type { Variables } from 'graphql-request';
3
- import type { TFiles } from '../files/interface';
4
- import type { DirectusRouteConfig } from '../types/directusRouteConfig';
1
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
2
+ import { Variables } from 'graphql-request';
3
+ import { TFiles } from '../files/interface';
4
+ import { DirectusRouteConfig } from '../types/directusRouteConfig';
5
+
5
6
  export type Fragmentize<FragmentData, FragmentName extends string = string> = {
6
7
  ' $fragmentRefs'?: {
7
8
  [FragmentKey in FragmentName]?: FragmentData | null | undefined;
@@ -1,5 +1,6 @@
1
- import type { Variables } from 'graphql-request';
2
- import type { TUsePageSettingsProps, TPageSettingsQueryItem, TUsePageSettingsReturn } from './interface';
1
+ import { Variables } from 'graphql-request';
2
+ import { TUsePageSettingsProps, TPageSettingsQueryItem, TUsePageSettingsReturn } from './interface';
3
+
3
4
  /**
4
5
  * @param props Optional props. Passing new props will trigger a new query if the variables have changed compared to the value of the variables in the cache. Omitting props will return the cached value.
5
6
  * @param itemKey Required if the query has more than a single root field
@@ -1,4 +1,5 @@
1
- import type { HandleRedirectOptions } from './interface';
1
+ import { HandleRedirectOptions } from './interface';
2
+
2
3
  export declare function parseRedirectParams(url: string): {
3
4
  secret: string;
4
5
  };
@@ -1,5 +1,6 @@
1
- import type { TFetchRedirectsResponse } from '@okam/directus-node/edge';
2
- import type { DirectusRouteRedirectsModule } from '../../types/directusRouteConfig';
1
+ import { TFetchRedirectsResponse } from '../../../../directus-node/src/edge.ts';
2
+ import { DirectusRouteRedirectsModule } from '../../types/directusRouteConfig';
3
+
3
4
  /**
4
5
  * Gets a response from `options.apiRoute`
5
6
  * @param {DirectusRouteRedirectsModule} options
@@ -1,6 +1,6 @@
1
- import type { NextRequest } from 'next/server';
2
- import { NextResponse } from 'next/server';
3
- import type { DirectusRouteRedirectsModule } from '../../types/directusRouteConfig';
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { DirectusRouteRedirectsModule } from '../../types/directusRouteConfig';
3
+
4
4
  /**
5
5
  * Handles next redirection using directus redirects
6
6
  */
@@ -1,5 +1,6 @@
1
- import type { NextRequest, NextResponse as NextResponseType } from 'next/server';
2
- import type { DirectusRouteConfig } from '../types/directusRouteConfig';
1
+ import { NextRequest, NextResponse as NextResponseType } from 'next/server';
2
+ import { DirectusRouteConfig } from '../types/directusRouteConfig';
3
+
3
4
  /**
4
5
  * Handles incoming middleware requests and rewrites the path to the new format according to fetched page settings.
5
6
  * @param request - The NextRequest object
@@ -1,2 +1,3 @@
1
- import type { PageSettingsTranslation } from '../../types';
1
+ import { PageSettingsTranslation } from '../../types';
2
+
2
3
  export declare function fetchPageSettingsTranslation(path: string): Promise<PageSettingsTranslation[] | null>;
@@ -1,4 +1,5 @@
1
- import type { DirectusRouteConfig } from '../../types';
1
+ import { DirectusRouteConfig } from '../../types';
2
+
2
3
  /**
3
4
  * Validates if a given string is a valid locale from the directus route configuration.
4
5
  * @param maybeLocale The string to validate as a locale