@powerhousedao/vetra-builder-package 0.0.15 → 0.0.17

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 (34) hide show
  1. package/dist/document-models/index.d.ts +0 -1
  2. package/dist/document-models/index.js +0 -1
  3. package/dist/editors/index.d.ts +0 -1
  4. package/dist/editors/index.js +0 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/processors/factory.js +6 -4
  7. package/dist/processors/index.d.ts +2 -4
  8. package/dist/processors/index.js +2 -4
  9. package/dist/processors/vetra-builder-read-model/builder-account-handlers.d.ts +27 -0
  10. package/dist/processors/vetra-builder-read-model/builder-account-handlers.js +249 -0
  11. package/dist/processors/vetra-builder-read-model/database-helpers.d.ts +39 -0
  12. package/dist/processors/vetra-builder-read-model/database-helpers.js +144 -0
  13. package/dist/processors/vetra-builder-read-model/factory.d.ts +3 -0
  14. package/dist/processors/vetra-builder-read-model/factory.js +25 -0
  15. package/dist/processors/vetra-builder-read-model/index.d.ts +29 -0
  16. package/dist/processors/vetra-builder-read-model/index.js +370 -0
  17. package/dist/processors/vetra-builder-read-model/migrations.d.ts +3 -0
  18. package/dist/processors/vetra-builder-read-model/migrations.js +152 -0
  19. package/dist/processors/vetra-builder-read-model/package-handlers.d.ts +20 -0
  20. package/dist/processors/vetra-builder-read-model/package-handlers.js +116 -0
  21. package/dist/processors/vetra-builder-read-model/schema.d.ts +66 -0
  22. package/dist/processors/vetra-builder-read-model/schema.js +1 -0
  23. package/dist/processors/vetra-builder-read-model/types.d.ts +32 -0
  24. package/dist/processors/vetra-builder-read-model/types.js +1 -0
  25. package/dist/style.css +3 -180
  26. package/dist/subgraphs/index.d.ts +1 -2
  27. package/dist/subgraphs/index.js +1 -3
  28. package/dist/subgraphs/vetra-builder-read-model/index.d.ts +10 -0
  29. package/dist/subgraphs/vetra-builder-read-model/index.js +11 -0
  30. package/dist/subgraphs/vetra-builder-read-model/resolvers.d.ts +2 -0
  31. package/dist/subgraphs/vetra-builder-read-model/resolvers.js +174 -0
  32. package/dist/subgraphs/vetra-builder-read-model/schema.d.ts +2 -0
  33. package/dist/subgraphs/vetra-builder-read-model/schema.js +79 -0
  34. package/package.json +1 -1
@@ -1,3 +1,2 @@
1
1
  export {};
2
2
  export { module as BuilderAccount } from "./builder-account/index.js";
3
- export { module as RenownProfile } from "./renown-profile/index.js";
@@ -1,2 +1 @@
1
1
  export { module as BuilderAccount } from "./builder-account/index.js";
2
- export { module as RenownProfile } from "./renown-profile/index.js";
@@ -1,3 +1,2 @@
1
1
  export {};
2
2
  export { module as BuilderAccountEditor } from "./builder-account-editor/index.js";
3
- export { module as RenownProfileEditor } from "./renown-profile-editor/index.js";
@@ -1,2 +1 @@
1
1
  export { module as BuilderAccountEditor } from "./builder-account-editor/index.js";
2
- export { module as RenownProfileEditor } from "./renown-profile-editor/index.js";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { Manifest } from "document-model";
2
2
  export declare const manifest: Manifest;
3
- export declare const documentModels: (import("document-model").DocumentModelModule<import("./document-models/builder-account/gen").BuilderAccountPHState> | import("document-model").DocumentModelModule<import("./document-models/renown-profile/gen").RenownProfilePHState>)[];
3
+ export declare const documentModels: import("document-model").DocumentModelModule<import("./document-models/builder-account/gen").BuilderAccountPHState>[];
4
4
  export declare const editors: import("document-model").EditorModule[];
