@autobe/ui 0.29.2 → 0.30.0-dev.20260315

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 (151) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +261 -0
  3. package/lib/components/AutoBeChatMain.js +5 -5
  4. package/lib/components/AutoBeChatMain.js.map +1 -1
  5. package/lib/components/AutoBeConfigModal.js +9 -9
  6. package/lib/components/AutoBeStatusModal.js +4 -4
  7. package/lib/components/AutoBeStatusModal.js.map +1 -1
  8. package/lib/components/AutoBeUserMessageMovie.d.ts +2 -2
  9. package/lib/components/common/ChatBubble.d.ts +2 -2
  10. package/lib/components/common/openai/OpenAIContent.d.ts +2 -2
  11. package/lib/components/common/openai/OpenAIContent.js.map +1 -1
  12. package/lib/components/common/openai/OpenAIUserAudioContent.js +1 -1
  13. package/lib/components/common/openai/OpenAIUserAudioContent.js.map +1 -1
  14. package/lib/components/common/openai/OpenAIUserFileContent.js +1 -1
  15. package/lib/components/common/openai/OpenAIUserFileContent.js.map +1 -1
  16. package/lib/components/common/openai/OpenAIUserImageContent.d.ts +2 -2
  17. package/lib/components/events/AutoBeCompleteEventMovie.d.ts +2 -2
  18. package/lib/components/events/AutoBeCompleteEventMovie.js +5 -5
  19. package/lib/components/events/AutoBeCompleteEventMovie.js.map +1 -1
  20. package/lib/components/events/AutoBeCorrectEventMovie.d.ts +2 -2
  21. package/lib/components/events/AutoBeCorrectEventMovie.js +4 -4
  22. package/lib/components/events/AutoBeCorrectEventMovie.js.map +1 -1
  23. package/lib/components/events/AutoBeEventMovie.js +38 -17
  24. package/lib/components/events/AutoBeEventMovie.js.map +1 -1
  25. package/lib/components/events/AutoBeProgressEventMovie.js +73 -13
  26. package/lib/components/events/AutoBeProgressEventMovie.js.map +1 -1
  27. package/lib/components/events/AutoBeScenarioEventMovie.d.ts +2 -2
  28. package/lib/components/events/AutoBeScenarioEventMovie.js +18 -5
  29. package/lib/components/events/AutoBeScenarioEventMovie.js.map +1 -1
  30. package/lib/components/events/AutoBeStartEventMovie.d.ts +2 -2
  31. package/lib/components/events/AutoBeStartEventMovie.js +2 -2
  32. package/lib/components/events/AutoBeStartEventMovie.js.map +1 -1
  33. package/lib/components/events/AutoBeValidateEventMovie.d.ts +2 -2
  34. package/lib/components/events/AutoBeValidateEventMovie.js +3 -11
  35. package/lib/components/events/AutoBeValidateEventMovie.js.map +1 -1
  36. package/lib/components/events/groups/CorrectEventGroup.d.ts +2 -2
  37. package/lib/components/events/groups/CorrectEventGroup.js +1 -1
  38. package/lib/components/events/groups/CorrectEventGroup.js.map +1 -1
  39. package/lib/components/events/groups/ValidateEventGroup.d.ts +2 -2
  40. package/lib/components/events/groups/ValidateEventGroup.js +1 -2
  41. package/lib/components/events/groups/ValidateEventGroup.js.map +1 -1
  42. package/lib/components/events/utils/eventGrouper.js +1 -2
  43. package/lib/components/events/utils/eventGrouper.js.map +1 -1
  44. package/lib/components/upload/AutoBeChatUploadBox.d.ts +3 -4
  45. package/lib/components/upload/AutoBeChatUploadBox.js +2 -1
  46. package/lib/components/upload/AutoBeChatUploadBox.js.map +1 -1
  47. package/lib/components/upload/AutoBeChatUploadSendButton.js +1 -1
  48. package/lib/components/upload/AutoBeChatUploadSendButton.js.map +1 -1
  49. package/lib/context/AutoBeAgentContext.d.ts +1 -3
  50. package/lib/context/AutoBeAgentContext.js +0 -4
  51. package/lib/context/AutoBeAgentContext.js.map +1 -1
  52. package/lib/hooks/useSessionStorage.d.ts +4 -0
  53. package/lib/hooks/useSessionStorage.js +16 -0
  54. package/lib/hooks/useSessionStorage.js.map +1 -0
  55. package/lib/index.d.ts +1 -0
  56. package/lib/index.js +1 -0
  57. package/lib/index.js.map +1 -1
  58. package/lib/strategy/AutoBeAgentSessionStorageStrategy.d.ts +10 -0
  59. package/lib/strategy/AutoBeAgentSessionStorageStrategy.js +117 -0
  60. package/lib/strategy/AutoBeAgentSessionStorageStrategy.js.map +1 -0
  61. package/lib/structure/AutoBeListener.js +91 -23
  62. package/lib/structure/AutoBeListener.js.map +1 -1
  63. package/lib/structure/AutoBeListenerState.d.ts +3 -3
  64. package/lib/structure/AutoBeListenerState.js +4 -4
  65. package/lib/structure/AutoBeListenerState.js.map +1 -1
  66. package/lib/structure/IAutoBeAgentSessionStorageStrategy.js +1 -1
  67. package/lib/structure/IAutoBeAgentSessionStorageStrategy.js.map +1 -1
  68. package/lib/utils/AutoBeFileUploader.d.ts +2 -2
  69. package/lib/utils/AutoBeFileUploader.js.map +1 -1
  70. package/package.json +3 -4
  71. package/src/components/AutoBeAssistantMessageMovie.tsx +22 -22
  72. package/src/components/AutoBeChatMain.tsx +376 -376
  73. package/src/components/AutoBeChatSidebar.tsx +414 -414
  74. package/src/components/AutoBeConfigButton.tsx +83 -83
  75. package/src/components/AutoBeConfigModal.tsx +443 -443
  76. package/src/components/AutoBeStatusButton.tsx +75 -75
  77. package/src/components/AutoBeStatusModal.tsx +486 -484
  78. package/src/components/AutoBeUserMessageMovie.tsx +27 -27
  79. package/src/components/common/ActionButton.tsx +205 -205
  80. package/src/components/common/ActionButtonGroup.tsx +80 -80
  81. package/src/components/common/AutoBeConfigInput.tsx +185 -185
  82. package/src/components/common/ChatBubble.tsx +119 -119
  83. package/src/components/common/Collapsible.tsx +95 -95
  84. package/src/components/common/CompactSessionIndicator.tsx +73 -73
  85. package/src/components/common/CompactSessionList.tsx +82 -82
  86. package/src/components/common/index.ts +8 -8
  87. package/src/components/common/openai/OpenAIContent.tsx +53 -53
  88. package/src/components/common/openai/OpenAIUserAudioContent.tsx +70 -70
  89. package/src/components/common/openai/OpenAIUserFileContent.tsx +76 -76
  90. package/src/components/common/openai/OpenAIUserImageContent.tsx +34 -34
  91. package/src/components/common/openai/OpenAIUserTextContent.tsx +15 -15
  92. package/src/components/common/openai/index.ts +5 -5
  93. package/src/components/events/AutoBeCompleteEventMovie.tsx +402 -402
  94. package/src/components/events/AutoBeCorrectEventMovie.tsx +354 -368
  95. package/src/components/events/AutoBeEventGroupMovie.tsx +18 -18
  96. package/src/components/events/AutoBeEventMovie.tsx +158 -139
  97. package/src/components/events/AutoBeProgressEventMovie.tsx +217 -157
  98. package/src/components/events/AutoBeScenarioEventMovie.tsx +135 -95
  99. package/src/components/events/AutoBeStartEventMovie.tsx +82 -82
  100. package/src/components/events/AutoBeValidateEventMovie.tsx +249 -286
  101. package/src/components/events/README.md +300 -300
  102. package/src/components/events/common/CollapsibleEventGroup.tsx +211 -211
  103. package/src/components/events/common/EventCard.tsx +61 -61
  104. package/src/components/events/common/EventContent.tsx +31 -31
  105. package/src/components/events/common/EventHeader.tsx +85 -85
  106. package/src/components/events/common/EventIcon.tsx +82 -82
  107. package/src/components/events/common/ProgressBar.tsx +64 -64
  108. package/src/components/events/common/index.ts +13 -13
  109. package/src/components/events/groups/CorrectEventGroup.tsx +183 -183
  110. package/src/components/events/groups/ValidateEventGroup.tsx +143 -146
  111. package/src/components/events/groups/index.ts +8 -8
  112. package/src/components/events/index.ts +16 -16
  113. package/src/components/events/utils/eventGrouper.tsx +116 -117
  114. package/src/components/events/utils/index.ts +1 -1
  115. package/src/components/index.ts +13 -13
  116. package/src/components/upload/AutoBeChatUploadBox.tsx +425 -424
  117. package/src/components/upload/AutoBeChatUploadSendButton.tsx +66 -66
  118. package/src/components/upload/AutoBeFileUploadBox.tsx +123 -123
  119. package/src/components/upload/AutoBeUploadConfig.ts +5 -5
  120. package/src/components/upload/AutoBeVoiceRecoderButton.tsx +100 -100
  121. package/src/components/upload/index.ts +5 -5
  122. package/src/constant/color.ts +28 -28
  123. package/src/context/AutoBeAgentContext.tsx +245 -258
  124. package/src/context/AutoBeAgentSessionList.tsx +58 -58
  125. package/src/context/SearchParamsContext.tsx +49 -49
  126. package/src/hooks/index.ts +3 -3
  127. package/src/hooks/useEscapeKey.ts +24 -24
  128. package/src/hooks/useIsomorphicLayoutEffect.ts +8 -8
  129. package/src/hooks/useMediaQuery.ts +73 -73
  130. package/src/hooks/useSessionStorage.ts +10 -0
  131. package/src/icons/Receipt.tsx +74 -74
  132. package/src/index.ts +9 -8
  133. package/src/strategy/AutoBeAgentSessionStorageStrategy.ts +127 -0
  134. package/src/structure/AutoBeListener.ts +373 -304
  135. package/src/structure/AutoBeListenerState.ts +53 -53
  136. package/src/structure/IAutoBeAgentSessionStorageStrategy.ts +87 -87
  137. package/src/structure/IAutoBeEventGroup.ts +6 -6
  138. package/src/structure/index.ts +4 -4
  139. package/src/types/config.ts +44 -44
  140. package/src/types/index.ts +1 -1
  141. package/src/utils/AutoBeFileUploader.ts +279 -279
  142. package/src/utils/AutoBeVoiceRecorder.ts +95 -95
  143. package/src/utils/__tests__/crypto.test.ts +286 -286
  144. package/src/utils/__tests__/storage.test.ts +229 -229
  145. package/src/utils/crypto.ts +95 -95
  146. package/src/utils/index.ts +6 -6
  147. package/src/utils/number.ts +17 -17
  148. package/src/utils/storage.ts +96 -96
  149. package/src/utils/time.ts +14 -14
  150. package/tsconfig.json +9 -9
  151. package/vitest.config.ts +15 -15
