@carlonicora/nextjs-jsonapi 3.0.0 → 3.1.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 (90) hide show
  1. package/dist/AbstractApiData-DtitRWPz.d.ts +47 -0
  2. package/dist/AbstractApiData-XLhBP5Tl.d.mts +47 -0
  3. package/dist/{BlockNoteEditor-CDTU6DRN.js → BlockNoteEditor-4KBDD2TM.js} +20 -20
  4. package/dist/{BlockNoteEditor-CDTU6DRN.js.map → BlockNoteEditor-4KBDD2TM.js.map} +1 -1
  5. package/dist/{BlockNoteEditor-VVAY73V2.mjs → BlockNoteEditor-LJ2KA44Z.mjs} +5 -5
  6. package/dist/{JsonApiRequest-3UWVIIFL.mjs → JsonApiRequest-2OQCZAK6.mjs} +2 -2
  7. package/dist/JsonApiRequest-6TYNBVUL.js +26 -0
  8. package/dist/{JsonApiRequest-QRU3IPIU.js.map → JsonApiRequest-6TYNBVUL.js.map} +1 -1
  9. package/dist/ai-connection.module-28f-hux0.d.mts +255 -0
  10. package/dist/ai-connection.module-Bqwh_DnR.d.ts +255 -0
  11. package/dist/billing/index.js +399 -399
  12. package/dist/billing/index.mjs +4 -4
  13. package/dist/{chunk-TWXKAY34.mjs → chunk-CGJW7ZZM.mjs} +310 -5
  14. package/dist/chunk-CGJW7ZZM.mjs.map +1 -0
  15. package/dist/{chunk-E5YA5Z5X.mjs → chunk-CMGXH5SA.mjs} +2 -1
  16. package/dist/chunk-CMGXH5SA.mjs.map +1 -0
  17. package/dist/{chunk-JKGEJGSD.js → chunk-H7DOSB7W.js} +9 -9
  18. package/dist/{chunk-JKGEJGSD.js.map → chunk-H7DOSB7W.js.map} +1 -1
  19. package/dist/{chunk-FPO4DLZN.js → chunk-PFAZPP54.js} +2 -1
  20. package/dist/chunk-PFAZPP54.js.map +1 -0
  21. package/dist/{chunk-UGNLKDI6.js → chunk-UYOQG5IW.js} +1628 -959
  22. package/dist/chunk-UYOQG5IW.js.map +1 -0
  23. package/dist/{chunk-J54546YC.mjs → chunk-WCRZEBX4.mjs} +1750 -1081
  24. package/dist/chunk-WCRZEBX4.mjs.map +1 -0
  25. package/dist/{chunk-53B6NPGA.js → chunk-YUXCJ35V.js} +377 -72
  26. package/dist/chunk-YUXCJ35V.js.map +1 -0
  27. package/dist/{chunk-PHEFWL6L.mjs → chunk-ZMYZFQN3.mjs} +3 -3
  28. package/dist/client/index.js +5 -5
  29. package/dist/client/index.mjs +4 -4
  30. package/dist/components/index.d.mts +122 -4
  31. package/dist/components/index.d.ts +122 -4
  32. package/dist/components/index.js +31 -5
  33. package/dist/components/index.js.map +1 -1
  34. package/dist/components/index.mjs +30 -4
  35. package/dist/{config-BIjrg5wd.d.ts → config-B6UB7j69.d.ts} +1 -46
  36. package/dist/{config-BRUjtCd1.d.mts → config-n-ZpPmOL.d.mts} +1 -46
  37. package/dist/contexts/index.js +5 -5
  38. package/dist/contexts/index.mjs +4 -4
  39. package/dist/core/index.d.mts +5 -4
  40. package/dist/core/index.d.ts +5 -4
  41. package/dist/core/index.js +11 -3
  42. package/dist/core/index.js.map +1 -1
  43. package/dist/core/index.mjs +10 -2
  44. package/dist/features/help/index.js +38 -38
  45. package/dist/features/help/index.mjs +4 -4
  46. package/dist/features/tokenusage/index.d.mts +2 -2
  47. package/dist/features/tokenusage/index.d.ts +2 -2
  48. package/dist/features/tokenusage/index.js +102 -102
  49. package/dist/features/tokenusage/index.mjs +4 -4
  50. package/dist/index.d.mts +3 -3
  51. package/dist/index.d.ts +3 -3
  52. package/dist/index.js +12 -4
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +11 -3
  55. package/dist/server/index.js +12 -12
  56. package/dist/server/index.mjs +2 -2
  57. package/package.json +1 -1
  58. package/src/components/index.ts +1 -0
  59. package/src/core/index.ts +5 -0
  60. package/src/core/registry/ModuleRegistry.ts +2 -0
  61. package/src/core/utils/translateResponse.ts +6 -0
  62. package/src/features/administration/components/AdminIndexContainer.tsx +9 -2
  63. package/src/features/ai-connection/ai-connection.module.ts +14 -0
  64. package/src/features/ai-connection/components/containers/AiConnectionsContainer.tsx +109 -0
  65. package/src/features/ai-connection/components/forms/AiConnectionDeleter.tsx +58 -0
  66. package/src/features/ai-connection/components/forms/AiConnectionEditor.tsx +329 -0
  67. package/src/features/ai-connection/components/lists/AiConnectionTypeCard.tsx +223 -0
  68. package/src/features/ai-connection/contexts/AiConnectionsContext.tsx +111 -0
  69. package/src/features/ai-connection/data/__tests__/ai-connection.test.ts +202 -0
  70. package/src/features/ai-connection/data/ai-connection.fields.ts +6 -0
  71. package/src/features/ai-connection/data/ai-connection.interface.ts +87 -0
  72. package/src/features/ai-connection/data/ai-connection.service.ts +90 -0
  73. package/src/features/ai-connection/data/ai-connection.ts +244 -0
  74. package/src/features/ai-connection/data/index.ts +4 -0
  75. package/src/features/ai-connection/i18n-keys.ts +66 -0
  76. package/src/features/ai-connection/index.ts +11 -0
  77. package/src/features/index.ts +1 -0
  78. package/src/features/user/components/forms/UserEditor.tsx +11 -2
  79. package/dist/AuthComponent-Cik96ElA.d.mts +0 -56
  80. package/dist/AuthComponent-DTTKu3VK.d.ts +0 -56
  81. package/dist/JsonApiRequest-QRU3IPIU.js +0 -26
  82. package/dist/chunk-53B6NPGA.js.map +0 -1
  83. package/dist/chunk-E5YA5Z5X.mjs.map +0 -1
  84. package/dist/chunk-FPO4DLZN.js.map +0 -1
  85. package/dist/chunk-J54546YC.mjs.map +0 -1
  86. package/dist/chunk-TWXKAY34.mjs.map +0 -1
  87. package/dist/chunk-UGNLKDI6.js.map +0 -1
  88. /package/dist/{BlockNoteEditor-VVAY73V2.mjs.map → BlockNoteEditor-LJ2KA44Z.mjs.map} +0 -0
  89. /package/dist/{JsonApiRequest-3UWVIIFL.mjs.map → JsonApiRequest-2OQCZAK6.mjs.map} +0 -0
  90. /package/dist/{chunk-PHEFWL6L.mjs.map → chunk-ZMYZFQN3.mjs.map} +0 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The fixed namespace of i18n keys the AI connection administration surfaces
