@lokalise/harmony 1.8.2 → 1.11.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 (52) hide show
  1. package/README.md +63 -0
  2. package/dist/harmony.cjs +1 -1
  3. package/dist/harmony.mjs +923 -507
  4. package/dist/types/src/features/auth/backend/services/getAuthenticatedSessionDetailFromRequest.d.ts +10 -0
  5. package/dist/types/src/features/auth/backend/services/getAuthenticatedSessionPayloadFromRequest.test.d.ts +1 -0
  6. package/dist/types/src/features/auth/core/jwtTokenPayload.d.ts +7 -0
  7. package/dist/types/src/features/auth/core/jwtTokenPayload.test.d.ts +1 -0
  8. package/dist/types/src/features/auth/core/lokaliseAuthAddon.d.ts +14 -0
  9. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.d.ts +13 -0
  10. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.test.d.ts +1 -0
  11. package/dist/types/src/features/auth/core/middleware/publicApiHeadersMiddleware.d.ts +5 -0
  12. package/dist/types/src/features/auth/core/types/jwtTokenPayload.d.ts +42 -0
  13. package/dist/types/src/features/auth/core/types/jwtTokenPayload.fixture.d.ts +27 -0
  14. package/dist/types/src/features/auth/core/utils/makeAuthHeader.d.ts +2 -0
  15. package/dist/types/src/features/auth/core/utils/makeAuthHeader.test.d.ts +1 -0
  16. package/dist/types/src/features/auth/frontend/addon/lokaliseAuthBrowserAddon.d.ts +35 -0
  17. package/dist/types/src/features/auth/frontend/events/NewJwtIssuedEvent.d.ts +20 -0
  18. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedProjectContributor.d.ts +28 -0
  19. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedSessionPayload.d.ts +18 -0
  20. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedUser.d.ts +18 -0
  21. package/dist/types/src/features/auth/frontend/hooks/useGetPromotedClassicSessionJwtQuery.d.ts +12 -0
  22. package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.d.ts +14 -0
  23. package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.test.d.ts +1 -0
  24. package/dist/types/src/features/auth/frontend/utils/cookieTokenUtils.d.ts +4 -0
  25. package/dist/types/src/features/auth/frontend/utils/cookieTokenUtils.test.d.ts +1 -0
  26. package/dist/types/src/features/auth/node.d.ts +9 -0
  27. package/dist/types/src/features/node.d.ts +2 -0
  28. package/dist/types/src/features/publicApi/contributors.d.ts +111 -0
  29. package/dist/types/src/features/publicApi/hooks/useCreateProjectMutation.d.ts +76 -0
  30. package/dist/types/src/features/publicApi/hooks/useGetTeamUsersQuery.d.ts +26 -0
  31. package/dist/types/src/features/publicApi/hooks/useGetUserTokenQuery.d.ts +20 -0
  32. package/dist/types/src/features/publicApi/hooks/useListProjectsQuery.d.ts +81 -0
  33. package/dist/types/src/features/publicApi/hooks/useRetrieveContributorQuery.d.ts +34 -0
  34. package/dist/types/src/features/publicApi/hooks/useRetrieveProjectQuery.d.ts +72 -0
  35. package/dist/types/src/features/publicApi/node.d.ts +16 -0
  36. package/dist/types/src/features/publicApi/projects.d.ts +1132 -0
  37. package/dist/types/src/features/publicApi/teamUsers.d.ts +61 -0
  38. package/dist/types/src/features/publicApi/types/contributorTypes.d.ts +171 -0
  39. package/dist/types/src/features/publicApi/types/languageTypes.d.ts +29 -0
  40. package/dist/types/src/features/publicApi/types/projectTypes.d.ts +1061 -0
  41. package/dist/types/src/features/publicApi/types/teamRoleTypes.d.ts +3 -0
  42. package/dist/types/src/features/publicApi/types/teamUserTypes.d.ts +70 -0
  43. package/dist/types/src/features/publicApi/types/userTokenTypes.d.ts +26 -0
  44. package/dist/types/src/features/publicApi/userToken.d.ts +35 -0
  45. package/dist/types/src/node.d.ts +2 -1
  46. package/dist/types/src/utils/testing/createMockFactoryWithDefaults.d.ts +2 -0
  47. package/dist/types/src/utils/testing/createMockFactoryWithDefaults.test.d.ts +1 -0
  48. package/dist/types/src/utils/testing/deepOverride.d.ts +4 -0
  49. package/dist/types/src/utils/testing/deepOverride.test.d.ts +1 -0
  50. package/dist/types/src/utils/types/apiMutationOverrides.d.ts +2 -0
  51. package/dist/types/src/utils/types/apiQueryOverrides.d.ts +2 -0
  52. package/package.json +13 -2
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const TEAM_ROLE_SCHEMA: z.ZodUnion<[z.ZodLiteral<"owner">, z.ZodLiteral<"admin">, z.ZodLiteral<"biller">, z.ZodLiteral<"member">]>;
3
+ export type TeamRole = z.infer<typeof TEAM_ROLE_SCHEMA>;
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ export declare const TEAM_USER_SCHEMA: z.ZodObject<{
3
+ user_id: z.ZodNumber;
4
+ email: z.ZodString;
5
+ fullname: z.ZodString;
6
+ created_at: z.ZodString;
7
+ created_at_timestamp: z.ZodNumber;
8
+ role: z.ZodUnion<[z.ZodLiteral<"owner">, z.ZodLiteral<"admin">, z.ZodLiteral<"biller">, z.ZodLiteral<"member">]>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ role: "member" | "admin" | "biller" | "owner";
11
+ email: string;
12
+ user_id: number;
13
+ fullname: string;
14
+ created_at: string;
15
+ created_at_timestamp: number;
16
+ }, {
17
+ role: "member" | "admin" | "biller" | "owner";
18
+ email: string;
19
+ user_id: number;
20
+ fullname: string;
21
+ created_at: string;
22
+ created_at_timestamp: number;
23
+ }>;
24
+ export type TeamUser = z.infer<typeof TEAM_USER_SCHEMA>;
25
+ export declare const TEAM_USER_RESPONSE_SCHEMA: z.ZodObject<{
26
+ team_id: z.ZodNumber;
27
+ team_user: z.ZodObject<{
28
+ user_id: z.ZodNumber;
29
+ email: z.ZodString;
30
+ fullname: z.ZodString;
31
+ created_at: z.ZodString;
32
+ created_at_timestamp: z.ZodNumber;
33
+ role: z.ZodUnion<[z.ZodLiteral<"owner">, z.ZodLiteral<"admin">, z.ZodLiteral<"biller">, z.ZodLiteral<"member">]>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ role: "member" | "admin" | "biller" | "owner";
36
+ email: string;
37
+ user_id: number;
38
+ fullname: string;
39
+ created_at: string;
40
+ created_at_timestamp: number;
41
+ }, {
42
+ role: "member" | "admin" | "biller" | "owner";
43
+ email: string;
44
+ user_id: number;
45
+ fullname: string;
46
+ created_at: string;
47
+ created_at_timestamp: number;
48
+ }>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ team_id: number;
51
+ team_user: {
52
+ role: "member" | "admin" | "biller" | "owner";
53
+ email: string;
54
+ user_id: number;
55
+ fullname: string;
56
+ created_at: string;
57
+ created_at_timestamp: number;
58
+ };
59
+ }, {
60
+ team_id: number;
61
+ team_user: {
62
+ role: "member" | "admin" | "biller" | "owner";
63
+ email: string;
64
+ user_id: number;
65
+ fullname: string;
66
+ created_at: string;
67
+ created_at_timestamp: number;
68
+ };
69
+ }>;
70
+ export type TeamUserResponse = z.infer<typeof TEAM_USER_RESPONSE_SCHEMA>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ export declare const JWT_TOKEN_SCHEMA: z.ZodObject<{
3
+ accessToken: z.ZodString;
4
+ refreshToken: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ accessToken: string;
7
+ refreshToken: string;
8
+ }, {
9
+ accessToken: string;
10
+ refreshToken: string;
11
+ }>;
12
+ export type JwtToken = z.infer<typeof JWT_TOKEN_SCHEMA>;
13
+ export declare const AUTHENTICATED_REQUEST_HEADER: z.ZodUnion<[z.ZodObject<{
14
+ Authorization: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ Authorization: string;
17
+ }, {
18
+ Authorization: string;
19
+ }>, z.ZodObject<{
20
+ 'x-csrf-token': z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ 'x-csrf-token': string;
23
+ }, {
24
+ 'x-csrf-token': string;
25
+ }>]>;
26
+ export type AuthenticatedRequestHeader = z.infer<typeof AUTHENTICATED_REQUEST_HEADER>;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A method of getting a JWT token for a user.
4
+ * You can call this with either a refresh token or from within the scope of a classic CSRF cookie session.
5
+ */
6
+ export declare const getUserToken: import('@lokalise/universal-ts-utils/node').PayloadRouteDefinition<{
7
+ teamId: number;
8
+ }, z.ZodUndefined, z.ZodObject<{
9
+ accessToken: z.ZodString;
10
+ refreshToken: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ accessToken: string;
13
+ refreshToken: string;
14
+ }, {
15
+ accessToken: string;
16
+ refreshToken: string;
17
+ }>, z.ZodObject<{
18
+ teamId: z.ZodNumber;
19
+ }, "strip", z.ZodTypeAny, {
20
+ teamId: number;
21
+ }, {
22
+ teamId: number;
23
+ }>, undefined, z.ZodUnion<[z.ZodObject<{
24
+ Authorization: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ Authorization: string;
27
+ }, {
28
+ Authorization: string;
29
+ }>, z.ZodObject<{
30
+ 'x-csrf-token': z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ 'x-csrf-token': string;
33
+ }, {
34
+ 'x-csrf-token': string;
35
+ }>]>, false, false>;
@@ -6,4 +6,5 @@ export { NavigationPanel } from './components/NavigationPanel/NavigationPanel';
6
6
  export { Sidebar } from './components/Sidebar/Sidebar';
