@aneuhold/core-ts-lib 1.1.11 → 1.1.12
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/helperFunctions/sleep.d.ts.map +1 -1
- package/lib/helperFunctions/sleep.js +0 -1
- package/lib/services/DateService/DateService.spec.js +1 -1
- package/lib/services/DependencyService.d.ts +8 -0
- package/lib/services/DependencyService.d.ts.map +1 -1
- package/lib/services/DependencyService.js +8 -8
- package/lib/services/FileSystemService/FileSystemService.d.ts.map +1 -1
- package/lib/services/FileSystemService/FileSystemService.spec.js +6 -3
- package/lib/utils/Logger.d.ts.map +1 -1
- package/lib/utils/Logger.js +1 -2
- package/package.json +7 -10
- package/lib/services/DOFunctionService/DOFunctionService.d.ts +0 -46
- package/lib/services/DOFunctionService/DOFunctionService.d.ts.map +0 -1
- package/lib/services/DOFunctionService/DOFunctionService.js +0 -19
- package/lib/services/DOFunctionService/functionsInfo/authCheckPassword.d.ts +0 -11
- package/lib/services/DOFunctionService/functionsInfo/authCheckPassword.d.ts.map +0 -1
- package/lib/services/DOFunctionService/functionsInfo/authCheckPassword.js +0 -21
- package/lib/services/DateService.d.ts +0 -50
- package/lib/services/DateService.d.ts.map +0 -1
- package/lib/services/DateService.js +0 -110
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/sleep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/sleep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvD"}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
* @param ms the number of milliseconds to sleep
|
|
7
7
|
*/
|
|
8
8
|
function sleep(ms) {
|
|
9
|
-
// eslint-disable-next-line no-promise-executor-return
|
|
10
9
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
10
|
}
|
|
12
11
|
exports.default = sleep;
|
|
@@ -20,7 +20,7 @@ describe('DateService', () => {
|
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
describe('getWeekOfMonth', () => {
|
|
23
|
-
it('should successfully get the week of month for a date',
|
|
23
|
+
it('should successfully get the week of month for a date', () => {
|
|
24
24
|
const result = DateService_1.default.getWeekOfMonth(new Date(2024, 0, 14));
|
|
25
25
|
expect(result).toEqual(3);
|
|
26
26
|
const result2 = DateService_1.default.getWeekOfMonth(new Date(2024, 0, 1));
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export type PackageJson = {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
dependencies?: Record<string, string>;
|
|
5
|
+
devDependencies?: Record<string, string>;
|
|
6
|
+
peerDependencies?: Record<string, string>;
|
|
7
|
+
optionalDependencies?: Record<string, string>;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* A service which can be used to manage dependencies in the current project
|
|
3
11
|
* in various ways.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyService.d.ts","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;WACU,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;CA+DtD"}
|
|
1
|
+
{"version":3,"file":"DependencyService.d.ts","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;WACU,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;CA+DtD"}
|
|
@@ -41,19 +41,19 @@ class DependencyService {
|
|
|
41
41
|
await Promise.all(packageJsonPaths.map(async (packageJsonPath) => {
|
|
42
42
|
const fullPackageJsonPath = path_1.default.join(process.cwd(), packageJsonPath);
|
|
43
43
|
const packageJsonData = JSON.parse(await (0, promises_1.readFile)(fullPackageJsonPath, 'utf-8'));
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const dependencies = packageJsonData.dependencies;
|
|
45
|
+
if (dependencies) {
|
|
46
|
+
Object.keys(dependencies).forEach((dependency) => {
|
|
46
47
|
if (rootDependencies[dependency]) {
|
|
47
|
-
|
|
48
|
-
rootDependencies[dependency];
|
|
48
|
+
dependencies[dependency] = rootDependencies[dependency];
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const devDependencies = packageJsonData.devDependencies;
|
|
53
|
+
if (devDependencies) {
|
|
54
|
+
Object.keys(devDependencies).forEach((dependency) => {
|
|
54
55
|
if (rootDependencies[dependency]) {
|
|
55
|
-
|
|
56
|
-
rootDependencies[dependency];
|
|
56
|
+
devDependencies[dependency] = rootDependencies[dependency];
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystemService.d.ts","sourceRoot":"","sources":["../../../src/services/FileSystemService/FileSystemService.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;;;;OAOG;WACU,iBAAiB,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;IAsBhB;;;;;;OAMG;WACU,kBAAkB,CAC7B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"FileSystemService.d.ts","sourceRoot":"","sources":["../../../src/services/FileSystemService/FileSystemService.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;;;;OAOG;WACU,iBAAiB,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;IAsBhB;;;;;;OAMG;WACU,kBAAkB,CAC7B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;WAmCH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAWtD,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5D;;;;;;OAMG;WACU,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAoBhE;;;;;;OAMG;WACU,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMzE"}
|
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
6
|
const promises_1 = require("fs/promises");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const FileSystemService_1 = __importDefault(require("./FileSystemService"));
|
|
9
9
|
const TEST_FOLDER_NAME = '__fileSystemService-tests__';
|
|
10
10
|
describe('FileSystemService', () => {
|
|
@@ -58,8 +58,10 @@ describe('FileSystemService', () => {
|
|
|
58
58
|
// Execute
|
|
59
59
|
await FileSystemService_1.default.copyFolderContents(sourceFolderPath, targetFolderPath, ['ts']);
|
|
60
60
|
// Assert
|
|
61
|
-
const expectedContents = (await FileSystemService_1.default.getAllFilePathsRelative(sourceFolderPath))
|
|
62
|
-
|
|
61
|
+
const expectedContents = (await FileSystemService_1.default.getAllFilePathsRelative(sourceFolderPath))
|
|
62
|
+
.filter((sourceFilePath) => !sourceFilePath.endsWith('.ts'))
|
|
63
|
+
.sort();
|
|
64
|
+
const actualContents = (await FileSystemService_1.default.getAllFilePathsRelative(targetFolderPath)).sort();
|
|
63
65
|
expect(actualContents).toEqual(expectedContents);
|
|
64
66
|
});
|
|
65
67
|
});
|
|
@@ -71,6 +73,7 @@ async function createTestFiles(folderPath, fileStructure) {
|
|
|
71
73
|
await (0, promises_1.writeFile)(path_1.default.join(folderPath, key), value);
|
|
72
74
|
}
|
|
73
75
|
else if (typeof value === 'object') {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
74
77
|
await createTestFiles(path_1.default.join(folderPath, key), value);
|
|
75
78
|
}
|
|
76
79
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/utils/Logger.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAc,qBAAqB,UAAS;IAE5C;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAS;gBAErB,gBAAgB,CAAC,EAAE,OAAO;IAMtC;;;OAGG;IACH,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAW9C;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAIrD;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI/B,OAAO,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/utils/Logger.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAc,qBAAqB,UAAS;IAE5C;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAS;gBAErB,gBAAgB,CAAC,EAAE,OAAO;IAMtC;;;OAGG;IACH,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAW9C;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAIrD;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI/B,OAAO,CAAC,SAAS;CAMlB"}
|
package/lib/utils/Logger.js
CHANGED
|
@@ -102,8 +102,7 @@ class Logger {
|
|
|
102
102
|
new Logger().error(msg);
|
|
103
103
|
}
|
|
104
104
|
shouldLog() {
|
|
105
|
-
if (!this.logOnlyIfVerbose ||
|
|
106
|
-
(this.logOnlyIfVerbose && Logger.verboseLoggingEnabled)) {
|
|
105
|
+
if (!this.logOnlyIfVerbose || Logger.verboseLoggingEnabled) {
|
|
107
106
|
return true;
|
|
108
107
|
}
|
|
109
108
|
return false;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aneuhold/core-ts-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "A core library for all of my TypeScript projects",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
|
+
"packageManager": "yarn@4.2.2",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"pushpub": "npm run build && npm version patch && git push && npm publish --access public",
|
|
9
10
|
"build": "tsc",
|
|
@@ -11,7 +12,8 @@
|
|
|
11
12
|
"link:local": "cd lib && yarn link",
|
|
12
13
|
"unlink:local": "cd lib && yarn unlink",
|
|
13
14
|
"upgrade:all": "yarn upgrade --latest",
|
|
14
|
-
"test": "jest"
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"lint": "eslint"
|
|
15
17
|
},
|
|
16
18
|
"type": "commonjs",
|
|
17
19
|
"repository": {
|
|
@@ -32,17 +34,12 @@
|
|
|
32
34
|
"lib/**/*"
|
|
33
35
|
],
|
|
34
36
|
"devDependencies": {
|
|
37
|
+
"@aneuhold/eslint-config": "^1.0.4",
|
|
35
38
|
"@types/jest": "^29.5.8",
|
|
36
39
|
"@types/node": "^18.15.0",
|
|
37
|
-
"
|
|
38
|
-
"@typescript-eslint/parser": "^5.54.1",
|
|
39
|
-
"eslint": "^8.35.0",
|
|
40
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
41
|
-
"eslint-config-prettier": "^8.3.0",
|
|
42
|
-
"eslint-plugin-import": "^2.22.1",
|
|
43
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
40
|
+
"eslint": "^9.2.0",
|
|
44
41
|
"jest": "^29.7.0",
|
|
45
|
-
"prettier": "^2.
|
|
42
|
+
"prettier": "^3.2.5",
|
|
46
43
|
"ts-jest": "^29.1.1",
|
|
47
44
|
"ts-node": "^10.2.1",
|
|
48
45
|
"typescript": "^4.4.3"
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw output from a Digital Ocean function must always be an object with
|
|
3
|
-
* a body property. The body property must also be an object.
|
|
4
|
-
*/
|
|
5
|
-
export type DOFunctionRawOutput<TOutput extends object> = {
|
|
6
|
-
/**
|
|
7
|
-
* The body is an object, which means it will automatically be serialized to
|
|
8
|
-
* JSON and the Content-Type header will be set to application/json.
|
|
9
|
-
*/
|
|
10
|
-
body: DOFunctionOutput<TOutput>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The output from a Digital Ocean function must always be an object. This
|
|
14
|
-
* is the data that actually matters and doesn't require parsing the `body`
|
|
15
|
-
* property.
|
|
16
|
-
*/
|
|
17
|
-
export type DOFunctionOutput<TOutput extends object> = TOutput;
|
|
18
|
-
/**
|
|
19
|
-
* The input to a Digital Ocean function must always be an object.
|
|
20
|
-
*/
|
|
21
|
-
export type DOFunctionInput<TInput extends object> = TInput;
|
|
22
|
-
/**
|
|
23
|
-
* Information about a Digital Ocean function.
|
|
24
|
-
*/
|
|
25
|
-
export type DOFunctionInfo<TInput extends object, TOutput extends object> = {
|
|
26
|
-
url: string;
|
|
27
|
-
call: (args: DOFunctionInput<TInput>) => Promise<DOFunctionOutput<TOutput>>;
|
|
28
|
-
};
|
|
29
|
-
declare const doFunctionsInfo: {
|
|
30
|
-
authCheckPassword: DOFunctionInfo<{
|
|
31
|
-
password: string;
|
|
32
|
-
}, {
|
|
33
|
-
passwordIsCorrect: boolean;
|
|
34
|
-
}>;
|
|
35
|
-
};
|
|
36
|
-
export type DOFunction = keyof typeof doFunctionsInfo;
|
|
37
|
-
/**
|
|
38
|
-
* A service to provide some utility realted to Digital Ocean functions.
|
|
39
|
-
*/
|
|
40
|
-
export default class DOFunctionService {
|
|
41
|
-
static call(functionName: DOFunction, args: (typeof doFunctionsInfo)[DOFunction]['call']['arguments'][0]): Promise<{
|
|
42
|
-
passwordIsCorrect: boolean;
|
|
43
|
-
}>;
|
|
44
|
-
}
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=DOFunctionService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DOFunctionService.d.ts","sourceRoot":"","sources":["../../../src/services/DOFunctionService/DOFunctionService.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,MAAM,IAAI;IACxD;;;OAGG;IACH,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,MAAM,IAAI,OAAO,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,MAAM,IAAI,MAAM,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,IAAI;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7E,CAAC;AAEF,QAAA,MAAM,eAAe;;;;;;CAEpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;WACvB,IAAI,CACf,YAAY,EAAE,UAAU,EACxB,IAAI,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;;;CAKrE"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 authCheckPassword_1 = __importDefault(require("./functionsInfo/authCheckPassword"));
|
|
7
|
-
const doFunctionsInfo = {
|
|
8
|
-
authCheckPassword: authCheckPassword_1.default
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* A service to provide some utility realted to Digital Ocean functions.
|
|
12
|
-
*/
|
|
13
|
-
class DOFunctionService {
|
|
14
|
-
static async call(functionName, args) {
|
|
15
|
-
const info = doFunctionsInfo[functionName];
|
|
16
|
-
return info.call(args);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = DOFunctionService;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DOFunctionInfo, DOFunctionInput, DOFunctionOutput, DOFunctionRawOutput } from '../DOFunctionService';
|
|
2
|
-
export type DOAuthCheckPasswordInput = DOFunctionInput<{
|
|
3
|
-
password: string;
|
|
4
|
-
}>;
|
|
5
|
-
export type DOAuthCheckPasswordOutput = DOFunctionOutput<{
|
|
6
|
-
passwordIsCorrect: boolean;
|
|
7
|
-
}>;
|
|
8
|
-
export type DOAuthCheckPasswordRawOutput = DOFunctionRawOutput<DOAuthCheckPasswordOutput>;
|
|
9
|
-
declare const authCheckPasswordInfo: DOFunctionInfo<DOAuthCheckPasswordInput, DOAuthCheckPasswordOutput>;
|
|
10
|
-
export default authCheckPasswordInfo;
|
|
11
|
-
//# sourceMappingURL=authCheckPassword.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authCheckPassword.d.ts","sourceRoot":"","sources":["../../../../src/services/DOFunctionService/functionsInfo/authCheckPassword.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,wBAAwB,GAAG,eAAe,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC7E,MAAM,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;IACvD,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AACH,MAAM,MAAM,4BAA4B,GACtC,mBAAmB,CAAC,yBAAyB,CAAC,CAAC;AAEjD,QAAA,MAAM,qBAAqB,EAAE,cAAc,CACzC,wBAAwB,EACxB,yBAAyB,CAc1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 node_fetch_1 = __importDefault(require("node-fetch"));
|
|
7
|
-
const authCheckPasswordInfo = {
|
|
8
|
-
url: 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword',
|
|
9
|
-
call: async (input) => {
|
|
10
|
-
const result = await (0, node_fetch_1.default)(`${authCheckPasswordInfo.url}`, {
|
|
11
|
-
method: 'POST',
|
|
12
|
-
headers: {
|
|
13
|
-
'Content-Type': 'application/json'
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify(input)
|
|
16
|
-
});
|
|
17
|
-
const json = (await result.json());
|
|
18
|
-
return json;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.default = authCheckPasswordInfo;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A class that supports converting dates across various personal projects.
|
|
3
|
-
*
|
|
4
|
-
* All of the things in this class should be able to be used in Node and the
|
|
5
|
-
* browser.
|
|
6
|
-
*/
|
|
7
|
-
export default class DateService {
|
|
8
|
-
private static dateFormatter;
|
|
9
|
-
private static dateTimeFormatter;
|
|
10
|
-
/**
|
|
11
|
-
* Gets the date in date format if it is set to midnight, otherwise gets the
|
|
12
|
-
* date in date time format.
|
|
13
|
-
*/
|
|
14
|
-
static getAutoDateString(date: Date): string;
|
|
15
|
-
/**
|
|
16
|
-
* Determines if a date has a user-specified time component to it, meaning
|
|
17
|
-
* that it isn't midnight.
|
|
18
|
-
*/
|
|
19
|
-
static dateHasTime(date: Date): boolean;
|
|
20
|
-
static getDateString(date: Date): string;
|
|
21
|
-
static getDateTimeString(date: Date): string;
|
|
22
|
-
/**
|
|
23
|
-
* Determines if two dates are equal. This is strict, down to the ms.
|
|
24
|
-
*/
|
|
25
|
-
static datesAreEqual(date1: Date | undefined | null, date2: Date | undefined | null): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Gets the last day of the month for the provided date. This will return
|
|
28
|
-
* the date at exactly 00:00 on the last day of the month.
|
|
29
|
-
*/
|
|
30
|
-
static getLastDayOfGivenMonth(date: Date): Date;
|
|
31
|
-
/**
|
|
32
|
-
* Gets the week of the month for the provided date. This starts at 1.
|
|
33
|
-
*/
|
|
34
|
-
static getWeekOfMonth(date: Date): number;
|
|
35
|
-
/**
|
|
36
|
-
* Adds the provided number of days to the provided date. If the days are
|
|
37
|
-
* over or under the number of days in the month, then the month will be
|
|
38
|
-
* adjusted accordingly.
|
|
39
|
-
*/
|
|
40
|
-
static addDays(date: Date, days: number): Date;
|
|
41
|
-
static addMonths(date: Date, months: number): Date;
|
|
42
|
-
static addWeeks(date: Date, weeks: number): Date;
|
|
43
|
-
static addYears(date: Date, years: number): Date;
|
|
44
|
-
/**
|
|
45
|
-
* For personal projects, midnight can mean exactly midnight, or 11:59pm.
|
|
46
|
-
* It acts as a border between two dates.
|
|
47
|
-
*/
|
|
48
|
-
static dateIsMidnight(date: Date): boolean;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=DateService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateService.d.ts","sourceRoot":"","sources":["../../src/services/DateService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAIzB;IAEH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAM7B;IAEH;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI;IAOnC;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI;IAI7B,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI;IAI/B,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI;IAInC;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,EAC9B,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI;IAWhC;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAM/C;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAazC;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM;IAMvC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM;IAM3C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM;IAIzC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM;IAMzC;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI;CAMjC"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* A class that supports converting dates across various personal projects.
|
|
5
|
-
*
|
|
6
|
-
* All of the things in this class should be able to be used in Node and the
|
|
7
|
-
* browser.
|
|
8
|
-
*/
|
|
9
|
-
class DateService {
|
|
10
|
-
static dateFormatter = new Intl.DateTimeFormat('en-US', {
|
|
11
|
-
year: 'numeric',
|
|
12
|
-
month: 'short',
|
|
13
|
-
day: 'numeric'
|
|
14
|
-
});
|
|
15
|
-
static dateTimeFormatter = new Intl.DateTimeFormat('en-US', {
|
|
16
|
-
year: 'numeric',
|
|
17
|
-
month: 'short',
|
|
18
|
-
day: 'numeric',
|
|
19
|
-
hour: 'numeric',
|
|
20
|
-
minute: 'numeric'
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Gets the date in date format if it is set to midnight, otherwise gets the
|
|
24
|
-
* date in date time format.
|
|
25
|
-
*/
|
|
26
|
-
static getAutoDateString(date) {
|
|
27
|
-
if (this.dateHasTime(date)) {
|
|
28
|
-
return this.getDateTimeString(date);
|
|
29
|
-
}
|
|
30
|
-
return this.getDateString(date);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Determines if a date has a user-specified time component to it, meaning
|
|
34
|
-
* that it isn't midnight.
|
|
35
|
-
*/
|
|
36
|
-
static dateHasTime(date) {
|
|
37
|
-
return !this.dateIsMidnight(date);
|
|
38
|
-
}
|
|
39
|
-
static getDateString(date) {
|
|
40
|
-
return this.dateFormatter.format(date);
|
|
41
|
-
}
|
|
42
|
-
static getDateTimeString(date) {
|
|
43
|
-
return this.dateTimeFormatter.format(date);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Determines if two dates are equal. This is strict, down to the ms.
|
|
47
|
-
*/
|
|
48
|
-
static datesAreEqual(date1, date2) {
|
|
49
|
-
if (!date1 && !date2) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
if (!date1 || !date2) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
return date1.getTime() === date2.getTime();
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Gets the last day of the month for the provided date. This will return
|
|
59
|
-
* the date at exactly 00:00 on the last day of the month.
|
|
60
|
-
*/
|
|
61
|
-
static getLastDayOfGivenMonth(date) {
|
|
62
|
-
// Setting the day to 0, makes the date move to the last day of the
|
|
63
|
-
// previous month.
|
|
64
|
-
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Gets the week of the month for the provided date. This starts at 1.
|
|
68
|
-
*/
|
|
69
|
-
static getWeekOfMonth(date) {
|
|
70
|
-
const firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
71
|
-
const firstDayOfMonthWeekday = firstDayOfMonth.getDay();
|
|
72
|
-
const firstDayOfFirstWeek = new Date(firstDayOfMonth);
|
|
73
|
-
firstDayOfFirstWeek.setDate(firstDayOfFirstWeek.getDate() - firstDayOfMonthWeekday);
|
|
74
|
-
const daysSinceFirstDayOfFirstWeek = date.getDate() - firstDayOfFirstWeek.getDate();
|
|
75
|
-
const daysSinceFirstDayOfMonth = daysSinceFirstDayOfFirstWeek + 1;
|
|
76
|
-
return Math.ceil(daysSinceFirstDayOfMonth / 7);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Adds the provided number of days to the provided date. If the days are
|
|
80
|
-
* over or under the number of days in the month, then the month will be
|
|
81
|
-
* adjusted accordingly.
|
|
82
|
-
*/
|
|
83
|
-
static addDays(date, days) {
|
|
84
|
-
const newDate = new Date(date);
|
|
85
|
-
newDate.setDate(newDate.getDate() + days);
|
|
86
|
-
return newDate;
|
|
87
|
-
}
|
|
88
|
-
static addMonths(date, months) {
|
|
89
|
-
const newDate = new Date(date);
|
|
90
|
-
newDate.setMonth(newDate.getMonth() + months);
|
|
91
|
-
return newDate;
|
|
92
|
-
}
|
|
93
|
-
static addWeeks(date, weeks) {
|
|
94
|
-
return this.addDays(date, weeks * 7);
|
|
95
|
-
}
|
|
96
|
-
static addYears(date, years) {
|
|
97
|
-
const newDate = new Date(date);
|
|
98
|
-
newDate.setFullYear(newDate.getFullYear() + years);
|
|
99
|
-
return newDate;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* For personal projects, midnight can mean exactly midnight, or 11:59pm.
|
|
103
|
-
* It acts as a border between two dates.
|
|
104
|
-
*/
|
|
105
|
-
static dateIsMidnight(date) {
|
|
106
|
-
return ((date.getHours() === 0 && date.getMinutes() === 0) ||
|
|
107
|
-
(date.getHours() === 23 && date.getMinutes() === 59));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.default = DateService;
|