3
+ * read via useTranslations. Consuming apps must define each entry in their
4
+ * messages/<locale>.json — this list is the contract between the package and
5
+ * the app, and the names are frozen: an app that wants different wording
6
+ * changes its own translation, never the key.
7
+ *
8
+ * Mirrors the contract shipped by the administration feature
9
+ * (features/administration/i18n-keys.ts) and the billing admin surfaces
10
+ * (features/billing/i18n-keys.ts).
11
+ */
12
+ export const AI_CONNECTIONS_I18N_KEYS = [
13
+ "ai_connections.admin.title",
14
+ "ai_connections.admin.entity",
15
+ "ai_connections.admin.create",
16
+ "ai_connections.admin.scope.global",
17
+ "ai_connections.admin.scope.company",
18
+ "ai_connections.admin.scope.inherits_global",
19
+ "ai_connections.admin.env_fallback",
20
+ "ai_connections.admin.empty.title",
21
+ "ai_connections.admin.empty.description",
22
+ "ai_connections.admin.types.ai",
23
+ "ai_connections.admin.types.aiLite",
24
+ "ai_connections.admin.types.aiLarge",
25
+ "ai_connections.admin.types.vision",
26
+ "ai_connections.admin.types.audio",
27
+ "ai_connections.admin.types.embedder",
28
+ "ai_connections.admin.types.transcriber",
29
+ "ai_connections.admin.types.documentAi",
30
+ "ai_connections.admin.fields.name",
31
+ "ai_connections.admin.fields.provider",
32
+ "ai_connections.admin.fields.model",
33
+ "ai_connections.admin.fields.url",
34
+ "ai_connections.admin.fields.apiKey",
35
+ "ai_connections.admin.fields.region",
36
+ "ai_connections.admin.fields.instance",
37
+ "ai_connections.admin.fields.apiVersion",
38
+ "ai_connections.admin.fields.googleCredentialsBase64",
39
+ "ai_connections.admin.fields.allowFallbacks",
40
+ "ai_connections.admin.fields.reasoningEffort",
41
+ "ai_connections.admin.fields.maxOutputTokens",
42
+ "ai_connections.admin.fields.dimensions",
43
+ "ai_connections.admin.fields.inputCostPer1MTokens",
44
+ "ai_connections.admin.fields.outputCostPer1MTokens",
45
+ "ai_connections.admin.fields.cachedInputCostPer1MTokens",
46
+ "ai_connections.admin.fields.costPerMinute",
47
+ "ai_connections.admin.fields.costPerPage",
48
+ "ai_connections.admin.fields.directUrl",
49
+ "ai_connections.admin.fields.language",
50
+ "ai_connections.admin.fields.directFormat",
51
+ "ai_connections.admin.fields.directProvider",
52
+ "ai_connections.admin.fields.enabled",
53
+ "ai_connections.admin.fields.costs_section",
54
+ "ai_connections.admin.placeholders.name",
55
+ "ai_connections.admin.placeholders.secret_unchanged",
56
+ "ai_connections.admin.reorder.up",
57
+ "ai_connections.admin.reorder.down",
58
+ "ai_connections.admin.errors.name",
59
+ "ai_connections.admin.errors.required_field",
60
+ "ai_connections.admin.embedder_warning.title",
61
+ "ai_connections.admin.embedder_warning.description",
62
+ "ai_connections.admin.delete.title",
63
+ "ai_connections.admin.delete.description",
64
+ "ai_connections.admin.delete.confirm",
65
+ "administration.ai_connections.description",
66
+ ] as const;
@@ -0,0 +1,11 @@
1
+ export * from "./data";
2
+ export * from "./ai-connection.module";
3
+ export { AI_CONNECTIONS_I18N_KEYS } from "./i18n-keys";
4
+
5
+ // Client surfaces of the feature. Owned by the components task; listed here so
6
+ // the barrel is the single entry point for the whole feature.
7
+ export * from "./contexts/AiConnectionsContext";
8
+ export * from "./components/containers/AiConnectionsContainer";
9
+ export * from "./components/lists/AiConnectionTypeCard";
10
+ export * from "./components/forms/AiConnectionEditor";
11
+ export * from "./components/forms/AiConnectionDeleter";
@@ -1,4 +1,5 @@
1
1
  // S3 feature exports
