@aneuhold/core-ts-api-lib 1.0.4 → 1.0.6

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 (24) hide show
  1. package/lib/index.d.ts +6 -3
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/services/APIService/APIService.d.ts +7 -0
  4. package/lib/services/APIService/APIService.d.ts.map +1 -1
  5. package/lib/services/APIService/APIService.js +11 -0
  6. package/lib/services/DOFunctionService/DOFunction.d.ts +39 -0
  7. package/lib/services/DOFunctionService/DOFunction.d.ts.map +1 -0
  8. package/lib/services/DOFunctionService/DOFunction.js +37 -0
  9. package/lib/services/DOFunctionService/DOFunctionService.d.ts +6 -30
  10. package/lib/services/DOFunctionService/DOFunctionService.d.ts.map +1 -1
  11. package/lib/services/DOFunctionService/DOFunctionService.js +4 -2
  12. package/lib/services/DOFunctionService/functions/authCheckPassword.d.ts +5 -5
  13. package/lib/services/DOFunctionService/functions/authCheckPassword.d.ts.map +1 -1
  14. package/lib/services/DOFunctionService/functions/authCheckPassword.js +18 -14
  15. package/lib/services/DOFunctionService/functions/authValidateUser.d.ts +12 -5
  16. package/lib/services/DOFunctionService/functions/authValidateUser.d.ts.map +1 -1
  17. package/lib/services/DOFunctionService/functions/authValidateUser.js +18 -14
  18. package/lib/services/DOFunctionService/functions/projectDashboard.d.ts +37 -0
  19. package/lib/services/DOFunctionService/functions/projectDashboard.d.ts.map +1 -0
  20. package/lib/services/DOFunctionService/functions/projectDashboard.js +23 -0
  21. package/lib/types/DashboardConfig.d.ts +8 -0
  22. package/lib/types/DashboardConfig.d.ts.map +1 -0
  23. package/lib/types/DashboardConfig.js +2 -0
  24. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import APIService from './services/APIService/APIService';
2
+ import { DOFunctionRawOutput } from './services/DOFunctionService/DOFunction';
2
3
  import DOFunctionService from './services/DOFunctionService/DOFunctionService';
3
- import { AuthCheckPasswordInput, AuthCheckPasswordOutput, AuthCheckPasswordRawOutput } from './services/DOFunctionService/functions/authCheckPassword';
4
- import { AuthValidateUserInput, AuthValidateUserOutput, AuthValidateUserRawOutput } from './services/DOFunctionService/functions/authValidateUser';
4
+ import { AuthCheckPasswordInput, AuthCheckPasswordOutput } from './services/DOFunctionService/functions/authCheckPassword';
5
+ import { AuthValidateUserInput, AuthValidateUserOutput } from './services/DOFunctionService/functions/authValidateUser';
6
+ import { ProjectDashboardInput, ProjectDashboardOptions, ProjectDashboardOutput } from './services/DOFunctionService/functions/projectDashboard';
7
+ import { DashboardConfig } from './types/DashboardConfig';
5
8
  import { Translation, Translations } from './types/Translations';
6
9
  export { DOFunctionService, APIService };
7
- export type { AuthCheckPasswordInput, AuthCheckPasswordOutput, AuthCheckPasswordRawOutput, AuthValidateUserInput, AuthValidateUserOutput, AuthValidateUserRawOutput, Translations, Translation };
10
+ export type { DOFunctionRawOutput, AuthCheckPasswordInput, AuthCheckPasswordOutput, AuthValidateUserInput, AuthValidateUserOutput, ProjectDashboardInput, ProjectDashboardOutput, ProjectDashboardOptions, DashboardConfig, Translations, Translation };
8
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,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;AACjE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAGzC,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACZ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,iBAAiB,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,0DAA0D,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAGzC,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,WAAW,EACZ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { AuthValidateUserInput } from '../DOFunctionService/functions/authValidateUser';
2
+ import { ProjectDashboardInput } from '../DOFunctionService/functions/projectDashboard';
2
3
  /**
3
4
  * A service for making calls to the backend API for personal projects. This is
4
5
  * abstracted so that the backend implementation can change over time.
@@ -9,5 +10,11 @@ export default class APIService {
9
10
  * returns the user's information if successful.
10
11
  */
11
12
  static validateUser(input: AuthValidateUserInput): Promise<import("../DOFunctionService/functions/authValidateUser").AuthValidateUserOutput>;
