@opengis/fastify-table 2.5.17 → 2.5.18

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,3 +1,5 @@
1
1
  declare const cronList: Record<string, Function>;
2
+ declare const cronTime: Record<string, string | number>;
3
+ export { cronList, cronTime };
2
4
  export default cronList;
3
5
  //# sourceMappingURL=cronList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cronList.d.ts","sourceRoot":"","sources":["../../../../server/plugins/cron/cronList.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAM,CAAC;AAE9C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"cronList.d.ts","sourceRoot":"","sources":["../../../../server/plugins/cron/cronList.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAM,CAAC;AAC9C,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAE9B,eAAe,QAAQ,CAAC"}
@@ -1,2 +1,4 @@
1
1
  const cronList = {};
2
+ const cronTime = {};
3
+ export { cronList, cronTime };
2
4
  export default cronList;
@@ -1 +1 @@
1
- {"version":3,"file":"addCron.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/cron/funcs/addCron.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AAEH,wBAA8B,OAAO,CACnC,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,EAAE,MAAmB,iBA+BtB"}
1
+ {"version":3,"file":"addCron.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/cron/funcs/addCron.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AAEH,wBAA8B,OAAO,CACnC,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,EAAE,MAAmB,iBAkCtB"}
@@ -1,7 +1,7 @@
1
1
  import config from "../../../../config.js";
2
2
  import logger from "../../logger/getLogger.js";
3
3
  import pgClients from "../../pg/pgClients.js";
4
- import cronList from "../cronList.js";
4
+ import { cronList, cronTime } from "../cronList.js";
5
5
  import runCron from "./runCron.js";
6
6
  import interval2ms from "./interval2ms.js";
7
7
  /**
@@ -25,6 +25,7 @@ export default async function addCron(func, interval, pg = pgClients.client) {
25
25
  }
26
26
  cronList[name] = func;
27
27
  const userInterval = time[name] || interval;
28
+ cronTime[name] = userInterval;
28
29
  const [waitMs, intervalMs] = interval2ms[typeof interval](userInterval);
29
30
  if (intervalMs < 1000) {
30
31
  logger.file("cron", { name, error: `interval ${interval} too small` });
@@ -1 +1 @@
1
- {"version":3,"file":"cronApi.d.ts","sourceRoot":"","sources":["../../../../../server/routes/cron/controllers/cronApi.ts"],"names":[],"mappings":"AAQA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBAyBzD"}
1
+ {"version":3,"file":"cronApi.d.ts","sourceRoot":"","sources":["../../../../../server/routes/cron/controllers/cronApi.ts"],"names":[],"mappings":"AAQA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBA8BzD"}
@@ -1,5 +1,5 @@
1
1
  import { ForbiddenError, UnauthorizedError, NotFoundError, } from "../../../../errors.js";
2
- import cronList from "../../../plugins/cron/cronList.js";
2
+ import { cronList, cronTime } from "../../../plugins/cron/cronList.js";
3
3
  export default async function cronApi(req, reply) {
4
4
  const { params, hostname } = req;
5
5
  const { uid, user_type: userType } = process.env.NODE_ENV === "test" || process.env.VITEST
@@ -12,7 +12,9 @@ export default async function cronApi(req, reply) {
12
12
  throw ForbiddenError("access restricted");
13
13
  }
14
14
  if (params.name === "list") {
15
- return { data: Object.keys(cronList || {}) };
15
+ return {
16
+ data: Object.keys(cronList || {}).reduce((acc, curr) => ({ ...acc, [curr]: cronTime[curr] }), {}),
17
+ };
16
18
  }
17
19
  if (!cronList[params.name]) {
18
20
  throw NotFoundError(`cron not found: ${params.name}`);
@@ -1,2 +1,2 @@
1
- export default function dumpInstalledDeps(app: any): Promise<{}>;
1
+ export default function dumpInstalledDeps({ query }: any): Promise<{}>;
2
2
  //# sourceMappingURL=dependencies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../server/routes/util/controllers/dependencies.ts"],"names":[],"mappings":"AAQA,wBAA8B,iBAAiB,CAAC,GAAG,EAAE,GAAG,eAcvD"}
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../server/routes/util/controllers/dependencies.ts"],"names":[],"mappings":"AAaA,wBAA8B,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,eAuB7D"}
@@ -1,10 +1,20 @@
1
1
  import path from "node:path";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { createRequire } from "node:module";
4
+ import util from "node:util";
5
+ import { exec } from "node:child_process";
4
6
  const require = createRequire(import.meta.url);
5
7
  const pkgPath = path.join(process.cwd(), "package.json");
6
8
  const json = JSON.parse(readFileSync(pkgPath, "utf8"));
7
- export default async function dumpInstalledDeps(app) {
9
+ const execAsync = util.promisify(exec);
10
+ export default async function dumpInstalledDeps({ query }) {
11
+ if (query?.nested) {
12
+ const { stdout, stderr } = await execAsync(`${process.argv0.includes("node") ? "npm" : "bun"} list --all`);
13
+ if (stderr) {
14
+ throw new Error(stderr);
15
+ }
16
+ return stdout;
17
+ }
8
18
  return Object.keys({
9
19
  ...json.dependencies,
10
20
  ...(json.devDependencies || {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.5.17",
3
+ "version": "2.5.18",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [