@futdevpro/fsm-dynamo 1.0.11 → 1.0.13

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.
Files changed (110) hide show
  1. package/BuildPackage.bat +1 -0
  2. package/HOWTO.md +15 -0
  3. package/LICENSE +21 -0
  4. package/README.md +17 -24
  5. package/lib/_constants/module-settings/test-module-settings.d.ts +1 -0
  6. package/lib/_constants/module-settings/test-module-settings.d.ts.map +1 -0
  7. package/lib/_constants/module-settings/test-module-settings.js.map +1 -1
  8. package/lib/_constants/module-settings/usage-module-settings.d.ts +1 -0
  9. package/lib/_constants/module-settings/usage-module-settings.d.ts.map +1 -0
  10. package/lib/_constants/module-settings/usage-module-settings.js.map +1 -1
  11. package/lib/_constants/times.d.ts +1 -0
  12. package/lib/_constants/times.d.ts.map +1 -0
  13. package/lib/_constants/times.js.map +1 -1
  14. package/lib/_models/control-models/daily-usage-data.d.ts +1 -0
  15. package/lib/_models/control-models/daily-usage-data.d.ts.map +1 -0
  16. package/lib/_models/control-models/daily-usage-data.js.map +1 -1
  17. package/lib/_models/control-models/dynamo-module-settings.d.ts +1 -0
  18. package/lib/_models/control-models/dynamo-module-settings.d.ts.map +1 -0
  19. package/lib/_models/control-models/dynamo-module-settings.js.map +1 -1
  20. package/lib/_models/control-models/dynamobe-data-params.d.ts +1 -0
  21. package/lib/_models/control-models/dynamobe-data-params.d.ts.map +1 -0
  22. package/lib/_models/control-models/dynamobe-data-params.js.map +1 -1
  23. package/lib/_models/control-models/dynamobe-data-property-params.d.ts +1 -0
  24. package/lib/_models/control-models/dynamobe-data-property-params.d.ts.map +1 -0
  25. package/lib/_models/control-models/dynamobe-data-property-params.js.map +1 -1
  26. package/lib/_models/control-models/dynamobe-error.d.ts +1 -0
  27. package/lib/_models/control-models/dynamobe-error.d.ts.map +1 -0
  28. package/lib/_models/control-models/dynamobe-error.js.map +1 -1
  29. package/lib/_models/control-models/geo-ip-location.d.ts +1 -0
  30. package/lib/_models/control-models/geo-ip-location.d.ts.map +1 -0
  31. package/lib/_models/control-models/geo-ip-location.js.map +1 -1
  32. package/lib/_models/control-models/location-coordinates.d.ts +1 -0
  33. package/lib/_models/control-models/location-coordinates.d.ts.map +1 -0
  34. package/lib/_models/control-models/location-coordinates.js.map +1 -1
  35. package/lib/_models/control-models/usage-action.d.ts +1 -0
  36. package/lib/_models/control-models/usage-action.d.ts.map +1 -0
  37. package/lib/_models/control-models/usage-action.js.map +1 -1
  38. package/lib/_models/control-models/usage-data.d.ts +1 -0
  39. package/lib/_models/control-models/usage-data.d.ts.map +1 -0
  40. package/lib/_models/control-models/usage-data.js.map +1 -1
  41. package/lib/_models/data-models/custom-data.d.ts +1 -0
  42. package/lib/_models/data-models/custom-data.d.ts.map +1 -0
  43. package/lib/_models/data-models/custom-data.js.map +1 -1
  44. package/lib/_models/data-models/metadata.d.ts +1 -0
  45. package/lib/_models/data-models/metadata.d.ts.map +1 -0
  46. package/lib/_models/data-models/metadata.js.map +1 -1
  47. package/lib/_models/data-models/usage-session.d.ts +1 -0
  48. package/lib/_models/data-models/usage-session.d.ts.map +1 -0
  49. package/lib/_models/data-models/usage-session.js.map +1 -1
  50. package/lib/data-models.d.ts +3 -0
  51. package/lib/data-models.d.ts.map +1 -0
  52. package/lib/data-models.js +7 -0
  53. package/lib/data-models.js.map +1 -0
  54. package/lib/index.d.ts +15 -0
  55. package/lib/index.d.ts.map +1 -0
  56. package/lib/index.js +23 -0
  57. package/lib/index.js.map +1 -0
  58. package/lib/tsconfig.tsbuildinfo +2316 -0
  59. package/nodemon.json +6 -0
  60. package/package.json +45 -48
  61. package/src/_constants/module-settings/test-module-settings.ts +15 -0
  62. package/src/_constants/module-settings/usage-module-settings.ts +12 -0
  63. package/src/_constants/times.ts +8 -0
  64. package/src/_models/control-models/daily-usage-data.ts +34 -0
  65. package/src/_models/control-models/dynamo-module-settings.ts +8 -0
  66. package/src/_models/control-models/dynamobe-data-params.ts +19 -0
  67. package/src/_models/control-models/dynamobe-data-property-params.ts +97 -0
  68. package/src/_models/control-models/dynamobe-error.ts +200 -0
  69. package/src/_models/control-models/geo-ip-location.ts +26 -0
  70. package/src/_models/control-models/location-coordinates.ts +5 -0
  71. package/src/_models/control-models/usage-action.ts +18 -0
  72. package/src/_models/control-models/usage-data.ts +26 -0
  73. package/src/_models/data-models/custom-data.ts +41 -0
  74. package/src/_models/data-models/metadata.ts +30 -0
  75. package/src/_models/data-models/usage-session.ts +85 -0
  76. package/src/data-models.ts +6 -0
  77. package/src/index.ts +22 -0
  78. package/src/sync.ffs_db +0 -0
  79. package/src/version.json +2 -0
  80. package/tsconfig.app.json +12 -0
  81. package/tsconfig.json +26 -0
  82. package/data-models.d.ts +0 -2
  83. package/data-models.js +0 -7
  84. package/data-models.js.map +0 -1
  85. package/esm2020/futdevpro-fsm-dynamo.mjs +0 -5
  86. package/esm2020/lib/_constants/module-settings/test-module-settings.mjs +0 -13
  87. package/esm2020/lib/_constants/module-settings/usage-module-settings.mjs +0 -10
  88. package/esm2020/lib/_constants/times.mjs +0 -8
  89. package/esm2020/lib/_models/control-models/daily-usage-data.mjs +0 -18
  90. package/esm2020/lib/_models/control-models/dynamo-module-settings.mjs +0 -2
  91. package/esm2020/lib/_models/control-models/dynamobe-data-params.mjs +0 -8
  92. package/esm2020/lib/_models/control-models/dynamobe-data-property-params.mjs +0 -63
  93. package/esm2020/lib/_models/control-models/dynamobe-error.mjs +0 -183
  94. package/esm2020/lib/_models/control-models/geo-ip-location.mjs +0 -2
  95. package/esm2020/lib/_models/control-models/location-coordinates.mjs +0 -2
  96. package/esm2020/lib/_models/control-models/usage-action.mjs +0 -9
  97. package/esm2020/lib/_models/control-models/usage-data.mjs +0 -12
  98. package/esm2020/lib/_models/data-models/custom-data.mjs +0 -24
  99. package/esm2020/lib/_models/data-models/metadata.mjs +0 -13
  100. package/esm2020/lib/_models/data-models/usage-session.mjs +0 -49
  101. package/esm2020/public-api.mjs +0 -20
  102. package/fesm2015/futdevpro-fsm-dynamo.mjs +0 -415
  103. package/fesm2015/futdevpro-fsm-dynamo.mjs.map +0 -1
  104. package/fesm2020/futdevpro-fsm-dynamo.mjs +0 -413
  105. package/fesm2020/futdevpro-fsm-dynamo.mjs.map +0 -1
  106. package/futdevpro-fsm-dynamo-01.00.10.tgz +0 -0
  107. package/futdevpro-fsm-dynamo.d.ts +0 -5
  108. package/public-api.d.ts +0 -14
  109. package/public-api.js +0 -23
  110. package/public-api.js.map +0 -1
