insforge 0.3.1

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 (395) hide show
  1. package/.dockerignore +58 -0
  2. package/.env.example +49 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.yml +83 -0
  4. package/.github/ISSUE_TEMPLATE/config.yml +11 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.yml +79 -0
  6. package/.github/copilot-instructions.md +147 -0
  7. package/.github/workflows/build-image.yml +65 -0
  8. package/.github/workflows/ci-premerge-check.yml +24 -0
  9. package/.github/workflows/deploy-aws.yml +130 -0
  10. package/.github/workflows/lint-and-format.yml +33 -0
  11. package/.prettierignore +65 -0
  12. package/.prettierrc +9 -0
  13. package/CHANGELOG.md +3 -0
  14. package/CONTRIBUTING.md +126 -0
  15. package/Dockerfile +27 -0
  16. package/GITHUB_OAUTH_SETUP.md +49 -0
  17. package/GOOGLE_OAUTH_SETUP.md +148 -0
  18. package/LICENSE +201 -0
  19. package/README.md +134 -0
  20. package/assets/Dark.svg +23 -0
  21. package/assets/archDiagram.png +0 -0
  22. package/assets/banner.png +0 -0
  23. package/assets/mcpInstallv2.png +0 -0
  24. package/assets/sampleResponse.png +0 -0
  25. package/assets/signin.png +0 -0
  26. package/assets/userflow.png +0 -0
  27. package/backend/migrations/000_create-base-tables.sql +142 -0
  28. package/backend/migrations/001_create-helper-functions.sql +41 -0
  29. package/backend/migrations/002_rename-auth-tables.sql +30 -0
  30. package/backend/migrations/003_create-users-table.sql +56 -0
  31. package/backend/migrations/004_add-reload-postgrest-func.sql +24 -0
  32. package/backend/migrations/005_enable-project-admin-modify-users.sql +30 -0
  33. package/backend/migrations/006_modify-ai-usage-table.sql +25 -0
  34. package/backend/migrations/007_drop-metadata-table.sql +2 -0
  35. package/backend/migrations/008_add-system-tables.sql +77 -0
  36. package/backend/migrations/009_add-function-secrets.sql +24 -0
  37. package/backend/migrations/010_modify-ai-config-modalities.sql +93 -0
  38. package/backend/migrations/011_refactor-secrets-table.sql +15 -0
  39. package/backend/migrations/012_add-storage-uploaded-by.sql +8 -0
  40. package/backend/package.json +75 -0
  41. package/backend/src/api/middleware/auth.ts +240 -0
  42. package/backend/src/api/middleware/error.ts +231 -0
  43. package/backend/src/api/middleware/upload.ts +59 -0
  44. package/backend/src/api/routes/agent.ts +29 -0
  45. package/backend/src/api/routes/ai.ts +472 -0
  46. package/backend/src/api/routes/auth.oauth.ts +482 -0
  47. package/backend/src/api/routes/auth.ts +386 -0
  48. package/backend/src/api/routes/database.advance.ts +275 -0
  49. package/backend/src/api/routes/database.records.ts +246 -0
  50. package/backend/src/api/routes/database.tables.ts +161 -0
  51. package/backend/src/api/routes/docs.ts +66 -0
  52. package/backend/src/api/routes/functions.ts +183 -0
  53. package/backend/src/api/routes/logs.ts +150 -0
  54. package/backend/src/api/routes/metadata.ts +160 -0
  55. package/backend/src/api/routes/openapi.ts +82 -0
  56. package/backend/src/api/routes/secrets.ts +199 -0
  57. package/backend/src/api/routes/storage.ts +547 -0
  58. package/backend/src/api/routes/usage.ts +96 -0
  59. package/backend/src/core/ai/chat.ts +207 -0
  60. package/backend/src/core/ai/client.ts +242 -0
  61. package/backend/src/core/ai/config.ts +187 -0
  62. package/backend/src/core/ai/image.ts +156 -0
  63. package/backend/src/core/ai/model.ts +117 -0
  64. package/backend/src/core/ai/usage.ts +290 -0
  65. package/backend/src/core/auth/auth.ts +781 -0
  66. package/backend/src/core/auth/oauth.ts +398 -0
  67. package/backend/src/core/database/advance.ts +1074 -0
  68. package/backend/src/core/database/manager.ts +178 -0
  69. package/backend/src/core/database/table.ts +772 -0
  70. package/backend/src/core/documentation/agent.ts +689 -0
  71. package/backend/src/core/documentation/openapi.ts +856 -0
  72. package/backend/src/core/functions/functions.ts +310 -0
  73. package/backend/src/core/logs/analytics.ts +76 -0
  74. package/backend/src/core/logs/audit.ts +255 -0
  75. package/backend/src/core/logs/providers/base.provider.ts +83 -0
  76. package/backend/src/core/logs/providers/cloudwatch.provider.ts +510 -0
  77. package/backend/src/core/logs/providers/localdb.provider.ts +246 -0
  78. package/backend/src/core/secrets/encryption.ts +58 -0
  79. package/backend/src/core/secrets/secrets.ts +410 -0
  80. package/backend/src/core/socket/socket.ts +388 -0
  81. package/backend/src/core/socket/types.ts +79 -0
  82. package/backend/src/core/storage/storage.ts +923 -0
  83. package/backend/src/server.ts +288 -0
  84. package/backend/src/types/ai.ts +46 -0
  85. package/backend/src/types/auth.ts +90 -0
  86. package/backend/src/types/database.ts +136 -0
  87. package/backend/src/types/error-constants.ts +86 -0
  88. package/backend/src/types/logs.ts +47 -0
  89. package/backend/src/types/profile.ts +55 -0
  90. package/backend/src/types/storage.ts +23 -0
  91. package/backend/src/utils/cloud-token.ts +39 -0
  92. package/backend/src/utils/constants.ts +1 -0
  93. package/backend/src/utils/environment.ts +35 -0
  94. package/backend/src/utils/helpers.ts +49 -0
  95. package/backend/src/utils/logger.ts +13 -0
  96. package/backend/src/utils/response.ts +62 -0
  97. package/backend/src/utils/seed.ts +205 -0
  98. package/backend/src/utils/sql-parser.ts +63 -0
  99. package/backend/src/utils/uuid.ts +9 -0
  100. package/backend/src/utils/validations.ts +129 -0
  101. package/backend/tests/README.md +134 -0
  102. package/backend/tests/cleanup-all-test-data.sh +231 -0
  103. package/backend/tests/cloud/test-s3-multitenant.sh +132 -0
  104. package/backend/tests/local/comprehensive-curl-tests.sh +156 -0
  105. package/backend/tests/local/test-auth-router.sh +144 -0
  106. package/backend/tests/local/test-database-router.sh +222 -0
  107. package/backend/tests/local/test-e2e.sh +241 -0
  108. package/backend/tests/local/test-fk-errors.sh +97 -0
  109. package/backend/tests/local/test-id-field.sh +201 -0
  110. package/backend/tests/local/test-public-bucket.sh +265 -0
  111. package/backend/tests/local/test-secrets.sh +248 -0
  112. package/backend/tests/local/test-serverless-functions.sh.disabled +325 -0
  113. package/backend/tests/local/test-traditional-rest.sh +209 -0
  114. package/backend/tests/manual/README.md +51 -0
  115. package/backend/tests/manual/create-large-table-simple.sql +11 -0
  116. package/backend/tests/manual/seed-large-table.sql +101 -0
  117. package/backend/tests/manual/setup-large-table-extras.sql +34 -0
  118. package/backend/tests/manual/test-better-auth.sh +303 -0
  119. package/backend/tests/manual/test-bulk-upsert.sh +410 -0
  120. package/backend/tests/manual/test-database-advance.sh +297 -0
  121. package/backend/tests/manual/test-postgrest-stability.sh +192 -0
  122. package/backend/tests/manual/test-rawsql-export-import.sh +412 -0
  123. package/backend/tests/manual/test-universal-storage.sh +264 -0
  124. package/backend/tests/manual/test-users.sql +18 -0
  125. package/backend/tests/run-all-tests.sh +140 -0
  126. package/backend/tests/setup.ts +22 -0
  127. package/backend/tests/test-config.sh +303 -0
  128. package/backend/tsconfig.json +23 -0
  129. package/backend/tsup.config.ts +18 -0
  130. package/backend/vitest.config.ts +22 -0
  131. package/docker-compose.prod.yml +145 -0
  132. package/docker-compose.yml +167 -0
  133. package/docker-init/db/db-init.sql +125 -0
  134. package/docker-init/db/jwt.sql +5 -0
  135. package/docker-init/db/logs.sql +9 -0
  136. package/docker-init/db/postgresql.conf +17 -0
  137. package/docs/deprecated/insforge-auth-api.md +215 -0
  138. package/docs/deprecated/insforge-auth-sdk.md +100 -0
  139. package/docs/deprecated/insforge-db-api.md +359 -0
  140. package/docs/deprecated/insforge-db-sdk.md +140 -0
  141. package/docs/deprecated/insforge-debug-sdk.md +157 -0
  142. package/docs/deprecated/insforge-debug.md +65 -0
  143. package/docs/deprecated/insforge-instructions.md +124 -0
  144. package/docs/deprecated/insforge-project.md +118 -0
  145. package/docs/deprecated/insforge-storage-api.md +279 -0
  146. package/docs/deprecated/insforge-storage-sdk.md +159 -0
  147. package/docs/insforge-instructions-sdk.md +407 -0
  148. package/eslint.config.js +317 -0
  149. package/examples/oauth/frontend-oauth-example.html +251 -0
  150. package/examples/response-examples.md +444 -0
  151. package/frontend/README.md +112 -0
  152. package/frontend/components.json +17 -0
  153. package/frontend/index.html +13 -0
  154. package/frontend/package.json +63 -0
  155. package/frontend/public/favicon.ico +0 -0
  156. package/frontend/src/App.tsx +106 -0
  157. package/frontend/src/assets/icons/checkbox_checked.svg +6 -0
  158. package/frontend/src/assets/icons/checkbox_undetermined.svg +6 -0
  159. package/frontend/src/assets/icons/checked.svg +3 -0
  160. package/frontend/src/assets/icons/error.svg +3 -0
  161. package/frontend/src/assets/icons/pencil.svg +4 -0
  162. package/frontend/src/assets/icons/refresh.svg +4 -0
  163. package/frontend/src/assets/icons/step_active.svg +3 -0
  164. package/frontend/src/assets/icons/step_inactive.svg +11 -0
  165. package/frontend/src/assets/icons/warning.svg +3 -0
  166. package/frontend/src/assets/logos/amazon.svg +1 -0
  167. package/frontend/src/assets/logos/claude_code.svg +3 -0
  168. package/frontend/src/assets/logos/cline.svg +6 -0
  169. package/frontend/src/assets/logos/cursor.svg +20 -0
  170. package/frontend/src/assets/logos/discord.svg +9 -0
  171. package/frontend/src/assets/logos/gemini.svg +19 -0
  172. package/frontend/src/assets/logos/github.svg +5 -0
  173. package/frontend/src/assets/logos/google.svg +13 -0
  174. package/frontend/src/assets/logos/grok.svg +10 -0
  175. package/frontend/src/assets/logos/insforge_dark.svg +15 -0
  176. package/frontend/src/assets/logos/insforge_light.svg +15 -0
  177. package/frontend/src/assets/logos/openai.svg +10 -0
  178. package/frontend/src/assets/logos/roo_code.svg +9 -0
  179. package/frontend/src/assets/logos/trae.svg +3 -0
  180. package/frontend/src/assets/logos/windsurf.svg +10 -0
  181. package/frontend/src/components/ButtonWithLoading.tsx +27 -0
  182. package/frontend/src/components/Checkbox.tsx +61 -0
  183. package/frontend/src/components/CodeBlock.tsx +32 -0
  184. package/frontend/src/components/ConfirmDialog.tsx +96 -0
  185. package/frontend/src/components/CopyButton.tsx +69 -0
  186. package/frontend/src/components/DeleteActionButton.tsx +42 -0
  187. package/frontend/src/components/EmptyState.tsx +41 -0
  188. package/frontend/src/components/ErrorState.tsx +35 -0
  189. package/frontend/src/components/FeatureSidebar.tsx +126 -0
  190. package/frontend/src/components/FeatureSidebarItem.tsx +101 -0
  191. package/frontend/src/components/JsonHighlight.tsx +61 -0
  192. package/frontend/src/components/LoadingState.tsx +16 -0
  193. package/frontend/src/components/PaginationControls.tsx +54 -0
  194. package/frontend/src/components/PromptDialog.tsx +68 -0
  195. package/frontend/src/components/SearchInput.tsx +90 -0
  196. package/frontend/src/components/SelectionClearButton.tsx +26 -0
  197. package/frontend/src/components/Stepper.tsx +139 -0
  198. package/frontend/src/components/ThemeToggle.tsx +58 -0
  199. package/frontend/src/components/TypeBadge.tsx +20 -0
  200. package/frontend/src/components/datagrid/DataGrid.tsx +264 -0
  201. package/frontend/src/components/datagrid/DefaultCellRenderer.tsx +114 -0
  202. package/frontend/src/components/datagrid/IdCell.tsx +44 -0
  203. package/frontend/src/components/datagrid/SortableHeader.tsx +74 -0
  204. package/frontend/src/components/datagrid/cell-editors/BooleanCellEditor.tsx +54 -0
  205. package/frontend/src/components/datagrid/cell-editors/DateCellEditor.tsx +483 -0
  206. package/frontend/src/components/datagrid/cell-editors/JsonCellEditor.tsx +362 -0
  207. package/frontend/src/components/datagrid/cell-editors/TextCellEditor.tsx +38 -0
  208. package/frontend/src/components/datagrid/cell-editors/index.ts +14 -0
  209. package/frontend/src/components/datagrid/cell-editors/types.ts +43 -0
  210. package/frontend/src/components/datagrid/datagridTypes.tsx +72 -0
  211. package/frontend/src/components/datagrid/index.tsx +20 -0
  212. package/frontend/src/components/index.ts +39 -0
  213. package/frontend/src/components/layout/AppHeader.tsx +146 -0
  214. package/frontend/src/components/layout/AppSidebar.tsx +190 -0
  215. package/frontend/src/components/layout/CloudLayout.tsx +95 -0
  216. package/frontend/src/components/layout/Layout.tsx +43 -0
  217. package/frontend/src/components/radix/Alert.tsx +45 -0
  218. package/frontend/src/components/radix/AlertDialog.tsx +115 -0
  219. package/frontend/src/components/radix/Avatar.tsx +45 -0
  220. package/frontend/src/components/radix/Badge.tsx +33 -0
  221. package/frontend/src/components/radix/Button.tsx +50 -0
  222. package/frontend/src/components/radix/Card.tsx +58 -0
  223. package/frontend/src/components/radix/Dialog.tsx +98 -0
  224. package/frontend/src/components/radix/DropdownMenu.tsx +185 -0
  225. package/frontend/src/components/radix/Form.tsx +167 -0
  226. package/frontend/src/components/radix/Input.tsx +22 -0
  227. package/frontend/src/components/radix/Label.tsx +19 -0
  228. package/frontend/src/components/radix/Popover.tsx +29 -0
  229. package/frontend/src/components/radix/ScrollArea.tsx +44 -0
  230. package/frontend/src/components/radix/Select.tsx +151 -0
  231. package/frontend/src/components/radix/Separator.tsx +26 -0
  232. package/frontend/src/components/radix/Sheet.tsx +119 -0
  233. package/frontend/src/components/radix/Skeleton.tsx +7 -0
  234. package/frontend/src/components/radix/Switch.tsx +29 -0
  235. package/frontend/src/components/radix/Tabs.tsx +50 -0
  236. package/frontend/src/components/radix/Textarea.tsx +21 -0
  237. package/frontend/src/components/radix/Tooltip.tsx +28 -0
  238. package/frontend/src/features/ai/components/AIConfigCard.tsx +154 -0
  239. package/frontend/src/features/ai/components/AIConfigDialog.tsx +76 -0
  240. package/frontend/src/features/ai/components/AIConfigForm.tsx +222 -0
  241. package/frontend/src/features/ai/components/AIEmptyState.tsx +18 -0
  242. package/frontend/src/features/ai/components/fields/ModalityField.tsx +87 -0
  243. package/frontend/src/features/ai/components/fields/ModelSelectionField.tsx +134 -0
  244. package/frontend/src/features/ai/components/fields/SystemPromptField.tsx +33 -0
  245. package/frontend/src/features/ai/helpers.ts +155 -0
  246. package/frontend/src/features/ai/hooks/useAIConfigs.ts +221 -0
  247. package/frontend/src/features/ai/hooks/useAIUsage.ts +77 -0
  248. package/frontend/src/features/ai/page/AIPage.tsx +178 -0
  249. package/frontend/src/features/ai/services/ai.service.ts +148 -0
  250. package/frontend/src/features/auth/components/AddOAuthDialog.tsx +106 -0
  251. package/frontend/src/features/auth/components/AuthMethodTab.tsx +238 -0
  252. package/frontend/src/features/auth/components/OAuthConfigDialog.tsx +303 -0
  253. package/frontend/src/features/auth/components/OAuthEmptyState.tsx +15 -0
  254. package/frontend/src/features/auth/components/UserFormDialog.tsx +248 -0
  255. package/frontend/src/features/auth/components/UsersDataGrid.tsx +183 -0
  256. package/frontend/src/features/auth/components/UsersTab.tsx +114 -0
  257. package/frontend/src/features/auth/hooks/useOAuthConfig.ts +129 -0
  258. package/frontend/src/features/auth/hooks/useUsers.ts +57 -0
  259. package/frontend/src/features/auth/index.ts +9 -0
  260. package/frontend/src/features/auth/page/AuthenticationPage.tsx +169 -0
  261. package/frontend/src/features/auth/services/auth.service.ts +112 -0
  262. package/frontend/src/features/auth/services/oauth.service.ts +49 -0
  263. package/frontend/src/features/dashboard/page/DashboardPage.tsx +194 -0
  264. package/frontend/src/features/database/components/ColumnTypeSelect.tsx +64 -0
  265. package/frontend/src/features/database/components/DatabaseDataGrid.tsx +282 -0
  266. package/frontend/src/features/database/components/ForeignKeyCell.tsx +187 -0
  267. package/frontend/src/features/database/components/ForeignKeyPopover.tsx +378 -0
  268. package/frontend/src/features/database/components/LinkRecordModal.tsx +288 -0
  269. package/frontend/src/features/database/components/RecordFormDialog.tsx +164 -0
  270. package/frontend/src/features/database/components/RecordFormField.tsx +568 -0
  271. package/frontend/src/features/database/components/TableEmptyState.tsx +21 -0
  272. package/frontend/src/features/database/components/TableForm.tsx +656 -0
  273. package/frontend/src/features/database/components/TableFormColumn.tsx +137 -0
  274. package/frontend/src/features/database/components/TableListSkeleton.tsx +9 -0
  275. package/frontend/src/features/database/components/TableSidebar.tsx +47 -0
  276. package/frontend/src/features/database/constants.ts +26 -0
  277. package/frontend/src/features/database/helpers.ts +125 -0
  278. package/frontend/src/features/database/hooks/UseLinkModal.tsx +78 -0
  279. package/frontend/src/features/database/index.ts +12 -0
  280. package/frontend/src/features/database/page/DatabasePage.tsx +626 -0
  281. package/frontend/src/features/database/schema.ts +25 -0
  282. package/frontend/src/features/database/services/database.service.ts +216 -0
  283. package/frontend/src/features/functions/components/FunctionEmptyState.tsx +15 -0
  284. package/frontend/src/features/functions/components/FunctionRow.tsx +71 -0
  285. package/frontend/src/features/functions/components/FunctionViewer.tsx +46 -0
  286. package/frontend/src/features/functions/components/FunctionsContent.tsx +88 -0
  287. package/frontend/src/features/functions/components/FunctionsSidebar.tsx +56 -0
  288. package/frontend/src/features/functions/components/SecretEmptyState.tsx +23 -0
  289. package/frontend/src/features/functions/components/SecretRow.tsx +68 -0
  290. package/frontend/src/features/functions/components/SecretsContent.tsx +120 -0
  291. package/frontend/src/features/functions/hooks/useFunctions.ts +106 -0
  292. package/frontend/src/features/functions/page/FunctionsPage.tsx +28 -0
  293. package/frontend/src/features/functions/services/functions.service.ts +48 -0
  294. package/frontend/src/features/login/components/AuthErrorBoundary.tsx +87 -0
  295. package/frontend/src/features/login/components/PrivateRoute.tsx +24 -0
  296. package/frontend/src/features/login/page/CloudLoginPage.tsx +93 -0
  297. package/frontend/src/features/login/page/LoginPage.tsx +174 -0
  298. package/frontend/src/features/logs/components/AnalyticsLogsTable.tsx +313 -0
  299. package/frontend/src/features/logs/components/LogsTable.tsx +199 -0
  300. package/frontend/src/features/logs/hooks/useAuditLogs.ts +39 -0
  301. package/frontend/src/features/logs/index.ts +5 -0
  302. package/frontend/src/features/logs/page/AnalyticsLogsPage.tsx +530 -0
  303. package/frontend/src/features/logs/page/AuditsPage.tsx +192 -0
  304. package/frontend/src/features/logs/services/log.service.ts +171 -0
  305. package/frontend/src/features/metadata/hooks/useMetadata.ts +53 -0
  306. package/frontend/src/features/metadata/index.ts +0 -0
  307. package/frontend/src/features/metadata/page/MetadataPage.tsx +136 -0
  308. package/frontend/src/features/metadata/services/metadata.service.ts +17 -0
  309. package/frontend/src/features/onboard/components/CompletionCard.tsx +41 -0
  310. package/frontend/src/features/onboard/components/OnboardButton.tsx +84 -0
  311. package/frontend/src/features/onboard/components/StepContent.tsx +91 -0
  312. package/frontend/src/features/onboard/components/TestConnectionStep.tsx +53 -0
  313. package/frontend/src/features/onboard/components/mcp/CursorDeeplinkGenerator.tsx +35 -0
  314. package/frontend/src/features/onboard/components/mcp/McpInstallation.tsx +144 -0
  315. package/frontend/src/features/onboard/components/mcp/index.ts +4 -0
  316. package/frontend/src/features/onboard/components/mcp/mcp-helper.tsx +98 -0
  317. package/frontend/src/features/onboard/index.ts +3 -0
  318. package/frontend/src/features/onboard/page/OnBoardPage.tsx +104 -0
  319. package/frontend/src/features/onboard/types.ts +8 -0
  320. package/frontend/src/features/secrets/hooks/useSecrets.ts +139 -0
  321. package/frontend/src/features/secrets/services/secrets.service.ts +57 -0
  322. package/frontend/src/features/storage/components/BucketEmptyState.tsx +19 -0
  323. package/frontend/src/features/storage/components/BucketFormDialog.tsx +194 -0
  324. package/frontend/src/features/storage/components/BucketListSkeleton.tsx +17 -0
  325. package/frontend/src/features/storage/components/FilePreviewDialog.tsx +287 -0
  326. package/frontend/src/features/storage/components/StorageDataGrid.tsx +239 -0
  327. package/frontend/src/features/storage/components/StorageManager.tsx +236 -0
  328. package/frontend/src/features/storage/components/StorageSidebar.tsx +44 -0
  329. package/frontend/src/features/storage/components/UploadToast.tsx +46 -0
  330. package/frontend/src/features/storage/index.ts +3 -0
  331. package/frontend/src/features/storage/page/StoragePage.tsx +553 -0
  332. package/frontend/src/features/storage/services/storage.service.ts +144 -0
  333. package/frontend/src/features/visualizer/components/AuthNode.tsx +107 -0
  334. package/frontend/src/features/visualizer/components/BucketNode.tsx +34 -0
  335. package/frontend/src/features/visualizer/components/SchemaVisualizer.tsx +359 -0
  336. package/frontend/src/features/visualizer/components/TableNode.tsx +152 -0
  337. package/frontend/src/features/visualizer/components/VisualizerSkeleton.tsx +24 -0
  338. package/frontend/src/features/visualizer/components/index.ts +5 -0
  339. package/frontend/src/features/visualizer/page/VisualizerPage.tsx +127 -0
  340. package/frontend/src/index.css +248 -0
  341. package/frontend/src/lib/api/client.ts +163 -0
  342. package/frontend/src/lib/contexts/AuthContext.tsx +157 -0
  343. package/frontend/src/lib/contexts/OnboardStepContext.tsx +68 -0
  344. package/frontend/src/lib/contexts/SocketContext.tsx +303 -0
  345. package/frontend/src/lib/contexts/ThemeContext.tsx +125 -0
  346. package/frontend/src/lib/hooks/useAuth.ts +4 -0
  347. package/frontend/src/lib/hooks/useConfirm.ts +55 -0
  348. package/frontend/src/lib/hooks/useInterval.ts +27 -0
  349. package/frontend/src/lib/hooks/useMediaQuery.ts +59 -0
  350. package/frontend/src/lib/hooks/useOnboardingCompletion.ts +29 -0
  351. package/frontend/src/lib/hooks/usePagination.ts +27 -0
  352. package/frontend/src/lib/hooks/useTimeout.ts +27 -0
  353. package/frontend/src/lib/hooks/useToast.tsx +229 -0
  354. package/frontend/src/lib/utils/constants.ts +38 -0
  355. package/frontend/src/lib/utils/utils.ts +165 -0
  356. package/frontend/src/lib/utils/validation-schemas.ts +126 -0
  357. package/frontend/src/main.tsx +16 -0
  358. package/frontend/src/rdg.css +194 -0
  359. package/frontend/src/vite-env.d.ts +12 -0
  360. package/frontend/tailwind.config.js +97 -0
  361. package/frontend/tsconfig.json +26 -0
  362. package/frontend/tsconfig.node.json +10 -0
  363. package/frontend/vite.config.ts +37 -0
  364. package/frontend/vitest.config.ts +36 -0
  365. package/functions/deno.json +25 -0
  366. package/functions/server.ts +290 -0
  367. package/functions/worker-template.js +126 -0
  368. package/openapi/ai.yaml +689 -0
  369. package/openapi/auth.yaml +563 -0
  370. package/openapi/functions.yaml +476 -0
  371. package/openapi/health.yaml +30 -0
  372. package/openapi/logs.yaml +224 -0
  373. package/openapi/metadata.yaml +178 -0
  374. package/openapi/records.yaml +382 -0
  375. package/openapi/secrets.yaml +371 -0
  376. package/openapi/storage.yaml +876 -0
  377. package/openapi/tables.yaml +464 -0
  378. package/package.json +88 -0
  379. package/shared-schemas/package.json +31 -0
  380. package/shared-schemas/src/ai-api.schema.ts +167 -0
  381. package/shared-schemas/src/ai.schema.ts +54 -0
  382. package/shared-schemas/src/auth-api.schema.ts +193 -0
  383. package/shared-schemas/src/auth.schema.ts +94 -0
  384. package/shared-schemas/src/database-api.schema.ts +259 -0
  385. package/shared-schemas/src/database.schema.ts +69 -0
  386. package/shared-schemas/src/functions-api.schema.ts +25 -0
  387. package/shared-schemas/src/functions.schema.ts +16 -0
  388. package/shared-schemas/src/index.ts +13 -0
  389. package/shared-schemas/src/logs-api.schema.ts +49 -0
  390. package/shared-schemas/src/logs.schema.ts +14 -0
  391. package/shared-schemas/src/metadata.schema.ts +56 -0
  392. package/shared-schemas/src/storage-api.schema.ts +65 -0
  393. package/shared-schemas/src/storage.schema.ts +19 -0
  394. package/shared-schemas/tsconfig.json +21 -0
  395. package/tsconfig.json +8 -0