@@ -1,11 +1,13 @@
1
- import { renownProfileProcessorFactory } from "./renown-profile/factory.js";
2
- import { vetraReadModelProcessorFactory } from "./vetra-read-model/factory.js";
1
+ /**
2
+ * This file aggregates all processor factories
3
+ * Auto-generated by codegen - DO NOT EDIT MANUALLY
4
+ */
5
+ import { vetraBuilderReadModelProcessorFactory } from "./vetra-builder-read-model/factory.js";
3
6
  export const processorFactory = (module) => {
4
7
  // Initialize all processor factories once with the module
5
8
  const factories = [];
6
9
  // Add other processors here as they are generated
7
- factories.push(vetraReadModelProcessorFactory(module));
8
- factories.push(renownProfileProcessorFactory(module));
10
+ factories.push(vetraBuilderReadModelProcessorFactory(module));
9
11
  // Return the inner function that will be called for each drive
10
12
  return async (driveHeader) => {
11
13
  const processors = [];
@@ -1,5 +1,3 @@
1
- export { VetraReadModelProcessor } from "./vetra-read-model/index.js";
2
- export { vetraReadModelProcessorFactory } from "./vetra-read-model/factory.js";
1
+ export { VetraBuilderReadModelProcessor } from "./vetra-builder-read-model/index.js";
2
+ export { vetraBuilderReadModelProcessorFactory } from "./vetra-builder-read-model/factory.js";
3
3
  export { processorFactory } from "./factory.js";
4
- export * as RenownProfileProcessor from "./renown-profile/index.js";
5
- export { renownProfileProcessorFactory } from "./renown-profile/factory.js";
@@ -1,5 +1,3 @@
1
- export { VetraReadModelProcessor } from "./vetra-read-model/index.js";
2
- export { vetraReadModelProcessorFactory } from "./vetra-read-model/factory.js";
1
+ export { VetraBuilderReadModelProcessor } from "./vetra-builder-read-model/index.js";
2
+ export { vetraBuilderReadModelProcessorFactory } from "./vetra-builder-read-model/factory.js";
3
3
  export { processorFactory } from "./factory.js";
4
- export * as RenownProfileProcessor from "./renown-profile/index.js";
5
- export { renownProfileProcessorFactory } from "./renown-profile/factory.js";
@@ -0,0 +1,27 @@
1
+ import type { BuilderAccountAction } from "../../document-models/builder-account/gen/actions.js";
2
+ import type { BuilderAccountState } from "document-models/builder-account/index.js";
3
+ import type { DB } from "./schema.js";
4
+ import type { IRelationalDb } from "document-drive";
5
+ export declare class BuilderAccountHandlers {
6
+ private db;
7
+ private dbHelpers;
8
+ constructor(db: IRelationalDb<DB>);
9
+ handleBuilderAccountOperation(documentId: string, action: BuilderAccountAction, state: BuilderAccountState, driveId?: string): Promise<void>;
10
+ private handleSetLogo;
11
+ private handleSetProfileName;
12
+ private handleSetSlug;
13
+ private handleSetProfileDescription;
14
+ private handleUpdateSocials;
15
+ private handleAddMember;
16
+ private handleRemoveMember;
17
+ private handleAddSpace;
18
+ private handleDeleteSpace;
19
+ private handleSetSpaceTitle;
20
+ private handleSetSpaceDescription;
21
+ private handleReorderSpaces;
22
+ private handleAddPackage;
23
+ private handleSetPackageDriveId;
24
+ private handleUpdatePackage;
25
+ private handleReorderPackages;
26
+ private handleDeletePackage;
27
+ }
@@ -0,0 +1,249 @@
1
+ import { toPascalCase } from "document-drive/utils/misc";
2
+ import { DatabaseHelpers } from "./database-helpers.js";
3
+ export class BuilderAccountHandlers {
4
+ db;
5
+ dbHelpers;
6
+ constructor(db) {
7
+ this.db = db;
8
+ this.dbHelpers = new DatabaseHelpers(db);
9
+ }
10
+ async handleBuilderAccountOperation(documentId, action, state, driveId) {
11
+ switch (action.type) {
12
+ // Profile operations
13
+ case "SET_LOGO":
14
+ await this.handleSetLogo(documentId, action, state);
15
+ break;
16
+ case "SET_PROFILE_NAME":
17
+ await this.handleSetProfileName(documentId, action, state);
18
+ break;
19
+ case "SET_SLUG":
20
+ await this.handleSetSlug(documentId, action, state);
21
+ break;
22
+ case "SET_PROFILE_DESCRIPTION":
23
+ await this.handleSetProfileDescription(documentId, action, state);
24
+ break;
25
+ case "UPDATE_SOCIALS":
26
+ await this.handleUpdateSocials(documentId, action, state);
27
+ break;
28
+ // Members operations
29
+ case "ADD_MEMBER":
30
+ await this.handleAddMember(documentId, action, state);
31
+ break;
32
+ case "REMOVE_MEMBER":
33
+ await this.handleRemoveMember(documentId, action, state);
34
+ break;
35
+ // Spaces operations
36
+ case "ADD_SPACE":
37
+ await this.handleAddSpace(documentId, action, state);
38
+ break;
39
+ case "DELETE_SPACE":
40
+ await this.handleDeleteSpace(documentId, action, state);
41
+ break;
42
+ case "SET_SPACE_TITLE":
43
+ await this.handleSetSpaceTitle(documentId, action, state);
44
+ break;
45
+ case "SET_SPACE_DESCRIPTION":
46
+ await this.handleSetSpaceDescription(documentId, action, state);
47
+ break;
48
+ case "REORDER_SPACES":
49
+ await this.handleReorderSpaces(documentId, action, state);
50
+ break;
51
+ // Packages operations
52
+ case "ADD_PACKAGE":
53
+ await this.handleAddPackage(documentId, action, state);
54
+ break;
55
+ case "SET_PACKAGE_DRIVE_ID":
56
+ await this.handleSetPackageDriveId(documentId, action, state);
57
+ break;
58
+ case "UPDATE_PACKAGE":
59
+ await this.handleUpdatePackage(documentId, action, state);
60
+ break;
61
+ case "REORDER_PACKAGES":
62
+ await this.handleReorderPackages(documentId, action, state);
63
+ break;
64
+ case "DELETE_PACKAGE":
65
+ await this.handleDeletePackage(documentId, action, state);
66
+ break;
67
+ }
68
+ }
69
+ // Profile operations
70
+ async handleSetLogo(documentId, action, state) {
71
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
72
+ await this.dbHelpers.updateBuilderAccount(documentId, {
73
+ profile_logo: action.input.logoUrl,
74
+ });
75
+ }
76
+ async handleSetProfileName(documentId, action, state) {
77
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
78
+ await this.dbHelpers.updateBuilderAccount(documentId, {
79
+ profile_name: action.input.name,
80
+ });
81
+ }
82
+ async handleSetSlug(documentId, action, state) {
83
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
84
+ await this.dbHelpers.updateBuilderAccount(documentId, {
85
+ profile_slug: action.input.slug,
86
+ });
87
+ }
88
+ async handleSetProfileDescription(documentId, action, state) {
89
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
90
+ await this.dbHelpers.updateBuilderAccount(documentId, {
91
+ profile_description: action.input.description,
92
+ });
93
+ }
94
+ async handleUpdateSocials(documentId, action, state) {
95
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
96
+ await this.dbHelpers.updateBuilderAccount(documentId, {
97
+ profile_socials_x: action.input.x,
98
+ profile_socials_github: action.input.github,
99
+ profile_socials_website: action.input.website,
100
+ });
101
+ }
102
+ // Members operations
103
+ async handleAddMember(documentId, action, state) {
104
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
105
+ if (!action.input.ethAddress)
106
+ return;
107
+ const memberExists = await this.dbHelpers.memberExists(documentId, action.input.ethAddress);
108
+ if (!memberExists) {
109
+ await this.db
110
+ .insertInto("builder_account_members")
111
+ .values({
112
+ id: action.input.ethAddress,
113
+ builder_account_id: documentId,
114
+ eth_address: action.input.ethAddress,
115
+ created_at: new Date(),
116
+ })
117
+ .execute();
118
+ }
119
+ }
120
+ async handleRemoveMember(documentId, action, state) {
121
+ if (!action.input.ethAddress)
122
+ return;
123
+ await this.db
124
+ .deleteFrom("builder_account_members")
125
+ .where("builder_account_id", "=", documentId)
126
+ .where("eth_address", "=", action.input.ethAddress)
127
+ .execute();
128
+ }
129
+ // Spaces operations
130
+ async handleAddSpace(documentId, action, state) {
131
+ await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
132
+ const spaceId = toPascalCase(action.input.title);
133
+ await this.db
134
+ .insertInto("builder_spaces")
135
+ .values({
136
+ id: spaceId,
137
+ builder_account_id: documentId,
138
+ title: action.input.title,
139
+ description: action.input.description || null,
140
+ sort_order: 0,
141
+ created_at: new Date(),
142
+ updated_at: new Date(),
143
+ })
144
+ .onConflict((oc) => oc.column("id").doNothing())
145
+ .execute();
146
+ }
147
+ async handleDeleteSpace(documentId, action, state) {
148
+ await this.db
149
+ .deleteFrom("builder_spaces")
150
+ .where("id", "=", action.input.id)
151
+ .where("builder_account_id", "=", documentId)
152
+ .execute();
153
+ }
154
+ async handleSetSpaceTitle(documentId, action, state) {
155
+ await this.dbHelpers.updateBuilderSpace(action.input.id, documentId, {
156
+ title: action.input.newTitle,
157
+ });
158
+ }
159
+ async handleSetSpaceDescription(documentId, action, state) {
160
+ await this.dbHelpers.updateBuilderSpace(action.input.id, documentId, {
161
+ description: action.input.description,
162
+ });
163
+ }
164
+ async handleReorderSpaces(documentId, action, state) {
165
+ const { ids, insertAfter } = action.input;
166
+ for (let i = 0; i < ids.length; i++) {
167
+ const spaceId = ids[i];
168
+ const sortOrder = insertAfter !== null ? Number(insertAfter) + i + 1 : i;
169
+ await this.dbHelpers.updateBuilderSpace(spaceId, documentId, {
170
+ sort_order: sortOrder,
171
+ });
172
+ }
173
+ }
174
+ // Packages operations
175
+ async handleAddPackage(documentId, action, state) {
176
+ const packageId = action.input.spaceId + "-" + toPascalCase(action.input.name);
177
+ await this.db
178
+ .insertInto("builder_packages")
179
+ .values({
180
+ id: `${packageId}`,
181
+ space_id: action.input.spaceId,
182
+ name: action.input.name,
183
+ description: action.input.description || null,
184
+ category: action.input.category || null,
185
+ author_name: action.input.author?.name || "",
186
+ author_website: action.input.author?.website || null,
187
+ github_url: action.input.github || null,
188
+ npm_url: action.input.npm || null,
189
+ vetra_drive_url: action.input.vetraDriveUrl || null,
190
+ drive_id: null,
191
+ sort_order: 0,
192
+ created_at: new Date(),
193
+ updated_at: new Date(),
194
+ })
195
+ .onConflict((oc) => oc.column("id").doNothing())
196
+ .execute();
197
+ // Add keywords if provided
198
+ if (action.input.keywords && action.input.keywords.length > 0) {
199
+ for (const keyword of action.input.keywords) {
200
+ await this.db
201
+ .insertInto("builder_package_keywords")
202
+ .values({
203
+ id: `${packageId}-${keyword}`,
204
+ package_id: packageId,
205
+ label: keyword,
206
+ created_at: new Date(),
207
+ })
208
+ .execute();
209
+ }
210
+ }
211
+ }
212
+ async handleSetPackageDriveId(documentId, action, state) {
213
+ await this.dbHelpers.updateBuilderPackage(action.input.packageId, {
214
+ drive_id: action.input.driveId,
215
+ });
216
+ }
217
+ async handleUpdatePackage(documentId, action, state) {
218
+ const updates = {};
219
+ if (action.input.title !== undefined) {
220
+ updates.name = action.input.title;
221
+ }
222
+ if (action.input.description !== undefined) {
223
+ updates.description = action.input.description;
224
+ }
225
+ await this.dbHelpers.updateBuilderPackage(action.input.id, updates);
226
+ }
227
+ async handleReorderPackages(documentId, action, state) {
228
+ const { ids, insertAfter, spaceId } = action.input;
229
+ for (let i = 0; i < ids.length; i++) {
230
+ const packageId = ids[i];
231
+ const sortOrder = insertAfter !== null ? Number(insertAfter) + i + 1 : i;
232
+ await this.db
233
+ .updateTable("builder_packages")
234
+ .set({
235
+ sort_order: sortOrder,
236
+ updated_at: new Date(),
237
+ })
238
+ .where("id", "=", packageId)
239
+ .where("space_id", "=", spaceId)
240
+ .execute();
241
+ }
242
+ }
243
+ async handleDeletePackage(documentId, action, state) {
244
+ await this.db
245
+ .deleteFrom("builder_packages")
246
+ .where("id", "=", action.input.id)
247
+ .execute();
248
+ }
249
+ }
@@ -0,0 +1,39 @@
1
+ import type { IRelationalDb } from "document-drive";
2
+ import type { DB } from "./schema.js";
3
+ export declare class DatabaseHelpers {
4
+ private db;
5
+ constructor(db: IRelationalDb<DB>);
6
+ /**
7
+ * Ensures a package exists in the database, creating it if it doesn't
8
+ */
9
+ ensurePackageExists(documentId: string, driveId: string): Promise<void>;
10
+ /**
11
+ * Check if a document ID is marked as deleted
12
+ */
13
+ private isDocumentDeleted;
14
+ /**
15
+ * Ensures a builder account exists in the database, creating it if it doesn't
16
+ * Throws an error if the document was previously deleted
17
+ */
18
+ ensureBuilderAccountExistsAndIsNotdeleted(documentId: string): Promise<void>;
19
+ /**
20
+ * Updates a package with the provided data
21
+ */
22
+ updatePackage(documentId: string, updates: Record<string, any>): Promise<void>;
23
+ /**
24
+ * Updates a builder account with the provided data
25
+ */
26
+ updateBuilderAccount(documentId: string, updates: Record<string, any>): Promise<void>;
27
+ /**
28
+ * Updates a builder space with the provided data
29
+ */
30
+ updateBuilderSpace(spaceId: string, documentId: string, updates: Record<string, any>): Promise<void>;
31
+ /**
32
+ * Updates a builder package with the provided data
33
+ */
34
+ updateBuilderPackage(packageId: string, updates: Record<string, any>): Promise<void>;
35
+ /**
36
+ * Checks if a member already exists for a builder account
37
+ */
38
+ memberExists(documentId: string, ethAddress: string): Promise<boolean>;
39
+ }
@@ -0,0 +1,144 @@
1
+ export class DatabaseHelpers {
2
+ db;
3
+ constructor(db) {
4
+ this.db = db;
5
+ }
6
+ /**
7
+ * Ensures a package exists in the database, creating it if it doesn't
8
+ */
9
+ async ensurePackageExists(documentId, driveId) {
10
+ const existing = await this.db
11
+ .selectFrom("builder_packages")
12
+ .select("id")
13
+ .where("id", "=", documentId)
14
+ .executeTakeFirst();
15
+ if (!existing) {
16
+ await this.db
17
+ .insertInto("builder_packages")
18
+ .values({
19
+ id: documentId,
20
+ drive_id: driveId,
21
+ author_name: "",
22
+ name: "",
23
+ space_id: "",
24
+ })
25
+ .execute();
26
+ }
27
+ }
28
+ /**
29
+ * Check if a document ID is marked as deleted
30
+ */
31
+ async isDocumentDeleted(documentId) {
32
+ try {
33
+ const result = await this.db
34
+ .selectFrom("deleted_files")
35
+ .select("id")
36
+ .where("document_id", "=", documentId)
37
+ .executeTakeFirst();
38
+ return !!result;
39
+ }
40
+ catch (error) {
41
+ console.error("Error checking if document is deleted:", error);
42
+ return false;
43
+ }
44
+ }
45
+ /**
46
+ * Ensures a builder account exists in the database, creating it if it doesn't
47
+ * Throws an error if the document was previously deleted
48
+ */
49
+ async ensureBuilderAccountExistsAndIsNotdeleted(documentId) {
50
+ // Check if the document was deleted
51
+ const isDeleted = await this.isDocumentDeleted(documentId);
52
+ if (isDeleted) {
53
+ throw new Error(`Builder account with document ID ${documentId} was previously deleted and cannot be accessed`);
54
+ }
55
+ const existing = await this.db
56
+ .selectFrom("builder_accounts")
57
+ .select("id")
58
+ .where("id", "=", documentId)
59
+ .executeTakeFirst();
60
+ if (!existing) {
61
+ await this.db
62
+ .insertInto("builder_accounts")
63
+ .values({
64
+ id: documentId,
65
+ profile_name: "",
66
+ profile_slug: "",
67
+ profile_logo: null,
68
+ profile_description: null,
69
+ profile_socials_x: null,
70
+ profile_socials_github: null,
71
+ profile_socials_website: null,
72
+ created_at: new Date(),
73
+ updated_at: new Date(),
74
+ })
75
+ .onConflict((oc) => oc.column("id").doNothing())
76
+ .execute();
77
+ }
78
+ }
79
+ /**
80
+ * Updates a package with the provided data
81
+ */
82
+ async updatePackage(documentId, updates) {
83
+ await this.db
84
+ .updateTable("builder_packages")
85
+ .set({
86
+ ...updates,
87
+ updated_at: new Date(),
88
+ })
89
+ .where("id", "=", documentId)
90
+ .execute();
91
+ }
92
+ /**
93
+ * Updates a builder account with the provided data
94
+ */
95
+ async updateBuilderAccount(documentId, updates) {
96
+ await this.db
97
+ .updateTable("builder_accounts")
98
+ .set({
99
+ ...updates,
100
+ updated_at: new Date(),
101
+ })
102
+ .where("id", "=", documentId)
103
+ .execute();
104
+ }
105
+ /**
106
+ * Updates a builder space with the provided data
107
+ */
108
+ async updateBuilderSpace(spaceId, documentId, updates) {
109
+ await this.db
110
+ .updateTable("builder_spaces")
111
+ .set({
112
+ ...updates,
113
+ updated_at: new Date(),
114
+ })
115
+ .where("id", "=", spaceId)
116
+ .where("builder_account_id", "=", documentId)
117
+ .execute();
118
+ }
119
+ /**
120
+ * Updates a builder package with the provided data
121
+ */
122
+ async updateBuilderPackage(packageId, updates) {
123
+ await this.db
124
+ .updateTable("builder_packages")
125
+ .set({
126
+ ...updates,
127
+ updated_at: new Date(),
128
+ })
129
+ .where("id", "=", packageId)
130
+ .execute();
131
+ }
132
+ /**
133
+ * Checks if a member already exists for a builder account
134
+ */
135
+ async memberExists(documentId, ethAddress) {
136
+ const existing = await this.db
137
+ .selectFrom("builder_account_members")
138
+ .select("id")
139
+ .where("builder_account_id", "=", documentId)
140
+ .where("eth_address", "=", ethAddress)
141
+ .executeTakeFirst();
142
+ return !!existing;
143
+ }
144
+ }
@@ -0,0 +1,3 @@
1
+ import { type IProcessorHostModule, type ProcessorRecord } from "document-drive/processors/types";
2
+ import { type PHDocumentHeader } from "document-model";
3
+ export declare const vetraBuilderReadModelProcessorFactory: (module: IProcessorHostModule) => (driveHeader: PHDocumentHeader) => Promise<ProcessorRecord[]>;
@@ -0,0 +1,25 @@
1
+ import { VetraBuilderReadModelProcessor } from "./index.js";
2
+ export const vetraBuilderReadModelProcessorFactory = (module) => async (driveHeader) => {
3
+ // Create a namespace for the processor and the provided drive id
4
+ const namespace = VetraBuilderReadModelProcessor.getNamespace(driveHeader.id);
5
+ // Create a namespaced db for the processor
6
+ const store = await module.relationalDb.createNamespace(namespace);
7
+ // Create a filter for the processor
8
+ const filter = {
9
+ branch: ["main"],
10
+ documentId: ["*"],
11
+ documentType: [
12
+ "powerhouse/vetra/builder-account",
13
+ "powerhouse/document-drive",
14
+ ],
15
+ scope: ["global"],
16
+ };
17
+ // Create the processor
18
+ const processor = new VetraBuilderReadModelProcessor(namespace, filter, store);
19
+ return [
20
+ {
21
+ processor,
22
+ filter,
23
+ },
24
+ ];
25
+ };
@@ -0,0 +1,29 @@
1
+ import { RelationalDbProcessor } from "document-drive/processors/relational";
2
+ import { type InternalTransmitterUpdate } from "document-drive/server/listener/transmitter/internal";
3
+ import { type DB } from "./schema.js";
4
+ export declare class VetraBuilderReadModelProcessor extends RelationalDbProcessor<DB> {
5
+ static getNamespace(driveId: string): string;
6
+ initAndUpgrade(): Promise<void>;
7
+ onStrands(strands: InternalTransmitterUpdate[]): Promise<void>;
8
+ private handleDocumentDriveOperation;
9
+ private handlePackageOperation;
10
+ private handleSetLogo;
11
+ private handleSetProfileName;
12
+ private handleSetSlug;
13
+ private handleSetProfileDescription;
14
+ private handleUpdateSocials;
15
+ private handleAddMember;
16
+ private handleRemoveMember;
17
+ private handleAddSpace;
18
+ private handleDeleteSpace;
19
+ private handleSetSpaceTitle;
20
+ private handleSetSpaceDescription;
21
+ private handleReorderSpaces;
22
+ private handleAddPackage;
23
+ private handleSetPackageDriveId;
24
+ private handleUpdatePackage;
25
+ private handleReorderPackages;
26
+ private handleDeletePackage;
27
+ private ensureBuilderAccount;
28
+ onDisconnect(): Promise<void>;
29
+ }