@opengis/fastify-table 2.5.1 → 2.5.2

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":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AA8FA,iBAAe,MAAM,CAAC,OAAO,EAAE,GAAG,iBAoMjC;;AACD,wBAEG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AA8FA,iBAAe,MAAM,CAAC,OAAO,EAAE,GAAG,iBAkOjC;;AACD,wBAEG"}
package/dist/index.js CHANGED
@@ -164,6 +164,33 @@ async function plugin(fastify) {
164
164
  if (config.dblist) {
165
165
  fastify.register(dblistRoutes, opt);
166
166
  }
167
+ fastify.addHook('preValidation', async (request, reply) => {
168
+ const q = request.query;
169
+ if (q?.limit !== undefined) {
170
+ const limit = Number(q.limit);
171
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
172
+ reply.code(400).send({
173
+ error: 'Invalid limit (1-100)'
174
+ });
175
+ }
176
+ }
177
+ if (q?.offset !== undefined) {
178
+ const offset = Number(q.offset);
179
+ if (!Number.isInteger(offset) || offset < 0) {
180
+ reply.code(400).send({
181
+ error: 'Invalid offset (>=0)'
182
+ });
183
+ }
184
+ }
185
+ if (q?.page !== undefined) {
186
+ const page = Number(q.page);
187
+ if (!Number.isInteger(page) || page > 1000) {
188
+ reply.code(400).send({
189
+ error: 'Invalid page (<=1000)'
190
+ });
191
+ }
192
+ }
193
+ });
167
194
  // routes / api
168
195
  fastify.register(cronRoutes, opt);
169
196
  fastify.register(crudRoutes, opt);