2
+ export * from "./ai-connection";
2
3
  export * from "./assistant-action";
3
4
  export * from "./auth";
4
5
  export * from "./billing";
@@ -108,7 +108,12 @@ function UserEditorInternal({
108
108
  const formSchema = useMemo(
109
109
  () =>
110
110
  z.object({
111
- id: z.uuidv4(),
111
+ // Any UUID version: on edit this is the PERSISTED id, and seeded/legacy
112
+ // users can carry a non-v4 uuid (the migration-created Administrator is
113
+ // v1). `z.uuidv4()` rejected those, and because `id` has no rendered
114
+ // field the failure was invisible — handleSubmit simply never fired.
115
+ // New users still get a v4 from `v4()` in getDefaultValues.
116
+ id: z.uuid(),
112
117
  name: z.string().min(1, { message: t(`user.fields.name.error`) }),
113
118
  email: z.string().min(1, { message: t(`common.fields.email.error`) }),
114
119
  password: z.string().optional(),
@@ -205,7 +210,11 @@ function UserEditorInternal({
205
210
  avatar: resetImage ? undefined : values.avatar,
206
211
  roleIds: values.roleIds,
207
212
  sendInvitationEmail: values.sendInvitationEmail,
208
- companyId: company!.id,
213
+ // Optional: `companyId` only sets the `x-companyid` header, and a user
214
+ // can legitimately have no company (the seeded Administrator does), in
215
+ // which case `company` is null here. `company!.id` threw a TypeError
216
+ // and surfaced as a generic "update failed" toast.
217
+ companyId: company?.id,
209
218
  adminCreated: adminCreated,
210
219
  };
211
220
 
@@ -1,56 +0,0 @@
1
- import { LucideIcon } from 'lucide-react';
2
- import { ReactNode } from 'react';
3
- import { A as ApiDataInterface } from './ApiDataInterface-BcZeXy5X.mjs';
4
- import { M as ModuleWithPermissions } from './types-Bq_UA8Lg.mjs';
5
-
6
- declare function getInitials(name: string): string;
7
- declare function getInitials(firstName: string, lastName: string): string;
8
-
9
- declare const getIconByModule: (params: {
10
- module: ModuleWithPermissions;
11
- className?: string;
12
- }) => ReactNode;
13
- declare const getIcon: (params: {
14
- element: ApiDataInterface;
15
- className?: string;
16
- }) => ReactNode;
17
- declare const getIconByModuleName: (params: {
18
- name: string;
19
- className?: string;
20
- }) => ReactNode;
21
- declare const getLucideIcon: (params: {
22
- element: ApiDataInterface;
23
- }) => LucideIcon | null;
24
- declare const getLucideIconByModule: (params: {
25
- module: ModuleWithPermissions;
26
- }) => LucideIcon | null;
27
- declare const getLucideIconByModuleName: (params: {
28
- name: string;
29
- }) => LucideIcon | null;
30
-
31
- interface TotpAuthenticatorInterface extends ApiDataInterface {
32
- get name(): string;
33
- get verified(): boolean;
34
- get lastUsedAt(): Date | undefined;
35
- }
36
-
37
- interface PasskeyInterface extends ApiDataInterface {
38
- get name(): string;
39
- get credentialId(): string;
40
- get deviceType(): string;
41
- get backedUp(): boolean;
42
- get lastUsedAt(): Date | undefined;
43
- }
44
-
45
- declare enum AuthComponent {
46
- Login = 0,
47
- ForgotPassword = 1,
48
- ResetPassword = 2,
49
- ActivateAccount = 3,
50
- AcceptInvitation = 4,
51
- Register = 5,
52
- Landing = 6,
53
- TwoFactorChallenge = "2fa_challenge"
54
- }
55
-
56
- export { AuthComponent as A, type PasskeyInterface as P, type TotpAuthenticatorInterface as T, getIconByModule as a, getIcon as b, getIconByModuleName as c, getLucideIcon as d, getLucideIconByModule as e, getLucideIconByModuleName as f, getInitials as g };
@@ -1,56 +0,0 @@
1
- import { LucideIcon } from 'lucide-react';
2
- import { ReactNode } from 'react';
3
- import { A as ApiDataInterface } from './ApiDataInterface-BcZeXy5X.js';
4
- import { M as ModuleWithPermissions } from './types-bsm8Fp55.js';
5
-
6
- declare function getInitials(name: string): string;
7
- declare function getInitials(firstName: string, lastName: string): string;
8
-
9
- declare const getIconByModule: (params: {
10
- module: ModuleWithPermissions;
11
- className?: string;
12
- }) => ReactNode;
13
- declare const getIcon: (params: {
14
- element: ApiDataInterface;
15
- className?: string;
16
- }) => ReactNode;
17
- declare const getIconByModuleName: (params: {
18
- name: string;
19
- className?: string;
20
- }) => ReactNode;
21
- declare const getLucideIcon: (params: {
22
- element: ApiDataInterface;
23
- }) => LucideIcon | null;
24
- declare const getLucideIconByModule: (params: {
25
- module: ModuleWithPermissions;
26
- }) => LucideIcon | null;
27
- declare const getLucideIconByModuleName: (params: {
28
- name: string;
29
- }) => LucideIcon | null;
30
-
31
- interface TotpAuthenticatorInterface extends ApiDataInterface {
32
- get name(): string;
33
- get verified(): boolean;
34
- get lastUsedAt(): Date | undefined;
35
- }
36
-
37
- interface PasskeyInterface extends ApiDataInterface {
38
- get name(): string;
39
- get credentialId(): string;
40
- get deviceType(): string;
41
- get backedUp(): boolean;
42
- get lastUsedAt(): Date | undefined;
43
- }
44
-
45
- declare enum AuthComponent {
46
- Login = 0,
47
- ForgotPassword = 1,
48
- ResetPassword = 2,
49
- ActivateAccount = 3,
50
- AcceptInvitation = 4,
51
- Register = 5,
52
- Landing = 6,
53
- TwoFactorChallenge = "2fa_challenge"
54
- }
55
-
56
- export { AuthComponent as A, type PasskeyInterface as P, type TotpAuthenticatorInterface as T, getIconByModule as a, getIcon as b, getIconByModuleName as c, getLucideIcon as d, getLucideIconByModule as e, getLucideIconByModuleName as f, getInitials as g };
@@ -1,26 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
- var _chunkFPO4DLZNjs = require('./chunk-FPO4DLZN.js');
13
- require('./chunk-7QVYU63E.js');
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
- exports.JsonApiDelete = _chunkFPO4DLZNjs.JsonApiDelete; exports.JsonApiGet = _chunkFPO4DLZNjs.JsonApiGet; exports.JsonApiPatch = _chunkFPO4DLZNjs.JsonApiPatch; exports.JsonApiPost = _chunkFPO4DLZNjs.JsonApiPost; exports.JsonApiPut = _chunkFPO4DLZNjs.JsonApiPut; exports.buildUrl = _chunkFPO4DLZNjs.buildUrl; exports.configureJsonApi = _chunkFPO4DLZNjs.configureJsonApi; exports.getApiUrl = _chunkFPO4DLZNjs.getApiUrl; exports.getAppUrl = _chunkFPO4DLZNjs.getAppUrl; exports.getTrackablePages = _chunkFPO4DLZNjs.getTrackablePages;
26
- //# sourceMappingURL=JsonApiRequest-QRU3IPIU.js.map