@aneuhold/core-ts-api-lib 1.0.119 → 2.0.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 +21 -0
- package/README.md +48 -3
- package/lib/index.d.ts +10 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -10
- package/lib/index.js.map +1 -0
- package/lib/index.ts +42 -0
- package/lib/services/APIService/APIService.d.ts +16 -4
- package/lib/services/APIService/APIService.d.ts.map +1 -1
- package/lib/services/APIService/APIService.js +17 -11
- package/lib/services/APIService/APIService.js.map +1 -0
- package/lib/services/APIService/APIService.ts +53 -0
- package/lib/services/DOFunctionService/DOFunction.d.ts +24 -0
- package/lib/services/DOFunctionService/DOFunction.d.ts.map +1 -1
- package/lib/services/DOFunctionService/DOFunction.js +26 -7
- package/lib/services/DOFunctionService/DOFunction.js.map +1 -0
- package/lib/services/DOFunctionService/DOFunction.ts +129 -0
- package/lib/services/DOFunctionService/DOFunctionService.d.ts +30 -5
- package/lib/services/DOFunctionService/DOFunctionService.d.ts.map +1 -1
- package/lib/services/DOFunctionService/DOFunctionService.js +36 -16
- package/lib/services/DOFunctionService/DOFunctionService.js.map +1 -0
- package/lib/services/DOFunctionService/DOFunctionService.ts +105 -0
- package/lib/services/DOFunctionService/functions/authCheckPassword.d.ts +17 -1
- package/lib/services/DOFunctionService/functions/authCheckPassword.d.ts.map +1 -1
- package/lib/services/DOFunctionService/functions/authCheckPassword.js +13 -8
- package/lib/services/DOFunctionService/functions/authCheckPassword.js.map +1 -0
- package/lib/services/DOFunctionService/functions/authCheckPassword.ts +48 -0
- package/lib/services/DOFunctionService/functions/authValidateUser.d.ts +32 -2
- package/lib/services/DOFunctionService/functions/authValidateUser.d.ts.map +1 -1
- package/lib/services/DOFunctionService/functions/authValidateUser.js +18 -8
- package/lib/services/DOFunctionService/functions/authValidateUser.js.map +1 -0
- package/lib/services/DOFunctionService/functions/authValidateUser.ts +74 -0
- package/lib/services/DOFunctionService/functions/projectDashboard.d.ts +52 -4
- package/lib/services/DOFunctionService/functions/projectDashboard.d.ts.map +1 -1
- package/lib/services/DOFunctionService/functions/projectDashboard.js +3 -8
- package/lib/services/DOFunctionService/functions/projectDashboard.js.map +1 -0
- package/lib/services/DOFunctionService/functions/projectDashboard.ts +127 -0
- package/lib/types/DashboardConfig.d.ts.map +1 -1
- package/lib/types/DashboardConfig.js +2 -2
- package/lib/types/DashboardConfig.js.map +1 -0
- package/lib/types/DashboardConfig.ts +14 -0
- package/lib/types/Translations.d.ts.map +1 -1
- package/lib/types/Translations.js +2 -2
- package/lib/types/Translations.js.map +1 -0
- package/lib/types/Translations.ts +14 -0
- package/package.json +36 -29
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bson_1 = require("bson");
|
|
7
|
-
const authCheckPassword_1 = __importDefault(require("./functions/authCheckPassword"));
|
|
8
|
-
const authValidateUser_1 = __importDefault(require("./functions/authValidateUser"));
|
|
9
|
-
const projectDashboard_1 = __importDefault(require("./functions/projectDashboard"));
|
|
1
|
+
import { BSON } from 'bson';
|
|
2
|
+
import AuthCheckPassword from './functions/authCheckPassword.js';
|
|
3
|
+
import AuthValidateUser from './functions/authValidateUser.js';
|
|
4
|
+
import ProjectDashboard from './functions/projectDashboard.js';
|
|
10
5
|
/**
|
|
11
6
|
* A service to provide some utility related to Digital Ocean functions.
|
|
12
7
|
*/
|
|
13
|
-
class DOFunctionService {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
export default class DOFunctionService {
|
|
9
|
+
/**
|
|
10
|
+
* {@link AuthCheckPassword} function instance.
|
|
11
|
+
*/
|
|
12
|
+
static authCheckPassword = AuthCheckPassword.getFunction();
|
|
13
|
+
/**
|
|
14
|
+
* {@link AuthValidateUser} function instance.
|
|
15
|
+
*/
|
|
16
|
+
static authValidateUser = AuthValidateUser.getFunction();
|
|
17
|
+
/**
|
|
18
|
+
* {@link ProjectDashboard} function instance.
|
|
19
|
+
*/
|
|
20
|
+
static projectDashboard = ProjectDashboard.getFunction();
|
|
17
21
|
/**
|
|
18
22
|
* A generic method to handle any API request on the backend. This has
|
|
19
23
|
* no use on the frontend.
|
|
@@ -21,6 +25,10 @@ class DOFunctionService {
|
|
|
21
25
|
* This will take care of returning the error if the handler throws.
|
|
22
26
|
* Ideally the handler should not throw though unless something really
|
|
23
27
|
* unexpected happened.
|
|
28
|
+
*
|
|
29
|
+
* @param rawInput - The raw input for the function.
|
|
30
|
+
* @param handler - The handler function to process the input.
|
|
31
|
+
* @returns The raw output of the function call.
|
|
24
32
|
*/
|
|
25
33
|
static async handleApiRequest(rawInput, handler) {
|
|
26
34
|
const input = this.deserializeInput(rawInput);
|
|
@@ -47,6 +55,12 @@ class DOFunctionService {
|
|
|
47
55
|
}
|
|
48
56
|
return rawOutput;
|
|
49
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Deserializes the raw input into a typed input object.
|
|
60
|
+
*
|
|
61
|
+
* @param rawInput - The raw input to deserialize.
|
|
62
|
+
* @returns The deserialized input object.
|
|
63
|
+
*/
|
|
50
64
|
static deserializeInput(rawInput) {
|
|
51
65
|
const binaryString = atob(rawInput.http.body);
|
|
52
66
|
const len = binaryString.length;
|
|
@@ -54,11 +68,17 @@ class DOFunctionService {
|
|
|
54
68
|
for (let i = 0; i < len; i += 1) {
|
|
55
69
|
bytes[i] = binaryString.charCodeAt(i);
|
|
56
70
|
}
|
|
57
|
-
return
|
|
71
|
+
return BSON.deserialize(bytes);
|
|
58
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Serializes the output object into a base64 string.
|
|
75
|
+
*
|
|
76
|
+
* @param output - The output object to serialize.
|
|
77
|
+
* @returns The serialized output as a base64 string.
|
|
78
|
+
*/
|
|
59
79
|
static serializeOutput(output) {
|
|
60
|
-
const uInt8Array =
|
|
80
|
+
const uInt8Array = BSON.serialize(output);
|
|
61
81
|
return Buffer.from(uInt8Array).toString('base64');
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
|
-
|
|
84
|
+
//# sourceMappingURL=DOFunctionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOFunctionService.js","sourceRoot":"./src/","sources":["services/DOFunctionService/DOFunctionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAE/D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;OAEG;IACH,MAAM,CAAC,iBAAiB,GAAsB,iBAAiB,CAAC,WAAW,EAAE,CAAC;IAE9E;;OAEG;IACH,MAAM,CAAC,gBAAgB,GAAqB,gBAAgB,CAAC,WAAW,EAAE,CAAC;IAE3E;;OAEG;IACH,MAAM,CAAC,gBAAgB,GAAqB,gBAAgB,CAAC,WAAW,EAAE,CAAC;IAE3E;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAI3B,QAA4B,EAC5B,OAAkE;QAElE,MAAM,KAAK,GAAW,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACtD,MAAM,SAAS,GAAwB;YACrC,IAAI,EAAE,EAAE;YACR,OAAO,EAAE;gBACP,cAAc,EAAE,0BAA0B;aAC3C;SACF,CAAC;QACF,yCAAyC;QACzC,MAAM,aAAa,GAAkC;YACnD,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAa;SACpB,CAAC;QACF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;YACpC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,CAAU,CAAC;YACzB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACzC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,gBAAgB,CAC7B,QAA4B;QAE5B,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAW,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,eAAe,CAC5B,MAAqC;QAErC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { BSON } from 'bson';
|
|
2
|
+
import {
|
|
3
|
+
DOFunctionCallOutput,
|
|
4
|
+
DOFunctionInput,
|
|
5
|
+
DOFunctionOutput,
|
|
6
|
+
DOFunctionRawInput,
|
|
7
|
+
DOFunctionRawOutput
|
|
8
|
+
} from './DOFunction.js';
|
|
9
|
+
import AuthCheckPassword from './functions/authCheckPassword.js';
|
|
10
|
+
import AuthValidateUser from './functions/authValidateUser.js';
|
|
11
|
+
import ProjectDashboard from './functions/projectDashboard.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A service to provide some utility related to Digital Ocean functions.
|
|
15
|
+
*/
|
|
16
|
+
export default class DOFunctionService {
|
|
17
|
+
/**
|
|
18
|
+
* {@link AuthCheckPassword} function instance.
|
|
19
|
+
*/
|
|
20
|
+
static authCheckPassword: AuthCheckPassword = AuthCheckPassword.getFunction();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* {@link AuthValidateUser} function instance.
|
|
24
|
+
*/
|
|
25
|
+
static authValidateUser: AuthValidateUser = AuthValidateUser.getFunction();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* {@link ProjectDashboard} function instance.
|
|
29
|
+
*/
|
|
30
|
+
static projectDashboard: ProjectDashboard = ProjectDashboard.getFunction();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A generic method to handle any API request on the backend. This has
|
|
34
|
+
* no use on the frontend.
|
|
35
|
+
*
|
|
36
|
+
* This will take care of returning the error if the handler throws.
|
|
37
|
+
* Ideally the handler should not throw though unless something really
|
|
38
|
+
* unexpected happened.
|
|
39
|
+
*
|
|
40
|
+
* @param rawInput - The raw input for the function.
|
|
41
|
+
* @param handler - The handler function to process the input.
|
|
42
|
+
* @returns The raw output of the function call.
|
|
43
|
+
*/
|
|
44
|
+
static async handleApiRequest<
|
|
45
|
+
TInput extends DOFunctionInput,
|
|
46
|
+
TOutput extends DOFunctionOutput
|
|
47
|
+
>(
|
|
48
|
+
rawInput: DOFunctionRawInput,
|
|
49
|
+
handler: (input: TInput) => Promise<DOFunctionCallOutput<TOutput>>
|
|
50
|
+
): Promise<DOFunctionRawOutput> {
|
|
51
|
+
const input: TInput = this.deserializeInput(rawInput);
|
|
52
|
+
const rawOutput: DOFunctionRawOutput = {
|
|
53
|
+
body: '',
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/octet-stream'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
// Default output if something goes wrong
|
|
59
|
+
const defaultOutput: DOFunctionCallOutput<TOutput> = {
|
|
60
|
+
success: false,
|
|
61
|
+
errors: [],
|
|
62
|
+
data: {} as TOutput
|
|
63
|
+
};
|
|
64
|
+
try {
|
|
65
|
+
const output = await handler(input);
|
|
66
|
+
rawOutput.body = this.serializeOutput(output);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
const error = e as Error;
|
|
69
|
+
defaultOutput.errors.push(error.message);
|
|
70
|
+
rawOutput.body = this.serializeOutput(defaultOutput);
|
|
71
|
+
}
|
|
72
|
+
return rawOutput;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Deserializes the raw input into a typed input object.
|
|
77
|
+
*
|
|
78
|
+
* @param rawInput - The raw input to deserialize.
|
|
79
|
+
* @returns The deserialized input object.
|
|
80
|
+
*/
|
|
81
|
+
private static deserializeInput<TInput extends DOFunctionInput>(
|
|
82
|
+
rawInput: DOFunctionRawInput
|
|
83
|
+
): TInput {
|
|
84
|
+
const binaryString = atob(rawInput.http.body);
|
|
85
|
+
const len = binaryString.length;
|
|
86
|
+
const bytes = new Uint8Array(len);
|
|
87
|
+
for (let i = 0; i < len; i += 1) {
|
|
88
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
89
|
+
}
|
|
90
|
+
return BSON.deserialize(bytes) as TInput;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Serializes the output object into a base64 string.
|
|
95
|
+
*
|
|
96
|
+
* @param output - The output object to serialize.
|
|
97
|
+
* @returns The serialized output as a base64 string.
|
|
98
|
+
*/
|
|
99
|
+
private static serializeOutput<TOutput extends DOFunctionOutput>(
|
|
100
|
+
output: DOFunctionCallOutput<TOutput>
|
|
101
|
+
): string {
|
|
102
|
+
const uInt8Array = BSON.serialize(output);
|
|
103
|
+
return Buffer.from(uInt8Array).toString('base64');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction';
|
|
1
|
+
import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction.js';
|
|
2
|
+
/**
|
|
3
|
+
* Input interface for {@link AuthCheckPassword}.
|
|
4
|
+
*/
|
|
2
5
|
export interface AuthCheckPasswordInput extends DOFunctionInput {
|
|
3
6
|
password: string;
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Output interface for {@link AuthCheckPassword}.
|
|
10
|
+
*/
|
|
5
11
|
export interface AuthCheckPasswordOutput extends DOFunctionOutput {
|
|
6
12
|
passwordIsCorrect: boolean;
|
|
7
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Class representing the AuthCheckPassword function.
|
|
16
|
+
*
|
|
17
|
+
* This class is a singleton and provides a method to get the instance of the function.
|
|
18
|
+
*/
|
|
8
19
|
export default class AuthCheckPassword extends DOFunction<AuthCheckPasswordInput, AuthCheckPasswordOutput> {
|
|
9
20
|
private static instance;
|
|
10
21
|
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Gets the singleton instance of {@link AuthCheckPassword}.
|
|
24
|
+
*
|
|
25
|
+
* @returns The instance of the AuthCheckPassword function.
|
|
26
|
+
*/
|
|
11
27
|
static getFunction(): AuthCheckPassword;
|
|
12
28
|
}
|
|
13
29
|
//# sourceMappingURL=authCheckPassword.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authCheckPassword.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"authCheckPassword.d.ts","sourceRoot":"./src/","sources":["services/DOFunctionService/functions/authCheckPassword.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EACjB,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU,CACvD,sBAAsB,EACtB,uBAAuB,CACxB;IACC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgC;IAEvD,OAAO;IAMP;;;;OAIG;IACH,MAAM,CAAC,WAAW,IAAI,iBAAiB;CAMxC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class AuthCheckPassword extends
|
|
1
|
+
import DOFunction from '../DOFunction.js';
|
|
2
|
+
/**
|
|
3
|
+
* Class representing the AuthCheckPassword function.
|
|
4
|
+
*
|
|
5
|
+
* This class is a singleton and provides a method to get the instance of the function.
|
|
6
|
+
*/
|
|
7
|
+
export default class AuthCheckPassword extends DOFunction {
|
|
8
8
|
static instance;
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
11
11
|
this.url =
|
|
12
12
|
'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword';
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Gets the singleton instance of {@link AuthCheckPassword}.
|
|
16
|
+
*
|
|
17
|
+
* @returns The instance of the AuthCheckPassword function.
|
|
18
|
+
*/
|
|
14
19
|
static getFunction() {
|
|
15
20
|
if (!AuthCheckPassword.instance) {
|
|
16
21
|
AuthCheckPassword.instance = new AuthCheckPassword();
|
|
@@ -18,4 +23,4 @@ class AuthCheckPassword extends DOFunction_1.default {
|
|
|
18
23
|
return AuthCheckPassword.instance;
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
|
-
|
|
26
|
+
//# sourceMappingURL=authCheckPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authCheckPassword.js","sourceRoot":"./src/","sources":["services/DOFunctionService/functions/authCheckPassword.ts"],"names":[],"mappings":"AAAA,OAAO,UAGN,MAAM,kBAAkB,CAAC;AAgB1B;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAG9C;IACS,MAAM,CAAC,QAAQ,CAAgC;IAEvD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG;YACN,kHAAkH,CAAC;IACvH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACvD,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import DOFunction, {
|
|
2
|
+
DOFunctionInput,
|
|
3
|
+
DOFunctionOutput
|
|
4
|
+
} from '../DOFunction.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Input interface for {@link AuthCheckPassword}.
|
|
8
|
+
*/
|
|
9
|
+
export interface AuthCheckPasswordInput extends DOFunctionInput {
|
|
10
|
+
password: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Output interface for {@link AuthCheckPassword}.
|
|
15
|
+
*/
|
|
16
|
+
export interface AuthCheckPasswordOutput extends DOFunctionOutput {
|
|
17
|
+
passwordIsCorrect: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Class representing the AuthCheckPassword function.
|
|
22
|
+
*
|
|
23
|
+
* This class is a singleton and provides a method to get the instance of the function.
|
|
24
|
+
*/
|
|
25
|
+
export default class AuthCheckPassword extends DOFunction<
|
|
26
|
+
AuthCheckPasswordInput,
|
|
27
|
+
AuthCheckPasswordOutput
|
|
28
|
+
> {
|
|
29
|
+
private static instance: AuthCheckPassword | undefined;
|
|
30
|
+
|
|
31
|
+
private constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.url =
|
|
34
|
+
'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Gets the singleton instance of {@link AuthCheckPassword}.
|
|
39
|
+
*
|
|
40
|
+
* @returns The instance of the AuthCheckPassword function.
|
|
41
|
+
*/
|
|
42
|
+
static getFunction(): AuthCheckPassword {
|
|
43
|
+
if (!AuthCheckPassword.instance) {
|
|
44
|
+
AuthCheckPassword.instance = new AuthCheckPassword();
|
|
45
|
+
}
|
|
46
|
+
return AuthCheckPassword.instance;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { ApiKey, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { DashboardConfig } from '../../../types/DashboardConfig.js';
|
|
3
|
+
import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction.js';
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing the input to the {@link AuthValidateUser} function.
|
|
6
|
+
*/
|
|
4
7
|
export interface AuthValidateUserInput extends DOFunctionInput {
|
|
8
|
+
/**
|
|
9
|
+
* The username of the user to be validated.
|
|
10
|
+
*/
|
|
5
11
|
userName: string;
|
|
12
|
+
/**
|
|
13
|
+
* The password of the user to be validated.
|
|
14
|
+
*/
|
|
6
15
|
password: string;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Interface representing the output of the {@link AuthValidateUser} function.
|
|
19
|
+
*/
|
|
8
20
|
export interface AuthValidateUserOutput extends DOFunctionOutput {
|
|
21
|
+
/**
|
|
22
|
+
* Information about the authenticated user.
|
|
23
|
+
*/
|
|
9
24
|
userInfo?: {
|
|
10
25
|
user: User;
|
|
11
26
|
apiKey: ApiKey;
|
|
@@ -17,9 +32,24 @@ export interface AuthValidateUserOutput extends DOFunctionOutput {
|
|
|
17
32
|
dashboard?: DashboardConfig;
|
|
18
33
|
};
|
|
19
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Class representing the {@link AuthValidateUser} function.
|
|
37
|
+
* This class is a singleton and extends {@link DOFunction}.
|
|
38
|
+
* It is used to validate user authentication.
|
|
39
|
+
*/
|
|
20
40
|
export default class AuthValidateUser extends DOFunction<AuthValidateUserInput, AuthValidateUserOutput> {
|
|
21
41
|
private static instance;
|
|
42
|
+
/**
|
|
43
|
+
* Private constructor to prevent direct instantiation.
|
|
44
|
+
* Initializes the URL for the validate user function.
|
|
45
|
+
*/
|
|
22
46
|
private constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the singleton instance of {@link AuthValidateUser}.
|
|
49
|
+
* If the instance does not exist, it creates a new one.
|
|
50
|
+
*
|
|
51
|
+
* @returns The singleton instance of {@link AuthValidateUser}.
|
|
52
|
+
*/
|
|
23
53
|
static getFunction(): AuthValidateUser;
|
|
24
54
|
}
|
|
25
55
|
//# sourceMappingURL=authValidateUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authValidateUser.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"authValidateUser.d.ts","sourceRoot":"./src/","sources":["services/DOFunctionService/functions/authValidateUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,UAAU,EAAE,EACjB,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,IAAI,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,eAAe,CAAC;KAC7B,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CACtD,qBAAqB,EACrB,sBAAsB,CACvB;IACC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IAEtD;;;OAGG;IACH,OAAO;IAMP;;;;;OAKG;IACH,MAAM,CAAC,WAAW,IAAI,gBAAgB;CAMvC"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class AuthValidateUser extends
|
|
1
|
+
import DOFunction from '../DOFunction.js';
|
|
2
|
+
/**
|
|
3
|
+
* Class representing the {@link AuthValidateUser} function.
|
|
4
|
+
* This class is a singleton and extends {@link DOFunction}.
|
|
5
|
+
* It is used to validate user authentication.
|
|
6
|
+
*/
|
|
7
|
+
export default class AuthValidateUser extends DOFunction {
|
|
8
8
|
static instance;
|
|
9
|
+
/**
|
|
10
|
+
* Private constructor to prevent direct instantiation.
|
|
11
|
+
* Initializes the URL for the validate user function.
|
|
12
|
+
*/
|
|
9
13
|
constructor() {
|
|
10
14
|
super();
|
|
11
15
|
this.url =
|
|
12
16
|
'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/validateUser';
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the singleton instance of {@link AuthValidateUser}.
|
|
20
|
+
* If the instance does not exist, it creates a new one.
|
|
21
|
+
*
|
|
22
|
+
* @returns The singleton instance of {@link AuthValidateUser}.
|
|
23
|
+
*/
|
|
14
24
|
static getFunction() {
|
|
15
25
|
if (!AuthValidateUser.instance) {
|
|
16
26
|
AuthValidateUser.instance = new AuthValidateUser();
|
|
@@ -18,4 +28,4 @@ class AuthValidateUser extends DOFunction_1.default {
|
|
|
18
28
|
return AuthValidateUser.instance;
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
|
-
|
|
31
|
+
//# sourceMappingURL=authValidateUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authValidateUser.js","sourceRoot":"./src/","sources":["services/DOFunctionService/functions/authValidateUser.ts"],"names":[],"mappings":"AAEA,OAAO,UAGN,MAAM,kBAAkB,CAAC;AAmC1B;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAG7C;IACS,MAAM,CAAC,QAAQ,CAA+B;IAEtD;;;OAGG;IACH;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG;YACN,iHAAiH,CAAC;IACtH,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YAC/B,gBAAgB,CAAC,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACrD,CAAC;QACD,OAAO,gBAAgB,CAAC,QAAQ,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ApiKey, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
+
import { DashboardConfig } from '../../../types/DashboardConfig.js';
|
|
3
|
+
import DOFunction, {
|
|
4
|
+
DOFunctionInput,
|
|
5
|
+
DOFunctionOutput
|
|
6
|
+
} from '../DOFunction.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Interface representing the input to the {@link AuthValidateUser} function.
|
|
10
|
+
*/
|
|
11
|
+
export interface AuthValidateUserInput extends DOFunctionInput {
|
|
12
|
+
/**
|
|
13
|
+
* The username of the user to be validated.
|
|
14
|
+
*/
|
|
15
|
+
userName: string;
|
|
16
|
+
/**
|
|
17
|
+
* The password of the user to be validated.
|
|
18
|
+
*/
|
|
19
|
+
password: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Interface representing the output of the {@link AuthValidateUser} function.
|
|
24
|
+
*/
|
|
25
|
+
export interface AuthValidateUserOutput extends DOFunctionOutput {
|
|
26
|
+
/**
|
|
27
|
+
* Information about the authenticated user.
|
|
28
|
+
*/
|
|
29
|
+
userInfo?: {
|
|
30
|
+
user: User;
|
|
31
|
+
apiKey: ApiKey;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Basic configuration for the projects that the user has access to.
|
|
35
|
+
*/
|
|
36
|
+
config?: {
|
|
37
|
+
dashboard?: DashboardConfig;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Class representing the {@link AuthValidateUser} function.
|
|
43
|
+
* This class is a singleton and extends {@link DOFunction}.
|
|
44
|
+
* It is used to validate user authentication.
|
|
45
|
+
*/
|
|
46
|
+
export default class AuthValidateUser extends DOFunction<
|
|
47
|
+
AuthValidateUserInput,
|
|
48
|
+
AuthValidateUserOutput
|
|
49
|
+
> {
|
|
50
|
+
private static instance: AuthValidateUser | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Private constructor to prevent direct instantiation.
|
|
54
|
+
* Initializes the URL for the validate user function.
|
|
55
|
+
*/
|
|
56
|
+
private constructor() {
|
|
57
|
+
super();
|
|
58
|
+
this.url =
|
|
59
|
+
'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/validateUser';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Retrieves the singleton instance of {@link AuthValidateUser}.
|
|
64
|
+
* If the instance does not exist, it creates a new one.
|
|
65
|
+
*
|
|
66
|
+
* @returns The singleton instance of {@link AuthValidateUser}.
|
|
67
|
+
*/
|
|
68
|
+
static getFunction(): AuthValidateUser {
|
|
69
|
+
if (!AuthValidateUser.instance) {
|
|
70
|
+
AuthValidateUser.instance = new AuthValidateUser();
|
|
71
|
+
}
|
|
72
|
+
return AuthValidateUser.instance;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,39 +1,87 @@
|
|
|
1
|
-
import { UUID } from 'crypto';
|
|
2
1
|
import { DashboardTask, DashboardUserConfig, NonogramKatanaItem, NonogramKatanaUpgrade, UserCTO } from '@aneuhold/core-ts-db-lib';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { UUID } from 'crypto';
|
|
3
|
+
import { Translations } from '../../../types/Translations.js';
|
|
4
|
+
import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction.js';
|
|
5
|
+
/**
|
|
6
|
+
* Options for configuring the project dashboard.
|
|
7
|
+
*/
|
|
5
8
|
export interface ProjectDashboardOptions {
|
|
6
9
|
get?: {
|
|
10
|
+
/**
|
|
11
|
+
* Whether to include translations in the response.
|
|
12
|
+
*/
|
|
7
13
|
translations?: boolean;
|
|
8
14
|
/**
|
|
9
|
-
* If
|
|
15
|
+
* If true, the user config will be returned for the user
|
|
10
16
|
* and the collaborators.
|
|
11
17
|
*/
|
|
12
18
|
userConfig?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to include tasks in the response.
|
|
21
|
+
*/
|
|
13
22
|
tasks?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A string indicating if the user name is valid.
|
|
25
|
+
*/
|
|
14
26
|
userNameIsValid?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to include nonogram katana items in the response.
|
|
29
|
+
*/
|
|
15
30
|
nonogramKatanaItems?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to include nonogram katana upgrades in the response.
|
|
33
|
+
*/
|
|
16
34
|
nonogramKatanaUpgrades?: boolean;
|
|
17
35
|
};
|
|
18
36
|
insert?: {
|
|
37
|
+
/**
|
|
38
|
+
* Tasks to be inserted.
|
|
39
|
+
*/
|
|
19
40
|
tasks?: DashboardTask[];
|
|
41
|
+
/**
|
|
42
|
+
* Nonogram katana items to be inserted.
|
|
43
|
+
*/
|
|
20
44
|
nonogramKatanaItems?: NonogramKatanaItem[];
|
|
45
|
+
/**
|
|
46
|
+
* Nonogram katana upgrades to be inserted.
|
|
47
|
+
*/
|
|
21
48
|
nonogramKatanaUpgrades?: NonogramKatanaUpgrade[];
|
|
22
49
|
};
|
|
23
50
|
update?: {
|
|
51
|
+
/**
|
|
52
|
+
* User configuration to be updated.
|
|
53
|
+
*/
|
|
24
54
|
userConfig?: DashboardUserConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Tasks to be updated.
|
|
57
|
+
*/
|
|
25
58
|
tasks?: DashboardTask[];
|
|
59
|
+
/**
|
|
60
|
+
* Nonogram katana items to be updated.
|
|
61
|
+
*/
|
|
26
62
|
nonogramKatanaItems?: NonogramKatanaItem[];
|
|
63
|
+
/**
|
|
64
|
+
* Nonogram katana upgrades to be updated.
|
|
65
|
+
*/
|
|
27
66
|
nonogramKatanaUpgrades?: NonogramKatanaUpgrade[];
|
|
28
67
|
};
|
|
29
68
|
delete?: {
|
|
69
|
+
/**
|
|
70
|
+
* Tasks to be deleted.
|
|
71
|
+
*/
|
|
30
72
|
tasks?: DashboardTask[];
|
|
31
73
|
};
|
|
32
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Represents the input to the project dashboard function.
|
|
77
|
+
*/
|
|
33
78
|
export interface ProjectDashboardInput extends DOFunctionInput {
|
|
34
79
|
apiKey: UUID;
|
|
35
80
|
options: ProjectDashboardOptions;
|
|
36
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Represents the output of the project dashboard function.
|
|
84
|
+
*/
|
|
37
85
|
export interface ProjectDashboardOutput extends DOFunctionOutput {
|
|
38
86
|
translations?: Translations;
|
|
39
87
|
userConfig?: DashboardUserConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectDashboard.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"projectDashboard.d.ts","sourceRoot":"./src/","sources":["services/DOFunctionService/functions/projectDashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,OAAO,EACR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,UAAU,EAAE,EACjB,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE;QACJ;;WAEG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB;;WAEG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B;;WAEG;QACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAClC,CAAC;IACF,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;QACxB;;WAEG;QACH,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAC3C;;WAEG;QACH,sBAAsB,CAAC,EAAE,qBAAqB,EAAE,CAAC;KAClD,CAAC;IACF,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;QACjC;;WAEG;QACH,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;QACxB;;WAEG;QACH,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAC3C;;WAEG;QACH,sBAAsB,CAAC,EAAE,qBAAqB,EAAE,CAAC;KAClD,CAAC;IACF,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;KACzB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC3C,sBAAsB,CAAC,EAAE,qBAAqB,EAAE,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CACtD,qBAAqB,EACrB,sBAAsB,CACvB;IACC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IAEtD,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,gBAAgB;CAMvC"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const DOFunction_1 = __importDefault(require("../DOFunction"));
|
|
1
|
+
import DOFunction from '../DOFunction.js';
|
|
7
2
|
/**
|
|
8
3
|
* The Digital Ocean function which handles all data requests for the
|
|
9
4
|
* dashboard project.
|
|
10
5
|
*/
|
|
11
|
-
class ProjectDashboard extends
|
|
6
|
+
export default class ProjectDashboard extends DOFunction {
|
|
12
7
|
static instance;
|
|
13
8
|
constructor() {
|
|
14
9
|
super();
|
|
@@ -20,4 +15,4 @@ class ProjectDashboard extends DOFunction_1.default {
|
|
|
20
15
|
return ProjectDashboard.instance;
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
|
-
|
|
18
|
+
//# sourceMappingURL=projectDashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectDashboard.js","sourceRoot":"./src/","sources":["services/DOFunctionService/functions/projectDashboard.ts"],"names":[],"mappings":"AASA,OAAO,UAGN,MAAM,kBAAkB,CAAC;AA8F1B;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAG7C;IACS,MAAM,CAAC,QAAQ,CAA+B;IAEtD;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YAC/B,gBAAgB,CAAC,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACrD,CAAC;QACD,OAAO,gBAAgB,CAAC,QAAQ,CAAC;IACnC,CAAC;CACF"}
|