@@ -0,0 +1,476 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Insforge Functions API
4
+ version: 1.0.0
5
+ description: Serverless functions running in Deno runtime
6
+
7
+ paths:
8
+ /api/functions:
9
+ get:
10
+ summary: List all functions
11
+ description: Get all functions with their metadata
12
+ tags:
13
+ - Admin
14
+ security:
15
+ - bearerAuth: []
16
+ responses:
17
+ '200':
18
+ description: List of functions
19
+ content:
20
+ application/json:
21
+ schema:
22
+ type: array
23
+ items:
24
+ $ref: '#/components/schemas/FunctionMetadata'
25
+ example:
26
+ - id: "123e4567-e89b-12d3-a456-426614174000"
27
+ slug: "hello-world"
28
+ name: "Hello World Function"
29
+ description: "Returns a greeting message"
30
+ status: "active"
31
+ created_at: "2024-01-21T10:30:00Z"
32
+ updated_at: "2024-01-21T10:35:00Z"
33
+ deployed_at: "2024-01-21T10:35:00Z"
34
+ - id: "223e4567-e89b-12d3-a456-426614174001"
35
+ slug: "process-webhook"
36
+ name: "Webhook Processor"
37
+ description: "Processes incoming webhooks"
38
+ status: "draft"
39
+ created_at: "2024-01-22T14:20:00Z"
40
+ updated_at: "2024-01-22T14:20:00Z"
41
+ deployed_at: null
42
+ '401':
43
+ description: Unauthorized
44
+ '403':
45
+ description: Forbidden - Admin only
46
+ '500':
47
+ description: Failed to list functions
48
+ content:
49
+ application/json:
50
+ schema:
51
+ $ref: '#/components/schemas/ErrorResponse'
52
+
53
+ post:
54
+ summary: Create new function
55
+ description: Create a new function with code that runs in Deno runtime
56
+ tags:
57
+ - Admin
58
+ security:
59
+ - bearerAuth: []
60
+ requestBody:
61
+ required: true
62
+ content:
63
+ application/json:
64
+ schema:
65
+ type: object
66
+ required:
67
+ - name
68
+ - code
69
+ properties:
70
+ name:
71
+ type: string
72
+ minLength: 1
73
+ description: Display name for the function
74
+ example: "Hello World Function"
75
+ slug:
76
+ type: string
77
+ pattern: '^[a-zA-Z0-9_-]+$'
78
+ description: URL-friendly identifier (auto-generated from name if not provided)
79
+ example: "hello-world"
80
+ code:
81
+ type: string
82
+ minLength: 1
83
+ description: JavaScript/TypeScript code that exports an async function
84
+ example: |
85
+ export default async function(request) {
86
+ const { name = 'World' } = await request.json();
87
+ return new Response(
88
+ JSON.stringify({ message: `Hello, ${name}!` }),
89
+ { headers: { 'Content-Type': 'application/json' } }
90
+ );
91
+ }
92
+ description:
93
+ type: string
94
+ description: Description of what the function does
95
+ example: "Returns a personalized greeting message"
96
+ status:
97
+ type: string
98
+ enum: ["draft", "active"]
99
+ default: "active"
100
+ description: Initial status (draft or active/deployed)
101
+ responses:
102
+ '201':
103
+ description: Function created successfully
104
+ content:
105
+ application/json:
106
+ schema:
107
+ type: object
108
+ properties:
109
+ success:
110
+ type: boolean
111
+ function:
112
+ $ref: '#/components/schemas/FunctionMetadata'
113
+ example:
114
+ success: true
115
+ function:
116
+ id: "123e4567-e89b-12d3-a456-426614174000"
117
+ slug: "hello-world"
118
+ name: "Hello World Function"
119
+ description: "Returns a greeting message"
120
+ status: "active"
121
+ created_at: "2024-01-21T10:30:00Z"
122
+ '400':
123
+ description: Invalid request
124
+ content:
125
+ application/json:
126
+ schema:
127
+ $ref: '#/components/schemas/ErrorResponse'
128
+ examples:
129
+ validation:
130
+ value:
131
+ error: "Invalid request"
132
+ details:
133
+ - code: "too_small"
134
+ minimum: 1
135
+ path: ["name"]
136
+ message: "Name is required"
137
+ dangerousCode:
138
+ value:
139
+ error: "Code contains potentially dangerous patterns"
140
+ pattern: "/Deno\\.run/i"
141
+ '409':
142
+ description: Function slug already exists
143
+ content:
144
+ application/json:
145
+ schema:
146
+ $ref: '#/components/schemas/ErrorResponse'
147
+ example:
148
+ error: "Function with this slug already exists"
149
+ details: "duplicate key value violates unique constraint"
150
+ '500':
151
+ description: Failed to create function
152
+ content:
153
+ application/json:
154
+ schema:
155
+ $ref: '#/components/schemas/ErrorResponse'
156
+
157
+ /api/functions/{slug}:
158
+ get:
159
+ summary: Get function details
160
+ description: Get a specific function including its code
161
+ tags:
162
+ - Admin
163
+ security:
164
+ - bearerAuth: []
165
+ parameters:
166
+ - name: slug
167
+ in: path
168
+ required: true
169
+ schema:
170
+ type: string
171
+ pattern: '^[a-zA-Z0-9_-]+$'
172
+ description: Function slug identifier
173
+ example: "hello-world"
174
+ responses:
175
+ '200':
176
+ description: Function details with code
177
+ content:
178
+ application/json:
179
+ schema:
180
+ $ref: '#/components/schemas/FunctionDetails'
181
+ example:
182
+ id: "123e4567-e89b-12d3-a456-426614174000"
183
+ slug: "hello-world"
184
+ name: "Hello World Function"
185
+ description: "Returns a greeting message"
186
+ code: |
187
+ export default async function(request) {
188
+ const { name = 'World' } = await request.json();
189
+ return new Response(
190
+ JSON.stringify({ message: `Hello, ${name}!` }),
191
+ { headers: { 'Content-Type': 'application/json' } }
192
+ );
193
+ }
194
+ status: "active"
195
+ created_at: "2024-01-21T10:30:00Z"
196
+ updated_at: "2024-01-21T10:35:00Z"
197
+ deployed_at: "2024-01-21T10:35:00Z"
198
+ '404':
199
+ description: Function not found
200
+ content:
201
+ application/json:
202
+ schema:
203
+ $ref: '#/components/schemas/ErrorResponse'
204
+ example:
205
+ error: "Function not found"
206
+ '401':
207
+ description: Unauthorized
208
+ '403':
209
+ description: Forbidden - Admin only
210
+ '500':
211
+ description: Failed to get function
212
+ content:
213
+ application/json:
214
+ schema:
215
+ $ref: '#/components/schemas/ErrorResponse'
216
+
217
+ put:
218
+ summary: Update function
219
+ description: Update an existing function's code or metadata
220
+ tags:
221
+ - Admin
222
+ security:
223
+ - bearerAuth: []
224
+ parameters:
225
+ - name: slug
226
+ in: path
227
+ required: true
228
+ schema:
229
+ type: string
230
+ pattern: '^[a-zA-Z0-9_-]+$'
231
+ description: Function slug identifier
232
+ example: "hello-world"
233
+ requestBody:
234
+ required: true
235
+ content:
236
+ application/json:
237
+ schema:
238
+ type: object
239
+ properties:
240
+ name:
241
+ type: string
242
+ description: New display name
243
+ code:
244
+ type: string
245
+ description: Updated function code
246
+ description:
247
+ type: string
248
+ description: Updated description
249
+ status:
250
+ type: string
251
+ enum: ["draft", "active", "error"]
252
+ description: Function status
253
+ responses:
254
+ '200':
255
+ description: Function updated successfully
256
+ content:
257
+ application/json:
258
+ schema:
259
+ type: object
260
+ properties:
261
+ success:
262
+ type: boolean
263
+ function:
264
+ $ref: '#/components/schemas/FunctionMetadata'
265
+ example:
266
+ success: true
267
+ function:
268
+ id: "123e4567-e89b-12d3-a456-426614174000"
269
+ slug: "hello-world"
270
+ name: "Hello World Function v2"
271
+ description: "Returns a greeting message"
272
+ status: "active"
273
+ updated_at: "2024-01-21T11:00:00Z"
274
+ '400':
275
+ description: Invalid request
276
+ content:
277
+ application/json:
278
+ schema:
279
+ $ref: '#/components/schemas/ErrorResponse'
280
+ '404':
281
+ description: Function not found
282
+ content:
283
+ application/json:
284
+ schema:
285
+ $ref: '#/components/schemas/ErrorResponse'
286
+ example:
287
+ error: "Function not found"
288
+ '500':
289
+ description: Failed to update function
290
+ content:
291
+ application/json:
292
+ schema:
293
+ $ref: '#/components/schemas/ErrorResponse'
294
+
295
+ delete:
296
+ summary: Delete function
297
+ description: Permanently delete a function
298
+ tags:
299
+ - Admin
300
+ security:
301
+ - bearerAuth: []
302
+ parameters:
303
+ - name: slug
304
+ in: path
305
+ required: true
306
+ schema:
307
+ type: string
308
+ pattern: '^[a-zA-Z0-9_-]+$'
309
+ description: Function slug identifier
310
+ example: "hello-world"
311
+ responses:
312
+ '200':
313
+ description: Function deleted successfully
314
+ content:
315
+ application/json:
316
+ schema:
317
+ type: object
318
+ properties:
319
+ success:
320
+ type: boolean
321
+ message:
322
+ type: string
323
+ example:
324
+ success: true
325
+ message: "Function hello-world deleted successfully"
326
+ '404':
327
+ description: Function not found
328
+ content:
329
+ application/json:
330
+ schema:
331
+ $ref: '#/components/schemas/ErrorResponse'
332
+ example:
333
+ error: "Function not found"
334
+ '500':
335
+ description: Failed to delete function
336
+ content:
337
+ application/json:
338
+ schema:
339
+ $ref: '#/components/schemas/ErrorResponse'
340
+
341
+ /functions/{slug}:
342
+ post:
343
+ summary: Execute function
344
+ description: Execute a function with the provided request
345
+ tags:
346
+ - Client
347
+ parameters:
348
+ - name: slug
349
+ in: path
350
+ required: true
351
+ schema:
352
+ type: string
353
+ pattern: '^[a-zA-Z0-9_-]+$'
354
+ description: Function slug identifier
355
+ example: "hello-world"
356
+ requestBody:
357
+ required: false
358
+ content:
359
+ application/json:
360
+ schema:
361
+ type: object
362
+ additionalProperties: true
363
+ example:
364
+ name: "John"
365
+ age: 30
366
+ responses:
367
+ '200':
368
+ description: Function executed successfully
369
+ content:
370
+ '*/*':
371
+ schema:
372
+ type: object
373
+ additionalProperties: true
374
+ example:
375
+ message: "Hello, John!"
376
+ '404':
377
+ description: Function not found or not active
378
+ content:
379
+ application/json:
380
+ schema:
381
+ $ref: '#/components/schemas/ErrorResponse'
382
+ example:
383
+ error: "Function not found or not active"
384
+ '500':
385
+ description: Function execution error
386
+ content:
387
+ application/json:
388
+ schema:
389
+ $ref: '#/components/schemas/ErrorResponse'
390
+ example:
391
+ error: "Function execution failed"
392
+ message: "TypeError: Cannot read property 'name' of undefined"
393
+
394
+ components:
395
+ securitySchemes:
396
+ bearerAuth:
397
+ type: http
398
+ scheme: bearer
399
+ bearerFormat: JWT
400
+
401
+ schemas:
402
+ FunctionMetadata:
403
+ type: object
404
+ properties:
405
+ id:
406
+ type: string
407
+ format: uuid
408
+ description: Unique identifier for the function
409
+ slug:
410
+ type: string
411
+ description: URL-friendly identifier
412
+ example: "hello-world"
413
+ name:
414
+ type: string
415
+ description: Display name for the function
416
+ example: "Hello World Function"
417
+ description:
418
+ type: string
419
+ nullable: true
420
+ description: Description of what the function does
421
+ status:
422
+ type: string
423
+ enum: ["draft", "active", "error"]
424
+ description: Current status of the function
425
+ created_at:
426
+ type: string
427
+ format: date-time
428
+ description: When the function was created
429
+ updated_at:
430
+ type: string
431
+ format: date-time
432
+ description: When the function was last updated
433
+ deployed_at:
434
+ type: string
435
+ format: date-time
436
+ nullable: true
437
+ description: When the function was last deployed (null if never deployed)
438
+ required:
439
+ - id
440
+ - slug
441
+ - name
442
+ - status
443
+ - created_at
444
+ - updated_at
445
+
446
+ FunctionDetails:
447
+ allOf:
448
+ - $ref: '#/components/schemas/FunctionMetadata'
449
+ - type: object
450
+ properties:
451
+ code:
452
+ type: string
453
+ description: The function's JavaScript/TypeScript code
454
+ required:
455
+ - code
456
+
457
+ ErrorResponse:
458
+ type: object
459
+ properties:
460
+ error:
461
+ type: string
462
+ description: Error message
463
+ details:
464
+ oneOf:
465
+ - type: string
466
+ - type: array
467
+ items:
468
+ type: object
469
+ - type: object
470
+ description: Additional error details
471
+ message:
472
+ type: string
473
+ description: Detailed error message
474
+ pattern:
475
+ type: string
476
+ description: Pattern that caused validation failure (for dangerous code detection)
@@ -0,0 +1,30 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Insforge Health API
4
+ version: 1.0.0
5
+
6
+ paths:
7
+ /api/health:
8
+ get:
9
+ summary: Health check
10
+ description: Check if the API is running and healthy
11
+ tags:
12
+ - Client
13
+ responses:
14
+ '200':
15
+ description: API is healthy
16
+ content:
17
+ application/json:
18
+ schema:
19
+ type: object
20
+ properties:
21
+ status:
22
+ type: string
23
+ example: ok
24
+ service:
25
+ type: string
26
+ example: Insforge Backend
27
+ timestamp:
28
+ type: string
29
+ format: date-time
30
+ example: "2025-01-21T03:45:22.194Z"