@loomcore/api 0.1.4 → 0.1.6

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.
@@ -1 +1,4 @@
1
1
  export * from './mongo-db/index.js';
2
+ export * from './postgres/index.js';
3
+ export * from './models/index.js';
4
+ export * from './operations/index.js';
@@ -1 +1,4 @@
1
1
  export * from './mongo-db/index.js';
2
+ export * from './postgres/index.js';
3
+ export * from './models/index.js';
4
+ export * from './operations/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './operation.js';
2
+ export * from './join.operation.js';
@@ -0,0 +1,2 @@
1
+ export * from './operation.js';
2
+ export * from './join.operation.js';
@@ -0,0 +1,2 @@
1
+ export * from './postgres.database.js';
2
+ export * from './migrations/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './postgres.database.js';
2
+ export * from './migrations/index.js';
@@ -1,9 +1,10 @@
1
1
  import { Application } from 'express';
2
- import { Db, MongoClient } from "mongodb";
2
+ import { MongoClient } from "mongodb";
3
3
  import { Server } from "http";
4
4
  import { IBaseApiConfig } from "../models/index.js";
5
- type RouteSetupFunction = (app: Application, db: Db, config: IBaseApiConfig) => void;
6
- declare function setupExpressApp(db: Db, config: IBaseApiConfig, setupRoutes: RouteSetupFunction): Application;
5
+ import { IDatabase } from '../databases/models/index.js';
6
+ type RouteSetupFunction = (app: Application, database: IDatabase, config: IBaseApiConfig) => void;
7
+ declare function setupExpressApp(database: IDatabase, config: IBaseApiConfig, setupRoutes: RouteSetupFunction): Application;
7
8
  declare function performGracefulShutdown(event: any, mongoClient: MongoClient | null, externalServer: Server | null, internalServer: Server | null): void;
8
9
  export declare const expressUtils: {
9
10
  setupExpressApp: typeof setupExpressApp;
@@ -6,7 +6,7 @@ import qs from 'qs';
6
6
  import { NotFoundError } from "../errors/not-found.error.js";
7
7
  import { errorHandler } from "../middleware/error-handler.js";
8
8
  import { ensureUserContext } from '../middleware/ensure-user-context.js';
9
- function setupExpressApp(db, config, setupRoutes) {
9
+ function setupExpressApp(database, config, setupRoutes) {
10
10
  const app = express();
11
11
  app.set('query parser', (str) => {
12
12
  return qs.parse(str, {});
@@ -24,7 +24,7 @@ function setupExpressApp(db, config, setupRoutes) {
24
24
  credentials: true
25
25
  }));
26
26
  app.use(ensureUserContext);
27
- setupRoutes(app, db, config);
27
+ setupRoutes(app, database, config);
28
28
  app.use(async (req, res) => {
29
29
  throw new NotFoundError(`Requested path, ${req.path}, Not Found`);
30
30
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcore/api",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};