@gooddata/api-client-tiger 11.58.0-alpha.2 → 11.58.0-alpha.4
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/profile.js +5 -6
- package/esm/profile.test.d.ts +2 -0
- package/esm/profile.test.d.ts.map +1 -0
- package/esm/profile.test.js +48 -0
- package/package.json +4 -4
package/esm/__version.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "11.58.0-alpha.
|
|
1
|
+
export declare const LIB_VERSION = "11.58.0-alpha.4";
|
|
2
2
|
export declare const LIB_DESCRIPTION = "API Client for GoodData Cloud and GoodData.CN";
|
|
3
3
|
export declare const LIB_NAME = "@gooddata/api-client-tiger";
|
|
4
4
|
//# sourceMappingURL=__version.d.ts.map
|
package/esm/__version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// (C) 2021 GoodData Corporation
|
|
2
2
|
// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD
|
|
3
|
-
export const LIB_VERSION = "11.58.0-alpha.
|
|
3
|
+
export const LIB_VERSION = "11.58.0-alpha.4";
|
|
4
4
|
export const LIB_DESCRIPTION = "API Client for GoodData Cloud and GoodData.CN";
|
|
5
5
|
export const LIB_NAME = "@gooddata/api-client-tiger";
|
package/esm/profile.js
CHANGED
|
@@ -50,13 +50,12 @@ async function getUserDetails(axios, id) {
|
|
|
50
50
|
const firstName = user.data.attributes?.firstname;
|
|
51
51
|
const lastName = user.data.attributes?.lastname;
|
|
52
52
|
const email = user.data.attributes?.email;
|
|
53
|
+
const name = [firstName, lastName].filter(Boolean).join(" ");
|
|
53
54
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
lastName,
|
|
59
|
-
}),
|
|
55
|
+
// A user with neither name part keeps whatever name the profile already carried.
|
|
56
|
+
...(name && { name }),
|
|
57
|
+
...(firstName && { firstName }),
|
|
58
|
+
...(lastName && { lastName }),
|
|
60
59
|
...(email && {
|
|
61
60
|
email,
|
|
62
61
|
}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.test.d.ts","sourceRoot":"","sources":["../src/profile.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ProfileApi_GetCurrentWithDetails } from "./profile.js";
|
|
4
|
+
const USER_ID = "0a294638-514d-4148-acdb-b7d6176d20d7";
|
|
5
|
+
// Whatever the auth provider supplied; it need not be a person's name.
|
|
6
|
+
const AUTH_NAME = "auth-provider-name";
|
|
7
|
+
// The bare profile carries no name parts and no email, so the entity read is the only source of
|
|
8
|
+
// either; its name is whatever the auth provider supplied, which need not be a person's name.
|
|
9
|
+
function axiosOf(attributes) {
|
|
10
|
+
return {
|
|
11
|
+
get: async () => ({ data: { userId: USER_ID, name: AUTH_NAME }, headers: {} }),
|
|
12
|
+
request: async () => ({
|
|
13
|
+
data: { data: { id: USER_ID, type: "user", attributes } },
|
|
14
|
+
headers: {},
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const profileOf = (attributes) => ProfileApi_GetCurrentWithDetails(axiosOf(attributes));
|
|
19
|
+
describe("ProfileApi_GetCurrentWithDetails", () => {
|
|
20
|
+
it("names a user from both of their name parts", async () => {
|
|
21
|
+
await expect(profileOf({ firstname: "My", lastname: "Duong" })).resolves.toMatchObject({
|
|
22
|
+
name: "My Duong",
|
|
23
|
+
firstName: "My",
|
|
24
|
+
lastName: "Duong",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
it("names a user who has only a first name", async () => {
|
|
28
|
+
await expect(profileOf({ firstname: "My" })).resolves.toMatchObject({
|
|
29
|
+
name: "My",
|
|
30
|
+
firstName: "My",
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
it("names a user who has only a last name", async () => {
|
|
34
|
+
await expect(profileOf({ lastname: "Duong" })).resolves.toMatchObject({
|
|
35
|
+
name: "Duong",
|
|
36
|
+
lastName: "Duong",
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it("leaves the profile's own name alone for a user with neither name part", async () => {
|
|
40
|
+
await expect(profileOf({ email: "my.duong@acme.test" })).resolves.toMatchObject({
|
|
41
|
+
name: AUTH_NAME,
|
|
42
|
+
email: "my.duong@acme.test",
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
it("carries the email of a user who also has a name", async () => {
|
|
46
|
+
await expect(profileOf({ firstname: "My", lastname: "Duong", email: "my.duong@acme.test" })).resolves.toMatchObject({ name: "My Duong", email: "my.duong@acme.test" });
|
|
47
|
+
});
|
|
48
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/api-client-tiger",
|
|
3
|
-
"version": "11.58.0-alpha.
|
|
3
|
+
"version": "11.58.0-alpha.4",
|
|
4
4
|
"description": "API Client for GoodData Cloud and GoodData.CN",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"axios-cache-interceptor": "1.12.0",
|
|
47
47
|
"lodash-es": "^4.17.23",
|
|
48
48
|
"tslib": "2.8.1",
|
|
49
|
-
"@gooddata/sdk-model": "11.58.0-alpha.
|
|
49
|
+
"@gooddata/sdk-model": "11.58.0-alpha.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@microsoft/api-documenter": "7.30.10",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"oxlint-tsgolint": "7.0.2001",
|
|
74
74
|
"typescript": "7.0.2",
|
|
75
75
|
"vitest": "4.1.11",
|
|
76
|
-
"@gooddata/oxlint-config": "11.58.0-alpha.
|
|
77
|
-
"@gooddata/eslint-config": "11.58.0-alpha.
|
|
76
|
+
"@gooddata/oxlint-config": "11.58.0-alpha.4",
|
|
77
|
+
"@gooddata/eslint-config": "11.58.0-alpha.4"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"_phase:build": "npm run build",
|