13
+ static setDashboardAPIUrl(url: string): void;
14
+ /**
15
+ * Calls the dashboard API and returns the result. This will fail if the
16
+ * dashboard API URL has not been set. See {@link setDashboardAPIUrl}.
17
+ */
18
+ static callDashboardAPI(input: ProjectDashboardInput): Promise<import("../DOFunctionService/functions/projectDashboard").ProjectDashboardOutput>;
12
19
  }
13
20
  //# sourceMappingURL=APIService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"APIService.d.ts","sourceRoot":"","sources":["../../../src/services/APIService/APIService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAExF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;OAGG;WACU,YAAY,CAAC,KAAK,EAAE,qBAAqB;CAIvD"}
1
+ {"version":3,"file":"APIService.d.ts","sourceRoot":"","sources":["../../../src/services/APIService/APIService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAExF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;OAGG;WACU,YAAY,CAAC,KAAK,EAAE,qBAAqB;IAKtD,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM;IAIrC;;;OAGG;WACU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB;CAI3D"}
@@ -17,5 +17,16 @@ class APIService {
17
17
  const result = await DOFunctionService_1.default.authValidateUser.call(input);
18
18
  return result;
19
19
  }
20
+ static setDashboardAPIUrl(url) {
21
+ DOFunctionService_1.default.projectDashboard.setUrl(url);
22
+ }
23
+ /**
24
+ * Calls the dashboard API and returns the result. This will fail if the
25
+ * dashboard API URL has not been set. See {@link setDashboardAPIUrl}.
26
+ */
27
+ static async callDashboardAPI(input) {
28
+ const result = await DOFunctionService_1.default.projectDashboard.call(input);
29
+ return result;
30
+ }
20
31
  }
21
32
  exports.default = APIService;
@@ -0,0 +1,39 @@
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
+ * An abstract class that can be extended to define a Digital Ocean
24
+ * function.
25
+ */
26
+ export default abstract class DOFunction<TInput extends DOFunctionInput, TOutput extends DOFunctionOutput> {
27
+ /**
28
+ * The URL of the digital ocean function.
29
+ */
30
+ protected url?: string;
31
+ protected functionName: string;
32
+ protected constructor();
33
+ setUrl(url: string): void;
34
+ /**
35
+ * A generic call method for any digital ocean function.
36
+ */
37
+ call(input: TInput): Promise<TOutput>;
38
+ }
39
+ //# sourceMappingURL=DOFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DOFunction.d.ts","sourceRoot":"","sources":["../../../src/services/DOFunctionService/DOFunction.ts"],"names":[],"mappings":"AAAA;;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;;;GAGG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,UAAU,CACtC,MAAM,SAAS,eAAe,EAC9B,OAAO,SAAS,gBAAgB;IAEhC;;OAEG;IACH,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAE/B,SAAS;IAIT,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAc5C"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * An abstract class that can be extended to define a Digital Ocean
5
+ * function.
6
+ */
7
+ class DOFunction {
8
+ /**
9
+ * The URL of the digital ocean function.
10
+ */
11
+ url;
12
+ functionName;
13
+ constructor() {
14
+ this.functionName = this.constructor.name;
15
+ }
16
+ setUrl(url) {
17
+ this.url = url;
18
+ }
19
+ /**
20
+ * A generic call method for any digital ocean function.
21
+ */
22
+ async call(input) {
23
+ if (!this.url) {
24
+ throw new Error(`${this.functionName} URL is not set`);
25
+ }
26
+ const result = await fetch(`${this.url}`, {
27
+ method: 'POST',
28
+ headers: {
29
+ 'Content-Type': 'application/json'
30
+ },
31
+ body: JSON.stringify(input)
32
+ });
33
+ const json = (await result.json());
34
+ return json.body;
35
+ }
36
+ }
37
+ exports.default = DOFunction;
@@ -1,36 +1,12 @@
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
- };
1
+ import AuthCheckPassword from './functions/authCheckPassword';
2
+ import AuthValidateUser from './functions/authValidateUser';
3
+ import ProjectDashboard from './functions/projectDashboard';
29
4
  /**
30
5
  * A service to provide some utility related to Digital Ocean functions.
31
6
  */
32
7
  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>;
8
+ static auchCheckPassword: AuthCheckPassword;
9
+ static authValidateUser: AuthValidateUser;
10
+ static projectDashboard: ProjectDashboard;
35
11
  }
