@powerhousedao/reactor-api 1.7.0 → 1.8.1

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 CHANGED
@@ -1,24 +1,9 @@
1
- ## 1.7.0 (2024-12-03)
2
-
3
- ### 🚀 Features
4
-
5
- - **design-system:** bump storybook deps ([f21d9539](https://github.com/powerhouse-inc/powerhouse/commit/f21d9539))
6
- - **monorepo:** remove eslint args ([4677e343](https://github.com/powerhouse-inc/powerhouse/commit/4677e343))
7
- - **monorepo:** readd vite for reactor local ([24a9e56b](https://github.com/powerhouse-inc/powerhouse/commit/24a9e56b))
8
- - **monorepo:** add linting for switchboard gui ([dc56c561](https://github.com/powerhouse-inc/powerhouse/commit/dc56c561))
9
- - **monorepo:** gitignore tsbuildinfo files ([d676a703](https://github.com/powerhouse-inc/powerhouse/commit/d676a703))
10
- - **monorepo:** unify typescript and linting ([24b9a205](https://github.com/powerhouse-inc/powerhouse/commit/24b9a205))
1
+ ## 1.8.1 (2024-12-05)
11
2
 
12
3
  ### 🧱 Updated Dependencies
13
4
 
14
- - Updated document-model-libs to 1.117.1
15
- - Updated document-drive to 1.6.0
16
- - Updated document-model to 2.8.0
17
- - Updated @powerhousedao/scalars to 1.10.0
18
-
19
- ### ❤️ Thank You
20
-
21
- - ryanwolhuter @ryanwolhuter
5
+ - Updated document-model-libs to 1.118.1
6
+ - Updated document-drive to 1.7.1
22
7
 
23
8
  ## 1.2.0 (2024-10-29)
24
9
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
+ import { PGlite } from '@electric-sql/pglite';
1
2
  import { Trigger, PullResponderTriggerData, DocumentDriveDocument, ListenerFilter, DocumentDriveLocalState, ListenerCallInfo, DocumentDriveAction, DocumentDriveState } from 'document-model-libs/document-drive';
2
3
  import { Document, OperationScope, Operation, DocumentModel, Action, ActionContext, BaseAction, State, CreateChildDocumentInput, ReducerOptions, Signal } from 'document-model/document';
3
4
  import { Unsubscribe } from 'nanoevents';
4
- import express, { Express, IRouter } from 'express';
5
+ import express, { Express } from 'express';
6
+ import pg from 'pg';
7
+ import { PgDatabase } from 'drizzle-orm/pg-core';
8
+ import { IncomingHttpHeaders } from 'http';
5
9
  import * as graphql from 'graphql';
6
10
  import { GraphQLResolverMap } from '@apollo/subgraph/dist/schema-helper';
7
11
 
@@ -279,12 +283,6 @@ type PublicPart<T> = Pick<T, PublicKeys<T>>;
279
283
  type IBaseDocumentDriveServer = PublicPart<AbstractDocumentDriveServer>;
280
284
  type IDocumentDriveServer = IBaseDocumentDriveServer & IDefaultDrivesManager & IReadModeDriveServer;
281
285
 
282
- type Options = {
283
- express?: Express;
284
- port?: number;
285
- };
286
- declare function startAPI(reactor: IDocumentDriveServer, options: Options): Promise<express.Express>;
287
-
288
286
  type InternalListenerModule = {
289
287
  name: string;
290
288
  options: Omit<Listener, "driveId">;
@@ -299,21 +297,54 @@ declare class InternalListenerManager {
299
297
  registerInternalListener(module: InternalListenerModule): Promise<void>;
300
298
  }
301
299
 
302
- declare const SUBGRAPH_REGISTRY: {
300
+ interface Context {
301
+ headers: IncomingHttpHeaders;
302
+ driveId: string | undefined;
303
+ driveServer: IDocumentDriveServer;
304
+ db: PgDatabase<any, any, any>;
305
+ }
306
+ type Processor = {
303
307
  name: string;
304
- getSchema: (driveServer: IDocumentDriveServer) => graphql.GraphQLSchema;
305
- }[];
308
+ resolvers: any;
309
+ typeDefs: string;
310
+ options?: Omit<Listener, "driveId">;
311
+ transmit?: (strands: InternalTransmitterUpdate[]) => Promise<void>;
312
+ };
306
313
 
307
- declare let reactorRouter: IRouter;
308
- declare const getListenerManager: (driveServer: IDocumentDriveServer) => Promise<InternalListenerManager>;
309
- declare const updateRouter: (driveServer: IDocumentDriveServer) => Promise<void>;
310
- declare const initReactorRouter: (path: string, app: express.Express, driveServer: IDocumentDriveServer) => Promise<void>;
311
- declare const addSubgraph: (subgraph: (typeof SUBGRAPH_REGISTRY)[number]) => Promise<void>;
312
- declare const registerInternalListener: (module: InternalListenerModule) => Promise<void>;
313
- declare const getAdditionalContextFields: () => {};
314
- declare const setAdditionalContextFields: (fields: Record<string, any>) => void;
314
+ declare const Pool$1: typeof pg.Pool;
315
+
316
+ declare class ReactorRouterManager {
317
+ #private;
318
+ private readonly path;
319
+ private readonly app;
320
+ private readonly driveServer;
321
+ private readonly client;
322
+ private listenerManager;
323
+ private database;
324
+ private reactorRouter;
325
+ private contextFields;
326
+ private registry;
327
+ constructor(path: string, app: express.Express, driveServer: IDocumentDriveServer, client?: PGlite | typeof Pool$1, listenerManager?: InternalListenerManager);
328
+ init(): Promise<void>;
329
+ updateRouter(): Promise<void>;
330
+ registerProcessor(processor: Processor): Promise<void>;
331
+ getAdditionalContextFields: () => Record<string, any>;
332
+ setAdditionalContextFields(fields: Record<string, any>): void;
333
+ }
334
+
335
+ declare const Pool: typeof pg.Pool;
336
+
337
+ type Options = {
338
+ express?: Express;
339
+ port?: number;
340
+ client?: PGlite | typeof Pool | undefined;
341
+ };
342
+ declare function startAPI(reactor: IDocumentDriveServer, options: Options): Promise<{
343
+ app: express.Express;
344
+ reactorRouterManager: ReactorRouterManager;
345
+ }>;
315
346
 
316
- declare const createSchema: (documentDriveServer: IDocumentDriveServer, resolvers: GraphQLResolverMap, typeDefs: string) => graphql.GraphQLSchema;
347
+ declare const createSchema: (documentDriveServer: IDocumentDriveServer, resolvers: GraphQLResolverMap<Context>, typeDefs: string) => graphql.GraphQLSchema;
317
348
  declare const getDocumentModelTypeDefs: (documentDriveServer: IDocumentDriveServer, typeDefs: string) => graphql.DocumentNode;
318
349
 
319
- export { addSubgraph, createSchema, getAdditionalContextFields, getDocumentModelTypeDefs, getListenerManager, initReactorRouter, reactorRouter, registerInternalListener, setAdditionalContextFields, startAPI, updateRouter };
350
+ export { ReactorRouterManager, createSchema, getDocumentModelTypeDefs, startAPI };