@@ -1,157 +1,217 @@
1
- import { AutoBeEvent, AutoBeProgressEventBase } from "@autobe/interface";
2
-
3
- import { EventCard, EventContent, EventHeader, ProgressBar } from "./common";
4
-
5
- export function AutoBeProgressEventMovie(
6
- props: AutoBeProgressEventMovie.IProps,
7
- ) {
8
- const state: IState = getState(props.event);
9
-
10
- return (
11
- <EventCard>
12
- <EventHeader
13
- title={state.title}
14
- timestamp={props.event.created_at}
15
- iconType="progress"
16
- />
17
- <EventContent>
18
- <div style={{ marginBottom: 0 }}>{state.description}</div>
19
- <ProgressBar current={state.completed} total={state.total} />
20
- </EventContent>
21
- </EventCard>
22
- );
23
- }
24
- type ExtractType<T, U> = T extends U ? T : never;
25
-
26
- export namespace AutoBeProgressEventMovie {
27
- export interface IProps {
28
- event: ExtractType<AutoBeEvent, AutoBeProgressEventBase>;
29
- }
30
- }
31
-
32
- interface IState {
33
- title: string;
34
- description: string;
35
- completed: number;
36
- total: number;
37
- }
38
-
39
- function getState(event: AutoBeProgressEventMovie.IProps["event"]): IState {
40
- const content: Pick<IState, "title" | "description"> = (() => {
41
- switch (event.type) {
42
- case "analyzeWrite":
43
- return {
44
- title: "Analyze Write",
45
- description: "Analyzing requirements, and writing a report paper",
46
- };
47
- case "analyzeReview":
48
- return {
49
- title: "Analyze Review",
50
- description: "Reviewing the analysis results",
51
- };
52
- case "prismaSchema":
53
- return {
54
- title: "Prisma Schemas",
55
- description: "Designing Database schemas",
56
- };
57
- case "prismaReview":
58
- return {
59
- title: "Prisma Review",
60
- description: "Reviewing the Prisma schemas",
61
- };
62
- case "interfaceEndpoint":
63
- return {
64
- title: "Interface Endpoints",
65
- description: "Collecting API endpoints",
66
- };
67
- case "interfaceOperation":
68
- return {
69
- title: "Interface Operations",
70
- description: "Designing API operations",
71
- };
72
- case "interfaceOperationReview":
73
- return {
74
- title: "Interface Operations Review",
75
- description: "Reviewing API operations",
76
- };
77
- case "interfaceAuthorization":
78
- return {
79
- title: "Interface Authorization",
80
- description: "Designing API authorization operations",
81
- };
82
- case "interfaceSchema":
83
- return {
84
- title: "Interface Schemas",
85
- description: "Designing API type schemas",
86
- };
87
- case "interfaceSchemaReview":
88
- return {
89
- title: "Interface Schemas Review",
90
- description: `Reviewing API type schemas' ${event.kind}`,
91
- };
92
- case "interfaceComplement":
93
- return {
94
- title: "Interface Complement",
95
- description: "Complementing missing API type schemas",
96
- };
97
- case "interfaceSchemaRename":
98
- return {
99
- title: "Interface Schema Rename",
100
- description: "Renaming API type schemas",
101
- };
102
- case "interfacePrerequisite":
103
- return {
104
- title: "Interface Prerequisites",
105
- description: "Defining API prerequisites",
106
- };
107
- case "testScenario":
108
- return {
109
- title: "Test Scenarios",
110
- description: "Planning E2E test scenarios",
111
- };
112
- case "testScenarioReview":
113
- return {
114
- title: "Test Scenarios Review",
115
- description: "Reviewing E2E test scenarios",
116
- };
117
- case "testWrite":
118
- return {
119
- title: "Test Write",
120
- description: "Writing E2E test functions",
121
- };
122
- case "realizeWrite":
123
- return {
124
- title: "Realize Write",
125
- description: "Realizing the API functions",
126
- };
127
- case "realizeAuthorizationWrite":
128
- return {
129
- title: "Authorization Write",
130
- description: "Writing authorization decorators and functions",
131
- };
132
- case "realizeTestOperation":
133
- return {
134
- title: "Realize Test Operation",
135
- description:
136
- "Running the E2E test operations to validate the API functions",
137
- };
138
- case "realizeCorrect":
139
- return {
140
- title: "Realize Correct",
141
- description: "Correcting the API functions",
142
- };
143
- default:
144
- event satisfies never;
145
- return {
146
- title: "Unknown Event",
147
- description: "This event type is not recognized.",
148
- };
149
- }
150
- })();
151
- return {
152
- ...content,
153
- completed: event.completed,
154
- total: event.total,
155
- };
156
- }
157
- export default AutoBeProgressEventMovie;
1
+ import { AutoBeEvent, AutoBeProgressEventBase } from "@autobe/interface";
2
+
3
+ import { EventCard, EventContent, EventHeader, ProgressBar } from "./common";
4
+
5
+ export function AutoBeProgressEventMovie(
6
+ props: AutoBeProgressEventMovie.IProps,
7
+ ) {
8
+ const state: IState = getState(props.event);
9
+
10
+ return (
11
+ <EventCard>
12
+ <EventHeader
13
+ title={state.title}
14
+ timestamp={props.event.created_at}
15
+ iconType="progress"
16
+ />
17
+ <EventContent>
18
+ <div style={{ marginBottom: 0 }}>{state.description}</div>
19
+ <ProgressBar current={state.completed} total={state.total} />
20
+ </EventContent>
21
+ </EventCard>
22
+ );
23
+ }
24
+ type ExtractType<T, U> = T extends U ? T : never;
25
+
26
+ export namespace AutoBeProgressEventMovie {
27
+ export interface IProps {
28
+ event: ExtractType<AutoBeEvent, AutoBeProgressEventBase>;
29
+ }
30
+ }
31
+
32
+ interface IState {
33
+ title: string;
34
+ description: string;
35
+ completed: number;
36
+ total: number;
37
+ }
38
+
39
+ function getState(event: AutoBeProgressEventMovie.IProps["event"]): IState {
40
+ const content: Pick<IState, "title" | "description"> = (() => {
41
+ switch (event.type) {
42
+ case "databaseComponent":
43
+ return {
44
+ title: "Database Components",
45
+ description: "Generating database component schemas",
46
+ };
47
+ case "databaseComponentReview":
48
+ return {
49
+ title: "Prisma Components Review",
50
+ description: "Reviewing the Prisma components",
51
+ };
52
+ case "databaseSchema":
53
+ return {
54
+ title: "Prisma Schemas",
55
+ description: "Designing Database schemas",
56
+ };
57
+ case "databaseSchemaReview":
58
+ return {
59
+ title: "Prisma Review",
60
+ description: "Reviewing the Prisma schemas",
61
+ };
62
+ case "interfaceEndpoint":
63
+ return {
64
+ title: "Interface Endpoints",
65
+ description: "Collecting API endpoints",
66
+ };
67
+ case "interfaceEndpointReview":
68
+ return {
69
+ title: "Interface Endpoints Review",
70
+ description: "Reviewing API endpoints",
71
+ };
72
+ case "interfaceOperation":
73
+ return {
74
+ title: "Interface Operations",
75
+ description: "Designing API operations",
76
+ };
77
+ case "interfaceOperationReview":
78
+ return {
79
+ title: "Interface Operations Review",
80
+ description: "Reviewing API operations",
81
+ };
82
+ case "interfaceAuthorization":
83
+ return {
84
+ title: "Interface Authorization",
85
+ description: "Designing API authorization operations",
86
+ };
87
+ case "interfaceSchema":
88
+ return {
89
+ title: "Interface Schemas",
90
+ description: "Designing API type schemas",
91
+ };
92
+ case "interfaceSchemaCasting":
93
+ return {
94
+ title: "Interface Schemas Casting",
95
+ description: `Refining degenerate API type schemas' structure`,
96
+ };
97
+ case "interfaceSchemaRefine":
98
+ return {
99
+ title: "Interface Schemas Refine",
100
+ description: `Refining API type schemas' documentation and metadata`,
101
+ };
102
+ case "interfaceSchemaReview":
103
+ return {
104
+ title: "Interface Schemas Review",
105
+ description: `Reviewing API type schemas`,
106
+ };
107
+ case "interfaceSchemaComplement":
108
+ return {
109
+ title: "Interface Complement",
110
+ description: "Complementing missing API type schemas",
111
+ };
112
+ case "interfaceSchemaRename":
113
+ return {
114
+ title: "Interface Schema Rename",
115
+ description: "Renaming API type schemas",
116
+ };
117
+ case "interfacePrerequisite":
118
+ return {
119
+ title: "Interface Prerequisites",
120
+ description: "Defining API prerequisites",
121
+ };
122
+ case "testScenario":
123
+ return {
124
+ title: "Test Scenarios",
125
+ description: "Planning E2E test scenarios",
126
+ };
127
+ case "testScenarioReview":
128
+ return {
129
+ title: "Test Scenarios Review",
130
+ description: "Reviewing E2E test scenarios",
131
+ };
132
+ case "testWrite":
133
+ return {
134
+ title: "Test Write",
135
+ description: "Writing E2E test functions",
136
+ };
137
+ case "testValidate":
138
+ return {
139
+ title: "Test Validate",
140
+ description: "Validating E2E test results",
141
+ };
142
+ case "realizePlan":
143
+ return {
144
+ title: "Realize Plan",
145
+ description: "Planning the API functions' modularization",
146
+ };
147
+ case "realizeWrite":
148
+ return {
149
+ title: "Realize Write",
150
+ description: "Realizing the API functions",
151
+ };
152
+ case "realizeAuthorizationWrite":
153
+ return {
154
+ title: "Authorization Write",
155
+ description: "Writing authorization decorators and functions",
156
+ };
157
+ case "realizeTestOperation":
158
+ return {
159
+ title: "Realize Test Operation",
160
+ description:
161
+ "Running the E2E test operations to validate the API functions",
162
+ };
163
+ case "realizeValidate":
164
+ return {
165
+ title: "Realize Validate",
166
+ description: "Correcting and Validating the API functions",
167
+ };
168
+ case "imageDescribeDraft":
169
+ return {
170
+ title: "Describe Image Draft",
171
+ description: "Describing the image draft",
172
+ };
173
+ case "analyzeWriteModule":
174
+ return {
175
+ title: "Analyze Write Module",
176
+ description: "Generating module section structure",
177
+ };
178
+ case "analyzeModuleReview":
179
+ return {
180
+ title: "Analyze Module Review",
181
+ description: "Reviewing module section structure",
182
+ };
183
+ case "analyzeWriteUnit":
184
+ return {
185
+ title: "Analyze Write Unit",
186
+ description: "Generating unit section content",
187
+ };
188
+ case "analyzeUnitReview":
189
+ return {
190
+ title: "Analyze Unit Review",
191
+ description: "Reviewing unit section content",
192
+ };
193
+ case "analyzeWriteSection":
194
+ return {
195
+ title: "Analyze Write Section",
196
+ description: "Generating section details",
197
+ };
198
+ case "analyzeSectionReview":
199
+ return {
200
+ title: "Analyze Section Review",
201
+ description: "Reviewing section details",
202
+ };
203
+ default:
204
+ event satisfies never;
205
+ return {
206
+ title: "Unknown Event",
207
+ description: "This event type is not recognized.",
208
+ };
209
+ }
210
+ })();
211
+ return {
212
+ ...content,
213
+ completed: event.completed,
214
+ total: event.total,
215
+ };
216
+ }
217
+ export default AutoBeProgressEventMovie;
@@ -1,95 +1,135 @@
1
- import {
2
- AutoBeAnalyzeScenarioEvent,
3
- AutoBeInterfaceGroupEvent,
4
- AutoBePrismaComponentEvent,
5
- AutoBeRealizeTestResetEvent,
6
- } from "@autobe/interface";
7
- import { JSX } from "react";
8
-
9
- import { EventCard, EventContent, EventHeader } from "./common";
10
-
11
- export interface IAutoBeScenarioEventMovieProps {
12
- event:
13
- | AutoBeAnalyzeScenarioEvent
14
- | AutoBePrismaComponentEvent
15
- | AutoBeInterfaceGroupEvent
16
- | AutoBeRealizeTestResetEvent;
17
- }
18
- export const AutoBeScenarioEventMovie = (
19
- props: IAutoBeScenarioEventMovieProps,
20
- ) => {
21
- const { event } = props;
22
- const { title, description } = getState(event);
23
-
24
- return (
25
- <EventCard>
26
- <EventHeader title={title} timestamp={event.created_at} iconType="info" />
27
- <EventContent>{description}</EventContent>
28
- </EventCard>
29
- );
30
- };
31
- export default AutoBeScenarioEventMovie;
32
-
33
- interface IState {
34
- title: string;
35
- description: string | JSX.Element;
36
- }
37
-
38
- function getState(event: IAutoBeScenarioEventMovieProps["event"]): IState {
39
- switch (event.type) {
40
- case "analyzeScenario":
41
- return {
42
- title: "Analyze Scenario",
43
- description: (
44
- <>
45
- Generating analysis report.
46
- <br />
47
- <br />
48
- Number of documents to write: #{event.files.length}
49
- </>
50
- ),
51
- };
52
- case "prismaComponent":
53
- return {
54
- title: "Prisma Components",
55
- description: (
56
- <>
57
- Generating Prisma components.
58
- <br />
59
- <br />
60
- Number of Prisma schemas would be:
61
- <br />
62
- <ul>
63
- <li>namespaces: #{event.components.length}</li>
64
- <li>
65
- tables: #
66
- {event.components
67
- .map((c) => c.tables.length)
68
- .reduce((a, b) => a + b, 0)}
69
- </li>
70
- </ul>
71
- </>
72
- ),
73
- };
74
- case "interfaceGroup":
75
- return {
76
- title: "Interface Endpoint Groups",
77
- description: (
78
- <>
79
- Generating interface endpoint groups.
80
- <br />
81
- <br />
82
- Number of API operation groups would be #{event.groups.length}
83
- </>
84
- ),
85
- };
86
- case "realizeTestReset":
87
- return {
88
- title: "Realize Test Reset",
89
- description: "Resetting test environment.",
90
- };
91
- default:
92
- event satisfies never;
93
- throw new Error("Unknown event type");
94
- }
95
- }
1
+ import {
2
+ AutoBeAnalyzeScenarioEvent,
3
+ AutoBeDatabaseAuthorizationEvent,
4
+ AutoBeDatabaseAuthorizationReviewEvent,
5
+ AutoBeDatabaseGroupEvent,
6
+ AutoBeDatabaseGroupReviewEvent,
7
+ AutoBeInterfaceGroupEvent,
8
+ AutoBeRealizeTestResetEvent,
9
+ } from "@autobe/interface";
10
+ import { JSX } from "react";
11
+
12
+ import { EventCard, EventContent, EventHeader } from "./common";
13
+
14
+ export interface IAutoBeScenarioEventMovieProps {
15
+ event:
16
+ | AutoBeAnalyzeScenarioEvent
17
+ | AutoBeDatabaseAuthorizationEvent
18
+ | AutoBeDatabaseAuthorizationReviewEvent
19
+ | AutoBeDatabaseGroupEvent
20
+ | AutoBeDatabaseGroupReviewEvent
21
+ | AutoBeInterfaceGroupEvent
22
+ | AutoBeRealizeTestResetEvent;
23
+ }
24
+ export const AutoBeScenarioEventMovie = (
25
+ props: IAutoBeScenarioEventMovieProps,
26
+ ) => {
27
+ const { event } = props;
28
+ const { title, description } = getState(event);
29
+
30
+ return (
31
+ <EventCard>
32
+ <EventHeader title={title} timestamp={event.created_at} iconType="info" />
33
+ <EventContent>{description}</EventContent>
34
+ </EventCard>
35
+ );
36
+ };
37
+ export default AutoBeScenarioEventMovie;
38
+
39
+ interface IState {
40
+ title: string;
41
+ description: string | JSX.Element;
42
+ }
43
+
44
+ function getState(event: IAutoBeScenarioEventMovieProps["event"]): IState {
45
+ switch (event.type) {
46
+ case "analyzeScenario":
47
+ return {
48
+ title: "Analyze Scenario",
49
+ description: (
50
+ <>
51
+ Generating analysis report.
52
+ <br />
53
+ <br />
54
+ Number of documents to write: #{event.files.length}
55
+ </>
56
+ ),
57
+ };
58
+ case "databaseGroup":
59
+ return {
60
+ title: "Database Group",
61
+ description: (
62
+ <>
63
+ Generating Database groups.
64
+ <br />
65
+ <br />
66
+ Number of Database groups would be:
67
+ <br />
68
+ <ul>
69
+ <li>namespaces: #{event.groups.length}</li>
70
+ </ul>
71
+ </>
72
+ ),
73
+ };
74
+ case "databaseGroupReview":
75
+ return {
76
+ title: "Database Group Review",
77
+ description: (
78
+ <>
79
+ Reviewed Database group structure.
80
+ <br />
81
+ <br />
82
+ Revisions applied: #{event.revises.length}
83
+ <br />
84
+ Final groups: #{event.groups.length}
85
+ </>
86
+ ),
87
+ };
88
+ case "databaseAuthorization":
89
+ return {
90
+ title: "Database Authorization",
91
+ description: (
92
+ <>
93
+ Generated authorization tables for all actors.
94
+ <br />
95
+ <br />
96
+ Tables created: #{event.component.tables.length}
97
+ </>
98
+ ),
99
+ };
100
+ case "databaseAuthorizationReview":
101
+ return {
102
+ title: "Database Authorization Review",
103
+ description: (
104
+ <>
105
+ Reviewed authorization tables.
106
+ <br />
107
+ <br />
108
+ Revisions applied: #{event.revises.length}
109
+ <br />
110
+ Final tables: #{event.modification.tables.length}
111
+ </>
112
+ ),
113
+ };
114
+ case "interfaceGroup":
115
+ return {
116
+ title: "Interface Endpoint Groups",
117
+ description: (
118
+ <>
119
+ Generating interface endpoint groups.
120
+ <br />
121
+ <br />
122
+ Number of API operation groups would be #{event.groups.length}
123
+ </>
124
+ ),
125
+ };
126
+ case "realizeTestReset":
127
+ return {
128
+ title: "Realize Test Reset",
129
+ description: "Resetting test environment.",
130
+ };
131
+ default:
132
+ event satisfies never;
133
+ throw new Error("Unknown event type");
134
+ }
135
+ }