@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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -3
  3. package/lib/index.d.ts +10 -10
  4. package/lib/index.d.ts.map +1 -1
  5. package/lib/index.js +5 -10
  6. package/lib/index.js.map +1 -0
  7. package/lib/index.ts +42 -0
  8. package/lib/services/APIService/APIService.d.ts +16 -4
  9. package/lib/services/APIService/APIService.d.ts.map +1 -1
  10. package/lib/services/APIService/APIService.js +17 -11
  11. package/lib/services/APIService/APIService.js.map +1 -0
  12. package/lib/services/APIService/APIService.ts +53 -0
  13. package/lib/services/DOFunctionService/DOFunction.d.ts +24 -0
  14. package/lib/services/DOFunctionService/DOFunction.d.ts.map +1 -1
  15. package/lib/services/DOFunctionService/DOFunction.js +26 -7
  16. package/lib/services/DOFunctionService/DOFunction.js.map +1 -0
  17. package/lib/services/DOFunctionService/DOFunction.ts +129 -0
  18. package/lib/services/DOFunctionService/DOFunctionService.d.ts +30 -5
  19. package/lib/services/DOFunctionService/DOFunctionService.d.ts.map +1 -1
  20. package/lib/services/DOFunctionService/DOFunctionService.js +36 -16
  21. package/lib/services/DOFunctionService/DOFunctionService.js.map +1 -0
  22. package/lib/services/DOFunctionService/DOFunctionService.ts +105 -0
  23. package/lib/services/DOFunctionService/functions/authCheckPassword.d.ts +17 -1
  24. package/lib/services/DOFunctionService/functions/authCheckPassword.d.ts.map +1 -1
  25. package/lib/services/DOFunctionService/functions/authCheckPassword.js +13 -8
  26. package/lib/services/DOFunctionService/functions/authCheckPassword.js.map +1 -0
  27. package/lib/services/DOFunctionService/functions/authCheckPassword.ts +48 -0
  28. package/lib/services/DOFunctionService/functions/authValidateUser.d.ts +32 -2
  29. package/lib/services/DOFunctionService/functions/authValidateUser.d.ts.map +1 -1
  30. package/lib/services/DOFunctionService/functions/authValidateUser.js +18 -8
  31. package/lib/services/DOFunctionService/functions/authValidateUser.js.map +1 -0
  32. package/lib/services/DOFunctionService/functions/authValidateUser.ts +74 -0
  33. package/lib/services/DOFunctionService/functions/projectDashboard.d.ts +52 -4
  34. package/lib/services/DOFunctionService/functions/projectDashboard.d.ts.map +1 -1
  35. package/lib/services/DOFunctionService/functions/projectDashboard.js +3 -8
  36. package/lib/services/DOFunctionService/functions/projectDashboard.js.map +1 -0
  37. package/lib/services/DOFunctionService/functions/projectDashboard.ts +127 -0
  38. package/lib/types/DashboardConfig.d.ts.map +1 -1
  39. package/lib/types/DashboardConfig.js +2 -2
  40. package/lib/types/DashboardConfig.js.map +1 -0
  41. package/lib/types/DashboardConfig.ts +14 -0
  42. package/lib/types/Translations.d.ts.map +1 -1
  43. package/lib/types/Translations.js +2 -2
  44. package/lib/types/Translations.js.map +1 -0
  45. package/lib/types/Translations.ts +14 -0
  46. package/package.json +36 -29
