@powerhousedao/codegen 3.3.0-dev.11 → 3.3.0-dev.12

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.
@@ -7,9 +7,8 @@ import {
7
7
  type IProcessorHostModule
8
8
  } from "document-drive/processors/types";
9
9
  import {
10
- createNamespacedDb,
11
- type OperationalProcessorFilter,
12
- } from "document-drive/processors/operational-processor";
10
+ type RelationalDbProcessorFilter,
11
+ } from "document-drive/processors/relational";
13
12
  import { <%= pascalName %>Processor } from "./index.js";
14
13
 
15
14
  export const <%= h.changeCase.camel(name) %>ProcessorFactory = (module: IProcessorHostModule) => async (driveId: string): Promise<ProcessorRecord[]> => {
@@ -17,17 +16,16 @@ export const <%= h.changeCase.camel(name) %>ProcessorFactory = (module: IProcess
17
16
  const namespace = <%= pascalName %>Processor.getNamespace(driveId);
18
17
 
19
18
  // Create a filter for the processor
20
- const filter: OperationalProcessorFilter = {
19
+ const filter: RelationalDbProcessorFilter = {
21
20
  branch: ["main"],
22
21
  documentId: ["*"],
23
22
  documentType: [<% if(documentTypes.length) { %><%- documentTypes.map(type => `"${type}"`).join(", ") %><% } else { %>"*"<% } %>],
24
23
  scope: ["global"],
25
24
  };
26
25
 
27
- // Create a namespaced store for the processor
28
- const store = await createNamespacedDb<<%= pascalName %>Processor>(
26
+ // Create a namespaced db for the processor
27
+ const store = await module.relationalDb.createNamespacedDb<<%= pascalName %>Processor>(
29
28
  namespace,
30
- module.operationalStore,
31
29
  );
32
30
 
33
31
  // Create the processor
@@ -2,8 +2,8 @@
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/index.ts"
3
3
  force: true
4
4
  ---
5
- import { type IOperationalStore } from "document-drive/processors/types";
6
- import { OperationalProcessor } from "document-drive/processors/operational-processor";
5
+ import { type IRelationalDb } from "document-drive/processors/types";
6
+ import { RelationalDbProcessor } from "document-drive/processors/relational";
7
7
  import { type InternalTransmitterUpdate } from "document-drive/server/listener/transmitter/internal";
8
8
  <% documentTypes.forEach(type => { _%>
9
9
  import type { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>/index.js";
@@ -14,14 +14,14 @@ import { type DB } from "./schema.js";
14
14
 
15
15
  type DocumentType = <% if(documentTypes.length) { %><%= documentTypes.map(type => `${documentTypesMap[type].name}Document`).join(" | ") %> <% } else { %>PHDocument<% } %>;
16
16
 
17
- export class <%= pascalName %>Processor extends OperationalProcessor<DB> {
17
+ export class <%= pascalName %>Processor extends RelationalDbProcessor<DB> {
18
18
  static override getNamespace(driveId: string): string {
19
19
  // Default namespace: `${this.name}_${driveId.replaceAll("-", "_")}`
20
20
  return super.getNamespace(driveId);
21
21
  }
22
22
 
23
23
  override async initAndUpgrade(): Promise<void> {
24
- await up(this.operationalStore as IOperationalStore);
24
+ await up(this.relationalDb as IRelationalDb);
25
25
  }
26
26
 
27
27
  override async onStrands(
@@ -37,7 +37,7 @@ export class <%= pascalName %>Processor extends OperationalProcessor<DB> {
37
37
  }
38
38
 
39
39
  for (const operation of strand.operations) {
40
- await this.operationalStore
40
+ await this.relationalDb
41
41
  .insertInto("todo")
42
42
  .values({
43
43
  task: strand.documentId,
@@ -2,9 +2,9 @@
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/migrations.ts"
3
3
  force: true
4
4
  ---
5
- import { type IOperationalStore } from "document-drive/processors/types"
5
+ import { type IRelationalDb } from "document-drive/processors/types"
6
6
 
7
- export async function up(db: IOperationalStore): Promise<void> {
7
+ export async function up(db: IRelationalDb<any>): Promise<void> {
8
8
  // Create table
9
9
  await db.schema
10
10
  .createTable("todo")
@@ -17,7 +17,7 @@ export async function up(db: IOperationalStore): Promise<void> {
17
17
  .execute();
18
18
  }
19
19
 
20
- export async function down(db: IOperationalStore): Promise<void> {
20
+ export async function down(db: IRelationalDb<any>): Promise<void> {
21
21
  // drop table
22
22
  await db.schema.dropTable("todo").execute();
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/codegen",
3
- "version": "3.3.0-dev.11",
3
+ "version": "3.3.0-dev.12",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "type": "module",
@@ -33,8 +33,8 @@
33
33
  "kysely": "^0.28.2",
34
34
  "kysely-pglite": "^0.6.1",
35
35
  "prettier": "^3.4.2",
36
- "@powerhousedao/config": "3.3.0-dev.11",
37
- "document-model": "3.3.0-dev.11"
36
+ "@powerhousedao/config": "3.3.0-dev.12",
37
+ "document-model": "3.3.0-dev.12"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@graphql-codegen/core": "^4.0.2",
@@ -44,8 +44,8 @@
44
44
  "husky": "^8.0.3",
45
45
  "vitest": "^3.1.2",
46
46
  "zod": "^3.24.3",
47
- "@powerhousedao/reactor-api": "3.3.0-dev.11",
48
- "document-drive": "3.3.0-dev.11"
47
+ "@powerhousedao/reactor-api": "3.3.0-dev.12",
48
+ "document-drive": "3.3.0-dev.12"
49
49
  },
50
50
  "scripts": {
51
51
  "build:tsc": "tsc --build",