7
7
  export { Breadcrumbs } from './components/NavigationPanel/components/Breadcrumbs/Breadcrumbs';
8
8
  export { NavigationTabs } from './components/NavigationPanel/components/NavigationTabs/NavigationTabs';
9
- export * from './utils/node';
9
+ export * from './features/node';
10
+ export * from './utils/node.ts';
@@ -0,0 +1,2 @@
1
+ import { DeepPartial } from './deepOverride';
2
+ export declare const createMockFactoryWithDefaults: <T extends object>(defaults: T) => (overrides?: DeepPartial<T>, removeProperties?: (keyof T)[]) => T;
@@ -0,0 +1,4 @@
1
+ export type DeepPartial<T> = T extends object ? {
2
+ [K in keyof T]?: DeepPartial<T[K]>;
3
+ } : T;
4
+ export declare const deepOverride: <T extends object>(defaults: T, overrides: DeepPartial<T> | undefined, removeProperties?: (keyof T)[]) => T;
@@ -0,0 +1,2 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ export type ApiMutationOverrides<Data, Variables, Error = undefined, Context = undefined> = Omit<UseMutationOptions<Data, Error, Variables, Context>, 'mutationFn'>;
@@ -0,0 +1,2 @@
1
+ import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
2
+ export type ApiQueryOverrides<Data, QueryKeyFactory extends Record<string, (...args: any[]) => QueryKey>, SelectedData = Data, Error = undefined> = Omit<UseQueryOptions<Data, Error, SelectedData, ReturnType<QueryKeyFactory[keyof QueryKeyFactory]>>, 'queryFn'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/harmony",
3
- "version": "1.8.2",
3
+ "version": "1.11.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"
@@ -30,12 +30,17 @@
30
30
  "storybook:build": "storybook build"
