@lokalise/harmony 1.6.0-exp-jwtutils.22 → 1.8.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 (57) hide show
  1. package/README.md +64 -0
  2. package/dist/harmony.cjs +1 -1
  3. package/dist/harmony.mjs +547 -552
  4. package/dist/types/src/components/Sidebar/Sidebar.d.ts +5 -2
  5. package/dist/types/src/components/Sidebar/Sidebar.stories.d.ts +1 -0
  6. package/dist/types/src/components/Sidebar/Widgets/Avatar/Avatar.d.ts +3 -0
  7. package/dist/types/src/components/Sidebar/Widgets/IconLink/IconLink.d.ts +3 -0
  8. package/dist/types/src/components/Sidebar/Widgets/Menu/Menu.d.ts +3 -0
  9. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/ProfileMenu.d.ts +4 -0
  10. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/ProfileSettingsMenuItem/ProfileSettingsMenuItem.d.ts +4 -0
  11. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/TeamMenuItem/TeamMenuItem.d.ts +5 -0
  12. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/TeamSwitch/TeamSwitch.d.ts +3 -0
  13. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/UpgradeMenuItem/UpgradeMenuItem.d.ts +5 -0
  14. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/types.d.ts +9 -6
  15. package/dist/types/src/features/auth/backend/services/getAuthenticatedSessionDetailFromRequest.d.ts +10 -0
  16. package/dist/types/src/features/auth/core/jwtTokenPayload.d.ts +7 -14
  17. package/dist/types/src/features/auth/core/lokaliseAuthAddon.d.ts +8 -0
  18. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.d.ts +1 -1
  19. package/dist/types/src/features/auth/core/middleware/publicApiHeadersMiddleware.d.ts +3 -0
  20. package/dist/types/src/features/auth/core/types/jwtTokenPayload.d.ts +4 -4
  21. package/dist/types/src/features/auth/core/types/jwtTokenPayload.fixture.d.ts +5 -5
  22. package/dist/types/src/features/auth/core/utils/makeAuthHeader.d.ts +2 -3
  23. package/dist/types/src/features/auth/frontend/addon/lokaliseAuthBrowserAddon.d.ts +7 -0
  24. package/dist/types/src/features/auth/frontend/events/NewJwtIssuedEvent.d.ts +1 -1
  25. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedProjectContributor.d.ts +9 -1
  26. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedSessionPayload.d.ts +2 -2
  27. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedUser.d.ts +7 -1
  28. package/dist/types/src/features/auth/frontend/hooks/useGetPromotedClassicSessionJwtQuery.d.ts +11 -202
  29. package/dist/types/src/features/auth/frontend/utils/cookieTokenUtils.d.ts +4 -0
  30. package/dist/types/src/features/auth/frontend/utils/cookieTokenUtils.test.d.ts +1 -0
  31. package/dist/types/src/features/auth/{index.d.ts → node.d.ts} +1 -11
  32. package/dist/types/src/features/node.d.ts +2 -0
  33. package/dist/types/src/features/publicApi/contributors.d.ts +3 -97
  34. package/dist/types/src/features/publicApi/hooks/useCreateProjectMutation.d.ts +11 -6
  35. package/dist/types/src/features/publicApi/hooks/useGetTeamUsersQuery.d.ts +11 -2
  36. package/dist/types/src/features/publicApi/hooks/useGetUserTokenQuery.d.ts +11 -2
  37. package/dist/types/src/features/publicApi/hooks/useListProjectsQuery.d.ts +13 -4
  38. package/dist/types/src/features/publicApi/hooks/useRetrieveContributorQuery.d.ts +11 -2
  39. package/dist/types/src/features/publicApi/hooks/useRetrieveProjectQuery.d.ts +13 -4
  40. package/dist/types/src/features/publicApi/{index.d.ts → node.d.ts} +6 -3
  41. package/dist/types/src/features/publicApi/projects.d.ts +259 -784
  42. package/dist/types/src/features/publicApi/teamUsers.d.ts +3 -70
  43. package/dist/types/src/features/publicApi/types/contributorTypes.d.ts +171 -0
  44. package/dist/types/src/features/publicApi/types/projectTypes.d.ts +1061 -0
  45. package/dist/types/src/features/publicApi/types/teamUserTypes.d.ts +70 -0
  46. package/dist/types/src/features/publicApi/types/userTokenTypes.d.ts +26 -0
  47. package/dist/types/src/features/publicApi/userToken.d.ts +0 -11
  48. package/dist/types/src/node.d.ts +3 -6
  49. package/dist/types/tests/utils.d.ts +1 -6
  50. package/package.json +23 -18
  51. package/dist/types/src/features/auth/bff/services/getAuthenticatedSessionDetailFromRequest.d.ts +0 -18
  52. package/dist/types/src/features/auth/frontend/utils/cookieToken.d.ts +0 -4
  53. package/dist/types/src/features/publicApi/types/project.d.ts +0 -522
  54. /package/dist/types/src/{features/auth/bff/services/getAuthenticatedSessionPayloadFromRequest.test.d.ts → components/Sidebar/Widgets/ProfileMenu/ProfileMenu.test.d.ts} +0 -0
  55. /package/dist/types/src/features/auth/{frontend/utils/cookieToken.test.d.ts → backend/services/getAuthenticatedSessionPayloadFromRequest.test.d.ts} +0 -0
  56. /package/dist/types/src/features/publicApi/types/{language.d.ts → languageTypes.d.ts} +0 -0
  57. /package/dist/types/src/features/publicApi/types/{teamRole.d.ts → teamRoleTypes.d.ts} +0 -0
