@forge/response 0.1.1 → 0.1.2-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @forge/repsonse
2
2
 
3
+ ## 0.1.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - d1376d7: package re-release to correct missing files
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -11,7 +11,7 @@ By implementing this into the profile retriever function, if the input to the re
11
11
  ### Example
12
12
 
13
13
  ```
14
- import { AuthProfile } from '@forge/auth';
14
+ import { AuthProfile } from '@forge/response';
15
15
 
16
16
  export const retriever = (body: string) => {
17
17
  const externalProfile = JSON.parse(body);
@@ -0,0 +1,17 @@
1
+ export declare class AuthProfile {
2
+ private id;
3
+ private displayName;
4
+ private avatarUrl;
5
+ constructor(authProfile: {
6
+ id: string;
7
+ displayName: string;
8
+ avatarUrl?: string;
9
+ });
10
+ toJson(): {
11
+ id: string;
12
+ displayName: string;
13
+ avatarUrl?: string;
14
+ };
15
+ private parameterValidation;
16
+ }
17
+ //# sourceMappingURL=auth-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-profile.d.ts","sourceRoot":"","sources":["../src/auth-profile.ts"],"names":[],"mappings":"AAEA,qBAAa,WAAW;IACtB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAqB;gBAC1B,WAAW,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAczE,MAAM,IAAI;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAQxE,OAAO,CAAC,mBAAmB;CAQ5B"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthProfile = void 0;
4
+ const CHARACTER_LIMIT = 1042;
5
+ class AuthProfile {
6
+ constructor(authProfile) {
7
+ if (!authProfile || !authProfile.id || !authProfile.displayName) {
8
+ throw new Error(`Missing Value for one or more required fields: 'id', 'displayName'`);
9
+ }
10
+ this.parameterValidation('id', authProfile.id);
11
+ this.parameterValidation('displayName', authProfile.displayName);
12
+ if (authProfile.avatarUrl) {
13
+ this.parameterValidation('avatarUrl', authProfile.avatarUrl);
14
+ }
15
+ this.id = authProfile.id;
16
+ this.displayName = authProfile.displayName;
17
+ this.avatarUrl = authProfile.avatarUrl;
18
+ }
19
+ toJson() {
20
+ return Object.assign({ id: this.id, displayName: this.displayName }, (this.avatarUrl ? { avatarUrl: this.avatarUrl } : {}));
21
+ }
22
+ parameterValidation(fieldName, parameter) {
23
+ if (typeof parameter !== `string`) {
24
+ throw new Error(`The parameter ${fieldName} is an invalid type`);
25
+ }
26
+ if (parameter.length > CHARACTER_LIMIT) {
27
+ throw new Error(`The provided value for ${fieldName} is longer than the character limit of ${CHARACTER_LIMIT}`);
28
+ }
29
+ }
30
+ }
31
+ exports.AuthProfile = AuthProfile;
package/out/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { AuthProfile } from './auth-profile';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
package/out/index.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var auth_profile_1 = require("./auth-profile");
4
+ Object.defineProperty(exports, "AuthProfile", { enumerable: true, get: function () { return auth_profile_1.AuthProfile; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/response",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-next.0",
4
4
  "description": "Contains object to do validation of response objects at time of invocation",
5
5
  "main": "out/index.js",
6
6
  "license": "UNLICENSED",