31
31
  },
32
32
  "peerDependencies": {
33
+ "@lokalise/frontend-http-client": ">=3.2.1",
33
34
  "@lokalise/louis": ">=26.0.0",
34
35
  "@lokalise/token-dictionary": ">=2.42.1",
36
+ "@lokalise/universal-ts-utils": ">=3.4.0",
37
+ "@tanstack/react-query": ">=5.66.9",
35
38
  "date-fns": ">=4.1",
36
39
  "date-fns-tz": ">=3.2",
37
40
  "react": "^18.0.0 || ^19.0.0",
38
- "react-dom": "^18.0.0 || ^19.0.0"
41
+ "react-dom": "^18.0.0 || ^19.0.0",
42
+ "wretch": ">=2.11.0",
43
+ "zod": ">=3.23.8"
39
44
  },
40
45
  "devDependencies": {
41
46
  "@biomejs/biome": "^1.9.4",
@@ -70,7 +75,9 @@
70
75
  "eslint-plugin-i18next": "^6.0.9",
71
76
  "eslint-plugin-storybook": "^0.11.4",
72
77
  "eslint-plugin-testing-library": "^7.1.1",
78
+ "vitest-fail-on-console": "^0.7.1",
73
79
  "jsdom": "26.0.0",
80
+ "mockttp": "^3.16.0",
74
81
  "rimraf": "^6.0.1",
75
82
  "semantic-release": "^24.2.3",
76
83
  "storybook": "^8.6.0-alpha.1",
@@ -95,5 +102,9 @@
95
102
  "dependencies": {
96
103
  "clsx": "^2.1.1",
97
104
  "react-resize-detector": "^12.0.2"
105
+ },
106
+ "optionalDependencies": {
107
+ "@biomejs/cli-linux-x64": "^1.9.4",
108
+ "@rollup/rollup-linux-x64-gnu": "^4.34.9"
98
109
  }
99
110
  }