@@ -1,100 +1,7 @@
1
1
  import { z } from 'zod';
2
- declare const RETRIEVE_CONTRIBUTORS_RESPONSE_SCHEMA: z.ZodObject<{
3
- project_id: z.ZodString;
4
- contributors: z.ZodArray<z.ZodObject<{
5
- user_id: z.ZodNumber;
6
- email: z.ZodString;
7
- fullname: z.ZodString;
8
- created_at: z.ZodString;
9
- created_at_timestamp: z.ZodNumber;
10
- admin_rights: z.ZodArray<z.ZodString, "many">;
11
- languages: z.ZodArray<z.ZodObject<{
12
- lang_id: z.ZodNumber;
13
- lang_iso: z.ZodString;
14
- lang_name: z.ZodString;
15
- is_writable: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
16
- }, "strip", z.ZodTypeAny, {
17
- lang_id: number;
18
- lang_iso: string;
19
- lang_name: string;
20
- is_writable: 0 | 1;
21
- }, {
22
- lang_id: number;
23
- lang_iso: string;
24
- lang_name: string;
25
- is_writable: 0 | 1;
26
- }>, "many">;
27
- is_admin: z.ZodBoolean;
28
- is_reviewer: z.ZodBoolean;
29
- }, "strip", z.ZodTypeAny, {
30
- email: string;
31
- user_id: number;
32
- fullname: string;
33
- created_at: string;
34
- created_at_timestamp: number;
35
- admin_rights: string[];
36
- languages: {
37
- lang_id: number;
38
- lang_iso: string;
39
- lang_name: string;
40
- is_writable: 0 | 1;
41
- }[];
42
- is_admin: boolean;
43
- is_reviewer: boolean;
44
- }, {
45
- email: string;
46
- user_id: number;
47
- fullname: string;
48
- created_at: string;
49
- created_at_timestamp: number;
50
- admin_rights: string[];
51
- languages: {
52
- lang_id: number;
53
- lang_iso: string;
54
- lang_name: string;
55
- is_writable: 0 | 1;
56
- }[];
57
- is_admin: boolean;
58
- is_reviewer: boolean;
59
- }>, "many">;
60
- }, "strip", z.ZodTypeAny, {
61
- contributors: {
62
- email: string;
63
- user_id: number;
64
- fullname: string;
65
- created_at: string;
66
- created_at_timestamp: number;
67
- admin_rights: string[];
68
- languages: {
69
- lang_id: number;
70
- lang_iso: string;
71
- lang_name: string;
72
- is_writable: 0 | 1;
73
- }[];
74
- is_admin: boolean;
75
- is_reviewer: boolean;
76
- }[];
77
- project_id: string;
78
- }, {
79
- contributors: {
80
- email: string;
81
- user_id: number;
82
- fullname: string;
83
- created_at: string;
84
- created_at_timestamp: number;
85
- admin_rights: string[];
86
- languages: {
87
- lang_id: number;
88
- lang_iso: string;
89
- lang_name: string;
90
- is_writable: 0 | 1;
91
- }[];
92
- is_admin: boolean;
93
- is_reviewer: boolean;
94
- }[];
95
- project_id: string;
96
- }>;
97
- export type RetrieveContributorsResponse = z.infer<typeof RETRIEVE_CONTRIBUTORS_RESPONSE_SCHEMA>;
2
+ /**
3
+ * Public API router definition for retrieving a project contributor
4
+ */
98
5
  export declare const retrieveContributor: import('@lokalise/universal-ts-utils/node').GetRouteDefinition<{
99
6
  projectId: string;
100
7
  contributorId: number;
@@ -202,4 +109,3 @@ export declare const retrieveContributor: import('@lokalise/universal-ts-utils/n
202
109
  projectId: string;
203
110
  contributorId: number;
204
111
  }>, undefined, undefined, false, false>;
205
- export {};
@@ -1,18 +1,23 @@
1
1
  import { ApiMutationOverrides } from '../../../utils/types/apiMutationOverrides';
2
2
  import { Wretch } from 'wretch';
3
- import { CreateProjectRequestBody } from '../projects';
4
- import { Project } from '../types/project';
5
- export declare function useCreateProjectMutation<T>(api: Wretch<T>, overrides?: ApiMutationOverrides<Project, CreateProjectRequestBody>): import('@tanstack/react-query').UseMutationResult<{
3
+ import { CreateProjectRequestBody, Project } from '../types/projectTypes';
4
+ /**
5
+ * A react-router wrapper about the createProject public API endpoint
6
+ *
7
+ * @param wretchClient - Wretch instance configured to a public API instance.
8
+ * @param overrides - Additional options to pass to the query.
9
+ */
10
+ export declare function useCreateProjectMutation<T>(wretchClient: Wretch<T>, overrides?: ApiMutationOverrides<Project, CreateProjectRequestBody>): import('@tanstack/react-query').UseMutationResult<{
6
11
  name: string;
7
12
  created_at: string;
8
13
  created_at_timestamp: number;
9
- project_id: string;
14
+ team_id: number;
10
15
  description: string;
16
+ project_id: string;
11
17
  uuid: string;
12
18
  project_type: "localization_files" | "paged_documents" | "marketing";
13
19
  created_by: number;
14
20
  created_by_email: string;
15
- team_id: number;
16
21
  base_language_id: number;
17
22
  base_language_iso: string;
18
23
  settings: {
@@ -60,12 +65,12 @@ export declare function useCreateProjectMutation<T>(api: Wretch<T>, overrides?:
60
65
  };
61
66
  }, undefined, {
62
67
  name: string;
68
+ team_id: string;
63
69
  languages: {
64
70
  lang_iso: string;
65
71
  custom_iso?: string | undefined;
66
72
  }[];
67
73
  project_type: "localization_files" | "paged_documents" | "marketing";
68
- team_id: string;
69
74
  base_lang_iso: string;
70
75
  is_segmentation_enabled: boolean;
71
76
  }, undefined>;
@@ -1,10 +1,19 @@
1
+ import { TeamUserResponse } from '../types/teamUserTypes';
1
2
  import { ApiQueryOverrides } from '../../../utils/types/apiQueryOverrides';
2
3
  import { Wretch } from 'wretch/types';
3
- import { TeamUserResponse } from '../teamUsers';
4
+ /**
5
+ * Factory for generating the query key for the getTeamUser public API endpoint
6
+ */
4
7
  export declare const getTeamUsersQueryKey: {
5
8
  teamUserKey: (teamId: number, userId: number) => readonly ["GetTeamUsers", number, number];
6
9
  };
7
- export declare const useGetTeamUsersQuery: <T>(api: Wretch<T>, overrides: ApiQueryOverrides<TeamUserResponse, typeof getTeamUsersQueryKey>) => import('@tanstack/react-query').UseQueryResult<{
10
+ /**
11
+ * A react-router wrapper about the getTeamUser public API endpoint
12
+ *
13
+ * @param wretchClient - Wretch instance configured to a public API instance.
14
+ * @param overrides - Additional options to pass to the query.
15
+ */
16
+ export declare const useGetTeamUsersQuery: <T>(wretchClient: Wretch<T>, overrides: ApiQueryOverrides<TeamUserResponse, typeof getTeamUsersQueryKey>) => import('@tanstack/react-query').UseQueryResult<{
8
17
  team_id: number;
9
18
  team_user: {
10
19
  role: "member" | "admin" | "biller" | "owner";
@@ -1,11 +1,20 @@
1
+ import { JwtToken } from '../types/userTokenTypes';
1
2
  import { ApiQueryOverrides } from '../../../utils/types/apiQueryOverrides';
2
3
  import { Wretch } from 'wretch/types';
3
- import { JwtToken } from '../userToken';
4
+ /**
5
+ * Factory for generating keys for the getUserToken public API endpoint
6
+ */
4
7
  export declare const getUserTokenKey: {
5
8
  teamKeyCsrf: (teamId: number, csrf: string) => readonly ["getUserToken", "x-csrf-token", string, number];
6
9
  teamKeyJwt: (teamId: number, refreshToken: string) => readonly ["getUserToken", "Authorization", `Bearer ${string}`, number];
7
10
  };
8
- export declare const useGetUserTokenQuery: <T>(api: Wretch<T>, overrides: ApiQueryOverrides<JwtToken, typeof getUserTokenKey>) => import('@tanstack/react-query').UseQueryResult<{
11
+ /**
12
+ * A react-router wrapper about the getUserToken public API endpoint
13
+ *
14
+ * @param wretchClient - Wretch instance configured to a public API instance.
15
+ * @param overrides - Additional options to pass to the query.
16
+ */
17
+ export declare const useGetUserTokenQuery: <T>(wretchClient: Wretch<T>, overrides: ApiQueryOverrides<JwtToken, typeof getUserTokenKey>) => import('@tanstack/react-query').UseQueryResult<{
9
18
  accessToken: string;
10
19
  refreshToken: string;
11
20
  }, undefined>;
@@ -1,6 +1,9 @@
1
+ import { ListProjectsRequestQuery, ListProjectsSuccessResponseBody } from '../types/projectTypes';
1
2
  import { ApiQueryOverrides } from '../../../utils/types/apiQueryOverrides';
2
3
  import { Wretch } from 'wretch';
3
- import { ListProjectsRequestQuery, ListProjectsSuccessResponseBody } from '../projects';
4
+ /**
5
+ * Factory for the listProjects public API endpoint key
6
+ */
4
7
  export declare const listProjectsKey: {
5
8
  paramsKey: (params: ListProjectsRequestQuery) => readonly ["listProjects", {
6
9
  page?: number | undefined;
@@ -12,17 +15,23 @@ export declare const listProjectsKey: {
12
15
  limit?: number | undefined;
13
16
  }];
14
17
  };
15
- export declare function useListProjectsQuery<T>(api: Wretch<T>, overrides: ApiQueryOverrides<ListProjectsSuccessResponseBody, typeof listProjectsKey>): import('@tanstack/react-query').UseQueryResult<({
18
+ /**
19
+ * A react-router wrapper about the listProjects public API endpoint
20
+ *
21
+ * @param wretchClient - Wretch instance configured to a public API instance.
22
+ * @param overrides - Additional options to pass to the query.
23
+ */
24
+ export declare function useListProjectsQuery<T>(wretchClient: Wretch<T>, overrides: ApiQueryOverrides<ListProjectsSuccessResponseBody, typeof listProjectsKey>): import('@tanstack/react-query').UseQueryResult<({
16
25
  name: string;
17
26
  created_at: string;
18
27
  created_at_timestamp: number;
19
- project_id: string;
28
+ team_id: number;
20
29
  description: string;
30
+ project_id: string;
21
31
  uuid: string;
22
32
  project_type: "localization_files" | "paged_documents" | "marketing";
23
33
  created_by: number;
24
34
  created_by_email: string;
25
- team_id: number;
26
35
  base_language_id: number;
27
36
  base_language_iso: string;
28
37
  } | {
@@ -1,10 +1,19 @@
1
+ import { RetrieveContributorsResponse } from '../types/contributorTypes';
1
2
  import { ApiQueryOverrides } from '../../../utils/types/apiQueryOverrides';
2
3
  import { Wretch } from 'wretch';
3
- import { RetrieveContributorsResponse } from '../contributors';
4
+ /**
5
+ * Factory for creating keys for the useRetrieveContributorQuery hook
6
+ */
4
7
  export declare const retrieveContributorKeys: {
5
8
  projectUserKey: (projectId: string, userId: number) => readonly ["RetrieveContributor", string, number];
6
9
  };
7
- export declare const useRetrieveContributorQuery: <T>(api: Wretch<T>, overrides: ApiQueryOverrides<RetrieveContributorsResponse, typeof retrieveContributorKeys>) => import('@tanstack/react-query').UseQueryResult<{
10
+ /**
11
+ * A react-router wrapper about the retrieveContributor public API endpoint
12
+ *
13
+ * @param wretchClient - Wretch instance configured to a public API instance.
14
+ * @param overrides - Additional options to pass to the query.
15
+ */
16
+ export declare const useRetrieveContributorQuery: <T>(wretchClient: Wretch<T>, overrides: ApiQueryOverrides<RetrieveContributorsResponse, typeof retrieveContributorKeys>) => import('@tanstack/react-query').UseQueryResult<{
8
17
  contributors: {
9
18
  email: string;
10
19
  user_id: number;
@@ -1,20 +1,29 @@
1
1
  import { ApiQueryOverrides } from '../../../utils/types/apiQueryOverrides';
2
2
  import { Wretch } from 'wretch';
3
- import { Project } from '../types/project';
3
+ import { Project } from '../types/projectTypes';
4
+ /**
5
+ * Factory function to create the query key for the retrieveProject query
6
+ */
4
7
  export declare const retrieveProjectQueryKey: {
5
8
  projectIdKey: (projectId: string) => string[];
6
9
  };
7
- export declare function useRetrieveProjectQuery<T>(api: Wretch<T>, overrides: ApiQueryOverrides<Project, typeof retrieveProjectQueryKey>): import('@tanstack/react-query').UseQueryResult<{
10
+ /**
11
+ * A react-router wrapper about the retrieveProject public API endpoint
12
+ *
13
+ * @param wretchClient - Wretch instance configured to a public API instance.
14
+ * @param overrides - Additional options to pass to the query.
15
+ */
16
+ export declare function useRetrieveProjectQuery<T>(wretchClient: Wretch<T>, overrides: ApiQueryOverrides<Project, typeof retrieveProjectQueryKey>): import('@tanstack/react-query').UseQueryResult<{
8
17
  name: string;
9
18
  created_at: string;
10
19
  created_at_timestamp: number;
11
- project_id: string;
20
+ team_id: number;
12
21
  description: string;
22
+ project_id: string;
13
23
  uuid: string;
14
24
  project_type: "localization_files" | "paged_documents" | "marketing";
15
25
  created_by: number;
16
26
  created_by_email: string;
17
- team_id: number;
18
27
  base_language_id: number;
19
28
  base_language_iso: string;
20
29
  settings: {
@@ -2,9 +2,12 @@ export * from './contributors';
2
2
  export * from './projects';
3
3
  export * from './teamUsers';
4
4
  export * from './userToken';
5
- export type { LanguageStatistics, LanguageIso } from './types/language';
6
- export type { Project, ProjectQaIssues, ProjectType, ProjectSettings } from './types/project';
7
- export type { TeamRole } from './types/teamRole';
5
+ export type { LanguageStatistics, LanguageIso } from './types/languageTypes';
6
+ export type { Project, ProjectQaIssues, ProjectType, ProjectSettings } from './types/projectTypes';
7
+ export type { TeamRole } from './types/teamRoleTypes';
8
+ export type { Contributor, ContributorLanguage } from './types/contributorTypes';
9
+ export type { TeamUser } from './types/teamUserTypes';
10
+ export type { AuthenticatedRequestHeader, JwtToken } from './types/userTokenTypes';
8
11
  export * from './hooks/useCreateProjectMutation';
9
12
  export * from './hooks/useGetTeamUsersQuery';
10
13
  export * from './hooks/useGetUserTokenQuery';