@lobehub/chat 1.79.7 → 1.79.9

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 (121) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +58 -0
  3. package/changelog/v1.json +18 -0
  4. package/docs/development/database-schema.dbml +119 -0
  5. package/locales/ar/models.json +12 -0
  6. package/locales/ar/oauth.json +40 -0
  7. package/locales/bg-BG/models.json +12 -0
  8. package/locales/bg-BG/oauth.json +40 -0
  9. package/locales/de-DE/models.json +12 -0
  10. package/locales/de-DE/oauth.json +40 -0
  11. package/locales/en-US/models.json +12 -0
  12. package/locales/en-US/oauth.json +40 -0
  13. package/locales/es-ES/models.json +12 -0
  14. package/locales/es-ES/oauth.json +40 -0
  15. package/locales/fa-IR/models.json +12 -0
  16. package/locales/fa-IR/oauth.json +40 -0
  17. package/locales/fr-FR/models.json +12 -0
  18. package/locales/fr-FR/oauth.json +40 -0
  19. package/locales/it-IT/models.json +12 -0
  20. package/locales/it-IT/oauth.json +40 -0
  21. package/locales/ja-JP/models.json +12 -0
  22. package/locales/ja-JP/oauth.json +40 -0
  23. package/locales/ko-KR/models.json +12 -0
  24. package/locales/ko-KR/oauth.json +40 -0
  25. package/locales/nl-NL/models.json +12 -0
  26. package/locales/nl-NL/oauth.json +40 -0
  27. package/locales/pl-PL/models.json +12 -0
  28. package/locales/pl-PL/oauth.json +40 -0
  29. package/locales/pt-BR/models.json +12 -0
  30. package/locales/pt-BR/oauth.json +40 -0
  31. package/locales/ru-RU/models.json +12 -0
  32. package/locales/ru-RU/oauth.json +40 -0
  33. package/locales/tr-TR/models.json +12 -0
  34. package/locales/tr-TR/oauth.json +40 -0
  35. package/locales/vi-VN/models.json +12 -0
  36. package/locales/vi-VN/oauth.json +40 -0
  37. package/locales/zh-CN/models.json +12 -0
  38. package/locales/zh-CN/oauth.json +40 -0
  39. package/locales/zh-TW/models.json +12 -0
  40. package/locales/zh-TW/oauth.json +40 -0
  41. package/package.json +4 -1
  42. package/scripts/generate-oidc-jwk.mjs +59 -0
  43. package/scripts/migrateServerDB/index.ts +3 -1
  44. package/src/app/(backend)/oidc/[...oidc]/route.ts +96 -0
  45. package/src/app/(backend)/oidc/consent/route.ts +131 -0
  46. package/src/app/(backend)/trpc/async/[trpc]/route.ts +1 -1
  47. package/src/app/(backend)/trpc/edge/[trpc]/route.ts +2 -2
  48. package/src/app/(backend)/trpc/lambda/[trpc]/route.ts +2 -2
  49. package/src/app/(backend)/trpc/tools/[trpc]/route.ts +2 -2
  50. package/src/app/[variants]/(main)/files/[id]/page.tsx +1 -1
  51. package/src/app/[variants]/oauth/consent/[uid]/Client.tsx +224 -0
  52. package/src/app/[variants]/oauth/consent/[uid]/ClientError.tsx +46 -0
  53. package/src/app/[variants]/oauth/consent/[uid]/failed/page.tsx +36 -0
  54. package/src/app/[variants]/oauth/consent/[uid]/page.tsx +69 -0
  55. package/src/app/[variants]/oauth/consent/[uid]/success/page.tsx +30 -0
  56. package/src/components/Branding/ProductLogo/index.tsx +6 -1
  57. package/src/config/aiModels/openai.ts +63 -41
  58. package/src/database/client/migrations.json +27 -8
  59. package/src/database/migrations/0020_add_oidc.sql +124 -0
  60. package/src/database/migrations/meta/0020_snapshot.json +4975 -0
  61. package/src/database/migrations/meta/_journal.json +7 -0
  62. package/src/database/repositories/tableViewer/index.test.ts +1 -1
  63. package/src/database/schemas/index.ts +1 -0
  64. package/src/database/schemas/oidc.ts +158 -0
  65. package/src/database/server/models/__tests__/adapter.test.ts +499 -0
  66. package/src/envs/oidc.ts +18 -0
  67. package/src/libs/agent-runtime/azureOpenai/index.ts +4 -1
  68. package/src/libs/agent-runtime/utils/streams/protocol.ts +2 -4
  69. package/src/libs/oidc-provider/adapter.ts +541 -0
  70. package/src/libs/oidc-provider/config.ts +52 -0
  71. package/src/libs/oidc-provider/http-adapter.ts +311 -0
  72. package/src/libs/oidc-provider/interaction-policy.ts +37 -0
  73. package/src/libs/oidc-provider/provider.ts +288 -0
  74. package/src/libs/trpc/async/init.ts +1 -1
  75. package/src/{server → libs/trpc/edge}/context.ts +2 -2
  76. package/src/libs/trpc/{index.ts → edge/index.ts} +8 -8
  77. package/src/libs/trpc/{init.ts → edge/init.ts} +2 -2
  78. package/src/libs/trpc/{middleware → edge/middleware}/jwtPayload.test.ts +3 -3
  79. package/src/libs/trpc/{middleware → edge/middleware}/jwtPayload.ts +3 -2
  80. package/src/libs/trpc/lambda/context.ts +70 -0
  81. package/src/libs/trpc/lambda/index.ts +39 -1
  82. package/src/libs/trpc/lambda/init.ts +26 -0
  83. package/src/libs/trpc/lambda/middleware/index.ts +2 -0
  84. package/src/libs/trpc/{middleware → lambda/middleware}/keyVaults.ts +2 -1
  85. package/src/libs/trpc/lambda/{serverDatabase.ts → middleware/serverDatabase.ts} +2 -1
  86. package/src/libs/trpc/middleware/userAuth.test.ts +3 -3
  87. package/src/libs/trpc/middleware/userAuth.ts +1 -1
  88. package/src/libs/trpc/mock.ts +7 -0
  89. package/src/locales/default/index.ts +2 -0
  90. package/src/locales/default/oauth.ts +43 -0
  91. package/src/middleware.ts +94 -6
  92. package/src/server/routers/edge/appStatus.ts +1 -1
  93. package/src/server/routers/edge/config/index.test.ts +2 -3
  94. package/src/server/routers/edge/config/index.ts +1 -1
  95. package/src/server/routers/edge/index.ts +1 -1
  96. package/src/server/routers/edge/upload.ts +1 -1
  97. package/src/server/routers/lambda/_template.ts +2 -2
  98. package/src/server/routers/lambda/agent.ts +2 -2
  99. package/src/server/routers/lambda/aiModel.ts +2 -2
  100. package/src/server/routers/lambda/aiProvider.ts +2 -2
  101. package/src/server/routers/lambda/chunk.ts +2 -3
  102. package/src/server/routers/lambda/exporter.ts +2 -2
  103. package/src/server/routers/lambda/file.ts +2 -2
  104. package/src/server/routers/lambda/importer.ts +2 -2
  105. package/src/server/routers/lambda/index.ts +1 -1
  106. package/src/server/routers/lambda/knowledgeBase.ts +2 -2
  107. package/src/server/routers/lambda/message.ts +2 -2
  108. package/src/server/routers/lambda/plugin.ts +2 -2
  109. package/src/server/routers/lambda/ragEval.ts +2 -3
  110. package/src/server/routers/lambda/session.ts +2 -2
  111. package/src/server/routers/lambda/sessionGroup.ts +2 -2
  112. package/src/server/routers/lambda/thread.ts +2 -2
  113. package/src/server/routers/lambda/topic.ts +2 -2
  114. package/src/server/routers/lambda/user.ts +2 -2
  115. package/src/server/routers/tools/__tests__/search.test.ts +2 -2
  116. package/src/server/routers/tools/index.ts +1 -1
  117. package/src/server/routers/tools/search.ts +2 -1
  118. package/src/server/services/oidc/index.ts +64 -0
  119. package/src/server/services/oidc/oidcProvider.ts +25 -0
  120. package/src/server/mock.ts +0 -8
  121. /package/src/{server/asyncContext.ts → libs/trpc/async/context.ts} +0 -0
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+
3
+ import { Typography } from 'antd';
4
+ import { createStyles } from 'antd-style';
5
+ import React, { memo } from 'react';
6
+ import { Center } from 'react-layout-kit';
7
+
8
+ interface ClientProps {
9
+ error: {
10
+ message: string;
11
+ title: string;
12
+ };
13
+ }
14
+
15
+ const { Title, Paragraph } = Typography;
16
+
17
+ const useStyles = createStyles(({ css, token }) => ({
18
+ container: css`
19
+ width: 100%;
20
+ min-height: 100vh;
21
+ color: ${token.colorTextBase};
22
+ background-color: ${token.colorBgLayout};
23
+ `,
24
+ error: css`
25
+ text-align: center;
26
+ `,
27
+ }));
28
+
29
+ const ConsentClientError = memo<ClientProps>(({ error }) => {
30
+ const { styles } = useStyles();
31
+
32
+ return (
33
+ <Center className={styles.container}>
34
+ <div className={styles.error}>
35
+ <Title level={2} style={{ color: 'inherit' }}>
36
+ {error.title}
37
+ </Title>
38
+ <Paragraph style={{ color: 'inherit' }}>{error.message}</Paragraph>
39
+ </div>
40
+ </Center>
41
+ );
42
+ });
43
+
44
+ ConsentClientError.displayName = 'ConsentClientError';
45
+
46
+ export default ConsentClientError;
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+
3
+ import { Icon } from '@lobehub/ui';
4
+ import { Button, Card, Result } from 'antd';
5
+ import { XCircle } from 'lucide-react';
6
+ import Link from 'next/link';
7
+ import React, { memo } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+ import { Center } from 'react-layout-kit';
10
+
11
+ const FailedPage = memo(() => {
12
+ const { t } = useTranslation('oauth');
13
+
14
+ return (
15
+ <Center height="100vh">
16
+ <Card style={{ maxWidth: 500, width: '100%' }}>
17
+ <Result
18
+ extra={
19
+ <Link href="/">
20
+ <Button type="primary">{t('failed.backToHome')}</Button>
21
+ </Link>
22
+ }
23
+ icon={<Icon icon={XCircle} />}
24
+ status="error"
25
+ style={{ padding: 0 }}
26
+ subTitle={t('failed.subTitle')}
27
+ title={t('failed.title')}
28
+ />
29
+ </Card>
30
+ </Center>
31
+ );
32
+ });
33
+
34
+ FailedPage.displayName = 'FailedPage';
35
+
36
+ export default FailedPage;
@@ -0,0 +1,69 @@
1
+ import { notFound } from 'next/navigation';
2
+
3
+ import { oidcEnv } from '@/envs/oidc';
4
+ import { OIDCService } from '@/server/services/oidc';
5
+
6
+ import ConsentClient from './Client';
7
+ import ConsentClientError from './ClientError';
8
+
9
+ const InteractionPage = async (props: { params: Promise<{ uid: string }> }) => {
10
+ if (!oidcEnv.ENABLE_OIDC) return notFound();
11
+
12
+ const params = await props.params;
13
+ const uid = params.uid;
14
+
15
+ try {
16
+ const oidcService = await OIDCService.initialize();
17
+
18
+ // 获取交互详情,传入请求和响应对象
19
+ const details = await oidcService.getInteractionDetails(uid);
20
+
21
+ // 支持 login 和 consent 类型的交互
22
+ if (details.prompt.name !== 'consent' && details.prompt.name !== 'login') {
23
+ return (
24
+ <ConsentClientError
25
+ error={{
26
+ message: `不支持的交互类型: ${details.prompt.name}`,
27
+ title: '不支持的交互类型',
28
+ }}
29
+ />
30
+ );
31
+ }
32
+
33
+ // 获取客户端 ID 和授权范围
34
+ const clientId = (details.params.client_id as string) || 'unknown';
35
+ const scopes = (details.params.scope as string)?.split(' ') || [];
36
+
37
+ const clientDetail = await oidcService.getClientMetadata(clientId);
38
+
39
+ // 渲染客户端组件,无论是 login 还是 consent 类型
40
+ return (
41
+ <ConsentClient
42
+ clientId={clientId}
43
+ clientMetadata={{
44
+ clientName: clientDetail?.client_name,
45
+ logo: clientDetail?.logo_uri,
46
+ }}
47
+ redirectUri={details.params.redirect_uri as string}
48
+ scopes={scopes}
49
+ uid={params.uid}
50
+ />
51
+ );
52
+ } catch (error) {
53
+ console.error('Error handling OIDC interaction:', error);
54
+ // 确保错误处理能正确显示
55
+ const errorMessage = error instanceof Error ? error.message : '获取授权详情时发生未知错误';
56
+ // 检查是否是 'interaction session not found' 错误,可以给用户更友好的提示
57
+ if (errorMessage.includes('interaction session not found')) {
58
+ return (
59
+ <ConsentClientError
60
+ error={{ message: '授权会话已过期或无效,请重新发起授权流程。', title: '授权会话无效' }}
61
+ />
62
+ );
63
+ }
64
+
65
+ return <ConsentClientError error={{ message: errorMessage, title: '发生错误' }} />;
66
+ }
67
+ };
68
+
69
+ export default InteractionPage;
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+
3
+ import { Icon } from '@lobehub/ui';
4
+ import { Card, Result } from 'antd';
5
+ import { CheckCircle } from 'lucide-react';
6
+ import React, { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { Center } from 'react-layout-kit';
9
+
10
+ const SuccessPage = memo(() => {
11
+ const { t } = useTranslation('oauth');
12
+
13
+ return (
14
+ <Center height="100vh">
15
+ <Card style={{ maxWidth: 500, width: '100%' }}>
16
+ <Result
17
+ icon={<Icon icon={CheckCircle} />}
18
+ status="success"
19
+ style={{ padding: 0 }}
20
+ subTitle={t('success.subTitle')}
21
+ title={t('success.title')}
22
+ />
23
+ </Card>
24
+ </Center>
25
+ );
26
+ });
27
+
28
+ SuccessPage.displayName = 'SuccessPage';
29
+
30
+ export default SuccessPage;
@@ -5,7 +5,12 @@ import { isCustomBranding } from '@/const/version';
5
5
 
6
6
  import CustomLogo from './Custom';
7
7
 
8
- export const ProductLogo = memo<LobeHubProps>((props) => {
8
+ interface ProductLogoProps extends LobeHubProps {
9
+ height?: number;
10
+ width?: number;
11
+ }
12
+
13
+ export const ProductLogo = memo<ProductLogoProps>((props) => {
9
14
  if (isCustomBranding) {
10
15
  return <CustomLogo {...props} />;
11
16
  }
@@ -8,6 +8,66 @@ import {
8
8
  } from '@/types/aiModel';
9
9
 
10
10
  export const openaiChatModels: AIChatModelCard[] = [
11
+ {
12
+ abilities: {
13
+ functionCall: true,
14
+ vision: true,
15
+ },
16
+ contextWindowTokens: 1_047_576,
17
+ description:
18
+ 'GPT-4.1 是我们用于复杂任务的旗舰模型。它非常适合跨领域解决问题。',
19
+ displayName: 'GPT-4.1',
20
+ enabled: true,
21
+ id: 'gpt-4.1',
22
+ maxOutput: 32_768,
23
+ pricing: {
24
+ cachedInput: 0.5,
25
+ input: 2,
26
+ output: 8,
27
+ },
28
+ releasedAt: '2025-04-14',
29
+ type: 'chat',
30
+ },
31
+ {
32
+ abilities: {
33
+ functionCall: true,
34
+ vision: true,
35
+ },
36
+ contextWindowTokens: 1_047_576,
37
+ description:
38
+ 'GPT-4.1 mini 提供了智能、速度和成本之间的平衡,使其成为许多用例中有吸引力的模型。',
39
+ displayName: 'GPT-4.1 mini',
40
+ enabled: true,
41
+ id: 'gpt-4.1-mini',
42
+ maxOutput: 32_768,
43
+ pricing: {
44
+ cachedInput: 0.1,
45
+ input: 0.4,
46
+ output: 1.6,
47
+ },
48
+ releasedAt: '2025-04-14',
49
+ type: 'chat',
50
+ },
51
+ {
52
+ abilities: {
53
+ functionCall: true,
54
+ vision: true,
55
+ },
56
+ contextWindowTokens: 1_047_576,
57
+ description:
58
+ 'GPT-4.1 mini 提供了智能、速度和成本之间的平衡,使其成为许多用例中有吸引力的模型。',
59
+ displayName: 'GPT-4.1 nano',
60
+ enabled: true,
61
+ id: 'gpt-4.1-nano',
62
+ maxOutput: 32_768,
63
+ pricing: {
64
+ cachedInput: 0.025,
65
+ input: 0.1,
66
+ output: 0.4,
67
+ },
68
+ releasedAt: '2025-04-14',
69
+ type: 'chat',
70
+ },
11
71
  {
12
72
  abilities: {
13
73
  functionCall: true,
@@ -36,7 +96,6 @@ export const openaiChatModels: AIChatModelCard[] = [
36
96
  description:
37
97
  'o1-mini是一款针对编程、数学和科学应用场景而设计的快速、经济高效的推理模型。该模型具有128K上下文和2023年10月的知识截止日期。',
38
98
  displayName: 'OpenAI o1-mini',
39
- enabled: true,
40
99
  id: 'o1-mini',
41
100
  maxOutput: 65_536,
42
101
  pricing: {
@@ -75,7 +134,6 @@ export const openaiChatModels: AIChatModelCard[] = [
75
134
  description:
76
135
  'o1是OpenAI新的推理模型,适用于需要广泛通用知识的复杂任务。该模型具有128K上下文和2023年10月的知识截止日期。',
77
136
  displayName: 'OpenAI o1-preview',
78
- enabled: true,
79
137
  id: 'o1-preview',
80
138
  maxOutput: 32_768,
81
139
  pricing: {
@@ -94,8 +152,7 @@ export const openaiChatModels: AIChatModelCard[] = [
94
152
  description:
95
153
  'GPT-4.5 的研究预览版,它是我们迄今为止最大、最强大的 GPT 模型。它拥有广泛的世界知识,并能更好地理解用户意图,使其在创造性任务和自主规划方面表现出色。GPT-4.5 可接受文本和图像输入,并生成文本输出(包括结构化输出)。支持关键的开发者功能,如函数调用、批量 API 和流式输出。在需要创造性、开放式思考和对话的任务(如写作、学习或探索新想法)中,GPT-4.5 表现尤为出色。知识截止日期为 2023 年 10 月。',
96
154
  displayName: 'GPT-4.5 Preview',
97
- enabled: true,
98
- id: 'gpt-4.5-preview',
155
+ id: 'gpt-4.5-preview', // deprecated on 2025-07-14
99
156
  maxOutput: 16_384,
100
157
  pricing: {
101
158
  cachedInput: 37.5,
@@ -114,7 +171,6 @@ export const openaiChatModels: AIChatModelCard[] = [
114
171
  description:
115
172
  'GPT-4o mini是OpenAI在GPT-4 Omni之后推出的最新模型,支持图文输入并输出文本。作为他们最先进的小型模型,它比其他近期的前沿模型便宜很多,并且比GPT-3.5 Turbo便宜超过60%。它保持了最先进的智能,同时具有显著的性价比。GPT-4o mini在MMLU测试中获得了 82% 的得分,目前在聊天偏好上排名高于 GPT-4。',
116
173
  displayName: 'GPT-4o mini',
117
- enabled: true,
118
174
  id: 'gpt-4o-mini',
119
175
  maxOutput: 16_384,
120
176
  pricing: {
@@ -136,6 +192,7 @@ export const openaiChatModels: AIChatModelCard[] = [
136
192
  displayName: 'GPT-4o 1120',
137
193
  id: 'gpt-4o-2024-11-20',
138
194
  pricing: {
195
+ cachedInput: 1.25,
139
196
  input: 2.5,
140
197
  output: 10,
141
198
  },
@@ -151,7 +208,6 @@ export const openaiChatModels: AIChatModelCard[] = [
151
208
  description:
152
209
  'ChatGPT-4o 是一款动态模型,实时更新以保持当前最新版本。它结合了强大的语言理解与生成能力,适合于大规模应用场景,包括客户服务、教育和技术支持。',
153
210
  displayName: 'GPT-4o',
154
- enabled: true,
155
211
  id: 'gpt-4o',
156
212
  pricing: {
157
213
  cachedInput: 1.25,
@@ -161,23 +217,6 @@ export const openaiChatModels: AIChatModelCard[] = [
161
217
  releasedAt: '2024-05-13',
162
218
  type: 'chat',
163
219
  },
164
- {
165
- abilities: {
166
- functionCall: true,
167
- vision: true,
168
- },
169
- contextWindowTokens: 128_000,
170
- description:
171
- 'ChatGPT-4o 是一款动态模型,实时更新以保持当前最新版本。它结合了强大的语言理解与生成能力,适合于大规模应用场景,包括客户服务、教育和技术支持。',
172
- displayName: 'GPT-4o 0806',
173
- id: 'gpt-4o-2024-08-06',
174
- pricing: {
175
- input: 2.5,
176
- output: 10,
177
- },
178
- releasedAt: '2024-08-06',
179
- type: 'chat',
180
- },
181
220
  {
182
221
  abilities: {
183
222
  functionCall: true,
@@ -345,8 +384,7 @@ export const openaiChatModels: AIChatModelCard[] = [
345
384
  description:
346
385
  'GPT-4 提供了一个更大的上下文窗口,能够处理更长的文本输入,适用于需要广泛信息整合和数据分析的场景。',
347
386
  displayName: 'GPT-4 32K',
348
- id: 'gpt-4-32k',
349
- // Will be discontinued on June 6, 2025
387
+ id: 'gpt-4-32k', // deprecated on 2025-06-06
350
388
  legacy: true,
351
389
  pricing: {
352
390
  input: 60,
@@ -354,22 +392,6 @@ export const openaiChatModels: AIChatModelCard[] = [
354
392
  },
355
393
  type: 'chat',
356
394
  },
357
- {
358
- abilities: {
359
- functionCall: true,
360
- },
361
- contextWindowTokens: 32_768,
362
- description:
363
- 'GPT-4 提供了一个更大的上下文窗口,能够处理更长的文本输入,适用于需要广泛信息整合和数据分析的场景。',
364
- displayName: 'GPT-4 32K 0613',
365
- id: 'gpt-4-32k-0613',
366
- pricing: {
367
- input: 60,
368
- output: 120,
369
- },
370
- releasedAt: '2023-06-13',
371
- type: 'chat',
372
- },
373
395
  {
374
396
  abilities: {
375
397
  functionCall: true,
@@ -223,10 +223,7 @@
223
223
  "hash": "9646161fa041354714f823d726af27247bcd6e60fa3be5698c0d69f337a5700b"
224
224
  },
225
225
  {
226
- "sql": [
227
- "DROP TABLE \"user_budgets\";",
228
- "\nDROP TABLE \"user_subscriptions\";"
229
- ],
226
+ "sql": ["DROP TABLE \"user_budgets\";", "\nDROP TABLE \"user_subscriptions\";"],
230
227
  "bps": true,
231
228
  "folderMillis": 1729699958471,
232
229
  "hash": "7dad43a2a25d1aec82124a4e53f8d82f8505c3073f23606c1dc5d2a4598eacf9"
@@ -298,9 +295,7 @@
298
295
  "hash": "845a692ceabbfc3caf252a97d3e19a213bc0c433df2689900135f9cfded2cf49"
299
296
  },
300
297
  {
301
- "sql": [
302
- "ALTER TABLE \"messages\" ADD COLUMN \"reasoning\" jsonb;"
303
- ],
298
+ "sql": ["ALTER TABLE \"messages\" ADD COLUMN \"reasoning\" jsonb;"],
304
299
  "bps": true,
305
300
  "folderMillis": 1737609172353,
306
301
  "hash": "2cb36ae4fcdd7b7064767e04bfbb36ae34518ff4bb1b39006f2dd394d1893868"
@@ -429,5 +424,29 @@
429
424
  "bps": true,
430
425
  "folderMillis": 1742806552131,
431
426
  "hash": "d9032edf59f717e0e71da5a95b3545ec251c311155cafe14df01a12800a9eae0"
427
+ },
428
+ {
429
+ "sql": [
430
+ "CREATE TABLE IF NOT EXISTS \"oidc_access_tokens\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"consumed_at\" timestamp with time zone,\n\t\"user_id\" text NOT NULL,\n\t\"client_id\" varchar(255) NOT NULL,\n\t\"grant_id\" varchar(255),\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
431
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_authorization_codes\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"consumed_at\" timestamp with time zone,\n\t\"user_id\" text NOT NULL,\n\t\"client_id\" varchar(255) NOT NULL,\n\t\"grant_id\" varchar(255),\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
432
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_clients\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"description\" text,\n\t\"client_secret\" varchar(255),\n\t\"redirect_uris\" text[] NOT NULL,\n\t\"grants\" text[] NOT NULL,\n\t\"response_types\" text[] NOT NULL,\n\t\"scopes\" text[] NOT NULL,\n\t\"token_endpoint_auth_method\" varchar(20),\n\t\"application_type\" varchar(20),\n\t\"client_uri\" text,\n\t\"logo_uri\" text,\n\t\"policy_uri\" text,\n\t\"tos_uri\" text,\n\t\"is_first_party\" boolean DEFAULT false,\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
433
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_consents\" (\n\t\"user_id\" text NOT NULL,\n\t\"client_id\" varchar(255) NOT NULL,\n\t\"scopes\" text[] NOT NULL,\n\t\"expires_at\" timestamp with time zone,\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\tCONSTRAINT \"oidc_consents_user_id_client_id_pk\" PRIMARY KEY(\"user_id\",\"client_id\")\n);\n",
434
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_device_codes\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"consumed_at\" timestamp with time zone,\n\t\"user_id\" text,\n\t\"client_id\" varchar(255) NOT NULL,\n\t\"grant_id\" varchar(255),\n\t\"user_code\" varchar(255),\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
435
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_grants\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"consumed_at\" timestamp with time zone,\n\t\"user_id\" text NOT NULL,\n\t\"client_id\" varchar(255) NOT NULL,\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
436
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_interactions\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
437
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_refresh_tokens\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"consumed_at\" timestamp with time zone,\n\t\"user_id\" text NOT NULL,\n\t\"client_id\" varchar(255) NOT NULL,\n\t\"grant_id\" varchar(255),\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
438
+ "\nCREATE TABLE IF NOT EXISTS \"oidc_sessions\" (\n\t\"id\" varchar(255) PRIMARY KEY NOT NULL,\n\t\"data\" jsonb NOT NULL,\n\t\"expires_at\" timestamp with time zone NOT NULL,\n\t\"user_id\" text NOT NULL,\n\t\"accessed_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"created_at\" timestamp with time zone DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp with time zone DEFAULT now() NOT NULL\n);\n",
439
+ "\nALTER TABLE \"oidc_access_tokens\" ADD CONSTRAINT \"oidc_access_tokens_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;",
440
+ "\nALTER TABLE \"oidc_authorization_codes\" ADD CONSTRAINT \"oidc_authorization_codes_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;",
441
+ "\nALTER TABLE \"oidc_consents\" ADD CONSTRAINT \"oidc_consents_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;",
442
+ "\nALTER TABLE \"oidc_consents\" ADD CONSTRAINT \"oidc_consents_client_id_oidc_clients_id_fk\" FOREIGN KEY (\"client_id\") REFERENCES \"public\".\"oidc_clients\"(\"id\") ON DELETE cascade ON UPDATE no action;",
443
+ "\nALTER TABLE \"oidc_device_codes\" ADD CONSTRAINT \"oidc_device_codes_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;",
444
+ "\nALTER TABLE \"oidc_grants\" ADD CONSTRAINT \"oidc_grants_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;",
445
+ "\nALTER TABLE \"oidc_refresh_tokens\" ADD CONSTRAINT \"oidc_refresh_tokens_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;",
446
+ "\nALTER TABLE \"oidc_sessions\" ADD CONSTRAINT \"oidc_sessions_user_id_users_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"users\"(\"id\") ON DELETE cascade ON UPDATE no action;\n"
447
+ ],
448
+ "bps": true,
449
+ "folderMillis": 1744458287757,
450
+ "hash": "f3a80b900906b54ba658208cd448610647fc03f1f4d51963509c07f4e53ef4de"
432
451
  }
433
- ]
452
+ ]
@@ -0,0 +1,124 @@
1
+ CREATE TABLE IF NOT EXISTS "oidc_access_tokens" (
2
+ "id" varchar(255) PRIMARY KEY NOT NULL,
3
+ "data" jsonb NOT NULL,
4
+ "expires_at" timestamp with time zone NOT NULL,
5
+ "consumed_at" timestamp with time zone,
6
+ "user_id" text NOT NULL,
7
+ "client_id" varchar(255) NOT NULL,
8
+ "grant_id" varchar(255),
9
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
10
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
11
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE TABLE IF NOT EXISTS "oidc_authorization_codes" (
15
+ "id" varchar(255) PRIMARY KEY NOT NULL,
16
+ "data" jsonb NOT NULL,
17
+ "expires_at" timestamp with time zone NOT NULL,
18
+ "consumed_at" timestamp with time zone,
19
+ "user_id" text NOT NULL,
20
+ "client_id" varchar(255) NOT NULL,
21
+ "grant_id" varchar(255),
22
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
23
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
24
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
25
+ );
26
+ --> statement-breakpoint
27
+ CREATE TABLE IF NOT EXISTS "oidc_clients" (
28
+ "id" varchar(255) PRIMARY KEY NOT NULL,
29
+ "name" text NOT NULL,
30
+ "description" text,
31
+ "client_secret" varchar(255),
32
+ "redirect_uris" text[] NOT NULL,
33
+ "grants" text[] NOT NULL,
34
+ "response_types" text[] NOT NULL,
35
+ "scopes" text[] NOT NULL,
36
+ "token_endpoint_auth_method" varchar(20),
37
+ "application_type" varchar(20),
38
+ "client_uri" text,
39
+ "logo_uri" text,
40
+ "policy_uri" text,
41
+ "tos_uri" text,
42
+ "is_first_party" boolean DEFAULT false,
43
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
44
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
45
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
46
+ );
47
+ --> statement-breakpoint
48
+ CREATE TABLE IF NOT EXISTS "oidc_consents" (
49
+ "user_id" text NOT NULL,
50
+ "client_id" varchar(255) NOT NULL,
51
+ "scopes" text[] NOT NULL,
52
+ "expires_at" timestamp with time zone,
53
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
54
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
55
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
56
+ CONSTRAINT "oidc_consents_user_id_client_id_pk" PRIMARY KEY("user_id","client_id")
57
+ );
58
+ --> statement-breakpoint
59
+ CREATE TABLE IF NOT EXISTS "oidc_device_codes" (
60
+ "id" varchar(255) PRIMARY KEY NOT NULL,
61
+ "data" jsonb NOT NULL,
62
+ "expires_at" timestamp with time zone NOT NULL,
63
+ "consumed_at" timestamp with time zone,
64
+ "user_id" text,
65
+ "client_id" varchar(255) NOT NULL,
66
+ "grant_id" varchar(255),
67
+ "user_code" varchar(255),
68
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
69
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
70
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
71
+ );
72
+ --> statement-breakpoint
73
+ CREATE TABLE IF NOT EXISTS "oidc_grants" (
74
+ "id" varchar(255) PRIMARY KEY NOT NULL,
75
+ "data" jsonb NOT NULL,
76
+ "expires_at" timestamp with time zone NOT NULL,
77
+ "consumed_at" timestamp with time zone,
78
+ "user_id" text NOT NULL,
79
+ "client_id" varchar(255) NOT NULL,
80
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
81
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
82
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
83
+ );
84
+ --> statement-breakpoint
85
+ CREATE TABLE IF NOT EXISTS "oidc_interactions" (
86
+ "id" varchar(255) PRIMARY KEY NOT NULL,
87
+ "data" jsonb NOT NULL,
88
+ "expires_at" timestamp with time zone NOT NULL,
89
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
90
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
91
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
92
+ );
93
+ --> statement-breakpoint
94
+ CREATE TABLE IF NOT EXISTS "oidc_refresh_tokens" (
95
+ "id" varchar(255) PRIMARY KEY NOT NULL,
96
+ "data" jsonb NOT NULL,
97
+ "expires_at" timestamp with time zone NOT NULL,
98
+ "consumed_at" timestamp with time zone,
99
+ "user_id" text NOT NULL,
100
+ "client_id" varchar(255) NOT NULL,
101
+ "grant_id" varchar(255),
102
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
103
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
104
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
105
+ );
106
+ --> statement-breakpoint
107
+ CREATE TABLE IF NOT EXISTS "oidc_sessions" (
108
+ "id" varchar(255) PRIMARY KEY NOT NULL,
109
+ "data" jsonb NOT NULL,
110
+ "expires_at" timestamp with time zone NOT NULL,
111
+ "user_id" text NOT NULL,
112
+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,
113
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
114
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
115
+ );
116
+ --> statement-breakpoint
117
+ ALTER TABLE "oidc_access_tokens" ADD CONSTRAINT "oidc_access_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
118
+ ALTER TABLE "oidc_authorization_codes" ADD CONSTRAINT "oidc_authorization_codes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
119
+ ALTER TABLE "oidc_consents" ADD CONSTRAINT "oidc_consents_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
120
+ ALTER TABLE "oidc_consents" ADD CONSTRAINT "oidc_consents_client_id_oidc_clients_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oidc_clients"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
121
+ ALTER TABLE "oidc_device_codes" ADD CONSTRAINT "oidc_device_codes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
122
+ ALTER TABLE "oidc_grants" ADD CONSTRAINT "oidc_grants_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
123
+ ALTER TABLE "oidc_refresh_tokens" ADD CONSTRAINT "oidc_refresh_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
124
+ ALTER TABLE "oidc_sessions" ADD CONSTRAINT "oidc_sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;