@opengis/fastify-table 2.0.143 → 2.0.145

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 @@
1
- {"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/jwt/authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAwBvC,wBAA8B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBA4GpE"}
1
+ {"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/jwt/authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAyBvC,wBAA8B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBA4GpE"}
@@ -1,3 +1,4 @@
1
+ import config from "../../../../../config.js";
1
2
  import pgClients from "../../../../plugins/pg/pgClients.js";
2
3
  import dataInsert from "../../../../plugins/crud/funcs/dataInsert.js";
3
4
  import { sign, scryptHash } from "../../../../plugins/auth/funcs/jwt.js";
@@ -9,7 +10,7 @@ const getIp = (req) => (req.headers?.["x-real-ip"] ||
9
10
  "")
10
11
  .split(":")
11
12
  .pop();
12
- const expireMsec = 1000 * 60 * 60;
13
+ const expireMsec = +(config.auth?.oauthTokenExpireMs || 1000 * 60 * 60);
13
14
  // ? Request example: http://localhost:3000/oauth/authorize?response_type=code&client_id=2835134164020233999&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Foauth%2Ftoken%3Fclient_id%3D2835134164020233999%26noredirect%3D1%26grant_type%3Dauthorization_code
14
15
  // ? add &noredirect=1 to retrieve code via GET request or simply send POST requests
15
16
  export default async function authorize(req, reply) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/file/index.ts"],"names":[],"mappings":"AAWA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QAuBtC;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/file/index.ts"],"names":[],"mappings":"AAaA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QA8BtC;AAED,eAAe,MAAM,CAAC"}
@@ -1,3 +1,4 @@
1
+ import config from "../../../config.js";
1
2
  import files from "./controllers/files.js";
2
3
  import resize from "./controllers/resize.js";
3
4
  import resizeAll from "./controllers/resizeAll.js";
@@ -8,15 +9,26 @@ import uploadImage from "./controllers/uploadImage.js";
8
9
  import deleteFileAPI from "./controllers/delete.js";
9
10
  import { resizeSchema } from "./schema.js";
10
11
  function plugin(app, opt = {}) {
11
- app.get("/files/*", { config: { policy: ["public"] } }, files);
12
- if (!app.hasRoute({ method: 'GET', url: '/file/resize', })) {
13
- app.get("/file/resize", { config: { policy: ["public"] }, schema: resizeSchema }, resize);
12
+ app.get("/files/*", { config: { policy: "L0" } }, files);
13
+ if (!app.hasRoute({ method: "GET", url: "/file/resize" })) {
14
+ app.get("/file/resize", {
15
+ config: {
16
+ policy: "L0",
17
+ rateLimit: config.rateLimit
18
+ ? {
19
+ max: +(config.rateLimit?.resize?.max || 1000),
20
+ timeWindow: config.rateLimit?.resize?.timeWindow || "1 minute",
21
+ }
22
+ : undefined,
23
+ },
24
+ schema: resizeSchema,
25
+ }, resize);
14
26
  }
15
27
  app.get("/api/resize-all", { config: { policy: ["admin", "site"] }, schema: resizeSchema }, resizeAll);
16
- app.post("/file/upload/*", { config: { policy: ["public"] } }, upload);
17
- app.post("/file/upload-image/*", { config: { policy: ["public"] } }, uploadImage);
18
- app.get("/file/download/*", { config: { policy: ["public"] } }, download);
19
- app.get("/file/delete/*", { config: { policy: ["public"] } }, deleteFileAPI);
20
- app.get(`/api/export`, { config: { policy: ["public"] } }, exportTable);
28
+ app.post("/file/upload/*", { config: { policy: "L0" } }, upload);
29
+ app.post("/file/upload-image/*", { config: { policy: "L0" } }, uploadImage);
30
+ app.get("/file/download/*", { config: { policy: "L0" } }, download);
31
+ app.get("/file/delete/*", { config: { policy: "L0" } }, deleteFileAPI);
32
+ app.get(`/api/export`, { config: { policy: "L0" } }, exportTable);
21
33
  }
22
34
  export default plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.143",
3
+ "version": "2.0.145",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [