@volcanicminds/backend 0.5.0 → 0.5.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/README.md CHANGED
@@ -266,7 +266,7 @@ module.exports = {
266
266
  // src/api/example/controller/demo.ts
267
267
  import { FastifyReply, FastifyRequest } from '@volcanicminds/backend'
268
268
 
269
- export async function user(req: FastifyRequest, reply: FastifyReply) {
269
+ export function user(req: FastifyRequest, reply: FastifyReply) {
270
270
  reply.send(req.user || {})
271
271
  }
272
272
  ```
@@ -1,19 +1,8 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.check = void 0;
13
4
  function check(req, reply) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- reply.send({ ok: true });
16
- });
5
+ reply.send({ ok: true });
17
6
  }
18
7
  exports.check = check;
19
8
  //# sourceMappingURL=health.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"health.js","sourceRoot":"","sources":["../../../../../lib/api/health/controller/health.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,SAAsB,KAAK,CAAC,GAAmB,EAAE,KAAmB;;QAClE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1B,CAAC;CAAA;AAFD,sBAEC"}
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../../../../../lib/api/health/controller/health.ts"],"names":[],"mappings":";;;AAEA,SAAgB,KAAK,CAAC,GAAmB,EAAE,KAAmB;IAC5D,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AAC1B,CAAC;AAFD,sBAEC"}
@@ -1,27 +1,14 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.isAdmin = exports.user = void 0;
13
4
  function user(req, reply) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const user = req.user;
16
- reply.send(user ? Object.assign(Object.assign({}, user), { roles: req.roles() }) : {});
17
- });
5
+ const user = req.user;
6
+ reply.send(user ? Object.assign(Object.assign({}, user), { roles: req.roles() }) : {});
18
7
  }
19
8
  exports.user = user;
20
9
  function isAdmin(req, reply) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const user = req.user;
23
- reply.send({ isAdmin: (user === null || user === void 0 ? void 0 : user.getId()) && req.hasRole(roles.admin) });
24
- });
10
+ const user = req.user;
11
+ reply.send({ isAdmin: (user === null || user === void 0 ? void 0 : user.getId()) && req.hasRole(roles.admin) });
25
12
  }
26
13
  exports.isAdmin = isAdmin;
27
14
  //# sourceMappingURL=user.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../../lib/api/users/controller/user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,SAAsB,IAAI,CAAC,GAAmB,EAAE,KAAmB;;QACjE,MAAM,IAAI,GAAkC,GAAG,CAAC,IAAI,CAAA;QACpD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,iCAAM,IAAI,KAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAG,CAAC,CAAC,EAAE,CAAC,CAAA;IACzD,CAAC;CAAA;AAHD,oBAGC;AAED,SAAsB,OAAO,CAAC,GAAmB,EAAE,KAAmB;;QACpE,MAAM,IAAI,GAAkC,GAAG,CAAC,IAAI,CAAA;QACpD,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAAE,KAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACpE,CAAC;CAAA;AAHD,0BAGC"}
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../../lib/api/users/controller/user.ts"],"names":[],"mappings":";;;AAGA,SAAgB,IAAI,CAAC,GAAmB,EAAE,KAAmB;IAC3D,MAAM,IAAI,GAAkC,GAAG,CAAC,IAAI,CAAA;IACpD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,iCAAM,IAAI,KAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAG,CAAC,CAAC,EAAE,CAAC,CAAA;AACzD,CAAC;AAHD,oBAGC;AAED,SAAgB,OAAO,CAAC,GAAmB,EAAE,KAAmB;IAC9D,MAAM,IAAI,GAAkC,GAAG,CAAC,IAAI,CAAA;IACpD,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAAE,KAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AACpE,CAAC;AAHD,0BAGC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcanicminds/backend",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "codename": "turin",
5
5
  "license": "MIT",
6
6
  "description": "The volcanic (minds) backend",
@@ -1,5 +1,5 @@
1
1
  import { FastifyReply, FastifyRequest } from 'fastify'
2
2
 
3
- export async function check(req: FastifyRequest, reply: FastifyReply) {
3
+ export function check(req: FastifyRequest, reply: FastifyReply) {
4
4
  reply.send({ ok: true })
5
5
  }
@@ -1,12 +1,12 @@
1
1
  import { FastifyReply, FastifyRequest } from 'fastify'
2
2
  import { AuthenticatedUser } from '../../../../types/global'
3
3
 
4
- export async function user(req: FastifyRequest, reply: FastifyReply) {
4
+ export function user(req: FastifyRequest, reply: FastifyReply) {
5
5
  const user: AuthenticatedUser | undefined = req.user
6
6
  reply.send(user ? { ...user, roles: req.roles() } : {})
7
7
  }
8
8
 
9
- export async function isAdmin(req: FastifyRequest, reply: FastifyReply) {
9
+ export function isAdmin(req: FastifyRequest, reply: FastifyReply) {
10
10
  const user: AuthenticatedUser | undefined = req.user
11
11
  reply.send({ isAdmin: user?.getId() && req.hasRole(roles.admin) })
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcanicminds/backend",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "codename": "turin",
5
5
  "license": "MIT",
6
6
  "description": "The volcanic (minds) backend",