@aneuhold/core-ts-api-lib 1.0.1

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Core TypeScript API Library
2
+
3
+ A core library for interacting with and defining the backend API for personal projects. This can be pulled in to any frontend or backend personal project.
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import DOFunctionService from './services/DOFunctionService/DOFunctionService';
2
+ import { AuthCheckPasswordInput, AuthCheckPasswordOutput, AuthCheckPasswordRawOutput } from './services/DOFunctionService/functions/authCheckPassword';
3
+ import { AuthValidateUserInput, AuthValidateUserOutput, AuthValidateUserRawOutput } from './services/DOFunctionService/functions/authValidateUser';
4
+ export { DOFunctionService };
5
+ export type { AuthCheckPasswordInput, AuthCheckPasswordOutput, AuthCheckPasswordRawOutput, AuthValidateUserInput, AuthValidateUserOutput, AuthValidateUserRawOutput };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,0DAA0D,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,yDAAyD,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAG7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EAC1B,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
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
+ exports.DOFunctionService = void 0;
7
+ const DOFunctionService_1 = __importDefault(require("./services/DOFunctionService/DOFunctionService"));
8
+ exports.DOFunctionService = DOFunctionService_1.default;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A service for making calls to the backend API for personal projects. This is
3
+ * abstracted so that the backend implementation can change over time.
4
+ */
5
+ export default class APIService {
6
+ }
7
+ //# sourceMappingURL=APIService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"APIService.d.ts","sourceRoot":"","sources":["../../../src/services/APIService/APIService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;CAAG"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * A service for making calls to the backend API for personal projects. This is
5
+ * abstracted so that the backend implementation can change over time.
6
+ */
7
+ class APIService {
8
+ }
9
+ exports.default = APIService;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The input to a Digital Ocean function must always be an object.
3
+ */
4
+ export type DOFunctionInput = object;
5
+ /**
6
+ * The output from a Digital Ocean function must always be an object. This
7
+ * is the data that actually matters and doesn't require parsing the `body`
8
+ * property.
9
+ */
10
+ export type DOFunctionOutput = object;
11
+ /**
12
+ * Raw output from a Digital Ocean function must always be an object with
13
+ * a body property. The body property must also be an object.
14
+ */
15
+ export interface DOFunctionRawOutput<TOutput extends DOFunctionOutput> {
16
+ /**
17
+ * The body is an object, which means it will automatically be serialized to
18
+ * JSON and the Content-Type header will be set to application/json.
19
+ */
20
+ body: TOutput;
21
+ }
22
+ /**
23
+ * Information about a Digital Ocean function.
24
+ */
25
+ export type DOFunctionInfo<TInput extends DOFunctionInput, TOutput extends DOFunctionOutput> = {
26
+ url: string;
27
+ call: (args: TInput) => Promise<TOutput>;
28
+ };
29
+ /**
30
+ * A service to provide some utility related to Digital Ocean functions.
31
+ */
32
+ export default class DOFunctionService {
33
+ static auchCheckPassword: DOFunctionInfo<import("./functions/authCheckPassword").AuthCheckPasswordInput, import("./functions/authCheckPassword").AuthCheckPasswordOutput>;
34
+ static authValidateUser: DOFunctionInfo<import("./functions/authValidateUser").AuthValidateUserInput, import("./functions/authValidateUser").AuthValidateUserOutput>;
35
+ }
36
+ //# sourceMappingURL=DOFunctionService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DOFunctionService.d.ts","sourceRoot":"","sources":["../../../src/services/DOFunctionService/DOFunctionService.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,gBAAgB;IACnE;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,CACxB,MAAM,SAAS,eAAe,EAC9B,OAAO,SAAS,gBAAgB,IAC9B;IACF,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,MAAM,CAAC,iBAAiB,kJAAqB;IAE7C,MAAM,CAAC,gBAAgB,8IAAoB;CAC5C"}
@@ -0,0 +1,15 @@
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("./functions/authCheckPassword"));
7
+ const authValidateUser_1 = __importDefault(require("./functions/authValidateUser"));
8
+ /**
9
+ * A service to provide some utility related to Digital Ocean functions.
10
+ */
11
+ class DOFunctionService {
12
+ static auchCheckPassword = authCheckPassword_1.default;
13
+ static authValidateUser = authValidateUser_1.default;
14
+ }
15
+ exports.default = DOFunctionService;
@@ -0,0 +1,13 @@
1
+ import { DOFunctionInfo, DOFunctionInput, DOFunctionOutput, DOFunctionRawOutput } from '../DOFunctionService';
2
+ export interface AuthCheckPasswordInput extends DOFunctionInput {
3
+ password: string;
4
+ }
5
+ export interface AuthCheckPasswordOutput extends DOFunctionOutput {
6
+ passwordIsCorrect: boolean;
7
+ }
8
+ export interface AuthCheckPasswordRawOutput extends DOFunctionRawOutput<AuthCheckPasswordOutput> {
9
+ body: AuthCheckPasswordOutput;
10
+ }
11
+ declare const authCheckPassword: DOFunctionInfo<AuthCheckPasswordInput, AuthCheckPasswordOutput>;
12
+ export default authCheckPassword;
13
+ //# sourceMappingURL=authCheckPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authCheckPassword.d.ts","sourceRoot":"","sources":["../../../../src/services/DOFunctionService/functions/authCheckPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AACD,MAAM,WAAW,0BACf,SAAQ,mBAAmB,CAAC,uBAAuB,CAAC;IACpD,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED,QAAA,MAAM,iBAAiB,EAAE,cAAc,CACrC,sBAAsB,EACtB,uBAAuB,CAcxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const authCheckPassword = {
4
+ url: 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword',
5
+ call: async (input) => {
6
+ const result = await fetch(`${authCheckPassword.url}`, {
7
+ method: 'POST',
8
+ headers: {
9
+ 'Content-Type': 'application/json'
10
+ },
11
+ body: JSON.stringify(input)
12
+ });
13
+ const json = (await result.json());
14
+ return json;
15
+ }
16
+ };
17
+ exports.default = authCheckPassword;
@@ -0,0 +1,19 @@
1
+ import { ApiKey, User } from '@aneuhold/core-ts-db-lib';
2
+ import { DOFunctionInfo, DOFunctionInput, DOFunctionOutput, DOFunctionRawOutput } from '../DOFunctionService';
3
+ export interface AuthValidateUserInput extends DOFunctionInput {
4
+ userName: string;
5
+ password: string;
6
+ }
7
+ export interface AuthValidateUserOutput extends DOFunctionOutput {
8
+ success: boolean;
9
+ userInfo?: {
10
+ user: User;
11
+ apiKey: ApiKey;
12
+ };
13
+ }
14
+ export interface AuthValidateUserRawOutput extends DOFunctionRawOutput<AuthValidateUserOutput> {
15
+ body: AuthValidateUserOutput;
16
+ }
17
+ declare const authValidateUser: DOFunctionInfo<AuthValidateUserInput, AuthValidateUserOutput>;
18
+ export default authValidateUser;
19
+ //# sourceMappingURL=authValidateUser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authValidateUser.d.ts","sourceRoot":"","sources":["../../../../src/services/DOFunctionService/functions/authValidateUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,IAAI,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AACD,MAAM,WAAW,yBACf,SAAQ,mBAAmB,CAAC,sBAAsB,CAAC;IACnD,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,QAAA,MAAM,gBAAgB,EAAE,cAAc,CACpC,qBAAqB,EACrB,sBAAsB,CAcvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const authValidateUser = {
4
+ url: 'TBD',
5
+ call: async (input) => {
6
+ const result = await fetch(`${authValidateUser.url}`, {
7
+ method: 'POST',
8
+ headers: {
9
+ 'Content-Type': 'application/json'
10
+ },
11
+ body: JSON.stringify(input)
12
+ });
13
+ const json = (await result.json());
14
+ return json;
15
+ }
16
+ };
17
+ exports.default = authValidateUser;
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@aneuhold/core-ts-api-lib",
3
+ "version": "1.0.1",
4
+ "description": "A library for interacting with the backend and defining the backend API for personal projects.",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "author": "Anton G Neuhold Jr <agneuhold@gmail.com>",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/aneuhold/core-ts-api-lib.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/aneuhold/core-ts-api-lib/issues"
15
+ },
16
+ "homepage": "https://github.com/aneuhold/core-ts-api-lib#readme",
17
+ "files": [
18
+ "lib/**/*"
19
+ ],
20
+ "keywords": [
21
+ "Scripting",
22
+ "Node.js"
23
+ ],
24
+ "scripts": {
25
+ "pushpub": "npm run build && npm version patch && git push && npm publish --access public",
26
+ "build": "tsc",
27
+ "watch": "tsc -w",
28
+ "link:local": "cd lib && yarn link",
29
+ "link:coredb": "yarn link @aneuhold/core-ts-db-lib",
30
+ "unlink:local": "cd lib && yarn unlink",
31
+ "unlink:coredb": "yarn unlink @aneuhold/core-ts-db-lib && yarn install --force",
32
+ "upgrade:all": "yarn upgrade --latest",
33
+ "upgrade:core": "yarn upgrade --latest --pattern @aneuhold",
34
+ "test": "jest"
35
+ },
36
+ "dependencies": {
37
+ "@aneuhold/core-ts-db-lib": "^1.0.3",
38
+ "@aneuhold/core-ts-lib": "^1.1.7"
39
+ },
40
+ "devDependencies": {
41
+ "@types/jest": "^29.5.8",
42
+ "@types/node": "^20.10.4",
43
+ "@types/node-fetch": "^2.6.9",
44
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
45
+ "@typescript-eslint/parser": "^6.14.0",
46
+ "eslint": "^8.35.0",
47
+ "eslint-config-airbnb-base": "^15.0.0",
48
+ "eslint-config-prettier": "^9.1.0",
49
+ "eslint-plugin-import": "^2.22.1",
50
+ "eslint-plugin-prettier": "^5.0.1",
51
+ "jest": "^29.7.0",
52
+ "prettier": "^3.1.1",
53
+ "ts-jest": "^29.1.1",
54
+ "ts-node": "^10.2.1",
55
+ "typescript": "^5.3.3"
56
+ }
57
+ }