package/nodemon.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "watch": ["src"],
3
+ "ext": ".ts,.js",
4
+ "ignore": [],
5
+ "exec": "ts-node ./src/index.ts"
6
+ }
package/package.json CHANGED
@@ -1,48 +1,45 @@
1
- {
2
- "name": "@futdevpro/fsm-dynamo",
3
- "version": "01.00.11",
4
- "type": "module",
5
- "main": "./public-api.js",
6
- "module": "./public-api.js",
7
- "types": "./public-api.d.ts",
8
- "typings": "./public-api.d.ts",
9
- "exports": {
10
- "./data-models": {
11
- "default": "./data-models.js",
12
- "module": "./data-models.js",
13
- "types": "./data-models.d.ts",
14
- "typings": "./data-models.d.ts"
15
- },
16
- "./package.json": {
17
- "default": "./package.json"
18
- },
19
- ".": {
20
- "default": "./public-api.js",
21
- "types": "./public-api.d.ts",
22
- "esm2020": "./esm2020/futdevpro-fsm-dynamo.mjs",
23
- "es2020": "./fesm2020/futdevpro-fsm-dynamo.mjs",
24
- "es2015": "./fesm2015/futdevpro-fsm-dynamo.mjs",
25
- "node": "./fesm2015/futdevpro-fsm-dynamo.mjs"
26
- }
27
- },
28
- "typesVersions": {
29
- "*": {
30
- "data-models": [
31
- "data-models.d.ts"
32
- ]
33
- }
34
- },
35
- "peerDependencies": {
36
- "@angular/common": "~13.3.11",
37
- "@angular/core": "~13.3.11"
38
- },
39
- "dependencies": {
40
- "tslib": "~2.4.0",
41
- "typescript": "~4.6.4"
42
- },
43
- "es2020": "fesm2020/futdevpro-fsm-dynamo.mjs",
44
- "esm2020": "esm2020/futdevpro-fsm-dynamo.mjs",
45
- "fesm2020": "fesm2020/futdevpro-fsm-dynamo.mjs",
46
- "fesm2015": "fesm2015/futdevpro-fsm-dynamo.mjs",
47
- "sideEffects": false
48
- }
1
+ {
2
+ "name": "@futdevpro/fsm-dynamo",
3
+ "version": "01.00.13",
4
+ "description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Ltd.",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "build": "npx tsc",
8
+ "postbuild": "npm publish"
9
+ },
10
+ "main": "./lib/index.js",
11
+ "module": "./lib/index.js",
12
+ "types": "./lib/index.d.ts",
13
+ "typings": "./lib/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./lib/index.d.ts",
17
+ "typings": "./lib/index.d.ts",
18
+ "module": "./lib/index.js",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./data-model": {
22
+ "types": "./lib/data-model.index.d.ts",
23
+ "typings": "./lib/data-model.index.d.ts",
24
+ "module": "./lib/data-model.index.js",
25
+ "default": "./lib/data-model.index.js"
26
+ }
27
+ },
28
+ "typesVersions": {
29
+ "*": {
30
+ "data-model": [
31
+ "lib/data-model.d.ts"
32
+ ]
33
+ }
34
+ },
35
+ "keywords": [],
36
+ "author": "Future Development Program Ltd.",
37
+ "license": "ISC",
38
+ "homepage": "https:/futdevpro.hu/projects/dynamo",
39
+ "dependencies": {
40
+ "@types/node": "~14.0.27",
41
+ "ts-node": "~8.10.2",
42
+ "tslib": "~2.0.1",
43
+ "typescript": "~3.9.7"
44
+ }
45
+ }
@@ -0,0 +1,15 @@
1
+
2
+ import { DynamoModuleSettings } from '../../_models/control-models/dynamo-module-settings';
3
+
4
+ export const testModuleSettings: DynamoModuleSettings = {
5
+ mainRoute: '/test',
6
+ endPoints: {
7
+ testGet: '/test-get',
8
+ testPost: '/test-post',
9
+ testPut: '/test-put',
10
+ testPatch: '/test-patch',
11
+ testDelete: '/test-delete',
12
+ getCustomData: '/custom/get/:customId',
13
+ modifyCustomData: '/custom/post'
14
+ }
15
+ };
@@ -0,0 +1,12 @@
1
+
2
+ import { DynamoModuleSettings } from '../../_models/control-models/dynamo-module-settings';
3
+
4
+ export const usageModuleSettings: DynamoModuleSettings = {
5
+ mainRoute: '/usage',
6
+ endPoints: {
7
+ newSession: '/new-session',
8
+ closeSession: '/close-session/:sessionId',
9
+ updateUsage: '/update/:sessionId',
10
+ getAllUsageData: '/get/all',
11
+ }
12
+ };
@@ -0,0 +1,8 @@
1
+
2
+ export const second = 1000;
3
+ export const minute = second * 60;
4
+ export const hour = minute * 60;
5
+ export const day = hour * 24;
6
+ export const week = day * 7;
7
+ export const month = day * 30.4368499;
8
+ export const year = day * 365.242199;
@@ -0,0 +1,34 @@
1
+
2
+ import { DynamoUsageSession } from "../data-models/usage-session";
3
+
4
+ export class DailyUsageData {
5
+ date?: string;
6
+ totalVisitTime?: number = 0;
7
+ averageVisitTime?: number = 0;
8
+ visitorsHun?: number = 0;
9
+ visitorsElse?: number = 0;
10
+
11
+ visitations?: DynamoUsageSession[] = [];
12
+
13
+ constructor(
14
+ set?: {
15
+ date?: string,
16
+ totalVisitTime?: number,
17
+ averageVisitTime?: number,
18
+ visitorsHun?: number,
19
+ visitorsElse?: number,
20
+
21
+ visitations?: DynamoUsageSession[],
22
+ }
23
+ ) {
24
+ if (set) {
25
+ this.date = set.date;
26
+ this.totalVisitTime = set.totalVisitTime ? set.totalVisitTime : 0;
27
+ this.averageVisitTime = set.averageVisitTime ? set.averageVisitTime : 0;
28
+ this.visitorsHun = set.visitorsHun ? set.visitorsHun : 0;
29
+ this.visitorsElse = set.visitorsElse ? set.visitorsElse : 0;
30
+
31
+ this.visitations = set.visitations ? set.visitations : [];
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,8 @@
1
+
2
+ export interface DynamoModuleSettings {
3
+ mainRoute: string;
4
+
5
+ endPoints: {
6
+ [endpoint: string]: string
7
+ };
8
+ }
@@ -0,0 +1,19 @@
1
+
2
+ import { DynamoBEDataPropertyParams } from './dynamobe-data-property-params';
3
+
4
+ export class DynamoBEDataParams {
5
+ dataName: string;
6
+ dbName: string;
7
+ modelParams: DynamoBEDataPropertyParams[];
8
+
9
+ constructor(
10
+ set: {
11
+ dataName: string,
12
+ modelParams: DynamoBEDataPropertyParams[],
13
+ }
14
+ ) {
15
+ this.dataName = set.dataName;
16
+ this.dbName = set.dataName.charAt(0).toUpperCase() + set.dataName.slice(1);
17
+ this.modelParams = set.modelParams ? set.modelParams : [];
18
+ }
19
+ }
@@ -0,0 +1,97 @@
1
+
2
+ import { DynamoBEError } from './dynamobe-error';
3
+
4
+ export class DynamoBEDataPropertyParams {
5
+ key?: string;
6
+ type?: 'string' | 'number' | 'boolean' | 'Date' | 'object' | string;
7
+
8
+ unique?: boolean;
9
+ required?: boolean;
10
+ index?: boolean;
11
+
12
+ isDependencyHook?: boolean;
13
+ dependencyName?: string;
14
+
15
+ minlength?: number;
16
+ maxlength?: number;
17
+
18
+ subObjectParams?: DynamoBEDataPropertyParams[] = [];
19
+
20
+ additionalValidators?: ((data: any) => void)[];
21
+
22
+ constructor(
23
+ set: {
24
+ key: string,
25
+ type: 'string' | 'number' | 'boolean' | 'Date' | 'object' | string,
26
+
27
+ unique?: boolean,
28
+ required?: boolean,
29
+ index?: boolean,
30
+
31
+ isDependencyHook?: boolean,
32
+ dependencyDBServiceName?: string,
33
+
34
+ minlength?: number,
35
+ maxlength?: number,
36
+
37
+ subObjectParams?: DynamoBEDataPropertyParams[],
38
+
39
+ additionalValidators?: ((data: any) => void)[],
40
+ }
41
+ ) {
42
+ if (set) {
43
+ this.key = set.key;
44
+ this.type = set.type;
45
+
46
+ if (this.getBEType) {
47
+ if (set?.subObjectParams) {
48
+ this.subObjectParams = set.subObjectParams;
49
+ } else {
50
+ console.log('DYNAMO ERROR: \n subObjectParams missing', '\n\n', new Error());
51
+ throw new DynamoBEError({ message: 'subObjectParams missing' });
52
+ }
53
+ }
54
+
55
+ if (set.isDependencyHook) {
56
+ if (set.dependencyDBServiceName) {
57
+ this.isDependencyHook = set.isDependencyHook;
58
+ this.dependencyName = set.dependencyDBServiceName;
59
+ } else {
60
+ this.isDependencyHook = set.isDependencyHook;
61
+ console.log('DYNAMO ERROR: \n dependencyDBServiceName missing for dependencyHook', '\n\n', new Error());
62
+ }
63
+ }
64
+ this.unique = set.unique;
65
+ this.required = set.required;
66
+ this.index = set.index;
67
+ this.minlength = set.minlength;
68
+ this.maxlength = set.maxlength;
69
+ this.additionalValidators = set.additionalValidators;
70
+ } else {
71
+ console.log('DYNAMO ERROR: \nMISSING DynamoBEDataPropertyParams constructor input', '\n\n', new Error());
72
+ }
73
+ }
74
+
75
+ // tslint:disable-next-line: ban-types
76
+ getBEType?(): String | Number | Boolean | Object | Function | Array<any> | Date {
77
+ switch (this.type) {
78
+ case 'string':
79
+ return String;
80
+ case 'number':
81
+ return Number;
82
+ case 'boolean':
83
+ return Boolean;
84
+ case 'Date':
85
+ return Date;
86
+ case 'object':
87
+ default:
88
+ if (this.type?.includes('[]')) {
89
+ return Array;
90
+ } else if (this.type?.includes('=>') || this.type?.includes('function')) {
91
+ return Function;
92
+ } else {
93
+ return Object;
94
+ }
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,200 @@
1
+
2
+
3
+ export class DynamoBEError {
4
+ flag = 'DYNAMO-BE ERROR OBJECT';
5
+ handled: boolean;
6
+ status: number;
7
+ errors: any[] = [];
8
+ error: any;
9
+ messages: string[] = [];
10
+ userMessages: string[] = [];
11
+
12
+ constructor(
13
+ set: {
14
+ handled?: boolean;
15
+ status?: number,
16
+ message?: string,
17
+ messages?: string[],
18
+ userMessage?: string,
19
+ error?: any,
20
+ consoleLog?: boolean,
21
+ }
22
+ ) {
23
+ this.handled = !!set.handled;
24
+ if (set.status) {
25
+ this.status = set.status;
26
+ }
27
+ this.status = set?.error?.status ? set.error.status : set.status;
28
+
29
+ if (set?.error?.errors) {
30
+ this.errors = this.errors.concat(set?.error?.errors);
31
+ }
32
+ if (set?.error?.messages) {
33
+ this.messages = this.messages.concat(set?.error?.messages);
34
+ }
35
+ if (set?.error?.userMessages) {
36
+ this.userMessages = this.userMessages.concat(set?.error?.userMessages);
37
+ }
38
+
39
+ if (set.error) {
40
+ if (set.error instanceof DynamoBEError) {
41
+ this.errors.push(set.error.error);
42
+ } else {
43
+ if (set.error.error) {
44
+ this.errors.push(set.error.error);
45
+ }
46
+ this.errors.push(set.error);
47
+ }
48
+ if (set.error.message) {
49
+ this.messages.push(set.error.message);
50
+ }
51
+ if (set.error.status) {
52
+ this.status = set.error.status;
53
+ }
54
+ }
55
+ if (set.message) {
56
+ this.messages.push(set.message)
57
+ }
58
+ if (set.messages) {
59
+ this.messages.push(...set.messages)
60
+ }
61
+ if (set.userMessage) {
62
+ this.userMessages.push(set.userMessage)
63
+ }
64
+ if (set.consoleLog) {
65
+ console.log(this);
66
+ }
67
+ }
68
+ }
69
+
70
+ /*
71
+
72
+ // //
73
+ // RESPONSE STATUS //
74
+ // //
75
+
76
+ 1XX informational response
77
+
78
+ 100 Continue
79
+ 101 Switching Protocols
80
+ 102 Processing
81
+ 103 Early Hints
82
+
83
+
84
+ 2XX success
85
+
86
+ 200 OK
87
+ 201 Created
88
+ 202 Accepted
89
+ 203 Non-Authoritative Information
90
+ 204 No Content
91
+ 205 Reset Content
92
+ 206 Partial Content
93
+ 207 Multi-Status
94
+ 208 Already Reported
95
+ 226 IM Used
96
+
97
+
98
+ 3XX redirection
99
+
100
+ 300 Multiple Choices
101
+ 301 Moved Permanently
102
+ 302 Found
103
+ 303 See Other
104
+ 304 Not Modified
105
+ 305 Use Proxy
106
+ 306 Switch Proxy
107
+ 307 Temporary Redirect
108
+ 308 Permanent Redirect
109
+
110
+
111
+ 4XX client errors
112
+
113
+ 400 Bad Request
114
+ 401 Unauthorized
115
+ 402 Payment Required
116
+ 403 Forbidden
117
+ 404 Not Found
118
+ 405 Method Not Allowed
119
+ 406 Not Acceptable
120
+ 407 Proxy Authentication Required
121
+ 408 Request Timeout
122
+ 409 Conflict
123
+ 410 Gone
124
+ 411 Length Required
125
+ 412 Precondition Failed
126
+ 413 Payload Too Large
127
+ 414 URI Too Long
128
+ 415 Unsupported Media Type
129
+ 416 Range Not Satisfiable
130
+ 417 Expectation Failed
131
+ 418 I'm a teapot
132
+ 421 Misdirected Request
133
+ 422 Unprocessable Entity
134
+ 423 Locked
135
+ 424 Failed Dependency
136
+ 425 Too Early
137
+ 426 Upgrade Required
138
+ 428 Precondition Required
139
+ 429 Too Many Requests
140
+ 431 Request Header Fields Too Large
141
+ 451 Unavailable For Legal Reasons
142
+
143
+
144
+ 5XX server errors
145
+
146
+ 500 Internal Server Error
147
+ 501 Not Implemented
148
+ 502 Bad Gateway
149
+ 503 Service Unavailable
150
+ 504 Gateway Timeout
151
+ 505 HTTP Version Not Supported
152
+ 506 Variant Also Negotiates
153
+ 507 Insufficient Storage
154
+ 508 Loop Detected
155
+ 510 Not Extended
156
+ 511 Network Authentication Required
157
+
158
+
159
+ Unofficial codes
160
+
161
+ 103 Checkpoint
162
+ 218 This is fine (Apache Web Server)
163
+ 419 Page Expired (Laravel Framework)
164
+ 420 Enhance Your Calm (Twitter)
165
+ 430 Request Header Fields Too Large (Shopify)
166
+ 450 Blocked by Windows Parental Controls (Microsoft)
167
+ 498 Invalid Token (Esri)
168
+ 499 Token Required (Esri)
169
+ 509 Bandwidth Limit Exceeded (Apache Web Server/cPanel)
170
+ 526 Invalid SSL Certificate
171
+ 529 Site is overloaded
172
+ 530 Site is frozen
173
+ 598 (Informal convention) Network read timeout error
174
+
175
+ 440 Login Time-out
176
+ 449 Retry With
177
+ 451 Redirect
178
+
179
+ 444 No Response
180
+ 494 Request header too large
181
+ 495 SSL Certificate Error
182
+ 496 SSL Certificate Required
183
+ 497 HTTP Request Sent to HTTPS Port
184
+ 499 Client Closed Request
185
+
186
+ 520 Web Server Returned an Unknown Error
187
+ 521 Web Server Is Down
188
+ 522 Connection Timed Out
189
+ 523 Origin Is Unreachable
190
+ 524 A Timeout Occurred
191
+ 525 SSL Handshake Failed
192
+ 526 Invalid SSL Certificate
193
+ 527 Railgun Error
194
+
195
+ 530
196
+
197
+ 460
198
+ 463
199
+
200
+ */
@@ -0,0 +1,26 @@
1
+
2
+ export interface GeoIpLocation {
3
+ /** [ <low bound of IP block>, <high bound of IP block> ] */
4
+ range: [number, number];
5
+ /** 2 letter ISO-3166-1 country code https://www.iban.com/country-codes */
6
+ country: string;
7
+ /**
8
+ * Up to 3 alphanumeric variable length characters as ISO 3166-2 code
9
+ * For US states this is the 2 letter state
10
+ * For the United Kingdom this could be ENG as a country like “England
11
+ * FIPS 10-4 subcountry code
12
+ */
13
+ region: string;
14
+ /** 1 if the country is a member state of the European Union, 0 otherwise. */
15
+ eu: '1' | '0';
16
+ /** "Country/Zone" Timezone from IANA Time Zone Database */
17
+ timezone: string;
18
+ /** This is the full city name */
19
+ city: string;
20
+ /** The latitude and longitude of the city */
21
+ ll: [number, number];
22
+ /** Metro code */
23
+ metro: number;
24
+ /** The approximate accuracy radius (km), around the latitude and longitude */
25
+ area: number;
26
+ }
@@ -0,0 +1,5 @@
1
+
2
+ export interface LocationCoordinates {
3
+ longitude: number;
4
+ latitude: number;
5
+ }
@@ -0,0 +1,18 @@
1
+
2
+ export class DynamoUsageAction {
3
+ action?: string;
4
+ time?: Date;
5
+
6
+ constructor(
7
+ set?: {
8
+ action?: string,
9
+ time?: Date,
10
+ }
11
+ ) {
12
+ if (set) {
13
+ this.action = set.action;
14
+ this.time = set.time;
15
+ }
16
+ }
17
+ }
18
+
@@ -0,0 +1,26 @@
1
+
2
+ import { DynamoUsageAction } from './usage-action';
3
+
4
+ export class DynamoUsageData {
5
+ page?: string;
6
+ opened?: Date;
7
+ timeSpentOnPage?: number;
8
+ actions?: DynamoUsageAction[] = [];
9
+
10
+ constructor(
11
+ set?: {
12
+ page?: string,
13
+ opened?: Date;
14
+ timeSpentOnPage?: number,
15
+ actions?: DynamoUsageAction[],
16
+ }
17
+ ) {
18
+ if (set) {
19
+ this.page = set.page;
20
+ this.opened = set.opened;
21
+ this.timeSpentOnPage = set.timeSpentOnPage;
22
+ this.actions = set.actions ? set.actions : [];
23
+ }
24
+ }
25
+ }
26
+
@@ -0,0 +1,41 @@
1
+
2
+ import { DynamoBEDataParams } from '../control-models/dynamobe-data-params';
3
+ import { Metadata } from './metadata';
4
+
5
+ export class CustomData extends Metadata {
6
+ data?: string;
7
+
8
+ constructor(
9
+ set?: {
10
+ _id?: string,
11
+
12
+ data?: string,
13
+
14
+ __v?: number,
15
+ __created?: Date,
16
+ __createdBy?: string,
17
+ __lastModified?: Date,
18
+ __lastModifiedBy?: string,
19
+ }
20
+ ) {
21
+ super({
22
+ _id: set?._id,
23
+ __v: set?.__v,
24
+ __created: set?.__created,
25
+ __createdBy: set?.__createdBy,
26
+ __lastModified: set?.__lastModified,
27
+ __lastModifiedBy: set?.__lastModifiedBy,
28
+ })
29
+ if (set) {
30
+ this.data = set.data;
31
+ }
32
+ }
33
+ }
34
+
35
+ export const customDataModelParams = new DynamoBEDataParams({
36
+ dataName: 'customData',
37
+ modelParams: [
38
+ { key: 'data', type: 'string', required: true },
39
+ ]
40
+ })
41
+
@@ -0,0 +1,30 @@
1
+
2
+
3
+ export class Metadata {
4
+ _id?: string;
5
+ __created?: Date;
6
+ __createdBy?: string;
7
+ __lastModified?: Date;
8
+ __lastModifiedBy?: string;
9
+ __v?: number;
10
+
11
+ constructor(
12
+ set?: {
13
+ _id?: string,
14
+ __created?: Date,
15
+ __createdBy?: string,
16
+ __lastModified?: Date,
17
+ __lastModifiedBy?: string,
18
+ __v?: number;
19
+ } | Metadata
20
+ ){
21
+ if (set) {
22
+ this._id = set._id;
23
+ this.__created = set.__created;
24
+ this.__createdBy = set.__createdBy;
25
+ this.__lastModified = set.__lastModified;
26
+ this.__lastModifiedBy = set.__lastModifiedBy;
27
+ this.__v = set.__v;
28
+ }
29
+ }
30
+ }