@flink-app/flink 0.12.1-alpha.1 → 0.12.1-alpha.3

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.
@@ -164,7 +164,7 @@ export declare class FlinkApp<C extends FlinkContext> {
164
164
  private debug;
165
165
  private onDbConnection?;
166
166
  private plugins;
167
- private auth?;
167
+ auth?: FlinkAuthPlugin;
168
168
  private corsOpts;
169
169
  private routingConfigured;
170
170
  private jsonOptions?;
@@ -9,12 +9,8 @@ export declare abstract class FlinkRepo<C extends FlinkContext, Model extends Do
9
9
  get ctx(): FlinkContext;
10
10
  constructor(collectionName: string, db: Db);
11
11
  findAll(query?: {}): Promise<Model[]>;
12
- getById(id: string | ObjectId): Promise<(Model & {
13
- _id?: any;
14
- }) | null>;
15
- getOne(query?: {}): Promise<(Model & {
16
- _id?: any;
17
- }) | null>;
12
+ getById(id: string | ObjectId): Promise<Model | null>;
13
+ getOne(query?: {}): Promise<Model | null>;
18
14
  create<C = Omit<Model, "_id">>(model: C): Promise<C & {
19
15
  _id: string;
20
16
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/flink",
3
- "version": "0.12.1-alpha.1",
3
+ "version": "0.12.1-alpha.3",
4
4
  "description": "Typescript only framework for creating REST-like APIs on top of Express and mongodb",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "main": "dist/src/index.js",
@@ -66,5 +66,5 @@
66
66
  "rimraf": "^3.0.2",
67
67
  "ts-node": "^9.1.1"
68
68
  },
69
- "gitHead": "040e670be372c0cc47d9c7106bed55780910cf39"
69
+ "gitHead": "51b6524e233acb2430953ffaed6382909f34db8e"
70
70
  }
package/src/FlinkApp.ts CHANGED
@@ -227,7 +227,7 @@ export class FlinkApp<C extends FlinkContext> {
227
227
  private onDbConnection?: FlinkOptions["onDbConnection"];
228
228
 
229
229
  private plugins: FlinkPlugin[] = [];
230
- private auth?: FlinkAuthPlugin;
230
+ public auth?: FlinkAuthPlugin;
231
231
  private corsOpts: FlinkOptions["cors"];
232
232
  private routingConfigured = false;
233
233
  private jsonOptions?: OptionsJson;
package/src/FlinkRepo.ts CHANGED
@@ -21,13 +21,13 @@ export abstract class FlinkRepo<C extends FlinkContext, Model extends Document>
21
21
 
22
22
  async findAll(query = {}): Promise<Model[]> {
23
23
  const res = await this.collection.find<Model>(query).toArray();
24
- return res.map(this.objectIdToString);
24
+ return res.map(this.objectIdToString) as Model[];
25
25
  }
26
26
 
27
27
  async getById(id: string | ObjectId) {
28
28
  const res = await this.collection.findOne<Model>({ _id: this.buildId(id) });
29
29
  if (res) {
30
- return this.objectIdToString(res);
30
+ return this.objectIdToString(res) as Model;
31
31
  }
32
32
  return null;
33
33
  }
@@ -35,7 +35,7 @@ export abstract class FlinkRepo<C extends FlinkContext, Model extends Document>
35
35
  async getOne(query = {}) {
36
36
  const res = await this.collection.findOne<Model>(query);
37
37
  if (res) {
38
- return this.objectIdToString(res);
38
+ return this.objectIdToString(res) as Model;
39
39
  }
40
40
  return null;
41
41
  }
@@ -53,7 +53,7 @@ export abstract class FlinkRepo<C extends FlinkContext, Model extends Document>
53
53
  const res = await this.collection.findOne<Model>({ _id: oid });
54
54
 
55
55
  if (res) {
56
- return this.objectIdToString(res);
56
+ return this.objectIdToString(res) as Model;
57
57
  }
58
58
  return null;
59
59
  }