@@ -0,0 +1,127 @@
1
+ import {
2
+ DashboardTask,
3
+ DashboardUserConfig,
4
+ NonogramKatanaItem,
5
+ NonogramKatanaUpgrade,
6
+ UserCTO
7
+ } from '@aneuhold/core-ts-db-lib';
8
+ import { UUID } from 'crypto';
9
+ import { Translations } from '../../../types/Translations.js';
10
+ import DOFunction, {
11
+ DOFunctionInput,
12
+ DOFunctionOutput
13
+ } from '../DOFunction.js';
14
+
15
+ /**
16
+ * Options for configuring the project dashboard.
17
+ */
18
+ export interface ProjectDashboardOptions {
19
+ get?: {
20
+ /**
21
+ * Whether to include translations in the response.
22
+ */
23
+ translations?: boolean;
24
+ /**
25
+ * If true, the user config will be returned for the user
26
+ * and the collaborators.
27
+ */
28
+ userConfig?: boolean;
29
+ /**
30
+ * Whether to include tasks in the response.
31
+ */
32
+ tasks?: boolean;
33
+ /**
34
+ * A string indicating if the user name is valid.
35
+ */
36
+ userNameIsValid?: string;
37
+ /**
38
+ * Whether to include nonogram katana items in the response.
39
+ */
40
+ nonogramKatanaItems?: boolean;
41
+ /**
42
+ * Whether to include nonogram katana upgrades in the response.
43
+ */
44
+ nonogramKatanaUpgrades?: boolean;
45
+ };
46
+ insert?: {
47
+ /**
48
+ * Tasks to be inserted.
49
+ */
50
+ tasks?: DashboardTask[];
51
+ /**
52
+ * Nonogram katana items to be inserted.
53
+ */
54
+ nonogramKatanaItems?: NonogramKatanaItem[];
55
+ /**
56
+ * Nonogram katana upgrades to be inserted.
57
+ */
58
+ nonogramKatanaUpgrades?: NonogramKatanaUpgrade[];
59
+ };
60
+ update?: {
61
+ /**
62
+ * User configuration to be updated.
63
+ */
64
+ userConfig?: DashboardUserConfig;
65
+ /**
66
+ * Tasks to be updated.
67
+ */
68
+ tasks?: DashboardTask[];
69
+ /**
70
+ * Nonogram katana items to be updated.
71
+ */
72
+ nonogramKatanaItems?: NonogramKatanaItem[];
73
+ /**
74
+ * Nonogram katana upgrades to be updated.
75
+ */
76
+ nonogramKatanaUpgrades?: NonogramKatanaUpgrade[];
77
+ };
78
+ delete?: {
79
+ /**
80
+ * Tasks to be deleted.
81
+ */
82
+ tasks?: DashboardTask[];
83
+ };
84
+ }
85
+
86
+ /**
87
+ * Represents the input to the project dashboard function.
88
+ */
89
+ export interface ProjectDashboardInput extends DOFunctionInput {
90
+ apiKey: UUID;
91
+ options: ProjectDashboardOptions;
92
+ }
93
+
94
+ /**
95
+ * Represents the output of the project dashboard function.
96
+ */
97
+ export interface ProjectDashboardOutput extends DOFunctionOutput {
98
+ translations?: Translations;
99
+ userConfig?: DashboardUserConfig;
100
+ tasks?: DashboardTask[];
101
+ collaborators?: UserCTO[];
102
+ userFromUserName?: UserCTO | null;
103
+ nonogramKatanaItems?: NonogramKatanaItem[];
104
+ nonogramKatanaUpgrades?: NonogramKatanaUpgrade[];
105
+ }
106
+
107
+ /**
108
+ * The Digital Ocean function which handles all data requests for the
109
+ * dashboard project.
110
+ */
111
+ export default class ProjectDashboard extends DOFunction<
112
+ ProjectDashboardInput,
113
+ ProjectDashboardOutput
114
+ > {
115
+ private static instance: ProjectDashboard | undefined;
116
+
117
+ private constructor() {
118
+ super();
119
+ }
120
+
121
+ static getFunction(): ProjectDashboard {
122
+ if (!ProjectDashboard.instance) {
123
+ ProjectDashboard.instance = new ProjectDashboard();
124
+ }
125
+ return ProjectDashboard.instance;
126
+ }
127
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardConfig.d.ts","sourceRoot":"","sources":["../../src/types/DashboardConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,2BAA2B,EAAE,MAAM,CAAC;IACpC,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,4BAA4B,EAAE,MAAM,CAAC;QACrC,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"DashboardConfig.d.ts","sourceRoot":"./src/","sources":["types/DashboardConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,2BAA2B,EAAE,MAAM,CAAC;IACpC,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,4BAA4B,EAAE,MAAM,CAAC;QACrC,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=DashboardConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardConfig.js","sourceRoot":"./src/","sources":["types/DashboardConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The config for the dashboard project that is returned to every authenticated
3
+ * user inside that project.
4
+ */
5
+ export type DashboardConfig = {
6
+ projectDashboardFunctionUrl: string;
7
+ automationUrls: {
8
+ sunLight: string;
9
+ zoomLighting: string;
10
+ bedTimeButStillWatchingShows: string;
11
+ bedTime: string;
12
+ sunrise: string;
13
+ };
14
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Translations.d.ts","sourceRoot":"","sources":["../../src/types/Translations.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B"}
1
+ {"version":3,"file":"Translations.d.ts","sourceRoot":"./src/","sources":["types/Translations.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=Translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Translations.js","sourceRoot":"./src/","sources":["types/Translations.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * An individual translation as defined in the translations repo.
3
+ */
4
+ export type Translation = {
5
+ value: string;
6
+ description: string;
7
+ };
8
+
9
+ /**
10
+ * A collection of translations for a given project.
11
+ */
12
+ export interface Translations {
13
+ [key: string]: Translation;
14
+ }
package/package.json CHANGED
@@ -1,12 +1,33 @@
1
1
  {
2
2
  "name": "@aneuhold/core-ts-api-lib",
3
- "version": "1.0.119",
3
+ "author": "Anton G. Neuhold Jr.",
4
+ "license": "MIT",
5
+ "version": "2.0.0",
4
6
  "description": "A library for interacting with the backend and defining the backend API for personal projects.",
7
+ "packageManager": "yarn@4.5.1",
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "rimraf lib && tsc --project tsconfig.build.json && tsx ./scripts/copyTsFiles.ts",
11
+ "lint": "eslint",
12
+ "test": "vitest run",
13
+ "jsr:validate": "tb pkg validateJsr",
14
+ "checkAll": "yarn build && yarn lint && yarn test && yarn jsr:validate",
15
+ "jsr:publish": "tb pkg publishJsr",
16
+ "upgrade:core": "yarn up '@aneuhold/*'",
17
+ "upgrade:all": "yarn up"
18
+ },
5
19
  "main": "lib/index.js",
20
+ "module": "lib/index.js",
6
21
  "types": "lib/index.d.ts",
7
- "author": "Anton G Neuhold Jr <agneuhold@gmail.com>",
8
- "license": "MIT",
9
- "packageManager": "yarn@4.5.0",
22
+ "files": [
23
+ "lib/**/*"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./lib/index.d.ts",
28
+ "import": "./lib/index.js"
29
+ }
30
+ },
10
31
  "repository": {
11
32
  "type": "git",
12
33
  "url": "git+https://github.com/aneuhold/core-ts-api-lib.git"
@@ -15,26 +36,12 @@
15
36
  "url": "https://github.com/aneuhold/core-ts-api-lib/issues"
16
37
  },
17
38
  "homepage": "https://github.com/aneuhold/core-ts-api-lib#readme",
18
- "files": [
19
- "lib/**/*"
20
- ],
21
39
  "keywords": [
22
- "Scripting",
23
- "Node.js"
40
+ "API",
41
+ "Node.js",
42
+ "Database",
43
+ "TypeScript"
24
44
  ],
25
- "scripts": {
26
- "pushpub": "yarn build && npm version patch && git push",
27
- "build": "tsc",
28
- "watch": "tsc -w",
29
- "link:local": "cd lib && yarn link",
30
- "link:coredb": "yarn link @aneuhold/core-ts-db-lib",
31
- "unlink:local": "cd lib && yarn unlink",
32
- "unlink:coredb": "yarn unlink @aneuhold/core-ts-db-lib && yarn install --force",
33
- "upgrade:all": "yarn up",
34
- "upgrade:core": "yarn up '@aneuhold/*'",
35
- "test": "jest --passWithNoTests",
36
- "lint": "yarn eslint"
37
- },
38
45
  "dependencies": {
39
46
  "@aneuhold/core-ts-db-lib": "^2.0.4",
40
47
  "@aneuhold/core-ts-lib": "^2.0.6",
@@ -42,14 +49,14 @@
42
49
  },
43
50
  "devDependencies": {
44
51
  "@aneuhold/eslint-config": "^1.0.40",
45
- "@types/jest": "^29.5.13",
46
- "@types/node": "^20.16.10",
47
- "@types/node-fetch": "^2.6.11",
52
+ "@aneuhold/main-scripts": "^2.0.6",
53
+ "@types/node": "^20.17.1",
48
54
  "eslint": "^9.13.0",
49
- "jest": "^29.7.0",
55
+ "jsr": "^0.13.2",
50
56
  "prettier": "^3.3.3",
51
- "ts-jest": "^29.2.5",
52
- "ts-node": "^10.9.2",
53
- "typescript": "^5.6.2"
57
+ "rimraf": "^6.0.1",
58
+ "tsx": "^4.19.1",
59
+ "typescript": "^5.6.3",
60
+ "vitest": "^2.1.3"
54
61
  }
55
62
  }