@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 +6 -0
- package/README.md +1 -1
- package/out/auth-profile.d.ts +17 -0
- package/out/auth-profile.d.ts.map +1 -0
- package/out/auth-profile.js +31 -0
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -0
- package/out/index.js +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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/
|
|
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 @@
|
|
|
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