launchbase 1.2.2 → 1.2.3
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/bin/launchbase.js +1 -1
- package/package.json +1 -1
- package/template/prisma/schema.prisma +6 -1
- package/template/src/modules/auth/auth.service.ts +2 -2
- package/template/src/modules/billing/billing.service.ts +1 -1
- package/template/src/modules/deployments/dto/create-deployment.dto.ts +1 -1
- package/template/src/modules/edge-functions/edge-functions.service.ts +6 -5
package/bin/launchbase.js
CHANGED
|
@@ -7,7 +7,7 @@ const crypto = require('crypto');
|
|
|
7
7
|
const fs = require('fs-extra');
|
|
8
8
|
const { execSync, spawn } = require('child_process');
|
|
9
9
|
|
|
10
|
-
const VERSION = '1.2.
|
|
10
|
+
const VERSION = '1.2.3';
|
|
11
11
|
const program = new Command();
|
|
12
12
|
|
|
13
13
|
function findAvailablePort(startPort = 5432, maxAttempts = 100) {
|
package/package.json
CHANGED
|
@@ -111,6 +111,7 @@ model EdgeFunction {
|
|
|
111
111
|
projectId String
|
|
112
112
|
name String
|
|
113
113
|
slug String
|
|
114
|
+
description String?
|
|
114
115
|
runtime String @default("nodejs18")
|
|
115
116
|
sourceCode String
|
|
116
117
|
environment Json?
|
|
@@ -118,6 +119,7 @@ model EdgeFunction {
|
|
|
118
119
|
status String @default("draft")
|
|
119
120
|
deployedAt DateTime?
|
|
120
121
|
deploymentUrl String?
|
|
122
|
+
deploymentId String?
|
|
121
123
|
createdAt DateTime @default(now())
|
|
122
124
|
updatedAt DateTime @updatedAt
|
|
123
125
|
logs EdgeFunctionLog[]
|
|
@@ -152,6 +154,7 @@ model VectorCollection {
|
|
|
152
154
|
id String @id @default(cuid())
|
|
153
155
|
projectId String
|
|
154
156
|
name String
|
|
157
|
+
description String?
|
|
155
158
|
provider String @default("local")
|
|
156
159
|
dimension Int @default(1536)
|
|
157
160
|
embeddingModel String @default("text-embedding-3-small")
|
|
@@ -169,7 +172,9 @@ model Deployment {
|
|
|
169
172
|
id String @id @default(cuid())
|
|
170
173
|
projectId String
|
|
171
174
|
status String @default("pending")
|
|
172
|
-
version String
|
|
175
|
+
version String
|
|
176
|
+
description String?
|
|
177
|
+
error String?
|
|
173
178
|
deployedAt DateTime?
|
|
174
179
|
platform String?
|
|
175
180
|
url String?
|
|
@@ -117,7 +117,7 @@ export class AuthService {
|
|
|
117
117
|
const user = await this.prisma.user.findUnique({
|
|
118
118
|
where: { email: dto.email },
|
|
119
119
|
include: {
|
|
120
|
-
|
|
120
|
+
memberships: {
|
|
121
121
|
include: {
|
|
122
122
|
organization: {
|
|
123
123
|
include: { projects: { take: 1 } }
|
|
@@ -134,7 +134,7 @@ export class AuthService {
|
|
|
134
134
|
const tokens = await this.issueTokens({ id: user.id, email: user.email });
|
|
135
135
|
|
|
136
136
|
// Get first org and project for the user
|
|
137
|
-
const firstMembership = user.
|
|
137
|
+
const firstMembership = user.memberships[0];
|
|
138
138
|
const firstOrg = firstMembership?.organization;
|
|
139
139
|
const firstProject = firstOrg?.projects[0];
|
|
140
140
|
|
|
@@ -191,7 +191,7 @@ export class BillingService {
|
|
|
191
191
|
if (type === 'members' && limits.members === -1) return true;
|
|
192
192
|
|
|
193
193
|
if (type === 'projects') {
|
|
194
|
-
const count = await this.prisma.project.count({ where: { orgId } });
|
|
194
|
+
const count = await this.prisma.project.count({ where: { organizationId: orgId } });
|
|
195
195
|
return count < limits.projects;
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -12,18 +12,19 @@ export class EdgeFunctionsService {
|
|
|
12
12
|
// Validate the function code
|
|
13
13
|
this.validateCode(dto.code);
|
|
14
14
|
|
|
15
|
+
// Generate slug from name
|
|
16
|
+
const slug = dto.name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
17
|
+
|
|
15
18
|
const func = await this.prisma.edgeFunction.create({
|
|
16
19
|
data: {
|
|
17
20
|
name: dto.name,
|
|
21
|
+
slug,
|
|
18
22
|
description: dto.description,
|
|
19
|
-
|
|
23
|
+
sourceCode: dto.code,
|
|
20
24
|
runtime: dto.runtime || 'nodejs18',
|
|
21
|
-
timeout: dto.timeout || 30000,
|
|
22
|
-
memory: dto.memory || 128,
|
|
23
25
|
environment: dto.environment || {},
|
|
24
26
|
triggers: dto.triggers || [],
|
|
25
27
|
projectId,
|
|
26
|
-
createdBy: userId,
|
|
27
28
|
},
|
|
28
29
|
});
|
|
29
30
|
|
|
@@ -90,7 +91,7 @@ export class EdgeFunctionsService {
|
|
|
90
91
|
|
|
91
92
|
try {
|
|
92
93
|
// Execute in sandboxed VM
|
|
93
|
-
result = await this.runInSandbox(func.
|
|
94
|
+
result = await this.runInSandbox(func.sourceCode, {
|
|
94
95
|
...dto.payload,
|
|
95
96
|
user: { id: user.id, email: user.email },
|
|
96
97
|
projectId,
|