@lokalise/harmony 1.14.0 → 1.15.0-exp-removeaddon.1
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 +25 -18
- package/dist/harmony.cjs +1 -1
- package/dist/harmony.mjs +593 -604
- package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.d.ts +6 -2
- package/dist/types/src/features/auth/core/{jwtTokenPayload.d.ts → utils/jwtTokenPayload.d.ts} +1 -1
- package/dist/types/src/features/auth/frontend/middleware/clientSideJwtAuthMiddleware.d.ts +9 -0
- package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.d.ts +5 -5
- package/dist/types/src/features/auth/node.d.ts +7 -5
- package/dist/types/src/features/publicApi/projects.d.ts +5 -3
- package/dist/types/src/features/publicApi/types/projectTypes.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/src/features/auth/core/lokaliseAuthAddon.d.ts +0 -14
- package/dist/types/src/features/auth/frontend/addon/lokaliseAuthBrowserAddon.d.ts +0 -35
- /package/dist/types/src/features/auth/core/{jwtTokenPayload.test.d.ts → utils/jwtTokenPayload.test.d.ts} +0 -0
@@ -1,6 +1,10 @@
|
|
1
1
|
import { JwtToken } from '../../../publicApi/types/userTokenTypes';
|
2
2
|
import { ConfiguredMiddleware, Wretch } from 'wretch';
|
3
|
-
export type JwtAuthProps = {
|
3
|
+
export type JwtAuthProps<T> = {
|
4
|
+
/**
|
5
|
+
* A configured Wretch client that is used to make requests to the authentication provider.
|
6
|
+
*/
|
7
|
+
authProviderWretchClient: Wretch<T>;
|
4
8
|
/**
|
5
9
|
* This function should return the current JWT token if it exists.
|
6
10
|
*/
|
@@ -10,4 +14,4 @@ export type JwtAuthProps = {
|
|
10
14
|
*/
|
11
15
|
onNewJwtTokenIssued?: (jwtToken: JwtToken) => Promise<void>;
|
12
16
|
};
|
13
|
-
export declare function jwtAuthMiddleware<T>(
|
17
|
+
export declare function jwtAuthMiddleware<T>(props: JwtAuthProps<T>): ConfiguredMiddleware;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { JwtAuthProps } from '../../core/middleware/jwtAuthMiddleware';
|
2
|
+
export type ClientSideJwtAuthProps<T> = Omit<JwtAuthProps<T>, 'getCachedJwtToken'> & {
|
3
|
+
/**
|
4
|
+
* The browser implementation makes this optional, as it can be inferred from the cookie.
|
5
|
+
* You can still provide a custom implementation if you want to.
|
6
|
+
*/
|
7
|
+
getCachedJwtToken?: JwtAuthProps<T>['getCachedJwtToken'];
|
8
|
+
};
|
9
|
+
export declare function clientSideJwtAuthMiddleware<T>(props: ClientSideJwtAuthProps<T>): import('wretch').ConfiguredMiddleware;
|
package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
export type PromoteAuthProps =
|
1
|
+
import { ClientSideJwtAuthProps } from './clientSideJwtAuthMiddleware';
|
2
|
+
import { ConfiguredMiddleware } from 'wretch';
|
3
|
+
export type PromoteAuthProps<T> = ClientSideJwtAuthProps<T> & {
|
4
4
|
/**
|
5
5
|
* Team ID is required to issue a new JWT token.
|
6
6
|
*/
|
@@ -9,6 +9,6 @@ export type PromoteAuthProps = JwtAuthProps & {
|
|
9
9
|
* The current CSRF token is required to issue a new JWT token.
|
10
10
|
* So this function should return the CSRF token for the current session.
|
11
11
|
*/
|
12
|
-
getCsrfToken
|
12
|
+
getCsrfToken?: () => Promise<string | undefined>;
|
13
13
|
};
|
14
|
-
export declare function promoteClassicSessionToJwtMiddleware<T>(
|
14
|
+
export declare function promoteClassicSessionToJwtMiddleware<T>(overrides: PromoteAuthProps<T>): ConfiguredMiddleware;
|
@@ -1,9 +1,11 @@
|
|
1
|
+
export { jwtAuthMiddleware } from './core/middleware/jwtAuthMiddleware';
|
2
|
+
export { publicApiHeadersMiddleware } from './core/middleware/publicApiHeadersMiddleware';
|
3
|
+
export { clientSideJwtAuthMiddleware } from './frontend/middleware/clientSideJwtAuthMiddleware';
|
4
|
+
export { promoteClassicSessionToJwtMiddleware } from './frontend/middleware/promoteClassicSessionToJwtMiddleware';
|
5
|
+
export type { JwtTokenPayload } from './core/types/jwtTokenPayload';
|
6
|
+
export { parseJwtTokenPayload } from './core/utils/jwtTokenPayload';
|
7
|
+
export * from './backend/services/getAuthenticatedSessionDetailFromRequest';
|
1
8
|
export * from './frontend/hooks/useGetPromotedClassicSessionJwtQuery';
|
2
9
|
export * from './frontend/hooks/useAuthenticatedSessionPayload';
|
3
10
|
export * from './frontend/hooks/useAuthenticatedUser';
|
4
11
|
export * from './frontend/hooks/useAuthenticatedProjectContributor';
|
5
|
-
export * from './backend/services/getAuthenticatedSessionDetailFromRequest';
|
6
|
-
export { parseJwtTokenPayload } from './core/jwtTokenPayload';
|
7
|
-
export { publicApiHeadersMiddleware } from './core/middleware/publicApiHeadersMiddleware';
|
8
|
-
export { LokaliseAuthAddon } from './core/lokaliseAuthAddon';
|
9
|
-
export { LokaliseAuthBrowserAddon } from './frontend/addon/lokaliseAuthBrowserAddon';
|
@@ -775,7 +775,9 @@ export declare const listProjects: import('@lokalise/universal-ts-utils/node').G
|
|
775
775
|
/**
|
776
776
|
* Public API router definition for retrieving a project
|
777
777
|
*/
|
778
|
-
export declare const retrieveProject: import('@lokalise/universal-ts-utils/node').GetRouteDefinition<
|
778
|
+
export declare const retrieveProject: import('@lokalise/universal-ts-utils/node').GetRouteDefinition<{
|
779
|
+
project_id: string;
|
780
|
+
}, import('zod').ZodObject<{
|
779
781
|
project_id: import('zod').ZodString;
|
780
782
|
uuid: import('zod').ZodString;
|
781
783
|
project_type: import('zod').ZodUnion<[import('zod').ZodLiteral<"localization_files">, import('zod').ZodLiteral<"paged_documents">, import('zod').ZodLiteral<"marketing">]>;
|
@@ -1069,13 +1071,13 @@ export declare const retrieveProject: import('@lokalise/universal-ts-utils/node'
|
|
1069
1071
|
unbalanced_brackets: number;
|
1070
1072
|
};
|
1071
1073
|
} | undefined;
|
1072
|
-
}>,
|
1074
|
+
}>, import('zod').ZodObject<{
|
1073
1075
|
project_id: import('zod').ZodString;
|
1074
1076
|
}, "strip", import('zod').ZodTypeAny, {
|
1075
1077
|
project_id: string;
|
1076
1078
|
}, {
|
1077
1079
|
project_id: string;
|
1078
|
-
}>, undefined, false, false>;
|
1080
|
+
}>, undefined, undefined, false, false>;
|
1079
1081
|
/**
|
1080
1082
|
* Public API router definition for updating a project
|
1081
1083
|
*/
|
@@ -998,7 +998,7 @@ export declare const LIST_PROJECTS_SUCCESS_RESPONSE_BODY: z.ZodObject<{
|
|
998
998
|
}[];
|
999
999
|
}>;
|
1000
1000
|
export type ListProjectsSuccessResponseBody = z.infer<typeof LIST_PROJECTS_SUCCESS_RESPONSE_BODY>;
|
1001
|
-
export declare const
|
1001
|
+
export declare const RETRIEVE_PROJECT_PATH_PARAM_SCHEMA: z.ZodObject<{
|
1002
1002
|
project_id: z.ZodString;
|
1003
1003
|
}, "strip", z.ZodTypeAny, {
|
1004
1004
|
project_id: string;
|
package/package.json
CHANGED
@@ -1,14 +0,0 @@
|
|
1
|
-
import { Wretch, WretchAddon } from 'wretch/types';
|
2
|
-
import { JwtAuthProps } from './middleware/jwtAuthMiddleware';
|
3
|
-
export interface LokaliseAuthAddon {
|
4
|
-
/**
|
5
|
-
* Add authentication and automatic token refresh to Lokalise requests.
|
6
|
-
*/
|
7
|
-
lokaliseAuth<T extends LokaliseAuthAddon>(this: T & Wretch<T>, props: JwtAuthProps): this;
|
8
|
-
}
|
9
|
-
/**
|
10
|
-
* Addon for Lokalise authentication.
|
11
|
-
* This will expose a method that can be used to authenticate requests to Lokalise.
|
12
|
-
* It will also handle refreshing the token when it expires.
|
13
|
-
*/
|
14
|
-
export declare const LokaliseAuthAddon: WretchAddon<LokaliseAuthAddon>;
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { Wretch, WretchAddon } from 'wretch/types';
|
2
|
-
import { JwtAuthProps } from '../../core/middleware/jwtAuthMiddleware';
|
3
|
-
import { PromoteAuthProps } from '../middleware/promoteClassicSessionToJwtMiddleware';
|
4
|
-
type BrowserJwtAuthProps = Omit<JwtAuthProps, 'getCachedJwtToken'> & {
|
5
|
-
/**
|
6
|
-
* The browser implementation makes this optional, as it can be inferred from the cookie.
|
7
|
-
* You can still provide a custom implementation if you want to.
|
8
|
-
*/
|
9
|
-
getCachedJwtToken?: JwtAuthProps['getCachedJwtToken'];
|
10
|
-
};
|
11
|
-
type BrowserPromoteAuthProps = Omit<PromoteAuthProps, 'getCachedJwtToken' | 'getCsrfToken'> & {
|
12
|
-
/**
|
13
|
-
* The browser implementation makes this optional, as it can be inferred from the cookie.
|
14
|
-
* You can still provide a custom implementation if you want to.
|
15
|
-
*/
|
16
|
-
getCachedJwtToken?: PromoteAuthProps['getCachedJwtToken'];
|
17
|
-
/**
|
18
|
-
* The browser implementation makes this optional, as it can be inferred from the cookie.
|
19
|
-
* You can still provide a custom implementation if you want to.
|
20
|
-
*/
|
21
|
-
getCsrfToken?: PromoteAuthProps['getCsrfToken'];
|
22
|
-
};
|
23
|
-
export interface LokaliseAuthBrowserAddon {
|
24
|
-
lokaliseAuth<T extends LokaliseAuthBrowserAddon>(this: T & Wretch<T>, props?: BrowserJwtAuthProps): this;
|
25
|
-
promoteClassicSession<T extends LokaliseAuthBrowserAddon>(this: T & Wretch<T>, props: BrowserPromoteAuthProps): this;
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* A browser implementation of the LokaliseAuthAddon.
|
29
|
-
* This implementation provides default providers that uses cookies to retrieve the JWT token.
|
30
|
-
*
|
31
|
-
* It exposes another utility method to automatically promote a classic session to a JWT session
|
32
|
-
* when a request is made from an environment using class CSRF PHP token authentication.
|
33
|
-
*/
|
34
|
-
export declare const LokaliseAuthBrowserAddon: WretchAddon<LokaliseAuthBrowserAddon>;
|
35
|
-
export {};
|
File without changes
|