insforge 1.3.0 → 1.4.8
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.
- package/CHANGELOG.md +2 -0
- package/auth/package.json +5 -3
- package/auth/src/lib/broadcastService.ts +115 -117
- package/auth/src/lib/insforge.ts +8 -0
- package/auth/src/main.tsx +2 -4
- package/auth/src/pages/SignInPage.tsx +60 -60
- package/auth/src/pages/SignUpPage.tsx +60 -60
- package/auth/src/pages/VerifyEmailPage.tsx +18 -0
- package/auth/tsconfig.json +2 -1
- package/backend/package.json +10 -6
- package/backend/src/api/middlewares/rate-limiters.ts +127 -127
- package/backend/src/api/routes/ai/index.routes.ts +475 -468
- package/backend/src/api/routes/auth/index.routes.ts +85 -32
- package/backend/src/api/routes/auth/oauth.routes.ts +11 -6
- package/backend/src/api/routes/database/index.routes.ts +2 -0
- package/backend/src/api/routes/database/records.routes.ts +39 -175
- package/backend/src/api/routes/database/rpc.routes.ts +69 -0
- package/backend/src/api/routes/deployments/index.routes.ts +192 -0
- package/backend/src/api/routes/docs/index.routes.ts +3 -2
- package/backend/src/api/routes/email/index.routes.ts +35 -35
- package/backend/src/api/routes/functions/index.routes.ts +3 -3
- package/backend/src/api/routes/metadata/index.routes.ts +26 -0
- package/backend/src/api/routes/webhooks/index.routes.ts +109 -0
- package/backend/src/infra/database/database.manager.ts +0 -10
- package/backend/src/infra/database/migrations/018_schema-rework.sql +441 -0
- package/backend/src/infra/database/migrations/019_create-deployments-table.sql +36 -0
- package/backend/src/infra/database/migrations/020_add-audio-modality.sql +11 -0
- package/backend/src/infra/database/migrations/bootstrap/bootstrap-migrations.js +103 -0
- package/backend/src/infra/security/token.manager.ts +1 -4
- package/backend/src/providers/ai/openrouter.provider.ts +12 -3
- package/backend/src/providers/database/base.provider.ts +39 -0
- package/backend/src/providers/database/cloud.provider.ts +159 -0
- package/backend/src/providers/deployments/vercel.provider.ts +516 -0
- package/backend/src/server.ts +19 -7
- package/backend/src/services/ai/ai-config.service.ts +6 -6
- package/backend/src/services/ai/ai-model.service.ts +60 -60
- package/backend/src/services/ai/ai-usage.service.ts +7 -7
- package/backend/src/services/ai/chat-completion.service.ts +415 -220
- package/backend/src/services/ai/helpers.ts +64 -64
- package/backend/src/services/ai/index.ts +13 -13
- package/backend/src/services/auth/auth-config.service.ts +4 -4
- package/backend/src/services/auth/auth-otp.service.ts +6 -6
- package/backend/src/services/auth/auth.service.ts +134 -74
- package/backend/src/services/auth/index.ts +4 -4
- package/backend/src/services/auth/oauth-config.service.ts +12 -12
- package/backend/src/services/database/database-advance.service.ts +19 -55
- package/backend/src/services/database/database-table.service.ts +38 -85
- package/backend/src/services/database/postgrest-proxy.service.ts +165 -0
- package/backend/src/services/deployments/deployment.service.ts +693 -0
- package/backend/src/services/functions/function.service.ts +61 -41
- package/backend/src/services/logs/audit.service.ts +10 -10
- package/backend/src/services/secrets/secret.service.ts +101 -27
- package/backend/src/services/storage/storage.service.ts +30 -30
- package/backend/src/services/usage/usage.service.ts +6 -6
- package/backend/src/types/ai.ts +8 -0
- package/backend/src/types/auth.ts +5 -1
- package/backend/src/types/database.ts +2 -0
- package/backend/src/types/deployments.ts +33 -0
- package/backend/src/types/storage.ts +1 -1
- package/backend/src/types/webhooks.ts +45 -0
- package/backend/src/utils/cookies.ts +34 -35
- package/backend/src/utils/environment.ts +0 -14
- package/backend/src/utils/s3-config-loader.ts +64 -64
- package/backend/src/utils/seed.ts +334 -301
- package/backend/src/utils/sql-parser.ts +126 -0
- package/backend/src/utils/utils.ts +114 -114
- package/backend/src/utils/validations.ts +10 -10
- package/backend/tests/local/test-rpc.sh +141 -0
- package/backend/tests/local/test-secrets.sh +1 -1
- package/backend/tests/manual/test-ai-model-plugins.sh +258 -0
- package/backend/tests/manual/test-rawsql-modes.sh +24 -24
- package/backend/tests/unit/database-advance.test.ts +326 -0
- package/backend/tests/unit/helpers.test.ts +2 -2
- package/claude-plugin/skills/insforge-schema-patterns/SKILL.md +13 -10
- package/docker-compose.prod.yml +1 -1
- package/docker-compose.yml +1 -1
- package/docs/agent-docs/deployment.md +79 -0
- package/docs/changelog.mdx +165 -72
- package/docs/core-concepts/ai/architecture.mdx +1 -23
- package/docs/core-concepts/ai/sdk.mdx +26 -1
- package/docs/core-concepts/authentication/architecture.mdx +6 -8
- package/docs/core-concepts/authentication/sdk.mdx +387 -91
- package/docs/core-concepts/authentication/ui-components/customization.mdx +460 -256
- package/docs/core-concepts/authentication/ui-components/nextjs.mdx +50 -24
- package/docs/core-concepts/authentication/ui-components/react-router.mdx +18 -19
- package/docs/core-concepts/authentication/ui-components/react.mdx +26 -19
- package/docs/core-concepts/database/architecture.mdx +58 -21
- package/docs/core-concepts/database/pgvector.mdx +138 -0
- package/docs/core-concepts/database/sdk.mdx +17 -17
- package/docs/core-concepts/deployments/architecture.mdx +152 -0
- package/docs/core-concepts/email/architecture.mdx +4 -2
- package/docs/core-concepts/functions/architecture.mdx +1 -1
- package/docs/core-concepts/functions/sdk.mdx +0 -1
- package/docs/core-concepts/realtime/architecture.mdx +1 -1
- package/docs/core-concepts/storage/architecture.mdx +1 -1
- package/docs/core-concepts/storage/sdk.mdx +25 -25
- package/docs/docs.json +14 -6
- package/docs/favicon.png +0 -0
- package/docs/favicon.svg +3 -18
- package/docs/images/changelog/dec-2025/apple-oauth.mp4 +0 -0
- package/docs/images/changelog/dec-2025/moreModels.png +0 -0
- package/docs/images/changelog/dec-2025/multi-region.webp +0 -0
- package/docs/images/changelog/dec-2025/postgres-connection.webp +0 -0
- package/docs/images/changelog/dec-2025/realtime2.png +0 -0
- package/docs/images/mcp-setup/CC-MCP-1.mp4 +0 -0
- package/docs/images/mcp-setup/CC-MCP-2.mp4 +0 -0
- package/docs/images/mcp-setup/Cursor-MCP-1.mp4 +0 -0
- package/docs/images/mcp-setup/Cursor-MCP-2.mp4 +0 -0
- package/docs/images/mcp-setup/Cursor-MCP-3.mp4 +0 -0
- package/docs/images/mcp-setup/claude-code-connect.png +0 -0
- package/docs/images/mcp-setup/cline-1.png +0 -0
- package/docs/images/mcp-setup/cline-2.png +0 -0
- package/docs/images/mcp-setup/cline-3.png +0 -0
- package/docs/images/mcp-setup/connect-project.png +0 -0
- package/docs/images/mcp-setup/copilot-1.png +0 -0
- package/docs/images/mcp-setup/copilot-2.png +0 -0
- package/docs/images/mcp-setup/copilot-3.png +0 -0
- package/docs/images/mcp-setup/mcp-json-1.png +0 -0
- package/docs/images/mcp-setup/mcp-json-2.png +0 -0
- package/docs/images/mcp-setup/qoder-1.png +0 -0
- package/docs/images/mcp-setup/qoder-2.png +0 -0
- package/docs/images/mcp-setup/roocode-1.png +0 -0
- package/docs/images/mcp-setup/roocode-2.png +0 -0
- package/docs/images/mcp-setup/trae-1.png +0 -0
- package/docs/images/mcp-setup/trae-2.png +0 -0
- package/docs/images/mcp-setup/trae-3.png +0 -0
- package/docs/images/mcp-setup/trae-4.png +0 -0
- package/docs/images/mcp-setup/trae-5.png +0 -0
- package/docs/images/mcp-setup/windsurf-1.png +0 -0
- package/docs/images/mcp-setup/windsurf-2.png +0 -0
- package/docs/insforge-instructions-sdk.md +7 -3
- package/docs/introduction.mdx +9 -8
- package/docs/mcp-setup.mdx +332 -0
- package/docs/oauth-server.mdx +563 -0
- package/docs/partnership.mdx +79 -10
- package/docs/quickstart.mdx +1 -1
- package/docs/vscode-extension.mdx +74 -0
- package/eslint.config.js +1 -0
- package/examples/response-examples.md +1 -1
- package/frontend/package.json +1 -1
- package/frontend/src/App.tsx +8 -3
- package/frontend/src/assets/logos/antigravity.svg +1 -0
- package/frontend/src/assets/logos/copilot.svg +10 -0
- package/frontend/src/assets/logos/deepseek.svg +139 -0
- package/frontend/src/assets/logos/kiro.svg +9 -0
- package/frontend/src/assets/logos/qoder.svg +4 -0
- package/frontend/src/assets/logos/qwen.svg +15 -0
- package/frontend/src/components/CodeBlock.tsx +2 -2
- package/frontend/src/components/ConnectCTA.tsx +3 -2
- package/frontend/src/components/datagrid/DataGrid.tsx +90 -62
- package/frontend/src/components/datagrid/datagridTypes.tsx +2 -1
- package/frontend/src/components/datagrid/index.ts +1 -1
- package/frontend/src/components/index.ts +0 -1
- package/frontend/src/components/layout/AppHeader.tsx +4 -27
- package/frontend/src/components/layout/AppSidebar.tsx +85 -100
- package/frontend/src/components/layout/Layout.tsx +34 -32
- package/frontend/src/components/layout/PrimaryMenu.tsx +12 -4
- package/frontend/src/components/radix/Select.tsx +151 -151
- package/frontend/src/features/ai/components/AIConfigCard.tsx +200 -200
- package/frontend/src/features/ai/components/AIEmptyState.tsx +23 -23
- package/frontend/src/features/ai/components/ModalityFilterSidebar.tsx +102 -101
- package/frontend/src/features/ai/components/ModelSelectionDialog.tsx +135 -135
- package/frontend/src/features/ai/components/ModelSelectionGrid.tsx +51 -51
- package/frontend/src/features/ai/components/SystemPromptDialog.tsx +118 -118
- package/frontend/src/features/ai/components/index.ts +6 -6
- package/frontend/src/features/ai/helpers.ts +147 -141
- package/frontend/src/features/ai/pages/AIPage.tsx +166 -166
- package/frontend/src/features/auth/components/AuthPreview.tsx +96 -96
- package/frontend/src/features/auth/components/UsersDataGrid.tsx +55 -31
- package/frontend/src/features/auth/components/index.ts +5 -5
- package/frontend/src/features/auth/pages/AuthMethodsPage.tsx +275 -275
- package/frontend/src/features/dashboard/pages/DashboardPage.tsx +1 -1
- package/frontend/src/features/database/components/DatabaseDataGrid.tsx +0 -2
- package/frontend/src/features/database/components/ForeignKeyCell.tsx +38 -11
- package/frontend/src/features/database/components/ForeignKeyPopover.tsx +18 -8
- package/frontend/src/features/database/components/LinkRecordModal.tsx +61 -13
- package/frontend/src/features/database/components/RecordFormField.tsx +1 -1
- package/frontend/src/features/database/components/TableSidebar.tsx +0 -3
- package/frontend/src/features/database/components/TablesEmptyState.tsx +1 -1
- package/frontend/src/features/database/components/TemplatePreview.tsx +1 -2
- package/frontend/src/features/database/constants.ts +16 -28
- package/frontend/src/features/database/hooks/useCSVImport.ts +3 -2
- package/frontend/src/features/database/hooks/useRawSQL.ts +3 -2
- package/frontend/src/features/database/hooks/useTables.ts +5 -7
- package/frontend/src/features/database/pages/FunctionsPage.tsx +0 -5
- package/frontend/src/features/database/pages/IndexesPage.tsx +0 -5
- package/frontend/src/features/database/pages/PoliciesPage.tsx +0 -5
- package/frontend/src/features/database/pages/SQLEditorPage.tsx +2 -2
- package/frontend/src/features/database/pages/TriggersPage.tsx +0 -5
- package/frontend/src/features/database/services/advance.service.ts +1 -15
- package/frontend/src/features/database/services/record.service.ts +4 -20
- package/frontend/src/features/database/services/table.service.ts +1 -4
- package/frontend/src/features/database/templates/ai-chatbot.ts +6 -6
- package/frontend/src/features/database/templates/ecommerce-platform.ts +2 -2
- package/frontend/src/features/database/templates/instagram-clone.ts +10 -10
- package/frontend/src/features/database/templates/notion-clone.ts +8 -8
- package/frontend/src/features/database/templates/reddit-clone.ts +10 -10
- package/frontend/src/features/deployments/components/DeploymentRow.tsx +93 -0
- package/frontend/src/features/deployments/components/DeploymentsEmptyState.tsx +15 -0
- package/frontend/src/features/deployments/hooks/useDeployments.ts +157 -0
- package/frontend/src/features/deployments/pages/DeploymentsPage.tsx +318 -0
- package/frontend/src/features/deployments/services/deployments.service.ts +63 -0
- package/frontend/src/features/functions/components/FunctionRow.tsx +72 -72
- package/frontend/src/features/functions/components/FunctionsSidebar.tsx +56 -56
- package/frontend/src/features/functions/components/SecretRow.tsx +3 -3
- package/frontend/src/features/functions/components/index.ts +5 -5
- package/frontend/src/features/functions/hooks/useFunctions.ts +5 -4
- package/frontend/src/features/functions/hooks/useSecrets.ts +6 -9
- package/frontend/src/features/functions/pages/SecretsPage.tsx +118 -118
- package/frontend/src/features/functions/services/function.service.ts +8 -25
- package/frontend/src/features/functions/services/secret.service.ts +23 -41
- package/frontend/src/features/login/pages/CloudLoginPage.tsx +125 -118
- package/frontend/src/features/logs/components/LogDetailPanel.tsx +41 -0
- package/frontend/src/features/logs/components/LogsDataGrid.tsx +32 -1
- package/frontend/src/features/logs/components/index.ts +1 -0
- package/frontend/src/features/logs/pages/LogsPage.tsx +36 -6
- package/frontend/src/features/onboard/components/ApiCredentialsSection.tsx +59 -0
- package/frontend/src/features/onboard/components/ConnectionStringSection.tsx +180 -0
- package/frontend/src/features/onboard/components/McpConnectionSection.tsx +159 -0
- package/frontend/src/features/onboard/components/OnboardingController.tsx +68 -0
- package/frontend/src/features/onboard/components/OnboardingModal.tsx +121 -267
- package/frontend/src/features/onboard/components/ShowPasswordButton.tsx +21 -0
- package/frontend/src/features/onboard/components/index.ts +9 -4
- package/frontend/src/features/onboard/components/mcp/CursorDeeplinkGenerator.tsx +1 -1
- package/frontend/src/features/onboard/components/mcp/QoderDeeplinkGenerator.tsx +36 -0
- package/frontend/src/features/onboard/components/mcp/helpers.tsx +123 -98
- package/frontend/src/features/onboard/components/mcp/index.ts +4 -3
- package/frontend/src/features/onboard/index.ts +17 -13
- package/frontend/src/features/settings/pages/SettingsPage.tsx +349 -0
- package/frontend/src/features/visualizer/components/AuthNode.tsx +4 -4
- package/frontend/src/features/visualizer/components/SchemaVisualizer.tsx +21 -8
- package/frontend/src/features/visualizer/pages/VisualizerPage.tsx +10 -1
- package/frontend/src/index.css +249 -249
- package/frontend/src/lib/contexts/ModalContext.tsx +35 -0
- package/frontend/src/lib/hooks/useMetadata.ts +45 -1
- package/frontend/src/lib/hooks/useModal.tsx +2 -0
- package/frontend/src/lib/routing/AppRoutes.tsx +103 -99
- package/frontend/src/lib/services/metadata.service.ts +20 -3
- package/frontend/src/lib/utils/menuItems.ts +223 -207
- package/frontend/src/lib/utils/utils.ts +196 -196
- package/functions/server.ts +315 -315
- package/functions/worker-template.js +1 -1
- package/openapi/ai.yaml +115 -5
- package/openapi/auth.yaml +97 -17
- package/openapi/logs.yaml +0 -2
- package/openapi/metadata.yaml +0 -2
- package/openapi/records.yaml +21 -21
- package/openapi/tables.yaml +1 -2
- package/package.json +1 -1
- package/shared-schemas/package.json +1 -1
- package/shared-schemas/src/ai-api.schema.ts +251 -143
- package/shared-schemas/src/ai.schema.ts +63 -63
- package/shared-schemas/src/auth-api.schema.ts +34 -6
- package/shared-schemas/src/auth.schema.ts +17 -10
- package/shared-schemas/src/cloud-events.schema.ts +26 -0
- package/shared-schemas/src/deployments-api.schema.ts +55 -0
- package/shared-schemas/src/deployments.schema.ts +30 -0
- package/shared-schemas/src/docs.schema.ts +8 -2
- package/shared-schemas/src/email-api.schema.ts +30 -30
- package/shared-schemas/src/functions-api.schema.ts +13 -4
- package/shared-schemas/src/functions.schema.ts +1 -1
- package/shared-schemas/src/index.ts +22 -18
- package/shared-schemas/src/metadata.schema.ts +30 -4
- package/shared-schemas/src/secrets-api.schema.ts +44 -0
- package/shared-schemas/src/secrets.schema.ts +15 -0
- package/zeabur/README.md +13 -0
- package/zeabur/template.yml +20 -51
- package/backend/src/types/profile.ts +0 -55
- package/frontend/src/components/ProjectInfoModal.tsx +0 -128
|
@@ -25,28 +25,34 @@ export const roleSchema = z.enum(['anon', 'authenticated', 'project_admin']);
|
|
|
25
25
|
|
|
26
26
|
export const verificationMethodSchema = z.enum(['code', 'link']);
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* User profile schema with default fields and passthrough for custom fields
|
|
30
|
+
* Note: Using snake_case for fields as they are stored directly in PostgreSQL JSONB
|
|
31
|
+
*/
|
|
32
|
+
export const profileSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
name: z.string().optional(),
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
36
|
+
avatar_url: z.string().url().optional(),
|
|
37
|
+
})
|
|
38
|
+
.passthrough();
|
|
39
|
+
|
|
28
40
|
// ============================================================================
|
|
29
41
|
// Core entity schemas
|
|
30
42
|
// ============================================================================
|
|
31
43
|
|
|
32
44
|
/**
|
|
33
|
-
* User entity schema - represents the
|
|
45
|
+
* User entity schema - represents the auth.users table in PostgreSQL
|
|
34
46
|
*/
|
|
35
47
|
export const userSchema = z.object({
|
|
36
48
|
id: userIdSchema,
|
|
37
49
|
email: emailSchema,
|
|
38
|
-
name: nameSchema,
|
|
39
50
|
emailVerified: z.boolean(),
|
|
40
|
-
|
|
41
|
-
.array(
|
|
42
|
-
z.object({
|
|
43
|
-
provider: z.string(),
|
|
44
|
-
})
|
|
45
|
-
)
|
|
46
|
-
.optional(),
|
|
47
|
-
providerType: z.string().optional(),
|
|
51
|
+
providers: z.array(z.string()).optional(),
|
|
48
52
|
createdAt: z.string(), // PostgreSQL timestamp
|
|
49
53
|
updatedAt: z.string(), // PostgreSQL timestamp
|
|
54
|
+
profile: profileSchema.nullable(), // User profile data (name, avatar_url, bio, etc.)
|
|
55
|
+
metadata: z.record(z.unknown()).nullable(), // System metadata (device ID, login IP, etc.)
|
|
50
56
|
});
|
|
51
57
|
|
|
52
58
|
/**
|
|
@@ -123,6 +129,7 @@ export type EmailSchema = z.infer<typeof emailSchema>;
|
|
|
123
129
|
export type PasswordSchema = z.infer<typeof passwordSchema>;
|
|
124
130
|
export type RoleSchema = z.infer<typeof roleSchema>;
|
|
125
131
|
export type VerificationMethodSchema = z.infer<typeof verificationMethodSchema>;
|
|
132
|
+
export type ProfileSchema = z.infer<typeof profileSchema>;
|
|
126
133
|
export type UserSchema = z.infer<typeof userSchema>;
|
|
127
134
|
export type TokenPayloadSchema = z.infer<typeof tokenPayloadSchema>;
|
|
128
135
|
export type OAuthConfigSchema = z.infer<typeof oAuthConfigSchema>;
|
|
@@ -37,6 +37,24 @@ export const navigateToUsageSchema = z.object({
|
|
|
37
37
|
type: z.literal('NAVIGATE_TO_USAGE'),
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
export const showContactModalEventSchema = z.object({
|
|
41
|
+
type: z.literal('SHOW_CONTACT_MODAL'),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const showConnectOverlayEventSchema = z.object({
|
|
45
|
+
type: z.literal('SHOW_CONNECT_OVERLAY'),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const authorizationCodeEventSchema = z.object({
|
|
49
|
+
type: z.literal('AUTHORIZATION_CODE'),
|
|
50
|
+
code: z.string(),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const routeChangeEventSchema = z.object({
|
|
54
|
+
type: z.literal('ROUTE_CHANGE'),
|
|
55
|
+
path: z.string(),
|
|
56
|
+
});
|
|
57
|
+
|
|
40
58
|
export const cloudEventSchema = z.discriminatedUnion('type', [
|
|
41
59
|
appRouteChangeEventSchema,
|
|
42
60
|
authSuccessEventSchema,
|
|
@@ -46,6 +64,10 @@ export const cloudEventSchema = z.discriminatedUnion('type', [
|
|
|
46
64
|
showSettingsOverlayEventSchema,
|
|
47
65
|
onboardingSuccessSchema,
|
|
48
66
|
navigateToUsageSchema,
|
|
67
|
+
showContactModalEventSchema,
|
|
68
|
+
showConnectOverlayEventSchema,
|
|
69
|
+
authorizationCodeEventSchema,
|
|
70
|
+
routeChangeEventSchema,
|
|
49
71
|
]);
|
|
50
72
|
|
|
51
73
|
export type AppRouteChangeEvent = z.infer<typeof appRouteChangeEventSchema>;
|
|
@@ -55,3 +77,7 @@ export type McpConnectionStatusEvent = z.infer<typeof mcpConnectionStatusEventSc
|
|
|
55
77
|
export type CloudEvent = z.infer<typeof cloudEventSchema>;
|
|
56
78
|
export type ShowOnboardingOverlayEvent = z.infer<typeof showOnboardingOverlayEventSchema>;
|
|
57
79
|
export type ShowSettingsOverlayEvent = z.infer<typeof showSettingsOverlayEventSchema>;
|
|
80
|
+
export type ShowContactModalEvent = z.infer<typeof showContactModalEventSchema>;
|
|
81
|
+
export type ShowConnectOverlayEvent = z.infer<typeof showConnectOverlayEventSchema>;
|
|
82
|
+
export type AuthorizationCodeEvent = z.infer<typeof authorizationCodeEventSchema>;
|
|
83
|
+
export type RouteChangeEvent = z.infer<typeof routeChangeEventSchema>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { deploymentSchema } from './deployments.schema';
|
|
3
|
+
|
|
4
|
+
export const projectSettingsSchema = z.object({
|
|
5
|
+
buildCommand: z.string().nullable().optional(),
|
|
6
|
+
outputDirectory: z.string().nullable().optional(),
|
|
7
|
+
installCommand: z.string().nullable().optional(),
|
|
8
|
+
devCommand: z.string().nullable().optional(),
|
|
9
|
+
rootDirectory: z.string().nullable().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const envVarSchema = z.object({
|
|
13
|
+
key: z.string(),
|
|
14
|
+
value: z.string(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Response from creating a deployment - includes presigned upload info
|
|
19
|
+
*/
|
|
20
|
+
export const createDeploymentResponseSchema = z.object({
|
|
21
|
+
id: z.string().uuid(),
|
|
22
|
+
uploadUrl: z.string().url(),
|
|
23
|
+
uploadFields: z.record(z.string()), // Required for S3 presigned POST (policy, signature, key, etc.)
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Request to start a deployment (step 2)
|
|
28
|
+
* Triggers upload to Vercel and creates the actual deployment
|
|
29
|
+
*/
|
|
30
|
+
export const startDeploymentRequestSchema = z.object({
|
|
31
|
+
projectSettings: projectSettingsSchema.optional(),
|
|
32
|
+
envVars: z.array(envVarSchema).optional(),
|
|
33
|
+
meta: z.record(z.string()).optional(),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Response from starting a deployment
|
|
38
|
+
*/
|
|
39
|
+
export const startDeploymentResponseSchema = deploymentSchema;
|
|
40
|
+
|
|
41
|
+
export const listDeploymentsResponseSchema = z.object({
|
|
42
|
+
data: z.array(deploymentSchema),
|
|
43
|
+
pagination: z.object({
|
|
44
|
+
limit: z.number(),
|
|
45
|
+
offset: z.number(),
|
|
46
|
+
total: z.number(),
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export type ProjectSettings = z.infer<typeof projectSettingsSchema>;
|
|
51
|
+
export type EnvVar = z.infer<typeof envVarSchema>;
|
|
52
|
+
export type CreateDeploymentResponse = z.infer<typeof createDeploymentResponseSchema>;
|
|
53
|
+
export type StartDeploymentRequest = z.infer<typeof startDeploymentRequestSchema>;
|
|
54
|
+
export type StartDeploymentResponse = z.infer<typeof startDeploymentResponseSchema>;
|
|
55
|
+
export type ListDeploymentsResponse = z.infer<typeof listDeploymentsResponseSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deployment status enum schema
|
|
5
|
+
* WAITING -> UPLOADING -> (Vercel statuses: QUEUED/BUILDING/READY/ERROR/CANCELED)
|
|
6
|
+
*/
|
|
7
|
+
export const deploymentStatusSchema = z.enum([
|
|
8
|
+
'WAITING', // Record created, waiting for client to upload zip to S3
|
|
9
|
+
'UPLOADING', // Server is downloading from S3 and uploading to Vercel
|
|
10
|
+
'QUEUED', // Vercel: deployment queued
|
|
11
|
+
'BUILDING', // Vercel: deployment building
|
|
12
|
+
'READY', // Vercel: deployment ready
|
|
13
|
+
'ERROR', // Vercel: deployment failed
|
|
14
|
+
'CANCELED', // Vercel: deployment canceled
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export type DeploymentStatusType = z.infer<typeof deploymentStatusSchema>;
|
|
18
|
+
|
|
19
|
+
export const deploymentSchema = z.object({
|
|
20
|
+
id: z.string().uuid(),
|
|
21
|
+
providerDeploymentId: z.string().nullable(), // Provider's deployment ID, null until deployment starts
|
|
22
|
+
provider: z.string(),
|
|
23
|
+
status: deploymentStatusSchema,
|
|
24
|
+
url: z.string().nullable(),
|
|
25
|
+
metadata: z.record(z.unknown()).nullable(),
|
|
26
|
+
createdAt: z.string().datetime(),
|
|
27
|
+
updatedAt: z.string().datetime(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type DeploymentSchema = z.infer<typeof deploymentSchema>;
|
|
@@ -3,23 +3,29 @@ import { z } from 'zod';
|
|
|
3
3
|
export const docTypeSchema = z
|
|
4
4
|
.enum([
|
|
5
5
|
'instructions',
|
|
6
|
+
'auth-sdk',
|
|
6
7
|
'db-sdk',
|
|
7
8
|
'storage-sdk',
|
|
8
9
|
'functions-sdk',
|
|
9
10
|
'ai-integration-sdk',
|
|
10
11
|
'auth-components-react',
|
|
12
|
+
'auth-components-nextjs',
|
|
11
13
|
'real-time',
|
|
14
|
+
'deployment',
|
|
12
15
|
])
|
|
13
16
|
.describe(
|
|
14
17
|
`
|
|
15
|
-
Documentation type:
|
|
18
|
+
Documentation type:
|
|
16
19
|
"instructions" (essential backend setup - use FIRST),
|
|
17
20
|
"db-sdk" (database operations),
|
|
18
21
|
"storage-sdk" (file storage),
|
|
19
22
|
"functions-sdk" (edge functions),
|
|
23
|
+
"auth-sdk" (direct SDK methods for custom auth flows),
|
|
20
24
|
"auth-components-react" (authentication components for React+Vite applications),
|
|
25
|
+
"auth-components-nextjs" (authentication components for Next.js applications),
|
|
21
26
|
"ai-integration-sdk" (AI features),
|
|
22
|
-
"real-time" (real-time pub/sub through WebSockets)
|
|
27
|
+
"real-time" (real-time pub/sub through WebSockets),
|
|
28
|
+
"deployment" (deploy frontend applications via MCP tool)
|
|
23
29
|
`
|
|
24
30
|
);
|
|
25
31
|
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { emailSchema } from './auth.schema';
|
|
3
|
-
|
|
4
|
-
const emailOrEmails = z.union([
|
|
5
|
-
emailSchema,
|
|
6
|
-
z
|
|
7
|
-
.array(emailSchema)
|
|
8
|
-
.min(1, 'At least one email is required')
|
|
9
|
-
.max(50, 'Maximum 50 recipients allowed'),
|
|
10
|
-
]);
|
|
11
|
-
|
|
12
|
-
export const sendRawEmailRequestSchema = z.object({
|
|
13
|
-
to: emailOrEmails,
|
|
14
|
-
subject: z.string().trim().min(1, 'Subject is required').max(500, 'Subject too long'),
|
|
15
|
-
html: z.string().trim().min(1, 'HTML content is required'),
|
|
16
|
-
cc: emailOrEmails.optional(),
|
|
17
|
-
bcc: emailOrEmails.optional(),
|
|
18
|
-
from: z.string().trim().max(100, 'From name too long').optional(),
|
|
19
|
-
replyTo: z.string().email('Reply-To must be a valid email').optional(),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export type SendRawEmailRequest = z.infer<typeof sendRawEmailRequestSchema>;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Response for POST /api/email/send-raw
|
|
26
|
-
* Empty on success - extend with optional fields later if needed
|
|
27
|
-
*/
|
|
28
|
-
export const sendEmailResponseSchema = z.object({});
|
|
29
|
-
|
|
30
|
-
export type SendEmailResponse = z.infer<typeof sendEmailResponseSchema>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { emailSchema } from './auth.schema';
|
|
3
|
+
|
|
4
|
+
const emailOrEmails = z.union([
|
|
5
|
+
emailSchema,
|
|
6
|
+
z
|
|
7
|
+
.array(emailSchema)
|
|
8
|
+
.min(1, 'At least one email is required')
|
|
9
|
+
.max(50, 'Maximum 50 recipients allowed'),
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
export const sendRawEmailRequestSchema = z.object({
|
|
13
|
+
to: emailOrEmails,
|
|
14
|
+
subject: z.string().trim().min(1, 'Subject is required').max(500, 'Subject too long'),
|
|
15
|
+
html: z.string().trim().min(1, 'HTML content is required'),
|
|
16
|
+
cc: emailOrEmails.optional(),
|
|
17
|
+
bcc: emailOrEmails.optional(),
|
|
18
|
+
from: z.string().trim().max(100, 'From name too long').optional(),
|
|
19
|
+
replyTo: z.string().email('Reply-To must be a valid email').optional(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type SendRawEmailRequest = z.infer<typeof sendRawEmailRequestSchema>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Response for POST /api/email/send-raw
|
|
26
|
+
* Empty on success - extend with optional fields later if needed
|
|
27
|
+
*/
|
|
28
|
+
export const sendEmailResponseSchema = z.object({});
|
|
29
|
+
|
|
30
|
+
export type SendEmailResponse = z.infer<typeof sendEmailResponseSchema>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { functionSchema } from './functions.schema';
|
|
2
3
|
|
|
3
|
-
export const
|
|
4
|
+
export const uploadFunctionRequestSchema = z.object({
|
|
4
5
|
name: z.string().min(1, 'Name is required'),
|
|
5
6
|
slug: z
|
|
6
7
|
.string()
|
|
@@ -14,12 +15,20 @@ export const functionUploadRequestSchema = z.object({
|
|
|
14
15
|
status: z.enum(['draft', 'active']).optional().default('active'),
|
|
15
16
|
});
|
|
16
17
|
|
|
17
|
-
export const
|
|
18
|
+
export const updateFunctionRequestSchema = z.object({
|
|
18
19
|
name: z.string().optional(),
|
|
19
20
|
code: z.string().optional(),
|
|
20
21
|
description: z.string().optional(),
|
|
21
22
|
status: z.enum(['draft', 'active']).optional(),
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
export
|
|
25
|
-
|
|
25
|
+
export const listFunctionsResponseSchema = z.object({
|
|
26
|
+
functions: z.array(functionSchema),
|
|
27
|
+
runtime: z.object({
|
|
28
|
+
status: z.enum(['running', 'unavailable']),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type UploadFunctionRequest = z.infer<typeof uploadFunctionRequestSchema>;
|
|
33
|
+
export type UpdateFunctionRequest = z.infer<typeof updateFunctionRequestSchema>;
|
|
34
|
+
export type ListFunctionsResponse = z.infer<typeof listFunctionsResponseSchema>;
|
|
@@ -7,7 +7,7 @@ export const functionSchema = z.object({
|
|
|
7
7
|
name: z.string(),
|
|
8
8
|
description: z.string().nullable(),
|
|
9
9
|
code: z.string(),
|
|
10
|
-
status: z.enum(['draft', 'active']),
|
|
10
|
+
status: z.enum(['draft', 'active', 'error']),
|
|
11
11
|
createdAt: z.string(),
|
|
12
12
|
updatedAt: z.string(),
|
|
13
13
|
deployedAt: z.string().nullable(),
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
export * from './database.schema';
|
|
2
|
-
export * from './database-api.schema';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
1
|
+
export * from './database.schema';
|
|
2
|
+
export * from './database-api.schema';
|
|
3
|
+
export * from './secrets.schema';
|
|
4
|
+
export * from './secrets-api.schema';
|
|
5
|
+
export * from './storage.schema';
|
|
6
|
+
export * from './storage-api.schema';
|
|
7
|
+
export * from './auth.schema';
|
|
8
|
+
export * from './auth-api.schema';
|
|
9
|
+
export * from './metadata.schema';
|
|
10
|
+
export * from './ai.schema';
|
|
11
|
+
export * from './ai-api.schema';
|
|
12
|
+
export * from './logs.schema';
|
|
13
|
+
export * from './logs-api.schema';
|
|
14
|
+
export * from './functions.schema';
|
|
15
|
+
export * from './functions-api.schema';
|
|
16
|
+
export * from './cloud-events.schema';
|
|
17
|
+
export * from './realtime.schema';
|
|
18
|
+
export * from './realtime-api.schema';
|
|
19
|
+
export * from './docs.schema';
|
|
20
|
+
export * from './email-api.schema';
|
|
21
|
+
export * from './deployments.schema';
|
|
22
|
+
export * from './deployments-api.schema';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { storageBucketSchema } from './storage.schema';
|
|
3
|
-
import { oAuthConfigSchema } from './auth.schema';
|
|
4
3
|
import { realtimeChannelSchema } from './realtime.schema';
|
|
5
4
|
import { realtimePermissionsResponseSchema } from './realtime-api.schema';
|
|
5
|
+
import { getPublicAuthConfigResponseSchema } from './auth-api.schema';
|
|
6
6
|
|
|
7
|
-
export const authMetadataSchema =
|
|
8
|
-
oauths: z.array(oAuthConfigSchema),
|
|
9
|
-
});
|
|
7
|
+
export const authMetadataSchema = getPublicAuthConfigResponseSchema;
|
|
10
8
|
|
|
11
9
|
export const databaseMetadataSchema = z.object({
|
|
12
10
|
tables: z.array(
|
|
@@ -68,3 +66,31 @@ export type EdgeFunctionMetadataSchema = z.infer<typeof edgeFunctionMetadataSche
|
|
|
68
66
|
export type AIMetadataSchema = z.infer<typeof aiMetadataSchema>;
|
|
69
67
|
export type RealtimeMetadataSchema = z.infer<typeof realtimeMetadataSchema>;
|
|
70
68
|
export type AppMetadataSchema = z.infer<typeof appMetaDataSchema>;
|
|
69
|
+
|
|
70
|
+
// Database connection schemas
|
|
71
|
+
export const databaseConnectionParametersSchema = z.object({
|
|
72
|
+
host: z.string(),
|
|
73
|
+
port: z.number(),
|
|
74
|
+
database: z.string(),
|
|
75
|
+
user: z.string(),
|
|
76
|
+
password: z.string(),
|
|
77
|
+
sslmode: z.string(),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const databaseConnectionInfoSchema = z.object({
|
|
81
|
+
connectionURL: z.string(),
|
|
82
|
+
parameters: databaseConnectionParametersSchema,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const databasePasswordInfoSchema = z.object({
|
|
86
|
+
databasePassword: z.string(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const apiKeyResponseSchema = z.object({
|
|
90
|
+
apiKey: z.string(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export type DatabaseConnectionParameters = z.infer<typeof databaseConnectionParametersSchema>;
|
|
94
|
+
export type DatabaseConnectionInfo = z.infer<typeof databaseConnectionInfoSchema>;
|
|
95
|
+
export type DatabasePasswordInfo = z.infer<typeof databasePasswordInfoSchema>;
|
|
96
|
+
export type ApiKeyResponse = z.infer<typeof apiKeyResponseSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { secretSchema } from './secrets.schema';
|
|
3
|
+
|
|
4
|
+
// GET /secrets - List all secrets
|
|
5
|
+
export const listSecretsResponseSchema = z.object({
|
|
6
|
+
secrets: z.array(secretSchema),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// GET /secrets/:key - Get secret value
|
|
10
|
+
export const getSecretValueResponseSchema = z.object({
|
|
11
|
+
key: z.string(),
|
|
12
|
+
value: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// POST /secrets - Create secret (user-facing API)
|
|
16
|
+
export const createSecretRequestSchema = z.object({
|
|
17
|
+
key: z.string().regex(/^[A-Z0-9_]+$/, 'Use uppercase letters, numbers, and underscores only'),
|
|
18
|
+
value: z.string().min(1, 'Value is required'),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const createSecretResponseSchema = z.object({
|
|
22
|
+
success: z.literal(true),
|
|
23
|
+
message: z.string(),
|
|
24
|
+
id: z.string(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const updateSecretResponseSchema = z.object({
|
|
28
|
+
success: z.literal(true),
|
|
29
|
+
message: z.string(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// DELETE /secrets/:key - Delete secret
|
|
33
|
+
export const deleteSecretResponseSchema = z.object({
|
|
34
|
+
success: z.literal(true),
|
|
35
|
+
message: z.string(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Export types
|
|
39
|
+
export type ListSecretsResponse = z.infer<typeof listSecretsResponseSchema>;
|
|
40
|
+
export type GetSecretValueResponse = z.infer<typeof getSecretValueResponseSchema>;
|
|
41
|
+
export type CreateSecretRequest = z.infer<typeof createSecretRequestSchema>;
|
|
42
|
+
export type CreateSecretResponse = z.infer<typeof createSecretResponseSchema>;
|
|
43
|
+
export type UpdateSecretResponse = z.infer<typeof updateSecretResponseSchema>;
|
|
44
|
+
export type DeleteSecretResponse = z.infer<typeof deleteSecretResponseSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// Secret metadata (without value - for listing)
|
|
4
|
+
export const secretSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
key: z.string(),
|
|
7
|
+
isActive: z.boolean(),
|
|
8
|
+
isReserved: z.boolean(),
|
|
9
|
+
lastUsedAt: z.string().nullable(),
|
|
10
|
+
expiresAt: z.string().nullable(),
|
|
11
|
+
createdAt: z.string(),
|
|
12
|
+
updatedAt: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type SecretSchema = z.infer<typeof secretSchema>;
|
package/zeabur/README.md
CHANGED
|
@@ -2,12 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Internal template for one-click InsForge deployment on Zeabur.
|
|
4
4
|
|
|
5
|
+
## CLI Authentication
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx zeabur@latest auth login
|
|
9
|
+
npx zeabur@latest auth logout
|
|
10
|
+
```
|
|
11
|
+
|
|
5
12
|
## Deploy
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
15
|
npx zeabur@latest template deploy -f template.yml
|
|
9
16
|
```
|
|
10
17
|
|
|
18
|
+
## Update
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx zeabur@latest template update -c Q82M3Y -f template.yml
|
|
22
|
+
```
|
|
23
|
+
|
|
11
24
|
## Documentation
|
|
12
25
|
|
|
13
26
|
- Zeabur docs: https://zeabur.com/docs/en-US/template/template-in-code
|
package/zeabur/template.yml
CHANGED
|
@@ -175,30 +175,8 @@ spec:
|
|
|
175
175
|
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO project_admin;
|
|
176
176
|
|
|
177
177
|
-- Grant permissions to roles
|
|
178
|
-
|
|
179
|
-
GRANT SELECT
|
|
180
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
181
|
-
GRANT SELECT ON TABLES TO anon;
|
|
182
|
-
|
|
183
|
-
GRANT SELECT ON ALL TABLES IN SCHEMA public TO authenticated;
|
|
184
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
185
|
-
GRANT SELECT ON TABLES TO authenticated;
|
|
186
|
-
|
|
187
|
-
GRANT INSERT ON ALL TABLES IN SCHEMA public TO authenticated;
|
|
188
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
189
|
-
GRANT INSERT ON TABLES TO authenticated;
|
|
190
|
-
|
|
191
|
-
GRANT UPDATE ON ALL TABLES IN SCHEMA public TO authenticated;
|
|
192
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
193
|
-
GRANT UPDATE ON TABLES TO authenticated;
|
|
194
|
-
|
|
195
|
-
GRANT DELETE ON ALL TABLES IN SCHEMA public TO authenticated;
|
|
196
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
197
|
-
GRANT DELETE ON TABLES TO authenticated;
|
|
198
|
-
|
|
199
|
-
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO project_admin;
|
|
200
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
201
|
-
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO project_admin;
|
|
178
|
+
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO anon, authenticated, project_admin;
|
|
179
|
+
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO anon, authenticated, project_admin;
|
|
202
180
|
|
|
203
181
|
-- Create function to automatically create RLS policies for new tables
|
|
204
182
|
CREATE OR REPLACE FUNCTION public.create_default_policies()
|
|
@@ -224,12 +202,8 @@ spec:
|
|
|
224
202
|
AND tablename = table_name;
|
|
225
203
|
-- Only create policies if RLS is enabled
|
|
226
204
|
IF has_rls THEN
|
|
227
|
-
-- Create
|
|
228
|
-
-- anon
|
|
229
|
-
EXECUTE format('CREATE POLICY "anon_policy" ON %s FOR SELECT TO anon USING (true)', obj.object_identity);
|
|
230
|
-
-- authenticated: full access
|
|
231
|
-
EXECUTE format('CREATE POLICY "authenticated_policy" ON %s FOR ALL TO authenticated USING (true) WITH CHECK (true)', obj.object_identity);
|
|
232
|
-
-- project_admin: full access
|
|
205
|
+
-- Create policy for project_admin role only
|
|
206
|
+
-- Users must define their own policies for anon and authenticated roles
|
|
233
207
|
EXECUTE format('CREATE POLICY "project_admin_policy" ON %s FOR ALL TO project_admin USING (true) WITH CHECK (true)', obj.object_identity);
|
|
234
208
|
END IF;
|
|
235
209
|
END LOOP;
|
|
@@ -268,9 +242,8 @@ spec:
|
|
|
268
242
|
WHERE schemaname = table_schema
|
|
269
243
|
AND tablename = table_name
|
|
270
244
|
) THEN
|
|
271
|
-
-- Create
|
|
272
|
-
|
|
273
|
-
EXECUTE format('CREATE POLICY "authenticated_policy" ON %s FOR ALL TO authenticated USING (true) WITH CHECK (true)', obj.object_identity);
|
|
245
|
+
-- Create policy for project_admin role only
|
|
246
|
+
-- Users must define their own policies for anon and authenticated roles
|
|
274
247
|
EXECUTE format('CREATE POLICY "project_admin_policy" ON %s FOR ALL TO project_admin USING (true) WITH CHECK (true)', obj.object_identity);
|
|
275
248
|
END IF;
|
|
276
249
|
END LOOP;
|
|
@@ -382,7 +355,7 @@ spec:
|
|
|
382
355
|
POSTGREST_BASE_URL:
|
|
383
356
|
default: http://postgrest:3000
|
|
384
357
|
WORKER_TIMEOUT_MS:
|
|
385
|
-
default: "
|
|
358
|
+
default: "60000"
|
|
386
359
|
ENCRYPTION_KEY:
|
|
387
360
|
default: ${PASSWORD}
|
|
388
361
|
JWT_SECRET:
|
|
@@ -399,7 +372,7 @@ spec:
|
|
|
399
372
|
console.log(`Deno serverless runtime running on port ${port}`);
|
|
400
373
|
|
|
401
374
|
// Configuration
|
|
402
|
-
const WORKER_TIMEOUT_MS = parseInt(Deno.env.get('WORKER_TIMEOUT_MS') ?? '
|
|
375
|
+
const WORKER_TIMEOUT_MS = parseInt(Deno.env.get('WORKER_TIMEOUT_MS') ?? '60000');
|
|
403
376
|
|
|
404
377
|
// Worker template code - loaded on first use
|
|
405
378
|
let workerTemplateCode: string | null = null;
|
|
@@ -423,18 +396,14 @@ spec:
|
|
|
423
396
|
// Get the encryption key by hashing the JWT secret
|
|
424
397
|
const keyData = new TextEncoder().encode(key);
|
|
425
398
|
const hashBuffer = await crypto.subtle.digest('SHA-256', keyData);
|
|
426
|
-
const cryptoKey = await crypto.subtle.importKey(
|
|
427
|
-
'
|
|
428
|
-
|
|
429
|
-
{ name: 'AES-GCM' },
|
|
430
|
-
false,
|
|
431
|
-
['decrypt']
|
|
432
|
-
);
|
|
399
|
+
const cryptoKey = await crypto.subtle.importKey('raw', hashBuffer, { name: 'AES-GCM' }, false, [
|
|
400
|
+
'decrypt',
|
|
401
|
+
]);
|
|
433
402
|
|
|
434
403
|
// Extract IV, auth tag, and encrypted data
|
|
435
|
-
const iv = Uint8Array.from(parts[0].match(/.{2}/g)!.map(byte => parseInt(byte, 16)));
|
|
436
|
-
const authTag = Uint8Array.from(parts[1].match(/.{2}/g)!.map(byte => parseInt(byte, 16)));
|
|
437
|
-
const encrypted = Uint8Array.from(parts[2].match(/.{2}/g)!.map(byte => parseInt(byte, 16)));
|
|
404
|
+
const iv = Uint8Array.from(parts[0].match(/.{2}/g)!.map((byte) => parseInt(byte, 16)));
|
|
405
|
+
const authTag = Uint8Array.from(parts[1].match(/.{2}/g)!.map((byte) => parseInt(byte, 16)));
|
|
406
|
+
const encrypted = Uint8Array.from(parts[2].match(/.{2}/g)!.map((byte) => parseInt(byte, 16)));
|
|
438
407
|
|
|
439
408
|
// Combine encrypted data and auth tag (GCM expects them together)
|
|
440
409
|
const cipherData = new Uint8Array(encrypted.length + authTag.length);
|
|
@@ -472,7 +441,7 @@ spec:
|
|
|
472
441
|
await client.connect();
|
|
473
442
|
|
|
474
443
|
const result = await client.queryObject<{ code: string }>`
|
|
475
|
-
SELECT code FROM
|
|
444
|
+
SELECT code FROM functions.definitions
|
|
476
445
|
WHERE slug = ${slug} AND status = 'active'
|
|
477
446
|
`;
|
|
478
447
|
|
|
@@ -503,13 +472,13 @@ spec:
|
|
|
503
472
|
return {};
|
|
504
473
|
}
|
|
505
474
|
|
|
506
|
-
// Fetch all active secrets from
|
|
475
|
+
// Fetch all active secrets from system.secrets table
|
|
507
476
|
const result = await client.queryObject<{
|
|
508
477
|
key: string;
|
|
509
478
|
value_ciphertext: string;
|
|
510
479
|
}>`
|
|
511
480
|
SELECT key, value_ciphertext
|
|
512
|
-
FROM
|
|
481
|
+
FROM system.secrets
|
|
513
482
|
WHERE is_active = true
|
|
514
483
|
AND (expires_at IS NULL OR expires_at > NOW())
|
|
515
484
|
`;
|
|
@@ -766,7 +735,7 @@ spec:
|
|
|
766
735
|
* - We need to provide Deno.env functionality so functions can access secrets
|
|
767
736
|
*
|
|
768
737
|
* How it works:
|
|
769
|
-
* 1. The main server (server.ts) fetches all active secrets from the
|
|
738
|
+
* 1. The main server (server.ts) fetches all active secrets from the system.secrets table
|
|
770
739
|
* 2. Only active (is_active=true) and non-expired secrets are included
|
|
771
740
|
* 3. Secrets are decrypted and passed to this worker via the 'secrets' object
|
|
772
741
|
* 4. We create a mock Deno object that provides Deno.env.get()
|
|
@@ -890,7 +859,7 @@ spec:
|
|
|
890
859
|
template: PREBUILT
|
|
891
860
|
spec:
|
|
892
861
|
source:
|
|
893
|
-
image: ghcr.io/insforge/insforge-oss:v1.
|
|
862
|
+
image: ghcr.io/insforge/insforge-oss:v1.4.3
|
|
894
863
|
ports:
|
|
895
864
|
- id: web
|
|
896
865
|
port: 7130
|
|
@@ -959,7 +928,7 @@ spec:
|
|
|
959
928
|
type: HTTP
|
|
960
929
|
port: web
|
|
961
930
|
http:
|
|
962
|
-
path: /
|
|
931
|
+
path: /api/health
|
|
963
932
|
domainKey: PUBLIC_DOMAIN
|
|
964
933
|
|
|
965
934
|
localization:
|