36
12
  //# sourceMappingURL=DOFunctionService.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"DOFunctionService.d.ts","sourceRoot":"","sources":["../../../src/services/DOFunctionService/DOFunctionService.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAC9D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,MAAM,CAAC,iBAAiB,oBAAmC;IAE3D,MAAM,CAAC,gBAAgB,mBAAkC;IAEzD,MAAM,CAAC,gBAAgB,mBAAkC;CAC1D"}
@@ -5,11 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const authCheckPassword_1 = __importDefault(require("./functions/authCheckPassword"));
7
7
  const authValidateUser_1 = __importDefault(require("./functions/authValidateUser"));
8
+ const projectDashboard_1 = __importDefault(require("./functions/projectDashboard"));
8
9
  /**
9
10
  * A service to provide some utility related to Digital Ocean functions.
10
11
  */
11
12
  class DOFunctionService {
12
- static auchCheckPassword = authCheckPassword_1.default;
13
- static authValidateUser = authValidateUser_1.default;
13
+ static auchCheckPassword = authCheckPassword_1.default.getFunction();
14
+ static authValidateUser = authValidateUser_1.default.getFunction();
15
+ static projectDashboard = projectDashboard_1.default.getFunction();
14
16
  }
15
17
  exports.default = DOFunctionService;
@@ -1,13 +1,13 @@
1
- import { DOFunctionInfo, DOFunctionInput, DOFunctionOutput, DOFunctionRawOutput } from '../DOFunctionService';
1
+ import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction';
2
2
  export interface AuthCheckPasswordInput extends DOFunctionInput {
3
3
  password: string;
4
4
  }
5
5
  export interface AuthCheckPasswordOutput extends DOFunctionOutput {
6
6
  passwordIsCorrect: boolean;
7
7
  }
8
- export interface AuthCheckPasswordRawOutput extends DOFunctionRawOutput<AuthCheckPasswordOutput> {
9
- body: AuthCheckPasswordOutput;
8
+ export default class AuthCheckPassword extends DOFunction<AuthCheckPasswordInput, AuthCheckPasswordOutput> {
9
+ private static instance;
10
+ private constructor();
11
+ static getFunction(): AuthCheckPassword;
10
12
  }
11
- declare const authCheckPassword: DOFunctionInfo<AuthCheckPasswordInput, AuthCheckPasswordOutput>;
12
- export default authCheckPassword;
13
13
  //# sourceMappingURL=authCheckPassword.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"authCheckPassword.d.ts","sourceRoot":"","sources":["../../../../src/services/DOFunctionService/functions/authCheckPassword.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU,CACvD,sBAAsB,EACtB,uBAAuB,CACxB;IACC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoB;IAE3C,OAAO;IAMP,MAAM,CAAC,WAAW;CAMnB"}
@@ -1,17 +1,21 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  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;
6
+ const DOFunction_1 = __importDefault(require("../DOFunction"));
7
+ class AuthCheckPassword extends DOFunction_1.default {
8
+ static instance;
9
+ constructor() {
10
+ super();
11
+ this.url =
12
+ 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/checkPassword';
15
13
  }
16
- };
17
- exports.default = authCheckPassword;
14
+ static getFunction() {
15
+ if (!this.instance) {
16
+ AuthCheckPassword.instance = new AuthCheckPassword();
17
+ }
18
+ return AuthCheckPassword.instance;
19
+ }
20
+ }
21
+ exports.default = AuthCheckPassword;
@@ -1,5 +1,6 @@
1
1
  import { ApiKey, User } from '@aneuhold/core-ts-db-lib';
2
- import { DOFunctionInfo, DOFunctionInput, DOFunctionOutput, DOFunctionRawOutput } from '../DOFunctionService';
2
+ import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction';
3
+ import { DashboardConfig } from '../../../types/DashboardConfig';
3
4
  export interface AuthValidateUserInput extends DOFunctionInput {
4
5
  userName: string;
5
6
  password: string;
@@ -10,10 +11,16 @@ export interface AuthValidateUserOutput extends DOFunctionOutput {
10
11
  user: User;
11
12
  apiKey: ApiKey;
12
13
  };
14
+ /**
15
+ * Basic configuration for the projects that the user has access to.
16
+ */
17
+ config?: {
18
+ dashboard?: DashboardConfig;
19
+ };
13
20
  }