@@ -0,0 +1,77 @@
1
+ CREATE schema if not exists oauth;
2
+
3
+ CREATE TABLE if not exists oauth.clients (
4
+ client_id text PRIMARY KEY DEFAULT next_id(), -- ID клієнта (публічний ідентифікатор)
5
+ client_secret_hash text, -- Хеш секрету (NULL для public-клієнтів)
6
+ name text NOT NULL, -- Назва застосунку
7
+ type text NOT NULL CHECK (type IN ('public','confidential')),
8
+ token_endpoint_auth_method text NOT NULL CHECK (token_endpoint_auth_method IN ('client_secret_basic','client_secret_post','private_key_jwt','none')),
9
+ owner_user_id text, -- Власник/адміністратор клієнта (посилання на users.id or other id)
10
+
11
+ redirect_uris text[], -- Дозволені redirect_uri
12
+ grant_types text[] CHECK (case when grant_types is not null then grant_types <@ ARRAY['authorization_code','refresh_token','client_credentials','device_code']::text[] else true end),
13
+ require_pkce boolean NOT NULL DEFAULT true,
14
+ scopes text[],
15
+ allowed_cors_origins text[],
16
+ jwks jsonb, -- Вбудований JWK Set (опційно)
17
+
18
+ created_at timestamptz NOT NULL DEFAULT now(),
19
+ updated_at timestamptz NOT NULL DEFAULT now()
20
+ );
21
+
22
+ CREATE TABLE if not exists oauth.tokens (
23
+ id text PRIMARY KEY DEFAULT next_id(),
24
+ token_type text NOT NULL CHECK (token_type IN ('access','refresh')),
25
+ token_hash text NOT NULL UNIQUE, -- Argon2/bcrypt/SCrypt (хеш у застосунку)
26
+ token_hint text, -- останні 6-8 символів для діагностики (необов’язково)
27
+ jti text UNIQUE, -- JWT ID, якщо токен — JWT
28
+ client_id text NOT NULL REFERENCES oauth.clients(client_id) ON DELETE CASCADE,
29
+ user_id text, -- NULL для client_credentials
30
+ issuer text, -- iss
31
+ scopes text[],
32
+ claims jsonb, -- додаткові клейми
33
+ issued_at timestamptz NOT NULL DEFAULT now(),
34
+ expires_at timestamptz NOT NULL,
35
+ revoked_at timestamptz,
36
+ revocation_reason text,
37
+ ip inet -- IP видачі/використання (опційно)
38
+ );
39
+
40
+ COMMENT ON SCHEMA oauth IS 'Schema for OAuth2 / OpenID Connect clients and tokens';
41
+
42
+ -- Comments for oauth.clients
43
+ COMMENT ON TABLE oauth.clients IS 'OAuth 2.0 clients (applications) that can request tokens';
44
+
45
+ COMMENT ON COLUMN oauth.clients.client_id IS 'Client identifier (public ID, generated by next_id())';
46
+ COMMENT ON COLUMN oauth.clients.client_secret_hash IS 'Hashed client secret (NULL for public clients)';
47
+ COMMENT ON COLUMN oauth.clients.name IS 'Name of the application/client';
48
+ COMMENT ON COLUMN oauth.clients.type IS 'Client type: public or confidential';
49
+ COMMENT ON COLUMN oauth.clients.token_endpoint_auth_method IS 'Authentication method at token endpoint (client_secret_basic, client_secret_post, private_key_jwt, none)';
50
+ COMMENT ON COLUMN oauth.clients.owner_user_id IS 'Owner/administrator of the client (reference to users.id or external id)';
51
+ COMMENT ON COLUMN oauth.clients.redirect_uris IS 'Allowed redirect URIs';
52
+ COMMENT ON COLUMN oauth.clients.grant_types IS 'Allowed grant types (authorization_code, refresh_token, client_credentials, device_code)';
53
+ COMMENT ON COLUMN oauth.clients.require_pkce IS 'Whether PKCE is required (default true)';
54
+ COMMENT ON COLUMN oauth.clients.scopes IS 'Allowed OAuth2 scopes';
55
+ COMMENT ON COLUMN oauth.clients.allowed_cors_origins IS 'Allowed CORS origins for browser-based apps';
56
+ COMMENT ON COLUMN oauth.clients.jwks IS 'Embedded JSON Web Key Set (optional)';
57
+ COMMENT ON COLUMN oauth.clients.created_at IS 'Creation timestamp';
58
+ COMMENT ON COLUMN oauth.clients.updated_at IS 'Last update timestamp';
59
+
60
+ -- Comments for oauth.tokens
61
+ COMMENT ON TABLE oauth.tokens IS 'Issued OAuth 2.0 tokens (access or refresh)';
62
+
63
+ COMMENT ON COLUMN oauth.tokens.id IS 'Internal token ID (generated by next_id())';
64
+ COMMENT ON COLUMN oauth.tokens.token_type IS 'Type of token: access or refresh';
65
+ COMMENT ON COLUMN oauth.tokens.token_hash IS 'Secure hash of the token (Argon2/bcrypt/SCrypt)';
66
+ COMMENT ON COLUMN oauth.tokens.token_hint IS 'Optional hint (last 6–8 characters of token) for diagnostics';
67
+ COMMENT ON COLUMN oauth.tokens.jti IS 'JWT ID if token is a JWT (unique)';
68
+ COMMENT ON COLUMN oauth.tokens.client_id IS 'Reference to oauth.clients (issuing client)';
69
+ COMMENT ON COLUMN oauth.tokens.user_id IS 'User ID if bound to user (NULL for client_credentials flow)';
70
+ COMMENT ON COLUMN oauth.tokens.issuer IS 'Token issuer (iss claim)';
71
+ COMMENT ON COLUMN oauth.tokens.scopes IS 'Granted OAuth2 scopes for this token';
72
+ COMMENT ON COLUMN oauth.tokens.claims IS 'Additional claims (JSONB)';
73
+ COMMENT ON COLUMN oauth.tokens.issued_at IS 'Timestamp when issued';
74
+ COMMENT ON COLUMN oauth.tokens.expires_at IS 'Timestamp when token expires';
75
+ COMMENT ON COLUMN oauth.tokens.revoked_at IS 'Timestamp when revoked';
76
+ COMMENT ON COLUMN oauth.tokens.revocation_reason IS 'Reason for revocation (if any)';
77
+ COMMENT ON COLUMN oauth.tokens.ip IS 'IP address of issuance/usage (optional)';
@@ -0,0 +1,137 @@
1
+ syntax = "proto3";
2
+
3
+ service Convert {
4
+ rpc csvToXls(csvToXlsParams) returns (FileBase64) {}
5
+ rpc jsonToXls(jsonToXlsParams) returns (FileBase64) {}
6
+ rpc pdfMerge(pdfMergeParams) returns (FileBase64) {}
7
+ rpc htmlToPdf(htmlToPdfParams) returns (FileBase64) {}
8
+ rpc excelToJson(excelToJsonParams) returns (FileBase64) {}
9
+ rpc xmlToJson(xmlToJsonParams) returns (FileBase64) {}
10
+ rpc htmlToDoc(htmlToDocParams) returns (FileBase64) {}
11
+ rpc htmlToImage(htmlToImageParams) returns (FileBase64) {}
12
+ rpc geojsonToShp(geojsonToShpParams) returns (FileBase64) {}
13
+ rpc shpToGeojson(shpToGeojsonParams) returns (FileBase64) {}
14
+ rpc docToPDF(docToPDFParams) returns (FileBase64) {}
15
+ rpc mergeImages(mergeImagesIn) returns (FileBase64) {}
16
+ rpc resizeImage(resizeImageIn) returns (FileBase64) {}
17
+ rpc jsonToYaml(jsonToYamlIn) returns (FileBase64) {}
18
+ rpc yamlToJson(yamlToJsonIn) returns (FileBase64) {}
19
+ rpc log(log_in) returns (log_out) {}
20
+ rpc geojsonToGpkg(geojsonToShpParams) returns (FileBase64) {}
21
+ }
22
+
23
+ message jsonToYamlIn {
24
+ string json = 1;
25
+ }
26
+
27
+ message yamlToJsonIn {
28
+ string yaml = 1;
29
+ }
30
+
31
+ message resizeImageIn {
32
+ string base64 = 1;
33
+ uint64 width = 2;
34
+ uint64 height = 3;
35
+ uint32 quality = 4;
36
+ uint32 subsampling = 5;
37
+ }
38
+
39
+ message pdfToImgIn {
40
+ string pdfPath = 1;
41
+ string imgPath = 2;
42
+ }
43
+
44
+ message pdfToImgOut {
45
+ string imgPath = 1;
46
+ }
47
+
48
+ message log_in {
49
+ uint32 rows = 1;
50
+ string level = 2;
51
+ }
52
+
53
+ message log_out {
54
+ repeated string logs = 1;
55
+ }
56
+
57
+ enum mergeImageFormat {
58
+ VERTICAL = 0;
59
+ HORIZONTAL = 1;
60
+ OVERLAY = 2;
61
+ }
62
+
63
+ message imageMeta {
64
+ string base64 = 1;
65
+ mergeImageFormat mergeFormat = 2;
66
+ }
67
+
68
+ message mergeImagesIn {
69
+ repeated string images = 1;
70
+ repeated imageMeta imagesMeta = 2;
71
+ string background = 3;
72
+ string mergeFormat = 4;
73
+ }
74
+
75
+ message docToPDFParams {
76
+ string base64 = 1;
77
+ string to = 2;
78
+ string ext = 3;
79
+ }
80
+
81
+ message shpToGeojsonParams {
82
+ string base64 = 1;
83
+ }
84
+
85
+ message geojsonToShpParams {
86
+ string geojson = 1;
87
+ string proj = 2;
88
+ }
89
+
90
+ message xmlToJsonParams {
91
+ string xml = 1;
92
+ }
93
+
94
+ message jsonToXlsParams {
95
+ string json = 1;
96
+ string header = 2;
97
+ string subheader = 3;
98
+ string colmodel = 4;
99
+ }
100
+
101
+ message csvToXlsParams {
102
+ string csv = 1;
103
+ string header = 2;
104
+ string subheader = 3;
105
+ string separator = 4;
106
+ }
107
+
108
+ message excelToJsonParams {
109
+ string base64 = 1;
110
+ string type = 2;
111
+ string delimiter = 3;
112
+ string encoding = 4;
113
+ }
114
+
115
+ message htmlToPdfParams {
116
+ string html = 1;
117
+ string pdfPageConfig = 2;
118
+ }
119
+
120
+ message pdfMergeParams {
121
+ repeated string mergeFiles = 1;
122
+ }
123
+
124
+ message htmlToImageParams {
125
+ string html = 1;
126
+ string format = 2;
127
+ uint64 width = 3;
128
+ uint64 height = 4;
129
+ }
130
+
131
+ message htmlToDocParams {
132
+ string html = 1;
133
+ }
134
+
135
+ message FileBase64 {
136
+ string result = 1;
137
+ }
@@ -0,0 +1,14 @@
1
+ syntax = "proto3";
2
+
3
+ service OfficeConverterService {
4
+ rpc OfficeToPdf(OfficeToPdfRequest) returns (OfficeToPdfResponse) {}
5
+ }
6
+
7
+ message OfficeToPdfRequest {
8
+ string file = 1;
9
+ string ext = 2;
10
+ }
11
+
12
+ message OfficeToPdfResponse {
13
+ string file = 1;
14
+ }
@@ -0,0 +1,7 @@
1
+ import hookList from "../hookList.js";
2
+ export default function addHook(name, fn) {
3
+ if (!hookList[name]) {
4
+ hookList[name] = [];
5
+ }
6
+ hookList[name].push(fn);
7
+ }
@@ -0,0 +1,25 @@
1
+ /* eslint-disable no-console */
2
+ import config from "../../../../config.js";
3
+ import hookList from "../hookList.js";
4
+ export default async function applyHook(name, data) {
5
+ const { trace } = config;
6
+ if (trace)
7
+ console.log("applyHook", name);
8
+ if (!hookList[name]?.length)
9
+ return null;
10
+ const result = {};
11
+ await Promise.all(hookList[name].map(async (hook) => {
12
+ const hookData = await hook({ ...data, config });
13
+ if (hookData) {
14
+ if (trace)
15
+ console.log("applyHook", name, hookData);
16
+ Object.assign(result, hookData);
17
+ }
18
+ })).catch((err) => {
19
+ console.error("applyHook", name, err.toString());
20
+ });
21
+ if (Object.keys(result).length) {
22
+ return result;
23
+ }
24
+ return null;
25
+ }
@@ -0,0 +1,7 @@
1
+ import hookList from "../hookList.js";
2
+ export default function applyHookSync(name, data) {
3
+ if (!hookList[name]?.length)
4
+ return null;
5
+ const hookData = hookList[name].map((hook) => hook(data))[0];
6
+ return hookData;
7
+ }
@@ -0,0 +1,7 @@
1
+ // import addHook from './funcs/addHook.js';
2
+ // import applyHook from './funcs/applyHook.js';
3
+ async function plugin() {
4
+ // fastify.decorate('addHook', addHook);
5
+ // fastify.decorate('applyHook', applyHook);
6
+ }
7
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ declare function plugin(): Promise<void>;
2
+ export default plugin;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/index.ts"],"names":[],"mappings":"AAEA,iBAAe,MAAM,kBAEpB;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ // import execMigrations from './funcs/exec.migrations.js';
2
+ async function plugin() {
3
+ // fastify.decorate('execMigrations', execMigrations);
4
+ }
5
+ export default plugin;
@@ -0,0 +1,19 @@
1
+ import { FastifyReply } from "fastify";
2
+ import { ExtendedRequest } from "../../../../types/core.js";
3
+ /**
4
+ * Генерація secret для двохфакторної авторизації користувача
5
+ *
6
+ * @method GET
7
+ * @summary Генерація user secret для двохфакторної авторизації
8
+ * @priority 3
9
+ * @alias generate
10
+ * @type api
11
+ * @tag auth
12
+ * @requires 2fa
13
+ * @errors 500
14
+ * @returns {Number} status Номер помилки
15
+ * @returns {String|Object} error Опис помилки
16
+ * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
17
+ */
18
+ export default function generateFunction({ pg, user }: ExtendedRequest, reply: FastifyReply): Promise<never>;
19
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D;;;;;;;;;;;;;;GAcG;AAEH,wBAA8B,gBAAgB,CAC5C,EAAE,EAAqB,EAAE,IAAS,EAAE,EAAE,eAAe,EACrD,KAAK,EAAE,YAAY,kBAqBpB"}
@@ -0,0 +1,38 @@
1
+ import config from "../../../../../config.js";
2
+ import pgClients from "../../../../plugins/pg/pgClients.js";
3
+ import { generate } from "./providers/totp.js";
4
+ /**
5
+ * Генерація secret для двохфакторної авторизації користувача
6
+ *
7
+ * @method GET
8
+ * @summary Генерація user secret для двохфакторної авторизації
9
+ * @priority 3
10
+ * @alias generate
11
+ * @type api
12
+ * @tag auth
13
+ * @requires 2fa
14
+ * @errors 500
15
+ * @returns {Number} status Номер помилки
16
+ * @returns {String|Object} error Опис помилки
17
+ * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
18
+ */
19
+ export default async function generateFunction({ pg = pgClients.client, user = {} }, reply) {
20
+ if (!user?.uid) {
21
+ return reply.status(401).send("unauthorized");
22
+ }
23
+ const { uid } = user;
24
+ if (!config?.auth?.["2factor"]) {
25
+ return reply.status(400).send("2fa not enabled");
26
+ }
27
+ if (!config.pg) {
28
+ return reply.status(400).send("empty pg");
29
+ }
30
+ if (!uid) {
31
+ return reply.status(401).send("access restricted: unauthorized");
32
+ }
33
+ const res = await generate({ pg, uid });
34
+ if (res?.enabled) {
35
+ return reply.status(400).send("already created 2fa");
36
+ }
37
+ return reply.status(200).send(res);
38
+ }
@@ -0,0 +1,18 @@
1
+ import { FastifyReply } from 'fastify';
2
+ /**
3
+ * Включення/виключення двохфакторної авторизації для користувача
4
+ *
5
+ * @method GET
6
+ * @summary Включення/виключення двохфакторної авторизації
7
+ * @priority 2
8
+ * @alias toggle
9
+ * @type api
10
+ * @tag auth
11
+ * @requires 2fa
12
+ * @errors 500
13
+ * @returns {Number} status Номер помилки
14
+ * @returns {String|Object} error Опис помилки
15
+ * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
16
+ */
17
+ export default function toggleFunction(req: any, reply: FastifyReply): Promise<never>;
18
+ //# sourceMappingURL=toggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC;;;;;;;;;;;;;;GAcG;AAEH,wBAA8B,cAAc,CAAC,GAAG,EAAC,GAAG,EAAE,KAAK,EAAC,YAAY,kBAyBvE"}
@@ -0,0 +1,39 @@
1
+ import config from '../../../../../config.js';
2
+ import pgClients from '../../../../plugins/pg/pgClients.js';
3
+ import { toggle } from './providers/totp.js';
4
+ /**
5
+ * Включення/виключення двохфакторної авторизації для користувача
6
+ *
7
+ * @method GET
8
+ * @summary Включення/виключення двохфакторної авторизації
9
+ * @priority 2
10
+ * @alias toggle
11
+ * @type api
12
+ * @tag auth
13
+ * @requires 2fa
14
+ * @errors 500
15
+ * @returns {Number} status Номер помилки
16
+ * @returns {String|Object} error Опис помилки
17
+ * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
18
+ */
19
+ export default async function toggleFunction(req, reply) {
20
+ const { pg = pgClients.client, session = {}, query = {}, } = req;
21
+ const { uid } = session?.passport?.user || {};
22
+ const { code, enable } = query;
23
+ if (!config.pg) {
24
+ return reply.status(400).send('empty pg');
25
+ }
26
+ if (!uid) {
27
+ return reply.status(401).send('access restricted: unauthorized');
28
+ }
29
+ if (!code) {
30
+ return reply.status(400).send('param "code" is required');
31
+ }
32
+ if (!Object.hasOwn(query, 'enable')) {
33
+ return reply.status(400).send('param "enable" is required');
34
+ }
35
+ const data = await toggle({
36
+ pg, code, enable: enable === 'true', uid,
37
+ });
38
+ return reply.status(200).send(data);
39
+ }
@@ -0,0 +1,22 @@
1
+ import config from "../../../../../config.js";
2
+ const { accessToken = "0NWcGQxKRP8AsRxD" } = config.auth || {};
3
+ /**
4
+ *
5
+ * @summary check user access to logger interface - per admin user type or user group
6
+ * @returns {Object} message, status
7
+ */
8
+ export default function checkUserAccess({ user = {}, token, }) {
9
+ if (token && token === accessToken) {
10
+ return { message: "access granted", status: 200 };
11
+ }
12
+ // console.log(user);
13
+ if (!user.user_type?.includes?.("admin") &&
14
+ !config?.local &&
15
+ !config.auth?.disable) {
16
+ return { message: "access restricted", status: 403 };
17
+ }
18
+ /* if (!['admin', 'superadmin']?.includes(user.user_type) && count === '0') {
19
+ return { message: 'access restricted', status: 403 };
20
+ } */
21
+ return { message: "access granted", status: 200 };
22
+ }
@@ -0,0 +1,25 @@
1
+ /* eslint-disable no-console */
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import config from "../../../../../config.js";
5
+ // import { existsSync } from 'fs';
6
+ let logDir = null;
7
+ export default function getRootDir() {
8
+ // absolute / relative path
9
+ if (logDir)
10
+ return logDir;
11
+ const file = ["config.json", "/data/local/config.json"].find((el) => fs.existsSync(el) ? el : null);
12
+ const root = file === "config.json" ? process.cwd() : "/data/local";
13
+ logDir = config.logDir || path.join(root, config.log?.dir || "log");
14
+ console.log({ logDir });
15
+ return logDir;
16
+ // windows debug support
17
+ /* const customLogDir = process.cwd().includes(':') ? 'c:/data/local' : '/data/local';
18
+ // docker default path
19
+ if (existsSync(customLogDir)) {
20
+ return path.join(customLogDir, config.folder || '', 'log');
21
+ }
22
+
23
+ // non-docker default path
24
+ return path.join(config.root || '/data/local', config.folder || '', 'log'); */
25
+ }
@@ -0,0 +1,10 @@
1
+ import createError from "@fastify/error";
2
+ export declare const NotFoundError: createError.FastifyErrorConstructor<{
3
+ code: "NOT_FOUND_ERROR";
4
+ statusCode: 404;
5
+ }, [any?, any?, any?]>;
6
+ export declare const BadRequestError: createError.FastifyErrorConstructor<{
7
+ code: "NOT_FOUND_ERROR";
8
+ statusCode: 400;
9
+ }, [any?, any?, any?]>;
10
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../server/types/errors.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,aAAa;;;sBAIzB,CAAC;AACF,eAAO,MAAM,eAAe;;;sBAI3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import createError from "@fastify/error";
2
+ export const NotFoundError = createError("NOT_FOUND_ERROR", "Resource not found: %s", 404);
3
+ export const BadRequestError = createError("NOT_FOUND_ERROR", "Bad request: %s", 400);
package/package.json CHANGED
@@ -1,98 +1,98 @@
1
- {
2
- "name": "@opengis/fastify-table",
3
- "version": "2.5.1",
4
- "type": "module",
5
- "description": "core-plugins",
6
- "keywords": [
7
- "fastify",
8
- "table",
9
- "crud",
10
- "auth",
11
- "pg",
12
- "backend"
13
- ],
14
- "main": "dist/index.js",
15
- "exports": {
16
- ".": "./dist/index.js",
17
- "./index.js": "./dist/index.js",
18
- "./errors.js": "./dist/errors.js",
19
- "./utils.js": "./dist/utils.js",
20
- "./package.json": "./package.json"
21
- },
22
- "files": [
23
- "dist/*"
24
- ],
25
- "scripts": {
26
- "dump": "bun ./script/dump.ts",
27
- "migrate": "bun ./script/migrate.ts",
28
- "dump1": "bun ./dist/script/dump.js",
29
- "migrate1": "bun ./dist/script/migrate.js",
30
- "prepublishOnly": "npm run build",
31
- "clean": "tsc -b --clean",
32
- "build": "tsc -b --clean && tsc && copyfiles server/plugins/grpc/utils/*.proto dist && copyfiles server/migrations/*.sql dist && copyfiles server/templates/**/*.html dist && copyfiles server/templates/**/*.hbs dist && copyfiles script/* dist && copyfiles -u 2 module/core/*/* dist/module/core",
33
- "prod": "NODE_ENV=production bun dist/server",
34
- "patch": "npm version patch && git push && npm publish",
35
- "minor": "npm version minor && git push && npm publish",
36
- "major": "npm version major && git push && npm publish",
37
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
38
- "test": "npx vitest run",
39
- "compress": "node compress.js",
40
- "dev1": "bun --hot dist/server",
41
- "dev": "NODE_ENV=development bun start",
42
- "start": "LOG_LEVEL=trace bun server",
43
- "start1": "npx tsx server"
44
- },
45
- "dependencies": {
46
- "@aws-sdk/client-s3": "3.1079.0",
47
- "@aws-sdk/lib-storage": "3.1079.0",
48
- "@fastify/cookie": "11.0.2",
49
- "@fastify/http-proxy": "11.5.0",
50
- "@fastify/multipart": "10.0.0",
51
- "@fastify/passport": "3.0.2",
52
- "@fastify/rate-limit": "11.1.0",
53
- "@fastify/session": "11.1.1",
54
- "@grpc/grpc-js": "1.14.4",
55
- "@grpc/proto-loader": "0.8.1",
56
- "apache-crypt": "1.2.6",
57
- "dotenv": "17.4.2",
58
- "fastify": "5.9.0",
59
- "fastify-plugin": "6.0.0",
60
- "fastify-session-redis-store": "7.1.2",
61
- "handlebars": "4.7.9",
62
- "image-size": "2.0.2",
63
- "ioredis": "5.11.1",
64
- "js-yaml": "5.2.1",
65
- "markdown-it": "14.3.0",
66
- "minio": "^8.0.7",
67
- "nodemailer": "9.0.3",
68
- "otplib": "13.4.1",
69
- "pg": "8.22.0",
70
- "pino": "10.3.1",
71
- "pino-abstract-transport": "3.0.0",
72
- "promised-handlebars": "2.0.1",
73
- "qrcode": "1.5.4",
74
- "sharp": "0.35.3",
75
- "uglify-js": "3.19.3",
76
- "undici": "8.6.0"
77
- },
78
- "devDependencies": {
79
- "@stylistic/eslint-plugin": "^5.10.0",
80
- "@types/bun": "^1.3.5",
81
- "@types/js-yaml": "^4.0.9",
82
- "@types/markdown-it": "^14.1.2",
83
- "@types/node": "^26.1.0",
84
- "@types/nodemailer": "^8.0.1",
85
- "@types/passport": "^1.0.17",
86
- "@types/passport-local": "^1.0.38",
87
- "@types/pg": "^8.20.0",
88
- "@types/qrcode": "^1.5.6",
89
- "copyfiles": "^2.4.1",
90
- "eslint": "^10.6.0",
91
- "eslint-stylistic-airbnb": "^3.2.0",
92
- "ts-migrate": "^0.1.35",
93
- "typescript": "^6.0.2",
94
- "vitest": "^4.1.2"
95
- },
96
- "author": "Softpro",
97
- "license": "ISC"
98
- }
1
+ {
2
+ "name": "@opengis/fastify-table",
3
+ "version": "2.5.2",
4
+ "type": "module",
5
+ "description": "core-plugins",
6
+ "keywords": [
7
+ "fastify",
8
+ "table",
9
+ "crud",
10
+ "auth",
11
+ "pg",
12
+ "backend"
13
+ ],
14
+ "main": "dist/index.js",
15
+ "exports": {
16
+ ".": "./dist/index.js",
17
+ "./index.js": "./dist/index.js",
18
+ "./errors.js": "./dist/errors.js",
19
+ "./utils.js": "./dist/utils.js",
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "dist/*"
24
+ ],
25
+ "scripts": {
26
+ "dump": "bun ./script/dump.ts",
27
+ "migrate": "bun ./script/migrate.ts",
28
+ "dump1": "bun ./dist/script/dump.js",
29
+ "migrate1": "bun ./dist/script/migrate.js",
30
+ "prepublishOnly": "npm run build",
31
+ "clean": "tsc -b --clean",
32
+ "build": "tsc -b --clean && tsc && copyfiles server/plugins/grpc/utils/*.proto dist && copyfiles server/migrations/*.sql dist && copyfiles server/templates/**/*.html dist && copyfiles server/templates/**/*.hbs dist && copyfiles script/* dist && copyfiles -u 2 module/core/*/* dist/module/core",
33
+ "prod": "NODE_ENV=production bun dist/server",
34
+ "patch": "npm version patch && git push && npm publish",
35
+ "minor": "npm version minor && git push && npm publish",
36
+ "major": "npm version major && git push && npm publish",
37
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
38
+ "test": "npx vitest run",
39
+ "compress": "node compress.js",
40
+ "dev1": "bun --hot dist/server",
41
+ "dev": "NODE_ENV=development bun start",
42
+ "start": "LOG_LEVEL=trace bun server",
43
+ "start1": "npx tsx server"
44
+ },
45
+ "dependencies": {
46
+ "@aws-sdk/client-s3": "3.1079.0",
47
+ "@aws-sdk/lib-storage": "3.1079.0",
48
+ "@fastify/cookie": "11.0.2",
49
+ "@fastify/http-proxy": "11.5.0",
50
+ "@fastify/multipart": "10.0.0",
51
+ "@fastify/passport": "3.0.2",
52
+ "@fastify/rate-limit": "11.1.0",
53
+ "@fastify/session": "11.1.1",
54
+ "@grpc/grpc-js": "1.14.4",
55
+ "@grpc/proto-loader": "0.8.1",
56
+ "apache-crypt": "1.2.6",
57
+ "dotenv": "17.4.2",
58
+ "fastify": "5.9.0",
59
+ "fastify-plugin": "6.0.0",
60
+ "fastify-session-redis-store": "7.1.2",
61
+ "handlebars": "4.7.9",
62
+ "image-size": "2.0.2",
63
+ "ioredis": "5.11.1",
64
+ "js-yaml": "5.2.1",
65
+ "markdown-it": "14.3.0",
66
+ "minio": "^8.0.7",
67
+ "nodemailer": "9.0.3",
68
+ "otplib": "13.4.1",
69
+ "pg": "8.22.0",
70
+ "pino": "10.3.1",
71
+ "pino-abstract-transport": "3.0.0",
72
+ "promised-handlebars": "2.0.1",
73
+ "qrcode": "1.5.4",
74
+ "sharp": "0.35.3",
75
+ "uglify-js": "3.19.3",
76
+ "undici": "8.6.0"
77
+ },
78
+ "devDependencies": {
79
+ "@stylistic/eslint-plugin": "^5.10.0",
80
+ "@types/bun": "^1.3.5",
81
+ "@types/js-yaml": "^4.0.9",
82
+ "@types/markdown-it": "^14.1.2",
83
+ "@types/node": "^26.1.0",
84
+ "@types/nodemailer": "^8.0.1",
85
+ "@types/passport": "^1.0.17",
86
+ "@types/passport-local": "^1.0.38",
87
+ "@types/pg": "^8.20.0",
88
+ "@types/qrcode": "^1.5.6",
89
+ "copyfiles": "^2.4.1",
90
+ "eslint": "^10.6.0",
91
+ "eslint-stylistic-airbnb": "^3.2.0",
92
+ "ts-migrate": "^0.1.35",
93
+ "typescript": "^6.0.2",
94
+ "vitest": "^4.1.2"
95
+ },
96
+ "author": "Softpro",
97
+ "license": "ISC"
98
+ }