@opengis/fcore 0.0.1-beta.0
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/LICENSE +3 -0
- package/README.md +72 -0
- package/dist/config.d.ts +79 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/context.d.ts +29 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +1 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +1 -0
- package/dist/fastify.d.ts +8 -0
- package/dist/fastify.d.ts.map +1 -0
- package/dist/fastify.js +1 -0
- package/dist/fcore.d.ts +13 -0
- package/dist/fcore.d.ts.map +1 -0
- package/dist/fcore.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/migrations/cli.d.ts +3 -0
- package/dist/migrations/cli.d.ts.map +1 -0
- package/dist/migrations/cli.js +2 -0
- package/dist/migrations/runner.d.ts +12 -0
- package/dist/migrations/runner.d.ts.map +1 -0
- package/dist/migrations/runner.js +1 -0
- package/dist/modules/auth/index.d.ts +9 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +1 -0
- package/dist/modules/auth/route.d.ts +7 -0
- package/dist/modules/auth/route.d.ts.map +1 -0
- package/dist/modules/auth/route.js +1 -0
- package/dist/modules/auth/schema.d.ts +15 -0
- package/dist/modules/auth/schema.d.ts.map +1 -0
- package/dist/modules/auth/schema.js +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts +8 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -0
- package/dist/modules/auth/services/get-current-user.js +1 -0
- package/dist/modules/auth/services/login.d.ts +10 -0
- package/dist/modules/auth/services/login.d.ts.map +1 -0
- package/dist/modules/auth/services/login.js +1 -0
- package/dist/modules/auth/services/logout.d.ts +9 -0
- package/dist/modules/auth/services/logout.d.ts.map +1 -0
- package/dist/modules/auth/services/logout.js +1 -0
- package/dist/modules/auth/services/verify-two-factor.d.ts +9 -0
- package/dist/modules/auth/services/verify-two-factor.d.ts.map +1 -0
- package/dist/modules/auth/services/verify-two-factor.js +1 -0
- package/dist/modules/auth/services/verifyPassword.d.ts +11 -0
- package/dist/modules/auth/services/verifyPassword.d.ts.map +1 -0
- package/dist/modules/auth/services/verifyPassword.js +1 -0
- package/dist/modules/file/index.d.ts +8 -0
- package/dist/modules/file/index.d.ts.map +1 -0
- package/dist/modules/file/index.js +1 -0
- package/dist/modules/file/route.d.ts +7 -0
- package/dist/modules/file/route.d.ts.map +1 -0
- package/dist/modules/file/route.js +1 -0
- package/dist/modules/file/schema.d.ts +30 -0
- package/dist/modules/file/schema.d.ts.map +1 -0
- package/dist/modules/file/schema.js +1 -0
- package/dist/modules/file/services/get-file.d.ts +8 -0
- package/dist/modules/file/services/get-file.d.ts.map +1 -0
- package/dist/modules/file/services/get-file.js +1 -0
- package/dist/modules/file/services/resize-file.d.ts +13 -0
- package/dist/modules/file/services/resize-file.d.ts.map +1 -0
- package/dist/modules/file/services/resize-file.js +1 -0
- package/dist/modules/file/services/upload-file.d.ts +16 -0
- package/dist/modules/file/services/upload-file.d.ts.map +1 -0
- package/dist/modules/file/services/upload-file.js +1 -0
- package/dist/modules/resource/index.d.ts +20 -0
- package/dist/modules/resource/index.d.ts.map +1 -0
- package/dist/modules/resource/index.js +1 -0
- package/dist/modules/resource/route.d.ts +7 -0
- package/dist/modules/resource/route.d.ts.map +1 -0
- package/dist/modules/resource/route.js +1 -0
- package/dist/modules/resource/schema.d.ts +67 -0
- package/dist/modules/resource/schema.d.ts.map +1 -0
- package/dist/modules/resource/schema.js +1 -0
- package/dist/modules/resource/services/add-note.d.ts +6 -0
- package/dist/modules/resource/services/add-note.d.ts.map +1 -0
- package/dist/modules/resource/services/add-note.js +1 -0
- package/dist/modules/resource/services/add-resource-file.d.ts +6 -0
- package/dist/modules/resource/services/add-resource-file.d.ts.map +1 -0
- package/dist/modules/resource/services/add-resource-file.js +1 -0
- package/dist/modules/resource/services/create-resource-relation.d.ts +6 -0
- package/dist/modules/resource/services/create-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/create-resource-relation.js +1 -0
- package/dist/modules/resource/services/create-resource.d.ts +6 -0
- package/dist/modules/resource/services/create-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/create-resource.js +1 -0
- package/dist/modules/resource/services/delete-resource-relation.d.ts +6 -0
- package/dist/modules/resource/services/delete-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/delete-resource-relation.js +1 -0
- package/dist/modules/resource/services/delete-resource.d.ts +6 -0
- package/dist/modules/resource/services/delete-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/delete-resource.js +1 -0
- package/dist/modules/resource/services/export-resource.d.ts +6 -0
- package/dist/modules/resource/services/export-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/export-resource.js +1 -0
- package/dist/modules/resource/services/get-resource.d.ts +6 -0
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/get-resource.js +1 -0
- package/dist/modules/resource/services/list-children.d.ts +6 -0
- package/dist/modules/resource/services/list-children.d.ts.map +1 -0
- package/dist/modules/resource/services/list-children.js +1 -0
- package/dist/modules/resource/services/list-resource-relation.d.ts +6 -0
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/list-resource-relation.js +1 -0
- package/dist/modules/resource/services/list-resources.d.ts +6 -0
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -0
- package/dist/modules/resource/services/list-resources.js +1 -0
- package/dist/modules/resource/services/search-resource.d.ts +6 -0
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/search-resource.js +1 -0
- package/dist/modules/resource/services/suggest-resource.d.ts +6 -0
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/suggest-resource.js +1 -0
- package/dist/modules/resource/services/update-resource.d.ts +6 -0
- package/dist/modules/resource/services/update-resource.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource.js +1 -0
- package/dist/modules/resource/services/upload-resource-file.d.ts +13 -0
- package/dist/modules/resource/services/upload-resource-file.d.ts.map +1 -0
- package/dist/modules/resource/services/upload-resource-file.js +1 -0
- package/dist/modules/system/index.d.ts +13 -0
- package/dist/modules/system/index.d.ts.map +1 -0
- package/dist/modules/system/index.js +1 -0
- package/dist/modules/system/route.d.ts +7 -0
- package/dist/modules/system/route.d.ts.map +1 -0
- package/dist/modules/system/route.js +1 -0
- package/dist/modules/system/schema.d.ts +14 -0
- package/dist/modules/system/schema.d.ts.map +1 -0
- package/dist/modules/system/schema.js +1 -0
- package/dist/modules/system/services/check-system.d.ts +8 -0
- package/dist/modules/system/services/check-system.d.ts.map +1 -0
- package/dist/modules/system/services/check-system.js +1 -0
- package/dist/modules/system/services/get-api-list.d.ts +8 -0
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -0
- package/dist/modules/system/services/get-api-list.js +1 -0
- package/dist/modules/system/services/get-audit-log.d.ts +10 -0
- package/dist/modules/system/services/get-audit-log.d.ts.map +1 -0
- package/dist/modules/system/services/get-audit-log.js +1 -0
- package/dist/modules/system/services/get-dictionary.d.ts +8 -0
- package/dist/modules/system/services/get-dictionary.d.ts.map +1 -0
- package/dist/modules/system/services/get-dictionary.js +1 -0
- package/dist/modules/system/services/get-system-log.d.ts +6 -0
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -0
- package/dist/modules/system/services/get-system-log.js +1 -0
- package/dist/modules/system/services/get-system-settings.d.ts +8 -0
- package/dist/modules/system/services/get-system-settings.d.ts.map +1 -0
- package/dist/modules/system/services/get-system-settings.js +1 -0
- package/dist/modules/system/services/list-dictionaries.d.ts +6 -0
- package/dist/modules/system/services/list-dictionaries.d.ts.map +1 -0
- package/dist/modules/system/services/list-dictionaries.js +1 -0
- package/dist/modules/system/services/update-system-settings.d.ts +11 -0
- package/dist/modules/system/services/update-system-settings.d.ts.map +1 -0
- package/dist/modules/system/services/update-system-settings.js +1 -0
- package/dist/modules/utils/get-user-permissions.d.ts +3 -0
- package/dist/modules/utils/get-user-permissions.d.ts.map +1 -0
- package/dist/modules/utils/get-user-permissions.js +1 -0
- package/dist/modules/utils/require-admin.d.ts +3 -0
- package/dist/modules/utils/require-admin.d.ts.map +1 -0
- package/dist/modules/utils/require-admin.js +1 -0
- package/dist/modules/utils/safe-user.d.ts +2 -0
- package/dist/modules/utils/safe-user.d.ts.map +1 -0
- package/dist/modules/utils/safe-user.js +1 -0
- package/dist/modules/utils/unsupported.d.ts +2 -0
- package/dist/modules/utils/unsupported.d.ts.map +1 -0
- package/dist/modules/utils/unsupported.js +1 -0
- package/dist/plugins/audit/audit.d.ts +11 -0
- package/dist/plugins/audit/audit.d.ts.map +1 -0
- package/dist/plugins/audit/audit.js +1 -0
- package/dist/plugins/audit/audit.types.d.ts +27 -0
- package/dist/plugins/audit/audit.types.d.ts.map +1 -0
- package/dist/plugins/audit/audit.types.js +1 -0
- package/dist/plugins/audit/index.d.ts +6 -0
- package/dist/plugins/audit/index.d.ts.map +1 -0
- package/dist/plugins/audit/index.js +1 -0
- package/dist/plugins/audit/services/write-audit.d.ts +11 -0
- package/dist/plugins/audit/services/write-audit.d.ts.map +1 -0
- package/dist/plugins/audit/services/write-audit.js +1 -0
- package/dist/plugins/auth/auth.types.d.ts +16 -0
- package/dist/plugins/auth/auth.types.d.ts.map +1 -0
- package/dist/plugins/auth/auth.types.js +1 -0
- package/dist/plugins/auth/index.d.ts +5 -0
- package/dist/plugins/auth/index.d.ts.map +1 -0
- package/dist/plugins/auth/index.js +1 -0
- package/dist/plugins/dictionary.d.ts +30 -0
- package/dist/plugins/dictionary.d.ts.map +1 -0
- package/dist/plugins/dictionary.js +1 -0
- package/dist/plugins/file.d.ts +30 -0
- package/dist/plugins/file.d.ts.map +1 -0
- package/dist/plugins/file.js +1 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/logger/checkUserAccess.d.ts +11 -0
- package/dist/plugins/logger/checkUserAccess.d.ts.map +1 -0
- package/dist/plugins/logger/checkUserAccess.js +1 -0
- package/dist/plugins/logger/createFileStream.d.ts +3 -0
- package/dist/plugins/logger/createFileStream.d.ts.map +1 -0
- package/dist/plugins/logger/createFileStream.js +1 -0
- package/dist/plugins/logger/createLogger.d.ts +9 -0
- package/dist/plugins/logger/createLogger.d.ts.map +1 -0
- package/dist/plugins/logger/createLogger.js +1 -0
- package/dist/plugins/logger/errorStatus.d.ts +2 -0
- package/dist/plugins/logger/errorStatus.d.ts.map +1 -0
- package/dist/plugins/logger/errorStatus.js +1 -0
- package/dist/plugins/logger/getHooks.d.ts +5 -0
- package/dist/plugins/logger/getHooks.d.ts.map +1 -0
- package/dist/plugins/logger/getHooks.js +1 -0
- package/dist/plugins/logger/getRootDir.d.ts +3 -0
- package/dist/plugins/logger/getRootDir.d.ts.map +1 -0
- package/dist/plugins/logger/getRootDir.js +1 -0
- package/dist/plugins/logger/index.d.ts +5 -0
- package/dist/plugins/logger/index.d.ts.map +1 -0
- package/dist/plugins/logger/index.js +1 -0
- package/dist/plugins/logger/labels.d.ts +3 -0
- package/dist/plugins/logger/labels.d.ts.map +1 -0
- package/dist/plugins/logger/labels.js +1 -0
- package/dist/plugins/logger/serializers.d.ts +14 -0
- package/dist/plugins/logger/serializers.d.ts.map +1 -0
- package/dist/plugins/logger/serializers.js +1 -0
- package/dist/plugins/logger/timestampWithTimeZone.d.ts +2 -0
- package/dist/plugins/logger/timestampWithTimeZone.d.ts.map +1 -0
- package/dist/plugins/logger/timestampWithTimeZone.js +1 -0
- package/dist/plugins/pg.d.ts +15 -0
- package/dist/plugins/pg.d.ts.map +1 -0
- package/dist/plugins/pg.js +1 -0
- package/dist/plugins/redis.d.ts +19 -0
- package/dist/plugins/redis.d.ts.map +1 -0
- package/dist/plugins/redis.js +1 -0
- package/dist/plugins/resource/index.d.ts +7 -0
- package/dist/plugins/resource/index.d.ts.map +1 -0
- package/dist/plugins/resource/index.js +1 -0
- package/dist/plugins/resource/resource.d.ts +3 -0
- package/dist/plugins/resource/resource.d.ts.map +1 -0
- package/dist/plugins/resource/resource.js +1 -0
- package/dist/plugins/resource/resource.registry.d.ts +10 -0
- package/dist/plugins/resource/resource.registry.d.ts.map +1 -0
- package/dist/plugins/resource/resource.registry.js +1 -0
- package/dist/plugins/resource/resource.types.d.ts +98 -0
- package/dist/plugins/resource/resource.types.d.ts.map +1 -0
- package/dist/plugins/resource/resource.types.js +1 -0
- package/dist/plugins/resource/services/create.d.ts +8 -0
- package/dist/plugins/resource/services/create.d.ts.map +1 -0
- package/dist/plugins/resource/services/create.js +1 -0
- package/dist/plugins/resource/services/delete.d.ts +11 -0
- package/dist/plugins/resource/services/delete.d.ts.map +1 -0
- package/dist/plugins/resource/services/delete.js +1 -0
- package/dist/plugins/resource/services/find-one.d.ts +11 -0
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -0
- package/dist/plugins/resource/services/find-one.js +1 -0
- package/dist/plugins/resource/services/find.d.ts +8 -0
- package/dist/plugins/resource/services/find.d.ts.map +1 -0
- package/dist/plugins/resource/services/find.js +1 -0
- package/dist/plugins/resource/services/update.d.ts +9 -0
- package/dist/plugins/resource/services/update.d.ts.map +1 -0
- package/dist/plugins/resource/services/update.js +1 -0
- package/dist/plugins/resource/utils/fields.d.ts +5 -0
- package/dist/plugins/resource/utils/fields.d.ts.map +1 -0
- package/dist/plugins/resource/utils/fields.js +1 -0
- package/dist/plugins/resource/utils/filters.d.ts +9 -0
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -0
- package/dist/plugins/resource/utils/filters.js +1 -0
- package/dist/plugins/resource/utils/permissions.d.ts +3 -0
- package/dist/plugins/resource/utils/permissions.d.ts.map +1 -0
- package/dist/plugins/resource/utils/permissions.js +1 -0
- package/dist/plugins/resource/utils/sort.d.ts +6 -0
- package/dist/plugins/resource/utils/sort.d.ts.map +1 -0
- package/dist/plugins/resource/utils/sort.js +1 -0
- package/dist/plugins/resource/utils/sql.d.ts +14 -0
- package/dist/plugins/resource/utils/sql.d.ts.map +1 -0
- package/dist/plugins/resource/utils/sql.js +1 -0
- package/dist/shared/getIP.d.ts +3 -0
- package/dist/shared/getIP.d.ts.map +1 -0
- package/dist/shared/getIP.js +1 -0
- package/package.json +87 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @opengis/fcore
|
|
2
|
+
|
|
3
|
+
Reusable backend foundation for OpenGIS Node.js applications: config, typed application context, PostgreSQL, Redis, S3 file storage, audit, trusted Resource CRUD, Core modules, Fastify integration and SQL migration runner.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @opengis/fcore
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Bootstrap
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createFCore } from '@opengis/fcore';
|
|
15
|
+
import resources from './resources/index.js';
|
|
16
|
+
|
|
17
|
+
export const ctx = await createFCore({ resources });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import Fastify from 'fastify';
|
|
22
|
+
import fcoreFastify from '@opengis/fcore/fastify';
|
|
23
|
+
import { ctx } from './app.js';
|
|
24
|
+
|
|
25
|
+
const app = Fastify();
|
|
26
|
+
await app.register(fcoreFastify, { ctx });
|
|
27
|
+
await app.listen({ port: ctx.config.port });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Resource
|
|
31
|
+
|
|
32
|
+
All dynamic table/column identifiers come from registered `ResourceContract` metadata. Values are SQL parameters.
|
|
33
|
+
|
|
34
|
+
## Migrations
|
|
35
|
+
|
|
36
|
+
Project SQL files stay in `./migrations`. Build the package/application, then run `fcore-migrate` or import `runMigrations()`.
|
|
37
|
+
|
|
38
|
+
## Module service convention
|
|
39
|
+
|
|
40
|
+
Module services are plain async functions with the canonical `service(params, ctx)` signature. `ctx` is passed explicitly from `fastify.ts` to each module `route.ts`; there is no `service.ts` or `createService()` factory.
|
|
41
|
+
|
|
42
|
+
## Structure
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
@opengis/fcore
|
|
46
|
+
├── src/
|
|
47
|
+
│ ├── plugins/
|
|
48
|
+
│ │ ├── logger/
|
|
49
|
+
│ │ ├── redis/
|
|
50
|
+
│ │ ├── pg/
|
|
51
|
+
│ │ ├── file/
|
|
52
|
+
│ │ ├── audit/
|
|
53
|
+
│ │ └── resource/
|
|
54
|
+
│ ├── modules/
|
|
55
|
+
│ │ ├── auth/
|
|
56
|
+
│ │ ├── access/
|
|
57
|
+
│ │ ├── resource/
|
|
58
|
+
│ │ ├── file/
|
|
59
|
+
│ │ ├── template/
|
|
60
|
+
│ │ └── system/
|
|
61
|
+
│ ├── migrations/
|
|
62
|
+
│ ├── config.ts # loadConfig
|
|
63
|
+
│ ├── context.ts # createContext, set, get
|
|
64
|
+
│ ├── errors.ts # standard Errors
|
|
65
|
+
│ ├── fastify.ts # fastify Plugins
|
|
66
|
+
│ ├── fcore.ts # createFcore
|
|
67
|
+
│ └── index.ts # export type, methods, etc
|
|
68
|
+
├── test/
|
|
69
|
+
├── engineering/
|
|
70
|
+
├── package.json
|
|
71
|
+
└── tsconfig.json
|
|
72
|
+
```
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads and exposes validated FCore runtime configuration.
|
|
3
|
+
*/
|
|
4
|
+
import "dotenv/config";
|
|
5
|
+
import { User } from "./context.js";
|
|
6
|
+
type sameSiteStringOptions = "lax" | "strict" | "none";
|
|
7
|
+
export interface FCoreConfig {
|
|
8
|
+
env: string;
|
|
9
|
+
port: number;
|
|
10
|
+
maxFileSize: number;
|
|
11
|
+
storagePath: string;
|
|
12
|
+
rateLimit: {
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
max: number;
|
|
15
|
+
timeWindow: number;
|
|
16
|
+
};
|
|
17
|
+
redactionList: string[];
|
|
18
|
+
logger: {
|
|
19
|
+
level: "debug" | "info" | "warn" | "error";
|
|
20
|
+
directory?: string;
|
|
21
|
+
responses?: boolean;
|
|
22
|
+
responseCodes?: number[];
|
|
23
|
+
};
|
|
24
|
+
pg: {
|
|
25
|
+
host: string;
|
|
26
|
+
port: number;
|
|
27
|
+
database: string;
|
|
28
|
+
user: string;
|
|
29
|
+
password: string;
|
|
30
|
+
max?: number;
|
|
31
|
+
};
|
|
32
|
+
redis: {
|
|
33
|
+
host: string;
|
|
34
|
+
port: number;
|
|
35
|
+
password?: string;
|
|
36
|
+
db?: number;
|
|
37
|
+
lazyConnect?: boolean;
|
|
38
|
+
};
|
|
39
|
+
s3: {
|
|
40
|
+
endpoint?: string;
|
|
41
|
+
region: string;
|
|
42
|
+
bucket: string;
|
|
43
|
+
accessKey?: string;
|
|
44
|
+
secretKey?: string;
|
|
45
|
+
folder?: string;
|
|
46
|
+
forcePathStyle?: boolean;
|
|
47
|
+
tokenSecret?: string;
|
|
48
|
+
tokenTtl?: number;
|
|
49
|
+
};
|
|
50
|
+
auth: {
|
|
51
|
+
user: User;
|
|
52
|
+
secret: string;
|
|
53
|
+
accessToken: string;
|
|
54
|
+
sessionTimeout: number;
|
|
55
|
+
cookieName: string;
|
|
56
|
+
jwtSecret: string;
|
|
57
|
+
link?: {
|
|
58
|
+
base: {
|
|
59
|
+
login: string;
|
|
60
|
+
afterLogin?: string;
|
|
61
|
+
};
|
|
62
|
+
twoFactor?: {
|
|
63
|
+
login: string;
|
|
64
|
+
afterLogin?: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
cookieOptions: {
|
|
68
|
+
domain?: string;
|
|
69
|
+
path?: string;
|
|
70
|
+
httpOnly?: boolean;
|
|
71
|
+
secure?: boolean;
|
|
72
|
+
sameSite?: boolean | sameSiteStringOptions;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
declare function required(name: string): string;
|
|
77
|
+
export declare function loadConfig(overrides?: Partial<FCoreConfig>): FCoreConfig;
|
|
78
|
+
export { required as requireEnv };
|
|
79
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,KAAK,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAIvD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE;QACN,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,EAAE,EAAE;QACF,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,EAAE,EAAE;QACF,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE;YACL,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAM,CAAC;gBACd,UAAU,CAAC,EAAE,MAAM,CAAC;aACrB,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,KAAK,EAAE,MAAM,CAAC;gBACd,UAAU,CAAC,EAAE,MAAM,CAAC;aACrB,CAAC;SACH,CAAC;QACF,aAAa,EAAE;YACb,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,qBAAqB,CAAC;SAC5C,CAAC;KACH,CAAC;CACH;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAItC;AAED,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAqG5E;AACD,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function b(n,a){n=n-0x92;const E=I();let M=E[n];return M;}function I(){const bm=['2871246slMKmu','JAiiN','/log','369440wnAolC','HeUou','121546uIMJiB','kNDuj','paWLY','YjtQE','URMTZ','cwd','39353xfAkWH','LtkwO','iVRVi','httpOnly','bgkjS','cdNTt','path','password','cvCfV','us-east-1','./storage','split','654350ukrOtm','none','qsyZA','localhost','0ua4b1Tz21m47z13U3EO0uN9e0WE7hqRFbcZ72cbdWqZBzemf9cAU865xan1s81TdNpUKKfF','secure','KQgiH','development','true','strict','748134ZMgHDU','Ch7QR4e73Jg0wx0xOjm','sameSite','session_user_auth','parse','/login','xiEyF','false','/2factor','Missing\x20environment\x20variable:\x20','map','hNZgV','lax','logger','VlPwJ','includes','1166502ZFvbQa','info','AhQSu','auth','redis','uAVFr','x5y30KBsEKCENT04tu6549Vxx3No1ztJ2q2K8r79S59420RaZ5'];I=function(){return bm;};return I();}(function(n,a){const bl=b,E=n();while(!![]){try{const M=-parseInt(bl(0xb3))/0x1+-parseInt(bl(0xad))/0x2+parseInt(bl(0xc9))/0x3+parseInt(bl(0xab))/0x4+parseInt(bl(0xbf))/0x5+parseInt(bl(0xa1))/0x6+-parseInt(bl(0xa8))/0x7;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x26431));import'dotenv/config';const DEFAULT_LOG_RESPONSE_STATUS_CODES=[0x193,0x199,0x19d,0x19f,0x1ad];function required(n){const bP=b,a=process.env[n];if(!a)throw new Error(bP(0x9a)+n);return a;}export function loadConfig(E={}){const bJ=b,M={'VlPwJ':bJ(0xc6),'HeUou':bJ(0x98),'cdNTt':bJ(0xba),'cvCfV':function(u,Y){return u===Y;},'xiEyF':bJ(0xc2),'YjtQE':function(u,Y){return u(Y);},'AhQSu':function(u,Y){return u(Y);},'paWLY':function(u,Y){return u!==Y;},'JAiiN':bJ(0xa7),'LtkwO':bJ(0x94),'qsyZA':bJ(0xc3),'iVRVi':bJ(0x96),'kNDuj':bJ(0x99),'hNZgV':function(u,Y){return u(Y);},'URMTZ':bJ(0xc7),'uAVFr':bJ(0x9d),'KQgiH':bJ(0xc8),'bgkjS':bJ(0xc0)},X={};X[bJ(0xb9)]='/',X[bJ(0xb6)]=!![],X[bJ(0xc4)]=![],X[bJ(0x93)]=!![];const G={'env':process.env.NODE_ENV??M[bJ(0x9f)],'port':Number(process.env.PORT??0xbb8),'maxFileSize':+(process.env.MAX_FILE_SIZE||0x200),'rateLimit':{'disabled':process.env.RATE_LIMIT===M[bJ(0xac)],'max':+(process.env.RATE_LIMIT_MAX||0x64),'timeWindow':+(process.env.RATE_LIMIT_TIME_WINDOW||0xea60)},'storagePath':process.env.STORAGE_PATH??bJ(0xbd),'redactionList':(process.env.REDACTION_LIST||M[bJ(0xb8)])[bJ(0xbe)](','),'logger':{'level':process.env.LOG_LEVEL??bJ(0xa2),'responses':M[bJ(0xbb)](process.env.LOG_RESPONSES,bJ(0xc7))?!![]:![],'responseCodes':process.env.LOG_RESPONSE_STATUS_CODES?process.env.LOG_RESPONSE_STATUS_CODES[bJ(0xbe)](',')[bJ(0x9b)](u=>u-0x0):DEFAULT_LOG_RESPONSE_STATUS_CODES,'directory':process.env.LOG_DIRECTORY||process[bJ(0xb2)]()+bJ(0xaa)},'pg':{'host':process.env.PG_HOST??M[bJ(0x97)],'port':M[bJ(0xb0)](Number,process.env.PG_PORT??0x1538),'database':process.env.PG_DATABASE??'','user':process.env.PG_USER??'','password':process.env.PG_PASSWORD??''},'redis':{'host':process.env.REDIS_HOST??'','port':M[bJ(0xb0)](Number,process.env.REDIS_PORT??0x18eb),'password':process.env.REDIS_PASSWORD,'lazyConnect':!![],'db':process.env.REDIS_DB?M[bJ(0xa3)](Number,process.env.REDIS_DB):undefined},'s3':{'endpoint':process.env.S3_ENDPOINT,'region':process.env.S3_REGION??bJ(0xbc),'bucket':process.env.S3_BUCKET??'','accessKey':process.env.S3_ACCESS_KEY,'secretKey':process.env.S3_SECRET_KEY,'folder':process.env.S3_FOLDER,'forcePathStyle':M[bJ(0xaf)](process.env.S3_FORCE_PATH_STYLE,bJ(0x98)),'tokenSecret':process.env.FILE_TOKEN_SECRET,'tokenTtl':M[bJ(0xa3)](Number,process.env.FILE_TOKEN_TTL??0xe10)},'auth':{'accessToken':process.env.AUTH_ACCESS_TOKEN||bJ(0x92),'user':process.env.AUTH_USER?JSON[bJ(0x95)](process.env.AUTH_USER):undefined,'sessionTimeout':+(process.env.AUTH_SESSION_TIMEOUT||0x258),'secret':process.env.AUTH_SECRET??M[bJ(0xa9)],'cookieName':process.env.AUTH_COOKIE_NAME??M[bJ(0xb4)],'jwtSecret':process.env.AUTH_JWT_SECRET??M[bJ(0xc1)],'link':{'base':{'login':process.env.AUTH_BASE_LINK_LOGIN??M[bJ(0xb5)],'afterLogin':process.env.AUTH_BASE_LINK_LOGIN??'/'},'twoFactor':{'login':process.env.AUTH_TWOFACTOR_LINK_LOGIN??M[bJ(0xae)],'afterLogin':process.env.AUTH_TWOFACTOR_LINK_LOGIN??'/'}},'cookieOptions':process.env.AUTH_COOKIE_OPTIONS_DOMAIN?{'domain':process.env.AUTH_COOKIE_OPTIONS_DOMAIN,'path':process.env.AUTH_COOKIE_OPTIONS_PATH||'/','httpOnly':M[bJ(0x9c)](Boolean,process.env.AUTH_COOKIE_OPTIONS_HTTP_ONLY||bJ(0xc7)),'secure':M[bJ(0xb0)](Boolean,process.env.AUTH_COOKIE_OPTIONS_SECURE||M[bJ(0xb1)]),'sameSite':process.env.AUTH_COOKIE_OPTIONS_SAME_SITE&&[M[bJ(0xa6)],M[bJ(0xc5)],M[bJ(0xb7)]][bJ(0xa0)](process.env.AUTH_COOKIE_OPTIONS_SAME_SITE)?process.env.AUTH_COOKIE_OPTIONS_SAME_SITE:Boolean(process.env.AUTH_COOKIE_OPTIONS_SAME_SITE||bJ(0xc7))}:X}},j={...G,...E};return j[bJ(0x9e)]={...G[bJ(0x9e)],...E[bJ(0x9e)]},j['pg']={...G['pg'],...E['pg']},j[bJ(0xa5)]={...G[bJ(0xa5)],...E[bJ(0xa5)]},j['s3']={...G['s3'],...E['s3']},j[bJ(0xa4)]={...G[bJ(0xa4)],...E[bJ(0xa4)]},j;}export{required as requireEnv};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the typed dependency context shared by FCore routes and services.
|
|
3
|
+
*/
|
|
4
|
+
import type { FCoreConfig } from "./config.js";
|
|
5
|
+
import type { ExtendedLogger } from "./plugins/logger/index.js";
|
|
6
|
+
import type { RedisAdapter } from "./plugins/redis.js";
|
|
7
|
+
import type { DatabaseAdapter } from "./plugins/pg.js";
|
|
8
|
+
import type { FileAdapter } from "./plugins/file.js";
|
|
9
|
+
import type { ResourcePlugin } from "./plugins/resource/index.js";
|
|
10
|
+
import type { AuditPlugin } from "./plugins/audit/index.js";
|
|
11
|
+
import type { DictionaryPlugin } from "./plugins/dictionary.js";
|
|
12
|
+
import { AuthUser } from "./plugins/auth/auth.types.js";
|
|
13
|
+
export type User = AuthUser;
|
|
14
|
+
export interface AppContext {
|
|
15
|
+
config: FCoreConfig;
|
|
16
|
+
logger: ExtendedLogger;
|
|
17
|
+
redis: RedisAdapter;
|
|
18
|
+
pg: DatabaseAdapter | null;
|
|
19
|
+
file: FileAdapter | null;
|
|
20
|
+
resource: ResourcePlugin;
|
|
21
|
+
audit: AuditPlugin;
|
|
22
|
+
dictionary: DictionaryPlugin;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export type ContextDependencies = Omit<AppContext, "close">;
|
|
26
|
+
export declare function setContext(context: AppContext): void;
|
|
27
|
+
export declare function getContext(): AppContext;
|
|
28
|
+
export declare function createContext(deps: ContextDependencies): AppContext;
|
|
29
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC;AAE5B,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,EAAE,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAI5D,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAEpD;AAED,wBAAgB,UAAU,IAAI,UAAU,CAKvC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,UAAU,CAOnE"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function I(){const e=['744828hCoOzv','allSettled','100PrYrHD','22147038WXwlWZ','6lBepBz','redis','1112216KWIiNv','243108PEOnqI','end','4867723pLXNar','967193syELwL','Application\x20context\x20is\x20not\x20initialized','QWkeR','1061438ceIntH','close'];I=function(){return e;};return I();}(function(n,a){const u=b,E=n();while(!![]){try{const M=parseInt(u(0x95))/0x1+parseInt(u(0x89))/0x2+-parseInt(u(0x8f))/0x3*(-parseInt(u(0x8b))/0x4)+parseInt(u(0x8d))/0x5*(parseInt(u(0x92))/0x6)+parseInt(u(0x94))/0x7+-parseInt(u(0x91))/0x8+-parseInt(u(0x8e))/0x9;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0xbd84a));let defaultContext;export function setContext(n){defaultContext=n;}export function getContext(){const Y=b,a={};a[Y(0x88)]=Y(0x96);const E=a;if(!defaultContext)throw new Error(E[Y(0x88)]);return defaultContext;}function b(n,a){n=n-0x88;const E=I();let M=E[n];return M;}export function createContext(n){return{...n,async 'close'(){const g=b;await Promise[g(0x8c)]([n[g(0x90)]?.[g(0x8a)](),n['pg']?.[g(0x93)]()]);}};}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines shared error types used across FCore infrastructure and HTTP modules.
|
|
3
|
+
*/
|
|
4
|
+
export declare class FCoreError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly statusCode: number;
|
|
7
|
+
readonly details?: unknown;
|
|
8
|
+
constructor(code: string, message: string, statusCode?: number, details?: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare class BadRequestError extends FCoreError {
|
|
11
|
+
constructor(message: string, details?: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare class UnauthorizedError extends FCoreError {
|
|
14
|
+
constructor(message?: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class ForbiddenError extends FCoreError {
|
|
17
|
+
constructor(message?: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class NotFoundError extends FCoreError {
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
export declare class ConflictError extends FCoreError {
|
|
23
|
+
constructor(message?: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class ValidationError extends FCoreError {
|
|
26
|
+
constructor(message: string, details?: unknown);
|
|
27
|
+
}
|
|
28
|
+
export declare class UnsupportedError extends FCoreError {
|
|
29
|
+
constructor(message?: string);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;aAEjB,IAAI,EAAE,MAAM;aAEZ,UAAU;aACV,OAAO,CAAC,EAAE,OAAO;IAJnC,YACkB,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACC,UAAU,SAAM,EAChB,OAAO,CAAC,EAAE,OAAO,EAIlC;CACF;AACD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAE7C;CACF;AACD,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,YAAY,OAAO,SAA4B,EAE9C;CACF;AACD,qBAAa,cAAe,SAAQ,UAAU;IAC5C,YAAY,OAAO,SAAkB,EAEpC;CACF;AACD,qBAAa,aAAc,SAAQ,UAAU;IAC3C,YAAY,OAAO,SAAc,EAEhC;CACF;AACD,qBAAa,aAAc,SAAQ,UAAU;IAC3C,YAAY,OAAO,SAAa,EAE/B;CACF;AACD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAE7C;CACF;AACD,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C,YAAY,OAAO,SAAgC,EAElD;CACF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j=b;(function(n,a){var G=b,E=n();while(!![]){try{var M=parseInt(G(0xd2))/0x1*(parseInt(G(0xd1))/0x2)+parseInt(G(0xdc))/0x3+parseInt(G(0xe1))/0x4+-parseInt(G(0xd5))/0x5+-parseInt(G(0xc5))/0x6*(parseInt(G(0xc4))/0x7)+parseInt(G(0xcb))/0x8+-parseInt(G(0xcc))/0x9*(parseInt(G(0xd8))/0xa);if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x544b0));function b(n,a){n=n-0xc4;var E=I();var M=E[n];return M;}export class FCoreError extends Error{[j(0xd6)];[j(0xd9)];[j(0xce)];constructor(n,a,E=0x1f4,M){var u=j;super(a),this[u(0xd6)]=n,this[u(0xd9)]=E,this[u(0xce)]=M,this[u(0xe3)]=new.target.name;}}export class BadRequestError extends FCoreError{constructor(n,a){var Y=j;super(Y(0xc7),n,0x190,a);}}export class UnauthorizedError extends FCoreError{constructor(a=j(0xcd)){var g=j,E={};E[g(0xcf)]=g(0xdd);var M=E;super(M[g(0xcf)],a,0x191);}}export class ForbiddenError extends FCoreError{constructor(a=j(0xc8)){var e=j,E={};E[e(0xc9)]=e(0xc6);var M=E;super(M[e(0xc9)],a,0x193);}}export class NotFoundError extends FCoreError{constructor(a=j(0xdb)){var h=j,E={};E[h(0xde)]=h(0xd0);var M=E;super(M[h(0xde)],a,0x194);}}export class ConflictError extends FCoreError{constructor(a=j(0xd3)){var Z=j,E={};E[Z(0xe2)]=Z(0xda);var M=E;super(M[Z(0xe2)],a,0x199);}}export class ValidationError extends FCoreError{constructor(a,E){var H=j,M={};M[H(0xe0)]=H(0xd7);var X=M;super(X[H(0xe0)],a,0x1a6,E);}}export class UnsupportedError extends FCoreError{constructor(a=j(0xdf)){var t=j,E={};E[t(0xd4)]=t(0xca);var M=E;super(M[t(0xd4)],a,0x1f5);}}function I(){var B=['CONFLICT','Not\x20found','1795470gVdeuv','UNAUTHORIZED','tkWnD','Operation\x20is\x20not\x20configured','CTrMo','2021084ijnInE','Pzoad','name','7287sbnOPg','246MIQRSt','FORBIDDEN','BAD_REQUEST_ERROR','Access\x20denied','WuTQZ','UNSUPPORTED','2718936JYcUzo','63CewVum','Authentication\x20required','details','OcXCL','NOT_FOUND','9466ofzPEu','92MSzhEy','Conflict','ztnrq','3384290tZlpXH','code','VALIDATION_ERROR','1163230Bymmsa','statusCode'];I=function(){return B;};return I();}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FastifyPluginAsync } from "fastify";
|
|
2
|
+
import type { AppContext } from "./context.js";
|
|
3
|
+
export interface FCoreFastifyOptions {
|
|
4
|
+
ctx: AppContext;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: FastifyPluginAsync<FCoreFastifyOptions>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=fastify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,UAAU,CAAC;CACjB"}
|
package/dist/fastify.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const q=b;(function(n,a){const D=b,E=n();while(!![]){try{const M=-parseInt(D(0x180))/0x1*(-parseInt(D(0x17a))/0x2)+parseInt(D(0x173))/0x3+parseInt(D(0x194))/0x4+parseInt(D(0x17e))/0x5*(-parseInt(D(0x186))/0x6)+parseInt(D(0x188))/0x7*(-parseInt(D(0x187))/0x8)+-parseInt(D(0x17f))/0x9*(parseInt(D(0x174))/0xa)+parseInt(D(0x185))/0xb;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x6b862));import x from'fastify-plugin';function I(){const K=['statusCode','FST_ERR_VALIDATION','true','195SREDFO','9XDFAVU','463902KyBWuQ','lpLrF','ttVAw','TTdwg','message','17258274NPUBYy','60678zRDJFF','2035408qeGIUp','21MSwOHr','error','iBvIL','details','setErrorHandler','logger','test','code','name','kfTta','WpXvn','decorate','645568amjUsB','ctx','INTERNAL_ERROR','@opengis/fcore','send','343914XUnGry','7107630gPfLbM','IbrJe','register','Internal\x20server\x20error','jJfmg','WLkMq','2JgNTUk'];I=function(){return K;};return I();}import{FCoreError}from'./errors.js';import{authRoutes}from'./modules/auth/index.js';import{fileRoutes}from'./modules/file/index.js';import{resourceRoutes}from'./modules/resource/index.js';import{systemRoutes}from'./modules/system/index.js';import{createSessionStore}from'./plugins/auth/index.js';const plugin=async(n,{ctx:a})=>{const L=b,E={'WLkMq':function(M,X){return M instanceof X;},'TTdwg':function(M,X){return M===X;},'jJfmg':L(0x17c),'lpLrF':L(0x17d),'iBvIL':L(0x18e),'ttVAw':L(0x177),'kfTta':L(0x16f),'IbrJe':function(M,X,G){return M(X,G);},'WpXvn':function(M,X){return M(X);}};n[L(0x193)](E[L(0x191)],a),await E[L(0x175)](createSessionStore,n,a),n[L(0x18c)]((M,X,G)=>{const O=L;if(E[O(0x179)](M,FCoreError)||E[O(0x183)](M[O(0x18f)],E[O(0x178)]))return G[O(0x18f)](M[O(0x17b)])[O(0x172)]({'error':M[O(0x18f)],'message':M[O(0x184)],'details':M[O(0x18b)]});a[O(0x18d)][O(0x189)](M);(E[O(0x183)](process.env.trace,E[O(0x181)])||process.env.NODE_ENV===E[O(0x18a)]||process.env.VITEST)&&console[O(0x189)](M);const j={};return j[O(0x189)]=O(0x170),j[O(0x184)]=E[O(0x182)],G[O(0x18f)](0x1f4)[O(0x172)](j);}),await n[L(0x176)](E[L(0x192)](authRoutes,a)),await n[L(0x176)](resourceRoutes(a)),await n[L(0x176)](fileRoutes(a)),await n[L(0x176)](E[L(0x192)](systemRoutes,a));},f={};function b(n,a){n=n-0x16f;const E=I();let M=E[n];return M;}f[q(0x190)]=q(0x171);export default x(plugin,f);
|
package/dist/fcore.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates the high-level FCore application context and wires infrastructure dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import { type FCoreConfig } from "./config.js";
|
|
5
|
+
import { type AppContext } from "./context.js";
|
|
6
|
+
import { type DictionaryDefinition, type ResourceContract } from "./plugins/index.js";
|
|
7
|
+
export interface CreateFCoreOptions {
|
|
8
|
+
config?: Partial<FCoreConfig>;
|
|
9
|
+
resources?: ResourceContract[];
|
|
10
|
+
dictionaries?: DictionaryDefinition[];
|
|
11
|
+
}
|
|
12
|
+
export declare function createFCore(options?: CreateFCoreOptions): Promise<AppContext>;
|
|
13
|
+
//# sourceMappingURL=fcore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fcore.d.ts","sourceRoot":"","sources":["../src/fcore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAQL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAED,wBAAsB,WAAW,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CA6CrB"}
|
package/dist/fcore.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){const W=b,E=n();while(!![]){try{const M=-parseInt(W(0x1b1))/0x1*(parseInt(W(0x1b8))/0x2)+parseInt(W(0x1a9))/0x3+-parseInt(W(0x1c8))/0x4+parseInt(W(0x1bc))/0x5*(parseInt(W(0x1b0))/0x6)+parseInt(W(0x1c6))/0x7*(parseInt(W(0x1bd))/0x8)+parseInt(W(0x1b9))/0x9+-parseInt(W(0x1ba))/0xa;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x90ed5));import{loadConfig}from'./config.js';import{createContext,setContext}from'./context.js';import{createAudit,createDatabase,createDictionary,createFileS3,createLogger,createRedis,createResource}from'./plugins/index.js';function b(n,a){n=n-0x1a7;const E=I();let M=E[n];return M;}export async function createFCore(j={}){const f=b,u={'rhTdw':function(m,T){return m(T);},'rQVfE':function(m,T){return m(T);},'KvqUd':function(m,T){return m(T);},'OPqKA':function(m,T){return m(T);}},Y=u[f(0x1b6)](loadConfig,j[f(0x1c7)]),g=u[f(0x1b6)](createRedis,Y[f(0x1c2)]),e={};e[f(0x1c7)]=Y,e[f(0x1c2)]=g;const h=createLogger(e),Z=u[f(0x1c4)](createDatabase,Y['pg']),H={};H[f(0x1aa)]=Y['s3'][f(0x1aa)],H[f(0x1b5)]=Y['s3'][f(0x1b5)],H[f(0x1c0)]=Y['s3'][f(0x1c0)],H[f(0x1c3)]=Y['s3'][f(0x1c3)],H[f(0x1b7)]=Y['s3'][f(0x1b7)],H[f(0x1bf)]=Y['s3'][f(0x1bf)],H[f(0x1b3)]=Y['s3'][f(0x1b3)],H[f(0x1a8)]=Y['s3'][f(0x1a8)],H[f(0x1b2)]=Y['s3'][f(0x1b2)];const t=u[f(0x1c4)](createFileS3,H),B={};B['pg']=Z,B[f(0x1b4)]=h;const A=u[f(0x1ad)](createAudit,B),r={};r['pg']=Z,r[f(0x1bb)]=j[f(0x1bb)];const k=createDictionary(r),p={};p['pg']=Z,p[f(0x1b4)]=h,p[f(0x1ac)]=A;const l=u[f(0x1b6)](createResource,p);j[f(0x1ab)]?.[f(0x1af)]&&l[f(0x1be)](j[f(0x1ab)]);const P={};P[f(0x1c7)]=Y,P[f(0x1b4)]=h,P[f(0x1c2)]=g,P['pg']=Z,P[f(0x1c1)]=t,P[f(0x1c5)]=l,P[f(0x1ac)]=A,P[f(0x1ae)]=k;const J=u[f(0x1a7)](createContext,P);return setContext(J),J;}function I(){const x=['forcePathStyle','logger','region','rhTdw','secretKey','6WWHVor','9270180YOVhoH','1899560cjHCwv','dictionaries','3678175rlHTHo','69528HAhiHD','register','folder','bucket','file','redis','accessKey','rQVfE','resource','49PZBdxM','config','2169856jHKntC','OPqKA','tokenSecret','1022904sUfKSu','endpoint','resources','audit','KvqUd','dictionary','length','6AQjoUL','280473TUeJpA','tokenTtl'];I=function(){return x;};return I();}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exposes the public root API of the @opengis/fcore package.
|
|
3
|
+
*/
|
|
4
|
+
export * from './errors.js';
|
|
5
|
+
export * from './config.js';
|
|
6
|
+
export * from './context.js';
|
|
7
|
+
export * from './plugins/index.js';
|
|
8
|
+
export * from './fcore.js';
|
|
9
|
+
export * from './migrations/runner.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){var G=b,E=n();while(!![]){try{var M=parseInt(G(0x13d))/0x1+parseInt(G(0x13c))/0x2*(parseInt(G(0x139))/0x3)+-parseInt(G(0x13a))/0x4+-parseInt(G(0x137))/0x5*(-parseInt(G(0x13b))/0x6)+parseInt(G(0x138))/0x7+-parseInt(G(0x135))/0x8+parseInt(G(0x136))/0x9*(-parseInt(G(0x13e))/0xa);if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x80f1a));export*from'./errors.js';export*from'./config.js';function b(n,a){n=n-0x135;var E=I();var M=E[n];return M;}export*from'./context.js';export*from'./plugins/index.js';export*from'./fcore.js';function I(){var j=['1300okHGnH','6842272kAnYtl','11511dRqWiN','5rCRZWj','5558602QRqzaJ','12NfPvNL','2520844XKMIUZ','327498pHtPxi','425554ssdHWw','480142uZqRzP'];I=function(){return j;};return I();}export*from'./migrations/runner.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/migrations/cli.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const Y=b;(function(n,a){const u=b,E=n();while(!![]){try{const M=parseInt(u(0xa1))/0x1*(parseInt(u(0x95))/0x2)+-parseInt(u(0x97))/0x3*(parseInt(u(0x9e))/0x4)+-parseInt(u(0x99))/0x5+parseInt(u(0x9f))/0x6*(-parseInt(u(0x9d))/0x7)+parseInt(u(0x93))/0x8+-parseInt(u(0x9c))/0x9+parseInt(u(0x9b))/0xa;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x94980));import{runMigrations}from'./runner.js';import{loadConfig}from'../config.js';function I(){const g=['status','6FoJcjH','run','3rRlXMH','OK\x20\x20','6045820vLXUec','file','26585580gWmnCq','4211496xlQrKv','7gmeUIl','2011648RfaXaO','4905750dXFMCH','log','78138wRGWjx','error','exitCode','SKIP','5706504JbekQq'];I=function(){return g;};return I();}function b(n,a){n=n-0x92;const E=I();let M=E[n];return M;}try{for(const r of await runMigrations({'database':loadConfig()['pg']}))console[Y(0xa0)]((r[Y(0x94)]===Y(0x96)?Y(0x98):Y(0x92))+'\x20'+r[Y(0x9a)]);}catch(j){console[Y(0xa2)](j),process[Y(0xa3)]=0x1;}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DatabaseConfig } from "../plugins/pg.js";
|
|
2
|
+
export interface MigrationResult {
|
|
3
|
+
file: string;
|
|
4
|
+
status: "run" | "skip";
|
|
5
|
+
}
|
|
6
|
+
export interface RunMigrationsOptions {
|
|
7
|
+
dir?: string;
|
|
8
|
+
database?: DatabaseConfig;
|
|
9
|
+
databaseUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function runMigrations(options?: RunMigrationsOptions): Promise<MigrationResult[]>;
|
|
12
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/migrations/runner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AACD,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AACD,wBAAsB,aAAa,CACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,eAAe,EAAE,CAAC,CA2D5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){const T=b,E=n();while(!![]){try{const M=-parseInt(T(0xba))/0x1+parseInt(T(0xfa))/0x2+-parseInt(T(0xbe))/0x3*(parseInt(T(0xb8))/0x4)+-parseInt(T(0xd2))/0x5*(-parseInt(T(0xf8))/0x6)+-parseInt(T(0xfc))/0x7+-parseInt(T(0xb6))/0x8+parseInt(T(0xc9))/0x9;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0xaf30e));import A from'node:fs/promises';function I(){const N=['password','4359864xMjFbV','databaseUrl','2172tcDZHc','lqIzJ','464586AvBdYN','hostname','resolve','BEGIN','4299VhsDRx','endsWith','BwBpQ','run','bhRZl','database','sort','XNFCq','readFile','file','DATABASE_URL\x20or\x20database\x20config\x20is\x20required','21789900ZnIghl','connect','fXgFs','yXebe','Nkbvu','slice','has','iRNyN','username','128190UaRZmZ','ROLLBACK','DxyXw','CurLi','CpcpD','port','migrations','release','utf8','SELECT\x20version\x20FROM\x20schema_migrations','.sql','pMOEk','xKaAQ','readdir','version','INSERT\x20INTO\x20schema_migrations(version)\x20VALUES\x20($1)','query','map','filter','nRtcH','skip','wWiro','join','tvaqH','eqMvw','rows','BHRBL','oCjtH','\x0a\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20IF\x20NOT\x20EXISTS\x20schema_migrations\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20version\x20varchar(255)\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20applied_at\x20timestamptz\x20NOT\x20NULL\x20DEFAULT\x20now()\x0a\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20','LseFK','pathname','wWfmV','PrTyG','dir','status','JrCHE','uJCjX','end','174jjSLyE','COMMIT','382794PwZwmR','apWZb','5955103VexDrT','empty\x20pg','push','vVDym'];I=function(){return N;};return I();}import r from'node:path';import{createDatabase}from'../plugins/pg.js';function b(n,a){n=n-0xb2;const E=I();let M=E[n];return M;}export async function runMigrations(E={}){const y=b,M={'xKaAQ':y(0xc8),'vVDym':function(Y,g){return Y(g);},'oCjtH':y(0xb2),'CurLi':y(0xd8),'wWiro':function(Y,g){return Y===g;},'CpcpD':y(0xf6),'BwBpQ':y(0xd0),'fXgFs':y(0xdb),'bhRZl':y(0xf5),'nRtcH':y(0xe9),'lqIzJ':y(0xe6),'yXebe':y(0xda),'eqMvw':function(Y,g){return Y===g;},'wWfmV':y(0xcd),'PrTyG':y(0xbd),'apWZb':y(0xe1),'pMOEk':y(0xd3),'LseFK':y(0xc1),'BHRBL':y(0xd4)},X=r[y(0xbc)](E[y(0xf3)]??M[y(0xd5)]),G=E[y(0xc3)]??databaseFromUrl(E[y(0xb7)]??process.env.DATABASE_URL);if(!G){if(M[y(0xe7)](M[y(0xd6)],M[y(0xd6)]))throw new Error(M[y(0xde)]);else return a;}const j=createDatabase(G);if(!j)throw new Error(M[y(0xed)]);const u=[];try{if(M[y(0xe7)](M[y(0xc0)],y(0xd0))){await j[y(0xe2)](y(0xee));const g=await j[y(0xe2)](M[y(0xcb)]),e=new Set(g[y(0xeb)][y(0xe3)](Z=>Z[y(0xe0)])),h=(await A[y(0xdf)](X))[y(0xe4)](Z=>Z[y(0xbf)](y(0xdc)))[y(0xc4)]();for(const Z of h){if(e[y(0xcf)](Z)){if(M[y(0xc2)]===M[y(0xe5)])throw new B(M[y(0xde)]);else{const p={};p[y(0xc7)]=Z,p[y(0xf4)]=M[y(0xb9)],u[y(0xb3)](p);continue;}}const H=await A[y(0xc6)](r[y(0xe8)](X,Z),M[y(0xcc)]),t=await j[y(0xca)]();try{M[y(0xea)](M[y(0xf1)],y(0xcd))?(await t[y(0xe2)](M[y(0xf2)]),await t[y(0xe2)](H),await t[y(0xe2)](M[y(0xfb)],[Z]),await t[y(0xe2)](y(0xf9))):B[y(0xd9)]();}catch(P){await t[y(0xe2)](M[y(0xdd)]);throw P;}finally{t[y(0xd9)]();}const B={};B[y(0xc7)]=Z,B[y(0xf4)]=M[y(0xef)],u[y(0xb3)](B);}return u;}else{if(!u)return t;const m=new g(e);return{'host':m[y(0xbb)],'port':M[y(0xb4)](h,m[y(0xd7)]||0x1538),'database':m[y(0xf0)][y(0xce)](0x1),'user':M[y(0xb4)](Z,m[y(0xd1)]),'password':M[y(0xb4)](H,m[y(0xb5)])};}}finally{if(M[y(0xec)]!==M[y(0xec)])throw new a(M[y(0xed)]);else await j[y(0xf7)]();}}function databaseFromUrl(n){const s=b,a={'XNFCq':function(M,X){return M(X);}};if(!n)return undefined;const E=new URL(n);return{'host':E[s(0xbb)],'port':Number(E[s(0xd7)]||0x1538),'database':E[s(0xf0)][s(0xce)](0x1),'user':decodeURIComponent(E[s(0xd1)]),'password':a[s(0xc5)](decodeURIComponent,E[s(0xb5)])};}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exports the public surface of this FCore module.
|
|
3
|
+
*/
|
|
4
|
+
export * from './route.js';
|
|
5
|
+
export * from './services/login.js';
|
|
6
|
+
export * from './services/logout.js';
|
|
7
|
+
export * from './services/get-current-user.js';
|
|
8
|
+
export * from './services/verify-two-factor.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){var G=b,E=n();while(!![]){try{var M=-parseInt(G(0xf0))/0x1+-parseInt(G(0xf1))/0x2*(-parseInt(G(0xef))/0x3)+parseInt(G(0xf3))/0x4+-parseInt(G(0xed))/0x5*(-parseInt(G(0xee))/0x6)+-parseInt(G(0xf2))/0x7+parseInt(G(0xf5))/0x8+parseInt(G(0xf4))/0x9;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0xa042b));export*from'./route.js';export*from'./services/login.js';function b(n,a){n=n-0xed;var E=I();var M=E[n];return M;}export*from'./services/logout.js';export*from'./services/get-current-user.js';function I(){var j=['2yhSzzW','7955570TWisAe','2716588wocHai','10002798nEXsme','4887328dsamwf','1380lDMIAz','4878BLwrYU','895710ZYMxHe','1131506EtworE'];I=function(){return j;};return I();}export*from'./services/verify-two-factor.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers HTTP routes for this FCore module and delegates operations to application services.
|
|
3
|
+
*/
|
|
4
|
+
import type { FastifyPluginAsync } from "fastify";
|
|
5
|
+
import type { AppContext } from "../../context.js";
|
|
6
|
+
export declare function authRoutes(ctx: AppContext): FastifyPluginAsync;
|
|
7
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAWnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA0L9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){const w=b,E=n();while(!![]){try{const M=-parseInt(w(0x143))/0x1+parseInt(w(0xeb))/0x2+-parseInt(w(0x106))/0x3*(-parseInt(w(0x124))/0x4)+parseInt(w(0x159))/0x5*(parseInt(w(0x157))/0x6)+-parseInt(w(0x117))/0x7*(-parseInt(w(0x11d))/0x8)+parseInt(w(0x12b))/0x9*(-parseInt(w(0xfc))/0xa)+-parseInt(w(0x11a))/0xb;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x5369b));function b(n,a){n=n-0xe5;const E=I();let M=E[n];return M;}function I(){const f=['tgvvi','/api/login','RdhNZ','WdkUO','save','XScnO','wfLdy','/api/2factor','permissions','credentials','180nSQlPv','HWhYi','39505cpoxhi','QwCMq','defineProperty','WnQIM','HGUck','CZXam','pLAgo','WrRKS','MgYso','Uses\x20a\x20recovery\x20code\x20to\x20restore\x20two-factor\x20access.','NMBFB','320704FfdZqa','/api/logout','Vqyrl','value','Resets\x20two-factor\x20authentication\x20for\x20the\x20current\x20user.','description','cookie','Verify\x20two-factor\x20code','WWjVl','Vifvj','UnBbL','sessionId','Hdmdg','get','public','type','configurable','290HbaMAT','pRbjO','Returns\x20the\x20QR\x20code\x20required\x20to\x20configure\x20two-factor\x20authentication.','Verifies\x20a\x20two-factor\x20authentication\x20code.','MNqTR','EDGva','maxAge','yDUAN','fxtFU','UYShK','45LmWSgG','Get\x20two-factor\x20QR\x20code','/api/2factor/qr','access','MFrUe','config','wfrxu','Recover\x20two-factor\x20access','clearCookie','dpNBd','tags','XEOrs','ENIdb','DVbpw','RafHT','dICDE','Sign\x20out','39599RirTVn','body','schema','2499519KOMtqB','ZwrfN','not\x20supported\x20yet','520dwuqle','FESHJ','ugRgw','sessionTimeout','destroy','ZMcDz','Returns\x20the\x20authenticated\x20user\x27s\x20safe\x20profile.','129468WzLnlW','/api/2factor/recovery','vbKtt','/api/2factor/verify','Authenticates\x20a\x20user\x20and\x20returns\x20a\x20bearer\x20access\x20token.','jyegD','Sign\x20in','96246luvYTJ','writable','fcore','bGPuz','TSPlm','twoFactor','GqUJE','UHcCZ','pzffy','Terminates\x20the\x20current\x20user\x20session.','HsfQy','cookieName','redirectUrl','auth','lpONM','zJOCa','post','NrUbA','user','summary','/api/user','ZLpkO','Returns\x20the\x20current\x20two-factor\x20authentication\x20status.','session','371578SwPOfS','Get\x20current\x20user','Not\x20authorized','Get\x20two-factor\x20status','Reset\x20two-factor\x20authentication','PmGaz','/api/2factor/reset','xfYDQ','login','tBGyt'];I=function(){return f;};return I();}import Y from'./services/login.js';import g from'./services/logout.js';import e from'./services/get-current-user.js';import{authSchemas}from'./schema.js';import h from'../../shared/getIP.js';import{UnauthorizedError,UnsupportedError}from'../../errors.js';export function authRoutes(n){const R=b,a={'PmGaz':function(E,M){return E===M;},'CZXam':R(0x111),'pRbjO':function(E,M){return E(M);},'yDUAN':function(E,M,X){return E(M,X);},'vbKtt':function(E,M){return E*M;},'bGPuz':function(E,M){return E*M;},'XScnO':R(0x142),'RafHT':function(E,M){return E!==M;},'dpNBd':R(0x13a),'FESHJ':R(0x145),'WWjVl':R(0x11c),'MgYso':function(E,M){return E===M;},'wfLdy':R(0x10a),'ZMcDz':R(0x14a),'MNqTR':R(0x14c),'pzffy':R(0x138),'Vifvj':R(0x128),'ZLpkO':R(0xf9),'WrRKS':R(0xec),'fxtFU':R(0x116),'ZwrfN':R(0x134),'pLAgo':R(0x13d),'UnBbL':R(0x13f),'dICDE':R(0x12d),'lpONM':R(0x144),'UHcCZ':R(0x123),'GqUJE':R(0x146),'ugRgw':R(0x141),'DVbpw':R(0x108),'TSPlm':R(0xfe),'NMBFB':R(0x127),'NrUbA':R(0xff),'wfrxu':R(0x125),'HWhYi':R(0x10d),'EDGva':R(0xe9),'Hdmdg':R(0x147),'Vqyrl':R(0xef)};return async u=>{const F=R,Z={};Z[F(0x15d)]=F(0x145),Z[F(0x14f)]=a[F(0x122)],Z[F(0x150)]=a[F(0xf3)];const H=Z;if(a[F(0x148)](a[F(0x100)],F(0x15a)))return a;else{const B={};B[F(0x110)]=[F(0x12d),a[F(0x133)]],B[F(0x13e)]=F(0x12a),B[F(0xf0)]=a[F(0xf4)],B[F(0x109)]=a[F(0x140)],B[F(0x155)]=[],B[F(0x118)]=authSchemas[F(0x156)];const A={};A[F(0x119)]=B,u[F(0x13b)](F(0x14e),A,async P=>{const i=F;if(a[i(0x148)](a[i(0xe5)],i(0x105)))throw new B(i(0x145));else{const m=a[i(0xfd)](h,P),T={...P[i(0x118)]};T['ip']=m;const {user:y,redirectUrl:redirectUrl='/'}=await a[i(0x103)](Y,T,n);await P[i(0x14b)](y);const s=a[i(0x126)](a[i(0x12e)](n[i(0x10b)][i(0x138)][i(0x120)],0x3e8),0x3c);P[i(0x142)]?.[i(0xf1)]&&(P[i(0x142)][i(0xf1)][i(0x102)]=s);await P[i(0x142)][i(0x151)]();const N={};N['id']=y['id'],N[i(0xfa)]=y[i(0xfa)];const z={};return z[i(0x13d)]=N,z[i(0x137)]=redirectUrl,z;}}),u[F(0x13b)](a[F(0xe7)],{'schema':{'tags':[F(0x12d),a[F(0x133)]],'summary':a[F(0x104)],'description':a[F(0x11b)],'access':a[F(0xe6)],'permissions':[]}},async(P,J)=>{const o=F,m={};m[o(0x137)]='/';const T=m;if(!P[o(0x13d)])return T;const y={};y[o(0xf6)]=P[o(0x142)][o(0xf6)],y[o(0x13d)]=P[o(0x13d)],await a[o(0x103)](g,y,n),await P[o(0x142)][o(0x121)](),J[o(0x10e)](n[o(0x10b)][o(0x138)][o(0x136)]);const s={};return s[o(0xee)]=null,s[o(0x12c)]=![],s[o(0xfb)]=![],Object[o(0x15b)](P,a[o(0x152)],s),T;}),u[F(0xf8)](a[F(0xf5)],{'schema':{'tags':[a[F(0x115)],a[F(0x133)]],'summary':a[F(0x139)],'description':a[F(0x132)],'access':a[F(0xe6)],'permissions':[]}},async P=>e({'user':P[F(0x13d)]}));const r={};r[F(0x110)]=[a[F(0x115)],a[F(0x133)]],r[F(0x13e)]=a[F(0x131)],r[F(0xf0)]=a[F(0x11f)],r[F(0x109)]=a[F(0xe6)],r[F(0x155)]=[];const k={};k[F(0x119)]=r,u[F(0xf8)](F(0x154),k,async P=>{const C=F;if(a[C(0x114)](a[C(0x10f)],a[C(0x10f)]))throw new B(H[C(0x15d)]);else{if(!P[C(0x13d)])throw new UnauthorizedError(a[C(0x11e)]);throw new UnsupportedError(a[C(0xf3)]);}}),u[F(0xf8)](a[F(0x113)],{'schema':{'tags':[F(0x12d),a[F(0x133)]],'summary':F(0x107),'description':a[F(0x12f)],'access':a[F(0xe6)],'permissions':[]}},async P=>{const S=F;if(!P[S(0x13d)])throw new UnauthorizedError(S(0x145));throw new UnsupportedError(a[S(0xf3)]);}),u[F(0x13b)](a[F(0xea)],{'schema':{'tags':[F(0x12d),a[F(0x133)]],'summary':F(0xf2),'description':a[F(0x13c)],'access':F(0x13d),'permissions':[],'body':authSchemas[F(0x130)]}},async P=>{const c=F;if(!P[c(0x13d)])throw new UnauthorizedError(a[c(0x11e)]);throw new UnsupportedError(a[c(0xf3)]);}),u[F(0x13b)](a[F(0x10c)],{'schema':{'tags':[a[F(0x115)],a[F(0x133)]],'summary':a[F(0x158)],'description':a[F(0x101)],'access':a[F(0xe6)],'permissions':[],'body':authSchemas[F(0x130)]}},async P=>{const U=F,J={};J[U(0x112)]=U(0x145);const m=J;if(a[U(0x114)](U(0x135),U(0x14d))){if(!P[U(0x13d)]){if(a[U(0xe8)](U(0x10a),a[U(0x153)]))throw new UnauthorizedError(a[U(0x11e)]);else{if(!r[U(0x13d)])throw new l(hzVdwa[U(0x112)]);throw new p(U(0x11c));}}throw new UnsupportedError(a[U(0xf3)]);}else{if(!r[U(0x13d)])throw new l(H[U(0x15d)]);throw new J(U(0x11c));}});const p={};p[F(0x110)]=[a[F(0x115)],a[F(0x133)]],p[F(0x13e)]=a[F(0xf7)],p[F(0xf0)]=a[F(0xed)],p[F(0x109)]=F(0x13d),p[F(0x155)]=[],p[F(0x118)]=authSchemas[F(0x130)];const l={};l[F(0x119)]=p,u[F(0x13b)](F(0x149),l,async P=>{const W=F,J={};J[W(0x15c)]=W(0x145);const m=J;if(W(0x129)===H[W(0x14f)])throw new B(TuVQVl[W(0x15c)]);else{if(!P[W(0x13d)])throw new UnauthorizedError(W(0x145));throw new UnsupportedError(H[W(0x150)]);}});}};}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines Fastify/AJV request and response schemas for this module.
|
|
3
|
+
*/
|
|
4
|
+
import { Static } from "@sinclair/typebox";
|
|
5
|
+
export declare const authSchemas: {
|
|
6
|
+
credentials: import("@sinclair/typebox").TObject<{
|
|
7
|
+
login: import("@sinclair/typebox").TString;
|
|
8
|
+
password: import("@sinclair/typebox").TString;
|
|
9
|
+
}>;
|
|
10
|
+
twoFactor: import("@sinclair/typebox").TObject<{
|
|
11
|
+
code: import("@sinclair/typebox").TString;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export type Credentials = Static<typeof authSchemas.credentials>;
|
|
15
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW;IACtB,WAAW;;;;IAIX,SAAS;;;CAGV,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const g=b;(function(M,X){const Y=b,G=M();while(!![]){try{const j=parseInt(Y(0x1cd))/0x1*(-parseInt(Y(0x1ca))/0x2)+parseInt(Y(0x1d0))/0x3+parseInt(Y(0x1d3))/0x4*(parseInt(Y(0x1d1))/0x5)+parseInt(Y(0x1d6))/0x6*(parseInt(Y(0x1d5))/0x7)+parseInt(Y(0x1ce))/0x8+-parseInt(Y(0x1cc))/0x9+-parseInt(Y(0x1cb))/0xa*(-parseInt(Y(0x1d8))/0xb);if(j===X)break;else G['push'](G['shift']());}catch(u){G['push'](G['shift']());}}}(I,0xd2545));import{Type}from'@sinclair/typebox';const n={};function b(n,a){n=n-0x1ca;const E=I();let M=E[n];return M;}n[g(0x1d7)]=0x1,n[g(0x1d4)]=0x64;const a={};a[g(0x1d7)]=0x1,a[g(0x1d4)]=0x64;const E={};E[g(0x1d7)]=0x1;function I(){const e=['115882yPieQN','30AGGUyy','9609444DZVyEc','20tgzQAn','807976zZxNMN','String','3593076fEfoHw','7085keqiPh','Object','864Jxlmlu','maxLength','4319gvThgx','1098otewLa','minLength','5024701wWosZs'];I=function(){return e;};return I();}export const authSchemas={'credentials':Type[g(0x1d2)]({'login':Type[g(0x1cf)](n),'password':Type[g(0x1cf)](a)}),'twoFactor':Type[g(0x1d2)]({'code':Type[g(0x1cf)](E)})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements the get current user application service for its module.
|
|
3
|
+
*/
|
|
4
|
+
import type { User } from "../../../context.js";
|
|
5
|
+
export default function getCurrentUser(params: {
|
|
6
|
+
user: User | undefined;
|
|
7
|
+
}): Promise<Record<string, unknown>>;
|
|
8
|
+
//# sourceMappingURL=get-current-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/get-current-user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,wBAA8B,cAAc,CAAC,MAAM,EAAE;IACnD,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAGnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){const G=b,E=n();while(!![]){try{const M=-parseInt(G(0xd5))/0x1*(parseInt(G(0xce))/0x2)+parseInt(G(0xd0))/0x3*(-parseInt(G(0xcc))/0x4)+-parseInt(G(0xd1))/0x5+-parseInt(G(0xd4))/0x6*(parseInt(G(0xca))/0x7)+-parseInt(G(0xd3))/0x8+parseInt(G(0xcd))/0x9*(-parseInt(G(0xd6))/0xa)+parseInt(G(0xcb))/0xb*(parseInt(G(0xcf))/0xc);if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0xe84ab));import{safeUser}from'../../utils/safe-user.js';function b(n,a){n=n-0xc9;const E=I();let M=E[n];return M;}function I(){const u=['8762940ARicvw','PIUJZ','2536752XcAklH','3198rmOjxH','4fjOyOm','40IJkveD','hVZiZ','13083bZjNIJ','66108218ugPLaS','84WTolAm','524934edpRkY','238222fdCoAT','12ZXouya','183252bYflZN'];I=function(){return u;};return I();}export default async function getCurrentUser(n){const j=b,a={'PIUJZ':function(M,X){return M(X);},'hVZiZ':function(M,X){return M||X;}},{user:E}=n;return a[j(0xd2)](safeUser,a[j(0xc9)](E,{}));}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ContextDependencies } from "../../../context.js";
|
|
2
|
+
export default function login({ ip, login, password }: {
|
|
3
|
+
ip: string;
|
|
4
|
+
login: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}, { config, pg, logger, redis, }: Pick<ContextDependencies, "config" | "pg" | "logger" | "redis">): Promise<{
|
|
7
|
+
user: any;
|
|
8
|
+
redirectUrl: string;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/login.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAA8B,KAAK,CACjC,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACxE,EACE,MAAM,EACN,EAAE,EACF,MAAM,EACN,KAAK,GACN,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC;;;GAiCnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function I(){const l=['wYmYw','base','26VViCVw','35147532liTDOg','twofa','366hmFyAW','IKjRH','11yedXQz','5728lYGmQw','empty\x20redis','login','auth','8057OwutIT','empty\x20pg','txIOR','vHUHX','101261ydaYld','12461670vuRlYb','48jztYAY','afterLogin','twoFactor','password','195840QfZyKU','LItWM','logger','10245xKcDwZ','metrics','17446320GEAkgg','LwjOv','user.login','empty\x20user','link'];I=function(){return l;};return I();}(function(n,a){const k=b,M=n();while(!![]){try{const X=-parseInt(k(0xdc))/0x1*(-parseInt(k(0xee))/0x2)+-parseInt(k(0xe2))/0x3*(parseInt(k(0xde))/0x4)+-parseInt(k(0xe5))/0x5*(parseInt(k(0xd1))/0x6)+-parseInt(k(0xd8))/0x7*(-parseInt(k(0xd4))/0x8)+-parseInt(k(0xe7))/0x9+-parseInt(k(0xdd))/0xa+-parseInt(k(0xd3))/0xb*(-parseInt(k(0xef))/0xc);if(X===a)break;else M['push'](M['shift']());}catch(G){M['push'](M['shift']());}}}(I,0xee65a));import E from'./verifyPassword.js';function b(n,a){n=n-0xd0;const E=I();let M=E[n];return M;}export default async function login({ip:M,login:X,password:G},{config:j,pg:u,logger:Y,redis:g}){const p=b,e={'LwjOv':function(B,A){return B(A);},'vHUHX':p(0xd5),'wYmYw':function(B,A,r){return B(A,r);},'LItWM':p(0xea),'txIOR':p(0xe9),'IKjRH':function(B,A){return B||A;}};if(!u)throw e[p(0xe8)](Error,p(0xd9));if(!g)throw Error(e[p(0xdb)]);const h={};h[p(0xd6)]=X,h[p(0xe1)]=G,h['ip']=M;const Z={};Z['pg']=u,Z[p(0xe4)]=Y;const {user:H}=await e[p(0xec)](E,h,Z);if(!H)throw new Error(e[p(0xe3)]);Y[p(0xe6)](e[p(0xda)]);const t=H[p(0xd0)]?j[p(0xd7)][p(0xeb)]?.[p(0xe0)]?.[p(0xd6)]:j[p(0xd7)][p(0xeb)]?.[p(0xed)][p(0xdf)];return{'user':H,'redirectUrl':e[p(0xd2)](t,'/')};}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements the logout application service for its module.
|
|
3
|
+
*/
|
|
4
|
+
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
export default function logout(params: {
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
user?: User;
|
|
8
|
+
}, ctx: AppContext): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/logout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,wBAA8B,MAAM,CAClC,MAAM,EAAE;IACN,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){var u=b,E=n();while(!![]){try{var M=parseInt(u(0xda))/0x1+-parseInt(u(0xea))/0x2+-parseInt(u(0xed))/0x3*(parseInt(u(0xd9))/0x4)+parseInt(u(0xee))/0x5+parseInt(u(0xe4))/0x6*(parseInt(u(0xdf))/0x7)+parseInt(u(0xe8))/0x8+-parseInt(u(0xe5))/0x9*(parseInt(u(0xe9))/0xa);if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x2543f));function I(){var g=['414BZxpBd','action','sessionId','1080096FQsjlx','26930SSDcRD','282040ZVcYmA','audit','FUSCg','69186ReSVnv','401830yHknaU','logout','auth','36ohjxVf','178378yIjimf','module','resource','user','resourceId','9149BpkbRy','write','userId','DHBRN','session','1062opErUh'];I=function(){return g;};return I();}function b(n,a){n=n-0xd7;var E=I();var M=E[n];return M;}export default async function logout(E,M){var Y=b,X={};X[Y(0xec)]=Y(0xd8),X[Y(0xe2)]=Y(0xe3);var G=X,j={};j[Y(0xdb)]=G[Y(0xec)],j[Y(0xdc)]=G[Y(0xe2)],j[Y(0xde)]=E[Y(0xe7)],j[Y(0xe6)]=Y(0xd7),j[Y(0xe1)]=E[Y(0xdd)]?.['id'],await M[Y(0xeb)]?.[Y(0xe0)]?.(j);}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements the verify two factor application service for its module.
|
|
3
|
+
*/
|
|
4
|
+
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
export default function verifyTwoFactor(params: {
|
|
6
|
+
user: User;
|
|
7
|
+
code: string;
|
|
8
|
+
}, ctx: AppContext): Promise<never>;
|
|
9
|
+
//# sourceMappingURL=verify-two-factor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-two-factor.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/verify-two-factor.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAA8B,eAAe,CAC3C,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,KAAK,CAAC,CAEhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){var G=b,E=n();while(!![]){try{var M=parseInt(G(0xb7))/0x1+-parseInt(G(0xaf))/0x2+parseInt(G(0xb6))/0x3*(-parseInt(G(0xae))/0x4)+-parseInt(G(0xb3))/0x5+-parseInt(G(0xb8))/0x6+parseInt(G(0xb4))/0x7*(-parseInt(G(0xb5))/0x8)+parseInt(G(0xb1))/0x9;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0xe9fb6));function b(n,a){n=n-0xae;var E=I();var M=E[n];return M;}import{unsupported}from'../../utils/unsupported.js';export default async function verifyTwoFactor(a,E){var j=b,M={};M[j(0xb0)]=j(0xb2);var X=M;return unsupported(X[j(0xb0)]);}function I(){var u=['bopUM','61691733eUzZEL','Two-factor\x20provider','7862955KuQBjW','64778YzGdmk','1384UcggAS','2319hnWnkj','893797BQynWB','3068022RwPdiV','6996zMeMLR','3506394hveIVc'];I=function(){return u;};return I();}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContextDependencies } from "../../../context.js";
|
|
2
|
+
export declare function hashPassword(password: string): string;
|
|
3
|
+
export declare function verifyPasswordWithoutSalt(password: string, stored: string): boolean;
|
|
4
|
+
export default function verifyPassword({ login, password, ip, }: {
|
|
5
|
+
login: string;
|
|
6
|
+
password: string;
|
|
7
|
+
ip: string;
|
|
8
|
+
}, { pg, logger }: Pick<ContextDependencies, "pg" | "logger">): Promise<{
|
|
9
|
+
user: any;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=verifyPassword.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyPassword.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/verifyPassword.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAQ,MAAM,qBAAqB,CAAC;AAOhE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAST;AAED,wBAA8B,cAAc,CAC1C,EACE,KAAK,EACL,QAAQ,EACR,EAAE,GACH,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,EACD,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,QAAQ,CAAC;;GAmE3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){const O=b,E=n();while(!![]){try{const M=-parseInt(O(0x17c))/0x1*(-parseInt(O(0x189))/0x2)+parseInt(O(0x1aa))/0x3*(-parseInt(O(0x175))/0x4)+parseInt(O(0x1b1))/0x5+parseInt(O(0x1a7))/0x6+-parseInt(O(0x19d))/0x7+parseInt(O(0x1a0))/0x8+parseInt(O(0x199))/0x9*(-parseInt(O(0x18d))/0xa);if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x3afbd));import s from'apache-crypt';import N from'node:crypto';function b(n,a){n=n-0x168;const E=I();let M=E[n];return M;}import{BadRequestError}from'../../../errors.js';function md5(a){const q=b,E={};E[q(0x18a)]=q(0x184),E[q(0x17d)]=q(0x16b);const M=E;return N[q(0x18b)](M[q(0x18a)])[q(0x1a6)](a)[q(0x19f)](M[q(0x17d)]);}export function hashPassword(a){const K=b,E={};E[K(0x17e)]=K(0x16b);const M=E,X=N[K(0x17f)](0x10)[K(0x18c)](M[K(0x17e)]),G=N[K(0x194)](a,X,0x40)[K(0x18c)](K(0x16b));return K(0x185)+X+'$'+G;}export function verifyPasswordWithoutSalt(a,E){const d=b,M={};M[d(0x179)]=d(0x187);const X=M,[G,j,u]=E[d(0x191)]('$');if(G!==X[d(0x179)]||!j||!u)return![];const Y=N[d(0x194)](a,j,0x40),g=Buffer[d(0x1ab)](u,d(0x16b));return g[d(0x19a)]===Y[d(0x19a)]&&N[d(0x195)](g,Y);}export default async function verifyPassword({login:e,password:h,ip:Z},{pg:H,logger:t}){const Q=b,B={'bPYdX':Q(0x19b),'ZfXSv':Q(0x188),'hCoDy':Q(0x1af),'QsgRF':function(P,J){return P===J;},'iPwxE':function(P,J){return P!==J;},'lrhLF':Q(0x16d),'KpJOM':Q(0x182),'tAFAr':Q(0x180),'gezlq':Q(0x172),'UDbKd':function(P,J){return P===J;},'oAWAj':Q(0x18f),'BtnwV':Q(0x1a1),'JEEjY':function(P,J,m){return P(J,m);},'oYadY':Q(0x198),'Cinpu':Q(0x177),'rGede':function(P,J){return P===J;},'tbtiY':function(P,J){return P<J;},'umpxn':function(P,J){return P(J);},'pfOUP':function(P,J){return P+J;},'wVIAc':function(P,J){return P===J;}};if(!H)throw new Error(Q(0x19e));if(!e||B[Q(0x168)](e,''))throw new BadRequestError(Q(0x19b));if(!h||B[Q(0x168)](h,'')){if(B[Q(0x16e)](B[Q(0x190)],B[Q(0x192)]))throw new BadRequestError(B[Q(0x176)]);else throw new a(B[Q(0x17a)]);}const A=B[Q(0x178)],r=await H[Q(0x16a)](A,[e])[Q(0x170)](J=>J[Q(0x1a3)]?.[0x0]);if(!r){if(B[Q(0x1a4)](Q(0x1a2),Q(0x186))){const m={...M};m[Q(0x16c)]=X,m[Q(0x174)]=G;const T={};return T[Q(0x1a8)]=m,T;}else{const m=B[Q(0x183)],T={};T[Q(0x171)]=m,T[Q(0x19c)]=e,T['ip']=Z,t[Q(0x17b)](B[Q(0x1ac)],T);throw new BadRequestError(m);}}if(!r[Q(0x174)]){if(B[Q(0x16e)](B[Q(0x1ad)],Q(0x1a1))){const z=B[Q(0x1b0)],w={};w[Q(0x171)]=z,w[Q(0x19c)]=G,w['ip']=j,X[Q(0x17b)](B[Q(0x1ac)],w);throw new u(z);}else{const z=B[Q(0x1a9)](verifyPasswordWithoutSalt,h,r[Q(0x16c)]);if(!z){if(B[Q(0x1a4)](B[Q(0x169)],B[Q(0x16f)])){const o=Q(0x18f),C={};C[Q(0x171)]=o,C[Q(0x19c)]=G,C['ip']=j,X[Q(0x17b)](B[Q(0x1ac)],C);throw new u(o);}else{const o=B[Q(0x1b0)],C={};C[Q(0x171)]=o,C[Q(0x19c)]=e,C['ip']=Z,t[Q(0x17b)](B[Q(0x1ac)],C);throw new BadRequestError(o);}}const w={...r};w[Q(0x16c)]=undefined,w[Q(0x174)]=undefined;const R={};return R[Q(0x1a8)]=w,R;}}if(B[Q(0x1a5)](r[Q(0x18e)],!![])){const S=await H[Q(0x16a)](Q(0x1ae),[h,r[Q(0x174)]])[Q(0x170)](W=>W[Q(0x1a3)]?.[0x0]?.[Q(0x173)]);if(r[Q(0x16c)]===S){const W={...r};W[Q(0x16c)]=undefined,W[Q(0x174)]=undefined;const f={};return f[Q(0x1a8)]=W,f;}const c=B[Q(0x1b0)],U={};U[Q(0x171)]=c,U[Q(0x19c)]=e,U['ip']=Z,t[Q(0x17b)](Q(0x1af),U);throw new BadRequestError(c);}let k='';for(let x=0x0;B[Q(0x196)](x,0xa);x+=0x1){k=B[Q(0x197)](md5,B[Q(0x181)](B[Q(0x181)](h,k),r[Q(0x174)]));}k=s(k,r[Q(0x174)]);if(B[Q(0x193)](r[Q(0x16c)],k)){const D={...r};D[Q(0x16c)]=undefined,D[Q(0x174)]=undefined;const L={};return L[Q(0x1a8)]=D,L;}const p=B[Q(0x1b0)],l={};l[Q(0x171)]=p,l[Q(0x19c)]=e,l['ip']=Z,t[Q(0x17b)](Q(0x1af),l);throw new BadRequestError(p);}function I(){const v=['length','not\x20enough\x20params:\x20login','login','912429HlLZcr','empty\x20pg','digest','3259344GZXXct','LGMgd','VGeNQ','rows','UDbKd','rGede','update','2229576AwjyvR','user','JEEjY','721065FTdgVO','from','hCoDy','BtnwV','SELECT\x20public.crypt($1,\x20$2)','auth/warn','ZfXSv','671605XOYYZV','QsgRF','oYadY','query','hex','password','WHqzY','iPwxE','Cinpu','then','error','select\x20uid\x20as\x20id,\x20user_type\x20as\x20type,\x20password,\x20salt\x20from\x20admin.users\x20where\x20$1\x20in\x20(login,email,phone)\x20and\x20enabled\x20limit\x201','crypt','salt','4TdujsY','tAFAr','DKXuX','gezlq','sGpFf','bPYdX','file','166hELQfz','oTOhV','WeCdv','randomBytes','not\x20enough\x20params:\x20password','pfOUP','Ljyph','oAWAj','md5','scrypt$','vuiur','scrypt','Wrong\x20password','5506PjFgYm','jQWus','createHash','toString','3790170EUPgMT','password_new_hash_algorithm','user\x20not\x20found','lrhLF','split','KpJOM','wVIAc','scryptSync','timingSafeEqual','tbtiY','umpxn','LNgfh','18OKQhlb'];I=function(){return v;};return I();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/file/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,a){var G=b,E=n();while(!![]){try{var M=parseInt(G(0x1e5))/0x1+parseInt(G(0x1e3))/0x2*(-parseInt(G(0x1ea))/0x3)+-parseInt(G(0x1e8))/0x4+-parseInt(G(0x1ec))/0x5+-parseInt(G(0x1eb))/0x6*(parseInt(G(0x1e7))/0x7)+-parseInt(G(0x1e9))/0x8*(parseInt(G(0x1e6))/0x9)+parseInt(G(0x1e4))/0xa;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0x7bc5a));function b(n,a){n=n-0x1e3;var E=I();var M=E[n];return M;}export*from'./route.js';export*from'./services/upload-file.js';export*from'./services/get-file.js';function I(){var j=['2771536XducAz','4190360TbQqIM','277548HKAust','1138710wqebfE','1168275eGrhvR','20QdzZog','27632870ypqudJ','308962wuNZiO','9cSWGyO','7ZGNVRv'];I=function(){return j;};return I();}export*from'./services/resize-file.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers HTTP routes for this FCore module and delegates operations to application services.
|
|
3
|
+
*/
|
|
4
|
+
import type { FastifyPluginAsync } from "fastify";
|
|
5
|
+
import type { AppContext } from "../../context.js";
|
|
6
|
+
export declare function fileRoutes(ctx: AppContext): FastifyPluginAsync;
|
|
7
|
+
//# sourceMappingURL=route.d.ts.map
|