@powerhousedao/vetra-builder-package 0.0.21 → 0.0.22
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/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.js +12 -12
- package/dist/processors/vetra-builder-relational-db-processor/database-helpers.d.ts +5 -4
- package/dist/processors/vetra-builder-relational-db-processor/migrations.d.ts +3 -2
- package/dist/subgraphs/vetra-builders/resolvers.js +2 -1
- package/package.json +1 -1
|
@@ -123,7 +123,7 @@ export class BuilderTeamHandlers {
|
|
|
123
123
|
async handleAddSpace(documentId, action, state) {
|
|
124
124
|
await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
|
|
125
125
|
// Find the space in state to get its sortOrder
|
|
126
|
-
const space = state.spaces.find(s => s.id === action.input.id);
|
|
126
|
+
const space = state.spaces.find((s) => s.id === action.input.id);
|
|
127
127
|
const sortOrder = space?.sortOrder ?? 0;
|
|
128
128
|
await this.db
|
|
129
129
|
.insertInto("builder_team_spaces")
|
|
@@ -149,10 +149,10 @@ export class BuilderTeamHandlers {
|
|
|
149
149
|
async handleUpdateSpaceInfo(documentId, action, state) {
|
|
150
150
|
const updates = {};
|
|
151
151
|
// Only include fields that are provided
|
|
152
|
-
if (action.input.title !== undefined) {
|
|
152
|
+
if (action.input.title !== undefined && action.input.title !== null) {
|
|
153
153
|
updates.title = action.input.title;
|
|
154
154
|
}
|
|
155
|
-
if (action.input.description !== undefined) {
|
|
155
|
+
if (action.input.description !== undefined && action.input.description !== null) {
|
|
156
156
|
updates.description = action.input.description;
|
|
157
157
|
}
|
|
158
158
|
// Only update if there are actual changes
|
|
@@ -173,7 +173,7 @@ export class BuilderTeamHandlers {
|
|
|
173
173
|
// Find the package in state to get its sortOrder
|
|
174
174
|
let sortOrder = 0;
|
|
175
175
|
for (const space of state.spaces) {
|
|
176
|
-
const pkg = space.packages.find(p => p.id === action.input.id);
|
|
176
|
+
const pkg = space.packages.find((p) => p.id === action.input.id);
|
|
177
177
|
if (pkg) {
|
|
178
178
|
sortOrder = pkg.sortOrder ?? 0;
|
|
179
179
|
break;
|
|
@@ -219,29 +219,29 @@ export class BuilderTeamHandlers {
|
|
|
219
219
|
// Find the package in the state to get additional information
|
|
220
220
|
let packageFromState = null;
|
|
221
221
|
for (const space of state.spaces) {
|
|
222
|
-
const pkg = space.packages.find(p => p.id === action.input.id);
|
|
222
|
+
const pkg = space.packages.find((p) => p.id === action.input.id);
|
|
223
223
|
if (pkg) {
|
|
224
224
|
packageFromState = pkg;
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
// Map input fields to database columns, only include provided fields
|
|
229
|
-
if (action.input.title !== undefined) {
|
|
229
|
+
if (action.input.title !== undefined && action.input.title !== null) {
|
|
230
230
|
updates.title = action.input.title;
|
|
231
231
|
}
|
|
232
|
-
if (action.input.description !== undefined) {
|
|
232
|
+
if (action.input.description !== undefined && action.input.description !== null) {
|
|
233
233
|
updates.description = action.input.description;
|
|
234
234
|
}
|
|
235
|
-
if (action.input.github !== undefined) {
|
|
235
|
+
if (action.input.github !== undefined && action.input.github !== null) {
|
|
236
236
|
updates.github_url = action.input.github;
|
|
237
237
|
}
|
|
238
|
-
if (action.input.npm !== undefined) {
|
|
238
|
+
if (action.input.npm !== undefined && action.input.npm !== null) {
|
|
239
239
|
updates.npm_url = action.input.npm;
|
|
240
240
|
}
|
|
241
|
-
if (action.input.vetraDriveUrl !== undefined) {
|
|
241
|
+
if (action.input.vetraDriveUrl !== undefined && action.input.vetraDriveUrl !== null) {
|
|
242
242
|
updates.vetra_drive_url = action.input.vetraDriveUrl;
|
|
243
243
|
}
|
|
244
|
-
if (action.input.spaceId !== undefined) {
|
|
244
|
+
if (action.input.spaceId !== undefined && action.input.spaceId !== null) {
|
|
245
245
|
updates.space_id = action.input.spaceId;
|
|
246
246
|
}
|
|
247
247
|
// If we found the package in state and phid is available, store it
|
|
@@ -261,7 +261,7 @@ export class BuilderTeamHandlers {
|
|
|
261
261
|
async handleReorderPackages(documentId, action, state) {
|
|
262
262
|
const { spaceId } = action.input;
|
|
263
263
|
// Find the space in state
|
|
264
|
-
const space = state.spaces.find(s => s.id === spaceId);
|
|
264
|
+
const space = state.spaces.find((s) => s.id === spaceId);
|
|
265
265
|
if (!space)
|
|
266
266
|
return;
|
|
267
267
|
// Update sortOrder for all packages in the space based on the state
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IRelationalDb } from "document-drive";
|
|
2
2
|
import type { DB } from "./schema.js";
|
|
3
|
+
import type { Updateable } from "kysely";
|
|
3
4
|
export declare class DatabaseHelpers {
|
|
4
5
|
private db;
|
|
5
6
|
constructor(db: IRelationalDb<DB>);
|
|
@@ -19,19 +20,19 @@ export declare class DatabaseHelpers {
|
|
|
19
20
|
/**
|
|
20
21
|
* Updates a package with the provided data
|
|
21
22
|
*/
|
|
22
|
-
updatePackage(documentId: string, updates:
|
|
23
|
+
updatePackage(documentId: string, updates: Partial<Updateable<DB["builder_team_packages"]>>): Promise<void>;
|
|
23
24
|
/**
|
|
24
25
|
* Updates a builder account with the provided data
|
|
25
26
|
*/
|
|
26
|
-
updateBuilderAccount(documentId: string, updates:
|
|
27
|
+
updateBuilderAccount(documentId: string, updates: Partial<Updateable<DB["builder_teams"]>>): Promise<void>;
|
|
27
28
|
/**
|
|
28
29
|
* Updates a builder space with the provided data
|
|
29
30
|
*/
|
|
30
|
-
updateBuilderSpace(spaceId: string, documentId: string, updates:
|
|
31
|
+
updateBuilderSpace(spaceId: string, documentId: string, updates: Partial<Updateable<DB["builder_team_spaces"]>>): Promise<void>;
|
|
31
32
|
/**
|
|
32
33
|
* Updates a builder package with the provided data
|
|
33
34
|
*/
|
|
34
|
-
updateBuilderPackage(packageId: string, updates:
|
|
35
|
+
updateBuilderPackage(packageId: string, updates: Partial<Updateable<DB["builder_team_packages"]>>): Promise<void>;
|
|
35
36
|
/**
|
|
36
37
|
* Checks if a member already exists for a builder account
|
|
37
38
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type IRelationalDb } from "document-drive/processors/types";
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import type { DB } from "./schema.js";
|
|
3
|
+
export declare function up(db: IRelationalDb<DB>): Promise<void>;
|
|
4
|
+
export declare function down(db: IRelationalDb<DB>): Promise<void>;
|
|
@@ -101,8 +101,9 @@ export const getResolvers = (subgraph) => {
|
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
Query: {
|
|
104
|
-
fetchAllBuilderTeams: async (parent, args) => {
|
|
104
|
+
fetchAllBuilderTeams: async (parent, args, context) => {
|
|
105
105
|
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
106
|
+
context.driveId = driveId;
|
|
106
107
|
const search = args.search;
|
|
107
108
|
const sortOrder = args.sortOrder || "asc";
|
|
108
109
|
let accounts = VetraBuilderRelationalDbProcessor.query(driveId, db)
|