@futdevpro/nts-dynamo 1.4.7 → 1.4.8
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/lib/_constants/fullstack/module-settings/test-module-settings.d.ts +3 -0
- package/lib/_constants/fullstack/module-settings/test-module-settings.d.ts.map +1 -0
- package/lib/_constants/fullstack/module-settings/test-module-settings.js +16 -0
- package/lib/_constants/fullstack/module-settings/test-module-settings.js.map +1 -0
- package/lib/_constants/fullstack/module-settings/usage-module-settings.d.ts +3 -0
- package/lib/_constants/fullstack/module-settings/usage-module-settings.d.ts.map +1 -0
- package/lib/_constants/fullstack/module-settings/usage-module-settings.js +13 -0
- package/lib/_constants/fullstack/module-settings/usage-module-settings.js.map +1 -0
- package/lib/_constants/index.d.ts +2 -0
- package/lib/_constants/index.d.ts.map +1 -1
- package/lib/_constants/index.js +2 -0
- package/lib/_constants/index.js.map +1 -1
- package/lib/_models/dynamobe-data-model-params.d.ts +1 -1
- package/lib/_models/dynamobe-data-model-params.d.ts.map +1 -1
- package/lib/_models/dynamobe-data-model-params.js.map +1 -1
- package/lib/_models/dynamobe-endpoint-control.d.ts +30 -0
- package/lib/_models/dynamobe-endpoint-control.d.ts.map +1 -0
- package/lib/_models/dynamobe-endpoint-control.js +95 -0
- package/lib/_models/dynamobe-endpoint-control.js.map +1 -0
- package/lib/_models/fullstack/control-models/daily-usage-data.d.ts +18 -0
- package/lib/_models/fullstack/control-models/daily-usage-data.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/daily-usage-data.js +22 -0
- package/lib/_models/fullstack/control-models/daily-usage-data.js.map +1 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-params.d.ts +11 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-params.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-params.js +12 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-params.js.map +1 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-property-params.d.ts +28 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-property-params.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-property-params.js +67 -0
- package/lib/_models/fullstack/control-models/dynamobe-data-property-params.js.map +1 -0
- package/lib/_models/fullstack/control-models/dynamobe-error.d.ts +18 -0
- package/lib/_models/fullstack/control-models/dynamobe-error.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/dynamobe-error.js +188 -0
- package/lib/_models/fullstack/control-models/dynamobe-error.js.map +1 -0
- package/lib/_models/fullstack/control-models/geo-ip-location.d.ts +26 -0
- package/lib/_models/fullstack/control-models/geo-ip-location.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/geo-ip-location.js +3 -0
- package/lib/_models/fullstack/control-models/geo-ip-location.js.map +1 -0
- package/lib/_models/fullstack/control-models/usage-action.d.ts +9 -0
- package/lib/_models/fullstack/control-models/usage-action.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/usage-action.js +13 -0
- package/lib/_models/fullstack/control-models/usage-action.js.map +1 -0
- package/lib/_models/fullstack/control-models/usage-data.d.ts +14 -0
- package/lib/_models/fullstack/control-models/usage-data.d.ts.map +1 -0
- package/lib/_models/fullstack/control-models/usage-data.js +16 -0
- package/lib/_models/fullstack/control-models/usage-data.js.map +1 -0
- package/lib/_models/fullstack/data-models/custom-data.d.ts +16 -0
- package/lib/_models/fullstack/data-models/custom-data.d.ts.map +1 -0
- package/lib/_models/fullstack/data-models/custom-data.js +28 -0
- package/lib/_models/fullstack/data-models/custom-data.js.map +1 -0
- package/lib/_models/fullstack/data-models/metadata.d.ts +17 -0
- package/lib/_models/fullstack/data-models/metadata.d.ts.map +1 -0
- package/lib/_models/fullstack/data-models/metadata.js +17 -0
- package/lib/_models/fullstack/data-models/metadata.js.map +1 -0
- package/lib/_models/fullstack/data-models/usage-session.d.ts +34 -0
- package/lib/_models/fullstack/data-models/usage-session.d.ts.map +1 -0
- package/lib/_models/fullstack/data-models/usage-session.js +53 -0
- package/lib/_models/fullstack/data-models/usage-session.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/daily-usage-data.d.ts +18 -0
- package/lib/_models/fullstack-models/control-models/daily-usage-data.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/daily-usage-data.js +22 -0
- package/lib/_models/fullstack-models/control-models/daily-usage-data.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-params.d.ts +11 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-params.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-params.js +12 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-params.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.d.ts +28 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.js +67 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-error.d.ts +18 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-error.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-error.js +188 -0
- package/lib/_models/fullstack-models/control-models/dynamobe-error.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/geo-ip-location.d.ts +26 -0
- package/lib/_models/fullstack-models/control-models/geo-ip-location.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/geo-ip-location.js +3 -0
- package/lib/_models/fullstack-models/control-models/geo-ip-location.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/usage-action.d.ts +9 -0
- package/lib/_models/fullstack-models/control-models/usage-action.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/usage-action.js +13 -0
- package/lib/_models/fullstack-models/control-models/usage-action.js.map +1 -0
- package/lib/_models/fullstack-models/control-models/usage-data.d.ts +14 -0
- package/lib/_models/fullstack-models/control-models/usage-data.d.ts.map +1 -0
- package/lib/_models/fullstack-models/control-models/usage-data.js +16 -0
- package/lib/_models/fullstack-models/control-models/usage-data.js.map +1 -0
- package/lib/_models/fullstack-models/data-models/custom-data.d.ts +16 -0
- package/lib/_models/fullstack-models/data-models/custom-data.d.ts.map +1 -0
- package/lib/_models/fullstack-models/data-models/custom-data.js +28 -0
- package/lib/_models/fullstack-models/data-models/custom-data.js.map +1 -0
- package/lib/_models/fullstack-models/data-models/metadata.d.ts +17 -0
- package/lib/_models/fullstack-models/data-models/metadata.d.ts.map +1 -0
- package/lib/_models/fullstack-models/data-models/metadata.js +17 -0
- package/lib/_models/fullstack-models/data-models/metadata.js.map +1 -0
- package/lib/_models/fullstack-models/data-models/usage-session.d.ts +34 -0
- package/lib/_models/fullstack-models/data-models/usage-session.d.ts.map +1 -0
- package/lib/_models/fullstack-models/data-models/usage-session.js +53 -0
- package/lib/_models/fullstack-models/data-models/usage-session.js.map +1 -0
- package/lib/_models/index.d.ts +10 -0
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +12 -0
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/api-service.index.d.ts +1 -0
- package/lib/_modules/api-service.index.d.ts.map +1 -1
- package/lib/_modules/api-service.index.js +1 -0
- package/lib/_modules/api-service.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +1 -0
- package/lib/_modules/auth.index.d.ts.map +1 -1
- package/lib/_modules/auth.index.js +2 -0
- package/lib/_modules/auth.index.js.map +1 -1
- package/lib/_modules/data-models.index.d.ts +3 -0
- package/lib/_modules/data-models.index.d.ts.map +1 -0
- package/lib/_modules/data-models.index.js +6 -0
- package/lib/_modules/data-models.index.js.map +1 -0
- package/lib/_modules/data-service.index.d.ts +1 -0
- package/lib/_modules/data-service.index.d.ts.map +1 -1
- package/lib/_modules/data-service.index.js +2 -0
- package/lib/_modules/data-service.index.js.map +1 -1
- package/lib/_modules/index.d.ts +5 -0
- package/lib/_modules/index.d.ts.map +1 -0
- package/lib/_modules/index.js +9 -0
- package/lib/_modules/index.js.map +1 -0
- package/lib/_modules/test/custom-data.service.d.ts +1 -1
- package/lib/_modules/test/custom-data.service.d.ts.map +1 -1
- package/lib/_modules/test/custom-data.service.js +2 -2
- package/lib/_modules/test/custom-data.service.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.d.ts.map +1 -1
- package/lib/_modules/test/get-test-routing-module.js +2 -2
- package/lib/_modules/test/get-test-routing-module.js.map +1 -1
- package/lib/_modules/test/index.d.ts +2 -0
- package/lib/_modules/test/index.d.ts.map +1 -1
- package/lib/_modules/test/index.js +2 -0
- package/lib/_modules/test/index.js.map +1 -1
- package/lib/_modules/test/test-controller.d.ts.map +1 -1
- package/lib/_modules/test/test-controller.js +8 -8
- package/lib/_modules/test/test-controller.js.map +1 -1
- package/lib/_modules/test/test-routing-module-settings.d.ts +3 -0
- package/lib/_modules/test/test-routing-module-settings.d.ts.map +1 -0
- package/lib/_modules/test/test-routing-module-settings.js +10 -0
- package/lib/_modules/test/test-routing-module-settings.js.map +1 -0
- package/lib/_modules/test/test-routing-module.d.ts +3 -0
- package/lib/_modules/test/test-routing-module.d.ts.map +1 -0
- package/lib/_modules/test/test-routing-module.js +10 -0
- package/lib/_modules/test/test-routing-module.js.map +1 -0
- package/lib/_modules/test-route/custom-data.service.d.ts +6 -0
- package/lib/_modules/test-route/custom-data.service.d.ts.map +1 -0
- package/lib/_modules/test-route/custom-data.service.js +12 -0
- package/lib/_modules/test-route/custom-data.service.js.map +1 -0
- package/lib/_modules/test-route/test-controller.d.ts +6 -0
- package/lib/_modules/test-route/test-controller.d.ts.map +1 -0
- package/lib/_modules/test-route/test-controller.js +126 -0
- package/lib/_modules/test-route/test-controller.js.map +1 -0
- package/lib/_modules/usage/get-usage-routing-module.d.ts.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.js +2 -2
- package/lib/_modules/usage/get-usage-routing-module.js.map +1 -1
- package/lib/_modules/usage/index.d.ts +2 -0
- package/lib/_modules/usage/index.d.ts.map +1 -1
- package/lib/_modules/usage/index.js +2 -0
- package/lib/_modules/usage/index.js.map +1 -1
- package/lib/_modules/usage/usage-controller.js +7 -6
- package/lib/_modules/usage/usage-controller.js.map +1 -1
- package/lib/_modules/usage/usage-routing-module-settings.d.ts +3 -0
- package/lib/_modules/usage/usage-routing-module-settings.d.ts.map +1 -0
- package/lib/_modules/usage/usage-routing-module-settings.js +10 -0
- package/lib/_modules/usage/usage-routing-module-settings.js.map +1 -0
- package/lib/_modules/usage/usage-routing-module.d.ts +3 -0
- package/lib/_modules/usage/usage-routing-module.d.ts.map +1 -0
- package/lib/_modules/usage/usage-routing-module.js +10 -0
- package/lib/_modules/usage/usage-routing-module.js.map +1 -0
- package/lib/_modules/usage/usage.service.d.ts +4 -2
- package/lib/_modules/usage/usage.service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.service.js +13 -11
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_modules/usage-route/usage-controller.d.ts +7 -0
- package/lib/_modules/usage-route/usage-controller.d.ts.map +1 -0
- package/lib/_modules/usage-route/usage-controller.js +89 -0
- package/lib/_modules/usage-route/usage-controller.js.map +1 -0
- package/lib/_modules/usage-route/usage.service.d.ts +19 -0
- package/lib/_modules/usage-route/usage.service.d.ts.map +1 -0
- package/lib/_modules/usage-route/usage.service.js +110 -0
- package/lib/_modules/usage-route/usage.service.js.map +1 -0
- package/lib/_services/dynamobe-api.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-api.service.js +4 -4
- package/lib/_services/dynamobe-api.service.js.map +1 -1
- package/lib/_services/dynamobe-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-auth.service.js +3 -3
- package/lib/_services/dynamobe-auth.service.js.map +1 -1
- package/lib/_services/dynamobe-data.service.d.ts +3 -1
- package/lib/_services/dynamobe-data.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-data.service.js +17 -17
- package/lib/_services/dynamobe-data.service.js.map +1 -1
- package/lib/_services/dynamobe-db.service.d.ts +2 -1
- package/lib/_services/dynamobe-db.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-db.service.js +26 -26
- package/lib/_services/dynamobe-db.service.js.map +1 -1
- package/lib/_services/dynamobe-email.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-email.service.js +5 -5
- package/lib/_services/dynamobe-email.service.js.map +1 -1
- package/lib/_services/dynamobe-global-collection.service.d.ts +1 -0
- package/lib/_services/dynamobe-global-collection.service.d.ts.map +1 -0
- package/lib/_services/dynamobe-global-collection.service.js +58 -0
- package/lib/_services/dynamobe-global-collection.service.js.map +1 -0
- package/lib/_services/dynamobe-global.service.d.ts +2 -1
- package/lib/_services/dynamobe-global.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-global.service.js.map +1 -1
- package/lib/_services/dynamobe-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-routing-module.service.js +4 -4
- package/lib/_services/dynamobe-routing-module.service.js.map +1 -1
- package/lib/_services/dynamobe-server.d.ts +32 -0
- package/lib/_services/dynamobe-server.d.ts.map +1 -0
- package/lib/_services/dynamobe-server.js +183 -0
- package/lib/_services/dynamobe-server.js.map +1 -0
- package/lib/_services/dynamobe-shared-be.service.d.ts +1 -1
- package/lib/_services/dynamobe-shared-be.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-shared-be.service.js.map +1 -1
- package/lib/_services/dynamobe-shared.service.d.ts +16 -1
- package/lib/_services/dynamobe-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamobe-shared.service.js +64 -11
- package/lib/_services/dynamobe-shared.service.js.map +1 -1
- package/lib/_services/index.d.ts +1 -1
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +23 -1
- package/lib/_services/index.js.map +1 -1
- package/lib/api-service.d.ts +6 -0
- package/lib/api-service.d.ts.map +1 -0
- package/lib/api-service.js +12 -0
- package/lib/api-service.js.map +1 -0
- package/lib/app.d.ts +10 -0
- package/lib/app.d.ts.map +1 -0
- package/lib/app.js +17 -0
- package/lib/app.js.map +1 -0
- package/lib/auth.d.ts +4 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +9 -0
- package/lib/auth.js.map +1 -0
- package/lib/controller.d.ts +5 -0
- package/lib/controller.d.ts.map +1 -0
- package/lib/controller.js +11 -0
- package/lib/controller.js.map +1 -0
- package/lib/data-models.d.ts +3 -0
- package/lib/data-models.d.ts.map +1 -0
- package/lib/data-models.js +6 -0
- package/lib/data-models.js.map +1 -0
- package/lib/data-service.d.ts +6 -0
- package/lib/data-service.d.ts.map +1 -0
- package/lib/data-service.js +11 -0
- package/lib/data-service.js.map +1 -0
- package/lib/dynamobe-global.settings.d.ts +3 -0
- package/lib/dynamobe-global.settings.d.ts.map +1 -0
- package/lib/dynamobe-global.settings.js +13 -0
- package/lib/dynamobe-global.settings.js.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +978 -1163
- package/package.json +15 -4
- package/src/_constants/fullstack/module-settings/test-module-settings.ts +14 -0
- package/src/_constants/fullstack/module-settings/usage-module-settings.ts +12 -0
- package/src/_constants/index.ts +2 -0
- package/src/_models/dynamobe-data-model-params.ts +1 -2
- package/src/_models/fullstack/control-models/daily-usage-data.ts +34 -0
- package/src/_models/fullstack/control-models/dynamobe-data-params.ts +19 -0
- package/src/_models/fullstack/control-models/dynamobe-data-property-params.ts +98 -0
- package/src/_models/fullstack/control-models/dynamobe-error.ts +199 -0
- package/src/_models/fullstack/control-models/geo-ip-location.ts +26 -0
- package/src/_models/fullstack/control-models/usage-action.ts +18 -0
- package/src/_models/fullstack/control-models/usage-data.ts +26 -0
- package/src/_models/fullstack/data-models/custom-data.ts +41 -0
- package/src/_models/fullstack/data-models/metadata.ts +30 -0
- package/src/_models/fullstack/data-models/usage-session.ts +85 -0
- package/src/_models/index.ts +12 -0
- package/src/_modules/api-service.index.ts +1 -0
- package/src/_modules/auth.index.ts +3 -0
- package/src/_modules/data-models.index.ts +3 -0
- package/src/_modules/data-service.index.ts +3 -0
- package/src/_modules/test/custom-data.service.ts +1 -2
- package/src/_modules/test/get-test-routing-module.ts +1 -2
- package/src/_modules/test/index.ts +2 -0
- package/src/_modules/test/test-controller.ts +1 -2
- package/src/_modules/usage/get-usage-routing-module.ts +1 -2
- package/src/_modules/usage/index.ts +2 -0
- package/src/_modules/usage/usage-controller.ts +2 -2
- package/src/_modules/usage/usage.service.ts +9 -8
- package/src/_services/dynamobe-api.service.ts +1 -2
- package/src/_services/dynamobe-auth.service.ts +1 -2
- package/src/_services/dynamobe-data.service.ts +4 -3
- package/src/_services/dynamobe-db.service.ts +4 -2
- package/src/_services/dynamobe-email.service.ts +1 -2
- package/src/_services/dynamobe-global.service.ts +2 -2
- package/src/_services/dynamobe-routing-module.service.ts +1 -2
- package/src/_services/dynamobe-shared-be.service.ts +1 -1
- package/src/_services/dynamobe-shared.service.ts +63 -2
- package/src/_services/index.ts +22 -1
- package/src/index.ts +6 -0
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
import { GeoIpLocation } from '../control-models/geo-ip-location';
|
|
3
|
+
import { Metadata } from './metadata';
|
|
4
|
+
import { DynamoUsageData } from '../control-models/usage-data';
|
|
5
|
+
import { DynamoBEDataParams } from '../control-models/dynamobe-data-params';
|
|
6
|
+
|
|
7
|
+
export class DynamoUsageSession extends Metadata {
|
|
8
|
+
date?: string;
|
|
9
|
+
sessionStart?: Date;
|
|
10
|
+
sessionEnd?: Date;
|
|
11
|
+
address?: string;
|
|
12
|
+
issuer?: string;
|
|
13
|
+
locationData?: GeoIpLocation;
|
|
14
|
+
|
|
15
|
+
usageData?: DynamoUsageData[];
|
|
16
|
+
totalSessionTime?: number;
|
|
17
|
+
loggedInAs?: string;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
set?: {
|
|
21
|
+
_id?: string,
|
|
22
|
+
|
|
23
|
+
date?: string;
|
|
24
|
+
sessionStart?: Date,
|
|
25
|
+
sessionEnd?: Date,
|
|
26
|
+
address?: string,
|
|
27
|
+
issuer?: string,
|
|
28
|
+
locationData?: GeoIpLocation,
|
|
29
|
+
|
|
30
|
+
usageData?: DynamoUsageData[],
|
|
31
|
+
totalSessionTime?: number,
|
|
32
|
+
loggedInAs?: string,
|
|
33
|
+
|
|
34
|
+
__created?: Date,
|
|
35
|
+
__createdBy?: string,
|
|
36
|
+
__lastModified?: Date,
|
|
37
|
+
__lastModifiedBy?: string,
|
|
38
|
+
__v?: number
|
|
39
|
+
}
|
|
40
|
+
) {
|
|
41
|
+
super({
|
|
42
|
+
_id: set?._id,
|
|
43
|
+
__created: set?.__created,
|
|
44
|
+
__createdBy: set?.__createdBy,
|
|
45
|
+
__lastModified: set?.__lastModified,
|
|
46
|
+
__lastModifiedBy: set?.__lastModifiedBy,
|
|
47
|
+
__v: set?.__v,
|
|
48
|
+
});
|
|
49
|
+
if (set) {
|
|
50
|
+
if (set.date) {
|
|
51
|
+
this.date = set.date;
|
|
52
|
+
} else if (set.sessionStart) {
|
|
53
|
+
this.date = set.sessionStart.toISOString().substring(0, 10);
|
|
54
|
+
}
|
|
55
|
+
this.sessionStart = set.sessionStart;
|
|
56
|
+
this.sessionEnd = set.sessionEnd;
|
|
57
|
+
this.address = set.address;
|
|
58
|
+
this.issuer = set.issuer;
|
|
59
|
+
this.locationData = set.locationData;
|
|
60
|
+
|
|
61
|
+
this.usageData = set.usageData ? set.usageData : [];
|
|
62
|
+
this.totalSessionTime = set.totalSessionTime;
|
|
63
|
+
this.loggedInAs = set.loggedInAs;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const usageSessionModelParams = new DynamoBEDataParams({
|
|
69
|
+
dataName: 'usageSession',
|
|
70
|
+
modelParams: [
|
|
71
|
+
{ key: 'date', type: 'string',
|
|
72
|
+
required: true, index: true
|
|
73
|
+
},
|
|
74
|
+
{ key: 'sessionStart', type: 'Date',
|
|
75
|
+
required: true, index: true
|
|
76
|
+
},
|
|
77
|
+
{ key: 'sessionEnd', type: 'Date' },
|
|
78
|
+
{ key: 'address', type: 'string' },
|
|
79
|
+
{ key: 'issuer', type: 'string' },
|
|
80
|
+
{ key: 'locationData', type: 'IpApiLocation' },
|
|
81
|
+
{ key: 'usageData', type: 'UsageData[]' },
|
|
82
|
+
{ key: 'totalSessionTime', type: 'number' },
|
|
83
|
+
{ key: 'loggedInAs', type: 'string' },
|
|
84
|
+
]
|
|
85
|
+
})
|
package/src/_models/index.ts
CHANGED
|
@@ -6,4 +6,16 @@ export * from './dynamobe-app-params';
|
|
|
6
6
|
export * from './dynamobe-data-model-params';
|
|
7
7
|
export * from './dynamobe-endpoint-params';
|
|
8
8
|
export * from './dynamobe-global-settings';
|
|
9
|
+
// FULLSTACK - CONTROL MODELS
|
|
10
|
+
export * from './fullstack/control-models/daily-usage-data';
|
|
11
|
+
export * from './fullstack/control-models/dynamobe-data-property-params';
|
|
12
|
+
export * from './fullstack/control-models/dynamobe-error';
|
|
13
|
+
export * from './fullstack/control-models/geo-ip-location';
|
|
14
|
+
export * from './fullstack/control-models/usage-action';
|
|
15
|
+
export * from './fullstack/control-models/usage-data';
|
|
16
|
+
export * from './fullstack/control-models/dynamobe-data-params';
|
|
17
|
+
// FULLSTACK - DATA MODELS
|
|
18
|
+
export * from './fullstack/data-models/custom-data';
|
|
19
|
+
export * from './fullstack/data-models/metadata';
|
|
20
|
+
export * from './fullstack/data-models/usage-session';
|
|
9
21
|
|
|
@@ -4,3 +4,6 @@ export * from '../_services/dynamobe-data.service';
|
|
|
4
4
|
export * from '../_services/dynamobe-db.service';
|
|
5
5
|
export * from '../_services/dynamobe-global.service';
|
|
6
6
|
export * from '../_services/dynamobe-shared.service';
|
|
7
|
+
|
|
8
|
+
// MODELS
|
|
9
|
+
export * from '../_models/fullstack/control-models/dynamobe-error';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { CustomData, customDataModelParams } from '
|
|
5
|
-
|
|
4
|
+
import { CustomData, customDataModelParams } from '../../_models/fullstack/data-models/custom-data';
|
|
6
5
|
import { DynamoBEDataService } from '../../_services/dynamobe-data.service';
|
|
7
6
|
|
|
8
7
|
export class CustomDataService extends DynamoBEDataService<CustomData> {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { testModuleSettings } from '
|
|
3
|
-
|
|
2
|
+
import { testModuleSettings } from '../../_constants/fullstack/module-settings/test-module-settings';
|
|
4
3
|
import { DynamoBERouteSecurity } from '../../_enums/dynamobe-route-security.enum';
|
|
5
4
|
import { DynamoBERoutingModule, DynamoBERoutingModuleSettings } from '../../_services/dynamobe-routing-module.service';
|
|
6
5
|
import { TestController } from './test-controller';
|
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
export * from './test-controller';
|
|
4
4
|
export * from './custom-data.service';
|
|
5
5
|
export * from './get-test-routing-module';
|
|
6
|
+
export * from '../../_models/fullstack/data-models/custom-data';
|
|
7
|
+
export * from '../../_constants/fullstack/module-settings/test-module-settings';
|
|
6
8
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
|
-
import { testModuleSettings } from '
|
|
4
|
-
|
|
3
|
+
import { testModuleSettings } from '../../_constants/fullstack/module-settings/test-module-settings';
|
|
5
4
|
import { HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
6
5
|
import { DynamoBEEndpointParams } from '../../_models/dynamobe-endpoint-params';
|
|
7
6
|
import { DynamoBEController } from '../../_services/dynamobe-controller.service';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { usageModuleSettings } from '
|
|
3
|
-
|
|
2
|
+
import { usageModuleSettings } from '../../_constants/fullstack/module-settings/usage-module-settings';
|
|
4
3
|
import { DynamoBERouteSecurity } from '../../_enums/dynamobe-route-security.enum';
|
|
5
4
|
import { DynamoBERoutingModule, DynamoBERoutingModuleSettings } from '../../_services/dynamobe-routing-module.service';
|
|
6
5
|
import { UsageController } from './usage-controller';
|
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
export * from './usage-controller';
|
|
4
4
|
export * from './usage.service';
|
|
5
5
|
export * from './get-usage-routing-module';
|
|
6
|
+
export * from '../../_models/fullstack/data-models/usage-session';
|
|
7
|
+
export * from '../../_constants/fullstack/module-settings/usage-module-settings';
|
|
6
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
|
-
import { usageModuleSettings
|
|
4
|
-
|
|
3
|
+
import { usageModuleSettings } from '../../_constants/fullstack/module-settings/usage-module-settings';
|
|
5
4
|
import { HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
6
5
|
import { DynamoBEEndpointParams } from '../../_models/dynamobe-endpoint-params';
|
|
6
|
+
import { DynamoUsageSession } from '../../_models/fullstack/data-models/usage-session';
|
|
7
7
|
import { DynamoBEAuthService } from '../../_services/dynamobe-auth.service';
|
|
8
8
|
import { DynamoBEController } from '../../_services/dynamobe-controller.service';
|
|
9
9
|
import { DBE_Global_S } from '../../_services/dynamobe-global.service';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import { Request } from 'express';
|
|
3
|
-
import { DynamoUsageSession, DynamoUsageData, DailyUsageData,
|
|
4
|
-
usageSessionModelParams, DynamoBEError } from '@futdevpro/fsm-dynamo';
|
|
5
|
-
|
|
6
2
|
import { DynamoBEDataService } from '../../_services/dynamobe-data.service';
|
|
7
|
-
import {
|
|
3
|
+
import { DynamoBEError } from '../../_models/fullstack/control-models/dynamobe-error';
|
|
4
|
+
import { DBE_Shared } from '../../_services/dynamobe-shared.service';
|
|
5
|
+
import { Request } from 'express';
|
|
6
|
+
import { DynamoUsageData } from '../../_models/fullstack/control-models/usage-data';
|
|
7
|
+
import { DailyUsageData } from '../../_models/fullstack/control-models/daily-usage-data';
|
|
8
|
+
import { DynamoUsageSession, usageSessionModelParams } from '../../_models/fullstack/data-models/usage-session';
|
|
8
9
|
|
|
9
10
|
export class UsageService extends DynamoBEDataService<DynamoUsageSession> {
|
|
10
11
|
usageData: DynamoUsageData[] = [];
|
|
@@ -27,8 +28,8 @@ export class UsageService extends DynamoBEDataService<DynamoUsageSession> {
|
|
|
27
28
|
|
|
28
29
|
getLocationDataFromRequest(req: Request): void {
|
|
29
30
|
try {
|
|
30
|
-
this.data.address =
|
|
31
|
-
this.data.locationData =
|
|
31
|
+
this.data.address = DBE_Shared.getIpFromRequest(req);
|
|
32
|
+
this.data.locationData = DBE_Shared.getLocationDataByRequest(req);
|
|
32
33
|
|
|
33
34
|
/* console.log(`...getLocationDataFromRequest... ip: ${this.data.address}`, this.data.locationData); */
|
|
34
35
|
} catch (error) {
|
|
@@ -39,7 +40,7 @@ export class UsageService extends DynamoBEDataService<DynamoUsageSession> {
|
|
|
39
40
|
async getLastWeekUsage(): Promise<void> {
|
|
40
41
|
try {
|
|
41
42
|
await this.dataDBService.find({
|
|
42
|
-
sessionStart: { $gte:
|
|
43
|
+
sessionStart: { $gte: DBE_Shared.oneWeekAgo() }
|
|
43
44
|
}).then((res: DynamoUsageSession[]) => {
|
|
44
45
|
this.dataList = res;
|
|
45
46
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import * as Axios from 'axios';
|
|
3
|
-
import { DynamoBEError } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
|
|
5
3
|
import { HttpCallType } from '../_enums/http/http-call-type.enum';
|
|
6
4
|
import { HttpResponseType } from '../_enums/http/http-response-type.enum';
|
|
7
5
|
import { DynamoBEApiCallParams } from '../_models/dynamobe-api-call-params';
|
|
6
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
8
7
|
import { DBE_Shared } from './dynamobe-shared.service';
|
|
9
8
|
|
|
10
9
|
export class DynamoBEApiService {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { NextFunction, Request, Response } from 'express';
|
|
3
|
-
import { DynamoBEError } from '
|
|
4
|
-
|
|
3
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
5
4
|
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
3
|
+
import { Metadata } from '../_models/fullstack/data-models/metadata';
|
|
5
4
|
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
5
|
+
import { DynamoBEDataPropertyParams } from '../_models/fullstack/control-models/dynamobe-data-property-params';
|
|
6
6
|
import { DBE_Global_S } from './dynamobe-global.service';
|
|
7
|
+
import { DynamoBEDataParams } from '../_models/fullstack/control-models/dynamobe-data-params';
|
|
7
8
|
|
|
8
9
|
export class DynamoBEDataService<T extends Metadata> {
|
|
9
10
|
dataDBService: DynamoBEDBService<T>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
3
|
import { Schema } from 'mongoose';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
5
|
+
import { Metadata } from '../_models/fullstack/data-models/metadata';
|
|
6
|
+
import { DynamoBEDataPropertyParams } from '../_models/fullstack/control-models/dynamobe-data-property-params';
|
|
7
|
+
import { DynamoBEDataParams } from '../_models/fullstack/control-models/dynamobe-data-params';
|
|
6
8
|
|
|
7
9
|
export class DynamoBEDBService<T extends Metadata> {
|
|
8
10
|
dataModel = mongoose.model(this.dataParams.dbName, this.getSchema());
|
|
@@ -3,8 +3,7 @@ import * as FileSystem from 'fs';
|
|
|
3
3
|
import * as Path from 'path';
|
|
4
4
|
import * as NodeMailer from 'nodemailer';
|
|
5
5
|
import { Options as MailOptions, Attachment } from 'nodemailer/lib/mailer';
|
|
6
|
-
import { DynamoBEError } from '
|
|
7
|
-
|
|
6
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
8
7
|
import { DBE_Shared } from './dynamobe-shared.service';
|
|
9
8
|
|
|
10
9
|
export class DynamoBEEmailService {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { Metadata } from '../_models/fullstack/data-models/metadata';
|
|
5
4
|
import { DynamoBEAuthService } from './dynamobe-auth.service';
|
|
6
5
|
import { DynamoBEDBServiceCollection } from './dynamobe-db-service-collection.service';
|
|
7
6
|
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
8
7
|
import { DynamoBEEmailServiceCollection } from './dynamobe-email-service-collection.service';
|
|
9
8
|
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
9
|
+
import { DynamoBEDataParams } from '../_models/fullstack/control-models/dynamobe-data-params';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { Router } from 'express';
|
|
3
|
-
import { DynamoBEError } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
|
|
5
3
|
import { dynamoBEGlobalSettings } from '../_constants/dynamobe-global.settings';
|
|
6
4
|
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
7
5
|
import { HttpCallType } from '../_enums/http/http-call-type.enum';
|
|
8
6
|
import { DynamoBEEndpointParams } from '../_models/dynamobe-endpoint-params';
|
|
7
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
9
8
|
import { DynamoBEController } from './dynamobe-controller.service';
|
|
10
9
|
import { DBE_Shared } from './dynamobe-shared.service';
|
|
11
10
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import * as ReadLine from 'readline';
|
|
3
3
|
import { Request } from 'express';
|
|
4
4
|
import * as GeoIp from 'geoip-lite';
|
|
5
|
-
import { GeoIpLocation } from '@futdevpro/fsm-dynamo';
|
|
6
5
|
|
|
7
6
|
import { DBE_Shared } from './dynamobe-shared.service';
|
|
7
|
+
import { GeoIpLocation } from '../_models/fullstack/control-models/geo-ip-location';
|
|
8
8
|
|
|
9
9
|
export class DBE_Shared_BE extends DBE_Shared {
|
|
10
10
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as ReadLine from 'readline';
|
|
3
|
+
import { Request } from 'express';
|
|
4
|
+
import * as GeoIp from 'geoip-lite';
|
|
5
|
+
|
|
6
|
+
import { GeoIpLocation } from '../_models/fullstack/control-models/geo-ip-location';
|
|
4
7
|
import { LogStyle } from '../_enums/log-style.enum';
|
|
8
|
+
import { DynamoBEError } from '../_models/fullstack/control-models/dynamobe-error';
|
|
9
|
+
|
|
10
|
+
export const second = 1000;
|
|
11
|
+
export const minute = second * 60;
|
|
12
|
+
export const hour = minute * 60;
|
|
13
|
+
export const day = hour * 24;
|
|
14
|
+
export const week = day * 7;
|
|
15
|
+
export const month = day * 30.4368499;
|
|
16
|
+
export const year = day * 365.242199;
|
|
5
17
|
|
|
6
18
|
export class DBE_Shared {
|
|
7
19
|
|
|
@@ -217,6 +229,33 @@ export class DBE_Shared {
|
|
|
217
229
|
return new Date(+new Date() - year);
|
|
218
230
|
}
|
|
219
231
|
|
|
232
|
+
static getIpFromRequest(request: Request): string {
|
|
233
|
+
/* console.log('TESTTTT route:\n',
|
|
234
|
+
`\n|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n
|
|
235
|
+
HEADERS\n`, request.headers,
|
|
236
|
+
`\n|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n
|
|
237
|
+
ELSE\n`,
|
|
238
|
+
`\nremote `, request.socket.remoteAddress,
|
|
239
|
+
`\nlocal `, request.socket.localAddress,
|
|
240
|
+
); */
|
|
241
|
+
|
|
242
|
+
let ip: string;
|
|
243
|
+
if (request.headers['x-forwarded-for']) {
|
|
244
|
+
const route: string[] = (request.headers['x-forwarded-for'] as string).split(', ');
|
|
245
|
+
console.log('TESTTTT route:', route);
|
|
246
|
+
ip = route[route.length - 1];
|
|
247
|
+
} else {
|
|
248
|
+
ip = request.socket.remoteAddress;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* console.log(`ip from request: ${ip}`); */
|
|
252
|
+
return ip;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static getLocationDataByRequest(request: Request): GeoIpLocation {
|
|
256
|
+
return GeoIp.lookup(this.getIpFromRequest(request));
|
|
257
|
+
}
|
|
258
|
+
|
|
220
259
|
static setLogStyle(styles: LogStyle[]): void {
|
|
221
260
|
let styleSets = '';
|
|
222
261
|
styles.forEach((style: LogStyle) => {
|
|
@@ -263,5 +302,27 @@ export class DBE_Shared {
|
|
|
263
302
|
console.warn(`${LogStyle.yellow}${LogStyle.bright}${message}${LogStyle.reset}`);
|
|
264
303
|
}
|
|
265
304
|
}
|
|
305
|
+
|
|
306
|
+
static async prompt(question: string): Promise<string> {
|
|
307
|
+
const readLine = ReadLine.createInterface({
|
|
308
|
+
input: process.stdin,
|
|
309
|
+
output: process.stdout
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
return new Promise((resolve, reject) => {
|
|
313
|
+
try {
|
|
314
|
+
readLine.question(question, (result: string) => {
|
|
315
|
+
resolve(result);
|
|
316
|
+
readLine.close();
|
|
317
|
+
});
|
|
318
|
+
} catch (error) {
|
|
319
|
+
reject(error);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
266
323
|
}
|
|
267
324
|
|
|
325
|
+
export interface LocationCoordinates {
|
|
326
|
+
longitude: number;
|
|
327
|
+
latitude: number;
|
|
328
|
+
}
|
package/src/_services/index.ts
CHANGED
|
@@ -13,8 +13,29 @@ export * from './dynamobe-email-service-collection.service';
|
|
|
13
13
|
export * from './dynamobe-email.service';
|
|
14
14
|
export * from './dynamobe-global.service';
|
|
15
15
|
export * from './dynamobe-routing-module.service';
|
|
16
|
-
export * from './dynamobe-shared.service';
|
|
17
16
|
export * from './dynamobe-shared-be.service';
|
|
17
|
+
export * from './dynamobe-shared.service';
|
|
18
18
|
export * from './dynamobe-singleton.service';
|
|
19
19
|
|
|
20
|
+
/*
|
|
21
|
+
import { DynamoBEApiService } from './dynamobe-api.service';
|
|
22
|
+
import { DynamoBEApp } from './dynamobe-app';
|
|
23
|
+
import { DynamoBEAuthService } from './dynamobe-auth.service';
|
|
24
|
+
import { DynamoBEController } from './dynamobe-controller.service';
|
|
25
|
+
import { DynamoBEDataService } from './dynamobe-data.service';
|
|
26
|
+
import { DynamoBEDBServiceCollection } from './dynamobe-db-service-collection.service';
|
|
27
|
+
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
28
|
+
import { DynamoBEEmailServiceCollection } from './dynamobe-email-service-collection.service';
|
|
29
|
+
import { DynamoBEEmailService } from './dynamobe-email.service';
|
|
30
|
+
import { DBE_Global_S } from './dynamobe-global.service';
|
|
31
|
+
import { DynamoBERountingModule } from './dynamobe-routing-module.service';
|
|
32
|
+
import { DynamoBEServer } from './dynamobe-server';
|
|
33
|
+
import { DBE_Shared } from './dynamobe-shared.service';
|
|
34
|
+
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
20
35
|
|
|
36
|
+
module.exports = {
|
|
37
|
+
DynamoBEApiService, DynamoBEApp, DynamoBEAuthService, DynamoBEController,
|
|
38
|
+
DynamoBEDataService, DynamoBEDBServiceCollection, DynamoBEDBService,
|
|
39
|
+
DynamoBEEmailServiceCollection, DynamoBEEmailService, DBE_Global_S,
|
|
40
|
+
DynamoBERountingModule, DynamoBEServer, DBE_Shared, DynamoBESingletonService
|
|
41
|
+
} */
|
package/src/index.ts
CHANGED
|
@@ -15,3 +15,9 @@ export * from './_services';
|
|
|
15
15
|
export * from './_modules/test/index';
|
|
16
16
|
export * from './_modules/usage/index';
|
|
17
17
|
|
|
18
|
+
/* export * from './_modules/app.index';
|
|
19
|
+
export * from './_modules/api-service.index';
|
|
20
|
+
export * from './_modules/auth.index';
|
|
21
|
+
export * from './_modules/controller.index';
|
|
22
|
+
export * from './_modules/data-models.index';
|
|
23
|
+
export * from './_modules/data-service.index'; */
|