@aneuhold/core-ts-lib 1.0.15 → 1.0.17

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/index.d.ts CHANGED
@@ -7,9 +7,11 @@ import ITermService from './services/applications/ITermService';
7
7
  import CLIService from './services/CLIService';
8
8
  import ConfigService from './services/ConfigService/ConfigService';
9
9
  import DependencyService from './services/DependencyService';
10
- import DOFunctionService from './services/DOFunctionService';
10
+ import DOFunctionService, { DOFunction } from './services/DOFunctionService/DOFunctionService';
11
+ import { DOAuthCheckPasswordInput, DOAuthCheckPasswordOutput, DOAuthCheckPasswordRawOutput } from './services/DOFunctionService/functionsInfo/authCheckPassword';
11
12
  import StringService from './services/StringService';
12
13
  import CurrentEnv, { OperatingSystemType, ShellType, TerminalType } from './utils/CurrentEnv';
13
14
  import Logger from './utils/Logger';
14
15
  export { CLIService, StringService, CurrentEnv, ChromeService, DockerService, FileSystemService, sleep, OperatingSystemType, ShellType, Logger, TerminalType, datesAreOnSameDay, ITermService, ConfigService, DOFunctionService, DependencyService };
16
+ export type { DOAuthCheckPasswordRawOutput, DOAuthCheckPasswordInput, DOAuthCheckPasswordOutput, DOFunction };
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,iBAAiB,MAAM,6DAA6D,CAAC;AAC5F,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,iBAAiB,MAAM,8BAA8B,CAAC;AAC7D,OAAO,iBA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KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EAClB,CAAC;AAGF,YAAY,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACX,CAAC"}
package/lib/index.js CHANGED
@@ -45,7 +45,7 @@ const ConfigService_1 = __importDefault(require("./services/ConfigService/Config
45
45
  exports.ConfigService = ConfigService_1.default;
46
46
  const DependencyService_1 = __importDefault(require("./services/DependencyService"));
47
47
  exports.DependencyService = DependencyService_1.default;
48
- const DOFunctionService_1 = __importDefault(require("./services/DOFunctionService"));
48
+ const DOFunctionService_1 = __importDefault(require("./services/DOFunctionService/DOFunctionService"));
49
49
  exports.DOFunctionService = DOFunctionService_1.default;
50
50
  const StringService_1 = __importDefault(require("./services/StringService"));
51
51
  exports.StringService = StringService_1.default;
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=DOAuthCheckPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DOAuthCheckPassword.d.ts","sourceRoot":"","sources":["../../../src/services/DOFunctionService/DOAuthCheckPassword.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,46 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,19 @@
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;
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=DOAuthCheckPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DOAuthCheckPassword.d.ts","sourceRoot":"","sources":["../../../../src/services/DOFunctionService/functions/DOAuthCheckPassword.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# 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":""}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,21 @@
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,6 +1,32 @@
1
1
  /**
2
- * A service to provide some utility common to multiple Digital Ocean functions.
2
+ * Output from a Digital Ocean function must always be an object.
3
+ */
4
+ export type DOFunctionOutput<TOutput extends object> = {
5
+ /**
6
+ * The body is an object, which means it will automatically be serialized to
7
+ * JSON and the Content-Type header will be set to application/json.
8
+ */
9
+ body: TOutput;
10
+ };
11
+ export declare const DOFunctionsInfo: {
12
+ authCheckPassword: {
13
+ url: string;
14
+ method: string;
15
+ };
16
+ };
17
+ declare abstract class DOFunction<TInput extends object, TOutput extends object> {
18
+ abstract url: string;
19
+ abstract method: 'GET' | 'POST';
20
+ abstract call: (args: TInput) => Promise<DOFunctionOutput<TOutput>>;
21
+ }
22
+ interface DOFunction<TInput extends object, TOutput> implements DOFunctionOutput {
23
+ }
24
+ export type DOFunctions = keyof typeof DOFunctionsInfo;
25
+ /**
26
+ * A service to provide some utility realted to Digital Ocean functions.
3
27
  */
4
28
  export default class DOFunctionService {
29
+ static call(functionName: DOFunction): any;
5
30
  }
31
+ export {};
6
32
  //# sourceMappingURL=DOFunctionService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DOFunctionService.d.ts","sourceRoot":"","sources":["../../src/services/DOFunctionService.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;CAAG"}
1
+ {"version":3,"file":"DOFunctionService.d.ts","sourceRoot":"","sources":["../../src/services/DOFunctionService.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,MAAM,IAAI;IACrD;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;CAK3B,CAAA;AAED,uBAAe,UAAU,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM;IACrE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;CACrE;AAYD,UAAU,UAAU,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,CAAC,YAAW,gBAAgB;CAAA;AAM/E,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;WACvB,IAAI,CAAC,YAAY,EAAE,UAAU;CAC3C"}
@@ -1,7 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DOFunctionsInfo = void 0;
4
+ exports.DOFunctionsInfo = {
5
+ authCheckPassword: {
6
+ url: 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword',
7
+ method: 'POST'
8
+ }
9
+ };
10
+ class DOFunction {
11
+ }
12
+ class DOAuthCheckPassword extends DOFunction {
13
+ url = 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword';
14
+ method = 'POST';
15
+ call(args) {
16
+ }
17
+ }
18
+ (args);
19
+ then((response) => response.json());
20
+ > {
21
+ url: string,
22
+ method: 'GET' | 'POST',
23
+ call: (args) => Promise
24
+ };
3
25
  /**
4
- * A service to provide some utility common to multiple Digital Ocean functions.
26
+ * A service to provide some utility realted to Digital Ocean functions.
5
27
  */
6
28
  class DOFunctionService {
7
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aneuhold/core-ts-lib",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
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",
@@ -33,11 +33,13 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "dotenv": "^16.3.1",
36
+ "node-fetch": "^2",
36
37
  "octokit": "^3.1.2"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@types/jest": "^29.5.8",
40
41
  "@types/node": "^18.15.0",
42
+ "@types/node-fetch": "^2.6.9",
41
43
  "@typescript-eslint/eslint-plugin": "^5.54.1",
42
44
  "@typescript-eslint/parser": "^5.54.1",
43
45
  "eslint": "^8.35.0",