14
- export interface AuthValidateUserRawOutput extends DOFunctionRawOutput<AuthValidateUserOutput> {
15
- body: AuthValidateUserOutput;
21
+ export default class AuthValidateUser extends DOFunction<AuthValidateUserInput, AuthValidateUserOutput> {
22
+ private static instance;
23
+ private constructor();
24
+ static getFunction(): AuthValidateUser;
16
25
  }
17
- declare const authValidateUser: DOFunctionInfo<AuthValidateUserInput, AuthValidateUserOutput>;
18
- export default authValidateUser;
19
26
  //# sourceMappingURL=authValidateUser.d.ts.map
@@ -1 +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"}
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,UAAU,EAAE,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,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;IACF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,eAAe,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CACtD,qBAAqB,EACrB,sBAAsB,CACvB;IACC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmB;IAE1C,OAAO;IAMP,MAAM,CAAC,WAAW;CAMnB"}
@@ -1,17 +1,21 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const authValidateUser = {
4
- url: 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/validateUser',
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;
6
+ const DOFunction_1 = __importDefault(require("../DOFunction"));
7
+ class AuthValidateUser extends DOFunction_1.default {
8
+ static instance;
9
+ constructor() {
10
+ super();
11
+ this.url =
12
+ 'https://faas-sfo3-7872a1dd.doserverless.co/api/v1/web/fn-66dd3ef6-c21d-46dc-b7ae-caf2ac8041ec/auth/validateUser';
15
13
  }
16
- };
17
- exports.default = authValidateUser;
14
+ static getFunction() {
15
+ if (!this.instance) {
16
+ AuthValidateUser.instance = new AuthValidateUser();
17
+ }
18
+ return AuthValidateUser.instance;
19
+ }
20
+ }
21
+ exports.default = AuthValidateUser;
@@ -0,0 +1,37 @@
1
+ /// <reference types="node" />
2
+ import { UUID } from 'crypto';
3
+ import { Translations } from '../../../types/Translations';
4
+ import DOFunction, { DOFunctionInput, DOFunctionOutput } from '../DOFunction';
5
+ export interface ProjectDashboardOptions {
6
+ get?: {
7
+ translations?: boolean;
8
+ userConfig?: boolean;
9
+ };
10
+ update?: {
11
+ placeholder?: boolean;
12
+ };
13
+ delete?: {
14
+ placeholder?: boolean;
15
+ };
16
+ }
17
+ export interface ProjectDashboardInput extends DOFunctionInput {
18
+ apiKey: UUID;
19
+ options: ProjectDashboardOptions;
20
+ }
21
+ export interface ProjectDashboardOutput extends DOFunctionOutput {
22
+ success: boolean;
23
+ data: {
24
+ translations?: Translations;
25
+ userConfig?: object;
26
+ };
27
+ }
28
+ /**
29
+ * The Digital Ocean function which handles all data requests for the
30
+ * dashboard project.
31
+ */
32
+ export default class ProjectDashboard extends DOFunction<ProjectDashboardInput, ProjectDashboardOutput> {
33
+ private static instance;
34
+ private constructor();
35
+ static getFunction(): ProjectDashboard;
36
+ }
37
+ //# sourceMappingURL=projectDashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectDashboard.d.ts","sourceRoot":"","sources":["../../../../src/services/DOFunctionService/functions/projectDashboard.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE;QACJ,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,YAAY,CAAC,EAAE,YAAY,CAAC;QAE5B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CACtD,qBAAqB,EACrB,sBAAsB,CACvB;IACC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmB;IAE1C,OAAO;IAIP,MAAM,CAAC,WAAW;CAMnB"}
@@ -0,0 +1,23 @@
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 DOFunction_1 = __importDefault(require("../DOFunction"));
7
+ /**
8
+ * The Digital Ocean function which handles all data requests for the
9
+ * dashboard project.
10
+ */
11
+ class ProjectDashboard extends DOFunction_1.default {
12
+ static instance;
13
+ constructor() {
14
+ super();
15
+ }
16
+ static getFunction() {
17
+ if (!this.instance) {
18
+ ProjectDashboard.instance = new ProjectDashboard();
19
+ }
20
+ return ProjectDashboard.instance;
21
+ }
22
+ }
23
+ exports.default = ProjectDashboard;
@@ -0,0 +1,8 @@
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
+ };
8
+ //# sourceMappingURL=DashboardConfig.d.ts.map
@@ -0,0 +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;CACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aneuhold/core-ts-api-lib",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A library for interacting with the backend and defining the backend API for personal projects.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",